diff --git a/sdk/agricultureplatform/Microsoft.AgriculturePlatform/Microsoft.AgriculturePlatform.sln b/sdk/agricultureplatform/Microsoft.AgriculturePlatform/Microsoft.AgriculturePlatform.sln
new file mode 100644
index 000000000000..c01c07f53130
--- /dev/null
+++ b/sdk/agricultureplatform/Microsoft.AgriculturePlatform/Microsoft.AgriculturePlatform.sln
@@ -0,0 +1,50 @@
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.29709.97
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.AgriculturePlatform", "src\Microsoft.AgriculturePlatform.csproj", "{28FF4005-4467-4E36-92E7-DEA27DEB1519}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.AgriculturePlatform.Tests", "tests\Microsoft.AgriculturePlatform.Tests.csproj", "{1F1CD1D4-9932-4B73-99D8-C252A67D4B46}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Release|Any CPU.Build.0 = Release|Any CPU
+ {8E9A77AC-792A-4432-8320-ACFD46730401}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {8E9A77AC-792A-4432-8320-ACFD46730401}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {8E9A77AC-792A-4432-8320-ACFD46730401}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {8E9A77AC-792A-4432-8320-ACFD46730401}.Release|Any CPU.Build.0 = Release|Any CPU
+ {A4241C1F-A53D-474C-9E4E-075054407E74}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {A4241C1F-A53D-474C-9E4E-075054407E74}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {A4241C1F-A53D-474C-9E4E-075054407E74}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {A4241C1F-A53D-474C-9E4E-075054407E74}.Release|Any CPU.Build.0 = Release|Any CPU
+ {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Release|Any CPU.Build.0 = Release|Any CPU
+ {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Release|Any CPU.Build.0 = Release|Any CPU
+ {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Release|Any CPU.Build.0 = Release|Any CPU
+ {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {A97F4B90-2591-4689-B1F8-5F21FE6D6CAE}
+ EndGlobalSection
+EndGlobal
diff --git a/sdk/agricultureplatform/Microsoft.AgriculturePlatform/src/Generated/AcceptHeaderEnum.cs b/sdk/agricultureplatform/Microsoft.AgriculturePlatform/src/Generated/AcceptHeaderEnum.cs
new file mode 100644
index 000000000000..266cc0780ce4
--- /dev/null
+++ b/sdk/agricultureplatform/Microsoft.AgriculturePlatform/src/Generated/AcceptHeaderEnum.cs
@@ -0,0 +1,51 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.ComponentModel;
+
+namespace Microsoft.AgriculturePlatform
+{
+ /// enum for request "accept" header.
+ public readonly partial struct AcceptHeaderEnum : IEquatable
+ {
+ private readonly string _value;
+
+ /// Initializes a new instance of .
+ /// is null.
+ public AcceptHeaderEnum(string value)
+ {
+ _value = value ?? throw new ArgumentNullException(nameof(value));
+ }
+
+ private const string JsonValue = "application/json";
+ private const string OctetStreamValue = "application/octet-stream";
+
+ /// application/json.
+ public static AcceptHeaderEnum Json { get; } = new AcceptHeaderEnum(JsonValue);
+ /// application/octet-stream.
+ public static AcceptHeaderEnum OctetStream { get; } = new AcceptHeaderEnum(OctetStreamValue);
+ /// Determines if two values are the same.
+ public static bool operator ==(AcceptHeaderEnum left, AcceptHeaderEnum right) => left.Equals(right);
+ /// Determines if two values are not the same.
+ public static bool operator !=(AcceptHeaderEnum left, AcceptHeaderEnum right) => !left.Equals(right);
+ /// Converts a to a .
+ public static implicit operator AcceptHeaderEnum(string value) => new AcceptHeaderEnum(value);
+
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override bool Equals(object obj) => obj is AcceptHeaderEnum other && Equals(other);
+ ///
+ public bool Equals(AcceptHeaderEnum 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/agricultureplatform/Microsoft.AgriculturePlatform/src/Generated/AgriculturePlatformClient.cs b/sdk/agricultureplatform/Microsoft.AgriculturePlatform/src/Generated/AgriculturePlatformClient.cs
new file mode 100644
index 000000000000..44acf107ca66
--- /dev/null
+++ b/sdk/agricultureplatform/Microsoft.AgriculturePlatform/src/Generated/AgriculturePlatformClient.cs
@@ -0,0 +1,140 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using Azure;
+using Azure.Core;
+using Azure.Core.Pipeline;
+
+namespace Microsoft.AgriculturePlatform
+{
+ // Data plane generated client.
+ /// APIs documentation for Azure AgPlatform DataPlane Service.
+ public partial class AgriculturePlatformClient
+ {
+ private const string AuthorizationHeader = "Authorization";
+ private readonly AzureKeyCredential _keyCredential;
+ private readonly HttpPipeline _pipeline;
+ private readonly Uri _endpoint;
+
+ /// 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 AgriculturePlatformClient for mocking.
+ protected AgriculturePlatformClient()
+ {
+ }
+
+ /// Initializes a new instance of AgriculturePlatformClient.
+ /// The to use.
+ /// A credential used to authenticate to an Azure Service.
+ /// or is null.
+ public AgriculturePlatformClient(Uri endpoint, AzureKeyCredential credential) : this(endpoint, credential, new AgriculturePlatformClientOptions())
+ {
+ }
+
+ /// Initializes a new instance of AgriculturePlatformClient.
+ /// The to use.
+ /// A credential used to authenticate to an Azure Service.
+ /// The options for configuring the client.
+ /// or is null.
+ public AgriculturePlatformClient(Uri endpoint, AzureKeyCredential credential, AgriculturePlatformClientOptions options)
+ {
+ Argument.AssertNotNull(endpoint, nameof(endpoint));
+ Argument.AssertNotNull(credential, nameof(credential));
+ options ??= new AgriculturePlatformClientOptions();
+
+ ClientDiagnostics = new ClientDiagnostics(options, true);
+ _keyCredential = credential;
+ _pipeline = HttpPipelineBuilder.Build(options, Array.Empty(), new HttpPipelinePolicy[] { new AzureKeyCredentialPolicy(_keyCredential, AuthorizationHeader) }, new ResponseClassifier());
+ _endpoint = endpoint;
+ }
+
+ /// Initializes a new instance of Catalogs.
+ /// The API version to use for this operation.
+ /// is null.
+ public virtual Catalogs GetCatalogsClient(string apiVersion = "2024-11-01-preview")
+ {
+ Argument.AssertNotNull(apiVersion, nameof(apiVersion));
+
+ return new Catalogs(ClientDiagnostics, _pipeline, _keyCredential, _endpoint, apiVersion);
+ }
+
+ /// Initializes a new instance of Collections.
+ /// The API version to use for this operation.
+ /// is null.
+ public virtual Collections GetCollectionsClient(string apiVersion = "2024-11-01-preview")
+ {
+ Argument.AssertNotNull(apiVersion, nameof(apiVersion));
+
+ return new Collections(ClientDiagnostics, _pipeline, _keyCredential, _endpoint, apiVersion);
+ }
+
+ /// Initializes a new instance of File.
+ /// The API version to use for this operation.
+ /// is null.
+ public virtual File GetFileClient(string apiVersion = "2024-11-01-preview")
+ {
+ Argument.AssertNotNull(apiVersion, nameof(apiVersion));
+
+ return new File(ClientDiagnostics, _pipeline, _keyCredential, _endpoint, apiVersion);
+ }
+
+ /// Initializes a new instance of Items.
+ /// The API version to use for this operation.
+ /// is null.
+ public virtual Items GetItemsClient(string apiVersion = "2024-11-01-preview")
+ {
+ Argument.AssertNotNull(apiVersion, nameof(apiVersion));
+
+ return new Items(ClientDiagnostics, _pipeline, _keyCredential, _endpoint, apiVersion);
+ }
+
+ /// Initializes a new instance of Satellite.
+ /// The API version to use for this operation.
+ /// is null.
+ public virtual Satellite GetSatelliteClient(string apiVersion = "2024-11-01-preview")
+ {
+ Argument.AssertNotNull(apiVersion, nameof(apiVersion));
+
+ return new Satellite(ClientDiagnostics, _pipeline, _keyCredential, _endpoint, apiVersion);
+ }
+
+ /// Initializes a new instance of Schemas.
+ /// The API version to use for this operation.
+ /// is null.
+ public virtual Schemas GetSchemasClient(string apiVersion = "2024-11-01-preview")
+ {
+ Argument.AssertNotNull(apiVersion, nameof(apiVersion));
+
+ return new Schemas(ClientDiagnostics, _pipeline, _keyCredential, _endpoint, apiVersion);
+ }
+
+ /// Initializes a new instance of Solutions.
+ /// The API version to use for this operation.
+ /// is null.
+ public virtual Solutions GetSolutionsClient(string apiVersion = "2024-11-01-preview")
+ {
+ Argument.AssertNotNull(apiVersion, nameof(apiVersion));
+
+ return new Solutions(ClientDiagnostics, _pipeline, _keyCredential, _endpoint, apiVersion);
+ }
+
+ /// Initializes a new instance of Weather.
+ /// The API version to use for this operation.
+ /// is null.
+ public virtual Weather GetWeatherClient(string apiVersion = "2024-11-01-preview")
+ {
+ Argument.AssertNotNull(apiVersion, nameof(apiVersion));
+
+ return new Weather(ClientDiagnostics, _pipeline, _keyCredential, _endpoint, apiVersion);
+ }
+ }
+}
diff --git a/sdk/agricultureplatform/Microsoft.AgriculturePlatform/src/Generated/AgriculturePlatformClientOptions.cs b/sdk/agricultureplatform/Microsoft.AgriculturePlatform/src/Generated/AgriculturePlatformClientOptions.cs
new file mode 100644
index 000000000000..b3f89b6bafac
--- /dev/null
+++ b/sdk/agricultureplatform/Microsoft.AgriculturePlatform/src/Generated/AgriculturePlatformClientOptions.cs
@@ -0,0 +1,37 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using Azure.Core;
+
+namespace Microsoft.AgriculturePlatform
+{
+ /// Client options for AgriculturePlatformClient.
+ public partial class AgriculturePlatformClientOptions : ClientOptions
+ {
+ private const ServiceVersion LatestVersion = ServiceVersion.V2024_11_01_Preview;
+
+ /// The version of the service to use.
+ public enum ServiceVersion
+ {
+ /// Service version "2024-11-01-preview".
+ V2024_11_01_Preview = 1,
+ }
+
+ internal string Version { get; }
+
+ /// Initializes new instance of AgriculturePlatformClientOptions.
+ public AgriculturePlatformClientOptions(ServiceVersion version = LatestVersion)
+ {
+ Version = version switch
+ {
+ ServiceVersion.V2024_11_01_Preview => "2024-11-01-preview",
+ _ => throw new NotSupportedException()
+ };
+ }
+ }
+}
diff --git a/sdk/agricultureplatform/Microsoft.AgriculturePlatform/src/Generated/ApiKeyAuthCredentials.Serialization.cs b/sdk/agricultureplatform/Microsoft.AgriculturePlatform/src/Generated/ApiKeyAuthCredentials.Serialization.cs
new file mode 100644
index 000000000000..1eaafbad4478
--- /dev/null
+++ b/sdk/agricultureplatform/Microsoft.AgriculturePlatform/src/Generated/ApiKeyAuthCredentials.Serialization.cs
@@ -0,0 +1,135 @@
+// 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;
+using Azure.Core;
+
+namespace Microsoft.AgriculturePlatform
+{
+ public partial class ApiKeyAuthCredentials : 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(ApiKeyAuthCredentials)} does not support writing '{format}' format.");
+ }
+
+ base.JsonModelWriteCore(writer, options);
+ writer.WritePropertyName("apiKey"u8);
+ writer.WriteObjectValue(ApiKey, options);
+ }
+
+ ApiKeyAuthCredentials 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(ApiKeyAuthCredentials)} does not support reading '{format}' format.");
+ }
+
+ using JsonDocument document = JsonDocument.ParseValue(ref reader);
+ return DeserializeApiKeyAuthCredentials(document.RootElement, options);
+ }
+
+ internal static ApiKeyAuthCredentials DeserializeApiKeyAuthCredentials(JsonElement element, ModelReaderWriterOptions options = null)
+ {
+ options ??= ModelSerializationExtensions.WireOptions;
+
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ KeyVaultProperties apiKey = default;
+ AuthCredentialsKind kind = default;
+ IDictionary serializedAdditionalRawData = default;
+ Dictionary rawDataDictionary = new Dictionary();
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("apiKey"u8))
+ {
+ apiKey = KeyVaultProperties.DeserializeKeyVaultProperties(property.Value, options);
+ continue;
+ }
+ if (property.NameEquals("kind"u8))
+ {
+ kind = new AuthCredentialsKind(property.Value.GetString());
+ continue;
+ }
+ if (options.Format != "W")
+ {
+ rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText()));
+ }
+ }
+ serializedAdditionalRawData = rawDataDictionary;
+ return new ApiKeyAuthCredentials(kind, serializedAdditionalRawData, apiKey);
+ }
+
+ 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(ApiKeyAuthCredentials)} does not support writing '{options.Format}' format.");
+ }
+ }
+
+ ApiKeyAuthCredentials 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 DeserializeApiKeyAuthCredentials(document.RootElement, options);
+ }
+ default:
+ throw new FormatException($"The model {nameof(ApiKeyAuthCredentials)} 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 ApiKeyAuthCredentials FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions);
+ return DeserializeApiKeyAuthCredentials(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/agricultureplatform/Microsoft.AgriculturePlatform/src/Generated/ApiKeyAuthCredentials.cs b/sdk/agricultureplatform/Microsoft.AgriculturePlatform/src/Generated/ApiKeyAuthCredentials.cs
new file mode 100644
index 000000000000..099a63ae67a1
--- /dev/null
+++ b/sdk/agricultureplatform/Microsoft.AgriculturePlatform/src/Generated/ApiKeyAuthCredentials.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 Microsoft.AgriculturePlatform
+{
+ /// Api Key Auth Credentials class for API Key based Auth.
+ public partial class ApiKeyAuthCredentials : AuthCredentials
+ {
+ /// Initializes a new instance of .
+ /// Properties of the key vault.
+ /// is null.
+ public ApiKeyAuthCredentials(KeyVaultProperties apiKey)
+ {
+ Argument.AssertNotNull(apiKey, nameof(apiKey));
+
+ Kind = AuthCredentialsKind.ApiKeyAuthCredentials;
+ ApiKey = apiKey;
+ }
+
+ /// Initializes a new instance of .
+ /// Enum for different types of AuthCredentials supported.
+ /// Keeps track of any properties unknown to the library.
+ /// Properties of the key vault.
+ internal ApiKeyAuthCredentials(AuthCredentialsKind kind, IDictionary serializedAdditionalRawData, KeyVaultProperties apiKey) : base(kind, serializedAdditionalRawData)
+ {
+ ApiKey = apiKey;
+ }
+
+ /// Initializes a new instance of for deserialization.
+ internal ApiKeyAuthCredentials()
+ {
+ }
+
+ /// Properties of the key vault.
+ public KeyVaultProperties ApiKey { get; }
+ }
+}
diff --git a/sdk/agricultureplatform/Microsoft.AgriculturePlatform/src/Generated/Asset.Serialization.cs b/sdk/agricultureplatform/Microsoft.AgriculturePlatform/src/Generated/Asset.Serialization.cs
new file mode 100644
index 000000000000..bd552bb1cf06
--- /dev/null
+++ b/sdk/agricultureplatform/Microsoft.AgriculturePlatform/src/Generated/Asset.Serialization.cs
@@ -0,0 +1,172 @@
+// 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;
+using Azure.Core;
+
+namespace Microsoft.AgriculturePlatform
+{
+ public partial class Asset : 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(Asset)} does not support writing '{format}' format.");
+ }
+
+ if (Optional.IsDefined(Type))
+ {
+ writer.WritePropertyName("type"u8);
+ writer.WriteStringValue(Type.Value.ToString());
+ }
+ if (Optional.IsDefined(Name))
+ {
+ writer.WritePropertyName("name"u8);
+ writer.WriteStringValue(Name);
+ }
+ if (Optional.IsDefined(Href))
+ {
+ writer.WritePropertyName("href"u8);
+ writer.WriteStringValue(Href);
+ }
+ 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
+ }
+ }
+ }
+
+ Asset 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(Asset)} does not support reading '{format}' format.");
+ }
+
+ using JsonDocument document = JsonDocument.ParseValue(ref reader);
+ return DeserializeAsset(document.RootElement, options);
+ }
+
+ internal static Asset DeserializeAsset(JsonElement element, ModelReaderWriterOptions options = null)
+ {
+ options ??= ModelSerializationExtensions.WireOptions;
+
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ DataFormat? type = default;
+ string name = default;
+ string href = default;
+ IDictionary serializedAdditionalRawData = default;
+ Dictionary rawDataDictionary = new Dictionary();
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("type"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ type = new DataFormat(property.Value.GetString());
+ continue;
+ }
+ if (property.NameEquals("name"u8))
+ {
+ name = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("href"u8))
+ {
+ href = property.Value.GetString();
+ continue;
+ }
+ if (options.Format != "W")
+ {
+ rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText()));
+ }
+ }
+ serializedAdditionalRawData = rawDataDictionary;
+ return new Asset(type, name, href, 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(Asset)} does not support writing '{options.Format}' format.");
+ }
+ }
+
+ Asset 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 DeserializeAsset(document.RootElement, options);
+ }
+ default:
+ throw new FormatException($"The model {nameof(Asset)} 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 Asset FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions);
+ return DeserializeAsset(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/agricultureplatform/Microsoft.AgriculturePlatform/src/Generated/Asset.cs b/sdk/agricultureplatform/Microsoft.AgriculturePlatform/src/Generated/Asset.cs
new file mode 100644
index 000000000000..ac69508207dc
--- /dev/null
+++ b/sdk/agricultureplatform/Microsoft.AgriculturePlatform/src/Generated/Asset.cs
@@ -0,0 +1,73 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+
+namespace Microsoft.AgriculturePlatform
+{
+ /// Asset.
+ public partial class Asset
+ {
+ ///
+ /// 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 .
+ public Asset()
+ {
+ }
+
+ /// Initializes a new instance of .
+ /// Type of dataset.
+ /// Name.
+ /// Href.
+ /// Keeps track of any properties unknown to the library.
+ internal Asset(DataFormat? type, string name, string href, IDictionary serializedAdditionalRawData)
+ {
+ Type = type;
+ Name = name;
+ Href = href;
+ _serializedAdditionalRawData = serializedAdditionalRawData;
+ }
+
+ /// Type of dataset.
+ public DataFormat? Type { get; set; }
+ /// Name.
+ public string Name { get; set; }
+ /// Href.
+ public string Href { get; set; }
+ }
+}
diff --git a/sdk/agricultureplatform/Microsoft.AgriculturePlatform/src/Generated/AuthCredentials.Serialization.cs b/sdk/agricultureplatform/Microsoft.AgriculturePlatform/src/Generated/AuthCredentials.Serialization.cs
new file mode 100644
index 000000000000..668cb79cde84
--- /dev/null
+++ b/sdk/agricultureplatform/Microsoft.AgriculturePlatform/src/Generated/AuthCredentials.Serialization.cs
@@ -0,0 +1,135 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.ClientModel.Primitives;
+using System.Text.Json;
+using Azure;
+using Azure.Core;
+
+namespace Microsoft.AgriculturePlatform
+{
+ [PersistableModelProxy(typeof(UnknownAuthCredentials))]
+ public partial class AuthCredentials : 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(AuthCredentials)} does not support writing '{format}' format.");
+ }
+
+ writer.WritePropertyName("kind"u8);
+ writer.WriteStringValue(Kind.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
+ }
+ }
+ }
+
+ AuthCredentials 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(AuthCredentials)} does not support reading '{format}' format.");
+ }
+
+ using JsonDocument document = JsonDocument.ParseValue(ref reader);
+ return DeserializeAuthCredentials(document.RootElement, options);
+ }
+
+ internal static AuthCredentials DeserializeAuthCredentials(JsonElement element, ModelReaderWriterOptions options = null)
+ {
+ options ??= ModelSerializationExtensions.WireOptions;
+
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ if (element.TryGetProperty("kind", out JsonElement discriminator))
+ {
+ switch (discriminator.GetString())
+ {
+ case "ApiKeyAuthCredentials": return ApiKeyAuthCredentials.DeserializeApiKeyAuthCredentials(element, options);
+ case "OAuthClientCredentials": return OauthClientCredentials.DeserializeOauthClientCredentials(element, options);
+ }
+ }
+ return UnknownAuthCredentials.DeserializeUnknownAuthCredentials(element, options);
+ }
+
+ 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(AuthCredentials)} does not support writing '{options.Format}' format.");
+ }
+ }
+
+ AuthCredentials 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 DeserializeAuthCredentials(document.RootElement, options);
+ }
+ default:
+ throw new FormatException($"The model {nameof(AuthCredentials)} 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 AuthCredentials FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions);
+ return DeserializeAuthCredentials(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/agricultureplatform/Microsoft.AgriculturePlatform/src/Generated/AuthCredentials.cs b/sdk/agricultureplatform/Microsoft.AgriculturePlatform/src/Generated/AuthCredentials.cs
new file mode 100644
index 000000000000..460fd04a0765
--- /dev/null
+++ b/sdk/agricultureplatform/Microsoft.AgriculturePlatform/src/Generated/AuthCredentials.cs
@@ -0,0 +1,69 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+
+namespace Microsoft.AgriculturePlatform
+{
+ ///
+ /// AuthCredentials abstract base class for Auth Purpose.
+ /// 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 abstract partial class AuthCredentials
+ {
+ ///
+ /// 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 protected IDictionary _serializedAdditionalRawData;
+
+ /// Initializes a new instance of .
+ protected AuthCredentials()
+ {
+ }
+
+ /// Initializes a new instance of .
+ /// Enum for different types of AuthCredentials supported.
+ /// Keeps track of any properties unknown to the library.
+ internal AuthCredentials(AuthCredentialsKind kind, IDictionary serializedAdditionalRawData)
+ {
+ Kind = kind;
+ _serializedAdditionalRawData = serializedAdditionalRawData;
+ }
+
+ /// Enum for different types of AuthCredentials supported.
+ internal AuthCredentialsKind Kind { get; set; }
+ }
+}
diff --git a/sdk/agricultureplatform/Microsoft.AgriculturePlatform/src/Generated/AuthCredentialsKind.cs b/sdk/agricultureplatform/Microsoft.AgriculturePlatform/src/Generated/AuthCredentialsKind.cs
new file mode 100644
index 000000000000..85b9b87dca89
--- /dev/null
+++ b/sdk/agricultureplatform/Microsoft.AgriculturePlatform/src/Generated/AuthCredentialsKind.cs
@@ -0,0 +1,51 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.ComponentModel;
+
+namespace Microsoft.AgriculturePlatform
+{
+ /// Enum for different types of AuthCredentials supported.
+ internal readonly partial struct AuthCredentialsKind : IEquatable
+ {
+ private readonly string _value;
+
+ /// Initializes a new instance of .
+ /// is null.
+ public AuthCredentialsKind(string value)
+ {
+ _value = value ?? throw new ArgumentNullException(nameof(value));
+ }
+
+ private const string OAuthClientCredentialsValue = "OAuthClientCredentials";
+ private const string ApiKeyAuthCredentialsValue = "ApiKeyAuthCredentials";
+
+ /// OAuthClientCredentials.
+ public static AuthCredentialsKind OAuthClientCredentials { get; } = new AuthCredentialsKind(OAuthClientCredentialsValue);
+ /// ApiKeyAuthCredentials.
+ public static AuthCredentialsKind ApiKeyAuthCredentials { get; } = new AuthCredentialsKind(ApiKeyAuthCredentialsValue);
+ /// Determines if two values are the same.
+ public static bool operator ==(AuthCredentialsKind left, AuthCredentialsKind right) => left.Equals(right);
+ /// Determines if two values are not the same.
+ public static bool operator !=(AuthCredentialsKind left, AuthCredentialsKind right) => !left.Equals(right);
+ /// Converts a to a .
+ public static implicit operator AuthCredentialsKind(string value) => new AuthCredentialsKind(value);
+
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override bool Equals(object obj) => obj is AuthCredentialsKind other && Equals(other);
+ ///
+ public bool Equals(AuthCredentialsKind 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/agricultureplatform/Microsoft.AgriculturePlatform/src/Generated/CancelJobRequest.Serialization.cs b/sdk/agricultureplatform/Microsoft.AgriculturePlatform/src/Generated/CancelJobRequest.Serialization.cs
new file mode 100644
index 000000000000..c8d8e5f3a8c9
--- /dev/null
+++ b/sdk/agricultureplatform/Microsoft.AgriculturePlatform/src/Generated/CancelJobRequest.Serialization.cs
@@ -0,0 +1,227 @@
+// 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;
+using Azure.Core;
+
+namespace Microsoft.AgriculturePlatform
+{
+ internal partial class CancelJobRequest : 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(CancelJobRequest)} does not support writing '{format}' format.");
+ }
+
+ writer.WritePropertyName("solutionId"u8);
+ writer.WriteStringValue(SolutionId);
+ writer.WritePropertyName("requestPath"u8);
+ writer.WriteStringValue(RequestPath);
+ writer.WritePropertyName("partnerRequestBody"u8);
+ writer.WriteStartObject();
+ foreach (var item in PartnerRequestBody)
+ {
+ writer.WritePropertyName(item.Key);
+ if (item.Value == null)
+ {
+ writer.WriteNullValue();
+ continue;
+ }
+#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
+ }
+ writer.WriteEndObject();
+ writer.WritePropertyName("partnerRequestHeaders"u8);
+ writer.WriteStartObject();
+ foreach (var item in PartnerRequestHeaders)
+ {
+ writer.WritePropertyName(item.Key);
+ if (item.Value == null)
+ {
+ writer.WriteNullValue();
+ continue;
+ }
+#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
+ }
+ writer.WriteEndObject();
+ 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
+ }
+ }
+ }
+
+ CancelJobRequest 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(CancelJobRequest)} does not support reading '{format}' format.");
+ }
+
+ using JsonDocument document = JsonDocument.ParseValue(ref reader);
+ return DeserializeCancelJobRequest(document.RootElement, options);
+ }
+
+ internal static CancelJobRequest DeserializeCancelJobRequest(JsonElement element, ModelReaderWriterOptions options = null)
+ {
+ options ??= ModelSerializationExtensions.WireOptions;
+
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ string solutionId = default;
+ string requestPath = default;
+ IReadOnlyDictionary partnerRequestBody = default;
+ IReadOnlyDictionary partnerRequestHeaders = default;
+ IDictionary serializedAdditionalRawData = default;
+ Dictionary rawDataDictionary = new Dictionary();
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("solutionId"u8))
+ {
+ solutionId = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("requestPath"u8))
+ {
+ requestPath = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("partnerRequestBody"u8))
+ {
+ Dictionary dictionary = new Dictionary();
+ foreach (var property0 in property.Value.EnumerateObject())
+ {
+ if (property0.Value.ValueKind == JsonValueKind.Null)
+ {
+ dictionary.Add(property0.Name, null);
+ }
+ else
+ {
+ dictionary.Add(property0.Name, BinaryData.FromString(property0.Value.GetRawText()));
+ }
+ }
+ partnerRequestBody = dictionary;
+ continue;
+ }
+ if (property.NameEquals("partnerRequestHeaders"u8))
+ {
+ Dictionary dictionary = new Dictionary();
+ foreach (var property0 in property.Value.EnumerateObject())
+ {
+ if (property0.Value.ValueKind == JsonValueKind.Null)
+ {
+ dictionary.Add(property0.Name, null);
+ }
+ else
+ {
+ dictionary.Add(property0.Name, BinaryData.FromString(property0.Value.GetRawText()));
+ }
+ }
+ partnerRequestHeaders = dictionary;
+ continue;
+ }
+ if (options.Format != "W")
+ {
+ rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText()));
+ }
+ }
+ serializedAdditionalRawData = rawDataDictionary;
+ return new CancelJobRequest(solutionId, requestPath, partnerRequestBody, partnerRequestHeaders, 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(CancelJobRequest)} does not support writing '{options.Format}' format.");
+ }
+ }
+
+ CancelJobRequest 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 DeserializeCancelJobRequest(document.RootElement, options);
+ }
+ default:
+ throw new FormatException($"The model {nameof(CancelJobRequest)} 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 CancelJobRequest FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions);
+ return DeserializeCancelJobRequest(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/agricultureplatform/Microsoft.AgriculturePlatform/src/Generated/CancelJobRequest.cs b/sdk/agricultureplatform/Microsoft.AgriculturePlatform/src/Generated/CancelJobRequest.cs
new file mode 100644
index 000000000000..c6880483b504
--- /dev/null
+++ b/sdk/agricultureplatform/Microsoft.AgriculturePlatform/src/Generated/CancelJobRequest.cs
@@ -0,0 +1,154 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+
+namespace Microsoft.AgriculturePlatform
+{
+ /// The CancelJobRequest.
+ internal partial class CancelJobRequest
+ {
+ ///
+ /// 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 .
+ /// SolutionId.
+ /// RequestPath.
+ /// Properties.
+ /// Properties.
+ /// , , or is null.
+ internal CancelJobRequest(string solutionId, string requestPath, IReadOnlyDictionary partnerRequestBody, IReadOnlyDictionary partnerRequestHeaders)
+ {
+ Argument.AssertNotNull(solutionId, nameof(solutionId));
+ Argument.AssertNotNull(requestPath, nameof(requestPath));
+ Argument.AssertNotNull(partnerRequestBody, nameof(partnerRequestBody));
+ Argument.AssertNotNull(partnerRequestHeaders, nameof(partnerRequestHeaders));
+
+ SolutionId = solutionId;
+ RequestPath = requestPath;
+ PartnerRequestBody = partnerRequestBody;
+ PartnerRequestHeaders = partnerRequestHeaders;
+ }
+
+ /// Initializes a new instance of .
+ /// SolutionId.
+ /// RequestPath.
+ /// Properties.
+ /// Properties.
+ /// Keeps track of any properties unknown to the library.
+ internal CancelJobRequest(string solutionId, string requestPath, IReadOnlyDictionary partnerRequestBody, IReadOnlyDictionary partnerRequestHeaders, IDictionary serializedAdditionalRawData)
+ {
+ SolutionId = solutionId;
+ RequestPath = requestPath;
+ PartnerRequestBody = partnerRequestBody;
+ PartnerRequestHeaders = partnerRequestHeaders;
+ _serializedAdditionalRawData = serializedAdditionalRawData;
+ }
+
+ /// Initializes a new instance of for deserialization.
+ internal CancelJobRequest()
+ {
+ }
+
+ /// SolutionId.
+ public string SolutionId { get; }
+ /// RequestPath.
+ public string RequestPath { get; }
+ ///
+ /// Properties.
+ ///
+ /// 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" }.
+ ///
+ ///
+ ///
+ ///
+ public IReadOnlyDictionary PartnerRequestBody { get; }
+ ///
+ /// Properties.
+ ///
+ /// 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" }.
+ ///
+ ///
+ ///
+ ///
+ public IReadOnlyDictionary PartnerRequestHeaders { get; }
+ }
+}
diff --git a/sdk/agricultureplatform/Microsoft.AgriculturePlatform/src/Generated/Catalog.Serialization.cs b/sdk/agricultureplatform/Microsoft.AgriculturePlatform/src/Generated/Catalog.Serialization.cs
new file mode 100644
index 000000000000..1898f24473bf
--- /dev/null
+++ b/sdk/agricultureplatform/Microsoft.AgriculturePlatform/src/Generated/Catalog.Serialization.cs
@@ -0,0 +1,336 @@
+// 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;
+using Azure.Core;
+
+namespace Microsoft.AgriculturePlatform
+{
+ public partial class Catalog : 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(Catalog)} does not support writing '{format}' format.");
+ }
+
+ if (Optional.IsCollectionDefined(Links))
+ {
+ writer.WritePropertyName("links"u8);
+ writer.WriteStartArray();
+ foreach (var item in Links)
+ {
+ writer.WriteObjectValue(item, options);
+ }
+ writer.WriteEndArray();
+ }
+ if (options.Format != "W" && Optional.IsDefined(ETag))
+ {
+ writer.WritePropertyName("eTag"u8);
+ writer.WriteStringValue(ETag);
+ }
+ if (Optional.IsDefined(Status))
+ {
+ writer.WritePropertyName("status"u8);
+ writer.WriteStringValue(Status);
+ }
+ if (options.Format != "W" && Optional.IsDefined(CreatedDateTime))
+ {
+ writer.WritePropertyName("createdDateTime"u8);
+ writer.WriteStringValue(CreatedDateTime.Value, "O");
+ }
+ if (options.Format != "W" && Optional.IsDefined(ModifiedDateTime))
+ {
+ writer.WritePropertyName("modifiedDateTime"u8);
+ writer.WriteStringValue(ModifiedDateTime.Value, "O");
+ }
+ if (Optional.IsDefined(Source))
+ {
+ writer.WritePropertyName("source"u8);
+ writer.WriteStringValue(Source);
+ }
+ if (Optional.IsDefined(Name))
+ {
+ writer.WritePropertyName("name"u8);
+ writer.WriteStringValue(Name);
+ }
+ if (Optional.IsDefined(Description))
+ {
+ writer.WritePropertyName("description"u8);
+ writer.WriteStringValue(Description);
+ }
+ if (options.Format != "W" && Optional.IsDefined(CreatedBy))
+ {
+ writer.WritePropertyName("createdBy"u8);
+ writer.WriteStringValue(CreatedBy);
+ }
+ if (options.Format != "W" && Optional.IsDefined(ModifiedBy))
+ {
+ writer.WritePropertyName("modifiedBy"u8);
+ writer.WriteStringValue(ModifiedBy);
+ }
+ if (Optional.IsCollectionDefined(Properties))
+ {
+ writer.WritePropertyName("properties"u8);
+ writer.WriteStartObject();
+ foreach (var item in Properties)
+ {
+ writer.WritePropertyName(item.Key);
+ if (item.Value == null)
+ {
+ writer.WriteNullValue();
+ continue;
+ }
+#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
+ }
+ writer.WriteEndObject();
+ }
+ if (options.Format != "W")
+ {
+ writer.WritePropertyName("id"u8);
+ writer.WriteStringValue(Id);
+ }
+ 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
+ }
+ }
+ }
+
+ Catalog 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(Catalog)} does not support reading '{format}' format.");
+ }
+
+ using JsonDocument document = JsonDocument.ParseValue(ref reader);
+ return DeserializeCatalog(document.RootElement, options);
+ }
+
+ internal static Catalog DeserializeCatalog(JsonElement element, ModelReaderWriterOptions options = null)
+ {
+ options ??= ModelSerializationExtensions.WireOptions;
+
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ IList links = default;
+ string eTag = default;
+ string status = default;
+ DateTimeOffset? createdDateTime = default;
+ DateTimeOffset? modifiedDateTime = default;
+ string source = default;
+ string name = default;
+ string description = default;
+ string createdBy = default;
+ string modifiedBy = default;
+ IDictionary properties = default;
+ string id = default;
+ IDictionary serializedAdditionalRawData = default;
+ Dictionary rawDataDictionary = new Dictionary();
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("links"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ List array = new List();
+ foreach (var item in property.Value.EnumerateArray())
+ {
+ array.Add(Link.DeserializeLink(item, options));
+ }
+ links = array;
+ continue;
+ }
+ if (property.NameEquals("eTag"u8))
+ {
+ eTag = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("status"u8))
+ {
+ status = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("createdDateTime"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ createdDateTime = property.Value.GetDateTimeOffset("O");
+ continue;
+ }
+ if (property.NameEquals("modifiedDateTime"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ modifiedDateTime = property.Value.GetDateTimeOffset("O");
+ continue;
+ }
+ if (property.NameEquals("source"u8))
+ {
+ source = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("name"u8))
+ {
+ name = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("description"u8))
+ {
+ description = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("createdBy"u8))
+ {
+ createdBy = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("modifiedBy"u8))
+ {
+ modifiedBy = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("properties"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ Dictionary dictionary = new Dictionary();
+ foreach (var property0 in property.Value.EnumerateObject())
+ {
+ if (property0.Value.ValueKind == JsonValueKind.Null)
+ {
+ dictionary.Add(property0.Name, null);
+ }
+ else
+ {
+ dictionary.Add(property0.Name, BinaryData.FromString(property0.Value.GetRawText()));
+ }
+ }
+ properties = dictionary;
+ continue;
+ }
+ if (property.NameEquals("id"u8))
+ {
+ id = property.Value.GetString();
+ continue;
+ }
+ if (options.Format != "W")
+ {
+ rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText()));
+ }
+ }
+ serializedAdditionalRawData = rawDataDictionary;
+ return new Catalog(
+ links ?? new ChangeTrackingList(),
+ eTag,
+ status,
+ createdDateTime,
+ modifiedDateTime,
+ source,
+ name,
+ description,
+ createdBy,
+ modifiedBy,
+ properties ?? new ChangeTrackingDictionary(),
+ id,
+ 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(Catalog)} does not support writing '{options.Format}' format.");
+ }
+ }
+
+ Catalog 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 DeserializeCatalog(document.RootElement, options);
+ }
+ default:
+ throw new FormatException($"The model {nameof(Catalog)} 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 Catalog FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions);
+ return DeserializeCatalog(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/agricultureplatform/Microsoft.AgriculturePlatform/src/Generated/Catalog.cs b/sdk/agricultureplatform/Microsoft.AgriculturePlatform/src/Generated/Catalog.cs
new file mode 100644
index 000000000000..2bf0d9ff19e3
--- /dev/null
+++ b/sdk/agricultureplatform/Microsoft.AgriculturePlatform/src/Generated/Catalog.cs
@@ -0,0 +1,152 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+
+namespace Microsoft.AgriculturePlatform
+{
+ /// Catalog.
+ public partial class Catalog
+ {
+ ///
+ /// 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 .
+ public Catalog()
+ {
+ Links = new ChangeTrackingList();
+ Properties = new ChangeTrackingDictionary();
+ }
+
+ /// Initializes a new instance of .
+ /// Links for referencing other objects.
+ /// The ETag value to implement optimistic concurrency.
+ /// Status of the resource.
+ /// Date-time when resource was created, sample format: yyyy-MM-ddTHH:mm:ssZ.
+ /// Date-time when resource was last modified, sample format: yyyy-MM-ddTHH:mm:ssZ.
+ /// Source of the resource.
+ /// Name to identify resource.
+ /// Textual description of the resource.
+ /// Created by user/tenant id.
+ /// Modified by user/tenant id.
+ ///
+ /// A collection of key value pairs that belongs to the resource.
+ /// Each pair must not have a key greater than 50 characters
+ /// and must not have a value greater than 150 characters.
+ /// Note: A maximum of 25 key value pairs can be provided for a resource and only
+ /// string,
+ /// numeral and datetime (yyyy-MM-ddTHH:mm:ssZ) values are supported.
+ ///
+ /// Id of the Catalog.
+ /// Keeps track of any properties unknown to the library.
+ internal Catalog(IList links, string eTag, string status, DateTimeOffset? createdDateTime, DateTimeOffset? modifiedDateTime, string source, string name, string description, string createdBy, string modifiedBy, IDictionary properties, string id, IDictionary serializedAdditionalRawData)
+ {
+ Links = links;
+ ETag = eTag;
+ Status = status;
+ CreatedDateTime = createdDateTime;
+ ModifiedDateTime = modifiedDateTime;
+ Source = source;
+ Name = name;
+ Description = description;
+ CreatedBy = createdBy;
+ ModifiedBy = modifiedBy;
+ Properties = properties;
+ Id = id;
+ _serializedAdditionalRawData = serializedAdditionalRawData;
+ }
+
+ /// Links for referencing other objects.
+ public IList Links { get; }
+ /// The ETag value to implement optimistic concurrency.
+ public string ETag { get; }
+ /// Status of the resource.
+ public string Status { get; set; }
+ /// Date-time when resource was created, sample format: yyyy-MM-ddTHH:mm:ssZ.
+ public DateTimeOffset? CreatedDateTime { get; }
+ /// Date-time when resource was last modified, sample format: yyyy-MM-ddTHH:mm:ssZ.
+ public DateTimeOffset? ModifiedDateTime { get; }
+ /// Source of the resource.
+ public string Source { get; set; }
+ /// Name to identify resource.
+ public string Name { get; set; }
+ /// Textual description of the resource.
+ public string Description { get; set; }
+ /// Created by user/tenant id.
+ public string CreatedBy { get; }
+ /// Modified by user/tenant id.
+ public string ModifiedBy { get; }
+ ///
+ /// A collection of key value pairs that belongs to the resource.
+ /// Each pair must not have a key greater than 50 characters
+ /// and must not have a value greater than 150 characters.
+ /// Note: A maximum of 25 key value pairs can be provided for a resource and only
+ /// string,
+ /// numeral and datetime (yyyy-MM-ddTHH:mm:ssZ) values are supported.
+ ///
+ /// 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" }.
+ ///
+ ///
+ ///
+ ///
+ public IDictionary Properties { get; }
+ /// Id of the Catalog.
+ public string Id { get; }
+ }
+}
diff --git a/sdk/agricultureplatform/Microsoft.AgriculturePlatform/src/Generated/CatalogCollection.Serialization.cs b/sdk/agricultureplatform/Microsoft.AgriculturePlatform/src/Generated/CatalogCollection.Serialization.cs
new file mode 100644
index 000000000000..d3a7ffb34c45
--- /dev/null
+++ b/sdk/agricultureplatform/Microsoft.AgriculturePlatform/src/Generated/CatalogCollection.Serialization.cs
@@ -0,0 +1,157 @@
+// 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;
+using Azure.Core;
+
+namespace Microsoft.AgriculturePlatform
+{
+ public partial class CatalogCollection : 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(CatalogCollection)} does not support writing '{format}' format.");
+ }
+
+ if (options.Format != "W" && Optional.IsDefined(CatalogId))
+ {
+ writer.WritePropertyName("catalogId"u8);
+ writer.WriteStringValue(CatalogId);
+ }
+ if (options.Format != "W" && Optional.IsDefined(CollectionId))
+ {
+ writer.WritePropertyName("collectionId"u8);
+ writer.WriteStringValue(CollectionId);
+ }
+ 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
+ }
+ }
+ }
+
+ CatalogCollection 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(CatalogCollection)} does not support reading '{format}' format.");
+ }
+
+ using JsonDocument document = JsonDocument.ParseValue(ref reader);
+ return DeserializeCatalogCollection(document.RootElement, options);
+ }
+
+ internal static CatalogCollection DeserializeCatalogCollection(JsonElement element, ModelReaderWriterOptions options = null)
+ {
+ options ??= ModelSerializationExtensions.WireOptions;
+
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ string catalogId = default;
+ string collectionId = default;
+ IDictionary serializedAdditionalRawData = default;
+ Dictionary rawDataDictionary = new Dictionary();
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("catalogId"u8))
+ {
+ catalogId = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("collectionId"u8))
+ {
+ collectionId = property.Value.GetString();
+ continue;
+ }
+ if (options.Format != "W")
+ {
+ rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText()));
+ }
+ }
+ serializedAdditionalRawData = rawDataDictionary;
+ return new CatalogCollection(catalogId, collectionId, 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(CatalogCollection)} does not support writing '{options.Format}' format.");
+ }
+ }
+
+ CatalogCollection 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 DeserializeCatalogCollection(document.RootElement, options);
+ }
+ default:
+ throw new FormatException($"The model {nameof(CatalogCollection)} 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 CatalogCollection FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions);
+ return DeserializeCatalogCollection(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/agricultureplatform/Microsoft.AgriculturePlatform/src/Generated/CatalogCollection.cs b/sdk/agricultureplatform/Microsoft.AgriculturePlatform/src/Generated/CatalogCollection.cs
new file mode 100644
index 000000000000..338ad9a8a7c7
--- /dev/null
+++ b/sdk/agricultureplatform/Microsoft.AgriculturePlatform/src/Generated/CatalogCollection.cs
@@ -0,0 +1,69 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+
+namespace Microsoft.AgriculturePlatform
+{
+ /// Schema for storing catalog and collection id.
+ public partial class CatalogCollection
+ {
+ ///
+ /// 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 .
+ internal CatalogCollection()
+ {
+ }
+
+ /// Initializes a new instance of .
+ /// Catalog Id.
+ /// Collection Id.
+ /// Keeps track of any properties unknown to the library.
+ internal CatalogCollection(string catalogId, string collectionId, IDictionary serializedAdditionalRawData)
+ {
+ CatalogId = catalogId;
+ CollectionId = collectionId;
+ _serializedAdditionalRawData = serializedAdditionalRawData;
+ }
+
+ /// Catalog Id.
+ public string CatalogId { get; }
+ /// Collection Id.
+ public string CollectionId { get; }
+ }
+}
diff --git a/sdk/agricultureplatform/Microsoft.AgriculturePlatform/src/Generated/Catalogs.cs b/sdk/agricultureplatform/Microsoft.AgriculturePlatform/src/Generated/Catalogs.cs
new file mode 100644
index 000000000000..e2f36eb1950b
--- /dev/null
+++ b/sdk/agricultureplatform/Microsoft.AgriculturePlatform/src/Generated/Catalogs.cs
@@ -0,0 +1,593 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+using System.Threading;
+using System.Threading.Tasks;
+using Autorest.CSharp.Core;
+using Azure;
+using Azure.Core;
+using Azure.Core.Pipeline;
+
+namespace Microsoft.AgriculturePlatform
+{
+ // Data plane generated sub-client.
+ /// The Catalogs sub-client.
+ public partial class Catalogs
+ {
+ private const string AuthorizationHeader = "Authorization";
+ private readonly AzureKeyCredential _keyCredential;
+ 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 Catalogs for mocking.
+ protected Catalogs()
+ {
+ }
+
+ /// Initializes a new instance of Catalogs.
+ /// 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 to use.
+ /// The API version to use for this operation.
+ internal Catalogs(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, AzureKeyCredential keyCredential, Uri endpoint, string apiVersion)
+ {
+ ClientDiagnostics = clientDiagnostics;
+ _pipeline = pipeline;
+ _keyCredential = keyCredential;
+ _endpoint = endpoint;
+ _apiVersion = apiVersion;
+ }
+
+ /// Gets a specified Catalog resource.
+ /// Id of the Catalog.
+ /// The cancellation token to use.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ ///
+ public virtual async Task> GetCatalogAsync(string catalogId, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(catalogId, nameof(catalogId));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = await GetCatalogAsync(catalogId, context).ConfigureAwait(false);
+ return Response.FromValue(Catalog.FromResponse(response), response);
+ }
+
+ /// Gets a specified Catalog resource.
+ /// Id of the Catalog.
+ /// The cancellation token to use.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ ///
+ public virtual Response GetCatalog(string catalogId, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(catalogId, nameof(catalogId));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = GetCatalog(catalogId, context);
+ return Response.FromValue(Catalog.FromResponse(response), response);
+ }
+
+ ///
+ /// [Protocol Method] Gets a specified Catalog resource.
+ ///
+ /// -
+ ///
+ /// 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.
+ ///
+ ///
+ ///
+ ///
+ /// Id of the Catalog.
+ /// 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 GetCatalogAsync(string catalogId, RequestContext context)
+ {
+ Argument.AssertNotNullOrEmpty(catalogId, nameof(catalogId));
+
+ using var scope = ClientDiagnostics.CreateScope("Catalogs.GetCatalog");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateGetCatalogRequest(catalogId, context);
+ return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// [Protocol Method] Gets a specified Catalog resource.
+ ///
+ /// -
+ ///
+ /// 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.
+ ///
+ ///
+ ///
+ ///
+ /// Id of the Catalog.
+ /// 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 GetCatalog(string catalogId, RequestContext context)
+ {
+ Argument.AssertNotNullOrEmpty(catalogId, nameof(catalogId));
+
+ using var scope = ClientDiagnostics.CreateScope("Catalogs.GetCatalog");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateGetCatalogRequest(catalogId, context);
+ return _pipeline.ProcessMessage(message, context);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// [Protocol Method] Creates or updates a Catalog resource.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// Id of the Catalog.
+ /// 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.
+ /// 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 catalogId, RequestContent content, RequestContext context = null)
+ {
+ Argument.AssertNotNullOrEmpty(catalogId, nameof(catalogId));
+ Argument.AssertNotNull(content, nameof(content));
+
+ using var scope = ClientDiagnostics.CreateScope("Catalogs.CreateOrUpdate");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateCreateOrUpdateRequest(catalogId, content, context);
+ return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// [Protocol Method] Creates or updates a Catalog resource.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// Id of the Catalog.
+ /// 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.
+ /// 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 catalogId, RequestContent content, RequestContext context = null)
+ {
+ Argument.AssertNotNullOrEmpty(catalogId, nameof(catalogId));
+ Argument.AssertNotNull(content, nameof(content));
+
+ using var scope = ClientDiagnostics.CreateScope("Catalogs.CreateOrUpdate");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateCreateOrUpdateRequest(catalogId, content, 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 Catalog for given Catalog id.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// Id of the Catalog.
+ /// 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 catalogId, RequestContext context = null)
+ {
+ Argument.AssertNotNullOrEmpty(catalogId, nameof(catalogId));
+
+ using var scope = ClientDiagnostics.CreateScope("Catalogs.Delete");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateDeleteRequest(catalogId, 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 Catalog for given Catalog id.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// Id of the Catalog.
+ /// 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 catalogId, RequestContext context = null)
+ {
+ Argument.AssertNotNullOrEmpty(catalogId, nameof(catalogId));
+
+ using var scope = ClientDiagnostics.CreateScope("Catalogs.Delete");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateDeleteRequest(catalogId, context);
+ return _pipeline.ProcessMessage(message, context);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Returns a paginated list of Catalog resources.
+ /// Names of the resource.
+ ///
+ /// Filters on key-value pairs within the Properties object.
+ /// eg. "{testKey} eq {testValue}".
+ ///
+ /// Statuses of the resource.
+ /// Ids of the resource.
+ /// Minimum creation date of resource (inclusive).
+ /// Maximum creation date of resource (inclusive).
+ /// Minimum last modified date of resource (inclusive).
+ /// Maximum last modified date of resource (inclusive).
+ ///
+ /// Maximum number of items needed (inclusive).
+ /// Minimum = 10, Maximum = 1000, Default value = 50.
+ ///
+ /// Skip token for getting next set of results.
+ /// The cancellation token to use.
+ ///
+ public virtual AsyncPageable GetCatalogsAsync(IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, IEnumerable ids = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, CancellationToken cancellationToken = default)
+ {
+ RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null;
+ HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetCatalogsRequest(names, propertyFilters, statuses, ids, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context);
+ HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetCatalogsNextPageRequest(nextLink, names, propertyFilters, statuses, ids, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context);
+ return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => Catalog.DeserializeCatalog(e), ClientDiagnostics, _pipeline, "Catalogs.GetCatalogs", "value", "nextLink", context);
+ }
+
+ /// Returns a paginated list of Catalog resources.
+ /// Names of the resource.
+ ///
+ /// Filters on key-value pairs within the Properties object.
+ /// eg. "{testKey} eq {testValue}".
+ ///
+ /// Statuses of the resource.
+ /// Ids of the resource.
+ /// Minimum creation date of resource (inclusive).
+ /// Maximum creation date of resource (inclusive).
+ /// Minimum last modified date of resource (inclusive).
+ /// Maximum last modified date of resource (inclusive).
+ ///
+ /// Maximum number of items needed (inclusive).
+ /// Minimum = 10, Maximum = 1000, Default value = 50.
+ ///
+ /// Skip token for getting next set of results.
+ /// The cancellation token to use.
+ ///
+ public virtual Pageable GetCatalogs(IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, IEnumerable ids = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, CancellationToken cancellationToken = default)
+ {
+ RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null;
+ HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetCatalogsRequest(names, propertyFilters, statuses, ids, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context);
+ HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetCatalogsNextPageRequest(nextLink, names, propertyFilters, statuses, ids, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context);
+ return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => Catalog.DeserializeCatalog(e), ClientDiagnostics, _pipeline, "Catalogs.GetCatalogs", "value", "nextLink", context);
+ }
+
+ ///
+ /// [Protocol Method] Returns a paginated list of Catalog resources.
+ ///
+ /// -
+ ///
+ /// 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.
+ ///
+ ///
+ ///
+ ///
+ /// Names of the resource.
+ ///
+ /// Filters on key-value pairs within the Properties object.
+ /// eg. "{testKey} eq {testValue}".
+ ///
+ /// Statuses of the resource.
+ /// Ids of the resource.
+ /// Minimum creation date of resource (inclusive).
+ /// Maximum creation date of resource (inclusive).
+ /// Minimum last modified date of resource (inclusive).
+ /// Maximum last modified date of resource (inclusive).
+ ///
+ /// Maximum number of items needed (inclusive).
+ /// Minimum = 10, Maximum = 1000, Default value = 50.
+ ///
+ /// Skip token for getting next set of results.
+ /// 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 GetCatalogsAsync(IEnumerable names, IEnumerable propertyFilters, IEnumerable statuses, IEnumerable ids, DateTimeOffset? minCreatedDateTime, DateTimeOffset? maxCreatedDateTime, DateTimeOffset? minLastModifiedDateTime, DateTimeOffset? maxLastModifiedDateTime, int? maxPageSize, string skipToken, RequestContext context)
+ {
+ HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetCatalogsRequest(names, propertyFilters, statuses, ids, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context);
+ HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetCatalogsNextPageRequest(nextLink, names, propertyFilters, statuses, ids, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context);
+ return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Catalogs.GetCatalogs", "value", "nextLink", context);
+ }
+
+ ///
+ /// [Protocol Method] Returns a paginated list of Catalog resources.
+ ///
+ /// -
+ ///
+ /// 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.
+ ///
+ ///
+ ///
+ ///
+ /// Names of the resource.
+ ///
+ /// Filters on key-value pairs within the Properties object.
+ /// eg. "{testKey} eq {testValue}".
+ ///
+ /// Statuses of the resource.
+ /// Ids of the resource.
+ /// Minimum creation date of resource (inclusive).
+ /// Maximum creation date of resource (inclusive).
+ /// Minimum last modified date of resource (inclusive).
+ /// Maximum last modified date of resource (inclusive).
+ ///
+ /// Maximum number of items needed (inclusive).
+ /// Minimum = 10, Maximum = 1000, Default value = 50.
+ ///
+ /// Skip token for getting next set of results.
+ /// 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 GetCatalogs(IEnumerable names, IEnumerable propertyFilters, IEnumerable statuses, IEnumerable ids, DateTimeOffset? minCreatedDateTime, DateTimeOffset? maxCreatedDateTime, DateTimeOffset? minLastModifiedDateTime, DateTimeOffset? maxLastModifiedDateTime, int? maxPageSize, string skipToken, RequestContext context)
+ {
+ HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetCatalogsRequest(names, propertyFilters, statuses, ids, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context);
+ HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetCatalogsNextPageRequest(nextLink, names, propertyFilters, statuses, ids, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context);
+ return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Catalogs.GetCatalogs", "value", "nextLink", context);
+ }
+
+ internal HttpMessage CreateGetCatalogsRequest(IEnumerable names, IEnumerable propertyFilters, IEnumerable statuses, IEnumerable ids, DateTimeOffset? minCreatedDateTime, DateTimeOffset? maxCreatedDateTime, DateTimeOffset? minLastModifiedDateTime, DateTimeOffset? maxLastModifiedDateTime, int? maxPageSize, string skipToken, 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("/catalogs", false);
+ uri.AppendQuery("api-version", _apiVersion, true);
+ if (names != null && !(names is ChangeTrackingList changeTrackingList && changeTrackingList.IsUndefined))
+ {
+ foreach (var param in names)
+ {
+ uri.AppendQuery("names", param, true);
+ }
+ }
+ if (propertyFilters != null && !(propertyFilters is ChangeTrackingList changeTrackingList0 && changeTrackingList0.IsUndefined))
+ {
+ foreach (var param in propertyFilters)
+ {
+ uri.AppendQuery("propertyFilters", param, true);
+ }
+ }
+ if (statuses != null && !(statuses is ChangeTrackingList changeTrackingList1 && changeTrackingList1.IsUndefined))
+ {
+ foreach (var param in statuses)
+ {
+ uri.AppendQuery("statuses", param, true);
+ }
+ }
+ if (ids != null && !(ids is ChangeTrackingList changeTrackingList2 && changeTrackingList2.IsUndefined))
+ {
+ foreach (var param in ids)
+ {
+ uri.AppendQuery("ids", param, true);
+ }
+ }
+ if (minCreatedDateTime != null)
+ {
+ uri.AppendQuery("minCreatedDateTime", minCreatedDateTime.Value, "O", true);
+ }
+ if (maxCreatedDateTime != null)
+ {
+ uri.AppendQuery("maxCreatedDateTime", maxCreatedDateTime.Value, "O", true);
+ }
+ if (minLastModifiedDateTime != null)
+ {
+ uri.AppendQuery("minLastModifiedDateTime", minLastModifiedDateTime.Value, "O", true);
+ }
+ if (maxLastModifiedDateTime != null)
+ {
+ uri.AppendQuery("maxLastModifiedDateTime", maxLastModifiedDateTime.Value, "O", true);
+ }
+ if (maxPageSize != null)
+ {
+ uri.AppendQuery("maxPageSize", maxPageSize.Value, true);
+ }
+ if (skipToken != null)
+ {
+ uri.AppendQuery("skipToken", skipToken, true);
+ }
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ return message;
+ }
+
+ internal HttpMessage CreateGetCatalogRequest(string catalogId, 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("/catalogs/", false);
+ uri.AppendPath(catalogId, true);
+ uri.AppendQuery("api-version", _apiVersion, true);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ return message;
+ }
+
+ internal HttpMessage CreateCreateOrUpdateRequest(string catalogId, RequestContent content, RequestContext context)
+ {
+ var message = _pipeline.CreateMessage(context, ResponseClassifier200201);
+ var request = message.Request;
+ request.Method = RequestMethod.Patch;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(_endpoint);
+ uri.AppendPath("/catalogs/", false);
+ uri.AppendPath(catalogId, true);
+ uri.AppendQuery("api-version", _apiVersion, true);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ request.Headers.Add("Content-Type", "application/merge-patch+json");
+ request.Content = content;
+ return message;
+ }
+
+ internal HttpMessage CreateDeleteRequest(string catalogId, RequestContext context)
+ {
+ var message = _pipeline.CreateMessage(context, ResponseClassifier204);
+ var request = message.Request;
+ request.Method = RequestMethod.Delete;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(_endpoint);
+ uri.AppendPath("/catalogs/", false);
+ uri.AppendPath(catalogId, true);
+ uri.AppendQuery("api-version", _apiVersion, true);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ return message;
+ }
+
+ internal HttpMessage CreateGetCatalogsNextPageRequest(string nextLink, IEnumerable names, IEnumerable propertyFilters, IEnumerable statuses, IEnumerable ids, DateTimeOffset? minCreatedDateTime, DateTimeOffset? maxCreatedDateTime, DateTimeOffset? minLastModifiedDateTime, DateTimeOffset? maxLastModifiedDateTime, int? maxPageSize, string skipToken, RequestContext context)
+ {
+ var message = _pipeline.CreateMessage(context, ResponseClassifier200);
+ var request = message.Request;
+ request.Method = RequestMethod.Get;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(_endpoint);
+ uri.AppendRawNextLink(nextLink, false);
+ 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 _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 _responseClassifier204;
+ private static ResponseClassifier ResponseClassifier204 => _responseClassifier204 ??= new StatusCodeClassifier(stackalloc ushort[] { 204 });
+ }
+}
diff --git a/sdk/agricultureplatform/Microsoft.AgriculturePlatform/src/Generated/Collection.Serialization.cs b/sdk/agricultureplatform/Microsoft.AgriculturePlatform/src/Generated/Collection.Serialization.cs
new file mode 100644
index 000000000000..1d0f1dc54b70
--- /dev/null
+++ b/sdk/agricultureplatform/Microsoft.AgriculturePlatform/src/Generated/Collection.Serialization.cs
@@ -0,0 +1,357 @@
+// 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;
+using Azure.Core;
+
+namespace Microsoft.AgriculturePlatform
+{
+ public partial class Collection : 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(Collection)} does not support writing '{format}' format.");
+ }
+
+ if (Optional.IsCollectionDefined(Links))
+ {
+ writer.WritePropertyName("links"u8);
+ writer.WriteStartArray();
+ foreach (var item in Links)
+ {
+ writer.WriteObjectValue(item, options);
+ }
+ writer.WriteEndArray();
+ }
+ if (options.Format != "W" && Optional.IsDefined(ETag))
+ {
+ writer.WritePropertyName("eTag"u8);
+ writer.WriteStringValue(ETag);
+ }
+ if (Optional.IsDefined(Status))
+ {
+ writer.WritePropertyName("status"u8);
+ writer.WriteStringValue(Status);
+ }
+ if (options.Format != "W" && Optional.IsDefined(CreatedDateTime))
+ {
+ writer.WritePropertyName("createdDateTime"u8);
+ writer.WriteStringValue(CreatedDateTime.Value, "O");
+ }
+ if (options.Format != "W" && Optional.IsDefined(ModifiedDateTime))
+ {
+ writer.WritePropertyName("modifiedDateTime"u8);
+ writer.WriteStringValue(ModifiedDateTime.Value, "O");
+ }
+ if (Optional.IsDefined(Source))
+ {
+ writer.WritePropertyName("source"u8);
+ writer.WriteStringValue(Source);
+ }
+ if (Optional.IsDefined(Name))
+ {
+ writer.WritePropertyName("name"u8);
+ writer.WriteStringValue(Name);
+ }
+ if (Optional.IsDefined(Description))
+ {
+ writer.WritePropertyName("description"u8);
+ writer.WriteStringValue(Description);
+ }
+ if (options.Format != "W" && Optional.IsDefined(CreatedBy))
+ {
+ writer.WritePropertyName("createdBy"u8);
+ writer.WriteStringValue(CreatedBy);
+ }
+ if (options.Format != "W" && Optional.IsDefined(ModifiedBy))
+ {
+ writer.WritePropertyName("modifiedBy"u8);
+ writer.WriteStringValue(ModifiedBy);
+ }
+ if (Optional.IsCollectionDefined(Properties))
+ {
+ writer.WritePropertyName("properties"u8);
+ writer.WriteStartObject();
+ foreach (var item in Properties)
+ {
+ writer.WritePropertyName(item.Key);
+ if (item.Value == null)
+ {
+ writer.WriteNullValue();
+ continue;
+ }
+#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
+ }
+ writer.WriteEndObject();
+ }
+ writer.WritePropertyName("schemaId"u8);
+ writer.WriteStringValue(SchemaId);
+ if (options.Format != "W" && Optional.IsDefined(CatalogId))
+ {
+ writer.WritePropertyName("catalogId"u8);
+ writer.WriteStringValue(CatalogId);
+ }
+ if (options.Format != "W")
+ {
+ writer.WritePropertyName("id"u8);
+ writer.WriteStringValue(Id);
+ }
+ 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
+ }
+ }
+ }
+
+ Collection 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(Collection)} does not support reading '{format}' format.");
+ }
+
+ using JsonDocument document = JsonDocument.ParseValue(ref reader);
+ return DeserializeCollection(document.RootElement, options);
+ }
+
+ internal static Collection DeserializeCollection(JsonElement element, ModelReaderWriterOptions options = null)
+ {
+ options ??= ModelSerializationExtensions.WireOptions;
+
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ IList links = default;
+ string eTag = default;
+ string status = default;
+ DateTimeOffset? createdDateTime = default;
+ DateTimeOffset? modifiedDateTime = default;
+ string source = default;
+ string name = default;
+ string description = default;
+ string createdBy = default;
+ string modifiedBy = default;
+ IDictionary properties = default;
+ string schemaId = default;
+ string catalogId = default;
+ string id = default;
+ IDictionary serializedAdditionalRawData = default;
+ Dictionary rawDataDictionary = new Dictionary();
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("links"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ List array = new List();
+ foreach (var item in property.Value.EnumerateArray())
+ {
+ array.Add(Link.DeserializeLink(item, options));
+ }
+ links = array;
+ continue;
+ }
+ if (property.NameEquals("eTag"u8))
+ {
+ eTag = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("status"u8))
+ {
+ status = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("createdDateTime"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ createdDateTime = property.Value.GetDateTimeOffset("O");
+ continue;
+ }
+ if (property.NameEquals("modifiedDateTime"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ modifiedDateTime = property.Value.GetDateTimeOffset("O");
+ continue;
+ }
+ if (property.NameEquals("source"u8))
+ {
+ source = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("name"u8))
+ {
+ name = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("description"u8))
+ {
+ description = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("createdBy"u8))
+ {
+ createdBy = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("modifiedBy"u8))
+ {
+ modifiedBy = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("properties"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ Dictionary dictionary = new Dictionary();
+ foreach (var property0 in property.Value.EnumerateObject())
+ {
+ if (property0.Value.ValueKind == JsonValueKind.Null)
+ {
+ dictionary.Add(property0.Name, null);
+ }
+ else
+ {
+ dictionary.Add(property0.Name, BinaryData.FromString(property0.Value.GetRawText()));
+ }
+ }
+ properties = dictionary;
+ continue;
+ }
+ if (property.NameEquals("schemaId"u8))
+ {
+ schemaId = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("catalogId"u8))
+ {
+ catalogId = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("id"u8))
+ {
+ id = property.Value.GetString();
+ continue;
+ }
+ if (options.Format != "W")
+ {
+ rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText()));
+ }
+ }
+ serializedAdditionalRawData = rawDataDictionary;
+ return new Collection(
+ links ?? new ChangeTrackingList(),
+ eTag,
+ status,
+ createdDateTime,
+ modifiedDateTime,
+ source,
+ name,
+ description,
+ createdBy,
+ modifiedBy,
+ properties ?? new ChangeTrackingDictionary(),
+ schemaId,
+ catalogId,
+ id,
+ 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(Collection)} does not support writing '{options.Format}' format.");
+ }
+ }
+
+ Collection 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 DeserializeCollection(document.RootElement, options);
+ }
+ default:
+ throw new FormatException($"The model {nameof(Collection)} 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 Collection FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions);
+ return DeserializeCollection(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/agricultureplatform/Microsoft.AgriculturePlatform/src/Generated/Collection.cs b/sdk/agricultureplatform/Microsoft.AgriculturePlatform/src/Generated/Collection.cs
new file mode 100644
index 000000000000..bfbec4e446e1
--- /dev/null
+++ b/sdk/agricultureplatform/Microsoft.AgriculturePlatform/src/Generated/Collection.cs
@@ -0,0 +1,170 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+
+namespace Microsoft.AgriculturePlatform
+{
+ /// Collection.
+ public partial class Collection
+ {
+ ///
+ /// 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 .
+ /// Schema Foreign Key.
+ /// is null.
+ public Collection(string schemaId)
+ {
+ Argument.AssertNotNull(schemaId, nameof(schemaId));
+
+ Links = new ChangeTrackingList();
+ Properties = new ChangeTrackingDictionary();
+ SchemaId = schemaId;
+ }
+
+ /// Initializes a new instance of .
+ /// Links for referencing other objects.
+ /// The ETag value to implement optimistic concurrency.
+ /// Status of the resource.
+ /// Date-time when resource was created, sample format: yyyy-MM-ddTHH:mm:ssZ.
+ /// Date-time when resource was last modified, sample format: yyyy-MM-ddTHH:mm:ssZ.
+ /// Source of the resource.
+ /// Name to identify resource.
+ /// Textual description of the resource.
+ /// Created by user/tenant id.
+ /// Modified by user/tenant id.
+ ///
+ /// A collection of key value pairs that belongs to the resource.
+ /// Each pair must not have a key greater than 50 characters
+ /// and must not have a value greater than 150 characters.
+ /// Note: A maximum of 25 key value pairs can be provided for a resource and only
+ /// string,
+ /// numeral and datetime (yyyy-MM-ddTHH:mm:ssZ) values are supported.
+ ///
+ /// Schema Foreign Key.
+ /// Id of the Catalog.
+ /// Unique resource ID.
+ /// Keeps track of any properties unknown to the library.
+ internal Collection(IList links, string eTag, string status, DateTimeOffset? createdDateTime, DateTimeOffset? modifiedDateTime, string source, string name, string description, string createdBy, string modifiedBy, IDictionary properties, string schemaId, string catalogId, string id, IDictionary serializedAdditionalRawData)
+ {
+ Links = links;
+ ETag = eTag;
+ Status = status;
+ CreatedDateTime = createdDateTime;
+ ModifiedDateTime = modifiedDateTime;
+ Source = source;
+ Name = name;
+ Description = description;
+ CreatedBy = createdBy;
+ ModifiedBy = modifiedBy;
+ Properties = properties;
+ SchemaId = schemaId;
+ CatalogId = catalogId;
+ Id = id;
+ _serializedAdditionalRawData = serializedAdditionalRawData;
+ }
+
+ /// Initializes a new instance of for deserialization.
+ internal Collection()
+ {
+ }
+
+ /// Links for referencing other objects.
+ public IList Links { get; }
+ /// The ETag value to implement optimistic concurrency.
+ public string ETag { get; }
+ /// Status of the resource.
+ public string Status { get; set; }
+ /// Date-time when resource was created, sample format: yyyy-MM-ddTHH:mm:ssZ.
+ public DateTimeOffset? CreatedDateTime { get; }
+ /// Date-time when resource was last modified, sample format: yyyy-MM-ddTHH:mm:ssZ.
+ public DateTimeOffset? ModifiedDateTime { get; }
+ /// Source of the resource.
+ public string Source { get; set; }
+ /// Name to identify resource.
+ public string Name { get; set; }
+ /// Textual description of the resource.
+ public string Description { get; set; }
+ /// Created by user/tenant id.
+ public string CreatedBy { get; }
+ /// Modified by user/tenant id.
+ public string ModifiedBy { get; }
+ ///
+ /// A collection of key value pairs that belongs to the resource.
+ /// Each pair must not have a key greater than 50 characters
+ /// and must not have a value greater than 150 characters.
+ /// Note: A maximum of 25 key value pairs can be provided for a resource and only
+ /// string,
+ /// numeral and datetime (yyyy-MM-ddTHH:mm:ssZ) values are supported.
+ ///
+ /// 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" }.
+ ///
+ ///
+ ///
+ ///
+ public IDictionary Properties { get; }
+ /// Schema Foreign Key.
+ public string SchemaId { get; set; }
+ /// Id of the Catalog.
+ public string CatalogId { get; }
+ /// Unique resource ID.
+ public string Id { get; }
+ }
+}
diff --git a/sdk/agricultureplatform/Microsoft.AgriculturePlatform/src/Generated/Collections.cs b/sdk/agricultureplatform/Microsoft.AgriculturePlatform/src/Generated/Collections.cs
new file mode 100644
index 000000000000..bdb849abe239
--- /dev/null
+++ b/sdk/agricultureplatform/Microsoft.AgriculturePlatform/src/Generated/Collections.cs
@@ -0,0 +1,637 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+using System.Threading;
+using System.Threading.Tasks;
+using Autorest.CSharp.Core;
+using Azure;
+using Azure.Core;
+using Azure.Core.Pipeline;
+
+namespace Microsoft.AgriculturePlatform
+{
+ // Data plane generated sub-client.
+ /// The Collections sub-client.
+ public partial class Collections
+ {
+ private const string AuthorizationHeader = "Authorization";
+ private readonly AzureKeyCredential _keyCredential;
+ 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 Collections for mocking.
+ protected Collections()
+ {
+ }
+
+ /// Initializes a new instance of Collections.
+ /// 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 to use.
+ /// The API version to use for this operation.
+ internal Collections(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, AzureKeyCredential keyCredential, Uri endpoint, string apiVersion)
+ {
+ ClientDiagnostics = clientDiagnostics;
+ _pipeline = pipeline;
+ _keyCredential = keyCredential;
+ _endpoint = endpoint;
+ _apiVersion = apiVersion;
+ }
+
+ /// Gets a specified Collection resource.
+ /// Id of the Catalog.
+ /// Unique resource ID.
+ /// The cancellation token to use.
+ /// or is null.
+ /// or is an empty string, and was expected to be non-empty.
+ ///
+ public virtual async Task> GetCollectionAsync(string catalogId, string collectionId, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(catalogId, nameof(catalogId));
+ Argument.AssertNotNullOrEmpty(collectionId, nameof(collectionId));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = await GetCollectionAsync(catalogId, collectionId, context).ConfigureAwait(false);
+ return Response.FromValue(Collection.FromResponse(response), response);
+ }
+
+ /// Gets a specified Collection resource.
+ /// Id of the Catalog.
+ /// Unique resource ID.
+ /// The cancellation token to use.
+ /// or is null.
+ /// or is an empty string, and was expected to be non-empty.
+ ///
+ public virtual Response GetCollection(string catalogId, string collectionId, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(catalogId, nameof(catalogId));
+ Argument.AssertNotNullOrEmpty(collectionId, nameof(collectionId));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = GetCollection(catalogId, collectionId, context);
+ return Response.FromValue(Collection.FromResponse(response), response);
+ }
+
+ ///
+ /// [Protocol Method] Gets a specified Collection resource.
+ ///
+ /// -
+ ///
+ /// 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.
+ ///
+ ///
+ ///
+ ///
+ /// Id of the Catalog.
+ /// Unique resource ID.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// or is null.
+ /// or 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 GetCollectionAsync(string catalogId, string collectionId, RequestContext context)
+ {
+ Argument.AssertNotNullOrEmpty(catalogId, nameof(catalogId));
+ Argument.AssertNotNullOrEmpty(collectionId, nameof(collectionId));
+
+ using var scope = ClientDiagnostics.CreateScope("Collections.GetCollection");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateGetCollectionRequest(catalogId, collectionId, context);
+ return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// [Protocol Method] Gets a specified Collection resource.
+ ///
+ /// -
+ ///
+ /// 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.
+ ///
+ ///
+ ///
+ ///
+ /// Id of the Catalog.
+ /// Unique resource ID.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// or is null.
+ /// or 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 GetCollection(string catalogId, string collectionId, RequestContext context)
+ {
+ Argument.AssertNotNullOrEmpty(catalogId, nameof(catalogId));
+ Argument.AssertNotNullOrEmpty(collectionId, nameof(collectionId));
+
+ using var scope = ClientDiagnostics.CreateScope("Collections.GetCollection");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateGetCollectionRequest(catalogId, collectionId, context);
+ return _pipeline.ProcessMessage(message, context);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// [Protocol Method] Creates or updates a Collection resource.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// Id of the Catalog.
+ /// Unique resource ID.
+ /// 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.
+ /// , or is null.
+ /// or 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 catalogId, string collectionId, RequestContent content, RequestContext context = null)
+ {
+ Argument.AssertNotNullOrEmpty(catalogId, nameof(catalogId));
+ Argument.AssertNotNullOrEmpty(collectionId, nameof(collectionId));
+ Argument.AssertNotNull(content, nameof(content));
+
+ using var scope = ClientDiagnostics.CreateScope("Collections.CreateOrUpdate");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateCreateOrUpdateRequest(catalogId, collectionId, content, context);
+ return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// [Protocol Method] Creates or updates a Collection resource.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// Id of the Catalog.
+ /// Unique resource ID.
+ /// 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.
+ /// , or is null.
+ /// or 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 catalogId, string collectionId, RequestContent content, RequestContext context = null)
+ {
+ Argument.AssertNotNullOrEmpty(catalogId, nameof(catalogId));
+ Argument.AssertNotNullOrEmpty(collectionId, nameof(collectionId));
+ Argument.AssertNotNull(content, nameof(content));
+
+ using var scope = ClientDiagnostics.CreateScope("Collections.CreateOrUpdate");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateCreateOrUpdateRequest(catalogId, collectionId, content, 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 Collection for given Collection id.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// Id of the Catalog.
+ /// Unique resource ID.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// or is null.
+ /// or 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 catalogId, string collectionId, RequestContext context = null)
+ {
+ Argument.AssertNotNullOrEmpty(catalogId, nameof(catalogId));
+ Argument.AssertNotNullOrEmpty(collectionId, nameof(collectionId));
+
+ using var scope = ClientDiagnostics.CreateScope("Collections.Delete");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateDeleteRequest(catalogId, collectionId, 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 Collection for given Collection id.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// Id of the Catalog.
+ /// Unique resource ID.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// or is null.
+ /// or 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 catalogId, string collectionId, RequestContext context = null)
+ {
+ Argument.AssertNotNullOrEmpty(catalogId, nameof(catalogId));
+ Argument.AssertNotNullOrEmpty(collectionId, nameof(collectionId));
+
+ using var scope = ClientDiagnostics.CreateScope("Collections.Delete");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateDeleteRequest(catalogId, collectionId, context);
+ return _pipeline.ProcessMessage(message, context);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Returns a paginated list of Collection resources.
+ /// Id of the Catalog.
+ /// Names of the resource.
+ ///
+ /// Filters on key-value pairs within the Properties object.
+ /// eg. "{testKey} eq {testValue}".
+ ///
+ /// Statuses of the resource.
+ /// Ids of the resource.
+ /// Minimum creation date of resource (inclusive).
+ /// Maximum creation date of resource (inclusive).
+ /// Minimum last modified date of resource (inclusive).
+ /// Maximum last modified date of resource (inclusive).
+ ///
+ /// Maximum number of items needed (inclusive).
+ /// Minimum = 10, Maximum = 1000, Default value = 50.
+ ///
+ /// Skip token for getting next set of results.
+ /// The cancellation token to use.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ ///
+ public virtual AsyncPageable GetCollectionsAsync(string catalogId, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, IEnumerable ids = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(catalogId, nameof(catalogId));
+
+ RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null;
+ HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetCollectionsRequest(catalogId, names, propertyFilters, statuses, ids, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context);
+ HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetCollectionsNextPageRequest(nextLink, catalogId, names, propertyFilters, statuses, ids, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context);
+ return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => Collection.DeserializeCollection(e), ClientDiagnostics, _pipeline, "Collections.GetCollections", "value", "nextLink", context);
+ }
+
+ /// Returns a paginated list of Collection resources.
+ /// Id of the Catalog.
+ /// Names of the resource.
+ ///
+ /// Filters on key-value pairs within the Properties object.
+ /// eg. "{testKey} eq {testValue}".
+ ///
+ /// Statuses of the resource.
+ /// Ids of the resource.
+ /// Minimum creation date of resource (inclusive).
+ /// Maximum creation date of resource (inclusive).
+ /// Minimum last modified date of resource (inclusive).
+ /// Maximum last modified date of resource (inclusive).
+ ///
+ /// Maximum number of items needed (inclusive).
+ /// Minimum = 10, Maximum = 1000, Default value = 50.
+ ///
+ /// Skip token for getting next set of results.
+ /// The cancellation token to use.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ ///
+ public virtual Pageable GetCollections(string catalogId, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, IEnumerable ids = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(catalogId, nameof(catalogId));
+
+ RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null;
+ HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetCollectionsRequest(catalogId, names, propertyFilters, statuses, ids, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context);
+ HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetCollectionsNextPageRequest(nextLink, catalogId, names, propertyFilters, statuses, ids, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context);
+ return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => Collection.DeserializeCollection(e), ClientDiagnostics, _pipeline, "Collections.GetCollections", "value", "nextLink", context);
+ }
+
+ ///
+ /// [Protocol Method] Returns a paginated list of Collection resources.
+ ///
+ /// -
+ ///
+ /// 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.
+ ///
+ ///
+ ///
+ ///
+ /// Id of the Catalog.
+ /// Names of the resource.
+ ///
+ /// Filters on key-value pairs within the Properties object.
+ /// eg. "{testKey} eq {testValue}".
+ ///
+ /// Statuses of the resource.
+ /// Ids of the resource.
+ /// Minimum creation date of resource (inclusive).
+ /// Maximum creation date of resource (inclusive).
+ /// Minimum last modified date of resource (inclusive).
+ /// Maximum last modified date of resource (inclusive).
+ ///
+ /// Maximum number of items needed (inclusive).
+ /// Minimum = 10, Maximum = 1000, Default value = 50.
+ ///
+ /// Skip token for getting next set of results.
+ /// 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 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 GetCollectionsAsync(string catalogId, IEnumerable names, IEnumerable propertyFilters, IEnumerable statuses, IEnumerable ids, DateTimeOffset? minCreatedDateTime, DateTimeOffset? maxCreatedDateTime, DateTimeOffset? minLastModifiedDateTime, DateTimeOffset? maxLastModifiedDateTime, int? maxPageSize, string skipToken, RequestContext context)
+ {
+ Argument.AssertNotNullOrEmpty(catalogId, nameof(catalogId));
+
+ HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetCollectionsRequest(catalogId, names, propertyFilters, statuses, ids, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context);
+ HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetCollectionsNextPageRequest(nextLink, catalogId, names, propertyFilters, statuses, ids, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context);
+ return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Collections.GetCollections", "value", "nextLink", context);
+ }
+
+ ///
+ /// [Protocol Method] Returns a paginated list of Collection resources.
+ ///
+ /// -
+ ///
+ /// 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.
+ ///
+ ///
+ ///
+ ///
+ /// Id of the Catalog.
+ /// Names of the resource.
+ ///
+ /// Filters on key-value pairs within the Properties object.
+ /// eg. "{testKey} eq {testValue}".
+ ///
+ /// Statuses of the resource.
+ /// Ids of the resource.
+ /// Minimum creation date of resource (inclusive).
+ /// Maximum creation date of resource (inclusive).
+ /// Minimum last modified date of resource (inclusive).
+ /// Maximum last modified date of resource (inclusive).
+ ///
+ /// Maximum number of items needed (inclusive).
+ /// Minimum = 10, Maximum = 1000, Default value = 50.
+ ///
+ /// Skip token for getting next set of results.
+ /// 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 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 GetCollections(string catalogId, IEnumerable names, IEnumerable propertyFilters, IEnumerable statuses, IEnumerable ids, DateTimeOffset? minCreatedDateTime, DateTimeOffset? maxCreatedDateTime, DateTimeOffset? minLastModifiedDateTime, DateTimeOffset? maxLastModifiedDateTime, int? maxPageSize, string skipToken, RequestContext context)
+ {
+ Argument.AssertNotNullOrEmpty(catalogId, nameof(catalogId));
+
+ HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetCollectionsRequest(catalogId, names, propertyFilters, statuses, ids, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context);
+ HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetCollectionsNextPageRequest(nextLink, catalogId, names, propertyFilters, statuses, ids, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken, context);
+ return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Collections.GetCollections", "value", "nextLink", context);
+ }
+
+ internal HttpMessage CreateGetCollectionsRequest(string catalogId, IEnumerable names, IEnumerable propertyFilters, IEnumerable statuses, IEnumerable ids, DateTimeOffset? minCreatedDateTime, DateTimeOffset? maxCreatedDateTime, DateTimeOffset? minLastModifiedDateTime, DateTimeOffset? maxLastModifiedDateTime, int? maxPageSize, string skipToken, 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("/catalogs/", false);
+ uri.AppendPath(catalogId, true);
+ uri.AppendPath("/collections", false);
+ uri.AppendQuery("api-version", _apiVersion, true);
+ if (names != null && !(names is ChangeTrackingList changeTrackingList && changeTrackingList.IsUndefined))
+ {
+ foreach (var param in names)
+ {
+ uri.AppendQuery("names", param, true);
+ }
+ }
+ if (propertyFilters != null && !(propertyFilters is ChangeTrackingList changeTrackingList0 && changeTrackingList0.IsUndefined))
+ {
+ foreach (var param in propertyFilters)
+ {
+ uri.AppendQuery("propertyFilters", param, true);
+ }
+ }
+ if (statuses != null && !(statuses is ChangeTrackingList changeTrackingList1 && changeTrackingList1.IsUndefined))
+ {
+ foreach (var param in statuses)
+ {
+ uri.AppendQuery("statuses", param, true);
+ }
+ }
+ if (ids != null && !(ids is ChangeTrackingList changeTrackingList2 && changeTrackingList2.IsUndefined))
+ {
+ foreach (var param in ids)
+ {
+ uri.AppendQuery("ids", param, true);
+ }
+ }
+ if (minCreatedDateTime != null)
+ {
+ uri.AppendQuery("minCreatedDateTime", minCreatedDateTime.Value, "O", true);
+ }
+ if (maxCreatedDateTime != null)
+ {
+ uri.AppendQuery("maxCreatedDateTime", maxCreatedDateTime.Value, "O", true);
+ }
+ if (minLastModifiedDateTime != null)
+ {
+ uri.AppendQuery("minLastModifiedDateTime", minLastModifiedDateTime.Value, "O", true);
+ }
+ if (maxLastModifiedDateTime != null)
+ {
+ uri.AppendQuery("maxLastModifiedDateTime", maxLastModifiedDateTime.Value, "O", true);
+ }
+ if (maxPageSize != null)
+ {
+ uri.AppendQuery("maxPageSize", maxPageSize.Value, true);
+ }
+ if (skipToken != null)
+ {
+ uri.AppendQuery("skipToken", skipToken, true);
+ }
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ return message;
+ }
+
+ internal HttpMessage CreateGetCollectionRequest(string catalogId, string collectionId, 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("/catalogs/", false);
+ uri.AppendPath(catalogId, true);
+ uri.AppendPath("/collections/", false);
+ uri.AppendPath(collectionId, true);
+ uri.AppendQuery("api-version", _apiVersion, true);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ return message;
+ }
+
+ internal HttpMessage CreateCreateOrUpdateRequest(string catalogId, string collectionId, RequestContent content, RequestContext context)
+ {
+ var message = _pipeline.CreateMessage(context, ResponseClassifier200201);
+ var request = message.Request;
+ request.Method = RequestMethod.Patch;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(_endpoint);
+ uri.AppendPath("/catalogs/", false);
+ uri.AppendPath(catalogId, true);
+ uri.AppendPath("/collections/", false);
+ uri.AppendPath(collectionId, true);
+ uri.AppendQuery("api-version", _apiVersion, true);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ request.Headers.Add("Content-Type", "application/merge-patch+json");
+ request.Content = content;
+ return message;
+ }
+
+ internal HttpMessage CreateDeleteRequest(string catalogId, string collectionId, RequestContext context)
+ {
+ var message = _pipeline.CreateMessage(context, ResponseClassifier204);
+ var request = message.Request;
+ request.Method = RequestMethod.Delete;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(_endpoint);
+ uri.AppendPath("/catalogs/", false);
+ uri.AppendPath(catalogId, true);
+ uri.AppendPath("/collections/", false);
+ uri.AppendPath(collectionId, true);
+ uri.AppendQuery("api-version", _apiVersion, true);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ return message;
+ }
+
+ internal HttpMessage CreateGetCollectionsNextPageRequest(string nextLink, string catalogId, IEnumerable names, IEnumerable propertyFilters, IEnumerable statuses, IEnumerable ids, DateTimeOffset? minCreatedDateTime, DateTimeOffset? maxCreatedDateTime, DateTimeOffset? minLastModifiedDateTime, DateTimeOffset? maxLastModifiedDateTime, int? maxPageSize, string skipToken, RequestContext context)
+ {
+ var message = _pipeline.CreateMessage(context, ResponseClassifier200);
+ var request = message.Request;
+ request.Method = RequestMethod.Get;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(_endpoint);
+ uri.AppendRawNextLink(nextLink, false);
+ 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 _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 _responseClassifier204;
+ private static ResponseClassifier ResponseClassifier204 => _responseClassifier204 ??= new StatusCodeClassifier(stackalloc ushort[] { 204 });
+ }
+}
diff --git a/sdk/agricultureplatform/Microsoft.AgriculturePlatform/src/Generated/CreateJobRequest.Serialization.cs b/sdk/agricultureplatform/Microsoft.AgriculturePlatform/src/Generated/CreateJobRequest.Serialization.cs
new file mode 100644
index 000000000000..983530584440
--- /dev/null
+++ b/sdk/agricultureplatform/Microsoft.AgriculturePlatform/src/Generated/CreateJobRequest.Serialization.cs
@@ -0,0 +1,271 @@
+// 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;
+using Azure.Core;
+
+namespace Microsoft.AgriculturePlatform
+{
+ internal partial class CreateJobRequest : 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(CreateJobRequest)} does not support writing '{format}' format.");
+ }
+
+ writer.WritePropertyName("solutionId"u8);
+ writer.WriteStringValue(SolutionId);
+ writer.WritePropertyName("requestPath"u8);
+ writer.WriteStringValue(RequestPath);
+ writer.WritePropertyName("partnerRequestBody"u8);
+ writer.WriteStartObject();
+ foreach (var item in PartnerRequestBody)
+ {
+ writer.WritePropertyName(item.Key);
+ if (item.Value == null)
+ {
+ writer.WriteNullValue();
+ continue;
+ }
+#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
+ }
+ writer.WriteEndObject();
+ writer.WritePropertyName("partnerRequestHeaders"u8);
+ writer.WriteStartObject();
+ foreach (var item in PartnerRequestHeaders)
+ {
+ writer.WritePropertyName(item.Key);
+ if (item.Value == null)
+ {
+ writer.WriteNullValue();
+ continue;
+ }
+#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
+ }
+ writer.WriteEndObject();
+ writer.WritePropertyName("inputData"u8);
+ writer.WriteStartObject();
+ foreach (var item in InputData)
+ {
+ writer.WritePropertyName(item.Key);
+ if (item.Value == null)
+ {
+ writer.WriteNullValue();
+ continue;
+ }
+#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
+ }
+ writer.WriteEndObject();
+ 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
+ }
+ }
+ }
+
+ CreateJobRequest 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(CreateJobRequest)} does not support reading '{format}' format.");
+ }
+
+ using JsonDocument document = JsonDocument.ParseValue(ref reader);
+ return DeserializeCreateJobRequest(document.RootElement, options);
+ }
+
+ internal static CreateJobRequest DeserializeCreateJobRequest(JsonElement element, ModelReaderWriterOptions options = null)
+ {
+ options ??= ModelSerializationExtensions.WireOptions;
+
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ string solutionId = default;
+ string requestPath = default;
+ IReadOnlyDictionary partnerRequestBody = default;
+ IReadOnlyDictionary partnerRequestHeaders = default;
+ IReadOnlyDictionary inputData = default;
+ IDictionary serializedAdditionalRawData = default;
+ Dictionary rawDataDictionary = new Dictionary();
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("solutionId"u8))
+ {
+ solutionId = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("requestPath"u8))
+ {
+ requestPath = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("partnerRequestBody"u8))
+ {
+ Dictionary dictionary = new Dictionary();
+ foreach (var property0 in property.Value.EnumerateObject())
+ {
+ if (property0.Value.ValueKind == JsonValueKind.Null)
+ {
+ dictionary.Add(property0.Name, null);
+ }
+ else
+ {
+ dictionary.Add(property0.Name, BinaryData.FromString(property0.Value.GetRawText()));
+ }
+ }
+ partnerRequestBody = dictionary;
+ continue;
+ }
+ if (property.NameEquals("partnerRequestHeaders"u8))
+ {
+ Dictionary dictionary = new Dictionary();
+ foreach (var property0 in property.Value.EnumerateObject())
+ {
+ if (property0.Value.ValueKind == JsonValueKind.Null)
+ {
+ dictionary.Add(property0.Name, null);
+ }
+ else
+ {
+ dictionary.Add(property0.Name, BinaryData.FromString(property0.Value.GetRawText()));
+ }
+ }
+ partnerRequestHeaders = dictionary;
+ continue;
+ }
+ if (property.NameEquals("inputData"u8))
+ {
+ Dictionary dictionary = new Dictionary();
+ foreach (var property0 in property.Value.EnumerateObject())
+ {
+ if (property0.Value.ValueKind == JsonValueKind.Null)
+ {
+ dictionary.Add(property0.Name, null);
+ }
+ else
+ {
+ dictionary.Add(property0.Name, BinaryData.FromString(property0.Value.GetRawText()));
+ }
+ }
+ inputData = dictionary;
+ continue;
+ }
+ if (options.Format != "W")
+ {
+ rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText()));
+ }
+ }
+ serializedAdditionalRawData = rawDataDictionary;
+ return new CreateJobRequest(
+ solutionId,
+ requestPath,
+ partnerRequestBody,
+ partnerRequestHeaders,
+ inputData,
+ 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(CreateJobRequest)} does not support writing '{options.Format}' format.");
+ }
+ }
+
+ CreateJobRequest 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 DeserializeCreateJobRequest(document.RootElement, options);
+ }
+ default:
+ throw new FormatException($"The model {nameof(CreateJobRequest)} 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 CreateJobRequest FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions);
+ return DeserializeCreateJobRequest(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/agricultureplatform/Microsoft.AgriculturePlatform/src/Generated/CreateJobRequest.cs b/sdk/agricultureplatform/Microsoft.AgriculturePlatform/src/Generated/CreateJobRequest.cs
new file mode 100644
index 000000000000..6cf2488cd828
--- /dev/null
+++ b/sdk/agricultureplatform/Microsoft.AgriculturePlatform/src/Generated/CreateJobRequest.cs
@@ -0,0 +1,190 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+
+namespace Microsoft.AgriculturePlatform
+{
+ /// The CreateJobRequest.
+ internal partial class CreateJobRequest
+ {
+ ///
+ /// 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 .
+ /// SolutionId.
+ /// RequestPath.
+ /// Properties.
+ /// Properties.
+ /// Input Data.
+ /// , , , or is null.
+ internal CreateJobRequest(string solutionId, string requestPath, IReadOnlyDictionary partnerRequestBody, IReadOnlyDictionary partnerRequestHeaders, IReadOnlyDictionary inputData)
+ {
+ Argument.AssertNotNull(solutionId, nameof(solutionId));
+ Argument.AssertNotNull(requestPath, nameof(requestPath));
+ Argument.AssertNotNull(partnerRequestBody, nameof(partnerRequestBody));
+ Argument.AssertNotNull(partnerRequestHeaders, nameof(partnerRequestHeaders));
+ Argument.AssertNotNull(inputData, nameof(inputData));
+
+ SolutionId = solutionId;
+ RequestPath = requestPath;
+ PartnerRequestBody = partnerRequestBody;
+ PartnerRequestHeaders = partnerRequestHeaders;
+ InputData = inputData;
+ }
+
+ /// Initializes a new instance of .
+ /// SolutionId.
+ /// RequestPath.
+ /// Properties.
+ /// Properties.
+ /// Input Data.
+ /// Keeps track of any properties unknown to the library.
+ internal CreateJobRequest(string solutionId, string requestPath, IReadOnlyDictionary partnerRequestBody, IReadOnlyDictionary partnerRequestHeaders, IReadOnlyDictionary inputData, IDictionary serializedAdditionalRawData)
+ {
+ SolutionId = solutionId;
+ RequestPath = requestPath;
+ PartnerRequestBody = partnerRequestBody;
+ PartnerRequestHeaders = partnerRequestHeaders;
+ InputData = inputData;
+ _serializedAdditionalRawData = serializedAdditionalRawData;
+ }
+
+ /// Initializes a new instance of for deserialization.
+ internal CreateJobRequest()
+ {
+ }
+
+ /// SolutionId.
+ public string SolutionId { get; }
+ /// RequestPath.
+ public string RequestPath { get; }
+ ///
+ /// Properties.
+ ///
+ /// 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" }.
+ ///
+ ///
+ ///
+ ///
+ public IReadOnlyDictionary PartnerRequestBody { get; }
+ ///
+ /// Properties.
+ ///
+ /// 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" }.
+ ///
+ ///
+ ///
+ ///
+ public IReadOnlyDictionary PartnerRequestHeaders { get; }
+ ///
+ /// Input Data.
+ ///
+ /// 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" }.
+ ///
+ ///
+ ///
+ ///
+ public IReadOnlyDictionary InputData { get; }
+ }
+}
diff --git a/sdk/agricultureplatform/Microsoft.AgriculturePlatform/src/Generated/CreateRequest.Serialization.cs b/sdk/agricultureplatform/Microsoft.AgriculturePlatform/src/Generated/CreateRequest.Serialization.cs
new file mode 100644
index 000000000000..c85acd68e1dd
--- /dev/null
+++ b/sdk/agricultureplatform/Microsoft.AgriculturePlatform/src/Generated/CreateRequest.Serialization.cs
@@ -0,0 +1,333 @@
+// 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;
+using Azure.Core;
+
+namespace Microsoft.AgriculturePlatform
+{
+ internal partial class CreateRequest : 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(CreateRequest)} does not support writing '{format}' format.");
+ }
+
+ if (Optional.IsCollectionDefined(Links))
+ {
+ writer.WritePropertyName("links"u8);
+ writer.WriteStartArray();
+ foreach (var item in Links)
+ {
+ writer.WriteObjectValue(item, options);
+ }
+ writer.WriteEndArray();
+ }
+ if (Optional.IsDefined(Status))
+ {
+ writer.WritePropertyName("status"u8);
+ writer.WriteStringValue(Status);
+ }
+ if (Optional.IsDefined(Source))
+ {
+ writer.WritePropertyName("source"u8);
+ writer.WriteStringValue(Source);
+ }
+ if (Optional.IsDefined(Name))
+ {
+ writer.WritePropertyName("name"u8);
+ writer.WriteStringValue(Name);
+ }
+ if (Optional.IsDefined(Description))
+ {
+ writer.WritePropertyName("description"u8);
+ writer.WriteStringValue(Description);
+ }
+ if (Optional.IsCollectionDefined(Properties))
+ {
+ writer.WritePropertyName("properties"u8);
+ writer.WriteStartObject();
+ foreach (var item in Properties)
+ {
+ writer.WritePropertyName(item.Key);
+ if (item.Value == null)
+ {
+ writer.WriteNullValue();
+ continue;
+ }
+#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
+ }
+ writer.WriteEndObject();
+ }
+ writer.WritePropertyName("data"u8);
+ writer.WriteStartObject();
+ foreach (var item in Data)
+ {
+ writer.WritePropertyName(item.Key);
+ if (item.Value == null)
+ {
+ writer.WriteNullValue();
+ continue;
+ }
+#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
+ }
+ writer.WriteEndObject();
+ if (Optional.IsDefined(OwnerItemId))
+ {
+ writer.WritePropertyName("ownerItemId"u8);
+ writer.WriteStringValue(OwnerItemId);
+ }
+ if (Optional.IsCollectionDefined(Assets))
+ {
+ writer.WritePropertyName("assets"u8);
+ writer.WriteStartArray();
+ foreach (var item in Assets)
+ {
+ 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
+ }
+ }
+ }
+
+ CreateRequest 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(CreateRequest)} does not support reading '{format}' format.");
+ }
+
+ using JsonDocument document = JsonDocument.ParseValue(ref reader);
+ return DeserializeCreateRequest(document.RootElement, options);
+ }
+
+ internal static CreateRequest DeserializeCreateRequest(JsonElement element, ModelReaderWriterOptions options = null)
+ {
+ options ??= ModelSerializationExtensions.WireOptions;
+
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ IReadOnlyList links = default;
+ string status = default;
+ string source = default;
+ string name = default;
+ string description = default;
+ IReadOnlyDictionary properties = default;
+ IReadOnlyDictionary data = default;
+ string ownerItemId = default;
+ IReadOnlyList assets = default;
+ IDictionary