diff --git a/sdk/contentsafety/azure-ai-contentsafety/CHANGELOG.md b/sdk/contentsafety/azure-ai-contentsafety/CHANGELOG.md
index 4062df6618c2..c7739dd5c91d 100644
--- a/sdk/contentsafety/azure-ai-contentsafety/CHANGELOG.md
+++ b/sdk/contentsafety/azure-ai-contentsafety/CHANGELOG.md
@@ -1,14 +1,105 @@
# Release History
-## 1.1.0-beta.1 (Unreleased)
+## 1.1.0-beta.1 (2026-07-30)
### Features Added
-### Breaking Changes
+* `models.ProvenanceDetectOperation` was added
-### Bugs Fixed
+* `ContentProvenanceClientBuilder` was added
-### Other Changes
+* `models.DetectOutcome` was added
+
+* `models.ProvenanceOperationKind` was added
+
+* `models.OperationState` was added
+
+* `models.DetectProvenanceResult` was added
+
+* `ContentProvenanceAsyncClient` was added
+
+* `models.DetectedProvenance` was added
+
+* `ContentProvenanceClient` was added
+
+* `models.DetectedProvenanceType` was added
+
+* `models.DetectProvenanceOptions` was added
+
+* `models.ProvenanceContent` was added
+
+#### `models.AddOrUpdateTextBlocklistItemsResult` was modified
+
+* `toJson(com.azure.json.JsonWriter)` was added
+* `fromJson(com.azure.json.JsonReader)` was added
+
+#### `BlocklistAsyncClient` was modified
+
+* `createOrUpdateTextBlocklist(java.lang.String,models.TextBlocklist)` was added
+
+#### `models.AnalyzeTextResult` was modified
+
+* `fromJson(com.azure.json.JsonReader)` was added
+* `toJson(com.azure.json.JsonWriter)` was added
+
+#### `models.TextBlocklistMatch` was modified
+
+* `fromJson(com.azure.json.JsonReader)` was added
+* `toJson(com.azure.json.JsonWriter)` was added
+
+#### `models.AnalyzeImageOptions` was modified
+
+* `fromJson(com.azure.json.JsonReader)` was added
+* `toJson(com.azure.json.JsonWriter)` was added
+
+#### `models.TextBlocklistItem` was modified
+
+* `toJson(com.azure.json.JsonWriter)` was added
+* `fromJson(com.azure.json.JsonReader)` was added
+
+#### `models.RemoveTextBlocklistItemsOptions` was modified
+
+* `fromJson(com.azure.json.JsonReader)` was added
+* `toJson(com.azure.json.JsonWriter)` was added
+
+#### `models.TextBlocklist` was modified
+
+* `fromJson(com.azure.json.JsonReader)` was added
+* `toJson(com.azure.json.JsonWriter)` was added
+
+#### `models.AnalyzeTextOptions` was modified
+
+* `toJson(com.azure.json.JsonWriter)` was added
+* `fromJson(com.azure.json.JsonReader)` was added
+
+#### `models.ImageCategoriesAnalysis` was modified
+
+* `toJson(com.azure.json.JsonWriter)` was added
+* `fromJson(com.azure.json.JsonReader)` was added
+
+#### `models.AnalyzeImageResult` was modified
+
+* `fromJson(com.azure.json.JsonReader)` was added
+* `toJson(com.azure.json.JsonWriter)` was added
+
+#### `models.AddOrUpdateTextBlocklistItemsOptions` was modified
+
+* `toJson(com.azure.json.JsonWriter)` was added
+* `fromJson(com.azure.json.JsonReader)` was added
+
+#### `models.ContentSafetyImageData` was modified
+
+* `toJson(com.azure.json.JsonWriter)` was added
+* `fromJson(com.azure.json.JsonReader)` was added
+
+#### `models.TextCategoriesAnalysis` was modified
+
+* `fromJson(com.azure.json.JsonReader)` was added
+* `toJson(com.azure.json.JsonWriter)` was added
+
+#### `BlocklistClient` was modified
+
+* `createOrUpdateTextBlocklist(java.lang.String,models.TextBlocklist)` was added
## 1.0.19 (2026-07-01)
diff --git a/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/ContentProvenanceAsyncClient.java b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/ContentProvenanceAsyncClient.java
new file mode 100644
index 000000000000..6c26ce57c1ce
--- /dev/null
+++ b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/ContentProvenanceAsyncClient.java
@@ -0,0 +1,201 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) TypeSpec Code Generator.
+package com.azure.ai.contentsafety;
+
+import com.azure.ai.contentsafety.implementation.ContentProvenanceClientImpl;
+import com.azure.ai.contentsafety.models.DetectProvenanceOptions;
+import com.azure.ai.contentsafety.models.DetectProvenanceResult;
+import com.azure.ai.contentsafety.models.ProvenanceDetectOperation;
+import com.azure.core.annotation.Generated;
+import com.azure.core.annotation.ReturnType;
+import com.azure.core.annotation.ServiceClient;
+import com.azure.core.annotation.ServiceMethod;
+import com.azure.core.exception.ClientAuthenticationException;
+import com.azure.core.exception.HttpResponseException;
+import com.azure.core.exception.ResourceModifiedException;
+import com.azure.core.exception.ResourceNotFoundException;
+import com.azure.core.http.rest.RequestOptions;
+import com.azure.core.http.rest.Response;
+import com.azure.core.util.BinaryData;
+import com.azure.core.util.FluxUtil;
+import com.azure.core.util.polling.PollOperationDetails;
+import com.azure.core.util.polling.PollerFlux;
+import reactor.core.publisher.Mono;
+
+/**
+ * Initializes a new instance of the asynchronous ContentProvenanceClient type.
+ */
+@ServiceClient(builder = ContentProvenanceClientBuilder.class, isAsync = true)
+public final class ContentProvenanceAsyncClient {
+
+ @Generated
+ private final ContentProvenanceClientImpl serviceClient;
+
+ /**
+ * Initializes an instance of ContentProvenanceAsyncClient class.
+ *
+ * @param serviceClient the service client implementation.
+ */
+ @Generated
+ ContentProvenanceAsyncClient(ContentProvenanceClientImpl serviceClient) {
+ this.serviceClient = serviceClient;
+ }
+
+ /**
+ * Start Content Provenance Detection
+ *
+ * Starts an asynchronous Content Provenance Detection operation that inspects the supplied media for
+ * Microsoft-issued C2PA and imperceptible watermark signals indicating the content was created or modified using
+ * AI.
+ *
Request Body Schema
+ *
+ *
+ * {@code
+ * {
+ * content (Required): {
+ * uri: String (Required)
+ * }
+ * }
+ * }
+ *
+ *
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * id: String (Required)
+ * status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+ * error (Optional): {
+ * error (Required): (recursive schema, see error above)
+ * }
+ * result (Optional): {
+ * outcome: String(NoProvenanceDetected/ProvenanceDetected) (Required)
+ * results (Optional): [
+ * (Optional){
+ * type: String(C2PA/Watermark) (Optional)
+ * provider: String (Optional)
+ * modelName: String (Optional)
+ * timestamp: OffsetDateTime (Optional)
+ * }
+ * ]
+ * }
+ * }
+ * }
+ *
+ *
+ * @param options Options describing the media to inspect using Content Provenance Detection.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return the {@link PollerFlux} for polling of provides status details for long running operations.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
+ public PollerFlux beginDetect(BinaryData options, RequestOptions requestOptions) {
+ return this.serviceClient.beginDetectAsync(options, requestOptions);
+ }
+
+ /**
+ * Get Content Provenance Detection Status
+ *
+ * Gets the status, result, or error of an asynchronous Content Provenance Detection operation.
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * id: String (Required)
+ * status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+ * error (Optional): {
+ * error (Required): (recursive schema, see error above)
+ * }
+ * result (Optional): {
+ * outcome: String(NoProvenanceDetected/ProvenanceDetected) (Required)
+ * results (Optional): [
+ * (Optional){
+ * type: String(C2PA/Watermark) (Optional)
+ * provider: String (Optional)
+ * modelName: String (Optional)
+ * timestamp: OffsetDateTime (Optional)
+ * }
+ * ]
+ * }
+ * kind: String(Detect) (Required)
+ * createdAt: OffsetDateTime (Optional)
+ * lastUpdatedAt: OffsetDateTime (Optional)
+ * }
+ * }
+ *
+ *
+ * @param operationId The unique ID of the operation.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return content Provenance Detection Status
+ *
+ * Gets the status, result, or error of an asynchronous Content Provenance Detection operation along with
+ * {@link Response} on successful completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> getOperationStatusWithResponse(String operationId,
+ RequestOptions requestOptions) {
+ return this.serviceClient.getOperationStatusWithResponseAsync(operationId, requestOptions);
+ }
+
+ /**
+ * Start Content Provenance Detection
+ *
+ * Starts an asynchronous Content Provenance Detection operation that inspects the supplied media for
+ * Microsoft-issued C2PA and imperceptible watermark signals indicating the content was created or modified using
+ * AI.
+ *
+ * @param options Options describing the media to inspect using Content Provenance Detection.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the {@link PollerFlux} for polling of provides status details for long running operations.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
+ public PollerFlux beginDetect(DetectProvenanceOptions options) {
+ // Generated convenience method for beginDetectWithModel
+ RequestOptions requestOptions = new RequestOptions();
+ return serviceClient.beginDetectWithModelAsync(BinaryData.fromObject(options), requestOptions);
+ }
+
+ /**
+ * Get Content Provenance Detection Status
+ *
+ * Gets the status, result, or error of an asynchronous Content Provenance Detection operation.
+ *
+ * @param operationId The unique ID of the operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return content Provenance Detection Status
+ *
+ * Gets the status, result, or error of an asynchronous Content Provenance Detection operation on successful
+ * completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono getOperationStatus(String operationId) {
+ // Generated convenience method for getOperationStatusWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return getOperationStatusWithResponse(operationId, requestOptions).flatMap(FluxUtil::toMono)
+ .map(protocolMethodData -> protocolMethodData.toObject(ProvenanceDetectOperation.class));
+ }
+}
diff --git a/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/ContentProvenanceClient.java b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/ContentProvenanceClient.java
new file mode 100644
index 000000000000..6aa33377ab64
--- /dev/null
+++ b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/ContentProvenanceClient.java
@@ -0,0 +1,197 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) TypeSpec Code Generator.
+package com.azure.ai.contentsafety;
+
+import com.azure.ai.contentsafety.implementation.ContentProvenanceClientImpl;
+import com.azure.ai.contentsafety.models.DetectProvenanceOptions;
+import com.azure.ai.contentsafety.models.DetectProvenanceResult;
+import com.azure.ai.contentsafety.models.ProvenanceDetectOperation;
+import com.azure.core.annotation.Generated;
+import com.azure.core.annotation.ReturnType;
+import com.azure.core.annotation.ServiceClient;
+import com.azure.core.annotation.ServiceMethod;
+import com.azure.core.exception.ClientAuthenticationException;
+import com.azure.core.exception.HttpResponseException;
+import com.azure.core.exception.ResourceModifiedException;
+import com.azure.core.exception.ResourceNotFoundException;
+import com.azure.core.http.rest.RequestOptions;
+import com.azure.core.http.rest.Response;
+import com.azure.core.util.BinaryData;
+import com.azure.core.util.polling.PollOperationDetails;
+import com.azure.core.util.polling.SyncPoller;
+
+/**
+ * Initializes a new instance of the synchronous ContentProvenanceClient type.
+ */
+@ServiceClient(builder = ContentProvenanceClientBuilder.class)
+public final class ContentProvenanceClient {
+
+ @Generated
+ private final ContentProvenanceClientImpl serviceClient;
+
+ /**
+ * Initializes an instance of ContentProvenanceClient class.
+ *
+ * @param serviceClient the service client implementation.
+ */
+ @Generated
+ ContentProvenanceClient(ContentProvenanceClientImpl serviceClient) {
+ this.serviceClient = serviceClient;
+ }
+
+ /**
+ * Start Content Provenance Detection
+ *
+ * Starts an asynchronous Content Provenance Detection operation that inspects the supplied media for
+ * Microsoft-issued C2PA and imperceptible watermark signals indicating the content was created or modified using
+ * AI.
+ * Request Body Schema
+ *
+ *
+ * {@code
+ * {
+ * content (Required): {
+ * uri: String (Required)
+ * }
+ * }
+ * }
+ *
+ *
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * id: String (Required)
+ * status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+ * error (Optional): {
+ * error (Required): (recursive schema, see error above)
+ * }
+ * result (Optional): {
+ * outcome: String(NoProvenanceDetected/ProvenanceDetected) (Required)
+ * results (Optional): [
+ * (Optional){
+ * type: String(C2PA/Watermark) (Optional)
+ * provider: String (Optional)
+ * modelName: String (Optional)
+ * timestamp: OffsetDateTime (Optional)
+ * }
+ * ]
+ * }
+ * }
+ * }
+ *
+ *
+ * @param options Options describing the media to inspect using Content Provenance Detection.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return the {@link SyncPoller} for polling of provides status details for long running operations.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
+ public SyncPoller beginDetect(BinaryData options, RequestOptions requestOptions) {
+ return this.serviceClient.beginDetect(options, requestOptions);
+ }
+
+ /**
+ * Get Content Provenance Detection Status
+ *
+ * Gets the status, result, or error of an asynchronous Content Provenance Detection operation.
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * id: String (Required)
+ * status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+ * error (Optional): {
+ * error (Required): (recursive schema, see error above)
+ * }
+ * result (Optional): {
+ * outcome: String(NoProvenanceDetected/ProvenanceDetected) (Required)
+ * results (Optional): [
+ * (Optional){
+ * type: String(C2PA/Watermark) (Optional)
+ * provider: String (Optional)
+ * modelName: String (Optional)
+ * timestamp: OffsetDateTime (Optional)
+ * }
+ * ]
+ * }
+ * kind: String(Detect) (Required)
+ * createdAt: OffsetDateTime (Optional)
+ * lastUpdatedAt: OffsetDateTime (Optional)
+ * }
+ * }
+ *
+ *
+ * @param operationId The unique ID of the operation.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return content Provenance Detection Status
+ *
+ * Gets the status, result, or error of an asynchronous Content Provenance Detection operation along with
+ * {@link Response}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response getOperationStatusWithResponse(String operationId, RequestOptions requestOptions) {
+ return this.serviceClient.getOperationStatusWithResponse(operationId, requestOptions);
+ }
+
+ /**
+ * Start Content Provenance Detection
+ *
+ * Starts an asynchronous Content Provenance Detection operation that inspects the supplied media for
+ * Microsoft-issued C2PA and imperceptible watermark signals indicating the content was created or modified using
+ * AI.
+ *
+ * @param options Options describing the media to inspect using Content Provenance Detection.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the {@link SyncPoller} for polling of provides status details for long running operations.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
+ public SyncPoller beginDetect(DetectProvenanceOptions options) {
+ // Generated convenience method for beginDetectWithModel
+ RequestOptions requestOptions = new RequestOptions();
+ return serviceClient.beginDetectWithModel(BinaryData.fromObject(options), requestOptions);
+ }
+
+ /**
+ * Get Content Provenance Detection Status
+ *
+ * Gets the status, result, or error of an asynchronous Content Provenance Detection operation.
+ *
+ * @param operationId The unique ID of the operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return content Provenance Detection Status
+ *
+ * Gets the status, result, or error of an asynchronous Content Provenance Detection operation.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public ProvenanceDetectOperation getOperationStatus(String operationId) {
+ // Generated convenience method for getOperationStatusWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return getOperationStatusWithResponse(operationId, requestOptions).getValue()
+ .toObject(ProvenanceDetectOperation.class);
+ }
+}
diff --git a/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/ContentProvenanceClientBuilder.java b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/ContentProvenanceClientBuilder.java
new file mode 100644
index 000000000000..d9a71105ed30
--- /dev/null
+++ b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/ContentProvenanceClientBuilder.java
@@ -0,0 +1,355 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) TypeSpec Code Generator.
+package com.azure.ai.contentsafety;
+
+import com.azure.ai.contentsafety.implementation.ContentProvenanceClientImpl;
+import com.azure.core.annotation.Generated;
+import com.azure.core.annotation.ServiceClientBuilder;
+import com.azure.core.client.traits.ConfigurationTrait;
+import com.azure.core.client.traits.EndpointTrait;
+import com.azure.core.client.traits.HttpTrait;
+import com.azure.core.client.traits.KeyCredentialTrait;
+import com.azure.core.client.traits.TokenCredentialTrait;
+import com.azure.core.credential.KeyCredential;
+import com.azure.core.credential.TokenCredential;
+import com.azure.core.http.HttpClient;
+import com.azure.core.http.HttpHeaders;
+import com.azure.core.http.HttpPipeline;
+import com.azure.core.http.HttpPipelineBuilder;
+import com.azure.core.http.HttpPipelinePosition;
+import com.azure.core.http.policy.AddDatePolicy;
+import com.azure.core.http.policy.AddHeadersFromContextPolicy;
+import com.azure.core.http.policy.AddHeadersPolicy;
+import com.azure.core.http.policy.BearerTokenAuthenticationPolicy;
+import com.azure.core.http.policy.HttpLogOptions;
+import com.azure.core.http.policy.HttpLoggingPolicy;
+import com.azure.core.http.policy.HttpPipelinePolicy;
+import com.azure.core.http.policy.HttpPolicyProviders;
+import com.azure.core.http.policy.KeyCredentialPolicy;
+import com.azure.core.http.policy.RequestIdPolicy;
+import com.azure.core.http.policy.RetryOptions;
+import com.azure.core.http.policy.RetryPolicy;
+import com.azure.core.http.policy.UserAgentPolicy;
+import com.azure.core.util.ClientOptions;
+import com.azure.core.util.Configuration;
+import com.azure.core.util.CoreUtils;
+import com.azure.core.util.builder.ClientBuilderUtil;
+import com.azure.core.util.logging.ClientLogger;
+import com.azure.core.util.serializer.JacksonAdapter;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+
+/**
+ * A builder for creating a new instance of the ContentProvenanceClient type.
+ */
+@ServiceClientBuilder(serviceClients = { ContentProvenanceClient.class, ContentProvenanceAsyncClient.class })
+public final class ContentProvenanceClientBuilder implements HttpTrait,
+ ConfigurationTrait, TokenCredentialTrait,
+ KeyCredentialTrait, EndpointTrait {
+
+ @Generated
+ private static final String SDK_NAME = "name";
+
+ @Generated
+ private static final String SDK_VERSION = "version";
+
+ @Generated
+ private static final String[] DEFAULT_SCOPES = new String[] { "https://cognitiveservices.azure.com/.default" };
+
+ @Generated
+ private static final Map PROPERTIES = CoreUtils.getProperties("azure-ai-contentsafety.properties");
+
+ @Generated
+ private final List pipelinePolicies;
+
+ /**
+ * Create an instance of the ContentProvenanceClientBuilder.
+ */
+ @Generated
+ public ContentProvenanceClientBuilder() {
+ this.pipelinePolicies = new ArrayList<>();
+ }
+
+ /*
+ * The HTTP client used to send the request.
+ */
+ @Generated
+ private HttpClient httpClient;
+
+ /**
+ * {@inheritDoc}.
+ */
+ @Generated
+ @Override
+ public ContentProvenanceClientBuilder httpClient(HttpClient httpClient) {
+ this.httpClient = httpClient;
+ return this;
+ }
+
+ /*
+ * The HTTP pipeline to send requests through.
+ */
+ @Generated
+ private HttpPipeline pipeline;
+
+ /**
+ * {@inheritDoc}.
+ */
+ @Generated
+ @Override
+ public ContentProvenanceClientBuilder pipeline(HttpPipeline pipeline) {
+ if (this.pipeline != null && pipeline == null) {
+ LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured.");
+ }
+ this.pipeline = pipeline;
+ return this;
+ }
+
+ /*
+ * The logging configuration for HTTP requests and responses.
+ */
+ @Generated
+ private HttpLogOptions httpLogOptions;
+
+ /**
+ * {@inheritDoc}.
+ */
+ @Generated
+ @Override
+ public ContentProvenanceClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) {
+ this.httpLogOptions = httpLogOptions;
+ return this;
+ }
+
+ /*
+ * The client options such as application ID and custom headers to set on a request.
+ */
+ @Generated
+ private ClientOptions clientOptions;
+
+ /**
+ * {@inheritDoc}.
+ */
+ @Generated
+ @Override
+ public ContentProvenanceClientBuilder clientOptions(ClientOptions clientOptions) {
+ this.clientOptions = clientOptions;
+ return this;
+ }
+
+ /*
+ * The retry options to configure retry policy for failed requests.
+ */
+ @Generated
+ private RetryOptions retryOptions;
+
+ /**
+ * {@inheritDoc}.
+ */
+ @Generated
+ @Override
+ public ContentProvenanceClientBuilder retryOptions(RetryOptions retryOptions) {
+ this.retryOptions = retryOptions;
+ return this;
+ }
+
+ /**
+ * {@inheritDoc}.
+ */
+ @Generated
+ @Override
+ public ContentProvenanceClientBuilder addPolicy(HttpPipelinePolicy customPolicy) {
+ Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null.");
+ pipelinePolicies.add(customPolicy);
+ return this;
+ }
+
+ /*
+ * The configuration store that is used during construction of the service client.
+ */
+ @Generated
+ private Configuration configuration;
+
+ /**
+ * {@inheritDoc}.
+ */
+ @Generated
+ @Override
+ public ContentProvenanceClientBuilder configuration(Configuration configuration) {
+ this.configuration = configuration;
+ return this;
+ }
+
+ /*
+ * The TokenCredential used for authentication.
+ */
+ @Generated
+ private TokenCredential tokenCredential;
+
+ /**
+ * {@inheritDoc}.
+ */
+ @Generated
+ @Override
+ public ContentProvenanceClientBuilder credential(TokenCredential tokenCredential) {
+ this.tokenCredential = tokenCredential;
+ return this;
+ }
+
+ /*
+ * The KeyCredential used for authentication.
+ */
+ @Generated
+ private KeyCredential keyCredential;
+
+ /**
+ * {@inheritDoc}.
+ */
+ @Generated
+ @Override
+ public ContentProvenanceClientBuilder credential(KeyCredential keyCredential) {
+ this.keyCredential = keyCredential;
+ return this;
+ }
+
+ /*
+ * The service endpoint
+ */
+ @Generated
+ private String endpoint;
+
+ /**
+ * {@inheritDoc}.
+ */
+ @Generated
+ @Override
+ public ContentProvenanceClientBuilder endpoint(String endpoint) {
+ this.endpoint = endpoint;
+ return this;
+ }
+
+ /*
+ * Service version
+ */
+ @Generated
+ private ContentSafetyServiceVersion serviceVersion;
+
+ /**
+ * Sets Service version.
+ *
+ * @param serviceVersion the serviceVersion value.
+ * @return the ContentProvenanceClientBuilder.
+ */
+ @Generated
+ public ContentProvenanceClientBuilder serviceVersion(ContentSafetyServiceVersion serviceVersion) {
+ this.serviceVersion = serviceVersion;
+ return this;
+ }
+
+ /*
+ * The retry policy that will attempt to retry failed requests, if applicable.
+ */
+ @Generated
+ private RetryPolicy retryPolicy;
+
+ /**
+ * Sets The retry policy that will attempt to retry failed requests, if applicable.
+ *
+ * @param retryPolicy the retryPolicy value.
+ * @return the ContentProvenanceClientBuilder.
+ */
+ @Generated
+ public ContentProvenanceClientBuilder retryPolicy(RetryPolicy retryPolicy) {
+ this.retryPolicy = retryPolicy;
+ return this;
+ }
+
+ /**
+ * Builds an instance of ContentProvenanceClientImpl with the provided parameters.
+ *
+ * @return an instance of ContentProvenanceClientImpl.
+ */
+ @Generated
+ private ContentProvenanceClientImpl buildInnerClient() {
+ this.validateClient();
+ HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline();
+ ContentSafetyServiceVersion localServiceVersion
+ = (serviceVersion != null) ? serviceVersion : ContentSafetyServiceVersion.getLatest();
+ ContentProvenanceClientImpl client = new ContentProvenanceClientImpl(localPipeline,
+ JacksonAdapter.createDefaultSerializerAdapter(), this.endpoint, localServiceVersion);
+ return client;
+ }
+
+ @Generated
+ private void validateClient() {
+ // This method is invoked from 'buildInnerClient'/'buildClient' method.
+ // Developer can customize this method, to validate that the necessary conditions are met for the new client.
+ Objects.requireNonNull(endpoint, "'endpoint' cannot be null.");
+ }
+
+ @Generated
+ private HttpPipeline createHttpPipeline() {
+ Configuration buildConfiguration
+ = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration;
+ HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions;
+ ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions;
+ List policies = new ArrayList<>();
+ String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName");
+ String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion");
+ String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions);
+ policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration));
+ policies.add(new RequestIdPolicy());
+ policies.add(new AddHeadersFromContextPolicy());
+ HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions);
+ if (headers != null) {
+ policies.add(new AddHeadersPolicy(headers));
+ }
+ this.pipelinePolicies.stream()
+ .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL)
+ .forEach(p -> policies.add(p));
+ HttpPolicyProviders.addBeforeRetryPolicies(policies);
+ policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy()));
+ policies.add(new AddDatePolicy());
+ if (keyCredential != null) {
+ policies.add(new KeyCredentialPolicy("Ocp-Apim-Subscription-Key", keyCredential));
+ }
+ if (tokenCredential != null) {
+ policies.add(new BearerTokenAuthenticationPolicy(tokenCredential, DEFAULT_SCOPES));
+ }
+ this.pipelinePolicies.stream()
+ .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY)
+ .forEach(p -> policies.add(p));
+ HttpPolicyProviders.addAfterRetryPolicies(policies);
+ policies.add(new HttpLoggingPolicy(localHttpLogOptions));
+ HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0]))
+ .httpClient(httpClient)
+ .clientOptions(localClientOptions)
+ .build();
+ return httpPipeline;
+ }
+
+ /**
+ * Builds an instance of ContentProvenanceAsyncClient class.
+ *
+ * @return an instance of ContentProvenanceAsyncClient.
+ */
+ @Generated
+ public ContentProvenanceAsyncClient buildAsyncClient() {
+ return new ContentProvenanceAsyncClient(buildInnerClient());
+ }
+
+ /**
+ * Builds an instance of ContentProvenanceClient class.
+ *
+ * @return an instance of ContentProvenanceClient.
+ */
+ @Generated
+ public ContentProvenanceClient buildClient() {
+ return new ContentProvenanceClient(buildInnerClient());
+ }
+
+ private static final ClientLogger LOGGER = new ClientLogger(ContentProvenanceClientBuilder.class);
+}
diff --git a/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/implementation/BlocklistClientImpl.java b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/implementation/BlocklistClientImpl.java
index 727d27c55475..e7e96b52ccfc 100644
--- a/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/implementation/BlocklistClientImpl.java
+++ b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/implementation/BlocklistClientImpl.java
@@ -216,7 +216,7 @@ Response createOrUpdateTextBlocklistSync(@HostParam("endpoint") Stri
@UnexpectedResponseExceptionType(HttpResponseException.class)
Mono> deleteTextBlocklist(@HostParam("endpoint") String endpoint,
@QueryParam("api-version") String apiVersion, @PathParam("blocklistName") String name,
- @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context);
+ RequestOptions requestOptions, Context context);
@Delete("/text/blocklists/{blocklistName}")
@ExpectedResponses({ 204 })
@@ -226,7 +226,7 @@ Mono> deleteTextBlocklist(@HostParam("endpoint") String endpoint,
@UnexpectedResponseExceptionType(HttpResponseException.class)
Response deleteTextBlocklistSync(@HostParam("endpoint") String endpoint,
@QueryParam("api-version") String apiVersion, @PathParam("blocklistName") String name,
- @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context);
+ RequestOptions requestOptions, Context context);
@Get("/text/blocklists/{blocklistName}")
@ExpectedResponses({ 200 })
@@ -318,8 +318,8 @@ Response listTextBlocklistsSync(@HostParam("endpoint") String endpoi
@UnexpectedResponseExceptionType(HttpResponseException.class)
Mono> removeBlocklistItems(@HostParam("endpoint") String endpoint,
@QueryParam("api-version") String apiVersion, @PathParam("blocklistName") String name,
- @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept,
- @BodyParam("application/json") BinaryData options, RequestOptions requestOptions, Context context);
+ @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData options,
+ RequestOptions requestOptions, Context context);
@Post("/text/blocklists/{blocklistName}:removeBlocklistItems")
@ExpectedResponses({ 204 })
@@ -329,8 +329,8 @@ Mono> removeBlocklistItems(@HostParam("endpoint") String endpoint
@UnexpectedResponseExceptionType(HttpResponseException.class)
Response removeBlocklistItemsSync(@HostParam("endpoint") String endpoint,
@QueryParam("api-version") String apiVersion, @PathParam("blocklistName") String name,
- @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept,
- @BodyParam("application/json") BinaryData options, RequestOptions requestOptions, Context context);
+ @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData options,
+ RequestOptions requestOptions, Context context);
@Get("{nextLink}")
@ExpectedResponses({ 200 })
@@ -587,9 +587,8 @@ public Response createOrUpdateTextBlocklistWithResponse(String name,
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono> deleteTextBlocklistWithResponseAsync(String name, RequestOptions requestOptions) {
- final String accept = "application/json";
return FluxUtil.withContext(context -> service.deleteTextBlocklist(this.getEndpoint(),
- this.getServiceVersion().getVersion(), name, accept, requestOptions, context));
+ this.getServiceVersion().getVersion(), name, requestOptions, context));
}
/**
@@ -607,8 +606,7 @@ public Mono> deleteTextBlocklistWithResponseAsync(String name, Re
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response deleteTextBlocklistWithResponse(String name, RequestOptions requestOptions) {
- final String accept = "application/json";
- return service.deleteTextBlocklistSync(this.getEndpoint(), this.getServiceVersion().getVersion(), name, accept,
+ return service.deleteTextBlocklistSync(this.getEndpoint(), this.getServiceVersion().getVersion(), name,
requestOptions, Context.NONE);
}
@@ -1128,9 +1126,8 @@ public PagedIterable listTextBlocklists(RequestOptions requestOption
public Mono> removeBlocklistItemsWithResponseAsync(String name, BinaryData options,
RequestOptions requestOptions) {
final String contentType = "application/json";
- final String accept = "application/json";
return FluxUtil.withContext(context -> service.removeBlocklistItems(this.getEndpoint(),
- this.getServiceVersion().getVersion(), name, contentType, accept, options, requestOptions, context));
+ this.getServiceVersion().getVersion(), name, contentType, options, requestOptions, context));
}
/**
@@ -1162,9 +1159,8 @@ public Mono> removeBlocklistItemsWithResponseAsync(String name, B
public Response removeBlocklistItemsWithResponse(String name, BinaryData options,
RequestOptions requestOptions) {
final String contentType = "application/json";
- final String accept = "application/json";
return service.removeBlocklistItemsSync(this.getEndpoint(), this.getServiceVersion().getVersion(), name,
- contentType, accept, options, requestOptions, Context.NONE);
+ contentType, options, requestOptions, Context.NONE);
}
/**
diff --git a/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/implementation/ContentProvenanceClientImpl.java b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/implementation/ContentProvenanceClientImpl.java
new file mode 100644
index 000000000000..bed42230f81d
--- /dev/null
+++ b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/implementation/ContentProvenanceClientImpl.java
@@ -0,0 +1,690 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) TypeSpec Code Generator.
+
+package com.azure.ai.contentsafety.implementation;
+
+import com.azure.ai.contentsafety.ContentSafetyServiceVersion;
+import com.azure.ai.contentsafety.models.DetectProvenanceResult;
+import com.azure.core.annotation.BodyParam;
+import com.azure.core.annotation.ExpectedResponses;
+import com.azure.core.annotation.Get;
+import com.azure.core.annotation.HeaderParam;
+import com.azure.core.annotation.Host;
+import com.azure.core.annotation.HostParam;
+import com.azure.core.annotation.PathParam;
+import com.azure.core.annotation.Post;
+import com.azure.core.annotation.QueryParam;
+import com.azure.core.annotation.ReturnType;
+import com.azure.core.annotation.ServiceInterface;
+import com.azure.core.annotation.ServiceMethod;
+import com.azure.core.annotation.UnexpectedResponseExceptionType;
+import com.azure.core.exception.ClientAuthenticationException;
+import com.azure.core.exception.HttpResponseException;
+import com.azure.core.exception.ResourceModifiedException;
+import com.azure.core.exception.ResourceNotFoundException;
+import com.azure.core.http.HttpPipeline;
+import com.azure.core.http.HttpPipelineBuilder;
+import com.azure.core.http.policy.RetryPolicy;
+import com.azure.core.http.policy.UserAgentPolicy;
+import com.azure.core.http.rest.RequestOptions;
+import com.azure.core.http.rest.Response;
+import com.azure.core.http.rest.RestProxy;
+import com.azure.core.util.BinaryData;
+import com.azure.core.util.Context;
+import com.azure.core.util.FluxUtil;
+import com.azure.core.util.polling.PollOperationDetails;
+import com.azure.core.util.polling.PollerFlux;
+import com.azure.core.util.polling.PollingStrategyOptions;
+import com.azure.core.util.polling.SyncPoller;
+import com.azure.core.util.serializer.JacksonAdapter;
+import com.azure.core.util.serializer.SerializerAdapter;
+import com.azure.core.util.serializer.TypeReference;
+import java.time.Duration;
+import reactor.core.publisher.Mono;
+
+/**
+ * Initializes a new instance of the ContentProvenanceClient type.
+ */
+public final class ContentProvenanceClientImpl {
+ /**
+ * The proxy service used to perform REST calls.
+ */
+ private final ContentProvenanceClientService service;
+
+ /**
+ * Supported Cognitive Services endpoints (protocol and hostname, for example:
+ * https://<resource-name>.cognitiveservices.azure.com).
+ */
+ private final String endpoint;
+
+ /**
+ * Gets Supported Cognitive Services endpoints (protocol and hostname, for example:
+ * https://<resource-name>.cognitiveservices.azure.com).
+ *
+ * @return the endpoint value.
+ */
+ public String getEndpoint() {
+ return this.endpoint;
+ }
+
+ /**
+ * Service version.
+ */
+ private final ContentSafetyServiceVersion serviceVersion;
+
+ /**
+ * Gets Service version.
+ *
+ * @return the serviceVersion value.
+ */
+ public ContentSafetyServiceVersion getServiceVersion() {
+ return this.serviceVersion;
+ }
+
+ /**
+ * The HTTP pipeline to send requests through.
+ */
+ private final HttpPipeline httpPipeline;
+
+ /**
+ * Gets The HTTP pipeline to send requests through.
+ *
+ * @return the httpPipeline value.
+ */
+ public HttpPipeline getHttpPipeline() {
+ return this.httpPipeline;
+ }
+
+ /**
+ * The serializer to serialize an object into a string.
+ */
+ private final SerializerAdapter serializerAdapter;
+
+ /**
+ * Gets The serializer to serialize an object into a string.
+ *
+ * @return the serializerAdapter value.
+ */
+ public SerializerAdapter getSerializerAdapter() {
+ return this.serializerAdapter;
+ }
+
+ /**
+ * Initializes an instance of ContentProvenanceClient client.
+ *
+ * @param endpoint Supported Cognitive Services endpoints (protocol and hostname, for example:
+ * https://<resource-name>.cognitiveservices.azure.com).
+ * @param serviceVersion Service version.
+ */
+ public ContentProvenanceClientImpl(String endpoint, ContentSafetyServiceVersion serviceVersion) {
+ this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(),
+ JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion);
+ }
+
+ /**
+ * Initializes an instance of ContentProvenanceClient client.
+ *
+ * @param httpPipeline The HTTP pipeline to send requests through.
+ * @param endpoint Supported Cognitive Services endpoints (protocol and hostname, for example:
+ * https://<resource-name>.cognitiveservices.azure.com).
+ * @param serviceVersion Service version.
+ */
+ public ContentProvenanceClientImpl(HttpPipeline httpPipeline, String endpoint,
+ ContentSafetyServiceVersion serviceVersion) {
+ this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion);
+ }
+
+ /**
+ * Initializes an instance of ContentProvenanceClient client.
+ *
+ * @param httpPipeline The HTTP pipeline to send requests through.
+ * @param serializerAdapter The serializer to serialize an object into a string.
+ * @param endpoint Supported Cognitive Services endpoints (protocol and hostname, for example:
+ * https://<resource-name>.cognitiveservices.azure.com).
+ * @param serviceVersion Service version.
+ */
+ public ContentProvenanceClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint,
+ ContentSafetyServiceVersion serviceVersion) {
+ this.httpPipeline = httpPipeline;
+ this.serializerAdapter = serializerAdapter;
+ this.endpoint = endpoint;
+ this.serviceVersion = serviceVersion;
+ this.service
+ = RestProxy.create(ContentProvenanceClientService.class, this.httpPipeline, this.getSerializerAdapter());
+ }
+
+ /**
+ * The interface defining all the services for ContentProvenanceClient to be used by the proxy service to perform
+ * REST calls.
+ */
+ @Host("{endpoint}/contentsafety")
+ @ServiceInterface(name = "ContentProvenanceClient")
+ public interface ContentProvenanceClientService {
+ @Post("/provenance:detect")
+ @ExpectedResponses({ 202 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Mono> detect(@HostParam("endpoint") String endpoint,
+ @QueryParam("api-version") String apiVersion, @HeaderParam("Content-Type") String contentType,
+ @HeaderParam("Accept") String accept, @BodyParam("application/json") BinaryData options,
+ RequestOptions requestOptions, Context context);
+
+ @Post("/provenance:detect")
+ @ExpectedResponses({ 202 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Response detectSync(@HostParam("endpoint") String endpoint,
+ @QueryParam("api-version") String apiVersion, @HeaderParam("Content-Type") String contentType,
+ @HeaderParam("Accept") String accept, @BodyParam("application/json") BinaryData options,
+ RequestOptions requestOptions, Context context);
+
+ @Get("/provenance/operations/{operationId}")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Mono> getOperationStatus(@HostParam("endpoint") String endpoint,
+ @QueryParam("api-version") String apiVersion, @PathParam("operationId") String operationId,
+ @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context);
+
+ @Get("/provenance/operations/{operationId}")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
+ @UnexpectedResponseExceptionType(HttpResponseException.class)
+ Response getOperationStatusSync(@HostParam("endpoint") String endpoint,
+ @QueryParam("api-version") String apiVersion, @PathParam("operationId") String operationId,
+ @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context);
+ }
+
+ /**
+ * Start Content Provenance Detection
+ *
+ * Starts an asynchronous Content Provenance Detection operation that inspects the supplied media for
+ * Microsoft-issued C2PA and imperceptible watermark signals indicating the content was created or modified using
+ * AI.
+ * Request Body Schema
+ *
+ *
+ * {@code
+ * {
+ * content (Required): {
+ * uri: String (Required)
+ * }
+ * }
+ * }
+ *
+ *
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * id: String (Required)
+ * status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+ * error (Optional): {
+ * error (Required): (recursive schema, see error above)
+ * }
+ * result (Optional): {
+ * outcome: String(NoProvenanceDetected/ProvenanceDetected) (Required)
+ * results (Optional): [
+ * (Optional){
+ * type: String(C2PA/Watermark) (Optional)
+ * provider: String (Optional)
+ * modelName: String (Optional)
+ * timestamp: OffsetDateTime (Optional)
+ * }
+ * ]
+ * }
+ * }
+ * }
+ *
+ *
+ * @param options Options describing the media to inspect using Content Provenance Detection.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return provides status details for long running operations along with {@link Response} on successful completion
+ * of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Mono> detectWithResponseAsync(BinaryData options, RequestOptions requestOptions) {
+ final String contentType = "application/json";
+ final String accept = "application/json";
+ return FluxUtil.withContext(context -> service.detect(this.getEndpoint(), this.getServiceVersion().getVersion(),
+ contentType, accept, options, requestOptions, context));
+ }
+
+ /**
+ * Start Content Provenance Detection
+ *
+ * Starts an asynchronous Content Provenance Detection operation that inspects the supplied media for
+ * Microsoft-issued C2PA and imperceptible watermark signals indicating the content was created or modified using
+ * AI.
+ * Request Body Schema
+ *
+ *
+ * {@code
+ * {
+ * content (Required): {
+ * uri: String (Required)
+ * }
+ * }
+ * }
+ *
+ *
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * id: String (Required)
+ * status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+ * error (Optional): {
+ * error (Required): (recursive schema, see error above)
+ * }
+ * result (Optional): {
+ * outcome: String(NoProvenanceDetected/ProvenanceDetected) (Required)
+ * results (Optional): [
+ * (Optional){
+ * type: String(C2PA/Watermark) (Optional)
+ * provider: String (Optional)
+ * modelName: String (Optional)
+ * timestamp: OffsetDateTime (Optional)
+ * }
+ * ]
+ * }
+ * }
+ * }
+ *
+ *
+ * @param options Options describing the media to inspect using Content Provenance Detection.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return provides status details for long running operations along with {@link Response}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ private Response detectWithResponse(BinaryData options, RequestOptions requestOptions) {
+ final String contentType = "application/json";
+ final String accept = "application/json";
+ return service.detectSync(this.getEndpoint(), this.getServiceVersion().getVersion(), contentType, accept,
+ options, requestOptions, Context.NONE);
+ }
+
+ /**
+ * Start Content Provenance Detection
+ *
+ * Starts an asynchronous Content Provenance Detection operation that inspects the supplied media for
+ * Microsoft-issued C2PA and imperceptible watermark signals indicating the content was created or modified using
+ * AI.
+ * Request Body Schema
+ *
+ *
+ * {@code
+ * {
+ * content (Required): {
+ * uri: String (Required)
+ * }
+ * }
+ * }
+ *
+ *
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * id: String (Required)
+ * status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+ * error (Optional): {
+ * error (Required): (recursive schema, see error above)
+ * }
+ * result (Optional): {
+ * outcome: String(NoProvenanceDetected/ProvenanceDetected) (Required)
+ * results (Optional): [
+ * (Optional){
+ * type: String(C2PA/Watermark) (Optional)
+ * provider: String (Optional)
+ * modelName: String (Optional)
+ * timestamp: OffsetDateTime (Optional)
+ * }
+ * ]
+ * }
+ * }
+ * }
+ *
+ *
+ * @param options Options describing the media to inspect using Content Provenance Detection.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return the {@link PollerFlux} for polling of provides status details for long running operations.
+ */
+ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
+ public PollerFlux beginDetectWithModelAsync(BinaryData options,
+ RequestOptions requestOptions) {
+ return PollerFlux.create(Duration.ofSeconds(1), () -> this.detectWithResponseAsync(options, requestOptions),
+ new com.azure.ai.contentsafety.implementation.OperationLocationPollingStrategy<>(
+ new PollingStrategyOptions(this.getHttpPipeline())
+ .setEndpoint("{endpoint}/contentsafety".replace("{endpoint}", this.getEndpoint()))
+ .setContext(requestOptions != null && requestOptions.getContext() != null
+ ? requestOptions.getContext()
+ : Context.NONE)
+ .setServiceVersion(this.getServiceVersion().getVersion()),
+ "result"),
+ TypeReference.createInstance(PollOperationDetails.class),
+ TypeReference.createInstance(DetectProvenanceResult.class));
+ }
+
+ /**
+ * Start Content Provenance Detection
+ *
+ * Starts an asynchronous Content Provenance Detection operation that inspects the supplied media for
+ * Microsoft-issued C2PA and imperceptible watermark signals indicating the content was created or modified using
+ * AI.
+ * Request Body Schema
+ *
+ *
+ * {@code
+ * {
+ * content (Required): {
+ * uri: String (Required)
+ * }
+ * }
+ * }
+ *
+ *
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * id: String (Required)
+ * status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+ * error (Optional): {
+ * error (Required): (recursive schema, see error above)
+ * }
+ * result (Optional): {
+ * outcome: String(NoProvenanceDetected/ProvenanceDetected) (Required)
+ * results (Optional): [
+ * (Optional){
+ * type: String(C2PA/Watermark) (Optional)
+ * provider: String (Optional)
+ * modelName: String (Optional)
+ * timestamp: OffsetDateTime (Optional)
+ * }
+ * ]
+ * }
+ * }
+ * }
+ *
+ *
+ * @param options Options describing the media to inspect using Content Provenance Detection.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return the {@link SyncPoller} for polling of provides status details for long running operations.
+ */
+ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
+ public SyncPoller beginDetectWithModel(BinaryData options,
+ RequestOptions requestOptions) {
+ return SyncPoller.createPoller(Duration.ofSeconds(1), () -> this.detectWithResponse(options, requestOptions),
+ new com.azure.ai.contentsafety.implementation.SyncOperationLocationPollingStrategy<>(
+ new PollingStrategyOptions(this.getHttpPipeline())
+ .setEndpoint("{endpoint}/contentsafety".replace("{endpoint}", this.getEndpoint()))
+ .setContext(requestOptions != null && requestOptions.getContext() != null
+ ? requestOptions.getContext()
+ : Context.NONE)
+ .setServiceVersion(this.getServiceVersion().getVersion()),
+ "result"),
+ TypeReference.createInstance(PollOperationDetails.class),
+ TypeReference.createInstance(DetectProvenanceResult.class));
+ }
+
+ /**
+ * Start Content Provenance Detection
+ *
+ * Starts an asynchronous Content Provenance Detection operation that inspects the supplied media for
+ * Microsoft-issued C2PA and imperceptible watermark signals indicating the content was created or modified using
+ * AI.
+ * Request Body Schema
+ *
+ *
+ * {@code
+ * {
+ * content (Required): {
+ * uri: String (Required)
+ * }
+ * }
+ * }
+ *
+ *
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * id: String (Required)
+ * status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+ * error (Optional): {
+ * error (Required): (recursive schema, see error above)
+ * }
+ * result (Optional): {
+ * outcome: String(NoProvenanceDetected/ProvenanceDetected) (Required)
+ * results (Optional): [
+ * (Optional){
+ * type: String(C2PA/Watermark) (Optional)
+ * provider: String (Optional)
+ * modelName: String (Optional)
+ * timestamp: OffsetDateTime (Optional)
+ * }
+ * ]
+ * }
+ * }
+ * }
+ *
+ *
+ * @param options Options describing the media to inspect using Content Provenance Detection.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return the {@link PollerFlux} for polling of provides status details for long running operations.
+ */
+ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
+ public PollerFlux beginDetectAsync(BinaryData options, RequestOptions requestOptions) {
+ return PollerFlux.create(Duration.ofSeconds(1), () -> this.detectWithResponseAsync(options, requestOptions),
+ new com.azure.ai.contentsafety.implementation.OperationLocationPollingStrategy<>(
+ new PollingStrategyOptions(this.getHttpPipeline())
+ .setEndpoint("{endpoint}/contentsafety".replace("{endpoint}", this.getEndpoint()))
+ .setContext(requestOptions != null && requestOptions.getContext() != null
+ ? requestOptions.getContext()
+ : Context.NONE)
+ .setServiceVersion(this.getServiceVersion().getVersion()),
+ "result"),
+ TypeReference.createInstance(BinaryData.class), TypeReference.createInstance(BinaryData.class));
+ }
+
+ /**
+ * Start Content Provenance Detection
+ *
+ * Starts an asynchronous Content Provenance Detection operation that inspects the supplied media for
+ * Microsoft-issued C2PA and imperceptible watermark signals indicating the content was created or modified using
+ * AI.
+ * Request Body Schema
+ *
+ *
+ * {@code
+ * {
+ * content (Required): {
+ * uri: String (Required)
+ * }
+ * }
+ * }
+ *
+ *
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * id: String (Required)
+ * status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+ * error (Optional): {
+ * error (Required): (recursive schema, see error above)
+ * }
+ * result (Optional): {
+ * outcome: String(NoProvenanceDetected/ProvenanceDetected) (Required)
+ * results (Optional): [
+ * (Optional){
+ * type: String(C2PA/Watermark) (Optional)
+ * provider: String (Optional)
+ * modelName: String (Optional)
+ * timestamp: OffsetDateTime (Optional)
+ * }
+ * ]
+ * }
+ * }
+ * }
+ *
+ *
+ * @param options Options describing the media to inspect using Content Provenance Detection.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return the {@link SyncPoller} for polling of provides status details for long running operations.
+ */
+ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
+ public SyncPoller beginDetect(BinaryData options, RequestOptions requestOptions) {
+ return SyncPoller.createPoller(Duration.ofSeconds(1), () -> this.detectWithResponse(options, requestOptions),
+ new com.azure.ai.contentsafety.implementation.SyncOperationLocationPollingStrategy<>(
+ new PollingStrategyOptions(this.getHttpPipeline())
+ .setEndpoint("{endpoint}/contentsafety".replace("{endpoint}", this.getEndpoint()))
+ .setContext(requestOptions != null && requestOptions.getContext() != null
+ ? requestOptions.getContext()
+ : Context.NONE)
+ .setServiceVersion(this.getServiceVersion().getVersion()),
+ "result"),
+ TypeReference.createInstance(BinaryData.class), TypeReference.createInstance(BinaryData.class));
+ }
+
+ /**
+ * Get Content Provenance Detection Status
+ *
+ * Gets the status, result, or error of an asynchronous Content Provenance Detection operation.
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * id: String (Required)
+ * status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+ * error (Optional): {
+ * error (Required): (recursive schema, see error above)
+ * }
+ * result (Optional): {
+ * outcome: String(NoProvenanceDetected/ProvenanceDetected) (Required)
+ * results (Optional): [
+ * (Optional){
+ * type: String(C2PA/Watermark) (Optional)
+ * provider: String (Optional)
+ * modelName: String (Optional)
+ * timestamp: OffsetDateTime (Optional)
+ * }
+ * ]
+ * }
+ * kind: String(Detect) (Required)
+ * createdAt: OffsetDateTime (Optional)
+ * lastUpdatedAt: OffsetDateTime (Optional)
+ * }
+ * }
+ *
+ *
+ * @param operationId The unique ID of the operation.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return content Provenance Detection Status
+ *
+ * Gets the status, result, or error of an asynchronous Content Provenance Detection operation along with
+ * {@link Response} on successful completion of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> getOperationStatusWithResponseAsync(String operationId,
+ RequestOptions requestOptions) {
+ final String accept = "application/json";
+ return FluxUtil.withContext(context -> service.getOperationStatus(this.getEndpoint(),
+ this.getServiceVersion().getVersion(), operationId, accept, requestOptions, context));
+ }
+
+ /**
+ * Get Content Provenance Detection Status
+ *
+ * Gets the status, result, or error of an asynchronous Content Provenance Detection operation.
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * id: String (Required)
+ * status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+ * error (Optional): {
+ * error (Required): (recursive schema, see error above)
+ * }
+ * result (Optional): {
+ * outcome: String(NoProvenanceDetected/ProvenanceDetected) (Required)
+ * results (Optional): [
+ * (Optional){
+ * type: String(C2PA/Watermark) (Optional)
+ * provider: String (Optional)
+ * modelName: String (Optional)
+ * timestamp: OffsetDateTime (Optional)
+ * }
+ * ]
+ * }
+ * kind: String(Detect) (Required)
+ * createdAt: OffsetDateTime (Optional)
+ * lastUpdatedAt: OffsetDateTime (Optional)
+ * }
+ * }
+ *
+ *
+ * @param operationId The unique ID of the operation.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return content Provenance Detection Status
+ *
+ * Gets the status, result, or error of an asynchronous Content Provenance Detection operation along with
+ * {@link Response}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response getOperationStatusWithResponse(String operationId, RequestOptions requestOptions) {
+ final String accept = "application/json";
+ return service.getOperationStatusSync(this.getEndpoint(), this.getServiceVersion().getVersion(), operationId,
+ accept, requestOptions, Context.NONE);
+ }
+}
diff --git a/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/implementation/OperationLocationPollingStrategy.java b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/implementation/OperationLocationPollingStrategy.java
new file mode 100644
index 000000000000..dc39911001d9
--- /dev/null
+++ b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/implementation/OperationLocationPollingStrategy.java
@@ -0,0 +1,140 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) TypeSpec Code Generator.
+
+package com.azure.ai.contentsafety.implementation;
+
+import com.azure.core.exception.AzureException;
+import com.azure.core.http.HttpHeader;
+import com.azure.core.http.rest.Response;
+import com.azure.core.util.BinaryData;
+import com.azure.core.util.logging.ClientLogger;
+import com.azure.core.util.polling.LongRunningOperationStatus;
+import com.azure.core.util.polling.OperationResourcePollingStrategy;
+import com.azure.core.util.polling.PollResponse;
+import com.azure.core.util.polling.PollingContext;
+import com.azure.core.util.polling.PollingStrategyOptions;
+import com.azure.core.util.serializer.JsonSerializerProviders;
+import com.azure.core.util.serializer.ObjectSerializer;
+import com.azure.core.util.serializer.TypeReference;
+import java.time.Duration;
+import java.time.OffsetDateTime;
+import reactor.core.publisher.Mono;
+
+// DO NOT modify this helper class
+
+/**
+ * Implements an operation location polling strategy, from Operation-Location.
+ *
+ * @param the type of the response type from a polling call, or BinaryData if raw response body should be kept
+ * @param the type of the final result object to deserialize into, or BinaryData if raw response body should be
+ * kept
+ */
+public final class OperationLocationPollingStrategy extends OperationResourcePollingStrategy {
+
+ private static final ClientLogger LOGGER = new ClientLogger(OperationLocationPollingStrategy.class);
+
+ private final ObjectSerializer serializer;
+ private final String endpoint;
+ private final String propertyName;
+
+ /**
+ * Creates an instance of the operation resource polling strategy.
+ *
+ * @param pollingStrategyOptions options to configure this polling strategy.
+ * @throws NullPointerException if {@code pollingStrategyOptions} is null.
+ */
+ public OperationLocationPollingStrategy(PollingStrategyOptions pollingStrategyOptions) {
+ this(pollingStrategyOptions, null);
+ }
+
+ /**
+ * Creates an instance of the operation resource polling strategy.
+ *
+ * @param pollingStrategyOptions options to configure this polling strategy.
+ * @param propertyName the name of the property to extract final result.
+ * @throws NullPointerException if {@code pollingStrategyOptions} is null.
+ */
+ public OperationLocationPollingStrategy(PollingStrategyOptions pollingStrategyOptions, String propertyName) {
+ super(PollingUtils.OPERATION_LOCATION_HEADER, pollingStrategyOptions);
+ this.propertyName = propertyName;
+ this.endpoint = pollingStrategyOptions.getEndpoint();
+ this.serializer = pollingStrategyOptions.getSerializer() != null
+ ? pollingStrategyOptions.getSerializer()
+ : JsonSerializerProviders.createInstance(true);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Mono> onInitialResponse(Response> response, PollingContext pollingContext,
+ TypeReference pollResponseType) {
+ // Response> is Response
+
+ HttpHeader operationLocationHeader = response.getHeaders().get(PollingUtils.OPERATION_LOCATION_HEADER);
+ if (operationLocationHeader != null) {
+ pollingContext.setData(PollingUtils.OPERATION_LOCATION_HEADER.getCaseSensitiveName(),
+ PollingUtils.getAbsolutePath(operationLocationHeader.getValue(), endpoint, LOGGER));
+ }
+ final String httpMethod = response.getRequest().getHttpMethod().name();
+ pollingContext.setData(PollingUtils.HTTP_METHOD, httpMethod);
+ pollingContext.setData(PollingUtils.REQUEST_URL, response.getRequest().getUrl().toString());
+
+ if (response.getStatusCode() == 200
+ || response.getStatusCode() == 201
+ || response.getStatusCode() == 202
+ || response.getStatusCode() == 204) {
+ final Duration retryAfter
+ = PollingUtils.getRetryAfterFromHeaders(response.getHeaders(), OffsetDateTime::now);
+ final Mono> pollResponseMono
+ = PollingUtils.deserializeResponse((BinaryData) response.getValue(), serializer, pollResponseType)
+ .onErrorResume(exception -> {
+ LOGGER.info("Failed to parse initial response.");
+ return Mono.empty();
+ })
+ .map(value -> new PollResponse<>(LongRunningOperationStatus.IN_PROGRESS, value, retryAfter));
+ return pollResponseMono.switchIfEmpty(
+ Mono.fromSupplier(() -> new PollResponse<>(LongRunningOperationStatus.IN_PROGRESS, null, retryAfter)));
+ } else {
+ return Mono
+ .error(
+ new AzureException(String.format(
+ "Operation failed or cancelled with status code %d,"
+ + ", '%s' header: %s, and response body: %s",
+ response.getStatusCode(), PollingUtils.OPERATION_LOCATION_HEADER, operationLocationHeader,
+ response.getValue())));
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Mono getResult(PollingContext pollingContext, TypeReference resultType) {
+ if (pollingContext.getLatestResponse().getStatus() == LongRunningOperationStatus.FAILED) {
+ return Mono.error(new AzureException("Long running operation failed."));
+ } else if (pollingContext.getLatestResponse().getStatus() == LongRunningOperationStatus.USER_CANCELLED) {
+ return Mono.error(new AzureException("Long running operation cancelled."));
+ }
+ if (propertyName != null) {
+ // take the last poll response body from PollingContext,
+ // and de-serialize the property as final result
+ BinaryData latestResponseBody
+ = BinaryData.fromString(pollingContext.getData(PollingUtils.POLL_RESPONSE_BODY));
+ return PollingUtils
+ .deserializeResponse(latestResponseBody, serializer, PollingUtils.POST_POLL_RESULT_TYPE_REFERENCE)
+ .flatMap(value -> {
+ if (value.get(propertyName) != null) {
+ return BinaryData.fromObjectAsync(value.get(propertyName))
+ .flatMap(result -> PollingUtils.deserializeResponse(result, serializer, resultType));
+ } else {
+ return Mono.error(new AzureException("Cannot get final result"));
+ }
+ })
+ .switchIfEmpty(Mono.error(new AzureException("Cannot get final result")));
+ } else {
+ return super.getResult(pollingContext, resultType);
+ }
+ }
+}
diff --git a/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/implementation/PollingUtils.java b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/implementation/PollingUtils.java
new file mode 100644
index 000000000000..411edca19e7b
--- /dev/null
+++ b/sdk/contentsafety/azure-ai-contentsafety/src/main/java/com/azure/ai/contentsafety/implementation/PollingUtils.java
@@ -0,0 +1,151 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+// Code generated by Microsoft (R) TypeSpec Code Generator.
+
+package com.azure.ai.contentsafety.implementation;
+
+import com.azure.core.http.HttpHeaderName;
+import com.azure.core.http.HttpHeaders;
+import com.azure.core.util.BinaryData;
+import com.azure.core.util.CoreUtils;
+import com.azure.core.util.DateTimeRfc1123;
+import com.azure.core.util.logging.ClientLogger;
+import com.azure.core.util.serializer.ObjectSerializer;
+import com.azure.core.util.serializer.TypeReference;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.time.DateTimeException;
+import java.time.Duration;
+import java.time.OffsetDateTime;
+import java.time.temporal.ChronoUnit;
+import java.util.Map;
+import java.util.function.Function;
+import java.util.function.Supplier;
+import reactor.core.publisher.Mono;
+
+// DO NOT modify this helper class
+
+final class PollingUtils {
+
+ public static final TypeReference