Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add php, csharp, ruby client library API support #9310

Merged
merged 2 commits into from
Apr 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -898,6 +898,129 @@ public final SearchDocumentsPagedResponse searchDocuments(SearchDocumentsRequest
return stub.searchDocumentsCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lock the document so the document cannot be updated by other users.
*
* <p>Sample code:
*
* <pre>{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (DocumentServiceClient documentServiceClient = DocumentServiceClient.create()) {
* DocumentName name =
* DocumentName.ofProjectLocationDocumentName("[PROJECT]", "[LOCATION]", "[DOCUMENT]");
* Document response = documentServiceClient.lockDocument(name);
* }
* }</pre>
*
* @param name Required. The name of the document to lock. Format:
* projects/{project_number}/locations/{location}/documents/{document}.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final Document lockDocument(DocumentName name) {
LockDocumentRequest request =
LockDocumentRequest.newBuilder().setName(name == null ? null : name.toString()).build();
return lockDocument(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lock the document so the document cannot be updated by other users.
*
* <p>Sample code:
*
* <pre>{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (DocumentServiceClient documentServiceClient = DocumentServiceClient.create()) {
* String name =
* DocumentName.ofProjectLocationDocumentName("[PROJECT]", "[LOCATION]", "[DOCUMENT]")
* .toString();
* Document response = documentServiceClient.lockDocument(name);
* }
* }</pre>
*
* @param name Required. The name of the document to lock. Format:
* projects/{project_number}/locations/{location}/documents/{document}.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final Document lockDocument(String name) {
LockDocumentRequest request = LockDocumentRequest.newBuilder().setName(name).build();
return lockDocument(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lock the document so the document cannot be updated by other users.
*
* <p>Sample code:
*
* <pre>{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (DocumentServiceClient documentServiceClient = DocumentServiceClient.create()) {
* LockDocumentRequest request =
* LockDocumentRequest.newBuilder()
* .setName(
* DocumentName.ofProjectLocationDocumentName(
* "[PROJECT]", "[LOCATION]", "[DOCUMENT]")
* .toString())
* .setCollectionId("collectionId1636075609")
* .setLockingUser(UserInfo.newBuilder().build())
* .build();
* Document response = documentServiceClient.lockDocument(request);
* }
* }</pre>
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final Document lockDocument(LockDocumentRequest request) {
return lockDocumentCallable().call(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lock the document so the document cannot be updated by other users.
*
* <p>Sample code:
*
* <pre>{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (DocumentServiceClient documentServiceClient = DocumentServiceClient.create()) {
* LockDocumentRequest request =
* LockDocumentRequest.newBuilder()
* .setName(
* DocumentName.ofProjectLocationDocumentName(
* "[PROJECT]", "[LOCATION]", "[DOCUMENT]")
* .toString())
* .setCollectionId("collectionId1636075609")
* .setLockingUser(UserInfo.newBuilder().build())
* .build();
* ApiFuture<Document> future = documentServiceClient.lockDocumentCallable().futureCall(request);
* // Do something.
* Document response = future.get();
* }
* }</pre>
*/
public final UnaryCallable<LockDocumentRequest, Document> lockDocumentCallable() {
return stub.lockDocumentCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Gets the access control policy for a resource. Returns NOT_FOUND error if the resource does not
Expand All @@ -919,8 +1042,9 @@ public final SearchDocumentsPagedResponse searchDocuments(SearchDocumentsRequest
*
* @param resource Required. REQUIRED: The resource for which the policy is being requested.
* Format for document:
* projects/{project_number}/locations/{location}/documents/{document_id}. Format for project:
* projects/{project_number}.
* projects/{project_number}/locations/{location}/documents/{document_id}. Format for
* collection: projects/{project_number}/locations/{location}/collections/{collection_id}.
* Format for project: projects/{project_number}.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final FetchAclResponse fetchAcl(String resource) {
Expand Down Expand Up @@ -1011,10 +1135,21 @@ public final UnaryCallable<FetchAclRequest, FetchAclResponse> fetchAclCallable()
*
* @param resource Required. REQUIRED: The resource for which the policy is being requested.
* Format for document:
* projects/{project_number}/locations/{location}/documents/{document_id}. Format for project:
* projects/{project_number}.
* projects/{project_number}/locations/{location}/documents/{document_id}. Format for
* collection: projects/{project_number}/locations/{location}/collections/{collection_id}.
* Format for project: projects/{project_number}.
* @param policy Required. REQUIRED: The complete policy to be applied to the `resource`. The size
* of the policy is limited to a few 10s of KB.
* of the policy is limited to a few 10s of KB. This refers to an Identity and Access (IAM)
* policy, which specifies access controls for the Document.
* <p>You can set ACL with condition for projects only.
* <p>Supported operators are: `=`, `!=`, `&lt;`, `&lt;=`, `&gt;`, and `&gt;=` where the left
* of the operator is `DocumentSchemaId` or property name and the right of the operator is a
* number or a quoted string. You must escape backslash (\\\\) and quote (\\") characters.
* <p>Boolean expressions (AND/OR) are supported up to 3 levels of nesting (for example, "((A
* AND B AND C) OR D) AND E"), a maximum of 10 comparisons are allowed in the expression. The
* expression must be &lt; 6000 bytes in length.
* <p>Sample condition: `"DocumentSchemaId = \\"some schema id\\" OR
* SchemaId.floatPropertyName &gt;= 10"`
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final SetAclResponse setAcl(String resource, Policy policy) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,11 @@ public UnaryCallSettings<DeleteDocumentRequest, Empty> deleteDocumentSettings()
return ((DocumentServiceStubSettings) getStubSettings()).searchDocumentsSettings();
}

/** Returns the object with the settings used for calls to lockDocument. */
public UnaryCallSettings<LockDocumentRequest, Document> lockDocumentSettings() {
return ((DocumentServiceStubSettings) getStubSettings()).lockDocumentSettings();
}

/** Returns the object with the settings used for calls to fetchAcl. */
public UnaryCallSettings<FetchAclRequest, FetchAclResponse> fetchAclSettings() {
return ((DocumentServiceStubSettings) getStubSettings()).fetchAclSettings();
Expand Down Expand Up @@ -258,6 +263,11 @@ public UnaryCallSettings.Builder<DeleteDocumentRequest, Empty> deleteDocumentSet
return getStubSettingsBuilder().searchDocumentsSettings();
}

/** Returns the builder for the settings used for calls to lockDocument. */
public UnaryCallSettings.Builder<LockDocumentRequest, Document> lockDocumentSettings() {
return getStubSettingsBuilder().lockDocumentSettings();
}

/** Returns the builder for the settings used for calls to fetchAcl. */
public UnaryCallSettings.Builder<FetchAclRequest, FetchAclResponse> fetchAclSettings() {
return getStubSettingsBuilder().fetchAclSettings();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@
"GetDocument": {
"methods": ["getDocument", "getDocument", "getDocument", "getDocumentCallable"]
},
"LockDocument": {
"methods": ["lockDocument", "lockDocument", "lockDocument", "lockDocumentCallable"]
},
"SearchDocuments": {
"methods": ["searchDocuments", "searchDocuments", "searchDocuments", "searchDocumentsPagedCallable", "searchDocumentsCallable"]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

/**
* A client to contentwarehouse API
* A client to Document AI Warehouse API
*
* <p>The interfaces provided are listed below, along with usage samples.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import com.google.cloud.contentwarehouse.v1.FetchAclRequest;
import com.google.cloud.contentwarehouse.v1.FetchAclResponse;
import com.google.cloud.contentwarehouse.v1.GetDocumentRequest;
import com.google.cloud.contentwarehouse.v1.LockDocumentRequest;
import com.google.cloud.contentwarehouse.v1.SearchDocumentsRequest;
import com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse;
import com.google.cloud.contentwarehouse.v1.SetAclRequest;
Expand Down Expand Up @@ -70,6 +71,10 @@ public UnaryCallable<SearchDocumentsRequest, SearchDocumentsResponse> searchDocu
throw new UnsupportedOperationException("Not implemented: searchDocumentsCallable()");
}

public UnaryCallable<LockDocumentRequest, Document> lockDocumentCallable() {
throw new UnsupportedOperationException("Not implemented: lockDocumentCallable()");
}

public UnaryCallable<FetchAclRequest, FetchAclResponse> fetchAclCallable() {
throw new UnsupportedOperationException("Not implemented: fetchAclCallable()");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
import com.google.cloud.contentwarehouse.v1.FetchAclRequest;
import com.google.cloud.contentwarehouse.v1.FetchAclResponse;
import com.google.cloud.contentwarehouse.v1.GetDocumentRequest;
import com.google.cloud.contentwarehouse.v1.LockDocumentRequest;
import com.google.cloud.contentwarehouse.v1.SearchDocumentsRequest;
import com.google.cloud.contentwarehouse.v1.SearchDocumentsResponse;
import com.google.cloud.contentwarehouse.v1.SetAclRequest;
Expand Down Expand Up @@ -119,6 +120,7 @@ public class DocumentServiceStubSettings extends StubSettings<DocumentServiceStu
private final PagedCallSettings<
SearchDocumentsRequest, SearchDocumentsResponse, SearchDocumentsPagedResponse>
searchDocumentsSettings;
private final UnaryCallSettings<LockDocumentRequest, Document> lockDocumentSettings;
private final UnaryCallSettings<FetchAclRequest, FetchAclResponse> fetchAclSettings;
private final UnaryCallSettings<SetAclRequest, SetAclResponse> setAclSettings;

Expand Down Expand Up @@ -214,6 +216,11 @@ public UnaryCallSettings<DeleteDocumentRequest, Empty> deleteDocumentSettings()
return searchDocumentsSettings;
}

/** Returns the object with the settings used for calls to lockDocument. */
public UnaryCallSettings<LockDocumentRequest, Document> lockDocumentSettings() {
return lockDocumentSettings;
}

/** Returns the object with the settings used for calls to fetchAcl. */
public UnaryCallSettings<FetchAclRequest, FetchAclResponse> fetchAclSettings() {
return fetchAclSettings;
Expand Down Expand Up @@ -335,6 +342,7 @@ protected DocumentServiceStubSettings(Builder settingsBuilder) throws IOExceptio
updateDocumentSettings = settingsBuilder.updateDocumentSettings().build();
deleteDocumentSettings = settingsBuilder.deleteDocumentSettings().build();
searchDocumentsSettings = settingsBuilder.searchDocumentsSettings().build();
lockDocumentSettings = settingsBuilder.lockDocumentSettings().build();
fetchAclSettings = settingsBuilder.fetchAclSettings().build();
setAclSettings = settingsBuilder.setAclSettings().build();
}
Expand All @@ -351,6 +359,7 @@ public static class Builder extends StubSettings.Builder<DocumentServiceStubSett
private final PagedCallSettings.Builder<
SearchDocumentsRequest, SearchDocumentsResponse, SearchDocumentsPagedResponse>
searchDocumentsSettings;
private final UnaryCallSettings.Builder<LockDocumentRequest, Document> lockDocumentSettings;
private final UnaryCallSettings.Builder<FetchAclRequest, FetchAclResponse> fetchAclSettings;
private final UnaryCallSettings.Builder<SetAclRequest, SetAclResponse> setAclSettings;
private static final ImmutableMap<String, ImmutableSet<StatusCode.Code>>
Expand All @@ -366,6 +375,7 @@ public static class Builder extends StubSettings.Builder<DocumentServiceStubSett
ImmutableSet.copyOf(Lists.<StatusCode.Code>newArrayList(StatusCode.Code.UNAVAILABLE)));
definitions.put(
"no_retry_1_codes", ImmutableSet.copyOf(Lists.<StatusCode.Code>newArrayList()));
definitions.put("no_retry_codes", ImmutableSet.copyOf(Lists.<StatusCode.Code>newArrayList()));
RETRYABLE_CODE_DEFINITIONS = definitions.build();
}

Expand Down Expand Up @@ -401,6 +411,8 @@ public static class Builder extends StubSettings.Builder<DocumentServiceStubSett
.setTotalTimeout(Duration.ofMillis(60000L))
.build();
definitions.put("no_retry_1_params", settings);
settings = RetrySettings.newBuilder().setRpcTimeoutMultiplier(1.0).build();
definitions.put("no_retry_params", settings);
RETRY_PARAM_DEFINITIONS = definitions.build();
}

Expand All @@ -416,6 +428,7 @@ protected Builder(ClientContext clientContext) {
updateDocumentSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
deleteDocumentSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
searchDocumentsSettings = PagedCallSettings.newBuilder(SEARCH_DOCUMENTS_PAGE_STR_FACT);
lockDocumentSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
fetchAclSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
setAclSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();

Expand All @@ -426,6 +439,7 @@ protected Builder(ClientContext clientContext) {
updateDocumentSettings,
deleteDocumentSettings,
searchDocumentsSettings,
lockDocumentSettings,
fetchAclSettings,
setAclSettings);
initDefaults(this);
Expand All @@ -439,6 +453,7 @@ protected Builder(DocumentServiceStubSettings settings) {
updateDocumentSettings = settings.updateDocumentSettings.toBuilder();
deleteDocumentSettings = settings.deleteDocumentSettings.toBuilder();
searchDocumentsSettings = settings.searchDocumentsSettings.toBuilder();
lockDocumentSettings = settings.lockDocumentSettings.toBuilder();
fetchAclSettings = settings.fetchAclSettings.toBuilder();
setAclSettings = settings.setAclSettings.toBuilder();

Expand All @@ -449,6 +464,7 @@ protected Builder(DocumentServiceStubSettings settings) {
updateDocumentSettings,
deleteDocumentSettings,
searchDocumentsSettings,
lockDocumentSettings,
fetchAclSettings,
setAclSettings);
}
Expand Down Expand Up @@ -505,6 +521,11 @@ private static Builder initDefaults(Builder builder) {
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_2_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_2_params"));

builder
.lockDocumentSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params"));

builder
.fetchAclSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes"))
Expand Down Expand Up @@ -562,6 +583,11 @@ public UnaryCallSettings.Builder<DeleteDocumentRequest, Empty> deleteDocumentSet
return searchDocumentsSettings;
}

/** Returns the builder for the settings used for calls to lockDocument. */
public UnaryCallSettings.Builder<LockDocumentRequest, Document> lockDocumentSettings() {
return lockDocumentSettings;
}

/** Returns the builder for the settings used for calls to fetchAcl. */
public UnaryCallSettings.Builder<FetchAclRequest, FetchAclResponse> fetchAclSettings() {
return fetchAclSettings;
Expand Down
Loading