diff --git a/sdk/contosowidgetmanager/Azure.Template.Contoso/Azure.Template.Contoso.sln b/sdk/contosowidgetmanager/Azure.Template.Contoso/Azure.Template.Contoso.sln
new file mode 100644
index 000000000000..b8a126d8fc2a
--- /dev/null
+++ b/sdk/contosowidgetmanager/Azure.Template.Contoso/Azure.Template.Contoso.sln
@@ -0,0 +1,56 @@
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.29709.97
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Core.TestFramework", "..\..\core\Azure.Core.TestFramework\src\Azure.Core.TestFramework.csproj", "{ECC730C1-4AEA-420C-916A-66B19B79E4DC}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.Template.Contoso", "src\Azure.Template.Contoso.csproj", "{28FF4005-4467-4E36-92E7-DEA27DEB1519}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.Template.Contoso.Tests", "tests\Azure.Template.Contoso.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
+ {ECC730C1-4AEA-420C-916A-66B19B79E4DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {ECC730C1-4AEA-420C-916A-66B19B79E4DC}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {ECC730C1-4AEA-420C-916A-66B19B79E4DC}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {ECC730C1-4AEA-420C-916A-66B19B79E4DC}.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/contosowidgetmanager/Azure.Template.Contoso/CHANGELOG.md b/sdk/contosowidgetmanager/Azure.Template.Contoso/CHANGELOG.md
new file mode 100644
index 000000000000..8b33f0fedccc
--- /dev/null
+++ b/sdk/contosowidgetmanager/Azure.Template.Contoso/CHANGELOG.md
@@ -0,0 +1,11 @@
+# Release History
+
+## 1.0.0-beta.1 (Unreleased)
+
+### Features Added
+
+### Breaking Changes
+
+### Bugs Fixed
+
+### Other Changes
\ No newline at end of file
diff --git a/sdk/contosowidgetmanager/Azure.Template.Contoso/Directory.Build.props b/sdk/contosowidgetmanager/Azure.Template.Contoso/Directory.Build.props
new file mode 100644
index 000000000000..63bd836ad44b
--- /dev/null
+++ b/sdk/contosowidgetmanager/Azure.Template.Contoso/Directory.Build.props
@@ -0,0 +1,6 @@
+
+
+
+
diff --git a/sdk/contosowidgetmanager/Azure.Template.Contoso/README.md b/sdk/contosowidgetmanager/Azure.Template.Contoso/README.md
new file mode 100644
index 000000000000..e316c602298d
--- /dev/null
+++ b/sdk/contosowidgetmanager/Azure.Template.Contoso/README.md
@@ -0,0 +1,107 @@
+# Azure.Template.Contoso client library for .NET
+
+Azure.Template.Contoso is a managed service that helps developers get secret simply and securely.
+
+Use the client library for to:
+
+* [Get secret](https://docs.microsoft.com/azure)
+
+[Source code][source_root] | [Package (NuGet)][package] | [API reference documentation][reference_docs] | [Product documentation][azconfig_docs] | [Samples][source_samples]
+
+ [Source code](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/contosowidgetmanager/Azure.Template.Contoso/src) | [Package (NuGet)](https://www.nuget.org/packages) | [API reference documentation](https://azure.github.io/azure-sdk-for-net) | [Product documentation](https://docs.microsoft.com/azure)
+
+## Getting started
+
+This section should include everything a developer needs to do to install and create their first client connection *very quickly*.
+
+### Install the package
+
+First, provide instruction for obtaining and installing the package or library. This section might include only a single line of code, like `dotnet add package package-name`, but should enable a developer to successfully install the package from NuGet, npm, or even cloning a GitHub repository.
+
+Install the client library for .NET with [NuGet](https://www.nuget.org/ ):
+
+```dotnetcli
+dotnet add package Azure.Template.Contoso --prerelease
+```
+
+### Prerequisites
+
+Include a section after the install command that details any requirements that must be satisfied before a developer can [authenticate](#authenticate-the-client) and test all of the snippets in the [Examples](#examples) section. For example, for Cosmos DB:
+
+> You must have an [Azure subscription](https://azure.microsoft.com/free/dotnet/) and [Cosmos DB account](https://docs.microsoft.com/azure/cosmos-db/account-overview) (SQL API). In order to take advantage of the C# 8.0 syntax, it is recommended that you compile using the [.NET Core SDK](https://dotnet.microsoft.com/download) 3.0 or higher with a [language version](https://docs.microsoft.com/dotnet/csharp/language-reference/configure-language-version#override-a-default) of `latest`. It is also possible to compile with the .NET Core SDK 2.1.x using a language version of `preview`.
+
+### Authenticate the client
+
+If your library requires authentication for use, such as for Azure services, include instructions and example code needed for initializing and authenticating.
+
+For example, include details on obtaining an account key and endpoint URI, setting environment variables for each, and initializing the client object.
+
+### Service API versions
+
+The client library targets the latest service API version by default. A client instance accepts an optional service API version parameter from its options to specify which API version service to communicate.
+
+#### Select a service API version
+
+You have the flexibility to explicitly select a supported service API version when instantiating a client by configuring its associated options. This ensures that the client can communicate with services using the specified API version.
+
+For example,
+
+```C# Snippet:CreateClientForSpecificApiVersion
+Uri endpoint = new Uri("");
+DefaultAzureCredential credential = new DefaultAzureCredential();
+ClientOptions options = new ClientOptions(ClientOptions.ServiceVersion.)
+var client = new Client(endpoint, credential, options);
+```
+
+When selecting an API version, it's important to verify that there are no breaking changes compared to the latest API version. If there are significant differences, API calls may fail due to incompatibility.
+
+Always ensure that the chosen API version is fully supported and operational for your specific use case and that it aligns with the service's versioning policy.
+
+## Key concepts
+
+The *Key concepts* section should describe the functionality of the main classes. Point out the most important and useful classes in the package (with links to their reference pages) and explain how those classes work together. Feel free to use bulleted lists, tables, code blocks, or even diagrams for clarity.
+
+Include the *Thread safety* and *Additional concepts* sections below at the end of your *Key concepts* section. You may remove or add links depending on what your library makes use of:
+
+### Thread safety
+
+We guarantee that all client instance methods are thread-safe and independent of each other ([guideline](https://azure.github.io/azure-sdk/dotnet_introduction.html#dotnet-service-methods-thread-safety)). This ensures that the recommendation of reusing client instances is always safe, even across threads.
+
+### Additional concepts
+
+[Client options](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/README.md#configuring-service-clients-using-clientoptions) |
+[Accessing the response](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/README.md#accessing-http-response-details-using-responset) |
+[Long-running operations](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/README.md#consuming-long-running-operations-using-operationt) |
+[Handling failures](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/README.md#reporting-errors-requestfailedexception) |
+[Diagnostics](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/samples/Diagnostics.md) |
+[Mocking](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/README.md#mocking) |
+[Client lifetime](https://devblogs.microsoft.com/azure-sdk/lifetime-management-and-thread-safety-guarantees-of-azure-sdk-net-clients/)
+
+
+## Examples
+
+You can familiarize yourself with different APIs using [Samples](https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/contosowidgetmanager/Azure.Template.Contoso/samples).
+
+## Troubleshooting
+
+Describe common errors and exceptions, how to "unpack" them if necessary, and include guidance for graceful handling and recovery.
+
+Provide information to help developers avoid throttling or other service-enforced errors they might encounter. For example, provide guidance and examples for using retry or connection policies in the API.
+
+If the package or a related package supports it, include tips for logging or enabling instrumentation to help them debug their code.
+
+## Next steps
+
+* Provide a link to additional code examples, ideally to those sitting alongside the README in the package's `/samples` directory.
+* If appropriate, point users to other packages that might be useful.
+* If you think there's a good chance that developers might stumble across your package in error (because they're searching for specific functionality and mistakenly think the package provides that functionality), point them to the packages they might be looking for.
+
+## Contributing
+
+This is a template, but your SDK readme should include details on how to contribute code to the repo/package.
+
+
+[style-guide-msft]: https://docs.microsoft.com/style-guide/capitalization
+[style-guide-cloud]: https://aka.ms/azsdk/cloud-style-guide
+
+
\ No newline at end of file
diff --git a/sdk/contosowidgetmanager/Azure.Template.Contoso/api/Azure.Template.Contoso.net8.0.cs b/sdk/contosowidgetmanager/Azure.Template.Contoso/api/Azure.Template.Contoso.net8.0.cs
new file mode 100644
index 000000000000..94f8d7b1d24b
--- /dev/null
+++ b/sdk/contosowidgetmanager/Azure.Template.Contoso/api/Azure.Template.Contoso.net8.0.cs
@@ -0,0 +1,121 @@
+namespace Azure.Template.Contoso
+{
+ public partial class AzureTemplateContosoContext : System.ClientModel.Primitives.ModelReaderWriterContext
+ {
+ internal AzureTemplateContosoContext() { }
+ public static Azure.Template.Contoso.AzureTemplateContosoContext Default { get { throw null; } }
+ protected override bool TryGetTypeBuilderCore(System.Type type, out System.ClientModel.Primitives.ModelReaderWriterTypeBuilder builder) { throw null; }
+ }
+ public partial class ContosoWidgets
+ {
+ protected ContosoWidgets() { }
+ public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } }
+ public virtual Azure.Operation CreateOrUpdateWidget(Azure.WaitUntil waitUntil, string widgetName, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; }
+ public virtual System.Threading.Tasks.Task> CreateOrUpdateWidgetAsync(Azure.WaitUntil waitUntil, string widgetName, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; }
+ public virtual Azure.Operation DeleteWidget(Azure.WaitUntil waitUntil, string widgetName, Azure.RequestContext context) { throw null; }
+ public virtual Azure.Operation DeleteWidget(Azure.WaitUntil waitUntil, string widgetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ public virtual System.Threading.Tasks.Task> DeleteWidgetAsync(Azure.WaitUntil waitUntil, string widgetName, Azure.RequestContext context) { throw null; }
+ public virtual System.Threading.Tasks.Task> DeleteWidgetAsync(Azure.WaitUntil waitUntil, string widgetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ public virtual Azure.Response GetWidget(string widgetName, Azure.RequestContext context) { throw null; }
+ public virtual Azure.Response GetWidget(string widgetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ public virtual System.Threading.Tasks.Task GetWidgetAsync(string widgetName, Azure.RequestContext context) { throw null; }
+ public virtual System.Threading.Tasks.Task> GetWidgetAsync(string widgetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ public virtual Azure.Response GetWidgetOperationStatus(string widgetName, string operationId, Azure.RequestContext context) { throw null; }
+ public virtual Azure.Response GetWidgetOperationStatus(string widgetName, string operationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ public virtual System.Threading.Tasks.Task GetWidgetOperationStatusAsync(string widgetName, string operationId, Azure.RequestContext context) { throw null; }
+ public virtual System.Threading.Tasks.Task> GetWidgetOperationStatusAsync(string widgetName, string operationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ public virtual Azure.Pageable GetWidgets(Azure.RequestContext context) { throw null; }
+ public virtual Azure.Pageable GetWidgets(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ public virtual Azure.AsyncPageable GetWidgetsAsync(Azure.RequestContext context) { throw null; }
+ public virtual Azure.AsyncPageable GetWidgetsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ }
+ public partial class FakedSharedModel : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel
+ {
+ public FakedSharedModel(string tag, System.DateTimeOffset createdAt) { }
+ public System.DateTimeOffset CreatedAt { get { throw null; } set { } }
+ public string Tag { get { throw null; } set { } }
+ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { }
+ Azure.Template.Contoso.FakedSharedModel System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
+ void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { }
+ Azure.Template.Contoso.FakedSharedModel System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
+ string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
+ System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
+ }
+ [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
+ public readonly partial struct OperationState : System.IEquatable
+ {
+ private readonly object _dummy;
+ private readonly int _dummyPrimitive;
+ public OperationState(string value) { throw null; }
+ public static Azure.Template.Contoso.OperationState Canceled { get { throw null; } }
+ public static Azure.Template.Contoso.OperationState Failed { get { throw null; } }
+ public static Azure.Template.Contoso.OperationState NotStarted { get { throw null; } }
+ public static Azure.Template.Contoso.OperationState Running { get { throw null; } }
+ public static Azure.Template.Contoso.OperationState Succeeded { get { throw null; } }
+ public bool Equals(Azure.Template.Contoso.OperationState other) { throw null; }
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+ public override bool Equals(object obj) { throw null; }
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+ public override int GetHashCode() { throw null; }
+ public static bool operator ==(Azure.Template.Contoso.OperationState left, Azure.Template.Contoso.OperationState right) { throw null; }
+ public static implicit operator Azure.Template.Contoso.OperationState (string value) { throw null; }
+ public static bool operator !=(Azure.Template.Contoso.OperationState left, Azure.Template.Contoso.OperationState right) { throw null; }
+ public override string ToString() { throw null; }
+ }
+ public partial class ResourceOperationStatusWidgetSuiteWidgetSuiteError : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel
+ {
+ internal ResourceOperationStatusWidgetSuiteWidgetSuiteError() { }
+ public Azure.ResponseError Error { get { throw null; } }
+ public string Id { get { throw null; } }
+ public Azure.Template.Contoso.WidgetSuite Result { get { throw null; } }
+ public Azure.Template.Contoso.OperationState Status { get { throw null; } }
+ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { }
+ Azure.Template.Contoso.ResourceOperationStatusWidgetSuiteWidgetSuiteError System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
+ void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { }
+ Azure.Template.Contoso.ResourceOperationStatusWidgetSuiteWidgetSuiteError System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
+ string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
+ System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
+ }
+ public static partial class TemplateContosoModelFactory
+ {
+ public static Azure.Template.Contoso.ResourceOperationStatusWidgetSuiteWidgetSuiteError ResourceOperationStatusWidgetSuiteWidgetSuiteError(string id = null, Azure.Template.Contoso.OperationState status = default(Azure.Template.Contoso.OperationState), Azure.ResponseError error = null, Azure.Template.Contoso.WidgetSuite result = null) { throw null; }
+ public static Azure.Template.Contoso.WidgetSuite WidgetSuite(string name = null, string manufacturerId = null, Azure.Template.Contoso.FakedSharedModel sharedModel = null) { throw null; }
+ }
+ public partial class WidgetManagerClient
+ {
+ protected WidgetManagerClient() { }
+ public WidgetManagerClient(System.Uri endpoint, Azure.Core.TokenCredential credential) { }
+ public WidgetManagerClient(System.Uri endpoint, Azure.Core.TokenCredential credential, Azure.Template.Contoso.WidgetManagerClientOptions options) { }
+ public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } }
+ public virtual Azure.Template.Contoso.ContosoWidgets GetContosoWidgetsClient(string apiVersion = "2022-12-01") { throw null; }
+ }
+ public partial class WidgetManagerClientOptions : Azure.Core.ClientOptions
+ {
+ public WidgetManagerClientOptions(Azure.Template.Contoso.WidgetManagerClientOptions.ServiceVersion version = Azure.Template.Contoso.WidgetManagerClientOptions.ServiceVersion.V2022_12_01) { }
+ public enum ServiceVersion
+ {
+ V2022_12_01 = 1,
+ }
+ }
+ public partial class WidgetSuite : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel
+ {
+ public WidgetSuite(string manufacturerId) { }
+ public string ManufacturerId { get { throw null; } set { } }
+ public string Name { get { throw null; } }
+ public Azure.Template.Contoso.FakedSharedModel SharedModel { get { throw null; } set { } }
+ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { }
+ Azure.Template.Contoso.WidgetSuite System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
+ void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { }
+ Azure.Template.Contoso.WidgetSuite System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
+ string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
+ System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
+ }
+}
+namespace Microsoft.Extensions.Azure
+{
+ public static partial class TemplateContosoClientBuilderExtensions
+ {
+ public static Azure.Core.Extensions.IAzureClientBuilder AddWidgetManagerClient(this TBuilder builder, System.Uri endpoint) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilderWithCredential { throw null; }
+ public static Azure.Core.Extensions.IAzureClientBuilder AddWidgetManagerClient(this TBuilder builder, TConfiguration configuration) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilderWithConfiguration { throw null; }
+ }
+}
diff --git a/sdk/contosowidgetmanager/Azure.Template.Contoso/api/Azure.Template.Contoso.netstandard2.0.cs b/sdk/contosowidgetmanager/Azure.Template.Contoso/api/Azure.Template.Contoso.netstandard2.0.cs
new file mode 100644
index 000000000000..94f8d7b1d24b
--- /dev/null
+++ b/sdk/contosowidgetmanager/Azure.Template.Contoso/api/Azure.Template.Contoso.netstandard2.0.cs
@@ -0,0 +1,121 @@
+namespace Azure.Template.Contoso
+{
+ public partial class AzureTemplateContosoContext : System.ClientModel.Primitives.ModelReaderWriterContext
+ {
+ internal AzureTemplateContosoContext() { }
+ public static Azure.Template.Contoso.AzureTemplateContosoContext Default { get { throw null; } }
+ protected override bool TryGetTypeBuilderCore(System.Type type, out System.ClientModel.Primitives.ModelReaderWriterTypeBuilder builder) { throw null; }
+ }
+ public partial class ContosoWidgets
+ {
+ protected ContosoWidgets() { }
+ public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } }
+ public virtual Azure.Operation CreateOrUpdateWidget(Azure.WaitUntil waitUntil, string widgetName, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; }
+ public virtual System.Threading.Tasks.Task> CreateOrUpdateWidgetAsync(Azure.WaitUntil waitUntil, string widgetName, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; }
+ public virtual Azure.Operation DeleteWidget(Azure.WaitUntil waitUntil, string widgetName, Azure.RequestContext context) { throw null; }
+ public virtual Azure.Operation DeleteWidget(Azure.WaitUntil waitUntil, string widgetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ public virtual System.Threading.Tasks.Task> DeleteWidgetAsync(Azure.WaitUntil waitUntil, string widgetName, Azure.RequestContext context) { throw null; }
+ public virtual System.Threading.Tasks.Task> DeleteWidgetAsync(Azure.WaitUntil waitUntil, string widgetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ public virtual Azure.Response GetWidget(string widgetName, Azure.RequestContext context) { throw null; }
+ public virtual Azure.Response GetWidget(string widgetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ public virtual System.Threading.Tasks.Task GetWidgetAsync(string widgetName, Azure.RequestContext context) { throw null; }
+ public virtual System.Threading.Tasks.Task> GetWidgetAsync(string widgetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ public virtual Azure.Response GetWidgetOperationStatus(string widgetName, string operationId, Azure.RequestContext context) { throw null; }
+ public virtual Azure.Response GetWidgetOperationStatus(string widgetName, string operationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ public virtual System.Threading.Tasks.Task GetWidgetOperationStatusAsync(string widgetName, string operationId, Azure.RequestContext context) { throw null; }
+ public virtual System.Threading.Tasks.Task> GetWidgetOperationStatusAsync(string widgetName, string operationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ public virtual Azure.Pageable GetWidgets(Azure.RequestContext context) { throw null; }
+ public virtual Azure.Pageable GetWidgets(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ public virtual Azure.AsyncPageable GetWidgetsAsync(Azure.RequestContext context) { throw null; }
+ public virtual Azure.AsyncPageable GetWidgetsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ }
+ public partial class FakedSharedModel : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel
+ {
+ public FakedSharedModel(string tag, System.DateTimeOffset createdAt) { }
+ public System.DateTimeOffset CreatedAt { get { throw null; } set { } }
+ public string Tag { get { throw null; } set { } }
+ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { }
+ Azure.Template.Contoso.FakedSharedModel System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
+ void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { }
+ Azure.Template.Contoso.FakedSharedModel System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
+ string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
+ System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
+ }
+ [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
+ public readonly partial struct OperationState : System.IEquatable
+ {
+ private readonly object _dummy;
+ private readonly int _dummyPrimitive;
+ public OperationState(string value) { throw null; }
+ public static Azure.Template.Contoso.OperationState Canceled { get { throw null; } }
+ public static Azure.Template.Contoso.OperationState Failed { get { throw null; } }
+ public static Azure.Template.Contoso.OperationState NotStarted { get { throw null; } }
+ public static Azure.Template.Contoso.OperationState Running { get { throw null; } }
+ public static Azure.Template.Contoso.OperationState Succeeded { get { throw null; } }
+ public bool Equals(Azure.Template.Contoso.OperationState other) { throw null; }
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+ public override bool Equals(object obj) { throw null; }
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+ public override int GetHashCode() { throw null; }
+ public static bool operator ==(Azure.Template.Contoso.OperationState left, Azure.Template.Contoso.OperationState right) { throw null; }
+ public static implicit operator Azure.Template.Contoso.OperationState (string value) { throw null; }
+ public static bool operator !=(Azure.Template.Contoso.OperationState left, Azure.Template.Contoso.OperationState right) { throw null; }
+ public override string ToString() { throw null; }
+ }
+ public partial class ResourceOperationStatusWidgetSuiteWidgetSuiteError : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel
+ {
+ internal ResourceOperationStatusWidgetSuiteWidgetSuiteError() { }
+ public Azure.ResponseError Error { get { throw null; } }
+ public string Id { get { throw null; } }
+ public Azure.Template.Contoso.WidgetSuite Result { get { throw null; } }
+ public Azure.Template.Contoso.OperationState Status { get { throw null; } }
+ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { }
+ Azure.Template.Contoso.ResourceOperationStatusWidgetSuiteWidgetSuiteError System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
+ void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { }
+ Azure.Template.Contoso.ResourceOperationStatusWidgetSuiteWidgetSuiteError System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
+ string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
+ System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
+ }
+ public static partial class TemplateContosoModelFactory
+ {
+ public static Azure.Template.Contoso.ResourceOperationStatusWidgetSuiteWidgetSuiteError ResourceOperationStatusWidgetSuiteWidgetSuiteError(string id = null, Azure.Template.Contoso.OperationState status = default(Azure.Template.Contoso.OperationState), Azure.ResponseError error = null, Azure.Template.Contoso.WidgetSuite result = null) { throw null; }
+ public static Azure.Template.Contoso.WidgetSuite WidgetSuite(string name = null, string manufacturerId = null, Azure.Template.Contoso.FakedSharedModel sharedModel = null) { throw null; }
+ }
+ public partial class WidgetManagerClient
+ {
+ protected WidgetManagerClient() { }
+ public WidgetManagerClient(System.Uri endpoint, Azure.Core.TokenCredential credential) { }
+ public WidgetManagerClient(System.Uri endpoint, Azure.Core.TokenCredential credential, Azure.Template.Contoso.WidgetManagerClientOptions options) { }
+ public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } }
+ public virtual Azure.Template.Contoso.ContosoWidgets GetContosoWidgetsClient(string apiVersion = "2022-12-01") { throw null; }
+ }
+ public partial class WidgetManagerClientOptions : Azure.Core.ClientOptions
+ {
+ public WidgetManagerClientOptions(Azure.Template.Contoso.WidgetManagerClientOptions.ServiceVersion version = Azure.Template.Contoso.WidgetManagerClientOptions.ServiceVersion.V2022_12_01) { }
+ public enum ServiceVersion
+ {
+ V2022_12_01 = 1,
+ }
+ }
+ public partial class WidgetSuite : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel
+ {
+ public WidgetSuite(string manufacturerId) { }
+ public string ManufacturerId { get { throw null; } set { } }
+ public string Name { get { throw null; } }
+ public Azure.Template.Contoso.FakedSharedModel SharedModel { get { throw null; } set { } }
+ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { }
+ Azure.Template.Contoso.WidgetSuite System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
+ void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { }
+ Azure.Template.Contoso.WidgetSuite System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
+ string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
+ System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; }
+ }
+}
+namespace Microsoft.Extensions.Azure
+{
+ public static partial class TemplateContosoClientBuilderExtensions
+ {
+ public static Azure.Core.Extensions.IAzureClientBuilder AddWidgetManagerClient(this TBuilder builder, System.Uri endpoint) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilderWithCredential { throw null; }
+ public static Azure.Core.Extensions.IAzureClientBuilder AddWidgetManagerClient(this TBuilder builder, TConfiguration configuration) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilderWithConfiguration { throw null; }
+ }
+}
diff --git a/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Azure.Template.Contoso.csproj b/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Azure.Template.Contoso.csproj
new file mode 100644
index 000000000000..8e26ba2f2db8
--- /dev/null
+++ b/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Azure.Template.Contoso.csproj
@@ -0,0 +1,19 @@
+
+
+ This is the Azure.Template.Contoso client library for developing .NET applications with rich experience.
+ Azure SDK Code Generation Azure.Template.Contoso for Azure Data Plane
+ 1.0.0-beta.1
+ Azure.Template.Contoso
+ $(RequiredTargetFrameworks)
+ true
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/ContosoWidgets.cs b/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/ContosoWidgets.cs
new file mode 100644
index 000000000000..805332d7b840
--- /dev/null
+++ b/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/ContosoWidgets.cs
@@ -0,0 +1,661 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Text.Json;
+using System.Threading;
+using System.Threading.Tasks;
+using Autorest.CSharp.Core;
+using Azure.Core;
+using Azure.Core.Pipeline;
+
+namespace Azure.Template.Contoso
+{
+ // Data plane generated sub-client.
+ /// The ContosoWidgets sub-client.
+ public partial class ContosoWidgets
+ {
+ private static readonly string[] AuthorizationScopes = new string[] { "https://contoso.azure.com/.default" };
+ private readonly TokenCredential _tokenCredential;
+ private readonly HttpPipeline _pipeline;
+ private readonly Uri _endpoint;
+ private readonly string _apiVersion;
+
+ /// The ClientDiagnostics is used to provide tracing support for the client library.
+ internal ClientDiagnostics ClientDiagnostics { get; }
+
+ /// The HTTP pipeline for sending and receiving REST requests and responses.
+ public virtual HttpPipeline Pipeline => _pipeline;
+
+ /// Initializes a new instance of ContosoWidgets for mocking.
+ protected ContosoWidgets()
+ {
+ }
+
+ /// Initializes a new instance of ContosoWidgets.
+ /// The handler for diagnostic messaging in the client.
+ /// The HTTP pipeline for sending and receiving REST requests and responses.
+ /// The token credential to copy.
+ /// Service host.
+ /// The API version to use for this operation.
+ internal ContosoWidgets(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, TokenCredential tokenCredential, Uri endpoint, string apiVersion)
+ {
+ ClientDiagnostics = clientDiagnostics;
+ _pipeline = pipeline;
+ _tokenCredential = tokenCredential;
+ _endpoint = endpoint;
+ _apiVersion = apiVersion;
+ }
+
+ /// Fetch a Widget by name.
+ /// The widget name.
+ /// The cancellation token to use.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ ///
+ public virtual async Task> GetWidgetAsync(string widgetName, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(widgetName, nameof(widgetName));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = await GetWidgetAsync(widgetName, context).ConfigureAwait(false);
+ return Response.FromValue(WidgetSuite.FromResponse(response), response);
+ }
+
+ /// Fetch a Widget by name.
+ /// The widget name.
+ /// The cancellation token to use.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ ///
+ public virtual Response GetWidget(string widgetName, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(widgetName, nameof(widgetName));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = GetWidget(widgetName, context);
+ return Response.FromValue(WidgetSuite.FromResponse(response), response);
+ }
+
+ ///
+ /// [Protocol Method] Fetch a Widget by name.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ /// -
+ ///
+ /// Please try the simpler convenience overload with strongly typed models first.
+ ///
+ ///
+ ///
+ ///
+ /// The widget name.
+ /// 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 GetWidgetAsync(string widgetName, RequestContext context)
+ {
+ Argument.AssertNotNullOrEmpty(widgetName, nameof(widgetName));
+
+ using var scope = ClientDiagnostics.CreateScope("ContosoWidgets.GetWidget");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateGetWidgetRequest(widgetName, context);
+ return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// [Protocol Method] Fetch a Widget by name.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ /// -
+ ///
+ /// Please try the simpler convenience overload with strongly typed models first.
+ ///
+ ///
+ ///
+ ///
+ /// The widget name.
+ /// 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 GetWidget(string widgetName, RequestContext context)
+ {
+ Argument.AssertNotNullOrEmpty(widgetName, nameof(widgetName));
+
+ using var scope = ClientDiagnostics.CreateScope("ContosoWidgets.GetWidget");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateGetWidgetRequest(widgetName, context);
+ return _pipeline.ProcessMessage(message, context);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Gets status of a Widget operation.
+ /// The widget name.
+ /// The unique ID of the operation.
+ /// The cancellation token to use.
+ /// or is null.
+ /// or is an empty string, and was expected to be non-empty.
+ ///
+ public virtual async Task> GetWidgetOperationStatusAsync(string widgetName, string operationId, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(widgetName, nameof(widgetName));
+ Argument.AssertNotNullOrEmpty(operationId, nameof(operationId));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = await GetWidgetOperationStatusAsync(widgetName, operationId, context).ConfigureAwait(false);
+ return Response.FromValue(ResourceOperationStatusWidgetSuiteWidgetSuiteError.FromResponse(response), response);
+ }
+
+ /// Gets status of a Widget operation.
+ /// The widget name.
+ /// The unique ID of the operation.
+ /// The cancellation token to use.
+ /// or is null.
+ /// or is an empty string, and was expected to be non-empty.
+ ///
+ public virtual Response GetWidgetOperationStatus(string widgetName, string operationId, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(widgetName, nameof(widgetName));
+ Argument.AssertNotNullOrEmpty(operationId, nameof(operationId));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = GetWidgetOperationStatus(widgetName, operationId, context);
+ return Response.FromValue(ResourceOperationStatusWidgetSuiteWidgetSuiteError.FromResponse(response), response);
+ }
+
+ ///
+ /// [Protocol Method] Gets status of a Widget operation.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ /// -
+ ///
+ /// Please try the simpler convenience overload with strongly typed models first.
+ ///
+ ///
+ ///
+ ///
+ /// The widget name.
+ /// The unique ID of the operation.
+ /// 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 GetWidgetOperationStatusAsync(string widgetName, string operationId, RequestContext context)
+ {
+ Argument.AssertNotNullOrEmpty(widgetName, nameof(widgetName));
+ Argument.AssertNotNullOrEmpty(operationId, nameof(operationId));
+
+ using var scope = ClientDiagnostics.CreateScope("ContosoWidgets.GetWidgetOperationStatus");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateGetWidgetOperationStatusRequest(widgetName, operationId, context);
+ return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// [Protocol Method] Gets status of a Widget operation.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ /// -
+ ///
+ /// Please try the simpler convenience overload with strongly typed models first.
+ ///
+ ///
+ ///
+ ///
+ /// The widget name.
+ /// The unique ID of the operation.
+ /// 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 GetWidgetOperationStatus(string widgetName, string operationId, RequestContext context)
+ {
+ Argument.AssertNotNullOrEmpty(widgetName, nameof(widgetName));
+ Argument.AssertNotNullOrEmpty(operationId, nameof(operationId));
+
+ using var scope = ClientDiagnostics.CreateScope("ContosoWidgets.GetWidgetOperationStatus");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateGetWidgetOperationStatusRequest(widgetName, operationId, context);
+ return _pipeline.ProcessMessage(message, context);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// List Widget resources.
+ /// The cancellation token to use.
+ ///
+ public virtual AsyncPageable GetWidgetsAsync(CancellationToken cancellationToken = default)
+ {
+ RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null;
+ HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetWidgetsRequest(context);
+ HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetWidgetsNextPageRequest(nextLink, context);
+ return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => WidgetSuite.DeserializeWidgetSuite(e), ClientDiagnostics, _pipeline, "ContosoWidgets.GetWidgets", "value", "nextLink", context);
+ }
+
+ /// List Widget resources.
+ /// The cancellation token to use.
+ ///
+ public virtual Pageable GetWidgets(CancellationToken cancellationToken = default)
+ {
+ RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null;
+ HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetWidgetsRequest(context);
+ HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetWidgetsNextPageRequest(nextLink, context);
+ return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => WidgetSuite.DeserializeWidgetSuite(e), ClientDiagnostics, _pipeline, "ContosoWidgets.GetWidgets", "value", "nextLink", context);
+ }
+
+ ///
+ /// [Protocol Method] List Widget 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.
+ ///
+ ///
+ ///
+ ///
+ /// 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 GetWidgetsAsync(RequestContext context)
+ {
+ HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetWidgetsRequest(context);
+ HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetWidgetsNextPageRequest(nextLink, context);
+ return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ContosoWidgets.GetWidgets", "value", "nextLink", context);
+ }
+
+ ///
+ /// [Protocol Method] List Widget 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.
+ ///
+ ///
+ ///
+ ///
+ /// 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 GetWidgets(RequestContext context)
+ {
+ HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetWidgetsRequest(context);
+ HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetWidgetsNextPageRequest(nextLink, context);
+ return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ContosoWidgets.GetWidgets", "value", "nextLink", context);
+ }
+
+ ///
+ /// [Protocol Method] Creates or updates a Widget asynchronously.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples.
+ /// The widget name.
+ /// 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 representing an asynchronous operation on the service.
+ ///
+ public virtual async Task> CreateOrUpdateWidgetAsync(WaitUntil waitUntil, string widgetName, RequestContent content, RequestContext context = null)
+ {
+ Argument.AssertNotNullOrEmpty(widgetName, nameof(widgetName));
+ Argument.AssertNotNull(content, nameof(content));
+
+ using var scope = ClientDiagnostics.CreateScope("ContosoWidgets.CreateOrUpdateWidget");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateCreateOrUpdateWidgetRequest(widgetName, content, context);
+ return await ProtocolOperationHelpers.ProcessMessageAsync(_pipeline, message, ClientDiagnostics, "ContosoWidgets.CreateOrUpdateWidget", OperationFinalStateVia.OperationLocation, context, waitUntil).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// [Protocol Method] Creates or updates a Widget asynchronously.
+ ///
+ /// -
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples.
+ /// The widget name.
+ /// 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 representing an asynchronous operation on the service.
+ ///
+ public virtual Operation CreateOrUpdateWidget(WaitUntil waitUntil, string widgetName, RequestContent content, RequestContext context = null)
+ {
+ Argument.AssertNotNullOrEmpty(widgetName, nameof(widgetName));
+ Argument.AssertNotNull(content, nameof(content));
+
+ using var scope = ClientDiagnostics.CreateScope("ContosoWidgets.CreateOrUpdateWidget");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateCreateOrUpdateWidgetRequest(widgetName, content, context);
+ return ProtocolOperationHelpers.ProcessMessage(_pipeline, message, ClientDiagnostics, "ContosoWidgets.CreateOrUpdateWidget", OperationFinalStateVia.OperationLocation, context, waitUntil);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ /// Delete a Widget asynchronously.
+ /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples.
+ /// The widget name.
+ /// The cancellation token to use.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ ///
+ public virtual async Task> DeleteWidgetAsync(WaitUntil waitUntil, string widgetName, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(widgetName, nameof(widgetName));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Operation response = await DeleteWidgetAsync(waitUntil, widgetName, context).ConfigureAwait(false);
+ return ProtocolOperationHelpers.Convert(response, FetchWidgetSuiteFromResourceOperationStatusWidgetSuiteWidgetSuiteError, ClientDiagnostics, "ContosoWidgets.DeleteWidget");
+ }
+
+ /// Delete a Widget asynchronously.
+ /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples.
+ /// The widget name.
+ /// The cancellation token to use.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ ///
+ public virtual Operation DeleteWidget(WaitUntil waitUntil, string widgetName, CancellationToken cancellationToken = default)
+ {
+ Argument.AssertNotNullOrEmpty(widgetName, nameof(widgetName));
+
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Operation response = DeleteWidget(waitUntil, widgetName, context);
+ return ProtocolOperationHelpers.Convert(response, FetchWidgetSuiteFromResourceOperationStatusWidgetSuiteWidgetSuiteError, ClientDiagnostics, "ContosoWidgets.DeleteWidget");
+ }
+
+ ///
+ /// [Protocol Method] Delete a Widget asynchronously.
+ ///
+ /// -
+ ///
+ /// 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.
+ ///
+ ///
+ ///
+ ///
+ /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples.
+ /// The widget name.
+ /// 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 representing an asynchronous operation on the service.
+ ///
+ public virtual async Task> DeleteWidgetAsync(WaitUntil waitUntil, string widgetName, RequestContext context)
+ {
+ Argument.AssertNotNullOrEmpty(widgetName, nameof(widgetName));
+
+ using var scope = ClientDiagnostics.CreateScope("ContosoWidgets.DeleteWidget");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateDeleteWidgetRequest(widgetName, context);
+ return await ProtocolOperationHelpers.ProcessMessageAsync(_pipeline, message, ClientDiagnostics, "ContosoWidgets.DeleteWidget", OperationFinalStateVia.OperationLocation, context, waitUntil).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ ///
+ /// [Protocol Method] Delete a Widget asynchronously.
+ ///
+ /// -
+ ///
+ /// 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.
+ ///
+ ///
+ ///
+ ///
+ /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples.
+ /// The widget name.
+ /// 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 representing an asynchronous operation on the service.
+ ///
+ public virtual Operation DeleteWidget(WaitUntil waitUntil, string widgetName, RequestContext context)
+ {
+ Argument.AssertNotNullOrEmpty(widgetName, nameof(widgetName));
+
+ using var scope = ClientDiagnostics.CreateScope("ContosoWidgets.DeleteWidget");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateDeleteWidgetRequest(widgetName, context);
+ return ProtocolOperationHelpers.ProcessMessage(_pipeline, message, ClientDiagnostics, "ContosoWidgets.DeleteWidget", OperationFinalStateVia.OperationLocation, context, waitUntil);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
+ }
+ }
+
+ internal HttpMessage CreateGetWidgetRequest(string widgetName, 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("/widgets/", false);
+ uri.AppendPath(widgetName, true);
+ uri.AppendQuery("api-version", _apiVersion, true);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ return message;
+ }
+
+ internal HttpMessage CreateGetWidgetOperationStatusRequest(string widgetName, string operationId, 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("/widgets/", false);
+ uri.AppendPath(widgetName, true);
+ uri.AppendPath("/operations/", false);
+ uri.AppendPath(operationId, true);
+ uri.AppendQuery("api-version", _apiVersion, true);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ return message;
+ }
+
+ internal HttpMessage CreateCreateOrUpdateWidgetRequest(string widgetName, 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("/widgets/", false);
+ uri.AppendPath(widgetName, 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 CreateDeleteWidgetRequest(string widgetName, RequestContext context)
+ {
+ var message = _pipeline.CreateMessage(context, ResponseClassifier202);
+ var request = message.Request;
+ request.Method = RequestMethod.Delete;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(_endpoint);
+ uri.AppendPath("/widgets/", false);
+ uri.AppendPath(widgetName, true);
+ uri.AppendQuery("api-version", _apiVersion, true);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ return message;
+ }
+
+ internal HttpMessage CreateGetWidgetsRequest(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("/widgets", false);
+ uri.AppendQuery("api-version", _apiVersion, true);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ return message;
+ }
+
+ internal HttpMessage CreateGetWidgetsNextPageRequest(string nextLink, 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 _responseClassifier202;
+ private static ResponseClassifier ResponseClassifier202 => _responseClassifier202 ??= new StatusCodeClassifier(stackalloc ushort[] { 202 });
+
+ private WidgetSuite FetchWidgetSuiteFromResourceOperationStatusWidgetSuiteWidgetSuiteError(Response response)
+ {
+ var resultJsonElement = JsonDocument.Parse(response.Content).RootElement.GetProperty("result");
+ return WidgetSuite.DeserializeWidgetSuite(resultJsonElement);
+ }
+ }
+}
diff --git a/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/Docs/ContosoWidgets.xml b/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/Docs/ContosoWidgets.xml
new file mode 100644
index 000000000000..f93a7fff74d1
--- /dev/null
+++ b/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/Docs/ContosoWidgets.xml
@@ -0,0 +1,273 @@
+
+
+
+
+
+This sample shows how to call GetWidgetAsync.
+");
+TokenCredential credential = new DefaultAzureCredential();
+ContosoWidgets client = new WidgetManagerClient(endpoint, credential).GetContosoWidgetsClient(apiVersion: "2022-12-01");
+
+Response response = await client.GetWidgetAsync("searchbox");
+]]>
+
+
+
+This sample shows how to call GetWidget.
+");
+TokenCredential credential = new DefaultAzureCredential();
+ContosoWidgets client = new WidgetManagerClient(endpoint, credential).GetContosoWidgetsClient(apiVersion: "2022-12-01");
+
+Response response = client.GetWidget("searchbox");
+]]>
+
+
+
+This sample shows how to call GetWidgetAsync and parse the result.
+");
+TokenCredential credential = new DefaultAzureCredential();
+ContosoWidgets client = new WidgetManagerClient(endpoint, credential).GetContosoWidgetsClient(apiVersion: "2022-12-01");
+
+Response response = await client.GetWidgetAsync("searchbox", null);
+
+JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
+Console.WriteLine(result.GetProperty("name").ToString());
+Console.WriteLine(result.GetProperty("manufacturerId").ToString());
+]]>
+
+
+
+This sample shows how to call GetWidget and parse the result.
+");
+TokenCredential credential = new DefaultAzureCredential();
+ContosoWidgets client = new WidgetManagerClient(endpoint, credential).GetContosoWidgetsClient(apiVersion: "2022-12-01");
+
+Response response = client.GetWidget("searchbox", null);
+
+JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
+Console.WriteLine(result.GetProperty("name").ToString());
+Console.WriteLine(result.GetProperty("manufacturerId").ToString());
+]]>
+
+
+
+This sample shows how to call GetWidgetOperationStatusAsync.
+");
+TokenCredential credential = new DefaultAzureCredential();
+ContosoWidgets client = new WidgetManagerClient(endpoint, credential).GetContosoWidgetsClient(apiVersion: "2022-12-01");
+
+Response response = await client.GetWidgetOperationStatusAsync("name1", "opreation id1");
+]]>
+
+
+
+This sample shows how to call GetWidgetOperationStatus.
+");
+TokenCredential credential = new DefaultAzureCredential();
+ContosoWidgets client = new WidgetManagerClient(endpoint, credential).GetContosoWidgetsClient(apiVersion: "2022-12-01");
+
+Response response = client.GetWidgetOperationStatus("name1", "opreation id1");
+]]>
+
+
+
+This sample shows how to call GetWidgetOperationStatusAsync and parse the result.
+");
+TokenCredential credential = new DefaultAzureCredential();
+ContosoWidgets client = new WidgetManagerClient(endpoint, credential).GetContosoWidgetsClient(apiVersion: "2022-12-01");
+
+Response response = await client.GetWidgetOperationStatusAsync("name1", "opreation id1", null);
+
+JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
+Console.WriteLine(result.GetProperty("id").ToString());
+Console.WriteLine(result.GetProperty("status").ToString());
+]]>
+
+
+
+This sample shows how to call GetWidgetOperationStatus and parse the result.
+");
+TokenCredential credential = new DefaultAzureCredential();
+ContosoWidgets client = new WidgetManagerClient(endpoint, credential).GetContosoWidgetsClient(apiVersion: "2022-12-01");
+
+Response response = client.GetWidgetOperationStatus("name1", "opreation id1", null);
+
+JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
+Console.WriteLine(result.GetProperty("id").ToString());
+Console.WriteLine(result.GetProperty("status").ToString());
+]]>
+
+
+
+This sample shows how to call GetWidgetsAsync.
+");
+TokenCredential credential = new DefaultAzureCredential();
+ContosoWidgets client = new WidgetManagerClient(endpoint, credential).GetContosoWidgetsClient(apiVersion: "2022-12-01");
+
+await foreach (WidgetSuite item in client.GetWidgetsAsync())
+{
+}
+]]>
+
+
+
+This sample shows how to call GetWidgets.
+");
+TokenCredential credential = new DefaultAzureCredential();
+ContosoWidgets client = new WidgetManagerClient(endpoint, credential).GetContosoWidgetsClient(apiVersion: "2022-12-01");
+
+foreach (WidgetSuite item in client.GetWidgets())
+{
+}
+]]>
+
+
+
+This sample shows how to call GetWidgetsAsync and parse the result.
+");
+TokenCredential credential = new DefaultAzureCredential();
+ContosoWidgets client = new WidgetManagerClient(endpoint, credential).GetContosoWidgetsClient(apiVersion: "2022-12-01");
+
+await foreach (BinaryData item in client.GetWidgetsAsync(null))
+{
+ JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement;
+ Console.WriteLine(result.GetProperty("name").ToString());
+ Console.WriteLine(result.GetProperty("manufacturerId").ToString());
+}
+]]>
+
+
+
+This sample shows how to call GetWidgets and parse the result.
+");
+TokenCredential credential = new DefaultAzureCredential();
+ContosoWidgets client = new WidgetManagerClient(endpoint, credential).GetContosoWidgetsClient(apiVersion: "2022-12-01");
+
+foreach (BinaryData item in client.GetWidgets(null))
+{
+ JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement;
+ Console.WriteLine(result.GetProperty("name").ToString());
+ Console.WriteLine(result.GetProperty("manufacturerId").ToString());
+}
+]]>
+
+
+
+This sample shows how to call CreateOrUpdateWidgetAsync and parse the result.
+");
+TokenCredential credential = new DefaultAzureCredential();
+ContosoWidgets client = new WidgetManagerClient(endpoint, credential).GetContosoWidgetsClient(apiVersion: "2022-12-01");
+
+using RequestContent content = RequestContent.Create(new
+{
+ manufacturerId = "manufacturer id1",
+ sharedModel = new
+ {
+ tag = "tag1",
+ createdAt = "2023-01-09T02:12:25.689Z",
+ },
+});
+Operation operation = await client.CreateOrUpdateWidgetAsync(WaitUntil.Completed, "name1", content);
+BinaryData responseData = operation.Value;
+
+JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement;
+Console.WriteLine(result.GetProperty("name").ToString());
+Console.WriteLine(result.GetProperty("manufacturerId").ToString());
+]]>
+
+
+
+This sample shows how to call CreateOrUpdateWidget and parse the result.
+");
+TokenCredential credential = new DefaultAzureCredential();
+ContosoWidgets client = new WidgetManagerClient(endpoint, credential).GetContosoWidgetsClient(apiVersion: "2022-12-01");
+
+using RequestContent content = RequestContent.Create(new
+{
+ manufacturerId = "manufacturer id1",
+ sharedModel = new
+ {
+ tag = "tag1",
+ createdAt = "2023-01-09T02:12:25.689Z",
+ },
+});
+Operation operation = client.CreateOrUpdateWidget(WaitUntil.Completed, "name1", content);
+BinaryData responseData = operation.Value;
+
+JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement;
+Console.WriteLine(result.GetProperty("name").ToString());
+Console.WriteLine(result.GetProperty("manufacturerId").ToString());
+]]>
+
+
+
+This sample shows how to call DeleteWidgetAsync.
+");
+TokenCredential credential = new DefaultAzureCredential();
+ContosoWidgets client = new WidgetManagerClient(endpoint, credential).GetContosoWidgetsClient(apiVersion: "2022-12-01");
+
+Operation operation = await client.DeleteWidgetAsync(WaitUntil.Completed, "searchbox");
+WidgetSuite responseData = operation.Value;
+]]>
+
+
+
+This sample shows how to call DeleteWidget.
+");
+TokenCredential credential = new DefaultAzureCredential();
+ContosoWidgets client = new WidgetManagerClient(endpoint, credential).GetContosoWidgetsClient(apiVersion: "2022-12-01");
+
+Operation operation = client.DeleteWidget(WaitUntil.Completed, "searchbox");
+WidgetSuite responseData = operation.Value;
+]]>
+
+
+
+This sample shows how to call DeleteWidgetAsync and parse the result.
+");
+TokenCredential credential = new DefaultAzureCredential();
+ContosoWidgets client = new WidgetManagerClient(endpoint, credential).GetContosoWidgetsClient(apiVersion: "2022-12-01");
+
+Operation operation = await client.DeleteWidgetAsync(WaitUntil.Completed, "searchbox", null);
+BinaryData responseData = operation.Value;
+
+JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement;
+Console.WriteLine(result.GetProperty("name").ToString());
+Console.WriteLine(result.GetProperty("manufacturerId").ToString());
+]]>
+
+
+
+This sample shows how to call DeleteWidget and parse the result.
+");
+TokenCredential credential = new DefaultAzureCredential();
+ContosoWidgets client = new WidgetManagerClient(endpoint, credential).GetContosoWidgetsClient(apiVersion: "2022-12-01");
+
+Operation operation = client.DeleteWidget(WaitUntil.Completed, "searchbox", null);
+BinaryData responseData = operation.Value;
+
+JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement;
+Console.WriteLine(result.GetProperty("name").ToString());
+Console.WriteLine(result.GetProperty("manufacturerId").ToString());
+]]>
+
+
+
\ No newline at end of file
diff --git a/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/FakedSharedModel.Serialization.cs b/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/FakedSharedModel.Serialization.cs
new file mode 100644
index 000000000000..ddc608a1ab54
--- /dev/null
+++ b/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/FakedSharedModel.Serialization.cs
@@ -0,0 +1,150 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.ClientModel.Primitives;
+using System.Collections.Generic;
+using System.Text.Json;
+using Azure.Core;
+
+namespace Azure.Template.Contoso
+{
+ public partial class FakedSharedModel : 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(FakedSharedModel)} does not support writing '{format}' format.");
+ }
+
+ writer.WritePropertyName("tag"u8);
+ writer.WriteStringValue(Tag);
+ writer.WritePropertyName("createdAt"u8);
+ writer.WriteStringValue(CreatedAt, "O");
+ 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
+ }
+ }
+ }
+
+ FakedSharedModel 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(FakedSharedModel)} does not support reading '{format}' format.");
+ }
+
+ using JsonDocument document = JsonDocument.ParseValue(ref reader);
+ return DeserializeFakedSharedModel(document.RootElement, options);
+ }
+
+ internal static FakedSharedModel DeserializeFakedSharedModel(JsonElement element, ModelReaderWriterOptions options = null)
+ {
+ options ??= ModelSerializationExtensions.WireOptions;
+
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ string tag = default;
+ DateTimeOffset createdAt = default;
+ IDictionary serializedAdditionalRawData = default;
+ Dictionary rawDataDictionary = new Dictionary();
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("tag"u8))
+ {
+ tag = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("createdAt"u8))
+ {
+ createdAt = property.Value.GetDateTimeOffset("O");
+ continue;
+ }
+ if (options.Format != "W")
+ {
+ rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText()));
+ }
+ }
+ serializedAdditionalRawData = rawDataDictionary;
+ return new FakedSharedModel(tag, createdAt, 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, AzureTemplateContosoContext.Default);
+ default:
+ throw new FormatException($"The model {nameof(FakedSharedModel)} does not support writing '{options.Format}' format.");
+ }
+ }
+
+ FakedSharedModel 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 DeserializeFakedSharedModel(document.RootElement, options);
+ }
+ default:
+ throw new FormatException($"The model {nameof(FakedSharedModel)} 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 FakedSharedModel FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions);
+ return DeserializeFakedSharedModel(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/contosowidgetmanager/Azure.Template.Contoso/src/Generated/FakedSharedModel.cs b/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/FakedSharedModel.cs
new file mode 100644
index 000000000000..0ebce4cf58ed
--- /dev/null
+++ b/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/FakedSharedModel.cs
@@ -0,0 +1,81 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+
+namespace Azure.Template.Contoso
+{
+ /// Faked shared model.
+ public partial class FakedSharedModel
+ {
+ ///
+ /// Keeps track of any properties unknown to the library.
+ ///
+ /// To assign an object to the value of this property use .
+ ///
+ ///
+ /// To assign an already formatted json string to this property use .
+ ///
+ ///
+ /// Examples:
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson("foo")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromString("\"foo\"")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson(new { key = "value" })
+ /// Creates a payload of { "key": "value" }.
+ ///
+ /// -
+ /// BinaryData.FromString("{\"key\": \"value\"}")
+ /// Creates a payload of { "key": "value" }.
+ ///
+ ///
+ ///
+ ///
+ private IDictionary _serializedAdditionalRawData;
+
+ /// Initializes a new instance of .
+ /// The tag.
+ /// The created date.
+ /// is null.
+ public FakedSharedModel(string tag, DateTimeOffset createdAt)
+ {
+ Argument.AssertNotNull(tag, nameof(tag));
+
+ Tag = tag;
+ CreatedAt = createdAt;
+ }
+
+ /// Initializes a new instance of .
+ /// The tag.
+ /// The created date.
+ /// Keeps track of any properties unknown to the library.
+ internal FakedSharedModel(string tag, DateTimeOffset createdAt, IDictionary serializedAdditionalRawData)
+ {
+ Tag = tag;
+ CreatedAt = createdAt;
+ _serializedAdditionalRawData = serializedAdditionalRawData;
+ }
+
+ /// Initializes a new instance of for deserialization.
+ internal FakedSharedModel()
+ {
+ }
+
+ /// The tag.
+ public string Tag { get; set; }
+ /// The created date.
+ public DateTimeOffset CreatedAt { get; set; }
+ }
+}
diff --git a/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/Internal/Argument.cs b/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/Internal/Argument.cs
new file mode 100644
index 000000000000..6d81344fe1d7
--- /dev/null
+++ b/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/Internal/Argument.cs
@@ -0,0 +1,129 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+
+namespace Azure.Template.Contoso
+{
+ internal static class Argument
+ {
+ public static void AssertNotNull(T value, string name)
+ {
+ if (value is null)
+ {
+ throw new ArgumentNullException(name);
+ }
+ }
+
+ public static void AssertNotNull(T? value, string name)
+ where T : struct
+ {
+ if (!value.HasValue)
+ {
+ throw new ArgumentNullException(name);
+ }
+ }
+
+ public static void AssertNotNullOrEmpty(IEnumerable value, string name)
+ {
+ if (value is null)
+ {
+ throw new ArgumentNullException(name);
+ }
+ if (value is ICollection collectionOfT && collectionOfT.Count == 0)
+ {
+ throw new ArgumentException("Value cannot be an empty collection.", name);
+ }
+ if (value is ICollection collection && collection.Count == 0)
+ {
+ throw new ArgumentException("Value cannot be an empty collection.", name);
+ }
+ using IEnumerator e = value.GetEnumerator();
+ if (!e.MoveNext())
+ {
+ throw new ArgumentException("Value cannot be an empty collection.", name);
+ }
+ }
+
+ public static void AssertNotNullOrEmpty(string value, string name)
+ {
+ if (value is null)
+ {
+ throw new ArgumentNullException(name);
+ }
+ if (value.Length == 0)
+ {
+ throw new ArgumentException("Value cannot be an empty string.", name);
+ }
+ }
+
+ public static void AssertNotNullOrWhiteSpace(string value, string name)
+ {
+ if (value is null)
+ {
+ throw new ArgumentNullException(name);
+ }
+ if (string.IsNullOrWhiteSpace(value))
+ {
+ throw new ArgumentException("Value cannot be empty or contain only white-space characters.", name);
+ }
+ }
+
+ public static void AssertNotDefault(ref T value, string name)
+ where T : struct, IEquatable
+ {
+ if (value.Equals(default))
+ {
+ throw new ArgumentException("Value cannot be empty.", name);
+ }
+ }
+
+ public static void AssertInRange(T value, T minimum, T maximum, string name)
+ where T : notnull, IComparable
+ {
+ if (minimum.CompareTo(value) > 0)
+ {
+ throw new ArgumentOutOfRangeException(name, "Value is less than the minimum allowed.");
+ }
+ if (maximum.CompareTo(value) < 0)
+ {
+ throw new ArgumentOutOfRangeException(name, "Value is greater than the maximum allowed.");
+ }
+ }
+
+ public static void AssertEnumDefined(Type enumType, object value, string name)
+ {
+ if (!Enum.IsDefined(enumType, value))
+ {
+ throw new ArgumentException($"Value not defined for {enumType.FullName}.", name);
+ }
+ }
+
+ public static T CheckNotNull(T value, string name)
+ where T : class
+ {
+ AssertNotNull(value, name);
+ return value;
+ }
+
+ public static string CheckNotNullOrEmpty(string value, string name)
+ {
+ AssertNotNullOrEmpty(value, name);
+ return value;
+ }
+
+ public static void AssertNull(T value, string name, string message = null)
+ {
+ if (value != null)
+ {
+ throw new ArgumentException(message ?? "Value must be null.", name);
+ }
+ }
+ }
+}
diff --git a/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/Internal/ChangeTrackingDictionary.cs b/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/Internal/ChangeTrackingDictionary.cs
new file mode 100644
index 000000000000..fba592e87808
--- /dev/null
+++ b/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/Internal/ChangeTrackingDictionary.cs
@@ -0,0 +1,167 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+
+namespace Azure.Template.Contoso
+{
+ internal class ChangeTrackingDictionary : IDictionary, IReadOnlyDictionary where TKey : notnull
+ {
+ private IDictionary _innerDictionary;
+
+ public ChangeTrackingDictionary()
+ {
+ }
+
+ public ChangeTrackingDictionary(IDictionary dictionary)
+ {
+ if (dictionary == null)
+ {
+ return;
+ }
+ _innerDictionary = new Dictionary(dictionary);
+ }
+
+ public ChangeTrackingDictionary(IReadOnlyDictionary dictionary)
+ {
+ if (dictionary == null)
+ {
+ return;
+ }
+ _innerDictionary = new Dictionary();
+ foreach (var pair in dictionary)
+ {
+ _innerDictionary.Add(pair);
+ }
+ }
+
+ public bool IsUndefined => _innerDictionary == null;
+
+ public int Count => IsUndefined ? 0 : EnsureDictionary().Count;
+
+ public bool IsReadOnly => IsUndefined ? false : EnsureDictionary().IsReadOnly;
+
+ public ICollection Keys => IsUndefined ? Array.Empty() : EnsureDictionary().Keys;
+
+ public ICollection Values => IsUndefined ? Array.Empty() : EnsureDictionary().Values;
+
+ public TValue this[TKey key]
+ {
+ get
+ {
+ if (IsUndefined)
+ {
+ throw new KeyNotFoundException(nameof(key));
+ }
+ return EnsureDictionary()[key];
+ }
+ set
+ {
+ EnsureDictionary()[key] = value;
+ }
+ }
+
+ IEnumerable IReadOnlyDictionary.Keys => Keys;
+
+ IEnumerable IReadOnlyDictionary.Values => Values;
+
+ public IEnumerator> GetEnumerator()
+ {
+ if (IsUndefined)
+ {
+ IEnumerator> enumerateEmpty()
+ {
+ yield break;
+ }
+ return enumerateEmpty();
+ }
+ return EnsureDictionary().GetEnumerator();
+ }
+
+ IEnumerator IEnumerable.GetEnumerator()
+ {
+ return GetEnumerator();
+ }
+
+ public void Add(KeyValuePair item)
+ {
+ EnsureDictionary().Add(item);
+ }
+
+ public void Clear()
+ {
+ EnsureDictionary().Clear();
+ }
+
+ public bool Contains(KeyValuePair item)
+ {
+ if (IsUndefined)
+ {
+ return false;
+ }
+ return EnsureDictionary().Contains(item);
+ }
+
+ public void CopyTo(KeyValuePair[] array, int index)
+ {
+ if (IsUndefined)
+ {
+ return;
+ }
+ EnsureDictionary().CopyTo(array, index);
+ }
+
+ public bool Remove(KeyValuePair item)
+ {
+ if (IsUndefined)
+ {
+ return false;
+ }
+ return EnsureDictionary().Remove(item);
+ }
+
+ public void Add(TKey key, TValue value)
+ {
+ EnsureDictionary().Add(key, value);
+ }
+
+ public bool ContainsKey(TKey key)
+ {
+ if (IsUndefined)
+ {
+ return false;
+ }
+ return EnsureDictionary().ContainsKey(key);
+ }
+
+ public bool Remove(TKey key)
+ {
+ if (IsUndefined)
+ {
+ return false;
+ }
+ return EnsureDictionary().Remove(key);
+ }
+
+ public bool TryGetValue(TKey key, out TValue value)
+ {
+ if (IsUndefined)
+ {
+ value = default;
+ return false;
+ }
+ return EnsureDictionary().TryGetValue(key, out value);
+ }
+
+ public IDictionary EnsureDictionary()
+ {
+ return _innerDictionary ??= new Dictionary();
+ }
+ }
+}
diff --git a/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/Internal/ChangeTrackingList.cs b/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/Internal/ChangeTrackingList.cs
new file mode 100644
index 000000000000..5d1cec4e0093
--- /dev/null
+++ b/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/Internal/ChangeTrackingList.cs
@@ -0,0 +1,153 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace Azure.Template.Contoso
+{
+ internal class ChangeTrackingList : IList, IReadOnlyList
+ {
+ private IList _innerList;
+
+ public ChangeTrackingList()
+ {
+ }
+
+ public ChangeTrackingList(IList innerList)
+ {
+ if (innerList != null)
+ {
+ _innerList = innerList;
+ }
+ }
+
+ public ChangeTrackingList(IReadOnlyList innerList)
+ {
+ if (innerList != null)
+ {
+ _innerList = innerList.ToList();
+ }
+ }
+
+ public bool IsUndefined => _innerList == null;
+
+ public int Count => IsUndefined ? 0 : EnsureList().Count;
+
+ public bool IsReadOnly => IsUndefined ? false : EnsureList().IsReadOnly;
+
+ public T this[int index]
+ {
+ get
+ {
+ if (IsUndefined)
+ {
+ throw new ArgumentOutOfRangeException(nameof(index));
+ }
+ return EnsureList()[index];
+ }
+ set
+ {
+ if (IsUndefined)
+ {
+ throw new ArgumentOutOfRangeException(nameof(index));
+ }
+ EnsureList()[index] = value;
+ }
+ }
+
+ public void Reset()
+ {
+ _innerList = null;
+ }
+
+ public IEnumerator GetEnumerator()
+ {
+ if (IsUndefined)
+ {
+ IEnumerator enumerateEmpty()
+ {
+ yield break;
+ }
+ return enumerateEmpty();
+ }
+ return EnsureList().GetEnumerator();
+ }
+
+ IEnumerator IEnumerable.GetEnumerator()
+ {
+ return GetEnumerator();
+ }
+
+ public void Add(T item)
+ {
+ EnsureList().Add(item);
+ }
+
+ public void Clear()
+ {
+ EnsureList().Clear();
+ }
+
+ public bool Contains(T item)
+ {
+ if (IsUndefined)
+ {
+ return false;
+ }
+ return EnsureList().Contains(item);
+ }
+
+ public void CopyTo(T[] array, int arrayIndex)
+ {
+ if (IsUndefined)
+ {
+ return;
+ }
+ EnsureList().CopyTo(array, arrayIndex);
+ }
+
+ public bool Remove(T item)
+ {
+ if (IsUndefined)
+ {
+ return false;
+ }
+ return EnsureList().Remove(item);
+ }
+
+ public int IndexOf(T item)
+ {
+ if (IsUndefined)
+ {
+ return -1;
+ }
+ return EnsureList().IndexOf(item);
+ }
+
+ public void Insert(int index, T item)
+ {
+ EnsureList().Insert(index, item);
+ }
+
+ public void RemoveAt(int index)
+ {
+ if (IsUndefined)
+ {
+ throw new ArgumentOutOfRangeException(nameof(index));
+ }
+ EnsureList().RemoveAt(index);
+ }
+
+ public IList EnsureList()
+ {
+ return _innerList ??= new List();
+ }
+ }
+}
diff --git a/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/Internal/ModelSerializationExtensions.cs b/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/Internal/ModelSerializationExtensions.cs
new file mode 100644
index 000000000000..18ee5b8e4479
--- /dev/null
+++ b/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/Internal/ModelSerializationExtensions.cs
@@ -0,0 +1,407 @@
+// 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.Diagnostics;
+using System.Globalization;
+using System.Text.Json;
+using System.Xml;
+using Azure.Core;
+
+namespace Azure.Template.Contoso
+{
+ internal static class ModelSerializationExtensions
+ {
+ internal static readonly JsonDocumentOptions JsonDocumentOptions = new JsonDocumentOptions { MaxDepth = 256 };
+ internal static readonly ModelReaderWriterOptions WireOptions = new ModelReaderWriterOptions("W");
+ internal static readonly BinaryData SentinelValue = BinaryData.FromBytes("\"__EMPTY__\""u8.ToArray());
+
+ public static object GetObject(this JsonElement element)
+ {
+ switch (element.ValueKind)
+ {
+ case JsonValueKind.String:
+ return element.GetString();
+ case JsonValueKind.Number:
+ if (element.TryGetInt32(out int intValue))
+ {
+ return intValue;
+ }
+ if (element.TryGetInt64(out long longValue))
+ {
+ return longValue;
+ }
+ return element.GetDouble();
+ case JsonValueKind.True:
+ return true;
+ case JsonValueKind.False:
+ return false;
+ case JsonValueKind.Undefined:
+ case JsonValueKind.Null:
+ return null;
+ case JsonValueKind.Object:
+ var dictionary = new Dictionary();
+ foreach (var jsonProperty in element.EnumerateObject())
+ {
+ dictionary.Add(jsonProperty.Name, jsonProperty.Value.GetObject());
+ }
+ return dictionary;
+ case JsonValueKind.Array:
+ var list = new List