blob: 95a58318286fb9abc1e0c3c432afc8017739b650 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
// Top-level comments are attached to the syntax directive.
syntax = "proto3";
import "google/protobuf/any.proto";
import "google/protobuf/timestamp.proto";
import "extend.proto";
import public "todo_import.proto";
option go_package = "todo";
// The official documentation for the Todo API.
//
// Some parts of this file are unnecessarily complicated. In order to have a test for nested messages, enums, etc. I've
// added some odd looking implementation details. So you know, don't use this in real life for a todo service.
//
// The get started run the following:
//
// * `make setup`
// * `make test`
package com.pseudomuto.protokit.v1;
option (com.pseudomuto.protokit.v1.extend_file) = true;
// A service for managing "todo" items.
//
// Add, complete, and remove your items on your todo lists.
service Todo {
option (com.pseudomuto.protokit.v1.extend_service) = true;
// Create a new todo list
rpc CreateList(CreateListRequest) returns (CreateListResponse) {
option (com.pseudomuto.protokit.v1.extend_method) = true;
}
// Add an item to your list
//
// Adds a new item to the specified list.
rpc AddItem(AddItemRequest) returns (AddItemResponse);
}
// An enumeration of list types
enum ListType {
option (com.pseudomuto.protokit.v1.extend_enum) = true;
REMINDERS = 0; // The reminders type.
CHECKLIST = 1 [(com.pseudomuto.protokit.v1.extend_enum_value) = true]; // The checklist type.
}
// A list object.
message List {
option (com.pseudomuto.protokit.v1.extend_message) = true;
int64 id = 1; // The id of the list.
string name = 2 [(com.pseudomuto.protokit.v1.extend_field) = true]; // The name of the list.
ListType type = 3; // The type of list
google.protobuf.Timestamp created_at = 4; // The timestamp for creation.
google.protobuf.Any details = 5; // Some arbitrary list details.
}
// A request object for creating todo lists.
message CreateListRequest {
// The name of the list.
string name = 1;
}
// A successfully created list response.
message CreateListResponse {
// An internal status message
message Status {
sint32 code = 1; // The status code.
}
List list = 1; // The list that was created.
Status status = 2; // The status for the response.
}
// A list item
message Item {
// An enumeration of possible statuses
enum Status {
PENDING = 0; // The pending status.
COMPLETED = 1; // The completed status.
}
int64 id = 1; // The id of the item.
string title = 2; // The title of the item.
Status completed = 3; // The current status of the item.
google.protobuf.Timestamp created_at = 4; // The timestamp for creation.
ListItemDetails details = 5; // Item details.
}
// A request message for adding new items.
message AddItemRequest {
int64 list_id = 1; // The id of the list to add to.
string title = 2; // The title of the item.
bool completed = 3; // Whether or not the item is completed.
}
// A successfully added item response.
message AddItemResponse {
Item item = 1; // The list item that was added.
}
|