-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathexample.proto
547 lines (433 loc) · 15.5 KB
/
example.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
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
syntax = "proto3";
package example.bookstore.v1;
import "google/api/annotations.proto";
import "google/api/client.proto";
import "google/api/field_behavior.proto";
import "google/api/resource.proto";
import "google/protobuf/empty.proto";
import "google/protobuf/field_mask.proto";
option go_package = "/bookstore";
// A service.
service Bookstore {
// An aep-compliant Create method for book.
rpc CreateBook ( CreateBookRequest ) returns ( Book ) {
option (google.api.http) = {
post: "/{parent=publishers/*}/books",
body: "book"
};
option (google.api.method_signature) = "parent,book";
}
// An aep-compliant Get method for book.
rpc GetBook ( GetBookRequest ) returns ( Book ) {
option (google.api.http) = { get: "/{path=publishers/*/books/*}" };
option (google.api.method_signature) = "path";
}
// An aep-compliant Update method for book.
rpc UpdateBook ( UpdateBookRequest ) returns ( Book ) {
option (google.api.http) = {
patch: "/{path=publishers/*/books/*}",
body: "book"
};
option (google.api.method_signature) = "book,update_mask";
}
// An aep-compliant Delete method for book.
rpc DeleteBook ( DeleteBookRequest ) returns ( google.protobuf.Empty ) {
option (google.api.http) = { delete: "/{path=publishers/*/books/*}" };
option (google.api.method_signature) = "path";
}
// An aep-compliant List method for books.
rpc ListBooks ( ListBooksRequest ) returns ( ListBooksResponse ) {
option (google.api.http) = { get: "/{parent=publishers/*}/books" };
option (google.api.method_signature) = "parent";
}
// An aep-compliant Apply method for books.
rpc ApplyBook ( ApplyBookRequest ) returns ( Book ) {
option (google.api.http) = {
put: "/{path=publishers/*/books/*}",
body: "book"
};
}
// An aep-compliant Create method for book-edition.
rpc CreateBookEdition ( CreateBookEditionRequest ) returns ( BookEdition ) {
option (google.api.http) = {
post: "/{parent=publishers/*/books/*}/editions",
body: "book_edition"
};
option (google.api.method_signature) = "parent,book_edition";
}
// An aep-compliant Get method for book-edition.
rpc GetBookEdition ( GetBookEditionRequest ) returns ( BookEdition ) {
option (google.api.http) = { get: "/{path=publishers/*/books/*/editions/*}" };
option (google.api.method_signature) = "path";
}
// An aep-compliant Delete method for book-edition.
rpc DeleteBookEdition ( DeleteBookEditionRequest ) returns ( google.protobuf.Empty ) {
option (google.api.http) = {
delete: "/{path=publishers/*/books/*/editions/*}"
};
option (google.api.method_signature) = "path";
}
// An aep-compliant List method for book-editions.
rpc ListBookEditions ( ListBookEditionsRequest ) returns ( ListBookEditionsResponse ) {
option (google.api.http) = { get: "/{parent=publishers/*/books/*}/editions" };
option (google.api.method_signature) = "parent";
}
// An aep-compliant Create method for isbn.
rpc CreateIsbn ( CreateIsbnRequest ) returns ( Isbn ) {
option (google.api.http) = { post: "/{parent=isbns}", body: "isbn" };
option (google.api.method_signature) = "isbn";
}
// An aep-compliant Get method for isbn.
rpc GetIsbn ( GetIsbnRequest ) returns ( Isbn ) {
option (google.api.http) = { get: "/{path=isbns/*}" };
option (google.api.method_signature) = "path";
}
// An aep-compliant List method for isbns.
rpc ListIsbns ( ListIsbnsRequest ) returns ( ListIsbnsResponse ) {
option (google.api.http) = { get: "/{parent=isbns}" };
option (google.api.method_signature) = "parent";
}
// An aep-compliant Create method for publisher.
rpc CreatePublisher ( CreatePublisherRequest ) returns ( Publisher ) {
option (google.api.http) = {
post: "/{parent=publishers}",
body: "publisher"
};
option (google.api.method_signature) = "publisher";
}
// An aep-compliant Get method for publisher.
rpc GetPublisher ( GetPublisherRequest ) returns ( Publisher ) {
option (google.api.http) = { get: "/{path=publishers/*}" };
option (google.api.method_signature) = "path";
}
// An aep-compliant Update method for publisher.
rpc UpdatePublisher ( UpdatePublisherRequest ) returns ( Publisher ) {
option (google.api.http) = {
patch: "/{path=publishers/*}",
body: "publisher"
};
option (google.api.method_signature) = "publisher,update_mask";
}
// An aep-compliant Delete method for publisher.
rpc DeletePublisher ( DeletePublisherRequest ) returns ( google.protobuf.Empty ) {
option (google.api.http) = { delete: "/{path=publishers/*}" };
option (google.api.method_signature) = "path";
}
// An aep-compliant List method for publishers.
rpc ListPublishers ( ListPublishersRequest ) returns ( ListPublishersResponse ) {
option (google.api.http) = { get: "/{parent=publishers}" };
option (google.api.method_signature) = "parent";
}
// An aep-compliant Apply method for publishers.
rpc ApplyPublisher ( ApplyPublisherRequest ) returns ( Publisher ) {
option (google.api.http) = { put: "/{path=publishers/*}", body: "publisher" };
}
// An aep-compliant custom method Archive method for publisher.
rpc ArchivePublisher ( ArchivePublisherRequest ) returns ( ArchivePublisherResponse ) {
option (google.api.http) = { post: "/{path=publishers/*}:archive" };
}
}
// A Book.
message Book {
option (google.api.resource) = {
type: "bookstore.example.com/book",
pattern: [ "publishers/{publisher}/books/{book}" ],
plural: "books",
singular: "book"
};
// A Author.
message Author {
// Field for firstName.
string firstName = 1;
// Field for lastName.
string lastName = 2;
}
// Field for author.
repeated Author author = 5;
// Field for isbn.
repeated string isbn = 1 [(google.api.field_behavior) = REQUIRED];
// Field for price.
float price = 2 [(google.api.field_behavior) = REQUIRED];
// Field for published.
bool published = 3 [(google.api.field_behavior) = REQUIRED];
// Field for edition.
int32 edition = 4;
// Field for path.
string path = 10000;
}
// A Create request for a book resource.
message CreateBookRequest {
// A field for the parent of book
string parent = 10013 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = { }
];
// An id that uniquely identifies the resource within the collection
string id = 10014;
// The resource to perform the operation on.
Book book = 10015 [(google.api.field_behavior) = REQUIRED];
}
// Request message for the Getbook method
message GetBookRequest {
// The globally unique identifier for the resource
string path = 10018 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = { type: "bookstore.example.com/book" }
];
}
// Request message for the UpdateBook method
message UpdateBookRequest {
// The globally unique identifier for the resource
string path = 10018 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = { type: "bookstore.example.com/book" }
];
// The resource to perform the operation on.
Book book = 10015 [(google.api.field_behavior) = REQUIRED];
// The update mask for the resource
google.protobuf.FieldMask update_mask = 10012;
}
// Request message for the DeleteBook method
message DeleteBookRequest {
// The globally unique identifier for the resource
string path = 10018 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = { type: "bookstore.example.com/book" }
];
// If true, the resource will be deleted even if it still has children.
bool force = 10020;
}
// Request message for the Listbook method
message ListBooksRequest {
// A field for the parent of book
string parent = 10013 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = { }
];
// The page token indicating the starting point of the page
string page_token = 10010;
// The maximum number of resources to return in a single page.
int32 max_page_size = 10017;
}
// Response message for the Listbook method
message ListBooksResponse {
// A list of books
repeated Book results = 10016;
// The page token indicating the ending point of this response.
string next_page_token = 10011;
}
// Request message for the Applybook method
message ApplyBookRequest {
// The globally unique identifier for the resource
string path = 10018 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = { type: "bookstore.example.com/book" }
];
// The resource to perform the operation on.
Book book = 10015 [(google.api.field_behavior) = REQUIRED];
}
// A BookEdition.
message BookEdition {
option (google.api.resource) = {
type: "bookstore.example.com/book-edition",
pattern: [
"publishers/{publisher}/books/{book}/editions/{book-edition}"
],
plural: "book-editions",
singular: "book-edition"
};
// Field for displayname.
string displayname = 1 [(google.api.field_behavior) = REQUIRED];
// Field for path.
string path = 10000;
}
// A Create request for a book-edition resource.
message CreateBookEditionRequest {
// A field for the parent of book-edition
string parent = 10013 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = { }
];
// An id that uniquely identifies the resource within the collection
string id = 10014;
// The resource to perform the operation on.
BookEdition book_edition = 10015 [(google.api.field_behavior) = REQUIRED];
}
// Request message for the Getbook-edition method
message GetBookEditionRequest {
// The globally unique identifier for the resource
string path = 10018 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = { type: "bookstore.example.com/book-edition" }
];
}
// Request message for the DeleteBookEdition method
message DeleteBookEditionRequest {
// The globally unique identifier for the resource
string path = 10018 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = { type: "bookstore.example.com/book-edition" }
];
}
// Request message for the Listbook-edition method
message ListBookEditionsRequest {
// A field for the parent of book-edition
string parent = 10013 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = { }
];
// The page token indicating the starting point of the page
string page_token = 10010;
// The maximum number of resources to return in a single page.
int32 max_page_size = 10017;
}
// Response message for the Listbook-edition method
message ListBookEditionsResponse {
// A list of book-editions
repeated BookEdition results = 10016;
// The page token indicating the ending point of this response.
string next_page_token = 10011;
}
// A Isbn.
message Isbn {
option (google.api.resource) = {
type: "bookstore.example.com/isbn",
pattern: [ "isbns/{isbn}" ],
plural: "isbns",
singular: "isbn"
};
// Field for path.
string path = 10000;
}
// A Create request for a isbn resource.
message CreateIsbnRequest {
// A field for the parent of isbn
string parent = 10013 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = { }
];
// The resource to perform the operation on.
Isbn isbn = 10015 [(google.api.field_behavior) = REQUIRED];
}
// Request message for the Getisbn method
message GetIsbnRequest {
// The globally unique identifier for the resource
string path = 10018 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = { type: "bookstore.example.com/isbn" }
];
}
// Request message for the Listisbn method
message ListIsbnsRequest {
// A field for the parent of isbn
string parent = 10013 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = { }
];
// The page token indicating the starting point of the page
string page_token = 10010;
// The maximum number of resources to return in a single page.
int32 max_page_size = 10017;
}
// Response message for the Listisbn method
message ListIsbnsResponse {
// A list of isbns
repeated Isbn results = 10016;
// The page token indicating the ending point of this response.
string next_page_token = 10011;
}
// A Publisher.
message Publisher {
option (google.api.resource) = {
type: "bookstore.example.com/publisher",
pattern: [ "publishers/{publisher}" ],
plural: "publishers",
singular: "publisher"
};
// Field for description.
string description = 1;
// Field for path.
string path = 10000;
}
// A Create request for a publisher resource.
message CreatePublisherRequest {
// A field for the parent of publisher
string parent = 10013 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = { }
];
// An id that uniquely identifies the resource within the collection
string id = 10014;
// The resource to perform the operation on.
Publisher publisher = 10015 [(google.api.field_behavior) = REQUIRED];
}
// Request message for the Getpublisher method
message GetPublisherRequest {
// The globally unique identifier for the resource
string path = 10018 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = { type: "bookstore.example.com/publisher" }
];
}
// Request message for the UpdatePublisher method
message UpdatePublisherRequest {
// The globally unique identifier for the resource
string path = 10018 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = { type: "bookstore.example.com/publisher" }
];
// The resource to perform the operation on.
Publisher publisher = 10015 [(google.api.field_behavior) = REQUIRED];
// The update mask for the resource
google.protobuf.FieldMask update_mask = 10012;
}
// Request message for the DeletePublisher method
message DeletePublisherRequest {
// The globally unique identifier for the resource
string path = 10018 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = { type: "bookstore.example.com/publisher" }
];
// If true, the resource will be deleted even if it still has children.
bool force = 10020;
}
// Request message for the Listpublisher method
message ListPublishersRequest {
// A field for the parent of publisher
string parent = 10013 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = { }
];
// The page token indicating the starting point of the page
string page_token = 10010;
// The maximum number of resources to return in a single page.
int32 max_page_size = 10017;
}
// Response message for the Listpublisher method
message ListPublishersResponse {
// A list of publishers
repeated Publisher results = 10016;
// The page token indicating the ending point of this response.
string next_page_token = 10011;
}
// Request message for the Applypublisher method
message ApplyPublisherRequest {
// The globally unique identifier for the resource
string path = 10018 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = { type: "bookstore.example.com/publisher" }
];
// The resource to perform the operation on.
Publisher publisher = 10015 [(google.api.field_behavior) = REQUIRED];
}
// Request message for the Archivepublisher method
message ArchivePublisherRequest {
// The globally unique identifier for the resource
string path = 10018 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = { type: "bookstore.example.com/publisher" }
];
}
// Response message for the Archivepublisher method
message ArchivePublisherResponse {
}