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 + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-net/sdk/contosowidgetmanager/Azure.Template.Contoso/README.png) \ 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..5f4aeb69c4f0 --- /dev/null +++ b/sdk/contosowidgetmanager/Azure.Template.Contoso/api/Azure.Template.Contoso.net8.0.cs @@ -0,0 +1,115 @@ +namespace Azure.Template.Contoso +{ + 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..5f4aeb69c4f0 --- /dev/null +++ b/sdk/contosowidgetmanager/Azure.Template.Contoso/api/Azure.Template.Contoso.netstandard2.0.cs @@ -0,0 +1,115 @@ +namespace Azure.Template.Contoso +{ + 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..e852c0eb26bc --- /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); + 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..bfa9471431fb --- /dev/null +++ b/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/Internal/ModelSerializationExtensions.cs @@ -0,0 +1,399 @@ +// 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"); + + 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(); + foreach (var item in element.EnumerateArray()) + { + list.Add(item.GetObject()); + } + return list.ToArray(); + default: + throw new NotSupportedException($"Not supported value kind {element.ValueKind}"); + } + } + + public static byte[] GetBytesFromBase64(this JsonElement element, string format) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + + return format switch + { + "U" => TypeFormatters.FromBase64UrlString(element.GetRequiredString()), + "D" => element.GetBytesFromBase64(), + _ => throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)) + }; + } + + public static DateTimeOffset GetDateTimeOffset(this JsonElement element, string format) => format switch + { + "U" when element.ValueKind == JsonValueKind.Number => DateTimeOffset.FromUnixTimeSeconds(element.GetInt64()), + _ => TypeFormatters.ParseDateTimeOffset(element.GetString(), format) + }; + + public static TimeSpan GetTimeSpan(this JsonElement element, string format) => TypeFormatters.ParseTimeSpan(element.GetString(), format); + + public static char GetChar(this JsonElement element) + { + if (element.ValueKind == JsonValueKind.String) + { + var text = element.GetString(); + if (text == null || text.Length != 1) + { + throw new NotSupportedException($"Cannot convert \"{text}\" to a char"); + } + return text[0]; + } + else + { + throw new NotSupportedException($"Cannot convert {element.ValueKind} to a char"); + } + } + + [Conditional("DEBUG")] + public static void ThrowNonNullablePropertyIsNull(this JsonProperty property) + { + throw new JsonException($"A property '{property.Name}' defined as non-nullable but received as null from the service. This exception only happens in DEBUG builds of the library and would be ignored in the release build"); + } + + public static string GetRequiredString(this JsonElement element) + { + var value = element.GetString(); + if (value == null) + { + throw new InvalidOperationException($"The requested operation requires an element of type 'String', but the target element has type '{element.ValueKind}'."); + } + return value; + } + + public static void WriteStringValue(this Utf8JsonWriter writer, DateTimeOffset value, string format) + { + writer.WriteStringValue(TypeFormatters.ToString(value, format)); + } + + public static void WriteStringValue(this Utf8JsonWriter writer, DateTime value, string format) + { + writer.WriteStringValue(TypeFormatters.ToString(value, format)); + } + + public static void WriteStringValue(this Utf8JsonWriter writer, TimeSpan value, string format) + { + writer.WriteStringValue(TypeFormatters.ToString(value, format)); + } + + public static void WriteStringValue(this Utf8JsonWriter writer, char value) + { + writer.WriteStringValue(value.ToString(CultureInfo.InvariantCulture)); + } + + public static void WriteBase64StringValue(this Utf8JsonWriter writer, byte[] value, string format) + { + if (value == null) + { + writer.WriteNullValue(); + return; + } + switch (format) + { + case "U": + writer.WriteStringValue(TypeFormatters.ToBase64UrlString(value)); + break; + case "D": + writer.WriteBase64StringValue(value); + break; + default: + throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)); + } + } + + public static void WriteNumberValue(this Utf8JsonWriter writer, DateTimeOffset value, string format) + { + if (format != "U") + { + throw new ArgumentOutOfRangeException(nameof(format), "Only 'U' format is supported when writing a DateTimeOffset as a Number."); + } + writer.WriteNumberValue(value.ToUnixTimeSeconds()); + } + + public static void WriteObjectValue(this Utf8JsonWriter writer, T value, ModelReaderWriterOptions options = null) + { + switch (value) + { + case null: + writer.WriteNullValue(); + break; + case IJsonModel jsonModel: + jsonModel.Write(writer, options ?? WireOptions); + break; + case IUtf8JsonSerializable serializable: + serializable.Write(writer); + break; + case byte[] bytes: + writer.WriteBase64StringValue(bytes); + break; + case BinaryData bytes0: + writer.WriteBase64StringValue(bytes0); + break; + case JsonElement json: + json.WriteTo(writer); + break; + case int i: + writer.WriteNumberValue(i); + break; + case decimal d: + writer.WriteNumberValue(d); + break; + case double d0: + if (double.IsNaN(d0)) + { + writer.WriteStringValue("NaN"); + } + else + { + writer.WriteNumberValue(d0); + } + break; + case float f: + writer.WriteNumberValue(f); + break; + case long l: + writer.WriteNumberValue(l); + break; + case string s: + writer.WriteStringValue(s); + break; + case bool b: + writer.WriteBooleanValue(b); + break; + case Guid g: + writer.WriteStringValue(g); + break; + case DateTimeOffset dateTimeOffset: + writer.WriteStringValue(dateTimeOffset, "O"); + break; + case DateTime dateTime: + writer.WriteStringValue(dateTime, "O"); + break; + case IEnumerable> enumerable: + writer.WriteStartObject(); + foreach (var pair in enumerable) + { + writer.WritePropertyName(pair.Key); + writer.WriteObjectValue(pair.Value, options); + } + writer.WriteEndObject(); + break; + case IEnumerable objectEnumerable: + writer.WriteStartArray(); + foreach (var item in objectEnumerable) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + break; + case TimeSpan timeSpan: + writer.WriteStringValue(timeSpan, "P"); + break; + default: + throw new NotSupportedException($"Not supported type {value.GetType()}"); + } + } + + public static void WriteObjectValue(this Utf8JsonWriter writer, object value, ModelReaderWriterOptions options = null) + { + writer.WriteObjectValue(value, options); + } + + internal static class TypeFormatters + { + private const string RoundtripZFormat = "yyyy-MM-ddTHH:mm:ss.fffffffZ"; + public const string DefaultNumberFormat = "G"; + + public static string ToString(bool value) => value ? "true" : "false"; + + public static string ToString(DateTime value, string format) => value.Kind switch + { + DateTimeKind.Utc => ToString((DateTimeOffset)value, format), + _ => throw new NotSupportedException($"DateTime {value} has a Kind of {value.Kind}. Azure SDK requires it to be UTC. You can call DateTime.SpecifyKind to change Kind property value to DateTimeKind.Utc.") + }; + + public static string ToString(DateTimeOffset value, string format) => format switch + { + "D" => value.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture), + "U" => value.ToUnixTimeSeconds().ToString(CultureInfo.InvariantCulture), + "O" => value.ToUniversalTime().ToString(RoundtripZFormat, CultureInfo.InvariantCulture), + "o" => value.ToUniversalTime().ToString(RoundtripZFormat, CultureInfo.InvariantCulture), + "R" => value.ToString("r", CultureInfo.InvariantCulture), + _ => value.ToString(format, CultureInfo.InvariantCulture) + }; + + public static string ToString(TimeSpan value, string format) => format switch + { + "P" => XmlConvert.ToString(value), + _ => value.ToString(format, CultureInfo.InvariantCulture) + }; + + public static string ToString(byte[] value, string format) => format switch + { + "U" => ToBase64UrlString(value), + "D" => Convert.ToBase64String(value), + _ => throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)) + }; + + public static string ToBase64UrlString(byte[] value) + { + int numWholeOrPartialInputBlocks = checked(value.Length + 2) / 3; + int size = checked(numWholeOrPartialInputBlocks * 4); + char[] output = new char[size]; + + int numBase64Chars = Convert.ToBase64CharArray(value, 0, value.Length, output, 0); + + int i = 0; + for (; i < numBase64Chars; i++) + { + char ch = output[i]; + if (ch == '+') + { + output[i] = '-'; + } + else + { + if (ch == '/') + { + output[i] = '_'; + } + else + { + if (ch == '=') + { + break; + } + } + } + } + + return new string(output, 0, i); + } + + public static byte[] FromBase64UrlString(string value) + { + int paddingCharsToAdd = (value.Length % 4) switch + { + 0 => 0, + 2 => 2, + 3 => 1, + _ => throw new InvalidOperationException("Malformed input") + }; + char[] output = new char[(value.Length + paddingCharsToAdd)]; + int i = 0; + for (; i < value.Length; i++) + { + char ch = value[i]; + if (ch == '-') + { + output[i] = '+'; + } + else + { + if (ch == '_') + { + output[i] = '/'; + } + else + { + output[i] = ch; + } + } + } + + for (; i < output.Length; i++) + { + output[i] = '='; + } + + return Convert.FromBase64CharArray(output, 0, output.Length); + } + + public static DateTimeOffset ParseDateTimeOffset(string value, string format) => format switch + { + "U" => DateTimeOffset.FromUnixTimeSeconds(long.Parse(value, CultureInfo.InvariantCulture)), + _ => DateTimeOffset.Parse(value, CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal) + }; + + public static TimeSpan ParseTimeSpan(string value, string format) => format switch + { + "P" => XmlConvert.ToTimeSpan(value), + _ => TimeSpan.ParseExact(value, format, CultureInfo.InvariantCulture) + }; + + public static string ConvertToString(object value, string format = null) => value switch + { + null => "null", + string s => s, + bool b => ToString(b), + int or float or double or long or decimal => ((IFormattable)value).ToString(DefaultNumberFormat, CultureInfo.InvariantCulture), + byte[] b0 when format != null => ToString(b0, format), + IEnumerable s0 => string.Join(",", s0), + DateTimeOffset dateTime when format != null => ToString(dateTime, format), + TimeSpan timeSpan when format != null => ToString(timeSpan, format), + TimeSpan timeSpan0 => XmlConvert.ToString(timeSpan0), + Guid guid => guid.ToString(), + BinaryData binaryData => ConvertToString(binaryData.ToArray(), format), + _ => value.ToString() + }; + } + } +} diff --git a/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/Internal/Optional.cs b/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/Internal/Optional.cs new file mode 100644 index 000000000000..072e7659b006 --- /dev/null +++ b/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/Internal/Optional.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; + +namespace Azure.Template.Contoso +{ + internal static class Optional + { + public static bool IsCollectionDefined(IEnumerable collection) + { + return !(collection is ChangeTrackingList changeTrackingList && changeTrackingList.IsUndefined); + } + + public static bool IsCollectionDefined(IDictionary collection) + { + return !(collection is ChangeTrackingDictionary changeTrackingDictionary && changeTrackingDictionary.IsUndefined); + } + + public static bool IsCollectionDefined(IReadOnlyDictionary collection) + { + return !(collection is ChangeTrackingDictionary changeTrackingDictionary && changeTrackingDictionary.IsUndefined); + } + + public static bool IsDefined(T? value) + where T : struct + { + return value.HasValue; + } + + public static bool IsDefined(object value) + { + return value != null; + } + + public static bool IsDefined(JsonElement value) + { + return value.ValueKind != JsonValueKind.Undefined; + } + + public static bool IsDefined(string value) + { + return value != null; + } + } +} diff --git a/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/Internal/Utf8JsonRequestContent.cs b/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/Internal/Utf8JsonRequestContent.cs new file mode 100644 index 000000000000..6dbde35752a2 --- /dev/null +++ b/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/Internal/Utf8JsonRequestContent.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.IO; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.Template.Contoso +{ + internal class Utf8JsonRequestContent : RequestContent + { + private readonly MemoryStream _stream; + private readonly RequestContent _content; + + public Utf8JsonRequestContent() + { + _stream = new MemoryStream(); + _content = Create(_stream); + JsonWriter = new Utf8JsonWriter(_stream); + } + + public Utf8JsonWriter JsonWriter { get; } + + public override async Task WriteToAsync(Stream stream, CancellationToken cancellationToken = default) + { + await JsonWriter.FlushAsync().ConfigureAwait(false); + await _content.WriteToAsync(stream, cancellationToken).ConfigureAwait(false); + } + + public override void WriteTo(Stream stream, CancellationToken cancellationToken = default) + { + JsonWriter.Flush(); + _content.WriteTo(stream, cancellationToken); + } + + public override bool TryComputeLength(out long length) + { + length = JsonWriter.BytesCommitted + JsonWriter.BytesPending; + return true; + } + + public override void Dispose() + { + JsonWriter.Dispose(); + _content.Dispose(); + _stream.Dispose(); + } + } +} diff --git a/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/OperationState.cs b/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/OperationState.cs new file mode 100644 index 000000000000..de05771393ce --- /dev/null +++ b/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/OperationState.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Template.Contoso +{ + /// Enum describing allowed operation states. + public readonly partial struct OperationState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public OperationState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string NotStartedValue = "NotStarted"; + private const string RunningValue = "Running"; + private const string SucceededValue = "Succeeded"; + private const string FailedValue = "Failed"; + private const string CanceledValue = "Canceled"; + + /// The operation has not started. + public static OperationState NotStarted { get; } = new OperationState(NotStartedValue); + /// The operation is in progress. + public static OperationState Running { get; } = new OperationState(RunningValue); + /// The operation has completed successfully. + public static OperationState Succeeded { get; } = new OperationState(SucceededValue); + /// The operation has failed. + public static OperationState Failed { get; } = new OperationState(FailedValue); + /// The operation has been canceled by the user. + public static OperationState Canceled { get; } = new OperationState(CanceledValue); + /// Determines if two values are the same. + public static bool operator ==(OperationState left, OperationState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(OperationState left, OperationState right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator OperationState(string value) => new OperationState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is OperationState other && Equals(other); + /// + public bool Equals(OperationState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/ResourceOperationStatusWidgetSuiteWidgetSuiteError.Serialization.cs b/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/ResourceOperationStatusWidgetSuiteWidgetSuiteError.Serialization.cs new file mode 100644 index 000000000000..3df98b2b0909 --- /dev/null +++ b/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/ResourceOperationStatusWidgetSuiteWidgetSuiteError.Serialization.cs @@ -0,0 +1,180 @@ +// 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 ResourceOperationStatusWidgetSuiteWidgetSuiteError : 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(ResourceOperationStatusWidgetSuiteWidgetSuiteError)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status.ToString()); + if (Optional.IsDefined(Error)) + { + writer.WritePropertyName("error"u8); + JsonSerializer.Serialize(writer, Error); + } + if (Optional.IsDefined(Result)) + { + writer.WritePropertyName("result"u8); + writer.WriteObjectValue(Result, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ResourceOperationStatusWidgetSuiteWidgetSuiteError 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(ResourceOperationStatusWidgetSuiteWidgetSuiteError)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeResourceOperationStatusWidgetSuiteWidgetSuiteError(document.RootElement, options); + } + + internal static ResourceOperationStatusWidgetSuiteWidgetSuiteError DeserializeResourceOperationStatusWidgetSuiteWidgetSuiteError(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + OperationState status = default; + ResponseError error = default; + WidgetSuite result = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("status"u8)) + { + status = new OperationState(property.Value.GetString()); + continue; + } + if (property.NameEquals("error"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + error = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("result"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + result = WidgetSuite.DeserializeWidgetSuite(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ResourceOperationStatusWidgetSuiteWidgetSuiteError(id, status, error, result, 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(ResourceOperationStatusWidgetSuiteWidgetSuiteError)} does not support writing '{options.Format}' format."); + } + } + + ResourceOperationStatusWidgetSuiteWidgetSuiteError 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 DeserializeResourceOperationStatusWidgetSuiteWidgetSuiteError(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ResourceOperationStatusWidgetSuiteWidgetSuiteError)} 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 ResourceOperationStatusWidgetSuiteWidgetSuiteError FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeResourceOperationStatusWidgetSuiteWidgetSuiteError(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/ResourceOperationStatusWidgetSuiteWidgetSuiteError.cs b/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/ResourceOperationStatusWidgetSuiteWidgetSuiteError.cs new file mode 100644 index 000000000000..d2a07ed0b367 --- /dev/null +++ b/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/ResourceOperationStatusWidgetSuiteWidgetSuiteError.cs @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Template.Contoso +{ + /// Provides status details for long running operations. + public partial class ResourceOperationStatusWidgetSuiteWidgetSuiteError + { + /// + /// 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 unique ID of the operation. + /// The status of the operation. + /// is null. + internal ResourceOperationStatusWidgetSuiteWidgetSuiteError(string id, OperationState status) + { + Argument.AssertNotNull(id, nameof(id)); + + Id = id; + Status = status; + } + + /// Initializes a new instance of . + /// The unique ID of the operation. + /// The status of the operation. + /// Error object that describes the error when status is "Failed". + /// The result of the operation. + /// Keeps track of any properties unknown to the library. + internal ResourceOperationStatusWidgetSuiteWidgetSuiteError(string id, OperationState status, ResponseError error, WidgetSuite result, IDictionary serializedAdditionalRawData) + { + Id = id; + Status = status; + Error = error; + Result = result; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ResourceOperationStatusWidgetSuiteWidgetSuiteError() + { + } + + /// The unique ID of the operation. + public string Id { get; } + /// The status of the operation. + public OperationState Status { get; } + /// Error object that describes the error when status is "Failed". + public ResponseError Error { get; } + /// The result of the operation. + public WidgetSuite Result { get; } + } +} diff --git a/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/TemplateContosoClientBuilderExtensions.cs b/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/TemplateContosoClientBuilderExtensions.cs new file mode 100644 index 000000000000..34e50338c431 --- /dev/null +++ b/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/TemplateContosoClientBuilderExtensions.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core.Extensions; +using Azure.Template.Contoso; + +namespace Microsoft.Extensions.Azure +{ + /// Extension methods to add to client builder. + public static partial class TemplateContosoClientBuilderExtensions + { + /// Registers a instance. + /// The builder to register with. + /// Service host. + public static IAzureClientBuilder AddWidgetManagerClient(this TBuilder builder, Uri endpoint) + where TBuilder : IAzureClientFactoryBuilderWithCredential + { + return builder.RegisterClientFactory((options, cred) => new WidgetManagerClient(endpoint, cred, options)); + } + + /// Registers a instance. + /// The builder to register with. + /// The configuration values. + public static IAzureClientBuilder AddWidgetManagerClient(this TBuilder builder, TConfiguration configuration) + where TBuilder : IAzureClientFactoryBuilderWithConfiguration + { + return builder.RegisterClientFactory(configuration); + } + } +} diff --git a/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/TemplateContosoModelFactory.cs b/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/TemplateContosoModelFactory.cs new file mode 100644 index 000000000000..1a64eda68bce --- /dev/null +++ b/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/TemplateContosoModelFactory.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.Template.Contoso +{ + /// Model factory for models. + public static partial class TemplateContosoModelFactory + { + /// Initializes a new instance of . + /// The widget name. + /// The ID of the widget's manufacturer. + /// The faked shared model. + /// A new instance for mocking. + public static WidgetSuite WidgetSuite(string name = null, string manufacturerId = null, FakedSharedModel sharedModel = null) + { + return new WidgetSuite(name, manufacturerId, sharedModel, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The unique ID of the operation. + /// The status of the operation. + /// Error object that describes the error when status is "Failed". + /// The result of the operation. + /// A new instance for mocking. + public static ResourceOperationStatusWidgetSuiteWidgetSuiteError ResourceOperationStatusWidgetSuiteWidgetSuiteError(string id = null, OperationState status = default, ResponseError error = null, WidgetSuite result = null) + { + return new ResourceOperationStatusWidgetSuiteWidgetSuiteError(id, status, error, result, serializedAdditionalRawData: null); + } + } +} diff --git a/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/WidgetManagerClient.cs b/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/WidgetManagerClient.cs new file mode 100644 index 000000000000..a4d30b4e1fb2 --- /dev/null +++ b/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/WidgetManagerClient.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.Template.Contoso +{ + // Data plane generated client. + /// The WidgetManager service client. + public partial class WidgetManagerClient + { + private static readonly string[] AuthorizationScopes = new string[] { "https://contoso.azure.com/.default" }; + private readonly TokenCredential _tokenCredential; + 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 WidgetManagerClient for mocking. + protected WidgetManagerClient() + { + } + + /// Initializes a new instance of WidgetManagerClient. + /// Service host. + /// A credential used to authenticate to an Azure Service. + /// or is null. + public WidgetManagerClient(Uri endpoint, TokenCredential credential) : this(endpoint, credential, new WidgetManagerClientOptions()) + { + } + + /// Initializes a new instance of WidgetManagerClient. + /// Service host. + /// A credential used to authenticate to an Azure Service. + /// The options for configuring the client. + /// or is null. + public WidgetManagerClient(Uri endpoint, TokenCredential credential, WidgetManagerClientOptions options) + { + Argument.AssertNotNull(endpoint, nameof(endpoint)); + Argument.AssertNotNull(credential, nameof(credential)); + options ??= new WidgetManagerClientOptions(); + + ClientDiagnostics = new ClientDiagnostics(options, true); + _tokenCredential = credential; + _pipeline = HttpPipelineBuilder.Build(options, Array.Empty(), new HttpPipelinePolicy[] { new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes) }, new ResponseClassifier()); + _endpoint = endpoint; + } + + /// Initializes a new instance of ContosoWidgets. + /// The API version to use for this operation. + /// is null. + public virtual ContosoWidgets GetContosoWidgetsClient(string apiVersion = "2022-12-01") + { + Argument.AssertNotNull(apiVersion, nameof(apiVersion)); + + return new ContosoWidgets(ClientDiagnostics, _pipeline, _tokenCredential, _endpoint, apiVersion); + } + } +} diff --git a/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/WidgetManagerClientOptions.cs b/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/WidgetManagerClientOptions.cs new file mode 100644 index 000000000000..c451e0c67e97 --- /dev/null +++ b/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/WidgetManagerClientOptions.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 Azure.Template.Contoso +{ + /// Client options for WidgetManagerClient. + public partial class WidgetManagerClientOptions : ClientOptions + { + private const ServiceVersion LatestVersion = ServiceVersion.V2022_12_01; + + /// The version of the service to use. + public enum ServiceVersion + { + /// Service version "2022-12-01". + V2022_12_01 = 1, + } + + internal string Version { get; } + + /// Initializes new instance of WidgetManagerClientOptions. + public WidgetManagerClientOptions(ServiceVersion version = LatestVersion) + { + Version = version switch + { + ServiceVersion.V2022_12_01 => "2022-12-01", + _ => throw new NotSupportedException() + }; + } + } +} diff --git a/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/WidgetSuite.Serialization.cs b/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/WidgetSuite.Serialization.cs new file mode 100644 index 000000000000..a1a04807038a --- /dev/null +++ b/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/WidgetSuite.Serialization.cs @@ -0,0 +1,168 @@ +// 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 WidgetSuite : 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(WidgetSuite)} does not support writing '{format}' format."); + } + + if (options.Format != "W") + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + writer.WritePropertyName("manufacturerId"u8); + writer.WriteStringValue(ManufacturerId); + if (Optional.IsDefined(SharedModel)) + { + writer.WritePropertyName("sharedModel"u8); + writer.WriteObjectValue(SharedModel, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + WidgetSuite 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(WidgetSuite)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeWidgetSuite(document.RootElement, options); + } + + internal static WidgetSuite DeserializeWidgetSuite(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + string manufacturerId = default; + FakedSharedModel sharedModel = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("manufacturerId"u8)) + { + manufacturerId = property.Value.GetString(); + continue; + } + if (property.NameEquals("sharedModel"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sharedModel = FakedSharedModel.DeserializeFakedSharedModel(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new WidgetSuite(name, manufacturerId, sharedModel, 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(WidgetSuite)} does not support writing '{options.Format}' format."); + } + } + + WidgetSuite 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 DeserializeWidgetSuite(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(WidgetSuite)} 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 WidgetSuite FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeWidgetSuite(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/WidgetSuite.cs b/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/WidgetSuite.cs new file mode 100644 index 000000000000..9ba44c829aa3 --- /dev/null +++ b/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/WidgetSuite.cs @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Template.Contoso +{ + /// A widget. + public partial class WidgetSuite + { + /// + /// 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 ID of the widget's manufacturer. + /// is null. + public WidgetSuite(string manufacturerId) + { + Argument.AssertNotNull(manufacturerId, nameof(manufacturerId)); + + ManufacturerId = manufacturerId; + } + + /// Initializes a new instance of . + /// The widget name. + /// The ID of the widget's manufacturer. + /// The faked shared model. + /// Keeps track of any properties unknown to the library. + internal WidgetSuite(string name, string manufacturerId, FakedSharedModel sharedModel, IDictionary serializedAdditionalRawData) + { + Name = name; + ManufacturerId = manufacturerId; + SharedModel = sharedModel; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal WidgetSuite() + { + } + + /// The widget name. + public string Name { get; } + /// The ID of the widget's manufacturer. + public string ManufacturerId { get; set; } + /// The faked shared model. + public FakedSharedModel SharedModel { get; set; } + } +} diff --git a/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Properties/AssemblyInfo.cs b/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Properties/AssemblyInfo.cs new file mode 100644 index 000000000000..aa9fd891b234 --- /dev/null +++ b/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Properties/AssemblyInfo.cs @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Runtime.CompilerServices; + +[assembly: InternalsVisibleTo("Azure.Template.Contoso.Tests, PublicKey = 0024000004800000940000000602000000240000525341310004000001000100d15ddcb29688295338af4b7686603fe614abd555e09efba8fb88ee09e1f7b1ccaeed2e8f823fa9eef3fdd60217fc012ea67d2479751a0b8c087a4185541b851bd8b16f8d91b840e51b1cb0ba6fe647997e57429265e85ef62d565db50a69ae1647d54d7bd855e4db3d8a91510e5bcbd0edfbbecaa20a7bd9ae74593daa7b11b4")] + +// Replace Microsoft.Test with the correct resource provider namepace for your service and uncomment. +// See https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/azure-services-resource-providers +// for the list of possible values. +[assembly: Azure.Core.AzureResourceProviderNamespace("Microsoft.Template")] diff --git a/sdk/contosowidgetmanager/Azure.Template.Contoso/tests/Azure.Template.Contoso.Tests.csproj b/sdk/contosowidgetmanager/Azure.Template.Contoso/tests/Azure.Template.Contoso.Tests.csproj new file mode 100644 index 000000000000..9b79d892421f --- /dev/null +++ b/sdk/contosowidgetmanager/Azure.Template.Contoso/tests/Azure.Template.Contoso.Tests.csproj @@ -0,0 +1,20 @@ + + + $(RequiredTargetFrameworks) + + $(NoWarn);CS1591 + + + + + + + + + + + + + + + diff --git a/sdk/contosowidgetmanager/Azure.Template.Contoso/tests/Generated/Samples/Samples_ContosoWidgets.cs b/sdk/contosowidgetmanager/Azure.Template.Contoso/tests/Generated/Samples/Samples_ContosoWidgets.cs new file mode 100644 index 000000000000..7b7e63a134ef --- /dev/null +++ b/sdk/contosowidgetmanager/Azure.Template.Contoso/tests/Generated/Samples/Samples_ContosoWidgets.cs @@ -0,0 +1,287 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using NUnit.Framework; + +namespace Azure.Template.Contoso.Samples +{ + public partial class Samples_ContosoWidgets + { + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_WidgetSuite_GetWidget_GetWidgetByWidgetName() + { + Uri endpoint = new Uri(""); + 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()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_WidgetSuite_GetWidget_GetWidgetByWidgetName_Async() + { + Uri endpoint = new Uri(""); + 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()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_WidgetSuite_GetWidget_GetWidgetByWidgetName_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + ContosoWidgets client = new WidgetManagerClient(endpoint, credential).GetContosoWidgetsClient(apiVersion: "2022-12-01"); + + Response response = client.GetWidget("searchbox"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_WidgetSuite_GetWidget_GetWidgetByWidgetName_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + ContosoWidgets client = new WidgetManagerClient(endpoint, credential).GetContosoWidgetsClient(apiVersion: "2022-12-01"); + + Response response = await client.GetWidgetAsync("searchbox"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_ResourceOperationStatus_GetWidgetOperationStatus_WidgetsGetWidgetOperationStatus() + { + Uri endpoint = new Uri(""); + 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()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_ResourceOperationStatus_GetWidgetOperationStatus_WidgetsGetWidgetOperationStatus_Async() + { + Uri endpoint = new Uri(""); + 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()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_ResourceOperationStatus_GetWidgetOperationStatus_WidgetsGetWidgetOperationStatus_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + ContosoWidgets client = new WidgetManagerClient(endpoint, credential).GetContosoWidgetsClient(apiVersion: "2022-12-01"); + + Response response = client.GetWidgetOperationStatus("name1", "opreation id1"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_ResourceOperationStatus_GetWidgetOperationStatus_WidgetsGetWidgetOperationStatus_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + ContosoWidgets client = new WidgetManagerClient(endpoint, credential).GetContosoWidgetsClient(apiVersion: "2022-12-01"); + + Response response = await client.GetWidgetOperationStatusAsync("name1", "opreation id1"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_WidgetSuite_GetWidgets_WidgetsListWidgets() + { + Uri endpoint = new Uri(""); + 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()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_WidgetSuite_GetWidgets_WidgetsListWidgets_Async() + { + Uri endpoint = new Uri(""); + 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()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_WidgetSuite_GetWidgets_WidgetsListWidgets_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + ContosoWidgets client = new WidgetManagerClient(endpoint, credential).GetContosoWidgetsClient(apiVersion: "2022-12-01"); + + foreach (WidgetSuite item in client.GetWidgets()) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_WidgetSuite_GetWidgets_WidgetsListWidgets_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + ContosoWidgets client = new WidgetManagerClient(endpoint, credential).GetContosoWidgetsClient(apiVersion: "2022-12-01"); + + await foreach (WidgetSuite item in client.GetWidgetsAsync()) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_WidgetSuite_CreateOrUpdateWidget_WidgetsCreateOrUpdateWidget() + { + Uri endpoint = new Uri(""); + 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()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_WidgetSuite_CreateOrUpdateWidget_WidgetsCreateOrUpdateWidget_Async() + { + Uri endpoint = new Uri(""); + 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()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_WidgetSuite_DeleteWidget_DeleteWidgetByWidgetNameUsingLongRunningOperation() + { + Uri endpoint = new Uri(""); + 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()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_WidgetSuite_DeleteWidget_DeleteWidgetByWidgetNameUsingLongRunningOperation_Async() + { + Uri endpoint = new Uri(""); + 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()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_WidgetSuite_DeleteWidget_DeleteWidgetByWidgetNameUsingLongRunningOperation_Convenience() + { + Uri endpoint = new Uri(""); + 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; + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_WidgetSuite_DeleteWidget_DeleteWidgetByWidgetNameUsingLongRunningOperation_Convenience_Async() + { + Uri endpoint = new Uri(""); + 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; + } + } +} diff --git a/sdk/contosowidgetmanager/Azure.Template.Contoso/tsp-location.yaml b/sdk/contosowidgetmanager/Azure.Template.Contoso/tsp-location.yaml new file mode 100644 index 000000000000..914e280edd55 --- /dev/null +++ b/sdk/contosowidgetmanager/Azure.Template.Contoso/tsp-location.yaml @@ -0,0 +1,5 @@ +directory: specification/contosowidgetmanager/Contoso.WidgetManager +commit: e5eca2279ea7f0cf8c93e7c543ffc033a18e5f7f +repo: Azure/azure-rest-api-specs +additionalDirectories: +- specification/contosowidgetmanager/Contoso.WidgetManager.Shared diff --git a/sdk/contosowidgetmanager/ci.yml b/sdk/contosowidgetmanager/ci.yml new file mode 100644 index 000000000000..7f76decbce9e --- /dev/null +++ b/sdk/contosowidgetmanager/ci.yml @@ -0,0 +1,35 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - main + - hotfix/* + - release/* + paths: + include: + - sdk/contosowidgetmanager + - sdk/contosowidgetmanager/ci.yml + - sdk/contosowidgetmanager/Azure.Template.Contoso + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/contosowidgetmanager + - sdk/contosowidgetmanager/ci.yml + - sdk/contosowidgetmanager/Azure.Template.Contoso + +extends: + template: /eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: contosowidgetmanager + ArtifactName: packages + Artifacts: + - name: Azure.Template.Contoso + safeName: AzureTemplateContoso diff --git a/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/api/Azure.Health.Insights.RadiologyInsights.net8.0.cs b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/api/Azure.Health.Insights.RadiologyInsights.net8.0.cs index 2884afa3f79d..c0083ed6a633 100644 --- a/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/api/Azure.Health.Insights.RadiologyInsights.net8.0.cs +++ b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/api/Azure.Health.Insights.RadiologyInsights.net8.0.cs @@ -10,6 +10,18 @@ protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter write string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } + public partial class AssessmentValueRange : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal AssessmentValueRange() { } + public string Maximum { get { throw null; } } + public string Minimum { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.Health.Insights.RadiologyInsights.AssessmentValueRange 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.Health.Insights.RadiologyInsights.AssessmentValueRange System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } public partial class ClinicalDocumentAuthor : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public ClinicalDocumentAuthor() { } @@ -703,9 +715,55 @@ protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter write string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } + public partial class GuidanceInference : Azure.Health.Insights.RadiologyInsights.RadiologyInsightsInference, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal GuidanceInference() { } + public Azure.Health.Insights.RadiologyInsights.FindingInference Finding { get { throw null; } } + public Azure.Health.Insights.RadiologyInsights.FhirR4CodeableConcept Identifier { get { throw null; } } + public System.Collections.Generic.IReadOnlyList MissingGuidanceInformation { get { throw null; } } + public System.Collections.Generic.IReadOnlyList PresentGuidanceInformation { get { throw null; } } + public Azure.Health.Insights.RadiologyInsights.GuidanceRankingType Ranking { get { throw null; } } + public System.Collections.Generic.IReadOnlyList RecommendationProposals { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.Health.Insights.RadiologyInsights.GuidanceInference 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.Health.Insights.RadiologyInsights.GuidanceInference System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class GuidanceOptions : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public GuidanceOptions(bool showGuidanceInHistory) { } + public bool ShowGuidanceInHistory { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.Health.Insights.RadiologyInsights.GuidanceOptions 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.Health.Insights.RadiologyInsights.GuidanceOptions 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 GuidanceRankingType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public GuidanceRankingType(string value) { throw null; } + public static Azure.Health.Insights.RadiologyInsights.GuidanceRankingType High { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.GuidanceRankingType Low { get { throw null; } } + public bool Equals(Azure.Health.Insights.RadiologyInsights.GuidanceRankingType 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.Health.Insights.RadiologyInsights.GuidanceRankingType left, Azure.Health.Insights.RadiologyInsights.GuidanceRankingType right) { throw null; } + public static implicit operator Azure.Health.Insights.RadiologyInsights.GuidanceRankingType (string value) { throw null; } + public static bool operator !=(Azure.Health.Insights.RadiologyInsights.GuidanceRankingType left, Azure.Health.Insights.RadiologyInsights.GuidanceRankingType right) { throw null; } + public override string ToString() { throw null; } + } public static partial class HealthInsightsRadiologyInsightsModelFactory { public static Azure.Health.Insights.RadiologyInsights.AgeMismatchInference AgeMismatchInference(System.Collections.Generic.IEnumerable extension = null) { throw null; } + public static Azure.Health.Insights.RadiologyInsights.AssessmentValueRange AssessmentValueRange(string minimum = null, string maximum = null) { throw null; } public static Azure.Health.Insights.RadiologyInsights.CompleteOrderDiscrepancyInference CompleteOrderDiscrepancyInference(System.Collections.Generic.IEnumerable extension = null, Azure.Health.Insights.RadiologyInsights.FhirR4CodeableConcept orderType = null, System.Collections.Generic.IEnumerable missingBodyParts = null, System.Collections.Generic.IEnumerable missingBodyPartMeasurements = null) { throw null; } public static Azure.Health.Insights.RadiologyInsights.CriticalResult CriticalResult(string description = null, Azure.Health.Insights.RadiologyInsights.FhirR4Observation finding = null) { throw null; } public static Azure.Health.Insights.RadiologyInsights.CriticalResultInference CriticalResultInference(System.Collections.Generic.IEnumerable extension = null, Azure.Health.Insights.RadiologyInsights.CriticalResult result = null) { throw null; } @@ -724,11 +782,14 @@ public static partial class HealthInsightsRadiologyInsightsModelFactory public static Azure.Health.Insights.RadiologyInsights.FollowupCommunicationInference FollowupCommunicationInference(System.Collections.Generic.IEnumerable extension = null, System.Collections.Generic.IEnumerable communicatedAt = null, System.Collections.Generic.IEnumerable recipient = null, bool wasAcknowledged = false) { throw null; } public static Azure.Health.Insights.RadiologyInsights.FollowupRecommendationInference FollowupRecommendationInference(System.Collections.Generic.IEnumerable extension = null, string effectiveAt = null, Azure.Health.Insights.RadiologyInsights.FhirR4Period effectivePeriod = null, System.Collections.Generic.IEnumerable findings = null, bool isConditional = false, bool isOption = false, bool isGuideline = false, bool isHedging = false, Azure.Health.Insights.RadiologyInsights.ProcedureRecommendation recommendedProcedure = null) { throw null; } public static Azure.Health.Insights.RadiologyInsights.GenericProcedureRecommendation GenericProcedureRecommendation(System.Collections.Generic.IEnumerable extension = null, Azure.Health.Insights.RadiologyInsights.FhirR4CodeableConcept code = null, string description = null) { throw null; } + public static Azure.Health.Insights.RadiologyInsights.GuidanceInference GuidanceInference(System.Collections.Generic.IEnumerable extension = null, Azure.Health.Insights.RadiologyInsights.FindingInference finding = null, Azure.Health.Insights.RadiologyInsights.FhirR4CodeableConcept identifier = null, System.Collections.Generic.IEnumerable presentGuidanceInformation = null, Azure.Health.Insights.RadiologyInsights.GuidanceRankingType ranking = default(Azure.Health.Insights.RadiologyInsights.GuidanceRankingType), System.Collections.Generic.IEnumerable recommendationProposals = null, System.Collections.Generic.IEnumerable missingGuidanceInformation = null) { throw null; } public static Azure.Health.Insights.RadiologyInsights.ImagingProcedure ImagingProcedure(Azure.Health.Insights.RadiologyInsights.FhirR4CodeableConcept modality = null, Azure.Health.Insights.RadiologyInsights.FhirR4CodeableConcept anatomy = null, Azure.Health.Insights.RadiologyInsights.FhirR4CodeableConcept laterality = null, Azure.Health.Insights.RadiologyInsights.RadiologyCodeWithTypes contrast = null, Azure.Health.Insights.RadiologyInsights.RadiologyCodeWithTypes view = null) { throw null; } public static Azure.Health.Insights.RadiologyInsights.ImagingProcedureRecommendation ImagingProcedureRecommendation(System.Collections.Generic.IEnumerable extension = null, System.Collections.Generic.IEnumerable procedureCodes = null, System.Collections.Generic.IEnumerable imagingProcedures = null) { throw null; } public static Azure.Health.Insights.RadiologyInsights.LateralityDiscrepancyInference LateralityDiscrepancyInference(System.Collections.Generic.IEnumerable extension = null, Azure.Health.Insights.RadiologyInsights.FhirR4CodeableConcept lateralityIndication = null, Azure.Health.Insights.RadiologyInsights.LateralityDiscrepancyType discrepancyType = default(Azure.Health.Insights.RadiologyInsights.LateralityDiscrepancyType)) { throw null; } public static Azure.Health.Insights.RadiologyInsights.LimitedOrderDiscrepancyInference LimitedOrderDiscrepancyInference(System.Collections.Generic.IEnumerable extension = null, Azure.Health.Insights.RadiologyInsights.FhirR4CodeableConcept orderType = null, System.Collections.Generic.IEnumerable presentBodyParts = null, System.Collections.Generic.IEnumerable presentBodyPartMeasurements = null) { throw null; } + public static Azure.Health.Insights.RadiologyInsights.PresentGuidanceInformation PresentGuidanceInformation(string presentGuidanceItem = null, System.Collections.Generic.IEnumerable sizes = null, Azure.Health.Insights.RadiologyInsights.FhirR4Quantity maximumDiameterAsInText = null, System.Collections.Generic.IEnumerable presentGuidanceValues = null, System.Collections.Generic.IEnumerable extension = null) { throw null; } public static Azure.Health.Insights.RadiologyInsights.ProcedureRecommendation ProcedureRecommendation(string kind = null, System.Collections.Generic.IEnumerable extension = null) { throw null; } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureInference QualityMeasureInference(System.Collections.Generic.IEnumerable extension = null, string qualityMeasureDenominator = null, Azure.Health.Insights.RadiologyInsights.QualityMeasureComplianceType complianceType = default(Azure.Health.Insights.RadiologyInsights.QualityMeasureComplianceType), System.Collections.Generic.IEnumerable qualityCriteria = null) { throw null; } public static Azure.Health.Insights.RadiologyInsights.RadiologyCodeWithTypes RadiologyCodeWithTypes(Azure.Health.Insights.RadiologyInsights.FhirR4CodeableConcept code = null, System.Collections.Generic.IEnumerable types = null) { throw null; } public static Azure.Health.Insights.RadiologyInsights.RadiologyInsightsInference RadiologyInsightsInference(string kind = null, System.Collections.Generic.IEnumerable extension = null) { throw null; } public static Azure.Health.Insights.RadiologyInsights.RadiologyInsightsInferenceResult RadiologyInsightsInferenceResult(System.Collections.Generic.IEnumerable patientResults = null, string modelVersion = null) { throw null; } @@ -738,6 +799,7 @@ public static partial class HealthInsightsRadiologyInsightsModelFactory public static Azure.Health.Insights.RadiologyInsights.RecommendationFinding RecommendationFinding(Azure.Health.Insights.RadiologyInsights.FhirR4Observation finding = null, Azure.Health.Insights.RadiologyInsights.CriticalResult criticalFinding = null, Azure.Health.Insights.RadiologyInsights.RecommendationFindingStatusType recommendationFindingStatus = default(Azure.Health.Insights.RadiologyInsights.RecommendationFindingStatusType), System.Collections.Generic.IEnumerable extension = null) { throw null; } public static Azure.Health.Insights.RadiologyInsights.ResearchStudyArm ResearchStudyArm(string name = null, Azure.Health.Insights.RadiologyInsights.FhirR4CodeableConcept type = null, string description = null) { throw null; } public static Azure.Health.Insights.RadiologyInsights.ResearchStudyObjective ResearchStudyObjective(string name = null, Azure.Health.Insights.RadiologyInsights.FhirR4CodeableConcept type = null) { throw null; } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentInference ScoringAndAssessmentInference(System.Collections.Generic.IEnumerable extension = null, Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType category = default(Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType), string categoryDescription = null, string singleValue = null, Azure.Health.Insights.RadiologyInsights.AssessmentValueRange rangeValue = null) { throw null; } public static Azure.Health.Insights.RadiologyInsights.SexMismatchInference SexMismatchInference(System.Collections.Generic.IEnumerable extension = null, Azure.Health.Insights.RadiologyInsights.FhirR4CodeableConcept sexIndication = null) { throw null; } } public partial class ImagingProcedure : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel @@ -968,6 +1030,21 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public static bool operator !=(Azure.Health.Insights.RadiologyInsights.PatientSex left, Azure.Health.Insights.RadiologyInsights.PatientSex right) { throw null; } public override string ToString() { throw null; } } + public partial class PresentGuidanceInformation : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal PresentGuidanceInformation() { } + public System.Collections.Generic.IReadOnlyList Extension { get { throw null; } } + public Azure.Health.Insights.RadiologyInsights.FhirR4Quantity MaximumDiameterAsInText { get { throw null; } } + public string PresentGuidanceItem { get { throw null; } } + public System.Collections.Generic.IReadOnlyList PresentGuidanceValues { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Sizes { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.Health.Insights.RadiologyInsights.PresentGuidanceInformation 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.Health.Insights.RadiologyInsights.PresentGuidanceInformation 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 abstract partial class ProcedureRecommendation : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { protected ProcedureRecommendation() { } @@ -979,6 +1056,89 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer 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 QualityMeasureComplianceType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public QualityMeasureComplianceType(string value) { throw null; } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureComplianceType DenominatorException { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureComplianceType NotEligible { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureComplianceType PerformanceMet { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureComplianceType PerformanceNotMet { get { throw null; } } + public bool Equals(Azure.Health.Insights.RadiologyInsights.QualityMeasureComplianceType 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.Health.Insights.RadiologyInsights.QualityMeasureComplianceType left, Azure.Health.Insights.RadiologyInsights.QualityMeasureComplianceType right) { throw null; } + public static implicit operator Azure.Health.Insights.RadiologyInsights.QualityMeasureComplianceType (string value) { throw null; } + public static bool operator !=(Azure.Health.Insights.RadiologyInsights.QualityMeasureComplianceType left, Azure.Health.Insights.RadiologyInsights.QualityMeasureComplianceType right) { throw null; } + public override string ToString() { throw null; } + } + public partial class QualityMeasureInference : Azure.Health.Insights.RadiologyInsights.RadiologyInsightsInference, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal QualityMeasureInference() { } + public Azure.Health.Insights.RadiologyInsights.QualityMeasureComplianceType ComplianceType { get { throw null; } } + public System.Collections.Generic.IReadOnlyList QualityCriteria { get { throw null; } } + public string QualityMeasureDenominator { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.Health.Insights.RadiologyInsights.QualityMeasureInference 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.Health.Insights.RadiologyInsights.QualityMeasureInference System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class QualityMeasureOptions : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public QualityMeasureOptions(System.Collections.Generic.IEnumerable measureTypes) { } + public System.Collections.Generic.IList MeasureTypes { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.Health.Insights.RadiologyInsights.QualityMeasureOptions 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.Health.Insights.RadiologyInsights.QualityMeasureOptions 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 QualityMeasureType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public QualityMeasureType(string value) { throw null; } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureType Acrad36 { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureType Acrad37 { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureType Acrad38 { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureType Acrad39 { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureType Acrad40 { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureType Acrad41 { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureType Acrad42 { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureType Mednax55 { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureType Mips145 { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureType Mips147 { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureType Mips195 { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureType Mips360 { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureType Mips364 { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureType Mips405 { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureType Mips406 { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureType Mips436 { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureType Mips76 { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureType Msn13 { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureType Msn15 { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureType Qmm17 { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureType Qmm18 { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureType Qmm19 { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureType Qmm26 { get { throw null; } } + public bool Equals(Azure.Health.Insights.RadiologyInsights.QualityMeasureType 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.Health.Insights.RadiologyInsights.QualityMeasureType left, Azure.Health.Insights.RadiologyInsights.QualityMeasureType right) { throw null; } + public static implicit operator Azure.Health.Insights.RadiologyInsights.QualityMeasureType (string value) { throw null; } + public static bool operator !=(Azure.Health.Insights.RadiologyInsights.QualityMeasureType left, Azure.Health.Insights.RadiologyInsights.QualityMeasureType right) { throw null; } + public override string ToString() { throw null; } + } public partial class RadiologyCodeWithTypes : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { internal RadiologyCodeWithTypes() { } @@ -1006,10 +1166,11 @@ public RadiologyInsightsClient(System.Uri endpoint, Azure.Core.TokenCredential c } public partial class RadiologyInsightsClientOptions : Azure.Core.ClientOptions { - public RadiologyInsightsClientOptions(Azure.Health.Insights.RadiologyInsights.RadiologyInsightsClientOptions.ServiceVersion version = Azure.Health.Insights.RadiologyInsights.RadiologyInsightsClientOptions.ServiceVersion.V2024_04_01) { } + public RadiologyInsightsClientOptions(Azure.Health.Insights.RadiologyInsights.RadiologyInsightsClientOptions.ServiceVersion version = Azure.Health.Insights.RadiologyInsights.RadiologyInsightsClientOptions.ServiceVersion.V2024_10_01) { } public enum ServiceVersion { V2024_04_01 = 1, + V2024_10_01 = 2, } } public partial class RadiologyInsightsData : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel @@ -1040,6 +1201,8 @@ public partial class RadiologyInsightsInferenceOptions : System.ClientModel.Prim public RadiologyInsightsInferenceOptions() { } public Azure.Health.Insights.RadiologyInsights.FindingOptions FindingOptions { get { throw null; } set { } } public Azure.Health.Insights.RadiologyInsights.FollowupRecommendationOptions FollowupRecommendationOptions { get { throw null; } set { } } + public Azure.Health.Insights.RadiologyInsights.GuidanceOptions GuidanceOptions { get { throw null; } set { } } + public Azure.Health.Insights.RadiologyInsights.QualityMeasureOptions QualityMeasureOptions { get { throw null; } set { } } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.Health.Insights.RadiologyInsights.RadiologyInsightsInferenceOptions 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) { } @@ -1071,9 +1234,12 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public static Azure.Health.Insights.RadiologyInsights.RadiologyInsightsInferenceType Finding { get { throw null; } } public static Azure.Health.Insights.RadiologyInsights.RadiologyInsightsInferenceType FollowupCommunication { get { throw null; } } public static Azure.Health.Insights.RadiologyInsights.RadiologyInsightsInferenceType FollowupRecommendation { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.RadiologyInsightsInferenceType Guidance { get { throw null; } } public static Azure.Health.Insights.RadiologyInsights.RadiologyInsightsInferenceType LateralityDiscrepancy { get { throw null; } } public static Azure.Health.Insights.RadiologyInsights.RadiologyInsightsInferenceType LimitedOrderDiscrepancy { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.RadiologyInsightsInferenceType QualityMeasure { get { throw null; } } public static Azure.Health.Insights.RadiologyInsights.RadiologyInsightsInferenceType RadiologyProcedure { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.RadiologyInsightsInferenceType ScoringAndAssessment { get { throw null; } } public static Azure.Health.Insights.RadiologyInsights.RadiologyInsightsInferenceType SexMismatch { get { throw null; } } public bool Equals(Azure.Health.Insights.RadiologyInsights.RadiologyInsightsInferenceType other) { throw null; } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] @@ -1229,6 +1395,70 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public static bool operator !=(Azure.Health.Insights.RadiologyInsights.ResearchStudyStatusCodeType left, Azure.Health.Insights.RadiologyInsights.ResearchStudyStatusCodeType right) { throw null; } public override string ToString() { throw null; } } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ScoringAndAssessmentCategoryType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ScoringAndAssessmentCategoryType(string value) { throw null; } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType AGATSTONSCORE { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType ALBERTASTROKEPROGRAMEARLYCTSCORE { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType ASCVDRISK { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType BIRADS { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType CADRADS { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType CALCIUMMASSSCORE { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType CALCIUMSCOREUNSPECIFIED { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType CALCIUMVOLUMESCORE { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType CEUSLIRADS { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType CRADSCOLONICFINDINGS { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType CRADSEXTRACOLONICFINDINGS { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType FRAXSCORE { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType HNPCCMUTATIONRISK { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType KELLGRENLAWRENCEGRADINGSCALE { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType LIFETIMEBREASTCANCERRISK { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType LIRADS { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType LUNGRADS { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType MODIFIEDGAILMODELRISK { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType NIRADS { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType ORADS { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType ORADSMRI { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType PIRADS { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType RISKOFMALIGNANCYINDEX { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType TENYEARCHDRISK { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType TENYEARCHDRISKARTERIALAGE { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType TENYEARCHDRISKOBSERVEDAGE { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType TIRADS { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType TONNISCLASSIFICATION { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType TREATMENTRESPONSELIRADS { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType TSCORE { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType TYRERCUSICKMODELRISK { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType USLIRADS { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType USLIRADSVISUALIZATIONSCORE { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType ZSCORE { get { throw null; } } + public bool Equals(Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType 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.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType left, Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType right) { throw null; } + public static implicit operator Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType (string value) { throw null; } + public static bool operator !=(Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType left, Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType right) { throw null; } + public override string ToString() { throw null; } + } + public partial class ScoringAndAssessmentInference : Azure.Health.Insights.RadiologyInsights.RadiologyInsightsInference, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ScoringAndAssessmentInference() { } + public Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType Category { get { throw null; } } + public string CategoryDescription { get { throw null; } } + public Azure.Health.Insights.RadiologyInsights.AssessmentValueRange RangeValue { get { throw null; } } + public string SingleValue { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentInference 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.Health.Insights.RadiologyInsights.ScoringAndAssessmentInference System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } public partial class SexMismatchInference : Azure.Health.Insights.RadiologyInsights.RadiologyInsightsInference, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { internal SexMismatchInference() { } diff --git a/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/api/Azure.Health.Insights.RadiologyInsights.netstandard2.0.cs b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/api/Azure.Health.Insights.RadiologyInsights.netstandard2.0.cs index 2884afa3f79d..c0083ed6a633 100644 --- a/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/api/Azure.Health.Insights.RadiologyInsights.netstandard2.0.cs +++ b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/api/Azure.Health.Insights.RadiologyInsights.netstandard2.0.cs @@ -10,6 +10,18 @@ protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter write string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } + public partial class AssessmentValueRange : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal AssessmentValueRange() { } + public string Maximum { get { throw null; } } + public string Minimum { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.Health.Insights.RadiologyInsights.AssessmentValueRange 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.Health.Insights.RadiologyInsights.AssessmentValueRange System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } public partial class ClinicalDocumentAuthor : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public ClinicalDocumentAuthor() { } @@ -703,9 +715,55 @@ protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter write string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } + public partial class GuidanceInference : Azure.Health.Insights.RadiologyInsights.RadiologyInsightsInference, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal GuidanceInference() { } + public Azure.Health.Insights.RadiologyInsights.FindingInference Finding { get { throw null; } } + public Azure.Health.Insights.RadiologyInsights.FhirR4CodeableConcept Identifier { get { throw null; } } + public System.Collections.Generic.IReadOnlyList MissingGuidanceInformation { get { throw null; } } + public System.Collections.Generic.IReadOnlyList PresentGuidanceInformation { get { throw null; } } + public Azure.Health.Insights.RadiologyInsights.GuidanceRankingType Ranking { get { throw null; } } + public System.Collections.Generic.IReadOnlyList RecommendationProposals { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.Health.Insights.RadiologyInsights.GuidanceInference 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.Health.Insights.RadiologyInsights.GuidanceInference System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class GuidanceOptions : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public GuidanceOptions(bool showGuidanceInHistory) { } + public bool ShowGuidanceInHistory { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.Health.Insights.RadiologyInsights.GuidanceOptions 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.Health.Insights.RadiologyInsights.GuidanceOptions 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 GuidanceRankingType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public GuidanceRankingType(string value) { throw null; } + public static Azure.Health.Insights.RadiologyInsights.GuidanceRankingType High { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.GuidanceRankingType Low { get { throw null; } } + public bool Equals(Azure.Health.Insights.RadiologyInsights.GuidanceRankingType 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.Health.Insights.RadiologyInsights.GuidanceRankingType left, Azure.Health.Insights.RadiologyInsights.GuidanceRankingType right) { throw null; } + public static implicit operator Azure.Health.Insights.RadiologyInsights.GuidanceRankingType (string value) { throw null; } + public static bool operator !=(Azure.Health.Insights.RadiologyInsights.GuidanceRankingType left, Azure.Health.Insights.RadiologyInsights.GuidanceRankingType right) { throw null; } + public override string ToString() { throw null; } + } public static partial class HealthInsightsRadiologyInsightsModelFactory { public static Azure.Health.Insights.RadiologyInsights.AgeMismatchInference AgeMismatchInference(System.Collections.Generic.IEnumerable extension = null) { throw null; } + public static Azure.Health.Insights.RadiologyInsights.AssessmentValueRange AssessmentValueRange(string minimum = null, string maximum = null) { throw null; } public static Azure.Health.Insights.RadiologyInsights.CompleteOrderDiscrepancyInference CompleteOrderDiscrepancyInference(System.Collections.Generic.IEnumerable extension = null, Azure.Health.Insights.RadiologyInsights.FhirR4CodeableConcept orderType = null, System.Collections.Generic.IEnumerable missingBodyParts = null, System.Collections.Generic.IEnumerable missingBodyPartMeasurements = null) { throw null; } public static Azure.Health.Insights.RadiologyInsights.CriticalResult CriticalResult(string description = null, Azure.Health.Insights.RadiologyInsights.FhirR4Observation finding = null) { throw null; } public static Azure.Health.Insights.RadiologyInsights.CriticalResultInference CriticalResultInference(System.Collections.Generic.IEnumerable extension = null, Azure.Health.Insights.RadiologyInsights.CriticalResult result = null) { throw null; } @@ -724,11 +782,14 @@ public static partial class HealthInsightsRadiologyInsightsModelFactory public static Azure.Health.Insights.RadiologyInsights.FollowupCommunicationInference FollowupCommunicationInference(System.Collections.Generic.IEnumerable extension = null, System.Collections.Generic.IEnumerable communicatedAt = null, System.Collections.Generic.IEnumerable recipient = null, bool wasAcknowledged = false) { throw null; } public static Azure.Health.Insights.RadiologyInsights.FollowupRecommendationInference FollowupRecommendationInference(System.Collections.Generic.IEnumerable extension = null, string effectiveAt = null, Azure.Health.Insights.RadiologyInsights.FhirR4Period effectivePeriod = null, System.Collections.Generic.IEnumerable findings = null, bool isConditional = false, bool isOption = false, bool isGuideline = false, bool isHedging = false, Azure.Health.Insights.RadiologyInsights.ProcedureRecommendation recommendedProcedure = null) { throw null; } public static Azure.Health.Insights.RadiologyInsights.GenericProcedureRecommendation GenericProcedureRecommendation(System.Collections.Generic.IEnumerable extension = null, Azure.Health.Insights.RadiologyInsights.FhirR4CodeableConcept code = null, string description = null) { throw null; } + public static Azure.Health.Insights.RadiologyInsights.GuidanceInference GuidanceInference(System.Collections.Generic.IEnumerable extension = null, Azure.Health.Insights.RadiologyInsights.FindingInference finding = null, Azure.Health.Insights.RadiologyInsights.FhirR4CodeableConcept identifier = null, System.Collections.Generic.IEnumerable presentGuidanceInformation = null, Azure.Health.Insights.RadiologyInsights.GuidanceRankingType ranking = default(Azure.Health.Insights.RadiologyInsights.GuidanceRankingType), System.Collections.Generic.IEnumerable recommendationProposals = null, System.Collections.Generic.IEnumerable missingGuidanceInformation = null) { throw null; } public static Azure.Health.Insights.RadiologyInsights.ImagingProcedure ImagingProcedure(Azure.Health.Insights.RadiologyInsights.FhirR4CodeableConcept modality = null, Azure.Health.Insights.RadiologyInsights.FhirR4CodeableConcept anatomy = null, Azure.Health.Insights.RadiologyInsights.FhirR4CodeableConcept laterality = null, Azure.Health.Insights.RadiologyInsights.RadiologyCodeWithTypes contrast = null, Azure.Health.Insights.RadiologyInsights.RadiologyCodeWithTypes view = null) { throw null; } public static Azure.Health.Insights.RadiologyInsights.ImagingProcedureRecommendation ImagingProcedureRecommendation(System.Collections.Generic.IEnumerable extension = null, System.Collections.Generic.IEnumerable procedureCodes = null, System.Collections.Generic.IEnumerable imagingProcedures = null) { throw null; } public static Azure.Health.Insights.RadiologyInsights.LateralityDiscrepancyInference LateralityDiscrepancyInference(System.Collections.Generic.IEnumerable extension = null, Azure.Health.Insights.RadiologyInsights.FhirR4CodeableConcept lateralityIndication = null, Azure.Health.Insights.RadiologyInsights.LateralityDiscrepancyType discrepancyType = default(Azure.Health.Insights.RadiologyInsights.LateralityDiscrepancyType)) { throw null; } public static Azure.Health.Insights.RadiologyInsights.LimitedOrderDiscrepancyInference LimitedOrderDiscrepancyInference(System.Collections.Generic.IEnumerable extension = null, Azure.Health.Insights.RadiologyInsights.FhirR4CodeableConcept orderType = null, System.Collections.Generic.IEnumerable presentBodyParts = null, System.Collections.Generic.IEnumerable presentBodyPartMeasurements = null) { throw null; } + public static Azure.Health.Insights.RadiologyInsights.PresentGuidanceInformation PresentGuidanceInformation(string presentGuidanceItem = null, System.Collections.Generic.IEnumerable sizes = null, Azure.Health.Insights.RadiologyInsights.FhirR4Quantity maximumDiameterAsInText = null, System.Collections.Generic.IEnumerable presentGuidanceValues = null, System.Collections.Generic.IEnumerable extension = null) { throw null; } public static Azure.Health.Insights.RadiologyInsights.ProcedureRecommendation ProcedureRecommendation(string kind = null, System.Collections.Generic.IEnumerable extension = null) { throw null; } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureInference QualityMeasureInference(System.Collections.Generic.IEnumerable extension = null, string qualityMeasureDenominator = null, Azure.Health.Insights.RadiologyInsights.QualityMeasureComplianceType complianceType = default(Azure.Health.Insights.RadiologyInsights.QualityMeasureComplianceType), System.Collections.Generic.IEnumerable qualityCriteria = null) { throw null; } public static Azure.Health.Insights.RadiologyInsights.RadiologyCodeWithTypes RadiologyCodeWithTypes(Azure.Health.Insights.RadiologyInsights.FhirR4CodeableConcept code = null, System.Collections.Generic.IEnumerable types = null) { throw null; } public static Azure.Health.Insights.RadiologyInsights.RadiologyInsightsInference RadiologyInsightsInference(string kind = null, System.Collections.Generic.IEnumerable extension = null) { throw null; } public static Azure.Health.Insights.RadiologyInsights.RadiologyInsightsInferenceResult RadiologyInsightsInferenceResult(System.Collections.Generic.IEnumerable patientResults = null, string modelVersion = null) { throw null; } @@ -738,6 +799,7 @@ public static partial class HealthInsightsRadiologyInsightsModelFactory public static Azure.Health.Insights.RadiologyInsights.RecommendationFinding RecommendationFinding(Azure.Health.Insights.RadiologyInsights.FhirR4Observation finding = null, Azure.Health.Insights.RadiologyInsights.CriticalResult criticalFinding = null, Azure.Health.Insights.RadiologyInsights.RecommendationFindingStatusType recommendationFindingStatus = default(Azure.Health.Insights.RadiologyInsights.RecommendationFindingStatusType), System.Collections.Generic.IEnumerable extension = null) { throw null; } public static Azure.Health.Insights.RadiologyInsights.ResearchStudyArm ResearchStudyArm(string name = null, Azure.Health.Insights.RadiologyInsights.FhirR4CodeableConcept type = null, string description = null) { throw null; } public static Azure.Health.Insights.RadiologyInsights.ResearchStudyObjective ResearchStudyObjective(string name = null, Azure.Health.Insights.RadiologyInsights.FhirR4CodeableConcept type = null) { throw null; } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentInference ScoringAndAssessmentInference(System.Collections.Generic.IEnumerable extension = null, Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType category = default(Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType), string categoryDescription = null, string singleValue = null, Azure.Health.Insights.RadiologyInsights.AssessmentValueRange rangeValue = null) { throw null; } public static Azure.Health.Insights.RadiologyInsights.SexMismatchInference SexMismatchInference(System.Collections.Generic.IEnumerable extension = null, Azure.Health.Insights.RadiologyInsights.FhirR4CodeableConcept sexIndication = null) { throw null; } } public partial class ImagingProcedure : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel @@ -968,6 +1030,21 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public static bool operator !=(Azure.Health.Insights.RadiologyInsights.PatientSex left, Azure.Health.Insights.RadiologyInsights.PatientSex right) { throw null; } public override string ToString() { throw null; } } + public partial class PresentGuidanceInformation : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal PresentGuidanceInformation() { } + public System.Collections.Generic.IReadOnlyList Extension { get { throw null; } } + public Azure.Health.Insights.RadiologyInsights.FhirR4Quantity MaximumDiameterAsInText { get { throw null; } } + public string PresentGuidanceItem { get { throw null; } } + public System.Collections.Generic.IReadOnlyList PresentGuidanceValues { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Sizes { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.Health.Insights.RadiologyInsights.PresentGuidanceInformation 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.Health.Insights.RadiologyInsights.PresentGuidanceInformation 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 abstract partial class ProcedureRecommendation : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { protected ProcedureRecommendation() { } @@ -979,6 +1056,89 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer 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 QualityMeasureComplianceType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public QualityMeasureComplianceType(string value) { throw null; } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureComplianceType DenominatorException { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureComplianceType NotEligible { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureComplianceType PerformanceMet { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureComplianceType PerformanceNotMet { get { throw null; } } + public bool Equals(Azure.Health.Insights.RadiologyInsights.QualityMeasureComplianceType 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.Health.Insights.RadiologyInsights.QualityMeasureComplianceType left, Azure.Health.Insights.RadiologyInsights.QualityMeasureComplianceType right) { throw null; } + public static implicit operator Azure.Health.Insights.RadiologyInsights.QualityMeasureComplianceType (string value) { throw null; } + public static bool operator !=(Azure.Health.Insights.RadiologyInsights.QualityMeasureComplianceType left, Azure.Health.Insights.RadiologyInsights.QualityMeasureComplianceType right) { throw null; } + public override string ToString() { throw null; } + } + public partial class QualityMeasureInference : Azure.Health.Insights.RadiologyInsights.RadiologyInsightsInference, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal QualityMeasureInference() { } + public Azure.Health.Insights.RadiologyInsights.QualityMeasureComplianceType ComplianceType { get { throw null; } } + public System.Collections.Generic.IReadOnlyList QualityCriteria { get { throw null; } } + public string QualityMeasureDenominator { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.Health.Insights.RadiologyInsights.QualityMeasureInference 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.Health.Insights.RadiologyInsights.QualityMeasureInference System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class QualityMeasureOptions : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public QualityMeasureOptions(System.Collections.Generic.IEnumerable measureTypes) { } + public System.Collections.Generic.IList MeasureTypes { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.Health.Insights.RadiologyInsights.QualityMeasureOptions 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.Health.Insights.RadiologyInsights.QualityMeasureOptions 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 QualityMeasureType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public QualityMeasureType(string value) { throw null; } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureType Acrad36 { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureType Acrad37 { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureType Acrad38 { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureType Acrad39 { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureType Acrad40 { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureType Acrad41 { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureType Acrad42 { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureType Mednax55 { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureType Mips145 { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureType Mips147 { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureType Mips195 { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureType Mips360 { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureType Mips364 { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureType Mips405 { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureType Mips406 { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureType Mips436 { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureType Mips76 { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureType Msn13 { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureType Msn15 { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureType Qmm17 { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureType Qmm18 { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureType Qmm19 { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.QualityMeasureType Qmm26 { get { throw null; } } + public bool Equals(Azure.Health.Insights.RadiologyInsights.QualityMeasureType 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.Health.Insights.RadiologyInsights.QualityMeasureType left, Azure.Health.Insights.RadiologyInsights.QualityMeasureType right) { throw null; } + public static implicit operator Azure.Health.Insights.RadiologyInsights.QualityMeasureType (string value) { throw null; } + public static bool operator !=(Azure.Health.Insights.RadiologyInsights.QualityMeasureType left, Azure.Health.Insights.RadiologyInsights.QualityMeasureType right) { throw null; } + public override string ToString() { throw null; } + } public partial class RadiologyCodeWithTypes : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { internal RadiologyCodeWithTypes() { } @@ -1006,10 +1166,11 @@ public RadiologyInsightsClient(System.Uri endpoint, Azure.Core.TokenCredential c } public partial class RadiologyInsightsClientOptions : Azure.Core.ClientOptions { - public RadiologyInsightsClientOptions(Azure.Health.Insights.RadiologyInsights.RadiologyInsightsClientOptions.ServiceVersion version = Azure.Health.Insights.RadiologyInsights.RadiologyInsightsClientOptions.ServiceVersion.V2024_04_01) { } + public RadiologyInsightsClientOptions(Azure.Health.Insights.RadiologyInsights.RadiologyInsightsClientOptions.ServiceVersion version = Azure.Health.Insights.RadiologyInsights.RadiologyInsightsClientOptions.ServiceVersion.V2024_10_01) { } public enum ServiceVersion { V2024_04_01 = 1, + V2024_10_01 = 2, } } public partial class RadiologyInsightsData : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel @@ -1040,6 +1201,8 @@ public partial class RadiologyInsightsInferenceOptions : System.ClientModel.Prim public RadiologyInsightsInferenceOptions() { } public Azure.Health.Insights.RadiologyInsights.FindingOptions FindingOptions { get { throw null; } set { } } public Azure.Health.Insights.RadiologyInsights.FollowupRecommendationOptions FollowupRecommendationOptions { get { throw null; } set { } } + public Azure.Health.Insights.RadiologyInsights.GuidanceOptions GuidanceOptions { get { throw null; } set { } } + public Azure.Health.Insights.RadiologyInsights.QualityMeasureOptions QualityMeasureOptions { get { throw null; } set { } } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.Health.Insights.RadiologyInsights.RadiologyInsightsInferenceOptions 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) { } @@ -1071,9 +1234,12 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public static Azure.Health.Insights.RadiologyInsights.RadiologyInsightsInferenceType Finding { get { throw null; } } public static Azure.Health.Insights.RadiologyInsights.RadiologyInsightsInferenceType FollowupCommunication { get { throw null; } } public static Azure.Health.Insights.RadiologyInsights.RadiologyInsightsInferenceType FollowupRecommendation { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.RadiologyInsightsInferenceType Guidance { get { throw null; } } public static Azure.Health.Insights.RadiologyInsights.RadiologyInsightsInferenceType LateralityDiscrepancy { get { throw null; } } public static Azure.Health.Insights.RadiologyInsights.RadiologyInsightsInferenceType LimitedOrderDiscrepancy { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.RadiologyInsightsInferenceType QualityMeasure { get { throw null; } } public static Azure.Health.Insights.RadiologyInsights.RadiologyInsightsInferenceType RadiologyProcedure { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.RadiologyInsightsInferenceType ScoringAndAssessment { get { throw null; } } public static Azure.Health.Insights.RadiologyInsights.RadiologyInsightsInferenceType SexMismatch { get { throw null; } } public bool Equals(Azure.Health.Insights.RadiologyInsights.RadiologyInsightsInferenceType other) { throw null; } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] @@ -1229,6 +1395,70 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public static bool operator !=(Azure.Health.Insights.RadiologyInsights.ResearchStudyStatusCodeType left, Azure.Health.Insights.RadiologyInsights.ResearchStudyStatusCodeType right) { throw null; } public override string ToString() { throw null; } } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ScoringAndAssessmentCategoryType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ScoringAndAssessmentCategoryType(string value) { throw null; } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType AGATSTONSCORE { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType ALBERTASTROKEPROGRAMEARLYCTSCORE { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType ASCVDRISK { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType BIRADS { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType CADRADS { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType CALCIUMMASSSCORE { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType CALCIUMSCOREUNSPECIFIED { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType CALCIUMVOLUMESCORE { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType CEUSLIRADS { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType CRADSCOLONICFINDINGS { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType CRADSEXTRACOLONICFINDINGS { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType FRAXSCORE { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType HNPCCMUTATIONRISK { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType KELLGRENLAWRENCEGRADINGSCALE { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType LIFETIMEBREASTCANCERRISK { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType LIRADS { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType LUNGRADS { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType MODIFIEDGAILMODELRISK { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType NIRADS { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType ORADS { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType ORADSMRI { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType PIRADS { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType RISKOFMALIGNANCYINDEX { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType TENYEARCHDRISK { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType TENYEARCHDRISKARTERIALAGE { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType TENYEARCHDRISKOBSERVEDAGE { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType TIRADS { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType TONNISCLASSIFICATION { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType TREATMENTRESPONSELIRADS { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType TSCORE { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType TYRERCUSICKMODELRISK { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType USLIRADS { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType USLIRADSVISUALIZATIONSCORE { get { throw null; } } + public static Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType ZSCORE { get { throw null; } } + public bool Equals(Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType 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.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType left, Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType right) { throw null; } + public static implicit operator Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType (string value) { throw null; } + public static bool operator !=(Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType left, Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType right) { throw null; } + public override string ToString() { throw null; } + } + public partial class ScoringAndAssessmentInference : Azure.Health.Insights.RadiologyInsights.RadiologyInsightsInference, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ScoringAndAssessmentInference() { } + public Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentCategoryType Category { get { throw null; } } + public string CategoryDescription { get { throw null; } } + public Azure.Health.Insights.RadiologyInsights.AssessmentValueRange RangeValue { get { throw null; } } + public string SingleValue { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.Health.Insights.RadiologyInsights.ScoringAndAssessmentInference 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.Health.Insights.RadiologyInsights.ScoringAndAssessmentInference System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } public partial class SexMismatchInference : Azure.Health.Insights.RadiologyInsights.RadiologyInsightsInference, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { internal SexMismatchInference() { } diff --git a/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/AssessmentValueRange.Serialization.cs b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/AssessmentValueRange.Serialization.cs new file mode 100644 index 000000000000..cf34bcf7c257 --- /dev/null +++ b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/AssessmentValueRange.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.Health.Insights.RadiologyInsights +{ + public partial class AssessmentValueRange : 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(AssessmentValueRange)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("minimum"u8); + writer.WriteStringValue(Minimum); + writer.WritePropertyName("maximum"u8); + writer.WriteStringValue(Maximum); + 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 + } + } + } + + AssessmentValueRange 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(AssessmentValueRange)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAssessmentValueRange(document.RootElement, options); + } + + internal static AssessmentValueRange DeserializeAssessmentValueRange(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string minimum = default; + string maximum = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("minimum"u8)) + { + minimum = property.Value.GetString(); + continue; + } + if (property.NameEquals("maximum"u8)) + { + maximum = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AssessmentValueRange(minimum, maximum, 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(AssessmentValueRange)} does not support writing '{options.Format}' format."); + } + } + + AssessmentValueRange 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 DeserializeAssessmentValueRange(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AssessmentValueRange)} 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 AssessmentValueRange FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeAssessmentValueRange(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/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/AssessmentValueRange.cs b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/AssessmentValueRange.cs new file mode 100644 index 000000000000..063bcc9817d6 --- /dev/null +++ b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/AssessmentValueRange.cs @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Health.Insights.RadiologyInsights +{ + /// A range of values. + public partial class AssessmentValueRange + { + /// + /// 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 minimum value. + /// The maximum value. + /// or is null. + internal AssessmentValueRange(string minimum, string maximum) + { + Argument.AssertNotNull(minimum, nameof(minimum)); + Argument.AssertNotNull(maximum, nameof(maximum)); + + Minimum = minimum; + Maximum = maximum; + } + + /// Initializes a new instance of . + /// The minimum value. + /// The maximum value. + /// Keeps track of any properties unknown to the library. + internal AssessmentValueRange(string minimum, string maximum, IDictionary serializedAdditionalRawData) + { + Minimum = minimum; + Maximum = maximum; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AssessmentValueRange() + { + } + + /// The minimum value. + public string Minimum { get; } + /// The maximum value. + public string Maximum { get; } + } +} diff --git a/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/Docs/RadiologyInsightsClient.xml b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/Docs/RadiologyInsightsClient.xml index 4be4584e5545..61146c283619 100644 --- a/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/Docs/RadiologyInsightsClient.xml +++ b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/Docs/RadiologyInsightsClient.xml @@ -179,6 +179,8 @@ RadiologyInsightsJob resource = new RadiologyInsightsJob { ProvideFocusedSentenceEvidence = true, }, + GuidanceOptions = new GuidanceOptions(true), + QualityMeasureOptions = new QualityMeasureOptions(new QualityMeasureType[] { QualityMeasureType.Mips76 }), }, Locale = "", }, @@ -366,6 +368,8 @@ RadiologyInsightsJob resource = new RadiologyInsightsJob { ProvideFocusedSentenceEvidence = true, }, + GuidanceOptions = new GuidanceOptions(true), + QualityMeasureOptions = new QualityMeasureOptions(new QualityMeasureType[] { QualityMeasureType.Mips76 }), }, Locale = "", }, @@ -627,6 +631,17 @@ using RequestContent content = RequestContent.Create(new { provideFocusedSentenceEvidence = true, }, + guidanceOptions = new + { + showGuidanceInHistory = true, + }, + qualityMeasureOptions = new + { + measureTypes = new object[] + { + "mips76" + }, + }, }, locale = "", }, @@ -2006,6 +2021,17 @@ using RequestContent content = RequestContent.Create(new { provideFocusedSentenceEvidence = true, }, + guidanceOptions = new + { + showGuidanceInHistory = true, + }, + qualityMeasureOptions = new + { + measureTypes = new object[] + { + "mips76" + }, + }, }, locale = "", }, diff --git a/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/FhirR4Extension.cs b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/FhirR4Extension.cs index 7a3d74a4c3ba..7af73b34d0c1 100644 --- a/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/FhirR4Extension.cs +++ b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/FhirR4Extension.cs @@ -12,7 +12,7 @@ namespace Azure.Health.Insights.RadiologyInsights { /// /// Base for all elements - /// Based on [FHIR Element](https://www.hl7.org/fhir/datatypes.html#Element) + /// Based on [FHIR Element](https://www.hl7.org/fhir/R4/element.html) /// public partial class FhirR4Extension : FhirR4Element { diff --git a/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/GuidanceInference.Serialization.cs b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/GuidanceInference.Serialization.cs new file mode 100644 index 000000000000..39a121896785 --- /dev/null +++ b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/GuidanceInference.Serialization.cs @@ -0,0 +1,249 @@ +// 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.Health.Insights.RadiologyInsights +{ + public partial class GuidanceInference : 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(GuidanceInference)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("finding"u8); + writer.WriteObjectValue(Finding, options); + writer.WritePropertyName("identifier"u8); + writer.WriteObjectValue(Identifier, options); + if (Optional.IsCollectionDefined(PresentGuidanceInformation)) + { + writer.WritePropertyName("presentGuidanceInformation"u8); + writer.WriteStartArray(); + foreach (var item in PresentGuidanceInformation) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + writer.WritePropertyName("ranking"u8); + writer.WriteStringValue(Ranking.ToString()); + if (Optional.IsCollectionDefined(RecommendationProposals)) + { + writer.WritePropertyName("recommendationProposals"u8); + writer.WriteStartArray(); + foreach (var item in RecommendationProposals) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(MissingGuidanceInformation)) + { + writer.WritePropertyName("missingGuidanceInformation"u8); + writer.WriteStartArray(); + foreach (var item in MissingGuidanceInformation) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + } + + GuidanceInference 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(GuidanceInference)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeGuidanceInference(document.RootElement, options); + } + + internal static GuidanceInference DeserializeGuidanceInference(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + FindingInference finding = default; + FhirR4CodeableConcept identifier = default; + IReadOnlyList presentGuidanceInformation = default; + GuidanceRankingType ranking = default; + IReadOnlyList recommendationProposals = default; + IReadOnlyList missingGuidanceInformation = default; + RadiologyInsightsInferenceType kind = default; + IReadOnlyList extension = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("finding"u8)) + { + finding = FindingInference.DeserializeFindingInference(property.Value, options); + continue; + } + if (property.NameEquals("identifier"u8)) + { + identifier = FhirR4CodeableConcept.DeserializeFhirR4CodeableConcept(property.Value, options); + continue; + } + if (property.NameEquals("presentGuidanceInformation"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(RadiologyInsights.PresentGuidanceInformation.DeserializePresentGuidanceInformation(item, options)); + } + presentGuidanceInformation = array; + continue; + } + if (property.NameEquals("ranking"u8)) + { + ranking = new GuidanceRankingType(property.Value.GetString()); + continue; + } + if (property.NameEquals("recommendationProposals"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(FollowupRecommendationInference.DeserializeFollowupRecommendationInference(item, options)); + } + recommendationProposals = array; + continue; + } + if (property.NameEquals("missingGuidanceInformation"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + missingGuidanceInformation = array; + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new RadiologyInsightsInferenceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("extension"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(FhirR4Extension.DeserializeFhirR4Extension(item, options)); + } + extension = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new GuidanceInference( + kind, + extension ?? new ChangeTrackingList(), + serializedAdditionalRawData, + finding, + identifier, + presentGuidanceInformation ?? new ChangeTrackingList(), + ranking, + recommendationProposals ?? new ChangeTrackingList(), + missingGuidanceInformation ?? new ChangeTrackingList()); + } + + 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(GuidanceInference)} does not support writing '{options.Format}' format."); + } + } + + GuidanceInference 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 DeserializeGuidanceInference(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(GuidanceInference)} 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 GuidanceInference FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeGuidanceInference(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/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/GuidanceInference.cs b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/GuidanceInference.cs new file mode 100644 index 000000000000..dd651a4ed90c --- /dev/null +++ b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/GuidanceInference.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 Azure.Health.Insights.RadiologyInsights +{ + /// A guidance inference collects structured information about a specific finding in the report and can possibly propose appropriate follow-up recommendations, based upon established, evidence-based best practices i.e. ACR guidelines. + public partial class GuidanceInference : RadiologyInsightsInference + { + /// Initializes a new instance of . + /// The finding associated with the guidance. + /// The guidance identifier, as a concept. + /// See doc of GuidanceRankingType. + /// or is null. + internal GuidanceInference(FindingInference finding, FhirR4CodeableConcept identifier, GuidanceRankingType ranking) + { + Argument.AssertNotNull(finding, nameof(finding)); + Argument.AssertNotNull(identifier, nameof(identifier)); + + Kind = RadiologyInsightsInferenceType.Guidance; + Finding = finding; + Identifier = identifier; + PresentGuidanceInformation = new ChangeTrackingList(); + Ranking = ranking; + RecommendationProposals = new ChangeTrackingList(); + MissingGuidanceInformation = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Discriminator property for RadiologyInsightsInference. + /// Additional Content defined by implementations. + /// Keeps track of any properties unknown to the library. + /// The finding associated with the guidance. + /// The guidance identifier, as a concept. + /// presentGuidanceInformation lists each item of the structured information (e.g. laterality) and corresponding details (left, right, bilateral) that is present in the document. + /// See doc of GuidanceRankingType. + /// The proposed follow-up recommendations, if any. If this is filled, missingGuidanceInformation cannot be filled (and vice versa). + /// Contains all missing items that are needed to determine follow-up. + internal GuidanceInference(RadiologyInsightsInferenceType kind, IReadOnlyList extension, IDictionary serializedAdditionalRawData, FindingInference finding, FhirR4CodeableConcept identifier, IReadOnlyList presentGuidanceInformation, GuidanceRankingType ranking, IReadOnlyList recommendationProposals, IReadOnlyList missingGuidanceInformation) : base(kind, extension, serializedAdditionalRawData) + { + Finding = finding; + Identifier = identifier; + PresentGuidanceInformation = presentGuidanceInformation; + Ranking = ranking; + RecommendationProposals = recommendationProposals; + MissingGuidanceInformation = missingGuidanceInformation; + } + + /// Initializes a new instance of for deserialization. + internal GuidanceInference() + { + } + + /// The finding associated with the guidance. + public FindingInference Finding { get; } + /// The guidance identifier, as a concept. + public FhirR4CodeableConcept Identifier { get; } + /// presentGuidanceInformation lists each item of the structured information (e.g. laterality) and corresponding details (left, right, bilateral) that is present in the document. + public IReadOnlyList PresentGuidanceInformation { get; } + /// See doc of GuidanceRankingType. + public GuidanceRankingType Ranking { get; } + /// The proposed follow-up recommendations, if any. If this is filled, missingGuidanceInformation cannot be filled (and vice versa). + public IReadOnlyList RecommendationProposals { get; } + /// Contains all missing items that are needed to determine follow-up. + public IReadOnlyList MissingGuidanceInformation { get; } + } +} diff --git a/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/GuidanceOptions.Serialization.cs b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/GuidanceOptions.Serialization.cs new file mode 100644 index 000000000000..956bfebe544b --- /dev/null +++ b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/GuidanceOptions.Serialization.cs @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Health.Insights.RadiologyInsights +{ + public partial class GuidanceOptions : 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(GuidanceOptions)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("showGuidanceInHistory"u8); + writer.WriteBooleanValue(ShowGuidanceInHistory); + 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 + } + } + } + + GuidanceOptions 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(GuidanceOptions)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeGuidanceOptions(document.RootElement, options); + } + + internal static GuidanceOptions DeserializeGuidanceOptions(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool showGuidanceInHistory = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("showGuidanceInHistory"u8)) + { + showGuidanceInHistory = property.Value.GetBoolean(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new GuidanceOptions(showGuidanceInHistory, 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(GuidanceOptions)} does not support writing '{options.Format}' format."); + } + } + + GuidanceOptions 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 DeserializeGuidanceOptions(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(GuidanceOptions)} 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 GuidanceOptions FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeGuidanceOptions(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/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/GuidanceOptions.cs b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/GuidanceOptions.cs new file mode 100644 index 000000000000..899f088e6855 --- /dev/null +++ b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/GuidanceOptions.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Health.Insights.RadiologyInsights +{ + /// Guidance options. + public partial class GuidanceOptions + { + /// + /// 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 . + /// If this is true, also show guidances from a clinical history section i.e. if the first token of the associated finding's clinical indicator is in this section. Default is false. + public GuidanceOptions(bool showGuidanceInHistory) + { + ShowGuidanceInHistory = showGuidanceInHistory; + } + + /// Initializes a new instance of . + /// If this is true, also show guidances from a clinical history section i.e. if the first token of the associated finding's clinical indicator is in this section. Default is false. + /// Keeps track of any properties unknown to the library. + internal GuidanceOptions(bool showGuidanceInHistory, IDictionary serializedAdditionalRawData) + { + ShowGuidanceInHistory = showGuidanceInHistory; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal GuidanceOptions() + { + } + + /// If this is true, also show guidances from a clinical history section i.e. if the first token of the associated finding's clinical indicator is in this section. Default is false. + public bool ShowGuidanceInHistory { get; set; } + } +} diff --git a/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/GuidanceRankingType.cs b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/GuidanceRankingType.cs new file mode 100644 index 000000000000..de2636e79e9f --- /dev/null +++ b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/GuidanceRankingType.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 Azure.Health.Insights.RadiologyInsights +{ + /// Refers to how important a clinical guidance is. + public readonly partial struct GuidanceRankingType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public GuidanceRankingType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string HighValue = "high"; + private const string LowValue = "low"; + + /// high. + public static GuidanceRankingType High { get; } = new GuidanceRankingType(HighValue); + /// low. + public static GuidanceRankingType Low { get; } = new GuidanceRankingType(LowValue); + /// Determines if two values are the same. + public static bool operator ==(GuidanceRankingType left, GuidanceRankingType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(GuidanceRankingType left, GuidanceRankingType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator GuidanceRankingType(string value) => new GuidanceRankingType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is GuidanceRankingType other && Equals(other); + /// + public bool Equals(GuidanceRankingType 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/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/HealthInsightsRadiologyInsightsModelFactory.cs b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/HealthInsightsRadiologyInsightsModelFactory.cs index c897a39a10c7..64a30a36065c 100644 --- a/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/HealthInsightsRadiologyInsightsModelFactory.cs +++ b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/HealthInsightsRadiologyInsightsModelFactory.cs @@ -54,7 +54,7 @@ public static RadiologyInsightsInferenceResult RadiologyInsightsInferenceResult( /// /// The model's inferences for the given patient. /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , , , , , , , , and . + /// The available derived classes include , , , , , , , , , , , and . /// /// A new instance for mocking. public static RadiologyInsightsPatientResult RadiologyInsightsPatientResult(string patientId = null, IEnumerable inferences = null) @@ -798,5 +798,105 @@ public static FollowupCommunicationInference FollowupCommunicationInference(IEnu recipient?.ToList(), wasAcknowledged); } + + /// Initializes a new instance of . + /// Additional Content defined by implementations. + /// Category, e.g. BIRADS. + /// The expansion of the category (which is an abbreviation.). + /// The value. If the value is a range, use field valueRange. + /// The range. + /// A new instance for mocking. + public static ScoringAndAssessmentInference ScoringAndAssessmentInference(IEnumerable extension = null, ScoringAndAssessmentCategoryType category = default, string categoryDescription = null, string singleValue = null, AssessmentValueRange rangeValue = null) + { + extension ??= new List(); + + return new ScoringAndAssessmentInference( + RadiologyInsightsInferenceType.ScoringAndAssessment, + extension?.ToList(), + serializedAdditionalRawData: null, + category, + categoryDescription, + singleValue, + rangeValue); + } + + /// Initializes a new instance of . + /// The minimum value. + /// The maximum value. + /// A new instance for mocking. + public static AssessmentValueRange AssessmentValueRange(string minimum = null, string maximum = null) + { + return new AssessmentValueRange(minimum, maximum, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Additional Content defined by implementations. + /// The finding associated with the guidance. + /// The guidance identifier, as a concept. + /// presentGuidanceInformation lists each item of the structured information (e.g. laterality) and corresponding details (left, right, bilateral) that is present in the document. + /// See doc of GuidanceRankingType. + /// The proposed follow-up recommendations, if any. If this is filled, missingGuidanceInformation cannot be filled (and vice versa). + /// Contains all missing items that are needed to determine follow-up. + /// A new instance for mocking. + public static GuidanceInference GuidanceInference(IEnumerable extension = null, FindingInference finding = null, FhirR4CodeableConcept identifier = null, IEnumerable presentGuidanceInformation = null, GuidanceRankingType ranking = default, IEnumerable recommendationProposals = null, IEnumerable missingGuidanceInformation = null) + { + extension ??= new List(); + presentGuidanceInformation ??= new List(); + recommendationProposals ??= new List(); + missingGuidanceInformation ??= new List(); + + return new GuidanceInference( + RadiologyInsightsInferenceType.Guidance, + extension?.ToList(), + serializedAdditionalRawData: null, + finding, + identifier, + presentGuidanceInformation?.ToList(), + ranking, + recommendationProposals?.ToList(), + missingGuidanceInformation?.ToList()); + } + + /// Initializes a new instance of . + /// The item of the structured information. + /// A list of size values, if the item is about size. + /// The maximum diameter value, if the item is about the maximum diameter. + /// The list of item values that are mentioned in the report. + /// Additional Content defined by implementations. + /// A new instance for mocking. + public static PresentGuidanceInformation PresentGuidanceInformation(string presentGuidanceItem = null, IEnumerable sizes = null, FhirR4Quantity maximumDiameterAsInText = null, IEnumerable presentGuidanceValues = null, IEnumerable extension = null) + { + sizes ??= new List(); + presentGuidanceValues ??= new List(); + extension ??= new List(); + + return new PresentGuidanceInformation( + presentGuidanceItem, + sizes?.ToList(), + maximumDiameterAsInText, + presentGuidanceValues?.ToList(), + extension?.ToList(), + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Additional Content defined by implementations. + /// The denominator, which identifies the QualityMeasure kind. + /// The ComplianceType indicates whether the document is compliant for the specified QualityMeasure or not, or if exceptions apply. + /// List of quality criteria identified in the document, if any. + /// A new instance for mocking. + public static QualityMeasureInference QualityMeasureInference(IEnumerable extension = null, string qualityMeasureDenominator = null, QualityMeasureComplianceType complianceType = default, IEnumerable qualityCriteria = null) + { + extension ??= new List(); + qualityCriteria ??= new List(); + + return new QualityMeasureInference( + RadiologyInsightsInferenceType.QualityMeasure, + extension?.ToList(), + serializedAdditionalRawData: null, + qualityMeasureDenominator, + complianceType, + qualityCriteria?.ToList()); + } } } diff --git a/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/PresentGuidanceInformation.Serialization.cs b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/PresentGuidanceInformation.Serialization.cs new file mode 100644 index 000000000000..7e306c77006d --- /dev/null +++ b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/PresentGuidanceInformation.Serialization.cs @@ -0,0 +1,238 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Health.Insights.RadiologyInsights +{ + public partial class PresentGuidanceInformation : 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(PresentGuidanceInformation)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("presentGuidanceItem"u8); + writer.WriteStringValue(PresentGuidanceItem); + if (Optional.IsCollectionDefined(Sizes)) + { + writer.WritePropertyName("sizes"u8); + writer.WriteStartArray(); + foreach (var item in Sizes) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(MaximumDiameterAsInText)) + { + writer.WritePropertyName("maximumDiameterAsInText"u8); + writer.WriteObjectValue(MaximumDiameterAsInText, options); + } + if (Optional.IsCollectionDefined(PresentGuidanceValues)) + { + writer.WritePropertyName("presentGuidanceValues"u8); + writer.WriteStartArray(); + foreach (var item in PresentGuidanceValues) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Extension)) + { + writer.WritePropertyName("extension"u8); + writer.WriteStartArray(); + foreach (var item in Extension) + { + 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 + } + } + } + + PresentGuidanceInformation 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(PresentGuidanceInformation)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializePresentGuidanceInformation(document.RootElement, options); + } + + internal static PresentGuidanceInformation DeserializePresentGuidanceInformation(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string presentGuidanceItem = default; + IReadOnlyList sizes = default; + FhirR4Quantity maximumDiameterAsInText = default; + IReadOnlyList presentGuidanceValues = default; + IReadOnlyList extension = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("presentGuidanceItem"u8)) + { + presentGuidanceItem = property.Value.GetString(); + continue; + } + if (property.NameEquals("sizes"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(FhirR4Observation.DeserializeFhirR4Observation(item, options)); + } + sizes = array; + continue; + } + if (property.NameEquals("maximumDiameterAsInText"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + maximumDiameterAsInText = FhirR4Quantity.DeserializeFhirR4Quantity(property.Value, options); + continue; + } + if (property.NameEquals("presentGuidanceValues"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + presentGuidanceValues = array; + continue; + } + if (property.NameEquals("extension"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(FhirR4Extension.DeserializeFhirR4Extension(item, options)); + } + extension = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new PresentGuidanceInformation( + presentGuidanceItem, + sizes ?? new ChangeTrackingList(), + maximumDiameterAsInText, + presentGuidanceValues ?? new ChangeTrackingList(), + extension ?? new ChangeTrackingList(), + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(PresentGuidanceInformation)} does not support writing '{options.Format}' format."); + } + } + + PresentGuidanceInformation 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 DeserializePresentGuidanceInformation(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(PresentGuidanceInformation)} 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 PresentGuidanceInformation FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializePresentGuidanceInformation(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/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/PresentGuidanceInformation.cs b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/PresentGuidanceInformation.cs new file mode 100644 index 000000000000..e46aa4622b04 --- /dev/null +++ b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/PresentGuidanceInformation.cs @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Health.Insights.RadiologyInsights +{ + /// An item of the structured information (e.g. laterality or size) and one or more corresponding details (e.g. left or size-value). + public partial class PresentGuidanceInformation + { + /// + /// 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 item of the structured information. + /// is null. + internal PresentGuidanceInformation(string presentGuidanceItem) + { + Argument.AssertNotNull(presentGuidanceItem, nameof(presentGuidanceItem)); + + PresentGuidanceItem = presentGuidanceItem; + Sizes = new ChangeTrackingList(); + PresentGuidanceValues = new ChangeTrackingList(); + Extension = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The item of the structured information. + /// A list of size values, if the item is about size. + /// The maximum diameter value, if the item is about the maximum diameter. + /// The list of item values that are mentioned in the report. + /// Additional Content defined by implementations. + /// Keeps track of any properties unknown to the library. + internal PresentGuidanceInformation(string presentGuidanceItem, IReadOnlyList sizes, FhirR4Quantity maximumDiameterAsInText, IReadOnlyList presentGuidanceValues, IReadOnlyList extension, IDictionary serializedAdditionalRawData) + { + PresentGuidanceItem = presentGuidanceItem; + Sizes = sizes; + MaximumDiameterAsInText = maximumDiameterAsInText; + PresentGuidanceValues = presentGuidanceValues; + Extension = extension; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal PresentGuidanceInformation() + { + } + + /// The item of the structured information. + public string PresentGuidanceItem { get; } + /// A list of size values, if the item is about size. + public IReadOnlyList Sizes { get; } + /// The maximum diameter value, if the item is about the maximum diameter. + public FhirR4Quantity MaximumDiameterAsInText { get; } + /// The list of item values that are mentioned in the report. + public IReadOnlyList PresentGuidanceValues { get; } + /// Additional Content defined by implementations. + public IReadOnlyList Extension { get; } + } +} diff --git a/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/QualityMeasureComplianceType.cs b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/QualityMeasureComplianceType.cs new file mode 100644 index 000000000000..c0f35e14e333 --- /dev/null +++ b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/QualityMeasureComplianceType.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Health.Insights.RadiologyInsights +{ + /// Whether the document is compliant. + public readonly partial struct QualityMeasureComplianceType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public QualityMeasureComplianceType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string NotEligibleValue = "notEligible"; + private const string PerformanceNotMetValue = "performanceNotMet"; + private const string PerformanceMetValue = "performanceMet"; + private const string DenominatorExceptionValue = "denominatorException"; + + /// not eligible. + public static QualityMeasureComplianceType NotEligible { get; } = new QualityMeasureComplianceType(NotEligibleValue); + /// performance not met. + public static QualityMeasureComplianceType PerformanceNotMet { get; } = new QualityMeasureComplianceType(PerformanceNotMetValue); + /// performance met. + public static QualityMeasureComplianceType PerformanceMet { get; } = new QualityMeasureComplianceType(PerformanceMetValue); + /// denominator exception. + public static QualityMeasureComplianceType DenominatorException { get; } = new QualityMeasureComplianceType(DenominatorExceptionValue); + /// Determines if two values are the same. + public static bool operator ==(QualityMeasureComplianceType left, QualityMeasureComplianceType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(QualityMeasureComplianceType left, QualityMeasureComplianceType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator QualityMeasureComplianceType(string value) => new QualityMeasureComplianceType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is QualityMeasureComplianceType other && Equals(other); + /// + public bool Equals(QualityMeasureComplianceType 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/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/QualityMeasureInference.Serialization.cs b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/QualityMeasureInference.Serialization.cs new file mode 100644 index 000000000000..ed78f85e367f --- /dev/null +++ b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/QualityMeasureInference.Serialization.cs @@ -0,0 +1,188 @@ +// 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.Health.Insights.RadiologyInsights +{ + public partial class QualityMeasureInference : 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(QualityMeasureInference)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("qualityMeasureDenominator"u8); + writer.WriteStringValue(QualityMeasureDenominator); + writer.WritePropertyName("complianceType"u8); + writer.WriteStringValue(ComplianceType.ToString()); + if (Optional.IsCollectionDefined(QualityCriteria)) + { + writer.WritePropertyName("qualityCriteria"u8); + writer.WriteStartArray(); + foreach (var item in QualityCriteria) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + } + + QualityMeasureInference 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(QualityMeasureInference)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeQualityMeasureInference(document.RootElement, options); + } + + internal static QualityMeasureInference DeserializeQualityMeasureInference(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string qualityMeasureDenominator = default; + QualityMeasureComplianceType complianceType = default; + IReadOnlyList qualityCriteria = default; + RadiologyInsightsInferenceType kind = default; + IReadOnlyList extension = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("qualityMeasureDenominator"u8)) + { + qualityMeasureDenominator = property.Value.GetString(); + continue; + } + if (property.NameEquals("complianceType"u8)) + { + complianceType = new QualityMeasureComplianceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("qualityCriteria"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + qualityCriteria = array; + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new RadiologyInsightsInferenceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("extension"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(FhirR4Extension.DeserializeFhirR4Extension(item, options)); + } + extension = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new QualityMeasureInference( + kind, + extension ?? new ChangeTrackingList(), + serializedAdditionalRawData, + qualityMeasureDenominator, + complianceType, + qualityCriteria ?? new ChangeTrackingList()); + } + + 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(QualityMeasureInference)} does not support writing '{options.Format}' format."); + } + } + + QualityMeasureInference 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 DeserializeQualityMeasureInference(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(QualityMeasureInference)} 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 QualityMeasureInference FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeQualityMeasureInference(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/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/QualityMeasureInference.cs b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/QualityMeasureInference.cs new file mode 100644 index 000000000000..c441f9784322 --- /dev/null +++ b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/QualityMeasureInference.cs @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Health.Insights.RadiologyInsights +{ + /// A QualityMeasure inference captures the MIPS ('measure based incentive payment system') quality measure criteria in the document that are used to measure the data completeness. + public partial class QualityMeasureInference : RadiologyInsightsInference + { + /// Initializes a new instance of . + /// The denominator, which identifies the QualityMeasure kind. + /// The ComplianceType indicates whether the document is compliant for the specified QualityMeasure or not, or if exceptions apply. + /// is null. + internal QualityMeasureInference(string qualityMeasureDenominator, QualityMeasureComplianceType complianceType) + { + Argument.AssertNotNull(qualityMeasureDenominator, nameof(qualityMeasureDenominator)); + + Kind = RadiologyInsightsInferenceType.QualityMeasure; + QualityMeasureDenominator = qualityMeasureDenominator; + ComplianceType = complianceType; + QualityCriteria = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Discriminator property for RadiologyInsightsInference. + /// Additional Content defined by implementations. + /// Keeps track of any properties unknown to the library. + /// The denominator, which identifies the QualityMeasure kind. + /// The ComplianceType indicates whether the document is compliant for the specified QualityMeasure or not, or if exceptions apply. + /// List of quality criteria identified in the document, if any. + internal QualityMeasureInference(RadiologyInsightsInferenceType kind, IReadOnlyList extension, IDictionary serializedAdditionalRawData, string qualityMeasureDenominator, QualityMeasureComplianceType complianceType, IReadOnlyList qualityCriteria) : base(kind, extension, serializedAdditionalRawData) + { + QualityMeasureDenominator = qualityMeasureDenominator; + ComplianceType = complianceType; + QualityCriteria = qualityCriteria; + } + + /// Initializes a new instance of for deserialization. + internal QualityMeasureInference() + { + } + + /// The denominator, which identifies the QualityMeasure kind. + public string QualityMeasureDenominator { get; } + /// The ComplianceType indicates whether the document is compliant for the specified QualityMeasure or not, or if exceptions apply. + public QualityMeasureComplianceType ComplianceType { get; } + /// List of quality criteria identified in the document, if any. + public IReadOnlyList QualityCriteria { get; } + } +} diff --git a/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/QualityMeasureOptions.Serialization.cs b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/QualityMeasureOptions.Serialization.cs new file mode 100644 index 000000000000..8e85e3a63406 --- /dev/null +++ b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/QualityMeasureOptions.Serialization.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Health.Insights.RadiologyInsights +{ + public partial class QualityMeasureOptions : 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(QualityMeasureOptions)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("measureTypes"u8); + writer.WriteStartArray(); + foreach (var item in MeasureTypes) + { + writer.WriteStringValue(item.ToString()); + } + 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 + } + } + } + + QualityMeasureOptions 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(QualityMeasureOptions)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeQualityMeasureOptions(document.RootElement, options); + } + + internal static QualityMeasureOptions DeserializeQualityMeasureOptions(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList measureTypes = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("measureTypes"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(new QualityMeasureType(item.GetString())); + } + measureTypes = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new QualityMeasureOptions(measureTypes, 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(QualityMeasureOptions)} does not support writing '{options.Format}' format."); + } + } + + QualityMeasureOptions 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 DeserializeQualityMeasureOptions(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(QualityMeasureOptions)} 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 QualityMeasureOptions FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeQualityMeasureOptions(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/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/QualityMeasureOptions.cs b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/QualityMeasureOptions.cs new file mode 100644 index 000000000000..052a7235b800 --- /dev/null +++ b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/QualityMeasureOptions.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.Health.Insights.RadiologyInsights +{ + /// Quality Measure Options. + public partial class QualityMeasureOptions + { + /// + /// 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 . + /// Id(s) of the MIPS measures that need to be evaluated in the document. + /// is null. + public QualityMeasureOptions(IEnumerable measureTypes) + { + Argument.AssertNotNull(measureTypes, nameof(measureTypes)); + + MeasureTypes = measureTypes.ToList(); + } + + /// Initializes a new instance of . + /// Id(s) of the MIPS measures that need to be evaluated in the document. + /// Keeps track of any properties unknown to the library. + internal QualityMeasureOptions(IList measureTypes, IDictionary serializedAdditionalRawData) + { + MeasureTypes = measureTypes; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal QualityMeasureOptions() + { + } + + /// Id(s) of the MIPS measures that need to be evaluated in the document. + public IList MeasureTypes { get; } + } +} diff --git a/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/QualityMeasureType.cs b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/QualityMeasureType.cs new file mode 100644 index 000000000000..b2b8f703fa2f --- /dev/null +++ b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/QualityMeasureType.cs @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Health.Insights.RadiologyInsights +{ + /// Mips types that can be checked by the engine. + public readonly partial struct QualityMeasureType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public QualityMeasureType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string Mips76Value = "mips76"; + private const string Mips147Value = "mips147"; + private const string Mips195Value = "mips195"; + private const string Mips360Value = "mips360"; + private const string Mips364Value = "mips364"; + private const string Mips405Value = "mips405"; + private const string Mips406Value = "mips406"; + private const string Mips436Value = "mips436"; + private const string Mips145Value = "mips145"; + private const string Acrad36Value = "acrad36"; + private const string Acrad37Value = "acrad37"; + private const string Acrad38Value = "acrad38"; + private const string Acrad39Value = "acrad39"; + private const string Acrad40Value = "acrad40"; + private const string Acrad41Value = "acrad41"; + private const string Acrad42Value = "acrad42"; + private const string Mednax55Value = "mednax55"; + private const string Msn13Value = "msn13"; + private const string Msn15Value = "msn15"; + private const string Qmm26Value = "qmm26"; + private const string Qmm17Value = "qmm17"; + private const string Qmm18Value = "qmm18"; + private const string Qmm19Value = "qmm19"; + + /// Mips 76. + public static QualityMeasureType Mips76 { get; } = new QualityMeasureType(Mips76Value); + /// Mips 147. + public static QualityMeasureType Mips147 { get; } = new QualityMeasureType(Mips147Value); + /// Mips 195. + public static QualityMeasureType Mips195 { get; } = new QualityMeasureType(Mips195Value); + /// Mips 360. + public static QualityMeasureType Mips360 { get; } = new QualityMeasureType(Mips360Value); + /// Mips 364. + public static QualityMeasureType Mips364 { get; } = new QualityMeasureType(Mips364Value); + /// Mips 405. + public static QualityMeasureType Mips405 { get; } = new QualityMeasureType(Mips405Value); + /// Mips 406. + public static QualityMeasureType Mips406 { get; } = new QualityMeasureType(Mips406Value); + /// Mips 436. + public static QualityMeasureType Mips436 { get; } = new QualityMeasureType(Mips436Value); + /// Mips 145. + public static QualityMeasureType Mips145 { get; } = new QualityMeasureType(Mips145Value); + /// Acrad 36. + public static QualityMeasureType Acrad36 { get; } = new QualityMeasureType(Acrad36Value); + /// Acrad 37. + public static QualityMeasureType Acrad37 { get; } = new QualityMeasureType(Acrad37Value); + /// Acrad 38. + public static QualityMeasureType Acrad38 { get; } = new QualityMeasureType(Acrad38Value); + /// Acrad 39. + public static QualityMeasureType Acrad39 { get; } = new QualityMeasureType(Acrad39Value); + /// Acrad 40. + public static QualityMeasureType Acrad40 { get; } = new QualityMeasureType(Acrad40Value); + /// Acrad 41. + public static QualityMeasureType Acrad41 { get; } = new QualityMeasureType(Acrad41Value); + /// Acrad 42. + public static QualityMeasureType Acrad42 { get; } = new QualityMeasureType(Acrad42Value); + /// Mednax55. + public static QualityMeasureType Mednax55 { get; } = new QualityMeasureType(Mednax55Value); + /// Msn13. + public static QualityMeasureType Msn13 { get; } = new QualityMeasureType(Msn13Value); + /// Msn15. + public static QualityMeasureType Msn15 { get; } = new QualityMeasureType(Msn15Value); + /// Qmm26. + public static QualityMeasureType Qmm26 { get; } = new QualityMeasureType(Qmm26Value); + /// Qmm17. + public static QualityMeasureType Qmm17 { get; } = new QualityMeasureType(Qmm17Value); + /// Qmm18. + public static QualityMeasureType Qmm18 { get; } = new QualityMeasureType(Qmm18Value); + /// Qmm19. + public static QualityMeasureType Qmm19 { get; } = new QualityMeasureType(Qmm19Value); + /// Determines if two values are the same. + public static bool operator ==(QualityMeasureType left, QualityMeasureType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(QualityMeasureType left, QualityMeasureType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator QualityMeasureType(string value) => new QualityMeasureType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is QualityMeasureType other && Equals(other); + /// + public bool Equals(QualityMeasureType 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/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/RadiologyInsightsClientOptions.cs b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/RadiologyInsightsClientOptions.cs index c32d7850c9dc..5d7e5a8d4ce5 100644 --- a/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/RadiologyInsightsClientOptions.cs +++ b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/RadiologyInsightsClientOptions.cs @@ -13,13 +13,15 @@ namespace Azure.Health.Insights.RadiologyInsights /// Client options for RadiologyInsightsClient. public partial class RadiologyInsightsClientOptions : ClientOptions { - private const ServiceVersion LatestVersion = ServiceVersion.V2024_04_01; + private const ServiceVersion LatestVersion = ServiceVersion.V2024_10_01; /// The version of the service to use. public enum ServiceVersion { /// Service version "2024-04-01". V2024_04_01 = 1, + /// Service version "2024-10-01". + V2024_10_01 = 2, } internal string Version { get; } @@ -30,6 +32,7 @@ public RadiologyInsightsClientOptions(ServiceVersion version = LatestVersion) Version = version switch { ServiceVersion.V2024_04_01 => "2024-04-01", + ServiceVersion.V2024_10_01 => "2024-10-01", _ => throw new NotSupportedException() }; } diff --git a/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/RadiologyInsightsInference.Serialization.cs b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/RadiologyInsightsInference.Serialization.cs index 1640fff3e1bd..9ff8cf51f955 100644 --- a/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/RadiologyInsightsInference.Serialization.cs +++ b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/RadiologyInsightsInference.Serialization.cs @@ -93,9 +93,12 @@ internal static RadiologyInsightsInference DeserializeRadiologyInsightsInference case "finding": return FindingInference.DeserializeFindingInference(element, options); case "followupCommunication": return FollowupCommunicationInference.DeserializeFollowupCommunicationInference(element, options); case "followupRecommendation": return FollowupRecommendationInference.DeserializeFollowupRecommendationInference(element, options); + case "guidance": return GuidanceInference.DeserializeGuidanceInference(element, options); case "lateralityDiscrepancy": return LateralityDiscrepancyInference.DeserializeLateralityDiscrepancyInference(element, options); case "limitedOrderDiscrepancy": return LimitedOrderDiscrepancyInference.DeserializeLimitedOrderDiscrepancyInference(element, options); + case "qualityMeasure": return QualityMeasureInference.DeserializeQualityMeasureInference(element, options); case "radiologyProcedure": return RadiologyProcedureInference.DeserializeRadiologyProcedureInference(element, options); + case "scoringAndAssessment": return ScoringAndAssessmentInference.DeserializeScoringAndAssessmentInference(element, options); case "sexMismatch": return SexMismatchInference.DeserializeSexMismatchInference(element, options); } } diff --git a/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/RadiologyInsightsInference.cs b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/RadiologyInsightsInference.cs index 802adb427731..19ff43760195 100644 --- a/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/RadiologyInsightsInference.cs +++ b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/RadiologyInsightsInference.cs @@ -23,7 +23,7 @@ namespace Azure.Health.Insights.RadiologyInsights /// - RadiologyProcedure /// - FollowupCommunication /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , , , , , , , , and . + /// The available derived classes include , , , , , , , , , , , and . /// public abstract partial class RadiologyInsightsInference { diff --git a/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/RadiologyInsightsInferenceOptions.Serialization.cs b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/RadiologyInsightsInferenceOptions.Serialization.cs index abb233d3d4d8..dc9277b21032 100644 --- a/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/RadiologyInsightsInferenceOptions.Serialization.cs +++ b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/RadiologyInsightsInferenceOptions.Serialization.cs @@ -44,6 +44,16 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("findingOptions"u8); writer.WriteObjectValue(FindingOptions, options); } + if (Optional.IsDefined(GuidanceOptions)) + { + writer.WritePropertyName("guidanceOptions"u8); + writer.WriteObjectValue(GuidanceOptions, options); + } + if (Optional.IsDefined(QualityMeasureOptions)) + { + writer.WritePropertyName("qualityMeasureOptions"u8); + writer.WriteObjectValue(QualityMeasureOptions, options); + } if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -83,6 +93,8 @@ internal static RadiologyInsightsInferenceOptions DeserializeRadiologyInsightsIn } FollowupRecommendationOptions followupRecommendationOptions = default; FindingOptions findingOptions = default; + GuidanceOptions guidanceOptions = default; + QualityMeasureOptions qualityMeasureOptions = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -105,13 +117,31 @@ internal static RadiologyInsightsInferenceOptions DeserializeRadiologyInsightsIn findingOptions = FindingOptions.DeserializeFindingOptions(property.Value, options); continue; } + if (property.NameEquals("guidanceOptions"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + guidanceOptions = GuidanceOptions.DeserializeGuidanceOptions(property.Value, options); + continue; + } + if (property.NameEquals("qualityMeasureOptions"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + qualityMeasureOptions = QualityMeasureOptions.DeserializeQualityMeasureOptions(property.Value, options); + continue; + } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); } } serializedAdditionalRawData = rawDataDictionary; - return new RadiologyInsightsInferenceOptions(followupRecommendationOptions, findingOptions, serializedAdditionalRawData); + return new RadiologyInsightsInferenceOptions(followupRecommendationOptions, findingOptions, guidanceOptions, qualityMeasureOptions, serializedAdditionalRawData); } BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) diff --git a/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/RadiologyInsightsInferenceOptions.cs b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/RadiologyInsightsInferenceOptions.cs index 66db2f624256..3fa0c1914664 100644 --- a/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/RadiologyInsightsInferenceOptions.cs +++ b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/RadiologyInsightsInferenceOptions.cs @@ -53,11 +53,15 @@ public RadiologyInsightsInferenceOptions() /// Initializes a new instance of . /// Follow-up recommendation options. /// Finding options. + /// Guidance options. + /// QualityMeasureOptions. /// Keeps track of any properties unknown to the library. - internal RadiologyInsightsInferenceOptions(FollowupRecommendationOptions followupRecommendationOptions, FindingOptions findingOptions, IDictionary serializedAdditionalRawData) + internal RadiologyInsightsInferenceOptions(FollowupRecommendationOptions followupRecommendationOptions, FindingOptions findingOptions, GuidanceOptions guidanceOptions, QualityMeasureOptions qualityMeasureOptions, IDictionary serializedAdditionalRawData) { FollowupRecommendationOptions = followupRecommendationOptions; FindingOptions = findingOptions; + GuidanceOptions = guidanceOptions; + QualityMeasureOptions = qualityMeasureOptions; _serializedAdditionalRawData = serializedAdditionalRawData; } @@ -65,5 +69,9 @@ internal RadiologyInsightsInferenceOptions(FollowupRecommendationOptions followu public FollowupRecommendationOptions FollowupRecommendationOptions { get; set; } /// Finding options. public FindingOptions FindingOptions { get; set; } + /// Guidance options. + public GuidanceOptions GuidanceOptions { get; set; } + /// QualityMeasureOptions. + public QualityMeasureOptions QualityMeasureOptions { get; set; } } } diff --git a/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/RadiologyInsightsInferenceType.cs b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/RadiologyInsightsInferenceType.cs index e36756668014..f0f23cea906b 100644 --- a/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/RadiologyInsightsInferenceType.cs +++ b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/RadiologyInsightsInferenceType.cs @@ -32,6 +32,9 @@ public RadiologyInsightsInferenceType(string value) private const string FollowupRecommendationValue = "followupRecommendation"; private const string FollowupCommunicationValue = "followupCommunication"; private const string RadiologyProcedureValue = "radiologyProcedure"; + private const string ScoringAndAssessmentValue = "scoringAndAssessment"; + private const string GuidanceValue = "guidance"; + private const string QualityMeasureValue = "qualityMeasure"; /// Age mismatch inference type. public static RadiologyInsightsInferenceType AgeMismatch { get; } = new RadiologyInsightsInferenceType(AgeMismatchValue); @@ -53,6 +56,12 @@ public RadiologyInsightsInferenceType(string value) public static RadiologyInsightsInferenceType FollowupCommunication { get; } = new RadiologyInsightsInferenceType(FollowupCommunicationValue); /// Radiology Procedure inference type. public static RadiologyInsightsInferenceType RadiologyProcedure { get; } = new RadiologyInsightsInferenceType(RadiologyProcedureValue); + /// Scoring and assessment inference type. + public static RadiologyInsightsInferenceType ScoringAndAssessment { get; } = new RadiologyInsightsInferenceType(ScoringAndAssessmentValue); + /// Guidance inference type. + public static RadiologyInsightsInferenceType Guidance { get; } = new RadiologyInsightsInferenceType(GuidanceValue); + /// Guidance measure inference type. + public static RadiologyInsightsInferenceType QualityMeasure { get; } = new RadiologyInsightsInferenceType(QualityMeasureValue); /// Determines if two values are the same. public static bool operator ==(RadiologyInsightsInferenceType left, RadiologyInsightsInferenceType right) => left.Equals(right); /// Determines if two values are not the same. diff --git a/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/RadiologyInsightsPatientResult.cs b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/RadiologyInsightsPatientResult.cs index aeaff61759a4..97110384a295 100644 --- a/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/RadiologyInsightsPatientResult.cs +++ b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/RadiologyInsightsPatientResult.cs @@ -51,7 +51,7 @@ public partial class RadiologyInsightsPatientResult /// /// The model's inferences for the given patient. /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , , , , , , , , and . + /// The available derived classes include , , , , , , , , , , , and . /// /// or is null. internal RadiologyInsightsPatientResult(string patientId, IEnumerable inferences) @@ -68,7 +68,7 @@ internal RadiologyInsightsPatientResult(string patientId, IEnumerable /// The model's inferences for the given patient. /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , , , , , , , , and . + /// The available derived classes include , , , , , , , , , , , and . /// /// Keeps track of any properties unknown to the library. internal RadiologyInsightsPatientResult(string patientId, IReadOnlyList inferences, IDictionary serializedAdditionalRawData) @@ -88,7 +88,7 @@ internal RadiologyInsightsPatientResult() /// /// The model's inferences for the given patient. /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , , , , , , , , and . + /// The available derived classes include , , , , , , , , , , , and . /// public IReadOnlyList Inferences { get; } } diff --git a/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/ScoringAndAssessmentCategoryType.cs b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/ScoringAndAssessmentCategoryType.cs new file mode 100644 index 000000000000..d28d123e4926 --- /dev/null +++ b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/ScoringAndAssessmentCategoryType.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Health.Insights.RadiologyInsights +{ + /// The category that gets a value, e.g. BIRADS, Z-SCORE or FRAX SCORE. + public readonly partial struct ScoringAndAssessmentCategoryType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ScoringAndAssessmentCategoryType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string BIRADSValue = "BIRADS"; + private const string CRADSCOLONICFINDINGSValue = "C-RADS COLONIC FINDINGS"; + private const string CADRADSValue = "CAD-RADS"; + private const string LIRADSValue = "LI-RADS"; + private const string LUNGRADSValue = "LUNG-RADS"; + private const string NIRADSValue = "NI-RADS"; + private const string ORADSValue = "O-RADS"; + private const string PIRADSValue = "PI-RADS"; + private const string TIRADSValue = "TI-RADS"; + private const string CRADSEXTRACOLONICFINDINGSValue = "C-RADS EXTRACOLONIC FINDINGS"; + private const string LIFETIMEBREASTCANCERRISKValue = "LIFETIME BREAST CANCER RISK"; + private const string ASCVDRISKValue = "ASCVD RISK"; + private const string MODIFIEDGAILMODELRISKValue = "MODIFIED GAIL MODEL RISK"; + private const string TYRERCUSICKMODELRISKValue = "TYRER CUSICK MODEL RISK"; + private const string AGATSTONSCOREValue = "AGATSTON SCORE"; + private const string TENYEARCHDRISKValue = "10 YEAR CHD RISK"; + private const string ZSCOREValue = "Z-SCORE"; + private const string TSCOREValue = "T-SCORE"; + private const string CALCIUMVOLUMESCOREValue = "CALCIUM VOLUME SCORE"; + private const string USLIRADSVISUALIZATIONSCOREValue = "US LI-RADS VISUALIZATION SCORE"; + private const string USLIRADSValue = "US LI-RADS"; + private const string CEUSLIRADSValue = "CEUS LI-RADS"; + private const string TREATMENTRESPONSELIRADSValue = "TREATMENT RESPONSE LI-RADS"; + private const string ORADSMRIValue = "O-RADS MRI"; + private const string CALCIUMMASSSCOREValue = "CALCIUM MASS SCORE"; + private const string RISKOFMALIGNANCYINDEXValue = "RISK OF MALIGNANCY INDEX"; + private const string HNPCCMUTATIONRISKValue = "HNPCC MUTATION RISK"; + private const string ALBERTASTROKEPROGRAMEARLYCTSCOREValue = "ALBERTA STROKE PROGRAM EARLY CT SCORE"; + private const string KELLGRENLAWRENCEGRADINGSCALEValue = "KELLGREN-LAWRENCE GRADING SCALE"; + private const string TONNISCLASSIFICATIONValue = "TONNIS CLASSIFICATION"; + private const string CALCIUMSCOREUNSPECIFIEDValue = "CALCIUM SCORE (UNSPECIFIED)"; + private const string TENYEARCHDRISKOBSERVEDAGEValue = "10 YEAR CHD RISK (OBSERVED AGE)"; + private const string TENYEARCHDRISKARTERIALAGEValue = "10 YEAR CHD RISK (ARTERIAL AGE)"; + private const string FRAXSCOREValue = "FRAX SCORE"; + + /// BIRADS. + public static ScoringAndAssessmentCategoryType BIRADS { get; } = new ScoringAndAssessmentCategoryType(BIRADSValue); + /// C-RADS COLONIC FINDINGS. + public static ScoringAndAssessmentCategoryType CRADSCOLONICFINDINGS { get; } = new ScoringAndAssessmentCategoryType(CRADSCOLONICFINDINGSValue); + /// CAD-RADS. + public static ScoringAndAssessmentCategoryType CADRADS { get; } = new ScoringAndAssessmentCategoryType(CADRADSValue); + /// LI-RADS. + public static ScoringAndAssessmentCategoryType LIRADS { get; } = new ScoringAndAssessmentCategoryType(LIRADSValue); + /// LUNG-RADS. + public static ScoringAndAssessmentCategoryType LUNGRADS { get; } = new ScoringAndAssessmentCategoryType(LUNGRADSValue); + /// NI-RADS. + public static ScoringAndAssessmentCategoryType NIRADS { get; } = new ScoringAndAssessmentCategoryType(NIRADSValue); + /// O-RADS. + public static ScoringAndAssessmentCategoryType ORADS { get; } = new ScoringAndAssessmentCategoryType(ORADSValue); + /// PI-RADS. + public static ScoringAndAssessmentCategoryType PIRADS { get; } = new ScoringAndAssessmentCategoryType(PIRADSValue); + /// TI-RADS. + public static ScoringAndAssessmentCategoryType TIRADS { get; } = new ScoringAndAssessmentCategoryType(TIRADSValue); + /// C-RADS EXTRACOLONIC FINDINGS. + public static ScoringAndAssessmentCategoryType CRADSEXTRACOLONICFINDINGS { get; } = new ScoringAndAssessmentCategoryType(CRADSEXTRACOLONICFINDINGSValue); + /// LIFETIME BREAST CANCER RISK. + public static ScoringAndAssessmentCategoryType LIFETIMEBREASTCANCERRISK { get; } = new ScoringAndAssessmentCategoryType(LIFETIMEBREASTCANCERRISKValue); + /// ASCVD RISK. + public static ScoringAndAssessmentCategoryType ASCVDRISK { get; } = new ScoringAndAssessmentCategoryType(ASCVDRISKValue); + /// MODIFIED GAIL MODEL RISK. + public static ScoringAndAssessmentCategoryType MODIFIEDGAILMODELRISK { get; } = new ScoringAndAssessmentCategoryType(MODIFIEDGAILMODELRISKValue); + /// TYRER CUSICK MODEL RISK. + public static ScoringAndAssessmentCategoryType TYRERCUSICKMODELRISK { get; } = new ScoringAndAssessmentCategoryType(TYRERCUSICKMODELRISKValue); + /// AGATSTON SCORE. + public static ScoringAndAssessmentCategoryType AGATSTONSCORE { get; } = new ScoringAndAssessmentCategoryType(AGATSTONSCOREValue); + /// 10 YEAR CHD RISK. + public static ScoringAndAssessmentCategoryType TENYEARCHDRISK { get; } = new ScoringAndAssessmentCategoryType(TENYEARCHDRISKValue); + /// Z-SCORE. + public static ScoringAndAssessmentCategoryType ZSCORE { get; } = new ScoringAndAssessmentCategoryType(ZSCOREValue); + /// T-SCORE. + public static ScoringAndAssessmentCategoryType TSCORE { get; } = new ScoringAndAssessmentCategoryType(TSCOREValue); + /// CALCIUM VOLUME SCORE. + public static ScoringAndAssessmentCategoryType CALCIUMVOLUMESCORE { get; } = new ScoringAndAssessmentCategoryType(CALCIUMVOLUMESCOREValue); + /// US LI-RADS VISUALIZATION SCORE. + public static ScoringAndAssessmentCategoryType USLIRADSVISUALIZATIONSCORE { get; } = new ScoringAndAssessmentCategoryType(USLIRADSVISUALIZATIONSCOREValue); + /// US LI-RADS. + public static ScoringAndAssessmentCategoryType USLIRADS { get; } = new ScoringAndAssessmentCategoryType(USLIRADSValue); + /// CEUS LI-RADS. + public static ScoringAndAssessmentCategoryType CEUSLIRADS { get; } = new ScoringAndAssessmentCategoryType(CEUSLIRADSValue); + /// TREATMENT RESPONSE LI-RADS. + public static ScoringAndAssessmentCategoryType TREATMENTRESPONSELIRADS { get; } = new ScoringAndAssessmentCategoryType(TREATMENTRESPONSELIRADSValue); + /// O-RADS MRI. + public static ScoringAndAssessmentCategoryType ORADSMRI { get; } = new ScoringAndAssessmentCategoryType(ORADSMRIValue); + /// CALCIUM MASS SCORE. + public static ScoringAndAssessmentCategoryType CALCIUMMASSSCORE { get; } = new ScoringAndAssessmentCategoryType(CALCIUMMASSSCOREValue); + /// RISK OF MALIGNANCY INDEX. + public static ScoringAndAssessmentCategoryType RISKOFMALIGNANCYINDEX { get; } = new ScoringAndAssessmentCategoryType(RISKOFMALIGNANCYINDEXValue); + /// HNPCC MUTATION RISK. + public static ScoringAndAssessmentCategoryType HNPCCMUTATIONRISK { get; } = new ScoringAndAssessmentCategoryType(HNPCCMUTATIONRISKValue); + /// ALBERTA STROKE PROGRAM EARLY CT SCORE. + public static ScoringAndAssessmentCategoryType ALBERTASTROKEPROGRAMEARLYCTSCORE { get; } = new ScoringAndAssessmentCategoryType(ALBERTASTROKEPROGRAMEARLYCTSCOREValue); + /// KELLGREN-LAWRENCE GRADING SCALE. + public static ScoringAndAssessmentCategoryType KELLGRENLAWRENCEGRADINGSCALE { get; } = new ScoringAndAssessmentCategoryType(KELLGRENLAWRENCEGRADINGSCALEValue); + /// TONNIS CLASSIFICATION. + public static ScoringAndAssessmentCategoryType TONNISCLASSIFICATION { get; } = new ScoringAndAssessmentCategoryType(TONNISCLASSIFICATIONValue); + /// CALCIUM SCORE (UNSPECIFIED). + public static ScoringAndAssessmentCategoryType CALCIUMSCOREUNSPECIFIED { get; } = new ScoringAndAssessmentCategoryType(CALCIUMSCOREUNSPECIFIEDValue); + /// 10 YEAR CHD RISK (OBSERVED AGE). + public static ScoringAndAssessmentCategoryType TENYEARCHDRISKOBSERVEDAGE { get; } = new ScoringAndAssessmentCategoryType(TENYEARCHDRISKOBSERVEDAGEValue); + /// 10 YEAR CHD RISK (ARTERIAL AGE). + public static ScoringAndAssessmentCategoryType TENYEARCHDRISKARTERIALAGE { get; } = new ScoringAndAssessmentCategoryType(TENYEARCHDRISKARTERIALAGEValue); + /// FRAX SCORE. + public static ScoringAndAssessmentCategoryType FRAXSCORE { get; } = new ScoringAndAssessmentCategoryType(FRAXSCOREValue); + /// Determines if two values are the same. + public static bool operator ==(ScoringAndAssessmentCategoryType left, ScoringAndAssessmentCategoryType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ScoringAndAssessmentCategoryType left, ScoringAndAssessmentCategoryType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator ScoringAndAssessmentCategoryType(string value) => new ScoringAndAssessmentCategoryType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ScoringAndAssessmentCategoryType other && Equals(other); + /// + public bool Equals(ScoringAndAssessmentCategoryType 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/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/ScoringAndAssessmentInference.Serialization.cs b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/ScoringAndAssessmentInference.Serialization.cs new file mode 100644 index 000000000000..d79f2b5f144e --- /dev/null +++ b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/ScoringAndAssessmentInference.Serialization.cs @@ -0,0 +1,190 @@ +// 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.Health.Insights.RadiologyInsights +{ + public partial class ScoringAndAssessmentInference : 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(ScoringAndAssessmentInference)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("category"u8); + writer.WriteStringValue(Category.ToString()); + writer.WritePropertyName("categoryDescription"u8); + writer.WriteStringValue(CategoryDescription); + if (Optional.IsDefined(SingleValue)) + { + writer.WritePropertyName("singleValue"u8); + writer.WriteStringValue(SingleValue); + } + if (Optional.IsDefined(RangeValue)) + { + writer.WritePropertyName("rangeValue"u8); + writer.WriteObjectValue(RangeValue, options); + } + } + + ScoringAndAssessmentInference 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(ScoringAndAssessmentInference)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeScoringAndAssessmentInference(document.RootElement, options); + } + + internal static ScoringAndAssessmentInference DeserializeScoringAndAssessmentInference(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ScoringAndAssessmentCategoryType category = default; + string categoryDescription = default; + string singleValue = default; + AssessmentValueRange rangeValue = default; + RadiologyInsightsInferenceType kind = default; + IReadOnlyList extension = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("category"u8)) + { + category = new ScoringAndAssessmentCategoryType(property.Value.GetString()); + continue; + } + if (property.NameEquals("categoryDescription"u8)) + { + categoryDescription = property.Value.GetString(); + continue; + } + if (property.NameEquals("singleValue"u8)) + { + singleValue = property.Value.GetString(); + continue; + } + if (property.NameEquals("rangeValue"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + rangeValue = AssessmentValueRange.DeserializeAssessmentValueRange(property.Value, options); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new RadiologyInsightsInferenceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("extension"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(FhirR4Extension.DeserializeFhirR4Extension(item, options)); + } + extension = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ScoringAndAssessmentInference( + kind, + extension ?? new ChangeTrackingList(), + serializedAdditionalRawData, + category, + categoryDescription, + singleValue, + rangeValue); + } + + 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(ScoringAndAssessmentInference)} does not support writing '{options.Format}' format."); + } + } + + ScoringAndAssessmentInference 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 DeserializeScoringAndAssessmentInference(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ScoringAndAssessmentInference)} 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 ScoringAndAssessmentInference FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeScoringAndAssessmentInference(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/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/ScoringAndAssessmentInference.cs b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/ScoringAndAssessmentInference.cs new file mode 100644 index 000000000000..0377bb19445d --- /dev/null +++ b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/src/Generated/ScoringAndAssessmentInference.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Health.Insights.RadiologyInsights +{ + /// Identifies and highlights Risk, Scoring, Assessment and Classifications and correspondent values dictated in a report, e.g. 'BIRADS 5'. + public partial class ScoringAndAssessmentInference : RadiologyInsightsInference + { + /// Initializes a new instance of . + /// Category, e.g. BIRADS. + /// The expansion of the category (which is an abbreviation.). + /// is null. + internal ScoringAndAssessmentInference(ScoringAndAssessmentCategoryType category, string categoryDescription) + { + Argument.AssertNotNull(categoryDescription, nameof(categoryDescription)); + + Kind = RadiologyInsightsInferenceType.ScoringAndAssessment; + Category = category; + CategoryDescription = categoryDescription; + } + + /// Initializes a new instance of . + /// Discriminator property for RadiologyInsightsInference. + /// Additional Content defined by implementations. + /// Keeps track of any properties unknown to the library. + /// Category, e.g. BIRADS. + /// The expansion of the category (which is an abbreviation.). + /// The value. If the value is a range, use field valueRange. + /// The range. + internal ScoringAndAssessmentInference(RadiologyInsightsInferenceType kind, IReadOnlyList extension, IDictionary serializedAdditionalRawData, ScoringAndAssessmentCategoryType category, string categoryDescription, string singleValue, AssessmentValueRange rangeValue) : base(kind, extension, serializedAdditionalRawData) + { + Category = category; + CategoryDescription = categoryDescription; + SingleValue = singleValue; + RangeValue = rangeValue; + } + + /// Initializes a new instance of for deserialization. + internal ScoringAndAssessmentInference() + { + } + + /// Category, e.g. BIRADS. + public ScoringAndAssessmentCategoryType Category { get; } + /// The expansion of the category (which is an abbreviation.). + public string CategoryDescription { get; } + /// The value. If the value is a range, use field valueRange. + public string SingleValue { get; } + /// The range. + public AssessmentValueRange RangeValue { get; } + } +} diff --git a/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/tests/Generated/Samples/Samples_RadiologyInsightsClient.cs b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/tests/Generated/Samples/Samples_RadiologyInsightsClient.cs index e6c4122d9333..9b6af0230319 100644 --- a/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/tests/Generated/Samples/Samples_RadiologyInsightsClient.cs +++ b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/tests/Generated/Samples/Samples_RadiologyInsightsClient.cs @@ -316,6 +316,17 @@ public void Example_RadiologyInsightsJob_InferRadiologyInsights_AllParameters() { provideFocusedSentenceEvidence = true, }, + guidanceOptions = new + { + showGuidanceInHistory = true, + }, + qualityMeasureOptions = new + { + measureTypes = new object[] + { +"mips76" + }, + }, }, locale = "", }, @@ -1680,6 +1691,17 @@ public async Task Example_RadiologyInsightsJob_InferRadiologyInsights_AllParamet { provideFocusedSentenceEvidence = true, }, + guidanceOptions = new + { + showGuidanceInHistory = true, + }, + qualityMeasureOptions = new + { + measureTypes = new object[] + { +"mips76" + }, + }, }, locale = "", }, @@ -2975,6 +2997,8 @@ public void Example_RadiologyInsightsJob_InferRadiologyInsights_AllParameters_Co { ProvideFocusedSentenceEvidence = true, }, + GuidanceOptions = new GuidanceOptions(true), + QualityMeasureOptions = new QualityMeasureOptions(new QualityMeasureType[] { QualityMeasureType.Mips76 }), }, Locale = "", }, @@ -3152,6 +3176,8 @@ public async Task Example_RadiologyInsightsJob_InferRadiologyInsights_AllParamet { ProvideFocusedSentenceEvidence = true, }, + GuidanceOptions = new GuidanceOptions(true), + QualityMeasureOptions = new QualityMeasureOptions(new QualityMeasureType[] { QualityMeasureType.Mips76 }), }, Locale = "", }, diff --git a/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/tsp-location.yaml b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/tsp-location.yaml index f37e9e56b97d..208a2fb1699d 100644 --- a/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/tsp-location.yaml +++ b/sdk/healthinsights/Azure.Health.Insights.RadiologyInsights/tsp-location.yaml @@ -1,7 +1,6 @@ directory: specification/ai/HealthInsights/HealthInsights.RadiologyInsights -additionalDirectories: - - specification/ai/HealthInsights/HealthInsights.OpenAPI - - specification/ai/HealthInsights/HealthInsights.Common -commit: 1f1dcb6199544dd127964e91bd10118ecc21d7a8 +commit: e5eca2279ea7f0cf8c93e7c543ffc033a18e5f7f repo: Azure/azure-rest-api-specs -cleanup: false +additionalDirectories: +- specification/ai/HealthInsights/HealthInsights.Common +- specification/ai/HealthInsights/HealthInsights.OpenAPI diff --git a/sdk/keyvault/Azure.Security.KeyVault.Administration/tsp-location.yaml b/sdk/keyvault/Azure.Security.KeyVault.Administration/tsp-location.yaml index 1bca575d59ae..97ce5a9abce2 100644 --- a/sdk/keyvault/Azure.Security.KeyVault.Administration/tsp-location.yaml +++ b/sdk/keyvault/Azure.Security.KeyVault.Administration/tsp-location.yaml @@ -1,9 +1,8 @@ directory: specification/keyvault/Security.KeyVault.Administration -commit: b0a48bcbffead733affe03944ef09f5e8d12f8c8 +commit: e5eca2279ea7f0cf8c93e7c543ffc033a18e5f7f repo: Azure/azure-rest-api-specs - -additionalDirectories: -- specification/keyvault/Security.KeyVault.BackupRestore/ -- specification/keyvault/Security.KeyVault.Common/ -- specification/keyvault/Security.KeyVault.RBAC/ -- specification/keyvault/Security.KeyVault.Settings/ +additionalDirectories: +- specification/keyvault/Security.KeyVault.BackupRestore +- specification/keyvault/Security.KeyVault.Common +- specification/keyvault/Security.KeyVault.RBAC +- specification/keyvault/Security.KeyVault.Settings diff --git a/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/Azure.Developer.MicrosoftPlaywrightTesting.sln b/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/Azure.Developer.MicrosoftPlaywrightTesting.sln new file mode 100644 index 000000000000..f0b95cc94a15 --- /dev/null +++ b/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/Azure.Developer.MicrosoftPlaywrightTesting.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.Developer.MicrosoftPlaywrightTesting", "src\Azure.Developer.MicrosoftPlaywrightTesting.csproj", "{28FF4005-4467-4E36-92E7-DEA27DEB1519}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.Developer.MicrosoftPlaywrightTesting.Tests", "tests\Azure.Developer.MicrosoftPlaywrightTesting.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/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/CHANGELOG.md b/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/CHANGELOG.md new file mode 100644 index 000000000000..8b33f0fedccc --- /dev/null +++ b/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/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/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/Directory.Build.props b/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/Directory.Build.props new file mode 100644 index 000000000000..63bd836ad44b --- /dev/null +++ b/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/Directory.Build.props @@ -0,0 +1,6 @@ + + + + diff --git a/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/README.md b/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/README.md new file mode 100644 index 000000000000..ba9958c97bb7 --- /dev/null +++ b/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/README.md @@ -0,0 +1,107 @@ +# Azure.Developer.MicrosoftPlaywrightTesting client library for .NET + +Azure.Developer.MicrosoftPlaywrightTesting 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/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/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.Developer.MicrosoftPlaywrightTesting --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/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/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 + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-net/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/README.png) \ No newline at end of file diff --git a/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/src/Azure.Developer.MicrosoftPlaywrightTesting.csproj b/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/src/Azure.Developer.MicrosoftPlaywrightTesting.csproj new file mode 100644 index 000000000000..4a68b892e00d --- /dev/null +++ b/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/src/Azure.Developer.MicrosoftPlaywrightTesting.csproj @@ -0,0 +1,19 @@ + + + This is the Azure.Developer.MicrosoftPlaywrightTesting client library for developing .NET applications with rich experience. + Azure SDK Code Generation Azure.Developer.MicrosoftPlaywrightTesting for Azure Data Plane + 1.0.0-beta.1 + Azure.Developer.MicrosoftPlaywrightTesting + $(RequiredTargetFrameworks) + true + + + + + + + + + + + diff --git a/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/src/Generated/AccessToken.Serialization.cs b/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/src/Generated/AccessToken.Serialization.cs new file mode 100644 index 000000000000..e2466ce5d94d --- /dev/null +++ b/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/src/Generated/AccessToken.Serialization.cs @@ -0,0 +1,201 @@ +// 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.Developer.MicrosoftPlaywrightTesting +{ + public partial class AccessToken : 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(AccessToken)} does not support writing '{format}' format."); + } + + if (options.Format != "W") + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + if (options.Format != "W" && Optional.IsDefined(JwtToken)) + { + writer.WritePropertyName("jwtToken"u8); + writer.WriteStringValue(JwtToken); + } + if (options.Format != "W") + { + writer.WritePropertyName("createdAt"u8); + writer.WriteStringValue(CreatedAt, "O"); + } + writer.WritePropertyName("expiryAt"u8); + writer.WriteStringValue(ExpiryAt, "O"); + if (options.Format != "W") + { + writer.WritePropertyName("state"u8); + writer.WriteStringValue(State.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 + } + } + } + + AccessToken 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(AccessToken)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAccessToken(document.RootElement, options); + } + + internal static AccessToken DeserializeAccessToken(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Guid id = default; + string name = default; + string jwtToken = default; + DateTimeOffset createdAt = default; + DateTimeOffset expiryAt = default; + AccessTokenState state = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = property.Value.GetGuid(); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("jwtToken"u8)) + { + jwtToken = property.Value.GetString(); + continue; + } + if (property.NameEquals("createdAt"u8)) + { + createdAt = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("expiryAt"u8)) + { + expiryAt = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("state"u8)) + { + state = new AccessTokenState(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AccessToken( + id, + name, + jwtToken, + createdAt, + expiryAt, + state, + 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(AccessToken)} does not support writing '{options.Format}' format."); + } + } + + AccessToken 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 DeserializeAccessToken(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AccessToken)} 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 AccessToken FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeAccessToken(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/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/src/Generated/AccessToken.cs b/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/src/Generated/AccessToken.cs new file mode 100644 index 000000000000..f681c953a689 --- /dev/null +++ b/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/src/Generated/AccessToken.cs @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Developer.MicrosoftPlaywrightTesting +{ + /// Model of an access-token linked to an account. + public partial class AccessToken + { + /// + /// 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 access-token name. + /// The access-token expiryAt utcDateTime. + /// is null. + public AccessToken(string name, DateTimeOffset expiryAt) + { + Argument.AssertNotNull(name, nameof(name)); + + Name = name; + ExpiryAt = expiryAt; + } + + /// Initializes a new instance of . + /// The access-token id. + /// The access-token name. + /// The access-token value in JWT format. + /// The access-token createdAt utcDateTime. + /// The access-token expiryAt utcDateTime. + /// The access-token state - Active | Expired. + /// Keeps track of any properties unknown to the library. + internal AccessToken(Guid id, string name, string jwtToken, DateTimeOffset createdAt, DateTimeOffset expiryAt, AccessTokenState state, IDictionary serializedAdditionalRawData) + { + Id = id; + Name = name; + JwtToken = jwtToken; + CreatedAt = createdAt; + ExpiryAt = expiryAt; + State = state; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AccessToken() + { + } + + /// The access-token id. + public Guid Id { get; } + /// The access-token name. + public string Name { get; set; } + /// The access-token value in JWT format. + public string JwtToken { get; } + /// The access-token createdAt utcDateTime. + public DateTimeOffset CreatedAt { get; } + /// The access-token expiryAt utcDateTime. + public DateTimeOffset ExpiryAt { get; set; } + /// The access-token state - Active | Expired. + public AccessTokenState State { get; } + } +} diff --git a/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/src/Generated/AccessTokenState.cs b/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/src/Generated/AccessTokenState.cs new file mode 100644 index 000000000000..f321e8733180 --- /dev/null +++ b/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/src/Generated/AccessTokenState.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 Azure.Developer.MicrosoftPlaywrightTesting +{ + /// The access-token state. + public readonly partial struct AccessTokenState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AccessTokenState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ActiveValue = "Active"; + private const string ExpiredValue = "Expired"; + + /// The access-token is Active. + public static AccessTokenState Active { get; } = new AccessTokenState(ActiveValue); + /// The access-token is Expired. + public static AccessTokenState Expired { get; } = new AccessTokenState(ExpiredValue); + /// Determines if two values are the same. + public static bool operator ==(AccessTokenState left, AccessTokenState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AccessTokenState left, AccessTokenState right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator AccessTokenState(string value) => new AccessTokenState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AccessTokenState other && Equals(other); + /// + public bool Equals(AccessTokenState 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/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/src/Generated/AccessTokens.cs b/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/src/Generated/AccessTokens.cs new file mode 100644 index 000000000000..141567fa8cc8 --- /dev/null +++ b/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/src/Generated/AccessTokens.cs @@ -0,0 +1,562 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.Developer.MicrosoftPlaywrightTesting +{ + // Data plane generated sub-client. + /// The AccessTokens sub-client. + public partial class AccessTokens + { + private static readonly string[] AuthorizationScopes = new string[] { "https://playwright.microsoft.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 AccessTokens for mocking. + protected AccessTokens() + { + } + + /// Initializes a new instance of AccessTokens. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The token credential to copy. + /// + /// Supported Azure Playwright Service API Endpoints (protocol and hostname, for example: + /// https://{region}.api.playwright.microsoft.com). + /// + /// The API version to use for this operation. + internal AccessTokens(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, TokenCredential tokenCredential, Uri endpoint, string apiVersion) + { + ClientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + _tokenCredential = tokenCredential; + _endpoint = endpoint; + _apiVersion = apiVersion; + } + + /// Creates an access-token for the account with given access-token id. Authorization required is Bearer JWT Access token provided by EntraID. + /// The account id. + /// The access-token id. + /// The resource instance. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual async Task> CreateOrReplaceAsync(string accountId, Guid accessTokenId, AccessToken resource, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(accountId, nameof(accountId)); + Argument.AssertNotNull(resource, nameof(resource)); + + using RequestContent content = resource.ToRequestContent(); + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await CreateOrReplaceAsync(accountId, accessTokenId, content, context).ConfigureAwait(false); + return Response.FromValue(AccessToken.FromResponse(response), response); + } + + /// Creates an access-token for the account with given access-token id. Authorization required is Bearer JWT Access token provided by EntraID. + /// The account id. + /// The access-token id. + /// The resource instance. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual Response CreateOrReplace(string accountId, Guid accessTokenId, AccessToken resource, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(accountId, nameof(accountId)); + Argument.AssertNotNull(resource, nameof(resource)); + + using RequestContent content = resource.ToRequestContent(); + RequestContext context = FromCancellationToken(cancellationToken); + Response response = CreateOrReplace(accountId, accessTokenId, content, context); + return Response.FromValue(AccessToken.FromResponse(response), response); + } + + /// + /// [Protocol Method] Creates an access-token for the account with given access-token id. Authorization required is Bearer JWT Access token provided by EntraID. + /// + /// + /// + /// 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 account id. + /// The access-token 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. + /// 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 CreateOrReplaceAsync(string accountId, Guid accessTokenId, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(accountId, nameof(accountId)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("AccessTokens.CreateOrReplace"); + scope.Start(); + try + { + using HttpMessage message = CreateCreateOrReplaceRequest(accountId, accessTokenId, content, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Creates an access-token for the account with given access-token id. Authorization required is Bearer JWT Access token provided by EntraID. + /// + /// + /// + /// 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 account id. + /// The access-token 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. + /// 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 CreateOrReplace(string accountId, Guid accessTokenId, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(accountId, nameof(accountId)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("AccessTokens.CreateOrReplace"); + scope.Start(); + try + { + using HttpMessage message = CreateCreateOrReplaceRequest(accountId, accessTokenId, content, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets an access-token for the account with given access-token id. Authorization required is Bearer JWT Access token provided by EntraID. + /// The account id. + /// The access-token id. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual async Task> GetAccessTokenAsync(string accountId, Guid accessTokenId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(accountId, nameof(accountId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await GetAccessTokenAsync(accountId, accessTokenId, context).ConfigureAwait(false); + return Response.FromValue(AccessToken.FromResponse(response), response); + } + + /// Gets an access-token for the account with given access-token id. Authorization required is Bearer JWT Access token provided by EntraID. + /// The account id. + /// The access-token id. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual Response GetAccessToken(string accountId, Guid accessTokenId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(accountId, nameof(accountId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = GetAccessToken(accountId, accessTokenId, context); + return Response.FromValue(AccessToken.FromResponse(response), response); + } + + /// + /// [Protocol Method] Gets an access-token for the account with given access-token id. Authorization required is Bearer JWT Access token provided by EntraID. + /// + /// + /// + /// 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 account id. + /// The access-token id. + /// 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 GetAccessTokenAsync(string accountId, Guid accessTokenId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(accountId, nameof(accountId)); + + using var scope = ClientDiagnostics.CreateScope("AccessTokens.GetAccessToken"); + scope.Start(); + try + { + using HttpMessage message = CreateGetAccessTokenRequest(accountId, accessTokenId, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Gets an access-token for the account with given access-token id. Authorization required is Bearer JWT Access token provided by EntraID. + /// + /// + /// + /// 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 account id. + /// The access-token id. + /// 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 GetAccessToken(string accountId, Guid accessTokenId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(accountId, nameof(accountId)); + + using var scope = ClientDiagnostics.CreateScope("AccessTokens.GetAccessToken"); + scope.Start(); + try + { + using HttpMessage message = CreateGetAccessTokenRequest(accountId, accessTokenId, 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 an access-token for the account with given access-token id. Authorization required is Bearer JWT Access token provided by EntraID. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// The account id. + /// The access-token id. + /// 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 accountId, Guid accessTokenId, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(accountId, nameof(accountId)); + + using var scope = ClientDiagnostics.CreateScope("AccessTokens.Delete"); + scope.Start(); + try + { + using HttpMessage message = CreateDeleteRequest(accountId, accessTokenId, 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 an access-token for the account with given access-token id. Authorization required is Bearer JWT Access token provided by EntraID. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// The account id. + /// The access-token id. + /// 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 accountId, Guid accessTokenId, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(accountId, nameof(accountId)); + + using var scope = ClientDiagnostics.CreateScope("AccessTokens.Delete"); + scope.Start(); + try + { + using HttpMessage message = CreateDeleteRequest(accountId, accessTokenId, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Lists access-tokens for the given account id. It can use OData query params like $select, $filter, $orderby, $top and $skip. The default page size is 10. Use nextLink in response to fetch more objects in the list. Authorization required is Bearer JWT Access token provided by EntraID. + /// The account id. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual AsyncPageable GetAccessTokensAsync(string accountId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(accountId, nameof(accountId)); + + RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetAccessTokensRequest(accountId, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetAccessTokensNextPageRequest(nextLink, accountId, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => AccessToken.DeserializeAccessToken(e), ClientDiagnostics, _pipeline, "AccessTokens.GetAccessTokens", "value", "nextLink", context); + } + + /// Lists access-tokens for the given account id. It can use OData query params like $select, $filter, $orderby, $top and $skip. The default page size is 10. Use nextLink in response to fetch more objects in the list. Authorization required is Bearer JWT Access token provided by EntraID. + /// The account id. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual Pageable GetAccessTokens(string accountId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(accountId, nameof(accountId)); + + RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetAccessTokensRequest(accountId, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetAccessTokensNextPageRequest(nextLink, accountId, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => AccessToken.DeserializeAccessToken(e), ClientDiagnostics, _pipeline, "AccessTokens.GetAccessTokens", "value", "nextLink", context); + } + + /// + /// [Protocol Method] Lists access-tokens for the given account id. It can use OData query params like $select, $filter, $orderby, $top and $skip. The default page size is 10. Use nextLink in response to fetch more objects in the list. Authorization required is Bearer JWT Access token provided by EntraID. + /// + /// + /// + /// 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 account id. + /// 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 GetAccessTokensAsync(string accountId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(accountId, nameof(accountId)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetAccessTokensRequest(accountId, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetAccessTokensNextPageRequest(nextLink, accountId, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "AccessTokens.GetAccessTokens", "value", "nextLink", context); + } + + /// + /// [Protocol Method] Lists access-tokens for the given account id. It can use OData query params like $select, $filter, $orderby, $top and $skip. The default page size is 10. Use nextLink in response to fetch more objects in the list. Authorization required is Bearer JWT Access token provided by EntraID. + /// + /// + /// + /// 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 account id. + /// 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 GetAccessTokens(string accountId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(accountId, nameof(accountId)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetAccessTokensRequest(accountId, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetAccessTokensNextPageRequest(nextLink, accountId, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "AccessTokens.GetAccessTokens", "value", "nextLink", context); + } + + internal HttpMessage CreateCreateOrReplaceRequest(string accountId, Guid accessTokenId, RequestContent content, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200201); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/accounts/", false); + uri.AppendPath(accountId, true); + uri.AppendPath("/access-tokens/", false); + uri.AppendPath(accessTokenId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateGetAccessTokenRequest(string accountId, Guid accessTokenId, 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("/accounts/", false); + uri.AppendPath(accountId, true); + uri.AppendPath("/access-tokens/", false); + uri.AppendPath(accessTokenId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateDeleteRequest(string accountId, Guid accessTokenId, 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("/accounts/", false); + uri.AppendPath(accountId, true); + uri.AppendPath("/access-tokens/", false); + uri.AppendPath(accessTokenId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateGetAccessTokensRequest(string accountId, 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("/accounts/", false); + uri.AppendPath(accountId, true); + uri.AppendPath("/access-tokens", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateGetAccessTokensNextPageRequest(string nextLink, string accountId, 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 _responseClassifier200201; + private static ResponseClassifier ResponseClassifier200201 => _responseClassifier200201 ??= new StatusCodeClassifier(stackalloc ushort[] { 200, 201 }); + private static ResponseClassifier _responseClassifier200; + private static ResponseClassifier ResponseClassifier200 => _responseClassifier200 ??= new StatusCodeClassifier(stackalloc ushort[] { 200 }); + private static ResponseClassifier _responseClassifier204; + private static ResponseClassifier ResponseClassifier204 => _responseClassifier204 ??= new StatusCodeClassifier(stackalloc ushort[] { 204 }); + } +} diff --git a/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/src/Generated/Account.Serialization.cs b/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/src/Generated/Account.Serialization.cs new file mode 100644 index 000000000000..d7c296e6a58f --- /dev/null +++ b/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/src/Generated/Account.Serialization.cs @@ -0,0 +1,295 @@ +// 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.Developer.MicrosoftPlaywrightTesting +{ + public partial class Account : 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(Account)} does not support writing '{format}' format."); + } + + if (options.Format != "W") + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } + if (options.Format != "W") + { + writer.WritePropertyName("resourceId"u8); + writer.WriteStringValue(ResourceId); + } + if (options.Format != "W") + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (options.Format != "W") + { + writer.WritePropertyName("state"u8); + writer.WriteStringValue(State.ToString()); + } + if (options.Format != "W") + { + writer.WritePropertyName("subscriptionId"u8); + writer.WriteStringValue(SubscriptionId); + } + if (options.Format != "W") + { + writer.WritePropertyName("subscriptionState"u8); + writer.WriteStringValue(SubscriptionState.ToString()); + } + if (options.Format != "W") + { + writer.WritePropertyName("tenantId"u8); + writer.WriteStringValue(TenantId); + } + if (options.Format != "W") + { + writer.WritePropertyName("location"u8); + writer.WriteStringValue(Location); + } + if (options.Format != "W" && Optional.IsDefined(RegionalAffinity)) + { + writer.WritePropertyName("regionalAffinity"u8); + writer.WriteStringValue(RegionalAffinity.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(ScalableExecution)) + { + writer.WritePropertyName("scalableExecution"u8); + writer.WriteStringValue(ScalableExecution.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(Reporting)) + { + writer.WritePropertyName("reporting"u8); + writer.WriteStringValue(Reporting.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(LocalAuth)) + { + writer.WritePropertyName("localAuth"u8); + writer.WriteStringValue(LocalAuth.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + Account 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(Account)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAccount(document.RootElement, options); + } + + internal static Account DeserializeAccount(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + string resourceId = default; + string name = default; + AccountState state = default; + Guid subscriptionId = default; + SubscriptionState subscriptionState = default; + Guid tenantId = default; + string location = default; + EnablementStatus? regionalAffinity = default; + EnablementStatus? scalableExecution = default; + EnablementStatus? reporting = default; + EnablementStatus? localAuth = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("resourceId"u8)) + { + resourceId = property.Value.GetString(); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("state"u8)) + { + state = new AccountState(property.Value.GetString()); + continue; + } + if (property.NameEquals("subscriptionId"u8)) + { + subscriptionId = property.Value.GetGuid(); + continue; + } + if (property.NameEquals("subscriptionState"u8)) + { + subscriptionState = new SubscriptionState(property.Value.GetString()); + continue; + } + if (property.NameEquals("tenantId"u8)) + { + tenantId = property.Value.GetGuid(); + continue; + } + if (property.NameEquals("location"u8)) + { + location = property.Value.GetString(); + continue; + } + if (property.NameEquals("regionalAffinity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + regionalAffinity = new EnablementStatus(property.Value.GetString()); + continue; + } + if (property.NameEquals("scalableExecution"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + scalableExecution = new EnablementStatus(property.Value.GetString()); + continue; + } + if (property.NameEquals("reporting"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + reporting = new EnablementStatus(property.Value.GetString()); + continue; + } + if (property.NameEquals("localAuth"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + localAuth = new EnablementStatus(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new Account( + id, + resourceId, + name, + state, + subscriptionId, + subscriptionState, + tenantId, + location, + regionalAffinity, + scalableExecution, + reporting, + localAuth, + 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(Account)} does not support writing '{options.Format}' format."); + } + } + + Account 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 DeserializeAccount(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(Account)} 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 Account FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeAccount(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/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/src/Generated/Account.cs b/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/src/Generated/Account.cs new file mode 100644 index 000000000000..be4afd6848bb --- /dev/null +++ b/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/src/Generated/Account.cs @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Developer.MicrosoftPlaywrightTesting +{ + /// An account is a parent resource for most of the other service resources. It's directly mapped to an Azure resource. + public partial class Account + { + /// + /// 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 Account() + { + } + + /// Initializes a new instance of . + /// The account id. + /// The fully-qualified Azure resource id for the account. + /// The account name. + /// The state of account - Active | Inactive. + /// The Azure subscription id for the account. + /// The Azure subscription state - Registered | Unregistered | Warned | Suspended | Deleted. + /// The Azure tenant id of the account. + /// The account resource location in Azure, for eg. eastus, southeastasia. + /// This property sets the connection region for Playwright client workers to cloud-hosted browsers. If enabled, workers connect to browsers in the closest Azure region, ensuring lower latency. If disabled, workers connect to browsers in the Azure region in which the workspace was initially created. + /// When enabled, Playwright client workers can connect to cloud-hosted browsers. This can increase the number of parallel workers for a test run, significantly minimizing test completion durations. + /// When enabled, this feature allows the workspace to upload and display test results, including artifacts like traces and screenshots, in the Playwright portal. This enables faster and more efficient troubleshooting. + /// When enabled, this feature allows the workspace to use local auth (through service access token) for executing operations. + /// Keeps track of any properties unknown to the library. + internal Account(string id, string resourceId, string name, AccountState state, Guid subscriptionId, SubscriptionState subscriptionState, Guid tenantId, string location, EnablementStatus? regionalAffinity, EnablementStatus? scalableExecution, EnablementStatus? reporting, EnablementStatus? localAuth, IDictionary serializedAdditionalRawData) + { + Id = id; + ResourceId = resourceId; + Name = name; + State = state; + SubscriptionId = subscriptionId; + SubscriptionState = subscriptionState; + TenantId = tenantId; + Location = location; + RegionalAffinity = regionalAffinity; + ScalableExecution = scalableExecution; + Reporting = reporting; + LocalAuth = localAuth; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The account id. + public string Id { get; } + /// The fully-qualified Azure resource id for the account. + public string ResourceId { get; } + /// The account name. + public string Name { get; } + /// The state of account - Active | Inactive. + public AccountState State { get; } + /// The Azure subscription id for the account. + public Guid SubscriptionId { get; } + /// The Azure subscription state - Registered | Unregistered | Warned | Suspended | Deleted. + public SubscriptionState SubscriptionState { get; } + /// The Azure tenant id of the account. + public Guid TenantId { get; } + /// The account resource location in Azure, for eg. eastus, southeastasia. + public string Location { get; } + /// This property sets the connection region for Playwright client workers to cloud-hosted browsers. If enabled, workers connect to browsers in the closest Azure region, ensuring lower latency. If disabled, workers connect to browsers in the Azure region in which the workspace was initially created. + public EnablementStatus? RegionalAffinity { get; } + /// When enabled, Playwright client workers can connect to cloud-hosted browsers. This can increase the number of parallel workers for a test run, significantly minimizing test completion durations. + public EnablementStatus? ScalableExecution { get; } + /// When enabled, this feature allows the workspace to upload and display test results, including artifacts like traces and screenshots, in the Playwright portal. This enables faster and more efficient troubleshooting. + public EnablementStatus? Reporting { get; } + /// When enabled, this feature allows the workspace to use local auth (through service access token) for executing operations. + public EnablementStatus? LocalAuth { get; } + } +} diff --git a/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/src/Generated/AccountState.cs b/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/src/Generated/AccountState.cs new file mode 100644 index 000000000000..bac66ed7f0e2 --- /dev/null +++ b/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/src/Generated/AccountState.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 Azure.Developer.MicrosoftPlaywrightTesting +{ + /// The account state. + public readonly partial struct AccountState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AccountState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ActiveValue = "Active"; + private const string InactiveValue = "Inactive"; + + /// The account is Active. + public static AccountState Active { get; } = new AccountState(ActiveValue); + /// The account is Inactive. + public static AccountState Inactive { get; } = new AccountState(InactiveValue); + /// Determines if two values are the same. + public static bool operator ==(AccountState left, AccountState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AccountState left, AccountState right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator AccountState(string value) => new AccountState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AccountState other && Equals(other); + /// + public bool Equals(AccountState 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/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/src/Generated/Accounts.cs b/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/src/Generated/Accounts.cs new file mode 100644 index 000000000000..c7773ce95649 --- /dev/null +++ b/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/src/Generated/Accounts.cs @@ -0,0 +1,340 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.Developer.MicrosoftPlaywrightTesting +{ + // Data plane generated sub-client. + /// The Accounts sub-client. + public partial class Accounts + { + private static readonly string[] AuthorizationScopes = new string[] { "https://playwright.microsoft.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 Accounts for mocking. + protected Accounts() + { + } + + /// Initializes a new instance of Accounts. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The token credential to copy. + /// + /// Supported Azure Playwright Service API Endpoints (protocol and hostname, for example: + /// https://{region}.api.playwright.microsoft.com). + /// + /// The API version to use for this operation. + internal Accounts(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, TokenCredential tokenCredential, Uri endpoint, string apiVersion) + { + ClientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + _tokenCredential = tokenCredential; + _endpoint = endpoint; + _apiVersion = apiVersion; + } + + /// Get details of the Azure resource mapped to an account for the given account id. Authorization required is Bearer JWT Access token provided by EntraID. + /// The account id. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual async Task> GetAccountAsync(string accountId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(accountId, nameof(accountId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await GetAccountAsync(accountId, context).ConfigureAwait(false); + return Response.FromValue(Account.FromResponse(response), response); + } + + /// Get details of the Azure resource mapped to an account for the given account id. Authorization required is Bearer JWT Access token provided by EntraID. + /// The account id. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual Response GetAccount(string accountId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(accountId, nameof(accountId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = GetAccount(accountId, context); + return Response.FromValue(Account.FromResponse(response), response); + } + + /// + /// [Protocol Method] Get details of the Azure resource mapped to an account for the given account id. Authorization required is Bearer JWT Access token provided by EntraID. + /// + /// + /// + /// 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 account id. + /// 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 GetAccountAsync(string accountId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(accountId, nameof(accountId)); + + using var scope = ClientDiagnostics.CreateScope("Accounts.GetAccount"); + scope.Start(); + try + { + using HttpMessage message = CreateGetAccountRequest(accountId, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Get details of the Azure resource mapped to an account for the given account id. Authorization required is Bearer JWT Access token provided by EntraID. + /// + /// + /// + /// 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 account id. + /// 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 GetAccount(string accountId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(accountId, nameof(accountId)); + + using var scope = ClientDiagnostics.CreateScope("Accounts.GetAccount"); + scope.Start(); + try + { + using HttpMessage message = CreateGetAccountRequest(accountId, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets remote browsers corresponding to given account id and redirects the client for running Playwright tests. Authorization required is Bearer JWT Access token provided by EntraID or Microsoft Playwright Testing Service. + /// The account id. + /// The run id provided by client for corresponding remote test run. + /// The os provided by client for remote test runs. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual async Task GetBrowsersAsync(string accountId, string runId = null, OS? os = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(accountId, nameof(accountId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await GetBrowsersAsync(accountId, runId, os?.ToString(), context).ConfigureAwait(false); + return response; + } + + /// Gets remote browsers corresponding to given account id and redirects the client for running Playwright tests. Authorization required is Bearer JWT Access token provided by EntraID or Microsoft Playwright Testing Service. + /// The account id. + /// The run id provided by client for corresponding remote test run. + /// The os provided by client for remote test runs. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual Response GetBrowsers(string accountId, string runId = null, OS? os = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(accountId, nameof(accountId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = GetBrowsers(accountId, runId, os?.ToString(), context); + return response; + } + + /// + /// [Protocol Method] Gets remote browsers corresponding to given account id and redirects the client for running Playwright tests. Authorization required is Bearer JWT Access token provided by EntraID or Microsoft Playwright Testing Service. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The account id. + /// The run id provided by client for corresponding remote test run. + /// The os provided by client for remote test runs. Allowed values: "Linux" | "Windows". + /// 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 GetBrowsersAsync(string accountId, string runId, string os, RequestContext context) + { + Argument.AssertNotNullOrEmpty(accountId, nameof(accountId)); + + using var scope = ClientDiagnostics.CreateScope("Accounts.GetBrowsers"); + scope.Start(); + try + { + using HttpMessage message = CreateGetBrowsersRequest(accountId, runId, os, context); + RedirectPolicy.SetAllowAutoRedirect(message, true); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Gets remote browsers corresponding to given account id and redirects the client for running Playwright tests. Authorization required is Bearer JWT Access token provided by EntraID or Microsoft Playwright Testing Service. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The account id. + /// The run id provided by client for corresponding remote test run. + /// The os provided by client for remote test runs. Allowed values: "Linux" | "Windows". + /// 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 GetBrowsers(string accountId, string runId, string os, RequestContext context) + { + Argument.AssertNotNullOrEmpty(accountId, nameof(accountId)); + + using var scope = ClientDiagnostics.CreateScope("Accounts.GetBrowsers"); + scope.Start(); + try + { + using HttpMessage message = CreateGetBrowsersRequest(accountId, runId, os, context); + RedirectPolicy.SetAllowAutoRedirect(message, true); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + internal HttpMessage CreateGetAccountRequest(string accountId, 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("/accounts/", false); + uri.AppendPath(accountId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateGetBrowsersRequest(string accountId, string runId, string os, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier302); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/accounts/", false); + uri.AppendPath(accountId, true); + uri.AppendPath("/browsers", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (runId != null) + { + uri.AppendQuery("runId", runId, true); + } + if (os != null) + { + uri.AppendQuery("os", os, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + private static RequestContext DefaultRequestContext = new RequestContext(); + internal static RequestContext FromCancellationToken(CancellationToken cancellationToken = default) + { + if (!cancellationToken.CanBeCanceled) + { + return DefaultRequestContext; + } + + return new RequestContext() { CancellationToken = cancellationToken }; + } + + private static ResponseClassifier _responseClassifier200; + private static ResponseClassifier ResponseClassifier200 => _responseClassifier200 ??= new StatusCodeClassifier(stackalloc ushort[] { 200 }); + private static ResponseClassifier _responseClassifier302; + private static ResponseClassifier ResponseClassifier302 => _responseClassifier302 ??= new StatusCodeClassifier(stackalloc ushort[] { 302 }); + } +} diff --git a/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/src/Generated/AuthManagerClient.cs b/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/src/Generated/AuthManagerClient.cs new file mode 100644 index 000000000000..aeae0a5f3275 --- /dev/null +++ b/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/src/Generated/AuthManagerClient.cs @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.Developer.MicrosoftPlaywrightTesting +{ + // Data plane generated client. + /// The AuthManager service client. + public partial class AuthManagerClient + { + private static readonly string[] AuthorizationScopes = new string[] { "https://playwright.microsoft.com/.default" }; + private readonly TokenCredential _tokenCredential; + 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 AuthManagerClient for mocking. + protected AuthManagerClient() + { + } + + /// Initializes a new instance of AuthManagerClient. + /// + /// Supported Azure Playwright Service API Endpoints (protocol and hostname, for example: + /// https://{region}.api.playwright.microsoft.com). + /// + /// A credential used to authenticate to an Azure Service. + /// or is null. + public AuthManagerClient(Uri endpoint, TokenCredential credential) : this(endpoint, credential, new AuthManagerClientOptions()) + { + } + + /// Initializes a new instance of AuthManagerClient. + /// + /// Supported Azure Playwright Service API Endpoints (protocol and hostname, for example: + /// https://{region}.api.playwright.microsoft.com). + /// + /// A credential used to authenticate to an Azure Service. + /// The options for configuring the client. + /// or is null. + public AuthManagerClient(Uri endpoint, TokenCredential credential, AuthManagerClientOptions options) + { + Argument.AssertNotNull(endpoint, nameof(endpoint)); + Argument.AssertNotNull(credential, nameof(credential)); + options ??= new AuthManagerClientOptions(); + + ClientDiagnostics = new ClientDiagnostics(options, true); + _tokenCredential = credential; + _pipeline = HttpPipelineBuilder.Build(options, Array.Empty(), new HttpPipelinePolicy[] { new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes) }, new ResponseClassifier()); + _endpoint = endpoint; + } + + /// Initializes a new instance of AccessTokens. + /// The API version to use for this operation. + /// is null. + public virtual AccessTokens GetAccessTokensClient(string apiVersion = "2024-12-01") + { + Argument.AssertNotNull(apiVersion, nameof(apiVersion)); + + return new AccessTokens(ClientDiagnostics, _pipeline, _tokenCredential, _endpoint, apiVersion); + } + + /// Initializes a new instance of Accounts. + /// The API version to use for this operation. + /// is null. + public virtual Accounts GetAccountsClient(string apiVersion = "2024-12-01") + { + Argument.AssertNotNull(apiVersion, nameof(apiVersion)); + + return new Accounts(ClientDiagnostics, _pipeline, _tokenCredential, _endpoint, apiVersion); + } + } +} diff --git a/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/src/Generated/AuthManagerClientOptions.cs b/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/src/Generated/AuthManagerClientOptions.cs new file mode 100644 index 000000000000..99fd673ddfd4 --- /dev/null +++ b/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/src/Generated/AuthManagerClientOptions.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 Azure.Developer.MicrosoftPlaywrightTesting +{ + /// Client options for AuthManagerClient. + public partial class AuthManagerClientOptions : ClientOptions + { + private const ServiceVersion LatestVersion = ServiceVersion.V2024_12_01; + + /// The version of the service to use. + public enum ServiceVersion + { + /// Service version "2024-12-01". + V2024_12_01 = 1, + } + + internal string Version { get; } + + /// Initializes new instance of AuthManagerClientOptions. + public AuthManagerClientOptions(ServiceVersion version = LatestVersion) + { + Version = version switch + { + ServiceVersion.V2024_12_01 => "2024-12-01", + _ => throw new NotSupportedException() + }; + } + } +} diff --git a/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/src/Generated/DeveloperMicrosoftPlaywrightTestingClientBuilderExtensions.cs b/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/src/Generated/DeveloperMicrosoftPlaywrightTestingClientBuilderExtensions.cs new file mode 100644 index 000000000000..364126f7a80c --- /dev/null +++ b/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/src/Generated/DeveloperMicrosoftPlaywrightTestingClientBuilderExtensions.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core.Extensions; +using Azure.Developer.MicrosoftPlaywrightTesting; + +namespace Microsoft.Extensions.Azure +{ + /// Extension methods to add to client builder. + public static partial class DeveloperMicrosoftPlaywrightTestingClientBuilderExtensions + { + /// Registers a instance. + /// The builder to register with. + /// + /// Supported Azure Playwright Service API Endpoints (protocol and hostname, for example: + /// https://{region}.api.playwright.microsoft.com). + /// + public static IAzureClientBuilder AddAuthManagerClient(this TBuilder builder, Uri endpoint) + where TBuilder : IAzureClientFactoryBuilderWithCredential + { + return builder.RegisterClientFactory((options, cred) => new AuthManagerClient(endpoint, cred, options)); + } + + /// Registers a instance. + /// The builder to register with. + /// The configuration values. + public static IAzureClientBuilder AddAuthManagerClient(this TBuilder builder, TConfiguration configuration) + where TBuilder : IAzureClientFactoryBuilderWithConfiguration + { + return builder.RegisterClientFactory(configuration); + } + } +} diff --git a/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/src/Generated/DeveloperMicrosoftPlaywrightTestingModelFactory.cs b/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/src/Generated/DeveloperMicrosoftPlaywrightTestingModelFactory.cs new file mode 100644 index 000000000000..c5ca93548a23 --- /dev/null +++ b/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/src/Generated/DeveloperMicrosoftPlaywrightTestingModelFactory.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; +using System.Linq; + +namespace Azure.Developer.MicrosoftPlaywrightTesting +{ + /// Model factory for models. + public static partial class DeveloperMicrosoftPlaywrightTestingModelFactory + { + /// Initializes a new instance of . + /// The access-token id. + /// The access-token name. + /// The access-token value in JWT format. + /// The access-token createdAt utcDateTime. + /// The access-token expiryAt utcDateTime. + /// The access-token state - Active | Expired. + /// A new instance for mocking. + public static AccessToken AccessToken(Guid id = default, string name = null, string jwtToken = null, DateTimeOffset createdAt = default, DateTimeOffset expiryAt = default, AccessTokenState state = default) + { + return new AccessToken( + id, + name, + jwtToken, + createdAt, + expiryAt, + state, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The account id. + /// The fully-qualified Azure resource id for the account. + /// The account name. + /// The state of account - Active | Inactive. + /// The Azure subscription id for the account. + /// The Azure subscription state - Registered | Unregistered | Warned | Suspended | Deleted. + /// The Azure tenant id of the account. + /// The account resource location in Azure, for eg. eastus, southeastasia. + /// This property sets the connection region for Playwright client workers to cloud-hosted browsers. If enabled, workers connect to browsers in the closest Azure region, ensuring lower latency. If disabled, workers connect to browsers in the Azure region in which the workspace was initially created. + /// When enabled, Playwright client workers can connect to cloud-hosted browsers. This can increase the number of parallel workers for a test run, significantly minimizing test completion durations. + /// When enabled, this feature allows the workspace to upload and display test results, including artifacts like traces and screenshots, in the Playwright portal. This enables faster and more efficient troubleshooting. + /// When enabled, this feature allows the workspace to use local auth (through service access token) for executing operations. + /// A new instance for mocking. + public static Account Account(string id = null, string resourceId = null, string name = null, AccountState state = default, Guid subscriptionId = default, SubscriptionState subscriptionState = default, Guid tenantId = default, string location = null, EnablementStatus? regionalAffinity = null, EnablementStatus? scalableExecution = null, EnablementStatus? reporting = null, EnablementStatus? localAuth = null) + { + return new Account( + id, + resourceId, + name, + state, + subscriptionId, + subscriptionState, + tenantId, + location, + regionalAffinity, + scalableExecution, + reporting, + localAuth, + serializedAdditionalRawData: null); + } + } +} diff --git a/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/src/Generated/Docs/AccessTokens.xml b/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/src/Generated/Docs/AccessTokens.xml new file mode 100644 index 000000000000..fe737d05e5e0 --- /dev/null +++ b/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/src/Generated/Docs/AccessTokens.xml @@ -0,0 +1,225 @@ + + + + + +This sample shows how to call CreateOrReplaceAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +AccessTokens client = new AuthManagerClient(endpoint, credential).GetAccessTokensClient(apiVersion: "2024-12-01"); + +AccessToken resource = new AccessToken("sampleAccessToken", DateTimeOffset.Parse("2022-09-28T12:32:33Z")); +Response response = await client.CreateOrReplaceAsync("sampleAccountId_00000000-0000-0000-0000-000000000000", Guid.Parse("00000000-0000-0000-0000-000000000000"), resource); +]]> + + + +This sample shows how to call CreateOrReplace. +"); +TokenCredential credential = new DefaultAzureCredential(); +AccessTokens client = new AuthManagerClient(endpoint, credential).GetAccessTokensClient(apiVersion: "2024-12-01"); + +AccessToken resource = new AccessToken("sampleAccessToken", DateTimeOffset.Parse("2022-09-28T12:32:33Z")); +Response response = client.CreateOrReplace("sampleAccountId_00000000-0000-0000-0000-000000000000", Guid.Parse("00000000-0000-0000-0000-000000000000"), resource); +]]> + + + +This sample shows how to call CreateOrReplaceAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +AccessTokens client = new AuthManagerClient(endpoint, credential).GetAccessTokensClient(apiVersion: "2024-12-01"); + +using RequestContent content = RequestContent.Create(new +{ + id = "00000000-0000-0000-0000-000000000000", + name = "sampleAccessToken", + expiryAt = "2022-09-28T12:32:33Z", +}); +Response response = await client.CreateOrReplaceAsync("sampleAccountId_00000000-0000-0000-0000-000000000000", Guid.Parse("00000000-0000-0000-0000-000000000000"), content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("createdAt").ToString()); +Console.WriteLine(result.GetProperty("expiryAt").ToString()); +Console.WriteLine(result.GetProperty("state").ToString()); +]]> + + + +This sample shows how to call CreateOrReplace and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +AccessTokens client = new AuthManagerClient(endpoint, credential).GetAccessTokensClient(apiVersion: "2024-12-01"); + +using RequestContent content = RequestContent.Create(new +{ + id = "00000000-0000-0000-0000-000000000000", + name = "sampleAccessToken", + expiryAt = "2022-09-28T12:32:33Z", +}); +Response response = client.CreateOrReplace("sampleAccountId_00000000-0000-0000-0000-000000000000", Guid.Parse("00000000-0000-0000-0000-000000000000"), content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("createdAt").ToString()); +Console.WriteLine(result.GetProperty("expiryAt").ToString()); +Console.WriteLine(result.GetProperty("state").ToString()); +]]> + + + +This sample shows how to call GetAccessTokenAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +AccessTokens client = new AuthManagerClient(endpoint, credential).GetAccessTokensClient(apiVersion: "2024-12-01"); + +Response response = await client.GetAccessTokenAsync("sampleAccountId_00000000-0000-0000-0000-000000000000", Guid.Parse("00000000-0000-0000-0000-000000000000")); +]]> + + + +This sample shows how to call GetAccessToken. +"); +TokenCredential credential = new DefaultAzureCredential(); +AccessTokens client = new AuthManagerClient(endpoint, credential).GetAccessTokensClient(apiVersion: "2024-12-01"); + +Response response = client.GetAccessToken("sampleAccountId_00000000-0000-0000-0000-000000000000", Guid.Parse("00000000-0000-0000-0000-000000000000")); +]]> + + + +This sample shows how to call GetAccessTokenAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +AccessTokens client = new AuthManagerClient(endpoint, credential).GetAccessTokensClient(apiVersion: "2024-12-01"); + +Response response = await client.GetAccessTokenAsync("sampleAccountId_00000000-0000-0000-0000-000000000000", Guid.Parse("00000000-0000-0000-0000-000000000000"), null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("createdAt").ToString()); +Console.WriteLine(result.GetProperty("expiryAt").ToString()); +Console.WriteLine(result.GetProperty("state").ToString()); +]]> + + + +This sample shows how to call GetAccessToken and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +AccessTokens client = new AuthManagerClient(endpoint, credential).GetAccessTokensClient(apiVersion: "2024-12-01"); + +Response response = client.GetAccessToken("sampleAccountId_00000000-0000-0000-0000-000000000000", Guid.Parse("00000000-0000-0000-0000-000000000000"), null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("createdAt").ToString()); +Console.WriteLine(result.GetProperty("expiryAt").ToString()); +Console.WriteLine(result.GetProperty("state").ToString()); +]]> + + + +This sample shows how to call DeleteAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +AccessTokens client = new AuthManagerClient(endpoint, credential).GetAccessTokensClient(apiVersion: "2024-12-01"); + +Response response = await client.DeleteAsync("sampleAccountId_00000000-0000-0000-0000-000000000000", Guid.Parse("00000000-0000-0000-0000-000000000000")); + +Console.WriteLine(response.Status); +]]> + + + +This sample shows how to call Delete. +"); +TokenCredential credential = new DefaultAzureCredential(); +AccessTokens client = new AuthManagerClient(endpoint, credential).GetAccessTokensClient(apiVersion: "2024-12-01"); + +Response response = client.Delete("sampleAccountId_00000000-0000-0000-0000-000000000000", Guid.Parse("00000000-0000-0000-0000-000000000000")); + +Console.WriteLine(response.Status); +]]> + + + +This sample shows how to call GetAccessTokensAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +AccessTokens client = new AuthManagerClient(endpoint, credential).GetAccessTokensClient(apiVersion: "2024-12-01"); + +await foreach (AccessToken item in client.GetAccessTokensAsync("sampleAccountId_00000000-0000-0000-0000-000000000000")) +{ +} +]]> + + + +This sample shows how to call GetAccessTokens. +"); +TokenCredential credential = new DefaultAzureCredential(); +AccessTokens client = new AuthManagerClient(endpoint, credential).GetAccessTokensClient(apiVersion: "2024-12-01"); + +foreach (AccessToken item in client.GetAccessTokens("sampleAccountId_00000000-0000-0000-0000-000000000000")) +{ +} +]]> + + + +This sample shows how to call GetAccessTokensAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +AccessTokens client = new AuthManagerClient(endpoint, credential).GetAccessTokensClient(apiVersion: "2024-12-01"); + +await foreach (BinaryData item in client.GetAccessTokensAsync("sampleAccountId_00000000-0000-0000-0000-000000000000", null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("createdAt").ToString()); + Console.WriteLine(result.GetProperty("expiryAt").ToString()); + Console.WriteLine(result.GetProperty("state").ToString()); +} +]]> + + + +This sample shows how to call GetAccessTokens and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +AccessTokens client = new AuthManagerClient(endpoint, credential).GetAccessTokensClient(apiVersion: "2024-12-01"); + +foreach (BinaryData item in client.GetAccessTokens("sampleAccountId_00000000-0000-0000-0000-000000000000", null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("createdAt").ToString()); + Console.WriteLine(result.GetProperty("expiryAt").ToString()); + Console.WriteLine(result.GetProperty("state").ToString()); +} +]]> + + + \ No newline at end of file diff --git a/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/src/Generated/Docs/Accounts.xml b/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/src/Generated/Docs/Accounts.xml new file mode 100644 index 000000000000..62ebdf2b75ee --- /dev/null +++ b/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/src/Generated/Docs/Accounts.xml @@ -0,0 +1,117 @@ + + + + + +This sample shows how to call GetAccountAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +Accounts client = new AuthManagerClient(endpoint, credential).GetAccountsClient(apiVersion: "2024-12-01"); + +Response response = await client.GetAccountAsync("sampleAccountId_00000000-0000-0000-0000-000000000000"); +]]> + + + +This sample shows how to call GetAccount. +"); +TokenCredential credential = new DefaultAzureCredential(); +Accounts client = new AuthManagerClient(endpoint, credential).GetAccountsClient(apiVersion: "2024-12-01"); + +Response response = client.GetAccount("sampleAccountId_00000000-0000-0000-0000-000000000000"); +]]> + + + +This sample shows how to call GetAccountAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +Accounts client = new AuthManagerClient(endpoint, credential).GetAccountsClient(apiVersion: "2024-12-01"); + +Response response = await client.GetAccountAsync("sampleAccountId_00000000-0000-0000-0000-000000000000", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("resourceId").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("state").ToString()); +Console.WriteLine(result.GetProperty("subscriptionId").ToString()); +Console.WriteLine(result.GetProperty("subscriptionState").ToString()); +Console.WriteLine(result.GetProperty("tenantId").ToString()); +Console.WriteLine(result.GetProperty("location").ToString()); +]]> + + + +This sample shows how to call GetAccount and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +Accounts client = new AuthManagerClient(endpoint, credential).GetAccountsClient(apiVersion: "2024-12-01"); + +Response response = client.GetAccount("sampleAccountId_00000000-0000-0000-0000-000000000000", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("resourceId").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("state").ToString()); +Console.WriteLine(result.GetProperty("subscriptionId").ToString()); +Console.WriteLine(result.GetProperty("subscriptionState").ToString()); +Console.WriteLine(result.GetProperty("tenantId").ToString()); +Console.WriteLine(result.GetProperty("location").ToString()); +]]> + + + +This sample shows how to call GetBrowsersAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +Accounts client = new AuthManagerClient(endpoint, credential).GetAccountsClient(apiVersion: "2024-12-01"); + +Response response = await client.GetBrowsersAsync("sampleAccountId_00000000-0000-0000-0000-000000000000"); +]]> + + + +This sample shows how to call GetBrowsers. +"); +TokenCredential credential = new DefaultAzureCredential(); +Accounts client = new AuthManagerClient(endpoint, credential).GetAccountsClient(apiVersion: "2024-12-01"); + +Response response = client.GetBrowsers("sampleAccountId_00000000-0000-0000-0000-000000000000"); +]]> + + + +This sample shows how to call GetBrowsersAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +Accounts client = new AuthManagerClient(endpoint, credential).GetAccountsClient(apiVersion: "2024-12-01"); + +Response response = await client.GetBrowsersAsync("sampleAccountId_00000000-0000-0000-0000-000000000000", null, "Linux", null); + +Console.WriteLine(response.Status); +]]> + + + +This sample shows how to call GetBrowsers. +"); +TokenCredential credential = new DefaultAzureCredential(); +Accounts client = new AuthManagerClient(endpoint, credential).GetAccountsClient(apiVersion: "2024-12-01"); + +Response response = client.GetBrowsers("sampleAccountId_00000000-0000-0000-0000-000000000000", null, "Linux", null); + +Console.WriteLine(response.Status); +]]> + + + \ No newline at end of file diff --git a/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/src/Generated/EnablementStatus.cs b/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/src/Generated/EnablementStatus.cs new file mode 100644 index 000000000000..98e5aab7d42d --- /dev/null +++ b/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/src/Generated/EnablementStatus.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 Azure.Developer.MicrosoftPlaywrightTesting +{ + /// The enablement status of a feature. + public readonly partial struct EnablementStatus : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public EnablementStatus(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string EnabledValue = "Enabled"; + private const string DisabledValue = "Disabled"; + + /// The feature is Enabled. + public static EnablementStatus Enabled { get; } = new EnablementStatus(EnabledValue); + /// The feature is Disabled. + public static EnablementStatus Disabled { get; } = new EnablementStatus(DisabledValue); + /// Determines if two values are the same. + public static bool operator ==(EnablementStatus left, EnablementStatus right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(EnablementStatus left, EnablementStatus right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator EnablementStatus(string value) => new EnablementStatus(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is EnablementStatus other && Equals(other); + /// + public bool Equals(EnablementStatus 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/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/src/Generated/Internal/Argument.cs b/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/src/Generated/Internal/Argument.cs new file mode 100644 index 000000000000..751c33a54e9a --- /dev/null +++ b/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/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.Developer.MicrosoftPlaywrightTesting +{ + 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/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/src/Generated/Internal/ChangeTrackingDictionary.cs b/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/src/Generated/Internal/ChangeTrackingDictionary.cs new file mode 100644 index 000000000000..f1d970892926 --- /dev/null +++ b/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/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.Developer.MicrosoftPlaywrightTesting +{ + 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/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/src/Generated/Internal/ChangeTrackingList.cs b/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/src/Generated/Internal/ChangeTrackingList.cs new file mode 100644 index 000000000000..19167552757e --- /dev/null +++ b/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/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.Developer.MicrosoftPlaywrightTesting +{ + 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/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/src/Generated/Internal/ModelSerializationExtensions.cs b/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/src/Generated/Internal/ModelSerializationExtensions.cs new file mode 100644 index 000000000000..edae67d6f482 --- /dev/null +++ b/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/src/Generated/Internal/ModelSerializationExtensions.cs @@ -0,0 +1,399 @@ +// 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.Developer.MicrosoftPlaywrightTesting +{ + internal static class ModelSerializationExtensions + { + internal static readonly JsonDocumentOptions JsonDocumentOptions = new JsonDocumentOptions { MaxDepth = 256 }; + internal static readonly ModelReaderWriterOptions WireOptions = new ModelReaderWriterOptions("W"); + + 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(); + foreach (var item in element.EnumerateArray()) + { + list.Add(item.GetObject()); + } + return list.ToArray(); + default: + throw new NotSupportedException($"Not supported value kind {element.ValueKind}"); + } + } + + public static byte[] GetBytesFromBase64(this JsonElement element, string format) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + + return format switch + { + "U" => TypeFormatters.FromBase64UrlString(element.GetRequiredString()), + "D" => element.GetBytesFromBase64(), + _ => throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)) + }; + } + + public static DateTimeOffset GetDateTimeOffset(this JsonElement element, string format) => format switch + { + "U" when element.ValueKind == JsonValueKind.Number => DateTimeOffset.FromUnixTimeSeconds(element.GetInt64()), + _ => TypeFormatters.ParseDateTimeOffset(element.GetString(), format) + }; + + public static TimeSpan GetTimeSpan(this JsonElement element, string format) => TypeFormatters.ParseTimeSpan(element.GetString(), format); + + public static char GetChar(this JsonElement element) + { + if (element.ValueKind == JsonValueKind.String) + { + var text = element.GetString(); + if (text == null || text.Length != 1) + { + throw new NotSupportedException($"Cannot convert \"{text}\" to a char"); + } + return text[0]; + } + else + { + throw new NotSupportedException($"Cannot convert {element.ValueKind} to a char"); + } + } + + [Conditional("DEBUG")] + public static void ThrowNonNullablePropertyIsNull(this JsonProperty property) + { + throw new JsonException($"A property '{property.Name}' defined as non-nullable but received as null from the service. This exception only happens in DEBUG builds of the library and would be ignored in the release build"); + } + + public static string GetRequiredString(this JsonElement element) + { + var value = element.GetString(); + if (value == null) + { + throw new InvalidOperationException($"The requested operation requires an element of type 'String', but the target element has type '{element.ValueKind}'."); + } + return value; + } + + public static void WriteStringValue(this Utf8JsonWriter writer, DateTimeOffset value, string format) + { + writer.WriteStringValue(TypeFormatters.ToString(value, format)); + } + + public static void WriteStringValue(this Utf8JsonWriter writer, DateTime value, string format) + { + writer.WriteStringValue(TypeFormatters.ToString(value, format)); + } + + public static void WriteStringValue(this Utf8JsonWriter writer, TimeSpan value, string format) + { + writer.WriteStringValue(TypeFormatters.ToString(value, format)); + } + + public static void WriteStringValue(this Utf8JsonWriter writer, char value) + { + writer.WriteStringValue(value.ToString(CultureInfo.InvariantCulture)); + } + + public static void WriteBase64StringValue(this Utf8JsonWriter writer, byte[] value, string format) + { + if (value == null) + { + writer.WriteNullValue(); + return; + } + switch (format) + { + case "U": + writer.WriteStringValue(TypeFormatters.ToBase64UrlString(value)); + break; + case "D": + writer.WriteBase64StringValue(value); + break; + default: + throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)); + } + } + + public static void WriteNumberValue(this Utf8JsonWriter writer, DateTimeOffset value, string format) + { + if (format != "U") + { + throw new ArgumentOutOfRangeException(nameof(format), "Only 'U' format is supported when writing a DateTimeOffset as a Number."); + } + writer.WriteNumberValue(value.ToUnixTimeSeconds()); + } + + public static void WriteObjectValue(this Utf8JsonWriter writer, T value, ModelReaderWriterOptions options = null) + { + switch (value) + { + case null: + writer.WriteNullValue(); + break; + case IJsonModel jsonModel: + jsonModel.Write(writer, options ?? WireOptions); + break; + case IUtf8JsonSerializable serializable: + serializable.Write(writer); + break; + case byte[] bytes: + writer.WriteBase64StringValue(bytes); + break; + case BinaryData bytes0: + writer.WriteBase64StringValue(bytes0); + break; + case JsonElement json: + json.WriteTo(writer); + break; + case int i: + writer.WriteNumberValue(i); + break; + case decimal d: + writer.WriteNumberValue(d); + break; + case double d0: + if (double.IsNaN(d0)) + { + writer.WriteStringValue("NaN"); + } + else + { + writer.WriteNumberValue(d0); + } + break; + case float f: + writer.WriteNumberValue(f); + break; + case long l: + writer.WriteNumberValue(l); + break; + case string s: + writer.WriteStringValue(s); + break; + case bool b: + writer.WriteBooleanValue(b); + break; + case Guid g: + writer.WriteStringValue(g); + break; + case DateTimeOffset dateTimeOffset: + writer.WriteStringValue(dateTimeOffset, "O"); + break; + case DateTime dateTime: + writer.WriteStringValue(dateTime, "O"); + break; + case IEnumerable> enumerable: + writer.WriteStartObject(); + foreach (var pair in enumerable) + { + writer.WritePropertyName(pair.Key); + writer.WriteObjectValue(pair.Value, options); + } + writer.WriteEndObject(); + break; + case IEnumerable objectEnumerable: + writer.WriteStartArray(); + foreach (var item in objectEnumerable) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + break; + case TimeSpan timeSpan: + writer.WriteStringValue(timeSpan, "P"); + break; + default: + throw new NotSupportedException($"Not supported type {value.GetType()}"); + } + } + + public static void WriteObjectValue(this Utf8JsonWriter writer, object value, ModelReaderWriterOptions options = null) + { + writer.WriteObjectValue(value, options); + } + + internal static class TypeFormatters + { + private const string RoundtripZFormat = "yyyy-MM-ddTHH:mm:ss.fffffffZ"; + public const string DefaultNumberFormat = "G"; + + public static string ToString(bool value) => value ? "true" : "false"; + + public static string ToString(DateTime value, string format) => value.Kind switch + { + DateTimeKind.Utc => ToString((DateTimeOffset)value, format), + _ => throw new NotSupportedException($"DateTime {value} has a Kind of {value.Kind}. Azure SDK requires it to be UTC. You can call DateTime.SpecifyKind to change Kind property value to DateTimeKind.Utc.") + }; + + public static string ToString(DateTimeOffset value, string format) => format switch + { + "D" => value.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture), + "U" => value.ToUnixTimeSeconds().ToString(CultureInfo.InvariantCulture), + "O" => value.ToUniversalTime().ToString(RoundtripZFormat, CultureInfo.InvariantCulture), + "o" => value.ToUniversalTime().ToString(RoundtripZFormat, CultureInfo.InvariantCulture), + "R" => value.ToString("r", CultureInfo.InvariantCulture), + _ => value.ToString(format, CultureInfo.InvariantCulture) + }; + + public static string ToString(TimeSpan value, string format) => format switch + { + "P" => XmlConvert.ToString(value), + _ => value.ToString(format, CultureInfo.InvariantCulture) + }; + + public static string ToString(byte[] value, string format) => format switch + { + "U" => ToBase64UrlString(value), + "D" => Convert.ToBase64String(value), + _ => throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)) + }; + + public static string ToBase64UrlString(byte[] value) + { + int numWholeOrPartialInputBlocks = checked(value.Length + 2) / 3; + int size = checked(numWholeOrPartialInputBlocks * 4); + char[] output = new char[size]; + + int numBase64Chars = Convert.ToBase64CharArray(value, 0, value.Length, output, 0); + + int i = 0; + for (; i < numBase64Chars; i++) + { + char ch = output[i]; + if (ch == '+') + { + output[i] = '-'; + } + else + { + if (ch == '/') + { + output[i] = '_'; + } + else + { + if (ch == '=') + { + break; + } + } + } + } + + return new string(output, 0, i); + } + + public static byte[] FromBase64UrlString(string value) + { + int paddingCharsToAdd = (value.Length % 4) switch + { + 0 => 0, + 2 => 2, + 3 => 1, + _ => throw new InvalidOperationException("Malformed input") + }; + char[] output = new char[(value.Length + paddingCharsToAdd)]; + int i = 0; + for (; i < value.Length; i++) + { + char ch = value[i]; + if (ch == '-') + { + output[i] = '+'; + } + else + { + if (ch == '_') + { + output[i] = '/'; + } + else + { + output[i] = ch; + } + } + } + + for (; i < output.Length; i++) + { + output[i] = '='; + } + + return Convert.FromBase64CharArray(output, 0, output.Length); + } + + public static DateTimeOffset ParseDateTimeOffset(string value, string format) => format switch + { + "U" => DateTimeOffset.FromUnixTimeSeconds(long.Parse(value, CultureInfo.InvariantCulture)), + _ => DateTimeOffset.Parse(value, CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal) + }; + + public static TimeSpan ParseTimeSpan(string value, string format) => format switch + { + "P" => XmlConvert.ToTimeSpan(value), + _ => TimeSpan.ParseExact(value, format, CultureInfo.InvariantCulture) + }; + + public static string ConvertToString(object value, string format = null) => value switch + { + null => "null", + string s => s, + bool b => ToString(b), + int or float or double or long or decimal => ((IFormattable)value).ToString(DefaultNumberFormat, CultureInfo.InvariantCulture), + byte[] b0 when format != null => ToString(b0, format), + IEnumerable s0 => string.Join(",", s0), + DateTimeOffset dateTime when format != null => ToString(dateTime, format), + TimeSpan timeSpan when format != null => ToString(timeSpan, format), + TimeSpan timeSpan0 => XmlConvert.ToString(timeSpan0), + Guid guid => guid.ToString(), + BinaryData binaryData => ConvertToString(binaryData.ToArray(), format), + _ => value.ToString() + }; + } + } +} diff --git a/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/src/Generated/Internal/Optional.cs b/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/src/Generated/Internal/Optional.cs new file mode 100644 index 000000000000..aeefc5cf26a9 --- /dev/null +++ b/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/src/Generated/Internal/Optional.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; + +namespace Azure.Developer.MicrosoftPlaywrightTesting +{ + internal static class Optional + { + public static bool IsCollectionDefined(IEnumerable collection) + { + return !(collection is ChangeTrackingList changeTrackingList && changeTrackingList.IsUndefined); + } + + public static bool IsCollectionDefined(IDictionary collection) + { + return !(collection is ChangeTrackingDictionary changeTrackingDictionary && changeTrackingDictionary.IsUndefined); + } + + public static bool IsCollectionDefined(IReadOnlyDictionary collection) + { + return !(collection is ChangeTrackingDictionary changeTrackingDictionary && changeTrackingDictionary.IsUndefined); + } + + public static bool IsDefined(T? value) + where T : struct + { + return value.HasValue; + } + + public static bool IsDefined(object value) + { + return value != null; + } + + public static bool IsDefined(JsonElement value) + { + return value.ValueKind != JsonValueKind.Undefined; + } + + public static bool IsDefined(string value) + { + return value != null; + } + } +} diff --git a/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/src/Generated/Internal/Utf8JsonRequestContent.cs b/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/src/Generated/Internal/Utf8JsonRequestContent.cs new file mode 100644 index 000000000000..56ddcc549b34 --- /dev/null +++ b/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/src/Generated/Internal/Utf8JsonRequestContent.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.IO; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.Developer.MicrosoftPlaywrightTesting +{ + internal class Utf8JsonRequestContent : RequestContent + { + private readonly MemoryStream _stream; + private readonly RequestContent _content; + + public Utf8JsonRequestContent() + { + _stream = new MemoryStream(); + _content = Create(_stream); + JsonWriter = new Utf8JsonWriter(_stream); + } + + public Utf8JsonWriter JsonWriter { get; } + + public override async Task WriteToAsync(Stream stream, CancellationToken cancellationToken = default) + { + await JsonWriter.FlushAsync().ConfigureAwait(false); + await _content.WriteToAsync(stream, cancellationToken).ConfigureAwait(false); + } + + public override void WriteTo(Stream stream, CancellationToken cancellationToken = default) + { + JsonWriter.Flush(); + _content.WriteTo(stream, cancellationToken); + } + + public override bool TryComputeLength(out long length) + { + length = JsonWriter.BytesCommitted + JsonWriter.BytesPending; + return true; + } + + public override void Dispose() + { + JsonWriter.Dispose(); + _content.Dispose(); + _stream.Dispose(); + } + } +} diff --git a/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/src/Generated/OS.cs b/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/src/Generated/OS.cs new file mode 100644 index 000000000000..e9fcbb0f87a8 --- /dev/null +++ b/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/src/Generated/OS.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 Azure.Developer.MicrosoftPlaywrightTesting +{ + /// The os to configure for remote test runs. + public readonly partial struct OS : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public OS(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string LinuxValue = "Linux"; + private const string WindowsValue = "Windows"; + + /// Linux OS. + public static OS Linux { get; } = new OS(LinuxValue); + /// Windows OS. + public static OS Windows { get; } = new OS(WindowsValue); + /// Determines if two values are the same. + public static bool operator ==(OS left, OS right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(OS left, OS right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator OS(string value) => new OS(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is OS other && Equals(other); + /// + public bool Equals(OS 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/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/src/Generated/SubscriptionState.cs b/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/src/Generated/SubscriptionState.cs new file mode 100644 index 000000000000..d3fb25818b1a --- /dev/null +++ b/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/src/Generated/SubscriptionState.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Developer.MicrosoftPlaywrightTesting +{ + /// The Azure subscription state. + public readonly partial struct SubscriptionState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public SubscriptionState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string RegisteredValue = "Registered"; + private const string WarnedValue = "Warned"; + private const string SuspendedValue = "Suspended"; + private const string DeletedValue = "Deleted"; + private const string UnregisteredValue = "Unregistered"; + + /// The subscription state is Registered. + public static SubscriptionState Registered { get; } = new SubscriptionState(RegisteredValue); + /// The subscription state is Warned. + public static SubscriptionState Warned { get; } = new SubscriptionState(WarnedValue); + /// The subscription state is Suspended. + public static SubscriptionState Suspended { get; } = new SubscriptionState(SuspendedValue); + /// The subscription state is Deleted. + public static SubscriptionState Deleted { get; } = new SubscriptionState(DeletedValue); + /// The subscription state is Unregistered. + public static SubscriptionState Unregistered { get; } = new SubscriptionState(UnregisteredValue); + /// Determines if two values are the same. + public static bool operator ==(SubscriptionState left, SubscriptionState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(SubscriptionState left, SubscriptionState right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator SubscriptionState(string value) => new SubscriptionState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is SubscriptionState other && Equals(other); + /// + public bool Equals(SubscriptionState 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/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/src/Properties/AssemblyInfo.cs b/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/src/Properties/AssemblyInfo.cs new file mode 100644 index 000000000000..145709b2db91 --- /dev/null +++ b/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/src/Properties/AssemblyInfo.cs @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Runtime.CompilerServices; + +[assembly: InternalsVisibleTo("Azure.Developer.MicrosoftPlaywrightTesting.Tests, PublicKey = 0024000004800000940000000602000000240000525341310004000001000100d15ddcb29688295338af4b7686603fe614abd555e09efba8fb88ee09e1f7b1ccaeed2e8f823fa9eef3fdd60217fc012ea67d2479751a0b8c087a4185541b851bd8b16f8d91b840e51b1cb0ba6fe647997e57429265e85ef62d565db50a69ae1647d54d7bd855e4db3d8a91510e5bcbd0edfbbecaa20a7bd9ae74593daa7b11b4")] + +// Replace Microsoft.Test with the correct resource provider namepace for your service and uncomment. +// See https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/azure-services-resource-providers +// for the list of possible values. +[assembly: Azure.Core.AzureResourceProviderNamespace("Microsoft.Template")] diff --git a/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/tests/Azure.Developer.MicrosoftPlaywrightTesting.Tests.csproj b/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/tests/Azure.Developer.MicrosoftPlaywrightTesting.Tests.csproj new file mode 100644 index 000000000000..f3becb133be8 --- /dev/null +++ b/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/tests/Azure.Developer.MicrosoftPlaywrightTesting.Tests.csproj @@ -0,0 +1,20 @@ + + + $(RequiredTargetFrameworks) + + $(NoWarn);CS1591 + + + + + + + + + + + + + + + diff --git a/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/tests/Generated/Samples/Samples_AccessTokens.cs b/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/tests/Generated/Samples/Samples_AccessTokens.cs new file mode 100644 index 000000000000..4a11c551742b --- /dev/null +++ b/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/tests/Generated/Samples/Samples_AccessTokens.cs @@ -0,0 +1,239 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using NUnit.Framework; + +namespace Azure.Developer.MicrosoftPlaywrightTesting.Samples +{ + public partial class Samples_AccessTokens + { + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_AccessToken_CreateOrReplace_AccessTokensCreateOrReplace() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + AccessTokens client = new AuthManagerClient(endpoint, credential).GetAccessTokensClient(apiVersion: "2024-12-01"); + + using RequestContent content = RequestContent.Create(new + { + id = "00000000-0000-0000-0000-000000000000", + name = "sampleAccessToken", + expiryAt = "2022-09-28T12:32:33Z", + }); + Response response = client.CreateOrReplace("sampleAccountId_00000000-0000-0000-0000-000000000000", Guid.Parse("00000000-0000-0000-0000-000000000000"), content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("createdAt").ToString()); + Console.WriteLine(result.GetProperty("expiryAt").ToString()); + Console.WriteLine(result.GetProperty("state").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_AccessToken_CreateOrReplace_AccessTokensCreateOrReplace_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + AccessTokens client = new AuthManagerClient(endpoint, credential).GetAccessTokensClient(apiVersion: "2024-12-01"); + + using RequestContent content = RequestContent.Create(new + { + id = "00000000-0000-0000-0000-000000000000", + name = "sampleAccessToken", + expiryAt = "2022-09-28T12:32:33Z", + }); + Response response = await client.CreateOrReplaceAsync("sampleAccountId_00000000-0000-0000-0000-000000000000", Guid.Parse("00000000-0000-0000-0000-000000000000"), content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("createdAt").ToString()); + Console.WriteLine(result.GetProperty("expiryAt").ToString()); + Console.WriteLine(result.GetProperty("state").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_AccessToken_CreateOrReplace_AccessTokensCreateOrReplace_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + AccessTokens client = new AuthManagerClient(endpoint, credential).GetAccessTokensClient(apiVersion: "2024-12-01"); + + AccessToken resource = new AccessToken("sampleAccessToken", DateTimeOffset.Parse("2022-09-28T12:32:33Z")); + Response response = client.CreateOrReplace("sampleAccountId_00000000-0000-0000-0000-000000000000", Guid.Parse("00000000-0000-0000-0000-000000000000"), resource); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_AccessToken_CreateOrReplace_AccessTokensCreateOrReplace_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + AccessTokens client = new AuthManagerClient(endpoint, credential).GetAccessTokensClient(apiVersion: "2024-12-01"); + + AccessToken resource = new AccessToken("sampleAccessToken", DateTimeOffset.Parse("2022-09-28T12:32:33Z")); + Response response = await client.CreateOrReplaceAsync("sampleAccountId_00000000-0000-0000-0000-000000000000", Guid.Parse("00000000-0000-0000-0000-000000000000"), resource); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_AccessToken_GetAccessToken_AccessTokensGet() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + AccessTokens client = new AuthManagerClient(endpoint, credential).GetAccessTokensClient(apiVersion: "2024-12-01"); + + Response response = client.GetAccessToken("sampleAccountId_00000000-0000-0000-0000-000000000000", Guid.Parse("00000000-0000-0000-0000-000000000000"), null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("createdAt").ToString()); + Console.WriteLine(result.GetProperty("expiryAt").ToString()); + Console.WriteLine(result.GetProperty("state").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_AccessToken_GetAccessToken_AccessTokensGet_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + AccessTokens client = new AuthManagerClient(endpoint, credential).GetAccessTokensClient(apiVersion: "2024-12-01"); + + Response response = await client.GetAccessTokenAsync("sampleAccountId_00000000-0000-0000-0000-000000000000", Guid.Parse("00000000-0000-0000-0000-000000000000"), null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("createdAt").ToString()); + Console.WriteLine(result.GetProperty("expiryAt").ToString()); + Console.WriteLine(result.GetProperty("state").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_AccessToken_GetAccessToken_AccessTokensGet_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + AccessTokens client = new AuthManagerClient(endpoint, credential).GetAccessTokensClient(apiVersion: "2024-12-01"); + + Response response = client.GetAccessToken("sampleAccountId_00000000-0000-0000-0000-000000000000", Guid.Parse("00000000-0000-0000-0000-000000000000")); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_AccessToken_GetAccessToken_AccessTokensGet_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + AccessTokens client = new AuthManagerClient(endpoint, credential).GetAccessTokensClient(apiVersion: "2024-12-01"); + + Response response = await client.GetAccessTokenAsync("sampleAccountId_00000000-0000-0000-0000-000000000000", Guid.Parse("00000000-0000-0000-0000-000000000000")); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_AccessToken_Delete_AccessTokensDelete() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + AccessTokens client = new AuthManagerClient(endpoint, credential).GetAccessTokensClient(apiVersion: "2024-12-01"); + + Response response = client.Delete("sampleAccountId_00000000-0000-0000-0000-000000000000", Guid.Parse("00000000-0000-0000-0000-000000000000")); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_AccessToken_Delete_AccessTokensDelete_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + AccessTokens client = new AuthManagerClient(endpoint, credential).GetAccessTokensClient(apiVersion: "2024-12-01"); + + Response response = await client.DeleteAsync("sampleAccountId_00000000-0000-0000-0000-000000000000", Guid.Parse("00000000-0000-0000-0000-000000000000")); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_AccessToken_GetAccessTokens_AccessTokensList() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + AccessTokens client = new AuthManagerClient(endpoint, credential).GetAccessTokensClient(apiVersion: "2024-12-01"); + + foreach (BinaryData item in client.GetAccessTokens("sampleAccountId_00000000-0000-0000-0000-000000000000", null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("createdAt").ToString()); + Console.WriteLine(result.GetProperty("expiryAt").ToString()); + Console.WriteLine(result.GetProperty("state").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_AccessToken_GetAccessTokens_AccessTokensList_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + AccessTokens client = new AuthManagerClient(endpoint, credential).GetAccessTokensClient(apiVersion: "2024-12-01"); + + await foreach (BinaryData item in client.GetAccessTokensAsync("sampleAccountId_00000000-0000-0000-0000-000000000000", null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("createdAt").ToString()); + Console.WriteLine(result.GetProperty("expiryAt").ToString()); + Console.WriteLine(result.GetProperty("state").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_AccessToken_GetAccessTokens_AccessTokensList_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + AccessTokens client = new AuthManagerClient(endpoint, credential).GetAccessTokensClient(apiVersion: "2024-12-01"); + + foreach (AccessToken item in client.GetAccessTokens("sampleAccountId_00000000-0000-0000-0000-000000000000")) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_AccessToken_GetAccessTokens_AccessTokensList_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + AccessTokens client = new AuthManagerClient(endpoint, credential).GetAccessTokensClient(apiVersion: "2024-12-01"); + + await foreach (AccessToken item in client.GetAccessTokensAsync("sampleAccountId_00000000-0000-0000-0000-000000000000")) + { + } + } + } +} diff --git a/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/tests/Generated/Samples/Samples_Accounts.cs b/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/tests/Generated/Samples/Samples_Accounts.cs new file mode 100644 index 000000000000..774f29c21146 --- /dev/null +++ b/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/tests/Generated/Samples/Samples_Accounts.cs @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using NUnit.Framework; + +namespace Azure.Developer.MicrosoftPlaywrightTesting.Samples +{ + public partial class Samples_Accounts + { + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Account_GetAccount_AccountsGet() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + Accounts client = new AuthManagerClient(endpoint, credential).GetAccountsClient(apiVersion: "2024-12-01"); + + Response response = client.GetAccount("sampleAccountId_00000000-0000-0000-0000-000000000000", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("resourceId").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("state").ToString()); + Console.WriteLine(result.GetProperty("subscriptionId").ToString()); + Console.WriteLine(result.GetProperty("subscriptionState").ToString()); + Console.WriteLine(result.GetProperty("tenantId").ToString()); + Console.WriteLine(result.GetProperty("location").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Account_GetAccount_AccountsGet_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + Accounts client = new AuthManagerClient(endpoint, credential).GetAccountsClient(apiVersion: "2024-12-01"); + + Response response = await client.GetAccountAsync("sampleAccountId_00000000-0000-0000-0000-000000000000", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("resourceId").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("state").ToString()); + Console.WriteLine(result.GetProperty("subscriptionId").ToString()); + Console.WriteLine(result.GetProperty("subscriptionState").ToString()); + Console.WriteLine(result.GetProperty("tenantId").ToString()); + Console.WriteLine(result.GetProperty("location").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Account_GetAccount_AccountsGet_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + Accounts client = new AuthManagerClient(endpoint, credential).GetAccountsClient(apiVersion: "2024-12-01"); + + Response response = client.GetAccount("sampleAccountId_00000000-0000-0000-0000-000000000000"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Account_GetAccount_AccountsGet_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + Accounts client = new AuthManagerClient(endpoint, credential).GetAccountsClient(apiVersion: "2024-12-01"); + + Response response = await client.GetAccountAsync("sampleAccountId_00000000-0000-0000-0000-000000000000"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Accounts_GetBrowsers_AccountsGetBrowsers() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + Accounts client = new AuthManagerClient(endpoint, credential).GetAccountsClient(apiVersion: "2024-12-01"); + + Response response = client.GetBrowsers("sampleAccountId_00000000-0000-0000-0000-000000000000", null, "Linux", null); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Accounts_GetBrowsers_AccountsGetBrowsers_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + Accounts client = new AuthManagerClient(endpoint, credential).GetAccountsClient(apiVersion: "2024-12-01"); + + Response response = await client.GetBrowsersAsync("sampleAccountId_00000000-0000-0000-0000-000000000000", null, "Linux", null); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Accounts_GetBrowsers_AccountsGetBrowsers_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + Accounts client = new AuthManagerClient(endpoint, credential).GetAccountsClient(apiVersion: "2024-12-01"); + + Response response = client.GetBrowsers("sampleAccountId_00000000-0000-0000-0000-000000000000"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Accounts_GetBrowsers_AccountsGetBrowsers_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + Accounts client = new AuthManagerClient(endpoint, credential).GetAccountsClient(apiVersion: "2024-12-01"); + + Response response = await client.GetBrowsersAsync("sampleAccountId_00000000-0000-0000-0000-000000000000"); + } + } +} diff --git a/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/tsp-location.yaml b/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/tsp-location.yaml new file mode 100644 index 000000000000..0cffaba7cae1 --- /dev/null +++ b/sdk/playwrighttesting/Azure.Developer.MicrosoftPlaywrightTesting/tsp-location.yaml @@ -0,0 +1,5 @@ +directory: specification/playwrighttesting/PlaywrightTesting.AuthManager +commit: e5eca2279ea7f0cf8c93e7c543ffc033a18e5f7f +repo: Azure/azure-rest-api-specs +additionalDirectories: +- specification/playwrighttesting/PlaywrightTesting.Shared