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 1/2] =?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


From 07985562fbbe18c1785d522b63a86cce016d025d Mon Sep 17 00:00:00 2001
From: ko_oler <kooler89@gmail.com>
Date: Thu, 20 Feb 2025 17:23:31 +0300
Subject: [PATCH 2/2] =?UTF-8?q?=D0=B8=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?=
 =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=BF=D0=BE=20=D1=80=D0=B5=D0=B2?=
 =?UTF-8?q?=D1=8C=D1=8E?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 proto/items/items.proto | 109 +++++++++++++++++++++++++++-------------
 1 file changed, 74 insertions(+), 35 deletions(-)

diff --git a/proto/items/items.proto b/proto/items/items.proto
index 2cfeaff..47fb2b8 100644
--- a/proto/items/items.proto
+++ b/proto/items/items.proto
@@ -445,140 +445,179 @@ message GetArchivedResponse {
  */
 service Items {
   /**
-   * Создать запись
-   */
+  * Создать запись
+  */
   rpc Create(CreateRequest) returns(CreateResponse) {
     option (google.api.http) = {
-      post: "/v1/content/spaces/{space_id}/environments/{env_id}/collections/{collection_id}/items/create"
+      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) {
     option (google.api.http) = {
-      post: "/v1/content/spaces/{space_id}/environments/{env_id}/collections/{collection_id}/items/introspect"
+      post: "/content/v1/spaces/{item.space_id}/environments/{item.env_id}/collections/{item.collection_id}/items"
       body: "item"
     };
   }
 
   /**
-   * Получение записи по идентификатору
-   */
+  * Получение записи по идентификатору
+  */
   rpc Get(GetRequest) returns(GetResponse) {
     option (google.api.http) = {
-      get: "/v1/content/spaces/{space_id}/environments/{env_id}/collections/{collection_id}/items/{item_id}"
+      get: "/content/v1/spaces/{space_id}/environments/{env_id}/collections/{collection_id}/items/{item_id}"
     };
   }
 
   /**
-   * Поиск по текущим записям
-   */
+  * Поиск по текущим записям
+  */
   rpc Find(FindRequest) returns(FindResponse) {
     option (google.api.http) = {
-      get: "/v1/content/spaces/{space_id}/environments/{env_id}/collections/{collection_id}/items/find"
+      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: "/v1/content/spaces/{item.space_id}/environments/{item.env_id}/collections/{item.collection_id}/items/{item.id}"
+      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: "/v1/content/spaces/{item.space_id}/environments/{item.env_id}/collections/{item.collection_id}/items/{item.id}/{options.update_attrs}/{options.erase}"
+      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) = {
-      post: "/v1/content/spaces/{item.space_id}/environments/{item.env_id}/collections/{item.collection_id}/items/{item.id}/undelete"
+      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) = {
-      post: "/v1/content/spaces/{item.space_id}/environments/{item.env_id}/collections/{item.collection_id}/items/{item.id}/publish"
+      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) = {
-      post: "/v1/content/spaces/{item.space_id}/environments/{item.env_id}/collections/{item.collection_id}/items/{item.id}/unpublish"
+      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: "/v1/content/spaces/{space_id}/environments/{env_id}/collections/{collection_id}/items/{item_id}/published"
+      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: "/v1/content/spaces/{space_id}/environments/{env_id}/collections/{collection_id}/items/find/published"
+      get: "/content/v1/spaces/{space_id}/environments/{env_id}/collections/{collection_id}/items/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"
+      get: "/content/v1/spaces/{space_id}/environments/{env_id}/collections/{collection_id}/items/{item_id}/revision/{revision_id}/checkout"
     };
   }
 
   /**
-   * Расчет значений по существующим данным. Например, получение среднего значения поля
-   */
+  * Расчет значений по существующим данным. Например, получение среднего значения поля
+  */
   rpc Aggregate(AggregateRequest) returns(AggregateResponse) {
     option (google.api.http) = {
-      post: "/v1/content/spaces/{space_id}/environments/{env_id}/collections/{collection_id}/items/aggregate"
-      body: "*"
+      get: "/content/v1/spaces/{space_id}/environments/{env_id}/collections/{collection_id}/items/aggregate"
     };
   }
 
 
   /**
-   * Расчет значений по существующим **опубликованным** данным.
-   */
+  * Расчет значений по существующим **опубликованным** данным.
+  */
   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: "*"
+      get: "/content/v1/spaces/{space_id}/environments/{env_id}/collections/{collection_id}/items/published/aggregate"
     };
   }
 
+  /**
+  * Получение ревизии записи
+  */
   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}"
+      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: "/v1/content/spaces/{space_id}/environments/{env_id}/collections/{collection_id}/items/{item_id}/revisions"
+      get: "/content/v1/spaces/{space_id}/environments/{env_id}/collections/{collection_id}/items/{item_id}/revisions"
     };
   }
 
+  /**
+  * Архивирование записей
+  */
   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"
+      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: "/v1/content/spaces/{space_id}/environments/{env_id}/collections/{collection_id}/items/find/archived"
+      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) = {
-      post: "/v1/content/spaces/{item.space_id}/environments/{item.env_id}/collections/{item.collection_id}/items/{item.id}/unarchive"
+      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: "/v1/content/spaces/{space_id}/environments/{env_id}/collections/{collection_id}/items/{item_id}/archived"
+      get: "/content/v1/spaces/{space_id}/environments/{env_id}/collections/{collection_id}/items/{item_id}/archived"
     };
   }
 }
-- 
GitLab