From f491555278dc7f4fdd96758c8540f04deb8b8918 Mon Sep 17 00:00:00 2001 From: ko_oler <kooler89@gmail.com> Date: Wed, 19 Feb 2025 11:36:54 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D1=8B=20=D0=B0=D0=BD=D0=BD=D0=BE=D1=82=D0=B0=D1=86=D0=B8?= =?UTF-8?q?=D0=B8=20(google.api.http)=20=D0=B2=20=D1=81=D0=BF=D0=B5=D1=86?= =?UTF-8?q?=D0=B8=D1=84=D0=B8=D0=BA=D0=B0=D1=86=D0=B8=D1=8E=20=D1=81=D0=B5?= =?UTF-8?q?=D1=80=D0=B2=D0=B8=D1=81=D0=B0=20"Items"=20=D0=B4=D0=BB=D1=8F?= =?UTF-8?q?=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D1=8B=20=D1=81=20Rest=20API?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- proto/items/items.proto | 131 ++++++++++++++++++++++++++++++++++------ 1 file changed, 111 insertions(+), 20 deletions(-) diff --git a/proto/items/items.proto b/proto/items/items.proto index 0e2ab17..2cfeaff 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"; @@ -446,48 +447,138 @@ service Items { /** * Создать запись */ - rpc Create(CreateRequest) returns(CreateResponse) {} + rpc Create(CreateRequest) returns(CreateResponse) { + option (google.api.http) = { + post: "/v1/content/spaces/{space_id}/environments/{env_id}/collections/{collection_id}/items/create" + body: "item" + }; + } /** * Валидация данных записи */ - rpc Introspect(IntrospectRequest) returns(IntrospectResponse) {} + rpc Introspect(IntrospectRequest) returns(IntrospectResponse) { + option (google.api.http) = { + post: "/v1/content/spaces/{space_id}/environments/{env_id}/collections/{collection_id}/items/introspect" + body: "item" + }; + } /** * Получение записи по идентификатору */ - rpc Get(GetRequest) returns(GetResponse) {} + rpc Get(GetRequest) returns(GetResponse) { + option (google.api.http) = { + get: "/v1/content/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 Find(FindRequest) returns(FindResponse) { + option (google.api.http) = { + get: "/v1/content/spaces/{space_id}/environments/{env_id}/collections/{collection_id}/items/find" + }; + } + rpc Update(UpdateRequest) returns(google.protobuf.Empty) { + option (google.api.http) = { + put: "/v1/content/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: "/v1/content/spaces/{item.space_id}/environments/{item.env_id}/collections/{item.collection_id}/items/{item.id}/{options.update_attrs}/{options.erase}" + }; + } + rpc Undelete(UndeleteRequest) returns(google.protobuf.Empty) { + option (google.api.http) = { + post: "/v1/content/spaces/{item.space_id}/environments/{item.env_id}/collections/{item.collection_id}/items/{item.id}/undelete" + body: "*" + }; + } - 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 Publish(PublishRequest) returns(google.protobuf.Empty) { + option (google.api.http) = { + post: "/v1/content/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) = { + post: "/v1/content/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: "/v1/content/spaces/{space_id}/environments/{env_id}/collections/{collection_id}/items/{item_id}/published" + }; + } + rpc FindPublished(FindPublishedRequest) returns(FindPublishedResponse) { + option (google.api.http) = { + get: "/v1/content/spaces/{space_id}/environments/{env_id}/collections/{collection_id}/items/find/published" + }; + } + rpc CheckoutRevision(CheckoutRevisionRequest) returns(CheckoutRevisionResponse) { + option (google.api.http) = { + get: "/v1/content/spaces/{space_id}/environments/{env_id}/collections/{collection_id}/items/{item_id}/revision/{revision_id}/checkout-revision" + }; + } /** * Расчет значений по существующим данным. Например, получение среднего значения поля */ - rpc Aggregate(AggregateRequest) returns(AggregateResponse) {} + rpc Aggregate(AggregateRequest) returns(AggregateResponse) { + option (google.api.http) = { + post: "/v1/content/spaces/{space_id}/environments/{env_id}/collections/{collection_id}/items/aggregate" + body: "*" + }; + } /** * Расчет значений по существующим **опубликованным** данным. */ - rpc AggregatePublished(AggregatePublishedRequest) returns(AggregatePublishedResponse) {} + rpc AggregatePublished(AggregatePublishedRequest) returns(AggregatePublishedResponse) { + option (google.api.http) = { + post: "/v1/content/spaces/{space_id}/environments/{env_id}/collections/{collection_id}/items/aggregate/published" + body: "*" + }; + } - rpc GetRevision(GetRevisionRequest) returns(GetRevisionResponse) {} - rpc ListRevisions(ListRevisionsRequest) returns(ListRevisionsResponse) {} + rpc GetRevision(GetRevisionRequest) returns(GetRevisionResponse) { + option (google.api.http) = { + get: "/v1/content/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: "/v1/content/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) = { + post: "/v1/content/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: "/v1/content/spaces/{space_id}/environments/{env_id}/collections/{collection_id}/items/find/archived" + }; + } + rpc Unarchive(UnarchiveRequest) returns(google.protobuf.Empty) { + option (google.api.http) = { + post: "/v1/content/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: "/v1/content/spaces/{space_id}/environments/{env_id}/collections/{collection_id}/items/{item_id}/archived" + }; + } } -- GitLab