diff --git a/eng/testProjects.json b/eng/testProjects.json index 02da03a8e4d..9bdc06a11e6 100644 --- a/eng/testProjects.json +++ b/eng/testProjects.json @@ -18,6 +18,8 @@ "authentication/oauth2", "authentication/union", "azure/core/basic", + "azure/core/lro/rpc-legacy", + "azure/core/lro/standard", "azure/core/traits", "azure/client-generator-core/access", "azure/client-generator-core/usage", diff --git a/src/AutoRest.CSharp/LowLevel/Output/OperationMethodChainBuilder.cs b/src/AutoRest.CSharp/LowLevel/Output/OperationMethodChainBuilder.cs index f8a309a206a..202eadfc35d 100644 --- a/src/AutoRest.CSharp/LowLevel/Output/OperationMethodChainBuilder.cs +++ b/src/AutoRest.CSharp/LowLevel/Output/OperationMethodChainBuilder.cs @@ -105,7 +105,7 @@ public LowLevelClientMethod BuildOperationMethodChain() var diagnostic = new Diagnostic($"{_clientName}.{_restClientMethod.Name}"); var requestBodyType = Operation.Parameters.FirstOrDefault(p => p.Location == RequestLocation.Body)?.Type; - var responseBodyType = Operation.Responses.FirstOrDefault()?.BodyType; + var responseBodyType = GetReturnedResponseInputType(); // samples will build below var samples = new List(); @@ -255,16 +255,7 @@ private bool IsParameterTypeSame(Parameter? first, Parameter? second) private ReturnTypeChain BuildReturnTypes() { - var operationBodyTypes = Operation.Responses.Where(r => !r.IsErrorResponse).Select(r => r.BodyType).Distinct().ToArray(); - CSharpType? responseType = null; - if (operationBodyTypes.Length != 0) - { - var firstBodyType = operationBodyTypes[0]; - if (firstBodyType != null) - { - responseType = TypeFactory.GetOutputType(_typeFactory.CreateType(firstBodyType)); - } - }; + CSharpType? responseType = GetReturnedResponseCSharpType(); if (Operation.Paging != null) { @@ -322,6 +313,32 @@ private ReturnTypeChain BuildReturnTypes() return new ReturnTypeChain(typeof(Response), typeof(Response), null); } + private CSharpType? GetReturnedResponseCSharpType() + { + var inputType = GetReturnedResponseInputType(); + if (inputType != null) + { + return TypeFactory.GetOutputType(_typeFactory.CreateType(inputType)); + } + return null; + } + + private InputType? GetReturnedResponseInputType() + { + if (Operation.LongRunning != null) + { + return Operation.LongRunning.FinalResponse.BodyType; + } + + var operationBodyTypes = Operation.Responses.Where(r => !r.IsErrorResponse).Select(r => r.BodyType).Distinct(); + if (operationBodyTypes.Any()) + { + return operationBodyTypes.First(); + } + + return null; + } + private ConvenienceMethod? BuildConvenienceMethod(bool shouldRequestContextOptional, ConvenienceMethodGenerationInfo generationInfo) { if (!generationInfo.IsConvenienceMethodGenerated) diff --git a/src/AutoRest.CSharp/Properties/launchSettings.json b/src/AutoRest.CSharp/Properties/launchSettings.json index 8dc6b1ee339..44480c8e326 100644 --- a/src/AutoRest.CSharp/Properties/launchSettings.json +++ b/src/AutoRest.CSharp/Properties/launchSettings.json @@ -308,10 +308,6 @@ "commandName": "Project", "commandLineArgs": "--standalone $(SolutionDir)\\test\\TestServerProjects\\lro\\Generated" }, - "Lro-Basic-TypeSpec": { - "commandName": "Project", - "commandLineArgs": "--standalone $(SolutionDir)\\test\\TestProjects\\Lro-Basic-TypeSpec\\src\\Generated -n" - }, "lro-LowLevel": { "commandName": "Project", "commandLineArgs": "--standalone $(SolutionDir)\\test\\TestServerProjectsLowLevel\\lro\\src\\Generated" @@ -636,6 +632,14 @@ "commandName": "Project", "commandLineArgs": "--standalone $(SolutionDir)\\test\\CadlRanchProjects\\azure\\core\\basic\\src\\Generated -n" }, + "typespec-azure/core/lro/rpc-legacy": { + "commandName": "Project", + "commandLineArgs": "--standalone $(SolutionDir)\\test\\CadlRanchProjects\\azure\\core\\lro\\rpc-legacy\\src\\Generated -n" + }, + "typespec-azure/core/lro/standard": { + "commandName": "Project", + "commandLineArgs": "--standalone $(SolutionDir)\\test\\CadlRanchProjects\\azure\\core\\lro\\standard\\src\\Generated -n" + }, "typespec-azure/core/traits": { "commandName": "Project", "commandLineArgs": "--standalone $(SolutionDir)\\test\\CadlRanchProjects\\azure\\core\\traits\\src\\Generated -n" diff --git a/src/TypeSpec.Extension/Emitter.Csharp/src/lib/operation.ts b/src/TypeSpec.Extension/Emitter.Csharp/src/lib/operation.ts index 0b242f2138c..9d333beea31 100644 --- a/src/TypeSpec.Extension/Emitter.Csharp/src/lib/operation.ts +++ b/src/TypeSpec.Extension/Emitter.Csharp/src/lib/operation.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -import { getOperationLink } from "@azure-tools/typespec-azure-core"; +import { getLroMetadata } from "@azure-tools/typespec-azure-core"; import { createSdkContext, isApiVersion, @@ -44,7 +44,7 @@ import { isInputLiteralType, isInputUnionType } from "../type/inputType.js"; -import { OperationFinalStateVia } from "../type/operationFinalStateVia.js"; +import { convertLroFinalStateVia } from "../type/operationFinalStateVia.js"; import { OperationLongRunning } from "../type/operationLongRunning.js"; import { OperationPaging } from "../type/operationPaging.js"; import { OperationResponse } from "../type/operationResponse.js"; @@ -379,54 +379,30 @@ export function loadOperation( op: HttpOperation, resourceOperation?: ResourceOperation ): OperationLongRunning | undefined { - if (!isLongRunningOperation(context, op.operation)) return undefined; - - const finalResponse = loadLongRunningFinalResponse( - context, - op, - resourceOperation - ); - if (finalResponse === undefined) return undefined; - - return { - FinalStateVia: OperationFinalStateVia.Location, // data plane only supports `location` - FinalResponse: finalResponse - } as OperationLongRunning; - } - - function loadLongRunningFinalResponse( - context: SdkContext, - op: HttpOperation, - resourceOperation?: ResourceOperation - ): OperationResponse | undefined { - let finalResponse: any | undefined; - for (const response of op.responses) { - if (response.statusCode === "200") { - finalResponse = response; - break; - } - if (response.statusCode === "204") { - finalResponse = response; - } + const metadata = getLroMetadata(program, op.operation); + if (metadata === undefined) { + return undefined; } - if (finalResponse !== undefined) { - return loadOperationResponse( - context, - finalResponse, - resourceOperation + var bodyType = undefined; + if (op.verb !== "delete") { + const formattedType = getFormattedType( + program, + metadata.logicalResult ); + bodyType = getInputType(context, formattedType, models, enums); } - return loadOperationResponse( - context, - op.responses[0], - resourceOperation - ); - } - - function isLongRunningOperation(context: SdkContext, op: Operation) { - return getOperationLink(context.program, op, "polling") !== undefined; + return { + FinalStateVia: convertLroFinalStateVia(metadata.finalStateVia), + FinalResponse: { + // in swagger, we allow delete to return some meaningful body content + // for now, let assume we don't allow return type + StatusCodes: op.verb === "delete" ? [204] : [200], + BodyType: bodyType, + BodyMediaType: BodyMediaType.Json + } as OperationResponse + } as OperationLongRunning; } } diff --git a/src/TypeSpec.Extension/Emitter.Csharp/src/type/operationFinalStateVia.ts b/src/TypeSpec.Extension/Emitter.Csharp/src/type/operationFinalStateVia.ts index f81c7e944b1..37fac2dd355 100644 --- a/src/TypeSpec.Extension/Emitter.Csharp/src/type/operationFinalStateVia.ts +++ b/src/TypeSpec.Extension/Emitter.Csharp/src/type/operationFinalStateVia.ts @@ -1,8 +1,38 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. +import { FinalStateValue } from "@azure-tools/typespec-azure-core"; export enum OperationFinalStateVia { AzureAsyncOperation, Location, - OriginalUri + OriginalUri, + OperationLocation, + CustomLink, + CustomOperationReference +} + +export function convertLroFinalStateVia( + finalStateValue: FinalStateValue +): OperationFinalStateVia { + switch (finalStateValue) { + case FinalStateValue.azureAsyncOperation: + return OperationFinalStateVia.AzureAsyncOperation; + // TODO: we don't have implementation of custom-link and custom-operation-reference yet + // case FinalStateValue.customLink: + // return OperationFinalStateVia.CustomLink; + + // And right now some existing API specs are not correctly defined so that they are parsed + // into `custom-operation-reference` which should be `operation-location`. + // so let's fallback `custom-operation-reference` into `operation-location` as a work-around + case FinalStateValue.customOperationReference: + return OperationFinalStateVia.OperationLocation; + case FinalStateValue.location: + return OperationFinalStateVia.Location; + case FinalStateValue.originalUri: + return OperationFinalStateVia.OriginalUri; + case FinalStateValue.operationLocation: + return OperationFinalStateVia.OperationLocation; + default: + throw `Unsupported LRO final state value: ${finalStateValue}`; + } } diff --git a/src/TypeSpec.Extension/Emitter.Csharp/test/TestProjects/lro/Generated/tspCodeModel.json b/src/TypeSpec.Extension/Emitter.Csharp/test/TestProjects/lro/Generated/tspCodeModel.json index 68998d7b615..aebbc11d561 100644 --- a/src/TypeSpec.Extension/Emitter.Csharp/test/TestProjects/lro/Generated/tspCodeModel.json +++ b/src/TypeSpec.Extension/Emitter.Csharp/test/TestProjects/lro/Generated/tspCodeModel.json @@ -281,12 +281,26 @@ "application/merge-patch+json" ], "BufferResponse": true, + "LongRunning": { + "$id": "33", + "FinalStateVia": 3, + "FinalResponse": { + "$id": "34", + "StatusCodes": [ + 200 + ], + "BodyType": { + "$ref": "2" + }, + "BodyMediaType": "Json" + } + }, "GenerateProtocolMethod": true, "GenerateConvenienceMethod": false } ], "Protocol": { - "$id": "33" + "$id": "35" }, "Creatable": true } diff --git a/src/TypeSpec.Extension/Emitter.Csharp/test/Unit/operationFinalStateVia.test.ts b/src/TypeSpec.Extension/Emitter.Csharp/test/Unit/operationFinalStateVia.test.ts new file mode 100644 index 00000000000..310c209eec4 --- /dev/null +++ b/src/TypeSpec.Extension/Emitter.Csharp/test/Unit/operationFinalStateVia.test.ts @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +import { FinalStateValue } from "@azure-tools/typespec-azure-core"; +import { + OperationFinalStateVia, + convertLroFinalStateVia +} from "../../src/type/operationFinalStateVia.js"; +import assert from "assert"; +import { describe } from "mocha"; + +describe("convertLroFinalStateVia()", () => { + describe("normal inputs", () => { + const mappings: [FinalStateValue, OperationFinalStateVia][] = [ + [ + FinalStateValue.azureAsyncOperation, + OperationFinalStateVia.AzureAsyncOperation + ], + [FinalStateValue.location, OperationFinalStateVia.Location], + [FinalStateValue.originalUri, OperationFinalStateVia.OriginalUri], + [ + FinalStateValue.operationLocation, + OperationFinalStateVia.OperationLocation + ] + ]; + for (const [input, output] of mappings) { + it(`should return '${output}' for '${input}'`, function () { + assert.equal(convertLroFinalStateVia(input), output); + }); + } + }); + + describe("unsupported inputs", () => { + const unsupportedInputs = [FinalStateValue.customLink]; + for (const input of unsupportedInputs) { + it(`should throw exception for unsupported input '${input}'`, function () { + assert.throws( + () => convertLroFinalStateVia(input), + new RegExp(`Unsupported LRO final state value: ${input}`) + ); + }); + } + }); +}); diff --git a/test/CadlRanchProjects.Tests/Lro-Basic-TypeSpec.cs b/test/CadlRanchProjects.Tests/Lro-Basic-TypeSpec.cs deleted file mode 100644 index 26fb4393c8b..00000000000 --- a/test/CadlRanchProjects.Tests/Lro-Basic-TypeSpec.cs +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System.Threading.Tasks; -using AutoRest.TestServer.Tests.Infrastructure; -using LroBasicTypeSpec; -using NUnit.Framework; -using Azure; -using LroBasicTypeSpec.Models; -using System.Net; - -namespace CadlRanchProjects.Tests -{ - /// - /// End-to-end test cases for `Lro-Basic-TypeSpec` test project. - /// - public class LroBasicTypeSpecTests : CadlRanchMockApiTestBase - { - [Test] - public Task LroBasic_CreateProject() => Test(async (host) => - { - Project project = new(null, "foo", "bar"); - var operation = await new LroBasicTypeSpecClient(host).CreateProjectAsync(WaitUntil.Completed, project); - Assert.IsTrue(operation.HasCompleted); - Assert.AreEqual((int)HttpStatusCode.OK, operation.GetRawResponse().Status); - }); - - [Test] - public Task LroBasic_CreateProjectWaitForCompletion() => Test(async (host) => - { - Project project = new(null, "foo", "bar"); - var operation = await new LroBasicTypeSpecClient(host).CreateProjectAsync(WaitUntil.Started, project); - Assert.IsFalse(operation.HasCompleted); - Assert.AreEqual(((int)HttpStatusCode.Accepted), operation.GetRawResponse().Status); - - await operation.WaitForCompletionResponseAsync(); - Assert.IsTrue(operation.HasCompleted); - Assert.AreEqual((int)HttpStatusCode.OK, operation.GetRawResponse().Status); - }); - - [Test] - public Task LroBasic_UpdateProject() => Test(async (host) => - { - Project project = new("123", "test", "test"); - var operation = await new LroBasicTypeSpecClient(host).UpdateProjectAsync(WaitUntil.Started, "123", project); - await operation.WaitForCompletionResponseAsync(); - Assert.IsTrue(operation.HasCompleted); - Assert.AreEqual((int)HttpStatusCode.OK, operation.GetRawResponse().Status); - var result = operation.Value; - Assert.AreEqual(project.Id, result.Id); - Assert.AreEqual(project.Name, result.Name); - Assert.AreEqual(project.Description, result.Description); - }); - - [Test] - public Task LroBasic_UpdateProjectWaitForCompletion() => Test(async (host) => - { - Project project = new("123", "test", "test"); - var operation = await new LroBasicTypeSpecClient(host).UpdateProjectAsync(WaitUntil.Started, "123", project); - Assert.IsFalse(operation.HasCompleted); - Assert.AreEqual(((int)HttpStatusCode.Created), operation.GetRawResponse().Status); - - await operation.WaitForCompletionResponseAsync(); - Assert.IsTrue(operation.HasCompleted); - Assert.AreEqual((int)HttpStatusCode.OK, operation.GetRawResponse().Status); - - var result = operation.Value; - Assert.AreEqual(project.Id, result.Id); - Assert.AreEqual(project.Name, result.Name); - Assert.AreEqual(project.Description, result.Description); - }); - } -} diff --git a/test/CadlRanchProjects.Tests/lro/rpc-legacy.cs b/test/CadlRanchProjects.Tests/lro/rpc-legacy.cs new file mode 100644 index 00000000000..7b4938ebbc7 --- /dev/null +++ b/test/CadlRanchProjects.Tests/lro/rpc-legacy.cs @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Xml; +using AutoRest.TestServer.Tests.Infrastructure; +using Azure; +using Azure.Core; +using NUnit.Framework; +using _Azure.Lro.RpcLegacy; +using _Azure.Lro.RpcLegacy.Models; +using System.Net; + +namespace CadlRanchProjects.Tests +{ + public class LroRpcLegacyTests : CadlRanchTestBase + { + [Test] + public Task CreateOrReplace() => Test(async (host) => + { + var operation = await new LegacyClient(host, null).CreateJobAsync(WaitUntil.Completed, new JobData("async job")); + var result = operation.Value; + + Assert.AreEqual("job1", result.JobId); + Assert.AreEqual("async job", result.Comment); + Assert.AreEqual(JobStatus.Succeeded, result.Status); + Assert.AreEqual(new List{"job1 result"}, result.Results); + }); + } +} diff --git a/test/CadlRanchProjects.Tests/lro/standard.cs b/test/CadlRanchProjects.Tests/lro/standard.cs new file mode 100644 index 00000000000..2a22abc50bf --- /dev/null +++ b/test/CadlRanchProjects.Tests/lro/standard.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Xml; +using AutoRest.TestServer.Tests.Infrastructure; +using Azure; +using Azure.Core; +using NUnit.Framework; +using _Azure.Lro.Standard; +using _Azure.Lro.Standard.Models; +using System.Net; + +namespace CadlRanchProjects.Tests +{ + public class LroStandardTests : CadlRanchTestBase + { + [Test] + public Task CreateOrReplace() => Test(async (host) => + { + var operation = await new StandardClient(host, null).CreateOrReplaceAsync(WaitUntil.Completed, "madge", new User("contributor")); + var user = operation.Value; + + Assert.AreEqual("madge", user.Name); + Assert.AreEqual("contributor", user.Role); + }); + + [Test] + public Task Delete() => Test(async (host) => + { + var operation = await new StandardClient(host, null).DeleteAsync(WaitUntil.Completed, "madge"); + + Assert.IsTrue(operation.HasCompleted); + Assert.AreEqual(((int)HttpStatusCode.OK), operation.GetRawResponse().Status); + }); + + [Test] + public Task Action() => Test(async (host) => + { + var operation = await new StandardClient(host, null).ExportAsync(WaitUntil.Completed, "madge", "json"); + Assert.IsTrue(operation.HasCompleted); + // TODO: support model properties + }); + } +} diff --git a/test/CadlRanchProjects/azure/core/lro/rpc-legacy/_Azure.Lro.RpcLegacy.sln b/test/CadlRanchProjects/azure/core/lro/rpc-legacy/_Azure.Lro.RpcLegacy.sln new file mode 100644 index 00000000000..01b8812794c --- /dev/null +++ b/test/CadlRanchProjects/azure/core/lro/rpc-legacy/_Azure.Lro.RpcLegacy.sln @@ -0,0 +1,50 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29709.97 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "_Azure.Lro.RpcLegacy", "src\_Azure.Lro.RpcLegacy.csproj", "{28FF4005-4467-4E36-92E7-DEA27DEB1519}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "_Azure.Lro.RpcLegacy.Tests", "tests\_Azure.Lro.RpcLegacy.Tests.csproj", "{1F1CD1D4-9932-4B73-99D8-C252A67D4B46}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Release|Any CPU.Build.0 = Release|Any CPU + {8E9A77AC-792A-4432-8320-ACFD46730401}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8E9A77AC-792A-4432-8320-ACFD46730401}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8E9A77AC-792A-4432-8320-ACFD46730401}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8E9A77AC-792A-4432-8320-ACFD46730401}.Release|Any CPU.Build.0 = Release|Any CPU + {A4241C1F-A53D-474C-9E4E-075054407E74}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A4241C1F-A53D-474C-9E4E-075054407E74}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A4241C1F-A53D-474C-9E4E-075054407E74}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A4241C1F-A53D-474C-9E4E-075054407E74}.Release|Any CPU.Build.0 = Release|Any CPU + {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Release|Any CPU.Build.0 = Release|Any CPU + {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Release|Any CPU.Build.0 = Release|Any CPU + {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Debug|Any CPU.Build.0 = Debug|Any CPU + {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Release|Any CPU.ActiveCfg = Release|Any CPU + {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Release|Any CPU.Build.0 = Release|Any CPU + {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {A97F4B90-2591-4689-B1F8-5F21FE6D6CAE} + EndGlobalSection +EndGlobal diff --git a/test/CadlRanchProjects/azure/core/lro/rpc-legacy/src/Generated/AzureLroRpcLegacyClientBuilderExtensions.cs b/test/CadlRanchProjects/azure/core/lro/rpc-legacy/src/Generated/AzureLroRpcLegacyClientBuilderExtensions.cs new file mode 100644 index 00000000000..23b5ef63cc8 --- /dev/null +++ b/test/CadlRanchProjects/azure/core/lro/rpc-legacy/src/Generated/AzureLroRpcLegacyClientBuilderExtensions.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.Lro.RpcLegacy; + +namespace Microsoft.Extensions.Azure +{ + /// Extension methods to add to client builder. + public static partial class AzureLroRpcLegacyClientBuilderExtensions + { + /// Registers a instance. + /// The builder to register with. + /// TestServer endpoint. + public static IAzureClientBuilder AddLegacyClient(this TBuilder builder, Uri endpoint) + where TBuilder : IAzureClientFactoryBuilder + { + return builder.RegisterClientFactory((options) => new LegacyClient(endpoint, options)); + } + + /// Registers a instance. + /// The builder to register with. + /// The configuration values. + public static IAzureClientBuilder AddLegacyClient(this TBuilder builder, TConfiguration configuration) + where TBuilder : IAzureClientFactoryBuilderWithConfiguration + { + return builder.RegisterClientFactory(configuration); + } + } +} diff --git a/test/CadlRanchProjects/azure/core/lro/rpc-legacy/src/Generated/AzureLroRpcLegacyModelFactory.cs b/test/CadlRanchProjects/azure/core/lro/rpc-legacy/src/Generated/AzureLroRpcLegacyModelFactory.cs new file mode 100644 index 00000000000..1b50d152959 --- /dev/null +++ b/test/CadlRanchProjects/azure/core/lro/rpc-legacy/src/Generated/AzureLroRpcLegacyModelFactory.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; +using Azure; + +namespace _Azure.Lro.RpcLegacy.Models +{ + /// Model factory for models. + public static partial class AzureLroRpcLegacyModelFactory + { + /// Initializes a new instance of JobResult. + /// A processing job identifier. + /// Comment. + /// The status of the processing job. + /// Error objects that describes the error when status is "Failed". + /// The results. + /// A new instance for mocking. + public static JobResult JobResult(string jobId = null, string comment = null, JobStatus status = default, IEnumerable errors = null, IEnumerable results = null) + { + errors ??= new List(); + results ??= new List(); + + return new JobResult(jobId, comment, status, errors?.ToList(), results?.ToList()); + } + + /// Initializes a new instance of ErrorResponse. + /// The error object. + /// is null. + /// A new instance for mocking. + public static ErrorResponse ErrorResponse(ResponseError error = null) + { + if (error == null) + { + throw new ArgumentNullException(nameof(error)); + } + + return new ErrorResponse(error); + } + } +} diff --git a/test/CadlRanchProjects/azure/core/lro/rpc-legacy/src/Generated/Configuration.json b/test/CadlRanchProjects/azure/core/lro/rpc-legacy/src/Generated/Configuration.json new file mode 100644 index 00000000000..a6207ce5cd7 --- /dev/null +++ b/test/CadlRanchProjects/azure/core/lro/rpc-legacy/src/Generated/Configuration.json @@ -0,0 +1,10 @@ +{ + "output-folder": ".", + "namespace": "_Azure.Lro.RpcLegacy", + "library-name": "_Azure.Lro.RpcLegacy", + "shared-source-folders": [ + "../../../../../../../../artifacts/bin/AutoRest.CSharp/Debug/net6.0/Generator.Shared", + "../../../../../../../../artifacts/bin/AutoRest.CSharp/Debug/net6.0/Azure.Core.Shared" + ], + "use-overloads-between-protocol-and-convenience": true +} diff --git a/test/CadlRanchProjects/azure/core/lro/rpc-legacy/src/Generated/Docs/LegacyClient.xml b/test/CadlRanchProjects/azure/core/lro/rpc-legacy/src/Generated/Docs/LegacyClient.xml new file mode 100644 index 00000000000..6b34d24a7ca --- /dev/null +++ b/test/CadlRanchProjects/azure/core/lro/rpc-legacy/src/Generated/Docs/LegacyClient.xml @@ -0,0 +1,123 @@ + + + + + +This sample shows how to call CreateJobAsync. +"); +Operation operation = await client.CreateJobAsync(WaitUntil.Completed, jobData); +JobResult responseData = operation.Value; +]]> +This sample shows how to call CreateJobAsync with all parameters. +"); +Operation operation = await client.CreateJobAsync(WaitUntil.Completed, jobData); +JobResult responseData = operation.Value; +]]> + + + +This sample shows how to call CreateJob. +"); +Operation operation = client.CreateJob(WaitUntil.Completed, jobData); +JobResult responseData = operation.Value; +]]> +This sample shows how to call CreateJob with all parameters. +"); +Operation operation = client.CreateJob(WaitUntil.Completed, jobData); +JobResult responseData = operation.Value; +]]> + + + +This sample shows how to call CreateJobAsync and parse the result. +", +}); +Operation operation = await client.CreateJobAsync(WaitUntil.Completed, content); +BinaryData responseData = operation.Value; + +JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; +Console.WriteLine(result.GetProperty("jobId").ToString()); +Console.WriteLine(result.GetProperty("comment").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +]]> +This sample shows how to call CreateJobAsync with all parameters and request content and parse the result. +", +}); +Operation operation = await client.CreateJobAsync(WaitUntil.Completed, content); +BinaryData responseData = operation.Value; + +JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; +Console.WriteLine(result.GetProperty("jobId").ToString()); +Console.WriteLine(result.GetProperty("comment").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("errors")[0].GetProperty("error").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("errors")[0].GetProperty("error").GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("errors")[0].GetProperty("error").GetProperty("target").ToString()); +Console.WriteLine(result.GetProperty("errors")[0].GetProperty("error").GetProperty("innererror").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("results")[0].ToString()); +]]> + + + +This sample shows how to call CreateJob and parse the result. +", +}); +Operation operation = client.CreateJob(WaitUntil.Completed, content); +BinaryData responseData = operation.Value; + +JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; +Console.WriteLine(result.GetProperty("jobId").ToString()); +Console.WriteLine(result.GetProperty("comment").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +]]> +This sample shows how to call CreateJob with all parameters and request content and parse the result. +", +}); +Operation operation = client.CreateJob(WaitUntil.Completed, content); +BinaryData responseData = operation.Value; + +JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; +Console.WriteLine(result.GetProperty("jobId").ToString()); +Console.WriteLine(result.GetProperty("comment").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("errors")[0].GetProperty("error").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("errors")[0].GetProperty("error").GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("errors")[0].GetProperty("error").GetProperty("target").ToString()); +Console.WriteLine(result.GetProperty("errors")[0].GetProperty("error").GetProperty("innererror").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("results")[0].ToString()); +]]> + + + \ No newline at end of file diff --git a/test/CadlRanchProjects/azure/core/lro/rpc-legacy/src/Generated/LegacyClient.cs b/test/CadlRanchProjects/azure/core/lro/rpc-legacy/src/Generated/LegacyClient.cs new file mode 100644 index 00000000000..7a01c0ea8ae --- /dev/null +++ b/test/CadlRanchProjects/azure/core/lro/rpc-legacy/src/Generated/LegacyClient.cs @@ -0,0 +1,194 @@ +// 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; +using Azure.Core; +using Azure.Core.Pipeline; +using _Azure.Lro.RpcLegacy.Models; + +namespace _Azure.Lro.RpcLegacy +{ + // Data plane generated client. + /// POST to create resource, poll URL via operation-location header. + public partial class LegacyClient + { + 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 LegacyClient. + public LegacyClient() : this(new Uri("http://localhost:3000"), new LegacyClientOptions()) + { + } + + /// Initializes a new instance of LegacyClient. + /// TestServer endpoint. + /// The options for configuring the client. + /// is null. + public LegacyClient(Uri endpoint, LegacyClientOptions options) + { + Argument.AssertNotNull(endpoint, nameof(endpoint)); + options ??= new LegacyClientOptions(); + + ClientDiagnostics = new ClientDiagnostics(options, true); + _pipeline = HttpPipelineBuilder.Build(options, Array.Empty(), Array.Empty(), new ResponseClassifier()); + _endpoint = endpoint; + _apiVersion = options.Version; + } + + /// Creates a Job. + /// 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. + /// Data of the job. + /// The cancellation token to use. + /// is null. + /// + public virtual async Task> CreateJobAsync(WaitUntil waitUntil, JobData jobData, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(jobData, nameof(jobData)); + + RequestContext context = FromCancellationToken(cancellationToken); + using RequestContent content = jobData.ToRequestContent(); + Operation response = await CreateJobAsync(waitUntil, content, context).ConfigureAwait(false); + return ProtocolOperationHelpers.Convert(response, JobResult.FromResponse, ClientDiagnostics, "LegacyClient.CreateJob"); + } + + /// Creates a Job. + /// 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. + /// Data of the job. + /// The cancellation token to use. + /// is null. + /// + public virtual Operation CreateJob(WaitUntil waitUntil, JobData jobData, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(jobData, nameof(jobData)); + + RequestContext context = FromCancellationToken(cancellationToken); + using RequestContent content = jobData.ToRequestContent(); + Operation response = CreateJob(waitUntil, content, context); + return ProtocolOperationHelpers.Convert(response, JobResult.FromResponse, ClientDiagnostics, "LegacyClient.CreateJob"); + } + + /// + /// [Protocol Method] Creates a Job + /// + /// + /// + /// 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 content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The representing an asynchronous operation on the service. + /// + public virtual async Task> CreateJobAsync(WaitUntil waitUntil, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("LegacyClient.CreateJob"); + scope.Start(); + try + { + using HttpMessage message = CreateCreateJobRequest(content, context); + return await ProtocolOperationHelpers.ProcessMessageAsync(_pipeline, message, ClientDiagnostics, "LegacyClient.CreateJob", OperationFinalStateVia.OperationLocation, context, waitUntil).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Creates a Job + /// + /// + /// + /// 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 content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The representing an asynchronous operation on the service. + /// + public virtual Operation CreateJob(WaitUntil waitUntil, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("LegacyClient.CreateJob"); + scope.Start(); + try + { + using HttpMessage message = CreateCreateJobRequest(content, context); + return ProtocolOperationHelpers.ProcessMessage(_pipeline, message, ClientDiagnostics, "LegacyClient.CreateJob", OperationFinalStateVia.OperationLocation, context, waitUntil); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + internal HttpMessage CreateCreateJobRequest(RequestContent content, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200202); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/azure/core/lro/rpc/legacy/create-resource-poll-via-operation-location/jobs", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + return message; + } + + 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 _responseClassifier200202; + private static ResponseClassifier ResponseClassifier200202 => _responseClassifier200202 ??= new StatusCodeClassifier(stackalloc ushort[] { 200, 202 }); + } +} diff --git a/test/TestProjects/Lro-Basic-TypeSpec/src/Generated/LroBasicTypeSpecClientOptions.cs b/test/CadlRanchProjects/azure/core/lro/rpc-legacy/src/Generated/LegacyClientOptions.cs similarity index 50% rename from test/TestProjects/Lro-Basic-TypeSpec/src/Generated/LroBasicTypeSpecClientOptions.cs rename to test/CadlRanchProjects/azure/core/lro/rpc-legacy/src/Generated/LegacyClientOptions.cs index 8d6f29707fa..3d2550fe64e 100644 --- a/test/TestProjects/Lro-Basic-TypeSpec/src/Generated/LroBasicTypeSpecClientOptions.cs +++ b/test/CadlRanchProjects/azure/core/lro/rpc-legacy/src/Generated/LegacyClientOptions.cs @@ -8,28 +8,28 @@ using System; using Azure.Core; -namespace LroBasicTypeSpec +namespace _Azure.Lro.RpcLegacy { - /// Client options for LroBasicTypeSpecClient. - public partial class LroBasicTypeSpecClientOptions : ClientOptions + /// Client options for LegacyClient. + public partial class LegacyClientOptions : ClientOptions { - private const ServiceVersion LatestVersion = ServiceVersion.V2022_05_15_Preview; + private const ServiceVersion LatestVersion = ServiceVersion.V2022_12_01_Preview; /// The version of the service to use. public enum ServiceVersion { - /// Service version "2022-05-15-preview". - V2022_05_15_Preview = 1, + /// Service version "2022-12-01-preview". + V2022_12_01_Preview = 1, } internal string Version { get; } - /// Initializes new instance of LroBasicTypeSpecClientOptions. - public LroBasicTypeSpecClientOptions(ServiceVersion version = LatestVersion) + /// Initializes new instance of LegacyClientOptions. + public LegacyClientOptions(ServiceVersion version = LatestVersion) { Version = version switch { - ServiceVersion.V2022_05_15_Preview => "2022-05-15-preview", + ServiceVersion.V2022_12_01_Preview => "2022-12-01-preview", _ => throw new NotSupportedException() }; } diff --git a/test/CadlRanchProjects/azure/core/lro/rpc-legacy/src/Generated/Models/ErrorResponse.Serialization.cs b/test/CadlRanchProjects/azure/core/lro/rpc-legacy/src/Generated/Models/ErrorResponse.Serialization.cs new file mode 100644 index 00000000000..7d1e1b29b06 --- /dev/null +++ b/test/CadlRanchProjects/azure/core/lro/rpc-legacy/src/Generated/Models/ErrorResponse.Serialization.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure; + +namespace _Azure.Lro.RpcLegacy.Models +{ + public partial class ErrorResponse + { + internal static ErrorResponse DeserializeErrorResponse(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResponseError error = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("error"u8)) + { + error = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + } + return new ErrorResponse(error); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static ErrorResponse FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeErrorResponse(document.RootElement); + } + } +} diff --git a/test/CadlRanchProjects/azure/core/lro/rpc-legacy/src/Generated/Models/ErrorResponse.cs b/test/CadlRanchProjects/azure/core/lro/rpc-legacy/src/Generated/Models/ErrorResponse.cs new file mode 100644 index 00000000000..d9e1328d43b --- /dev/null +++ b/test/CadlRanchProjects/azure/core/lro/rpc-legacy/src/Generated/Models/ErrorResponse.cs @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure; +using Azure.Core; + +namespace _Azure.Lro.RpcLegacy.Models +{ + /// A response containing error details. + public partial class ErrorResponse + { + /// Initializes a new instance of ErrorResponse. + /// The error object. + /// is null. + internal ErrorResponse(ResponseError error) + { + Argument.AssertNotNull(error, nameof(error)); + + Error = error; + } + + /// The error object. + public ResponseError Error { get; } + } +} diff --git a/test/CadlRanchProjects/azure/core/lro/rpc-legacy/src/Generated/Models/JobData.Serialization.cs b/test/CadlRanchProjects/azure/core/lro/rpc-legacy/src/Generated/Models/JobData.Serialization.cs new file mode 100644 index 00000000000..9c9030abb88 --- /dev/null +++ b/test/CadlRanchProjects/azure/core/lro/rpc-legacy/src/Generated/Models/JobData.Serialization.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace _Azure.Lro.RpcLegacy.Models +{ + public partial class JobData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("comment"u8); + writer.WriteStringValue(Comment); + writer.WriteEndObject(); + } + + /// Convert into a Utf8JsonRequestContent. + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/test/CadlRanchProjects/azure/core/lro/rpc-legacy/src/Generated/Models/JobData.cs b/test/CadlRanchProjects/azure/core/lro/rpc-legacy/src/Generated/Models/JobData.cs new file mode 100644 index 00000000000..337419eb1e4 --- /dev/null +++ b/test/CadlRanchProjects/azure/core/lro/rpc-legacy/src/Generated/Models/JobData.cs @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; + +namespace _Azure.Lro.RpcLegacy.Models +{ + /// Data of the job. + public partial class JobData + { + /// Initializes a new instance of JobData. + /// Comment. + /// is null. + public JobData(string comment) + { + Argument.AssertNotNull(comment, nameof(comment)); + + Comment = comment; + } + + /// Comment. + public string Comment { get; } + } +} diff --git a/test/CadlRanchProjects/azure/core/lro/rpc-legacy/src/Generated/Models/JobResult.Serialization.cs b/test/CadlRanchProjects/azure/core/lro/rpc-legacy/src/Generated/Models/JobResult.Serialization.cs new file mode 100644 index 00000000000..97cd6d03596 --- /dev/null +++ b/test/CadlRanchProjects/azure/core/lro/rpc-legacy/src/Generated/Models/JobResult.Serialization.cs @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure; +using Azure.Core; + +namespace _Azure.Lro.RpcLegacy.Models +{ + public partial class JobResult + { + internal static JobResult DeserializeJobResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string jobId = default; + string comment = default; + JobStatus status = default; + Optional> errors = default; + Optional> results = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("jobId"u8)) + { + jobId = property.Value.GetString(); + continue; + } + if (property.NameEquals("comment"u8)) + { + comment = property.Value.GetString(); + continue; + } + if (property.NameEquals("status"u8)) + { + status = new JobStatus(property.Value.GetString()); + continue; + } + if (property.NameEquals("errors"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ErrorResponse.DeserializeErrorResponse(item)); + } + errors = array; + continue; + } + if (property.NameEquals("results"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + results = array; + continue; + } + } + return new JobResult(jobId, comment, status, Optional.ToList(errors), Optional.ToList(results)); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static JobResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeJobResult(document.RootElement); + } + } +} diff --git a/test/CadlRanchProjects/azure/core/lro/rpc-legacy/src/Generated/Models/JobResult.cs b/test/CadlRanchProjects/azure/core/lro/rpc-legacy/src/Generated/Models/JobResult.cs new file mode 100644 index 00000000000..b5abd0f2687 --- /dev/null +++ b/test/CadlRanchProjects/azure/core/lro/rpc-legacy/src/Generated/Models/JobResult.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace _Azure.Lro.RpcLegacy.Models +{ + /// Result of the job. + public partial class JobResult + { + /// Initializes a new instance of JobResult. + internal JobResult() + { + Errors = new ChangeTrackingList(); + Results = new ChangeTrackingList(); + } + + /// Initializes a new instance of JobResult. + /// A processing job identifier. + /// Comment. + /// The status of the processing job. + /// Error objects that describes the error when status is "Failed". + /// The results. + internal JobResult(string jobId, string comment, JobStatus status, IReadOnlyList errors, IReadOnlyList results) + { + JobId = jobId; + Comment = comment; + Status = status; + Errors = errors; + Results = results; + } + + /// A processing job identifier. + public string JobId { get; } + /// Comment. + public string Comment { get; } + /// The status of the processing job. + public JobStatus Status { get; } + /// Error objects that describes the error when status is "Failed". + public IReadOnlyList Errors { get; } + /// The results. + public IReadOnlyList Results { get; } + } +} diff --git a/test/CadlRanchProjects/azure/core/lro/rpc-legacy/src/Generated/Models/JobStatus.cs b/test/CadlRanchProjects/azure/core/lro/rpc-legacy/src/Generated/Models/JobStatus.cs new file mode 100644 index 00000000000..223c8f9002e --- /dev/null +++ b/test/CadlRanchProjects/azure/core/lro/rpc-legacy/src/Generated/Models/JobStatus.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace _Azure.Lro.RpcLegacy.Models +{ + /// The status of the processing job. + public readonly partial struct JobStatus : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public JobStatus(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"; + private const string PartiallyCompletedValue = "partiallyCompleted"; + + /// The operation is not started. + public static JobStatus NotStarted { get; } = new JobStatus(NotStartedValue); + /// The operation is in progress. + public static JobStatus Running { get; } = new JobStatus(RunningValue); + /// The operation has completed successfully. + public static JobStatus Succeeded { get; } = new JobStatus(SucceededValue); + /// The operation has failed. + public static JobStatus Failed { get; } = new JobStatus(FailedValue); + /// The operation has been canceled by the user. + public static JobStatus Canceled { get; } = new JobStatus(CanceledValue); + /// The operation has partially completed. + public static JobStatus PartiallyCompleted { get; } = new JobStatus(PartiallyCompletedValue); + /// Determines if two values are the same. + public static bool operator ==(JobStatus left, JobStatus right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(JobStatus left, JobStatus right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator JobStatus(string value) => new JobStatus(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is JobStatus other && Equals(other); + /// + public bool Equals(JobStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/test/CadlRanchProjects/azure/core/lro/rpc-legacy/src/Generated/tspCodeModel.json b/test/CadlRanchProjects/azure/core/lro/rpc-legacy/src/Generated/tspCodeModel.json new file mode 100644 index 00000000000..acb73555a62 --- /dev/null +++ b/test/CadlRanchProjects/azure/core/lro/rpc-legacy/src/Generated/tspCodeModel.json @@ -0,0 +1,548 @@ +{ + "$id": "1", + "Name": "_Specs_.Azure.Core.Lro.Rpc.Legacy", + "Description": "Illustrates bodies templated with Azure Core with long-running operation", + "ApiVersions": [ + "2022-12-01-preview" + ], + "Enums": [ + { + "$id": "2", + "Name": "JobStatus", + "EnumValueType": "String", + "AllowedValues": [ + { + "$id": "3", + "Name": "NotStarted", + "Value": "notStarted", + "Description": "The operation is not started." + }, + { + "$id": "4", + "Name": "Running", + "Value": "running", + "Description": "The operation is in progress." + }, + { + "$id": "5", + "Name": "Succeeded", + "Value": "succeeded", + "Description": "The operation has completed successfully." + }, + { + "$id": "6", + "Name": "Failed", + "Value": "failed", + "Description": "The operation has failed." + }, + { + "$id": "7", + "Name": "Canceled", + "Value": "canceled", + "Description": "The operation has been canceled by the user." + }, + { + "$id": "8", + "Name": "PartiallyCompleted", + "Value": "partiallyCompleted", + "Description": "The operation has partially completed." + } + ], + "Namespace": "_Specs_.Azure.Core.Lro.Rpc.Legacy", + "Description": "The status of the processing job.", + "IsExtensible": true, + "IsNullable": false, + "Usage": "Output" + }, + { + "$id": "9", + "Name": "Versions", + "EnumValueType": "String", + "AllowedValues": [ + { + "$id": "10", + "Name": "v2022_12_01_preview", + "Value": "2022-12-01-preview", + "Description": "2022-12-01-preview" + } + ], + "Namespace": "_Specs_.Azure.Core.Lro.Rpc.Legacy", + "Description": "Versions of the service", + "IsExtensible": true, + "IsNullable": false, + "Usage": "None" + } + ], + "Models": [ + { + "$id": "11", + "Name": "JobData", + "Namespace": "_Specs_.Azure.Core.Lro.Rpc.Legacy", + "Description": "Data of the job", + "IsNullable": false, + "Usage": "Input", + "Properties": [ + { + "$id": "12", + "Name": "comment", + "SerializedName": "comment", + "Description": "Comment.", + "Type": { + "$id": "13", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + } + ] + }, + { + "$id": "14", + "Name": "JobResult", + "Namespace": "_Specs_.Azure.Core.Lro.Rpc.Legacy", + "Description": "Result of the job", + "IsNullable": false, + "Usage": "Output", + "Properties": [ + { + "$id": "15", + "Name": "jobId", + "SerializedName": "jobId", + "Description": "A processing job identifier.", + "Type": { + "$id": "16", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": true + }, + { + "$id": "17", + "Name": "comment", + "SerializedName": "comment", + "Description": "Comment.", + "Type": { + "$id": "18", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": true + }, + { + "$id": "19", + "Name": "status", + "SerializedName": "status", + "Description": "The status of the processing job.", + "Type": { + "$ref": "2" + }, + "IsRequired": true, + "IsReadOnly": true + }, + { + "$id": "20", + "Name": "errors", + "SerializedName": "errors", + "Description": "Error objects that describes the error when status is \"Failed\".", + "Type": { + "$id": "21", + "Name": "Array", + "ElementType": { + "$id": "22", + "Name": "ErrorResponse", + "Namespace": "Azure.Core.Foundations", + "Description": "A response containing error details.", + "IsNullable": false, + "Usage": "Output", + "Properties": [ + { + "$id": "23", + "Name": "error", + "SerializedName": "error", + "Description": "The error object.", + "Type": { + "$id": "24", + "Name": "Error", + "Namespace": "Azure.Core.Foundations", + "Description": "The error object.", + "IsNullable": false, + "Usage": "Output", + "Properties": [ + { + "$id": "25", + "Name": "code", + "SerializedName": "code", + "Description": "One of a server-defined set of error codes.", + "Type": { + "$id": "26", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "27", + "Name": "message", + "SerializedName": "message", + "Description": "A human-readable representation of the error.", + "Type": { + "$id": "28", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "29", + "Name": "target", + "SerializedName": "target", + "Description": "The target of the error.", + "Type": { + "$id": "30", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "31", + "Name": "details", + "SerializedName": "details", + "Description": "An array of details about specific errors that led to this reported error.", + "Type": { + "$id": "32", + "Name": "Array", + "ElementType": { + "$ref": "24" + }, + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "33", + "Name": "innererror", + "SerializedName": "innererror", + "Description": "An object containing more specific information than the current object about the error.", + "Type": { + "$id": "34", + "Name": "InnerError", + "Namespace": "Azure.Core.Foundations", + "Description": "An object containing more specific information about the error. As per Microsoft One API guidelines - https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses.", + "IsNullable": false, + "Usage": "Output", + "Properties": [ + { + "$id": "35", + "Name": "code", + "SerializedName": "code", + "Description": "One of a server-defined set of error codes.", + "Type": { + "$id": "36", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "37", + "Name": "InnerErrorObject", + "SerializedName": "innererror", + "Description": "Inner error.", + "Type": { + "$ref": "34" + }, + "IsRequired": false, + "IsReadOnly": false + } + ] + }, + "IsRequired": false, + "IsReadOnly": false + } + ] + }, + "IsRequired": true, + "IsReadOnly": false + } + ] + }, + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": true + }, + { + "$id": "38", + "Name": "results", + "SerializedName": "results", + "Description": "The results.", + "Type": { + "$id": "39", + "Name": "Array", + "ElementType": { + "$id": "40", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": true + } + ] + }, + { + "$ref": "22" + }, + { + "$ref": "24" + }, + { + "$ref": "34" + } + ], + "Clients": [ + { + "$id": "41", + "Name": "LegacyClient", + "Description": "POST to create resource, poll URL via operation-location header.", + "Operations": [ + { + "$id": "42", + "Name": "createJob", + "ResourceName": "CreateResourcePollViaOperationLocation", + "Description": "Creates a Job", + "Parameters": [ + { + "$id": "43", + "Name": "host", + "NameInRequest": "host", + "Description": "TestServer endpoint", + "Type": { + "$id": "44", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Location": "Uri", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": true, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Client", + "DefaultValue": { + "$id": "45", + "Type": { + "$id": "46", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Value": "http://localhost:3000" + } + }, + { + "$id": "47", + "Name": "apiVersion", + "NameInRequest": "api-version", + "Description": "", + "Type": { + "$id": "48", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Location": "Query", + "IsRequired": true, + "IsApiVersion": true, + "IsContentType": false, + "IsEndpoint": false, + "IsResourceParameter": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Client", + "DefaultValue": { + "$id": "49", + "Type": { + "$id": "50", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Value": "2022-12-01-preview" + } + }, + { + "$id": "51", + "Name": "JobData", + "NameInRequest": "JobData", + "Description": "Data of the job", + "Type": { + "$ref": "11" + }, + "Location": "Body", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "52", + "Name": "contentType", + "NameInRequest": "Content-Type", + "Type": { + "$id": "53", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": true, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "54", + "Type": { + "$ref": "53" + }, + "Value": "application/json" + } + }, + { + "$id": "55", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "56", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "57", + "Type": { + "$ref": "56" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "58", + "StatusCodes": [ + 202 + ], + "BodyMediaType": "Json", + "Headers": [ + { + "$id": "59", + "Name": "Operation-Location", + "NameInResponse": "operationLocation", + "Description": "The location for monitoring the operation state.", + "Type": { + "$id": "60", + "Name": "ResourceLocation", + "Kind": "Uri", + "IsNullable": false + } + }, + { + "$id": "61", + "Name": "Retry-After", + "NameInResponse": "retryAfter", + "Description": "The Retry-After header can indicate how long the client should wait before polling the operation status.", + "Type": { + "$id": "62", + "Name": "int32", + "Kind": "Int32", + "IsNullable": false + } + } + ], + "IsErrorResponse": false + }, + { + "$id": "63", + "StatusCodes": [ + 200 + ], + "BodyType": { + "$ref": "14" + }, + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false + } + ], + "HttpMethod": "POST", + "RequestBodyMediaType": "Json", + "Uri": "{host}", + "Path": "/azure/core/lro/rpc/legacy/create-resource-poll-via-operation-location/jobs", + "RequestMediaTypes": [ + "application/json" + ], + "BufferResponse": true, + "LongRunning": { + "$id": "64", + "FinalStateVia": 3, + "FinalResponse": { + "$id": "65", + "StatusCodes": [ + 200 + ], + "BodyType": { + "$ref": "14" + }, + "BodyMediaType": "Json" + } + }, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + } + ], + "Protocol": { + "$id": "66" + }, + "Creatable": true + } + ] +} diff --git a/test/CadlRanchProjects/azure/core/lro/rpc-legacy/src/_Azure.Lro.RpcLegacy.csproj b/test/CadlRanchProjects/azure/core/lro/rpc-legacy/src/_Azure.Lro.RpcLegacy.csproj new file mode 100644 index 00000000000..2a6dc8469c6 --- /dev/null +++ b/test/CadlRanchProjects/azure/core/lro/rpc-legacy/src/_Azure.Lro.RpcLegacy.csproj @@ -0,0 +1,20 @@ + + + This is the _Azure.Lro.RpcLegacy client library for developing .NET applications with rich experience. + Azure SDK Code Generation _Azure.Lro.RpcLegacy for Azure Data Plane + 1.0.0-beta.1 + _Azure.Lro.RpcLegacy + $(RequiredTargetFrameworks) + true + + + + + + + + + + + + diff --git a/test/CadlRanchProjects/azure/core/lro/rpc-legacy/tests/Generated/Samples/Samples_LegacyClient.cs b/test/CadlRanchProjects/azure/core/lro/rpc-legacy/tests/Generated/Samples/Samples_LegacyClient.cs new file mode 100644 index 00000000000..5206493d11a --- /dev/null +++ b/test/CadlRanchProjects/azure/core/lro/rpc-legacy/tests/Generated/Samples/Samples_LegacyClient.cs @@ -0,0 +1,152 @@ +// 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; +using Azure.Core; +using Azure.Identity; +using NUnit.Framework; +using _Azure.Lro.RpcLegacy; +using _Azure.Lro.RpcLegacy.Models; + +namespace _Azure.Lro.RpcLegacy.Samples +{ + public partial class Samples_LegacyClient + { + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_CreateJob_ShortVersion() + { + LegacyClient client = new LegacyClient(); + + using RequestContent content = RequestContent.Create(new + { + comment = "", + }); + Operation operation = client.CreateJob(WaitUntil.Completed, content); + BinaryData responseData = operation.Value; + + JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("jobId").ToString()); + Console.WriteLine(result.GetProperty("comment").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_CreateJob_ShortVersion_Async() + { + LegacyClient client = new LegacyClient(); + + using RequestContent content = RequestContent.Create(new + { + comment = "", + }); + Operation operation = await client.CreateJobAsync(WaitUntil.Completed, content); + BinaryData responseData = operation.Value; + + JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("jobId").ToString()); + Console.WriteLine(result.GetProperty("comment").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_CreateJob_ShortVersion_Convenience() + { + LegacyClient client = new LegacyClient(); + + JobData jobData = new JobData(""); + Operation operation = client.CreateJob(WaitUntil.Completed, jobData); + JobResult responseData = operation.Value; + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_CreateJob_ShortVersion_Convenience_Async() + { + LegacyClient client = new LegacyClient(); + + JobData jobData = new JobData(""); + Operation operation = await client.CreateJobAsync(WaitUntil.Completed, jobData); + JobResult responseData = operation.Value; + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_CreateJob_AllParameters() + { + LegacyClient client = new LegacyClient(); + + using RequestContent content = RequestContent.Create(new + { + comment = "", + }); + Operation operation = client.CreateJob(WaitUntil.Completed, content); + BinaryData responseData = operation.Value; + + JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("jobId").ToString()); + Console.WriteLine(result.GetProperty("comment").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("errors")[0].GetProperty("error").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("errors")[0].GetProperty("error").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("errors")[0].GetProperty("error").GetProperty("target").ToString()); + Console.WriteLine(result.GetProperty("errors")[0].GetProperty("error").GetProperty("innererror").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("results")[0].ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_CreateJob_AllParameters_Async() + { + LegacyClient client = new LegacyClient(); + + using RequestContent content = RequestContent.Create(new + { + comment = "", + }); + Operation operation = await client.CreateJobAsync(WaitUntil.Completed, content); + BinaryData responseData = operation.Value; + + JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("jobId").ToString()); + Console.WriteLine(result.GetProperty("comment").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("errors")[0].GetProperty("error").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("errors")[0].GetProperty("error").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("errors")[0].GetProperty("error").GetProperty("target").ToString()); + Console.WriteLine(result.GetProperty("errors")[0].GetProperty("error").GetProperty("innererror").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("results")[0].ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_CreateJob_AllParameters_Convenience() + { + LegacyClient client = new LegacyClient(); + + JobData jobData = new JobData(""); + Operation operation = client.CreateJob(WaitUntil.Completed, jobData); + JobResult responseData = operation.Value; + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_CreateJob_AllParameters_Convenience_Async() + { + LegacyClient client = new LegacyClient(); + + JobData jobData = new JobData(""); + Operation operation = await client.CreateJobAsync(WaitUntil.Completed, jobData); + JobResult responseData = operation.Value; + } + } +} diff --git a/test/CadlRanchProjects/azure/core/lro/rpc-legacy/tests/_Azure.Lro.RpcLegacy.Tests.csproj b/test/CadlRanchProjects/azure/core/lro/rpc-legacy/tests/_Azure.Lro.RpcLegacy.Tests.csproj new file mode 100644 index 00000000000..5b262495fdb --- /dev/null +++ b/test/CadlRanchProjects/azure/core/lro/rpc-legacy/tests/_Azure.Lro.RpcLegacy.Tests.csproj @@ -0,0 +1,25 @@ + + + $(RequiredTargetFrameworks) + + + $(NoWarn);CS1591 + + + + + + + + + + + + + + + + + + + diff --git a/test/TestProjects/Lro-Basic-TypeSpec/tspconfig.yaml b/test/CadlRanchProjects/azure/core/lro/rpc-legacy/tspconfig.yaml similarity index 51% rename from test/TestProjects/Lro-Basic-TypeSpec/tspconfig.yaml rename to test/CadlRanchProjects/azure/core/lro/rpc-legacy/tspconfig.yaml index b74ff790d83..1aafbb2ffdc 100644 --- a/test/TestProjects/Lro-Basic-TypeSpec/tspconfig.yaml +++ b/test/CadlRanchProjects/azure/core/lro/rpc-legacy/tspconfig.yaml @@ -1,3 +1,3 @@ options: "@azure-tools/typespec-csharp": - generate-convenience-methods: false + namespace: _Azure.Lro.RpcLegacy \ No newline at end of file diff --git a/test/TestProjects/Lro-Basic-TypeSpec/LroBasicTypeSpec.sln b/test/CadlRanchProjects/azure/core/lro/standard/_Azure.Lro.Standard.sln similarity index 90% rename from test/TestProjects/Lro-Basic-TypeSpec/LroBasicTypeSpec.sln rename to test/CadlRanchProjects/azure/core/lro/standard/_Azure.Lro.Standard.sln index 57be90bb483..187cc56e00e 100644 --- a/test/TestProjects/Lro-Basic-TypeSpec/LroBasicTypeSpec.sln +++ b/test/CadlRanchProjects/azure/core/lro/standard/_Azure.Lro.Standard.sln @@ -2,9 +2,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 VisualStudioVersion = 16.0.29709.97 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LroBasicTypeSpec", "src\LroBasicTypeSpec.csproj", "{28FF4005-4467-4E36-92E7-DEA27DEB1519}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "_Azure.Lro.Standard", "src\_Azure.Lro.Standard.csproj", "{28FF4005-4467-4E36-92E7-DEA27DEB1519}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LroBasicTypeSpec.Tests", "tests\LroBasicTypeSpec.Tests.csproj", "{1F1CD1D4-9932-4B73-99D8-C252A67D4B46}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "_Azure.Lro.Standard.Tests", "tests\_Azure.Lro.Standard.Tests.csproj", "{1F1CD1D4-9932-4B73-99D8-C252A67D4B46}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/test/CadlRanchProjects/azure/core/lro/standard/src/Generated/AzureLroStandardClientBuilderExtensions.cs b/test/CadlRanchProjects/azure/core/lro/standard/src/Generated/AzureLroStandardClientBuilderExtensions.cs new file mode 100644 index 00000000000..94802c10cfb --- /dev/null +++ b/test/CadlRanchProjects/azure/core/lro/standard/src/Generated/AzureLroStandardClientBuilderExtensions.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.Lro.Standard; + +namespace Microsoft.Extensions.Azure +{ + /// Extension methods to add to client builder. + public static partial class AzureLroStandardClientBuilderExtensions + { + /// Registers a instance. + /// The builder to register with. + /// TestServer endpoint. + public static IAzureClientBuilder AddStandardClient(this TBuilder builder, Uri endpoint) + where TBuilder : IAzureClientFactoryBuilder + { + return builder.RegisterClientFactory((options) => new StandardClient(endpoint, options)); + } + + /// Registers a instance. + /// The builder to register with. + /// The configuration values. + public static IAzureClientBuilder AddStandardClient(this TBuilder builder, TConfiguration configuration) + where TBuilder : IAzureClientFactoryBuilderWithConfiguration + { + return builder.RegisterClientFactory(configuration); + } + } +} diff --git a/test/CadlRanchProjects/azure/core/lro/standard/src/Generated/AzureLroStandardModelFactory.cs b/test/CadlRanchProjects/azure/core/lro/standard/src/Generated/AzureLroStandardModelFactory.cs new file mode 100644 index 00000000000..ad66da066c1 --- /dev/null +++ b/test/CadlRanchProjects/azure/core/lro/standard/src/Generated/AzureLroStandardModelFactory.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure; + +namespace _Azure.Lro.Standard.Models +{ + /// Model factory for models. + public static partial class AzureLroStandardModelFactory + { + /// Initializes a new instance of User. + /// The name of user. + /// The role of user. + /// A new instance for mocking. + public static User User(string name = null, string role = null) + { + return new User(name, role); + } + + /// Initializes a new instance of ExportedUser. + /// The name of user. + /// The exported URI. + /// or is null. + /// A new instance for mocking. + public static ExportedUser ExportedUser(string name = null, string resourceUri = null) + { + if (name == null) + { + throw new ArgumentNullException(nameof(name)); + } + if (resourceUri == null) + { + throw new ArgumentNullException(nameof(resourceUri)); + } + + return new ExportedUser(name, resourceUri); + } + } +} diff --git a/test/CadlRanchProjects/azure/core/lro/standard/src/Generated/Configuration.json b/test/CadlRanchProjects/azure/core/lro/standard/src/Generated/Configuration.json new file mode 100644 index 00000000000..d7f2cb92d59 --- /dev/null +++ b/test/CadlRanchProjects/azure/core/lro/standard/src/Generated/Configuration.json @@ -0,0 +1,10 @@ +{ + "output-folder": ".", + "namespace": "_Azure.Lro.Standard", + "library-name": "_Azure.Lro.Standard", + "shared-source-folders": [ + "../../../../../../../../artifacts/bin/AutoRest.CSharp/Debug/net6.0/Generator.Shared", + "../../../../../../../../artifacts/bin/AutoRest.CSharp/Debug/net6.0/Azure.Core.Shared" + ], + "use-overloads-between-protocol-and-convenience": true +} diff --git a/test/CadlRanchProjects/azure/core/lro/standard/src/Generated/Docs/StandardClient.xml b/test/CadlRanchProjects/azure/core/lro/standard/src/Generated/Docs/StandardClient.xml new file mode 100644 index 00000000000..8aa5f38e66c --- /dev/null +++ b/test/CadlRanchProjects/azure/core/lro/standard/src/Generated/Docs/StandardClient.xml @@ -0,0 +1,223 @@ + + + + + +This sample shows how to call CreateOrReplaceAsync. +"); +Operation operation = await client.CreateOrReplaceAsync(WaitUntil.Completed, "", resource); +User responseData = operation.Value; +]]> +This sample shows how to call CreateOrReplaceAsync with all parameters. +"); +Operation operation = await client.CreateOrReplaceAsync(WaitUntil.Completed, "", resource); +User responseData = operation.Value; +]]> + + + +This sample shows how to call CreateOrReplace. +"); +Operation operation = client.CreateOrReplace(WaitUntil.Completed, "", resource); +User responseData = operation.Value; +]]> +This sample shows how to call CreateOrReplace with all parameters. +"); +Operation operation = client.CreateOrReplace(WaitUntil.Completed, "", resource); +User responseData = operation.Value; +]]> + + + +This sample shows how to call CreateOrReplaceAsync and parse the result. +", +}); +Operation operation = await client.CreateOrReplaceAsync(WaitUntil.Completed, "", content); +BinaryData responseData = operation.Value; + +JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("role").ToString()); +]]> +This sample shows how to call CreateOrReplaceAsync with all parameters and request content and parse the result. +", +}); +Operation operation = await client.CreateOrReplaceAsync(WaitUntil.Completed, "", content); +BinaryData responseData = operation.Value; + +JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("role").ToString()); +]]> + + + +This sample shows how to call CreateOrReplace and parse the result. +", +}); +Operation operation = client.CreateOrReplace(WaitUntil.Completed, "", content); +BinaryData responseData = operation.Value; + +JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("role").ToString()); +]]> +This sample shows how to call CreateOrReplace with all parameters and request content and parse the result. +", +}); +Operation operation = client.CreateOrReplace(WaitUntil.Completed, "", content); +BinaryData responseData = operation.Value; + +JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("role").ToString()); +]]> + + + +This sample shows how to call DeleteAsync. +"); +]]> +This sample shows how to call DeleteAsync with all parameters. +"); +]]> + + + +This sample shows how to call Delete. +"); +]]> +This sample shows how to call Delete with all parameters. +"); +]]> + + + +This sample shows how to call ExportAsync. + operation = await client.ExportAsync(WaitUntil.Completed, "", ""); +ExportedUser responseData = operation.Value; +]]> +This sample shows how to call ExportAsync with all parameters. + operation = await client.ExportAsync(WaitUntil.Completed, "", ""); +ExportedUser responseData = operation.Value; +]]> + + + +This sample shows how to call Export. + operation = client.Export(WaitUntil.Completed, "", ""); +ExportedUser responseData = operation.Value; +]]> +This sample shows how to call Export with all parameters. + operation = client.Export(WaitUntil.Completed, "", ""); +ExportedUser responseData = operation.Value; +]]> + + + +This sample shows how to call ExportAsync and parse the result. + operation = await client.ExportAsync(WaitUntil.Completed, "", "", null); +BinaryData responseData = operation.Value; + +JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("resourceUri").ToString()); +]]> +This sample shows how to call ExportAsync with all parameters and parse the result. + operation = await client.ExportAsync(WaitUntil.Completed, "", "", null); +BinaryData responseData = operation.Value; + +JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("resourceUri").ToString()); +]]> + + + +This sample shows how to call Export and parse the result. + operation = client.Export(WaitUntil.Completed, "", "", null); +BinaryData responseData = operation.Value; + +JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("resourceUri").ToString()); +]]> +This sample shows how to call Export with all parameters and parse the result. + operation = client.Export(WaitUntil.Completed, "", "", null); +BinaryData responseData = operation.Value; + +JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("resourceUri").ToString()); +]]> + + + \ No newline at end of file diff --git a/test/CadlRanchProjects/azure/core/lro/standard/src/Generated/Models/ExportedUser.Serialization.cs b/test/CadlRanchProjects/azure/core/lro/standard/src/Generated/Models/ExportedUser.Serialization.cs new file mode 100644 index 00000000000..dfcd4484119 --- /dev/null +++ b/test/CadlRanchProjects/azure/core/lro/standard/src/Generated/Models/ExportedUser.Serialization.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure; + +namespace _Azure.Lro.Standard.Models +{ + public partial class ExportedUser + { + internal static ExportedUser DeserializeExportedUser(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + string resourceUri = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("resourceUri"u8)) + { + resourceUri = property.Value.GetString(); + continue; + } + } + return new ExportedUser(name, resourceUri); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static ExportedUser FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeExportedUser(document.RootElement); + } + } +} diff --git a/test/CadlRanchProjects/azure/core/lro/standard/src/Generated/Models/ExportedUser.cs b/test/CadlRanchProjects/azure/core/lro/standard/src/Generated/Models/ExportedUser.cs new file mode 100644 index 00000000000..436c02f2206 --- /dev/null +++ b/test/CadlRanchProjects/azure/core/lro/standard/src/Generated/Models/ExportedUser.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; + +namespace _Azure.Lro.Standard.Models +{ + /// The exported user data. + public partial class ExportedUser + { + /// Initializes a new instance of ExportedUser. + /// The name of user. + /// The exported URI. + /// or is null. + internal ExportedUser(string name, string resourceUri) + { + Argument.AssertNotNull(name, nameof(name)); + Argument.AssertNotNull(resourceUri, nameof(resourceUri)); + + Name = name; + ResourceUri = resourceUri; + } + + /// The name of user. + public string Name { get; } + /// The exported URI. + public string ResourceUri { get; } + } +} diff --git a/test/TestProjects/Lro-Basic-TypeSpec/src/Generated/Models/Thing.Serialization.cs b/test/CadlRanchProjects/azure/core/lro/standard/src/Generated/Models/User.Serialization.cs similarity index 68% rename from test/TestProjects/Lro-Basic-TypeSpec/src/Generated/Models/Thing.Serialization.cs rename to test/CadlRanchProjects/azure/core/lro/standard/src/Generated/Models/User.Serialization.cs index 987652976aa..84de34d98d4 100644 --- a/test/TestProjects/Lro-Basic-TypeSpec/src/Generated/Models/Thing.Serialization.cs +++ b/test/CadlRanchProjects/azure/core/lro/standard/src/Generated/Models/User.Serialization.cs @@ -9,25 +9,26 @@ using Azure; using Azure.Core; -namespace LroBasicTypeSpec.Models +namespace _Azure.Lro.Standard.Models { - public partial class Thing : IUtf8JsonSerializable + public partial class User : IUtf8JsonSerializable { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name); + writer.WritePropertyName("role"u8); + writer.WriteStringValue(Role); writer.WriteEndObject(); } - internal static Thing DeserializeThing(JsonElement element) + internal static User DeserializeUser(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) { return null; } string name = default; + string role = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -35,16 +36,21 @@ internal static Thing DeserializeThing(JsonElement element) name = property.Value.GetString(); continue; } + if (property.NameEquals("role"u8)) + { + role = property.Value.GetString(); + continue; + } } - return new Thing(name); + return new User(name, role); } /// Deserializes the model from a raw response. /// The response to deserialize the model from. - internal static Thing FromResponse(Response response) + internal static User FromResponse(Response response) { using var document = JsonDocument.Parse(response.Content); - return DeserializeThing(document.RootElement); + return DeserializeUser(document.RootElement); } /// Convert into a Utf8JsonRequestContent. diff --git a/test/CadlRanchProjects/azure/core/lro/standard/src/Generated/Models/User.cs b/test/CadlRanchProjects/azure/core/lro/standard/src/Generated/Models/User.cs new file mode 100644 index 00000000000..38458eb4276 --- /dev/null +++ b/test/CadlRanchProjects/azure/core/lro/standard/src/Generated/Models/User.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; + +namespace _Azure.Lro.Standard.Models +{ + /// Details about a user. + public partial class User + { + /// Initializes a new instance of User. + /// The role of user. + /// is null. + public User(string role) + { + Argument.AssertNotNull(role, nameof(role)); + + Role = role; + } + + /// Initializes a new instance of User. + /// The name of user. + /// The role of user. + internal User(string name, string role) + { + Name = name; + Role = role; + } + + /// The name of user. + public string Name { get; } + /// The role of user. + public string Role { get; set; } + } +} diff --git a/test/TestProjects/Lro-Basic-TypeSpec/src/Generated/LroBasicTypeSpecClient.cs b/test/CadlRanchProjects/azure/core/lro/standard/src/Generated/StandardClient.cs similarity index 55% rename from test/TestProjects/Lro-Basic-TypeSpec/src/Generated/LroBasicTypeSpecClient.cs rename to test/CadlRanchProjects/azure/core/lro/standard/src/Generated/StandardClient.cs index e79b0cfb74e..fa0cfe08906 100644 --- a/test/TestProjects/Lro-Basic-TypeSpec/src/Generated/LroBasicTypeSpecClient.cs +++ b/test/CadlRanchProjects/azure/core/lro/standard/src/Generated/StandardClient.cs @@ -11,13 +11,13 @@ using Azure; using Azure.Core; using Azure.Core.Pipeline; -using LroBasicTypeSpec.Models; +using _Azure.Lro.Standard.Models; -namespace LroBasicTypeSpec +namespace _Azure.Lro.Standard { // Data plane generated client. - /// The LroBasicTypeSpec service client. - public partial class LroBasicTypeSpecClient + /// Illustrates bodies templated with Azure Core with long-running operation. + public partial class StandardClient { private readonly HttpPipeline _pipeline; private readonly Uri _endpoint; @@ -29,26 +29,19 @@ public partial class LroBasicTypeSpecClient /// The HTTP pipeline for sending and receiving REST requests and responses. public virtual HttpPipeline Pipeline => _pipeline; - /// Initializes a new instance of LroBasicTypeSpecClient for mocking. - protected LroBasicTypeSpecClient() + /// Initializes a new instance of StandardClient. + public StandardClient() : this(new Uri("http://localhost:3000"), new StandardClientOptions()) { } - /// Initializes a new instance of LroBasicTypeSpecClient. - /// The Uri to use. - /// is null. - public LroBasicTypeSpecClient(Uri endpoint) : this(endpoint, new LroBasicTypeSpecClientOptions()) - { - } - - /// Initializes a new instance of LroBasicTypeSpecClient. - /// The Uri to use. + /// Initializes a new instance of StandardClient. + /// TestServer endpoint. /// The options for configuring the client. /// is null. - public LroBasicTypeSpecClient(Uri endpoint, LroBasicTypeSpecClientOptions options) + public StandardClient(Uri endpoint, StandardClientOptions options) { Argument.AssertNotNull(endpoint, nameof(endpoint)); - options ??= new LroBasicTypeSpecClientOptions(); + options ??= new StandardClientOptions(); ClientDiagnostics = new ClientDiagnostics(options, true); _pipeline = HttpPipelineBuilder.Build(options, Array.Empty(), Array.Empty(), new ResponseClassifier()); @@ -56,38 +49,48 @@ public LroBasicTypeSpecClient(Uri endpoint, LroBasicTypeSpecClientOptions option _apiVersion = options.Version; } - /// Creates a project. + /// Adds a user or replaces a user's fields. /// 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 name of user. /// The resource instance. /// The cancellation token to use. - /// is null. - /// - public virtual async Task CreateProjectAsync(WaitUntil waitUntil, Project resource, CancellationToken cancellationToken = default) + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// Creates or replaces a User. + /// + public virtual async Task> CreateOrReplaceAsync(WaitUntil waitUntil, string name, User resource, CancellationToken cancellationToken = default) { + Argument.AssertNotNullOrEmpty(name, nameof(name)); Argument.AssertNotNull(resource, nameof(resource)); RequestContext context = FromCancellationToken(cancellationToken); using RequestContent content = resource.ToRequestContent(); - return await CreateProjectAsync(waitUntil, content, context).ConfigureAwait(false); + Operation response = await CreateOrReplaceAsync(waitUntil, name, content, context).ConfigureAwait(false); + return ProtocolOperationHelpers.Convert(response, User.FromResponse, ClientDiagnostics, "StandardClient.CreateOrReplace"); } - /// Creates a project. + /// Adds a user or replaces a user's fields. /// 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 name of user. /// The resource instance. /// The cancellation token to use. - /// is null. - /// - public virtual Operation CreateProject(WaitUntil waitUntil, Project resource, CancellationToken cancellationToken = default) + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// Creates or replaces a User. + /// + public virtual Operation CreateOrReplace(WaitUntil waitUntil, string name, User resource, CancellationToken cancellationToken = default) { + Argument.AssertNotNullOrEmpty(name, nameof(name)); Argument.AssertNotNull(resource, nameof(resource)); RequestContext context = FromCancellationToken(cancellationToken); using RequestContent content = resource.ToRequestContent(); - return CreateProject(waitUntil, content, context); + Operation response = CreateOrReplace(waitUntil, name, content, context); + return ProtocolOperationHelpers.Convert(response, User.FromResponse, ClientDiagnostics, "StandardClient.CreateOrReplace"); } /// - /// [Protocol Method] Creates a project + /// [Protocol Method] Adds a user or replaces a user's fields. /// /// /// @@ -96,28 +99,31 @@ public virtual Operation CreateProject(WaitUntil waitUntil, Project resource, Ca /// /// /// - /// Please try the simpler convenience overload with strongly typed models first. + /// 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 name of user. /// The content to send as the body of the request. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. + /// 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 CreateProjectAsync(WaitUntil waitUntil, RequestContent content, RequestContext context = null) + /// + public virtual async Task> CreateOrReplaceAsync(WaitUntil waitUntil, string name, RequestContent content, RequestContext context = null) { + Argument.AssertNotNullOrEmpty(name, nameof(name)); Argument.AssertNotNull(content, nameof(content)); - using var scope = ClientDiagnostics.CreateScope("LroBasicTypeSpecClient.CreateProject"); + using var scope = ClientDiagnostics.CreateScope("StandardClient.CreateOrReplace"); scope.Start(); try { - using HttpMessage message = CreateCreateProjectRequest(content, context); - return await ProtocolOperationHelpers.ProcessMessageWithoutResponseValueAsync(_pipeline, message, ClientDiagnostics, "LroBasicTypeSpecClient.CreateProject", OperationFinalStateVia.Location, context, waitUntil).ConfigureAwait(false); + using HttpMessage message = CreateCreateOrReplaceRequest(name, content, context); + return await ProtocolOperationHelpers.ProcessMessageAsync(_pipeline, message, ClientDiagnostics, "StandardClient.CreateOrReplace", OperationFinalStateVia.OperationLocation, context, waitUntil).ConfigureAwait(false); } catch (Exception e) { @@ -127,7 +133,7 @@ public virtual async Task CreateProjectAsync(WaitUntil waitUntil, Req } /// - /// [Protocol Method] Creates a project + /// [Protocol Method] Adds a user or replaces a user's fields. /// /// /// @@ -136,28 +142,31 @@ public virtual async Task CreateProjectAsync(WaitUntil waitUntil, Req /// /// /// - /// Please try the simpler convenience overload with strongly typed models first. + /// 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 name of user. /// The content to send as the body of the request. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. + /// 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 CreateProject(WaitUntil waitUntil, RequestContent content, RequestContext context = null) + /// + public virtual Operation CreateOrReplace(WaitUntil waitUntil, string name, RequestContent content, RequestContext context = null) { + Argument.AssertNotNullOrEmpty(name, nameof(name)); Argument.AssertNotNull(content, nameof(content)); - using var scope = ClientDiagnostics.CreateScope("LroBasicTypeSpecClient.CreateProject"); + using var scope = ClientDiagnostics.CreateScope("StandardClient.CreateOrReplace"); scope.Start(); try { - using HttpMessage message = CreateCreateProjectRequest(content, context); - return ProtocolOperationHelpers.ProcessMessageWithoutResponseValue(_pipeline, message, ClientDiagnostics, "LroBasicTypeSpecClient.CreateProject", OperationFinalStateVia.Location, context, waitUntil); + using HttpMessage message = CreateCreateOrReplaceRequest(name, content, context); + return ProtocolOperationHelpers.ProcessMessage(_pipeline, message, ClientDiagnostics, "StandardClient.CreateOrReplace", OperationFinalStateVia.OperationLocation, context, waitUntil); } catch (Exception e) { @@ -166,79 +175,35 @@ public virtual Operation CreateProject(WaitUntil waitUntil, RequestContent conte } } - /// Updates a project. - /// 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 String to use. - /// 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> UpdateProjectAsync(WaitUntil waitUntil, string id, Project resource, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(id, nameof(id)); - Argument.AssertNotNull(resource, nameof(resource)); - - RequestContext context = FromCancellationToken(cancellationToken); - using RequestContent content = resource.ToRequestContent(); - Operation response = await UpdateProjectAsync(waitUntil, id, content, context).ConfigureAwait(false); - return ProtocolOperationHelpers.Convert(response, Project.FromResponse, ClientDiagnostics, "LroBasicTypeSpecClient.UpdateProject"); - } - - /// Updates a project. - /// 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 String to use. - /// The resource instance. - /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - /// - public virtual Operation UpdateProject(WaitUntil waitUntil, string id, Project resource, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(id, nameof(id)); - Argument.AssertNotNull(resource, nameof(resource)); - - RequestContext context = FromCancellationToken(cancellationToken); - using RequestContent content = resource.ToRequestContent(); - Operation response = UpdateProject(waitUntil, id, content, context); - return ProtocolOperationHelpers.Convert(response, Project.FromResponse, ClientDiagnostics, "LroBasicTypeSpecClient.UpdateProject"); - } - + // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method /// - /// [Protocol Method] Updates a project + /// [Protocol Method] Deletes a user. /// /// /// /// 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 String to use. - /// The content to send as the body of the request. + /// The name of user. /// 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. + /// 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> UpdateProjectAsync(WaitUntil waitUntil, string id, RequestContent content, RequestContext context = null) + /// + public virtual async Task DeleteAsync(WaitUntil waitUntil, string name, RequestContext context = null) { - Argument.AssertNotNullOrEmpty(id, nameof(id)); - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = ClientDiagnostics.CreateScope("LroBasicTypeSpecClient.UpdateProject"); + using var scope = ClientDiagnostics.CreateScope("StandardClient.Delete"); scope.Start(); try { - using HttpMessage message = CreateUpdateProjectRequest(id, content, context); - return await ProtocolOperationHelpers.ProcessMessageAsync(_pipeline, message, ClientDiagnostics, "LroBasicTypeSpecClient.UpdateProject", OperationFinalStateVia.Location, context, waitUntil).ConfigureAwait(false); + using HttpMessage message = CreateDeleteRequest(name, context); + return await ProtocolOperationHelpers.ProcessMessageWithoutResponseValueAsync(_pipeline, message, ClientDiagnostics, "StandardClient.Delete", OperationFinalStateVia.OperationLocation, context, waitUntil).ConfigureAwait(false); } catch (Exception e) { @@ -247,41 +212,35 @@ public virtual async Task> UpdateProjectAsync(WaitUntil wa } } + // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method /// - /// [Protocol Method] Updates a project + /// [Protocol Method] Deletes a user. /// /// /// /// 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 String to use. - /// The content to send as the body of the request. + /// The name of user. /// 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. + /// 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 UpdateProject(WaitUntil waitUntil, string id, RequestContent content, RequestContext context = null) + /// + public virtual Operation Delete(WaitUntil waitUntil, string name, RequestContext context = null) { - Argument.AssertNotNullOrEmpty(id, nameof(id)); - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = ClientDiagnostics.CreateScope("LroBasicTypeSpecClient.UpdateProject"); + using var scope = ClientDiagnostics.CreateScope("StandardClient.Delete"); scope.Start(); try { - using HttpMessage message = CreateUpdateProjectRequest(id, content, context); - return ProtocolOperationHelpers.ProcessMessage(_pipeline, message, ClientDiagnostics, "LroBasicTypeSpecClient.UpdateProject", OperationFinalStateVia.Location, context, waitUntil); + using HttpMessage message = CreateDeleteRequest(name, context); + return ProtocolOperationHelpers.ProcessMessageWithoutResponseValue(_pipeline, message, ClientDiagnostics, "StandardClient.Delete", OperationFinalStateVia.OperationLocation, context, waitUntil); } catch (Exception e) { @@ -290,40 +249,46 @@ public virtual Operation UpdateProject(WaitUntil waitUntil, string i } } - /// Long running RPC operation template. + /// Exports a user. /// 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 Thing to use. + /// The name of user. + /// The format of the data. /// The cancellation token to use. - /// is null. - /// - public virtual async Task> CreateThingAsync(WaitUntil waitUntil, Thing thing, CancellationToken cancellationToken = default) + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// Exports a User. + /// + public virtual async Task> ExportAsync(WaitUntil waitUntil, string name, string format, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(thing, nameof(thing)); + Argument.AssertNotNullOrEmpty(name, nameof(name)); + Argument.AssertNotNull(format, nameof(format)); RequestContext context = FromCancellationToken(cancellationToken); - using RequestContent content = thing.ToRequestContent(); - Operation response = await CreateThingAsync(waitUntil, content, context).ConfigureAwait(false); - return ProtocolOperationHelpers.Convert(response, Thing.FromResponse, ClientDiagnostics, "LroBasicTypeSpecClient.CreateThing"); + Operation response = await ExportAsync(waitUntil, name, format, context).ConfigureAwait(false); + return ProtocolOperationHelpers.Convert(response, ExportedUser.FromResponse, ClientDiagnostics, "StandardClient.Export"); } - /// Long running RPC operation template. + /// Exports a user. /// 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 Thing to use. + /// The name of user. + /// The format of the data. /// The cancellation token to use. - /// is null. - /// - public virtual Operation CreateThing(WaitUntil waitUntil, Thing thing, CancellationToken cancellationToken = default) + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// Exports a User. + /// + public virtual Operation Export(WaitUntil waitUntil, string name, string format, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(thing, nameof(thing)); + Argument.AssertNotNullOrEmpty(name, nameof(name)); + Argument.AssertNotNull(format, nameof(format)); RequestContext context = FromCancellationToken(cancellationToken); - using RequestContent content = thing.ToRequestContent(); - Operation response = CreateThing(waitUntil, content, context); - return ProtocolOperationHelpers.Convert(response, Thing.FromResponse, ClientDiagnostics, "LroBasicTypeSpecClient.CreateThing"); + Operation response = Export(waitUntil, name, format, context); + return ProtocolOperationHelpers.Convert(response, ExportedUser.FromResponse, ClientDiagnostics, "StandardClient.Export"); } /// - /// [Protocol Method] Long running RPC operation template + /// [Protocol Method] Exports a user. /// /// /// @@ -332,28 +297,31 @@ public virtual Operation CreateThing(WaitUntil waitUntil, Thing thing, Ca /// /// /// - /// Please try the simpler convenience overload with strongly typed models first. + /// 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 content to send as the body of the request. + /// The name of user. + /// The format of the data. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. + /// 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> CreateThingAsync(WaitUntil waitUntil, RequestContent content, RequestContext context = null) + /// + public virtual async Task> ExportAsync(WaitUntil waitUntil, string name, string format, RequestContext context) { - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNullOrEmpty(name, nameof(name)); + Argument.AssertNotNull(format, nameof(format)); - using var scope = ClientDiagnostics.CreateScope("LroBasicTypeSpecClient.CreateThing"); + using var scope = ClientDiagnostics.CreateScope("StandardClient.Export"); scope.Start(); try { - using HttpMessage message = CreateCreateThingRequest(content, context); - return await ProtocolOperationHelpers.ProcessMessageAsync(_pipeline, message, ClientDiagnostics, "LroBasicTypeSpecClient.CreateThing", OperationFinalStateVia.Location, context, waitUntil).ConfigureAwait(false); + using HttpMessage message = CreateExportRequest(name, format, context); + return await ProtocolOperationHelpers.ProcessMessageAsync(_pipeline, message, ClientDiagnostics, "StandardClient.Export", OperationFinalStateVia.OperationLocation, context, waitUntil).ConfigureAwait(false); } catch (Exception e) { @@ -363,7 +331,7 @@ public virtual async Task> CreateThingAsync(WaitUntil wait } /// - /// [Protocol Method] Long running RPC operation template + /// [Protocol Method] Exports a user. /// /// /// @@ -372,28 +340,31 @@ public virtual async Task> CreateThingAsync(WaitUntil wait /// /// /// - /// Please try the simpler convenience overload with strongly typed models first. + /// 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 content to send as the body of the request. + /// The name of user. + /// The format of the data. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. + /// 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 CreateThing(WaitUntil waitUntil, RequestContent content, RequestContext context = null) + /// + public virtual Operation Export(WaitUntil waitUntil, string name, string format, RequestContext context) { - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNullOrEmpty(name, nameof(name)); + Argument.AssertNotNull(format, nameof(format)); - using var scope = ClientDiagnostics.CreateScope("LroBasicTypeSpecClient.CreateThing"); + using var scope = ClientDiagnostics.CreateScope("StandardClient.Export"); scope.Start(); try { - using HttpMessage message = CreateCreateThingRequest(content, context); - return ProtocolOperationHelpers.ProcessMessage(_pipeline, message, ClientDiagnostics, "LroBasicTypeSpecClient.CreateThing", OperationFinalStateVia.Location, context, waitUntil); + using HttpMessage message = CreateExportRequest(name, format, context); + return ProtocolOperationHelpers.ProcessMessage(_pipeline, message, ClientDiagnostics, "StandardClient.Export", OperationFinalStateVia.OperationLocation, context, waitUntil); } catch (Exception e) { @@ -402,14 +373,15 @@ public virtual Operation CreateThing(WaitUntil waitUntil, RequestCon } } - internal HttpMessage CreateCreateProjectRequest(RequestContent content, RequestContext context) + internal HttpMessage CreateCreateOrReplaceRequest(string name, RequestContent content, RequestContext context) { - var message = _pipeline.CreateMessage(context, ResponseClassifier202); + var message = _pipeline.CreateMessage(context, ResponseClassifier200201); var request = message.Request; - request.Method = RequestMethod.Post; + request.Method = RequestMethod.Put; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); - uri.AppendPath("/projects", false); + uri.AppendPath("/azure/core/lro/standard/users/", false); + uri.AppendPath(name, true); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); @@ -418,36 +390,35 @@ internal HttpMessage CreateCreateProjectRequest(RequestContent content, RequestC return message; } - internal HttpMessage CreateUpdateProjectRequest(string id, RequestContent content, RequestContext context) + internal HttpMessage CreateDeleteRequest(string name, RequestContext context) { - var message = _pipeline.CreateMessage(context, ResponseClassifier200201); + var message = _pipeline.CreateMessage(context, ResponseClassifier202); var request = message.Request; - request.Method = RequestMethod.Put; + request.Method = RequestMethod.Delete; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); - uri.AppendPath("/projects/", false); - uri.AppendPath(id, true); + uri.AppendPath("/azure/core/lro/standard/users/", false); + uri.AppendPath(name, 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 CreateCreateThingRequest(RequestContent content, RequestContext context) + internal HttpMessage CreateExportRequest(string name, string format, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier202); var request = message.Request; request.Method = RequestMethod.Post; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); - uri.AppendPath("/thing", false); + uri.AppendPath("/azure/core/lro/standard/users/", false); + uri.AppendPath(name, true); + uri.AppendPath(":export", false); + uri.AppendQuery("format", format, 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; } @@ -462,9 +433,9 @@ internal static RequestContext FromCancellationToken(CancellationToken cancellat return new RequestContext() { CancellationToken = cancellationToken }; } - private static ResponseClassifier _responseClassifier202; - private static ResponseClassifier ResponseClassifier202 => _responseClassifier202 ??= new StatusCodeClassifier(stackalloc ushort[] { 202 }); 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 }); } } diff --git a/test/CadlRanchProjects/azure/core/lro/standard/src/Generated/StandardClientOptions.cs b/test/CadlRanchProjects/azure/core/lro/standard/src/Generated/StandardClientOptions.cs new file mode 100644 index 00000000000..10e2da7c554 --- /dev/null +++ b/test/CadlRanchProjects/azure/core/lro/standard/src/Generated/StandardClientOptions.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.Lro.Standard +{ + /// Client options for StandardClient. + public partial class StandardClientOptions : ClientOptions + { + private const ServiceVersion LatestVersion = ServiceVersion.V2022_12_01_Preview; + + /// The version of the service to use. + public enum ServiceVersion + { + /// Service version "2022-12-01-preview". + V2022_12_01_Preview = 1, + } + + internal string Version { get; } + + /// Initializes new instance of StandardClientOptions. + public StandardClientOptions(ServiceVersion version = LatestVersion) + { + Version = version switch + { + ServiceVersion.V2022_12_01_Preview => "2022-12-01-preview", + _ => throw new NotSupportedException() + }; + } + } +} diff --git a/test/CadlRanchProjects/azure/core/lro/standard/src/Generated/tspCodeModel.json b/test/CadlRanchProjects/azure/core/lro/standard/src/Generated/tspCodeModel.json new file mode 100644 index 00000000000..16dd36c684a --- /dev/null +++ b/test/CadlRanchProjects/azure/core/lro/standard/src/Generated/tspCodeModel.json @@ -0,0 +1,815 @@ +{ + "$id": "1", + "Name": "_Specs_.Azure.Core.Lro.Standard", + "Description": "Illustrates bodies templated with Azure Core with long-running operation", + "ApiVersions": [ + "2022-12-01-preview" + ], + "Enums": [ + { + "$id": "2", + "Name": "OperationState", + "EnumValueType": "String", + "AllowedValues": [ + { + "$id": "3", + "Name": "InProgress", + "Value": "InProgress", + "Description": "The operation is in progress." + }, + { + "$id": "4", + "Name": "Succeeded", + "Value": "Succeeded", + "Description": "The operation has completed successfully." + }, + { + "$id": "5", + "Name": "Failed", + "Value": "Failed", + "Description": "The operation has failed." + }, + { + "$id": "6", + "Name": "Canceled", + "Value": "Canceled", + "Description": "The operation has been canceled by the user." + } + ], + "Namespace": "Azure.Core.Foundations", + "Description": "Enum describing allowed operation states.", + "IsExtensible": true, + "IsNullable": false, + "Usage": "Output" + }, + { + "$id": "7", + "Name": "Versions", + "EnumValueType": "String", + "AllowedValues": [ + { + "$id": "8", + "Name": "v2022_12_01_preview", + "Value": "2022-12-01-preview", + "Description": "The 2022-12-01-preview version." + } + ], + "Namespace": "_Specs_.Azure.Core.Lro.Standard", + "Description": "The API version.", + "IsExtensible": true, + "IsNullable": false, + "Usage": "None" + } + ], + "Models": [ + { + "$id": "9", + "Name": "User", + "Namespace": "_Specs_.Azure.Core.Lro.Standard", + "Description": "Details about a user.", + "IsNullable": false, + "Usage": "RoundTrip", + "Properties": [ + { + "$id": "10", + "Name": "name", + "SerializedName": "name", + "Description": "The name of user.", + "Type": { + "$id": "11", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": true + }, + { + "$id": "12", + "Name": "role", + "SerializedName": "role", + "Description": "The role of user", + "Type": { + "$id": "13", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + } + ] + }, + { + "$id": "14", + "Name": "ResourceOperationStatusUserExportedUserError", + "Namespace": "Azure.Core", + "Description": "Provides status details for long running operations.", + "IsNullable": false, + "Usage": "Output", + "Properties": [ + { + "$id": "15", + "Name": "id", + "SerializedName": "id", + "Description": "The unique ID of the operation.", + "Type": { + "$id": "16", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "17", + "Name": "status", + "SerializedName": "status", + "Description": "The status of the operation", + "Type": { + "$ref": "2" + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "18", + "Name": "error", + "SerializedName": "error", + "Description": "Error object that describes the error when status is \"Failed\".", + "Type": { + "$id": "19", + "Name": "Error", + "Namespace": "Azure.Core.Foundations", + "Description": "The error object.", + "IsNullable": false, + "Usage": "Output", + "Properties": [ + { + "$id": "20", + "Name": "code", + "SerializedName": "code", + "Description": "One of a server-defined set of error codes.", + "Type": { + "$id": "21", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "22", + "Name": "message", + "SerializedName": "message", + "Description": "A human-readable representation of the error.", + "Type": { + "$id": "23", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "24", + "Name": "target", + "SerializedName": "target", + "Description": "The target of the error.", + "Type": { + "$id": "25", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "26", + "Name": "details", + "SerializedName": "details", + "Description": "An array of details about specific errors that led to this reported error.", + "Type": { + "$id": "27", + "Name": "Array", + "ElementType": { + "$ref": "19" + }, + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "28", + "Name": "innererror", + "SerializedName": "innererror", + "Description": "An object containing more specific information than the current object about the error.", + "Type": { + "$id": "29", + "Name": "InnerError", + "Namespace": "Azure.Core.Foundations", + "Description": "An object containing more specific information about the error. As per Microsoft One API guidelines - https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses.", + "IsNullable": false, + "Usage": "Output", + "Properties": [ + { + "$id": "30", + "Name": "code", + "SerializedName": "code", + "Description": "One of a server-defined set of error codes.", + "Type": { + "$id": "31", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "32", + "Name": "InnerErrorObject", + "SerializedName": "innererror", + "Description": "Inner error.", + "Type": { + "$ref": "29" + }, + "IsRequired": false, + "IsReadOnly": false + } + ] + }, + "IsRequired": false, + "IsReadOnly": false + } + ] + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "33", + "Name": "result", + "SerializedName": "result", + "Description": "The result of the operation.", + "Type": { + "$id": "34", + "Name": "ExportedUser", + "Namespace": "_Specs_.Azure.Core.Lro.Standard", + "Description": "The exported user data.", + "IsNullable": false, + "Usage": "Output", + "Properties": [ + { + "$id": "35", + "Name": "name", + "SerializedName": "name", + "Description": "The name of user.", + "Type": { + "$id": "36", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "37", + "Name": "resourceUri", + "SerializedName": "resourceUri", + "Description": "The exported URI.", + "Type": { + "$id": "38", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + } + ] + }, + "IsRequired": false, + "IsReadOnly": false + } + ] + }, + { + "$ref": "19" + }, + { + "$ref": "29" + }, + { + "$ref": "34" + }, + { + "$id": "39", + "Name": "UserExportParams", + "Namespace": "_Specs_.Azure.Core.Lro.Standard", + "Description": "The parameters for exporting a user.", + "IsNullable": false, + "Usage": "None", + "Properties": [] + } + ], + "Clients": [ + { + "$id": "40", + "Name": "StandardClient", + "Description": "Illustrates bodies templated with Azure Core with long-running operation", + "Operations": [ + { + "$id": "41", + "Name": "createOrReplace", + "ResourceName": "User", + "Summary": "Adds a user or replaces a user's fields.", + "Description": "Creates or replaces a User", + "Parameters": [ + { + "$id": "42", + "Name": "host", + "NameInRequest": "host", + "Description": "TestServer endpoint", + "Type": { + "$id": "43", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Location": "Uri", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": true, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Client", + "DefaultValue": { + "$id": "44", + "Type": { + "$id": "45", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Value": "http://localhost:3000" + } + }, + { + "$id": "46", + "Name": "apiVersion", + "NameInRequest": "api-version", + "Description": "", + "Type": { + "$id": "47", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Location": "Query", + "IsRequired": true, + "IsApiVersion": true, + "IsContentType": false, + "IsEndpoint": false, + "IsResourceParameter": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Client", + "DefaultValue": { + "$id": "48", + "Type": { + "$id": "49", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Value": "2022-12-01-preview" + } + }, + { + "$id": "50", + "Name": "name", + "NameInRequest": "name", + "Description": "The name of user.", + "Type": { + "$id": "51", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "Location": "Path", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "52", + "Name": "resource", + "NameInRequest": "resource", + "Description": "The resource instance.", + "Type": { + "$ref": "9" + }, + "Location": "Body", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "53", + "Name": "contentType", + "NameInRequest": "Content-Type", + "Type": { + "$id": "54", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": true, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "55", + "Type": { + "$ref": "54" + }, + "Value": "application/json" + } + }, + { + "$id": "56", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "57", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "58", + "Type": { + "$ref": "57" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "59", + "StatusCodes": [ + 201 + ], + "BodyType": { + "$ref": "9" + }, + "BodyMediaType": "Json", + "Headers": [ + { + "$id": "60", + "Name": "Operation-Location", + "NameInResponse": "operationLocation", + "Description": "The location for monitoring the operation state.", + "Type": { + "$id": "61", + "Name": "ResourceLocation", + "Kind": "Uri", + "IsNullable": false + } + } + ], + "IsErrorResponse": false + }, + { + "$id": "62", + "StatusCodes": [ + 200 + ], + "BodyType": { + "$ref": "9" + }, + "BodyMediaType": "Json", + "Headers": [ + { + "$id": "63", + "Name": "Operation-Location", + "NameInResponse": "operationLocation", + "Description": "The location for monitoring the operation state.", + "Type": { + "$id": "64", + "Name": "ResourceLocation", + "Kind": "Uri", + "IsNullable": false + } + } + ], + "IsErrorResponse": false + } + ], + "HttpMethod": "PUT", + "RequestBodyMediaType": "Json", + "Uri": "{host}", + "Path": "/azure/core/lro/standard/users/{name}", + "RequestMediaTypes": [ + "application/json" + ], + "BufferResponse": true, + "LongRunning": { + "$id": "65", + "FinalStateVia": 3, + "FinalResponse": { + "$id": "66", + "StatusCodes": [ + 200 + ], + "BodyType": { + "$ref": "9" + }, + "BodyMediaType": "Json" + } + }, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + }, + { + "$id": "67", + "Name": "delete", + "ResourceName": "User", + "Summary": "Deletes a user.", + "Description": "Deletes a User", + "Parameters": [ + { + "$ref": "42" + }, + { + "$ref": "46" + }, + { + "$id": "68", + "Name": "name", + "NameInRequest": "name", + "Description": "The name of user.", + "Type": { + "$id": "69", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "Location": "Path", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "70", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "71", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "72", + "Type": { + "$ref": "71" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "73", + "StatusCodes": [ + 202 + ], + "BodyType": { + "$ref": "9" + }, + "BodyMediaType": "Json", + "Headers": [ + { + "$id": "74", + "Name": "Operation-Location", + "NameInResponse": "operationLocation", + "Description": "The location for monitoring the operation state.", + "Type": { + "$id": "75", + "Name": "ResourceLocation", + "Kind": "Uri", + "IsNullable": false + } + } + ], + "IsErrorResponse": false + } + ], + "HttpMethod": "DELETE", + "RequestBodyMediaType": "None", + "Uri": "{host}", + "Path": "/azure/core/lro/standard/users/{name}", + "BufferResponse": true, + "LongRunning": { + "$id": "76", + "FinalStateVia": 3, + "FinalResponse": { + "$id": "77", + "StatusCodes": [ + 204 + ], + "BodyMediaType": "Json" + } + }, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + }, + { + "$id": "78", + "Name": "export", + "ResourceName": "Standard", + "Summary": "Exports a user.", + "Description": "Exports a User", + "Parameters": [ + { + "$ref": "42" + }, + { + "$ref": "46" + }, + { + "$id": "79", + "Name": "name", + "NameInRequest": "name", + "Description": "The name of user.", + "Type": { + "$id": "80", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "Location": "Path", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "81", + "Name": "format", + "NameInRequest": "format", + "Description": "The format of the data.", + "Type": { + "$id": "82", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "Location": "Query", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "83", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "84", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "85", + "Type": { + "$ref": "84" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "86", + "StatusCodes": [ + 202 + ], + "BodyType": { + "$ref": "14" + }, + "BodyMediaType": "Json", + "Headers": [ + { + "$id": "87", + "Name": "Operation-Location", + "NameInResponse": "operationLocation", + "Description": "The location for monitoring the operation state.", + "Type": { + "$id": "88", + "Name": "ResourceLocation", + "Kind": "Uri", + "IsNullable": false + } + } + ], + "IsErrorResponse": false + } + ], + "HttpMethod": "POST", + "RequestBodyMediaType": "None", + "Uri": "{host}", + "Path": "/azure/core/lro/standard/users/{name}:export", + "BufferResponse": true, + "LongRunning": { + "$id": "89", + "FinalStateVia": 3, + "FinalResponse": { + "$id": "90", + "StatusCodes": [ + 200 + ], + "BodyType": { + "$ref": "34" + }, + "BodyMediaType": "Json" + } + }, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + } + ], + "Protocol": { + "$id": "91" + }, + "Creatable": true + } + ] +} diff --git a/test/TestProjects/Lro-Basic-TypeSpec/src/LroBasicTypeSpec.csproj b/test/CadlRanchProjects/azure/core/lro/standard/src/_Azure.Lro.Standard.csproj similarity index 65% rename from test/TestProjects/Lro-Basic-TypeSpec/src/LroBasicTypeSpec.csproj rename to test/CadlRanchProjects/azure/core/lro/standard/src/_Azure.Lro.Standard.csproj index 6d355b95306..7c39099f247 100644 --- a/test/TestProjects/Lro-Basic-TypeSpec/src/LroBasicTypeSpec.csproj +++ b/test/CadlRanchProjects/azure/core/lro/standard/src/_Azure.Lro.Standard.csproj @@ -1,9 +1,9 @@ - This is the LroBasicTypeSpec client library for developing .NET applications with rich experience. - Azure SDK Code Generation LroBasicTypeSpec for Azure Data Plane + This is the _Azure.Lro.Standard client library for developing .NET applications with rich experience. + Azure SDK Code Generation _Azure.Lro.Standard for Azure Data Plane 1.0.0-beta.1 - LroBasicTypeSpec + _Azure.Lro.Standard $(RequiredTargetFrameworks) true diff --git a/test/CadlRanchProjects/azure/core/lro/standard/tests/Generated/Samples/Samples_StandardClient.cs b/test/CadlRanchProjects/azure/core/lro/standard/tests/Generated/Samples/Samples_StandardClient.cs new file mode 100644 index 00000000000..f195f9c5121 --- /dev/null +++ b/test/CadlRanchProjects/azure/core/lro/standard/tests/Generated/Samples/Samples_StandardClient.cs @@ -0,0 +1,270 @@ +// 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; +using Azure.Core; +using Azure.Identity; +using NUnit.Framework; +using _Azure.Lro.Standard; +using _Azure.Lro.Standard.Models; + +namespace _Azure.Lro.Standard.Samples +{ + public partial class Samples_StandardClient + { + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_CreateOrReplace_ShortVersion() + { + StandardClient client = new StandardClient(); + + using RequestContent content = RequestContent.Create(new + { + role = "", + }); + Operation operation = client.CreateOrReplace(WaitUntil.Completed, "", content); + BinaryData responseData = operation.Value; + + JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("role").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_CreateOrReplace_ShortVersion_Async() + { + StandardClient client = new StandardClient(); + + using RequestContent content = RequestContent.Create(new + { + role = "", + }); + Operation operation = await client.CreateOrReplaceAsync(WaitUntil.Completed, "", content); + BinaryData responseData = operation.Value; + + JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("role").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_CreateOrReplace_ShortVersion_Convenience() + { + StandardClient client = new StandardClient(); + + User resource = new User(""); + Operation operation = client.CreateOrReplace(WaitUntil.Completed, "", resource); + User responseData = operation.Value; + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_CreateOrReplace_ShortVersion_Convenience_Async() + { + StandardClient client = new StandardClient(); + + User resource = new User(""); + Operation operation = await client.CreateOrReplaceAsync(WaitUntil.Completed, "", resource); + User responseData = operation.Value; + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_CreateOrReplace_AllParameters() + { + StandardClient client = new StandardClient(); + + using RequestContent content = RequestContent.Create(new + { + role = "", + }); + Operation operation = client.CreateOrReplace(WaitUntil.Completed, "", content); + BinaryData responseData = operation.Value; + + JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("role").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_CreateOrReplace_AllParameters_Async() + { + StandardClient client = new StandardClient(); + + using RequestContent content = RequestContent.Create(new + { + role = "", + }); + Operation operation = await client.CreateOrReplaceAsync(WaitUntil.Completed, "", content); + BinaryData responseData = operation.Value; + + JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("role").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_CreateOrReplace_AllParameters_Convenience() + { + StandardClient client = new StandardClient(); + + User resource = new User(""); + Operation operation = client.CreateOrReplace(WaitUntil.Completed, "", resource); + User responseData = operation.Value; + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_CreateOrReplace_AllParameters_Convenience_Async() + { + StandardClient client = new StandardClient(); + + User resource = new User(""); + Operation operation = await client.CreateOrReplaceAsync(WaitUntil.Completed, "", resource); + User responseData = operation.Value; + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Delete_ShortVersion() + { + StandardClient client = new StandardClient(); + + Operation operation = client.Delete(WaitUntil.Completed, ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Delete_ShortVersion_Async() + { + StandardClient client = new StandardClient(); + + Operation operation = await client.DeleteAsync(WaitUntil.Completed, ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Delete_AllParameters() + { + StandardClient client = new StandardClient(); + + Operation operation = client.Delete(WaitUntil.Completed, ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Delete_AllParameters_Async() + { + StandardClient client = new StandardClient(); + + Operation operation = await client.DeleteAsync(WaitUntil.Completed, ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Export_ShortVersion() + { + StandardClient client = new StandardClient(); + + Operation operation = client.Export(WaitUntil.Completed, "", "", null); + BinaryData responseData = operation.Value; + + JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("resourceUri").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Export_ShortVersion_Async() + { + StandardClient client = new StandardClient(); + + Operation operation = await client.ExportAsync(WaitUntil.Completed, "", "", null); + BinaryData responseData = operation.Value; + + JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("resourceUri").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Export_ShortVersion_Convenience() + { + StandardClient client = new StandardClient(); + + Operation operation = client.Export(WaitUntil.Completed, "", ""); + ExportedUser responseData = operation.Value; + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Export_ShortVersion_Convenience_Async() + { + StandardClient client = new StandardClient(); + + Operation operation = await client.ExportAsync(WaitUntil.Completed, "", ""); + ExportedUser responseData = operation.Value; + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Export_AllParameters() + { + StandardClient client = new StandardClient(); + + Operation operation = client.Export(WaitUntil.Completed, "", "", null); + BinaryData responseData = operation.Value; + + JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("resourceUri").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Export_AllParameters_Async() + { + StandardClient client = new StandardClient(); + + Operation operation = await client.ExportAsync(WaitUntil.Completed, "", "", null); + BinaryData responseData = operation.Value; + + JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("resourceUri").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Export_AllParameters_Convenience() + { + StandardClient client = new StandardClient(); + + Operation operation = client.Export(WaitUntil.Completed, "", ""); + ExportedUser responseData = operation.Value; + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Export_AllParameters_Convenience_Async() + { + StandardClient client = new StandardClient(); + + Operation operation = await client.ExportAsync(WaitUntil.Completed, "", ""); + ExportedUser responseData = operation.Value; + } + } +} diff --git a/test/TestProjects/Lro-Basic-TypeSpec/tests/LroBasicTypeSpec.Tests.csproj b/test/CadlRanchProjects/azure/core/lro/standard/tests/_Azure.Lro.Standard.Tests.csproj similarity index 90% rename from test/TestProjects/Lro-Basic-TypeSpec/tests/LroBasicTypeSpec.Tests.csproj rename to test/CadlRanchProjects/azure/core/lro/standard/tests/_Azure.Lro.Standard.Tests.csproj index 98ad05e279e..ae3cb1298a8 100644 --- a/test/TestProjects/Lro-Basic-TypeSpec/tests/LroBasicTypeSpec.Tests.csproj +++ b/test/CadlRanchProjects/azure/core/lro/standard/tests/_Azure.Lro.Standard.Tests.csproj @@ -8,7 +8,7 @@ - + diff --git a/test/CadlRanchProjects/azure/core/lro/standard/tspconfig.yaml b/test/CadlRanchProjects/azure/core/lro/standard/tspconfig.yaml new file mode 100644 index 00000000000..48a3ed26297 --- /dev/null +++ b/test/CadlRanchProjects/azure/core/lro/standard/tspconfig.yaml @@ -0,0 +1,3 @@ +options: + "@azure-tools/typespec-csharp": + namespace: _Azure.Lro.Standard diff --git a/test/TestProjects/Authoring-TypeSpec/src/Generated/AuthoringTypeSpecClient.cs b/test/TestProjects/Authoring-TypeSpec/src/Generated/AuthoringTypeSpecClient.cs index 99bbc1a9b75..efd22859974 100644 --- a/test/TestProjects/Authoring-TypeSpec/src/Generated/AuthoringTypeSpecClient.cs +++ b/test/TestProjects/Authoring-TypeSpec/src/Generated/AuthoringTypeSpecClient.cs @@ -58,7 +58,7 @@ public AuthoringTypeSpecClient(Uri endpoint, AuthoringTypeSpecClientOptions opti } /// - /// [Protocol Method] Creates a new project or updates an existing one. + /// [Protocol Method] Gets the details of a project. /// /// /// @@ -68,23 +68,21 @@ public AuthoringTypeSpecClient(Uri endpoint, AuthoringTypeSpecClientOptions opti /// /// /// The String to use. - /// 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 null. /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. - /// - public virtual async Task CreateOrUpdateAsync(string projectName, RequestContent content, RequestContext context = null) + /// + public virtual async Task GetProjectAsync(string projectName, RequestContext context = null) { Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNull(content, nameof(content)); - using var scope = ClientDiagnostics.CreateScope("AuthoringTypeSpecClient.CreateOrUpdate"); + using var scope = ClientDiagnostics.CreateScope("AuthoringTypeSpecClient.GetProject"); scope.Start(); try { - using HttpMessage message = CreateCreateOrUpdateRequest(projectName, content, context); + using HttpMessage message = CreateGetProjectRequest(projectName, context); return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) @@ -95,7 +93,7 @@ public virtual async Task CreateOrUpdateAsync(string projectName, Requ } /// - /// [Protocol Method] Creates a new project or updates an existing one. + /// [Protocol Method] Gets the details of a project. /// /// /// @@ -105,23 +103,21 @@ public virtual async Task CreateOrUpdateAsync(string projectName, Requ /// /// /// The String to use. - /// 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 null. /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. - /// - public virtual Response CreateOrUpdate(string projectName, RequestContent content, RequestContext context = null) + /// + public virtual Response GetProject(string projectName, RequestContext context = null) { Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNull(content, nameof(content)); - using var scope = ClientDiagnostics.CreateScope("AuthoringTypeSpecClient.CreateOrUpdate"); + using var scope = ClientDiagnostics.CreateScope("AuthoringTypeSpecClient.GetProject"); scope.Start(); try { - using HttpMessage message = CreateCreateOrUpdateRequest(projectName, content, context); + using HttpMessage message = CreateGetProjectRequest(projectName, context); return _pipeline.ProcessMessage(message, context); } catch (Exception e) @@ -132,7 +128,7 @@ public virtual Response CreateOrUpdate(string projectName, RequestContent conten } /// - /// [Protocol Method] Gets the details of a project. + /// [Protocol Method] Gets the details of a deployment. /// /// /// @@ -142,21 +138,23 @@ public virtual Response CreateOrUpdate(string projectName, RequestContent conten /// /// /// The String to use. + /// The String to use. /// 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. + /// 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 GetProjectAsync(string projectName, RequestContext context = null) + /// + public virtual async Task GetDeploymentAsync(string projectName, string deploymentName, RequestContext context = null) { Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); - using var scope = ClientDiagnostics.CreateScope("AuthoringTypeSpecClient.GetProject"); + using var scope = ClientDiagnostics.CreateScope("AuthoringTypeSpecClient.GetDeployment"); scope.Start(); try { - using HttpMessage message = CreateGetProjectRequest(projectName, context); + using HttpMessage message = CreateGetDeploymentRequest(projectName, deploymentName, context); return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) @@ -167,7 +165,7 @@ public virtual async Task GetProjectAsync(string projectName, RequestC } /// - /// [Protocol Method] Gets the details of a project. + /// [Protocol Method] Gets the details of a deployment. /// /// /// @@ -177,21 +175,23 @@ public virtual async Task GetProjectAsync(string projectName, RequestC /// /// /// The String to use. + /// The String to use. /// 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. + /// 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 GetProject(string projectName, RequestContext context = null) + /// + public virtual Response GetDeployment(string projectName, string deploymentName, RequestContext context = null) { Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); - using var scope = ClientDiagnostics.CreateScope("AuthoringTypeSpecClient.GetProject"); + using var scope = ClientDiagnostics.CreateScope("AuthoringTypeSpecClient.GetDeployment"); scope.Start(); try { - using HttpMessage message = CreateGetProjectRequest(projectName, context); + using HttpMessage message = CreateGetDeploymentRequest(projectName, deploymentName, context); return _pipeline.ProcessMessage(message, context); } catch (Exception e) @@ -201,33 +201,27 @@ public virtual Response GetProject(string projectName, RequestContext context = } } - /// - /// [Protocol Method] Deletes a project. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// + /// Gets the status of an existing deployment job. /// The String to use. - /// 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 projectName, RequestContext context = null) + /// The String to use. + /// The String to use. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + /// + public virtual async Task> GetDeploymentStatusValueAsync(string projectName, string deploymentName, string jobId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); + Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); - using var scope = ClientDiagnostics.CreateScope("AuthoringTypeSpecClient.Delete"); + using var scope = ClientDiagnostics.CreateScope("AuthoringTypeSpecClient.GetDeploymentStatusValue"); scope.Start(); try { - using HttpMessage message = CreateDeleteRequest(projectName, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await GetDeploymentStatusAsync(projectName, deploymentName, jobId, context).ConfigureAwait(false); + return Response.FromValue(DeploymentJob.FromResponse(response), response); } catch (Exception e) { @@ -236,33 +230,27 @@ public virtual async Task DeleteAsync(string projectName, RequestConte } } - /// - /// [Protocol Method] Deletes a project. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// + /// Gets the status of an existing deployment job. /// The String to use. - /// 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 projectName, RequestContext context = null) + /// The String to use. + /// The String to use. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + /// + public virtual Response GetDeploymentStatusValue(string projectName, string deploymentName, string jobId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); + Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); - using var scope = ClientDiagnostics.CreateScope("AuthoringTypeSpecClient.Delete"); + using var scope = ClientDiagnostics.CreateScope("AuthoringTypeSpecClient.GetDeploymentStatusValue"); scope.Start(); try { - using HttpMessage message = CreateDeleteRequest(projectName, context); - return _pipeline.ProcessMessage(message, context); + RequestContext context = FromCancellationToken(cancellationToken); + Response response = GetDeploymentStatus(projectName, deploymentName, jobId, context); + return Response.FromValue(DeploymentJob.FromResponse(response), response); } catch (Exception e) { @@ -272,33 +260,40 @@ public virtual Response Delete(string projectName, RequestContext context = null } /// - /// [Protocol Method] Triggers a job to export a project's data. + /// [Protocol Method] Gets the status of an existing deployment job. /// /// /// /// 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 String to use. - /// The String to use. + /// The String to use. + /// The String to use. /// 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. + /// , 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 ExportAsync(string projectName, string projectFileVersion, RequestContext context = null) + /// + public virtual async Task GetDeploymentStatusAsync(string projectName, string deploymentName, string jobId, RequestContext context = null) { Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNull(projectFileVersion, nameof(projectFileVersion)); + Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); + Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); - using var scope = ClientDiagnostics.CreateScope("AuthoringTypeSpecClient.Export"); + using var scope = ClientDiagnostics.CreateScope("AuthoringTypeSpecClient.GetDeploymentStatus"); scope.Start(); try { - using HttpMessage message = CreateExportRequest(projectName, projectFileVersion, context); + using HttpMessage message = CreateGetDeploymentStatusRequest(projectName, deploymentName, jobId, context); return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) @@ -309,33 +304,40 @@ public virtual async Task ExportAsync(string projectName, string proje } /// - /// [Protocol Method] Triggers a job to export a project's data. + /// [Protocol Method] Gets the status of an existing deployment job. /// /// /// /// 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 String to use. - /// The String to use. + /// The String to use. + /// The String to use. /// 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. + /// , 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 Export(string projectName, string projectFileVersion, RequestContext context = null) + /// + public virtual Response GetDeploymentStatus(string projectName, string deploymentName, string jobId, RequestContext context = null) { Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNull(projectFileVersion, nameof(projectFileVersion)); + Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); + Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); - using var scope = ClientDiagnostics.CreateScope("AuthoringTypeSpecClient.Export"); + using var scope = ClientDiagnostics.CreateScope("AuthoringTypeSpecClient.GetDeploymentStatus"); scope.Start(); try { - using HttpMessage message = CreateExportRequest(projectName, projectFileVersion, context); + using HttpMessage message = CreateGetDeploymentStatusRequest(projectName, deploymentName, jobId, context); return _pipeline.ProcessMessage(message, context); } catch (Exception e) @@ -345,33 +347,27 @@ public virtual Response Export(string projectName, string projectFileVersion, Re } } - /// - /// [Protocol Method] Triggers a job to export a project's data. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// + /// Gets the status of an existing swap deployment job. /// The String to use. - /// 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 ImportxAsync(string projectName, RequestContext context = null) + /// The String to use. + /// The String to use. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + /// + public virtual async Task> GetSwapDeploymentsStatusValueAsync(string projectName, string deploymentName, string jobId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); + Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); - using var scope = ClientDiagnostics.CreateScope("AuthoringTypeSpecClient.Importx"); + using var scope = ClientDiagnostics.CreateScope("AuthoringTypeSpecClient.GetSwapDeploymentsStatusValue"); scope.Start(); try { - using HttpMessage message = CreateImportxRequest(projectName, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await GetSwapDeploymentsStatusAsync(projectName, deploymentName, jobId, context).ConfigureAwait(false); + return Response.FromValue(SwapDeploymentsJob.FromResponse(response), response); } catch (Exception e) { @@ -380,33 +376,27 @@ public virtual async Task ImportxAsync(string projectName, RequestCont } } - /// - /// [Protocol Method] Triggers a job to export a project's data. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// + /// Gets the status of an existing swap deployment job. /// The String to use. - /// 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 Importx(string projectName, RequestContext context = null) + /// The String to use. + /// The String to use. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + /// + public virtual Response GetSwapDeploymentsStatusValue(string projectName, string deploymentName, string jobId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); + Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); - using var scope = ClientDiagnostics.CreateScope("AuthoringTypeSpecClient.Importx"); + using var scope = ClientDiagnostics.CreateScope("AuthoringTypeSpecClient.GetSwapDeploymentsStatusValue"); scope.Start(); try { - using HttpMessage message = CreateImportxRequest(projectName, context); - return _pipeline.ProcessMessage(message, context); + RequestContext context = FromCancellationToken(cancellationToken); + Response response = GetSwapDeploymentsStatus(projectName, deploymentName, jobId, context); + return Response.FromValue(SwapDeploymentsJob.FromResponse(response), response); } catch (Exception e) { @@ -416,33 +406,40 @@ public virtual Response Importx(string projectName, RequestContext context = nul } /// - /// [Protocol Method] Triggers a training job for a project. + /// [Protocol Method] Gets the status of an existing swap deployment job. /// /// /// /// 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 String to use. - /// The content to send as the body of the request. + /// The String to use. + /// The String to use. /// 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. + /// , 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 TrainAsync(string projectName, RequestContent content, RequestContext context = null) + /// + public virtual async Task GetSwapDeploymentsStatusAsync(string projectName, string deploymentName, string jobId, RequestContext context = null) { Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); + Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); - using var scope = ClientDiagnostics.CreateScope("AuthoringTypeSpecClient.Train"); + using var scope = ClientDiagnostics.CreateScope("AuthoringTypeSpecClient.GetSwapDeploymentsStatus"); scope.Start(); try { - using HttpMessage message = CreateTrainRequest(projectName, content, context); + using HttpMessage message = CreateGetSwapDeploymentsStatusRequest(projectName, deploymentName, jobId, context); return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) @@ -453,33 +450,40 @@ public virtual async Task TrainAsync(string projectName, RequestConten } /// - /// [Protocol Method] Triggers a training job for a project. + /// [Protocol Method] Gets the status of an existing swap deployment job. /// /// /// /// 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 String to use. - /// The content to send as the body of the request. + /// The String to use. + /// The String to use. /// 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. + /// , 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 Train(string projectName, RequestContent content, RequestContext context = null) + /// + public virtual Response GetSwapDeploymentsStatus(string projectName, string deploymentName, string jobId, RequestContext context = null) { Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); + Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); - using var scope = ClientDiagnostics.CreateScope("AuthoringTypeSpecClient.Train"); + using var scope = ClientDiagnostics.CreateScope("AuthoringTypeSpecClient.GetSwapDeploymentsStatus"); scope.Start(); try { - using HttpMessage message = CreateTrainRequest(projectName, content, context); + using HttpMessage message = CreateGetSwapDeploymentsStatusRequest(projectName, deploymentName, jobId, context); return _pipeline.ProcessMessage(message, context); } catch (Exception e) @@ -490,7 +494,7 @@ public virtual Response Train(string projectName, RequestContent content, Reques } /// - /// [Protocol Method] Gets the details of a deployment. + /// [Protocol Method] Lists the existing projects. /// /// /// @@ -499,35 +503,19 @@ public virtual Response Train(string projectName, RequestContent content, Reques /// /// /// - /// The String to use. - /// The String to use. /// 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 GetDeploymentAsync(string projectName, string deploymentName, RequestContext context = null) + /// 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 GetProjectsAsync(RequestContext context = null) { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); - - using var scope = ClientDiagnostics.CreateScope("AuthoringTypeSpecClient.GetDeployment"); - scope.Start(); - try - { - using HttpMessage message = CreateGetDeploymentRequest(projectName, deploymentName, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetProjectsRequest(context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetProjectsNextPageRequest(nextLink, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "AuthoringTypeSpecClient.GetProjects", "value", "nextLink", context); } /// - /// [Protocol Method] Gets the details of a deployment. + /// [Protocol Method] Lists the existing projects. /// /// /// @@ -536,35 +524,19 @@ public virtual async Task GetDeploymentAsync(string projectName, strin /// /// /// - /// The String to use. - /// The String to use. /// 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 GetDeployment(string projectName, string deploymentName, RequestContext context = null) + /// 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 GetProjects(RequestContext context = null) { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); - - using var scope = ClientDiagnostics.CreateScope("AuthoringTypeSpecClient.GetDeployment"); - scope.Start(); - try - { - using HttpMessage message = CreateGetDeploymentRequest(projectName, deploymentName, context); - return _pipeline.ProcessMessage(message, context); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetProjectsRequest(context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetProjectsNextPageRequest(nextLink, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "AuthoringTypeSpecClient.GetProjects", "value", "nextLink", context); } /// - /// [Protocol Method] Creates a new deployment or replaces an existing one. + /// [Protocol Method] Lists the existing deployments. /// /// /// @@ -574,36 +546,23 @@ public virtual Response GetDeployment(string projectName, string deploymentName, /// /// /// The String to use. - /// The String to use. - /// The content to send as the body of the request. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// , or is null. - /// or is an empty string, and was expected to be non-empty. + /// 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 DeployProjectAsync(string projectName, string deploymentName, RequestContent content, RequestContext context = null) + /// 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 GetDeploymentsAsync(string projectName, RequestContext context = null) { Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); - Argument.AssertNotNull(content, nameof(content)); - using var scope = ClientDiagnostics.CreateScope("AuthoringTypeSpecClient.DeployProject"); - scope.Start(); - try - { - using HttpMessage message = CreateDeployProjectRequest(projectName, deploymentName, content, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetDeploymentsRequest(projectName, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetDeploymentsNextPageRequest(nextLink, projectName, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "AuthoringTypeSpecClient.GetDeployments", "value", "nextLink", context); } /// - /// [Protocol Method] Creates a new deployment or replaces an existing one. + /// [Protocol Method] Lists the existing deployments. /// /// /// @@ -613,36 +572,23 @@ public virtual async Task DeployProjectAsync(string projectName, strin /// /// /// The String to use. - /// The String to use. - /// The content to send as the body of the request. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// , or is null. - /// or is an empty string, and was expected to be non-empty. + /// 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 DeployProject(string projectName, string deploymentName, RequestContent content, RequestContext context = null) + /// 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 GetDeployments(string projectName, RequestContext context = null) { Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); - Argument.AssertNotNull(content, nameof(content)); - using var scope = ClientDiagnostics.CreateScope("AuthoringTypeSpecClient.DeployProject"); - scope.Start(); - try - { - using HttpMessage message = CreateDeployProjectRequest(projectName, deploymentName, content, context); - return _pipeline.ProcessMessage(message, context); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetDeploymentsRequest(projectName, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetDeploymentsNextPageRequest(nextLink, projectName, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "AuthoringTypeSpecClient.GetDeployments", "value", "nextLink", context); } /// - /// [Protocol Method] Deletes a project deployment. + /// [Protocol Method] /// /// /// @@ -651,35 +597,46 @@ public virtual Response DeployProject(string projectName, string deploymentName, /// /// /// - /// The String to use. - /// The String to use. + /// The Int32 to use. + /// The Int32 to use. + /// The Int32 to use. /// 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 DeleteDeploymentAsync(string projectName, string deploymentName, RequestContext context = null) + /// 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 GetSupportedLanguagesAsync(int? maxCount = null, int? skip = null, int? maxpagesize = null, RequestContext context = null) { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetSupportedLanguagesRequest(maxCount, skip, maxpagesize, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetSupportedLanguagesNextPageRequest(nextLink, maxCount, skip, maxpagesize, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "AuthoringTypeSpecClient.GetSupportedLanguages", "value", "nextLink", context); + } - using var scope = ClientDiagnostics.CreateScope("AuthoringTypeSpecClient.DeleteDeployment"); - scope.Start(); - try - { - using HttpMessage message = CreateDeleteDeploymentRequest(projectName, deploymentName, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } + /// + /// [Protocol Method] + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// The Int32 to use. + /// The Int32 to use. + /// The Int32 to use. + /// 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 GetSupportedLanguages(int? maxCount = null, int? skip = null, int? maxpagesize = null, RequestContext context = null) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetSupportedLanguagesRequest(maxCount, skip, maxpagesize, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetSupportedLanguagesNextPageRequest(nextLink, maxCount, skip, maxpagesize, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "AuthoringTypeSpecClient.GetSupportedLanguages", "value", "nextLink", context); } /// - /// [Protocol Method] Deletes a project deployment. + /// [Protocol Method] /// /// /// @@ -688,35 +645,46 @@ public virtual async Task DeleteDeploymentAsync(string projectName, st /// /// /// - /// The String to use. - /// The String to use. + /// The Int32 to use. + /// The Int32 to use. + /// The Int32 to use. /// 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 DeleteDeployment(string projectName, string deploymentName, RequestContext context = null) + /// 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 GetTrainingConfigVersionsAsync(int? maxCount = null, int? skip = null, int? maxpagesize = null, RequestContext context = null) { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetTrainingConfigVersionsRequest(maxCount, skip, maxpagesize, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetTrainingConfigVersionsNextPageRequest(nextLink, maxCount, skip, maxpagesize, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "AuthoringTypeSpecClient.GetTrainingConfigVersions", "value", "nextLink", context); + } - using var scope = ClientDiagnostics.CreateScope("AuthoringTypeSpecClient.DeleteDeployment"); - scope.Start(); - try - { - using HttpMessage message = CreateDeleteDeploymentRequest(projectName, deploymentName, context); - return _pipeline.ProcessMessage(message, context); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } + /// + /// [Protocol Method] + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// The Int32 to use. + /// The Int32 to use. + /// The Int32 to use. + /// 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 GetTrainingConfigVersions(int? maxCount = null, int? skip = null, int? maxpagesize = null, RequestContext context = null) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetTrainingConfigVersionsRequest(maxCount, skip, maxpagesize, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetTrainingConfigVersionsNextPageRequest(nextLink, maxCount, skip, maxpagesize, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "AuthoringTypeSpecClient.GetTrainingConfigVersions", "value", "nextLink", context); } /// - /// [Protocol Method] Swaps two existing deployments with each other. + /// [Protocol Method] Creates a new project or updates an existing one. /// /// /// @@ -725,25 +693,26 @@ public virtual Response DeleteDeployment(string projectName, string deploymentNa /// /// /// + /// 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 String to use. /// 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 SwapDeploymentsAsync(string projectName, RequestContent content, RequestContext context = null) + /// The representing an asynchronous operation on the service. + /// + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string projectName, RequestContent content, RequestContext context = null) { Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); Argument.AssertNotNull(content, nameof(content)); - using var scope = ClientDiagnostics.CreateScope("AuthoringTypeSpecClient.SwapDeployments"); + using var scope = ClientDiagnostics.CreateScope("AuthoringTypeSpecClient.CreateOrUpdate"); scope.Start(); try { - using HttpMessage message = CreateSwapDeploymentsRequest(projectName, content, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + using HttpMessage message = CreateCreateOrUpdateRequest(projectName, content, context); + return await ProtocolOperationHelpers.ProcessMessageAsync(_pipeline, message, ClientDiagnostics, "AuthoringTypeSpecClient.CreateOrUpdate", OperationFinalStateVia.OperationLocation, context, waitUntil).ConfigureAwait(false); } catch (Exception e) { @@ -753,7 +722,7 @@ public virtual async Task SwapDeploymentsAsync(string projectName, Req } /// - /// [Protocol Method] Swaps two existing deployments with each other. + /// [Protocol Method] Creates a new project or updates an existing one. /// /// /// @@ -762,83 +731,26 @@ public virtual async Task SwapDeploymentsAsync(string projectName, Req /// /// /// + /// 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 String to use. /// 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 SwapDeployments(string projectName, RequestContent content, RequestContext context = null) + /// The representing an asynchronous operation on the service. + /// + public virtual Operation CreateOrUpdate(WaitUntil waitUntil, string projectName, RequestContent content, RequestContext context = null) { Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); Argument.AssertNotNull(content, nameof(content)); - using var scope = ClientDiagnostics.CreateScope("AuthoringTypeSpecClient.SwapDeployments"); - scope.Start(); - try - { - using HttpMessage message = CreateSwapDeploymentsRequest(projectName, content, context); - return _pipeline.ProcessMessage(message, context); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Gets the status of an existing deployment job. - /// The String to use. - /// The String to use. - /// The String to use. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - /// - public virtual async Task> GetDeploymentStatusValueAsync(string projectName, string deploymentName, string jobId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); - Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); - - using var scope = ClientDiagnostics.CreateScope("AuthoringTypeSpecClient.GetDeploymentStatusValue"); - scope.Start(); - try - { - RequestContext context = FromCancellationToken(cancellationToken); - Response response = await GetDeploymentStatusAsync(projectName, deploymentName, jobId, context).ConfigureAwait(false); - return Response.FromValue(DeploymentJob.FromResponse(response), response); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Gets the status of an existing deployment job. - /// The String to use. - /// The String to use. - /// The String to use. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - /// - public virtual Response GetDeploymentStatusValue(string projectName, string deploymentName, string jobId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); - Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); - - using var scope = ClientDiagnostics.CreateScope("AuthoringTypeSpecClient.GetDeploymentStatusValue"); + using var scope = ClientDiagnostics.CreateScope("AuthoringTypeSpecClient.CreateOrUpdate"); scope.Start(); try { - RequestContext context = FromCancellationToken(cancellationToken); - Response response = GetDeploymentStatus(projectName, deploymentName, jobId, context); - return Response.FromValue(DeploymentJob.FromResponse(response), response); + using HttpMessage message = CreateCreateOrUpdateRequest(projectName, content, context); + return ProtocolOperationHelpers.ProcessMessage(_pipeline, message, ClientDiagnostics, "AuthoringTypeSpecClient.CreateOrUpdate", OperationFinalStateVia.OperationLocation, context, waitUntil); } catch (Exception e) { @@ -848,41 +760,33 @@ public virtual Response GetDeploymentStatusValue(string projectNa } /// - /// [Protocol Method] Gets the status of an existing deployment job. + /// [Protocol Method] Deletes a project. /// /// /// /// 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 String to use. - /// The String to use. - /// The String to use. /// 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. + /// 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 GetDeploymentStatusAsync(string projectName, string deploymentName, string jobId, RequestContext context = null) + /// The representing an asynchronous operation on the service. + /// + public virtual async Task DeleteAsync(WaitUntil waitUntil, string projectName, RequestContext context = null) { Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); - Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); - using var scope = ClientDiagnostics.CreateScope("AuthoringTypeSpecClient.GetDeploymentStatus"); + using var scope = ClientDiagnostics.CreateScope("AuthoringTypeSpecClient.Delete"); scope.Start(); try { - using HttpMessage message = CreateGetDeploymentStatusRequest(projectName, deploymentName, jobId, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + using HttpMessage message = CreateDeleteRequest(projectName, context); + return await ProtocolOperationHelpers.ProcessMessageWithoutResponseValueAsync(_pipeline, message, ClientDiagnostics, "AuthoringTypeSpecClient.Delete", OperationFinalStateVia.OperationLocation, context, waitUntil).ConfigureAwait(false); } catch (Exception e) { @@ -892,41 +796,33 @@ public virtual async Task GetDeploymentStatusAsync(string projectName, } /// - /// [Protocol Method] Gets the status of an existing deployment job. + /// [Protocol Method] Deletes a project. /// /// /// /// 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 String to use. - /// The String to use. - /// The String to use. /// 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. + /// 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 GetDeploymentStatus(string projectName, string deploymentName, string jobId, RequestContext context = null) + /// The representing an asynchronous operation on the service. + /// + public virtual Operation Delete(WaitUntil waitUntil, string projectName, RequestContext context = null) { Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); - Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); - using var scope = ClientDiagnostics.CreateScope("AuthoringTypeSpecClient.GetDeploymentStatus"); + using var scope = ClientDiagnostics.CreateScope("AuthoringTypeSpecClient.Delete"); scope.Start(); try { - using HttpMessage message = CreateGetDeploymentStatusRequest(projectName, deploymentName, jobId, context); - return _pipeline.ProcessMessage(message, context); + using HttpMessage message = CreateDeleteRequest(projectName, context); + return ProtocolOperationHelpers.ProcessMessageWithoutResponseValue(_pipeline, message, ClientDiagnostics, "AuthoringTypeSpecClient.Delete", OperationFinalStateVia.OperationLocation, context, waitUntil); } catch (Exception e) { @@ -935,27 +831,36 @@ public virtual Response GetDeploymentStatus(string projectName, string deploymen } } - /// Gets the status of an existing swap deployment job. + /// + /// [Protocol Method] Triggers a job to export a project's data. + /// + /// + /// + /// 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 String to use. - /// The String to use. - /// The String to use. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - /// - public virtual async Task> GetSwapDeploymentsStatusValueAsync(string projectName, string deploymentName, string jobId, CancellationToken cancellationToken = default) + /// The String to use. + /// 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> ExportAsync(WaitUntil waitUntil, string projectName, string projectFileVersion, RequestContext context = null) { Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); - Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); + Argument.AssertNotNull(projectFileVersion, nameof(projectFileVersion)); - using var scope = ClientDiagnostics.CreateScope("AuthoringTypeSpecClient.GetSwapDeploymentsStatusValue"); + using var scope = ClientDiagnostics.CreateScope("AuthoringTypeSpecClient.Export"); scope.Start(); try { - RequestContext context = FromCancellationToken(cancellationToken); - Response response = await GetSwapDeploymentsStatusAsync(projectName, deploymentName, jobId, context).ConfigureAwait(false); - return Response.FromValue(SwapDeploymentsJob.FromResponse(response), response); + using HttpMessage message = CreateExportRequest(projectName, projectFileVersion, context); + return await ProtocolOperationHelpers.ProcessMessageAsync(_pipeline, message, ClientDiagnostics, "AuthoringTypeSpecClient.Export", OperationFinalStateVia.OperationLocation, context, waitUntil).ConfigureAwait(false); } catch (Exception e) { @@ -964,27 +869,36 @@ public virtual async Task> GetSwapDeploymentsStatus } } - /// Gets the status of an existing swap deployment job. + /// + /// [Protocol Method] Triggers a job to export a project's data. + /// + /// + /// + /// 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 String to use. - /// The String to use. - /// The String to use. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - /// - public virtual Response GetSwapDeploymentsStatusValue(string projectName, string deploymentName, string jobId, CancellationToken cancellationToken = default) + /// The String to use. + /// 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 Export(WaitUntil waitUntil, string projectName, string projectFileVersion, RequestContext context = null) { Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); - Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); + Argument.AssertNotNull(projectFileVersion, nameof(projectFileVersion)); - using var scope = ClientDiagnostics.CreateScope("AuthoringTypeSpecClient.GetSwapDeploymentsStatusValue"); + using var scope = ClientDiagnostics.CreateScope("AuthoringTypeSpecClient.Export"); scope.Start(); try { - RequestContext context = FromCancellationToken(cancellationToken); - Response response = GetSwapDeploymentsStatus(projectName, deploymentName, jobId, context); - return Response.FromValue(SwapDeploymentsJob.FromResponse(response), response); + using HttpMessage message = CreateExportRequest(projectName, projectFileVersion, context); + return ProtocolOperationHelpers.ProcessMessage(_pipeline, message, ClientDiagnostics, "AuthoringTypeSpecClient.Export", OperationFinalStateVia.OperationLocation, context, waitUntil); } catch (Exception e) { @@ -994,41 +908,33 @@ public virtual Response GetSwapDeploymentsStatusValue(string } /// - /// [Protocol Method] Gets the status of an existing swap deployment job. + /// [Protocol Method] Triggers a job to export a project's data. /// /// /// /// 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 String to use. - /// The String to use. - /// The String to use. /// 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. + /// 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 GetSwapDeploymentsStatusAsync(string projectName, string deploymentName, string jobId, RequestContext context = null) + /// The representing an asynchronous operation on the service. + /// + public virtual async Task> ImportxAsync(WaitUntil waitUntil, string projectName, RequestContext context = null) { Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); - Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); - using var scope = ClientDiagnostics.CreateScope("AuthoringTypeSpecClient.GetSwapDeploymentsStatus"); + using var scope = ClientDiagnostics.CreateScope("AuthoringTypeSpecClient.Importx"); scope.Start(); try { - using HttpMessage message = CreateGetSwapDeploymentsStatusRequest(projectName, deploymentName, jobId, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + using HttpMessage message = CreateImportxRequest(projectName, context); + return await ProtocolOperationHelpers.ProcessMessageAsync(_pipeline, message, ClientDiagnostics, "AuthoringTypeSpecClient.Importx", OperationFinalStateVia.OperationLocation, context, waitUntil).ConfigureAwait(false); } catch (Exception e) { @@ -1038,41 +944,33 @@ public virtual async Task GetSwapDeploymentsStatusAsync(string project } /// - /// [Protocol Method] Gets the status of an existing swap deployment job. + /// [Protocol Method] Triggers a job to export a project's data. /// /// /// /// 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 String to use. - /// The String to use. - /// The String to use. /// 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. + /// 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 GetSwapDeploymentsStatus(string projectName, string deploymentName, string jobId, RequestContext context = null) + /// The representing an asynchronous operation on the service. + /// + public virtual Operation Importx(WaitUntil waitUntil, string projectName, RequestContext context = null) { Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); - Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); - using var scope = ClientDiagnostics.CreateScope("AuthoringTypeSpecClient.GetSwapDeploymentsStatus"); + using var scope = ClientDiagnostics.CreateScope("AuthoringTypeSpecClient.Importx"); scope.Start(); try { - using HttpMessage message = CreateGetSwapDeploymentsStatusRequest(projectName, deploymentName, jobId, context); - return _pipeline.ProcessMessage(message, context); + using HttpMessage message = CreateImportxRequest(projectName, context); + return ProtocolOperationHelpers.ProcessMessage(_pipeline, message, ClientDiagnostics, "AuthoringTypeSpecClient.Importx", OperationFinalStateVia.OperationLocation, context, waitUntil); } catch (Exception e) { @@ -1082,7 +980,7 @@ public virtual Response GetSwapDeploymentsStatus(string projectName, string depl } /// - /// [Protocol Method] Lists the existing projects. + /// [Protocol Method] Triggers a training job for a project. /// /// /// @@ -1091,19 +989,36 @@ public virtual Response GetSwapDeploymentsStatus(string projectName, string depl /// /// /// + /// 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 String to use. + /// 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 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 GetProjectsAsync(RequestContext context = null) + /// The representing an asynchronous operation on the service. + /// + public virtual async Task> TrainAsync(WaitUntil waitUntil, string projectName, RequestContent content, RequestContext context = null) { - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetProjectsRequest(context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetProjectsNextPageRequest(nextLink, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "AuthoringTypeSpecClient.GetProjects", "value", "nextLink", context); + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("AuthoringTypeSpecClient.Train"); + scope.Start(); + try + { + using HttpMessage message = CreateTrainRequest(projectName, content, context); + return await ProtocolOperationHelpers.ProcessMessageAsync(_pipeline, message, ClientDiagnostics, "AuthoringTypeSpecClient.Train", OperationFinalStateVia.OperationLocation, context, waitUntil).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } } /// - /// [Protocol Method] Lists the existing projects. + /// [Protocol Method] Triggers a training job for a project. /// /// /// @@ -1112,19 +1027,36 @@ public virtual AsyncPageable GetProjectsAsync(RequestContext context /// /// /// + /// 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 String to use. + /// 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 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 GetProjects(RequestContext context = null) + /// The representing an asynchronous operation on the service. + /// + public virtual Operation Train(WaitUntil waitUntil, string projectName, RequestContent content, RequestContext context = null) { - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetProjectsRequest(context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetProjectsNextPageRequest(nextLink, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "AuthoringTypeSpecClient.GetProjects", "value", "nextLink", context); + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("AuthoringTypeSpecClient.Train"); + scope.Start(); + try + { + using HttpMessage message = CreateTrainRequest(projectName, content, context); + return ProtocolOperationHelpers.ProcessMessage(_pipeline, message, ClientDiagnostics, "AuthoringTypeSpecClient.Train", OperationFinalStateVia.OperationLocation, context, waitUntil); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } } /// - /// [Protocol Method] Lists the existing deployments. + /// [Protocol Method] Creates a new deployment or replaces an existing one. /// /// /// @@ -1133,24 +1065,38 @@ public virtual Pageable GetProjects(RequestContext context = null) /// /// /// + /// 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 String to use. + /// The String to use. + /// The content to send as the body of the request. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// , or is null. + /// or 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 GetDeploymentsAsync(string projectName, RequestContext context = null) + /// The representing an asynchronous operation on the service. + /// + public virtual async Task> DeployProjectAsync(WaitUntil waitUntil, string projectName, string deploymentName, RequestContent content, RequestContext context = null) { Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); + Argument.AssertNotNull(content, nameof(content)); - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetDeploymentsRequest(projectName, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetDeploymentsNextPageRequest(nextLink, projectName, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "AuthoringTypeSpecClient.GetDeployments", "value", "nextLink", context); + using var scope = ClientDiagnostics.CreateScope("AuthoringTypeSpecClient.DeployProject"); + scope.Start(); + try + { + using HttpMessage message = CreateDeployProjectRequest(projectName, deploymentName, content, context); + return await ProtocolOperationHelpers.ProcessMessageAsync(_pipeline, message, ClientDiagnostics, "AuthoringTypeSpecClient.DeployProject", OperationFinalStateVia.OperationLocation, context, waitUntil).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } } /// - /// [Protocol Method] Lists the existing deployments. + /// [Protocol Method] Creates a new deployment or replaces an existing one. /// /// /// @@ -1159,24 +1105,38 @@ public virtual AsyncPageable GetDeploymentsAsync(string projectName, /// /// /// + /// 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 String to use. + /// The String to use. + /// The content to send as the body of the request. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// , or is null. + /// or 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 GetDeployments(string projectName, RequestContext context = null) + /// The representing an asynchronous operation on the service. + /// + public virtual Operation DeployProject(WaitUntil waitUntil, string projectName, string deploymentName, RequestContent content, RequestContext context = null) { Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); + Argument.AssertNotNull(content, nameof(content)); - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetDeploymentsRequest(projectName, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetDeploymentsNextPageRequest(nextLink, projectName, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "AuthoringTypeSpecClient.GetDeployments", "value", "nextLink", context); + using var scope = ClientDiagnostics.CreateScope("AuthoringTypeSpecClient.DeployProject"); + scope.Start(); + try + { + using HttpMessage message = CreateDeployProjectRequest(projectName, deploymentName, content, context); + return ProtocolOperationHelpers.ProcessMessage(_pipeline, message, ClientDiagnostics, "AuthoringTypeSpecClient.DeployProject", OperationFinalStateVia.OperationLocation, context, waitUntil); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } } /// - /// [Protocol Method] + /// [Protocol Method] Deletes a project deployment. /// /// /// @@ -1185,22 +1145,36 @@ public virtual Pageable GetDeployments(string projectName, RequestCo /// /// /// - /// The Int32 to use. - /// The Int32 to use. - /// The Int32 to use. + /// 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 String to use. + /// The String to use. /// 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 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 GetSupportedLanguagesAsync(int? maxCount = null, int? skip = null, int? maxpagesize = null, RequestContext context = null) + /// The representing an asynchronous operation on the service. + /// + public virtual async Task DeleteDeploymentAsync(WaitUntil waitUntil, string projectName, string deploymentName, RequestContext context = null) { - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetSupportedLanguagesRequest(maxCount, skip, maxpagesize, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetSupportedLanguagesNextPageRequest(nextLink, maxCount, skip, maxpagesize, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "AuthoringTypeSpecClient.GetSupportedLanguages", "value", "nextLink", context); + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); + + using var scope = ClientDiagnostics.CreateScope("AuthoringTypeSpecClient.DeleteDeployment"); + scope.Start(); + try + { + using HttpMessage message = CreateDeleteDeploymentRequest(projectName, deploymentName, context); + return await ProtocolOperationHelpers.ProcessMessageWithoutResponseValueAsync(_pipeline, message, ClientDiagnostics, "AuthoringTypeSpecClient.DeleteDeployment", OperationFinalStateVia.OperationLocation, context, waitUntil).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } } /// - /// [Protocol Method] + /// [Protocol Method] Deletes a project deployment. /// /// /// @@ -1209,22 +1183,36 @@ public virtual AsyncPageable GetSupportedLanguagesAsync(int? maxCoun /// /// /// - /// The Int32 to use. - /// The Int32 to use. - /// The Int32 to use. + /// 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 String to use. + /// The String to use. /// 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 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 GetSupportedLanguages(int? maxCount = null, int? skip = null, int? maxpagesize = null, RequestContext context = null) + /// The representing an asynchronous operation on the service. + /// + public virtual Operation DeleteDeployment(WaitUntil waitUntil, string projectName, string deploymentName, RequestContext context = null) { - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetSupportedLanguagesRequest(maxCount, skip, maxpagesize, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetSupportedLanguagesNextPageRequest(nextLink, maxCount, skip, maxpagesize, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "AuthoringTypeSpecClient.GetSupportedLanguages", "value", "nextLink", context); + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); + + using var scope = ClientDiagnostics.CreateScope("AuthoringTypeSpecClient.DeleteDeployment"); + scope.Start(); + try + { + using HttpMessage message = CreateDeleteDeploymentRequest(projectName, deploymentName, context); + return ProtocolOperationHelpers.ProcessMessageWithoutResponseValue(_pipeline, message, ClientDiagnostics, "AuthoringTypeSpecClient.DeleteDeployment", OperationFinalStateVia.OperationLocation, context, waitUntil); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } } /// - /// [Protocol Method] + /// [Protocol Method] Swaps two existing deployments with each other. /// /// /// @@ -1233,22 +1221,36 @@ public virtual Pageable GetSupportedLanguages(int? maxCount = null, /// /// /// - /// The Int32 to use. - /// The Int32 to use. - /// The Int32 to use. + /// 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 String to use. + /// 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 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 GetTrainingConfigVersionsAsync(int? maxCount = null, int? skip = null, int? maxpagesize = null, RequestContext context = null) + /// The representing an asynchronous operation on the service. + /// + public virtual async Task> SwapDeploymentsAsync(WaitUntil waitUntil, string projectName, RequestContent content, RequestContext context = null) { - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetTrainingConfigVersionsRequest(maxCount, skip, maxpagesize, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetTrainingConfigVersionsNextPageRequest(nextLink, maxCount, skip, maxpagesize, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "AuthoringTypeSpecClient.GetTrainingConfigVersions", "value", "nextLink", context); + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("AuthoringTypeSpecClient.SwapDeployments"); + scope.Start(); + try + { + using HttpMessage message = CreateSwapDeploymentsRequest(projectName, content, context); + return await ProtocolOperationHelpers.ProcessMessageAsync(_pipeline, message, ClientDiagnostics, "AuthoringTypeSpecClient.SwapDeployments", OperationFinalStateVia.OperationLocation, context, waitUntil).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } } /// - /// [Protocol Method] + /// [Protocol Method] Swaps two existing deployments with each other. /// /// /// @@ -1257,18 +1259,32 @@ public virtual AsyncPageable GetTrainingConfigVersionsAsync(int? max /// /// /// - /// The Int32 to use. - /// The Int32 to use. - /// The Int32 to use. + /// 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 String to use. + /// 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 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 GetTrainingConfigVersions(int? maxCount = null, int? skip = null, int? maxpagesize = null, RequestContext context = null) + /// The representing an asynchronous operation on the service. + /// + public virtual Operation SwapDeployments(WaitUntil waitUntil, string projectName, RequestContent content, RequestContext context = null) { - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetTrainingConfigVersionsRequest(maxCount, skip, maxpagesize, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetTrainingConfigVersionsNextPageRequest(nextLink, maxCount, skip, maxpagesize, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "AuthoringTypeSpecClient.GetTrainingConfigVersions", "value", "nextLink", context); + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("AuthoringTypeSpecClient.SwapDeployments"); + scope.Start(); + try + { + using HttpMessage message = CreateSwapDeploymentsRequest(projectName, content, context); + return ProtocolOperationHelpers.ProcessMessage(_pipeline, message, ClientDiagnostics, "AuthoringTypeSpecClient.SwapDeployments", OperationFinalStateVia.OperationLocation, context, waitUntil); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } } internal HttpMessage CreateCreateOrUpdateRequest(string projectName, RequestContent content, RequestContext context) diff --git a/test/TestProjects/Authoring-TypeSpec/src/Generated/Docs/AuthoringTypeSpecClient.xml b/test/TestProjects/Authoring-TypeSpec/src/Generated/Docs/AuthoringTypeSpecClient.xml index c291c02c277..838e6a09770 100644 --- a/test/TestProjects/Authoring-TypeSpec/src/Generated/Docs/AuthoringTypeSpecClient.xml +++ b/test/TestProjects/Authoring-TypeSpec/src/Generated/Docs/AuthoringTypeSpecClient.xml @@ -1,20 +1,14 @@ - + -This sample shows how to call CreateOrUpdateAsync and parse the result. +This sample shows how to call GetProjectAsync and parse the result. "); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); -using RequestContent content = RequestContent.Create(new -{ - projectKind = "CustomSingleLabelClassification", - storageInputContainerName = "", - language = "", -}); -Response response = await client.CreateOrUpdateAsync("", content); +Response response = await client.GetProjectAsync(""); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("projectName").ToString()); @@ -26,24 +20,12 @@ Console.WriteLine(result.GetProperty("lastModifiedDateTime").ToString()); Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); Console.WriteLine(result.GetProperty("lastDeployedDateTime").ToString()); ]]> -This sample shows how to call CreateOrUpdateAsync with all parameters and request content and parse the result. +This sample shows how to call GetProjectAsync with all parameters and parse the result. "); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); -using RequestContent content = RequestContent.Create(new -{ - projectKind = "CustomSingleLabelClassification", - storageInputContainerName = "", - settings = new - { - key = "", - }, - multilingual = true, - description = "", - language = "", -}); -Response response = await client.CreateOrUpdateAsync("", content); +Response response = await client.GetProjectAsync(""); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("projectName").ToString()); @@ -59,20 +41,14 @@ Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); Console.WriteLine(result.GetProperty("lastDeployedDateTime").ToString()); ]]> - + -This sample shows how to call CreateOrUpdate and parse the result. +This sample shows how to call GetProject and parse the result. "); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); -using RequestContent content = RequestContent.Create(new -{ - projectKind = "CustomSingleLabelClassification", - storageInputContainerName = "", - language = "", -}); -Response response = client.CreateOrUpdate("", content); +Response response = client.GetProject(""); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("projectName").ToString()); @@ -84,24 +60,12 @@ Console.WriteLine(result.GetProperty("lastModifiedDateTime").ToString()); Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); Console.WriteLine(result.GetProperty("lastDeployedDateTime").ToString()); ]]> -This sample shows how to call CreateOrUpdate with all parameters and request content and parse the result. +This sample shows how to call GetProject with all parameters and parse the result. "); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); -using RequestContent content = RequestContent.Create(new -{ - projectKind = "CustomSingleLabelClassification", - storageInputContainerName = "", - settings = new - { - key = "", - }, - multilingual = true, - description = "", - language = "", -}); -Response response = client.CreateOrUpdate("", content); +Response response = client.GetProject(""); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("projectName").ToString()); @@ -117,992 +81,1058 @@ Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); Console.WriteLine(result.GetProperty("lastDeployedDateTime").ToString()); ]]> - + -This sample shows how to call GetProjectAsync and parse the result. +This sample shows how to call GetDeploymentAsync and parse the result. "); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); -Response response = await client.GetProjectAsync(""); +Response response = await client.GetDeploymentAsync("", ""); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("projectName").ToString()); -Console.WriteLine(result.GetProperty("projectKind").ToString()); -Console.WriteLine(result.GetProperty("storageInputContainerName").ToString()); -Console.WriteLine(result.GetProperty("language").ToString()); -Console.WriteLine(result.GetProperty("createdDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastModifiedDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastDeployedDateTime").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); ]]> -This sample shows how to call GetProjectAsync with all parameters and parse the result. +This sample shows how to call GetDeploymentAsync with all parameters and parse the result. "); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); -Response response = await client.GetProjectAsync(""); +Response response = await client.GetDeploymentAsync("", ""); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("projectName").ToString()); -Console.WriteLine(result.GetProperty("projectKind").ToString()); -Console.WriteLine(result.GetProperty("storageInputContainerName").ToString()); -Console.WriteLine(result.GetProperty("settings").GetProperty("").ToString()); -Console.WriteLine(result.GetProperty("multilingual").ToString()); -Console.WriteLine(result.GetProperty("description").ToString()); -Console.WriteLine(result.GetProperty("language").ToString()); -Console.WriteLine(result.GetProperty("createdDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastModifiedDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastDeployedDateTime").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); ]]> - + -This sample shows how to call GetProject and parse the result. +This sample shows how to call GetDeployment and parse the result. "); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); -Response response = client.GetProject(""); +Response response = client.GetDeployment("", ""); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("projectName").ToString()); -Console.WriteLine(result.GetProperty("projectKind").ToString()); -Console.WriteLine(result.GetProperty("storageInputContainerName").ToString()); -Console.WriteLine(result.GetProperty("language").ToString()); -Console.WriteLine(result.GetProperty("createdDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastModifiedDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastDeployedDateTime").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); ]]> -This sample shows how to call GetProject with all parameters and parse the result. +This sample shows how to call GetDeployment with all parameters and parse the result. "); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); -Response response = client.GetProject(""); +Response response = client.GetDeployment("", ""); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("projectName").ToString()); -Console.WriteLine(result.GetProperty("projectKind").ToString()); -Console.WriteLine(result.GetProperty("storageInputContainerName").ToString()); -Console.WriteLine(result.GetProperty("settings").GetProperty("").ToString()); -Console.WriteLine(result.GetProperty("multilingual").ToString()); -Console.WriteLine(result.GetProperty("description").ToString()); -Console.WriteLine(result.GetProperty("language").ToString()); -Console.WriteLine(result.GetProperty("createdDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastModifiedDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastDeployedDateTime").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); ]]> - + -This sample shows how to call DeleteAsync and parse the result. +This sample shows how to call GetDeploymentStatusValueAsync. "); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); -Response response = await client.DeleteAsync(""); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("projectName").ToString()); -Console.WriteLine(result.GetProperty("projectKind").ToString()); -Console.WriteLine(result.GetProperty("storageInputContainerName").ToString()); -Console.WriteLine(result.GetProperty("language").ToString()); -Console.WriteLine(result.GetProperty("createdDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastModifiedDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastDeployedDateTime").ToString()); +Response response = await client.GetDeploymentStatusValueAsync("", "", ""); ]]> -This sample shows how to call DeleteAsync with all parameters and parse the result. +This sample shows how to call GetDeploymentStatusValueAsync with all parameters. "); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); -Response response = await client.DeleteAsync(""); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("projectName").ToString()); -Console.WriteLine(result.GetProperty("projectKind").ToString()); -Console.WriteLine(result.GetProperty("storageInputContainerName").ToString()); -Console.WriteLine(result.GetProperty("settings").GetProperty("").ToString()); -Console.WriteLine(result.GetProperty("multilingual").ToString()); -Console.WriteLine(result.GetProperty("description").ToString()); -Console.WriteLine(result.GetProperty("language").ToString()); -Console.WriteLine(result.GetProperty("createdDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastModifiedDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastDeployedDateTime").ToString()); +Response response = await client.GetDeploymentStatusValueAsync("", "", ""); ]]> - + -This sample shows how to call Delete and parse the result. +This sample shows how to call GetDeploymentStatusValue. "); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); -Response response = client.Delete(""); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("projectName").ToString()); -Console.WriteLine(result.GetProperty("projectKind").ToString()); -Console.WriteLine(result.GetProperty("storageInputContainerName").ToString()); -Console.WriteLine(result.GetProperty("language").ToString()); -Console.WriteLine(result.GetProperty("createdDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastModifiedDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastDeployedDateTime").ToString()); +Response response = client.GetDeploymentStatusValue("", "", ""); ]]> -This sample shows how to call Delete with all parameters and parse the result. +This sample shows how to call GetDeploymentStatusValue with all parameters. "); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); -Response response = client.Delete(""); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("projectName").ToString()); -Console.WriteLine(result.GetProperty("projectKind").ToString()); -Console.WriteLine(result.GetProperty("storageInputContainerName").ToString()); -Console.WriteLine(result.GetProperty("settings").GetProperty("").ToString()); -Console.WriteLine(result.GetProperty("multilingual").ToString()); -Console.WriteLine(result.GetProperty("description").ToString()); -Console.WriteLine(result.GetProperty("language").ToString()); -Console.WriteLine(result.GetProperty("createdDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastModifiedDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastDeployedDateTime").ToString()); +Response response = client.GetDeploymentStatusValue("", "", ""); ]]> - + -This sample shows how to call ExportAsync. +This sample shows how to call GetDeploymentStatusAsync and parse the result. "); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); -Response response = await client.ExportAsync("", ""); +Response response = await client.GetDeploymentStatusAsync("", "", ""); -Console.WriteLine(response.Status); +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("jobId").ToString()); +Console.WriteLine(result.GetProperty("createdDateTime").ToString()); +Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); +Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("errors").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("errors").GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("id").ToString()); ]]> -This sample shows how to call ExportAsync with all parameters. +This sample shows how to call GetDeploymentStatusAsync with all parameters and parse the result. "); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); -Response response = await client.ExportAsync("", ""); +Response response = await client.GetDeploymentStatusAsync("", "", ""); -Console.WriteLine(response.Status); +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("jobId").ToString()); +Console.WriteLine(result.GetProperty("createdDateTime").ToString()); +Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); +Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("errors").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("errors").GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("errors").GetProperty("target").ToString()); +Console.WriteLine(result.GetProperty("errors").GetProperty("innererror").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("id").ToString()); ]]> - + -This sample shows how to call Export. +This sample shows how to call GetDeploymentStatus and parse the result. "); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); -Response response = client.Export("", ""); +Response response = client.GetDeploymentStatus("", "", ""); -Console.WriteLine(response.Status); +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("jobId").ToString()); +Console.WriteLine(result.GetProperty("createdDateTime").ToString()); +Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); +Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("errors").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("errors").GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("id").ToString()); ]]> -This sample shows how to call Export with all parameters. +This sample shows how to call GetDeploymentStatus with all parameters and parse the result. "); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); -Response response = client.Export("", ""); +Response response = client.GetDeploymentStatus("", "", ""); -Console.WriteLine(response.Status); +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("jobId").ToString()); +Console.WriteLine(result.GetProperty("createdDateTime").ToString()); +Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); +Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("errors").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("errors").GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("errors").GetProperty("target").ToString()); +Console.WriteLine(result.GetProperty("errors").GetProperty("innererror").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("id").ToString()); ]]> - + -This sample shows how to call ImportxAsync. +This sample shows how to call GetSwapDeploymentsStatusValueAsync. "); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); -Response response = await client.ImportxAsync(""); - -Console.WriteLine(response.Status); +Response response = await client.GetSwapDeploymentsStatusValueAsync("", "", ""); ]]> -This sample shows how to call ImportxAsync with all parameters. +This sample shows how to call GetSwapDeploymentsStatusValueAsync with all parameters. "); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); -Response response = await client.ImportxAsync(""); - -Console.WriteLine(response.Status); +Response response = await client.GetSwapDeploymentsStatusValueAsync("", "", ""); ]]> - + -This sample shows how to call Importx. +This sample shows how to call GetSwapDeploymentsStatusValue. "); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); -Response response = client.Importx(""); - -Console.WriteLine(response.Status); +Response response = client.GetSwapDeploymentsStatusValue("", "", ""); ]]> -This sample shows how to call Importx with all parameters. +This sample shows how to call GetSwapDeploymentsStatusValue with all parameters. "); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); -Response response = client.Importx(""); - -Console.WriteLine(response.Status); +Response response = client.GetSwapDeploymentsStatusValue("", "", ""); ]]> - + -This sample shows how to call TrainAsync. +This sample shows how to call GetSwapDeploymentsStatusAsync and parse the result. "); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); -using RequestContent content = RequestContent.Create(new -{ - modelLabel = "", -}); -Response response = await client.TrainAsync("", content); - -Console.WriteLine(response.Status); -]]> -This sample shows how to call TrainAsync with all parameters and request content. -"); -AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); +Response response = await client.GetSwapDeploymentsStatusAsync("", "", ""); -using RequestContent content = RequestContent.Create(new -{ - modelLabel = "", -}); -Response response = await client.TrainAsync("", content); - -Console.WriteLine(response.Status); -]]> - - - -This sample shows how to call Train. -"); -AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); - -using RequestContent content = RequestContent.Create(new -{ - modelLabel = "", -}); -Response response = client.Train("", content); - -Console.WriteLine(response.Status); +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("jobId").ToString()); +Console.WriteLine(result.GetProperty("createdDateTime").ToString()); +Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); +Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("errors").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("errors").GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("id").ToString()); ]]> -This sample shows how to call Train with all parameters and request content. +This sample shows how to call GetSwapDeploymentsStatusAsync with all parameters and parse the result. "); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); -using RequestContent content = RequestContent.Create(new -{ - modelLabel = "", -}); -Response response = client.Train("", content); +Response response = await client.GetSwapDeploymentsStatusAsync("", "", ""); -Console.WriteLine(response.Status); +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("jobId").ToString()); +Console.WriteLine(result.GetProperty("createdDateTime").ToString()); +Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); +Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("errors").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("errors").GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("errors").GetProperty("target").ToString()); +Console.WriteLine(result.GetProperty("errors").GetProperty("innererror").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("id").ToString()); ]]> - + -This sample shows how to call GetDeploymentAsync and parse the result. +This sample shows how to call GetSwapDeploymentsStatus and parse the result. "); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); -Response response = await client.GetDeploymentAsync("", ""); +Response response = client.GetSwapDeploymentsStatus("", "", ""); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("jobId").ToString()); +Console.WriteLine(result.GetProperty("createdDateTime").ToString()); +Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); +Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("errors").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("errors").GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("id").ToString()); ]]> -This sample shows how to call GetDeploymentAsync with all parameters and parse the result. +This sample shows how to call GetSwapDeploymentsStatus with all parameters and parse the result. "); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); -Response response = await client.GetDeploymentAsync("", ""); +Response response = client.GetSwapDeploymentsStatus("", "", ""); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("jobId").ToString()); +Console.WriteLine(result.GetProperty("createdDateTime").ToString()); +Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); +Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("errors").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("errors").GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("errors").GetProperty("target").ToString()); +Console.WriteLine(result.GetProperty("errors").GetProperty("innererror").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("id").ToString()); ]]> - + -This sample shows how to call GetDeployment and parse the result. +This sample shows how to call GetProjectsAsync and parse the result. "); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); -Response response = client.GetDeployment("", ""); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("name").ToString()); +await foreach (BinaryData item in client.GetProjectsAsync()) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("projectName").ToString()); + Console.WriteLine(result.GetProperty("projectKind").ToString()); + Console.WriteLine(result.GetProperty("storageInputContainerName").ToString()); + Console.WriteLine(result.GetProperty("language").ToString()); + Console.WriteLine(result.GetProperty("createdDateTime").ToString()); + Console.WriteLine(result.GetProperty("lastModifiedDateTime").ToString()); + Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); + Console.WriteLine(result.GetProperty("lastDeployedDateTime").ToString()); +} ]]> -This sample shows how to call GetDeployment with all parameters and parse the result. +This sample shows how to call GetProjectsAsync with all request content and parse the result. "); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); -Response response = client.GetDeployment("", ""); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("name").ToString()); +await foreach (BinaryData item in client.GetProjectsAsync()) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("projectName").ToString()); + Console.WriteLine(result.GetProperty("projectKind").ToString()); + Console.WriteLine(result.GetProperty("storageInputContainerName").ToString()); + Console.WriteLine(result.GetProperty("settings").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("multilingual").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + Console.WriteLine(result.GetProperty("language").ToString()); + Console.WriteLine(result.GetProperty("createdDateTime").ToString()); + Console.WriteLine(result.GetProperty("lastModifiedDateTime").ToString()); + Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); + Console.WriteLine(result.GetProperty("lastDeployedDateTime").ToString()); +} ]]> - + -This sample shows how to call DeployProjectAsync and parse the result. +This sample shows how to call GetProjects and parse the result. "); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); -using RequestContent content = RequestContent.Create(new object()); -Response response = await client.DeployProjectAsync("", "", content); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("name").ToString()); +foreach (BinaryData item in client.GetProjects()) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("projectName").ToString()); + Console.WriteLine(result.GetProperty("projectKind").ToString()); + Console.WriteLine(result.GetProperty("storageInputContainerName").ToString()); + Console.WriteLine(result.GetProperty("language").ToString()); + Console.WriteLine(result.GetProperty("createdDateTime").ToString()); + Console.WriteLine(result.GetProperty("lastModifiedDateTime").ToString()); + Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); + Console.WriteLine(result.GetProperty("lastDeployedDateTime").ToString()); +} ]]> -This sample shows how to call DeployProjectAsync with all parameters and request content and parse the result. +This sample shows how to call GetProjects with all request content and parse the result. "); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); -using RequestContent content = RequestContent.Create(new object()); -Response response = await client.DeployProjectAsync("", "", content); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("name").ToString()); +foreach (BinaryData item in client.GetProjects()) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("projectName").ToString()); + Console.WriteLine(result.GetProperty("projectKind").ToString()); + Console.WriteLine(result.GetProperty("storageInputContainerName").ToString()); + Console.WriteLine(result.GetProperty("settings").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("multilingual").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + Console.WriteLine(result.GetProperty("language").ToString()); + Console.WriteLine(result.GetProperty("createdDateTime").ToString()); + Console.WriteLine(result.GetProperty("lastModifiedDateTime").ToString()); + Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); + Console.WriteLine(result.GetProperty("lastDeployedDateTime").ToString()); +} ]]> - + -This sample shows how to call DeployProject and parse the result. +This sample shows how to call GetDeploymentsAsync and parse the result. "); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); -using RequestContent content = RequestContent.Create(new object()); -Response response = client.DeployProject("", "", content); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("name").ToString()); +await foreach (BinaryData item in client.GetDeploymentsAsync("")) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); +} ]]> -This sample shows how to call DeployProject with all parameters and request content and parse the result. +This sample shows how to call GetDeploymentsAsync with all parameters and parse the result. "); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); -using RequestContent content = RequestContent.Create(new object()); -Response response = client.DeployProject("", "", content); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("name").ToString()); +await foreach (BinaryData item in client.GetDeploymentsAsync("")) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); +} ]]> - + -This sample shows how to call DeleteDeploymentAsync and parse the result. +This sample shows how to call GetDeployments and parse the result. "); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); -Response response = await client.DeleteDeploymentAsync("", ""); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("name").ToString()); +foreach (BinaryData item in client.GetDeployments("")) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); +} ]]> -This sample shows how to call DeleteDeploymentAsync with all parameters and parse the result. +This sample shows how to call GetDeployments with all parameters and parse the result. "); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); -Response response = await client.DeleteDeploymentAsync("", ""); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("name").ToString()); +foreach (BinaryData item in client.GetDeployments("")) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); +} ]]> - + -This sample shows how to call DeleteDeployment and parse the result. +This sample shows how to call GetSupportedLanguagesAsync and parse the result. "); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); -Response response = client.DeleteDeployment("", ""); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("name").ToString()); +await foreach (BinaryData item in client.GetSupportedLanguagesAsync()) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("languageName").ToString()); + Console.WriteLine(result.GetProperty("languageCode").ToString()); +} ]]> -This sample shows how to call DeleteDeployment with all parameters and parse the result. +This sample shows how to call GetSupportedLanguagesAsync with all parameters and parse the result. "); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); -Response response = client.DeleteDeployment("", ""); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("name").ToString()); +await foreach (BinaryData item in client.GetSupportedLanguagesAsync(maxCount: 1234, skip: 1234, maxpagesize: 1234)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("languageName").ToString()); + Console.WriteLine(result.GetProperty("languageCode").ToString()); +} ]]> - + -This sample shows how to call SwapDeploymentsAsync. +This sample shows how to call GetSupportedLanguages and parse the result. "); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); -using RequestContent content = RequestContent.Create(new +foreach (BinaryData item in client.GetSupportedLanguages()) { - firstDeploymentName = "", - secondDeploymentName = "", -}); -Response response = await client.SwapDeploymentsAsync("", content); - -Console.WriteLine(response.Status); + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("languageName").ToString()); + Console.WriteLine(result.GetProperty("languageCode").ToString()); +} ]]> -This sample shows how to call SwapDeploymentsAsync with all parameters and request content. +This sample shows how to call GetSupportedLanguages with all parameters and parse the result. "); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); -using RequestContent content = RequestContent.Create(new +foreach (BinaryData item in client.GetSupportedLanguages(maxCount: 1234, skip: 1234, maxpagesize: 1234)) { - firstDeploymentName = "", - secondDeploymentName = "", -}); -Response response = await client.SwapDeploymentsAsync("", content); - -Console.WriteLine(response.Status); + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("languageName").ToString()); + Console.WriteLine(result.GetProperty("languageCode").ToString()); +} ]]> - + -This sample shows how to call SwapDeployments. +This sample shows how to call GetTrainingConfigVersionsAsync and parse the result. "); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); -using RequestContent content = RequestContent.Create(new +await foreach (BinaryData item in client.GetTrainingConfigVersionsAsync()) { - firstDeploymentName = "", - secondDeploymentName = "", -}); -Response response = client.SwapDeployments("", content); - -Console.WriteLine(response.Status); + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("trainingConfigVersionStr").ToString()); + Console.WriteLine(result.GetProperty("modelExpirationDate").ToString()); +} ]]> -This sample shows how to call SwapDeployments with all parameters and request content. +This sample shows how to call GetTrainingConfigVersionsAsync with all parameters and parse the result. "); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); -using RequestContent content = RequestContent.Create(new +await foreach (BinaryData item in client.GetTrainingConfigVersionsAsync(maxCount: 1234, skip: 1234, maxpagesize: 1234)) { - firstDeploymentName = "", - secondDeploymentName = "", -}); -Response response = client.SwapDeployments("", content); - -Console.WriteLine(response.Status); + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("trainingConfigVersionStr").ToString()); + Console.WriteLine(result.GetProperty("modelExpirationDate").ToString()); +} ]]> - + -This sample shows how to call GetDeploymentStatusValueAsync. +This sample shows how to call GetTrainingConfigVersions and parse the result. "); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); -Response response = await client.GetDeploymentStatusValueAsync("", "", ""); +foreach (BinaryData item in client.GetTrainingConfigVersions()) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("trainingConfigVersionStr").ToString()); + Console.WriteLine(result.GetProperty("modelExpirationDate").ToString()); +} ]]> -This sample shows how to call GetDeploymentStatusValueAsync with all parameters. +This sample shows how to call GetTrainingConfigVersions with all parameters and parse the result. "); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); -Response response = await client.GetDeploymentStatusValueAsync("", "", ""); +foreach (BinaryData item in client.GetTrainingConfigVersions(maxCount: 1234, skip: 1234, maxpagesize: 1234)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("trainingConfigVersionStr").ToString()); + Console.WriteLine(result.GetProperty("modelExpirationDate").ToString()); +} ]]> - + -This sample shows how to call GetDeploymentStatusValue. +This sample shows how to call CreateOrUpdateAsync and parse the result. "); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); -Response response = client.GetDeploymentStatusValue("", "", ""); +using RequestContent content = RequestContent.Create(new +{ + projectKind = "CustomSingleLabelClassification", + storageInputContainerName = "", + language = "", +}); +Operation operation = await client.CreateOrUpdateAsync(WaitUntil.Completed, "", content); +BinaryData responseData = operation.Value; + +JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; +Console.WriteLine(result.GetProperty("projectName").ToString()); +Console.WriteLine(result.GetProperty("projectKind").ToString()); +Console.WriteLine(result.GetProperty("storageInputContainerName").ToString()); +Console.WriteLine(result.GetProperty("language").ToString()); +Console.WriteLine(result.GetProperty("createdDateTime").ToString()); +Console.WriteLine(result.GetProperty("lastModifiedDateTime").ToString()); +Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); +Console.WriteLine(result.GetProperty("lastDeployedDateTime").ToString()); ]]> -This sample shows how to call GetDeploymentStatusValue with all parameters. +This sample shows how to call CreateOrUpdateAsync with all parameters and request content and parse the result. "); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); -Response response = client.GetDeploymentStatusValue("", "", ""); +using RequestContent content = RequestContent.Create(new +{ + projectKind = "CustomSingleLabelClassification", + storageInputContainerName = "", + settings = new + { + key = "", + }, + multilingual = true, + description = "", + language = "", +}); +Operation operation = await client.CreateOrUpdateAsync(WaitUntil.Completed, "", content); +BinaryData responseData = operation.Value; + +JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; +Console.WriteLine(result.GetProperty("projectName").ToString()); +Console.WriteLine(result.GetProperty("projectKind").ToString()); +Console.WriteLine(result.GetProperty("storageInputContainerName").ToString()); +Console.WriteLine(result.GetProperty("settings").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("multilingual").ToString()); +Console.WriteLine(result.GetProperty("description").ToString()); +Console.WriteLine(result.GetProperty("language").ToString()); +Console.WriteLine(result.GetProperty("createdDateTime").ToString()); +Console.WriteLine(result.GetProperty("lastModifiedDateTime").ToString()); +Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); +Console.WriteLine(result.GetProperty("lastDeployedDateTime").ToString()); ]]> - + -This sample shows how to call GetDeploymentStatusAsync and parse the result. +This sample shows how to call CreateOrUpdate and parse the result. "); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); -Response response = await client.GetDeploymentStatusAsync("", "", ""); +using RequestContent content = RequestContent.Create(new +{ + projectKind = "CustomSingleLabelClassification", + storageInputContainerName = "", + language = "", +}); +Operation operation = client.CreateOrUpdate(WaitUntil.Completed, "", content); +BinaryData responseData = operation.Value; -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("jobId").ToString()); +JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; +Console.WriteLine(result.GetProperty("projectName").ToString()); +Console.WriteLine(result.GetProperty("projectKind").ToString()); +Console.WriteLine(result.GetProperty("storageInputContainerName").ToString()); +Console.WriteLine(result.GetProperty("language").ToString()); Console.WriteLine(result.GetProperty("createdDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); -Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); -Console.WriteLine(result.GetProperty("status").ToString()); -Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors").GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors").GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("lastModifiedDateTime").ToString()); +Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); +Console.WriteLine(result.GetProperty("lastDeployedDateTime").ToString()); ]]> -This sample shows how to call GetDeploymentStatusAsync with all parameters and parse the result. +This sample shows how to call CreateOrUpdate with all parameters and request content and parse the result. "); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); -Response response = await client.GetDeploymentStatusAsync("", "", ""); +using RequestContent content = RequestContent.Create(new +{ + projectKind = "CustomSingleLabelClassification", + storageInputContainerName = "", + settings = new + { + key = "", + }, + multilingual = true, + description = "", + language = "", +}); +Operation operation = client.CreateOrUpdate(WaitUntil.Completed, "", content); +BinaryData responseData = operation.Value; -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("jobId").ToString()); +JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; +Console.WriteLine(result.GetProperty("projectName").ToString()); +Console.WriteLine(result.GetProperty("projectKind").ToString()); +Console.WriteLine(result.GetProperty("storageInputContainerName").ToString()); +Console.WriteLine(result.GetProperty("settings").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("multilingual").ToString()); +Console.WriteLine(result.GetProperty("description").ToString()); +Console.WriteLine(result.GetProperty("language").ToString()); Console.WriteLine(result.GetProperty("createdDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); -Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); -Console.WriteLine(result.GetProperty("status").ToString()); -Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors").GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors").GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors").GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors").GetProperty("innererror").GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("lastModifiedDateTime").ToString()); +Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); +Console.WriteLine(result.GetProperty("lastDeployedDateTime").ToString()); ]]> - + -This sample shows how to call GetDeploymentStatus and parse the result. +This sample shows how to call DeleteAsync. "); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); -Response response = client.GetDeploymentStatus("", "", ""); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("jobId").ToString()); -Console.WriteLine(result.GetProperty("createdDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); -Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); -Console.WriteLine(result.GetProperty("status").ToString()); -Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors").GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors").GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("id").ToString()); +Operation operation = await client.DeleteAsync(WaitUntil.Completed, ""); ]]> -This sample shows how to call GetDeploymentStatus with all parameters and parse the result. +This sample shows how to call DeleteAsync with all parameters. "); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); -Response response = client.GetDeploymentStatus("", "", ""); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("jobId").ToString()); -Console.WriteLine(result.GetProperty("createdDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); -Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); -Console.WriteLine(result.GetProperty("status").ToString()); -Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors").GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors").GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors").GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors").GetProperty("innererror").GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("id").ToString()); +Operation operation = await client.DeleteAsync(WaitUntil.Completed, ""); ]]> - + -This sample shows how to call GetSwapDeploymentsStatusValueAsync. +This sample shows how to call Delete. "); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); -Response response = await client.GetSwapDeploymentsStatusValueAsync("", "", ""); +Operation operation = client.Delete(WaitUntil.Completed, ""); ]]> -This sample shows how to call GetSwapDeploymentsStatusValueAsync with all parameters. +This sample shows how to call Delete with all parameters. "); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); -Response response = await client.GetSwapDeploymentsStatusValueAsync("", "", ""); +Operation operation = client.Delete(WaitUntil.Completed, ""); ]]> - + -This sample shows how to call GetSwapDeploymentsStatusValue. +This sample shows how to call ExportAsync and parse the result. "); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); -Response response = client.GetSwapDeploymentsStatusValue("", "", ""); +Operation operation = await client.ExportAsync(WaitUntil.Completed, "", ""); +BinaryData responseData = operation.Value; + +JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); ]]> -This sample shows how to call GetSwapDeploymentsStatusValue with all parameters. +This sample shows how to call ExportAsync with all parameters and parse the result. "); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); -Response response = client.GetSwapDeploymentsStatusValue("", "", ""); +Operation operation = await client.ExportAsync(WaitUntil.Completed, "", ""); +BinaryData responseData = operation.Value; + +JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("error").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("error").GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("error").GetProperty("target").ToString()); +Console.WriteLine(result.GetProperty("error").GetProperty("innererror").GetProperty("code").ToString()); ]]> - + -This sample shows how to call GetSwapDeploymentsStatusAsync and parse the result. +This sample shows how to call Export and parse the result. "); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); -Response response = await client.GetSwapDeploymentsStatusAsync("", "", ""); +Operation operation = client.Export(WaitUntil.Completed, "", ""); +BinaryData responseData = operation.Value; -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("jobId").ToString()); -Console.WriteLine(result.GetProperty("createdDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); -Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); +JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); Console.WriteLine(result.GetProperty("status").ToString()); -Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors").GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors").GetProperty("message").ToString()); +]]> +This sample shows how to call Export with all parameters and parse the result. +"); +AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); + +Operation operation = client.Export(WaitUntil.Completed, "", ""); +BinaryData responseData = operation.Value; + +JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("error").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("error").GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("error").GetProperty("target").ToString()); +Console.WriteLine(result.GetProperty("error").GetProperty("innererror").GetProperty("code").ToString()); +]]> + + + +This sample shows how to call ImportxAsync and parse the result. +"); +AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); + +Operation operation = await client.ImportxAsync(WaitUntil.Completed, ""); +BinaryData responseData = operation.Value; + +JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); ]]> -This sample shows how to call GetSwapDeploymentsStatusAsync with all parameters and parse the result. +This sample shows how to call ImportxAsync with all parameters and parse the result. "); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); -Response response = await client.GetSwapDeploymentsStatusAsync("", "", ""); +Operation operation = await client.ImportxAsync(WaitUntil.Completed, ""); +BinaryData responseData = operation.Value; -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("jobId").ToString()); -Console.WriteLine(result.GetProperty("createdDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); -Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); -Console.WriteLine(result.GetProperty("status").ToString()); -Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors").GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors").GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors").GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors").GetProperty("innererror").GetProperty("code").ToString()); +JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("error").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("error").GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("error").GetProperty("target").ToString()); +Console.WriteLine(result.GetProperty("error").GetProperty("innererror").GetProperty("code").ToString()); ]]> - + -This sample shows how to call GetSwapDeploymentsStatus and parse the result. +This sample shows how to call Importx and parse the result. "); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); -Response response = client.GetSwapDeploymentsStatus("", "", ""); +Operation operation = client.Importx(WaitUntil.Completed, ""); +BinaryData responseData = operation.Value; -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("jobId").ToString()); -Console.WriteLine(result.GetProperty("createdDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); -Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); -Console.WriteLine(result.GetProperty("status").ToString()); -Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors").GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors").GetProperty("message").ToString()); +JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); ]]> -This sample shows how to call GetSwapDeploymentsStatus with all parameters and parse the result. +This sample shows how to call Importx with all parameters and parse the result. "); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); -Response response = client.GetSwapDeploymentsStatus("", "", ""); +Operation operation = client.Importx(WaitUntil.Completed, ""); +BinaryData responseData = operation.Value; -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("jobId").ToString()); -Console.WriteLine(result.GetProperty("createdDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); -Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); -Console.WriteLine(result.GetProperty("status").ToString()); -Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors").GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors").GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors").GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors").GetProperty("innererror").GetProperty("code").ToString()); +JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("error").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("error").GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("error").GetProperty("target").ToString()); +Console.WriteLine(result.GetProperty("error").GetProperty("innererror").GetProperty("code").ToString()); ]]> - + -This sample shows how to call GetProjectsAsync and parse the result. +This sample shows how to call TrainAsync and parse the result. "); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); -await foreach (BinaryData item in client.GetProjectsAsync()) +using RequestContent content = RequestContent.Create(new { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("projectName").ToString()); - Console.WriteLine(result.GetProperty("projectKind").ToString()); - Console.WriteLine(result.GetProperty("storageInputContainerName").ToString()); - Console.WriteLine(result.GetProperty("language").ToString()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastModifiedDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastDeployedDateTime").ToString()); -} + modelLabel = "", +}); +Operation operation = await client.TrainAsync(WaitUntil.Completed, "", content); +BinaryData responseData = operation.Value; + +JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); ]]> -This sample shows how to call GetProjectsAsync with all request content and parse the result. +This sample shows how to call TrainAsync with all parameters and request content and parse the result. "); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); -await foreach (BinaryData item in client.GetProjectsAsync()) +using RequestContent content = RequestContent.Create(new { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("projectName").ToString()); - Console.WriteLine(result.GetProperty("projectKind").ToString()); - Console.WriteLine(result.GetProperty("storageInputContainerName").ToString()); - Console.WriteLine(result.GetProperty("settings").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("multilingual").ToString()); - Console.WriteLine(result.GetProperty("description").ToString()); - Console.WriteLine(result.GetProperty("language").ToString()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastModifiedDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastDeployedDateTime").ToString()); -} + modelLabel = "", +}); +Operation operation = await client.TrainAsync(WaitUntil.Completed, "", content); +BinaryData responseData = operation.Value; + +JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("error").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("error").GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("error").GetProperty("target").ToString()); +Console.WriteLine(result.GetProperty("error").GetProperty("innererror").GetProperty("code").ToString()); ]]> - + -This sample shows how to call GetProjects and parse the result. +This sample shows how to call Train and parse the result. "); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); -foreach (BinaryData item in client.GetProjects()) +using RequestContent content = RequestContent.Create(new { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("projectName").ToString()); - Console.WriteLine(result.GetProperty("projectKind").ToString()); - Console.WriteLine(result.GetProperty("storageInputContainerName").ToString()); - Console.WriteLine(result.GetProperty("language").ToString()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastModifiedDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastDeployedDateTime").ToString()); -} + modelLabel = "", +}); +Operation operation = client.Train(WaitUntil.Completed, "", content); +BinaryData responseData = operation.Value; + +JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); ]]> -This sample shows how to call GetProjects with all request content and parse the result. +This sample shows how to call Train with all parameters and request content and parse the result. "); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); -foreach (BinaryData item in client.GetProjects()) +using RequestContent content = RequestContent.Create(new { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("projectName").ToString()); - Console.WriteLine(result.GetProperty("projectKind").ToString()); - Console.WriteLine(result.GetProperty("storageInputContainerName").ToString()); - Console.WriteLine(result.GetProperty("settings").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("multilingual").ToString()); - Console.WriteLine(result.GetProperty("description").ToString()); - Console.WriteLine(result.GetProperty("language").ToString()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastModifiedDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastDeployedDateTime").ToString()); -} + modelLabel = "", +}); +Operation operation = client.Train(WaitUntil.Completed, "", content); +BinaryData responseData = operation.Value; + +JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("error").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("error").GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("error").GetProperty("target").ToString()); +Console.WriteLine(result.GetProperty("error").GetProperty("innererror").GetProperty("code").ToString()); ]]> - + -This sample shows how to call GetDeploymentsAsync and parse the result. +This sample shows how to call DeployProjectAsync and parse the result. "); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); -await foreach (BinaryData item in client.GetDeploymentsAsync("")) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("name").ToString()); -} +using RequestContent content = RequestContent.Create(new object()); +Operation operation = await client.DeployProjectAsync(WaitUntil.Completed, "", "", content); +BinaryData responseData = operation.Value; + +JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; +Console.WriteLine(result.GetProperty("name").ToString()); ]]> -This sample shows how to call GetDeploymentsAsync with all parameters and parse the result. +This sample shows how to call DeployProjectAsync with all parameters and request content and parse the result. "); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); -await foreach (BinaryData item in client.GetDeploymentsAsync("")) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("name").ToString()); -} +using RequestContent content = RequestContent.Create(new object()); +Operation operation = await client.DeployProjectAsync(WaitUntil.Completed, "", "", content); +BinaryData responseData = operation.Value; + +JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; +Console.WriteLine(result.GetProperty("name").ToString()); ]]> - + -This sample shows how to call GetDeployments and parse the result. +This sample shows how to call DeployProject and parse the result. "); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); -foreach (BinaryData item in client.GetDeployments("")) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("name").ToString()); -} +using RequestContent content = RequestContent.Create(new object()); +Operation operation = client.DeployProject(WaitUntil.Completed, "", "", content); +BinaryData responseData = operation.Value; + +JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; +Console.WriteLine(result.GetProperty("name").ToString()); ]]> -This sample shows how to call GetDeployments with all parameters and parse the result. +This sample shows how to call DeployProject with all parameters and request content and parse the result. "); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); -foreach (BinaryData item in client.GetDeployments("")) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("name").ToString()); -} +using RequestContent content = RequestContent.Create(new object()); +Operation operation = client.DeployProject(WaitUntil.Completed, "", "", content); +BinaryData responseData = operation.Value; + +JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; +Console.WriteLine(result.GetProperty("name").ToString()); ]]> - + -This sample shows how to call GetSupportedLanguagesAsync and parse the result. +This sample shows how to call DeleteDeploymentAsync. "); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); -await foreach (BinaryData item in client.GetSupportedLanguagesAsync()) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("languageName").ToString()); - Console.WriteLine(result.GetProperty("languageCode").ToString()); -} +Operation operation = await client.DeleteDeploymentAsync(WaitUntil.Completed, "", ""); ]]> -This sample shows how to call GetSupportedLanguagesAsync with all parameters and parse the result. +This sample shows how to call DeleteDeploymentAsync with all parameters. "); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); -await foreach (BinaryData item in client.GetSupportedLanguagesAsync(maxCount: 1234, skip: 1234, maxpagesize: 1234)) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("languageName").ToString()); - Console.WriteLine(result.GetProperty("languageCode").ToString()); -} +Operation operation = await client.DeleteDeploymentAsync(WaitUntil.Completed, "", ""); ]]> - + -This sample shows how to call GetSupportedLanguages and parse the result. +This sample shows how to call DeleteDeployment. "); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); -foreach (BinaryData item in client.GetSupportedLanguages()) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("languageName").ToString()); - Console.WriteLine(result.GetProperty("languageCode").ToString()); -} +Operation operation = client.DeleteDeployment(WaitUntil.Completed, "", ""); ]]> -This sample shows how to call GetSupportedLanguages with all parameters and parse the result. +This sample shows how to call DeleteDeployment with all parameters. "); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); -foreach (BinaryData item in client.GetSupportedLanguages(maxCount: 1234, skip: 1234, maxpagesize: 1234)) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("languageName").ToString()); - Console.WriteLine(result.GetProperty("languageCode").ToString()); -} +Operation operation = client.DeleteDeployment(WaitUntil.Completed, "", ""); ]]> - + -This sample shows how to call GetTrainingConfigVersionsAsync and parse the result. +This sample shows how to call SwapDeploymentsAsync and parse the result. "); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); -await foreach (BinaryData item in client.GetTrainingConfigVersionsAsync()) +using RequestContent content = RequestContent.Create(new { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("trainingConfigVersionStr").ToString()); - Console.WriteLine(result.GetProperty("modelExpirationDate").ToString()); -} + firstDeploymentName = "", + secondDeploymentName = "", +}); +Operation operation = await client.SwapDeploymentsAsync(WaitUntil.Completed, "", content); +BinaryData responseData = operation.Value; + +JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); ]]> -This sample shows how to call GetTrainingConfigVersionsAsync with all parameters and parse the result. +This sample shows how to call SwapDeploymentsAsync with all parameters and request content and parse the result. "); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); -await foreach (BinaryData item in client.GetTrainingConfigVersionsAsync(maxCount: 1234, skip: 1234, maxpagesize: 1234)) +using RequestContent content = RequestContent.Create(new { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("trainingConfigVersionStr").ToString()); - Console.WriteLine(result.GetProperty("modelExpirationDate").ToString()); -} + firstDeploymentName = "", + secondDeploymentName = "", +}); +Operation operation = await client.SwapDeploymentsAsync(WaitUntil.Completed, "", content); +BinaryData responseData = operation.Value; + +JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("error").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("error").GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("error").GetProperty("target").ToString()); +Console.WriteLine(result.GetProperty("error").GetProperty("innererror").GetProperty("code").ToString()); ]]> - + -This sample shows how to call GetTrainingConfigVersions and parse the result. +This sample shows how to call SwapDeployments and parse the result. "); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); -foreach (BinaryData item in client.GetTrainingConfigVersions()) +using RequestContent content = RequestContent.Create(new { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("trainingConfigVersionStr").ToString()); - Console.WriteLine(result.GetProperty("modelExpirationDate").ToString()); -} + firstDeploymentName = "", + secondDeploymentName = "", +}); +Operation operation = client.SwapDeployments(WaitUntil.Completed, "", content); +BinaryData responseData = operation.Value; + +JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); ]]> -This sample shows how to call GetTrainingConfigVersions with all parameters and parse the result. +This sample shows how to call SwapDeployments with all parameters and request content and parse the result. "); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); -foreach (BinaryData item in client.GetTrainingConfigVersions(maxCount: 1234, skip: 1234, maxpagesize: 1234)) +using RequestContent content = RequestContent.Create(new { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("trainingConfigVersionStr").ToString()); - Console.WriteLine(result.GetProperty("modelExpirationDate").ToString()); -} + firstDeploymentName = "", + secondDeploymentName = "", +}); +Operation operation = client.SwapDeployments(WaitUntil.Completed, "", content); +BinaryData responseData = operation.Value; + +JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("error").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("error").GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("error").GetProperty("target").ToString()); +Console.WriteLine(result.GetProperty("error").GetProperty("innererror").GetProperty("code").ToString()); ]]> diff --git a/test/TestProjects/Authoring-TypeSpec/src/Generated/tspCodeModel.json b/test/TestProjects/Authoring-TypeSpec/src/Generated/tspCodeModel.json index d8a19075cbd..3ccfbffe56f 100644 --- a/test/TestProjects/Authoring-TypeSpec/src/Generated/tspCodeModel.json +++ b/test/TestProjects/Authoring-TypeSpec/src/Generated/tspCodeModel.json @@ -37,41 +37,77 @@ }, { "$id": "6", - "Name": "JobStatus", + "Name": "OperationState", "EnumValueType": "String", "AllowedValues": [ { "$id": "7", + "Name": "InProgress", + "Value": "InProgress", + "Description": "The operation is in progress." + }, + { + "$id": "8", + "Name": "Succeeded", + "Value": "Succeeded", + "Description": "The operation has completed successfully." + }, + { + "$id": "9", + "Name": "Failed", + "Value": "Failed", + "Description": "The operation has failed." + }, + { + "$id": "10", + "Name": "Canceled", + "Value": "Canceled", + "Description": "The operation has been canceled by the user." + } + ], + "Namespace": "Azure.Core.Foundations", + "Description": "Enum describing allowed operation states.", + "IsExtensible": true, + "IsNullable": false, + "Usage": "None" + }, + { + "$id": "11", + "Name": "JobStatus", + "EnumValueType": "String", + "AllowedValues": [ + { + "$id": "12", "Name": "notStarted", "Value": "notStarted" }, { - "$id": "8", + "$id": "13", "Name": "running", "Value": "running" }, { - "$id": "9", + "$id": "14", "Name": "succeeded", "Value": "succeeded" }, { - "$id": "10", + "$id": "15", "Name": "failed", "Value": "failed" }, { - "$id": "11", + "$id": "16", "Name": "cancelled", "Value": "cancelled" }, { - "$id": "12", + "$id": "17", "Name": "cancelling", "Value": "cancelling" }, { - "$id": "13", + "$id": "18", "Name": "partiallyCompleted", "Value": "partiallyCompleted" } @@ -85,19 +121,19 @@ ], "Models": [ { - "$id": "14", + "$id": "19", "Name": "Project", "Namespace": "AuthoringTypeSpec", "IsNullable": false, "Usage": "None", "Properties": [ { - "$id": "15", + "$id": "20", "Name": "projectName", "SerializedName": "projectName", "Description": "", "Type": { - "$id": "16", + "$id": "21", "Name": "string", "Kind": "String", "IsNullable": false @@ -106,7 +142,7 @@ "IsReadOnly": true }, { - "$id": "17", + "$id": "22", "Name": "projectKind", "SerializedName": "projectKind", "Description": "The project kind.", @@ -117,12 +153,12 @@ "IsReadOnly": false }, { - "$id": "18", + "$id": "23", "Name": "storageInputContainerName", "SerializedName": "storageInputContainerName", "Description": "The storage container name.", "Type": { - "$id": "19", + "$id": "24", "Name": "string", "Kind": "String", "IsNullable": false @@ -131,21 +167,21 @@ "IsReadOnly": false }, { - "$id": "20", + "$id": "25", "Name": "settings", "SerializedName": "settings", "Description": "The project settings.", "Type": { - "$id": "21", + "$id": "26", "Name": "Dictionary", "KeyType": { - "$id": "22", + "$id": "27", "Name": "string", "Kind": "String", "IsNullable": false }, "ValueType": { - "$id": "23", + "$id": "28", "Name": "string", "Kind": "String", "IsNullable": false @@ -156,12 +192,12 @@ "IsReadOnly": false }, { - "$id": "24", + "$id": "29", "Name": "multilingual", "SerializedName": "multilingual", "Description": "Whether the project would be used for multiple languages or not.", "Type": { - "$id": "25", + "$id": "30", "Name": "boolean", "Kind": "Boolean", "IsNullable": false @@ -170,12 +206,12 @@ "IsReadOnly": false }, { - "$id": "26", + "$id": "31", "Name": "description", "SerializedName": "description", "Description": "The project description.", "Type": { - "$id": "27", + "$id": "32", "Name": "string", "Kind": "String", "IsNullable": false @@ -184,12 +220,12 @@ "IsReadOnly": false }, { - "$id": "28", + "$id": "33", "Name": "language", "SerializedName": "language", "Description": "The project language. This is BCP-47 representation of a language. For example, use \"en\" for English, \"en-gb\" for English (UK), \"es\" for Spanish etc.", "Type": { - "$id": "29", + "$id": "34", "Name": "string", "Kind": "String", "IsNullable": false @@ -198,12 +234,12 @@ "IsReadOnly": false }, { - "$id": "30", + "$id": "35", "Name": "createdDateTime", "SerializedName": "createdDateTime", "Description": "Represents the project creation datetime.", "Type": { - "$id": "31", + "$id": "36", "Name": "utcDateTime", "Kind": "DateTime", "IsNullable": false @@ -212,12 +248,12 @@ "IsReadOnly": true }, { - "$id": "32", + "$id": "37", "Name": "lastModifiedDateTime", "SerializedName": "lastModifiedDateTime", "Description": "Represents the project last modification datetime.", "Type": { - "$id": "33", + "$id": "38", "Name": "utcDateTime", "Kind": "DateTime", "IsNullable": false @@ -226,12 +262,12 @@ "IsReadOnly": true }, { - "$id": "34", + "$id": "39", "Name": "lastTrainedDateTime", "SerializedName": "lastTrainedDateTime", "Description": "Represents the project last training datetime.", "Type": { - "$id": "35", + "$id": "40", "Name": "utcDateTime", "Kind": "DateTime", "IsNullable": false @@ -240,12 +276,12 @@ "IsReadOnly": true }, { - "$id": "36", + "$id": "41", "Name": "lastDeployedDateTime", "SerializedName": "lastDeployedDateTime", "Description": "Represents the project last deployment datetime.", "Type": { - "$id": "37", + "$id": "42", "Name": "utcDateTime", "Kind": "DateTime", "IsNullable": false @@ -256,7 +292,7 @@ ] }, { - "$id": "38", + "$id": "43", "Name": "PagedProject", "Namespace": "Azure.Core.Foundations", "Description": "Paged collection of Project items", @@ -264,15 +300,15 @@ "Usage": "None", "Properties": [ { - "$id": "39", + "$id": "44", "Name": "value", "SerializedName": "value", "Description": "The Project items on this page", "Type": { - "$id": "40", + "$id": "45", "Name": "Array", "ElementType": { - "$ref": "14" + "$ref": "19" }, "IsNullable": false }, @@ -280,12 +316,12 @@ "IsReadOnly": false }, { - "$id": "41", + "$id": "46", "Name": "nextLink", "SerializedName": "nextLink", "Description": "The link to the next page of items", "Type": { - "$id": "42", + "$id": "47", "Name": "ResourceLocation", "Kind": "Uri", "IsNullable": false @@ -296,7 +332,167 @@ ] }, { - "$id": "43", + "$id": "48", + "Name": "OperationStatusneverError", + "Namespace": "Azure.Core.Foundations", + "Description": "Provides status details for long running operations.", + "IsNullable": false, + "Usage": "None", + "Properties": [ + { + "$id": "49", + "Name": "id", + "SerializedName": "id", + "Description": "The unique ID of the operation.", + "Type": { + "$id": "50", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "51", + "Name": "status", + "SerializedName": "status", + "Description": "The status of the operation", + "Type": { + "$ref": "6" + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "52", + "Name": "error", + "SerializedName": "error", + "Description": "Error object that describes the error when status is \"Failed\".", + "Type": { + "$id": "53", + "Name": "Error", + "Namespace": "Azure.Core.Foundations", + "Description": "The error object.", + "IsNullable": false, + "Usage": "Output", + "Properties": [ + { + "$id": "54", + "Name": "code", + "SerializedName": "code", + "Description": "One of a server-defined set of error codes.", + "Type": { + "$id": "55", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "56", + "Name": "message", + "SerializedName": "message", + "Description": "A human-readable representation of the error.", + "Type": { + "$id": "57", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "58", + "Name": "target", + "SerializedName": "target", + "Description": "The target of the error.", + "Type": { + "$id": "59", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "60", + "Name": "details", + "SerializedName": "details", + "Description": "An array of details about specific errors that led to this reported error.", + "Type": { + "$id": "61", + "Name": "Array", + "ElementType": { + "$ref": "53" + }, + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "62", + "Name": "innererror", + "SerializedName": "innererror", + "Description": "An object containing more specific information than the current object about the error.", + "Type": { + "$id": "63", + "Name": "InnerError", + "Namespace": "Azure.Core.Foundations", + "Description": "An object containing more specific information about the error. As per Microsoft One API guidelines - https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses.", + "IsNullable": false, + "Usage": "Output", + "Properties": [ + { + "$id": "64", + "Name": "code", + "SerializedName": "code", + "Description": "One of a server-defined set of error codes.", + "Type": { + "$id": "65", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "66", + "Name": "InnerErrorObject", + "SerializedName": "innererror", + "Description": "Inner error.", + "Type": { + "$ref": "63" + }, + "IsRequired": false, + "IsReadOnly": false + } + ] + }, + "IsRequired": false, + "IsReadOnly": false + } + ] + }, + "IsRequired": false, + "IsReadOnly": false + } + ] + }, + { + "$ref": "53" + }, + { + "$ref": "63" + }, + { + "$id": "67", "Name": "TrainingJobOptions", "Namespace": "AuthoringTypeSpec", "Description": "Training job parameters.", @@ -304,12 +500,12 @@ "Usage": "None", "Properties": [ { - "$id": "44", + "$id": "68", "Name": "modelLabel", "SerializedName": "modelLabel", "Description": "", "Type": { - "$id": "45", + "$id": "69", "Name": "string", "Kind": "String", "IsNullable": false @@ -320,19 +516,19 @@ ] }, { - "$id": "46", + "$id": "70", "Name": "Deployment", "Namespace": "AuthoringTypeSpec", "IsNullable": false, "Usage": "None", "Properties": [ { - "$id": "47", + "$id": "71", "Name": "name", "SerializedName": "name", "Description": "", "Type": { - "$id": "48", + "$id": "72", "Name": "string", "Kind": "String", "IsNullable": false @@ -343,7 +539,7 @@ ] }, { - "$id": "49", + "$id": "73", "Name": "PagedDeployment", "Namespace": "Azure.Core.Foundations", "Description": "Paged collection of Deployment items", @@ -351,15 +547,15 @@ "Usage": "None", "Properties": [ { - "$id": "50", + "$id": "74", "Name": "value", "SerializedName": "value", "Description": "The Deployment items on this page", "Type": { - "$id": "51", + "$id": "75", "Name": "Array", "ElementType": { - "$ref": "46" + "$ref": "70" }, "IsNullable": false }, @@ -367,12 +563,12 @@ "IsReadOnly": false }, { - "$id": "52", + "$id": "76", "Name": "nextLink", "SerializedName": "nextLink", "Description": "The link to the next page of items", "Type": { - "$id": "53", + "$id": "77", "Name": "ResourceLocation", "Kind": "Uri", "IsNullable": false @@ -383,19 +579,19 @@ ] }, { - "$id": "54", + "$id": "78", "Name": "SwapDeploymentsOptions", "Namespace": "AuthoringTypeSpec", "IsNullable": false, "Usage": "None", "Properties": [ { - "$id": "55", + "$id": "79", "Name": "firstDeploymentName", "SerializedName": "firstDeploymentName", "Description": "Represents the first deployment name.", "Type": { - "$id": "56", + "$id": "80", "Name": "string", "Kind": "String", "IsNullable": false @@ -404,12 +600,12 @@ "IsReadOnly": false }, { - "$id": "57", + "$id": "81", "Name": "secondDeploymentName", "SerializedName": "secondDeploymentName", "Description": "Represents the second deployment name.", "Type": { - "$id": "58", + "$id": "82", "Name": "string", "Kind": "String", "IsNullable": false @@ -420,19 +616,19 @@ ] }, { - "$id": "59", + "$id": "83", "Name": "DeploymentJob", "Namespace": "AuthoringTypeSpec", "IsNullable": false, "Usage": "Output", "Properties": [ { - "$id": "60", + "$id": "84", "Name": "jobId", "SerializedName": "jobId", "Description": "The job ID.", "Type": { - "$id": "61", + "$id": "85", "Name": "string", "Kind": "String", "IsNullable": false @@ -441,12 +637,12 @@ "IsReadOnly": false }, { - "$id": "62", + "$id": "86", "Name": "createdDateTime", "SerializedName": "createdDateTime", "Description": "The creation date time of the job.", "Type": { - "$id": "63", + "$id": "87", "Name": "utcDateTime", "Kind": "DateTime", "IsNullable": false @@ -455,12 +651,12 @@ "IsReadOnly": true }, { - "$id": "64", + "$id": "88", "Name": "lastUpdatedDateTime", "SerializedName": "lastUpdatedDateTime", "Description": "The the last date time the job was updated.", "Type": { - "$id": "65", + "$id": "89", "Name": "utcDateTime", "Kind": "DateTime", "IsNullable": false @@ -469,12 +665,12 @@ "IsReadOnly": true }, { - "$id": "66", + "$id": "90", "Name": "expirationDateTime", "SerializedName": "expirationDateTime", "Description": "The expiration date time of the job.", "Type": { - "$id": "67", + "$id": "91", "Name": "utcDateTime", "Kind": "DateTime", "IsNullable": false @@ -483,26 +679,26 @@ "IsReadOnly": true }, { - "$id": "68", + "$id": "92", "Name": "status", "SerializedName": "status", "Description": "The job status.", "Type": { - "$ref": "6" + "$ref": "11" }, "IsRequired": true, "IsReadOnly": false }, { - "$id": "69", + "$id": "93", "Name": "warnings", "SerializedName": "warnings", "Description": "The warnings that were encountered while executing the job.", "Type": { - "$id": "70", + "$id": "94", "Name": "Array", "ElementType": { - "$id": "71", + "$id": "95", "Name": "JobWarning", "Namespace": "AuthoringTypeSpec", "Description": "Represents a warning that was encountered while executing the request.", @@ -510,12 +706,12 @@ "Usage": "Output", "Properties": [ { - "$id": "72", + "$id": "96", "Name": "code", "SerializedName": "code", "Description": "The warning code.", "Type": { - "$id": "73", + "$id": "97", "Name": "string", "Kind": "String", "IsNullable": false @@ -524,12 +720,12 @@ "IsReadOnly": false }, { - "$id": "74", + "$id": "98", "Name": "message", "SerializedName": "message", "Description": "The warning message.", "Type": { - "$id": "75", + "$id": "99", "Name": "string", "Kind": "String", "IsNullable": false @@ -545,131 +741,23 @@ "IsReadOnly": false }, { - "$id": "76", + "$id": "100", "Name": "errors", "SerializedName": "errors", "Description": "The errors encountered while executing the job.", "Type": { - "$id": "77", - "Name": "Error", - "Namespace": "Azure.Core.Foundations", - "Description": "The error object.", - "IsNullable": false, - "Usage": "Output", - "Properties": [ - { - "$id": "78", - "Name": "code", - "SerializedName": "code", - "Description": "One of a server-defined set of error codes.", - "Type": { - "$id": "79", - "Name": "string", - "Kind": "String", - "IsNullable": false - }, - "IsRequired": true, - "IsReadOnly": false - }, - { - "$id": "80", - "Name": "message", - "SerializedName": "message", - "Description": "A human-readable representation of the error.", - "Type": { - "$id": "81", - "Name": "string", - "Kind": "String", - "IsNullable": false - }, - "IsRequired": true, - "IsReadOnly": false - }, - { - "$id": "82", - "Name": "target", - "SerializedName": "target", - "Description": "The target of the error.", - "Type": { - "$id": "83", - "Name": "string", - "Kind": "String", - "IsNullable": false - }, - "IsRequired": false, - "IsReadOnly": false - }, - { - "$id": "84", - "Name": "details", - "SerializedName": "details", - "Description": "An array of details about specific errors that led to this reported error.", - "Type": { - "$id": "85", - "Name": "Array", - "ElementType": { - "$ref": "77" - }, - "IsNullable": false - }, - "IsRequired": false, - "IsReadOnly": false - }, - { - "$id": "86", - "Name": "innererror", - "SerializedName": "innererror", - "Description": "An object containing more specific information than the current object about the error.", - "Type": { - "$id": "87", - "Name": "InnerError", - "Namespace": "Azure.Core.Foundations", - "Description": "An object containing more specific information about the error. As per Microsoft One API guidelines - https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses.", - "IsNullable": false, - "Usage": "Output", - "Properties": [ - { - "$id": "88", - "Name": "code", - "SerializedName": "code", - "Description": "One of a server-defined set of error codes.", - "Type": { - "$id": "89", - "Name": "string", - "Kind": "String", - "IsNullable": false - }, - "IsRequired": false, - "IsReadOnly": false - }, - { - "$id": "90", - "Name": "InnerErrorObject", - "SerializedName": "innererror", - "Description": "Inner error.", - "Type": { - "$ref": "87" - }, - "IsRequired": false, - "IsReadOnly": false - } - ] - }, - "IsRequired": false, - "IsReadOnly": false - } - ] + "$ref": "53" }, "IsRequired": true, "IsReadOnly": false }, { - "$id": "91", + "$id": "101", "Name": "id", "SerializedName": "id", "Description": "", "Type": { - "$id": "92", + "$id": "102", "Name": "string", "Kind": "String", "IsNullable": false @@ -680,28 +768,22 @@ ] }, { - "$ref": "71" - }, - { - "$ref": "77" - }, - { - "$ref": "87" + "$ref": "95" }, { - "$id": "93", + "$id": "103", "Name": "SwapDeploymentsJob", "Namespace": "AuthoringTypeSpec", "IsNullable": false, "Usage": "Output", "Properties": [ { - "$id": "94", + "$id": "104", "Name": "jobId", "SerializedName": "jobId", "Description": "The job ID.", "Type": { - "$id": "95", + "$id": "105", "Name": "string", "Kind": "String", "IsNullable": false @@ -710,12 +792,12 @@ "IsReadOnly": false }, { - "$id": "96", + "$id": "106", "Name": "createdDateTime", "SerializedName": "createdDateTime", "Description": "The creation date time of the job.", "Type": { - "$id": "97", + "$id": "107", "Name": "utcDateTime", "Kind": "DateTime", "IsNullable": false @@ -724,12 +806,12 @@ "IsReadOnly": true }, { - "$id": "98", + "$id": "108", "Name": "lastUpdatedDateTime", "SerializedName": "lastUpdatedDateTime", "Description": "The the last date time the job was updated.", "Type": { - "$id": "99", + "$id": "109", "Name": "utcDateTime", "Kind": "DateTime", "IsNullable": false @@ -738,12 +820,12 @@ "IsReadOnly": true }, { - "$id": "100", + "$id": "110", "Name": "expirationDateTime", "SerializedName": "expirationDateTime", "Description": "The expiration date time of the job.", "Type": { - "$id": "101", + "$id": "111", "Name": "utcDateTime", "Kind": "DateTime", "IsNullable": false @@ -752,26 +834,26 @@ "IsReadOnly": true }, { - "$id": "102", + "$id": "112", "Name": "status", "SerializedName": "status", "Description": "The job status.", "Type": { - "$ref": "6" + "$ref": "11" }, "IsRequired": true, "IsReadOnly": false }, { - "$id": "103", + "$id": "113", "Name": "warnings", "SerializedName": "warnings", "Description": "The warnings that were encountered while executing the job.", "Type": { - "$id": "104", + "$id": "114", "Name": "Array", "ElementType": { - "$ref": "71" + "$ref": "95" }, "IsNullable": false }, @@ -779,23 +861,23 @@ "IsReadOnly": false }, { - "$id": "105", + "$id": "115", "Name": "errors", "SerializedName": "errors", "Description": "The errors encountered while executing the job.", "Type": { - "$ref": "77" + "$ref": "53" }, "IsRequired": true, "IsReadOnly": false }, { - "$id": "106", + "$id": "116", "Name": "id", "SerializedName": "id", "Description": "", "Type": { - "$id": "107", + "$id": "117", "Name": "string", "Kind": "String", "IsNullable": false @@ -806,7 +888,7 @@ ] }, { - "$id": "108", + "$id": "118", "Name": "PagedSupportedLanguage", "Namespace": "AuthoringTypeSpec", "Description": "Paged collection of SupportedLanguage items", @@ -814,15 +896,15 @@ "Usage": "None", "Properties": [ { - "$id": "109", + "$id": "119", "Name": "value", "SerializedName": "value", "Description": "The SupportedLanguage items on this page", "Type": { - "$id": "110", + "$id": "120", "Name": "Array", "ElementType": { - "$id": "111", + "$id": "121", "Name": "SupportedLanguage", "Namespace": "AuthoringTypeSpec", "Description": "Represents a supported language.", @@ -830,12 +912,12 @@ "Usage": "None", "Properties": [ { - "$id": "112", + "$id": "122", "Name": "languageName", "SerializedName": "languageName", "Description": "The language name.", "Type": { - "$id": "113", + "$id": "123", "Name": "string", "Kind": "String", "IsNullable": false @@ -844,12 +926,12 @@ "IsReadOnly": false }, { - "$id": "114", + "$id": "124", "Name": "languageCode", "SerializedName": "languageCode", "Description": "The language code. This is BCP-47 representation of a language. For example, \"en\" for English, \"en-gb\" for English (UK), \"es\" for Spanish etc.", "Type": { - "$id": "115", + "$id": "125", "Name": "string", "Kind": "String", "IsNullable": false @@ -865,12 +947,12 @@ "IsReadOnly": false }, { - "$id": "116", + "$id": "126", "Name": "nextLink", "SerializedName": "nextLink", "Description": "The link to the next page of items", "Type": { - "$id": "117", + "$id": "127", "Name": "ResourceLocation", "Kind": "Uri", "IsNullable": false @@ -881,10 +963,10 @@ ] }, { - "$ref": "111" + "$ref": "121" }, { - "$id": "118", + "$id": "128", "Name": "PagedTrainingConfigVersion", "Namespace": "AuthoringTypeSpec", "Description": "Paged collection of TrainingConfigVersion items", @@ -892,15 +974,15 @@ "Usage": "None", "Properties": [ { - "$id": "119", + "$id": "129", "Name": "value", "SerializedName": "value", "Description": "The TrainingConfigVersion items on this page", "Type": { - "$id": "120", + "$id": "130", "Name": "Array", "ElementType": { - "$id": "121", + "$id": "131", "Name": "TrainingConfigVersion", "Namespace": "AuthoringTypeSpec", "Description": "Represents a training config version.", @@ -908,12 +990,12 @@ "Usage": "None", "Properties": [ { - "$id": "122", + "$id": "132", "Name": "trainingConfigVersionStr", "SerializedName": "trainingConfigVersionStr", "Description": "Represents the version of the config.", "Type": { - "$id": "123", + "$id": "133", "Name": "string", "Kind": "String", "IsNullable": false @@ -922,12 +1004,12 @@ "IsReadOnly": false }, { - "$id": "124", + "$id": "134", "Name": "modelExpirationDate", "SerializedName": "modelExpirationDate", "Description": "Represents the training config version expiration date.", "Type": { - "$id": "125", + "$id": "135", "Name": "plainDate", "Kind": "Date", "IsNullable": false @@ -943,12 +1025,12 @@ "IsReadOnly": false }, { - "$id": "126", + "$id": "136", "Name": "nextLink", "SerializedName": "nextLink", "Description": "The link to the next page of items", "Type": { - "$id": "127", + "$id": "137", "Name": "ResourceLocation", "Kind": "Uri", "IsNullable": false @@ -959,22 +1041,22 @@ ] }, { - "$ref": "121" + "$ref": "131" }, { - "$id": "128", + "$id": "138", "Name": "Job", "Namespace": "AuthoringTypeSpec", "IsNullable": false, "Usage": "None", "Properties": [ { - "$id": "129", + "$id": "139", "Name": "jobId", "SerializedName": "jobId", "Description": "The job ID.", "Type": { - "$id": "130", + "$id": "140", "Name": "string", "Kind": "String", "IsNullable": false @@ -983,12 +1065,12 @@ "IsReadOnly": false }, { - "$id": "131", + "$id": "141", "Name": "createdDateTime", "SerializedName": "createdDateTime", "Description": "The creation date time of the job.", "Type": { - "$id": "132", + "$id": "142", "Name": "utcDateTime", "Kind": "DateTime", "IsNullable": false @@ -997,12 +1079,12 @@ "IsReadOnly": true }, { - "$id": "133", + "$id": "143", "Name": "lastUpdatedDateTime", "SerializedName": "lastUpdatedDateTime", "Description": "The the last date time the job was updated.", "Type": { - "$id": "134", + "$id": "144", "Name": "utcDateTime", "Kind": "DateTime", "IsNullable": false @@ -1011,12 +1093,12 @@ "IsReadOnly": true }, { - "$id": "135", + "$id": "145", "Name": "expirationDateTime", "SerializedName": "expirationDateTime", "Description": "The expiration date time of the job.", "Type": { - "$id": "136", + "$id": "146", "Name": "utcDateTime", "Kind": "DateTime", "IsNullable": false @@ -1025,26 +1107,26 @@ "IsReadOnly": true }, { - "$id": "137", + "$id": "147", "Name": "status", "SerializedName": "status", "Description": "The job status.", "Type": { - "$ref": "6" + "$ref": "11" }, "IsRequired": true, "IsReadOnly": false }, { - "$id": "138", + "$id": "148", "Name": "warnings", "SerializedName": "warnings", "Description": "The warnings that were encountered while executing the job.", "Type": { - "$id": "139", + "$id": "149", "Name": "Array", "ElementType": { - "$ref": "71" + "$ref": "95" }, "IsNullable": false }, @@ -1052,12 +1134,12 @@ "IsReadOnly": false }, { - "$id": "140", + "$id": "150", "Name": "errors", "SerializedName": "errors", "Description": "The errors encountered while executing the job.", "Type": { - "$ref": "77" + "$ref": "53" }, "IsRequired": true, "IsReadOnly": false @@ -1065,7 +1147,7 @@ ] }, { - "$id": "141", + "$id": "151", "Name": "ExportedProject", "Namespace": "AuthoringTypeSpec", "IsNullable": false, @@ -1073,7 +1155,7 @@ "Properties": [] }, { - "$id": "142", + "$id": "152", "Name": "ListQueryParams", "Namespace": "AuthoringTypeSpec", "IsNullable": false, @@ -1081,7 +1163,7 @@ "Properties": [] }, { - "$id": "143", + "$id": "153", "Name": "ExportParams", "Namespace": "AuthoringTypeSpec", "IsNullable": false, @@ -1089,19 +1171,19 @@ "Properties": [] }, { - "$id": "144", + "$id": "154", "Name": "SwapDeploymentsParams", "Namespace": "AuthoringTypeSpec", "IsNullable": false, "Usage": "None", "Properties": [ { - "$id": "145", + "$id": "155", "Name": "body", "SerializedName": "body", "Description": "The body schema of the operation.", "Type": { - "$ref": "54" + "$ref": "78" }, "IsRequired": true, "IsReadOnly": false @@ -1111,22 +1193,22 @@ ], "Clients": [ { - "$id": "146", + "$id": "156", "Name": "AuthoringTypeSpecClient", "Description": "", "Operations": [ { - "$id": "147", + "$id": "157", "Name": "createOrUpdate", "ResourceName": "Project", "Description": "Creates a new project or updates an existing one.", "Parameters": [ { - "$id": "148", + "$id": "158", "Name": "Endpoint", "NameInRequest": "Endpoint", "Type": { - "$id": "149", + "$id": "159", "Name": "Uri", "Kind": "Uri", "IsNullable": false @@ -1142,12 +1224,12 @@ "Kind": "Client" }, { - "$id": "150", + "$id": "160", "Name": "apiVersion", "NameInRequest": "api-version", "Description": "", "Type": { - "$id": "151", + "$id": "161", "Name": "String", "Kind": "String", "IsNullable": false @@ -1162,9 +1244,9 @@ "Explode": false, "Kind": "Client", "DefaultValue": { - "$id": "152", + "$id": "162", "Type": { - "$id": "153", + "$id": "163", "Name": "String", "Kind": "String", "IsNullable": false @@ -1173,11 +1255,11 @@ } }, { - "$id": "154", + "$id": "164", "Name": "projectName", "NameInRequest": "projectName", "Type": { - "$id": "155", + "$id": "165", "Name": "string", "Kind": "String", "IsNullable": false @@ -1193,15 +1275,15 @@ "Kind": "Method" }, { - "$id": "156", + "$id": "166", "Name": "contentType", "NameInRequest": "Content-Type", "Description": "This request has a JSON Merge Patch body.", "Type": { - "$id": "157", + "$id": "167", "Name": "Literal", "LiteralValueType": { - "$id": "158", + "$id": "168", "Name": "String", "Kind": "String", "IsNullable": false @@ -1211,9 +1293,9 @@ }, "Location": "Header", "DefaultValue": { - "$id": "159", + "$id": "169", "Type": { - "$ref": "157" + "$ref": "167" }, "Value": "application/merge-patch+json" }, @@ -1227,12 +1309,12 @@ "Kind": "Constant" }, { - "$id": "160", + "$id": "170", "Name": "resource", "NameInRequest": "resource", "Description": "The resource instance.", "Type": { - "$ref": "14" + "$ref": "19" }, "Location": "Body", "IsRequired": true, @@ -1245,11 +1327,11 @@ "Kind": "Method" }, { - "$id": "161", + "$id": "171", "Name": "accept", "NameInRequest": "Accept", "Type": { - "$id": "162", + "$id": "172", "Name": "String", "Kind": "String", "IsNullable": false @@ -1264,9 +1346,9 @@ "Explode": false, "Kind": "Constant", "DefaultValue": { - "$id": "163", + "$id": "173", "Type": { - "$ref": "162" + "$ref": "172" }, "Value": "application/json" } @@ -1274,22 +1356,22 @@ ], "Responses": [ { - "$id": "164", + "$id": "174", "StatusCodes": [ 201 ], "BodyType": { - "$ref": "14" + "$ref": "19" }, "BodyMediaType": "Json", "Headers": [ { - "$id": "165", + "$id": "175", "Name": "Operation-Location", "NameInResponse": "operationLocation", "Description": "The location for monitoring the operation state.", "Type": { - "$id": "166", + "$id": "176", "Name": "ResourceLocation", "Kind": "Uri", "IsNullable": false @@ -1299,22 +1381,22 @@ "IsErrorResponse": false }, { - "$id": "167", + "$id": "177", "StatusCodes": [ 200 ], "BodyType": { - "$ref": "14" + "$ref": "19" }, "BodyMediaType": "Json", "Headers": [ { - "$id": "168", + "$id": "178", "Name": "Operation-Location", "NameInResponse": "operationLocation", "Description": "The location for monitoring the operation state.", "Type": { - "$id": "169", + "$id": "179", "Name": "ResourceLocation", "Kind": "Uri", "IsNullable": false @@ -1332,27 +1414,41 @@ "application/merge-patch+json" ], "BufferResponse": true, + "LongRunning": { + "$id": "180", + "FinalStateVia": 3, + "FinalResponse": { + "$id": "181", + "StatusCodes": [ + 200 + ], + "BodyType": { + "$ref": "19" + }, + "BodyMediaType": "Json" + } + }, "GenerateProtocolMethod": true, "GenerateConvenienceMethod": false }, { - "$id": "170", + "$id": "182", "Name": "get", "ResourceName": "Project", "Description": "Gets the details of a project.", "Parameters": [ { - "$ref": "148" + "$ref": "158" }, { - "$ref": "150" + "$ref": "160" }, { - "$id": "171", + "$id": "183", "Name": "projectName", "NameInRequest": "projectName", "Type": { - "$id": "172", + "$id": "184", "Name": "string", "Kind": "String", "IsNullable": false @@ -1368,11 +1464,11 @@ "Kind": "Method" }, { - "$id": "173", + "$id": "185", "Name": "accept", "NameInRequest": "Accept", "Type": { - "$id": "174", + "$id": "186", "Name": "String", "Kind": "String", "IsNullable": false @@ -1387,9 +1483,9 @@ "Explode": false, "Kind": "Constant", "DefaultValue": { - "$id": "175", + "$id": "187", "Type": { - "$ref": "174" + "$ref": "186" }, "Value": "application/json" } @@ -1397,12 +1493,12 @@ ], "Responses": [ { - "$id": "176", + "$id": "188", "StatusCodes": [ 200 ], "BodyType": { - "$ref": "14" + "$ref": "19" }, "BodyMediaType": "Json", "Headers": [], @@ -1418,23 +1514,23 @@ "GenerateConvenienceMethod": false }, { - "$id": "177", + "$id": "189", "Name": "delete", "ResourceName": "Project", "Description": "Deletes a project.", "Parameters": [ { - "$ref": "148" + "$ref": "158" }, { - "$ref": "150" + "$ref": "160" }, { - "$id": "178", + "$id": "190", "Name": "projectName", "NameInRequest": "projectName", "Type": { - "$id": "179", + "$id": "191", "Name": "string", "Kind": "String", "IsNullable": false @@ -1450,11 +1546,11 @@ "Kind": "Method" }, { - "$id": "180", + "$id": "192", "Name": "accept", "NameInRequest": "Accept", "Type": { - "$id": "181", + "$id": "193", "Name": "String", "Kind": "String", "IsNullable": false @@ -1469,9 +1565,9 @@ "Explode": false, "Kind": "Constant", "DefaultValue": { - "$id": "182", + "$id": "194", "Type": { - "$ref": "181" + "$ref": "193" }, "Value": "application/json" } @@ -1479,22 +1575,22 @@ ], "Responses": [ { - "$id": "183", + "$id": "195", "StatusCodes": [ 202 ], "BodyType": { - "$ref": "14" + "$ref": "19" }, "BodyMediaType": "Json", "Headers": [ { - "$id": "184", + "$id": "196", "Name": "Operation-Location", "NameInResponse": "operationLocation", "Description": "The location for monitoring the operation state.", "Type": { - "$id": "185", + "$id": "197", "Name": "ResourceLocation", "Kind": "Uri", "IsNullable": false @@ -1509,27 +1605,38 @@ "Uri": "{Endpoint}/language", "Path": "/authoring/analyze-text/projects/{projectName}", "BufferResponse": true, + "LongRunning": { + "$id": "198", + "FinalStateVia": 3, + "FinalResponse": { + "$id": "199", + "StatusCodes": [ + 204 + ], + "BodyMediaType": "Json" + } + }, "GenerateProtocolMethod": true, "GenerateConvenienceMethod": false }, { - "$id": "186", + "$id": "200", "Name": "list", "ResourceName": "Project", "Description": "Lists the existing projects.", "Parameters": [ { - "$ref": "148" + "$ref": "158" }, { - "$ref": "150" + "$ref": "160" }, { - "$id": "187", + "$id": "201", "Name": "accept", "NameInRequest": "Accept", "Type": { - "$id": "188", + "$id": "202", "Name": "String", "Kind": "String", "IsNullable": false @@ -1544,9 +1651,9 @@ "Explode": false, "Kind": "Constant", "DefaultValue": { - "$id": "189", + "$id": "203", "Type": { - "$ref": "188" + "$ref": "202" }, "Value": "application/json" } @@ -1554,12 +1661,12 @@ ], "Responses": [ { - "$id": "190", + "$id": "204", "StatusCodes": [ 200 ], "BodyType": { - "$ref": "38" + "$ref": "43" }, "BodyMediaType": "Json", "Headers": [], @@ -1572,7 +1679,7 @@ "Path": "/authoring/analyze-text/projects", "BufferResponse": true, "Paging": { - "$id": "191", + "$id": "205", "NextLinkName": "nextLink", "ItemName": "value" }, @@ -1580,23 +1687,23 @@ "GenerateConvenienceMethod": false }, { - "$id": "192", + "$id": "206", "Name": "export", "ResourceName": "Projects", "Description": "Triggers a job to export a project's data.", "Parameters": [ { - "$ref": "148" + "$ref": "158" }, { - "$ref": "150" + "$ref": "160" }, { - "$id": "193", + "$id": "207", "Name": "projectName", "NameInRequest": "projectName", "Type": { - "$id": "194", + "$id": "208", "Name": "string", "Kind": "String", "IsNullable": false @@ -1612,11 +1719,11 @@ "Kind": "Method" }, { - "$id": "195", + "$id": "209", "Name": "projectFileVersion", "NameInRequest": "projectFileVersion", "Type": { - "$id": "196", + "$id": "210", "Name": "string", "Kind": "String", "IsNullable": false @@ -1632,11 +1739,11 @@ "Kind": "Method" }, { - "$id": "197", + "$id": "211", "Name": "accept", "NameInRequest": "Accept", "Type": { - "$id": "198", + "$id": "212", "Name": "String", "Kind": "String", "IsNullable": false @@ -1651,9 +1758,9 @@ "Explode": false, "Kind": "Constant", "DefaultValue": { - "$id": "199", + "$id": "213", "Type": { - "$ref": "198" + "$ref": "212" }, "Value": "application/json" } @@ -1661,19 +1768,19 @@ ], "Responses": [ { - "$id": "200", + "$id": "214", "StatusCodes": [ 202 ], "BodyMediaType": "Json", "Headers": [ { - "$id": "201", + "$id": "215", "Name": "Operation-Location", "NameInResponse": "operationLocation", "Description": "The location for monitoring the operation state.", "Type": { - "$id": "202", + "$id": "216", "Name": "ResourceLocation", "Kind": "Uri", "IsNullable": false @@ -1688,27 +1795,41 @@ "Uri": "{Endpoint}/language", "Path": "/authoring/analyze-text/projects/{projectName}:export", "BufferResponse": true, + "LongRunning": { + "$id": "217", + "FinalStateVia": 3, + "FinalResponse": { + "$id": "218", + "StatusCodes": [ + 200 + ], + "BodyType": { + "$ref": "48" + }, + "BodyMediaType": "Json" + } + }, "GenerateProtocolMethod": true, "GenerateConvenienceMethod": false }, { - "$id": "203", + "$id": "219", "Name": "importx", "ResourceName": "Projects", "Description": "Triggers a job to export a project's data.", "Parameters": [ { - "$ref": "148" + "$ref": "158" }, { - "$ref": "150" + "$ref": "160" }, { - "$id": "204", + "$id": "220", "Name": "projectName", "NameInRequest": "projectName", "Type": { - "$id": "205", + "$id": "221", "Name": "string", "Kind": "String", "IsNullable": false @@ -1724,11 +1845,11 @@ "Kind": "Method" }, { - "$id": "206", + "$id": "222", "Name": "accept", "NameInRequest": "Accept", "Type": { - "$id": "207", + "$id": "223", "Name": "String", "Kind": "String", "IsNullable": false @@ -1743,9 +1864,9 @@ "Explode": false, "Kind": "Constant", "DefaultValue": { - "$id": "208", + "$id": "224", "Type": { - "$ref": "207" + "$ref": "223" }, "Value": "application/json" } @@ -1753,19 +1874,19 @@ ], "Responses": [ { - "$id": "209", + "$id": "225", "StatusCodes": [ 202 ], "BodyMediaType": "Json", "Headers": [ { - "$id": "210", + "$id": "226", "Name": "Operation-Location", "NameInResponse": "operationLocation", "Description": "The location for monitoring the operation state.", "Type": { - "$id": "211", + "$id": "227", "Name": "ResourceLocation", "Kind": "Uri", "IsNullable": false @@ -1780,27 +1901,41 @@ "Uri": "{Endpoint}/language", "Path": "/authoring/analyze-text/projects/{projectName}:importx", "BufferResponse": true, + "LongRunning": { + "$id": "228", + "FinalStateVia": 3, + "FinalResponse": { + "$id": "229", + "StatusCodes": [ + 200 + ], + "BodyType": { + "$ref": "48" + }, + "BodyMediaType": "Json" + } + }, "GenerateProtocolMethod": true, "GenerateConvenienceMethod": false }, { - "$id": "212", + "$id": "230", "Name": "train", "ResourceName": "Projects", "Description": "Triggers a training job for a project.", "Parameters": [ { - "$ref": "148" + "$ref": "158" }, { - "$ref": "150" + "$ref": "160" }, { - "$id": "213", + "$id": "231", "Name": "projectName", "NameInRequest": "projectName", "Type": { - "$id": "214", + "$id": "232", "Name": "string", "Kind": "String", "IsNullable": false @@ -1816,11 +1951,11 @@ "Kind": "Method" }, { - "$id": "215", + "$id": "233", "Name": "body", "NameInRequest": "body", "Type": { - "$ref": "43" + "$ref": "67" }, "Location": "Body", "IsRequired": true, @@ -1833,11 +1968,11 @@ "Kind": "Method" }, { - "$id": "216", + "$id": "234", "Name": "contentType", "NameInRequest": "Content-Type", "Type": { - "$id": "217", + "$id": "235", "Name": "String", "Kind": "String", "IsNullable": false @@ -1852,19 +1987,19 @@ "Explode": false, "Kind": "Constant", "DefaultValue": { - "$id": "218", + "$id": "236", "Type": { - "$ref": "217" + "$ref": "235" }, "Value": "application/json" } }, { - "$id": "219", + "$id": "237", "Name": "accept", "NameInRequest": "Accept", "Type": { - "$id": "220", + "$id": "238", "Name": "String", "Kind": "String", "IsNullable": false @@ -1879,9 +2014,9 @@ "Explode": false, "Kind": "Constant", "DefaultValue": { - "$id": "221", + "$id": "239", "Type": { - "$ref": "220" + "$ref": "238" }, "Value": "application/json" } @@ -1889,19 +2024,19 @@ ], "Responses": [ { - "$id": "222", + "$id": "240", "StatusCodes": [ 202 ], "BodyMediaType": "Json", "Headers": [ { - "$id": "223", + "$id": "241", "Name": "Operation-Location", "NameInResponse": "operationLocation", "Description": "The location for monitoring the operation state.", "Type": { - "$id": "224", + "$id": "242", "Name": "ResourceLocation", "Kind": "Uri", "IsNullable": false @@ -1919,27 +2054,41 @@ "application/json" ], "BufferResponse": true, + "LongRunning": { + "$id": "243", + "FinalStateVia": 3, + "FinalResponse": { + "$id": "244", + "StatusCodes": [ + 200 + ], + "BodyType": { + "$ref": "48" + }, + "BodyMediaType": "Json" + } + }, "GenerateProtocolMethod": true, "GenerateConvenienceMethod": false }, { - "$id": "225", + "$id": "245", "Name": "getDeployment", "ResourceName": "Deployment", "Description": "Gets the details of a deployment.", "Parameters": [ { - "$ref": "148" + "$ref": "158" }, { - "$ref": "150" + "$ref": "160" }, { - "$id": "226", + "$id": "246", "Name": "projectName", "NameInRequest": "projectName", "Type": { - "$id": "227", + "$id": "247", "Name": "string", "Kind": "String", "IsNullable": false @@ -1955,11 +2104,11 @@ "Kind": "Method" }, { - "$id": "228", + "$id": "248", "Name": "deploymentName", "NameInRequest": "deploymentName", "Type": { - "$id": "229", + "$id": "249", "Name": "string", "Kind": "String", "IsNullable": false @@ -1975,11 +2124,11 @@ "Kind": "Method" }, { - "$id": "230", + "$id": "250", "Name": "accept", "NameInRequest": "Accept", "Type": { - "$id": "231", + "$id": "251", "Name": "String", "Kind": "String", "IsNullable": false @@ -1994,9 +2143,9 @@ "Explode": false, "Kind": "Constant", "DefaultValue": { - "$id": "232", + "$id": "252", "Type": { - "$ref": "231" + "$ref": "251" }, "Value": "application/json" } @@ -2004,12 +2153,12 @@ ], "Responses": [ { - "$id": "233", + "$id": "253", "StatusCodes": [ 200 ], "BodyType": { - "$ref": "46" + "$ref": "70" }, "BodyMediaType": "Json", "Headers": [], @@ -2025,23 +2174,23 @@ "GenerateConvenienceMethod": false }, { - "$id": "234", + "$id": "254", "Name": "deployProject", "ResourceName": "Deployment", "Description": "Creates a new deployment or replaces an existing one.", "Parameters": [ { - "$ref": "148" + "$ref": "158" }, { - "$ref": "150" + "$ref": "160" }, { - "$id": "235", + "$id": "255", "Name": "projectName", "NameInRequest": "projectName", "Type": { - "$id": "236", + "$id": "256", "Name": "string", "Kind": "String", "IsNullable": false @@ -2057,11 +2206,11 @@ "Kind": "Method" }, { - "$id": "237", + "$id": "257", "Name": "deploymentName", "NameInRequest": "deploymentName", "Type": { - "$id": "238", + "$id": "258", "Name": "string", "Kind": "String", "IsNullable": false @@ -2077,12 +2226,12 @@ "Kind": "Method" }, { - "$id": "239", + "$id": "259", "Name": "resource", "NameInRequest": "resource", "Description": "The resource instance.", "Type": { - "$ref": "46" + "$ref": "70" }, "Location": "Body", "IsRequired": true, @@ -2095,11 +2244,11 @@ "Kind": "Method" }, { - "$id": "240", + "$id": "260", "Name": "contentType", "NameInRequest": "Content-Type", "Type": { - "$id": "241", + "$id": "261", "Name": "String", "Kind": "String", "IsNullable": false @@ -2114,19 +2263,19 @@ "Explode": false, "Kind": "Constant", "DefaultValue": { - "$id": "242", + "$id": "262", "Type": { - "$ref": "241" + "$ref": "261" }, "Value": "application/json" } }, { - "$id": "243", + "$id": "263", "Name": "accept", "NameInRequest": "Accept", "Type": { - "$id": "244", + "$id": "264", "Name": "String", "Kind": "String", "IsNullable": false @@ -2141,9 +2290,9 @@ "Explode": false, "Kind": "Constant", "DefaultValue": { - "$id": "245", + "$id": "265", "Type": { - "$ref": "244" + "$ref": "264" }, "Value": "application/json" } @@ -2151,22 +2300,22 @@ ], "Responses": [ { - "$id": "246", + "$id": "266", "StatusCodes": [ 201 ], "BodyType": { - "$ref": "46" + "$ref": "70" }, "BodyMediaType": "Json", "Headers": [ { - "$id": "247", + "$id": "267", "Name": "Operation-Location", "NameInResponse": "operationLocation", "Description": "The location for monitoring the operation state.", "Type": { - "$id": "248", + "$id": "268", "Name": "ResourceLocation", "Kind": "Uri", "IsNullable": false @@ -2176,22 +2325,22 @@ "IsErrorResponse": false }, { - "$id": "249", + "$id": "269", "StatusCodes": [ 200 ], "BodyType": { - "$ref": "46" + "$ref": "70" }, "BodyMediaType": "Json", "Headers": [ { - "$id": "250", + "$id": "270", "Name": "Operation-Location", "NameInResponse": "operationLocation", "Description": "The location for monitoring the operation state.", "Type": { - "$id": "251", + "$id": "271", "Name": "ResourceLocation", "Kind": "Uri", "IsNullable": false @@ -2209,27 +2358,41 @@ "application/json" ], "BufferResponse": true, + "LongRunning": { + "$id": "272", + "FinalStateVia": 3, + "FinalResponse": { + "$id": "273", + "StatusCodes": [ + 200 + ], + "BodyType": { + "$ref": "70" + }, + "BodyMediaType": "Json" + } + }, "GenerateProtocolMethod": true, "GenerateConvenienceMethod": false }, { - "$id": "252", + "$id": "274", "Name": "deleteDeployment", "ResourceName": "Deployment", "Description": "Deletes a project deployment.", "Parameters": [ { - "$ref": "148" + "$ref": "158" }, { - "$ref": "150" + "$ref": "160" }, { - "$id": "253", + "$id": "275", "Name": "projectName", "NameInRequest": "projectName", "Type": { - "$id": "254", + "$id": "276", "Name": "string", "Kind": "String", "IsNullable": false @@ -2245,11 +2408,11 @@ "Kind": "Method" }, { - "$id": "255", + "$id": "277", "Name": "deploymentName", "NameInRequest": "deploymentName", "Type": { - "$id": "256", + "$id": "278", "Name": "string", "Kind": "String", "IsNullable": false @@ -2265,11 +2428,11 @@ "Kind": "Method" }, { - "$id": "257", + "$id": "279", "Name": "accept", "NameInRequest": "Accept", "Type": { - "$id": "258", + "$id": "280", "Name": "String", "Kind": "String", "IsNullable": false @@ -2284,9 +2447,9 @@ "Explode": false, "Kind": "Constant", "DefaultValue": { - "$id": "259", + "$id": "281", "Type": { - "$ref": "258" + "$ref": "280" }, "Value": "application/json" } @@ -2294,22 +2457,22 @@ ], "Responses": [ { - "$id": "260", + "$id": "282", "StatusCodes": [ 202 ], "BodyType": { - "$ref": "46" + "$ref": "70" }, "BodyMediaType": "Json", "Headers": [ { - "$id": "261", + "$id": "283", "Name": "Operation-Location", "NameInResponse": "operationLocation", "Description": "The location for monitoring the operation state.", "Type": { - "$id": "262", + "$id": "284", "Name": "ResourceLocation", "Kind": "Uri", "IsNullable": false @@ -2324,27 +2487,38 @@ "Uri": "{Endpoint}/language", "Path": "/authoring/analyze-text/projects/{projectName}/deployments/{deploymentName}", "BufferResponse": true, + "LongRunning": { + "$id": "285", + "FinalStateVia": 3, + "FinalResponse": { + "$id": "286", + "StatusCodes": [ + 204 + ], + "BodyMediaType": "Json" + } + }, "GenerateProtocolMethod": true, "GenerateConvenienceMethod": false }, { - "$id": "263", + "$id": "287", "Name": "list", "ResourceName": "Deployment", "Description": "Lists the existing deployments.", "Parameters": [ { - "$ref": "148" + "$ref": "158" }, { - "$ref": "150" + "$ref": "160" }, { - "$id": "264", + "$id": "288", "Name": "projectName", "NameInRequest": "projectName", "Type": { - "$id": "265", + "$id": "289", "Name": "string", "Kind": "String", "IsNullable": false @@ -2360,11 +2534,11 @@ "Kind": "Method" }, { - "$id": "266", + "$id": "290", "Name": "accept", "NameInRequest": "Accept", "Type": { - "$id": "267", + "$id": "291", "Name": "String", "Kind": "String", "IsNullable": false @@ -2379,9 +2553,9 @@ "Explode": false, "Kind": "Constant", "DefaultValue": { - "$id": "268", + "$id": "292", "Type": { - "$ref": "267" + "$ref": "291" }, "Value": "application/json" } @@ -2389,12 +2563,12 @@ ], "Responses": [ { - "$id": "269", + "$id": "293", "StatusCodes": [ 200 ], "BodyType": { - "$ref": "49" + "$ref": "73" }, "BodyMediaType": "Json", "Headers": [], @@ -2407,7 +2581,7 @@ "Path": "/authoring/analyze-text/projects/{projectName}/deployments", "BufferResponse": true, "Paging": { - "$id": "270", + "$id": "294", "NextLinkName": "nextLink", "ItemName": "value" }, @@ -2415,23 +2589,23 @@ "GenerateConvenienceMethod": false }, { - "$id": "271", + "$id": "295", "Name": "swapDeployments", "ResourceName": "Deployments", "Description": "Swaps two existing deployments with each other.", "Parameters": [ { - "$ref": "148" + "$ref": "158" }, { - "$ref": "150" + "$ref": "160" }, { - "$id": "272", + "$id": "296", "Name": "projectName", "NameInRequest": "projectName", "Type": { - "$id": "273", + "$id": "297", "Name": "string", "Kind": "String", "IsNullable": false @@ -2447,12 +2621,12 @@ "Kind": "Method" }, { - "$id": "274", + "$id": "298", "Name": "body", "NameInRequest": "body", "Description": "The body schema of the operation.", "Type": { - "$ref": "54" + "$ref": "78" }, "Location": "Body", "IsRequired": true, @@ -2465,11 +2639,11 @@ "Kind": "Method" }, { - "$id": "275", + "$id": "299", "Name": "contentType", "NameInRequest": "Content-Type", "Type": { - "$id": "276", + "$id": "300", "Name": "String", "Kind": "String", "IsNullable": false @@ -2484,19 +2658,19 @@ "Explode": false, "Kind": "Constant", "DefaultValue": { - "$id": "277", + "$id": "301", "Type": { - "$ref": "276" + "$ref": "300" }, "Value": "application/json" } }, { - "$id": "278", + "$id": "302", "Name": "accept", "NameInRequest": "Accept", "Type": { - "$id": "279", + "$id": "303", "Name": "String", "Kind": "String", "IsNullable": false @@ -2511,9 +2685,9 @@ "Explode": false, "Kind": "Constant", "DefaultValue": { - "$id": "280", + "$id": "304", "Type": { - "$ref": "279" + "$ref": "303" }, "Value": "application/json" } @@ -2521,19 +2695,19 @@ ], "Responses": [ { - "$id": "281", + "$id": "305", "StatusCodes": [ 202 ], "BodyMediaType": "Json", "Headers": [ { - "$id": "282", + "$id": "306", "Name": "Operation-Location", "NameInResponse": "operationLocation", "Description": "The location for monitoring the operation state.", "Type": { - "$id": "283", + "$id": "307", "Name": "ResourceLocation", "Kind": "Uri", "IsNullable": false @@ -2551,27 +2725,41 @@ "application/json" ], "BufferResponse": true, + "LongRunning": { + "$id": "308", + "FinalStateVia": 3, + "FinalResponse": { + "$id": "309", + "StatusCodes": [ + 200 + ], + "BodyType": { + "$ref": "48" + }, + "BodyMediaType": "Json" + } + }, "GenerateProtocolMethod": true, "GenerateConvenienceMethod": false }, { - "$id": "284", + "$id": "310", "Name": "getDeploymentStatus", "ResourceName": "DeploymentJob", "Description": "Gets the status of an existing deployment job.", "Parameters": [ { - "$ref": "148" + "$ref": "158" }, { - "$ref": "150" + "$ref": "160" }, { - "$id": "285", + "$id": "311", "Name": "projectName", "NameInRequest": "projectName", "Type": { - "$id": "286", + "$id": "312", "Name": "string", "Kind": "String", "IsNullable": false @@ -2587,11 +2775,11 @@ "Kind": "Method" }, { - "$id": "287", + "$id": "313", "Name": "deploymentName", "NameInRequest": "deploymentName", "Type": { - "$id": "288", + "$id": "314", "Name": "string", "Kind": "String", "IsNullable": false @@ -2607,11 +2795,11 @@ "Kind": "Method" }, { - "$id": "289", + "$id": "315", "Name": "jobId", "NameInRequest": "jobId", "Type": { - "$id": "290", + "$id": "316", "Name": "string", "Kind": "String", "IsNullable": false @@ -2627,11 +2815,11 @@ "Kind": "Method" }, { - "$id": "291", + "$id": "317", "Name": "accept", "NameInRequest": "Accept", "Type": { - "$id": "292", + "$id": "318", "Name": "String", "Kind": "String", "IsNullable": false @@ -2646,9 +2834,9 @@ "Explode": false, "Kind": "Constant", "DefaultValue": { - "$id": "293", + "$id": "319", "Type": { - "$ref": "292" + "$ref": "318" }, "Value": "application/json" } @@ -2656,12 +2844,12 @@ ], "Responses": [ { - "$id": "294", + "$id": "320", "StatusCodes": [ 200 ], "BodyType": { - "$ref": "59" + "$ref": "83" }, "BodyMediaType": "Json", "Headers": [], @@ -2677,23 +2865,23 @@ "GenerateConvenienceMethod": true }, { - "$id": "295", + "$id": "321", "Name": "getSwapDeploymentsStatus", "ResourceName": "SwapDeploymentsJob", "Description": "Gets the status of an existing swap deployment job.", "Parameters": [ { - "$ref": "148" + "$ref": "158" }, { - "$ref": "150" + "$ref": "160" }, { - "$id": "296", + "$id": "322", "Name": "projectName", "NameInRequest": "projectName", "Type": { - "$id": "297", + "$id": "323", "Name": "string", "Kind": "String", "IsNullable": false @@ -2709,11 +2897,11 @@ "Kind": "Method" }, { - "$id": "298", + "$id": "324", "Name": "deploymentName", "NameInRequest": "deploymentName", "Type": { - "$id": "299", + "$id": "325", "Name": "string", "Kind": "String", "IsNullable": false @@ -2729,11 +2917,11 @@ "Kind": "Method" }, { - "$id": "300", + "$id": "326", "Name": "jobId", "NameInRequest": "jobId", "Type": { - "$id": "301", + "$id": "327", "Name": "string", "Kind": "String", "IsNullable": false @@ -2749,11 +2937,11 @@ "Kind": "Method" }, { - "$id": "302", + "$id": "328", "Name": "accept", "NameInRequest": "Accept", "Type": { - "$id": "303", + "$id": "329", "Name": "String", "Kind": "String", "IsNullable": false @@ -2768,9 +2956,9 @@ "Explode": false, "Kind": "Constant", "DefaultValue": { - "$id": "304", + "$id": "330", "Type": { - "$ref": "303" + "$ref": "329" }, "Value": "application/json" } @@ -2778,12 +2966,12 @@ ], "Responses": [ { - "$id": "305", + "$id": "331", "StatusCodes": [ 200 ], "BodyType": { - "$ref": "93" + "$ref": "103" }, "BodyMediaType": "Json", "Headers": [], @@ -2799,19 +2987,19 @@ "GenerateConvenienceMethod": true }, { - "$id": "306", + "$id": "332", "Name": "getSupportedLanguages", "ResourceName": "Global", "Parameters": [ { - "$ref": "148" + "$ref": "158" }, { - "$id": "307", + "$id": "333", "Name": "top", "NameInRequest": "top", "Type": { - "$id": "308", + "$id": "334", "Name": "int32", "Kind": "Int32", "IsNullable": false @@ -2827,11 +3015,11 @@ "Kind": "Method" }, { - "$id": "309", + "$id": "335", "Name": "skip", "NameInRequest": "skip", "Type": { - "$id": "310", + "$id": "336", "Name": "int32", "Kind": "Int32", "IsNullable": false @@ -2847,11 +3035,11 @@ "Kind": "Method" }, { - "$id": "311", + "$id": "337", "Name": "maxpagesize", "NameInRequest": "maxpagesize", "Type": { - "$id": "312", + "$id": "338", "Name": "int32", "Kind": "Int32", "IsNullable": false @@ -2867,14 +3055,14 @@ "Kind": "Method" }, { - "$ref": "150" + "$ref": "160" }, { - "$id": "313", + "$id": "339", "Name": "accept", "NameInRequest": "Accept", "Type": { - "$id": "314", + "$id": "340", "Name": "String", "Kind": "String", "IsNullable": false @@ -2889,9 +3077,9 @@ "Explode": false, "Kind": "Constant", "DefaultValue": { - "$id": "315", + "$id": "341", "Type": { - "$ref": "314" + "$ref": "340" }, "Value": "application/json" } @@ -2899,12 +3087,12 @@ ], "Responses": [ { - "$id": "316", + "$id": "342", "StatusCodes": [ 200 ], "BodyType": { - "$ref": "108" + "$ref": "118" }, "BodyMediaType": "Json", "Headers": [], @@ -2917,7 +3105,7 @@ "Path": "/authoring/analyze-text/projects/global/languages", "BufferResponse": true, "Paging": { - "$id": "317", + "$id": "343", "NextLinkName": "nextLink", "ItemName": "value" }, @@ -2925,19 +3113,19 @@ "GenerateConvenienceMethod": false }, { - "$id": "318", + "$id": "344", "Name": "listTrainingConfigVersions", "ResourceName": "Global", "Parameters": [ { - "$ref": "148" + "$ref": "158" }, { - "$id": "319", + "$id": "345", "Name": "top", "NameInRequest": "top", "Type": { - "$id": "320", + "$id": "346", "Name": "int32", "Kind": "Int32", "IsNullable": false @@ -2953,11 +3141,11 @@ "Kind": "Method" }, { - "$id": "321", + "$id": "347", "Name": "skip", "NameInRequest": "skip", "Type": { - "$id": "322", + "$id": "348", "Name": "int32", "Kind": "Int32", "IsNullable": false @@ -2973,11 +3161,11 @@ "Kind": "Method" }, { - "$id": "323", + "$id": "349", "Name": "maxpagesize", "NameInRequest": "maxpagesize", "Type": { - "$id": "324", + "$id": "350", "Name": "int32", "Kind": "Int32", "IsNullable": false @@ -2993,14 +3181,14 @@ "Kind": "Method" }, { - "$ref": "150" + "$ref": "160" }, { - "$id": "325", + "$id": "351", "Name": "accept", "NameInRequest": "Accept", "Type": { - "$id": "326", + "$id": "352", "Name": "String", "Kind": "String", "IsNullable": false @@ -3015,9 +3203,9 @@ "Explode": false, "Kind": "Constant", "DefaultValue": { - "$id": "327", + "$id": "353", "Type": { - "$ref": "326" + "$ref": "352" }, "Value": "application/json" } @@ -3025,12 +3213,12 @@ ], "Responses": [ { - "$id": "328", + "$id": "354", "StatusCodes": [ 200 ], "BodyType": { - "$ref": "118" + "$ref": "128" }, "BodyMediaType": "Json", "Headers": [], @@ -3043,7 +3231,7 @@ "Path": "/authoring/analyze-text/projects/global/training-config-versions", "BufferResponse": true, "Paging": { - "$id": "329", + "$id": "355", "NextLinkName": "nextLink", "ItemName": "value" }, @@ -3052,7 +3240,7 @@ } ], "Protocol": { - "$id": "330" + "$id": "356" }, "Creatable": true } diff --git a/test/TestProjects/Authoring-TypeSpec/tests/Generated/Samples/Samples_AuthoringTypeSpecClient.cs b/test/TestProjects/Authoring-TypeSpec/tests/Generated/Samples/Samples_AuthoringTypeSpecClient.cs index 71134401e1e..f720402fd2b 100644 --- a/test/TestProjects/Authoring-TypeSpec/tests/Generated/Samples/Samples_AuthoringTypeSpecClient.cs +++ b/test/TestProjects/Authoring-TypeSpec/tests/Generated/Samples/Samples_AuthoringTypeSpecClient.cs @@ -21,18 +21,12 @@ public partial class Samples_AuthoringTypeSpecClient { [Test] [Ignore("Only validating compilation of examples")] - public void Example_CreateOrUpdate_ShortVersion() + public void Example_GetProject_ShortVersion() { Uri endpoint = new Uri(""); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); - using RequestContent content = RequestContent.Create(new - { - projectKind = "CustomSingleLabelClassification", - storageInputContainerName = "", - language = "", - }); - Response response = client.CreateOrUpdate("", content); + Response response = client.GetProject(""); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("projectName").ToString()); @@ -47,18 +41,12 @@ public void Example_CreateOrUpdate_ShortVersion() [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_CreateOrUpdate_ShortVersion_Async() + public async Task Example_GetProject_ShortVersion_Async() { Uri endpoint = new Uri(""); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); - using RequestContent content = RequestContent.Create(new - { - projectKind = "CustomSingleLabelClassification", - storageInputContainerName = "", - language = "", - }); - Response response = await client.CreateOrUpdateAsync("", content); + Response response = await client.GetProjectAsync(""); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("projectName").ToString()); @@ -73,24 +61,12 @@ public async Task Example_CreateOrUpdate_ShortVersion_Async() [Test] [Ignore("Only validating compilation of examples")] - public void Example_CreateOrUpdate_AllParameters() + public void Example_GetProject_AllParameters() { Uri endpoint = new Uri(""); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); - using RequestContent content = RequestContent.Create(new - { - projectKind = "CustomSingleLabelClassification", - storageInputContainerName = "", - settings = new - { - key = "", - }, - multilingual = true, - description = "", - language = "", - }); - Response response = client.CreateOrUpdate("", content); + Response response = client.GetProject(""); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("projectName").ToString()); @@ -108,24 +84,12 @@ public void Example_CreateOrUpdate_AllParameters() [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_CreateOrUpdate_AllParameters_Async() + public async Task Example_GetProject_AllParameters_Async() { Uri endpoint = new Uri(""); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); - using RequestContent content = RequestContent.Create(new - { - projectKind = "CustomSingleLabelClassification", - storageInputContainerName = "", - settings = new - { - key = "", - }, - multilingual = true, - description = "", - language = "", - }); - Response response = await client.CreateOrUpdateAsync("", content); + Response response = await client.GetProjectAsync(""); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("projectName").ToString()); @@ -143,1092 +107,1158 @@ public async Task Example_CreateOrUpdate_AllParameters_Async() [Test] [Ignore("Only validating compilation of examples")] - public void Example_GetProject_ShortVersion() + public void Example_GetDeployment_ShortVersion() { Uri endpoint = new Uri(""); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); - Response response = client.GetProject(""); + Response response = client.GetDeployment("", ""); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("projectName").ToString()); - Console.WriteLine(result.GetProperty("projectKind").ToString()); - Console.WriteLine(result.GetProperty("storageInputContainerName").ToString()); - Console.WriteLine(result.GetProperty("language").ToString()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastModifiedDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastDeployedDateTime").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); } [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_GetProject_ShortVersion_Async() + public async Task Example_GetDeployment_ShortVersion_Async() { Uri endpoint = new Uri(""); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); - Response response = await client.GetProjectAsync(""); + Response response = await client.GetDeploymentAsync("", ""); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("projectName").ToString()); - Console.WriteLine(result.GetProperty("projectKind").ToString()); - Console.WriteLine(result.GetProperty("storageInputContainerName").ToString()); - Console.WriteLine(result.GetProperty("language").ToString()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastModifiedDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastDeployedDateTime").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); } [Test] [Ignore("Only validating compilation of examples")] - public void Example_GetProject_AllParameters() + public void Example_GetDeployment_AllParameters() { Uri endpoint = new Uri(""); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); - Response response = client.GetProject(""); + Response response = client.GetDeployment("", ""); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("projectName").ToString()); - Console.WriteLine(result.GetProperty("projectKind").ToString()); - Console.WriteLine(result.GetProperty("storageInputContainerName").ToString()); - Console.WriteLine(result.GetProperty("settings").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("multilingual").ToString()); - Console.WriteLine(result.GetProperty("description").ToString()); - Console.WriteLine(result.GetProperty("language").ToString()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastModifiedDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastDeployedDateTime").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); } [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_GetProject_AllParameters_Async() + public async Task Example_GetDeployment_AllParameters_Async() { Uri endpoint = new Uri(""); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); - Response response = await client.GetProjectAsync(""); + Response response = await client.GetDeploymentAsync("", ""); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("projectName").ToString()); - Console.WriteLine(result.GetProperty("projectKind").ToString()); - Console.WriteLine(result.GetProperty("storageInputContainerName").ToString()); - Console.WriteLine(result.GetProperty("settings").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("multilingual").ToString()); - Console.WriteLine(result.GetProperty("description").ToString()); - Console.WriteLine(result.GetProperty("language").ToString()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastModifiedDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastDeployedDateTime").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); } [Test] [Ignore("Only validating compilation of examples")] - public void Example_Delete_ShortVersion() + public void Example_GetDeploymentStatus_ShortVersion() { Uri endpoint = new Uri(""); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); - Response response = client.Delete(""); + Response response = client.GetDeploymentStatus("", "", ""); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("projectName").ToString()); - Console.WriteLine(result.GetProperty("projectKind").ToString()); - Console.WriteLine(result.GetProperty("storageInputContainerName").ToString()); - Console.WriteLine(result.GetProperty("language").ToString()); + Console.WriteLine(result.GetProperty("jobId").ToString()); Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastModifiedDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastDeployedDateTime").ToString()); + Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); + Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("errors").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("errors").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); } [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_Delete_ShortVersion_Async() + public async Task Example_GetDeploymentStatus_ShortVersion_Async() { Uri endpoint = new Uri(""); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); - Response response = await client.DeleteAsync(""); + Response response = await client.GetDeploymentStatusAsync("", "", ""); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("projectName").ToString()); - Console.WriteLine(result.GetProperty("projectKind").ToString()); - Console.WriteLine(result.GetProperty("storageInputContainerName").ToString()); - Console.WriteLine(result.GetProperty("language").ToString()); + Console.WriteLine(result.GetProperty("jobId").ToString()); Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastModifiedDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastDeployedDateTime").ToString()); + Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); + Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("errors").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("errors").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); } [Test] [Ignore("Only validating compilation of examples")] - public void Example_Delete_AllParameters() + public void Example_GetDeploymentStatusValue_ShortVersion_Convenience() { Uri endpoint = new Uri(""); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); - Response response = client.Delete(""); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("projectName").ToString()); - Console.WriteLine(result.GetProperty("projectKind").ToString()); - Console.WriteLine(result.GetProperty("storageInputContainerName").ToString()); - Console.WriteLine(result.GetProperty("settings").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("multilingual").ToString()); - Console.WriteLine(result.GetProperty("description").ToString()); - Console.WriteLine(result.GetProperty("language").ToString()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastModifiedDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastDeployedDateTime").ToString()); + Response response = client.GetDeploymentStatusValue("", "", ""); } [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_Delete_AllParameters_Async() + public async Task Example_GetDeploymentStatusValue_ShortVersion_Convenience_Async() { Uri endpoint = new Uri(""); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); - Response response = await client.DeleteAsync(""); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("projectName").ToString()); - Console.WriteLine(result.GetProperty("projectKind").ToString()); - Console.WriteLine(result.GetProperty("storageInputContainerName").ToString()); - Console.WriteLine(result.GetProperty("settings").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("multilingual").ToString()); - Console.WriteLine(result.GetProperty("description").ToString()); - Console.WriteLine(result.GetProperty("language").ToString()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastModifiedDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastDeployedDateTime").ToString()); + Response response = await client.GetDeploymentStatusValueAsync("", "", ""); } [Test] [Ignore("Only validating compilation of examples")] - public void Example_Export_ShortVersion() + public void Example_GetDeploymentStatus_AllParameters() { Uri endpoint = new Uri(""); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); - Response response = client.Export("", ""); + Response response = client.GetDeploymentStatus("", "", ""); - Console.WriteLine(response.Status); + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("jobId").ToString()); + Console.WriteLine(result.GetProperty("createdDateTime").ToString()); + Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); + Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("errors").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("errors").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("errors").GetProperty("target").ToString()); + Console.WriteLine(result.GetProperty("errors").GetProperty("innererror").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); } [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_Export_ShortVersion_Async() + public async Task Example_GetDeploymentStatus_AllParameters_Async() { Uri endpoint = new Uri(""); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); - Response response = await client.ExportAsync("", ""); + Response response = await client.GetDeploymentStatusAsync("", "", ""); - Console.WriteLine(response.Status); + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("jobId").ToString()); + Console.WriteLine(result.GetProperty("createdDateTime").ToString()); + Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); + Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("errors").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("errors").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("errors").GetProperty("target").ToString()); + Console.WriteLine(result.GetProperty("errors").GetProperty("innererror").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); } [Test] [Ignore("Only validating compilation of examples")] - public void Example_Export_AllParameters() + public void Example_GetDeploymentStatusValue_AllParameters_Convenience() { Uri endpoint = new Uri(""); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); - Response response = client.Export("", ""); - - Console.WriteLine(response.Status); + Response response = client.GetDeploymentStatusValue("", "", ""); } [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_Export_AllParameters_Async() + public async Task Example_GetDeploymentStatusValue_AllParameters_Convenience_Async() { Uri endpoint = new Uri(""); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); - Response response = await client.ExportAsync("", ""); - - Console.WriteLine(response.Status); + Response response = await client.GetDeploymentStatusValueAsync("", "", ""); } [Test] [Ignore("Only validating compilation of examples")] - public void Example_Importx_ShortVersion() + public void Example_GetSwapDeploymentsStatus_ShortVersion() { Uri endpoint = new Uri(""); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); - Response response = client.Importx(""); + Response response = client.GetSwapDeploymentsStatus("", "", ""); - Console.WriteLine(response.Status); + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("jobId").ToString()); + Console.WriteLine(result.GetProperty("createdDateTime").ToString()); + Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); + Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("errors").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("errors").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); } [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_Importx_ShortVersion_Async() + public async Task Example_GetSwapDeploymentsStatus_ShortVersion_Async() { Uri endpoint = new Uri(""); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); - Response response = await client.ImportxAsync(""); + Response response = await client.GetSwapDeploymentsStatusAsync("", "", ""); - Console.WriteLine(response.Status); + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("jobId").ToString()); + Console.WriteLine(result.GetProperty("createdDateTime").ToString()); + Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); + Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("errors").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("errors").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); } [Test] [Ignore("Only validating compilation of examples")] - public void Example_Importx_AllParameters() + public void Example_GetSwapDeploymentsStatusValue_ShortVersion_Convenience() { Uri endpoint = new Uri(""); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); - Response response = client.Importx(""); - - Console.WriteLine(response.Status); + Response response = client.GetSwapDeploymentsStatusValue("", "", ""); } [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_Importx_AllParameters_Async() + public async Task Example_GetSwapDeploymentsStatusValue_ShortVersion_Convenience_Async() { Uri endpoint = new Uri(""); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); - Response response = await client.ImportxAsync(""); - - Console.WriteLine(response.Status); + Response response = await client.GetSwapDeploymentsStatusValueAsync("", "", ""); } [Test] [Ignore("Only validating compilation of examples")] - public void Example_Train_ShortVersion() + public void Example_GetSwapDeploymentsStatus_AllParameters() { Uri endpoint = new Uri(""); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); - using RequestContent content = RequestContent.Create(new - { - modelLabel = "", - }); - Response response = client.Train("", content); + Response response = client.GetSwapDeploymentsStatus("", "", ""); - Console.WriteLine(response.Status); + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("jobId").ToString()); + Console.WriteLine(result.GetProperty("createdDateTime").ToString()); + Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); + Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("errors").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("errors").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("errors").GetProperty("target").ToString()); + Console.WriteLine(result.GetProperty("errors").GetProperty("innererror").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); } [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_Train_ShortVersion_Async() + public async Task Example_GetSwapDeploymentsStatus_AllParameters_Async() { Uri endpoint = new Uri(""); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); - using RequestContent content = RequestContent.Create(new - { - modelLabel = "", - }); - Response response = await client.TrainAsync("", content); + Response response = await client.GetSwapDeploymentsStatusAsync("", "", ""); - Console.WriteLine(response.Status); + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("jobId").ToString()); + Console.WriteLine(result.GetProperty("createdDateTime").ToString()); + Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); + Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("errors").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("errors").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("errors").GetProperty("target").ToString()); + Console.WriteLine(result.GetProperty("errors").GetProperty("innererror").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); } [Test] [Ignore("Only validating compilation of examples")] - public void Example_Train_AllParameters() + public void Example_GetSwapDeploymentsStatusValue_AllParameters_Convenience() { Uri endpoint = new Uri(""); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); - using RequestContent content = RequestContent.Create(new - { - modelLabel = "", - }); - Response response = client.Train("", content); - - Console.WriteLine(response.Status); + Response response = client.GetSwapDeploymentsStatusValue("", "", ""); } [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_Train_AllParameters_Async() + public async Task Example_GetSwapDeploymentsStatusValue_AllParameters_Convenience_Async() { Uri endpoint = new Uri(""); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); - using RequestContent content = RequestContent.Create(new - { - modelLabel = "", - }); - Response response = await client.TrainAsync("", content); - - Console.WriteLine(response.Status); + Response response = await client.GetSwapDeploymentsStatusValueAsync("", "", ""); } [Test] [Ignore("Only validating compilation of examples")] - public void Example_GetDeployment_ShortVersion() + public void Example_GetProjects_ShortVersion() { Uri endpoint = new Uri(""); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); - Response response = client.GetDeployment("", ""); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("name").ToString()); + foreach (BinaryData item in client.GetProjects()) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("projectName").ToString()); + Console.WriteLine(result.GetProperty("projectKind").ToString()); + Console.WriteLine(result.GetProperty("storageInputContainerName").ToString()); + Console.WriteLine(result.GetProperty("language").ToString()); + Console.WriteLine(result.GetProperty("createdDateTime").ToString()); + Console.WriteLine(result.GetProperty("lastModifiedDateTime").ToString()); + Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); + Console.WriteLine(result.GetProperty("lastDeployedDateTime").ToString()); + } } [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_GetDeployment_ShortVersion_Async() + public async Task Example_GetProjects_ShortVersion_Async() { Uri endpoint = new Uri(""); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); - Response response = await client.GetDeploymentAsync("", ""); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("name").ToString()); + await foreach (BinaryData item in client.GetProjectsAsync()) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("projectName").ToString()); + Console.WriteLine(result.GetProperty("projectKind").ToString()); + Console.WriteLine(result.GetProperty("storageInputContainerName").ToString()); + Console.WriteLine(result.GetProperty("language").ToString()); + Console.WriteLine(result.GetProperty("createdDateTime").ToString()); + Console.WriteLine(result.GetProperty("lastModifiedDateTime").ToString()); + Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); + Console.WriteLine(result.GetProperty("lastDeployedDateTime").ToString()); + } } [Test] [Ignore("Only validating compilation of examples")] - public void Example_GetDeployment_AllParameters() + public void Example_GetProjects_AllParameters() { Uri endpoint = new Uri(""); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); - Response response = client.GetDeployment("", ""); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("name").ToString()); + foreach (BinaryData item in client.GetProjects()) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("projectName").ToString()); + Console.WriteLine(result.GetProperty("projectKind").ToString()); + Console.WriteLine(result.GetProperty("storageInputContainerName").ToString()); + Console.WriteLine(result.GetProperty("settings").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("multilingual").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + Console.WriteLine(result.GetProperty("language").ToString()); + Console.WriteLine(result.GetProperty("createdDateTime").ToString()); + Console.WriteLine(result.GetProperty("lastModifiedDateTime").ToString()); + Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); + Console.WriteLine(result.GetProperty("lastDeployedDateTime").ToString()); + } } [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_GetDeployment_AllParameters_Async() + public async Task Example_GetProjects_AllParameters_Async() { Uri endpoint = new Uri(""); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); - Response response = await client.GetDeploymentAsync("", ""); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("name").ToString()); + await foreach (BinaryData item in client.GetProjectsAsync()) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("projectName").ToString()); + Console.WriteLine(result.GetProperty("projectKind").ToString()); + Console.WriteLine(result.GetProperty("storageInputContainerName").ToString()); + Console.WriteLine(result.GetProperty("settings").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("multilingual").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + Console.WriteLine(result.GetProperty("language").ToString()); + Console.WriteLine(result.GetProperty("createdDateTime").ToString()); + Console.WriteLine(result.GetProperty("lastModifiedDateTime").ToString()); + Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); + Console.WriteLine(result.GetProperty("lastDeployedDateTime").ToString()); + } } [Test] [Ignore("Only validating compilation of examples")] - public void Example_DeployProject_ShortVersion() + public void Example_GetDeployments_ShortVersion() { Uri endpoint = new Uri(""); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); - using RequestContent content = RequestContent.Create(new object()); - Response response = client.DeployProject("", "", content); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("name").ToString()); + foreach (BinaryData item in client.GetDeployments("")) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); + } } [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_DeployProject_ShortVersion_Async() + public async Task Example_GetDeployments_ShortVersion_Async() { Uri endpoint = new Uri(""); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); - using RequestContent content = RequestContent.Create(new object()); - Response response = await client.DeployProjectAsync("", "", content); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("name").ToString()); + await foreach (BinaryData item in client.GetDeploymentsAsync("")) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); + } } [Test] [Ignore("Only validating compilation of examples")] - public void Example_DeployProject_AllParameters() + public void Example_GetDeployments_AllParameters() { Uri endpoint = new Uri(""); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); - using RequestContent content = RequestContent.Create(new object()); - Response response = client.DeployProject("", "", content); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("name").ToString()); + foreach (BinaryData item in client.GetDeployments("")) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); + } } [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_DeployProject_AllParameters_Async() + public async Task Example_GetDeployments_AllParameters_Async() { Uri endpoint = new Uri(""); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); - using RequestContent content = RequestContent.Create(new object()); - Response response = await client.DeployProjectAsync("", "", content); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("name").ToString()); + await foreach (BinaryData item in client.GetDeploymentsAsync("")) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); + } } [Test] [Ignore("Only validating compilation of examples")] - public void Example_DeleteDeployment_ShortVersion() + public void Example_GetSupportedLanguages_ShortVersion() { Uri endpoint = new Uri(""); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); - Response response = client.DeleteDeployment("", ""); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("name").ToString()); + foreach (BinaryData item in client.GetSupportedLanguages()) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("languageName").ToString()); + Console.WriteLine(result.GetProperty("languageCode").ToString()); + } } [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_DeleteDeployment_ShortVersion_Async() + public async Task Example_GetSupportedLanguages_ShortVersion_Async() { Uri endpoint = new Uri(""); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); - Response response = await client.DeleteDeploymentAsync("", ""); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("name").ToString()); + await foreach (BinaryData item in client.GetSupportedLanguagesAsync()) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("languageName").ToString()); + Console.WriteLine(result.GetProperty("languageCode").ToString()); + } } [Test] [Ignore("Only validating compilation of examples")] - public void Example_DeleteDeployment_AllParameters() + public void Example_GetSupportedLanguages_AllParameters() { Uri endpoint = new Uri(""); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); - Response response = client.DeleteDeployment("", ""); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("name").ToString()); + foreach (BinaryData item in client.GetSupportedLanguages(maxCount: 1234, skip: 1234, maxpagesize: 1234)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("languageName").ToString()); + Console.WriteLine(result.GetProperty("languageCode").ToString()); + } } [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_DeleteDeployment_AllParameters_Async() + public async Task Example_GetSupportedLanguages_AllParameters_Async() { Uri endpoint = new Uri(""); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); - Response response = await client.DeleteDeploymentAsync("", ""); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("name").ToString()); + await foreach (BinaryData item in client.GetSupportedLanguagesAsync(maxCount: 1234, skip: 1234, maxpagesize: 1234)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("languageName").ToString()); + Console.WriteLine(result.GetProperty("languageCode").ToString()); + } } [Test] [Ignore("Only validating compilation of examples")] - public void Example_SwapDeployments_ShortVersion() + public void Example_GetTrainingConfigVersions_ShortVersion() { Uri endpoint = new Uri(""); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); - using RequestContent content = RequestContent.Create(new + foreach (BinaryData item in client.GetTrainingConfigVersions()) { - firstDeploymentName = "", - secondDeploymentName = "", - }); - Response response = client.SwapDeployments("", content); - - Console.WriteLine(response.Status); + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("trainingConfigVersionStr").ToString()); + Console.WriteLine(result.GetProperty("modelExpirationDate").ToString()); + } } [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_SwapDeployments_ShortVersion_Async() + public async Task Example_GetTrainingConfigVersions_ShortVersion_Async() { Uri endpoint = new Uri(""); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); - using RequestContent content = RequestContent.Create(new + await foreach (BinaryData item in client.GetTrainingConfigVersionsAsync()) { - firstDeploymentName = "", - secondDeploymentName = "", - }); - Response response = await client.SwapDeploymentsAsync("", content); - - Console.WriteLine(response.Status); + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("trainingConfigVersionStr").ToString()); + Console.WriteLine(result.GetProperty("modelExpirationDate").ToString()); + } } [Test] [Ignore("Only validating compilation of examples")] - public void Example_SwapDeployments_AllParameters() + public void Example_GetTrainingConfigVersions_AllParameters() { Uri endpoint = new Uri(""); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); - using RequestContent content = RequestContent.Create(new + foreach (BinaryData item in client.GetTrainingConfigVersions(maxCount: 1234, skip: 1234, maxpagesize: 1234)) { - firstDeploymentName = "", - secondDeploymentName = "", - }); - Response response = client.SwapDeployments("", content); - - Console.WriteLine(response.Status); + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("trainingConfigVersionStr").ToString()); + Console.WriteLine(result.GetProperty("modelExpirationDate").ToString()); + } } [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_SwapDeployments_AllParameters_Async() + public async Task Example_GetTrainingConfigVersions_AllParameters_Async() { Uri endpoint = new Uri(""); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); - using RequestContent content = RequestContent.Create(new + await foreach (BinaryData item in client.GetTrainingConfigVersionsAsync(maxCount: 1234, skip: 1234, maxpagesize: 1234)) { - firstDeploymentName = "", - secondDeploymentName = "", - }); - Response response = await client.SwapDeploymentsAsync("", content); - - Console.WriteLine(response.Status); + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("trainingConfigVersionStr").ToString()); + Console.WriteLine(result.GetProperty("modelExpirationDate").ToString()); + } } [Test] [Ignore("Only validating compilation of examples")] - public void Example_GetDeploymentStatus_ShortVersion() + public void Example_CreateOrUpdate_ShortVersion() { Uri endpoint = new Uri(""); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); - Response response = client.GetDeploymentStatus("", "", ""); + using RequestContent content = RequestContent.Create(new + { + projectKind = "CustomSingleLabelClassification", + storageInputContainerName = "", + language = "", + }); + Operation operation = client.CreateOrUpdate(WaitUntil.Completed, "", content); + BinaryData responseData = operation.Value; - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("jobId").ToString()); + JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("projectName").ToString()); + Console.WriteLine(result.GetProperty("projectKind").ToString()); + Console.WriteLine(result.GetProperty("storageInputContainerName").ToString()); + Console.WriteLine(result.GetProperty("language").ToString()); Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); - Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors").GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("lastModifiedDateTime").ToString()); + Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); + Console.WriteLine(result.GetProperty("lastDeployedDateTime").ToString()); } [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_GetDeploymentStatus_ShortVersion_Async() + public async Task Example_CreateOrUpdate_ShortVersion_Async() { Uri endpoint = new Uri(""); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); - Response response = await client.GetDeploymentStatusAsync("", "", ""); + using RequestContent content = RequestContent.Create(new + { + projectKind = "CustomSingleLabelClassification", + storageInputContainerName = "", + language = "", + }); + Operation operation = await client.CreateOrUpdateAsync(WaitUntil.Completed, "", content); + BinaryData responseData = operation.Value; - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("jobId").ToString()); + JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("projectName").ToString()); + Console.WriteLine(result.GetProperty("projectKind").ToString()); + Console.WriteLine(result.GetProperty("storageInputContainerName").ToString()); + Console.WriteLine(result.GetProperty("language").ToString()); Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); - Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors").GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("lastModifiedDateTime").ToString()); + Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); + Console.WriteLine(result.GetProperty("lastDeployedDateTime").ToString()); } [Test] [Ignore("Only validating compilation of examples")] - public void Example_GetDeploymentStatusValue_ShortVersion_Convenience() + public void Example_CreateOrUpdate_AllParameters() { Uri endpoint = new Uri(""); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); - Response response = client.GetDeploymentStatusValue("", "", ""); + using RequestContent content = RequestContent.Create(new + { + projectKind = "CustomSingleLabelClassification", + storageInputContainerName = "", + settings = new + { + key = "", + }, + multilingual = true, + description = "", + language = "", + }); + Operation operation = client.CreateOrUpdate(WaitUntil.Completed, "", content); + BinaryData responseData = operation.Value; + + JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("projectName").ToString()); + Console.WriteLine(result.GetProperty("projectKind").ToString()); + Console.WriteLine(result.GetProperty("storageInputContainerName").ToString()); + Console.WriteLine(result.GetProperty("settings").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("multilingual").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + Console.WriteLine(result.GetProperty("language").ToString()); + Console.WriteLine(result.GetProperty("createdDateTime").ToString()); + Console.WriteLine(result.GetProperty("lastModifiedDateTime").ToString()); + Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); + Console.WriteLine(result.GetProperty("lastDeployedDateTime").ToString()); } [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_GetDeploymentStatusValue_ShortVersion_Convenience_Async() + public async Task Example_CreateOrUpdate_AllParameters_Async() { Uri endpoint = new Uri(""); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); - Response response = await client.GetDeploymentStatusValueAsync("", "", ""); + using RequestContent content = RequestContent.Create(new + { + projectKind = "CustomSingleLabelClassification", + storageInputContainerName = "", + settings = new + { + key = "", + }, + multilingual = true, + description = "", + language = "", + }); + Operation operation = await client.CreateOrUpdateAsync(WaitUntil.Completed, "", content); + BinaryData responseData = operation.Value; + + JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("projectName").ToString()); + Console.WriteLine(result.GetProperty("projectKind").ToString()); + Console.WriteLine(result.GetProperty("storageInputContainerName").ToString()); + Console.WriteLine(result.GetProperty("settings").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("multilingual").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + Console.WriteLine(result.GetProperty("language").ToString()); + Console.WriteLine(result.GetProperty("createdDateTime").ToString()); + Console.WriteLine(result.GetProperty("lastModifiedDateTime").ToString()); + Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); + Console.WriteLine(result.GetProperty("lastDeployedDateTime").ToString()); } [Test] [Ignore("Only validating compilation of examples")] - public void Example_GetDeploymentStatus_AllParameters() + public void Example_Delete_ShortVersion() { Uri endpoint = new Uri(""); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); - Response response = client.GetDeploymentStatus("", "", ""); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("jobId").ToString()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); - Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors").GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors").GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors").GetProperty("innererror").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("id").ToString()); + Operation operation = client.Delete(WaitUntil.Completed, ""); } [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_GetDeploymentStatus_AllParameters_Async() + public async Task Example_Delete_ShortVersion_Async() { Uri endpoint = new Uri(""); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); - Response response = await client.GetDeploymentStatusAsync("", "", ""); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("jobId").ToString()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); - Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors").GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors").GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors").GetProperty("innererror").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("id").ToString()); + Operation operation = await client.DeleteAsync(WaitUntil.Completed, ""); } [Test] [Ignore("Only validating compilation of examples")] - public void Example_GetDeploymentStatusValue_AllParameters_Convenience() + public void Example_Delete_AllParameters() { Uri endpoint = new Uri(""); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); - Response response = client.GetDeploymentStatusValue("", "", ""); + Operation operation = client.Delete(WaitUntil.Completed, ""); } [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_GetDeploymentStatusValue_AllParameters_Convenience_Async() + public async Task Example_Delete_AllParameters_Async() { Uri endpoint = new Uri(""); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); - Response response = await client.GetDeploymentStatusValueAsync("", "", ""); + Operation operation = await client.DeleteAsync(WaitUntil.Completed, ""); } [Test] [Ignore("Only validating compilation of examples")] - public void Example_GetSwapDeploymentsStatus_ShortVersion() + public void Example_Export_ShortVersion() { Uri endpoint = new Uri(""); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); - Response response = client.GetSwapDeploymentsStatus("", "", ""); + Operation operation = client.Export(WaitUntil.Completed, "", ""); + BinaryData responseData = operation.Value; - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("jobId").ToString()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); - Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors").GetProperty("message").ToString()); + JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); } [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_GetSwapDeploymentsStatus_ShortVersion_Async() + public async Task Example_Export_ShortVersion_Async() { Uri endpoint = new Uri(""); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); - Response response = await client.GetSwapDeploymentsStatusAsync("", "", ""); + Operation operation = await client.ExportAsync(WaitUntil.Completed, "", ""); + BinaryData responseData = operation.Value; - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("jobId").ToString()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); - Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors").GetProperty("message").ToString()); + JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); } [Test] [Ignore("Only validating compilation of examples")] - public void Example_GetSwapDeploymentsStatusValue_ShortVersion_Convenience() + public void Example_Export_AllParameters() { Uri endpoint = new Uri(""); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); - Response response = client.GetSwapDeploymentsStatusValue("", "", ""); + Operation operation = client.Export(WaitUntil.Completed, "", ""); + BinaryData responseData = operation.Value; + + JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("error").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("error").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("error").GetProperty("target").ToString()); + Console.WriteLine(result.GetProperty("error").GetProperty("innererror").GetProperty("code").ToString()); } [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_GetSwapDeploymentsStatusValue_ShortVersion_Convenience_Async() + public async Task Example_Export_AllParameters_Async() { Uri endpoint = new Uri(""); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); - Response response = await client.GetSwapDeploymentsStatusValueAsync("", "", ""); + Operation operation = await client.ExportAsync(WaitUntil.Completed, "", ""); + BinaryData responseData = operation.Value; + + JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("error").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("error").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("error").GetProperty("target").ToString()); + Console.WriteLine(result.GetProperty("error").GetProperty("innererror").GetProperty("code").ToString()); } [Test] [Ignore("Only validating compilation of examples")] - public void Example_GetSwapDeploymentsStatus_AllParameters() + public void Example_Importx_ShortVersion() { Uri endpoint = new Uri(""); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); - Response response = client.GetSwapDeploymentsStatus("", "", ""); + Operation operation = client.Importx(WaitUntil.Completed, ""); + BinaryData responseData = operation.Value; - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("jobId").ToString()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); - Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors").GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors").GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors").GetProperty("innererror").GetProperty("code").ToString()); + JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); } [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_GetSwapDeploymentsStatus_AllParameters_Async() + public async Task Example_Importx_ShortVersion_Async() { Uri endpoint = new Uri(""); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); - Response response = await client.GetSwapDeploymentsStatusAsync("", "", ""); + Operation operation = await client.ImportxAsync(WaitUntil.Completed, ""); + BinaryData responseData = operation.Value; - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("jobId").ToString()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); - Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors").GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors").GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors").GetProperty("innererror").GetProperty("code").ToString()); + JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); } [Test] [Ignore("Only validating compilation of examples")] - public void Example_GetSwapDeploymentsStatusValue_AllParameters_Convenience() + public void Example_Importx_AllParameters() { Uri endpoint = new Uri(""); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); - Response response = client.GetSwapDeploymentsStatusValue("", "", ""); + Operation operation = client.Importx(WaitUntil.Completed, ""); + BinaryData responseData = operation.Value; + + JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("error").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("error").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("error").GetProperty("target").ToString()); + Console.WriteLine(result.GetProperty("error").GetProperty("innererror").GetProperty("code").ToString()); } [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_GetSwapDeploymentsStatusValue_AllParameters_Convenience_Async() + public async Task Example_Importx_AllParameters_Async() { Uri endpoint = new Uri(""); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); - Response response = await client.GetSwapDeploymentsStatusValueAsync("", "", ""); + Operation operation = await client.ImportxAsync(WaitUntil.Completed, ""); + BinaryData responseData = operation.Value; + + JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("error").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("error").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("error").GetProperty("target").ToString()); + Console.WriteLine(result.GetProperty("error").GetProperty("innererror").GetProperty("code").ToString()); } [Test] [Ignore("Only validating compilation of examples")] - public void Example_GetProjects_ShortVersion() + public void Example_Train_ShortVersion() { Uri endpoint = new Uri(""); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); - foreach (BinaryData item in client.GetProjects()) + using RequestContent content = RequestContent.Create(new { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("projectName").ToString()); - Console.WriteLine(result.GetProperty("projectKind").ToString()); - Console.WriteLine(result.GetProperty("storageInputContainerName").ToString()); - Console.WriteLine(result.GetProperty("language").ToString()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastModifiedDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastDeployedDateTime").ToString()); - } + modelLabel = "", + }); + Operation operation = client.Train(WaitUntil.Completed, "", content); + BinaryData responseData = operation.Value; + + JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); } [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_GetProjects_ShortVersion_Async() + public async Task Example_Train_ShortVersion_Async() { Uri endpoint = new Uri(""); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); - await foreach (BinaryData item in client.GetProjectsAsync()) + using RequestContent content = RequestContent.Create(new { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("projectName").ToString()); - Console.WriteLine(result.GetProperty("projectKind").ToString()); - Console.WriteLine(result.GetProperty("storageInputContainerName").ToString()); - Console.WriteLine(result.GetProperty("language").ToString()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastModifiedDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastDeployedDateTime").ToString()); - } + modelLabel = "", + }); + Operation operation = await client.TrainAsync(WaitUntil.Completed, "", content); + BinaryData responseData = operation.Value; + + JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); } [Test] [Ignore("Only validating compilation of examples")] - public void Example_GetProjects_AllParameters() + public void Example_Train_AllParameters() { Uri endpoint = new Uri(""); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); - foreach (BinaryData item in client.GetProjects()) + using RequestContent content = RequestContent.Create(new { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("projectName").ToString()); - Console.WriteLine(result.GetProperty("projectKind").ToString()); - Console.WriteLine(result.GetProperty("storageInputContainerName").ToString()); - Console.WriteLine(result.GetProperty("settings").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("multilingual").ToString()); - Console.WriteLine(result.GetProperty("description").ToString()); - Console.WriteLine(result.GetProperty("language").ToString()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastModifiedDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastDeployedDateTime").ToString()); - } + modelLabel = "", + }); + Operation operation = client.Train(WaitUntil.Completed, "", content); + BinaryData responseData = operation.Value; + + JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("error").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("error").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("error").GetProperty("target").ToString()); + Console.WriteLine(result.GetProperty("error").GetProperty("innererror").GetProperty("code").ToString()); } [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_GetProjects_AllParameters_Async() + public async Task Example_Train_AllParameters_Async() { Uri endpoint = new Uri(""); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); - await foreach (BinaryData item in client.GetProjectsAsync()) + using RequestContent content = RequestContent.Create(new { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("projectName").ToString()); - Console.WriteLine(result.GetProperty("projectKind").ToString()); - Console.WriteLine(result.GetProperty("storageInputContainerName").ToString()); - Console.WriteLine(result.GetProperty("settings").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("multilingual").ToString()); - Console.WriteLine(result.GetProperty("description").ToString()); - Console.WriteLine(result.GetProperty("language").ToString()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastModifiedDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastDeployedDateTime").ToString()); - } + modelLabel = "", + }); + Operation operation = await client.TrainAsync(WaitUntil.Completed, "", content); + BinaryData responseData = operation.Value; + + JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("error").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("error").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("error").GetProperty("target").ToString()); + Console.WriteLine(result.GetProperty("error").GetProperty("innererror").GetProperty("code").ToString()); } [Test] [Ignore("Only validating compilation of examples")] - public void Example_GetDeployments_ShortVersion() + public void Example_DeployProject_ShortVersion() { Uri endpoint = new Uri(""); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); - foreach (BinaryData item in client.GetDeployments("")) - { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("name").ToString()); - } + using RequestContent content = RequestContent.Create(new object()); + Operation operation = client.DeployProject(WaitUntil.Completed, "", "", content); + BinaryData responseData = operation.Value; + + JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); } [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_GetDeployments_ShortVersion_Async() + public async Task Example_DeployProject_ShortVersion_Async() { Uri endpoint = new Uri(""); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); - await foreach (BinaryData item in client.GetDeploymentsAsync("")) - { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("name").ToString()); - } + using RequestContent content = RequestContent.Create(new object()); + Operation operation = await client.DeployProjectAsync(WaitUntil.Completed, "", "", content); + BinaryData responseData = operation.Value; + + JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); } [Test] [Ignore("Only validating compilation of examples")] - public void Example_GetDeployments_AllParameters() + public void Example_DeployProject_AllParameters() { Uri endpoint = new Uri(""); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); - foreach (BinaryData item in client.GetDeployments("")) - { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("name").ToString()); - } + using RequestContent content = RequestContent.Create(new object()); + Operation operation = client.DeployProject(WaitUntil.Completed, "", "", content); + BinaryData responseData = operation.Value; + + JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); } [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_GetDeployments_AllParameters_Async() + public async Task Example_DeployProject_AllParameters_Async() { Uri endpoint = new Uri(""); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); - await foreach (BinaryData item in client.GetDeploymentsAsync("")) - { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("name").ToString()); - } + using RequestContent content = RequestContent.Create(new object()); + Operation operation = await client.DeployProjectAsync(WaitUntil.Completed, "", "", content); + BinaryData responseData = operation.Value; + + JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); } [Test] [Ignore("Only validating compilation of examples")] - public void Example_GetSupportedLanguages_ShortVersion() + public void Example_DeleteDeployment_ShortVersion() { Uri endpoint = new Uri(""); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); - foreach (BinaryData item in client.GetSupportedLanguages()) - { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("languageName").ToString()); - Console.WriteLine(result.GetProperty("languageCode").ToString()); - } + Operation operation = client.DeleteDeployment(WaitUntil.Completed, "", ""); } [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_GetSupportedLanguages_ShortVersion_Async() + public async Task Example_DeleteDeployment_ShortVersion_Async() { Uri endpoint = new Uri(""); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); - await foreach (BinaryData item in client.GetSupportedLanguagesAsync()) - { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("languageName").ToString()); - Console.WriteLine(result.GetProperty("languageCode").ToString()); - } + Operation operation = await client.DeleteDeploymentAsync(WaitUntil.Completed, "", ""); } [Test] [Ignore("Only validating compilation of examples")] - public void Example_GetSupportedLanguages_AllParameters() + public void Example_DeleteDeployment_AllParameters() { Uri endpoint = new Uri(""); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); - foreach (BinaryData item in client.GetSupportedLanguages(maxCount: 1234, skip: 1234, maxpagesize: 1234)) - { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("languageName").ToString()); - Console.WriteLine(result.GetProperty("languageCode").ToString()); - } + Operation operation = client.DeleteDeployment(WaitUntil.Completed, "", ""); } [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_GetSupportedLanguages_AllParameters_Async() + public async Task Example_DeleteDeployment_AllParameters_Async() { Uri endpoint = new Uri(""); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); - await foreach (BinaryData item in client.GetSupportedLanguagesAsync(maxCount: 1234, skip: 1234, maxpagesize: 1234)) - { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("languageName").ToString()); - Console.WriteLine(result.GetProperty("languageCode").ToString()); - } + Operation operation = await client.DeleteDeploymentAsync(WaitUntil.Completed, "", ""); } [Test] [Ignore("Only validating compilation of examples")] - public void Example_GetTrainingConfigVersions_ShortVersion() + public void Example_SwapDeployments_ShortVersion() { Uri endpoint = new Uri(""); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); - foreach (BinaryData item in client.GetTrainingConfigVersions()) + using RequestContent content = RequestContent.Create(new { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("trainingConfigVersionStr").ToString()); - Console.WriteLine(result.GetProperty("modelExpirationDate").ToString()); - } + firstDeploymentName = "", + secondDeploymentName = "", + }); + Operation operation = client.SwapDeployments(WaitUntil.Completed, "", content); + BinaryData responseData = operation.Value; + + JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); } [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_GetTrainingConfigVersions_ShortVersion_Async() + public async Task Example_SwapDeployments_ShortVersion_Async() { Uri endpoint = new Uri(""); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); - await foreach (BinaryData item in client.GetTrainingConfigVersionsAsync()) + using RequestContent content = RequestContent.Create(new { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("trainingConfigVersionStr").ToString()); - Console.WriteLine(result.GetProperty("modelExpirationDate").ToString()); - } + firstDeploymentName = "", + secondDeploymentName = "", + }); + Operation operation = await client.SwapDeploymentsAsync(WaitUntil.Completed, "", content); + BinaryData responseData = operation.Value; + + JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); } [Test] [Ignore("Only validating compilation of examples")] - public void Example_GetTrainingConfigVersions_AllParameters() + public void Example_SwapDeployments_AllParameters() { Uri endpoint = new Uri(""); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); - foreach (BinaryData item in client.GetTrainingConfigVersions(maxCount: 1234, skip: 1234, maxpagesize: 1234)) + using RequestContent content = RequestContent.Create(new { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("trainingConfigVersionStr").ToString()); - Console.WriteLine(result.GetProperty("modelExpirationDate").ToString()); - } + firstDeploymentName = "", + secondDeploymentName = "", + }); + Operation operation = client.SwapDeployments(WaitUntil.Completed, "", content); + BinaryData responseData = operation.Value; + + JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("error").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("error").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("error").GetProperty("target").ToString()); + Console.WriteLine(result.GetProperty("error").GetProperty("innererror").GetProperty("code").ToString()); } [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_GetTrainingConfigVersions_AllParameters_Async() + public async Task Example_SwapDeployments_AllParameters_Async() { Uri endpoint = new Uri(""); AuthoringTypeSpecClient client = new AuthoringTypeSpecClient(endpoint); - await foreach (BinaryData item in client.GetTrainingConfigVersionsAsync(maxCount: 1234, skip: 1234, maxpagesize: 1234)) + using RequestContent content = RequestContent.Create(new { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("trainingConfigVersionStr").ToString()); - Console.WriteLine(result.GetProperty("modelExpirationDate").ToString()); - } + firstDeploymentName = "", + secondDeploymentName = "", + }); + Operation operation = await client.SwapDeploymentsAsync(WaitUntil.Completed, "", content); + BinaryData responseData = operation.Value; + + JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("error").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("error").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("error").GetProperty("target").ToString()); + Console.WriteLine(result.GetProperty("error").GetProperty("innererror").GetProperty("code").ToString()); } } } diff --git a/test/TestProjects/Lro-Basic-TypeSpec/Lro-Basic-TypeSpec.tsp b/test/TestProjects/Lro-Basic-TypeSpec/Lro-Basic-TypeSpec.tsp deleted file mode 100644 index 397a412b7a8..00000000000 --- a/test/TestProjects/Lro-Basic-TypeSpec/Lro-Basic-TypeSpec.tsp +++ /dev/null @@ -1,77 +0,0 @@ -import "@typespec/rest"; -import "@typespec/http"; -import "@typespec/versioning"; -import "@azure-tools/typespec-client-generator-core"; -import "@azure-tools/typespec-azure-core"; - -using Azure.Core.Traits; -using TypeSpec.Http; -using TypeSpec.Rest; -using Azure.ClientGenerator.Core; -using TypeSpec.Versioning; - -@service( - { - title: "Text authoring", - version: "2022-05-15-preview" - } -) -@useDependency(Azure.Core.Versions.v1_0_Preview_1) -@server( - "{lroBasicUrl}", - "Endpoint Service", - { - lroBasicUrl: string, - } -) -namespace LroBasicTypeSpec; - -alias ResourceOperations = Azure.Core.ResourceOperations; - -@resource("projects") -model Project { - @key - @visibility("read") - id: string; - - description?: string; - - name?: string; -} - -model Thing { - name: string; -} - -interface Authoring { - createProjectStatusMonitor is ResourceOperations.GetResourceOperationStatus; - - @convenientAPI(true) - @Azure.Core.pollingOperation(Authoring.createProjectStatusMonitor) - @doc("Creates a project") - createProject is Azure.Core.LongRunningResourceCreateWithServiceProvidedName; - - @convenientAPI(true) - @Azure.Core.pollingOperation(Authoring.createProjectStatusMonitor) - @doc("Updates a project") - op updateProject is Azure.Core.LongRunningResourceCreateOrReplace; - - @convenientAPI(true) - @Azure.Core.pollingOperation(Authoring.createProjectStatusMonitor) - @route("/thing") - op createThing is CustomCore.LongRunningRpcOperation; -} - -namespace CustomCore { - @doc("Long running RPC operation template") - op LongRunningRpcOperation< - TParams extends {}, - TResponse extends {} - > is Azure.Core.RpcOperation< - TParams, - Azure.Core.Foundations.AcceptedResponse - >; -} diff --git a/test/TestProjects/Lro-Basic-TypeSpec/src/Generated/Configuration.json b/test/TestProjects/Lro-Basic-TypeSpec/src/Generated/Configuration.json deleted file mode 100644 index ee490ae289e..00000000000 --- a/test/TestProjects/Lro-Basic-TypeSpec/src/Generated/Configuration.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "output-folder": ".", - "namespace": "LroBasicTypeSpec", - "library-name": "LroBasicTypeSpec", - "shared-source-folders": [ - "../../../../../artifacts/bin/AutoRest.CSharp/Debug/net6.0/Generator.Shared", - "../../../../../artifacts/bin/AutoRest.CSharp/Debug/net6.0/Azure.Core.Shared" - ], - "use-overloads-between-protocol-and-convenience": true -} diff --git a/test/TestProjects/Lro-Basic-TypeSpec/src/Generated/Docs/LroBasicTypeSpecClient.xml b/test/TestProjects/Lro-Basic-TypeSpec/src/Generated/Docs/LroBasicTypeSpecClient.xml deleted file mode 100644 index 97f00d96875..00000000000 --- a/test/TestProjects/Lro-Basic-TypeSpec/src/Generated/Docs/LroBasicTypeSpecClient.xml +++ /dev/null @@ -1,321 +0,0 @@ - - - - - -This sample shows how to call CreateProjectAsync. -"); -LroBasicTypeSpecClient client = new LroBasicTypeSpecClient(endpoint); - -Project resource = new Project(); -Operation operation = await client.CreateProjectAsync(WaitUntil.Completed, resource); -]]> -This sample shows how to call CreateProjectAsync with all parameters. -"); -LroBasicTypeSpecClient client = new LroBasicTypeSpecClient(endpoint); - -Project resource = new Project -{ - Description = "", - Name = "", -}; -Operation operation = await client.CreateProjectAsync(WaitUntil.Completed, resource); -]]> - - - -This sample shows how to call CreateProject. -"); -LroBasicTypeSpecClient client = new LroBasicTypeSpecClient(endpoint); - -Project resource = new Project(); -Operation operation = client.CreateProject(WaitUntil.Completed, resource); -]]> -This sample shows how to call CreateProject with all parameters. -"); -LroBasicTypeSpecClient client = new LroBasicTypeSpecClient(endpoint); - -Project resource = new Project -{ - Description = "", - Name = "", -}; -Operation operation = client.CreateProject(WaitUntil.Completed, resource); -]]> - - - -This sample shows how to call CreateProjectAsync. -"); -LroBasicTypeSpecClient client = new LroBasicTypeSpecClient(endpoint); - -using RequestContent content = RequestContent.Create(new object()); -Operation operation = await client.CreateProjectAsync(WaitUntil.Completed, content); -]]> -This sample shows how to call CreateProjectAsync with all parameters and request content. -"); -LroBasicTypeSpecClient client = new LroBasicTypeSpecClient(endpoint); - -using RequestContent content = RequestContent.Create(new -{ - description = "", - name = "", -}); -Operation operation = await client.CreateProjectAsync(WaitUntil.Completed, content); -]]> - - - -This sample shows how to call CreateProject. -"); -LroBasicTypeSpecClient client = new LroBasicTypeSpecClient(endpoint); - -using RequestContent content = RequestContent.Create(new object()); -Operation operation = client.CreateProject(WaitUntil.Completed, content); -]]> -This sample shows how to call CreateProject with all parameters and request content. -"); -LroBasicTypeSpecClient client = new LroBasicTypeSpecClient(endpoint); - -using RequestContent content = RequestContent.Create(new -{ - description = "", - name = "", -}); -Operation operation = client.CreateProject(WaitUntil.Completed, content); -]]> - - - -This sample shows how to call UpdateProjectAsync. -"); -LroBasicTypeSpecClient client = new LroBasicTypeSpecClient(endpoint); - -Project resource = new Project(); -Operation operation = await client.UpdateProjectAsync(WaitUntil.Completed, "", resource); -Project responseData = operation.Value; -]]> -This sample shows how to call UpdateProjectAsync with all parameters. -"); -LroBasicTypeSpecClient client = new LroBasicTypeSpecClient(endpoint); - -Project resource = new Project -{ - Description = "", - Name = "", -}; -Operation operation = await client.UpdateProjectAsync(WaitUntil.Completed, "", resource); -Project responseData = operation.Value; -]]> - - - -This sample shows how to call UpdateProject. -"); -LroBasicTypeSpecClient client = new LroBasicTypeSpecClient(endpoint); - -Project resource = new Project(); -Operation operation = client.UpdateProject(WaitUntil.Completed, "", resource); -Project responseData = operation.Value; -]]> -This sample shows how to call UpdateProject with all parameters. -"); -LroBasicTypeSpecClient client = new LroBasicTypeSpecClient(endpoint); - -Project resource = new Project -{ - Description = "", - Name = "", -}; -Operation operation = client.UpdateProject(WaitUntil.Completed, "", resource); -Project responseData = operation.Value; -]]> - - - -This sample shows how to call UpdateProjectAsync and parse the result. -"); -LroBasicTypeSpecClient client = new LroBasicTypeSpecClient(endpoint); - -using RequestContent content = RequestContent.Create(new object()); -Operation operation = await client.UpdateProjectAsync(WaitUntil.Completed, "", content); -BinaryData responseData = operation.Value; - -JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; -Console.WriteLine(result.GetProperty("id").ToString()); -]]> -This sample shows how to call UpdateProjectAsync with all parameters and request content and parse the result. -"); -LroBasicTypeSpecClient client = new LroBasicTypeSpecClient(endpoint); - -using RequestContent content = RequestContent.Create(new -{ - description = "", - name = "", -}); -Operation operation = await client.UpdateProjectAsync(WaitUntil.Completed, "", content); -BinaryData responseData = operation.Value; - -JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; -Console.WriteLine(result.GetProperty("id").ToString()); -Console.WriteLine(result.GetProperty("description").ToString()); -Console.WriteLine(result.GetProperty("name").ToString()); -]]> - - - -This sample shows how to call UpdateProject and parse the result. -"); -LroBasicTypeSpecClient client = new LroBasicTypeSpecClient(endpoint); - -using RequestContent content = RequestContent.Create(new object()); -Operation operation = client.UpdateProject(WaitUntil.Completed, "", content); -BinaryData responseData = operation.Value; - -JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; -Console.WriteLine(result.GetProperty("id").ToString()); -]]> -This sample shows how to call UpdateProject with all parameters and request content and parse the result. -"); -LroBasicTypeSpecClient client = new LroBasicTypeSpecClient(endpoint); - -using RequestContent content = RequestContent.Create(new -{ - description = "", - name = "", -}); -Operation operation = client.UpdateProject(WaitUntil.Completed, "", content); -BinaryData responseData = operation.Value; - -JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; -Console.WriteLine(result.GetProperty("id").ToString()); -Console.WriteLine(result.GetProperty("description").ToString()); -Console.WriteLine(result.GetProperty("name").ToString()); -]]> - - - -This sample shows how to call CreateThingAsync. -"); -LroBasicTypeSpecClient client = new LroBasicTypeSpecClient(endpoint); - -Thing thing = new Thing(""); -Operation operation = await client.CreateThingAsync(WaitUntil.Completed, thing); -Thing responseData = operation.Value; -]]> -This sample shows how to call CreateThingAsync with all parameters. -"); -LroBasicTypeSpecClient client = new LroBasicTypeSpecClient(endpoint); - -Thing thing = new Thing(""); -Operation operation = await client.CreateThingAsync(WaitUntil.Completed, thing); -Thing responseData = operation.Value; -]]> - - - -This sample shows how to call CreateThing. -"); -LroBasicTypeSpecClient client = new LroBasicTypeSpecClient(endpoint); - -Thing thing = new Thing(""); -Operation operation = client.CreateThing(WaitUntil.Completed, thing); -Thing responseData = operation.Value; -]]> -This sample shows how to call CreateThing with all parameters. -"); -LroBasicTypeSpecClient client = new LroBasicTypeSpecClient(endpoint); - -Thing thing = new Thing(""); -Operation operation = client.CreateThing(WaitUntil.Completed, thing); -Thing responseData = operation.Value; -]]> - - - -This sample shows how to call CreateThingAsync and parse the result. -"); -LroBasicTypeSpecClient client = new LroBasicTypeSpecClient(endpoint); - -using RequestContent content = RequestContent.Create(new -{ - name = "", -}); -Operation operation = await client.CreateThingAsync(WaitUntil.Completed, content); -BinaryData responseData = operation.Value; - -JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; -Console.WriteLine(result.GetProperty("name").ToString()); -]]> -This sample shows how to call CreateThingAsync with all parameters and request content and parse the result. -"); -LroBasicTypeSpecClient client = new LroBasicTypeSpecClient(endpoint); - -using RequestContent content = RequestContent.Create(new -{ - name = "", -}); -Operation operation = await client.CreateThingAsync(WaitUntil.Completed, content); -BinaryData responseData = operation.Value; - -JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; -Console.WriteLine(result.GetProperty("name").ToString()); -]]> - - - -This sample shows how to call CreateThing and parse the result. -"); -LroBasicTypeSpecClient client = new LroBasicTypeSpecClient(endpoint); - -using RequestContent content = RequestContent.Create(new -{ - name = "", -}); -Operation operation = client.CreateThing(WaitUntil.Completed, content); -BinaryData responseData = operation.Value; - -JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; -Console.WriteLine(result.GetProperty("name").ToString()); -]]> -This sample shows how to call CreateThing with all parameters and request content and parse the result. -"); -LroBasicTypeSpecClient client = new LroBasicTypeSpecClient(endpoint); - -using RequestContent content = RequestContent.Create(new -{ - name = "", -}); -Operation operation = client.CreateThing(WaitUntil.Completed, content); -BinaryData responseData = operation.Value; - -JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; -Console.WriteLine(result.GetProperty("name").ToString()); -]]> - - - \ No newline at end of file diff --git a/test/TestProjects/Lro-Basic-TypeSpec/src/Generated/LroBasicTypeSpecClientBuilderExtensions.cs b/test/TestProjects/Lro-Basic-TypeSpec/src/Generated/LroBasicTypeSpecClientBuilderExtensions.cs deleted file mode 100644 index 5d266b859de..00000000000 --- a/test/TestProjects/Lro-Basic-TypeSpec/src/Generated/LroBasicTypeSpecClientBuilderExtensions.cs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using Azure.Core.Extensions; -using LroBasicTypeSpec; - -namespace Microsoft.Extensions.Azure -{ - /// Extension methods to add to client builder. - public static partial class LroBasicTypeSpecClientBuilderExtensions - { - /// Registers a instance. - /// The builder to register with. - /// The Uri to use. - public static IAzureClientBuilder AddLroBasicTypeSpecClient(this TBuilder builder, Uri endpoint) - where TBuilder : IAzureClientFactoryBuilder - { - return builder.RegisterClientFactory((options) => new LroBasicTypeSpecClient(endpoint, options)); - } - - /// Registers a instance. - /// The builder to register with. - /// The configuration values. - public static IAzureClientBuilder AddLroBasicTypeSpecClient(this TBuilder builder, TConfiguration configuration) - where TBuilder : IAzureClientFactoryBuilderWithConfiguration - { - return builder.RegisterClientFactory(configuration); - } - } -} diff --git a/test/TestProjects/Lro-Basic-TypeSpec/src/Generated/LroBasicTypeSpecModelFactory.cs b/test/TestProjects/Lro-Basic-TypeSpec/src/Generated/LroBasicTypeSpecModelFactory.cs deleted file mode 100644 index 2bc0bc6bb4c..00000000000 --- a/test/TestProjects/Lro-Basic-TypeSpec/src/Generated/LroBasicTypeSpecModelFactory.cs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -namespace LroBasicTypeSpec.Models -{ - /// Model factory for models. - public static partial class LroBasicTypeSpecModelFactory - { - /// Initializes a new instance of Project. - /// - /// - /// - /// A new instance for mocking. - public static Project Project(string id = null, string description = null, string name = null) - { - return new Project(id, description, name); - } - } -} diff --git a/test/TestProjects/Lro-Basic-TypeSpec/src/Generated/Models/Project.Serialization.cs b/test/TestProjects/Lro-Basic-TypeSpec/src/Generated/Models/Project.Serialization.cs deleted file mode 100644 index db1c0f99c09..00000000000 --- a/test/TestProjects/Lro-Basic-TypeSpec/src/Generated/Models/Project.Serialization.cs +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using Azure; -using Azure.Core; - -namespace LroBasicTypeSpec.Models -{ - public partial class Project : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - if (Optional.IsDefined(Description)) - { - writer.WritePropertyName("description"u8); - writer.WriteStringValue(Description); - } - if (Optional.IsDefined(Name)) - { - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name); - } - writer.WriteEndObject(); - } - - internal static Project DeserializeProject(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string id = default; - Optional description = default; - Optional name = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("id"u8)) - { - id = property.Value.GetString(); - continue; - } - if (property.NameEquals("description"u8)) - { - description = property.Value.GetString(); - continue; - } - if (property.NameEquals("name"u8)) - { - name = property.Value.GetString(); - continue; - } - } - return new Project(id, description.Value, name.Value); - } - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static Project FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeProject(document.RootElement); - } - - /// Convert into a Utf8JsonRequestContent. - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this); - return content; - } - } -} diff --git a/test/TestProjects/Lro-Basic-TypeSpec/src/Generated/Models/Project.cs b/test/TestProjects/Lro-Basic-TypeSpec/src/Generated/Models/Project.cs deleted file mode 100644 index 1fa6ada2f91..00000000000 --- a/test/TestProjects/Lro-Basic-TypeSpec/src/Generated/Models/Project.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -namespace LroBasicTypeSpec.Models -{ - /// The Project. - public partial class Project - { - /// Initializes a new instance of Project. - public Project() - { - } - - /// Initializes a new instance of Project. - /// - /// - /// - internal Project(string id, string description, string name) - { - Id = id; - Description = description; - Name = name; - } - - /// Gets the id. - public string Id { get; } - /// Gets or sets the description. - public string Description { get; set; } - /// Gets or sets the name. - public string Name { get; set; } - } -} diff --git a/test/TestProjects/Lro-Basic-TypeSpec/src/Generated/Models/Thing.cs b/test/TestProjects/Lro-Basic-TypeSpec/src/Generated/Models/Thing.cs deleted file mode 100644 index 14e714de38d..00000000000 --- a/test/TestProjects/Lro-Basic-TypeSpec/src/Generated/Models/Thing.cs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using Azure.Core; - -namespace LroBasicTypeSpec.Models -{ - /// The Thing. - public partial class Thing - { - /// Initializes a new instance of Thing. - /// - /// is null. - public Thing(string name) - { - Argument.AssertNotNull(name, nameof(name)); - - Name = name; - } - - /// Gets or sets the name. - public string Name { get; set; } - } -} diff --git a/test/TestProjects/Lro-Basic-TypeSpec/src/Generated/tspCodeModel.json b/test/TestProjects/Lro-Basic-TypeSpec/src/Generated/tspCodeModel.json deleted file mode 100644 index e3d5a1ff686..00000000000 --- a/test/TestProjects/Lro-Basic-TypeSpec/src/Generated/tspCodeModel.json +++ /dev/null @@ -1,636 +0,0 @@ -{ - "$id": "1", - "Name": "LroBasicTypeSpec", - "ApiVersions": [ - "2022-05-15-preview" - ], - "Enums": [], - "Models": [ - { - "$id": "2", - "Name": "Project", - "Namespace": "LroBasicTypeSpec", - "IsNullable": false, - "Usage": "RoundTrip", - "Properties": [ - { - "$id": "3", - "Name": "id", - "SerializedName": "id", - "Description": "", - "Type": { - "$id": "4", - "Name": "string", - "Kind": "String", - "IsNullable": false - }, - "IsRequired": true, - "IsReadOnly": true - }, - { - "$id": "5", - "Name": "description", - "SerializedName": "description", - "Description": "", - "Type": { - "$id": "6", - "Name": "string", - "Kind": "String", - "IsNullable": false - }, - "IsRequired": false, - "IsReadOnly": false - }, - { - "$id": "7", - "Name": "name", - "SerializedName": "name", - "Description": "", - "Type": { - "$id": "8", - "Name": "string", - "Kind": "String", - "IsNullable": false - }, - "IsRequired": false, - "IsReadOnly": false - } - ] - }, - { - "$id": "9", - "Name": "Thing", - "Namespace": "LroBasicTypeSpec", - "IsNullable": false, - "Usage": "RoundTrip", - "Properties": [ - { - "$id": "10", - "Name": "name", - "SerializedName": "name", - "Description": "", - "Type": { - "$id": "11", - "Name": "string", - "Kind": "String", - "IsNullable": false - }, - "IsRequired": true, - "IsReadOnly": false - } - ] - } - ], - "Clients": [ - { - "$id": "12", - "Name": "LroBasicTypeSpecClient", - "Description": "", - "Operations": [ - { - "$id": "13", - "Name": "createProject", - "ResourceName": "Project", - "Description": "Creates a project", - "Parameters": [ - { - "$id": "14", - "Name": "lroBasicUrl", - "NameInRequest": "lroBasicUrl", - "Type": { - "$id": "15", - "Name": "Uri", - "Kind": "Uri", - "IsNullable": false - }, - "Location": "Uri", - "IsApiVersion": false, - "IsResourceParameter": false, - "IsContentType": false, - "IsRequired": true, - "IsEndpoint": true, - "SkipUrlEncoding": false, - "Explode": false, - "Kind": "Client" - }, - { - "$id": "16", - "Name": "apiVersion", - "NameInRequest": "api-version", - "Description": "", - "Type": { - "$id": "17", - "Name": "String", - "Kind": "String", - "IsNullable": false - }, - "Location": "Query", - "IsRequired": true, - "IsApiVersion": true, - "IsContentType": false, - "IsEndpoint": false, - "IsResourceParameter": false, - "SkipUrlEncoding": false, - "Explode": false, - "Kind": "Client", - "DefaultValue": { - "$id": "18", - "Type": { - "$id": "19", - "Name": "String", - "Kind": "String", - "IsNullable": false - }, - "Value": "2022-05-15-preview" - } - }, - { - "$id": "20", - "Name": "resource", - "NameInRequest": "resource", - "Description": "The resource instance.", - "Type": { - "$ref": "2" - }, - "Location": "Body", - "IsRequired": true, - "IsApiVersion": false, - "IsResourceParameter": false, - "IsContentType": false, - "IsEndpoint": false, - "SkipUrlEncoding": false, - "Explode": false, - "Kind": "Method" - }, - { - "$id": "21", - "Name": "contentType", - "NameInRequest": "Content-Type", - "Type": { - "$id": "22", - "Name": "String", - "Kind": "String", - "IsNullable": false - }, - "Location": "Header", - "IsApiVersion": false, - "IsResourceParameter": false, - "IsContentType": true, - "IsRequired": true, - "IsEndpoint": false, - "SkipUrlEncoding": false, - "Explode": false, - "Kind": "Constant", - "DefaultValue": { - "$id": "23", - "Type": { - "$ref": "22" - }, - "Value": "application/json" - } - }, - { - "$id": "24", - "Name": "accept", - "NameInRequest": "Accept", - "Type": { - "$id": "25", - "Name": "String", - "Kind": "String", - "IsNullable": false - }, - "Location": "Header", - "IsApiVersion": false, - "IsResourceParameter": false, - "IsContentType": false, - "IsRequired": true, - "IsEndpoint": false, - "SkipUrlEncoding": false, - "Explode": false, - "Kind": "Constant", - "DefaultValue": { - "$id": "26", - "Type": { - "$ref": "25" - }, - "Value": "application/json" - } - } - ], - "Responses": [ - { - "$id": "27", - "StatusCodes": [ - 202 - ], - "BodyMediaType": "Json", - "Headers": [ - { - "$id": "28", - "Name": "Location", - "NameInResponse": "location", - "Description": "", - "Type": { - "$id": "29", - "Name": "ResourceLocation", - "Kind": "Uri", - "IsNullable": false - } - } - ], - "IsErrorResponse": false - } - ], - "HttpMethod": "POST", - "RequestBodyMediaType": "Json", - "Uri": "{lroBasicUrl}", - "Path": "/projects", - "RequestMediaTypes": [ - "application/json" - ], - "BufferResponse": true, - "LongRunning": { - "$id": "30", - "FinalStateVia": 1, - "FinalResponse": { - "$id": "31", - "StatusCodes": [ - 202 - ], - "BodyMediaType": "Json", - "Headers": [ - { - "$id": "32", - "Name": "Location", - "NameInResponse": "location", - "Description": "", - "Type": { - "$id": "33", - "Name": "ResourceLocation", - "Kind": "Uri", - "IsNullable": false - } - } - ], - "IsErrorResponse": false - } - }, - "GenerateProtocolMethod": true, - "GenerateConvenienceMethod": true - }, - { - "$id": "34", - "Name": "updateProject", - "ResourceName": "Project", - "Description": "Updates a project", - "Parameters": [ - { - "$ref": "14" - }, - { - "$ref": "16" - }, - { - "$id": "35", - "Name": "id", - "NameInRequest": "id", - "Type": { - "$id": "36", - "Name": "string", - "Kind": "String", - "IsNullable": false - }, - "Location": "Path", - "IsRequired": true, - "IsApiVersion": false, - "IsResourceParameter": false, - "IsContentType": false, - "IsEndpoint": false, - "SkipUrlEncoding": false, - "Explode": false, - "Kind": "Method" - }, - { - "$id": "37", - "Name": "resource", - "NameInRequest": "resource", - "Description": "The resource instance.", - "Type": { - "$ref": "2" - }, - "Location": "Body", - "IsRequired": true, - "IsApiVersion": false, - "IsResourceParameter": false, - "IsContentType": false, - "IsEndpoint": false, - "SkipUrlEncoding": false, - "Explode": false, - "Kind": "Method" - }, - { - "$id": "38", - "Name": "contentType", - "NameInRequest": "Content-Type", - "Type": { - "$id": "39", - "Name": "String", - "Kind": "String", - "IsNullable": false - }, - "Location": "Header", - "IsApiVersion": false, - "IsResourceParameter": false, - "IsContentType": true, - "IsRequired": true, - "IsEndpoint": false, - "SkipUrlEncoding": false, - "Explode": false, - "Kind": "Constant", - "DefaultValue": { - "$id": "40", - "Type": { - "$ref": "39" - }, - "Value": "application/json" - } - }, - { - "$id": "41", - "Name": "accept", - "NameInRequest": "Accept", - "Type": { - "$id": "42", - "Name": "String", - "Kind": "String", - "IsNullable": false - }, - "Location": "Header", - "IsApiVersion": false, - "IsResourceParameter": false, - "IsContentType": false, - "IsRequired": true, - "IsEndpoint": false, - "SkipUrlEncoding": false, - "Explode": false, - "Kind": "Constant", - "DefaultValue": { - "$id": "43", - "Type": { - "$ref": "42" - }, - "Value": "application/json" - } - } - ], - "Responses": [ - { - "$id": "44", - "StatusCodes": [ - 201 - ], - "BodyType": { - "$ref": "2" - }, - "BodyMediaType": "Json", - "Headers": [ - { - "$id": "45", - "Name": "Operation-Location", - "NameInResponse": "operationLocation", - "Description": "The location for monitoring the operation state.", - "Type": { - "$id": "46", - "Name": "ResourceLocation", - "Kind": "Uri", - "IsNullable": false - } - } - ], - "IsErrorResponse": false - }, - { - "$id": "47", - "StatusCodes": [ - 200 - ], - "BodyType": { - "$ref": "2" - }, - "BodyMediaType": "Json", - "Headers": [ - { - "$id": "48", - "Name": "Operation-Location", - "NameInResponse": "operationLocation", - "Description": "The location for monitoring the operation state.", - "Type": { - "$id": "49", - "Name": "ResourceLocation", - "Kind": "Uri", - "IsNullable": false - } - } - ], - "IsErrorResponse": false - } - ], - "HttpMethod": "PUT", - "RequestBodyMediaType": "Json", - "Uri": "{lroBasicUrl}", - "Path": "/projects/{id}", - "RequestMediaTypes": [ - "application/json" - ], - "BufferResponse": true, - "LongRunning": { - "$id": "50", - "FinalStateVia": 1, - "FinalResponse": { - "$id": "51", - "StatusCodes": [ - 200 - ], - "BodyType": { - "$ref": "2" - }, - "BodyMediaType": "Json", - "Headers": [ - { - "$id": "52", - "Name": "Operation-Location", - "NameInResponse": "operationLocation", - "Description": "The location for monitoring the operation state.", - "Type": { - "$id": "53", - "Name": "ResourceLocation", - "Kind": "Uri", - "IsNullable": false - } - } - ], - "IsErrorResponse": false - } - }, - "GenerateProtocolMethod": true, - "GenerateConvenienceMethod": true - }, - { - "$id": "54", - "Name": "createThing", - "ResourceName": "Authoring", - "Description": "Long running RPC operation template", - "Parameters": [ - { - "$ref": "14" - }, - { - "$ref": "16" - }, - { - "$id": "55", - "Name": "Thing", - "NameInRequest": "Thing", - "Type": { - "$ref": "9" - }, - "Location": "Body", - "IsRequired": true, - "IsApiVersion": false, - "IsResourceParameter": false, - "IsContentType": false, - "IsEndpoint": false, - "SkipUrlEncoding": false, - "Explode": false, - "Kind": "Method" - }, - { - "$id": "56", - "Name": "contentType", - "NameInRequest": "Content-Type", - "Type": { - "$id": "57", - "Name": "String", - "Kind": "String", - "IsNullable": false - }, - "Location": "Header", - "IsApiVersion": false, - "IsResourceParameter": false, - "IsContentType": true, - "IsRequired": true, - "IsEndpoint": false, - "SkipUrlEncoding": false, - "Explode": false, - "Kind": "Constant", - "DefaultValue": { - "$id": "58", - "Type": { - "$ref": "57" - }, - "Value": "application/json" - } - }, - { - "$id": "59", - "Name": "accept", - "NameInRequest": "Accept", - "Type": { - "$id": "60", - "Name": "String", - "Kind": "String", - "IsNullable": false - }, - "Location": "Header", - "IsApiVersion": false, - "IsResourceParameter": false, - "IsContentType": false, - "IsRequired": true, - "IsEndpoint": false, - "SkipUrlEncoding": false, - "Explode": false, - "Kind": "Constant", - "DefaultValue": { - "$id": "61", - "Type": { - "$ref": "60" - }, - "Value": "application/json" - } - } - ], - "Responses": [ - { - "$id": "62", - "StatusCodes": [ - 202 - ], - "BodyType": { - "$ref": "9" - }, - "BodyMediaType": "Json", - "Headers": [ - { - "$id": "63", - "Name": "Operation-Location", - "NameInResponse": "operationLocation", - "Description": "The location for monitoring the operation state.", - "Type": { - "$id": "64", - "Name": "ResourceLocation", - "Kind": "Uri", - "IsNullable": false - } - } - ], - "IsErrorResponse": false - } - ], - "HttpMethod": "POST", - "RequestBodyMediaType": "Json", - "Uri": "{lroBasicUrl}", - "Path": "/thing", - "RequestMediaTypes": [ - "application/json" - ], - "BufferResponse": true, - "LongRunning": { - "$id": "65", - "FinalStateVia": 1, - "FinalResponse": { - "$id": "66", - "StatusCodes": [ - 202 - ], - "BodyType": { - "$ref": "9" - }, - "BodyMediaType": "Json", - "Headers": [ - { - "$id": "67", - "Name": "Operation-Location", - "NameInResponse": "operationLocation", - "Description": "The location for monitoring the operation state.", - "Type": { - "$id": "68", - "Name": "ResourceLocation", - "Kind": "Uri", - "IsNullable": false - } - } - ], - "IsErrorResponse": false - } - }, - "GenerateProtocolMethod": true, - "GenerateConvenienceMethod": true - } - ], - "Protocol": { - "$id": "69" - }, - "Creatable": true - } - ] -} diff --git a/test/TestProjects/Lro-Basic-TypeSpec/tests/Generated/Samples/Samples_LroBasicTypeSpecClient.cs b/test/TestProjects/Lro-Basic-TypeSpec/tests/Generated/Samples/Samples_LroBasicTypeSpecClient.cs deleted file mode 100644 index 0098a19a05a..00000000000 --- a/test/TestProjects/Lro-Basic-TypeSpec/tests/Generated/Samples/Samples_LroBasicTypeSpecClient.cs +++ /dev/null @@ -1,374 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Text.Json; -using System.Threading.Tasks; -using Azure; -using Azure.Core; -using Azure.Identity; -using LroBasicTypeSpec; -using LroBasicTypeSpec.Models; -using NUnit.Framework; - -namespace LroBasicTypeSpec.Samples -{ - public partial class Samples_LroBasicTypeSpecClient - { - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_CreateProject_ShortVersion() - { - Uri endpoint = new Uri(""); - LroBasicTypeSpecClient client = new LroBasicTypeSpecClient(endpoint); - - using RequestContent content = RequestContent.Create(new object()); - Operation operation = client.CreateProject(WaitUntil.Completed, content); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_CreateProject_ShortVersion_Async() - { - Uri endpoint = new Uri(""); - LroBasicTypeSpecClient client = new LroBasicTypeSpecClient(endpoint); - - using RequestContent content = RequestContent.Create(new object()); - Operation operation = await client.CreateProjectAsync(WaitUntil.Completed, content); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_CreateProject_ShortVersion_Convenience() - { - Uri endpoint = new Uri(""); - LroBasicTypeSpecClient client = new LroBasicTypeSpecClient(endpoint); - - Project resource = new Project(); - Operation operation = client.CreateProject(WaitUntil.Completed, resource); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_CreateProject_ShortVersion_Convenience_Async() - { - Uri endpoint = new Uri(""); - LroBasicTypeSpecClient client = new LroBasicTypeSpecClient(endpoint); - - Project resource = new Project(); - Operation operation = await client.CreateProjectAsync(WaitUntil.Completed, resource); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_CreateProject_AllParameters() - { - Uri endpoint = new Uri(""); - LroBasicTypeSpecClient client = new LroBasicTypeSpecClient(endpoint); - - using RequestContent content = RequestContent.Create(new - { - description = "", - name = "", - }); - Operation operation = client.CreateProject(WaitUntil.Completed, content); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_CreateProject_AllParameters_Async() - { - Uri endpoint = new Uri(""); - LroBasicTypeSpecClient client = new LroBasicTypeSpecClient(endpoint); - - using RequestContent content = RequestContent.Create(new - { - description = "", - name = "", - }); - Operation operation = await client.CreateProjectAsync(WaitUntil.Completed, content); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_CreateProject_AllParameters_Convenience() - { - Uri endpoint = new Uri(""); - LroBasicTypeSpecClient client = new LroBasicTypeSpecClient(endpoint); - - Project resource = new Project - { - Description = "", - Name = "", - }; - Operation operation = client.CreateProject(WaitUntil.Completed, resource); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_CreateProject_AllParameters_Convenience_Async() - { - Uri endpoint = new Uri(""); - LroBasicTypeSpecClient client = new LroBasicTypeSpecClient(endpoint); - - Project resource = new Project - { - Description = "", - Name = "", - }; - Operation operation = await client.CreateProjectAsync(WaitUntil.Completed, resource); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_UpdateProject_ShortVersion() - { - Uri endpoint = new Uri(""); - LroBasicTypeSpecClient client = new LroBasicTypeSpecClient(endpoint); - - using RequestContent content = RequestContent.Create(new object()); - Operation operation = client.UpdateProject(WaitUntil.Completed, "", content); - BinaryData responseData = operation.Value; - - JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("id").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_UpdateProject_ShortVersion_Async() - { - Uri endpoint = new Uri(""); - LroBasicTypeSpecClient client = new LroBasicTypeSpecClient(endpoint); - - using RequestContent content = RequestContent.Create(new object()); - Operation operation = await client.UpdateProjectAsync(WaitUntil.Completed, "", content); - BinaryData responseData = operation.Value; - - JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("id").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_UpdateProject_ShortVersion_Convenience() - { - Uri endpoint = new Uri(""); - LroBasicTypeSpecClient client = new LroBasicTypeSpecClient(endpoint); - - Project resource = new Project(); - Operation operation = client.UpdateProject(WaitUntil.Completed, "", resource); - Project responseData = operation.Value; - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_UpdateProject_ShortVersion_Convenience_Async() - { - Uri endpoint = new Uri(""); - LroBasicTypeSpecClient client = new LroBasicTypeSpecClient(endpoint); - - Project resource = new Project(); - Operation operation = await client.UpdateProjectAsync(WaitUntil.Completed, "", resource); - Project responseData = operation.Value; - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_UpdateProject_AllParameters() - { - Uri endpoint = new Uri(""); - LroBasicTypeSpecClient client = new LroBasicTypeSpecClient(endpoint); - - using RequestContent content = RequestContent.Create(new - { - description = "", - name = "", - }); - Operation operation = client.UpdateProject(WaitUntil.Completed, "", content); - BinaryData responseData = operation.Value; - - JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("description").ToString()); - Console.WriteLine(result.GetProperty("name").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_UpdateProject_AllParameters_Async() - { - Uri endpoint = new Uri(""); - LroBasicTypeSpecClient client = new LroBasicTypeSpecClient(endpoint); - - using RequestContent content = RequestContent.Create(new - { - description = "", - name = "", - }); - Operation operation = await client.UpdateProjectAsync(WaitUntil.Completed, "", content); - BinaryData responseData = operation.Value; - - JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("description").ToString()); - Console.WriteLine(result.GetProperty("name").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_UpdateProject_AllParameters_Convenience() - { - Uri endpoint = new Uri(""); - LroBasicTypeSpecClient client = new LroBasicTypeSpecClient(endpoint); - - Project resource = new Project - { - Description = "", - Name = "", - }; - Operation operation = client.UpdateProject(WaitUntil.Completed, "", resource); - Project responseData = operation.Value; - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_UpdateProject_AllParameters_Convenience_Async() - { - Uri endpoint = new Uri(""); - LroBasicTypeSpecClient client = new LroBasicTypeSpecClient(endpoint); - - Project resource = new Project - { - Description = "", - Name = "", - }; - Operation operation = await client.UpdateProjectAsync(WaitUntil.Completed, "", resource); - Project responseData = operation.Value; - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_CreateThing_ShortVersion() - { - Uri endpoint = new Uri(""); - LroBasicTypeSpecClient client = new LroBasicTypeSpecClient(endpoint); - - using RequestContent content = RequestContent.Create(new - { - name = "", - }); - Operation operation = client.CreateThing(WaitUntil.Completed, content); - BinaryData responseData = operation.Value; - - JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("name").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_CreateThing_ShortVersion_Async() - { - Uri endpoint = new Uri(""); - LroBasicTypeSpecClient client = new LroBasicTypeSpecClient(endpoint); - - using RequestContent content = RequestContent.Create(new - { - name = "", - }); - Operation operation = await client.CreateThingAsync(WaitUntil.Completed, content); - BinaryData responseData = operation.Value; - - JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("name").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_CreateThing_ShortVersion_Convenience() - { - Uri endpoint = new Uri(""); - LroBasicTypeSpecClient client = new LroBasicTypeSpecClient(endpoint); - - Thing thing = new Thing(""); - Operation operation = client.CreateThing(WaitUntil.Completed, thing); - Thing responseData = operation.Value; - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_CreateThing_ShortVersion_Convenience_Async() - { - Uri endpoint = new Uri(""); - LroBasicTypeSpecClient client = new LroBasicTypeSpecClient(endpoint); - - Thing thing = new Thing(""); - Operation operation = await client.CreateThingAsync(WaitUntil.Completed, thing); - Thing responseData = operation.Value; - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_CreateThing_AllParameters() - { - Uri endpoint = new Uri(""); - LroBasicTypeSpecClient client = new LroBasicTypeSpecClient(endpoint); - - using RequestContent content = RequestContent.Create(new - { - name = "", - }); - Operation operation = client.CreateThing(WaitUntil.Completed, content); - BinaryData responseData = operation.Value; - - JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("name").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_CreateThing_AllParameters_Async() - { - Uri endpoint = new Uri(""); - LroBasicTypeSpecClient client = new LroBasicTypeSpecClient(endpoint); - - using RequestContent content = RequestContent.Create(new - { - name = "", - }); - Operation operation = await client.CreateThingAsync(WaitUntil.Completed, content); - BinaryData responseData = operation.Value; - - JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("name").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_CreateThing_AllParameters_Convenience() - { - Uri endpoint = new Uri(""); - LroBasicTypeSpecClient client = new LroBasicTypeSpecClient(endpoint); - - Thing thing = new Thing(""); - Operation operation = client.CreateThing(WaitUntil.Completed, thing); - Thing responseData = operation.Value; - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_CreateThing_AllParameters_Convenience_Async() - { - Uri endpoint = new Uri(""); - LroBasicTypeSpecClient client = new LroBasicTypeSpecClient(endpoint); - - Thing thing = new Thing(""); - Operation operation = await client.CreateThingAsync(WaitUntil.Completed, thing); - Thing responseData = operation.Value; - } - } -}