diff --git a/sdk/search/Azure.Search.Documents/src/Generated/Models/AIFoundryModelCatalogName.cs b/sdk/search/Azure.Search.Documents/src/Generated/AIFoundryModelCatalogName.cs
similarity index 87%
rename from sdk/search/Azure.Search.Documents/src/Generated/Models/AIFoundryModelCatalogName.cs
rename to sdk/search/Azure.Search.Documents/src/Generated/AIFoundryModelCatalogName.cs
index d65745f5b56d..780be23f1219 100644
--- a/sdk/search/Azure.Search.Documents/src/Generated/Models/AIFoundryModelCatalogName.cs
+++ b/sdk/search/Azure.Search.Documents/src/Generated/AIFoundryModelCatalogName.cs
@@ -8,9 +8,12 @@
using System;
using System.ComponentModel;
-namespace Azure.Search.Documents.Indexes.Models
+namespace Azure.Search.Documents
{
- /// The name of the embedding model from the Azure AI Studio Catalog that will be called.
+ ///
+ /// The name of the embedding model from the Azure AI Foundry Catalog that will be
+ /// called.
+ ///
public readonly partial struct AIFoundryModelCatalogName : IEquatable
{
private readonly string _value;
@@ -22,17 +25,17 @@ public AIFoundryModelCatalogName(string value)
_value = value ?? throw new ArgumentNullException(nameof(value));
}
- private const string OpenAIClipImageTextEmbeddingsVitBasePatch32Value = "OpenAI-CLIP-Image-Text-Embeddings-vit-base-patch32";
- private const string OpenAIClipImageTextEmbeddingsViTLargePatch14336Value = "OpenAI-CLIP-Image-Text-Embeddings-ViT-Large-Patch14-336";
+ private const string OpenAICLIPImageTextEmbeddingsVitBasePatch32Value = "OpenAI-CLIP-Image-Text-Embeddings-vit-base-patch32";
+ private const string OpenAICLIPImageTextEmbeddingsViTLargePatch14336Value = "OpenAI-CLIP-Image-Text-Embeddings-ViT-Large-Patch14-336";
private const string FacebookDinoV2ImageEmbeddingsViTBaseValue = "Facebook-DinoV2-Image-Embeddings-ViT-Base";
private const string FacebookDinoV2ImageEmbeddingsViTGiantValue = "Facebook-DinoV2-Image-Embeddings-ViT-Giant";
private const string CohereEmbedV3EnglishValue = "Cohere-embed-v3-english";
private const string CohereEmbedV3MultilingualValue = "Cohere-embed-v3-multilingual";
/// OpenAI-CLIP-Image-Text-Embeddings-vit-base-patch32.
- public static AIFoundryModelCatalogName OpenAIClipImageTextEmbeddingsVitBasePatch32 { get; } = new AIFoundryModelCatalogName(OpenAIClipImageTextEmbeddingsVitBasePatch32Value);
+ public static AIFoundryModelCatalogName OpenAICLIPImageTextEmbeddingsVitBasePatch32 { get; } = new AIFoundryModelCatalogName(OpenAICLIPImageTextEmbeddingsVitBasePatch32Value);
/// OpenAI-CLIP-Image-Text-Embeddings-ViT-Large-Patch14-336.
- public static AIFoundryModelCatalogName OpenAIClipImageTextEmbeddingsViTLargePatch14336 { get; } = new AIFoundryModelCatalogName(OpenAIClipImageTextEmbeddingsViTLargePatch14336Value);
+ public static AIFoundryModelCatalogName OpenAICLIPImageTextEmbeddingsViTLargePatch14336 { get; } = new AIFoundryModelCatalogName(OpenAICLIPImageTextEmbeddingsViTLargePatch14336Value);
/// Facebook-DinoV2-Image-Embeddings-ViT-Base.
public static AIFoundryModelCatalogName FacebookDinoV2ImageEmbeddingsViTBase { get; } = new AIFoundryModelCatalogName(FacebookDinoV2ImageEmbeddingsViTBaseValue);
/// Facebook-DinoV2-Image-Embeddings-ViT-Giant.
diff --git a/sdk/search/Azure.Search.Documents/src/Generated/AIServicesAccountIdentity.Serialization.cs b/sdk/search/Azure.Search.Documents/src/Generated/AIServicesAccountIdentity.Serialization.cs
new file mode 100644
index 000000000000..af5e70a0f75e
--- /dev/null
+++ b/sdk/search/Azure.Search.Documents/src/Generated/AIServicesAccountIdentity.Serialization.cs
@@ -0,0 +1,155 @@
+// 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.Search.Documents
+{
+ public partial class AIServicesAccountIdentity : IUtf8JsonSerializable, IJsonModel
+ {
+ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions);
+
+ 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 override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(AIServicesAccountIdentity)} does not support writing '{format}' format.");
+ }
+
+ base.JsonModelWriteCore(writer, options);
+ if (Optional.IsDefined(Identity))
+ {
+ writer.WritePropertyName("identity"u8);
+ writer.WriteObjectValue(Identity, options);
+ }
+ writer.WritePropertyName("subdomainUrl"u8);
+ writer.WriteStringValue(SubdomainUrl);
+ }
+
+ AIServicesAccountIdentity IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(AIServicesAccountIdentity)} does not support reading '{format}' format.");
+ }
+
+ using JsonDocument document = JsonDocument.ParseValue(ref reader);
+ return DeserializeAIServicesAccountIdentity(document.RootElement, options);
+ }
+
+ internal static AIServicesAccountIdentity DeserializeAIServicesAccountIdentity(JsonElement element, ModelReaderWriterOptions options = null)
+ {
+ options ??= ModelSerializationExtensions.WireOptions;
+
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ SearchIndexerDataIdentity identity = default;
+ string subdomainUrl = default;
+ string odataType = default;
+ string description = default;
+ IDictionary serializedAdditionalRawData = default;
+ Dictionary rawDataDictionary = new Dictionary();
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("identity"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ identity = SearchIndexerDataIdentity.DeserializeSearchIndexerDataIdentity(property.Value, options);
+ continue;
+ }
+ if (property.NameEquals("subdomainUrl"u8))
+ {
+ subdomainUrl = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("@odata.type"u8))
+ {
+ odataType = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("description"u8))
+ {
+ description = property.Value.GetString();
+ continue;
+ }
+ if (options.Format != "W")
+ {
+ rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText()));
+ }
+ }
+ serializedAdditionalRawData = rawDataDictionary;
+ return new AIServicesAccountIdentity(odataType, description, serializedAdditionalRawData, identity, subdomainUrl);
+ }
+
+ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ return ModelReaderWriter.Write(this, options);
+ default:
+ throw new FormatException($"The model {nameof(AIServicesAccountIdentity)} does not support writing '{options.Format}' format.");
+ }
+ }
+
+ AIServicesAccountIdentity IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ {
+ using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions);
+ return DeserializeAIServicesAccountIdentity(document.RootElement, options);
+ }
+ default:
+ throw new FormatException($"The model {nameof(AIServicesAccountIdentity)} does not support reading '{options.Format}' format.");
+ }
+ }
+
+ string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J";
+
+ /// Deserializes the model from a raw response.
+ /// The response to deserialize the model from.
+ internal static new AIServicesAccountIdentity FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions);
+ return DeserializeAIServicesAccountIdentity(document.RootElement);
+ }
+
+ /// Convert into a .
+ internal override RequestContent ToRequestContent()
+ {
+ var content = new Utf8JsonRequestContent();
+ content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions);
+ return content;
+ }
+ }
+}
diff --git a/sdk/search/Azure.Search.Documents/src/Generated/AIServicesAccountIdentity.cs b/sdk/search/Azure.Search.Documents/src/Generated/AIServicesAccountIdentity.cs
new file mode 100644
index 000000000000..40e578211d6c
--- /dev/null
+++ b/sdk/search/Azure.Search.Documents/src/Generated/AIServicesAccountIdentity.cs
@@ -0,0 +1,66 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+
+namespace Azure.Search.Documents
+{
+ ///
+ /// The multi-region account of an Azure AI service resource that's attached to a
+ /// skillset.
+ ///
+ public partial class AIServicesAccountIdentity : CognitiveServicesAccount
+ {
+ /// Initializes a new instance of .
+ /// The subdomain url for the corresponding AI Service.
+ /// is null.
+ public AIServicesAccountIdentity(string subdomainUrl)
+ {
+ Argument.AssertNotNull(subdomainUrl, nameof(subdomainUrl));
+
+ OdataType = "#Microsoft.Azure.Search.AIServicesByIdentity";
+ SubdomainUrl = subdomainUrl;
+ }
+
+ /// Initializes a new instance of .
+ /// The discriminator for derived types.
+ /// Description of the Azure AI service resource attached to a skillset.
+ /// Keeps track of any properties unknown to the library.
+ ///
+ /// The user-assigned managed identity used for connections to AI Service. If not
+ /// specified, the system-assigned managed identity is used. On updates to the
+ /// skillset, if the identity is unspecified, the value remains unchanged. If set
+ /// to "none", the value of this property is cleared.
+ /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes.
+ /// The available derived classes include and .
+ ///
+ /// The subdomain url for the corresponding AI Service.
+ internal AIServicesAccountIdentity(string odataType, string description, IDictionary serializedAdditionalRawData, SearchIndexerDataIdentity identity, string subdomainUrl) : base(odataType, description, serializedAdditionalRawData)
+ {
+ Identity = identity;
+ SubdomainUrl = subdomainUrl;
+ }
+
+ /// Initializes a new instance of for deserialization.
+ internal AIServicesAccountIdentity()
+ {
+ }
+
+ ///
+ /// The user-assigned managed identity used for connections to AI Service. If not
+ /// specified, the system-assigned managed identity is used. On updates to the
+ /// skillset, if the identity is unspecified, the value remains unchanged. If set
+ /// to "none", the value of this property is cleared.
+ /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes.
+ /// The available derived classes include and .
+ ///
+ public SearchIndexerDataIdentity Identity { get; set; }
+ /// The subdomain url for the corresponding AI Service.
+ public string SubdomainUrl { get; set; }
+ }
+}
diff --git a/sdk/search/Azure.Search.Documents/src/Generated/AIServicesAccountKey.Serialization.cs b/sdk/search/Azure.Search.Documents/src/Generated/AIServicesAccountKey.Serialization.cs
new file mode 100644
index 000000000000..aa300e235460
--- /dev/null
+++ b/sdk/search/Azure.Search.Documents/src/Generated/AIServicesAccountKey.Serialization.cs
@@ -0,0 +1,148 @@
+// 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.Search.Documents
+{
+ public partial class AIServicesAccountKey : IUtf8JsonSerializable, IJsonModel
+ {
+ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions);
+
+ 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 override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(AIServicesAccountKey)} does not support writing '{format}' format.");
+ }
+
+ base.JsonModelWriteCore(writer, options);
+ writer.WritePropertyName("key"u8);
+ writer.WriteStringValue(Key);
+ writer.WritePropertyName("subdomainUrl"u8);
+ writer.WriteStringValue(SubdomainUrl);
+ }
+
+ AIServicesAccountKey IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(AIServicesAccountKey)} does not support reading '{format}' format.");
+ }
+
+ using JsonDocument document = JsonDocument.ParseValue(ref reader);
+ return DeserializeAIServicesAccountKey(document.RootElement, options);
+ }
+
+ internal static AIServicesAccountKey DeserializeAIServicesAccountKey(JsonElement element, ModelReaderWriterOptions options = null)
+ {
+ options ??= ModelSerializationExtensions.WireOptions;
+
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ string key = default;
+ string subdomainUrl = default;
+ string odataType = default;
+ string description = default;
+ IDictionary serializedAdditionalRawData = default;
+ Dictionary rawDataDictionary = new Dictionary();
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("key"u8))
+ {
+ key = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("subdomainUrl"u8))
+ {
+ subdomainUrl = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("@odata.type"u8))
+ {
+ odataType = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("description"u8))
+ {
+ description = property.Value.GetString();
+ continue;
+ }
+ if (options.Format != "W")
+ {
+ rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText()));
+ }
+ }
+ serializedAdditionalRawData = rawDataDictionary;
+ return new AIServicesAccountKey(odataType, description, serializedAdditionalRawData, key, subdomainUrl);
+ }
+
+ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ return ModelReaderWriter.Write(this, options);
+ default:
+ throw new FormatException($"The model {nameof(AIServicesAccountKey)} does not support writing '{options.Format}' format.");
+ }
+ }
+
+ AIServicesAccountKey IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ {
+ using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions);
+ return DeserializeAIServicesAccountKey(document.RootElement, options);
+ }
+ default:
+ throw new FormatException($"The model {nameof(AIServicesAccountKey)} does not support reading '{options.Format}' format.");
+ }
+ }
+
+ string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J";
+
+ /// Deserializes the model from a raw response.
+ /// The response to deserialize the model from.
+ internal static new AIServicesAccountKey FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions);
+ return DeserializeAIServicesAccountKey(document.RootElement);
+ }
+
+ /// Convert into a .
+ internal override RequestContent ToRequestContent()
+ {
+ var content = new Utf8JsonRequestContent();
+ content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions);
+ return content;
+ }
+ }
+}
diff --git a/sdk/search/Azure.Search.Documents/src/Generated/AIServicesAccountKey.cs b/sdk/search/Azure.Search.Documents/src/Generated/AIServicesAccountKey.cs
new file mode 100644
index 000000000000..5bc9e644ec58
--- /dev/null
+++ b/sdk/search/Azure.Search.Documents/src/Generated/AIServicesAccountKey.cs
@@ -0,0 +1,55 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+
+namespace Azure.Search.Documents
+{
+ ///
+ /// The account key of an Azure AI service resource that's attached to a skillset,
+ /// to be used with the resource's subdomain.
+ ///
+ public partial class AIServicesAccountKey : CognitiveServicesAccount
+ {
+ /// Initializes a new instance of .
+ /// The key used to provision the Azure AI service resource attached to a skillset.
+ /// The subdomain url for the corresponding AI Service.
+ /// or is null.
+ public AIServicesAccountKey(string key, string subdomainUrl)
+ {
+ Argument.AssertNotNull(key, nameof(key));
+ Argument.AssertNotNull(subdomainUrl, nameof(subdomainUrl));
+
+ OdataType = "#Microsoft.Azure.Search.AIServicesByKey";
+ Key = key;
+ SubdomainUrl = subdomainUrl;
+ }
+
+ /// Initializes a new instance of .
+ /// The discriminator for derived types.
+ /// Description of the Azure AI service resource attached to a skillset.
+ /// Keeps track of any properties unknown to the library.
+ /// The key used to provision the Azure AI service resource attached to a skillset.
+ /// The subdomain url for the corresponding AI Service.
+ internal AIServicesAccountKey(string odataType, string description, IDictionary serializedAdditionalRawData, string key, string subdomainUrl) : base(odataType, description, serializedAdditionalRawData)
+ {
+ Key = key;
+ SubdomainUrl = subdomainUrl;
+ }
+
+ /// Initializes a new instance of for deserialization.
+ internal AIServicesAccountKey()
+ {
+ }
+
+ /// The key used to provision the Azure AI service resource attached to a skillset.
+ public string Key { get; set; }
+ /// The subdomain url for the corresponding AI Service.
+ public string SubdomainUrl { get; set; }
+ }
+}
diff --git a/sdk/search/Azure.Search.Documents/src/Generated/AIServicesVisionParameters.Serialization.cs b/sdk/search/Azure.Search.Documents/src/Generated/AIServicesVisionParameters.Serialization.cs
new file mode 100644
index 000000000000..40c51cffdc69
--- /dev/null
+++ b/sdk/search/Azure.Search.Documents/src/Generated/AIServicesVisionParameters.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.Core;
+
+namespace Azure.Search.Documents
+{
+ public partial class AIServicesVisionParameters : IUtf8JsonSerializable, IJsonModel
+ {
+ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions);
+
+ 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)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(AIServicesVisionParameters)} does not support writing '{format}' format.");
+ }
+
+ writer.WritePropertyName("modelVersion"u8);
+ writer.WriteStringValue(ModelVersion);
+ writer.WritePropertyName("resourceUri"u8);
+ writer.WriteStringValue(ResourceUri.AbsoluteUri);
+ if (Optional.IsDefined(ApiKey))
+ {
+ writer.WritePropertyName("apiKey"u8);
+ writer.WriteStringValue(ApiKey);
+ }
+ if (Optional.IsDefined(AuthIdentity))
+ {
+ writer.WritePropertyName("authIdentity"u8);
+ writer.WriteObjectValue(AuthIdentity, options);
+ }
+ if (options.Format != "W" && _serializedAdditionalRawData != null)
+ {
+ foreach (var item in _serializedAdditionalRawData)
+ {
+ writer.WritePropertyName(item.Key);
+#if NET6_0_OR_GREATER
+ writer.WriteRawValue(item.Value);
+#else
+ using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions))
+ {
+ JsonSerializer.Serialize(writer, document.RootElement);
+ }
+#endif
+ }
+ }
+ }
+
+ AIServicesVisionParameters IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(AIServicesVisionParameters)} does not support reading '{format}' format.");
+ }
+
+ using JsonDocument document = JsonDocument.ParseValue(ref reader);
+ return DeserializeAIServicesVisionParameters(document.RootElement, options);
+ }
+
+ internal static AIServicesVisionParameters DeserializeAIServicesVisionParameters(JsonElement element, ModelReaderWriterOptions options = null)
+ {
+ options ??= ModelSerializationExtensions.WireOptions;
+
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ string modelVersion = default;
+ Uri resourceUri = default;
+ string apiKey = default;
+ SearchIndexerDataIdentity authIdentity = default;
+ IDictionary serializedAdditionalRawData = default;
+ Dictionary rawDataDictionary = new Dictionary();
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("modelVersion"u8))
+ {
+ modelVersion = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("resourceUri"u8))
+ {
+ resourceUri = new Uri(property.Value.GetString());
+ continue;
+ }
+ if (property.NameEquals("apiKey"u8))
+ {
+ apiKey = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("authIdentity"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ authIdentity = SearchIndexerDataIdentity.DeserializeSearchIndexerDataIdentity(property.Value, options);
+ continue;
+ }
+ if (options.Format != "W")
+ {
+ rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText()));
+ }
+ }
+ serializedAdditionalRawData = rawDataDictionary;
+ return new AIServicesVisionParameters(modelVersion, resourceUri, apiKey, authIdentity, serializedAdditionalRawData);
+ }
+
+ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ return ModelReaderWriter.Write(this, options);
+ default:
+ throw new FormatException($"The model {nameof(AIServicesVisionParameters)} does not support writing '{options.Format}' format.");
+ }
+ }
+
+ AIServicesVisionParameters IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ {
+ using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions);
+ return DeserializeAIServicesVisionParameters(document.RootElement, options);
+ }
+ default:
+ throw new FormatException($"The model {nameof(AIServicesVisionParameters)} does not support reading '{options.Format}' format.");
+ }
+ }
+
+ string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J";
+
+ /// Deserializes the model from a raw response.
+ /// The response to deserialize the model from.
+ internal static AIServicesVisionParameters FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions);
+ return DeserializeAIServicesVisionParameters(document.RootElement);
+ }
+
+ /// Convert into a .
+ internal virtual RequestContent ToRequestContent()
+ {
+ var content = new Utf8JsonRequestContent();
+ content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions);
+ return content;
+ }
+ }
+}
diff --git a/sdk/search/Azure.Search.Documents/src/Generated/AIServicesVisionParameters.cs b/sdk/search/Azure.Search.Documents/src/Generated/AIServicesVisionParameters.cs
new file mode 100644
index 000000000000..7b3a90507233
--- /dev/null
+++ b/sdk/search/Azure.Search.Documents/src/Generated/AIServicesVisionParameters.cs
@@ -0,0 +1,118 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+
+namespace Azure.Search.Documents
+{
+ ///
+ /// Specifies the AI Services Vision parameters for vectorizing a query image or
+ /// text.
+ ///
+ public partial class AIServicesVisionParameters
+ {
+ ///
+ /// Keeps track of any properties unknown to the library.
+ ///
+ /// To assign an object to the value of this property use .
+ ///
+ ///
+ /// To assign an already formatted json string to this property use .
+ ///
+ ///
+ /// Examples:
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson("foo")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromString("\"foo\"")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson(new { key = "value" })
+ /// Creates a payload of { "key": "value" }.
+ ///
+ /// -
+ /// BinaryData.FromString("{\"key\": \"value\"}")
+ /// Creates a payload of { "key": "value" }.
+ ///
+ ///
+ ///
+ ///
+ private IDictionary _serializedAdditionalRawData;
+
+ /// Initializes a new instance of .
+ ///
+ /// The version of the model to use when calling the AI Services Vision service. It
+ /// will default to the latest available when not specified.
+ ///
+ /// The resource URI of the AI Services resource.
+ /// or is null.
+ public AIServicesVisionParameters(string modelVersion, Uri resourceUri)
+ {
+ Argument.AssertNotNull(modelVersion, nameof(modelVersion));
+ Argument.AssertNotNull(resourceUri, nameof(resourceUri));
+
+ ModelVersion = modelVersion;
+ ResourceUri = resourceUri;
+ }
+
+ /// Initializes a new instance of .
+ ///
+ /// The version of the model to use when calling the AI Services Vision service. It
+ /// will default to the latest available when not specified.
+ ///
+ /// The resource URI of the AI Services resource.
+ /// API key of the designated AI Services resource.
+ ///
+ /// The user-assigned managed identity used for outbound connections. If an
+ /// authResourceId is provided and it's not specified, the system-assigned managed
+ /// identity is used. On updates to the index, if the identity is unspecified, the
+ /// value remains unchanged. If set to "none", the value of this property is
+ /// cleared.
+ /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes.
+ /// The available derived classes include and .
+ ///
+ /// Keeps track of any properties unknown to the library.
+ internal AIServicesVisionParameters(string modelVersion, Uri resourceUri, string apiKey, SearchIndexerDataIdentity authIdentity, IDictionary serializedAdditionalRawData)
+ {
+ ModelVersion = modelVersion;
+ ResourceUri = resourceUri;
+ ApiKey = apiKey;
+ AuthIdentity = authIdentity;
+ _serializedAdditionalRawData = serializedAdditionalRawData;
+ }
+
+ /// Initializes a new instance of for deserialization.
+ internal AIServicesVisionParameters()
+ {
+ }
+
+ ///
+ /// The version of the model to use when calling the AI Services Vision service. It
+ /// will default to the latest available when not specified.
+ ///
+ public string ModelVersion { get; set; }
+ /// The resource URI of the AI Services resource.
+ public Uri ResourceUri { get; set; }
+ /// API key of the designated AI Services resource.
+ public string ApiKey { get; set; }
+ ///
+ /// The user-assigned managed identity used for outbound connections. If an
+ /// authResourceId is provided and it's not specified, the system-assigned managed
+ /// identity is used. On updates to the index, if the identity is unspecified, the
+ /// value remains unchanged. If set to "none", the value of this property is
+ /// cleared.
+ /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes.
+ /// The available derived classes include and .
+ ///
+ public SearchIndexerDataIdentity AuthIdentity { get; set; }
+ }
+}
diff --git a/sdk/search/Azure.Search.Documents/src/Generated/AIServicesVisionVectorizer.Serialization.cs b/sdk/search/Azure.Search.Documents/src/Generated/AIServicesVisionVectorizer.Serialization.cs
new file mode 100644
index 000000000000..de8d24b1cbb4
--- /dev/null
+++ b/sdk/search/Azure.Search.Documents/src/Generated/AIServicesVisionVectorizer.Serialization.cs
@@ -0,0 +1,147 @@
+// 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.Search.Documents
+{
+ public partial class AIServicesVisionVectorizer : IUtf8JsonSerializable, IJsonModel
+ {
+ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions);
+
+ 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 override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(AIServicesVisionVectorizer)} does not support writing '{format}' format.");
+ }
+
+ base.JsonModelWriteCore(writer, options);
+ if (Optional.IsDefined(AIServicesVisionParameters))
+ {
+ writer.WritePropertyName("AIServicesVisionParameters"u8);
+ writer.WriteObjectValue(AIServicesVisionParameters, options);
+ }
+ }
+
+ AIServicesVisionVectorizer IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(AIServicesVisionVectorizer)} does not support reading '{format}' format.");
+ }
+
+ using JsonDocument document = JsonDocument.ParseValue(ref reader);
+ return DeserializeAIServicesVisionVectorizer(document.RootElement, options);
+ }
+
+ internal static AIServicesVisionVectorizer DeserializeAIServicesVisionVectorizer(JsonElement element, ModelReaderWriterOptions options = null)
+ {
+ options ??= ModelSerializationExtensions.WireOptions;
+
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ AIServicesVisionParameters aiServicesVisionParameters = default;
+ string name = default;
+ VectorSearchVectorizerKind kind = default;
+ IDictionary serializedAdditionalRawData = default;
+ Dictionary rawDataDictionary = new Dictionary();
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("AIServicesVisionParameters"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ aiServicesVisionParameters = AIServicesVisionParameters.DeserializeAIServicesVisionParameters(property.Value, options);
+ continue;
+ }
+ if (property.NameEquals("name"u8))
+ {
+ name = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("kind"u8))
+ {
+ kind = new VectorSearchVectorizerKind(property.Value.GetString());
+ continue;
+ }
+ if (options.Format != "W")
+ {
+ rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText()));
+ }
+ }
+ serializedAdditionalRawData = rawDataDictionary;
+ return new AIServicesVisionVectorizer(name, kind, serializedAdditionalRawData, aiServicesVisionParameters);
+ }
+
+ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ return ModelReaderWriter.Write(this, options);
+ default:
+ throw new FormatException($"The model {nameof(AIServicesVisionVectorizer)} does not support writing '{options.Format}' format.");
+ }
+ }
+
+ AIServicesVisionVectorizer IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ {
+ using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions);
+ return DeserializeAIServicesVisionVectorizer(document.RootElement, options);
+ }
+ default:
+ throw new FormatException($"The model {nameof(AIServicesVisionVectorizer)} does not support reading '{options.Format}' format.");
+ }
+ }
+
+ string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J";
+
+ /// Deserializes the model from a raw response.
+ /// The response to deserialize the model from.
+ internal static new AIServicesVisionVectorizer FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions);
+ return DeserializeAIServicesVisionVectorizer(document.RootElement);
+ }
+
+ /// Convert into a .
+ internal override RequestContent ToRequestContent()
+ {
+ var content = new Utf8JsonRequestContent();
+ content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions);
+ return content;
+ }
+ }
+}
diff --git a/sdk/search/Azure.Search.Documents/src/Generated/AIServicesVisionVectorizer.cs b/sdk/search/Azure.Search.Documents/src/Generated/AIServicesVisionVectorizer.cs
new file mode 100644
index 000000000000..c3cbcee9cd14
--- /dev/null
+++ b/sdk/search/Azure.Search.Documents/src/Generated/AIServicesVisionVectorizer.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.Search.Documents
+{
+ /// Clears the identity property of a datasource.
+ public partial class AIServicesVisionVectorizer : VectorSearchVectorizer
+ {
+ /// Initializes a new instance of .
+ /// The name to associate with this particular vectorization method.
+ /// is null.
+ public AIServicesVisionVectorizer(string vectorizerName) : base(vectorizerName)
+ {
+ Argument.AssertNotNull(vectorizerName, nameof(vectorizerName));
+
+ Kind = VectorSearchVectorizerKind.AIServicesVision;
+ }
+
+ /// Initializes a new instance of .
+ /// The name to associate with this particular vectorization method.
+ /// Type of VectorSearchVectorizer.
+ /// Keeps track of any properties unknown to the library.
+ /// Contains the parameters specific to AI Services Vision embedding vectorization.
+ internal AIServicesVisionVectorizer(string vectorizerName, VectorSearchVectorizerKind kind, IDictionary serializedAdditionalRawData, AIServicesVisionParameters aiServicesVisionParameters) : base(vectorizerName, kind, serializedAdditionalRawData)
+ {
+ AIServicesVisionParameters = aiServicesVisionParameters;
+ }
+
+ /// Initializes a new instance of for deserialization.
+ internal AIServicesVisionVectorizer()
+ {
+ }
+
+ /// Contains the parameters specific to AI Services Vision embedding vectorization.
+ public AIServicesVisionParameters AIServicesVisionParameters { get; set; }
+ }
+}
diff --git a/sdk/search/Azure.Search.Documents/src/Generated/Aliases.cs b/sdk/search/Azure.Search.Documents/src/Generated/Aliases.cs
new file mode 100644
index 000000000000..628e13f42849
--- /dev/null
+++ b/sdk/search/Azure.Search.Documents/src/Generated/Aliases.cs
@@ -0,0 +1,656 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+using Autorest.CSharp.Core;
+using Azure.Core;
+using Azure.Core.Pipeline;
+
+namespace Azure.Search.Documents
+{
+ // Data plane generated sub-client.
+ /// The Aliases sub-client.
+ public partial class Aliases
+ {
+ private const string AuthorizationHeader = "api-key";
+ private readonly AzureKeyCredential _keyCredential;
+ private static readonly string[] AuthorizationScopes = new string[] { "https://search.azure.com/.default" };
+ private readonly TokenCredential _tokenCredential;
+ private readonly HttpPipeline _pipeline;
+ private readonly Uri _endpoint;
+ private readonly string _apiVersion;
+
+ /// The ClientDiagnostics is used to provide tracing support for the client library.
+ internal ClientDiagnostics ClientDiagnostics { get; }
+
+ /// The HTTP pipeline for sending and receiving REST requests and responses.
+ public virtual HttpPipeline Pipeline => _pipeline;
+
+ /// Initializes a new instance of Aliases for mocking.
+ protected Aliases()
+ {
+ }
+
+ /// Initializes a new instance of Aliases.
+ /// The handler for diagnostic messaging in the client.
+ /// The HTTP pipeline for sending and receiving REST requests and responses.
+ /// The key credential to copy.
+ /// The token credential to copy.
+ /// Service host.
+ /// The API version to use for this operation.
+ internal Aliases(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, AzureKeyCredential keyCredential, TokenCredential tokenCredential, Uri endpoint, string apiVersion)
+ {
+ ClientDiagnostics = clientDiagnostics;
+ _pipeline = pipeline;
+ _keyCredential = keyCredential;
+ _tokenCredential = tokenCredential;
+ _endpoint = endpoint;
+ _apiVersion = apiVersion;
+ }
+
+ /// Creates a new search alias.
+ /// The definition of the alias to create.
+ /// The cancellation token to use.
+ /// is null.
+ ///
+ public virtual async Task> CreateAsync(SearchAlias @alias, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNull(@alias, nameof(@alias));
+
+ using RequestContent content = @alias.ToRequestContent();
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = await CreateAsync(content, context).ConfigureAwait(false);
+ return Response.FromValue(SearchAlias.FromResponse(response), response);
+ }
+
+ /// Creates a new search alias.
+ /// The definition of the alias to create.
+ /// The cancellation token to use.
+ /// is null.
+ ///
+ public virtual Response Create(SearchAlias @alias, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNull(@alias, nameof(@alias));
+
+ using RequestContent content = @alias.ToRequestContent();
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = Create(content, context);
+ return Response.FromValue(SearchAlias.FromResponse(response), response);
+ }
+
+ ///
+ /// [Protocol Method] Creates a new search alias.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ /// -
+ ///
+ /// Please try the simpler convenience overload with strongly typed models first.
+ ///
+ ///
+ ///
+ ///
+ /// The content to send as the body of the request.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// is null.
+ /// Service returned a non-success status code.
+ /// The response returned from the service.
+ ///
+ public virtual async Task CreateAsync(RequestContent content, RequestContext context = null)
+ {
+ Argument.AssertNotNull(content, nameof(content));
+
+ using var scope = ClientDiagnostics.CreateScope("Aliases.Create");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateCreateRequest(content, context);
+ return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// [Protocol Method] Creates a new search alias.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ /// -
+ ///
+ /// Please try the simpler convenience overload with strongly typed models first.
+ ///
+ ///
+ ///
+ ///
+ /// The content to send as the body of the request.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// is null.
+ /// Service returned a non-success status code.
+ /// The response returned from the service.
+ ///
+ public virtual Response Create(RequestContent content, RequestContext context = null)
+ {
+ Argument.AssertNotNull(content, nameof(content));
+
+ using var scope = ClientDiagnostics.CreateScope("Aliases.Create");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateCreateRequest(content, context);
+ return _pipeline.ProcessMessage(message, context);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Creates a new search alias or updates an alias if it already exists.
+ /// The name of the alias.
+ /// The definition of the alias to create or update.
+ /// The content to send as the request conditions of the request.
+ /// The cancellation token to use.
+ /// or is null.
+ /// is an empty string, and was expected to be non-empty.
+ ///
+ public virtual async Task> CreateOrUpdateAsync(string aliasName, SearchAlias @alias, MatchConditions matchConditions = null, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(aliasName, nameof(aliasName));
+ Argument.AssertNotNull(@alias, nameof(@alias));
+
+ using RequestContent content = @alias.ToRequestContent();
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = await CreateOrUpdateAsync(aliasName, content, matchConditions, context).ConfigureAwait(false);
+ return Response.FromValue(SearchAlias.FromResponse(response), response);
+ }
+
+ /// Creates a new search alias or updates an alias if it already exists.
+ /// The name of the alias.
+ /// The definition of the alias to create or update.
+ /// The content to send as the request conditions of the request.
+ /// The cancellation token to use.
+ /// or is null.
+ /// is an empty string, and was expected to be non-empty.
+ ///
+ public virtual Response CreateOrUpdate(string aliasName, SearchAlias @alias, MatchConditions matchConditions = null, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(aliasName, nameof(aliasName));
+ Argument.AssertNotNull(@alias, nameof(@alias));
+
+ using RequestContent content = @alias.ToRequestContent();
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = CreateOrUpdate(aliasName, content, matchConditions, context);
+ return Response.FromValue(SearchAlias.FromResponse(response), response);
+ }
+
+ ///
+ /// [Protocol Method] Creates a new search alias or updates an alias if it already exists.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ /// -
+ ///
+ /// Please try the simpler convenience overload with strongly typed models first.
+ ///
+ ///
+ ///
+ ///
+ /// The name of the alias.
+ /// The content to send as the body of the request.
+ /// The content to send as the request conditions of the request.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// or 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 CreateOrUpdateAsync(string aliasName, RequestContent content, MatchConditions matchConditions = null, RequestContext context = null)
+ {
+ Argument.AssertNotNullOrEmpty(aliasName, nameof(aliasName));
+ Argument.AssertNotNull(content, nameof(content));
+
+ using var scope = ClientDiagnostics.CreateScope("Aliases.CreateOrUpdate");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateCreateOrUpdateRequest(aliasName, content, matchConditions, context);
+ return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// [Protocol Method] Creates a new search alias or updates an alias if it already exists.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ /// -
+ ///
+ /// Please try the simpler convenience overload with strongly typed models first.
+ ///
+ ///
+ ///
+ ///
+ /// The name of the alias.
+ /// The content to send as the body of the request.
+ /// The content to send as the request conditions of the request.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// or 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 CreateOrUpdate(string aliasName, RequestContent content, MatchConditions matchConditions = null, RequestContext context = null)
+ {
+ Argument.AssertNotNullOrEmpty(aliasName, nameof(aliasName));
+ Argument.AssertNotNull(content, nameof(content));
+
+ using var scope = ClientDiagnostics.CreateScope("Aliases.CreateOrUpdate");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateCreateOrUpdateRequest(aliasName, content, matchConditions, context);
+ return _pipeline.ProcessMessage(message, context);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method
+ ///
+ /// [Protocol Method] Deletes a search alias and its associated mapping to an index. This operation
+ /// is permanent, with no recovery option. The mapped index is untouched by this
+ /// operation.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// The name of the alias.
+ /// The content to send as the request conditions of the request.
+ /// The request context, 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 DeleteAsync(string aliasName, MatchConditions matchConditions = null, RequestContext context = null)
+ {
+ Argument.AssertNotNullOrEmpty(aliasName, nameof(aliasName));
+
+ using var scope = ClientDiagnostics.CreateScope("Aliases.Delete");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateDeleteRequest(aliasName, matchConditions, context);
+ return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method
+ ///
+ /// [Protocol Method] Deletes a search alias and its associated mapping to an index. This operation
+ /// is permanent, with no recovery option. The mapped index is untouched by this
+ /// operation.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// The name of the alias.
+ /// The content to send as the request conditions of the request.
+ /// The request context, 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 Delete(string aliasName, MatchConditions matchConditions = null, RequestContext context = null)
+ {
+ Argument.AssertNotNullOrEmpty(aliasName, nameof(aliasName));
+
+ using var scope = ClientDiagnostics.CreateScope("Aliases.Delete");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateDeleteRequest(aliasName, matchConditions, context);
+ return _pipeline.ProcessMessage(message, context);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Retrieves an alias definition.
+ /// The name of the alias.
+ /// The cancellation token to use.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ ///
+ public virtual async Task> GetAliasAsync(string aliasName, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(aliasName, nameof(aliasName));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = await GetAliasAsync(aliasName, context).ConfigureAwait(false);
+ return Response.FromValue(SearchAlias.FromResponse(response), response);
+ }
+
+ /// Retrieves an alias definition.
+ /// The name of the alias.
+ /// The cancellation token to use.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ ///
+ public virtual Response GetAlias(string aliasName, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(aliasName, nameof(aliasName));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = GetAlias(aliasName, context);
+ return Response.FromValue(SearchAlias.FromResponse(response), response);
+ }
+
+ ///
+ /// [Protocol Method] Retrieves an alias definition.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ /// -
+ ///
+ /// Please try the simpler convenience overload with strongly typed models first.
+ ///
+ ///
+ ///
+ ///
+ /// The name of the alias.
+ /// The request context, 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 GetAliasAsync(string aliasName, RequestContext context)
+ {
+ Argument.AssertNotNullOrEmpty(aliasName, nameof(aliasName));
+
+ using var scope = ClientDiagnostics.CreateScope("Aliases.GetAlias");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateGetAliasRequest(aliasName, context);
+ return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// [Protocol Method] Retrieves an alias definition.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ /// -
+ ///
+ /// Please try the simpler convenience overload with strongly typed models first.
+ ///
+ ///
+ ///
+ ///
+ /// The name of the alias.
+ /// The request context, 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 GetAlias(string aliasName, RequestContext context)
+ {
+ Argument.AssertNotNullOrEmpty(aliasName, nameof(aliasName));
+
+ using var scope = ClientDiagnostics.CreateScope("Aliases.GetAlias");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateGetAliasRequest(aliasName, context);
+ return _pipeline.ProcessMessage(message, context);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Lists all aliases available for a search service.
+ /// The cancellation token to use.
+ ///
+ public virtual AsyncPageable GetAliasesAsync(CancellationToken cancellationToken = default)
+ {
+ RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null;
+ HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetAliasesRequest(context);
+ return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => SearchAlias.DeserializeSearchAlias(e), ClientDiagnostics, _pipeline, "Aliases.GetAliases", "value", null, context);
+ }
+
+ /// Lists all aliases available for a search service.
+ /// The cancellation token to use.
+ ///
+ public virtual Pageable GetAliases(CancellationToken cancellationToken = default)
+ {
+ RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null;
+ HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetAliasesRequest(context);
+ return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => SearchAlias.DeserializeSearchAlias(e), ClientDiagnostics, _pipeline, "Aliases.GetAliases", "value", null, context);
+ }
+
+ ///
+ /// [Protocol Method] Lists all aliases available for a search service.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ /// -
+ ///
+ /// Please try the simpler convenience overload with strongly typed models first.
+ ///
+ ///
+ ///
+ ///
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// Service returned a non-success status code.
+ /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below.
+ ///
+ public virtual AsyncPageable GetAliasesAsync(RequestContext context)
+ {
+ HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetAliasesRequest(context);
+ return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Aliases.GetAliases", "value", null, context);
+ }
+
+ ///
+ /// [Protocol Method] Lists all aliases available for a search service.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ /// -
+ ///
+ /// Please try the simpler convenience overload with strongly typed models first.
+ ///
+ ///
+ ///
+ ///
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// Service returned a non-success status code.
+ /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below.
+ ///
+ public virtual Pageable GetAliases(RequestContext context)
+ {
+ HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetAliasesRequest(context);
+ return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Aliases.GetAliases", "value", null, context);
+ }
+
+ internal HttpMessage CreateCreateRequest(RequestContent content, RequestContext context)
+ {
+ var message = _pipeline.CreateMessage(context, ResponseClassifier201);
+ var request = message.Request;
+ request.Method = RequestMethod.Post;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(_endpoint);
+ uri.AppendPath("/aliases", false);
+ uri.AppendQuery("api-version", _apiVersion, true);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ request.Headers.Add("Content-Type", "application/json");
+ request.Content = content;
+ return message;
+ }
+
+ internal HttpMessage CreateGetAliasesRequest(RequestContext context)
+ {
+ var message = _pipeline.CreateMessage(context, ResponseClassifier200);
+ var request = message.Request;
+ request.Method = RequestMethod.Get;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(_endpoint);
+ uri.AppendPath("/aliases", false);
+ uri.AppendQuery("api-version", _apiVersion, true);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ return message;
+ }
+
+ internal HttpMessage CreateCreateOrUpdateRequest(string aliasName, RequestContent content, MatchConditions matchConditions, RequestContext context)
+ {
+ var message = _pipeline.CreateMessage(context, ResponseClassifier200201);
+ var request = message.Request;
+ request.Method = RequestMethod.Put;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(_endpoint);
+ uri.AppendPath("/aliases('", false);
+ uri.AppendPath(aliasName, true);
+ uri.AppendPath("')", false);
+ uri.AppendQuery("api-version", _apiVersion, true);
+ request.Uri = uri;
+ request.Headers.Add("Prefer", "return=representation");
+ request.Headers.Add("Accept", "application/json");
+ if (matchConditions != null)
+ {
+ request.Headers.Add(matchConditions);
+ }
+ request.Headers.Add("Content-Type", "application/json");
+ request.Content = content;
+ return message;
+ }
+
+ internal HttpMessage CreateDeleteRequest(string aliasName, MatchConditions matchConditions, RequestContext context)
+ {
+ var message = _pipeline.CreateMessage(context, ResponseClassifier204404);
+ var request = message.Request;
+ request.Method = RequestMethod.Delete;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(_endpoint);
+ uri.AppendPath("/aliases('", false);
+ uri.AppendPath(aliasName, true);
+ uri.AppendPath("')", false);
+ uri.AppendQuery("api-version", _apiVersion, true);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ if (matchConditions != null)
+ {
+ request.Headers.Add(matchConditions);
+ }
+ return message;
+ }
+
+ internal HttpMessage CreateGetAliasRequest(string aliasName, RequestContext context)
+ {
+ var message = _pipeline.CreateMessage(context, ResponseClassifier200);
+ var request = message.Request;
+ request.Method = RequestMethod.Get;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(_endpoint);
+ uri.AppendPath("/aliases('", false);
+ uri.AppendPath(aliasName, true);
+ uri.AppendPath("')", false);
+ uri.AppendQuery("api-version", _apiVersion, true);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ return message;
+ }
+
+ private static RequestContext DefaultRequestContext = new RequestContext();
+ internal static RequestContext FromCancellationToken(CancellationToken cancellationToken = default)
+ {
+ if (!cancellationToken.CanBeCanceled)
+ {
+ return DefaultRequestContext;
+ }
+
+ return new RequestContext() { CancellationToken = cancellationToken };
+ }
+
+ private static ResponseClassifier _responseClassifier201;
+ private static ResponseClassifier ResponseClassifier201 => _responseClassifier201 ??= new StatusCodeClassifier(stackalloc ushort[] { 201 });
+ private static ResponseClassifier _responseClassifier200;
+ private static ResponseClassifier ResponseClassifier200 => _responseClassifier200 ??= new StatusCodeClassifier(stackalloc ushort[] { 200 });
+ private static ResponseClassifier _responseClassifier200201;
+ private static ResponseClassifier ResponseClassifier200201 => _responseClassifier200201 ??= new StatusCodeClassifier(stackalloc ushort[] { 200, 201 });
+ private static ResponseClassifier _responseClassifier204404;
+ private static ResponseClassifier ResponseClassifier204404 => _responseClassifier204404 ??= new StatusCodeClassifier(stackalloc ushort[] { 204, 404 });
+ }
+}
diff --git a/sdk/search/Azure.Search.Documents/src/Generated/AliasesRestClient.cs b/sdk/search/Azure.Search.Documents/src/Generated/AliasesRestClient.cs
deleted file mode 100644
index 811c8bd46402..000000000000
--- a/sdk/search/Azure.Search.Documents/src/Generated/AliasesRestClient.cs
+++ /dev/null
@@ -1,413 +0,0 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License.
-
-//
-
-#nullable disable
-
-using System;
-using System.Text.Json;
-using System.Threading;
-using System.Threading.Tasks;
-using Azure.Core;
-using Azure.Core.Pipeline;
-using Azure.Search.Documents.Indexes.Models;
-
-namespace Azure.Search.Documents
-{
- internal partial class AliasesRestClient
- {
- private readonly HttpPipeline _pipeline;
- private readonly string _endpoint;
- private readonly Guid? _xMsClientRequestId;
- private readonly string _apiVersion;
-
- /// The ClientDiagnostics is used to provide tracing support for the client library.
- internal ClientDiagnostics ClientDiagnostics { get; }
-
- /// Initializes a new instance of AliasesRestClient.
- /// The handler for diagnostic messaging in the client.
- /// The HTTP pipeline for sending and receiving REST requests and responses.
- /// The endpoint URL of the search service.
- /// The tracking ID sent with the request to help with debugging.
- /// Api Version.
- /// , , or is null.
- public AliasesRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string endpoint, Guid? xMsClientRequestId = null, string apiVersion = "2024-11-01-preview")
- {
- ClientDiagnostics = clientDiagnostics ?? throw new ArgumentNullException(nameof(clientDiagnostics));
- _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline));
- _endpoint = endpoint ?? throw new ArgumentNullException(nameof(endpoint));
- _xMsClientRequestId = xMsClientRequestId;
- _apiVersion = apiVersion ?? throw new ArgumentNullException(nameof(apiVersion));
- }
-
- internal HttpMessage CreateCreateRequest(SearchAlias @alias)
- {
- var message = _pipeline.CreateMessage();
- var request = message.Request;
- request.Method = RequestMethod.Post;
- var uri = new RawRequestUriBuilder();
- uri.AppendRaw(_endpoint, false);
- uri.AppendPath("/aliases", false);
- uri.AppendQuery("api-version", _apiVersion, true);
- request.Uri = uri;
- request.Headers.Add("Accept", "application/json; odata.metadata=minimal");
- request.Headers.Add("Content-Type", "application/json");
- var content = new Utf8JsonRequestContent();
- content.JsonWriter.WriteObjectValue(@alias);
- request.Content = content;
- return message;
- }
-
- /// Creates a new search alias.
- /// The definition of the alias to create.
- /// The cancellation token to use.
- /// is null.
- public async Task> CreateAsync(SearchAlias @alias, CancellationToken cancellationToken = default)
- {
- if (@alias == null)
- {
- throw new ArgumentNullException(nameof(@alias));
- }
-
- using var message = CreateCreateRequest(@alias);
- await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
- switch (message.Response.Status)
- {
- case 201:
- {
- SearchAlias value = default;
- using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false);
- value = SearchAlias.DeserializeSearchAlias(document.RootElement);
- return Response.FromValue(value, message.Response);
- }
- default:
- throw new RequestFailedException(message.Response);
- }
- }
-
- /// Creates a new search alias.
- /// The definition of the alias to create.
- /// The cancellation token to use.
- /// is null.
- public Response Create(SearchAlias @alias, CancellationToken cancellationToken = default)
- {
- if (@alias == null)
- {
- throw new ArgumentNullException(nameof(@alias));
- }
-
- using var message = CreateCreateRequest(@alias);
- _pipeline.Send(message, cancellationToken);
- switch (message.Response.Status)
- {
- case 201:
- {
- SearchAlias value = default;
- using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions);
- value = SearchAlias.DeserializeSearchAlias(document.RootElement);
- return Response.FromValue(value, message.Response);
- }
- default:
- throw new RequestFailedException(message.Response);
- }
- }
-
- internal HttpMessage CreateListRequest()
- {
- var message = _pipeline.CreateMessage();
- var request = message.Request;
- request.Method = RequestMethod.Get;
- var uri = new RawRequestUriBuilder();
- uri.AppendRaw(_endpoint, false);
- uri.AppendPath("/aliases", false);
- uri.AppendQuery("api-version", _apiVersion, true);
- request.Uri = uri;
- request.Headers.Add("Accept", "application/json; odata.metadata=minimal");
- return message;
- }
-
- /// Lists all aliases available for a search service.
- /// The cancellation token to use.
- public async Task> ListAsync(CancellationToken cancellationToken = default)
- {
- using var message = CreateListRequest();
- await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
- switch (message.Response.Status)
- {
- case 200:
- {
- ListAliasesResult value = default;
- using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false);
- value = ListAliasesResult.DeserializeListAliasesResult(document.RootElement);
- return Response.FromValue(value, message.Response);
- }
- default:
- throw new RequestFailedException(message.Response);
- }
- }
-
- /// Lists all aliases available for a search service.
- /// The cancellation token to use.
- public Response List(CancellationToken cancellationToken = default)
- {
- using var message = CreateListRequest();
- _pipeline.Send(message, cancellationToken);
- switch (message.Response.Status)
- {
- case 200:
- {
- ListAliasesResult value = default;
- using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions);
- value = ListAliasesResult.DeserializeListAliasesResult(document.RootElement);
- return Response.FromValue(value, message.Response);
- }
- default:
- throw new RequestFailedException(message.Response);
- }
- }
-
- internal HttpMessage CreateCreateOrUpdateRequest(string aliasName, SearchAlias @alias, string ifMatch, string ifNoneMatch)
- {
- var message = _pipeline.CreateMessage();
- var request = message.Request;
- request.Method = RequestMethod.Put;
- var uri = new RawRequestUriBuilder();
- uri.AppendRaw(_endpoint, false);
- uri.AppendPath("/aliases('", false);
- uri.AppendPath(aliasName, true);
- uri.AppendPath("')", false);
- uri.AppendQuery("api-version", _apiVersion, true);
- request.Uri = uri;
- if (ifMatch != null)
- {
- request.Headers.Add("If-Match", ifMatch);
- }
- if (ifNoneMatch != null)
- {
- request.Headers.Add("If-None-Match", ifNoneMatch);
- }
- request.Headers.Add("Prefer", "return=representation");
- request.Headers.Add("Accept", "application/json; odata.metadata=minimal");
- request.Headers.Add("Content-Type", "application/json");
- var content = new Utf8JsonRequestContent();
- content.JsonWriter.WriteObjectValue(@alias);
- request.Content = content;
- return message;
- }
-
- /// Creates a new search alias or updates an alias if it already exists.
- /// The definition of the alias to create or update.
- /// The definition of the alias to create or update.
- /// Defines the If-Match condition. The operation will be performed only if the ETag on the server matches this value.
- /// Defines the If-None-Match condition. The operation will be performed only if the ETag on the server does not match this value.
- /// The cancellation token to use.
- /// or is null.
- public async Task> CreateOrUpdateAsync(string aliasName, SearchAlias @alias, string ifMatch = null, string ifNoneMatch = null, CancellationToken cancellationToken = default)
- {
- if (aliasName == null)
- {
- throw new ArgumentNullException(nameof(aliasName));
- }
- if (@alias == null)
- {
- throw new ArgumentNullException(nameof(@alias));
- }
-
- using var message = CreateCreateOrUpdateRequest(aliasName, @alias, ifMatch, ifNoneMatch);
- await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
- switch (message.Response.Status)
- {
- case 200:
- case 201:
- {
- SearchAlias value = default;
- using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false);
- value = SearchAlias.DeserializeSearchAlias(document.RootElement);
- return Response.FromValue(value, message.Response);
- }
- default:
- throw new RequestFailedException(message.Response);
- }
- }
-
- /// Creates a new search alias or updates an alias if it already exists.
- /// The definition of the alias to create or update.
- /// The definition of the alias to create or update.
- /// Defines the If-Match condition. The operation will be performed only if the ETag on the server matches this value.
- /// Defines the If-None-Match condition. The operation will be performed only if the ETag on the server does not match this value.
- /// The cancellation token to use.
- /// or is null.
- public Response CreateOrUpdate(string aliasName, SearchAlias @alias, string ifMatch = null, string ifNoneMatch = null, CancellationToken cancellationToken = default)
- {
- if (aliasName == null)
- {
- throw new ArgumentNullException(nameof(aliasName));
- }
- if (@alias == null)
- {
- throw new ArgumentNullException(nameof(@alias));
- }
-
- using var message = CreateCreateOrUpdateRequest(aliasName, @alias, ifMatch, ifNoneMatch);
- _pipeline.Send(message, cancellationToken);
- switch (message.Response.Status)
- {
- case 200:
- case 201:
- {
- SearchAlias value = default;
- using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions);
- value = SearchAlias.DeserializeSearchAlias(document.RootElement);
- return Response.FromValue(value, message.Response);
- }
- default:
- throw new RequestFailedException(message.Response);
- }
- }
-
- internal HttpMessage CreateDeleteRequest(string aliasName, string ifMatch, string ifNoneMatch)
- {
- var message = _pipeline.CreateMessage();
- var request = message.Request;
- request.Method = RequestMethod.Delete;
- var uri = new RawRequestUriBuilder();
- uri.AppendRaw(_endpoint, false);
- uri.AppendPath("/aliases('", false);
- uri.AppendPath(aliasName, true);
- uri.AppendPath("')", false);
- uri.AppendQuery("api-version", _apiVersion, true);
- request.Uri = uri;
- if (ifMatch != null)
- {
- request.Headers.Add("If-Match", ifMatch);
- }
- if (ifNoneMatch != null)
- {
- request.Headers.Add("If-None-Match", ifNoneMatch);
- }
- request.Headers.Add("Accept", "application/json; odata.metadata=minimal");
- return message;
- }
-
- /// Deletes a search alias and its associated mapping to an index. This operation is permanent, with no recovery option. The mapped index is untouched by this operation.
- /// The name of the alias to delete.
- /// Defines the If-Match condition. The operation will be performed only if the ETag on the server matches this value.
- /// Defines the If-None-Match condition. The operation will be performed only if the ETag on the server does not match this value.
- /// The cancellation token to use.
- /// is null.
- public async Task DeleteAsync(string aliasName, string ifMatch = null, string ifNoneMatch = null, CancellationToken cancellationToken = default)
- {
- if (aliasName == null)
- {
- throw new ArgumentNullException(nameof(aliasName));
- }
-
- using var message = CreateDeleteRequest(aliasName, ifMatch, ifNoneMatch);
- await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
- switch (message.Response.Status)
- {
- case 204:
- case 404:
- return message.Response;
- default:
- throw new RequestFailedException(message.Response);
- }
- }
-
- /// Deletes a search alias and its associated mapping to an index. This operation is permanent, with no recovery option. The mapped index is untouched by this operation.
- /// The name of the alias to delete.
- /// Defines the If-Match condition. The operation will be performed only if the ETag on the server matches this value.
- /// Defines the If-None-Match condition. The operation will be performed only if the ETag on the server does not match this value.
- /// The cancellation token to use.
- /// is null.
- public Response Delete(string aliasName, string ifMatch = null, string ifNoneMatch = null, CancellationToken cancellationToken = default)
- {
- if (aliasName == null)
- {
- throw new ArgumentNullException(nameof(aliasName));
- }
-
- using var message = CreateDeleteRequest(aliasName, ifMatch, ifNoneMatch);
- _pipeline.Send(message, cancellationToken);
- switch (message.Response.Status)
- {
- case 204:
- case 404:
- return message.Response;
- default:
- throw new RequestFailedException(message.Response);
- }
- }
-
- internal HttpMessage CreateGetRequest(string aliasName)
- {
- var message = _pipeline.CreateMessage();
- var request = message.Request;
- request.Method = RequestMethod.Get;
- var uri = new RawRequestUriBuilder();
- uri.AppendRaw(_endpoint, false);
- uri.AppendPath("/aliases('", false);
- uri.AppendPath(aliasName, true);
- uri.AppendPath("')", false);
- uri.AppendQuery("api-version", _apiVersion, true);
- request.Uri = uri;
- request.Headers.Add("Accept", "application/json; odata.metadata=minimal");
- return message;
- }
-
- /// Retrieves an alias definition.
- /// The name of the alias to retrieve.
- /// The cancellation token to use.
- /// is null.
- public async Task> GetAsync(string aliasName, CancellationToken cancellationToken = default)
- {
- if (aliasName == null)
- {
- throw new ArgumentNullException(nameof(aliasName));
- }
-
- using var message = CreateGetRequest(aliasName);
- await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
- switch (message.Response.Status)
- {
- case 200:
- {
- SearchAlias value = default;
- using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false);
- value = SearchAlias.DeserializeSearchAlias(document.RootElement);
- return Response.FromValue(value, message.Response);
- }
- default:
- throw new RequestFailedException(message.Response);
- }
- }
-
- /// Retrieves an alias definition.
- /// The name of the alias to retrieve.
- /// The cancellation token to use.
- /// is null.
- public Response Get(string aliasName, CancellationToken cancellationToken = default)
- {
- if (aliasName == null)
- {
- throw new ArgumentNullException(nameof(aliasName));
- }
-
- using var message = CreateGetRequest(aliasName);
- _pipeline.Send(message, cancellationToken);
- switch (message.Response.Status)
- {
- case 200:
- {
- SearchAlias value = default;
- using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions);
- value = SearchAlias.DeserializeSearchAlias(document.RootElement);
- return Response.FromValue(value, message.Response);
- }
- default:
- throw new RequestFailedException(message.Response);
- }
- }
- }
-}
diff --git a/sdk/search/Azure.Search.Documents/src/Generated/AnalyzeResult.Serialization.cs b/sdk/search/Azure.Search.Documents/src/Generated/AnalyzeResult.Serialization.cs
new file mode 100644
index 000000000000..e5d5da02f5c2
--- /dev/null
+++ b/sdk/search/Azure.Search.Documents/src/Generated/AnalyzeResult.Serialization.cs
@@ -0,0 +1,152 @@
+// 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.Search.Documents
+{
+ internal partial class AnalyzeResult : IUtf8JsonSerializable, IJsonModel
+ {
+ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions);
+
+ 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)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(AnalyzeResult)} does not support writing '{format}' format.");
+ }
+
+ writer.WritePropertyName("tokens"u8);
+ writer.WriteStartArray();
+ foreach (var item in Tokens)
+ {
+ writer.WriteObjectValue(item, options);
+ }
+ writer.WriteEndArray();
+ if (options.Format != "W" && _serializedAdditionalRawData != null)
+ {
+ foreach (var item in _serializedAdditionalRawData)
+ {
+ writer.WritePropertyName(item.Key);
+#if NET6_0_OR_GREATER
+ writer.WriteRawValue(item.Value);
+#else
+ using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions))
+ {
+ JsonSerializer.Serialize(writer, document.RootElement);
+ }
+#endif
+ }
+ }
+ }
+
+ AnalyzeResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(AnalyzeResult)} does not support reading '{format}' format.");
+ }
+
+ using JsonDocument document = JsonDocument.ParseValue(ref reader);
+ return DeserializeAnalyzeResult(document.RootElement, options);
+ }
+
+ internal static AnalyzeResult DeserializeAnalyzeResult(JsonElement element, ModelReaderWriterOptions options = null)
+ {
+ options ??= ModelSerializationExtensions.WireOptions;
+
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ IReadOnlyList tokens = default;
+ IDictionary serializedAdditionalRawData = default;
+ Dictionary rawDataDictionary = new Dictionary();
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("tokens"u8))
+ {
+ List array = new List();
+ foreach (var item in property.Value.EnumerateArray())
+ {
+ array.Add(AnalyzedTokenInfo.DeserializeAnalyzedTokenInfo(item, options));
+ }
+ tokens = array;
+ continue;
+ }
+ if (options.Format != "W")
+ {
+ rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText()));
+ }
+ }
+ serializedAdditionalRawData = rawDataDictionary;
+ return new AnalyzeResult(tokens, serializedAdditionalRawData);
+ }
+
+ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ return ModelReaderWriter.Write(this, options);
+ default:
+ throw new FormatException($"The model {nameof(AnalyzeResult)} does not support writing '{options.Format}' format.");
+ }
+ }
+
+ AnalyzeResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ {
+ using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions);
+ return DeserializeAnalyzeResult(document.RootElement, options);
+ }
+ default:
+ throw new FormatException($"The model {nameof(AnalyzeResult)} does not support reading '{options.Format}' format.");
+ }
+ }
+
+ string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J";
+
+ /// Deserializes the model from a raw response.
+ /// The response to deserialize the model from.
+ internal static AnalyzeResult FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions);
+ return DeserializeAnalyzeResult(document.RootElement);
+ }
+
+ /// Convert into a .
+ internal virtual RequestContent ToRequestContent()
+ {
+ var content = new Utf8JsonRequestContent();
+ content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions);
+ return content;
+ }
+ }
+}
diff --git a/sdk/search/Azure.Search.Documents/src/Generated/AnalyzeResult.cs b/sdk/search/Azure.Search.Documents/src/Generated/AnalyzeResult.cs
new file mode 100644
index 000000000000..c35cfcf9b23f
--- /dev/null
+++ b/sdk/search/Azure.Search.Documents/src/Generated/AnalyzeResult.cs
@@ -0,0 +1,76 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace Azure.Search.Documents
+{
+ /// The result of testing an analyzer on text.
+ internal partial class AnalyzeResult
+ {
+ ///
+ /// Keeps track of any properties unknown to the library.
+ ///
+ /// To assign an object to the value of this property use .
+ ///
+ ///
+ /// To assign an already formatted json string to this property use .
+ ///
+ ///
+ /// Examples:
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson("foo")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromString("\"foo\"")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson(new { key = "value" })
+ /// Creates a payload of { "key": "value" }.
+ ///
+ /// -
+ /// BinaryData.FromString("{\"key\": \"value\"}")
+ /// Creates a payload of { "key": "value" }.
+ ///
+ ///
+ ///
+ ///
+ private IDictionary _serializedAdditionalRawData;
+
+ /// Initializes a new instance of .
+ /// The list of tokens returned by the analyzer specified in the request.
+ /// is null.
+ internal AnalyzeResult(IEnumerable tokens)
+ {
+ Argument.AssertNotNull(tokens, nameof(tokens));
+
+ Tokens = tokens.ToList();
+ }
+
+ /// Initializes a new instance of .
+ /// The list of tokens returned by the analyzer specified in the request.
+ /// Keeps track of any properties unknown to the library.
+ internal AnalyzeResult(IReadOnlyList tokens, IDictionary serializedAdditionalRawData)
+ {
+ Tokens = tokens;
+ _serializedAdditionalRawData = serializedAdditionalRawData;
+ }
+
+ /// Initializes a new instance of for deserialization.
+ internal AnalyzeResult()
+ {
+ }
+
+ /// The list of tokens returned by the analyzer specified in the request.
+ public IReadOnlyList Tokens { get; }
+ }
+}
diff --git a/sdk/search/Azure.Search.Documents/src/Generated/AnalyzeTextOptions.Serialization.cs b/sdk/search/Azure.Search.Documents/src/Generated/AnalyzeTextOptions.Serialization.cs
new file mode 100644
index 000000000000..58ff4e7848b1
--- /dev/null
+++ b/sdk/search/Azure.Search.Documents/src/Generated/AnalyzeTextOptions.Serialization.cs
@@ -0,0 +1,244 @@
+// 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.Search.Documents.Indexes.Models
+{
+ public partial class AnalyzeTextOptions : IUtf8JsonSerializable, IJsonModel
+ {
+ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions);
+
+ 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)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(Search.Documents.Indexes.Models.AnalyzeTextOptions)} does not support writing '{format}' format.");
+ }
+
+ writer.WritePropertyName("text"u8);
+ writer.WriteStringValue(Text);
+ if (Optional.IsDefined(AnalyzerName))
+ {
+ writer.WritePropertyName("analyzer"u8);
+ writer.WriteStringValue(AnalyzerName.Value.ToString());
+ }
+ if (Optional.IsDefined(TokenizerName))
+ {
+ writer.WritePropertyName("tokenizer"u8);
+ writer.WriteStringValue(TokenizerName.Value.ToString());
+ }
+ if (Optional.IsDefined(NormalizerName))
+ {
+ writer.WritePropertyName("normalizer"u8);
+ writer.WriteStringValue(NormalizerName.Value.ToString());
+ }
+ if (Optional.IsCollectionDefined(TokenFilters))
+ {
+ writer.WritePropertyName("tokenFilters"u8);
+ writer.WriteStartArray();
+ foreach (var item in TokenFilters)
+ {
+ writer.WriteStringValue(item.ToString());
+ }
+ writer.WriteEndArray();
+ }
+ if (Optional.IsCollectionDefined(CharFilters))
+ {
+ writer.WritePropertyName("charFilters"u8);
+ writer.WriteStartArray();
+ foreach (var item in CharFilters)
+ {
+ writer.WriteStringValue(item);
+ }
+ writer.WriteEndArray();
+ }
+ if (options.Format != "W" && _serializedAdditionalRawData != null)
+ {
+ foreach (var item in _serializedAdditionalRawData)
+ {
+ writer.WritePropertyName(item.Key);
+#if NET6_0_OR_GREATER
+ writer.WriteRawValue(item.Value);
+#else
+ using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions))
+ {
+ JsonSerializer.Serialize(writer, document.RootElement);
+ }
+#endif
+ }
+ }
+ }
+
+ Search.Documents.Indexes.Models.AnalyzeTextOptions IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(Search.Documents.Indexes.Models.AnalyzeTextOptions)} does not support reading '{format}' format.");
+ }
+
+ using JsonDocument document = JsonDocument.ParseValue(ref reader);
+ return Search.Documents.Indexes.Models.AnalyzeTextOptions.DeserializeAnalyzeTextOptions(document.RootElement, options);
+ }
+
+ internal static Search.Documents.Indexes.Models.AnalyzeTextOptions DeserializeAnalyzeTextOptions(JsonElement element, ModelReaderWriterOptions options = null)
+ {
+ options ??= ModelSerializationExtensions.WireOptions;
+
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ string text = default;
+ Search.Documents.LexicalAnalyzerName? analyzer = default;
+ LexicalTokenizerName? tokenizer = default;
+ Search.Documents.LexicalNormalizerName? normalizer = default;
+ IList tokenFilters = default;
+ IList charFilters = default;
+ IDictionary serializedAdditionalRawData = default;
+ Dictionary rawDataDictionary = new Dictionary();
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("text"u8))
+ {
+ text = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("analyzer"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ analyzer = new Search.Documents.LexicalAnalyzerName(property.Value.GetString());
+ continue;
+ }
+ if (property.NameEquals("tokenizer"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ tokenizer = new LexicalTokenizerName(property.Value.GetString());
+ continue;
+ }
+ if (property.NameEquals("normalizer"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ normalizer = new Search.Documents.LexicalNormalizerName(property.Value.GetString());
+ continue;
+ }
+ if (property.NameEquals("tokenFilters"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ List array = new List();
+ foreach (var item in property.Value.EnumerateArray())
+ {
+ array.Add(new TokenFilterName(item.GetString()));
+ }
+ tokenFilters = array;
+ continue;
+ }
+ if (property.NameEquals("charFilters"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ List array = new List();
+ foreach (var item in property.Value.EnumerateArray())
+ {
+ array.Add(item.GetString());
+ }
+ charFilters = array;
+ continue;
+ }
+ if (options.Format != "W")
+ {
+ rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText()));
+ }
+ }
+ serializedAdditionalRawData = rawDataDictionary;
+ return new Search.Documents.Indexes.Models.AnalyzeTextOptions(
+ text,
+ analyzer,
+ tokenizer,
+ normalizer,
+ tokenFilters ?? new ChangeTrackingList(),
+ charFilters ?? new ChangeTrackingList(),
+ serializedAdditionalRawData);
+ }
+
+ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ return ModelReaderWriter.Write(this, options);
+ default:
+ throw new FormatException($"The model {nameof(Search.Documents.Indexes.Models.AnalyzeTextOptions)} does not support writing '{options.Format}' format.");
+ }
+ }
+
+ Search.Documents.Indexes.Models.AnalyzeTextOptions IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ {
+ using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions);
+ return Search.Documents.Indexes.Models.AnalyzeTextOptions.DeserializeAnalyzeTextOptions(document.RootElement, options);
+ }
+ default:
+ throw new FormatException($"The model {nameof(Search.Documents.Indexes.Models.AnalyzeTextOptions)} does not support reading '{options.Format}' format.");
+ }
+ }
+
+ string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J";
+
+ /// Deserializes the model from a raw response.
+ /// The response to deserialize the model from.
+ internal static Search.Documents.Indexes.Models.AnalyzeTextOptions FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions);
+ return Search.Documents.Indexes.Models.AnalyzeTextOptions.DeserializeAnalyzeTextOptions(document.RootElement);
+ }
+
+ /// Convert into a .
+ internal virtual RequestContent ToRequestContent()
+ {
+ var content = new Utf8JsonRequestContent();
+ content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions);
+ return content;
+ }
+ }
+}
diff --git a/sdk/search/Azure.Search.Documents/src/Generated/AnalyzeTextOptions.cs b/sdk/search/Azure.Search.Documents/src/Generated/AnalyzeTextOptions.cs
new file mode 100644
index 000000000000..6990d92f4b9b
--- /dev/null
+++ b/sdk/search/Azure.Search.Documents/src/Generated/AnalyzeTextOptions.cs
@@ -0,0 +1,101 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+
+namespace Azure.Search.Documents.Indexes.Models
+{
+ /// Specifies some text and analysis components used to break that text into tokens.
+ public partial class AnalyzeTextOptions
+ {
+ ///
+ /// Keeps track of any properties unknown to the library.
+ ///
+ /// To assign an object to the value of this property use .
+ ///
+ ///
+ /// To assign an already formatted json string to this property use .
+ ///
+ ///
+ /// Examples:
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson("foo")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromString("\"foo\"")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson(new { key = "value" })
+ /// Creates a payload of { "key": "value" }.
+ ///
+ /// -
+ /// BinaryData.FromString("{\"key\": \"value\"}")
+ /// Creates a payload of { "key": "value" }.
+ ///
+ ///
+ ///
+ ///
+ private IDictionary _serializedAdditionalRawData;
+
+ /// Initializes a new instance of .
+ /// The text to break into tokens.
+ /// is null.
+ public AnalyzeTextOptions(string text)
+ {
+ Argument.AssertNotNull(text, nameof(text));
+
+ Text = text;
+ TokenFilters = new ChangeTrackingList();
+ CharFilters = new ChangeTrackingList();
+ }
+
+ /// Initializes a new instance of .
+ /// The text to break into tokens.
+ ///
+ /// The name of the analyzer to use to break the given text. If this parameter is
+ /// not specified, you must specify a tokenizer instead. The tokenizer and analyzer
+ /// parameters are mutually exclusive.
+ ///
+ ///
+ /// The name of the tokenizer to use to break the given text. If this parameter is
+ /// not specified, you must specify an analyzer instead. The tokenizer and analyzer
+ /// parameters are mutually exclusive.
+ ///
+ /// The name of the normalizer to use to normalize the given text.
+ ///
+ /// An optional list of token filters to use when breaking the given text. This
+ /// parameter can only be set when using the tokenizer parameter.
+ ///
+ ///
+ /// An optional list of character filters to use when breaking the given text. This
+ /// parameter can only be set when using the tokenizer parameter.
+ ///
+ /// Keeps track of any properties unknown to the library.
+ internal AnalyzeTextOptions(string text, Search.Documents.LexicalAnalyzerName? analyzerName, LexicalTokenizerName? tokenizerName, Search.Documents.LexicalNormalizerName? normalizerName, IList tokenFilters, IList charFilters, IDictionary serializedAdditionalRawData)
+ {
+ Text = text;
+ AnalyzerName = analyzerName;
+ TokenizerName = tokenizerName;
+ NormalizerName = normalizerName;
+ TokenFilters = tokenFilters;
+ CharFilters = charFilters;
+ _serializedAdditionalRawData = serializedAdditionalRawData;
+ }
+
+ /// Initializes a new instance of for deserialization.
+ internal AnalyzeTextOptions()
+ {
+ }
+
+ /// The text to break into tokens.
+ public string Text { get; }
+ }
+}
diff --git a/sdk/search/Azure.Search.Documents/src/Generated/AnalyzedTokenInfo.Serialization.cs b/sdk/search/Azure.Search.Documents/src/Generated/AnalyzedTokenInfo.Serialization.cs
new file mode 100644
index 000000000000..7d843f5a6979
--- /dev/null
+++ b/sdk/search/Azure.Search.Documents/src/Generated/AnalyzedTokenInfo.Serialization.cs
@@ -0,0 +1,166 @@
+// 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.Search.Documents
+{
+ public partial class AnalyzedTokenInfo : IUtf8JsonSerializable, IJsonModel
+ {
+ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions);
+
+ 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)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(AnalyzedTokenInfo)} does not support writing '{format}' format.");
+ }
+
+ writer.WritePropertyName("token"u8);
+ writer.WriteStringValue(Token);
+ writer.WritePropertyName("startOffset"u8);
+ writer.WriteNumberValue(StartOffset);
+ writer.WritePropertyName("endOffset"u8);
+ writer.WriteNumberValue(EndOffset);
+ writer.WritePropertyName("position"u8);
+ writer.WriteNumberValue(Position);
+ if (options.Format != "W" && _serializedAdditionalRawData != null)
+ {
+ foreach (var item in _serializedAdditionalRawData)
+ {
+ writer.WritePropertyName(item.Key);
+#if NET6_0_OR_GREATER
+ writer.WriteRawValue(item.Value);
+#else
+ using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions))
+ {
+ JsonSerializer.Serialize(writer, document.RootElement);
+ }
+#endif
+ }
+ }
+ }
+
+ AnalyzedTokenInfo IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(AnalyzedTokenInfo)} does not support reading '{format}' format.");
+ }
+
+ using JsonDocument document = JsonDocument.ParseValue(ref reader);
+ return DeserializeAnalyzedTokenInfo(document.RootElement, options);
+ }
+
+ internal static AnalyzedTokenInfo DeserializeAnalyzedTokenInfo(JsonElement element, ModelReaderWriterOptions options = null)
+ {
+ options ??= ModelSerializationExtensions.WireOptions;
+
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ string token = default;
+ int startOffset = default;
+ int endOffset = default;
+ int position = default;
+ IDictionary serializedAdditionalRawData = default;
+ Dictionary rawDataDictionary = new Dictionary();
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("token"u8))
+ {
+ token = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("startOffset"u8))
+ {
+ startOffset = property.Value.GetInt32();
+ continue;
+ }
+ if (property.NameEquals("endOffset"u8))
+ {
+ endOffset = property.Value.GetInt32();
+ continue;
+ }
+ if (property.NameEquals("position"u8))
+ {
+ position = property.Value.GetInt32();
+ continue;
+ }
+ if (options.Format != "W")
+ {
+ rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText()));
+ }
+ }
+ serializedAdditionalRawData = rawDataDictionary;
+ return new AnalyzedTokenInfo(token, startOffset, endOffset, position, serializedAdditionalRawData);
+ }
+
+ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ return ModelReaderWriter.Write(this, options);
+ default:
+ throw new FormatException($"The model {nameof(AnalyzedTokenInfo)} does not support writing '{options.Format}' format.");
+ }
+ }
+
+ AnalyzedTokenInfo IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ {
+ using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions);
+ return DeserializeAnalyzedTokenInfo(document.RootElement, options);
+ }
+ default:
+ throw new FormatException($"The model {nameof(AnalyzedTokenInfo)} does not support reading '{options.Format}' format.");
+ }
+ }
+
+ string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J";
+
+ /// Deserializes the model from a raw response.
+ /// The response to deserialize the model from.
+ internal static AnalyzedTokenInfo FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions);
+ return DeserializeAnalyzedTokenInfo(document.RootElement);
+ }
+
+ /// Convert into a .
+ internal virtual RequestContent ToRequestContent()
+ {
+ var content = new Utf8JsonRequestContent();
+ content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions);
+ return content;
+ }
+ }
+}
diff --git a/sdk/search/Azure.Search.Documents/src/Generated/AnalyzedTokenInfo.cs b/sdk/search/Azure.Search.Documents/src/Generated/AnalyzedTokenInfo.cs
new file mode 100644
index 000000000000..c66aa12b387d
--- /dev/null
+++ b/sdk/search/Azure.Search.Documents/src/Generated/AnalyzedTokenInfo.cs
@@ -0,0 +1,108 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+
+namespace Azure.Search.Documents
+{
+ /// Information about a token returned by an analyzer.
+ public partial class AnalyzedTokenInfo
+ {
+ ///
+ /// Keeps track of any properties unknown to the library.
+ ///
+ /// To assign an object to the value of this property use .
+ ///
+ ///
+ /// To assign an already formatted json string to this property use .
+ ///
+ ///
+ /// Examples:
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson("foo")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromString("\"foo\"")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson(new { key = "value" })
+ /// Creates a payload of { "key": "value" }.
+ ///
+ /// -
+ /// BinaryData.FromString("{\"key\": \"value\"}")
+ /// Creates a payload of { "key": "value" }.
+ ///
+ ///
+ ///
+ ///
+ private IDictionary _serializedAdditionalRawData;
+
+ /// Initializes a new instance of .
+ /// The token returned by the analyzer.
+ /// The index of the first character of the token in the input text.
+ /// The index of the last character of the token in the input text.
+ ///
+ /// The position of the token in the input text relative to other tokens. The first
+ /// token in the input text has position 0, the next has position 1, and so on.
+ /// Depending on the analyzer used, some tokens might have the same position, for
+ /// example if they are synonyms of each other.
+ ///
+ /// is null.
+ internal AnalyzedTokenInfo(string token, int startOffset, int endOffset, int position)
+ {
+ Argument.AssertNotNull(token, nameof(token));
+
+ Token = token;
+ StartOffset = startOffset;
+ EndOffset = endOffset;
+ Position = position;
+ }
+
+ /// Initializes a new instance of .
+ /// The token returned by the analyzer.
+ /// The index of the first character of the token in the input text.
+ /// The index of the last character of the token in the input text.
+ ///
+ /// The position of the token in the input text relative to other tokens. The first
+ /// token in the input text has position 0, the next has position 1, and so on.
+ /// Depending on the analyzer used, some tokens might have the same position, for
+ /// example if they are synonyms of each other.
+ ///
+ /// Keeps track of any properties unknown to the library.
+ internal AnalyzedTokenInfo(string token, int startOffset, int endOffset, int position, IDictionary serializedAdditionalRawData)
+ {
+ Token = token;
+ StartOffset = startOffset;
+ EndOffset = endOffset;
+ Position = position;
+ _serializedAdditionalRawData = serializedAdditionalRawData;
+ }
+
+ /// Initializes a new instance of for deserialization.
+ internal AnalyzedTokenInfo()
+ {
+ }
+
+ /// The token returned by the analyzer.
+ public string Token { get; }
+ /// The index of the first character of the token in the input text.
+ public int StartOffset { get; }
+ /// The index of the last character of the token in the input text.
+ public int EndOffset { get; }
+ ///
+ /// The position of the token in the input text relative to other tokens. The first
+ /// token in the input text has position 0, the next has position 1, and so on.
+ /// Depending on the analyzer used, some tokens might have the same position, for
+ /// example if they are synonyms of each other.
+ ///
+ public int Position { get; }
+ }
+}
diff --git a/sdk/search/Azure.Search.Documents/src/Generated/AsciiFoldingTokenFilter.Serialization.cs b/sdk/search/Azure.Search.Documents/src/Generated/AsciiFoldingTokenFilter.Serialization.cs
new file mode 100644
index 000000000000..c9a6c2f4697e
--- /dev/null
+++ b/sdk/search/Azure.Search.Documents/src/Generated/AsciiFoldingTokenFilter.Serialization.cs
@@ -0,0 +1,147 @@
+// 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.Search.Documents
+{
+ public partial class AsciiFoldingTokenFilter : IUtf8JsonSerializable, IJsonModel
+ {
+ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions);
+
+ 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 override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(AsciiFoldingTokenFilter)} does not support writing '{format}' format.");
+ }
+
+ base.JsonModelWriteCore(writer, options);
+ if (Optional.IsDefined(PreserveOriginal))
+ {
+ writer.WritePropertyName("preserveOriginal"u8);
+ writer.WriteBooleanValue(PreserveOriginal.Value);
+ }
+ }
+
+ AsciiFoldingTokenFilter IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(AsciiFoldingTokenFilter)} does not support reading '{format}' format.");
+ }
+
+ using JsonDocument document = JsonDocument.ParseValue(ref reader);
+ return DeserializeAsciiFoldingTokenFilter(document.RootElement, options);
+ }
+
+ internal static AsciiFoldingTokenFilter DeserializeAsciiFoldingTokenFilter(JsonElement element, ModelReaderWriterOptions options = null)
+ {
+ options ??= ModelSerializationExtensions.WireOptions;
+
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ bool? preserveOriginal = default;
+ string odataType = default;
+ string name = default;
+ IDictionary serializedAdditionalRawData = default;
+ Dictionary rawDataDictionary = new Dictionary();
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("preserveOriginal"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ preserveOriginal = property.Value.GetBoolean();
+ continue;
+ }
+ if (property.NameEquals("@odata.type"u8))
+ {
+ odataType = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("name"u8))
+ {
+ name = property.Value.GetString();
+ continue;
+ }
+ if (options.Format != "W")
+ {
+ rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText()));
+ }
+ }
+ serializedAdditionalRawData = rawDataDictionary;
+ return new AsciiFoldingTokenFilter(odataType, name, serializedAdditionalRawData, preserveOriginal);
+ }
+
+ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ return ModelReaderWriter.Write(this, options);
+ default:
+ throw new FormatException($"The model {nameof(AsciiFoldingTokenFilter)} does not support writing '{options.Format}' format.");
+ }
+ }
+
+ AsciiFoldingTokenFilter IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ {
+ using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions);
+ return DeserializeAsciiFoldingTokenFilter(document.RootElement, options);
+ }
+ default:
+ throw new FormatException($"The model {nameof(AsciiFoldingTokenFilter)} does not support reading '{options.Format}' format.");
+ }
+ }
+
+ string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J";
+
+ /// Deserializes the model from a raw response.
+ /// The response to deserialize the model from.
+ internal static new AsciiFoldingTokenFilter FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions);
+ return DeserializeAsciiFoldingTokenFilter(document.RootElement);
+ }
+
+ /// Convert into a .
+ internal override RequestContent ToRequestContent()
+ {
+ var content = new Utf8JsonRequestContent();
+ content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions);
+ return content;
+ }
+ }
+}
diff --git a/sdk/search/Azure.Search.Documents/src/Generated/AsciiFoldingTokenFilter.cs b/sdk/search/Azure.Search.Documents/src/Generated/AsciiFoldingTokenFilter.cs
new file mode 100644
index 000000000000..619de16ed5ea
--- /dev/null
+++ b/sdk/search/Azure.Search.Documents/src/Generated/AsciiFoldingTokenFilter.cs
@@ -0,0 +1,57 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+
+namespace Azure.Search.Documents
+{
+ ///
+ /// Converts alphabetic, numeric, and symbolic Unicode characters which are not in
+ /// the first 127 ASCII characters (the "Basic Latin" Unicode block) into their
+ /// ASCII equivalents, if such equivalents exist. This token filter is implemented
+ /// using Apache Lucene.
+ ///
+ public partial class AsciiFoldingTokenFilter : TokenFilter
+ {
+ /// Initializes a new instance of .
+ ///
+ /// The name of the token filter. It must only contain letters, digits, spaces,
+ /// dashes or underscores, can only start and end with alphanumeric characters, and
+ /// is limited to 128 characters.
+ ///
+ /// is null.
+ public AsciiFoldingTokenFilter(string name) : base(name)
+ {
+ Argument.AssertNotNull(name, nameof(name));
+
+ OdataType = "#Microsoft.Azure.Search.AsciiFoldingTokenFilter";
+ }
+
+ /// Initializes a new instance of .
+ /// The discriminator for derived types.
+ ///
+ /// The name of the token filter. It must only contain letters, digits, spaces,
+ /// dashes or underscores, can only start and end with alphanumeric characters, and
+ /// is limited to 128 characters.
+ ///
+ /// Keeps track of any properties unknown to the library.
+ /// A value indicating whether the original token will be kept. Default is false.
+ internal AsciiFoldingTokenFilter(string odataType, string name, IDictionary serializedAdditionalRawData, bool? preserveOriginal) : base(odataType, name, serializedAdditionalRawData)
+ {
+ PreserveOriginal = preserveOriginal;
+ }
+
+ /// Initializes a new instance of for deserialization.
+ internal AsciiFoldingTokenFilter()
+ {
+ }
+
+ /// A value indicating whether the original token will be kept. Default is false.
+ public bool? PreserveOriginal { get; set; }
+ }
+}
diff --git a/sdk/search/Azure.Search.Documents/src/Generated/AutocompleteItem.Serialization.cs b/sdk/search/Azure.Search.Documents/src/Generated/AutocompleteItem.Serialization.cs
new file mode 100644
index 000000000000..6626476cbb44
--- /dev/null
+++ b/sdk/search/Azure.Search.Documents/src/Generated/AutocompleteItem.Serialization.cs
@@ -0,0 +1,150 @@
+// 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.Search.Documents
+{
+ public partial class AutocompleteItem : IUtf8JsonSerializable, IJsonModel
+ {
+ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions);
+
+ 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)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(AutocompleteItem)} does not support writing '{format}' format.");
+ }
+
+ writer.WritePropertyName("text"u8);
+ writer.WriteStringValue(Text);
+ writer.WritePropertyName("queryPlusText"u8);
+ writer.WriteStringValue(QueryPlusText);
+ if (options.Format != "W" && _serializedAdditionalRawData != null)
+ {
+ foreach (var item in _serializedAdditionalRawData)
+ {
+ writer.WritePropertyName(item.Key);
+#if NET6_0_OR_GREATER
+ writer.WriteRawValue(item.Value);
+#else
+ using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions))
+ {
+ JsonSerializer.Serialize(writer, document.RootElement);
+ }
+#endif
+ }
+ }
+ }
+
+ AutocompleteItem IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(AutocompleteItem)} does not support reading '{format}' format.");
+ }
+
+ using JsonDocument document = JsonDocument.ParseValue(ref reader);
+ return DeserializeAutocompleteItem(document.RootElement, options);
+ }
+
+ internal static AutocompleteItem DeserializeAutocompleteItem(JsonElement element, ModelReaderWriterOptions options = null)
+ {
+ options ??= ModelSerializationExtensions.WireOptions;
+
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ string text = default;
+ string queryPlusText = default;
+ IDictionary serializedAdditionalRawData = default;
+ Dictionary rawDataDictionary = new Dictionary();
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("text"u8))
+ {
+ text = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("queryPlusText"u8))
+ {
+ queryPlusText = property.Value.GetString();
+ continue;
+ }
+ if (options.Format != "W")
+ {
+ rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText()));
+ }
+ }
+ serializedAdditionalRawData = rawDataDictionary;
+ return new AutocompleteItem(text, queryPlusText, serializedAdditionalRawData);
+ }
+
+ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ return ModelReaderWriter.Write(this, options);
+ default:
+ throw new FormatException($"The model {nameof(AutocompleteItem)} does not support writing '{options.Format}' format.");
+ }
+ }
+
+ AutocompleteItem IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ {
+ using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions);
+ return DeserializeAutocompleteItem(document.RootElement, options);
+ }
+ default:
+ throw new FormatException($"The model {nameof(AutocompleteItem)} does not support reading '{options.Format}' format.");
+ }
+ }
+
+ string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J";
+
+ /// Deserializes the model from a raw response.
+ /// The response to deserialize the model from.
+ internal static AutocompleteItem FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions);
+ return DeserializeAutocompleteItem(document.RootElement);
+ }
+
+ /// Convert into a .
+ internal virtual RequestContent ToRequestContent()
+ {
+ var content = new Utf8JsonRequestContent();
+ content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions);
+ return content;
+ }
+ }
+}
diff --git a/sdk/search/Azure.Search.Documents/src/Generated/AutocompleteItem.cs b/sdk/search/Azure.Search.Documents/src/Generated/AutocompleteItem.cs
new file mode 100644
index 000000000000..e7e4a55ae4b0
--- /dev/null
+++ b/sdk/search/Azure.Search.Documents/src/Generated/AutocompleteItem.cs
@@ -0,0 +1,82 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+
+namespace Azure.Search.Documents
+{
+ /// The result of Autocomplete requests.
+ public partial class AutocompleteItem
+ {
+ ///
+ /// Keeps track of any properties unknown to the library.
+ ///
+ /// To assign an object to the value of this property use .
+ ///
+ ///
+ /// To assign an already formatted json string to this property use .
+ ///
+ ///
+ /// Examples:
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson("foo")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromString("\"foo\"")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson(new { key = "value" })
+ /// Creates a payload of { "key": "value" }.
+ ///
+ /// -
+ /// BinaryData.FromString("{\"key\": \"value\"}")
+ /// Creates a payload of { "key": "value" }.
+ ///
+ ///
+ ///
+ ///
+ private IDictionary _serializedAdditionalRawData;
+
+ /// Initializes a new instance of .
+ /// The completed term.
+ /// The query along with the completed term.
+ /// or is null.
+ internal AutocompleteItem(string text, string queryPlusText)
+ {
+ Argument.AssertNotNull(text, nameof(text));
+ Argument.AssertNotNull(queryPlusText, nameof(queryPlusText));
+
+ Text = text;
+ QueryPlusText = queryPlusText;
+ }
+
+ /// Initializes a new instance of .
+ /// The completed term.
+ /// The query along with the completed term.
+ /// Keeps track of any properties unknown to the library.
+ internal AutocompleteItem(string text, string queryPlusText, IDictionary serializedAdditionalRawData)
+ {
+ Text = text;
+ QueryPlusText = queryPlusText;
+ _serializedAdditionalRawData = serializedAdditionalRawData;
+ }
+
+ /// Initializes a new instance of for deserialization.
+ internal AutocompleteItem()
+ {
+ }
+
+ /// The completed term.
+ public string Text { get; }
+ /// The query along with the completed term.
+ public string QueryPlusText { get; }
+ }
+}
diff --git a/sdk/search/Azure.Search.Documents/src/Generated/AutocompleteMode.cs b/sdk/search/Azure.Search.Documents/src/Generated/AutocompleteMode.cs
new file mode 100644
index 000000000000..a12b55393e80
--- /dev/null
+++ b/sdk/search/Azure.Search.Documents/src/Generated/AutocompleteMode.cs
@@ -0,0 +1,68 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.ComponentModel;
+
+namespace Azure.Search.Documents
+{
+ ///
+ /// Specifies the mode for Autocomplete. The default is 'oneTerm'. Use 'twoTerms'
+ /// to get shingles and 'oneTermWithContext' to use the current context in
+ /// producing autocomplete terms.
+ ///
+ public readonly partial struct AutocompleteMode : IEquatable
+ {
+ private readonly string _value;
+
+ /// Initializes a new instance of .
+ /// is null.
+ public AutocompleteMode(string value)
+ {
+ _value = value ?? throw new ArgumentNullException(nameof(value));
+ }
+
+ private const string OneTermValue = "oneTerm";
+ private const string TwoTermsValue = "twoTerms";
+ private const string OneTermWithContextValue = "oneTermWithContext";
+
+ ///
+ /// Only one term is suggested. If the query has two terms, only the last term is
+ /// completed. For example, if the input is 'washington medic', the suggested terms
+ /// could include 'medicaid', 'medicare', and 'medicine'.
+ ///
+ public static AutocompleteMode OneTerm { get; } = new AutocompleteMode(OneTermValue);
+ ///
+ /// Matching two-term phrases in the index will be suggested. For example, if the
+ /// input is 'medic', the suggested terms could include 'medicare coverage' and 'medical assistant'.
+ ///
+ public static AutocompleteMode TwoTerms { get; } = new AutocompleteMode(TwoTermsValue);
+ ///
+ /// Completes the last term in a query with two or more terms, where the last two
+ /// terms are a phrase that exists in the index. For example, if the input is 'washington medic', the suggested terms could include 'washington medicaid' and 'washington medical'.
+ ///
+ public static AutocompleteMode OneTermWithContext { get; } = new AutocompleteMode(OneTermWithContextValue);
+ /// Determines if two values are the same.
+ public static bool operator ==(AutocompleteMode left, AutocompleteMode right) => left.Equals(right);
+ /// Determines if two values are not the same.
+ public static bool operator !=(AutocompleteMode left, AutocompleteMode right) => !left.Equals(right);
+ /// Converts a to a .
+ public static implicit operator AutocompleteMode(string value) => new AutocompleteMode(value);
+
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override bool Equals(object obj) => obj is AutocompleteMode other && Equals(other);
+ ///
+ public bool Equals(AutocompleteMode 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/search/Azure.Search.Documents/src/Generated/AutocompleteOptions.Serialization.cs b/sdk/search/Azure.Search.Documents/src/Generated/AutocompleteOptions.Serialization.cs
new file mode 100644
index 000000000000..6ea3d434d194
--- /dev/null
+++ b/sdk/search/Azure.Search.Documents/src/Generated/AutocompleteOptions.Serialization.cs
@@ -0,0 +1,265 @@
+// 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.Search.Documents
+{
+ public partial class AutocompleteOptions : IUtf8JsonSerializable, IJsonModel
+ {
+ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions);
+
+ 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)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(AutocompleteOptions)} does not support writing '{format}' format.");
+ }
+
+ writer.WritePropertyName("search"u8);
+ writer.WriteStringValue(SearchText);
+ if (Optional.IsDefined(Mode))
+ {
+ writer.WritePropertyName("autocompleteMode"u8);
+ writer.WriteStringValue(Mode.Value.ToString());
+ }
+ if (Optional.IsDefined(Filter))
+ {
+ writer.WritePropertyName("filter"u8);
+ writer.WriteStringValue(Filter);
+ }
+ if (Optional.IsDefined(UseFuzzyMatching))
+ {
+ writer.WritePropertyName("fuzzy"u8);
+ writer.WriteBooleanValue(UseFuzzyMatching.Value);
+ }
+ if (Optional.IsDefined(HighlightPostTag))
+ {
+ writer.WritePropertyName("highlightPostTag"u8);
+ writer.WriteStringValue(HighlightPostTag);
+ }
+ if (Optional.IsDefined(HighlightPreTag))
+ {
+ writer.WritePropertyName("highlightPreTag"u8);
+ writer.WriteStringValue(HighlightPreTag);
+ }
+ if (Optional.IsDefined(MinimumCoverage))
+ {
+ writer.WritePropertyName("minimumCoverage"u8);
+ writer.WriteNumberValue(MinimumCoverage.Value);
+ }
+ if (Optional.IsDefined(SearchFieldsRaw))
+ {
+ writer.WritePropertyName("searchFields"u8);
+ writer.WriteStringValue(SearchFieldsRaw);
+ }
+ writer.WritePropertyName("suggesterName"u8);
+ writer.WriteStringValue(SuggesterName);
+ if (Optional.IsDefined(Size))
+ {
+ writer.WritePropertyName("top"u8);
+ writer.WriteNumberValue(Size.Value);
+ }
+ if (options.Format != "W" && _serializedAdditionalRawData != null)
+ {
+ foreach (var item in _serializedAdditionalRawData)
+ {
+ writer.WritePropertyName(item.Key);
+#if NET6_0_OR_GREATER
+ writer.WriteRawValue(item.Value);
+#else
+ using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions))
+ {
+ JsonSerializer.Serialize(writer, document.RootElement);
+ }
+#endif
+ }
+ }
+ }
+
+ AutocompleteOptions IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(AutocompleteOptions)} does not support reading '{format}' format.");
+ }
+
+ using JsonDocument document = JsonDocument.ParseValue(ref reader);
+ return DeserializeAutocompleteOptions(document.RootElement, options);
+ }
+
+ internal static AutocompleteOptions DeserializeAutocompleteOptions(JsonElement element, ModelReaderWriterOptions options = null)
+ {
+ options ??= ModelSerializationExtensions.WireOptions;
+
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ string search = default;
+ AutocompleteMode? autocompleteMode = default;
+ string filter = default;
+ bool? fuzzy = default;
+ string highlightPostTag = default;
+ string highlightPreTag = default;
+ double? minimumCoverage = default;
+ string searchFields = default;
+ string suggesterName = default;
+ int? top = default;
+ IDictionary serializedAdditionalRawData = default;
+ Dictionary rawDataDictionary = new Dictionary();
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("search"u8))
+ {
+ search = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("autocompleteMode"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ autocompleteMode = new AutocompleteMode(property.Value.GetString());
+ continue;
+ }
+ if (property.NameEquals("filter"u8))
+ {
+ filter = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("fuzzy"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ fuzzy = property.Value.GetBoolean();
+ continue;
+ }
+ if (property.NameEquals("highlightPostTag"u8))
+ {
+ highlightPostTag = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("highlightPreTag"u8))
+ {
+ highlightPreTag = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("minimumCoverage"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ minimumCoverage = property.Value.GetDouble();
+ continue;
+ }
+ if (property.NameEquals("searchFields"u8))
+ {
+ searchFields = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("suggesterName"u8))
+ {
+ suggesterName = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("top"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ top = property.Value.GetInt32();
+ continue;
+ }
+ if (options.Format != "W")
+ {
+ rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText()));
+ }
+ }
+ serializedAdditionalRawData = rawDataDictionary;
+ return new AutocompleteOptions(
+ search,
+ autocompleteMode,
+ filter,
+ fuzzy,
+ highlightPostTag,
+ highlightPreTag,
+ minimumCoverage,
+ searchFields,
+ suggesterName,
+ top,
+ serializedAdditionalRawData);
+ }
+
+ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ return ModelReaderWriter.Write(this, options);
+ default:
+ throw new FormatException($"The model {nameof(AutocompleteOptions)} does not support writing '{options.Format}' format.");
+ }
+ }
+
+ AutocompleteOptions IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ {
+ using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions);
+ return DeserializeAutocompleteOptions(document.RootElement, options);
+ }
+ default:
+ throw new FormatException($"The model {nameof(AutocompleteOptions)} does not support reading '{options.Format}' format.");
+ }
+ }
+
+ string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J";
+
+ /// Deserializes the model from a raw response.
+ /// The response to deserialize the model from.
+ internal static AutocompleteOptions FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions);
+ return DeserializeAutocompleteOptions(document.RootElement);
+ }
+
+ /// Convert into a .
+ internal virtual RequestContent ToRequestContent()
+ {
+ var content = new Utf8JsonRequestContent();
+ content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions);
+ return content;
+ }
+ }
+}
diff --git a/sdk/search/Azure.Search.Documents/src/Generated/AutocompleteOptions.cs b/sdk/search/Azure.Search.Documents/src/Generated/AutocompleteOptions.cs
new file mode 100644
index 000000000000..28d2f4f827b2
--- /dev/null
+++ b/sdk/search/Azure.Search.Documents/src/Generated/AutocompleteOptions.cs
@@ -0,0 +1,134 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+
+namespace Azure.Search.Documents
+{
+ /// Parameters for fuzzy matching, and other autocomplete query behaviors.
+ public partial class AutocompleteOptions
+ {
+ ///
+ /// Keeps track of any properties unknown to the library.
+ ///
+ /// To assign an object to the value of this property use .
+ ///
+ ///
+ /// To assign an already formatted json string to this property use .
+ ///
+ ///
+ /// Examples:
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson("foo")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromString("\"foo\"")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson(new { key = "value" })
+ /// Creates a payload of { "key": "value" }.
+ ///
+ /// -
+ /// BinaryData.FromString("{\"key\": \"value\"}")
+ /// Creates a payload of { "key": "value" }.
+ ///
+ ///
+ ///
+ ///
+ private IDictionary _serializedAdditionalRawData;
+
+ /// Initializes a new instance of .
+ /// The search text on which to base autocomplete results.
+ ///
+ /// Specifies the mode for Autocomplete. The default is 'oneTerm'. Use 'twoTerms'
+ /// to get shingles and 'oneTermWithContext' to use the current context while
+ /// producing auto-completed terms.
+ ///
+ ///
+ /// An OData expression that filters the documents used to produce completed terms
+ /// for the Autocomplete result.
+ ///
+ ///
+ /// A value indicating whether to use fuzzy matching for the autocomplete query.
+ /// Default is false. When set to true, the query will autocomplete terms even if
+ /// there's a substituted or missing character in the search text. While this
+ /// provides a better experience in some scenarios, it comes at a performance cost
+ /// as fuzzy autocomplete queries are slower and consume more resources.
+ ///
+ ///
+ /// A string tag that is appended to hit highlights. Must be set with
+ /// highlightPreTag. If omitted, hit highlighting is disabled.
+ ///
+ ///
+ /// A string tag that is prepended to hit highlights. Must be set with
+ /// highlightPostTag. If omitted, hit highlighting is disabled.
+ ///
+ ///
+ /// A number between 0 and 100 indicating the percentage of the index that must be
+ /// covered by an autocomplete query in order for the query to be reported as a
+ /// success. This parameter can be useful for ensuring search availability even for
+ /// services with only one replica. The default is 80.
+ ///
+ ///
+ /// The comma-separated list of field names to consider when querying for
+ /// auto-completed terms. Target fields must be included in the specified
+ /// suggester.
+ ///
+ ///
+ /// The name of the suggester as specified in the suggesters collection that's part
+ /// of the index definition.
+ ///
+ ///
+ /// The number of auto-completed terms to retrieve. This must be a value between 1
+ /// and 100. The default is 5.
+ ///
+ /// Keeps track of any properties unknown to the library.
+ internal AutocompleteOptions(string searchText, AutocompleteMode? mode, string filter, bool? useFuzzyMatching, string highlightPostTag, string highlightPreTag, double? minimumCoverage, string searchFieldsRaw, string suggesterName, int? size, IDictionary serializedAdditionalRawData)
+ {
+ SearchText = searchText;
+ Mode = mode;
+ Filter = filter;
+ UseFuzzyMatching = useFuzzyMatching;
+ HighlightPostTag = highlightPostTag;
+ HighlightPreTag = highlightPreTag;
+ MinimumCoverage = minimumCoverage;
+ SearchFieldsRaw = searchFieldsRaw;
+ SuggesterName = suggesterName;
+ Size = size;
+ _serializedAdditionalRawData = serializedAdditionalRawData;
+ }
+ ///
+ /// A value indicating whether to use fuzzy matching for the autocomplete query.
+ /// Default is false. When set to true, the query will autocomplete terms even if
+ /// there's a substituted or missing character in the search text. While this
+ /// provides a better experience in some scenarios, it comes at a performance cost
+ /// as fuzzy autocomplete queries are slower and consume more resources.
+ ///
+ public bool? UseFuzzyMatching { get; set; }
+ ///
+ /// A string tag that is appended to hit highlights. Must be set with
+ /// highlightPreTag. If omitted, hit highlighting is disabled.
+ ///
+ public string HighlightPostTag { get; set; }
+ ///
+ /// A string tag that is prepended to hit highlights. Must be set with
+ /// highlightPostTag. If omitted, hit highlighting is disabled.
+ ///
+ public string HighlightPreTag { get; set; }
+ ///
+ /// A number between 0 and 100 indicating the percentage of the index that must be
+ /// covered by an autocomplete query in order for the query to be reported as a
+ /// success. This parameter can be useful for ensuring search availability even for
+ /// services with only one replica. The default is 80.
+ ///
+ public double? MinimumCoverage { get; set; }
+ }
+}
diff --git a/sdk/search/Azure.Search.Documents/src/Generated/AutocompleteResults.Serialization.cs b/sdk/search/Azure.Search.Documents/src/Generated/AutocompleteResults.Serialization.cs
new file mode 100644
index 000000000000..bdf3f786c526
--- /dev/null
+++ b/sdk/search/Azure.Search.Documents/src/Generated/AutocompleteResults.Serialization.cs
@@ -0,0 +1,167 @@
+// 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.Search.Documents.Models
+{
+ public partial class AutocompleteResults : IUtf8JsonSerializable, IJsonModel
+ {
+ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions);
+
+ 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)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(AutocompleteResults)} does not support writing '{format}' format.");
+ }
+
+ if (Optional.IsDefined(Coverage))
+ {
+ writer.WritePropertyName("@search.coverage"u8);
+ writer.WriteNumberValue(Coverage.Value);
+ }
+ writer.WritePropertyName("value"u8);
+ writer.WriteStartArray();
+ foreach (var item in Results)
+ {
+ writer.WriteObjectValue(item, options);
+ }
+ writer.WriteEndArray();
+ if (options.Format != "W" && _serializedAdditionalRawData != null)
+ {
+ foreach (var item in _serializedAdditionalRawData)
+ {
+ writer.WritePropertyName(item.Key);
+#if NET6_0_OR_GREATER
+ writer.WriteRawValue(item.Value);
+#else
+ using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions))
+ {
+ JsonSerializer.Serialize(writer, document.RootElement);
+ }
+#endif
+ }
+ }
+ }
+
+ AutocompleteResults IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(AutocompleteResults)} does not support reading '{format}' format.");
+ }
+
+ using JsonDocument document = JsonDocument.ParseValue(ref reader);
+ return DeserializeAutocompleteResults(document.RootElement, options);
+ }
+
+ internal static AutocompleteResults DeserializeAutocompleteResults(JsonElement element, ModelReaderWriterOptions options = null)
+ {
+ options ??= ModelSerializationExtensions.WireOptions;
+
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ double? searchCoverage = default;
+ IReadOnlyList value = default;
+ IDictionary serializedAdditionalRawData = default;
+ Dictionary rawDataDictionary = new Dictionary();
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("@search.coverage"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ searchCoverage = property.Value.GetDouble();
+ continue;
+ }
+ if (property.NameEquals("value"u8))
+ {
+ List array = new List();
+ foreach (var item in property.Value.EnumerateArray())
+ {
+ array.Add(AutocompleteItem.DeserializeAutocompleteItem(item, options));
+ }
+ value = array;
+ continue;
+ }
+ if (options.Format != "W")
+ {
+ rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText()));
+ }
+ }
+ serializedAdditionalRawData = rawDataDictionary;
+ return new AutocompleteResults(searchCoverage, value, serializedAdditionalRawData);
+ }
+
+ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ return ModelReaderWriter.Write(this, options);
+ default:
+ throw new FormatException($"The model {nameof(AutocompleteResults)} does not support writing '{options.Format}' format.");
+ }
+ }
+
+ AutocompleteResults IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ {
+ using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions);
+ return DeserializeAutocompleteResults(document.RootElement, options);
+ }
+ default:
+ throw new FormatException($"The model {nameof(AutocompleteResults)} does not support reading '{options.Format}' format.");
+ }
+ }
+
+ string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J";
+
+ /// Deserializes the model from a raw response.
+ /// The response to deserialize the model from.
+ internal static AutocompleteResults FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions);
+ return DeserializeAutocompleteResults(document.RootElement);
+ }
+
+ /// Convert into a .
+ internal virtual RequestContent ToRequestContent()
+ {
+ var content = new Utf8JsonRequestContent();
+ content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions);
+ return content;
+ }
+ }
+}
diff --git a/sdk/search/Azure.Search.Documents/src/Generated/AutocompleteResults.cs b/sdk/search/Azure.Search.Documents/src/Generated/AutocompleteResults.cs
new file mode 100644
index 000000000000..bc9d3e988a18
--- /dev/null
+++ b/sdk/search/Azure.Search.Documents/src/Generated/AutocompleteResults.cs
@@ -0,0 +1,88 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace Azure.Search.Documents.Models
+{
+ /// The result of Autocomplete query.
+ public partial class AutocompleteResults
+ {
+ ///
+ /// Keeps track of any properties unknown to the library.
+ ///
+ /// To assign an object to the value of this property use .
+ ///
+ ///
+ /// To assign an already formatted json string to this property use .
+ ///
+ ///
+ /// Examples:
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson("foo")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromString("\"foo\"")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson(new { key = "value" })
+ /// Creates a payload of { "key": "value" }.
+ ///
+ /// -
+ /// BinaryData.FromString("{\"key\": \"value\"}")
+ /// Creates a payload of { "key": "value" }.
+ ///
+ ///
+ ///
+ ///
+ private IDictionary _serializedAdditionalRawData;
+
+ /// Initializes a new instance of .
+ /// The list of returned Autocompleted items.
+ /// is null.
+ internal AutocompleteResults(IEnumerable results)
+ {
+ Argument.AssertNotNull(results, nameof(results));
+
+ Results = results.ToList();
+ }
+
+ /// Initializes a new instance of .
+ ///
+ /// A value indicating the percentage of the index that was considered by the
+ /// autocomplete request, or null if minimumCoverage was not specified in the
+ /// request.
+ ///
+ /// The list of returned Autocompleted items.
+ /// Keeps track of any properties unknown to the library.
+ internal AutocompleteResults(double? coverage, IReadOnlyList results, IDictionary serializedAdditionalRawData)
+ {
+ Coverage = coverage;
+ Results = results;
+ _serializedAdditionalRawData = serializedAdditionalRawData;
+ }
+
+ /// Initializes a new instance of for deserialization.
+ internal AutocompleteResults()
+ {
+ }
+
+ ///
+ /// A value indicating the percentage of the index that was considered by the
+ /// autocomplete request, or null if minimumCoverage was not specified in the
+ /// request.
+ ///
+ public double? Coverage { get; }
+ /// The list of returned Autocompleted items.
+ public IReadOnlyList Results { get; }
+ }
+}
diff --git a/sdk/search/Azure.Search.Documents/src/Generated/AzureActiveDirectoryApplicationCredentials.Serialization.cs b/sdk/search/Azure.Search.Documents/src/Generated/AzureActiveDirectoryApplicationCredentials.Serialization.cs
new file mode 100644
index 000000000000..8bb2ce98ff36
--- /dev/null
+++ b/sdk/search/Azure.Search.Documents/src/Generated/AzureActiveDirectoryApplicationCredentials.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.Search.Documents
+{
+ public partial class AzureActiveDirectoryApplicationCredentials : IUtf8JsonSerializable, IJsonModel
+ {
+ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions);
+
+ 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)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(AzureActiveDirectoryApplicationCredentials)} does not support writing '{format}' format.");
+ }
+
+ writer.WritePropertyName("applicationId"u8);
+ writer.WriteStringValue(ApplicationId);
+ if (Optional.IsDefined(ApplicationSecret))
+ {
+ writer.WritePropertyName("applicationSecret"u8);
+ writer.WriteStringValue(ApplicationSecret);
+ }
+ if (options.Format != "W" && _serializedAdditionalRawData != null)
+ {
+ foreach (var item in _serializedAdditionalRawData)
+ {
+ writer.WritePropertyName(item.Key);
+#if NET6_0_OR_GREATER
+ writer.WriteRawValue(item.Value);
+#else
+ using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions))
+ {
+ JsonSerializer.Serialize(writer, document.RootElement);
+ }
+#endif
+ }
+ }
+ }
+
+ AzureActiveDirectoryApplicationCredentials IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(AzureActiveDirectoryApplicationCredentials)} does not support reading '{format}' format.");
+ }
+
+ using JsonDocument document = JsonDocument.ParseValue(ref reader);
+ return DeserializeAzureActiveDirectoryApplicationCredentials(document.RootElement, options);
+ }
+
+ internal static AzureActiveDirectoryApplicationCredentials DeserializeAzureActiveDirectoryApplicationCredentials(JsonElement element, ModelReaderWriterOptions options = null)
+ {
+ options ??= ModelSerializationExtensions.WireOptions;
+
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ string applicationId = default;
+ string applicationSecret = default;
+ IDictionary serializedAdditionalRawData = default;
+ Dictionary rawDataDictionary = new Dictionary();
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("applicationId"u8))
+ {
+ applicationId = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("applicationSecret"u8))
+ {
+ applicationSecret = property.Value.GetString();
+ continue;
+ }
+ if (options.Format != "W")
+ {
+ rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText()));
+ }
+ }
+ serializedAdditionalRawData = rawDataDictionary;
+ return new AzureActiveDirectoryApplicationCredentials(applicationId, applicationSecret, serializedAdditionalRawData);
+ }
+
+ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ return ModelReaderWriter.Write(this, options);
+ default:
+ throw new FormatException($"The model {nameof(AzureActiveDirectoryApplicationCredentials)} does not support writing '{options.Format}' format.");
+ }
+ }
+
+ AzureActiveDirectoryApplicationCredentials IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ {
+ using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions);
+ return DeserializeAzureActiveDirectoryApplicationCredentials(document.RootElement, options);
+ }
+ default:
+ throw new FormatException($"The model {nameof(AzureActiveDirectoryApplicationCredentials)} does not support reading '{options.Format}' format.");
+ }
+ }
+
+ string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J";
+
+ /// Deserializes the model from a raw response.
+ /// The response to deserialize the model from.
+ internal static AzureActiveDirectoryApplicationCredentials FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions);
+ return DeserializeAzureActiveDirectoryApplicationCredentials(document.RootElement);
+ }
+
+ /// Convert into a .
+ internal virtual RequestContent ToRequestContent()
+ {
+ var content = new Utf8JsonRequestContent();
+ content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions);
+ return content;
+ }
+ }
+}
diff --git a/sdk/search/Azure.Search.Documents/src/Generated/AzureActiveDirectoryApplicationCredentials.cs b/sdk/search/Azure.Search.Documents/src/Generated/AzureActiveDirectoryApplicationCredentials.cs
new file mode 100644
index 000000000000..34c4ab2b23b5
--- /dev/null
+++ b/sdk/search/Azure.Search.Documents/src/Generated/AzureActiveDirectoryApplicationCredentials.cs
@@ -0,0 +1,97 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+
+namespace Azure.Search.Documents
+{
+ ///
+ /// Credentials of a registered application created for your search service, used
+ /// for authenticated access to the encryption keys stored in Azure Key Vault.
+ ///
+ public partial class AzureActiveDirectoryApplicationCredentials
+ {
+ ///
+ /// Keeps track of any properties unknown to the library.
+ ///
+ /// To assign an object to the value of this property use .
+ ///
+ ///
+ /// To assign an already formatted json string to this property use .
+ ///
+ ///
+ /// Examples:
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson("foo")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromString("\"foo\"")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson(new { key = "value" })
+ /// Creates a payload of { "key": "value" }.
+ ///
+ /// -
+ /// BinaryData.FromString("{\"key\": \"value\"}")
+ /// Creates a payload of { "key": "value" }.
+ ///
+ ///
+ ///
+ ///
+ private IDictionary _serializedAdditionalRawData;
+
+ /// Initializes a new instance of .
+ ///
+ /// An AAD Application ID that was granted the required access permissions to the
+ /// Azure Key Vault that is to be used when encrypting your data at rest. The
+ /// Application ID should not be confused with the Object ID for your AAD
+ /// Application.
+ ///
+ /// is null.
+ public AzureActiveDirectoryApplicationCredentials(string applicationId)
+ {
+ Argument.AssertNotNull(applicationId, nameof(applicationId));
+
+ ApplicationId = applicationId;
+ }
+
+ /// Initializes a new instance of .
+ ///
+ /// An AAD Application ID that was granted the required access permissions to the
+ /// Azure Key Vault that is to be used when encrypting your data at rest. The
+ /// Application ID should not be confused with the Object ID for your AAD
+ /// Application.
+ ///
+ /// The authentication key of the specified AAD application.
+ /// Keeps track of any properties unknown to the library.
+ internal AzureActiveDirectoryApplicationCredentials(string applicationId, string applicationSecret, IDictionary serializedAdditionalRawData)
+ {
+ ApplicationId = applicationId;
+ ApplicationSecret = applicationSecret;
+ _serializedAdditionalRawData = serializedAdditionalRawData;
+ }
+
+ /// Initializes a new instance of for deserialization.
+ internal AzureActiveDirectoryApplicationCredentials()
+ {
+ }
+
+ ///
+ /// An AAD Application ID that was granted the required access permissions to the
+ /// Azure Key Vault that is to be used when encrypting your data at rest. The
+ /// Application ID should not be confused with the Object ID for your AAD
+ /// Application.
+ ///
+ public string ApplicationId { get; set; }
+ /// The authentication key of the specified AAD application.
+ public string ApplicationSecret { get; set; }
+ }
+}
diff --git a/sdk/search/Azure.Search.Documents/src/Generated/AzureMachineLearningParameters.Serialization.cs b/sdk/search/Azure.Search.Documents/src/Generated/AzureMachineLearningParameters.Serialization.cs
new file mode 100644
index 000000000000..c9ddc3795c83
--- /dev/null
+++ b/sdk/search/Azure.Search.Documents/src/Generated/AzureMachineLearningParameters.Serialization.cs
@@ -0,0 +1,212 @@
+// 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.Search.Documents
+{
+ public partial class AzureMachineLearningParameters : IUtf8JsonSerializable, IJsonModel
+ {
+ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions);
+
+ 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)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(AzureMachineLearningParameters)} does not support writing '{format}' format.");
+ }
+
+ writer.WritePropertyName("uri"u8);
+ writer.WriteStringValue(ScoringUri.AbsoluteUri);
+ if (Optional.IsDefined(AuthenticationKey))
+ {
+ writer.WritePropertyName("key"u8);
+ writer.WriteStringValue(AuthenticationKey);
+ }
+ if (Optional.IsDefined(ResourceId))
+ {
+ writer.WritePropertyName("resourceId"u8);
+ writer.WriteStringValue(ResourceId);
+ }
+ if (Optional.IsDefined(Timeout))
+ {
+ writer.WritePropertyName("timeout"u8);
+ writer.WriteStringValue(Timeout.Value, "P");
+ }
+ if (Optional.IsDefined(Region))
+ {
+ writer.WritePropertyName("region"u8);
+ writer.WriteStringValue(Region);
+ }
+ if (Optional.IsDefined(ModelName))
+ {
+ writer.WritePropertyName("modelName"u8);
+ writer.WriteStringValue(ModelName.Value.ToString());
+ }
+ if (options.Format != "W" && _serializedAdditionalRawData != null)
+ {
+ foreach (var item in _serializedAdditionalRawData)
+ {
+ writer.WritePropertyName(item.Key);
+#if NET6_0_OR_GREATER
+ writer.WriteRawValue(item.Value);
+#else
+ using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions))
+ {
+ JsonSerializer.Serialize(writer, document.RootElement);
+ }
+#endif
+ }
+ }
+ }
+
+ AzureMachineLearningParameters IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(AzureMachineLearningParameters)} does not support reading '{format}' format.");
+ }
+
+ using JsonDocument document = JsonDocument.ParseValue(ref reader);
+ return DeserializeAzureMachineLearningParameters(document.RootElement, options);
+ }
+
+ internal static AzureMachineLearningParameters DeserializeAzureMachineLearningParameters(JsonElement element, ModelReaderWriterOptions options = null)
+ {
+ options ??= ModelSerializationExtensions.WireOptions;
+
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ Uri uri = default;
+ string key = default;
+ string resourceId = default;
+ TimeSpan? timeout = default;
+ string region = default;
+ AIFoundryModelCatalogName? modelName = default;
+ IDictionary serializedAdditionalRawData = default;
+ Dictionary rawDataDictionary = new Dictionary();
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("uri"u8))
+ {
+ uri = new Uri(property.Value.GetString());
+ continue;
+ }
+ if (property.NameEquals("key"u8))
+ {
+ key = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("resourceId"u8))
+ {
+ resourceId = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("timeout"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ timeout = property.Value.GetTimeSpan("P");
+ continue;
+ }
+ if (property.NameEquals("region"u8))
+ {
+ region = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("modelName"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ modelName = new AIFoundryModelCatalogName(property.Value.GetString());
+ continue;
+ }
+ if (options.Format != "W")
+ {
+ rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText()));
+ }
+ }
+ serializedAdditionalRawData = rawDataDictionary;
+ return new AzureMachineLearningParameters(
+ uri,
+ key,
+ resourceId,
+ timeout,
+ region,
+ modelName,
+ serializedAdditionalRawData);
+ }
+
+ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ return ModelReaderWriter.Write(this, options);
+ default:
+ throw new FormatException($"The model {nameof(AzureMachineLearningParameters)} does not support writing '{options.Format}' format.");
+ }
+ }
+
+ AzureMachineLearningParameters IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ {
+ using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions);
+ return DeserializeAzureMachineLearningParameters(document.RootElement, options);
+ }
+ default:
+ throw new FormatException($"The model {nameof(AzureMachineLearningParameters)} does not support reading '{options.Format}' format.");
+ }
+ }
+
+ string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J";
+
+ /// Deserializes the model from a raw response.
+ /// The response to deserialize the model from.
+ internal static AzureMachineLearningParameters FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions);
+ return DeserializeAzureMachineLearningParameters(document.RootElement);
+ }
+
+ /// Convert into a .
+ internal virtual RequestContent ToRequestContent()
+ {
+ var content = new Utf8JsonRequestContent();
+ content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions);
+ return content;
+ }
+ }
+}
diff --git a/sdk/search/Azure.Search.Documents/src/Generated/AzureMachineLearningParameters.cs b/sdk/search/Azure.Search.Documents/src/Generated/AzureMachineLearningParameters.cs
new file mode 100644
index 000000000000..08f98e4f5ba5
--- /dev/null
+++ b/sdk/search/Azure.Search.Documents/src/Generated/AzureMachineLearningParameters.cs
@@ -0,0 +1,127 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+
+namespace Azure.Search.Documents
+{
+ /// Specifies the properties for connecting to an AML vectorizer.
+ public partial class AzureMachineLearningParameters
+ {
+ ///
+ /// Keeps track of any properties unknown to the library.
+ ///
+ /// To assign an object to the value of this property use