-
Notifications
You must be signed in to change notification settings - Fork 47
/
messaging.proto
520 lines (447 loc) · 16.7 KB
/
messaging.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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
// Copyright 2018 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
import "google/api/annotations.proto";
import "google/api/client.proto";
import "google/api/field_behavior.proto";
import "google/api/resource.proto";
import "google/longrunning/operations.proto";
import "google/protobuf/empty.proto";
import "google/protobuf/field_mask.proto";
import "google/protobuf/timestamp.proto";
import "google/rpc/error_details.proto";
package google.showcase.v1beta1;
option go_package = "github.com/googleapis/gapic-showcase/server/genproto";
option java_package = "com.google.showcase.v1beta1";
option java_multiple_files = true;
option ruby_package = "Google::Showcase::V1beta1";
// A simple messaging service that implements chat rooms and profile posts.
//
// This messaging service showcases the features that API clients
// generated by gapic-generators implement.
service Messaging {
// This service is meant to only run locally on the port 7469 (keypad digits
// for "show").
option (google.api.default_host) = "localhost:7469";
// Creates a room.
rpc CreateRoom(CreateRoomRequest) returns (Room) {
option (google.api.http) = {
post: "/v1beta1/rooms"
body: "*"
};
option (google.api.method_signature) = "room.display_name,room.description";
}
// Retrieves the Room with the given resource name.
rpc GetRoom(GetRoomRequest) returns (Room) {
option (google.api.http) = {
get: "/v1beta1/{name=rooms/*}"
};
option (google.api.method_signature) = "name";
}
// Updates a room.
rpc UpdateRoom(UpdateRoomRequest) returns (Room) {
option (google.api.http) = {
patch: "/v1beta1/{room.name=rooms/*}"
body: "room"
};
}
// Deletes a room and all of its blurbs.
rpc DeleteRoom(DeleteRoomRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
delete: "/v1beta1/{name=rooms/*}"
};
option (google.api.method_signature) = "name";
}
// Lists all chat rooms.
rpc ListRooms(ListRoomsRequest) returns (ListRoomsResponse) {
option (google.api.http) = {
get: "/v1beta1/rooms"
};
}
// Creates a blurb. If the parent is a room, the blurb is understood to be a
// message in that room. If the parent is a profile, the blurb is understood
// to be a post on the profile.
rpc CreateBlurb(CreateBlurbRequest) returns (Blurb) {
option (google.api.http) = {
post: "/v1beta1/{parent=rooms/*}/blurbs"
body: "*"
additional_bindings: {
post: "/v1beta1/{parent=users/*/profile}/blurbs"
body: "*"
}
};
option (google.api.method_signature) = "parent,blurb.user,blurb.text";
option (google.api.method_signature) = "parent,blurb.user,blurb.image";
}
// Retrieves the Blurb with the given resource name.
rpc GetBlurb(GetBlurbRequest) returns (Blurb) {
option (google.api.http) = {
get: "/v1beta1/{name=rooms/*/blurbs/*}"
additional_bindings: { get: "/v1beta1/{name=users/*/profile/blurbs/*}" }
};
option (google.api.method_signature) = "name";
}
// Updates a blurb.
rpc UpdateBlurb(UpdateBlurbRequest) returns (Blurb) {
option (google.api.http) = {
patch: "/v1beta1/{blurb.name=rooms/*/blurbs/*}"
body: "blurb"
additional_bindings: {
patch: "/v1beta1/{blurb.name=users/*/profile/blurbs/*}"
body: "blurb"
}
};
}
// Deletes a blurb.
rpc DeleteBlurb(DeleteBlurbRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
delete: "/v1beta1/{name=rooms/*/blurbs/*}"
additional_bindings: {
delete: "/v1beta1/{name=users/*/profile/blurbs/*}"
}
};
option (google.api.method_signature) = "name";
}
// Lists blurbs for a specific chat room or user profile depending on the
// parent resource name.
rpc ListBlurbs(ListBlurbsRequest) returns (ListBlurbsResponse) {
option (google.api.http) = {
get: "/v1beta1/{parent=rooms/*}/blurbs"
additional_bindings: { get: "/v1beta1/{parent=users/*/profile}/blurbs" }
};
option (google.api.method_signature) = "parent";
}
// This method searches through all blurbs across all rooms and profiles
// for blurbs containing to words found in the query. Only posts that
// contain an exact match of a queried word will be returned.
rpc SearchBlurbs(SearchBlurbsRequest) returns (google.longrunning.Operation) {
option (google.api.http) = {
post: "/v1beta1/{parent=rooms/*}/blurbs:search"
body: "*"
additional_bindings: {
post: "/v1beta1/{parent=users/*/profile}/blurbs:search"
}
};
option (google.longrunning.operation_info) = {
response_type: "SearchBlurbsResponse"
metadata_type: "SearchBlurbsMetadata"
};
option (google.api.method_signature) = "parent,query";
}
// This returns a stream that emits the blurbs that are created for a
// particular chat room or user profile.
rpc StreamBlurbs(StreamBlurbsRequest) returns (stream StreamBlurbsResponse) {
option (google.api.http) = {
post: "/v1beta1/{name=rooms/*}/blurbs:stream"
body: "*"
additional_bindings: {
post: "/v1beta1/{name=users/*/profile}/blurbs:stream"
body: "*"
}
};
}
// This is a stream to create multiple blurbs. If an invalid blurb is
// requested to be created, the stream will close with an error.
rpc SendBlurbs(stream CreateBlurbRequest) returns (SendBlurbsResponse) {
option (google.api.http) = {
post: "/v1beta1/{parent=rooms/*}/blurbs:send"
body: "*"
additional_bindings: {
post: "/v1beta1/{parent=users/*/profile}/blurbs:send"
body: "*"
}
};
}
// This method starts a bidirectional stream that receives all blurbs that
// are being created after the stream has started and sends requests to create
// blurbs. If an invalid blurb is requested to be created, the stream will
// close with an error.
rpc Connect(stream ConnectRequest) returns (stream StreamBlurbsResponse);
}
// A chat room.
message Room {
option (google.api.resource) = {
type: "showcase.googleapis.com/Room"
pattern: "rooms/{room}"
};
// The resource name of the chat room.
string name = 1;
// The human readable name of the chat room.
string display_name = 2 [(google.api.field_behavior) = REQUIRED];
// The description of the chat room.
string description = 3;
// The timestamp at which the room was created.
google.protobuf.Timestamp create_time = 4
[(google.api.field_behavior) = OUTPUT_ONLY];
// The latest timestamp at which the room was updated.
google.protobuf.Timestamp update_time = 5
[(google.api.field_behavior) = OUTPUT_ONLY];
}
// The request message for the google.showcase.v1beta1.Messaging\CreateRoom
// method.
message CreateRoomRequest {
// The room to create.
Room room = 1;
}
// The request message for the google.showcase.v1beta1.Messaging\GetRoom
// method.
message GetRoomRequest {
// The resource name of the requested room.
string name = 1 [
(google.api.resource_reference).type = "showcase.googleapis.com/Room",
(google.api.field_behavior) = REQUIRED
];
}
// The request message for the google.showcase.v1beta1.Messaging\UpdateRoom
// method.
message UpdateRoomRequest {
// The room to update.
Room room = 1;
// The field mask to determine which fields are to be updated. If empty, the
// server will assume all fields are to be updated.
google.protobuf.FieldMask update_mask = 2;
}
// The request message for the google.showcase.v1beta1.Messaging\DeleteRoom
// method.
message DeleteRoomRequest {
// The resource name of the requested room.
string name = 1 [
(google.api.resource_reference).type = "showcase.googleapis.com/Room",
(google.api.field_behavior) = REQUIRED
];
}
// The request message for the google.showcase.v1beta1.Messaging\ListRooms
// method.
message ListRoomsRequest {
// The maximum number of rooms return. Server may return fewer rooms
// than requested. If unspecified, server will pick an appropriate default.
int32 page_size = 1;
// The value of google.showcase.v1beta1.ListRoomsResponse.next_page_token
// returned from the previous call to
// `google.showcase.v1beta1.Messaging\ListRooms` method.
string page_token = 2;
}
// The response message for the google.showcase.v1beta1.Messaging\ListRooms
// method.
message ListRoomsResponse {
// The list of rooms.
repeated Room rooms = 1;
// A token to retrieve next page of results.
// Pass this value in ListRoomsRequest.page_token field in the subsequent
// call to `google.showcase.v1beta1.Messaging\ListRooms` method to retrieve
// the next page of results.
string next_page_token = 2;
}
// This protocol buffer message represents a blurb sent to a chat room or
// posted on a user profile.
message Blurb {
option (google.api.resource) = {
type: "showcase.googleapis.com/Blurb"
pattern: "users/{user}/profile/blurbs/legacy/{legacy_user}~{blurb}"
pattern: "users/{user}/profile/blurbs/{blurb}"
pattern: "rooms/{room}/blurbs/{blurb}"
pattern: "rooms/{room}/blurbs/legacy/{legacy_room}.{blurb}"
};
// The resource name of the chat room.
string name = 1;
// The resource name of the blurb's author.
string user = 2 [
(google.api.resource_reference).type = "showcase.googleapis.com/User",
(google.api.field_behavior) = REQUIRED
];
oneof content {
// The textual content of this blurb.
string text = 3;
// The image content of this blurb.
bytes image = 4;
}
// The timestamp at which the blurb was created.
google.protobuf.Timestamp create_time = 5
[(google.api.field_behavior) = OUTPUT_ONLY];
// The latest timestamp at which the blurb was updated.
google.protobuf.Timestamp update_time = 6
[(google.api.field_behavior) = OUTPUT_ONLY];
// (-- aip.dev/not-precedent: This is designed for testing non-slash
// resource patterns. Ordinarily, non-slash separators are discouraged.
// --)
oneof legacy_id {
// The legacy id of the room. This field is used to signal
// the use of the compound resource pattern
// `rooms/{room}/blurbs/legacy/{legacy_room}.{blurb}`
string legacy_room_id = 7;
// The legacy id of the user. This field is used to signal
// the use of the compound resource pattern
// `users/{user}/profile/blurbs/legacy/{legacy_user}~{blurb}`
string legacy_user_id = 8;
}
}
// The request message for the google.showcase.v1beta1.Messaging\CreateBlurb
// method.
message CreateBlurbRequest {
// The resource name of the chat room or user profile that this blurb will
// be tied to.
string parent = 1 [
(google.api.resource_reference).child_type =
"showcase.googleapis.com/Blurb",
(google.api.field_behavior) = REQUIRED
];
// The blurb to create.
Blurb blurb = 2;
}
// The request message for the google.showcase.v1beta1.Messaging\GetBlurb
// method.
message GetBlurbRequest {
// The resource name of the requested blurb.
string name = 1 [
(google.api.resource_reference).type = "showcase.googleapis.com/Blurb",
(google.api.field_behavior) = REQUIRED
];
}
// The request message for the google.showcase.v1beta1.Messaging\UpdateBlurb
// method.
message UpdateBlurbRequest {
// The blurb to update.
Blurb blurb = 1;
// The field mask to determine wich fields are to be updated. If empty, the
// server will assume all fields are to be updated.
google.protobuf.FieldMask update_mask = 2;
}
// The request message for the google.showcase.v1beta1.Messaging\DeleteBlurb
// method.
message DeleteBlurbRequest {
// The resource name of the requested blurb.
string name = 1 [
(google.api.resource_reference).type = "showcase.googleapis.com/Blurb",
(google.api.field_behavior) = REQUIRED
];
}
// The request message for the google.showcase.v1beta1.Messaging\ListBlurbs
// method.
message ListBlurbsRequest {
// The resource name of the requested room or profile whos blurbs to list.
string parent = 1 [
(google.api.resource_reference).child_type =
"showcase.googleapis.com/Blurb",
(google.api.field_behavior) = REQUIRED
];
// The maximum number of blurbs to return. Server may return fewer
// blurbs than requested. If unspecified, server will pick an appropriate
// default.
int32 page_size = 2;
// The value of google.showcase.v1beta1.ListBlurbsResponse.next_page_token
// returned from the previous call to
// `google.showcase.v1beta1.Messaging\ListBlurbs` method.
string page_token = 3;
}
// The response message for the google.showcase.v1beta1.Messaging\ListBlurbs
// method.
message ListBlurbsResponse {
// The list of blurbs.
repeated Blurb blurbs = 1;
// A token to retrieve next page of results.
// Pass this value in ListBlurbsRequest.page_token field in the subsequent
// call to `google.showcase.v1beta1.Blurb\ListBlurbs` method to retrieve
// the next page of results.
string next_page_token = 2;
}
// The request message for the google.showcase.v1beta1.Messaging\SearchBlurbs
// method.
message SearchBlurbsRequest {
// The query used to search for blurbs containing to words of this string.
// Only posts that contain an exact match of a queried word will be returned.
string query = 1 [(google.api.field_behavior) = REQUIRED];
// The rooms or profiles to search. If unset, `SearchBlurbs` will search all
// rooms and all profiles.
string parent = 2 [(google.api.resource_reference).child_type =
"showcase.googleapis.com/Blurb"];
// The maximum number of blurbs return. Server may return fewer
// blurbs than requested. If unspecified, server will pick an appropriate
// default.
int32 page_size = 3;
// The value of
// google.showcase.v1beta1.SearchBlurbsResponse.next_page_token
// returned from the previous call to
// `google.showcase.v1beta1.Messaging\SearchBlurbs` method.
string page_token = 4;
}
// The operation metadata message for the
// google.showcase.v1beta1.Messaging\SearchBlurbs method.
message SearchBlurbsMetadata {
// This signals to the client when to next poll for response.
google.rpc.RetryInfo retry_info = 1;
}
// The operation response message for the
// google.showcase.v1beta1.Messaging\SearchBlurbs method.
message SearchBlurbsResponse {
// Blurbs that matched the search query.
repeated Blurb blurbs = 1;
// A token to retrieve next page of results.
// Pass this value in SearchBlurbsRequest.page_token field in the subsequent
// call to `google.showcase.v1beta1.Blurb\SearchBlurbs` method to
// retrieve the next page of results.
string next_page_token = 2;
}
// The request message for the google.showcase.v1beta1.Messaging\StreamBlurbs
// method.
message StreamBlurbsRequest {
// The resource name of a chat room or user profile whose blurbs to stream.
string name = 1 [
(google.api.resource_reference).child_type =
"showcase.googleapis.com/Blurb",
(google.api.field_behavior) = REQUIRED
];
// The time at which this stream will close.
google.protobuf.Timestamp expire_time = 2
[(google.api.field_behavior) = REQUIRED];
}
// The response message for the google.showcase.v1beta1.Messaging\StreamBlurbs
// method.
message StreamBlurbsResponse {
// The blurb that was either created, updated, or deleted.
Blurb blurb = 1;
// The action that triggered the blurb to be returned.
enum Action {
ACTION_UNSPECIFIED = 0;
// Specifies that the blurb was created.
CREATE = 1;
// Specifies that the blurb was updated.
UPDATE = 2;
// Specifies that the blurb was deleted.
DELETE = 3;
}
// The action that triggered the blurb to be returned.
Action action = 2;
}
// The response message for the google.showcase.v1beta1.Messaging\SendBlurbs
// method.
message SendBlurbsResponse {
// The names of successful blurb creations.
repeated string names = 1;
}
// The request message for the google.showcase.v1beta1.Messaging\Connect
// method.
message ConnectRequest {
message ConnectConfig {
// The room or profile to follow and create messages for.
string parent = 1 [(google.api.resource_reference).child_type =
"showcase.googleapis.com/Blurb"];
}
oneof request {
// Provides information that specifies how to process subsequent requests.
// The first `ConnectRequest` message must contain a `config` message.
ConnectConfig config = 1;
// The blurb to be created.
Blurb blurb = 2;
}
}