From 983db4897db29714150656ccaa9ff9e758a91af7 Mon Sep 17 00:00:00 2001 From: silasary Date: Thu, 13 Jan 2022 01:10:41 +0000 Subject: [PATCH] Updated swagger --- DecksiteAPI.csproj | 23 + generated/DecksiteAPIModelFactory.cs | 127 ++++++ generated/GetRestClient.cs | 398 ++++++++++++++++++ generated/Models/Competition.Serialization.cs | 142 +++++++ generated/Models/Competition.cs | 77 ++++ generated/Models/Deck.Serialization.cs | 265 ++++++++++++ generated/Models/Deck.cs | 131 ++++++ .../Models/DecklistEntry.Serialization.cs | 40 ++ generated/Models/DecklistEntry.cs | 32 ++ .../Models/MultipleDecks.Serialization.cs | 62 +++ generated/Models/MultipleDecks.cs | 40 ++ generated/Models/ReleaseDate.Serialization.cs | 41 ++ generated/Models/ReleaseDate.cs | 34 ++ .../Models/RotationDetails.Serialization.cs | 62 +++ generated/Models/RotationDetails.cs | 40 ++ generated/Models/Set.Serialization.cs | 63 +++ generated/Models/Set.cs | 44 ++ 17 files changed, 1621 insertions(+) create mode 100644 DecksiteAPI.csproj create mode 100644 generated/DecksiteAPIModelFactory.cs create mode 100644 generated/GetRestClient.cs create mode 100644 generated/Models/Competition.Serialization.cs create mode 100644 generated/Models/Competition.cs create mode 100644 generated/Models/Deck.Serialization.cs create mode 100644 generated/Models/Deck.cs create mode 100644 generated/Models/DecklistEntry.Serialization.cs create mode 100644 generated/Models/DecklistEntry.cs create mode 100644 generated/Models/MultipleDecks.Serialization.cs create mode 100644 generated/Models/MultipleDecks.cs create mode 100644 generated/Models/ReleaseDate.Serialization.cs create mode 100644 generated/Models/ReleaseDate.cs create mode 100644 generated/Models/RotationDetails.Serialization.cs create mode 100644 generated/Models/RotationDetails.cs create mode 100644 generated/Models/Set.Serialization.cs create mode 100644 generated/Models/Set.cs diff --git a/DecksiteAPI.csproj b/DecksiteAPI.csproj new file mode 100644 index 0000000..7b4d588 --- /dev/null +++ b/DecksiteAPI.csproj @@ -0,0 +1,23 @@ + + + + netstandard2.0 + true + annotations + + + + 8.0 + true + https://azuresdkartifacts.blob.core.windows.net/azure-sdk-tools/index.json + + + + + + + + + + + diff --git a/generated/DecksiteAPIModelFactory.cs b/generated/DecksiteAPIModelFactory.cs new file mode 100644 index 0000000..8a9e74f --- /dev/null +++ b/generated/DecksiteAPIModelFactory.cs @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace DecksiteAPI.Models +{ + /// Model factory for read-only models. + public static partial class DecksiteAPIModelFactory + { + /// Initializes a new instance of MultipleDecks. + /// + /// + /// + /// A new instance for mocking. + public static MultipleDecks MultipleDecks(IEnumerable objects = null, int? page = null, int? total = null) + { + objects ??= new List(); + + return new MultipleDecks(objects?.ToList(), page, total); + } + + /// Initializes a new instance of Deck. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// A new instance for mocking. + public static Deck Deck(int? id = null, string name = null, DateTimeOffset? createdDate = null, DateTimeOffset? updatedDate = null, int? wins = null, int? losses = null, int? draws = null, int? finish = null, int? archetypeId = null, string archetypeName = null, string sourceUrl = null, int? competitionId = null, string competitionName = null, string person = null, string decklistHash = null, bool? retired = null, IEnumerable colors = null, string omw = null, int? seasonId = null, IEnumerable maindeck = null, IEnumerable sideboard = null, string url = null, string sourceName = null, string competitionTypeName = null, int? lastArchetypeChange = null) + { + colors ??= new List(); + maindeck ??= new List(); + sideboard ??= new List(); + + return new Deck(id, name, createdDate, updatedDate, wins, losses, draws, finish, archetypeId, archetypeName, sourceUrl, competitionId, competitionName, person, decklistHash, retired, colors?.ToList(), omw, seasonId, maindeck?.ToList(), sideboard?.ToList(), url, sourceName, competitionTypeName, lastArchetypeChange); + } + + /// Initializes a new instance of DecklistEntry. + /// + /// + /// A new instance for mocking. + public static DecklistEntry DecklistEntry(int? n = null, string name = null) + { + return new DecklistEntry(n, name); + } + + /// Initializes a new instance of Competition. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// A new instance for mocking. + public static Competition Competition(int? id = null, string name = null, DateTimeOffset? startDate = null, DateTimeOffset? endDate = null, int? topN = null, int? numDecks = null, int? numReviewed = null, string sponsorName = null, string seriesName = null, string type = null, int? seasonId = null, IEnumerable decks = null) + { + decks ??= new List(); + + return new Competition(id, name, startDate, endDate, topN, numDecks, numReviewed, sponsorName, seriesName, type, seasonId, decks?.ToList()); + } + + /// Initializes a new instance of RotationDetails. + /// + /// + /// + /// + /// A new instance for mocking. + public static RotationDetails RotationDetails(Set last = null, Set next = null, float? diff = null, string friendlyDiff = null) + { + return new RotationDetails(last, next, diff, friendlyDiff); + } + + /// Initializes a new instance of Set. + /// + /// + /// + /// + /// + /// A new instance for mocking. + public static Set Set(string code = null, string name = null, ReleaseDate enterDate = null, ReleaseDate exitDate = null, string enterDateDt = null) + { + return new Set(code, name, enterDate, exitDate, enterDateDt); + } + + /// Initializes a new instance of ReleaseDate. + /// + /// + /// A new instance for mocking. + public static ReleaseDate ReleaseDate(DateTimeOffset? exact = null, string rough = null) + { + return new ReleaseDate(exact, rough); + } + } +} diff --git a/generated/GetRestClient.cs b/generated/GetRestClient.cs new file mode 100644 index 0000000..05c8415 --- /dev/null +++ b/generated/GetRestClient.cs @@ -0,0 +1,398 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using DecksiteAPI.Models; + +namespace DecksiteAPI +{ + internal partial class GetRestClient + { + private Uri endpoint; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + + /// Initializes a new instance of GetRestClient. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// server parameter. + public GetRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint = null) + { + this.endpoint = endpoint ?? new Uri("/api"); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + } + + internal HttpMessage CreateUpdatedDecksRequest(string xFields) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/decks/updated/", false); + request.Uri = uri; + if (xFields != null) + { + request.Headers.Add("X-Fields", xFields); + } + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// + /// Input: + /// { + /// 'sortBy': <str>, + /// 'sortOrder': <'ASC'|'DESC'>, + /// 'page': <int>, + /// 'pageSize': <int>, + /// 'since': <int>, + /// 'seasonId': <int|'all'> + /// } + /// Output: + /// { + /// 'page': <int>, + /// 'objects': [<deck>], + /// 'total: <int> + /// } + /// + /// An optional fields mask. + /// The cancellation token to use. + public async Task> UpdatedDecksAsync(string xFields = null, CancellationToken cancellationToken = default) + { + using var message = CreateUpdatedDecksRequest(xFields); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + MultipleDecks value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = MultipleDecks.DeserializeMultipleDecks(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// + /// Input: + /// { + /// 'sortBy': <str>, + /// 'sortOrder': <'ASC'|'DESC'>, + /// 'page': <int>, + /// 'pageSize': <int>, + /// 'since': <int>, + /// 'seasonId': <int|'all'> + /// } + /// Output: + /// { + /// 'page': <int>, + /// 'objects': [<deck>], + /// 'total: <int> + /// } + /// + /// An optional fields mask. + /// The cancellation token to use. + public Response UpdatedDecks(string xFields = null, CancellationToken cancellationToken = default) + { + using var message = CreateUpdatedDecksRequest(xFields); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + MultipleDecks value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = MultipleDecks.DeserializeMultipleDecks(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateLoadDeckRequest(int deckId, string xFields) + { + var message = _pipeline.CreateMessage(); + 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; + if (xFields != null) + { + request.Headers.Add("X-Fields", xFields); + } + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// The Integer to use. + /// An optional fields mask. + /// The cancellation token to use. + public async Task> LoadDeckAsync(int deckId, string xFields = null, CancellationToken cancellationToken = default) + { + using var message = CreateLoadDeckRequest(deckId, xFields); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + Deck value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = Deck.DeserializeDeck(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// The Integer to use. + /// An optional fields mask. + /// The cancellation token to use. + public Response LoadDeck(int deckId, string xFields = null, CancellationToken cancellationToken = default) + { + using var message = CreateLoadDeckRequest(deckId, xFields); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + Deck value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = Deck.DeserializeDeck(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateLeagueRequest(string xFields) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/league", false); + request.Uri = uri; + if (xFields != null) + { + request.Headers.Add("X-Fields", xFields); + } + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// An optional fields mask. + /// The cancellation token to use. + public async Task> LeagueAsync(string xFields = null, CancellationToken cancellationToken = default) + { + using var message = CreateLeagueRequest(xFields); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + Competition value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = Competition.DeserializeCompetition(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// An optional fields mask. + /// The cancellation token to use. + public Response League(string xFields = null, CancellationToken cancellationToken = default) + { + using var message = CreateLeagueRequest(xFields); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + Competition value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = Competition.DeserializeCompetition(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateLoadRandomDeckRequest(string xFields) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/randomlegaldeck", false); + request.Uri = uri; + if (xFields != null) + { + request.Headers.Add("X-Fields", xFields); + } + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// An optional fields mask. + /// The cancellation token to use. + public async Task> LoadRandomDeckAsync(string xFields = null, CancellationToken cancellationToken = default) + { + using var message = CreateLoadRandomDeckRequest(xFields); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + Deck value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = Deck.DeserializeDeck(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// An optional fields mask. + /// The cancellation token to use. + public Response LoadRandomDeck(string xFields = null, CancellationToken cancellationToken = default) + { + using var message = CreateLoadRandomDeckRequest(xFields); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + Deck value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = Deck.DeserializeDeck(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateRotationRequest(string xFields) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/rotation", false); + request.Uri = uri; + if (xFields != null) + { + request.Headers.Add("X-Fields", xFields); + } + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// An optional fields mask. + /// The cancellation token to use. + public async Task> RotationAsync(string xFields = null, CancellationToken cancellationToken = default) + { + using var message = CreateRotationRequest(xFields); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + RotationDetails value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = RotationDetails.DeserializeRotationDetails(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// An optional fields mask. + /// The cancellation token to use. + public Response Rotation(string xFields = null, CancellationToken cancellationToken = default) + { + using var message = CreateRotationRequest(xFields); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + RotationDetails value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = RotationDetails.DeserializeRotationDetails(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateSeasonCodesRequest() + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/seasoncodes", false); + request.Uri = uri; + return message; + } + + /// The cancellation token to use. + public async Task SeasonCodesAsync(CancellationToken cancellationToken = default) + { + using var message = CreateSeasonCodesRequest(); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// The cancellation token to use. + public Response SeasonCodes(CancellationToken cancellationToken = default) + { + using var message = CreateSeasonCodesRequest(); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/generated/Models/Competition.Serialization.cs b/generated/Models/Competition.Serialization.cs new file mode 100644 index 0000000..7a566e3 --- /dev/null +++ b/generated/Models/Competition.Serialization.cs @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace DecksiteAPI.Models +{ + public partial class Competition + { + internal static Competition DeserializeCompetition(JsonElement element) + { + Optional id = default; + Optional name = default; + Optional startDate = default; + Optional endDate = default; + Optional topN = default; + Optional numDecks = default; + Optional numReviewed = default; + Optional sponsorName = default; + Optional seriesName = default; + Optional type = default; + Optional seasonId = default; + Optional> decks = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + id = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("start_date")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + startDate = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("end_date")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + endDate = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("top_n")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + topN = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("num_decks")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + numDecks = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("num_reviewed")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + numReviewed = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("sponsor_name")) + { + sponsorName = property.Value.GetString(); + continue; + } + if (property.NameEquals("series_name")) + { + seriesName = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("season_id")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + seasonId = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("decks")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(Deck.DeserializeDeck(item)); + } + decks = array; + continue; + } + } + return new Competition(Optional.ToNullable(id), name.Value, Optional.ToNullable(startDate), Optional.ToNullable(endDate), Optional.ToNullable(topN), Optional.ToNullable(numDecks), Optional.ToNullable(numReviewed), sponsorName.Value, seriesName.Value, type.Value, Optional.ToNullable(seasonId), Optional.ToList(decks)); + } + } +} diff --git a/generated/Models/Competition.cs b/generated/Models/Competition.cs new file mode 100644 index 0000000..6ce125e --- /dev/null +++ b/generated/Models/Competition.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace DecksiteAPI.Models +{ + /// The Competition. + public partial class Competition + { + /// Initializes a new instance of Competition. + internal Competition() + { + Decks = new ChangeTrackingList(); + } + + /// Initializes a new instance of Competition. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + internal Competition(int? id, string name, DateTimeOffset? startDate, DateTimeOffset? endDate, int? topN, int? numDecks, int? numReviewed, string sponsorName, string seriesName, string type, int? seasonId, IReadOnlyList decks) + { + Id = id; + Name = name; + StartDate = startDate; + EndDate = endDate; + TopN = topN; + NumDecks = numDecks; + NumReviewed = numReviewed; + SponsorName = sponsorName; + SeriesName = seriesName; + Type = type; + SeasonId = seasonId; + Decks = decks; + } + + /// Gets the id. + public int? Id { get; } + /// Gets the name. + public string Name { get; } + /// Gets the start date. + public DateTimeOffset? StartDate { get; } + /// Gets the end date. + public DateTimeOffset? EndDate { get; } + /// Gets the top n. + public int? TopN { get; } + /// Gets the num decks. + public int? NumDecks { get; } + /// Gets the num reviewed. + public int? NumReviewed { get; } + /// Gets the sponsor name. + public string SponsorName { get; } + /// Gets the series name. + public string SeriesName { get; } + /// Gets the type. + public string Type { get; } + /// Gets the season id. + public int? SeasonId { get; } + /// Gets the decks. + public IReadOnlyList Decks { get; } + } +} diff --git a/generated/Models/Deck.Serialization.cs b/generated/Models/Deck.Serialization.cs new file mode 100644 index 0000000..3fcb9be --- /dev/null +++ b/generated/Models/Deck.Serialization.cs @@ -0,0 +1,265 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace DecksiteAPI.Models +{ + public partial class Deck + { + internal static Deck DeserializeDeck(JsonElement element) + { + Optional id = default; + Optional name = default; + Optional createdDate = default; + Optional updatedDate = default; + Optional wins = default; + Optional losses = default; + Optional draws = default; + Optional finish = default; + Optional archetypeId = default; + Optional archetypeName = default; + Optional sourceUrl = default; + Optional competitionId = default; + Optional competitionName = default; + Optional person = default; + Optional decklistHash = default; + Optional retired = default; + Optional> colors = default; + Optional omw = default; + Optional seasonId = default; + Optional> maindeck = default; + Optional> sideboard = default; + Optional url = default; + Optional sourceName = default; + Optional competitionTypeName = default; + Optional lastArchetypeChange = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + id = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("created_date")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + createdDate = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("updated_date")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + updatedDate = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("wins")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + wins = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("losses")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + losses = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("draws")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + draws = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("finish")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + finish = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("archetype_id")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + archetypeId = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("archetype_name")) + { + archetypeName = property.Value.GetString(); + continue; + } + if (property.NameEquals("source_url")) + { + sourceUrl = property.Value.GetString(); + continue; + } + if (property.NameEquals("competition_id")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + competitionId = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("competition_name")) + { + competitionName = property.Value.GetString(); + continue; + } + if (property.NameEquals("person")) + { + person = property.Value.GetString(); + continue; + } + if (property.NameEquals("decklist_hash")) + { + decklistHash = property.Value.GetString(); + continue; + } + if (property.NameEquals("retired")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + retired = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("colors")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + colors = array; + continue; + } + if (property.NameEquals("omw")) + { + omw = property.Value.GetString(); + continue; + } + if (property.NameEquals("season_id")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + seasonId = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("maindeck")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DecklistEntry.DeserializeDecklistEntry(item)); + } + maindeck = array; + continue; + } + if (property.NameEquals("sideboard")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DecklistEntry.DeserializeDecklistEntry(item)); + } + sideboard = array; + continue; + } + if (property.NameEquals("url")) + { + url = property.Value.GetString(); + continue; + } + if (property.NameEquals("source_name")) + { + sourceName = property.Value.GetString(); + continue; + } + if (property.NameEquals("competition_type_name")) + { + competitionTypeName = property.Value.GetString(); + continue; + } + if (property.NameEquals("last_archetype_change")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + lastArchetypeChange = property.Value.GetInt32(); + continue; + } + } + return new Deck(Optional.ToNullable(id), name.Value, Optional.ToNullable(createdDate), Optional.ToNullable(updatedDate), Optional.ToNullable(wins), Optional.ToNullable(losses), Optional.ToNullable(draws), Optional.ToNullable(finish), Optional.ToNullable(archetypeId), archetypeName.Value, sourceUrl.Value, Optional.ToNullable(competitionId), competitionName.Value, person.Value, decklistHash.Value, Optional.ToNullable(retired), Optional.ToList(colors), omw.Value, Optional.ToNullable(seasonId), Optional.ToList(maindeck), Optional.ToList(sideboard), url.Value, sourceName.Value, competitionTypeName.Value, Optional.ToNullable(lastArchetypeChange)); + } + } +} diff --git a/generated/Models/Deck.cs b/generated/Models/Deck.cs new file mode 100644 index 0000000..65ec1d7 --- /dev/null +++ b/generated/Models/Deck.cs @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace DecksiteAPI.Models +{ + /// The Deck. + public partial class Deck + { + /// Initializes a new instance of Deck. + internal Deck() + { + Colors = new ChangeTrackingList(); + Maindeck = new ChangeTrackingList(); + Sideboard = new ChangeTrackingList(); + } + + /// Initializes a new instance of Deck. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + internal Deck(int? id, string name, DateTimeOffset? createdDate, DateTimeOffset? updatedDate, int? wins, int? losses, int? draws, int? finish, int? archetypeId, string archetypeName, string sourceUrl, int? competitionId, string competitionName, string person, string decklistHash, bool? retired, IReadOnlyList colors, string omw, int? seasonId, IReadOnlyList maindeck, IReadOnlyList sideboard, string url, string sourceName, string competitionTypeName, int? lastArchetypeChange) + { + Id = id; + Name = name; + CreatedDate = createdDate; + UpdatedDate = updatedDate; + Wins = wins; + Losses = losses; + Draws = draws; + Finish = finish; + ArchetypeId = archetypeId; + ArchetypeName = archetypeName; + SourceUrl = sourceUrl; + CompetitionId = competitionId; + CompetitionName = competitionName; + Person = person; + DecklistHash = decklistHash; + Retired = retired; + Colors = colors; + Omw = omw; + SeasonId = seasonId; + Maindeck = maindeck; + Sideboard = sideboard; + Url = url; + SourceName = sourceName; + CompetitionTypeName = competitionTypeName; + LastArchetypeChange = lastArchetypeChange; + } + + /// Gets the id. + public int? Id { get; } + /// Gets the name. + public string Name { get; } + /// Gets the created date. + public DateTimeOffset? CreatedDate { get; } + /// Gets the updated date. + public DateTimeOffset? UpdatedDate { get; } + /// Gets the wins. + public int? Wins { get; } + /// Gets the losses. + public int? Losses { get; } + /// Gets the draws. + public int? Draws { get; } + /// Gets the finish. + public int? Finish { get; } + /// Gets the archetype id. + public int? ArchetypeId { get; } + /// Gets the archetype name. + public string ArchetypeName { get; } + /// Gets the source url. + public string SourceUrl { get; } + /// Gets the competition id. + public int? CompetitionId { get; } + /// Gets the competition name. + public string CompetitionName { get; } + /// Gets the person. + public string Person { get; } + /// Gets the decklist hash. + public string DecklistHash { get; } + /// Gets the retired. + public bool? Retired { get; } + /// Gets the colors. + public IReadOnlyList Colors { get; } + /// Gets the omw. + public string Omw { get; } + /// Gets the season id. + public int? SeasonId { get; } + /// Gets the maindeck. + public IReadOnlyList Maindeck { get; } + /// Gets the sideboard. + public IReadOnlyList Sideboard { get; } + /// Gets the url. + public string Url { get; } + /// Gets the source name. + public string SourceName { get; } + /// Gets the competition type name. + public string CompetitionTypeName { get; } + /// Gets the last archetype change. + public int? LastArchetypeChange { get; } + } +} diff --git a/generated/Models/DecklistEntry.Serialization.cs b/generated/Models/DecklistEntry.Serialization.cs new file mode 100644 index 0000000..1f853fc --- /dev/null +++ b/generated/Models/DecklistEntry.Serialization.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace DecksiteAPI.Models +{ + public partial class DecklistEntry + { + internal static DecklistEntry DeserializeDecklistEntry(JsonElement element) + { + Optional n = default; + Optional name = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("n")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + n = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + } + return new DecklistEntry(Optional.ToNullable(n), name.Value); + } + } +} diff --git a/generated/Models/DecklistEntry.cs b/generated/Models/DecklistEntry.cs new file mode 100644 index 0000000..91b018f --- /dev/null +++ b/generated/Models/DecklistEntry.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace DecksiteAPI.Models +{ + /// The DecklistEntry. + public partial class DecklistEntry + { + /// Initializes a new instance of DecklistEntry. + internal DecklistEntry() + { + } + + /// Initializes a new instance of DecklistEntry. + /// + /// + internal DecklistEntry(int? n, string name) + { + N = n; + Name = name; + } + + /// Gets the n. + public int? N { get; } + /// Gets the name. + public string Name { get; } + } +} diff --git a/generated/Models/MultipleDecks.Serialization.cs b/generated/Models/MultipleDecks.Serialization.cs new file mode 100644 index 0000000..795342d --- /dev/null +++ b/generated/Models/MultipleDecks.Serialization.cs @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace DecksiteAPI.Models +{ + public partial class MultipleDecks + { + internal static MultipleDecks DeserializeMultipleDecks(JsonElement element) + { + Optional> objects = default; + Optional page = default; + Optional total = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("objects")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(Deck.DeserializeDeck(item)); + } + objects = array; + continue; + } + if (property.NameEquals("page")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + page = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("total")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + total = property.Value.GetInt32(); + continue; + } + } + return new MultipleDecks(Optional.ToList(objects), Optional.ToNullable(page), Optional.ToNullable(total)); + } + } +} diff --git a/generated/Models/MultipleDecks.cs b/generated/Models/MultipleDecks.cs new file mode 100644 index 0000000..c0d5bea --- /dev/null +++ b/generated/Models/MultipleDecks.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace DecksiteAPI.Models +{ + /// The MultipleDecks. + public partial class MultipleDecks + { + /// Initializes a new instance of MultipleDecks. + internal MultipleDecks() + { + Objects = new ChangeTrackingList(); + } + + /// Initializes a new instance of MultipleDecks. + /// + /// + /// + internal MultipleDecks(IReadOnlyList objects, int? page, int? total) + { + Objects = objects; + Page = page; + Total = total; + } + + /// Gets the objects. + public IReadOnlyList Objects { get; } + /// Gets the page. + public int? Page { get; } + /// Gets the total. + public int? Total { get; } + } +} diff --git a/generated/Models/ReleaseDate.Serialization.cs b/generated/Models/ReleaseDate.Serialization.cs new file mode 100644 index 0000000..173fdaf --- /dev/null +++ b/generated/Models/ReleaseDate.Serialization.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using Azure.Core; + +namespace DecksiteAPI.Models +{ + public partial class ReleaseDate + { + internal static ReleaseDate DeserializeReleaseDate(JsonElement element) + { + Optional exact = default; + Optional rough = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("exact")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + exact = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("rough")) + { + rough = property.Value.GetString(); + continue; + } + } + return new ReleaseDate(Optional.ToNullable(exact), rough.Value); + } + } +} diff --git a/generated/Models/ReleaseDate.cs b/generated/Models/ReleaseDate.cs new file mode 100644 index 0000000..04ae99a --- /dev/null +++ b/generated/Models/ReleaseDate.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace DecksiteAPI.Models +{ + /// The ReleaseDate. + public partial class ReleaseDate + { + /// Initializes a new instance of ReleaseDate. + internal ReleaseDate() + { + } + + /// Initializes a new instance of ReleaseDate. + /// + /// + internal ReleaseDate(DateTimeOffset? exact, string rough) + { + Exact = exact; + Rough = rough; + } + + /// Gets the exact. + public DateTimeOffset? Exact { get; } + /// Gets the rough. + public string Rough { get; } + } +} diff --git a/generated/Models/RotationDetails.Serialization.cs b/generated/Models/RotationDetails.Serialization.cs new file mode 100644 index 0000000..1ae1f01 --- /dev/null +++ b/generated/Models/RotationDetails.Serialization.cs @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace DecksiteAPI.Models +{ + public partial class RotationDetails + { + internal static RotationDetails DeserializeRotationDetails(JsonElement element) + { + Optional last = default; + Optional next = default; + Optional diff = default; + Optional friendlyDiff = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("last")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + last = Set.DeserializeSet(property.Value); + continue; + } + if (property.NameEquals("next")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + next = Set.DeserializeSet(property.Value); + continue; + } + if (property.NameEquals("diff")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + diff = property.Value.GetSingle(); + continue; + } + if (property.NameEquals("friendly_diff")) + { + friendlyDiff = property.Value.GetString(); + continue; + } + } + return new RotationDetails(last.Value, next.Value, Optional.ToNullable(diff), friendlyDiff.Value); + } + } +} diff --git a/generated/Models/RotationDetails.cs b/generated/Models/RotationDetails.cs new file mode 100644 index 0000000..32529c6 --- /dev/null +++ b/generated/Models/RotationDetails.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace DecksiteAPI.Models +{ + /// The RotationDetails. + public partial class RotationDetails + { + /// Initializes a new instance of RotationDetails. + internal RotationDetails() + { + } + + /// Initializes a new instance of RotationDetails. + /// + /// + /// + /// + internal RotationDetails(Set last, Set next, float? diff, string friendlyDiff) + { + Last = last; + Next = next; + Diff = diff; + FriendlyDiff = friendlyDiff; + } + + /// Gets the last. + public Set Last { get; } + /// Gets the next. + public Set Next { get; } + /// Gets the diff. + public float? Diff { get; } + /// Gets the friendly diff. + public string FriendlyDiff { get; } + } +} diff --git a/generated/Models/Set.Serialization.cs b/generated/Models/Set.Serialization.cs new file mode 100644 index 0000000..8d8ab38 --- /dev/null +++ b/generated/Models/Set.Serialization.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace DecksiteAPI.Models +{ + public partial class Set + { + internal static Set DeserializeSet(JsonElement element) + { + Optional code = default; + Optional name = default; + Optional enterDate = default; + Optional exitDate = default; + Optional enterDateDt = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("code")) + { + code = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("enter_date")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + enterDate = ReleaseDate.DeserializeReleaseDate(property.Value); + continue; + } + if (property.NameEquals("exit_date")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + exitDate = ReleaseDate.DeserializeReleaseDate(property.Value); + continue; + } + if (property.NameEquals("enter_date_dt")) + { + enterDateDt = property.Value.GetString(); + continue; + } + } + return new Set(code.Value, name.Value, enterDate.Value, exitDate.Value, enterDateDt.Value); + } + } +} diff --git a/generated/Models/Set.cs b/generated/Models/Set.cs new file mode 100644 index 0000000..cebe509 --- /dev/null +++ b/generated/Models/Set.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace DecksiteAPI.Models +{ + /// The Set. + public partial class Set + { + /// Initializes a new instance of Set. + internal Set() + { + } + + /// Initializes a new instance of Set. + /// + /// + /// + /// + /// + internal Set(string code, string name, ReleaseDate enterDate, ReleaseDate exitDate, string enterDateDt) + { + Code = code; + Name = name; + EnterDate = enterDate; + ExitDate = exitDate; + EnterDateDt = enterDateDt; + } + + /// Gets the code. + public string Code { get; } + /// Gets the name. + public string Name { get; } + /// Gets the enter date. + public ReleaseDate EnterDate { get; } + /// Gets the exit date. + public ReleaseDate ExitDate { get; } + /// Gets the enter date dt. + public string EnterDateDt { get; } + } +}