xref: /aosp_15_r20/external/googleapis/google/cloud/contentwarehouse/v1/document_link_service.proto (revision d5c09012810ac0c9f33fe448fb6da8260d444cc9)
1// Copyright 2023 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
15syntax = "proto3";
16
17package google.cloud.contentwarehouse.v1;
18
19import "google/api/annotations.proto";
20import "google/api/client.proto";
21import "google/api/field_behavior.proto";
22import "google/api/resource.proto";
23import "google/cloud/contentwarehouse/v1/common.proto";
24import "google/cloud/contentwarehouse/v1/document.proto";
25import "google/protobuf/empty.proto";
26import "google/protobuf/timestamp.proto";
27
28option csharp_namespace = "Google.Cloud.ContentWarehouse.V1";
29option go_package = "cloud.google.com/go/contentwarehouse/apiv1/contentwarehousepb;contentwarehousepb";
30option java_multiple_files = true;
31option java_outer_classname = "DocumentLinkServiceProto";
32option java_package = "com.google.cloud.contentwarehouse.v1";
33option php_namespace = "Google\\Cloud\\ContentWarehouse\\V1";
34option ruby_package = "Google::Cloud::ContentWarehouse::V1";
35
36// This service lets you manage document-links.
37// Document-Links are treated as sub-resources under source documents.
38service DocumentLinkService {
39  option (google.api.default_host) = "contentwarehouse.googleapis.com";
40  option (google.api.oauth_scopes) =
41      "https://www.googleapis.com/auth/cloud-platform";
42
43  // Return all target document-links from the document.
44  rpc ListLinkedTargets(ListLinkedTargetsRequest)
45      returns (ListLinkedTargetsResponse) {
46    option (google.api.http) = {
47      post: "/v1/{parent=projects/*/locations/*/documents/*}/linkedTargets"
48      body: "*"
49    };
50    option (google.api.method_signature) = "parent";
51  }
52
53  // Return all source document-links from the document.
54  rpc ListLinkedSources(ListLinkedSourcesRequest)
55      returns (ListLinkedSourcesResponse) {
56    option (google.api.http) = {
57      post: "/v1/{parent=projects/*/locations/*/documents/*}/linkedSources"
58      body: "*"
59    };
60    option (google.api.method_signature) = "parent";
61  }
62
63  // Create a link between a source document and a target document.
64  rpc CreateDocumentLink(CreateDocumentLinkRequest) returns (DocumentLink) {
65    option (google.api.http) = {
66      post: "/v1/{parent=projects/*/locations/*/documents/*}/documentLinks"
67      body: "*"
68    };
69    option (google.api.method_signature) = "parent,document_link";
70  }
71
72  // Remove the link between the source and target documents.
73  rpc DeleteDocumentLink(DeleteDocumentLinkRequest)
74      returns (google.protobuf.Empty) {
75    option (google.api.http) = {
76      post: "/v1/{name=projects/*/locations/*/documents/*/documentLinks/*}:delete"
77      body: "*"
78    };
79    option (google.api.method_signature) = "name";
80  }
81}
82
83// Response message for DocumentLinkService.ListLinkedTargets.
84message ListLinkedTargetsResponse {
85  // Target document-links.
86  repeated DocumentLink document_links = 1;
87
88  // A token, which can be sent as `page_token` to retrieve the next page.
89  // If this field is omitted, there are no subsequent pages.
90  string next_page_token = 2;
91}
92
93// Request message for DocumentLinkService.ListLinkedTargets.
94message ListLinkedTargetsRequest {
95  // Required. The name of the document, for which all target links are
96  // returned. Format:
97  // projects/{project_number}/locations/{location}/documents/{target_document_id}.
98  string parent = 1 [
99    (google.api.field_behavior) = REQUIRED,
100    (google.api.resource_reference) = {
101      type: "contentwarehouse.googleapis.com/Document"
102    }
103  ];
104
105  // The meta information collected about the document creator, used to enforce
106  // access control for the service.
107  RequestMetadata request_metadata = 2;
108}
109
110// Response message for DocumentLinkService.ListLinkedSources.
111message ListLinkedSourcesResponse {
112  // Source document-links.
113  repeated DocumentLink document_links = 1;
114
115  // A token, which can be sent as `page_token` to retrieve the next page.
116  // If this field is omitted, there are no subsequent pages.
117  string next_page_token = 2;
118}
119
120// Response message for DocumentLinkService.ListLinkedSources.
121message ListLinkedSourcesRequest {
122  // Required. The name of the document, for which all source links are
123  // returned. Format:
124  // projects/{project_number}/locations/{location}/documents/{source_document_id}.
125  string parent = 1 [
126    (google.api.field_behavior) = REQUIRED,
127    (google.api.resource_reference) = {
128      type: "contentwarehouse.googleapis.com/Document"
129    }
130  ];
131
132  // The maximum number of document-links to return. The service may return
133  // fewer than this value.
134  //
135  // If unspecified, at most 50 document-links will be returned.
136  // The maximum value is 1000; values above 1000 will be coerced to 1000.
137  int32 page_size = 3;
138
139  // A page token, received from a previous `ListLinkedSources` call.
140  // Provide this to retrieve the subsequent page.
141  //
142  // When paginating, all other parameters provided to `ListLinkedSources`
143  // must match the call that provided the page token.
144  string page_token = 4;
145
146  // The meta information collected about the document creator, used to enforce
147  // access control for the service.
148  RequestMetadata request_metadata = 2;
149}
150
151// A document-link between source and target document.
152message DocumentLink {
153  option (google.api.resource) = {
154    type: "contentwarehouse.googleapis.com/DocumentLink"
155    pattern: "projects/{project}/locations/{location}/documents/{document}/documentLinks/{document_link}"
156  };
157
158  // The state of a document-link.
159  enum State {
160    // Unknown state of documentlink.
161    STATE_UNSPECIFIED = 0;
162
163    // The documentlink has both source and target documents detected.
164    ACTIVE = 1;
165
166    // Target document is deleted, and mark the documentlink as soft-deleted.
167    SOFT_DELETED = 2;
168  }
169
170  // Name of this document-link.
171  // It is required that the parent derived form the name to be consistent with
172  // the source document reference. Otherwise an exception will be thrown.
173  // Format:
174  // projects/{project_number}/locations/{location}/documents/{source_document_id}/documentLinks/{document_link_id}.
175  string name = 1;
176
177  // Document references of the source document.
178  DocumentReference source_document_reference = 2;
179
180  // Document references of the target document.
181  DocumentReference target_document_reference = 3;
182
183  // Description of this document-link.
184  string description = 4;
185
186  // Output only. The time when the documentLink is last updated.
187  google.protobuf.Timestamp update_time = 5
188      [(google.api.field_behavior) = OUTPUT_ONLY];
189
190  // Output only. The time when the documentLink is created.
191  google.protobuf.Timestamp create_time = 6
192      [(google.api.field_behavior) = OUTPUT_ONLY];
193
194  // The state of the documentlink. If target node has been deleted, the
195  // link is marked as invalid. Removing a source node will result in removal
196  // of all associated links.
197  State state = 7;
198}
199
200// Request message for DocumentLinkService.CreateDocumentLink.
201message CreateDocumentLinkRequest {
202  // Required. Parent of the document-link to be created.
203  // parent of document-link should be a document.
204  // Format:
205  // projects/{project_number}/locations/{location}/documents/{source_document_id}.
206  string parent = 1 [
207    (google.api.field_behavior) = REQUIRED,
208    (google.api.resource_reference) = {
209      type: "contentwarehouse.googleapis.com/Document"
210    }
211  ];
212
213  // Required. Document links associated with the source documents
214  // (source_document_id).
215  DocumentLink document_link = 2 [(google.api.field_behavior) = REQUIRED];
216
217  // The meta information collected about the document creator, used to enforce
218  // access control for the service.
219  RequestMetadata request_metadata = 3;
220}
221
222// Request message for DocumentLinkService.DeleteDocumentLink.
223message DeleteDocumentLinkRequest {
224  // Required. The name of the document-link to be deleted.
225  // Format:
226  // projects/{project_number}/locations/{location}/documents/{source_document_id}/documentLinks/{document_link_id}.
227  string name = 1 [
228    (google.api.field_behavior) = REQUIRED,
229    (google.api.resource_reference) = {
230      type: "contentwarehouse.googleapis.com/DocumentLink"
231    }
232  ];
233
234  // The meta information collected about the document creator, used to enforce
235  // access control for the service.
236  RequestMetadata request_metadata = 2;
237}
238