Skip to content

Commit d7275b3

Browse files
feat: add php, csharp, ruby client library API support (#9310)
* feat: add php, csharp, ruby client library API support feat: add `DocumentCreatorDefaultRole`, `ContentCategory`, `RetrievalImportance`, `SchemaSource`, `TotalResultSize`, `LockDocumentRequest`, `CustomWeightsMetadata`, `WeightedSchemaProperty` to Document Warehouse API v1 feat: add `content_category`, `text_extraction_enabled`, `retrieval_importance`, `schema_sources`, `total_result_size` fields to Document Warehouse API v1 feat: deprecate `text_extraction_disabled`, `structured_content_uri`, `async_enabled` field in Document Warehouse API v1 feat: add LockDocument service to Document Warehouse API v1 feat: update documentation PiperOrigin-RevId: 521802435 Source-Link: googleapis/googleapis@b2b7864 Source-Link: https://github.com/googleapis/googleapis-gen/commit/1956d61afcd74d3871ea2adf5a18dc002fc62107 Copy-Tag: eyJwIjoiamF2YS1jb250ZW50d2FyZWhvdXNlLy5Pd2xCb3QueWFtbCIsImgiOiIxOTU2ZDYxYWZjZDc0ZDM4NzFlYTJhZGY1YTE4ZGMwMDJmYzYyMTA3In0= * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent c0abb2c commit d7275b3

File tree

100 files changed

+10793
-1130
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+10793
-1130
lines changed

java-contentwarehouse/google-cloud-contentwarehouse/src/main/java/com/google/cloud/contentwarehouse/v1/DocumentServiceClient.java

Lines changed: 140 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -898,6 +898,129 @@ public final SearchDocumentsPagedResponse searchDocuments(SearchDocumentsRequest
898898
return stub.searchDocumentsCallable();
899899
}
900900

901+
// AUTO-GENERATED DOCUMENTATION AND METHOD.
902+
/**
903+
* Lock the document so the document cannot be updated by other users.
904+
*
905+
* <p>Sample code:
906+
*
907+
* <pre>{@code
908+
* // This snippet has been automatically generated and should be regarded as a code template only.
909+
* // It will require modifications to work:
910+
* // - It may require correct/in-range values for request initialization.
911+
* // - It may require specifying regional endpoints when creating the service client as shown in
912+
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
913+
* try (DocumentServiceClient documentServiceClient = DocumentServiceClient.create()) {
914+
* DocumentName name =
915+
* DocumentName.ofProjectLocationDocumentName("[PROJECT]", "[LOCATION]", "[DOCUMENT]");
916+
* Document response = documentServiceClient.lockDocument(name);
917+
* }
918+
* }</pre>
919+
*
920+
* @param name Required. The name of the document to lock. Format:
921+
* projects/{project_number}/locations/{location}/documents/{document}.
922+
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
923+
*/
924+
public final Document lockDocument(DocumentName name) {
925+
LockDocumentRequest request =
926+
LockDocumentRequest.newBuilder().setName(name == null ? null : name.toString()).build();
927+
return lockDocument(request);
928+
}
929+
930+
// AUTO-GENERATED DOCUMENTATION AND METHOD.
931+
/**
932+
* Lock the document so the document cannot be updated by other users.
933+
*
934+
* <p>Sample code:
935+
*
936+
* <pre>{@code
937+
* // This snippet has been automatically generated and should be regarded as a code template only.
938+
* // It will require modifications to work:
939+
* // - It may require correct/in-range values for request initialization.
940+
* // - It may require specifying regional endpoints when creating the service client as shown in
941+
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
942+
* try (DocumentServiceClient documentServiceClient = DocumentServiceClient.create()) {
943+
* String name =
944+
* DocumentName.ofProjectLocationDocumentName("[PROJECT]", "[LOCATION]", "[DOCUMENT]")
945+
* .toString();
946+
* Document response = documentServiceClient.lockDocument(name);
947+
* }
948+
* }</pre>
949+
*
950+
* @param name Required. The name of the document to lock. Format:
951+
* projects/{project_number}/locations/{location}/documents/{document}.
952+
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
953+
*/
954+
public final Document lockDocument(String name) {
955+
LockDocumentRequest request = LockDocumentRequest.newBuilder().setName(name).build();
956+
return lockDocument(request);
957+
}
958+
959+
// AUTO-GENERATED DOCUMENTATION AND METHOD.
960+
/**
961+
* Lock the document so the document cannot be updated by other users.
962+
*
963+
* <p>Sample code:
964+
*
965+
* <pre>{@code
966+
* // This snippet has been automatically generated and should be regarded as a code template only.
967+
* // It will require modifications to work:
968+
* // - It may require correct/in-range values for request initialization.
969+
* // - It may require specifying regional endpoints when creating the service client as shown in
970+
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
971+
* try (DocumentServiceClient documentServiceClient = DocumentServiceClient.create()) {
972+
* LockDocumentRequest request =
973+
* LockDocumentRequest.newBuilder()
974+
* .setName(
975+
* DocumentName.ofProjectLocationDocumentName(
976+
* "[PROJECT]", "[LOCATION]", "[DOCUMENT]")
977+
* .toString())
978+
* .setCollectionId("collectionId1636075609")
979+
* .setLockingUser(UserInfo.newBuilder().build())
980+
* .build();
981+
* Document response = documentServiceClient.lockDocument(request);
982+
* }
983+
* }</pre>
984+
*
985+
* @param request The request object containing all of the parameters for the API call.
986+
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
987+
*/
988+
public final Document lockDocument(LockDocumentRequest request) {
989+
return lockDocumentCallable().call(request);
990+
}
991+
992+
// AUTO-GENERATED DOCUMENTATION AND METHOD.
993+
/**
994+
* Lock the document so the document cannot be updated by other users.
995+
*
996+
* <p>Sample code:
997+
*
998+
* <pre>{@code
999+
* // This snippet has been automatically generated and should be regarded as a code template only.
1000+
* // It will require modifications to work:
1001+
* // - It may require correct/in-range values for request initialization.
1002+
* // - It may require specifying regional endpoints when creating the service client as shown in
1003+
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1004+
* try (DocumentServiceClient documentServiceClient = DocumentServiceClient.create()) {
1005+
* LockDocumentRequest request =
1006+
* LockDocumentRequest.newBuilder()
1007+
* .setName(
1008+
* DocumentName.ofProjectLocationDocumentName(
1009+
* "[PROJECT]", "[LOCATION]", "[DOCUMENT]")
1010+
* .toString())
1011+
* .setCollectionId("collectionId1636075609")
1012+
* .setLockingUser(UserInfo.newBuilder().build())
1013+
* .build();
1014+
* ApiFuture<Document> future = documentServiceClient.lockDocumentCallable().futureCall(request);
1015+
* // Do something.
1016+
* Document response = future.get();
1017+
* }
1018+
* }</pre>
1019+
*/
1020+
public final UnaryCallable<LockDocumentRequest, Document> lockDocumentCallable() {
1021+
return stub.lockDocumentCallable();
1022+
}
1023+
9011024
// AUTO-GENERATED DOCUMENTATION AND METHOD.
9021025
/**
9031026
* Gets the access control policy for a resource. Returns NOT_FOUND error if the resource does not
@@ -919,8 +1042,9 @@ public final SearchDocumentsPagedResponse searchDocuments(SearchDocumentsRequest
9191042
*
9201043
* @param resource Required. REQUIRED: The resource for which the policy is being requested.
9211044
* Format for document:
922-
* projects/{project_number}/locations/{location}/documents/{document_id}. Format for project:
923-
* projects/{project_number}.
1045+
* projects/{project_number}/locations/{location}/documents/{document_id}. Format for
1046+
* collection: projects/{project_number}/locations/{location}/collections/{collection_id}.
1047+
* Format for project: projects/{project_number}.
9241048
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
9251049
*/
9261050
public final FetchAclResponse fetchAcl(String resource) {
@@ -1011,10 +1135,21 @@ public final UnaryCallable<FetchAclRequest, FetchAclResponse> fetchAclCallable()
10111135
*
10121136
* @param resource Required. REQUIRED: The resource for which the policy is being requested.
10131137
* Format for document:
1014-
* projects/{project_number}/locations/{location}/documents/{document_id}. Format for project:
1015-
* projects/{project_number}.
1138+
* projects/{project_number}/locations/{location}/documents/{document_id}. Format for
1139+
* collection: projects/{project_number}/locations/{location}/collections/{collection_id}.
1140+
* Format for project: projects/{project_number}.
10161141
* @param policy Required. REQUIRED: The complete policy to be applied to the `resource`. The size
1017-
* of the policy is limited to a few 10s of KB.
1142+
* of the policy is limited to a few 10s of KB. This refers to an Identity and Access (IAM)
1143+
* policy, which specifies access controls for the Document.
1144+
* <p>You can set ACL with condition for projects only.
1145+
* <p>Supported operators are: `=`, `!=`, `&lt;`, `&lt;=`, `&gt;`, and `&gt;=` where the left
1146+
* of the operator is `DocumentSchemaId` or property name and the right of the operator is a
1147+
* number or a quoted string. You must escape backslash (\\\\) and quote (\\") characters.
1148+
* <p>Boolean expressions (AND/OR) are supported up to 3 levels of nesting (for example, "((A
1149+
* AND B AND C) OR D) AND E"), a maximum of 10 comparisons are allowed in the expression. The
1150+
* expression must be &lt; 6000 bytes in length.
1151+
* <p>Sample condition: `"DocumentSchemaId = \\"some schema id\\" OR
1152+
* SchemaId.floatPropertyName &gt;= 10"`
10181153
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
10191154
*/
10201155
public final SetAclResponse setAcl(String resource, Policy policy) {

java-contentwarehouse/google-cloud-contentwarehouse/src/main/java/com/google/cloud/contentwarehouse/v1/DocumentServiceSettings.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,11 @@ public UnaryCallSettings<DeleteDocumentRequest, Empty> deleteDocumentSettings()
104104
return ((DocumentServiceStubSettings) getStubSettings()).searchDocumentsSettings();
105105
}
106106

107+
/** Returns the object with the settings used for calls to lockDocument. */
108+
public UnaryCallSettings<LockDocumentRequest, Document> lockDocumentSettings() {
109+
return ((DocumentServiceStubSettings) getStubSettings()).lockDocumentSettings();
110+
}
111+
107112
/** Returns the object with the settings used for calls to fetchAcl. */
108113
public UnaryCallSettings<FetchAclRequest, FetchAclResponse> fetchAclSettings() {
109114
return ((DocumentServiceStubSettings) getStubSettings()).fetchAclSettings();
@@ -258,6 +263,11 @@ public UnaryCallSettings.Builder<DeleteDocumentRequest, Empty> deleteDocumentSet
258263
return getStubSettingsBuilder().searchDocumentsSettings();
259264
}
260265

266+
/** Returns the builder for the settings used for calls to lockDocument. */
267+
public UnaryCallSettings.Builder<LockDocumentRequest, Document> lockDocumentSettings() {
268+
return getStubSettingsBuilder().lockDocumentSettings();
269+
}
270+
261271
/** Returns the builder for the settings used for calls to fetchAcl. */
262272
public UnaryCallSettings.Builder<FetchAclRequest, FetchAclResponse> fetchAclSettings() {
263273
return getStubSettingsBuilder().fetchAclSettings();

java-contentwarehouse/google-cloud-contentwarehouse/src/main/java/com/google/cloud/contentwarehouse/v1/gapic_metadata.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@
6767
"GetDocument": {
6868
"methods": ["getDocument", "getDocument", "getDocument", "getDocumentCallable"]
6969
},
70+
"LockDocument": {
71+
"methods": ["lockDocument", "lockDocument", "lockDocument", "lockDocumentCallable"]
72+
},
7073
"SearchDocuments": {
7174
"methods": ["searchDocuments", "searchDocuments", "searchDocuments", "searchDocumentsPagedCallable", "searchDocumentsCallable"]
7275
},

java-contentwarehouse/google-cloud-contentwarehouse/src/main/java/com/google/cloud/contentwarehouse/v1/package-info.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616

1717
/**
18-
* A client to contentwarehouse API
18+
* A client to Document AI Warehouse API
1919
*
2020
* <p>The interfaces provided are listed below, along with usage samples.
2121
*

java-contentwarehouse/google-cloud-contentwarehouse/src/main/java/com/google/cloud/contentwarehouse/v1/stub/DocumentServiceStub.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import com.google.cloud.contentwarehouse.v1.FetchAclRequest;
2828
import com.google.cloud.contentwarehouse.v1.FetchAclResponse;
2929
import com.google.cloud.contentwarehouse.v1.GetDocumentRequest;
30+
import com.google.cloud.contentwarehouse.v1.LockDocumentRequest;
3031
import com.google.cloud.contentwarehouse.v1.SearchDocumentsRequest;
3132
import com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse;
3233
import com.google.cloud.contentwarehouse.v1.SetAclRequest;
@@ -70,6 +71,10 @@ public UnaryCallable<SearchDocumentsRequest, SearchDocumentsResponse> searchDocu
7071
throw new UnsupportedOperationException("Not implemented: searchDocumentsCallable()");
7172
}
7273

74+
public UnaryCallable<LockDocumentRequest, Document> lockDocumentCallable() {
75+
throw new UnsupportedOperationException("Not implemented: lockDocumentCallable()");
76+
}
77+
7378
public UnaryCallable<FetchAclRequest, FetchAclResponse> fetchAclCallable() {
7479
throw new UnsupportedOperationException("Not implemented: fetchAclCallable()");
7580
}

java-contentwarehouse/google-cloud-contentwarehouse/src/main/java/com/google/cloud/contentwarehouse/v1/stub/DocumentServiceStubSettings.java

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
import com.google.cloud.contentwarehouse.v1.FetchAclRequest;
5151
import com.google.cloud.contentwarehouse.v1.FetchAclResponse;
5252
import com.google.cloud.contentwarehouse.v1.GetDocumentRequest;
53+
import com.google.cloud.contentwarehouse.v1.LockDocumentRequest;
5354
import com.google.cloud.contentwarehouse.v1.SearchDocumentsRequest;
5455
import com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse;
5556
import com.google.cloud.contentwarehouse.v1.SetAclRequest;
@@ -119,6 +120,7 @@ public class DocumentServiceStubSettings extends StubSettings<DocumentServiceStu
119120
private final PagedCallSettings<
120121
SearchDocumentsRequest, SearchDocumentsResponse, SearchDocumentsPagedResponse>
121122
searchDocumentsSettings;
123+
private final UnaryCallSettings<LockDocumentRequest, Document> lockDocumentSettings;
122124
private final UnaryCallSettings<FetchAclRequest, FetchAclResponse> fetchAclSettings;
123125
private final UnaryCallSettings<SetAclRequest, SetAclResponse> setAclSettings;
124126

@@ -214,6 +216,11 @@ public UnaryCallSettings<DeleteDocumentRequest, Empty> deleteDocumentSettings()
214216
return searchDocumentsSettings;
215217
}
216218

219+
/** Returns the object with the settings used for calls to lockDocument. */
220+
public UnaryCallSettings<LockDocumentRequest, Document> lockDocumentSettings() {
221+
return lockDocumentSettings;
222+
}
223+
217224
/** Returns the object with the settings used for calls to fetchAcl. */
218225
public UnaryCallSettings<FetchAclRequest, FetchAclResponse> fetchAclSettings() {
219226
return fetchAclSettings;
@@ -335,6 +342,7 @@ protected DocumentServiceStubSettings(Builder settingsBuilder) throws IOExceptio
335342
updateDocumentSettings = settingsBuilder.updateDocumentSettings().build();
336343
deleteDocumentSettings = settingsBuilder.deleteDocumentSettings().build();
337344
searchDocumentsSettings = settingsBuilder.searchDocumentsSettings().build();
345+
lockDocumentSettings = settingsBuilder.lockDocumentSettings().build();
338346
fetchAclSettings = settingsBuilder.fetchAclSettings().build();
339347
setAclSettings = settingsBuilder.setAclSettings().build();
340348
}
@@ -351,6 +359,7 @@ public static class Builder extends StubSettings.Builder<DocumentServiceStubSett
351359
private final PagedCallSettings.Builder<
352360
SearchDocumentsRequest, SearchDocumentsResponse, SearchDocumentsPagedResponse>
353361
searchDocumentsSettings;
362+
private final UnaryCallSettings.Builder<LockDocumentRequest, Document> lockDocumentSettings;
354363
private final UnaryCallSettings.Builder<FetchAclRequest, FetchAclResponse> fetchAclSettings;
355364
private final UnaryCallSettings.Builder<SetAclRequest, SetAclResponse> setAclSettings;
356365
private static final ImmutableMap<String, ImmutableSet<StatusCode.Code>>
@@ -366,6 +375,7 @@ public static class Builder extends StubSettings.Builder<DocumentServiceStubSett
366375
ImmutableSet.copyOf(Lists.<StatusCode.Code>newArrayList(StatusCode.Code.UNAVAILABLE)));
367376
definitions.put(
368377
"no_retry_1_codes", ImmutableSet.copyOf(Lists.<StatusCode.Code>newArrayList()));
378+
definitions.put("no_retry_codes", ImmutableSet.copyOf(Lists.<StatusCode.Code>newArrayList()));
369379
RETRYABLE_CODE_DEFINITIONS = definitions.build();
370380
}
371381

@@ -401,6 +411,8 @@ public static class Builder extends StubSettings.Builder<DocumentServiceStubSett
401411
.setTotalTimeout(Duration.ofMillis(60000L))
402412
.build();
403413
definitions.put("no_retry_1_params", settings);
414+
settings = RetrySettings.newBuilder().setRpcTimeoutMultiplier(1.0).build();
415+
definitions.put("no_retry_params", settings);
404416
RETRY_PARAM_DEFINITIONS = definitions.build();
405417
}
406418

@@ -416,6 +428,7 @@ protected Builder(ClientContext clientContext) {
416428
updateDocumentSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
417429
deleteDocumentSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
418430
searchDocumentsSettings = PagedCallSettings.newBuilder(SEARCH_DOCUMENTS_PAGE_STR_FACT);
431+
lockDocumentSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
419432
fetchAclSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
420433
setAclSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
421434

@@ -426,6 +439,7 @@ protected Builder(ClientContext clientContext) {
426439
updateDocumentSettings,
427440
deleteDocumentSettings,
428441
searchDocumentsSettings,
442+
lockDocumentSettings,
429443
fetchAclSettings,
430444
setAclSettings);
431445
initDefaults(this);
@@ -439,6 +453,7 @@ protected Builder(DocumentServiceStubSettings settings) {
439453
updateDocumentSettings = settings.updateDocumentSettings.toBuilder();
440454
deleteDocumentSettings = settings.deleteDocumentSettings.toBuilder();
441455
searchDocumentsSettings = settings.searchDocumentsSettings.toBuilder();
456+
lockDocumentSettings = settings.lockDocumentSettings.toBuilder();
442457
fetchAclSettings = settings.fetchAclSettings.toBuilder();
443458
setAclSettings = settings.setAclSettings.toBuilder();
444459

@@ -449,6 +464,7 @@ protected Builder(DocumentServiceStubSettings settings) {
449464
updateDocumentSettings,
450465
deleteDocumentSettings,
451466
searchDocumentsSettings,
467+
lockDocumentSettings,
452468
fetchAclSettings,
453469
setAclSettings);
454470
}
@@ -505,6 +521,11 @@ private static Builder initDefaults(Builder builder) {
505521
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_2_codes"))
506522
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_2_params"));
507523

524+
builder
525+
.lockDocumentSettings()
526+
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes"))
527+
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params"));
528+
508529
builder
509530
.fetchAclSettings()
510531
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes"))
@@ -562,6 +583,11 @@ public UnaryCallSettings.Builder<DeleteDocumentRequest, Empty> deleteDocumentSet
562583
return searchDocumentsSettings;
563584
}
564585

586+
/** Returns the builder for the settings used for calls to lockDocument. */
587+
public UnaryCallSettings.Builder<LockDocumentRequest, Document> lockDocumentSettings() {
588+
return lockDocumentSettings;
589+
}
590+
565591
/** Returns the builder for the settings used for calls to fetchAcl. */
566592
public UnaryCallSettings.Builder<FetchAclRequest, FetchAclResponse> fetchAclSettings() {
567593
return fetchAclSettings;

0 commit comments

Comments
 (0)