From 9a609ac1259a96db99b89d9a52b4fae248523a8a Mon Sep 17 00:00:00 2001 From: silasary Date: Sat, 13 Apr 2024 00:57:47 +0000 Subject: [PATCH] Updated swagger --- DecksiteAPI.csproj | 19 + .../DecksiteAPIClientBuilderExtensions.cs | 35 ++ generated/Docs/GetClient.xml | 517 +++++++++++++++++ generated/GetClient.cs | 521 ++++++++++++++++++ generated/GetClientOptions.cs | 37 ++ generated/Internal/Argument.cs | 129 +++++ 6 files changed, 1258 insertions(+) create mode 100644 DecksiteAPI.csproj create mode 100644 generated/DecksiteAPIClientBuilderExtensions.cs create mode 100644 generated/Docs/GetClient.xml create mode 100644 generated/GetClient.cs create mode 100644 generated/GetClientOptions.cs create mode 100644 generated/Internal/Argument.cs diff --git a/DecksiteAPI.csproj b/DecksiteAPI.csproj new file mode 100644 index 0000000..4e0182c --- /dev/null +++ b/DecksiteAPI.csproj @@ -0,0 +1,19 @@ + + + netstandard2.0 + 11.0 + true + annotations + true + $(DefineConstants);EXPERIMENTAL + https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-net/nuget/v3/index.json + + + + + + + + + + diff --git a/generated/DecksiteAPIClientBuilderExtensions.cs b/generated/DecksiteAPIClientBuilderExtensions.cs new file mode 100644 index 0000000..64344c8 --- /dev/null +++ b/generated/DecksiteAPIClientBuilderExtensions.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 DecksiteAPI; + +namespace Microsoft.Extensions.Azure +{ + /// Extension methods to add to client builder. + public static partial class DecksiteAPIClientBuilderExtensions + { + /// Registers a instance. + /// The builder to register with. + /// server parameter. + public static IAzureClientBuilder AddGetClient(this TBuilder builder, Uri endpoint) + where TBuilder : IAzureClientFactoryBuilder + { + return builder.RegisterClientFactory((options) => new GetClient(endpoint, options)); + } + + /// Registers a instance. + /// The builder to register with. + /// The configuration values. + public static IAzureClientBuilder AddGetClient(this TBuilder builder, TConfiguration configuration) + where TBuilder : IAzureClientFactoryBuilderWithConfiguration + { + return builder.RegisterClientFactory(configuration); + } + } +} diff --git a/generated/Docs/GetClient.xml b/generated/Docs/GetClient.xml new file mode 100644 index 0000000..1f5915e --- /dev/null +++ b/generated/Docs/GetClient.xml @@ -0,0 +1,517 @@ + + + + + +This sample shows how to call UpdatedDecksAsync and parse the result. + +This sample shows how to call UpdatedDecksAsync with all parameters and parse the result. +", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("objects")[0].GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("objects")[0].GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("objects")[0].GetProperty("created_date").ToString()); +Console.WriteLine(result.GetProperty("objects")[0].GetProperty("updated_date").ToString()); +Console.WriteLine(result.GetProperty("objects")[0].GetProperty("wins").ToString()); +Console.WriteLine(result.GetProperty("objects")[0].GetProperty("losses").ToString()); +Console.WriteLine(result.GetProperty("objects")[0].GetProperty("draws").ToString()); +Console.WriteLine(result.GetProperty("objects")[0].GetProperty("finish").ToString()); +Console.WriteLine(result.GetProperty("objects")[0].GetProperty("archetype_id").ToString()); +Console.WriteLine(result.GetProperty("objects")[0].GetProperty("archetype_name").ToString()); +Console.WriteLine(result.GetProperty("objects")[0].GetProperty("source_url").ToString()); +Console.WriteLine(result.GetProperty("objects")[0].GetProperty("competition_id").ToString()); +Console.WriteLine(result.GetProperty("objects")[0].GetProperty("competition_name").ToString()); +Console.WriteLine(result.GetProperty("objects")[0].GetProperty("person").ToString()); +Console.WriteLine(result.GetProperty("objects")[0].GetProperty("decklist_hash").ToString()); +Console.WriteLine(result.GetProperty("objects")[0].GetProperty("retired").ToString()); +Console.WriteLine(result.GetProperty("objects")[0].GetProperty("colors")[0].ToString()); +Console.WriteLine(result.GetProperty("objects")[0].GetProperty("omw").ToString()); +Console.WriteLine(result.GetProperty("objects")[0].GetProperty("season_id").ToString()); +Console.WriteLine(result.GetProperty("objects")[0].GetProperty("maindeck")[0].GetProperty("n").ToString()); +Console.WriteLine(result.GetProperty("objects")[0].GetProperty("maindeck")[0].GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("objects")[0].GetProperty("sideboard")[0].GetProperty("n").ToString()); +Console.WriteLine(result.GetProperty("objects")[0].GetProperty("sideboard")[0].GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("objects")[0].GetProperty("url").ToString()); +Console.WriteLine(result.GetProperty("objects")[0].GetProperty("source_name").ToString()); +Console.WriteLine(result.GetProperty("objects")[0].GetProperty("competition_type_name").ToString()); +Console.WriteLine(result.GetProperty("objects")[0].GetProperty("last_archetype_change").ToString()); +Console.WriteLine(result.GetProperty("page").ToString()); +Console.WriteLine(result.GetProperty("total").ToString()); +]]> + + + +This sample shows how to call UpdatedDecks and parse the result. + +This sample shows how to call UpdatedDecks with all parameters and parse the result. +", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("objects")[0].GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("objects")[0].GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("objects")[0].GetProperty("created_date").ToString()); +Console.WriteLine(result.GetProperty("objects")[0].GetProperty("updated_date").ToString()); +Console.WriteLine(result.GetProperty("objects")[0].GetProperty("wins").ToString()); +Console.WriteLine(result.GetProperty("objects")[0].GetProperty("losses").ToString()); +Console.WriteLine(result.GetProperty("objects")[0].GetProperty("draws").ToString()); +Console.WriteLine(result.GetProperty("objects")[0].GetProperty("finish").ToString()); +Console.WriteLine(result.GetProperty("objects")[0].GetProperty("archetype_id").ToString()); +Console.WriteLine(result.GetProperty("objects")[0].GetProperty("archetype_name").ToString()); +Console.WriteLine(result.GetProperty("objects")[0].GetProperty("source_url").ToString()); +Console.WriteLine(result.GetProperty("objects")[0].GetProperty("competition_id").ToString()); +Console.WriteLine(result.GetProperty("objects")[0].GetProperty("competition_name").ToString()); +Console.WriteLine(result.GetProperty("objects")[0].GetProperty("person").ToString()); +Console.WriteLine(result.GetProperty("objects")[0].GetProperty("decklist_hash").ToString()); +Console.WriteLine(result.GetProperty("objects")[0].GetProperty("retired").ToString()); +Console.WriteLine(result.GetProperty("objects")[0].GetProperty("colors")[0].ToString()); +Console.WriteLine(result.GetProperty("objects")[0].GetProperty("omw").ToString()); +Console.WriteLine(result.GetProperty("objects")[0].GetProperty("season_id").ToString()); +Console.WriteLine(result.GetProperty("objects")[0].GetProperty("maindeck")[0].GetProperty("n").ToString()); +Console.WriteLine(result.GetProperty("objects")[0].GetProperty("maindeck")[0].GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("objects")[0].GetProperty("sideboard")[0].GetProperty("n").ToString()); +Console.WriteLine(result.GetProperty("objects")[0].GetProperty("sideboard")[0].GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("objects")[0].GetProperty("url").ToString()); +Console.WriteLine(result.GetProperty("objects")[0].GetProperty("source_name").ToString()); +Console.WriteLine(result.GetProperty("objects")[0].GetProperty("competition_type_name").ToString()); +Console.WriteLine(result.GetProperty("objects")[0].GetProperty("last_archetype_change").ToString()); +Console.WriteLine(result.GetProperty("page").ToString()); +Console.WriteLine(result.GetProperty("total").ToString()); +]]> + + + +This sample shows how to call LoadDeckAsync and parse the result. + +This sample shows how to call LoadDeckAsync with all parameters and parse the result. +", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("created_date").ToString()); +Console.WriteLine(result.GetProperty("updated_date").ToString()); +Console.WriteLine(result.GetProperty("wins").ToString()); +Console.WriteLine(result.GetProperty("losses").ToString()); +Console.WriteLine(result.GetProperty("draws").ToString()); +Console.WriteLine(result.GetProperty("finish").ToString()); +Console.WriteLine(result.GetProperty("archetype_id").ToString()); +Console.WriteLine(result.GetProperty("archetype_name").ToString()); +Console.WriteLine(result.GetProperty("source_url").ToString()); +Console.WriteLine(result.GetProperty("competition_id").ToString()); +Console.WriteLine(result.GetProperty("competition_name").ToString()); +Console.WriteLine(result.GetProperty("person").ToString()); +Console.WriteLine(result.GetProperty("decklist_hash").ToString()); +Console.WriteLine(result.GetProperty("retired").ToString()); +Console.WriteLine(result.GetProperty("colors")[0].ToString()); +Console.WriteLine(result.GetProperty("omw").ToString()); +Console.WriteLine(result.GetProperty("season_id").ToString()); +Console.WriteLine(result.GetProperty("maindeck")[0].GetProperty("n").ToString()); +Console.WriteLine(result.GetProperty("maindeck")[0].GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("sideboard")[0].GetProperty("n").ToString()); +Console.WriteLine(result.GetProperty("sideboard")[0].GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("url").ToString()); +Console.WriteLine(result.GetProperty("source_name").ToString()); +Console.WriteLine(result.GetProperty("competition_type_name").ToString()); +Console.WriteLine(result.GetProperty("last_archetype_change").ToString()); +]]> + + + +This sample shows how to call LoadDeck and parse the result. + +This sample shows how to call LoadDeck with all parameters and parse the result. +", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("created_date").ToString()); +Console.WriteLine(result.GetProperty("updated_date").ToString()); +Console.WriteLine(result.GetProperty("wins").ToString()); +Console.WriteLine(result.GetProperty("losses").ToString()); +Console.WriteLine(result.GetProperty("draws").ToString()); +Console.WriteLine(result.GetProperty("finish").ToString()); +Console.WriteLine(result.GetProperty("archetype_id").ToString()); +Console.WriteLine(result.GetProperty("archetype_name").ToString()); +Console.WriteLine(result.GetProperty("source_url").ToString()); +Console.WriteLine(result.GetProperty("competition_id").ToString()); +Console.WriteLine(result.GetProperty("competition_name").ToString()); +Console.WriteLine(result.GetProperty("person").ToString()); +Console.WriteLine(result.GetProperty("decklist_hash").ToString()); +Console.WriteLine(result.GetProperty("retired").ToString()); +Console.WriteLine(result.GetProperty("colors")[0].ToString()); +Console.WriteLine(result.GetProperty("omw").ToString()); +Console.WriteLine(result.GetProperty("season_id").ToString()); +Console.WriteLine(result.GetProperty("maindeck")[0].GetProperty("n").ToString()); +Console.WriteLine(result.GetProperty("maindeck")[0].GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("sideboard")[0].GetProperty("n").ToString()); +Console.WriteLine(result.GetProperty("sideboard")[0].GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("url").ToString()); +Console.WriteLine(result.GetProperty("source_name").ToString()); +Console.WriteLine(result.GetProperty("competition_type_name").ToString()); +Console.WriteLine(result.GetProperty("last_archetype_change").ToString()); +]]> + + + +This sample shows how to call LeagueAsync and parse the result. + +This sample shows how to call LeagueAsync with all parameters and parse the result. +", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("start_date").ToString()); +Console.WriteLine(result.GetProperty("end_date").ToString()); +Console.WriteLine(result.GetProperty("top_n").ToString()); +Console.WriteLine(result.GetProperty("num_decks").ToString()); +Console.WriteLine(result.GetProperty("num_reviewed").ToString()); +Console.WriteLine(result.GetProperty("sponsor_name").ToString()); +Console.WriteLine(result.GetProperty("series_name").ToString()); +Console.WriteLine(result.GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("season_id").ToString()); +Console.WriteLine(result.GetProperty("decks")[0].GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("decks")[0].GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("decks")[0].GetProperty("created_date").ToString()); +Console.WriteLine(result.GetProperty("decks")[0].GetProperty("updated_date").ToString()); +Console.WriteLine(result.GetProperty("decks")[0].GetProperty("wins").ToString()); +Console.WriteLine(result.GetProperty("decks")[0].GetProperty("losses").ToString()); +Console.WriteLine(result.GetProperty("decks")[0].GetProperty("draws").ToString()); +Console.WriteLine(result.GetProperty("decks")[0].GetProperty("finish").ToString()); +Console.WriteLine(result.GetProperty("decks")[0].GetProperty("archetype_id").ToString()); +Console.WriteLine(result.GetProperty("decks")[0].GetProperty("archetype_name").ToString()); +Console.WriteLine(result.GetProperty("decks")[0].GetProperty("source_url").ToString()); +Console.WriteLine(result.GetProperty("decks")[0].GetProperty("competition_id").ToString()); +Console.WriteLine(result.GetProperty("decks")[0].GetProperty("competition_name").ToString()); +Console.WriteLine(result.GetProperty("decks")[0].GetProperty("person").ToString()); +Console.WriteLine(result.GetProperty("decks")[0].GetProperty("decklist_hash").ToString()); +Console.WriteLine(result.GetProperty("decks")[0].GetProperty("retired").ToString()); +Console.WriteLine(result.GetProperty("decks")[0].GetProperty("colors")[0].ToString()); +Console.WriteLine(result.GetProperty("decks")[0].GetProperty("omw").ToString()); +Console.WriteLine(result.GetProperty("decks")[0].GetProperty("season_id").ToString()); +Console.WriteLine(result.GetProperty("decks")[0].GetProperty("maindeck")[0].GetProperty("n").ToString()); +Console.WriteLine(result.GetProperty("decks")[0].GetProperty("maindeck")[0].GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("decks")[0].GetProperty("sideboard")[0].GetProperty("n").ToString()); +Console.WriteLine(result.GetProperty("decks")[0].GetProperty("sideboard")[0].GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("decks")[0].GetProperty("url").ToString()); +Console.WriteLine(result.GetProperty("decks")[0].GetProperty("source_name").ToString()); +Console.WriteLine(result.GetProperty("decks")[0].GetProperty("competition_type_name").ToString()); +Console.WriteLine(result.GetProperty("decks")[0].GetProperty("last_archetype_change").ToString()); +]]> + + + +This sample shows how to call League and parse the result. + +This sample shows how to call League with all parameters and parse the result. +", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("start_date").ToString()); +Console.WriteLine(result.GetProperty("end_date").ToString()); +Console.WriteLine(result.GetProperty("top_n").ToString()); +Console.WriteLine(result.GetProperty("num_decks").ToString()); +Console.WriteLine(result.GetProperty("num_reviewed").ToString()); +Console.WriteLine(result.GetProperty("sponsor_name").ToString()); +Console.WriteLine(result.GetProperty("series_name").ToString()); +Console.WriteLine(result.GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("season_id").ToString()); +Console.WriteLine(result.GetProperty("decks")[0].GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("decks")[0].GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("decks")[0].GetProperty("created_date").ToString()); +Console.WriteLine(result.GetProperty("decks")[0].GetProperty("updated_date").ToString()); +Console.WriteLine(result.GetProperty("decks")[0].GetProperty("wins").ToString()); +Console.WriteLine(result.GetProperty("decks")[0].GetProperty("losses").ToString()); +Console.WriteLine(result.GetProperty("decks")[0].GetProperty("draws").ToString()); +Console.WriteLine(result.GetProperty("decks")[0].GetProperty("finish").ToString()); +Console.WriteLine(result.GetProperty("decks")[0].GetProperty("archetype_id").ToString()); +Console.WriteLine(result.GetProperty("decks")[0].GetProperty("archetype_name").ToString()); +Console.WriteLine(result.GetProperty("decks")[0].GetProperty("source_url").ToString()); +Console.WriteLine(result.GetProperty("decks")[0].GetProperty("competition_id").ToString()); +Console.WriteLine(result.GetProperty("decks")[0].GetProperty("competition_name").ToString()); +Console.WriteLine(result.GetProperty("decks")[0].GetProperty("person").ToString()); +Console.WriteLine(result.GetProperty("decks")[0].GetProperty("decklist_hash").ToString()); +Console.WriteLine(result.GetProperty("decks")[0].GetProperty("retired").ToString()); +Console.WriteLine(result.GetProperty("decks")[0].GetProperty("colors")[0].ToString()); +Console.WriteLine(result.GetProperty("decks")[0].GetProperty("omw").ToString()); +Console.WriteLine(result.GetProperty("decks")[0].GetProperty("season_id").ToString()); +Console.WriteLine(result.GetProperty("decks")[0].GetProperty("maindeck")[0].GetProperty("n").ToString()); +Console.WriteLine(result.GetProperty("decks")[0].GetProperty("maindeck")[0].GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("decks")[0].GetProperty("sideboard")[0].GetProperty("n").ToString()); +Console.WriteLine(result.GetProperty("decks")[0].GetProperty("sideboard")[0].GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("decks")[0].GetProperty("url").ToString()); +Console.WriteLine(result.GetProperty("decks")[0].GetProperty("source_name").ToString()); +Console.WriteLine(result.GetProperty("decks")[0].GetProperty("competition_type_name").ToString()); +Console.WriteLine(result.GetProperty("decks")[0].GetProperty("last_archetype_change").ToString()); +]]> + + + +This sample shows how to call LoadRandomDeckAsync and parse the result. + +This sample shows how to call LoadRandomDeckAsync with all parameters and parse the result. +", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("created_date").ToString()); +Console.WriteLine(result.GetProperty("updated_date").ToString()); +Console.WriteLine(result.GetProperty("wins").ToString()); +Console.WriteLine(result.GetProperty("losses").ToString()); +Console.WriteLine(result.GetProperty("draws").ToString()); +Console.WriteLine(result.GetProperty("finish").ToString()); +Console.WriteLine(result.GetProperty("archetype_id").ToString()); +Console.WriteLine(result.GetProperty("archetype_name").ToString()); +Console.WriteLine(result.GetProperty("source_url").ToString()); +Console.WriteLine(result.GetProperty("competition_id").ToString()); +Console.WriteLine(result.GetProperty("competition_name").ToString()); +Console.WriteLine(result.GetProperty("person").ToString()); +Console.WriteLine(result.GetProperty("decklist_hash").ToString()); +Console.WriteLine(result.GetProperty("retired").ToString()); +Console.WriteLine(result.GetProperty("colors")[0].ToString()); +Console.WriteLine(result.GetProperty("omw").ToString()); +Console.WriteLine(result.GetProperty("season_id").ToString()); +Console.WriteLine(result.GetProperty("maindeck")[0].GetProperty("n").ToString()); +Console.WriteLine(result.GetProperty("maindeck")[0].GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("sideboard")[0].GetProperty("n").ToString()); +Console.WriteLine(result.GetProperty("sideboard")[0].GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("url").ToString()); +Console.WriteLine(result.GetProperty("source_name").ToString()); +Console.WriteLine(result.GetProperty("competition_type_name").ToString()); +Console.WriteLine(result.GetProperty("last_archetype_change").ToString()); +]]> + + + +This sample shows how to call LoadRandomDeck and parse the result. + +This sample shows how to call LoadRandomDeck with all parameters and parse the result. +", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("created_date").ToString()); +Console.WriteLine(result.GetProperty("updated_date").ToString()); +Console.WriteLine(result.GetProperty("wins").ToString()); +Console.WriteLine(result.GetProperty("losses").ToString()); +Console.WriteLine(result.GetProperty("draws").ToString()); +Console.WriteLine(result.GetProperty("finish").ToString()); +Console.WriteLine(result.GetProperty("archetype_id").ToString()); +Console.WriteLine(result.GetProperty("archetype_name").ToString()); +Console.WriteLine(result.GetProperty("source_url").ToString()); +Console.WriteLine(result.GetProperty("competition_id").ToString()); +Console.WriteLine(result.GetProperty("competition_name").ToString()); +Console.WriteLine(result.GetProperty("person").ToString()); +Console.WriteLine(result.GetProperty("decklist_hash").ToString()); +Console.WriteLine(result.GetProperty("retired").ToString()); +Console.WriteLine(result.GetProperty("colors")[0].ToString()); +Console.WriteLine(result.GetProperty("omw").ToString()); +Console.WriteLine(result.GetProperty("season_id").ToString()); +Console.WriteLine(result.GetProperty("maindeck")[0].GetProperty("n").ToString()); +Console.WriteLine(result.GetProperty("maindeck")[0].GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("sideboard")[0].GetProperty("n").ToString()); +Console.WriteLine(result.GetProperty("sideboard")[0].GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("url").ToString()); +Console.WriteLine(result.GetProperty("source_name").ToString()); +Console.WriteLine(result.GetProperty("competition_type_name").ToString()); +Console.WriteLine(result.GetProperty("last_archetype_change").ToString()); +]]> + + + +This sample shows how to call RotationAsync and parse the result. + +This sample shows how to call RotationAsync with all parameters and parse the result. +", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("last").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("last").GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("last").GetProperty("enter_date").GetProperty("exact").ToString()); +Console.WriteLine(result.GetProperty("last").GetProperty("enter_date").GetProperty("rough").ToString()); +Console.WriteLine(result.GetProperty("last").GetProperty("exit_date").GetProperty("exact").ToString()); +Console.WriteLine(result.GetProperty("last").GetProperty("exit_date").GetProperty("rough").ToString()); +Console.WriteLine(result.GetProperty("last").GetProperty("enter_date_dt").ToString()); +Console.WriteLine(result.GetProperty("next").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("next").GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("next").GetProperty("enter_date").GetProperty("exact").ToString()); +Console.WriteLine(result.GetProperty("next").GetProperty("enter_date").GetProperty("rough").ToString()); +Console.WriteLine(result.GetProperty("next").GetProperty("exit_date").GetProperty("exact").ToString()); +Console.WriteLine(result.GetProperty("next").GetProperty("exit_date").GetProperty("rough").ToString()); +Console.WriteLine(result.GetProperty("next").GetProperty("enter_date_dt").ToString()); +Console.WriteLine(result.GetProperty("diff").ToString()); +Console.WriteLine(result.GetProperty("friendly_diff").ToString()); +]]> + + + +This sample shows how to call Rotation and parse the result. + +This sample shows how to call Rotation with all parameters and parse the result. +", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("last").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("last").GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("last").GetProperty("enter_date").GetProperty("exact").ToString()); +Console.WriteLine(result.GetProperty("last").GetProperty("enter_date").GetProperty("rough").ToString()); +Console.WriteLine(result.GetProperty("last").GetProperty("exit_date").GetProperty("exact").ToString()); +Console.WriteLine(result.GetProperty("last").GetProperty("exit_date").GetProperty("rough").ToString()); +Console.WriteLine(result.GetProperty("last").GetProperty("enter_date_dt").ToString()); +Console.WriteLine(result.GetProperty("next").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("next").GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("next").GetProperty("enter_date").GetProperty("exact").ToString()); +Console.WriteLine(result.GetProperty("next").GetProperty("enter_date").GetProperty("rough").ToString()); +Console.WriteLine(result.GetProperty("next").GetProperty("exit_date").GetProperty("exact").ToString()); +Console.WriteLine(result.GetProperty("next").GetProperty("exit_date").GetProperty("rough").ToString()); +Console.WriteLine(result.GetProperty("next").GetProperty("enter_date_dt").ToString()); +Console.WriteLine(result.GetProperty("diff").ToString()); +Console.WriteLine(result.GetProperty("friendly_diff").ToString()); +]]> + + + +This sample shows how to call SeasonCodesAsync. + +This sample shows how to call SeasonCodesAsync with all request content. + + + + +This sample shows how to call SeasonCodes. + +This sample shows how to call SeasonCodes with all request content. + + + + \ No newline at end of file diff --git a/generated/GetClient.cs b/generated/GetClient.cs new file mode 100644 index 0000000..d6ad3b2 --- /dev/null +++ b/generated/GetClient.cs @@ -0,0 +1,521 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace DecksiteAPI +{ + // Data plane generated client. + /// The Get service client. + public partial class GetClient + { + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + + /// The ClientDiagnostics is used to provide tracing support for the client library. + internal ClientDiagnostics ClientDiagnostics { get; } + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline => _pipeline; + + /// Initializes a new instance of GetClient. + public GetClient() : this(new Uri("/api"), new GetClientOptions()) + { + } + + /// Initializes a new instance of GetClient. + /// server parameter. + /// The options for configuring the client. + /// is null. + public GetClient(Uri endpoint, GetClientOptions options) + { + Argument.AssertNotNull(endpoint, nameof(endpoint)); + options ??= new GetClientOptions(); + + ClientDiagnostics = new ClientDiagnostics(options, true); + _pipeline = HttpPipelineBuilder.Build(options, Array.Empty(), Array.Empty(), new ResponseClassifier()); + _endpoint = endpoint; + } + + /// + /// [Protocol Method] Grab a slice of finished sorted decks last updated after a certain point + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// An optional fields mask. + /// 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 response returned from the service. + /// + public virtual async Task UpdatedDecksAsync(string xFields, RequestContext context) + { + using var scope = ClientDiagnostics.CreateScope("GetClient.UpdatedDecks"); + scope.Start(); + try + { + using HttpMessage message = CreateUpdatedDecksRequest(xFields, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Grab a slice of finished sorted decks last updated after a certain point + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// An optional fields mask. + /// 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 response returned from the service. + /// + public virtual Response UpdatedDecks(string xFields, RequestContext context) + { + using var scope = ClientDiagnostics.CreateScope("GetClient.UpdatedDecks"); + scope.Start(); + try + { + using HttpMessage message = CreateUpdatedDecksRequest(xFields, 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 to use. + /// An optional fields mask. + /// 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 response returned from the service. + /// + public virtual async Task LoadDeckAsync(int deckId, string xFields, RequestContext context) + { + using var scope = ClientDiagnostics.CreateScope("GetClient.LoadDeck"); + scope.Start(); + try + { + using HttpMessage message = CreateLoadDeckRequest(deckId, xFields, 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 to use. + /// An optional fields mask. + /// 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 response returned from the service. + /// + public virtual Response LoadDeck(int deckId, string xFields, RequestContext context) + { + using var scope = ClientDiagnostics.CreateScope("GetClient.LoadDeck"); + scope.Start(); + try + { + using HttpMessage message = CreateLoadDeckRequest(deckId, xFields, 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. + /// + /// + /// + /// + /// An optional fields mask. + /// 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 response returned from the service. + /// + public virtual async Task LeagueAsync(string xFields, RequestContext context) + { + using var scope = ClientDiagnostics.CreateScope("GetClient.League"); + scope.Start(); + try + { + using HttpMessage message = CreateLeagueRequest(xFields, 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. + /// + /// + /// + /// + /// An optional fields mask. + /// 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 response returned from the service. + /// + public virtual Response League(string xFields, RequestContext context) + { + using var scope = ClientDiagnostics.CreateScope("GetClient.League"); + scope.Start(); + try + { + using HttpMessage message = CreateLeagueRequest(xFields, 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. + /// + /// + /// + /// + /// An optional fields mask. + /// 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 response returned from the service. + /// + public virtual async Task LoadRandomDeckAsync(string xFields, RequestContext context) + { + using var scope = ClientDiagnostics.CreateScope("GetClient.LoadRandomDeck"); + scope.Start(); + try + { + using HttpMessage message = CreateLoadRandomDeckRequest(xFields, 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. + /// + /// + /// + /// + /// An optional fields mask. + /// 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 response returned from the service. + /// + public virtual Response LoadRandomDeck(string xFields, RequestContext context) + { + using var scope = ClientDiagnostics.CreateScope("GetClient.LoadRandomDeck"); + scope.Start(); + try + { + using HttpMessage message = CreateLoadRandomDeckRequest(xFields, 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. + /// + /// + /// + /// + /// An optional fields mask. + /// 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 response returned from the service. + /// + public virtual async Task RotationAsync(string xFields, RequestContext context) + { + using var scope = ClientDiagnostics.CreateScope("GetClient.Rotation"); + scope.Start(); + try + { + using HttpMessage message = CreateRotationRequest(xFields, 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. + /// + /// + /// + /// + /// An optional fields mask. + /// 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 response returned from the service. + /// + public virtual Response Rotation(string xFields, RequestContext context) + { + using var scope = ClientDiagnostics.CreateScope("GetClient.Rotation"); + scope.Start(); + try + { + using HttpMessage message = CreateRotationRequest(xFields, 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 request context, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task SeasonCodesAsync(RequestContext context = null) + { + using var scope = ClientDiagnostics.CreateScope("GetClient.SeasonCodes"); + scope.Start(); + try + { + using HttpMessage message = CreateSeasonCodesRequest(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 request context, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response SeasonCodes(RequestContext context = null) + { + using var scope = ClientDiagnostics.CreateScope("GetClient.SeasonCodes"); + scope.Start(); + try + { + using HttpMessage message = CreateSeasonCodesRequest(context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + internal HttpMessage CreateUpdatedDecksRequest(string xFields, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/decks/updated/", false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + if (xFields != null) + { + request.Headers.Add("X-Fields", xFields); + } + return message; + } + + internal HttpMessage CreateLoadDeckRequest(int deckId, string xFields, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/decks/", false); + uri.AppendPath(deckId, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + if (xFields != null) + { + request.Headers.Add("X-Fields", xFields); + } + return message; + } + + internal HttpMessage CreateLeagueRequest(string xFields, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/league", false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + if (xFields != null) + { + request.Headers.Add("X-Fields", xFields); + } + return message; + } + + internal HttpMessage CreateLoadRandomDeckRequest(string xFields, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/randomlegaldeck", false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + if (xFields != null) + { + request.Headers.Add("X-Fields", xFields); + } + return message; + } + + internal HttpMessage CreateRotationRequest(string xFields, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/rotation", false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + if (xFields != null) + { + request.Headers.Add("X-Fields", xFields); + } + return message; + } + + internal HttpMessage CreateSeasonCodesRequest(RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/seasoncodes", false); + request.Uri = uri; + return message; + } + + private static ResponseClassifier _responseClassifier200; + private static ResponseClassifier ResponseClassifier200 => _responseClassifier200 ??= new StatusCodeClassifier(stackalloc ushort[] { 200 }); + } +} diff --git a/generated/GetClientOptions.cs b/generated/GetClientOptions.cs new file mode 100644 index 0000000..0e17dcb --- /dev/null +++ b/generated/GetClientOptions.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 DecksiteAPI +{ + /// Client options for GetClient. + public partial class GetClientOptions : ClientOptions + { + private const ServiceVersion LatestVersion = ServiceVersion.V1_0; + + /// The version of the service to use. + public enum ServiceVersion + { + /// Service version "1.0". + V1_0 = 1, + } + + internal string Version { get; } + + /// Initializes new instance of GetClientOptions. + public GetClientOptions(ServiceVersion version = LatestVersion) + { + Version = version switch + { + ServiceVersion.V1_0 => "1.0", + _ => throw new NotSupportedException() + }; + } + } +} diff --git a/generated/Internal/Argument.cs b/generated/Internal/Argument.cs new file mode 100644 index 0000000..34618ba --- /dev/null +++ b/generated/Internal/Argument.cs @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; + +namespace DecksiteAPI +{ + internal static class Argument + { + public static void AssertNotNull(T value, string name) + { + if (value is null) + { + throw new ArgumentNullException(name); + } + } + + public static void AssertNotNull(T? value, string name) + where T : struct + { + if (!value.HasValue) + { + throw new ArgumentNullException(name); + } + } + + public static void AssertNotNullOrEmpty(IEnumerable value, string name) + { + if (value is null) + { + throw new ArgumentNullException(name); + } + if (value is ICollection collectionOfT && collectionOfT.Count == 0) + { + throw new ArgumentException("Value cannot be an empty collection.", name); + } + if (value is ICollection collection && collection.Count == 0) + { + throw new ArgumentException("Value cannot be an empty collection.", name); + } + using IEnumerator e = value.GetEnumerator(); + if (!e.MoveNext()) + { + throw new ArgumentException("Value cannot be an empty collection.", name); + } + } + + public static void AssertNotNullOrEmpty(string value, string name) + { + if (value is null) + { + throw new ArgumentNullException(name); + } + if (value.Length == 0) + { + throw new ArgumentException("Value cannot be an empty string.", name); + } + } + + public static void AssertNotNullOrWhiteSpace(string value, string name) + { + if (value is null) + { + throw new ArgumentNullException(name); + } + if (string.IsNullOrWhiteSpace(value)) + { + throw new ArgumentException("Value cannot be empty or contain only white-space characters.", name); + } + } + + public static void AssertNotDefault(ref T value, string name) + where T : struct, IEquatable + { + if (value.Equals(default)) + { + throw new ArgumentException("Value cannot be empty.", name); + } + } + + public static void AssertInRange(T value, T minimum, T maximum, string name) + where T : notnull, IComparable + { + if (minimum.CompareTo(value) > 0) + { + throw new ArgumentOutOfRangeException(name, "Value is less than the minimum allowed."); + } + if (maximum.CompareTo(value) < 0) + { + throw new ArgumentOutOfRangeException(name, "Value is greater than the maximum allowed."); + } + } + + public static void AssertEnumDefined(Type enumType, object value, string name) + { + if (!Enum.IsDefined(enumType, value)) + { + throw new ArgumentException($"Value not defined for {enumType.FullName}.", name); + } + } + + public static T CheckNotNull(T value, string name) + where T : class + { + AssertNotNull(value, name); + return value; + } + + public static string CheckNotNullOrEmpty(string value, string name) + { + AssertNotNullOrEmpty(value, name); + return value; + } + + public static void AssertNull(T value, string name, string message = null) + { + if (value != null) + { + throw new ArgumentException(message ?? "Value must be null.", name); + } + } + } +}