diff --git a/proto/items/items.proto b/proto/items/items.proto index 0e2ab172aa0a5acf3e02d4831e1f3de17ee93d1b..47fb2b84c52279680b087aba62b8f8174842a83e 100644 --- a/proto/items/items.proto +++ b/proto/items/items.proto @@ -13,6 +13,7 @@ import "common/common.proto"; import "common/error.proto"; import "google/protobuf/timestamp.proto"; import "google/protobuf/struct.proto"; +import "google/api/annotations.proto"; option go_package = "git.perx.ru/perxis/perxis-go/proto/items;items"; @@ -444,50 +445,179 @@ message GetArchivedResponse { */ service Items { /** - * Создать запись - */ - rpc Create(CreateRequest) returns(CreateResponse) {} + * Создать запись + */ + rpc Create(CreateRequest) returns(CreateResponse) { + option (google.api.http) = { + post: "/content/v1/spaces/{item.space_id}/environments/{item.env_id}/collections/{item.collection_id}/items/{item.id}" + body: "item" + }; + } /** - * Валидация данных записи - */ - rpc Introspect(IntrospectRequest) returns(IntrospectResponse) {} + * Валидация данных записи + */ + rpc Introspect(IntrospectRequest) returns(IntrospectResponse) { + option (google.api.http) = { + post: "/content/v1/spaces/{item.space_id}/environments/{item.env_id}/collections/{item.collection_id}/items" + body: "item" + }; + } /** - * Получение записи по идентификатору - */ - rpc Get(GetRequest) returns(GetResponse) {} + * Получение записи по идентификатору + */ + rpc Get(GetRequest) returns(GetResponse) { + option (google.api.http) = { + get: "/content/v1/spaces/{space_id}/environments/{env_id}/collections/{collection_id}/items/{item_id}" + }; + } /** - * Поиск по текущим записям - */ - rpc Find(FindRequest) returns(FindResponse) {} - rpc Update(UpdateRequest) returns(google.protobuf.Empty) {} - rpc Delete(DeleteRequest) returns(google.protobuf.Empty) {} - rpc Undelete(UndeleteRequest) returns(google.protobuf.Empty) {} - - rpc Publish(PublishRequest) returns(google.protobuf.Empty) {} - rpc Unpublish(UnpublishRequest) returns(google.protobuf.Empty) {} - rpc GetPublished(GetPublishedRequest) returns(GetPublishedResponse) {} - rpc FindPublished(FindPublishedRequest) returns(FindPublishedResponse) {} - rpc CheckoutRevision(CheckoutRevisionRequest) returns(CheckoutRevisionResponse) {} + * Поиск по текущим записям + */ + rpc Find(FindRequest) returns(FindResponse) { + option (google.api.http) = { + get: "/content/v1/spaces/{space_id}/environments/{env_id}/collections/{collection_id}/items" + }; + } + /** + * Обновление записи + */ + rpc Update(UpdateRequest) returns(google.protobuf.Empty) { + option (google.api.http) = { + put: "/content/v1/spaces/{item.space_id}/environments/{item.env_id}/collections/{item.collection_id}/items/{item.id}" + body: "*" + }; + } + /** + * Удаление записи + */ + rpc Delete(DeleteRequest) returns(google.protobuf.Empty) { + option (google.api.http) = { + delete: "/content/v1/spaces/{item.space_id}/environments/{item.env_id}/collections/{item.collection_id}/items/{item.id}" + }; + } + /** + * Восстановление записи + */ + rpc Undelete(UndeleteRequest) returns(google.protobuf.Empty) { + option (google.api.http) = { + patch: "/content/v1/spaces/{item.space_id}/environments/{item.env_id}/collections/{item.collection_id}/items/{item.id}/undelete" + body: "*" + }; + } + /** + * Публикация записи + */ + rpc Publish(PublishRequest) returns(google.protobuf.Empty) { + option (google.api.http) = { + patch: "/content/v1/spaces/{item.space_id}/environments/{item.env_id}/collections/{item.collection_id}/items/{item.id}/publish" + body: "*" + }; + } + /** + * Распубликация записи + */ + rpc Unpublish(UnpublishRequest) returns(google.protobuf.Empty) { + option (google.api.http) = { + patch: "/content/v1/spaces/{item.space_id}/environments/{item.env_id}/collections/{item.collection_id}/items/{item.id}/unpublish" + body: "*" + }; + } + /** + * Получение опубликованной записи + */ + rpc GetPublished(GetPublishedRequest) returns(GetPublishedResponse) { + option (google.api.http) = { + get: "/content/v1/spaces/{space_id}/environments/{env_id}/collections/{collection_id}/items/{item_id}/published" + }; + } + /** + * Получение всех опубликованных записей + */ + rpc FindPublished(FindPublishedRequest) returns(FindPublishedResponse) { + option (google.api.http) = { + get: "/content/v1/spaces/{space_id}/environments/{env_id}/collections/{collection_id}/items/published" + }; + } + /** + * Выбор ревизии записи + */ + rpc CheckoutRevision(CheckoutRevisionRequest) returns(CheckoutRevisionResponse) { + option (google.api.http) = { + get: "/content/v1/spaces/{space_id}/environments/{env_id}/collections/{collection_id}/items/{item_id}/revision/{revision_id}/checkout" + }; + } /** - * Расчет значений по существующим данным. Например, получение среднего значения поля - */ - rpc Aggregate(AggregateRequest) returns(AggregateResponse) {} + * Расчет значений по существующим данным. Например, получение среднего значения поля + */ + rpc Aggregate(AggregateRequest) returns(AggregateResponse) { + option (google.api.http) = { + get: "/content/v1/spaces/{space_id}/environments/{env_id}/collections/{collection_id}/items/aggregate" + }; + } /** - * Расчет значений по существующим **опубликованным** данным. - */ - rpc AggregatePublished(AggregatePublishedRequest) returns(AggregatePublishedResponse) {} + * Расчет значений по существующим **опубликованным** данным. + */ + rpc AggregatePublished(AggregatePublishedRequest) returns(AggregatePublishedResponse) { + option (google.api.http) = { + get: "/content/v1/spaces/{space_id}/environments/{env_id}/collections/{collection_id}/items/published/aggregate" + }; + } - rpc GetRevision(GetRevisionRequest) returns(GetRevisionResponse) {} - rpc ListRevisions(ListRevisionsRequest) returns(ListRevisionsResponse) {} + /** + * Получение ревизии записи + */ + rpc GetRevision(GetRevisionRequest) returns(GetRevisionResponse) { + option (google.api.http) = { + get: "/content/v1/spaces/{space_id}/environments/{env_id}/collections/{collection_id}/items/{item_id}/revision/{revision_id}" + }; + } + /** + * Получение списка ревизий записей + */ + rpc ListRevisions(ListRevisionsRequest) returns(ListRevisionsResponse) { + option (google.api.http) = { + get: "/content/v1/spaces/{space_id}/environments/{env_id}/collections/{collection_id}/items/{item_id}/revisions" + }; + } - rpc Archive(ArchiveRequest) returns(google.protobuf.Empty) {} - rpc FindArchived(FindArchivedRequest) returns(FindArchivedResponse) {} - rpc Unarchive(UnarchiveRequest) returns(google.protobuf.Empty) {} - rpc GetArchived(GetArchivedRequest) returns(GetArchivedResponse) {} + /** + * Архивирование записей + */ + rpc Archive(ArchiveRequest) returns(google.protobuf.Empty) { + option (google.api.http) = { + patch: "/content/v1/spaces/{item.space_id}/environments/{item.env_id}/collections/{item.collection_id}/items/{item.id}/archive" + body: "item" + }; + } + /** + * Поиск архированных записей + */ + rpc FindArchived(FindArchivedRequest) returns(FindArchivedResponse) { + option (google.api.http) = { + get: "/content/v1/spaces/{space_id}/environments/{env_id}/collections/{collection_id}/items/archived" + }; + } + /** + * Разархивирование записей + */ + rpc Unarchive(UnarchiveRequest) returns(google.protobuf.Empty) { + option (google.api.http) = { + patch: "/content/v1/spaces/{item.space_id}/environments/{item.env_id}/collections/{item.collection_id}/items/{item.id}/unarchive" + body: "item" + }; + } + /** + * Получение архивной записи + */ + rpc GetArchived(GetArchivedRequest) returns(GetArchivedResponse) { + option (google.api.http) = { + get: "/content/v1/spaces/{space_id}/environments/{env_id}/collections/{collection_id}/items/{item_id}/archived" + }; + } }