document_link_service.proto 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. // Copyright 2022 Google LLC
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. syntax = "proto3";
  15. package google.cloud.contentwarehouse.v1;
  16. import "google/api/annotations.proto";
  17. import "google/api/client.proto";
  18. import "google/api/field_behavior.proto";
  19. import "google/api/resource.proto";
  20. import "google/cloud/contentwarehouse/v1/common.proto";
  21. import "google/cloud/contentwarehouse/v1/document.proto";
  22. import "google/protobuf/empty.proto";
  23. import "google/protobuf/timestamp.proto";
  24. option go_package = "google.golang.org/genproto/googleapis/cloud/contentwarehouse/v1;contentwarehouse";
  25. option java_multiple_files = true;
  26. option java_outer_classname = "DocumentLinkServiceProto";
  27. option java_package = "com.google.cloud.contentwarehouse.v1";
  28. // This service lets you manage document-links.
  29. // Document-Links are treated as sub-resources under source documents.
  30. service DocumentLinkService {
  31. option (google.api.default_host) = "contentwarehouse.googleapis.com";
  32. option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform";
  33. // Return all target document-links from the document.
  34. rpc ListLinkedTargets(ListLinkedTargetsRequest) returns (ListLinkedTargetsResponse) {
  35. option (google.api.http) = {
  36. post: "/v1/{parent=projects/*/locations/*/documents/*}/linkedTargets"
  37. body: "*"
  38. };
  39. option (google.api.method_signature) = "parent";
  40. }
  41. // Return all source document-links from the document.
  42. rpc ListLinkedSources(ListLinkedSourcesRequest) returns (ListLinkedSourcesResponse) {
  43. option (google.api.http) = {
  44. post: "/v1/{parent=projects/*/locations/*/documents/*}/linkedSources"
  45. body: "*"
  46. };
  47. option (google.api.method_signature) = "parent";
  48. }
  49. // Create a link between a source document and a target document.
  50. rpc CreateDocumentLink(CreateDocumentLinkRequest) returns (DocumentLink) {
  51. option (google.api.http) = {
  52. post: "/v1/{parent=projects/*/locations/*/documents/*}/documentLinks"
  53. body: "*"
  54. };
  55. option (google.api.method_signature) = "parent,document_link";
  56. }
  57. // Remove the link between the source and target documents.
  58. rpc DeleteDocumentLink(DeleteDocumentLinkRequest) returns (google.protobuf.Empty) {
  59. option (google.api.http) = {
  60. post: "/v1/{name=projects/*/locations/*/documents/*/documentLinks/*}:delete"
  61. body: "*"
  62. };
  63. option (google.api.method_signature) = "name";
  64. }
  65. }
  66. // Response message for DocumentLinkService.ListLinkedTargets.
  67. message ListLinkedTargetsResponse {
  68. // Target document-links.
  69. repeated DocumentLink document_links = 1;
  70. // A token, which can be sent as `page_token` to retrieve the next page.
  71. // If this field is omitted, there are no subsequent pages.
  72. string next_page_token = 2;
  73. }
  74. // Request message for DocumentLinkService.ListLinkedTargets.
  75. message ListLinkedTargetsRequest {
  76. // Required. The name of the document, for which all target links are returned.
  77. // Format:
  78. // projects/{project_number}/locations/{location}/documents/{target_document_id}.
  79. string parent = 1 [
  80. (google.api.field_behavior) = REQUIRED,
  81. (google.api.resource_reference) = {
  82. type: "contentwarehouse.googleapis.com/Document"
  83. }
  84. ];
  85. // The meta information collected about the document creator, used to enforce
  86. // access control for the service.
  87. RequestMetadata request_metadata = 2;
  88. }
  89. // Response message for DocumentLinkService.ListLinkedSources.
  90. message ListLinkedSourcesResponse {
  91. // Source document-links.
  92. repeated DocumentLink document_links = 1;
  93. // A token, which can be sent as `page_token` to retrieve the next page.
  94. // If this field is omitted, there are no subsequent pages.
  95. string next_page_token = 2;
  96. }
  97. // Response message for DocumentLinkService.ListLinkedSources.
  98. message ListLinkedSourcesRequest {
  99. // Required. The name of the document, for which all source links are returned.
  100. // Format:
  101. // projects/{project_number}/locations/{location}/documents/{source_document_id}.
  102. string parent = 1 [
  103. (google.api.field_behavior) = REQUIRED,
  104. (google.api.resource_reference) = {
  105. type: "contentwarehouse.googleapis.com/Document"
  106. }
  107. ];
  108. // The maximum number of document-links to return. The service may return
  109. // fewer than this value.
  110. //
  111. // If unspecified, at most 50 document-links will be returned.
  112. // The maximum value is 1000; values above 1000 will be coerced to 1000.
  113. int32 page_size = 3;
  114. // A page token, received from a previous `ListLinkedSources` call.
  115. // Provide this to retrieve the subsequent page.
  116. //
  117. // When paginating, all other parameters provided to `ListLinkedSources`
  118. // must match the call that provided the page token.
  119. string page_token = 4;
  120. // The meta information collected about the document creator, used to enforce
  121. // access control for the service.
  122. RequestMetadata request_metadata = 2;
  123. }
  124. // A document-link between source and target document.
  125. message DocumentLink {
  126. option (google.api.resource) = {
  127. type: "contentwarehouse.googleapis.com/DocumentLink"
  128. pattern: "projects/{project}/locations/{location}/documents/{document}/documentLinks/{document_link}"
  129. };
  130. // The state of a document-link.
  131. enum State {
  132. // Unknown state of documentlink.
  133. STATE_UNSPECIFIED = 0;
  134. // The documentlink has both source and target documents detected.
  135. ACTIVE = 1;
  136. // Target document is deleted, and mark the documentlink as soft-deleted.
  137. SOFT_DELETED = 2;
  138. }
  139. // Name of this document-link.
  140. // It is required that the parent derived form the name to be consistent with
  141. // the source document reference. Otherwise an exception will be thrown.
  142. // Format:
  143. // projects/{project_number}/locations/{location}/documents/{source_document_id}/documentLinks/{document_link_id}.
  144. string name = 1;
  145. // Document references of the source document.
  146. DocumentReference source_document_reference = 2;
  147. // Document references of the target document.
  148. DocumentReference target_document_reference = 3;
  149. // Description of this document-link.
  150. string description = 4;
  151. // Output only. The time when the documentLink is last updated.
  152. google.protobuf.Timestamp update_time = 5 [(google.api.field_behavior) = OUTPUT_ONLY];
  153. // Output only. The time when the documentLink is created.
  154. google.protobuf.Timestamp create_time = 6 [(google.api.field_behavior) = OUTPUT_ONLY];
  155. // The state of the documentlink. If target node has been deleted, the
  156. // link is marked as invalid. Removing a source node will result in removal
  157. // of all associated links.
  158. State state = 7;
  159. }
  160. // Request message for DocumentLinkService.CreateDocumentLink.
  161. message CreateDocumentLinkRequest {
  162. // Required. Parent of the document-link to be created.
  163. // parent of document-link should be a document.
  164. // Format:
  165. // projects/{project_number}/locations/{location}/documents/{source_document_id}.
  166. string parent = 1 [
  167. (google.api.field_behavior) = REQUIRED,
  168. (google.api.resource_reference) = {
  169. type: "contentwarehouse.googleapis.com/Document"
  170. }
  171. ];
  172. // Required. Document links associated with the source documents (source_document_id).
  173. DocumentLink document_link = 2 [(google.api.field_behavior) = REQUIRED];
  174. // The meta information collected about the document creator, used to enforce
  175. // access control for the service.
  176. RequestMetadata request_metadata = 3;
  177. }
  178. // Request message for DocumentLinkService.DeleteDocumentLink.
  179. message DeleteDocumentLinkRequest {
  180. // Required. The name of the document-link to be deleted.
  181. // Format:
  182. // projects/{project_number}/locations/{location}/documents/{source_document_id}/documentLinks/{document_link_id}.
  183. string name = 1 [
  184. (google.api.field_behavior) = REQUIRED,
  185. (google.api.resource_reference) = {
  186. type: "contentwarehouse.googleapis.com/DocumentLink"
  187. }
  188. ];
  189. // The meta information collected about the document creator, used to enforce
  190. // access control for the service.
  191. RequestMetadata request_metadata = 2;
  192. }