From 26dc22f4551012131e2863f2937ff1d0ea314198 Mon Sep 17 00:00:00 2001 From: azure-sdk Date: Thu, 30 Jul 2026 17:21:57 +0000 Subject: [PATCH 1/5] Configurations: 'specification/cognitiveservices/ContentSafety/tspconfig.yaml', API Version: 2026-07-01-preview, SDK Release Type: beta, and CommitSHA: '829ccecea7e9c1609881104b9a8d0f8cb65ce644' in SpecRepo: 'https://github.com/Azure/azure-rest-api-specs' Pipeline run: https://dev.azure.com/azure-sdk/internal/_build/results?buildId=6640797 Refer to https://eng.ms/docs/products/azure-developer-experience/develop/sdk-release/sdk-release-prerequisites to prepare for SDK release. --- .../api/Azure.AI.ContentSafety.net10.0.cs | 199 ++++++++++++- .../api/Azure.AI.ContentSafety.net8.0.cs | 199 ++++++++++++- .../Azure.AI.ContentSafety.netstandard2.0.cs | 195 ++++++++++++- .../Azure.AI.ContentSafety/metadata.json | 2 +- .../ContentProvenanceClient.RestClient.cs | 62 ++++ .../src/Generated/ContentProvenanceClient.cs | 267 ++++++++++++++++++ .../ContentProvenanceClientHostExtensions.cs | 61 ++++ .../ContentProvenanceClientSettings.cs | 40 +++ .../ContentSafetyClientBuilderExtensions.cs | 37 +++ .../Generated/ContentSafetyClientOptions.cs | 9 +- .../Generated/ContentSafetyModelFactory.cs | 61 ++++ .../Models/AzureAIContentSafetyContext.cs | 7 + .../src/Generated/Models/DetectOutcome.cs | 76 +++++ .../DetectProvenanceOptions.Serialization.cs | 153 ++++++++++ .../Models/DetectProvenanceOptions.cs | 41 +++ .../DetectProvenanceResult.Serialization.cs | 176 ++++++++++++ .../Models/DetectProvenanceResult.cs | 44 +++ .../DetectedProvenance.Serialization.cs | 181 ++++++++++++ .../Generated/Models/DetectedProvenance.cs | 51 ++++ .../Models/DetectedProvenanceType.cs | 70 +++++ .../src/Generated/Models/OperationState.cs | 85 ++++++ .../Models/ProvenanceContent.Serialization.cs | 142 ++++++++++ .../src/Generated/Models/ProvenanceContent.cs | 41 +++ ...ProvenanceDetectOperation.Serialization.cs | 238 ++++++++++++++++ .../Models/ProvenanceDetectOperation.cs | 71 +++++ .../Models/ProvenanceOperationKind.cs | 65 +++++ .../Generated/schema/ConfigurationSchema.json | 17 ++ .../Azure.AI.ContentSafety/tsp-location.yaml | 8 +- 28 files changed, 2587 insertions(+), 11 deletions(-) create mode 100644 sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/ContentProvenanceClient.RestClient.cs create mode 100644 sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/ContentProvenanceClient.cs create mode 100644 sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/ContentProvenanceClientHostExtensions.cs create mode 100644 sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/ContentProvenanceClientSettings.cs create mode 100644 sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/Models/DetectOutcome.cs create mode 100644 sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/Models/DetectProvenanceOptions.Serialization.cs create mode 100644 sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/Models/DetectProvenanceOptions.cs create mode 100644 sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/Models/DetectProvenanceResult.Serialization.cs create mode 100644 sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/Models/DetectProvenanceResult.cs create mode 100644 sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/Models/DetectedProvenance.Serialization.cs create mode 100644 sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/Models/DetectedProvenance.cs create mode 100644 sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/Models/DetectedProvenanceType.cs create mode 100644 sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/Models/OperationState.cs create mode 100644 sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/Models/ProvenanceContent.Serialization.cs create mode 100644 sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/Models/ProvenanceContent.cs create mode 100644 sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/Models/ProvenanceDetectOperation.Serialization.cs create mode 100644 sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/Models/ProvenanceDetectOperation.cs create mode 100644 sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/Models/ProvenanceOperationKind.cs diff --git a/sdk/contentsafety/Azure.AI.ContentSafety/api/Azure.AI.ContentSafety.net10.0.cs b/sdk/contentsafety/Azure.AI.ContentSafety/api/Azure.AI.ContentSafety.net10.0.cs index a85e6b8a07a0..30cae7810696 100644 --- a/sdk/contentsafety/Azure.AI.ContentSafety/api/Azure.AI.ContentSafety.net10.0.cs +++ b/sdk/contentsafety/Azure.AI.ContentSafety/api/Azure.AI.ContentSafety.net10.0.cs @@ -193,6 +193,41 @@ public BlocklistClientSettings() { } public Azure.AI.ContentSafety.ContentSafetyClientOptions Options { get { throw null; } set { } } protected override void BindCore(Microsoft.Extensions.Configuration.IConfigurationSection section) { } } + public partial class ContentProvenanceClient + { + protected ContentProvenanceClient() { } + [System.Diagnostics.CodeAnalysis.ExperimentalAttribute("SCME0002")] + public ContentProvenanceClient(Azure.AI.ContentSafety.ContentProvenanceClientSettings settings) { } + public ContentProvenanceClient(System.Uri endpoint, Azure.AzureKeyCredential credential) { } + public ContentProvenanceClient(System.Uri endpoint, Azure.AzureKeyCredential credential, Azure.AI.ContentSafety.ContentSafetyClientOptions options) { } + public ContentProvenanceClient(System.Uri endpoint, Azure.Core.TokenCredential credential) { } + public ContentProvenanceClient(System.Uri endpoint, Azure.Core.TokenCredential credential, Azure.AI.ContentSafety.ContentSafetyClientOptions options) { } + public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } } + public virtual Azure.Operation Detect(Azure.WaitUntil waitUntil, Azure.AI.ContentSafety.DetectProvenanceOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Operation Detect(Azure.WaitUntil waitUntil, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } + public virtual System.Threading.Tasks.Task> DetectAsync(Azure.WaitUntil waitUntil, Azure.AI.ContentSafety.DetectProvenanceOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> DetectAsync(Azure.WaitUntil waitUntil, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } + public virtual Azure.Response GetOperationStatus(string operationId, Azure.RequestContext context) { throw null; } + public virtual Azure.Response GetOperationStatus(string operationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task GetOperationStatusAsync(string operationId, Azure.RequestContext context) { throw null; } + public virtual System.Threading.Tasks.Task> GetOperationStatusAsync(string operationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + [System.Diagnostics.CodeAnalysis.ExperimentalAttribute("SCME0002")] + public static partial class ContentProvenanceClientHostExtensions + { + public static System.ClientModel.Primitives.IClientBuilder AddContentProvenanceClient(this Microsoft.Extensions.Hosting.IHostApplicationBuilder host, string sectionName) { throw null; } + public static System.ClientModel.Primitives.IClientBuilder AddContentProvenanceClient(this Microsoft.Extensions.Hosting.IHostApplicationBuilder host, string sectionName, System.Action configureSettings) { throw null; } + public static System.ClientModel.Primitives.IClientBuilder AddKeyedContentProvenanceClient(this Microsoft.Extensions.Hosting.IHostApplicationBuilder host, string key, string sectionName) { throw null; } + public static System.ClientModel.Primitives.IClientBuilder AddKeyedContentProvenanceClient(this Microsoft.Extensions.Hosting.IHostApplicationBuilder host, string key, string sectionName, System.Action configureSettings) { throw null; } + } + [System.Diagnostics.CodeAnalysis.ExperimentalAttribute("SCME0002")] + public partial class ContentProvenanceClientSettings : System.ClientModel.Primitives.ClientSettings + { + public ContentProvenanceClientSettings() { } + public System.Uri Endpoint { get { throw null; } set { } } + public Azure.AI.ContentSafety.ContentSafetyClientOptions Options { get { throw null; } set { } } + protected override void BindCore(Microsoft.Extensions.Configuration.IConfigurationSection section) { } + } public partial class ContentSafetyClient { protected ContentSafetyClient() { } @@ -236,11 +271,12 @@ public static partial class ContentSafetyClientHostExtensions } public partial class ContentSafetyClientOptions : Azure.Core.ClientOptions { - public ContentSafetyClientOptions(Azure.AI.ContentSafety.ContentSafetyClientOptions.ServiceVersion version = Azure.AI.ContentSafety.ContentSafetyClientOptions.ServiceVersion.V2024_09_01) { } + public ContentSafetyClientOptions(Azure.AI.ContentSafety.ContentSafetyClientOptions.ServiceVersion version = Azure.AI.ContentSafety.ContentSafetyClientOptions.ServiceVersion.V2026_07_01_Preview) { } public enum ServiceVersion { V2023_10_01 = 1, V2024_09_01 = 2, + V2026_07_01_Preview = 3, } } [System.Diagnostics.CodeAnalysis.ExperimentalAttribute("SCME0002")] @@ -275,10 +311,15 @@ public static partial class ContentSafetyModelFactory public static Azure.AI.ContentSafety.AnalyzeTextOptions AnalyzeTextOptions(string text = null, System.Collections.Generic.IEnumerable categories = null, System.Collections.Generic.IEnumerable blocklistNames = null, bool? haltOnBlocklistHit = default(bool?), Azure.AI.ContentSafety.AnalyzeTextOutputType? outputType = default(Azure.AI.ContentSafety.AnalyzeTextOutputType?)) { throw null; } public static Azure.AI.ContentSafety.AnalyzeTextResult AnalyzeTextResult(System.Collections.Generic.IEnumerable blocklistsMatch = null, System.Collections.Generic.IEnumerable categoriesAnalysis = null) { throw null; } public static Azure.AI.ContentSafety.ContentSafetyImageData ContentSafetyImageData(System.BinaryData content = null, System.Uri blobUri = null) { throw null; } + public static Azure.AI.ContentSafety.DetectedProvenance DetectedProvenance(Azure.AI.ContentSafety.DetectedProvenanceType? type = default(Azure.AI.ContentSafety.DetectedProvenanceType?), string provider = null, string modelName = null, System.DateTimeOffset? timestamp = default(System.DateTimeOffset?)) { throw null; } + public static Azure.AI.ContentSafety.DetectProvenanceOptions DetectProvenanceOptions(Azure.AI.ContentSafety.ProvenanceContent content = null) { throw null; } + public static Azure.AI.ContentSafety.DetectProvenanceResult DetectProvenanceResult(Azure.AI.ContentSafety.DetectOutcome outcome = default(Azure.AI.ContentSafety.DetectOutcome), System.Collections.Generic.IEnumerable results = null) { throw null; } public static Azure.AI.ContentSafety.DetectTextProtectedMaterialOptions DetectTextProtectedMaterialOptions(string text = null) { throw null; } public static Azure.AI.ContentSafety.DetectTextProtectedMaterialResult DetectTextProtectedMaterialResult(Azure.AI.ContentSafety.TextProtectedMaterialAnalysisResult protectedMaterialAnalysis = null) { throw null; } public static Azure.AI.ContentSafety.DocumentInjectionAnalysisResult DocumentInjectionAnalysisResult(bool attackDetected = false) { throw null; } public static Azure.AI.ContentSafety.ImageCategoriesAnalysis ImageCategoriesAnalysis(Azure.AI.ContentSafety.ImageCategory category = default(Azure.AI.ContentSafety.ImageCategory), int? severity = default(int?)) { throw null; } + public static Azure.AI.ContentSafety.ProvenanceContent ProvenanceContent(System.Uri uri = null) { throw null; } + public static Azure.AI.ContentSafety.ProvenanceDetectOperation ProvenanceDetectOperation(string id = null, Azure.AI.ContentSafety.OperationState status = default(Azure.AI.ContentSafety.OperationState), Azure.ResponseError error = null, Azure.AI.ContentSafety.DetectProvenanceResult result = null, Azure.AI.ContentSafety.ProvenanceOperationKind kind = default(Azure.AI.ContentSafety.ProvenanceOperationKind), System.DateTimeOffset? createdAt = default(System.DateTimeOffset?), System.DateTimeOffset? lastUpdatedAt = default(System.DateTimeOffset?)) { throw null; } public static Azure.AI.ContentSafety.RemoveTextBlocklistItemsOptions RemoveTextBlocklistItemsOptions(System.Collections.Generic.IEnumerable blocklistItemIds = null) { throw null; } public static Azure.AI.ContentSafety.ShieldPromptOptions ShieldPromptOptions(string userPrompt = null, System.Collections.Generic.IEnumerable documents = null) { throw null; } public static Azure.AI.ContentSafety.ShieldPromptResult ShieldPromptResult(Azure.AI.ContentSafety.UserPromptInjectionAnalysisResult userPromptAnalysis = null, System.Collections.Generic.IEnumerable documentsAnalysis = null) { throw null; } @@ -290,6 +331,87 @@ public static partial class ContentSafetyModelFactory public static Azure.AI.ContentSafety.TextProtectedMaterialAnalysisResult TextProtectedMaterialAnalysisResult(bool detected = false) { throw null; } public static Azure.AI.ContentSafety.UserPromptInjectionAnalysisResult UserPromptInjectionAnalysisResult(bool attackDetected = false) { throw null; } } + public partial class DetectedProvenance : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal DetectedProvenance() { } + public string ModelName { get { throw null; } } + public string Provider { get { throw null; } } + public System.DateTimeOffset? Timestamp { get { throw null; } } + public Azure.AI.ContentSafety.DetectedProvenanceType? Type { get { throw null; } } + protected virtual Azure.AI.ContentSafety.DetectedProvenance JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.AI.ContentSafety.DetectedProvenance PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + Azure.AI.ContentSafety.DetectedProvenance System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.ContentSafety.DetectedProvenance System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct DetectedProvenanceType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public DetectedProvenanceType(string value) { throw null; } + public static Azure.AI.ContentSafety.DetectedProvenanceType C2PA { get { throw null; } } + public static Azure.AI.ContentSafety.DetectedProvenanceType Watermark { get { throw null; } } + public bool Equals(Azure.AI.ContentSafety.DetectedProvenanceType other) { throw null; } + public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.AI.ContentSafety.DetectedProvenanceType left, Azure.AI.ContentSafety.DetectedProvenanceType right) { throw null; } + public static implicit operator Azure.AI.ContentSafety.DetectedProvenanceType (string value) { throw null; } + public static implicit operator Azure.AI.ContentSafety.DetectedProvenanceType? (string value) { throw null; } + public static bool operator !=(Azure.AI.ContentSafety.DetectedProvenanceType left, Azure.AI.ContentSafety.DetectedProvenanceType right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct DetectOutcome : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public DetectOutcome(string value) { throw null; } + public static Azure.AI.ContentSafety.DetectOutcome NoProvenanceDetected { get { throw null; } } + public static Azure.AI.ContentSafety.DetectOutcome ProvenanceDetected { get { throw null; } } + public bool Equals(Azure.AI.ContentSafety.DetectOutcome other) { throw null; } + public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.AI.ContentSafety.DetectOutcome left, Azure.AI.ContentSafety.DetectOutcome right) { throw null; } + public static implicit operator Azure.AI.ContentSafety.DetectOutcome (string value) { throw null; } + public static implicit operator Azure.AI.ContentSafety.DetectOutcome? (string value) { throw null; } + public static bool operator !=(Azure.AI.ContentSafety.DetectOutcome left, Azure.AI.ContentSafety.DetectOutcome right) { throw null; } + public override string ToString() { throw null; } + } + public partial class DetectProvenanceOptions : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DetectProvenanceOptions(Azure.AI.ContentSafety.ProvenanceContent content) { } + public Azure.AI.ContentSafety.ProvenanceContent Content { get { throw null; } } + protected virtual Azure.AI.ContentSafety.DetectProvenanceOptions JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + public static implicit operator Azure.Core.RequestContent (Azure.AI.ContentSafety.DetectProvenanceOptions detectProvenanceOptions) { throw null; } + protected virtual Azure.AI.ContentSafety.DetectProvenanceOptions PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + Azure.AI.ContentSafety.DetectProvenanceOptions System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.ContentSafety.DetectProvenanceOptions System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class DetectProvenanceResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal DetectProvenanceResult() { } + public Azure.AI.ContentSafety.DetectOutcome Outcome { get { throw null; } } + public System.Collections.Generic.IList Results { get { throw null; } } + protected virtual Azure.AI.ContentSafety.DetectProvenanceResult JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.AI.ContentSafety.DetectProvenanceResult PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + Azure.AI.ContentSafety.DetectProvenanceResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.ContentSafety.DetectProvenanceResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } public partial class DetectTextProtectedMaterialOptions : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public DetectTextProtectedMaterialOptions(string text) { } @@ -368,6 +490,77 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public static bool operator !=(Azure.AI.ContentSafety.ImageCategory left, Azure.AI.ContentSafety.ImageCategory right) { throw null; } public override string ToString() { throw null; } } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct OperationState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public OperationState(string value) { throw null; } + public static Azure.AI.ContentSafety.OperationState Canceled { get { throw null; } } + public static Azure.AI.ContentSafety.OperationState Failed { get { throw null; } } + public static Azure.AI.ContentSafety.OperationState NotStarted { get { throw null; } } + public static Azure.AI.ContentSafety.OperationState Running { get { throw null; } } + public static Azure.AI.ContentSafety.OperationState Succeeded { get { throw null; } } + public bool Equals(Azure.AI.ContentSafety.OperationState other) { throw null; } + public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.AI.ContentSafety.OperationState left, Azure.AI.ContentSafety.OperationState right) { throw null; } + public static implicit operator Azure.AI.ContentSafety.OperationState (string value) { throw null; } + public static implicit operator Azure.AI.ContentSafety.OperationState? (string value) { throw null; } + public static bool operator !=(Azure.AI.ContentSafety.OperationState left, Azure.AI.ContentSafety.OperationState right) { throw null; } + public override string ToString() { throw null; } + } + public partial class ProvenanceContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public ProvenanceContent(System.Uri uri) { } + public System.Uri Uri { get { throw null; } } + protected virtual Azure.AI.ContentSafety.ProvenanceContent JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.AI.ContentSafety.ProvenanceContent PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + Azure.AI.ContentSafety.ProvenanceContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.ContentSafety.ProvenanceContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class ProvenanceDetectOperation : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ProvenanceDetectOperation() { } + public System.DateTimeOffset? CreatedAt { get { throw null; } } + public Azure.ResponseError Error { get { throw null; } } + public string Id { get { throw null; } } + public Azure.AI.ContentSafety.ProvenanceOperationKind Kind { get { throw null; } } + public System.DateTimeOffset? LastUpdatedAt { get { throw null; } } + public Azure.AI.ContentSafety.DetectProvenanceResult Result { get { throw null; } } + public Azure.AI.ContentSafety.OperationState Status { get { throw null; } } + protected virtual Azure.AI.ContentSafety.ProvenanceDetectOperation JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + public static explicit operator Azure.AI.ContentSafety.ProvenanceDetectOperation (Azure.Response response) { throw null; } + protected virtual Azure.AI.ContentSafety.ProvenanceDetectOperation PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + Azure.AI.ContentSafety.ProvenanceDetectOperation System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.ContentSafety.ProvenanceDetectOperation System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ProvenanceOperationKind : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ProvenanceOperationKind(string value) { throw null; } + public static Azure.AI.ContentSafety.ProvenanceOperationKind Detect { get { throw null; } } + public bool Equals(Azure.AI.ContentSafety.ProvenanceOperationKind other) { throw null; } + public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.AI.ContentSafety.ProvenanceOperationKind left, Azure.AI.ContentSafety.ProvenanceOperationKind right) { throw null; } + public static implicit operator Azure.AI.ContentSafety.ProvenanceOperationKind (string value) { throw null; } + public static implicit operator Azure.AI.ContentSafety.ProvenanceOperationKind? (string value) { throw null; } + public static bool operator !=(Azure.AI.ContentSafety.ProvenanceOperationKind left, Azure.AI.ContentSafety.ProvenanceOperationKind right) { throw null; } + public override string ToString() { throw null; } + } public partial class RemoveTextBlocklistItemsOptions : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public RemoveTextBlocklistItemsOptions(System.Collections.Generic.IEnumerable blocklistItemIds) { } @@ -536,6 +729,10 @@ public static partial class ContentSafetyClientBuilderExtensions public static Azure.Core.Extensions.IAzureClientBuilder AddBlocklistClient(this TBuilder builder, System.Uri endpoint, Azure.AzureKeyCredential credential) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilder { throw null; } [System.Diagnostics.CodeAnalysis.RequiresDynamicCodeAttribute("Requires unreferenced code until we opt into EnableConfigurationBindingGenerator.")] public static Azure.Core.Extensions.IAzureClientBuilder AddBlocklistClient(this TBuilder builder, TConfiguration configuration) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilderWithConfiguration { throw null; } + public static Azure.Core.Extensions.IAzureClientBuilder AddContentProvenanceClient(this TBuilder builder, System.Uri endpoint) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilderWithCredential { throw null; } + public static Azure.Core.Extensions.IAzureClientBuilder AddContentProvenanceClient(this TBuilder builder, System.Uri endpoint, Azure.AzureKeyCredential credential) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilder { throw null; } + [System.Diagnostics.CodeAnalysis.RequiresDynamicCodeAttribute("Requires unreferenced code until we opt into EnableConfigurationBindingGenerator.")] + public static Azure.Core.Extensions.IAzureClientBuilder AddContentProvenanceClient(this TBuilder builder, TConfiguration configuration) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilderWithConfiguration { throw null; } public static Azure.Core.Extensions.IAzureClientBuilder AddContentSafetyClient(this TBuilder builder, System.Uri endpoint) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilderWithCredential { throw null; } public static Azure.Core.Extensions.IAzureClientBuilder AddContentSafetyClient(this TBuilder builder, System.Uri endpoint, Azure.AzureKeyCredential credential) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilder { throw null; } [System.Diagnostics.CodeAnalysis.RequiresDynamicCodeAttribute("Requires unreferenced code until we opt into EnableConfigurationBindingGenerator.")] diff --git a/sdk/contentsafety/Azure.AI.ContentSafety/api/Azure.AI.ContentSafety.net8.0.cs b/sdk/contentsafety/Azure.AI.ContentSafety/api/Azure.AI.ContentSafety.net8.0.cs index a85e6b8a07a0..30cae7810696 100644 --- a/sdk/contentsafety/Azure.AI.ContentSafety/api/Azure.AI.ContentSafety.net8.0.cs +++ b/sdk/contentsafety/Azure.AI.ContentSafety/api/Azure.AI.ContentSafety.net8.0.cs @@ -193,6 +193,41 @@ public BlocklistClientSettings() { } public Azure.AI.ContentSafety.ContentSafetyClientOptions Options { get { throw null; } set { } } protected override void BindCore(Microsoft.Extensions.Configuration.IConfigurationSection section) { } } + public partial class ContentProvenanceClient + { + protected ContentProvenanceClient() { } + [System.Diagnostics.CodeAnalysis.ExperimentalAttribute("SCME0002")] + public ContentProvenanceClient(Azure.AI.ContentSafety.ContentProvenanceClientSettings settings) { } + public ContentProvenanceClient(System.Uri endpoint, Azure.AzureKeyCredential credential) { } + public ContentProvenanceClient(System.Uri endpoint, Azure.AzureKeyCredential credential, Azure.AI.ContentSafety.ContentSafetyClientOptions options) { } + public ContentProvenanceClient(System.Uri endpoint, Azure.Core.TokenCredential credential) { } + public ContentProvenanceClient(System.Uri endpoint, Azure.Core.TokenCredential credential, Azure.AI.ContentSafety.ContentSafetyClientOptions options) { } + public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } } + public virtual Azure.Operation Detect(Azure.WaitUntil waitUntil, Azure.AI.ContentSafety.DetectProvenanceOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Operation Detect(Azure.WaitUntil waitUntil, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } + public virtual System.Threading.Tasks.Task> DetectAsync(Azure.WaitUntil waitUntil, Azure.AI.ContentSafety.DetectProvenanceOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> DetectAsync(Azure.WaitUntil waitUntil, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } + public virtual Azure.Response GetOperationStatus(string operationId, Azure.RequestContext context) { throw null; } + public virtual Azure.Response GetOperationStatus(string operationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task GetOperationStatusAsync(string operationId, Azure.RequestContext context) { throw null; } + public virtual System.Threading.Tasks.Task> GetOperationStatusAsync(string operationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + [System.Diagnostics.CodeAnalysis.ExperimentalAttribute("SCME0002")] + public static partial class ContentProvenanceClientHostExtensions + { + public static System.ClientModel.Primitives.IClientBuilder AddContentProvenanceClient(this Microsoft.Extensions.Hosting.IHostApplicationBuilder host, string sectionName) { throw null; } + public static System.ClientModel.Primitives.IClientBuilder AddContentProvenanceClient(this Microsoft.Extensions.Hosting.IHostApplicationBuilder host, string sectionName, System.Action configureSettings) { throw null; } + public static System.ClientModel.Primitives.IClientBuilder AddKeyedContentProvenanceClient(this Microsoft.Extensions.Hosting.IHostApplicationBuilder host, string key, string sectionName) { throw null; } + public static System.ClientModel.Primitives.IClientBuilder AddKeyedContentProvenanceClient(this Microsoft.Extensions.Hosting.IHostApplicationBuilder host, string key, string sectionName, System.Action configureSettings) { throw null; } + } + [System.Diagnostics.CodeAnalysis.ExperimentalAttribute("SCME0002")] + public partial class ContentProvenanceClientSettings : System.ClientModel.Primitives.ClientSettings + { + public ContentProvenanceClientSettings() { } + public System.Uri Endpoint { get { throw null; } set { } } + public Azure.AI.ContentSafety.ContentSafetyClientOptions Options { get { throw null; } set { } } + protected override void BindCore(Microsoft.Extensions.Configuration.IConfigurationSection section) { } + } public partial class ContentSafetyClient { protected ContentSafetyClient() { } @@ -236,11 +271,12 @@ public static partial class ContentSafetyClientHostExtensions } public partial class ContentSafetyClientOptions : Azure.Core.ClientOptions { - public ContentSafetyClientOptions(Azure.AI.ContentSafety.ContentSafetyClientOptions.ServiceVersion version = Azure.AI.ContentSafety.ContentSafetyClientOptions.ServiceVersion.V2024_09_01) { } + public ContentSafetyClientOptions(Azure.AI.ContentSafety.ContentSafetyClientOptions.ServiceVersion version = Azure.AI.ContentSafety.ContentSafetyClientOptions.ServiceVersion.V2026_07_01_Preview) { } public enum ServiceVersion { V2023_10_01 = 1, V2024_09_01 = 2, + V2026_07_01_Preview = 3, } } [System.Diagnostics.CodeAnalysis.ExperimentalAttribute("SCME0002")] @@ -275,10 +311,15 @@ public static partial class ContentSafetyModelFactory public static Azure.AI.ContentSafety.AnalyzeTextOptions AnalyzeTextOptions(string text = null, System.Collections.Generic.IEnumerable categories = null, System.Collections.Generic.IEnumerable blocklistNames = null, bool? haltOnBlocklistHit = default(bool?), Azure.AI.ContentSafety.AnalyzeTextOutputType? outputType = default(Azure.AI.ContentSafety.AnalyzeTextOutputType?)) { throw null; } public static Azure.AI.ContentSafety.AnalyzeTextResult AnalyzeTextResult(System.Collections.Generic.IEnumerable blocklistsMatch = null, System.Collections.Generic.IEnumerable categoriesAnalysis = null) { throw null; } public static Azure.AI.ContentSafety.ContentSafetyImageData ContentSafetyImageData(System.BinaryData content = null, System.Uri blobUri = null) { throw null; } + public static Azure.AI.ContentSafety.DetectedProvenance DetectedProvenance(Azure.AI.ContentSafety.DetectedProvenanceType? type = default(Azure.AI.ContentSafety.DetectedProvenanceType?), string provider = null, string modelName = null, System.DateTimeOffset? timestamp = default(System.DateTimeOffset?)) { throw null; } + public static Azure.AI.ContentSafety.DetectProvenanceOptions DetectProvenanceOptions(Azure.AI.ContentSafety.ProvenanceContent content = null) { throw null; } + public static Azure.AI.ContentSafety.DetectProvenanceResult DetectProvenanceResult(Azure.AI.ContentSafety.DetectOutcome outcome = default(Azure.AI.ContentSafety.DetectOutcome), System.Collections.Generic.IEnumerable results = null) { throw null; } public static Azure.AI.ContentSafety.DetectTextProtectedMaterialOptions DetectTextProtectedMaterialOptions(string text = null) { throw null; } public static Azure.AI.ContentSafety.DetectTextProtectedMaterialResult DetectTextProtectedMaterialResult(Azure.AI.ContentSafety.TextProtectedMaterialAnalysisResult protectedMaterialAnalysis = null) { throw null; } public static Azure.AI.ContentSafety.DocumentInjectionAnalysisResult DocumentInjectionAnalysisResult(bool attackDetected = false) { throw null; } public static Azure.AI.ContentSafety.ImageCategoriesAnalysis ImageCategoriesAnalysis(Azure.AI.ContentSafety.ImageCategory category = default(Azure.AI.ContentSafety.ImageCategory), int? severity = default(int?)) { throw null; } + public static Azure.AI.ContentSafety.ProvenanceContent ProvenanceContent(System.Uri uri = null) { throw null; } + public static Azure.AI.ContentSafety.ProvenanceDetectOperation ProvenanceDetectOperation(string id = null, Azure.AI.ContentSafety.OperationState status = default(Azure.AI.ContentSafety.OperationState), Azure.ResponseError error = null, Azure.AI.ContentSafety.DetectProvenanceResult result = null, Azure.AI.ContentSafety.ProvenanceOperationKind kind = default(Azure.AI.ContentSafety.ProvenanceOperationKind), System.DateTimeOffset? createdAt = default(System.DateTimeOffset?), System.DateTimeOffset? lastUpdatedAt = default(System.DateTimeOffset?)) { throw null; } public static Azure.AI.ContentSafety.RemoveTextBlocklistItemsOptions RemoveTextBlocklistItemsOptions(System.Collections.Generic.IEnumerable blocklistItemIds = null) { throw null; } public static Azure.AI.ContentSafety.ShieldPromptOptions ShieldPromptOptions(string userPrompt = null, System.Collections.Generic.IEnumerable documents = null) { throw null; } public static Azure.AI.ContentSafety.ShieldPromptResult ShieldPromptResult(Azure.AI.ContentSafety.UserPromptInjectionAnalysisResult userPromptAnalysis = null, System.Collections.Generic.IEnumerable documentsAnalysis = null) { throw null; } @@ -290,6 +331,87 @@ public static partial class ContentSafetyModelFactory public static Azure.AI.ContentSafety.TextProtectedMaterialAnalysisResult TextProtectedMaterialAnalysisResult(bool detected = false) { throw null; } public static Azure.AI.ContentSafety.UserPromptInjectionAnalysisResult UserPromptInjectionAnalysisResult(bool attackDetected = false) { throw null; } } + public partial class DetectedProvenance : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal DetectedProvenance() { } + public string ModelName { get { throw null; } } + public string Provider { get { throw null; } } + public System.DateTimeOffset? Timestamp { get { throw null; } } + public Azure.AI.ContentSafety.DetectedProvenanceType? Type { get { throw null; } } + protected virtual Azure.AI.ContentSafety.DetectedProvenance JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.AI.ContentSafety.DetectedProvenance PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + Azure.AI.ContentSafety.DetectedProvenance System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.ContentSafety.DetectedProvenance System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct DetectedProvenanceType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public DetectedProvenanceType(string value) { throw null; } + public static Azure.AI.ContentSafety.DetectedProvenanceType C2PA { get { throw null; } } + public static Azure.AI.ContentSafety.DetectedProvenanceType Watermark { get { throw null; } } + public bool Equals(Azure.AI.ContentSafety.DetectedProvenanceType other) { throw null; } + public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.AI.ContentSafety.DetectedProvenanceType left, Azure.AI.ContentSafety.DetectedProvenanceType right) { throw null; } + public static implicit operator Azure.AI.ContentSafety.DetectedProvenanceType (string value) { throw null; } + public static implicit operator Azure.AI.ContentSafety.DetectedProvenanceType? (string value) { throw null; } + public static bool operator !=(Azure.AI.ContentSafety.DetectedProvenanceType left, Azure.AI.ContentSafety.DetectedProvenanceType right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct DetectOutcome : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public DetectOutcome(string value) { throw null; } + public static Azure.AI.ContentSafety.DetectOutcome NoProvenanceDetected { get { throw null; } } + public static Azure.AI.ContentSafety.DetectOutcome ProvenanceDetected { get { throw null; } } + public bool Equals(Azure.AI.ContentSafety.DetectOutcome other) { throw null; } + public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.AI.ContentSafety.DetectOutcome left, Azure.AI.ContentSafety.DetectOutcome right) { throw null; } + public static implicit operator Azure.AI.ContentSafety.DetectOutcome (string value) { throw null; } + public static implicit operator Azure.AI.ContentSafety.DetectOutcome? (string value) { throw null; } + public static bool operator !=(Azure.AI.ContentSafety.DetectOutcome left, Azure.AI.ContentSafety.DetectOutcome right) { throw null; } + public override string ToString() { throw null; } + } + public partial class DetectProvenanceOptions : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DetectProvenanceOptions(Azure.AI.ContentSafety.ProvenanceContent content) { } + public Azure.AI.ContentSafety.ProvenanceContent Content { get { throw null; } } + protected virtual Azure.AI.ContentSafety.DetectProvenanceOptions JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + public static implicit operator Azure.Core.RequestContent (Azure.AI.ContentSafety.DetectProvenanceOptions detectProvenanceOptions) { throw null; } + protected virtual Azure.AI.ContentSafety.DetectProvenanceOptions PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + Azure.AI.ContentSafety.DetectProvenanceOptions System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.ContentSafety.DetectProvenanceOptions System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class DetectProvenanceResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal DetectProvenanceResult() { } + public Azure.AI.ContentSafety.DetectOutcome Outcome { get { throw null; } } + public System.Collections.Generic.IList Results { get { throw null; } } + protected virtual Azure.AI.ContentSafety.DetectProvenanceResult JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.AI.ContentSafety.DetectProvenanceResult PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + Azure.AI.ContentSafety.DetectProvenanceResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.ContentSafety.DetectProvenanceResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } public partial class DetectTextProtectedMaterialOptions : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public DetectTextProtectedMaterialOptions(string text) { } @@ -368,6 +490,77 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public static bool operator !=(Azure.AI.ContentSafety.ImageCategory left, Azure.AI.ContentSafety.ImageCategory right) { throw null; } public override string ToString() { throw null; } } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct OperationState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public OperationState(string value) { throw null; } + public static Azure.AI.ContentSafety.OperationState Canceled { get { throw null; } } + public static Azure.AI.ContentSafety.OperationState Failed { get { throw null; } } + public static Azure.AI.ContentSafety.OperationState NotStarted { get { throw null; } } + public static Azure.AI.ContentSafety.OperationState Running { get { throw null; } } + public static Azure.AI.ContentSafety.OperationState Succeeded { get { throw null; } } + public bool Equals(Azure.AI.ContentSafety.OperationState other) { throw null; } + public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.AI.ContentSafety.OperationState left, Azure.AI.ContentSafety.OperationState right) { throw null; } + public static implicit operator Azure.AI.ContentSafety.OperationState (string value) { throw null; } + public static implicit operator Azure.AI.ContentSafety.OperationState? (string value) { throw null; } + public static bool operator !=(Azure.AI.ContentSafety.OperationState left, Azure.AI.ContentSafety.OperationState right) { throw null; } + public override string ToString() { throw null; } + } + public partial class ProvenanceContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public ProvenanceContent(System.Uri uri) { } + public System.Uri Uri { get { throw null; } } + protected virtual Azure.AI.ContentSafety.ProvenanceContent JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.AI.ContentSafety.ProvenanceContent PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + Azure.AI.ContentSafety.ProvenanceContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.ContentSafety.ProvenanceContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class ProvenanceDetectOperation : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ProvenanceDetectOperation() { } + public System.DateTimeOffset? CreatedAt { get { throw null; } } + public Azure.ResponseError Error { get { throw null; } } + public string Id { get { throw null; } } + public Azure.AI.ContentSafety.ProvenanceOperationKind Kind { get { throw null; } } + public System.DateTimeOffset? LastUpdatedAt { get { throw null; } } + public Azure.AI.ContentSafety.DetectProvenanceResult Result { get { throw null; } } + public Azure.AI.ContentSafety.OperationState Status { get { throw null; } } + protected virtual Azure.AI.ContentSafety.ProvenanceDetectOperation JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + public static explicit operator Azure.AI.ContentSafety.ProvenanceDetectOperation (Azure.Response response) { throw null; } + protected virtual Azure.AI.ContentSafety.ProvenanceDetectOperation PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + Azure.AI.ContentSafety.ProvenanceDetectOperation System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.ContentSafety.ProvenanceDetectOperation System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ProvenanceOperationKind : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ProvenanceOperationKind(string value) { throw null; } + public static Azure.AI.ContentSafety.ProvenanceOperationKind Detect { get { throw null; } } + public bool Equals(Azure.AI.ContentSafety.ProvenanceOperationKind other) { throw null; } + public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.AI.ContentSafety.ProvenanceOperationKind left, Azure.AI.ContentSafety.ProvenanceOperationKind right) { throw null; } + public static implicit operator Azure.AI.ContentSafety.ProvenanceOperationKind (string value) { throw null; } + public static implicit operator Azure.AI.ContentSafety.ProvenanceOperationKind? (string value) { throw null; } + public static bool operator !=(Azure.AI.ContentSafety.ProvenanceOperationKind left, Azure.AI.ContentSafety.ProvenanceOperationKind right) { throw null; } + public override string ToString() { throw null; } + } public partial class RemoveTextBlocklistItemsOptions : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public RemoveTextBlocklistItemsOptions(System.Collections.Generic.IEnumerable blocklistItemIds) { } @@ -536,6 +729,10 @@ public static partial class ContentSafetyClientBuilderExtensions public static Azure.Core.Extensions.IAzureClientBuilder AddBlocklistClient(this TBuilder builder, System.Uri endpoint, Azure.AzureKeyCredential credential) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilder { throw null; } [System.Diagnostics.CodeAnalysis.RequiresDynamicCodeAttribute("Requires unreferenced code until we opt into EnableConfigurationBindingGenerator.")] public static Azure.Core.Extensions.IAzureClientBuilder AddBlocklistClient(this TBuilder builder, TConfiguration configuration) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilderWithConfiguration { throw null; } + public static Azure.Core.Extensions.IAzureClientBuilder AddContentProvenanceClient(this TBuilder builder, System.Uri endpoint) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilderWithCredential { throw null; } + public static Azure.Core.Extensions.IAzureClientBuilder AddContentProvenanceClient(this TBuilder builder, System.Uri endpoint, Azure.AzureKeyCredential credential) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilder { throw null; } + [System.Diagnostics.CodeAnalysis.RequiresDynamicCodeAttribute("Requires unreferenced code until we opt into EnableConfigurationBindingGenerator.")] + public static Azure.Core.Extensions.IAzureClientBuilder AddContentProvenanceClient(this TBuilder builder, TConfiguration configuration) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilderWithConfiguration { throw null; } public static Azure.Core.Extensions.IAzureClientBuilder AddContentSafetyClient(this TBuilder builder, System.Uri endpoint) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilderWithCredential { throw null; } public static Azure.Core.Extensions.IAzureClientBuilder AddContentSafetyClient(this TBuilder builder, System.Uri endpoint, Azure.AzureKeyCredential credential) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilder { throw null; } [System.Diagnostics.CodeAnalysis.RequiresDynamicCodeAttribute("Requires unreferenced code until we opt into EnableConfigurationBindingGenerator.")] diff --git a/sdk/contentsafety/Azure.AI.ContentSafety/api/Azure.AI.ContentSafety.netstandard2.0.cs b/sdk/contentsafety/Azure.AI.ContentSafety/api/Azure.AI.ContentSafety.netstandard2.0.cs index 55fc9f9863ba..c4a89ae4d7c6 100644 --- a/sdk/contentsafety/Azure.AI.ContentSafety/api/Azure.AI.ContentSafety.netstandard2.0.cs +++ b/sdk/contentsafety/Azure.AI.ContentSafety/api/Azure.AI.ContentSafety.netstandard2.0.cs @@ -190,6 +190,38 @@ public BlocklistClientSettings() { } public Azure.AI.ContentSafety.ContentSafetyClientOptions Options { get { throw null; } set { } } protected override void BindCore(Microsoft.Extensions.Configuration.IConfigurationSection section) { } } + public partial class ContentProvenanceClient + { + protected ContentProvenanceClient() { } + public ContentProvenanceClient(Azure.AI.ContentSafety.ContentProvenanceClientSettings settings) { } + public ContentProvenanceClient(System.Uri endpoint, Azure.AzureKeyCredential credential) { } + public ContentProvenanceClient(System.Uri endpoint, Azure.AzureKeyCredential credential, Azure.AI.ContentSafety.ContentSafetyClientOptions options) { } + public ContentProvenanceClient(System.Uri endpoint, Azure.Core.TokenCredential credential) { } + public ContentProvenanceClient(System.Uri endpoint, Azure.Core.TokenCredential credential, Azure.AI.ContentSafety.ContentSafetyClientOptions options) { } + public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } } + public virtual Azure.Operation Detect(Azure.WaitUntil waitUntil, Azure.AI.ContentSafety.DetectProvenanceOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Operation Detect(Azure.WaitUntil waitUntil, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } + public virtual System.Threading.Tasks.Task> DetectAsync(Azure.WaitUntil waitUntil, Azure.AI.ContentSafety.DetectProvenanceOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> DetectAsync(Azure.WaitUntil waitUntil, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } + public virtual Azure.Response GetOperationStatus(string operationId, Azure.RequestContext context) { throw null; } + public virtual Azure.Response GetOperationStatus(string operationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task GetOperationStatusAsync(string operationId, Azure.RequestContext context) { throw null; } + public virtual System.Threading.Tasks.Task> GetOperationStatusAsync(string operationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public static partial class ContentProvenanceClientHostExtensions + { + public static System.ClientModel.Primitives.IClientBuilder AddContentProvenanceClient(this Microsoft.Extensions.Hosting.IHostApplicationBuilder host, string sectionName) { throw null; } + public static System.ClientModel.Primitives.IClientBuilder AddContentProvenanceClient(this Microsoft.Extensions.Hosting.IHostApplicationBuilder host, string sectionName, System.Action configureSettings) { throw null; } + public static System.ClientModel.Primitives.IClientBuilder AddKeyedContentProvenanceClient(this Microsoft.Extensions.Hosting.IHostApplicationBuilder host, string key, string sectionName) { throw null; } + public static System.ClientModel.Primitives.IClientBuilder AddKeyedContentProvenanceClient(this Microsoft.Extensions.Hosting.IHostApplicationBuilder host, string key, string sectionName, System.Action configureSettings) { throw null; } + } + public partial class ContentProvenanceClientSettings : System.ClientModel.Primitives.ClientSettings + { + public ContentProvenanceClientSettings() { } + public System.Uri Endpoint { get { throw null; } set { } } + public Azure.AI.ContentSafety.ContentSafetyClientOptions Options { get { throw null; } set { } } + protected override void BindCore(Microsoft.Extensions.Configuration.IConfigurationSection section) { } + } public partial class ContentSafetyClient { protected ContentSafetyClient() { } @@ -231,11 +263,12 @@ public static partial class ContentSafetyClientHostExtensions } public partial class ContentSafetyClientOptions : Azure.Core.ClientOptions { - public ContentSafetyClientOptions(Azure.AI.ContentSafety.ContentSafetyClientOptions.ServiceVersion version = Azure.AI.ContentSafety.ContentSafetyClientOptions.ServiceVersion.V2024_09_01) { } + public ContentSafetyClientOptions(Azure.AI.ContentSafety.ContentSafetyClientOptions.ServiceVersion version = Azure.AI.ContentSafety.ContentSafetyClientOptions.ServiceVersion.V2026_07_01_Preview) { } public enum ServiceVersion { V2023_10_01 = 1, V2024_09_01 = 2, + V2026_07_01_Preview = 3, } } public partial class ContentSafetyClientSettings : System.ClientModel.Primitives.ClientSettings @@ -269,10 +302,15 @@ public static partial class ContentSafetyModelFactory public static Azure.AI.ContentSafety.AnalyzeTextOptions AnalyzeTextOptions(string text = null, System.Collections.Generic.IEnumerable categories = null, System.Collections.Generic.IEnumerable blocklistNames = null, bool? haltOnBlocklistHit = default(bool?), Azure.AI.ContentSafety.AnalyzeTextOutputType? outputType = default(Azure.AI.ContentSafety.AnalyzeTextOutputType?)) { throw null; } public static Azure.AI.ContentSafety.AnalyzeTextResult AnalyzeTextResult(System.Collections.Generic.IEnumerable blocklistsMatch = null, System.Collections.Generic.IEnumerable categoriesAnalysis = null) { throw null; } public static Azure.AI.ContentSafety.ContentSafetyImageData ContentSafetyImageData(System.BinaryData content = null, System.Uri blobUri = null) { throw null; } + public static Azure.AI.ContentSafety.DetectedProvenance DetectedProvenance(Azure.AI.ContentSafety.DetectedProvenanceType? type = default(Azure.AI.ContentSafety.DetectedProvenanceType?), string provider = null, string modelName = null, System.DateTimeOffset? timestamp = default(System.DateTimeOffset?)) { throw null; } + public static Azure.AI.ContentSafety.DetectProvenanceOptions DetectProvenanceOptions(Azure.AI.ContentSafety.ProvenanceContent content = null) { throw null; } + public static Azure.AI.ContentSafety.DetectProvenanceResult DetectProvenanceResult(Azure.AI.ContentSafety.DetectOutcome outcome = default(Azure.AI.ContentSafety.DetectOutcome), System.Collections.Generic.IEnumerable results = null) { throw null; } public static Azure.AI.ContentSafety.DetectTextProtectedMaterialOptions DetectTextProtectedMaterialOptions(string text = null) { throw null; } public static Azure.AI.ContentSafety.DetectTextProtectedMaterialResult DetectTextProtectedMaterialResult(Azure.AI.ContentSafety.TextProtectedMaterialAnalysisResult protectedMaterialAnalysis = null) { throw null; } public static Azure.AI.ContentSafety.DocumentInjectionAnalysisResult DocumentInjectionAnalysisResult(bool attackDetected = false) { throw null; } public static Azure.AI.ContentSafety.ImageCategoriesAnalysis ImageCategoriesAnalysis(Azure.AI.ContentSafety.ImageCategory category = default(Azure.AI.ContentSafety.ImageCategory), int? severity = default(int?)) { throw null; } + public static Azure.AI.ContentSafety.ProvenanceContent ProvenanceContent(System.Uri uri = null) { throw null; } + public static Azure.AI.ContentSafety.ProvenanceDetectOperation ProvenanceDetectOperation(string id = null, Azure.AI.ContentSafety.OperationState status = default(Azure.AI.ContentSafety.OperationState), Azure.ResponseError error = null, Azure.AI.ContentSafety.DetectProvenanceResult result = null, Azure.AI.ContentSafety.ProvenanceOperationKind kind = default(Azure.AI.ContentSafety.ProvenanceOperationKind), System.DateTimeOffset? createdAt = default(System.DateTimeOffset?), System.DateTimeOffset? lastUpdatedAt = default(System.DateTimeOffset?)) { throw null; } public static Azure.AI.ContentSafety.RemoveTextBlocklistItemsOptions RemoveTextBlocklistItemsOptions(System.Collections.Generic.IEnumerable blocklistItemIds = null) { throw null; } public static Azure.AI.ContentSafety.ShieldPromptOptions ShieldPromptOptions(string userPrompt = null, System.Collections.Generic.IEnumerable documents = null) { throw null; } public static Azure.AI.ContentSafety.ShieldPromptResult ShieldPromptResult(Azure.AI.ContentSafety.UserPromptInjectionAnalysisResult userPromptAnalysis = null, System.Collections.Generic.IEnumerable documentsAnalysis = null) { throw null; } @@ -284,6 +322,87 @@ public static partial class ContentSafetyModelFactory public static Azure.AI.ContentSafety.TextProtectedMaterialAnalysisResult TextProtectedMaterialAnalysisResult(bool detected = false) { throw null; } public static Azure.AI.ContentSafety.UserPromptInjectionAnalysisResult UserPromptInjectionAnalysisResult(bool attackDetected = false) { throw null; } } + public partial class DetectedProvenance : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal DetectedProvenance() { } + public string ModelName { get { throw null; } } + public string Provider { get { throw null; } } + public System.DateTimeOffset? Timestamp { get { throw null; } } + public Azure.AI.ContentSafety.DetectedProvenanceType? Type { get { throw null; } } + protected virtual Azure.AI.ContentSafety.DetectedProvenance JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.AI.ContentSafety.DetectedProvenance PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + Azure.AI.ContentSafety.DetectedProvenance System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.ContentSafety.DetectedProvenance System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct DetectedProvenanceType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public DetectedProvenanceType(string value) { throw null; } + public static Azure.AI.ContentSafety.DetectedProvenanceType C2PA { get { throw null; } } + public static Azure.AI.ContentSafety.DetectedProvenanceType Watermark { get { throw null; } } + public bool Equals(Azure.AI.ContentSafety.DetectedProvenanceType other) { throw null; } + public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.AI.ContentSafety.DetectedProvenanceType left, Azure.AI.ContentSafety.DetectedProvenanceType right) { throw null; } + public static implicit operator Azure.AI.ContentSafety.DetectedProvenanceType (string value) { throw null; } + public static implicit operator Azure.AI.ContentSafety.DetectedProvenanceType? (string value) { throw null; } + public static bool operator !=(Azure.AI.ContentSafety.DetectedProvenanceType left, Azure.AI.ContentSafety.DetectedProvenanceType right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct DetectOutcome : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public DetectOutcome(string value) { throw null; } + public static Azure.AI.ContentSafety.DetectOutcome NoProvenanceDetected { get { throw null; } } + public static Azure.AI.ContentSafety.DetectOutcome ProvenanceDetected { get { throw null; } } + public bool Equals(Azure.AI.ContentSafety.DetectOutcome other) { throw null; } + public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.AI.ContentSafety.DetectOutcome left, Azure.AI.ContentSafety.DetectOutcome right) { throw null; } + public static implicit operator Azure.AI.ContentSafety.DetectOutcome (string value) { throw null; } + public static implicit operator Azure.AI.ContentSafety.DetectOutcome? (string value) { throw null; } + public static bool operator !=(Azure.AI.ContentSafety.DetectOutcome left, Azure.AI.ContentSafety.DetectOutcome right) { throw null; } + public override string ToString() { throw null; } + } + public partial class DetectProvenanceOptions : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DetectProvenanceOptions(Azure.AI.ContentSafety.ProvenanceContent content) { } + public Azure.AI.ContentSafety.ProvenanceContent Content { get { throw null; } } + protected virtual Azure.AI.ContentSafety.DetectProvenanceOptions JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + public static implicit operator Azure.Core.RequestContent (Azure.AI.ContentSafety.DetectProvenanceOptions detectProvenanceOptions) { throw null; } + protected virtual Azure.AI.ContentSafety.DetectProvenanceOptions PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + Azure.AI.ContentSafety.DetectProvenanceOptions System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.ContentSafety.DetectProvenanceOptions System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class DetectProvenanceResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal DetectProvenanceResult() { } + public Azure.AI.ContentSafety.DetectOutcome Outcome { get { throw null; } } + public System.Collections.Generic.IList Results { get { throw null; } } + protected virtual Azure.AI.ContentSafety.DetectProvenanceResult JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.AI.ContentSafety.DetectProvenanceResult PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + Azure.AI.ContentSafety.DetectProvenanceResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.ContentSafety.DetectProvenanceResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } public partial class DetectTextProtectedMaterialOptions : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public DetectTextProtectedMaterialOptions(string text) { } @@ -362,6 +481,77 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public static bool operator !=(Azure.AI.ContentSafety.ImageCategory left, Azure.AI.ContentSafety.ImageCategory right) { throw null; } public override string ToString() { throw null; } } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct OperationState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public OperationState(string value) { throw null; } + public static Azure.AI.ContentSafety.OperationState Canceled { get { throw null; } } + public static Azure.AI.ContentSafety.OperationState Failed { get { throw null; } } + public static Azure.AI.ContentSafety.OperationState NotStarted { get { throw null; } } + public static Azure.AI.ContentSafety.OperationState Running { get { throw null; } } + public static Azure.AI.ContentSafety.OperationState Succeeded { get { throw null; } } + public bool Equals(Azure.AI.ContentSafety.OperationState other) { throw null; } + public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.AI.ContentSafety.OperationState left, Azure.AI.ContentSafety.OperationState right) { throw null; } + public static implicit operator Azure.AI.ContentSafety.OperationState (string value) { throw null; } + public static implicit operator Azure.AI.ContentSafety.OperationState? (string value) { throw null; } + public static bool operator !=(Azure.AI.ContentSafety.OperationState left, Azure.AI.ContentSafety.OperationState right) { throw null; } + public override string ToString() { throw null; } + } + public partial class ProvenanceContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public ProvenanceContent(System.Uri uri) { } + public System.Uri Uri { get { throw null; } } + protected virtual Azure.AI.ContentSafety.ProvenanceContent JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.AI.ContentSafety.ProvenanceContent PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + Azure.AI.ContentSafety.ProvenanceContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.ContentSafety.ProvenanceContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class ProvenanceDetectOperation : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ProvenanceDetectOperation() { } + public System.DateTimeOffset? CreatedAt { get { throw null; } } + public Azure.ResponseError Error { get { throw null; } } + public string Id { get { throw null; } } + public Azure.AI.ContentSafety.ProvenanceOperationKind Kind { get { throw null; } } + public System.DateTimeOffset? LastUpdatedAt { get { throw null; } } + public Azure.AI.ContentSafety.DetectProvenanceResult Result { get { throw null; } } + public Azure.AI.ContentSafety.OperationState Status { get { throw null; } } + protected virtual Azure.AI.ContentSafety.ProvenanceDetectOperation JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + public static explicit operator Azure.AI.ContentSafety.ProvenanceDetectOperation (Azure.Response response) { throw null; } + protected virtual Azure.AI.ContentSafety.ProvenanceDetectOperation PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + Azure.AI.ContentSafety.ProvenanceDetectOperation System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.ContentSafety.ProvenanceDetectOperation System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ProvenanceOperationKind : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ProvenanceOperationKind(string value) { throw null; } + public static Azure.AI.ContentSafety.ProvenanceOperationKind Detect { get { throw null; } } + public bool Equals(Azure.AI.ContentSafety.ProvenanceOperationKind other) { throw null; } + public override bool Equals(object obj) { throw null; } + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.AI.ContentSafety.ProvenanceOperationKind left, Azure.AI.ContentSafety.ProvenanceOperationKind right) { throw null; } + public static implicit operator Azure.AI.ContentSafety.ProvenanceOperationKind (string value) { throw null; } + public static implicit operator Azure.AI.ContentSafety.ProvenanceOperationKind? (string value) { throw null; } + public static bool operator !=(Azure.AI.ContentSafety.ProvenanceOperationKind left, Azure.AI.ContentSafety.ProvenanceOperationKind right) { throw null; } + public override string ToString() { throw null; } + } public partial class RemoveTextBlocklistItemsOptions : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public RemoveTextBlocklistItemsOptions(System.Collections.Generic.IEnumerable blocklistItemIds) { } @@ -529,6 +719,9 @@ public static partial class ContentSafetyClientBuilderExtensions public static Azure.Core.Extensions.IAzureClientBuilder AddBlocklistClient(this TBuilder builder, System.Uri endpoint) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilderWithCredential { throw null; } public static Azure.Core.Extensions.IAzureClientBuilder AddBlocklistClient(this TBuilder builder, System.Uri endpoint, Azure.AzureKeyCredential credential) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilder { throw null; } public static Azure.Core.Extensions.IAzureClientBuilder AddBlocklistClient(this TBuilder builder, TConfiguration configuration) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilderWithConfiguration { throw null; } + public static Azure.Core.Extensions.IAzureClientBuilder AddContentProvenanceClient(this TBuilder builder, System.Uri endpoint) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilderWithCredential { throw null; } + public static Azure.Core.Extensions.IAzureClientBuilder AddContentProvenanceClient(this TBuilder builder, System.Uri endpoint, Azure.AzureKeyCredential credential) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilder { throw null; } + public static Azure.Core.Extensions.IAzureClientBuilder AddContentProvenanceClient(this TBuilder builder, TConfiguration configuration) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilderWithConfiguration { throw null; } public static Azure.Core.Extensions.IAzureClientBuilder AddContentSafetyClient(this TBuilder builder, System.Uri endpoint) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilderWithCredential { throw null; } public static Azure.Core.Extensions.IAzureClientBuilder AddContentSafetyClient(this TBuilder builder, System.Uri endpoint, Azure.AzureKeyCredential credential) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilder { throw null; } public static Azure.Core.Extensions.IAzureClientBuilder AddContentSafetyClient(this TBuilder builder, TConfiguration configuration) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilderWithConfiguration { throw null; } diff --git a/sdk/contentsafety/Azure.AI.ContentSafety/metadata.json b/sdk/contentsafety/Azure.AI.ContentSafety/metadata.json index ec8ce3698aa7..06916f54718e 100644 --- a/sdk/contentsafety/Azure.AI.ContentSafety/metadata.json +++ b/sdk/contentsafety/Azure.AI.ContentSafety/metadata.json @@ -1,5 +1,5 @@ { "apiVersions": { - "ContentSafety": "2024-09-01" + "ContentSafety": "2026-07-01-preview" } } \ No newline at end of file diff --git a/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/ContentProvenanceClient.RestClient.cs b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/ContentProvenanceClient.RestClient.cs new file mode 100644 index 000000000000..076dd6d3d080 --- /dev/null +++ b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/ContentProvenanceClient.RestClient.cs @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure; +using Azure.Core; + +namespace Azure.AI.ContentSafety +{ + /// + public partial class ContentProvenanceClient + { + private static ResponseClassifier _pipelineMessageClassifier200; + private static ResponseClassifier _pipelineMessageClassifier202; + + private static ResponseClassifier PipelineMessageClassifier200 => _pipelineMessageClassifier200 ??= new StatusCodeClassifier(stackalloc ushort[] { 200 }); + + private static ResponseClassifier PipelineMessageClassifier202 => _pipelineMessageClassifier202 ??= new StatusCodeClassifier(stackalloc ushort[] { 202 }); + + internal HttpMessage CreateDetectRequest(RequestContent content, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/contentsafety", false); + uri.AppendPath(":detect", false); + if (_apiVersion != null) + { + uri.AppendQuery("api-version", _apiVersion, true); + } + HttpMessage message = Pipeline.CreateMessage(context, PipelineMessageClassifier202); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Post; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateGetOperationStatusRequest(string operationId, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/contentsafety", false); + uri.AppendPath("/operations/", false); + uri.AppendPath(operationId, true); + if (_apiVersion != null) + { + uri.AppendQuery("api-version", _apiVersion, true); + } + HttpMessage message = Pipeline.CreateMessage(context, PipelineMessageClassifier200); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; + } + } +} diff --git a/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/ContentProvenanceClient.cs b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/ContentProvenanceClient.cs new file mode 100644 index 000000000000..c8042beab114 --- /dev/null +++ b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/ContentProvenanceClient.cs @@ -0,0 +1,267 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Diagnostics.CodeAnalysis; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.AI.ContentSafety +{ + /// The ContentProvenanceClient. + public partial class ContentProvenanceClient + { + private readonly Uri _endpoint; + private const string AuthorizationHeader = "Ocp-Apim-Subscription-Key"; + private static readonly string[] AuthorizationScopes = new string[] { "https://cognitiveservices.azure.com/.default" }; + private readonly string _apiVersion; + + /// Initializes a new instance of ContentProvenanceClient for mocking. + protected ContentProvenanceClient() + { + } + + /// Initializes a new instance of ContentProvenanceClient. + /// Service endpoint. + /// A credential used to authenticate to the service. + /// or is null. + public ContentProvenanceClient(Uri endpoint, AzureKeyCredential credential) : this(endpoint, credential, new ContentSafetyClientOptions()) + { + } + + /// Initializes a new instance of ContentProvenanceClient. + /// Service endpoint. + /// A credential used to authenticate to the service. + /// or is null. + public ContentProvenanceClient(Uri endpoint, TokenCredential credential) : this(endpoint, credential, new ContentSafetyClientOptions()) + { + } + + /// Initializes a new instance of ContentProvenanceClient. + /// The authentication policy to use for pipeline creation. + /// Service endpoint. + /// The options for configuring the client. + internal ContentProvenanceClient(HttpPipelinePolicy authenticationPolicy, Uri endpoint, ContentSafetyClientOptions options) + { + Argument.AssertNotNull(endpoint, nameof(endpoint)); + + options ??= new ContentSafetyClientOptions(); + + _endpoint = endpoint; + if (authenticationPolicy != null) + { + Pipeline = HttpPipelineBuilder.Build(options, new HttpPipelinePolicy[] { authenticationPolicy }); + } + else + { + Pipeline = HttpPipelineBuilder.Build(options, Array.Empty()); + } + _apiVersion = options.Version; + ClientDiagnostics = new ClientDiagnostics(options, true); + } + + /// Initializes a new instance of ContentProvenanceClient. + /// Service endpoint. + /// A credential used to authenticate to the service. + /// The options for configuring the client. + /// or is null. + public ContentProvenanceClient(Uri endpoint, AzureKeyCredential credential, ContentSafetyClientOptions options) : this(new AzureKeyCredentialPolicy(credential, AuthorizationHeader), endpoint, options) + { + } + + /// Initializes a new instance of ContentProvenanceClient. + /// Service endpoint. + /// A credential used to authenticate to the service. + /// The options for configuring the client. + /// or is null. + public ContentProvenanceClient(Uri endpoint, TokenCredential credential, ContentSafetyClientOptions options) : this(new BearerTokenAuthenticationPolicy(credential, AuthorizationScopes), endpoint, options) + { + } + + /// Initializes a new instance of ContentProvenanceClient from a . + /// The settings for ContentProvenanceClient. + [Experimental("SCME0002")] + public ContentProvenanceClient(ContentProvenanceClientSettings settings) : this(settings?.Endpoint, settings?.CredentialProvider as TokenCredential, settings?.Options) + { + } + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get; } + + /// The ClientDiagnostics is used to provide tracing support for the client library. + internal ClientDiagnostics ClientDiagnostics { get; } + + /// 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. + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The content to send as the body of the request. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// The response returned from the service. + public virtual Operation Detect(WaitUntil waitUntil, RequestContent content, RequestContext context = null) + { + using DiagnosticScope scope = ClientDiagnostics.CreateScope("ContentProvenanceClient.Detect"); + scope.Start(); + try + { + Argument.AssertNotNull(content, nameof(content)); + + using HttpMessage message = CreateDetectRequest(content, context); + return ProtocolOperationHelpers.ProcessMessage(Pipeline, message, ClientDiagnostics, "ContentProvenanceClient.Detect", OperationFinalStateVia.OperationLocation, context, waitUntil); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// 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. + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The content to send as the body of the request. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// The response returned from the service. + public virtual async Task> DetectAsync(WaitUntil waitUntil, RequestContent content, RequestContext context = null) + { + using DiagnosticScope scope = ClientDiagnostics.CreateScope("ContentProvenanceClient.Detect"); + scope.Start(); + try + { + Argument.AssertNotNull(content, nameof(content)); + + using HttpMessage message = CreateDetectRequest(content, context); + return await ProtocolOperationHelpers.ProcessMessageAsync(Pipeline, message, ClientDiagnostics, "ContentProvenanceClient.Detect", OperationFinalStateVia.OperationLocation, context, waitUntil).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// 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. + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Options describing the media to inspect using Content Provenance Detection. + /// The cancellation token that can be used to cancel the operation. + /// is null. + public virtual Operation Detect(WaitUntil waitUntil, DetectProvenanceOptions options, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(options, nameof(options)); + + Operation result = Detect(waitUntil, options, cancellationToken.ToRequestContext()); + return ProtocolOperationHelpers.Convert(result, response => DetectProvenanceResult.FromLroResponse(response), ClientDiagnostics, "ContentProvenanceClient.Detect"); + } + + /// 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. + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Options describing the media to inspect using Content Provenance Detection. + /// The cancellation token that can be used to cancel the operation. + /// is null. + public virtual async Task> DetectAsync(WaitUntil waitUntil, DetectProvenanceOptions options, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(options, nameof(options)); + + Operation result = await DetectAsync(waitUntil, options, cancellationToken.ToRequestContext()).ConfigureAwait(false); + return ProtocolOperationHelpers.Convert(result, response => DetectProvenanceResult.FromLroResponse(response), ClientDiagnostics, "ContentProvenanceClient.Detect"); + } + + /// + /// [Protocol Method] Gets the status, result, or error of an asynchronous Content Provenance Detection operation. + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// The unique ID of the operation. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual Response GetOperationStatus(string operationId, RequestContext context) + { + using DiagnosticScope scope = ClientDiagnostics.CreateScope("ContentProvenanceClient.GetOperationStatus"); + scope.Start(); + try + { + Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); + + using HttpMessage message = CreateGetOperationStatusRequest(operationId, context); + return Pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Gets the status, result, or error of an asynchronous Content Provenance Detection operation. + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// The unique ID of the operation. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual async Task GetOperationStatusAsync(string operationId, RequestContext context) + { + using DiagnosticScope scope = ClientDiagnostics.CreateScope("ContentProvenanceClient.GetOperationStatus"); + scope.Start(); + try + { + Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); + + using HttpMessage message = CreateGetOperationStatusRequest(operationId, context); + return await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets the status, result, or error of an asynchronous Content Provenance Detection operation. + /// The unique ID of the operation. + /// The cancellation token that can be used to cancel the operation. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + public virtual Response GetOperationStatus(string operationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); + + Response result = GetOperationStatus(operationId, cancellationToken.ToRequestContext()); + return Response.FromValue((ProvenanceDetectOperation)result, result); + } + + /// Gets the status, result, or error of an asynchronous Content Provenance Detection operation. + /// The unique ID of the operation. + /// The cancellation token that can be used to cancel the operation. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + public virtual async Task> GetOperationStatusAsync(string operationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); + + Response result = await GetOperationStatusAsync(operationId, cancellationToken.ToRequestContext()).ConfigureAwait(false); + return Response.FromValue((ProvenanceDetectOperation)result, result); + } + } +} diff --git a/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/ContentProvenanceClientHostExtensions.cs b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/ContentProvenanceClientHostExtensions.cs new file mode 100644 index 000000000000..c6a84ca30dbf --- /dev/null +++ b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/ContentProvenanceClientHostExtensions.cs @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Azure.Identity; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.Hosting; + +namespace Azure.AI.ContentSafety +{ + /// Extension methods to add to an . + [Experimental("SCME0002")] + public static partial class ContentProvenanceClientHostExtensions + { + /// Adds a singleton to the 's service collection. + /// The to add to. + /// The section of to use. + /// An that can be used to further configure the client. + public static IClientBuilder AddContentProvenanceClient(this IHostApplicationBuilder host, string sectionName) + { + return host.AddAzureClient(sectionName); + } + + /// Adds a singleton to the 's service collection. + /// The to add to. + /// The section of to use. + /// Factory method to modify the after they are created. + /// An that can be used to further configure the client. + public static IClientBuilder AddContentProvenanceClient(this IHostApplicationBuilder host, string sectionName, Action configureSettings) + { + return host.AddAzureClient(sectionName, configureSettings); + } + + /// Adds a keyed singleton to the 's service collection. + /// The to add to. + /// The unique key to register as. + /// The section of to use. + /// An that can be used to further configure the client. + public static IClientBuilder AddKeyedContentProvenanceClient(this IHostApplicationBuilder host, string key, string sectionName) + { + return host.AddKeyedAzureClient(key, sectionName); + } + + /// Adds a keyed singleton to the 's service collection. + /// The to add to. + /// The unique key to register as. + /// The section of to use. + /// Factory method to modify the after they are created. + /// An that can be used to further configure the client. + public static IClientBuilder AddKeyedContentProvenanceClient(this IHostApplicationBuilder host, string key, string sectionName, Action configureSettings) + { + return host.AddKeyedAzureClient(key, sectionName, configureSettings); + } + } +} diff --git a/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/ContentProvenanceClientSettings.cs b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/ContentProvenanceClientSettings.cs new file mode 100644 index 000000000000..3e50dc72e0c3 --- /dev/null +++ b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/ContentProvenanceClientSettings.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; + +namespace Azure.AI.ContentSafety +{ + /// Represents the settings used to configure a that can be loaded from an . + [Experimental("SCME0002")] + public partial class ContentProvenanceClientSettings : ClientSettings + { + /// Gets or sets the Endpoint. + public Uri Endpoint { get; set; } + + /// Gets or sets the Options. + public ContentSafetyClientOptions Options { get; set; } + + /// Binds configuration values from the given section. + /// The configuration section. + protected override void BindCore(IConfigurationSection section) + { + if (Uri.TryCreate(section["Endpoint"], UriKind.Absolute, out Uri endpoint)) + { + Endpoint = endpoint; + } + IConfigurationSection optionsSection = section.GetSection("Options"); + if (optionsSection.Exists()) + { + Options = new ContentSafetyClientOptions(optionsSection); + } + } + } +} diff --git a/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/ContentSafetyClientBuilderExtensions.cs b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/ContentSafetyClientBuilderExtensions.cs index c308b9532735..ce70355bc5f1 100644 --- a/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/ContentSafetyClientBuilderExtensions.cs +++ b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/ContentSafetyClientBuilderExtensions.cs @@ -53,6 +53,43 @@ public static IAzureClientBuilder(configuration); } + /// Registers a client with the specified . + /// The builder to register with. + /// Service endpoint. + /// A credential used to authenticate to the service. + /// or is null. + public static IAzureClientBuilder AddContentProvenanceClient(this TBuilder builder, Uri endpoint, AzureKeyCredential credential) + where TBuilder : IAzureClientFactoryBuilder + { + Argument.AssertNotNull(endpoint, nameof(endpoint)); + Argument.AssertNotNull(credential, nameof(credential)); + + return builder.RegisterClientFactory(options => new ContentProvenanceClient(endpoint, credential, options)); + } + + /// Registers a client with the specified . + /// The builder to register with. + /// Service endpoint. + /// is null. + public static IAzureClientBuilder AddContentProvenanceClient(this TBuilder builder, Uri endpoint) + where TBuilder : IAzureClientFactoryBuilderWithCredential + { + Argument.AssertNotNull(endpoint, nameof(endpoint)); + + return builder.RegisterClientFactory((options, credential) => new ContentProvenanceClient(endpoint, credential, options)); + } + + /// Registers a client with the specified . + /// The builder to register with. + /// The configuration to use for the client. + [RequiresUnreferencedCode("Requires unreferenced code until we opt into EnableConfigurationBindingGenerator.")] + [RequiresDynamicCode("Requires unreferenced code until we opt into EnableConfigurationBindingGenerator.")] + public static IAzureClientBuilder AddContentProvenanceClient(this TBuilder builder, TConfiguration configuration) + where TBuilder : IAzureClientFactoryBuilderWithConfiguration + { + return builder.RegisterClientFactory(configuration); + } + /// Registers a client with the specified . /// The builder to register with. /// Service endpoint. diff --git a/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/ContentSafetyClientOptions.cs b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/ContentSafetyClientOptions.cs index 10ce2f9c8d4e..77eadeeead68 100644 --- a/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/ContentSafetyClientOptions.cs +++ b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/ContentSafetyClientOptions.cs @@ -15,7 +15,7 @@ namespace Azure.AI.ContentSafety /// Client options for clients in this library. public partial class ContentSafetyClientOptions : ClientOptions { - private const ServiceVersion LatestVersion = ServiceVersion.V2024_09_01; + private const ServiceVersion LatestVersion = ServiceVersion.V2026_07_01_Preview; /// Initializes a new instance of ContentSafetyClientOptions. /// The service version. @@ -25,6 +25,7 @@ public ContentSafetyClientOptions(ServiceVersion version = LatestVersion) { ServiceVersion.V2023_10_01 => "2023-10-01", ServiceVersion.V2024_09_01 => "2024-09-01", + ServiceVersion.V2026_07_01_Preview => "2026-07-01-preview", _ => throw new NotSupportedException() }; ConfigureLogging(); @@ -35,7 +36,7 @@ public ContentSafetyClientOptions(ServiceVersion version = LatestVersion) [Experimental("SCME0002")] internal ContentSafetyClientOptions(IConfigurationSection section) : base(section, null) { - Version = "2024-09-01"; + Version = "2026-07-01-preview"; if (section is null || !section.Exists()) { return; @@ -59,7 +60,9 @@ public enum ServiceVersion /// V2023_10_01. V2023_10_01 = 1, /// V2024_09_01. - V2024_09_01 = 2 + V2024_09_01 = 2, + /// Public preview that adds asynchronous Content Provenance Detection operations. + V2026_07_01_Preview = 3 } } } diff --git a/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/ContentSafetyModelFactory.cs b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/ContentSafetyModelFactory.cs index 0773fe09eafd..40daeace81d1 100644 --- a/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/ContentSafetyModelFactory.cs +++ b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/ContentSafetyModelFactory.cs @@ -8,6 +8,7 @@ using System; using System.Collections.Generic; using System.Linq; +using Azure; namespace Azure.AI.ContentSafety { @@ -168,6 +169,66 @@ public static DocumentInjectionAnalysisResult DocumentInjectionAnalysisResult(bo return new DocumentInjectionAnalysisResult(attackDetected, additionalBinaryDataProperties: null); } + /// Input describing the media to inspect using Content Provenance Detection. + /// Source content to inspect. + /// A new instance for mocking. + public static DetectProvenanceOptions DetectProvenanceOptions(ProvenanceContent content = default) + { + return new DetectProvenanceOptions(content, additionalBinaryDataProperties: null); + } + + /// Source content descriptor for a Content Provenance Detection operation. + /// Blob URI of the media to inspect. Media up to 100 MB is supported. Supported formats: image (JPEG, PNG, GIF, WebP), audio (MP3, WAV), and video (MP4). + /// A new instance for mocking. + public static ProvenanceContent ProvenanceContent(Uri uri = default) + { + return new ProvenanceContent(uri, additionalBinaryDataProperties: null); + } + + /// Result of a Content Provenance Detection operation. + /// Top-level outcome of the Content Provenance Detection operation. + /// Detected provenance signals. Empty or omitted when `outcome` is `NoProvenanceDetected`. + /// A new instance for mocking. + public static DetectProvenanceResult DetectProvenanceResult(DetectOutcome outcome = default, IEnumerable results = default) + { + results ??= new ChangeTrackingList(); + + return new DetectProvenanceResult(outcome, results.ToList(), additionalBinaryDataProperties: null); + } + + /// A Microsoft-issued provenance signal indicating the media was created or modified using AI. + /// Detected provenance record type. + /// Identifier of the Microsoft provider that generated the content. + /// Identifier of the generating AI model when available. + /// Generation timestamp recorded in the provenance signal. + /// A new instance for mocking. + public static DetectedProvenance DetectedProvenance(DetectedProvenanceType? @type = default, string provider = default, string modelName = default, DateTimeOffset? timestamp = default) + { + return new DetectedProvenance(@type, provider, modelName, timestamp, additionalBinaryDataProperties: null); + } + + /// Status and result of an asynchronous Content Provenance Detection operation. + /// The unique ID of the operation. + /// The status of the operation. + /// Error object that describes the error when status is "Failed". + /// The result of the operation. + /// Kind of Content Provenance Detection operation. + /// Date and time (UTC) when the operation was created. + /// Date and time (UTC) when the status was last updated. + /// A new instance for mocking. + public static ProvenanceDetectOperation ProvenanceDetectOperation(string id = default, OperationState status = default, ResponseError error = default, DetectProvenanceResult result = default, ProvenanceOperationKind kind = default, DateTimeOffset? createdAt = default, DateTimeOffset? lastUpdatedAt = default) + { + return new ProvenanceDetectOperation( + id, + status, + error, + result, + kind, + createdAt, + lastUpdatedAt, + additionalBinaryDataProperties: null); + } + /// The request to add blocklistItems to a text blocklist. /// Array of blocklistItems to add. /// A new instance for mocking. diff --git a/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/Models/AzureAIContentSafetyContext.cs b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/Models/AzureAIContentSafetyContext.cs index 6fcb0e46d268..5391c527a49c 100644 --- a/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/Models/AzureAIContentSafetyContext.cs +++ b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/Models/AzureAIContentSafetyContext.cs @@ -6,6 +6,7 @@ #nullable disable using System.ClientModel.Primitives; +using Azure; namespace Azure.AI.ContentSafety { @@ -20,13 +21,19 @@ namespace Azure.AI.ContentSafety [ModelReaderWriterBuildable(typeof(AnalyzeTextOptions))] [ModelReaderWriterBuildable(typeof(AnalyzeTextResult))] [ModelReaderWriterBuildable(typeof(ContentSafetyImageData))] + [ModelReaderWriterBuildable(typeof(DetectedProvenance))] + [ModelReaderWriterBuildable(typeof(DetectProvenanceOptions))] + [ModelReaderWriterBuildable(typeof(DetectProvenanceResult))] [ModelReaderWriterBuildable(typeof(DetectTextProtectedMaterialOptions))] [ModelReaderWriterBuildable(typeof(DetectTextProtectedMaterialResult))] [ModelReaderWriterBuildable(typeof(DocumentInjectionAnalysisResult))] [ModelReaderWriterBuildable(typeof(ImageCategoriesAnalysis))] [ModelReaderWriterBuildable(typeof(PagedTextBlocklist))] [ModelReaderWriterBuildable(typeof(PagedTextBlocklistItem))] + [ModelReaderWriterBuildable(typeof(ProvenanceContent))] + [ModelReaderWriterBuildable(typeof(ProvenanceDetectOperation))] [ModelReaderWriterBuildable(typeof(RemoveTextBlocklistItemsOptions))] + [ModelReaderWriterBuildable(typeof(ResponseError))] [ModelReaderWriterBuildable(typeof(ShieldPromptOptions))] [ModelReaderWriterBuildable(typeof(ShieldPromptResult))] [ModelReaderWriterBuildable(typeof(TextBlocklist))] diff --git a/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/Models/DetectOutcome.cs b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/Models/DetectOutcome.cs new file mode 100644 index 000000000000..35c31b787c17 --- /dev/null +++ b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/Models/DetectOutcome.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.ContentSafety +{ + /// Top-level outcome of a Content Provenance Detection operation. + public readonly partial struct DetectOutcome : IEquatable + { + private readonly string _value; + /// + /// No supported Microsoft-issued C2PA or imperceptible watermark signal was detected. + /// This doesn't necessarily mean the content wasn't AI-generated; it means no supported signal was found. + /// + private const string NoProvenanceDetectedValue = "NoProvenanceDetected"; + /// At least one supported Microsoft-issued C2PA or imperceptible watermark signal was detected. + private const string ProvenanceDetectedValue = "ProvenanceDetected"; + + /// Initializes a new instance of . + /// The value. + /// is null. + public DetectOutcome(string value) + { + Argument.AssertNotNull(value, nameof(value)); + + _value = value; + } + + /// + /// No supported Microsoft-issued C2PA or imperceptible watermark signal was detected. + /// This doesn't necessarily mean the content wasn't AI-generated; it means no supported signal was found. + /// + public static DetectOutcome NoProvenanceDetected { get; } = new DetectOutcome(NoProvenanceDetectedValue); + + /// At least one supported Microsoft-issued C2PA or imperceptible watermark signal was detected. + public static DetectOutcome ProvenanceDetected { get; } = new DetectOutcome(ProvenanceDetectedValue); + + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator ==(DetectOutcome left, DetectOutcome right) => left.Equals(right); + + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator !=(DetectOutcome left, DetectOutcome right) => !left.Equals(right); + + /// Converts a string to a . + /// The value. + public static implicit operator DetectOutcome(string value) => new DetectOutcome(value); + + /// Converts a string to a . + /// The value. + public static implicit operator DetectOutcome?(string value) => value == null ? null : new DetectOutcome(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DetectOutcome other && Equals(other); + + /// + public bool Equals(DetectOutcome other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + + /// + public override string ToString() => _value; + } +} diff --git a/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/Models/DetectProvenanceOptions.Serialization.cs b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/Models/DetectProvenanceOptions.Serialization.cs new file mode 100644 index 000000000000..4a9298d5d45c --- /dev/null +++ b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/Models/DetectProvenanceOptions.Serialization.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.ContentSafety +{ + /// Input describing the media to inspect using Content Provenance Detection. + public partial class DetectProvenanceOptions : IJsonModel + { + /// Initializes a new instance of for deserialization. + internal DetectProvenanceOptions() + { + } + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual DetectProvenanceOptions PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) + { + return DeserializeDetectProvenanceOptions(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DetectProvenanceOptions)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureAIContentSafetyContext.Default); + default: + throw new FormatException($"The model {nameof(DetectProvenanceOptions)} does not support writing '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The data to parse. + /// The client options for reading and writing models. + DetectProvenanceOptions IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + public static implicit operator RequestContent(DetectProvenanceOptions detectProvenanceOptions) + { + if (detectProvenanceOptions == null) + { + return null; + } + return RequestContent.Create(detectProvenanceOptions, ModelSerializationExtensions.WireOptions); + } + + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DetectProvenanceOptions)} does not support writing '{format}' format."); + } + writer.WritePropertyName("content"u8); + writer.WriteObjectValue(Content, options); + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + DetectProvenanceOptions IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual DetectProvenanceOptions JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DetectProvenanceOptions)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDetectProvenanceOptions(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DetectProvenanceOptions DeserializeDetectProvenanceOptions(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ProvenanceContent content = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("content"u8)) + { + content = ProvenanceContent.DeserializeProvenanceContent(prop.Value, options); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new DetectProvenanceOptions(content, additionalBinaryDataProperties); + } + } +} diff --git a/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/Models/DetectProvenanceOptions.cs b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/Models/DetectProvenanceOptions.cs new file mode 100644 index 000000000000..1a0720462e16 --- /dev/null +++ b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/Models/DetectProvenanceOptions.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.ContentSafety +{ + /// Input describing the media to inspect using Content Provenance Detection. + public partial class DetectProvenanceOptions + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + /// Source content to inspect. + /// is null. + public DetectProvenanceOptions(ProvenanceContent content) + { + Argument.AssertNotNull(content, nameof(content)); + + Content = content; + } + + /// Initializes a new instance of . + /// Source content to inspect. + /// Keeps track of any properties unknown to the library. + internal DetectProvenanceOptions(ProvenanceContent content, IDictionary additionalBinaryDataProperties) + { + Content = content; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Source content to inspect. + public ProvenanceContent Content { get; } + } +} diff --git a/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/Models/DetectProvenanceResult.Serialization.cs b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/Models/DetectProvenanceResult.Serialization.cs new file mode 100644 index 000000000000..23b85b5af7ec --- /dev/null +++ b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/Models/DetectProvenanceResult.Serialization.cs @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure; + +namespace Azure.AI.ContentSafety +{ + /// Result of a Content Provenance Detection operation. + public partial class DetectProvenanceResult : IJsonModel + { + /// Initializes a new instance of for deserialization. + internal DetectProvenanceResult() + { + } + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual DetectProvenanceResult PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) + { + return DeserializeDetectProvenanceResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DetectProvenanceResult)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureAIContentSafetyContext.Default); + default: + throw new FormatException($"The model {nameof(DetectProvenanceResult)} does not support writing '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The data to parse. + /// The client options for reading and writing models. + DetectProvenanceResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DetectProvenanceResult)} does not support writing '{format}' format."); + } + writer.WritePropertyName("outcome"u8); + writer.WriteStringValue(Outcome.ToString()); + if (Optional.IsCollectionDefined(Results)) + { + writer.WritePropertyName("results"u8); + writer.WriteStartArray(); + foreach (DetectedProvenance item in Results) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + DetectProvenanceResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual DetectProvenanceResult JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DetectProvenanceResult)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDetectProvenanceResult(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DetectProvenanceResult DeserializeDetectProvenanceResult(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DetectOutcome outcome = default; + IList results = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("outcome"u8)) + { + outcome = new DetectOutcome(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("results"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + array.Add(DetectedProvenance.DeserializeDetectedProvenance(item, options)); + } + results = array; + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new DetectProvenanceResult(outcome, results ?? new ChangeTrackingList(), additionalBinaryDataProperties); + } + + /// Converts a response to a DetectProvenanceResult using the LRO result path. + /// The response from the service. + internal static DetectProvenanceResult FromLroResponse(Response response) + { + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeDetectProvenanceResult(document.RootElement.GetProperty("result"), ModelSerializationExtensions.WireOptions); + } + } +} diff --git a/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/Models/DetectProvenanceResult.cs b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/Models/DetectProvenanceResult.cs new file mode 100644 index 000000000000..55eb0fceebd4 --- /dev/null +++ b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/Models/DetectProvenanceResult.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.ContentSafety +{ + /// Result of a Content Provenance Detection operation. + public partial class DetectProvenanceResult + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + /// Top-level outcome of the Content Provenance Detection operation. + internal DetectProvenanceResult(DetectOutcome outcome) + { + Outcome = outcome; + Results = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Top-level outcome of the Content Provenance Detection operation. + /// Detected provenance signals. Empty or omitted when `outcome` is `NoProvenanceDetected`. + /// Keeps track of any properties unknown to the library. + internal DetectProvenanceResult(DetectOutcome outcome, IList results, IDictionary additionalBinaryDataProperties) + { + Outcome = outcome; + Results = results; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Top-level outcome of the Content Provenance Detection operation. + public DetectOutcome Outcome { get; } + + /// Detected provenance signals. Empty or omitted when `outcome` is `NoProvenanceDetected`. + public IList Results { get; } + } +} diff --git a/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/Models/DetectedProvenance.Serialization.cs b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/Models/DetectedProvenance.Serialization.cs new file mode 100644 index 000000000000..c07651b4f3f7 --- /dev/null +++ b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/Models/DetectedProvenance.Serialization.cs @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; + +namespace Azure.AI.ContentSafety +{ + /// A Microsoft-issued provenance signal indicating the media was created or modified using AI. + public partial class DetectedProvenance : IJsonModel + { + /// The data to parse. + /// The client options for reading and writing models. + protected virtual DetectedProvenance PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) + { + return DeserializeDetectedProvenance(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DetectedProvenance)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureAIContentSafetyContext.Default); + default: + throw new FormatException($"The model {nameof(DetectedProvenance)} does not support writing '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The data to parse. + /// The client options for reading and writing models. + DetectedProvenance IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DetectedProvenance)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(Type)) + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(Type.Value.ToString()); + } + if (Optional.IsDefined(Provider)) + { + writer.WritePropertyName("provider"u8); + writer.WriteStringValue(Provider); + } + if (Optional.IsDefined(ModelName)) + { + writer.WritePropertyName("modelName"u8); + writer.WriteStringValue(ModelName); + } + if (Optional.IsDefined(Timestamp)) + { + writer.WritePropertyName("timestamp"u8); + writer.WriteStringValue(Timestamp.Value, "O"); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + DetectedProvenance IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual DetectedProvenance JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DetectedProvenance)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDetectedProvenance(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DetectedProvenance DeserializeDetectedProvenance(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DetectedProvenanceType? @type = default; + string provider = default; + string modelName = default; + DateTimeOffset? timestamp = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("type"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + @type = new DetectedProvenanceType(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("provider"u8)) + { + provider = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("modelName"u8)) + { + modelName = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("timestamp"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + timestamp = prop.Value.GetDateTimeOffset("O"); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new DetectedProvenance(@type, provider, modelName, timestamp, additionalBinaryDataProperties); + } + } +} diff --git a/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/Models/DetectedProvenance.cs b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/Models/DetectedProvenance.cs new file mode 100644 index 000000000000..e28d98c28071 --- /dev/null +++ b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/Models/DetectedProvenance.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.ContentSafety +{ + /// A Microsoft-issued provenance signal indicating the media was created or modified using AI. + public partial class DetectedProvenance + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + internal DetectedProvenance() + { + } + + /// Initializes a new instance of . + /// Detected provenance record type. + /// Identifier of the Microsoft provider that generated the content. + /// Identifier of the generating AI model when available. + /// Generation timestamp recorded in the provenance signal. + /// Keeps track of any properties unknown to the library. + internal DetectedProvenance(DetectedProvenanceType? @type, string provider, string modelName, DateTimeOffset? timestamp, IDictionary additionalBinaryDataProperties) + { + Type = @type; + Provider = provider; + ModelName = modelName; + Timestamp = timestamp; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Detected provenance record type. + public DetectedProvenanceType? Type { get; } + + /// Identifier of the Microsoft provider that generated the content. + public string Provider { get; } + + /// Identifier of the generating AI model when available. + public string ModelName { get; } + + /// Generation timestamp recorded in the provenance signal. + public DateTimeOffset? Timestamp { get; } + } +} diff --git a/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/Models/DetectedProvenanceType.cs b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/Models/DetectedProvenanceType.cs new file mode 100644 index 000000000000..4ca111038991 --- /dev/null +++ b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/Models/DetectedProvenanceType.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.ContentSafety +{ + /// Detected provenance record type. + public readonly partial struct DetectedProvenanceType : IEquatable + { + private readonly string _value; + /// Provenance came from a C2PA Content Credential (manifest). + private const string C2PAValue = "C2PA"; + /// Provenance came from an imperceptible watermark. + private const string WatermarkValue = "Watermark"; + + /// Initializes a new instance of . + /// The value. + /// is null. + public DetectedProvenanceType(string value) + { + Argument.AssertNotNull(value, nameof(value)); + + _value = value; + } + + /// Provenance came from a C2PA Content Credential (manifest). + public static DetectedProvenanceType C2PA { get; } = new DetectedProvenanceType(C2PAValue); + + /// Provenance came from an imperceptible watermark. + public static DetectedProvenanceType Watermark { get; } = new DetectedProvenanceType(WatermarkValue); + + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator ==(DetectedProvenanceType left, DetectedProvenanceType right) => left.Equals(right); + + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator !=(DetectedProvenanceType left, DetectedProvenanceType right) => !left.Equals(right); + + /// Converts a string to a . + /// The value. + public static implicit operator DetectedProvenanceType(string value) => new DetectedProvenanceType(value); + + /// Converts a string to a . + /// The value. + public static implicit operator DetectedProvenanceType?(string value) => value == null ? null : new DetectedProvenanceType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DetectedProvenanceType other && Equals(other); + + /// + public bool Equals(DetectedProvenanceType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + + /// + public override string ToString() => _value; + } +} diff --git a/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/Models/OperationState.cs b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/Models/OperationState.cs new file mode 100644 index 000000000000..aa30fced447f --- /dev/null +++ b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/Models/OperationState.cs @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.ContentSafety +{ + /// Enum describing allowed operation states. + public readonly partial struct OperationState : IEquatable + { + private readonly string _value; + /// The operation has not started. + private const string NotStartedValue = "NotStarted"; + /// The operation is in progress. + private const string RunningValue = "Running"; + /// The operation has completed successfully. + private const string SucceededValue = "Succeeded"; + /// The operation has failed. + private const string FailedValue = "Failed"; + /// The operation has been canceled by the user. + private const string CanceledValue = "Canceled"; + + /// Initializes a new instance of . + /// The value. + /// is null. + public OperationState(string value) + { + Argument.AssertNotNull(value, nameof(value)); + + _value = value; + } + + /// The operation has not started. + public static OperationState NotStarted { get; } = new OperationState(NotStartedValue); + + /// The operation is in progress. + public static OperationState Running { get; } = new OperationState(RunningValue); + + /// The operation has completed successfully. + public static OperationState Succeeded { get; } = new OperationState(SucceededValue); + + /// The operation has failed. + public static OperationState Failed { get; } = new OperationState(FailedValue); + + /// The operation has been canceled by the user. + public static OperationState Canceled { get; } = new OperationState(CanceledValue); + + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator ==(OperationState left, OperationState right) => left.Equals(right); + + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator !=(OperationState left, OperationState right) => !left.Equals(right); + + /// Converts a string to a . + /// The value. + public static implicit operator OperationState(string value) => new OperationState(value); + + /// Converts a string to a . + /// The value. + public static implicit operator OperationState?(string value) => value == null ? null : new OperationState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is OperationState other && Equals(other); + + /// + public bool Equals(OperationState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + + /// + public override string ToString() => _value; + } +} diff --git a/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/Models/ProvenanceContent.Serialization.cs b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/Models/ProvenanceContent.Serialization.cs new file mode 100644 index 000000000000..c9ad64bd3442 --- /dev/null +++ b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/Models/ProvenanceContent.Serialization.cs @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; + +namespace Azure.AI.ContentSafety +{ + /// Source content descriptor for a Content Provenance Detection operation. + public partial class ProvenanceContent : IJsonModel + { + /// Initializes a new instance of for deserialization. + internal ProvenanceContent() + { + } + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ProvenanceContent PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) + { + return DeserializeProvenanceContent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ProvenanceContent)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureAIContentSafetyContext.Default); + default: + throw new FormatException($"The model {nameof(ProvenanceContent)} does not support writing '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The data to parse. + /// The client options for reading and writing models. + ProvenanceContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ProvenanceContent)} does not support writing '{format}' format."); + } + writer.WritePropertyName("uri"u8); + writer.WriteStringValue(Uri.AbsoluteUri); + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + ProvenanceContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ProvenanceContent JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ProvenanceContent)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeProvenanceContent(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ProvenanceContent DeserializeProvenanceContent(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Uri uri = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("uri"u8)) + { + uri = string.IsNullOrEmpty(prop.Value.GetString()) ? null : new Uri(prop.Value.GetString(), UriKind.RelativeOrAbsolute); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new ProvenanceContent(uri, additionalBinaryDataProperties); + } + } +} diff --git a/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/Models/ProvenanceContent.cs b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/Models/ProvenanceContent.cs new file mode 100644 index 000000000000..6eb126b9039b --- /dev/null +++ b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/Models/ProvenanceContent.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.ContentSafety +{ + /// Source content descriptor for a Content Provenance Detection operation. + public partial class ProvenanceContent + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + /// Blob URI of the media to inspect. Media up to 100 MB is supported. Supported formats: image (JPEG, PNG, GIF, WebP), audio (MP3, WAV), and video (MP4). + /// is null. + public ProvenanceContent(Uri uri) + { + Argument.AssertNotNull(uri, nameof(uri)); + + Uri = uri; + } + + /// Initializes a new instance of . + /// Blob URI of the media to inspect. Media up to 100 MB is supported. Supported formats: image (JPEG, PNG, GIF, WebP), audio (MP3, WAV), and video (MP4). + /// Keeps track of any properties unknown to the library. + internal ProvenanceContent(Uri uri, IDictionary additionalBinaryDataProperties) + { + Uri = uri; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Blob URI of the media to inspect. Media up to 100 MB is supported. Supported formats: image (JPEG, PNG, GIF, WebP), audio (MP3, WAV), and video (MP4). + public Uri Uri { get; } + } +} diff --git a/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/Models/ProvenanceDetectOperation.Serialization.cs b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/Models/ProvenanceDetectOperation.Serialization.cs new file mode 100644 index 000000000000..ef8577bce875 --- /dev/null +++ b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/Models/ProvenanceDetectOperation.Serialization.cs @@ -0,0 +1,238 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure; + +namespace Azure.AI.ContentSafety +{ + /// Status and result of an asynchronous Content Provenance Detection operation. + public partial class ProvenanceDetectOperation : IJsonModel + { + /// Initializes a new instance of for deserialization. + internal ProvenanceDetectOperation() + { + } + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ProvenanceDetectOperation PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) + { + return DeserializeProvenanceDetectOperation(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ProvenanceDetectOperation)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureAIContentSafetyContext.Default); + default: + throw new FormatException($"The model {nameof(ProvenanceDetectOperation)} does not support writing '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The data to parse. + /// The client options for reading and writing models. + ProvenanceDetectOperation IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + public static explicit operator ProvenanceDetectOperation(Response response) + { + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeProvenanceDetectOperation(document.RootElement, ModelSerializationExtensions.WireOptions); + } + + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ProvenanceDetectOperation)} does not support writing '{format}' format."); + } + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status.ToString()); + if (Optional.IsDefined(Error)) + { + writer.WritePropertyName("error"u8); + ((IJsonModel)Error).Write(writer, options); + } + if (Optional.IsDefined(Result)) + { + writer.WritePropertyName("result"u8); + writer.WriteObjectValue(Result, options); + } + if (options.Format != "W") + { + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(CreatedAt)) + { + writer.WritePropertyName("createdAt"u8); + writer.WriteStringValue(CreatedAt.Value, "O"); + } + if (options.Format != "W" && Optional.IsDefined(LastUpdatedAt)) + { + writer.WritePropertyName("lastUpdatedAt"u8); + writer.WriteStringValue(LastUpdatedAt.Value, "O"); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + ProvenanceDetectOperation IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ProvenanceDetectOperation JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ProvenanceDetectOperation)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeProvenanceDetectOperation(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ProvenanceDetectOperation DeserializeProvenanceDetectOperation(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + OperationState status = default; + ResponseError error = default; + DetectProvenanceResult result = default; + ProvenanceOperationKind kind = default; + DateTimeOffset? createdAt = default; + DateTimeOffset? lastUpdatedAt = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("id"u8)) + { + id = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("status"u8)) + { + status = new OperationState(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("error"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + error = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(prop.Value.GetRawText())), options, AzureAIContentSafetyContext.Default); + continue; + } + if (prop.NameEquals("result"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + result = DetectProvenanceResult.DeserializeDetectProvenanceResult(prop.Value, options); + continue; + } + if (prop.NameEquals("kind"u8)) + { + kind = new ProvenanceOperationKind(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("createdAt"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + createdAt = prop.Value.GetDateTimeOffset("O"); + continue; + } + if (prop.NameEquals("lastUpdatedAt"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + lastUpdatedAt = prop.Value.GetDateTimeOffset("O"); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new ProvenanceDetectOperation( + id, + status, + error, + result, + kind, + createdAt, + lastUpdatedAt, + additionalBinaryDataProperties); + } + } +} diff --git a/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/Models/ProvenanceDetectOperation.cs b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/Models/ProvenanceDetectOperation.cs new file mode 100644 index 000000000000..da4b4e941f28 --- /dev/null +++ b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/Models/ProvenanceDetectOperation.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure; + +namespace Azure.AI.ContentSafety +{ + /// Status and result of an asynchronous Content Provenance Detection operation. + public partial class ProvenanceDetectOperation + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + /// The unique ID of the operation. + /// The status of the operation. + internal ProvenanceDetectOperation(string id, OperationState status) + { + Id = id; + Status = status; + } + + /// Initializes a new instance of . + /// The unique ID of the operation. + /// The status of the operation. + /// Error object that describes the error when status is "Failed". + /// The result of the operation. + /// Kind of Content Provenance Detection operation. + /// Date and time (UTC) when the operation was created. + /// Date and time (UTC) when the status was last updated. + /// Keeps track of any properties unknown to the library. + internal ProvenanceDetectOperation(string id, OperationState status, ResponseError error, DetectProvenanceResult result, ProvenanceOperationKind kind, DateTimeOffset? createdAt, DateTimeOffset? lastUpdatedAt, IDictionary additionalBinaryDataProperties) + { + Id = id; + Status = status; + Error = error; + Result = result; + Kind = kind; + CreatedAt = createdAt; + LastUpdatedAt = lastUpdatedAt; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The unique ID of the operation. + public string Id { get; } + + /// The status of the operation. + public OperationState Status { get; } + + /// Error object that describes the error when status is "Failed". + public ResponseError Error { get; } + + /// The result of the operation. + public DetectProvenanceResult Result { get; } + + /// Kind of Content Provenance Detection operation. + public ProvenanceOperationKind Kind { get; } + + /// Date and time (UTC) when the operation was created. + public DateTimeOffset? CreatedAt { get; } + + /// Date and time (UTC) when the status was last updated. + public DateTimeOffset? LastUpdatedAt { get; } + } +} diff --git a/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/Models/ProvenanceOperationKind.cs b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/Models/ProvenanceOperationKind.cs new file mode 100644 index 000000000000..052c205c8f36 --- /dev/null +++ b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/Models/ProvenanceOperationKind.cs @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.ContentSafety +{ + /// Kind of asynchronous Content Provenance Detection operation. + public readonly partial struct ProvenanceOperationKind : IEquatable + { + private readonly string _value; + /// Content Provenance Detection operation. + private const string DetectValue = "Detect"; + + /// Initializes a new instance of . + /// The value. + /// is null. + public ProvenanceOperationKind(string value) + { + Argument.AssertNotNull(value, nameof(value)); + + _value = value; + } + + /// Content Provenance Detection operation. + public static ProvenanceOperationKind Detect { get; } = new ProvenanceOperationKind(DetectValue); + + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator ==(ProvenanceOperationKind left, ProvenanceOperationKind right) => left.Equals(right); + + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator !=(ProvenanceOperationKind left, ProvenanceOperationKind right) => !left.Equals(right); + + /// Converts a string to a . + /// The value. + public static implicit operator ProvenanceOperationKind(string value) => new ProvenanceOperationKind(value); + + /// Converts a string to a . + /// The value. + public static implicit operator ProvenanceOperationKind?(string value) => value == null ? null : new ProvenanceOperationKind(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ProvenanceOperationKind other && Equals(other); + + /// + public bool Equals(ProvenanceOperationKind other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + + /// + public override string ToString() => _value; + } +} diff --git a/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/schema/ConfigurationSchema.json b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/schema/ConfigurationSchema.json index 87094373294b..5a6d456694e7 100644 --- a/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/schema/ConfigurationSchema.json +++ b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/schema/ConfigurationSchema.json @@ -21,6 +21,23 @@ } } }, + "ContentProvenanceClient": { + "type": "object", + "description": "Configuration for ContentProvenanceClient.", + "properties": { + "Endpoint": { + "type": "string", + "format": "uri", + "description": "Gets or sets the Endpoint." + }, + "Credential": { + "$ref": "#/definitions/credential" + }, + "Options": { + "$ref": "#/definitions/contentSafetyClientOptions" + } + } + }, "BlocklistClient": { "type": "object", "description": "Configuration for BlocklistClient.", diff --git a/sdk/contentsafety/Azure.AI.ContentSafety/tsp-location.yaml b/sdk/contentsafety/Azure.AI.ContentSafety/tsp-location.yaml index 9c4c431f9843..7ade8ac787bd 100644 --- a/sdk/contentsafety/Azure.AI.ContentSafety/tsp-location.yaml +++ b/sdk/contentsafety/Azure.AI.ContentSafety/tsp-location.yaml @@ -1,6 +1,6 @@ -commit: 882f28f86c2c48d530248a541c4e95ea2f727e9c -additionalDirectories: [] -repo: Azure/azure-rest-api-specs directory: specification/cognitiveservices/ContentSafety +commit: 829ccecea7e9c1609881104b9a8d0f8cb65ce644 +repo: Azure/azure-rest-api-specs +additionalDirectories: -emitterPackageJsonPath: "eng/azure-typespec-http-client-csharp-emitter-package.json" \ No newline at end of file +emitterPackageJsonPath: eng/azure-typespec-http-client-csharp-emitter-package.json \ No newline at end of file From 7d6aef7a37744da9f3e99f5e053d6aff5d061987 Mon Sep 17 00:00:00 2001 From: Connor Wood Date: Fri, 31 Jul 2026 08:47:24 -0700 Subject: [PATCH 2/5] Restore explicit empty array for additionalDirectories in tsp-location.yaml --- sdk/contentsafety/Azure.AI.ContentSafety/tsp-location.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/contentsafety/Azure.AI.ContentSafety/tsp-location.yaml b/sdk/contentsafety/Azure.AI.ContentSafety/tsp-location.yaml index 7ade8ac787bd..d4e03d6a2b53 100644 --- a/sdk/contentsafety/Azure.AI.ContentSafety/tsp-location.yaml +++ b/sdk/contentsafety/Azure.AI.ContentSafety/tsp-location.yaml @@ -1,6 +1,6 @@ directory: specification/cognitiveservices/ContentSafety commit: 829ccecea7e9c1609881104b9a8d0f8cb65ce644 repo: Azure/azure-rest-api-specs -additionalDirectories: +additionalDirectories: [] emitterPackageJsonPath: eng/azure-typespec-http-client-csharp-emitter-package.json \ No newline at end of file From 1987cc8236d78ba236805333e3ac7d53f7447b45 Mon Sep 17 00:00:00 2001 From: azure-sdk Date: Mon, 3 Aug 2026 21:03:47 +0000 Subject: [PATCH 3/5] Configurations: 'specification/cognitiveservices/ContentSafety/tspconfig.yaml', SDK Release Type: beta, and CommitSHA: '926fc28f53c318fe3cf68eb8be1ea38e658c0879' in SpecRepo: 'https://github.com/Azure/azure-rest-api-specs' Pipeline run: https://dev.azure.com/azure-sdk/internal/_build/results?buildId=6652879 Refer to https://eng.ms/docs/products/azure-developer-experience/develop/sdk-release/sdk-release-prerequisites to prepare for SDK release. --- .../src/Generated/ContentProvenanceClient.RestClient.cs | 4 ++-- sdk/contentsafety/Azure.AI.ContentSafety/tsp-location.yaml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/ContentProvenanceClient.RestClient.cs b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/ContentProvenanceClient.RestClient.cs index 076dd6d3d080..ce8596ef07ee 100644 --- a/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/ContentProvenanceClient.RestClient.cs +++ b/sdk/contentsafety/Azure.AI.ContentSafety/src/Generated/ContentProvenanceClient.RestClient.cs @@ -25,7 +25,7 @@ internal HttpMessage CreateDetectRequest(RequestContent content, RequestContext RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/contentsafety", false); - uri.AppendPath(":detect", false); + uri.AppendPath("/provenance:detect", false); if (_apiVersion != null) { uri.AppendQuery("api-version", _apiVersion, true); @@ -45,7 +45,7 @@ internal HttpMessage CreateGetOperationStatusRequest(string operationId, Request RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/contentsafety", false); - uri.AppendPath("/operations/", false); + uri.AppendPath("/provenance/operations/", false); uri.AppendPath(operationId, true); if (_apiVersion != null) { diff --git a/sdk/contentsafety/Azure.AI.ContentSafety/tsp-location.yaml b/sdk/contentsafety/Azure.AI.ContentSafety/tsp-location.yaml index d4e03d6a2b53..734345b3afd0 100644 --- a/sdk/contentsafety/Azure.AI.ContentSafety/tsp-location.yaml +++ b/sdk/contentsafety/Azure.AI.ContentSafety/tsp-location.yaml @@ -1,6 +1,6 @@ directory: specification/cognitiveservices/ContentSafety -commit: 829ccecea7e9c1609881104b9a8d0f8cb65ce644 +commit: 926fc28f53c318fe3cf68eb8be1ea38e658c0879 repo: Azure/azure-rest-api-specs -additionalDirectories: [] +additionalDirectories: emitterPackageJsonPath: eng/azure-typespec-http-client-csharp-emitter-package.json \ No newline at end of file From 8165d5320e539faa9f0bb9860c47b642ae1baa5c Mon Sep 17 00:00:00 2001 From: Connor Wood Date: Wed, 5 Aug 2026 12:28:08 -0700 Subject: [PATCH 4/5] Document Content Provenance in the changelog --- sdk/contentsafety/Azure.AI.ContentSafety/CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sdk/contentsafety/Azure.AI.ContentSafety/CHANGELOG.md b/sdk/contentsafety/Azure.AI.ContentSafety/CHANGELOG.md index 4646f671e529..e1fc9f8197a5 100644 --- a/sdk/contentsafety/Azure.AI.ContentSafety/CHANGELOG.md +++ b/sdk/contentsafety/Azure.AI.ContentSafety/CHANGELOG.md @@ -4,6 +4,11 @@ ### Features Added +- Added support for the `2026-07-01-preview` API version, which is now the default `ServiceVersion`. +- Added `ContentProvenanceClient` for Content Provenance detection, which determines whether media was generated or modified by an AI system. `Detect` starts a long-running operation and returns an `Operation`; `GetOperationStatus` returns a `ProvenanceDetectOperation`. +- Added `ContentProvenanceClientSettings` and the `AddContentProvenanceClient`/`AddKeyedContentProvenanceClient` host extensions, to support creating a `ContentProvenanceClient` from `IConfiguration` and registering it for dependency injection. +- Added models `DetectProvenanceOptions`, `DetectProvenanceResult`, `DetectedProvenance`, `ProvenanceContent` and `ProvenanceDetectOperation`. +- Added enums `DetectOutcome`, `DetectedProvenanceType`, `ProvenanceOperationKind` and `OperationState`. - Exposed `JsonModelWriteCore` for model serialization procedure. - Added `ContentSafetyClientSettings` to support creating a `ContentSafetyClient` from `IConfiguration`, including configuration-based credential resolution and dependency injection registration. - Added `BlocklistClientSettings` to support creating a `BlocklistClient` from `IConfiguration`, including configuration-based credential resolution and dependency injection registration. From df6c5c1ff83c905994321cc48e2de88a3575c99f Mon Sep 17 00:00:00 2001 From: Connor Wood Date: Wed, 5 Aug 2026 15:42:02 -0700 Subject: [PATCH 5/5] Add Content Provenance detection tests Covers both outcomes: signed media (C2PA + watermark) asserting ProvenanceDetected with a populated Results collection, and unsigned media asserting NoProvenanceDetected. Provenance had no test coverage. The media are blob SAS URIs, so the recorded variables carry placeholder values and body regex sanitizers replace each URI wholesale; the recordings contain no SAS. --- .../Azure.AI.ContentSafety/assets.json | 2 +- .../tests/ContentProvenanceLiveTests.cs | 68 +++++++++++++++++++ .../ContentSafetyClientTestEnvironment.cs | 8 +++ 3 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 sdk/contentsafety/Azure.AI.ContentSafety/tests/ContentProvenanceLiveTests.cs diff --git a/sdk/contentsafety/Azure.AI.ContentSafety/assets.json b/sdk/contentsafety/Azure.AI.ContentSafety/assets.json index 30fb6f91ac54..79cc4d271a43 100644 --- a/sdk/contentsafety/Azure.AI.ContentSafety/assets.json +++ b/sdk/contentsafety/Azure.AI.ContentSafety/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "net", "TagPrefix": "net/contentsafety/Azure.AI.ContentSafety", - "Tag": "net/contentsafety/Azure.AI.ContentSafety_33a10328b1" + "Tag": "net/contentsafety/Azure.AI.ContentSafety_7ac25d8c7d" } diff --git a/sdk/contentsafety/Azure.AI.ContentSafety/tests/ContentProvenanceLiveTests.cs b/sdk/contentsafety/Azure.AI.ContentSafety/tests/ContentProvenanceLiveTests.cs new file mode 100644 index 000000000000..ec579c1721c3 --- /dev/null +++ b/sdk/contentsafety/Azure.AI.ContentSafety/tests/ContentProvenanceLiveTests.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Threading.Tasks; +using Azure.Core.TestFramework; +using Azure.Core.TestFramework.Models; +using NUnit.Framework; + +namespace Azure.AI.ContentSafety.Tests +{ + public class ContentProvenanceLiveTests : RecordedTestBase + { + public ContentProvenanceLiveTests(bool isAsync) : base(isAsync) + { + SanitizedHeaders.Add("Ocp-Apim-Subscription-Key"); + + // The media are blob SAS URIs; replace each wholesale so no SAS or storage account is recorded. + BodyRegexSanitizers.Add(new BodyRegexSanitizer(@"https://[^""]*?/provenance-test/[^""?]*bound\.png[^""]*") + { + Value = ContentSafetyClientTestEnvironment.SignedMediaPlaceholder + }); + BodyRegexSanitizers.Add(new BodyRegexSanitizer(@"https://[^""]*?/provenance-test/[^""?]*testImage\.png[^""]*") + { + Value = ContentSafetyClientTestEnvironment.UnsignedMediaPlaceholder + }); + } + + private ContentProvenanceClient CreateContentProvenanceClient() + { + var endpoint = new Uri(TestEnvironment.Endpoint); + var credential = new AzureKeyCredential(TestEnvironment.Key); + return InstrumentClient(new ContentProvenanceClient(endpoint, credential, InstrumentClientOptions(new ContentSafetyClientOptions()))); + } + + [RecordedTest] + public async Task DetectProvenanceInSignedMedia() + { + var client = CreateContentProvenanceClient(); + var options = new DetectProvenanceOptions(new ProvenanceContent(new Uri(TestEnvironment.SignedMediaUri))); + + Operation operation = await client.DetectAsync(WaitUntil.Completed, options); + + Assert.IsTrue(operation.HasValue); + Assert.AreEqual(DetectOutcome.ProvenanceDetected, operation.Value.Outcome); + Assert.IsNotEmpty(operation.Value.Results); + foreach (DetectedProvenance detected in operation.Value.Results) + { + Assert.Contains(detected.Type, new[] { DetectedProvenanceType.C2PA, DetectedProvenanceType.Watermark }); + Assert.IsNotEmpty(detected.Provider); + Assert.IsNotEmpty(detected.ModelName); + } + } + + [RecordedTest] + public async Task DetectNoProvenanceInUnsignedMedia() + { + var client = CreateContentProvenanceClient(); + var options = new DetectProvenanceOptions(new ProvenanceContent(new Uri(TestEnvironment.UnsignedMediaUri))); + + Operation operation = await client.DetectAsync(WaitUntil.Completed, options); + + Assert.IsTrue(operation.HasValue); + Assert.AreEqual(DetectOutcome.NoProvenanceDetected, operation.Value.Outcome); + Assert.IsEmpty(operation.Value.Results); + } + } +} diff --git a/sdk/contentsafety/Azure.AI.ContentSafety/tests/ContentSafetyClientTestEnvironment.cs b/sdk/contentsafety/Azure.AI.ContentSafety/tests/ContentSafetyClientTestEnvironment.cs index e02586aa0f48..88d87981074b 100644 --- a/sdk/contentsafety/Azure.AI.ContentSafety/tests/ContentSafetyClientTestEnvironment.cs +++ b/sdk/contentsafety/Azure.AI.ContentSafety/tests/ContentSafetyClientTestEnvironment.cs @@ -11,5 +11,13 @@ public class ContentSafetyClientTestEnvironment public string Endpoint => GetRecordedVariable("CONTENT_SAFETY_ENDPOINT"); public string Key => GetRecordedVariable("CONTENT_SAFETY_KEY", options => options.IsSecret()); + + public string SignedMediaUri => GetRecordedVariable("CONTENT_SAFETY_SIGNED_MEDIA_URI", options => options.IsSecret(SignedMediaPlaceholder)); + + public string UnsignedMediaUri => GetRecordedVariable("CONTENT_SAFETY_UNSIGNED_MEDIA_URI", options => options.IsSecret(UnsignedMediaPlaceholder)); + + public const string SignedMediaPlaceholder = "https://fake_storage.blob.core.windows.net/provenance-test/signed.png"; + + public const string UnsignedMediaPlaceholder = "https://fake_storage.blob.core.windows.net/provenance-test/unsigned.png"; } }