Skip to content

Commit bb06791

Browse files
authored
feat(aepc): expanding bookstore example (#68)
The bookstore was missing stores and items - things that would be pretty critical for a bookstore. Adding those missing resources.
1 parent 30d17fe commit bb06791

12 files changed

Lines changed: 6120 additions & 856 deletions

example/bookstore/v1/bookstore.pb.go

Lines changed: 2142 additions & 743 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example/bookstore/v1/bookstore.pb.gw.go

Lines changed: 1396 additions & 97 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example/bookstore/v1/bookstore.proto

Lines changed: 299 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,54 @@ service Bookstore {
133133
option (google.api.method_signature) = "parent";
134134
}
135135

136+
// An aep-compliant Create method for item.
137+
rpc CreateItem ( CreateItemRequest ) returns ( Item ) {
138+
option (google.api.http) = { post: "/{parent=stores/*}/items", body: "item" };
139+
140+
option (google.api.method_signature) = "parent,item";
141+
}
142+
143+
// An aep-compliant Get method for item.
144+
rpc GetItem ( GetItemRequest ) returns ( Item ) {
145+
option (google.api.http) = { get: "/{path=stores/*/items/*}" };
146+
147+
option (google.api.method_signature) = "path";
148+
}
149+
150+
// An aep-compliant Update method for item.
151+
rpc UpdateItem ( UpdateItemRequest ) returns ( Item ) {
152+
option (google.api.http) = {
153+
patch: "/{path=stores/*/items/*}",
154+
body: "item"
155+
};
156+
157+
option (google.api.method_signature) = "item,update_mask";
158+
}
159+
160+
// An aep-compliant Delete method for item.
161+
rpc DeleteItem ( DeleteItemRequest ) returns ( google.protobuf.Empty ) {
162+
option (google.api.http) = { delete: "/{path=stores/*/items/*}" };
163+
164+
option (google.api.method_signature) = "path";
165+
}
166+
167+
// An aep-compliant List method for items.
168+
rpc ListItems ( ListItemsRequest ) returns ( ListItemsResponse ) {
169+
option (google.api.http) = { get: "/{parent=stores/*}/items" };
170+
171+
option (google.api.method_signature) = "parent";
172+
}
173+
174+
// move a item.
175+
rpc MoveItem ( MoveItemRequest ) returns ( aep.api.Operation ) {
176+
option (aep.api.operation_info) = { response_type: "google.protobuf.Empty" };
177+
178+
option (google.api.http) = {
179+
post: "/{path=stores/*/items/*}:move",
180+
body: "*"
181+
};
182+
}
183+
136184
// An aep-compliant Create method for publisher.
137185
rpc CreatePublisher ( CreatePublisherRequest ) returns ( Publisher ) {
138186
option (google.api.http) = { post: "/publishers", body: "publisher" };
@@ -175,6 +223,41 @@ service Bookstore {
175223
rpc ApplyPublisher ( ApplyPublisherRequest ) returns ( Publisher ) {
176224
option (google.api.http) = { put: "/{path=publishers/*}", body: "publisher" };
177225
}
226+
227+
// An aep-compliant Create method for store.
228+
rpc CreateStore ( CreateStoreRequest ) returns ( Store ) {
229+
option (google.api.http) = { post: "/stores", body: "store" };
230+
231+
option (google.api.method_signature) = "store";
232+
}
233+
234+
// An aep-compliant Get method for store.
235+
rpc GetStore ( GetStoreRequest ) returns ( Store ) {
236+
option (google.api.http) = { get: "/{path=stores/*}" };
237+
238+
option (google.api.method_signature) = "path";
239+
}
240+
241+
// An aep-compliant Update method for store.
242+
rpc UpdateStore ( UpdateStoreRequest ) returns ( Store ) {
243+
option (google.api.http) = { patch: "/{path=stores/*}", body: "store" };
244+
245+
option (google.api.method_signature) = "store,update_mask";
246+
}
247+
248+
// An aep-compliant Delete method for store.
249+
rpc DeleteStore ( DeleteStoreRequest ) returns ( google.protobuf.Empty ) {
250+
option (google.api.http) = { delete: "/{path=stores/*}" };
251+
252+
option (google.api.method_signature) = "path";
253+
}
254+
255+
// An aep-compliant List method for stores.
256+
rpc ListStores ( ListStoresRequest ) returns ( ListStoresResponse ) {
257+
option (google.api.http) = { get: "/stores" };
258+
259+
option (google.api.method_signature) = "parent";
260+
}
178261
}
179262

180263
// A Book.
@@ -245,6 +328,28 @@ message Isbn {
245328
string path = 10018;
246329
}
247330

331+
// A Item.
332+
message Item {
333+
option (google.api.resource) = {
334+
type: "bookstore.example.com/item",
335+
pattern: [ "stores/{store}/items/{item}" ],
336+
plural: "items",
337+
singular: "item"
338+
};
339+
340+
// Field for book.
341+
string book = 1;
342+
343+
// Field for condition.
344+
string condition = 2 [(google.api.field_behavior) = REQUIRED];
345+
346+
// Field for price.
347+
double price = 3 [(google.api.field_behavior) = REQUIRED];
348+
349+
// Field for path.
350+
string path = 10018;
351+
}
352+
248353
// A Publisher.
249354
message Publisher {
250355
option (google.api.resource) = {
@@ -261,6 +366,25 @@ message Publisher {
261366
string path = 10018;
262367
}
263368

369+
// A Store.
370+
message Store {
371+
option (google.api.resource) = {
372+
type: "bookstore.example.com/store",
373+
pattern: [ "stores/{store}" ],
374+
plural: "stores",
375+
singular: "store"
376+
};
377+
378+
// Field for name.
379+
string name = 1 [(google.api.field_behavior) = REQUIRED];
380+
381+
// Field for description.
382+
string description = 2;
383+
384+
// Field for path.
385+
string path = 10018;
386+
}
387+
264388
// A Create request for a book resource.
265389
message CreateBookRequest {
266390
// A field for the parent of book
@@ -351,6 +475,10 @@ message ApplyBookRequest {
351475
Book book = 10015 [(google.api.field_behavior) = REQUIRED];
352476
}
353477

478+
// Response message for the archive method
479+
message ArchiveBookResponse {
480+
}
481+
354482
// Request message for the archive method
355483
message ArchiveBookRequest {
356484
// The globally unique identifier for the resource
@@ -360,10 +488,6 @@ message ArchiveBookRequest {
360488
];
361489
}
362490

363-
// Response message for the archive method
364-
message ArchiveBookResponse {
365-
}
366-
367491
// A Create request for a book-edition resource.
368492
message CreateBookEditionRequest {
369493
// A field for the parent of book-edition
@@ -469,6 +593,96 @@ message ListIsbnsResponse {
469593
string next_page_token = 10011;
470594
}
471595

596+
// A Create request for a item resource.
597+
message CreateItemRequest {
598+
// A field for the parent of item
599+
string parent = 10013 [
600+
(google.api.field_behavior) = REQUIRED,
601+
(google.api.resource_reference) = { }
602+
];
603+
604+
// An id that uniquely identifies the resource within the collection
605+
string id = 10014;
606+
607+
// The resource to perform the operation on.
608+
Item item = 10015 [(google.api.field_behavior) = REQUIRED];
609+
}
610+
611+
// Request message for the Getitem method
612+
message GetItemRequest {
613+
// The globally unique identifier for the resource
614+
string path = 10018 [
615+
(google.api.field_behavior) = REQUIRED,
616+
(google.api.resource_reference) = { type: "bookstore.example.com/item" }
617+
];
618+
}
619+
620+
// Request message for the UpdateItem method
621+
message UpdateItemRequest {
622+
// The globally unique identifier for the resource
623+
string path = 10018 [
624+
(google.api.field_behavior) = REQUIRED,
625+
(google.api.resource_reference) = { type: "bookstore.example.com/item" }
626+
];
627+
628+
// The resource to perform the operation on.
629+
Item item = 10015 [(google.api.field_behavior) = REQUIRED];
630+
631+
// The update mask for the resource
632+
google.protobuf.FieldMask update_mask = 10012;
633+
}
634+
635+
// Request message for the DeleteItem method
636+
message DeleteItemRequest {
637+
// The globally unique identifier for the resource
638+
string path = 10018 [
639+
(google.api.field_behavior) = REQUIRED,
640+
(google.api.resource_reference) = { type: "bookstore.example.com/item" }
641+
];
642+
}
643+
644+
// Request message for the Listitem method
645+
message ListItemsRequest {
646+
// A field for the parent of item
647+
string parent = 10013 [
648+
(google.api.field_behavior) = REQUIRED,
649+
(google.api.resource_reference) = { }
650+
];
651+
652+
// The page token indicating the starting point of the page
653+
string page_token = 10010;
654+
655+
// The maximum number of resources to return in a single page.
656+
int32 max_page_size = 10017;
657+
658+
// The number of resources to skip before returning the first resource in the page.
659+
int32 skip = 10021;
660+
661+
// The filter to apply to the list.
662+
string filter = 10022;
663+
}
664+
665+
// Response message for the Listitem method
666+
message ListItemsResponse {
667+
// A list of items
668+
repeated Item results = 10016;
669+
670+
// The page token indicating the ending point of this response.
671+
string next_page_token = 10011;
672+
}
673+
674+
// Request message for the move method
675+
message MoveItemRequest {
676+
// Field for target_store.
677+
string target_store = 1;
678+
679+
// The globally unique identifier for the resource
680+
string path = 10018 [
681+
(google.api.field_behavior) = REQUIRED,
682+
(google.api.resource_reference) = { type: "bookstore.example.com/item" }
683+
];
684+
}
685+
472686
// A Create request for a publisher resource.
473687
message CreatePublisherRequest {
474688
// A field for the parent of publisher
@@ -561,3 +775,84 @@ message ApplyPublisherRequest {
561775
// The resource to perform the operation on.
562776
Publisher publisher = 10015 [(google.api.field_behavior) = REQUIRED];
563777
}
778+
779+
// A Create request for a store resource.
780+
message CreateStoreRequest {
781+
// A field for the parent of store
782+
string parent = 10013 [
783+
(google.api.field_behavior) = REQUIRED,
784+
(google.api.resource_reference) = { }
785+
];
786+
787+
// An id that uniquely identifies the resource within the collection
788+
string id = 10014;
789+
790+
// The resource to perform the operation on.
791+
Store store = 10015 [(google.api.field_behavior) = REQUIRED];
792+
}
793+
794+
// Request message for the Getstore method
795+
message GetStoreRequest {
796+
// The globally unique identifier for the resource
797+
string path = 10018 [
798+
(google.api.field_behavior) = REQUIRED,
799+
(google.api.resource_reference) = { type: "bookstore.example.com/store" }
800+
];
801+
}
802+
803+
// Request message for the UpdateStore method
804+
message UpdateStoreRequest {
805+
// The globally unique identifier for the resource
806+
string path = 10018 [
807+
(google.api.field_behavior) = REQUIRED,
808+
(google.api.resource_reference) = { type: "bookstore.example.com/store" }
809+
];
810+
811+
// The resource to perform the operation on.
812+
Store store = 10015 [(google.api.field_behavior) = REQUIRED];
813+
814+
// The update mask for the resource
815+
google.protobuf.FieldMask update_mask = 10012;
816+
}
817+
818+
// Request message for the DeleteStore method
819+
message DeleteStoreRequest {
820+
// The globally unique identifier for the resource
821+
string path = 10018 [
822+
(google.api.field_behavior) = REQUIRED,
823+
(google.api.resource_reference) = { type: "bookstore.example.com/store" }
824+
];
825+
826+
// If true, the resource will be deleted, even if children still exist.
827+
bool force = 10020 [(google.api.field_behavior) = OPTIONAL];
828+
}
829+
830+
// Request message for the Liststore method
831+
message ListStoresRequest {
832+
// A field for the parent of store
833+
string parent = 10013 [
834+
(google.api.field_behavior) = REQUIRED,
835+
(google.api.resource_reference) = { }
836+
];
837+
838+
// The page token indicating the starting point of the page
839+
string page_token = 10010;
840+
841+
// The maximum number of resources to return in a single page.
842+
int32 max_page_size = 10017;
843+
844+
// The number of resources to skip before returning the first resource in the page.
845+
int32 skip = 10021;
846+
847+
// The filter to apply to the list.
848+
string filter = 10022;
849+
}
850+
851+
// Response message for the Liststore method
852+
message ListStoresResponse {
853+
// A list of stores
854+
repeated Store results = 10016;
855+
856+
// The page token indicating the ending point of this response.
857+
string next_page_token = 10011;
858+
}

0 commit comments

Comments
 (0)