This repository was archived by the owner on Oct 7, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshopping_list.proto
198 lines (166 loc) · 5.22 KB
/
shopping_list.proto
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
syntax = "proto3";
package shopping_list;
// Server interface to manage a shopping list.
//
// Note: Names generally follow this convention:
// https://cloud.google.com/apis/design/naming_convention
service ShoppingListService {
// Create a new shopping list.
//
// If the shopping list name is empty, returns `INVALID_ARGUMENT`.
rpc CreateShoppingList(CreateShoppingListRequest) returns (ShoppingList) {}
// Update properties of a shopping list.
//
// If the shopping list name is empty, returns `INVALID_ARGUMENT`.
// If a shopping list with the specified ID doesn't exist, returns `NOT_FOUND`.
rpc UpdateShoppingList(UpdateShoppingListRequest) returns (ShoppingList) {}
// Delete a shopping list.
//
// If a shopping list with the specified ID doesn't exist, returns `NOT_FOUND`.
rpc DeleteShoppingList(DeleteShoppingListRequest) returns (DeleteShoppingListResponse) {}
// List shopping lists.
//
// When a value for the `filter` parameter is provided, only shopping lists whose
// name includes the filter value are returned.
//
// Note: A robust implementation would handle paging.
rpc ListShoppingLists(ListShoppingListsRequest) returns (ListShoppingListsResponse) {}
// List shopping lists, returning results as a stream.
//
// When a value for the `filter` parameter is provided, only shopping lists
// whose name includes the filter value are returned.
rpc ListShoppingListsStream(ListShoppingListsStreamRequest) returns (stream ShoppingList) {}
// Add an item to a shopping list.
rpc AddItem(AddItemRequest) returns (AddItemResponse) {}
// Remove an item from a shopping list.
rpc RemoveItem(RemoveItemRequest) returns (RemoveItemResponse) {}
// Set whether an item on a shopping list is checked.
rpc SetItemChecked(SetItemCheckedRequest) returns (SetItemCheckedResponse) {}
// List items on a shopping list.
//
// Note: A robust implementation would handle paging.
rpc ListItems(ListItemsRequest) returns (ListItemsResponse) {}
// List items on a shopping list, returning results as a stream.
rpc ListItemsStream(ListItemsStreamRequest) returns (stream Item) {}
}
//
// Resources
//
// Shopping list resource.
message ShoppingList {
// The ID of the shopping list; populated upon creation.
string id = 1;
// The name of the shopping list.
string name = 2;
// The description of the shopping list.
string description = 3;
}
// Shopping list item resource.
message Item {
// The ID of the item; populated upon creation.
string id = 1;
// The name of the item.
string name = 2;
// The description of the item.
string description = 3;
// Whether the item is checked.
bool checked = 4;
}
//
// Requests
//
// Request for the `CreateShoppingList` method.
message CreateShoppingListRequest {
// The shopping list to create.
ShoppingList shopping_list = 1;
}
// Request for the `UpdateShoppingList` method.
message UpdateShoppingListRequest {
// The updated shopping list.
ShoppingList shopping_list = 1;
}
// Request for the `DeleteShoppingList` method.
message DeleteShoppingListRequest {
// The ID of the shopping list to delete.
string shopping_list_id = 1;
}
// Request for the `ListShoppingLists` method.
message ListShoppingListsRequest {
// The filter expression.
string filter = 1;
}
// Request for the `ListShoppingListsStream` method.
message ListShoppingListsStreamRequest {
// The filter expression.
string filter = 1;
}
// Request for the `AddItem` method.
message AddItemRequest {
// The ID of the shopping list to which to add the item.
string shopping_list_id = 1;
// The item.
Item item = 2;
}
// Request for the `RemoveItem` method.
message RemoveItemRequest {
// The ID of the shopping list from which to remove the item.
string shopping_list_id = 1;
// The ID of the item.
string item_id = 2;
}
// Request for the `SetItemChecked` method.
message SetItemCheckedRequest {
// The ID of the shopping list of the item.
string shopping_list_id = 1;
// The ID of the item.
string item_id = 2;
// Whether the item is checked.
bool checked = 3;
}
// Request for the `ListItems` method.
message ListItemsRequest {
// The ID of the shopping list.
string shopping_list_id = 1;
// The filter expression.
string filter = 2;
}
// Request for the `ListItemsStream` method.
message ListItemsStreamRequest {
// The ID of the shopping list.
string shopping_list_id = 1;
// The filter expression.
string filter = 2;
}
//
// Responses
//
// Response for the `DeleteShoppingList` method.
message DeleteShoppingListResponse {
// The deleted shopping list.
ShoppingList shopping_list = 1;
}
// Response for the `ListShoppingLists` method.
message ListShoppingListsResponse {
// The shopping lists that match the request.
repeated ShoppingList shopping_lists = 1;
}
// Response for the `AddItem` method.
message AddItemResponse {
// The item to add.
Item item = 1;
}
// Response for the `RemoveItem` method.
message RemoveItemResponse {
// The removed item.
Item item = 1;
}
// Response for the `SetItemChecked` method.
message SetItemCheckedResponse {
// The updated item.
Item item = 1;
}
// Response for the `ListItems` method.
message ListItemsResponse {
// The items that match the request.
repeated Item items = 1;
}