From edb61d2d507060076ef48c2077c59814602b33ab Mon Sep 17 00:00:00 2001 From: Ben Ramey Date: Thu, 18 Apr 2024 09:52:30 -0500 Subject: [PATCH] WIP on api stuff --- .../ApplicationChangeSetDto.g.cs | 66 ++-- .../ApplicationCreateSetDto.g.cs | 120 +++--- src/OAP/OapApi.v1.Client/ApplicationDto.g.cs | 108 ++--- .../OapApi.v1.Client/ApplicationStatus.g.cs | 224 +++++------ .../ApplicationTermsCreateSetDto.g.cs | 106 ++--- .../OapApi.v1.Client/ApplicationTermsDto.g.cs | 72 ++-- .../CreateApplicationRequestDto.g.cs | 120 +++--- .../CreateApplicationResponseDto.g.cs | 84 ++-- .../OapApi.v1.Client/DelegatingOapApiV1.g.cs | 98 ++--- .../GetApplicationRequestDto.g.cs | 84 ++-- .../GetApplicationResponseDto.g.cs | 96 ++--- .../GetApplicationsRequestDto.g.cs | 108 ++--- .../GetApplicationsResponseDto.g.cs | 120 +++--- .../Http/HttpClientOapApiV1.g.cs | 106 ++--- .../Http/OapApiV1HttpHandler.g.cs | 160 ++++---- .../Http/OapApiV1HttpMapping.g.cs | 372 +++++++++--------- src/OAP/OapApi.v1.Client/IOapApiV1.g.cs | 68 ++-- src/OAP/OapApi.v1.Client/OapApiV1Methods.g.cs | 56 +-- .../UpdateApplicationRequestDto.g.cs | 96 ++--- .../UpdateApplicationResponseDto.g.cs | 84 ++-- src/OAP/OapApi.v1/OapApiV1.cs | 84 ++-- src/OAP/OapApi.v1/Startup.cs | 69 ++-- 22 files changed, 1258 insertions(+), 1243 deletions(-) diff --git a/src/OAP/OapApi.v1.Client/ApplicationChangeSetDto.g.cs b/src/OAP/OapApi.v1.Client/ApplicationChangeSetDto.g.cs index fec4274..368d5d6 100644 --- a/src/OAP/OapApi.v1.Client/ApplicationChangeSetDto.g.cs +++ b/src/OAP/OapApi.v1.Client/ApplicationChangeSetDto.g.cs @@ -1,33 +1,33 @@ -// -// DO NOT EDIT: generated by fsdgencsharp -// -using System; -using System.Collections.Generic; -using Facility.Core; - -namespace OapApi.v1.Client -{ - [System.CodeDom.Compiler.GeneratedCode("fsdgencsharp", "")] - public sealed partial class ApplicationChangeSetDto : ServiceDto - { - /// - /// Creates an instance. - /// - public ApplicationChangeSetDto() - { - } - - /// - /// The JSON serializer. - /// - protected override JsonServiceSerializer JsonSerializer => SystemTextJsonServiceSerializer.Instance; - - /// - /// Determines if two DTOs are equivalent. - /// - public override bool IsEquivalentTo(ApplicationChangeSetDto other) - { - return other != null; - } - } -} +// +// DO NOT EDIT: generated by fsdgencsharp +// +using System; +using System.Collections.Generic; +using Facility.Core; + +namespace OapApi.v1.Client +{ + [System.CodeDom.Compiler.GeneratedCode("fsdgencsharp", "")] + public sealed partial class ApplicationChangeSetDto : ServiceDto + { + /// + /// Creates an instance. + /// + public ApplicationChangeSetDto() + { + } + + /// + /// The JSON serializer. + /// + protected override JsonServiceSerializer JsonSerializer => SystemTextJsonServiceSerializer.Instance; + + /// + /// Determines if two DTOs are equivalent. + /// + public override bool IsEquivalentTo(ApplicationChangeSetDto other) + { + return other != null; + } + } +} diff --git a/src/OAP/OapApi.v1.Client/ApplicationCreateSetDto.g.cs b/src/OAP/OapApi.v1.Client/ApplicationCreateSetDto.g.cs index 158c184..f3cf8c7 100644 --- a/src/OAP/OapApi.v1.Client/ApplicationCreateSetDto.g.cs +++ b/src/OAP/OapApi.v1.Client/ApplicationCreateSetDto.g.cs @@ -1,60 +1,60 @@ -// -// DO NOT EDIT: generated by fsdgencsharp -// -using System; -using System.Collections.Generic; -using Facility.Core; - -namespace OapApi.v1.Client -{ - [System.CodeDom.Compiler.GeneratedCode("fsdgencsharp", "")] - public sealed partial class ApplicationCreateSetDto : ServiceDto - { - /// - /// Creates an instance. - /// - public ApplicationCreateSetDto() - { - } - - /// - /// Terms a user must accept to start an application. - /// - public ApplicationTermsCreateSetDto Terms { get; set; } - - /// - /// The JSON serializer. - /// - protected override JsonServiceSerializer JsonSerializer => SystemTextJsonServiceSerializer.Instance; - - /// - /// Determines if two DTOs are equivalent. - /// - public override bool IsEquivalentTo(ApplicationCreateSetDto other) - { - return other != null && - ServiceDataUtility.AreEquivalentDtos(Terms, other.Terms); - } - - /// - /// Validates the DTO. - /// - public override bool Validate(out string errorMessage) - { - errorMessage = GetValidationErrorMessage(); - return errorMessage == null; - } - - private string GetValidationErrorMessage() - { - if (Terms == null) - return ServiceDataUtility.GetRequiredFieldErrorMessage("terms"); - - string errorMessage; - if (!ServiceDataUtility.ValidateFieldValue(Terms, "terms", out errorMessage)) - return errorMessage; - - return null; - } - } -} +// +// DO NOT EDIT: generated by fsdgencsharp +// +using System; +using System.Collections.Generic; +using Facility.Core; + +namespace OapApi.v1.Client +{ + [System.CodeDom.Compiler.GeneratedCode("fsdgencsharp", "")] + public sealed partial class ApplicationCreateSetDto : ServiceDto + { + /// + /// Creates an instance. + /// + public ApplicationCreateSetDto() + { + } + + /// + /// Terms a user must accept to start an application. + /// + public ApplicationTermsCreateSetDto Terms { get; set; } + + /// + /// The JSON serializer. + /// + protected override JsonServiceSerializer JsonSerializer => SystemTextJsonServiceSerializer.Instance; + + /// + /// Determines if two DTOs are equivalent. + /// + public override bool IsEquivalentTo(ApplicationCreateSetDto other) + { + return other != null && + ServiceDataUtility.AreEquivalentDtos(Terms, other.Terms); + } + + /// + /// Validates the DTO. + /// + public override bool Validate(out string errorMessage) + { + errorMessage = GetValidationErrorMessage(); + return errorMessage == null; + } + + private string GetValidationErrorMessage() + { + if (Terms == null) + return ServiceDataUtility.GetRequiredFieldErrorMessage("terms"); + + string errorMessage; + if (!ServiceDataUtility.ValidateFieldValue(Terms, "terms", out errorMessage)) + return errorMessage; + + return null; + } + } +} diff --git a/src/OAP/OapApi.v1.Client/ApplicationDto.g.cs b/src/OAP/OapApi.v1.Client/ApplicationDto.g.cs index 70f15ed..52d8753 100644 --- a/src/OAP/OapApi.v1.Client/ApplicationDto.g.cs +++ b/src/OAP/OapApi.v1.Client/ApplicationDto.g.cs @@ -1,54 +1,54 @@ -// -// DO NOT EDIT: generated by fsdgencsharp -// -using System; -using System.Collections.Generic; -using Facility.Core; - -namespace OapApi.v1.Client -{ - /// - /// An application. - /// - [System.CodeDom.Compiler.GeneratedCode("fsdgencsharp", "")] - public sealed partial class ApplicationDto : ServiceDto - { - /// - /// Creates an instance. - /// - public ApplicationDto() - { - } - - /// - /// A unique identifier for the application. - /// - public string Id { get; set; } - - /// - /// The current status of this application. - /// - public ApplicationStatus? Status { get; set; } - - /// - /// Terms the user must accept to start, continue an accept an application. - /// - public ApplicationTermsDto Terms { get; set; } - - /// - /// The JSON serializer. - /// - protected override JsonServiceSerializer JsonSerializer => SystemTextJsonServiceSerializer.Instance; - - /// - /// Determines if two DTOs are equivalent. - /// - public override bool IsEquivalentTo(ApplicationDto other) - { - return other != null && - Id == other.Id && - Status == other.Status && - ServiceDataUtility.AreEquivalentDtos(Terms, other.Terms); - } - } -} +// +// DO NOT EDIT: generated by fsdgencsharp +// +using System; +using System.Collections.Generic; +using Facility.Core; + +namespace OapApi.v1.Client +{ + /// + /// An application. + /// + [System.CodeDom.Compiler.GeneratedCode("fsdgencsharp", "")] + public sealed partial class ApplicationDto : ServiceDto + { + /// + /// Creates an instance. + /// + public ApplicationDto() + { + } + + /// + /// A unique identifier for the application. + /// + public string Id { get; set; } + + /// + /// The current status of this application. + /// + public ApplicationStatus? Status { get; set; } + + /// + /// Terms the user must accept to start, continue an accept an application. + /// + public ApplicationTermsDto Terms { get; set; } + + /// + /// The JSON serializer. + /// + protected override JsonServiceSerializer JsonSerializer => SystemTextJsonServiceSerializer.Instance; + + /// + /// Determines if two DTOs are equivalent. + /// + public override bool IsEquivalentTo(ApplicationDto other) + { + return other != null && + Id == other.Id && + Status == other.Status && + ServiceDataUtility.AreEquivalentDtos(Terms, other.Terms); + } + } +} diff --git a/src/OAP/OapApi.v1.Client/ApplicationStatus.g.cs b/src/OAP/OapApi.v1.Client/ApplicationStatus.g.cs index 1e28627..ce772c2 100644 --- a/src/OAP/OapApi.v1.Client/ApplicationStatus.g.cs +++ b/src/OAP/OapApi.v1.Client/ApplicationStatus.g.cs @@ -1,112 +1,112 @@ -// -// DO NOT EDIT: generated by fsdgencsharp -// -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using Facility.Core; - -namespace OapApi.v1.Client -{ - [System.CodeDom.Compiler.GeneratedCode("fsdgencsharp", "")] - [Newtonsoft.Json.JsonConverter(typeof(ApplicationStatusJsonConverter))] - [System.Text.Json.Serialization.JsonConverter(typeof(ApplicationStatusSystemTextJsonConverter))] - public partial struct ApplicationStatus : IEquatable - { - public static readonly ApplicationStatus InProgress = new ApplicationStatus(Strings.InProgress); - - public static readonly ApplicationStatus Submitted = new ApplicationStatus(Strings.Submitted); - - /// - /// Creates an instance. - /// - public ApplicationStatus(string value) => m_value = value; - - /// - /// Converts the instance to a string. - /// - public override string ToString() => m_value != null && s_valueCache.TryGetValue(m_value, out var cachedValue) ? cachedValue : m_value ?? ""; - - /// - /// Checks for equality. - /// - public bool Equals(ApplicationStatus other) => StringComparer.OrdinalIgnoreCase.Equals(m_value ?? "", other.m_value ?? ""); - - /// - /// Checks for equality. - /// - public override bool Equals(object obj) => obj is ApplicationStatus && Equals((ApplicationStatus) obj); - - /// - /// Gets the hash code. - /// - public override int GetHashCode() => StringComparer.OrdinalIgnoreCase.GetHashCode(m_value ?? ""); - - /// - /// Checks for equality. - /// - public static bool operator ==(ApplicationStatus left, ApplicationStatus right) => left.Equals(right); - - /// - /// Checks for inequality. - /// - public static bool operator !=(ApplicationStatus left, ApplicationStatus right) => !left.Equals(right); - - /// - /// Returns true if the instance is equal to one of the defined values. - /// - public bool IsDefined() => m_value != null && s_valueCache.ContainsKey(m_value); - - /// - /// Returns all of the defined values. - /// - public static IReadOnlyList GetValues() => s_values; - - /// - /// Provides string constants for defined values. - /// - public static class Strings - { - public const string InProgress = "InProgress"; - - public const string Submitted = "Submitted"; - } - - /// - /// Used for serialization. - /// - public sealed class ApplicationStatusJsonConverter : ServiceEnumJsonConverter - { - /// - /// Creates the value from a string. - /// - protected override ApplicationStatus CreateCore(string value) => new ApplicationStatus(value); - } - - /// - /// Used for serialization. - /// - public sealed class ApplicationStatusSystemTextJsonConverter : ServiceEnumSystemTextJsonConverter - { - /// - /// Creates the value from a string. - /// - protected override ApplicationStatus CreateCore(string value) => new ApplicationStatus(value); - } - - private static readonly ReadOnlyCollection s_values = new ReadOnlyCollection( - new[] - { - InProgress, - Submitted, - }); - - private static readonly IReadOnlyDictionary s_valueCache = new Dictionary(StringComparer.OrdinalIgnoreCase) - { - { Strings.InProgress, Strings.InProgress }, - { Strings.Submitted, Strings.Submitted }, - }; - - private readonly string m_value; - } -} +// +// DO NOT EDIT: generated by fsdgencsharp +// +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using Facility.Core; + +namespace OapApi.v1.Client +{ + [System.CodeDom.Compiler.GeneratedCode("fsdgencsharp", "")] + [Newtonsoft.Json.JsonConverter(typeof(ApplicationStatusJsonConverter))] + [System.Text.Json.Serialization.JsonConverter(typeof(ApplicationStatusSystemTextJsonConverter))] + public partial struct ApplicationStatus : IEquatable + { + public static readonly ApplicationStatus InProgress = new ApplicationStatus(Strings.InProgress); + + public static readonly ApplicationStatus Submitted = new ApplicationStatus(Strings.Submitted); + + /// + /// Creates an instance. + /// + public ApplicationStatus(string value) => m_value = value; + + /// + /// Converts the instance to a string. + /// + public override string ToString() => m_value != null && s_valueCache.TryGetValue(m_value, out var cachedValue) ? cachedValue : m_value ?? ""; + + /// + /// Checks for equality. + /// + public bool Equals(ApplicationStatus other) => StringComparer.OrdinalIgnoreCase.Equals(m_value ?? "", other.m_value ?? ""); + + /// + /// Checks for equality. + /// + public override bool Equals(object obj) => obj is ApplicationStatus && Equals((ApplicationStatus) obj); + + /// + /// Gets the hash code. + /// + public override int GetHashCode() => StringComparer.OrdinalIgnoreCase.GetHashCode(m_value ?? ""); + + /// + /// Checks for equality. + /// + public static bool operator ==(ApplicationStatus left, ApplicationStatus right) => left.Equals(right); + + /// + /// Checks for inequality. + /// + public static bool operator !=(ApplicationStatus left, ApplicationStatus right) => !left.Equals(right); + + /// + /// Returns true if the instance is equal to one of the defined values. + /// + public bool IsDefined() => m_value != null && s_valueCache.ContainsKey(m_value); + + /// + /// Returns all of the defined values. + /// + public static IReadOnlyList GetValues() => s_values; + + /// + /// Provides string constants for defined values. + /// + public static class Strings + { + public const string InProgress = "InProgress"; + + public const string Submitted = "Submitted"; + } + + /// + /// Used for serialization. + /// + public sealed class ApplicationStatusJsonConverter : ServiceEnumJsonConverter + { + /// + /// Creates the value from a string. + /// + protected override ApplicationStatus CreateCore(string value) => new ApplicationStatus(value); + } + + /// + /// Used for serialization. + /// + public sealed class ApplicationStatusSystemTextJsonConverter : ServiceEnumSystemTextJsonConverter + { + /// + /// Creates the value from a string. + /// + protected override ApplicationStatus CreateCore(string value) => new ApplicationStatus(value); + } + + private static readonly ReadOnlyCollection s_values = new ReadOnlyCollection( + new[] + { + InProgress, + Submitted, + }); + + private static readonly IReadOnlyDictionary s_valueCache = new Dictionary(StringComparer.OrdinalIgnoreCase) + { + { Strings.InProgress, Strings.InProgress }, + { Strings.Submitted, Strings.Submitted }, + }; + + private readonly string m_value; + } +} diff --git a/src/OAP/OapApi.v1.Client/ApplicationTermsCreateSetDto.g.cs b/src/OAP/OapApi.v1.Client/ApplicationTermsCreateSetDto.g.cs index 6d557f9..5b75d07 100644 --- a/src/OAP/OapApi.v1.Client/ApplicationTermsCreateSetDto.g.cs +++ b/src/OAP/OapApi.v1.Client/ApplicationTermsCreateSetDto.g.cs @@ -1,53 +1,53 @@ -// -// DO NOT EDIT: generated by fsdgencsharp -// -using System; -using System.Collections.Generic; -using Facility.Core; - -namespace OapApi.v1.Client -{ - [System.CodeDom.Compiler.GeneratedCode("fsdgencsharp", "")] - public sealed partial class ApplicationTermsCreateSetDto : ServiceDto - { - /// - /// Creates an instance. - /// - public ApplicationTermsCreateSetDto() - { - } - - public bool? HasReadInstructions { get; set; } - - /// - /// The JSON serializer. - /// - protected override JsonServiceSerializer JsonSerializer => SystemTextJsonServiceSerializer.Instance; - - /// - /// Determines if two DTOs are equivalent. - /// - public override bool IsEquivalentTo(ApplicationTermsCreateSetDto other) - { - return other != null && - HasReadInstructions == other.HasReadInstructions; - } - - /// - /// Validates the DTO. - /// - public override bool Validate(out string errorMessage) - { - errorMessage = GetValidationErrorMessage(); - return errorMessage == null; - } - - private string GetValidationErrorMessage() - { - if (HasReadInstructions == null) - return ServiceDataUtility.GetRequiredFieldErrorMessage("hasReadInstructions"); - - return null; - } - } -} +// +// DO NOT EDIT: generated by fsdgencsharp +// +using System; +using System.Collections.Generic; +using Facility.Core; + +namespace OapApi.v1.Client +{ + [System.CodeDom.Compiler.GeneratedCode("fsdgencsharp", "")] + public sealed partial class ApplicationTermsCreateSetDto : ServiceDto + { + /// + /// Creates an instance. + /// + public ApplicationTermsCreateSetDto() + { + } + + public bool? HasReadInstructions { get; set; } + + /// + /// The JSON serializer. + /// + protected override JsonServiceSerializer JsonSerializer => SystemTextJsonServiceSerializer.Instance; + + /// + /// Determines if two DTOs are equivalent. + /// + public override bool IsEquivalentTo(ApplicationTermsCreateSetDto other) + { + return other != null && + HasReadInstructions == other.HasReadInstructions; + } + + /// + /// Validates the DTO. + /// + public override bool Validate(out string errorMessage) + { + errorMessage = GetValidationErrorMessage(); + return errorMessage == null; + } + + private string GetValidationErrorMessage() + { + if (HasReadInstructions == null) + return ServiceDataUtility.GetRequiredFieldErrorMessage("hasReadInstructions"); + + return null; + } + } +} diff --git a/src/OAP/OapApi.v1.Client/ApplicationTermsDto.g.cs b/src/OAP/OapApi.v1.Client/ApplicationTermsDto.g.cs index 6083908..f751a90 100644 --- a/src/OAP/OapApi.v1.Client/ApplicationTermsDto.g.cs +++ b/src/OAP/OapApi.v1.Client/ApplicationTermsDto.g.cs @@ -1,36 +1,36 @@ -// -// DO NOT EDIT: generated by fsdgencsharp -// -using System; -using System.Collections.Generic; -using Facility.Core; - -namespace OapApi.v1.Client -{ - [System.CodeDom.Compiler.GeneratedCode("fsdgencsharp", "")] - public sealed partial class ApplicationTermsDto : ServiceDto - { - /// - /// Creates an instance. - /// - public ApplicationTermsDto() - { - } - - public bool? HasReadInstructions { get; set; } - - /// - /// The JSON serializer. - /// - protected override JsonServiceSerializer JsonSerializer => SystemTextJsonServiceSerializer.Instance; - - /// - /// Determines if two DTOs are equivalent. - /// - public override bool IsEquivalentTo(ApplicationTermsDto other) - { - return other != null && - HasReadInstructions == other.HasReadInstructions; - } - } -} +// +// DO NOT EDIT: generated by fsdgencsharp +// +using System; +using System.Collections.Generic; +using Facility.Core; + +namespace OapApi.v1.Client +{ + [System.CodeDom.Compiler.GeneratedCode("fsdgencsharp", "")] + public sealed partial class ApplicationTermsDto : ServiceDto + { + /// + /// Creates an instance. + /// + public ApplicationTermsDto() + { + } + + public bool? HasReadInstructions { get; set; } + + /// + /// The JSON serializer. + /// + protected override JsonServiceSerializer JsonSerializer => SystemTextJsonServiceSerializer.Instance; + + /// + /// Determines if two DTOs are equivalent. + /// + public override bool IsEquivalentTo(ApplicationTermsDto other) + { + return other != null && + HasReadInstructions == other.HasReadInstructions; + } + } +} diff --git a/src/OAP/OapApi.v1.Client/CreateApplicationRequestDto.g.cs b/src/OAP/OapApi.v1.Client/CreateApplicationRequestDto.g.cs index bef903e..c0212c6 100644 --- a/src/OAP/OapApi.v1.Client/CreateApplicationRequestDto.g.cs +++ b/src/OAP/OapApi.v1.Client/CreateApplicationRequestDto.g.cs @@ -1,60 +1,60 @@ -// -// DO NOT EDIT: generated by fsdgencsharp -// -using System; -using System.Collections.Generic; -using Facility.Core; - -namespace OapApi.v1.Client -{ - /// - /// Request for CreateApplication. - /// - [System.CodeDom.Compiler.GeneratedCode("fsdgencsharp", "")] - public sealed partial class CreateApplicationRequestDto : ServiceDto - { - /// - /// Creates an instance. - /// - public CreateApplicationRequestDto() - { - } - - /// - /// The application to create. - /// - public ApplicationCreateSetDto ApplicationCreateSet { get; set; } - - /// - /// The JSON serializer. - /// - protected override JsonServiceSerializer JsonSerializer => SystemTextJsonServiceSerializer.Instance; - - /// - /// Determines if two DTOs are equivalent. - /// - public override bool IsEquivalentTo(CreateApplicationRequestDto other) - { - return other != null && - ServiceDataUtility.AreEquivalentDtos(ApplicationCreateSet, other.ApplicationCreateSet); - } - - /// - /// Validates the DTO. - /// - public override bool Validate(out string errorMessage) - { - errorMessage = GetValidationErrorMessage(); - return errorMessage == null; - } - - private string GetValidationErrorMessage() - { - string errorMessage; - if (!ServiceDataUtility.ValidateFieldValue(ApplicationCreateSet, "applicationCreateSet", out errorMessage)) - return errorMessage; - - return null; - } - } -} +// +// DO NOT EDIT: generated by fsdgencsharp +// +using System; +using System.Collections.Generic; +using Facility.Core; + +namespace OapApi.v1.Client +{ + /// + /// Request for CreateApplication. + /// + [System.CodeDom.Compiler.GeneratedCode("fsdgencsharp", "")] + public sealed partial class CreateApplicationRequestDto : ServiceDto + { + /// + /// Creates an instance. + /// + public CreateApplicationRequestDto() + { + } + + /// + /// The application to create. + /// + public ApplicationCreateSetDto ApplicationCreateSet { get; set; } + + /// + /// The JSON serializer. + /// + protected override JsonServiceSerializer JsonSerializer => SystemTextJsonServiceSerializer.Instance; + + /// + /// Determines if two DTOs are equivalent. + /// + public override bool IsEquivalentTo(CreateApplicationRequestDto other) + { + return other != null && + ServiceDataUtility.AreEquivalentDtos(ApplicationCreateSet, other.ApplicationCreateSet); + } + + /// + /// Validates the DTO. + /// + public override bool Validate(out string errorMessage) + { + errorMessage = GetValidationErrorMessage(); + return errorMessage == null; + } + + private string GetValidationErrorMessage() + { + string errorMessage; + if (!ServiceDataUtility.ValidateFieldValue(ApplicationCreateSet, "applicationCreateSet", out errorMessage)) + return errorMessage; + + return null; + } + } +} diff --git a/src/OAP/OapApi.v1.Client/CreateApplicationResponseDto.g.cs b/src/OAP/OapApi.v1.Client/CreateApplicationResponseDto.g.cs index f67a50d..33cd820 100644 --- a/src/OAP/OapApi.v1.Client/CreateApplicationResponseDto.g.cs +++ b/src/OAP/OapApi.v1.Client/CreateApplicationResponseDto.g.cs @@ -1,42 +1,42 @@ -// -// DO NOT EDIT: generated by fsdgencsharp -// -using System; -using System.Collections.Generic; -using Facility.Core; - -namespace OapApi.v1.Client -{ - /// - /// Response for CreateApplication. - /// - [System.CodeDom.Compiler.GeneratedCode("fsdgencsharp", "")] - public sealed partial class CreateApplicationResponseDto : ServiceDto - { - /// - /// Creates an instance. - /// - public CreateApplicationResponseDto() - { - } - - /// - /// The created application. - /// - public ApplicationDto Application { get; set; } - - /// - /// The JSON serializer. - /// - protected override JsonServiceSerializer JsonSerializer => SystemTextJsonServiceSerializer.Instance; - - /// - /// Determines if two DTOs are equivalent. - /// - public override bool IsEquivalentTo(CreateApplicationResponseDto other) - { - return other != null && - ServiceDataUtility.AreEquivalentDtos(Application, other.Application); - } - } -} +// +// DO NOT EDIT: generated by fsdgencsharp +// +using System; +using System.Collections.Generic; +using Facility.Core; + +namespace OapApi.v1.Client +{ + /// + /// Response for CreateApplication. + /// + [System.CodeDom.Compiler.GeneratedCode("fsdgencsharp", "")] + public sealed partial class CreateApplicationResponseDto : ServiceDto + { + /// + /// Creates an instance. + /// + public CreateApplicationResponseDto() + { + } + + /// + /// The created application. + /// + public ApplicationDto Application { get; set; } + + /// + /// The JSON serializer. + /// + protected override JsonServiceSerializer JsonSerializer => SystemTextJsonServiceSerializer.Instance; + + /// + /// Determines if two DTOs are equivalent. + /// + public override bool IsEquivalentTo(CreateApplicationResponseDto other) + { + return other != null && + ServiceDataUtility.AreEquivalentDtos(Application, other.Application); + } + } +} diff --git a/src/OAP/OapApi.v1.Client/DelegatingOapApiV1.g.cs b/src/OAP/OapApi.v1.Client/DelegatingOapApiV1.g.cs index 801f1cb..1246fe1 100644 --- a/src/OAP/OapApi.v1.Client/DelegatingOapApiV1.g.cs +++ b/src/OAP/OapApi.v1.Client/DelegatingOapApiV1.g.cs @@ -1,49 +1,49 @@ -// -// DO NOT EDIT: generated by fsdgencsharp -// -using System; -using System.Threading; -using System.Threading.Tasks; -using Facility.Core; - -namespace OapApi.v1.Client -{ - /// - /// A delegating implementation of OapApiV1. - /// - [System.CodeDom.Compiler.GeneratedCode("fsdgencsharp", "")] - public partial class DelegatingOapApiV1 : IOapApiV1 - { - /// - /// Creates an instance with the specified delegator. - /// - public DelegatingOapApiV1(ServiceDelegator delegator) => - m_delegator = delegator ?? throw new ArgumentNullException(nameof(delegator)); - - /// - /// Gets applications for the current user. - /// - public virtual async Task> GetApplicationsAsync(GetApplicationsRequestDto request, CancellationToken cancellationToken = default) => - (await m_delegator(OapApiV1Methods.GetApplications, request, cancellationToken).ConfigureAwait(false)).Cast(); - - /// - /// Creates a new application for the current user. - /// - public virtual async Task> CreateApplicationAsync(CreateApplicationRequestDto request, CancellationToken cancellationToken = default) => - (await m_delegator(OapApiV1Methods.CreateApplication, request, cancellationToken).ConfigureAwait(false)).Cast(); - - /// - /// Gets the specified application for the current user. - /// - public virtual async Task> GetApplicationAsync(GetApplicationRequestDto request, CancellationToken cancellationToken = default) => - (await m_delegator(OapApiV1Methods.GetApplication, request, cancellationToken).ConfigureAwait(false)).Cast(); - - /// - /// Updates the application. - /// - public virtual async Task> UpdateApplicationAsync(UpdateApplicationRequestDto request, CancellationToken cancellationToken = default) => - (await m_delegator(OapApiV1Methods.UpdateApplication, request, cancellationToken).ConfigureAwait(false)).Cast(); - - private readonly ServiceDelegator m_delegator; - } -} +// +// DO NOT EDIT: generated by fsdgencsharp +// +using System; +using System.Threading; +using System.Threading.Tasks; +using Facility.Core; + +namespace OapApi.v1.Client +{ + /// + /// A delegating implementation of OapApiV1. + /// + [System.CodeDom.Compiler.GeneratedCode("fsdgencsharp", "")] + public partial class DelegatingOapApiV1 : IOapApiV1 + { + /// + /// Creates an instance with the specified delegator. + /// + public DelegatingOapApiV1(ServiceDelegator delegator) => + m_delegator = delegator ?? throw new ArgumentNullException(nameof(delegator)); + + /// + /// Gets applications for the current user. + /// + public virtual async Task> GetApplicationsAsync(GetApplicationsRequestDto request, CancellationToken cancellationToken = default) => + (await m_delegator(OapApiV1Methods.GetApplications, request, cancellationToken).ConfigureAwait(false)).Cast(); + + /// + /// Creates a new application for the current user. + /// + public virtual async Task> CreateApplicationAsync(CreateApplicationRequestDto request, CancellationToken cancellationToken = default) => + (await m_delegator(OapApiV1Methods.CreateApplication, request, cancellationToken).ConfigureAwait(false)).Cast(); + + /// + /// Gets the specified application for the current user. + /// + public virtual async Task> GetApplicationAsync(GetApplicationRequestDto request, CancellationToken cancellationToken = default) => + (await m_delegator(OapApiV1Methods.GetApplication, request, cancellationToken).ConfigureAwait(false)).Cast(); + + /// + /// Updates the application. + /// + public virtual async Task> UpdateApplicationAsync(UpdateApplicationRequestDto request, CancellationToken cancellationToken = default) => + (await m_delegator(OapApiV1Methods.UpdateApplication, request, cancellationToken).ConfigureAwait(false)).Cast(); + + private readonly ServiceDelegator m_delegator; + } +} diff --git a/src/OAP/OapApi.v1.Client/GetApplicationRequestDto.g.cs b/src/OAP/OapApi.v1.Client/GetApplicationRequestDto.g.cs index 009a605..f233f0f 100644 --- a/src/OAP/OapApi.v1.Client/GetApplicationRequestDto.g.cs +++ b/src/OAP/OapApi.v1.Client/GetApplicationRequestDto.g.cs @@ -1,42 +1,42 @@ -// -// DO NOT EDIT: generated by fsdgencsharp -// -using System; -using System.Collections.Generic; -using Facility.Core; - -namespace OapApi.v1.Client -{ - /// - /// Request for GetApplication. - /// - [System.CodeDom.Compiler.GeneratedCode("fsdgencsharp", "")] - public sealed partial class GetApplicationRequestDto : ServiceDto - { - /// - /// Creates an instance. - /// - public GetApplicationRequestDto() - { - } - - /// - /// The widget ID. - /// - public string Id { get; set; } - - /// - /// The JSON serializer. - /// - protected override JsonServiceSerializer JsonSerializer => SystemTextJsonServiceSerializer.Instance; - - /// - /// Determines if two DTOs are equivalent. - /// - public override bool IsEquivalentTo(GetApplicationRequestDto other) - { - return other != null && - Id == other.Id; - } - } -} +// +// DO NOT EDIT: generated by fsdgencsharp +// +using System; +using System.Collections.Generic; +using Facility.Core; + +namespace OapApi.v1.Client +{ + /// + /// Request for GetApplication. + /// + [System.CodeDom.Compiler.GeneratedCode("fsdgencsharp", "")] + public sealed partial class GetApplicationRequestDto : ServiceDto + { + /// + /// Creates an instance. + /// + public GetApplicationRequestDto() + { + } + + /// + /// The widget ID. + /// + public string Id { get; set; } + + /// + /// The JSON serializer. + /// + protected override JsonServiceSerializer JsonSerializer => SystemTextJsonServiceSerializer.Instance; + + /// + /// Determines if two DTOs are equivalent. + /// + public override bool IsEquivalentTo(GetApplicationRequestDto other) + { + return other != null && + Id == other.Id; + } + } +} diff --git a/src/OAP/OapApi.v1.Client/GetApplicationResponseDto.g.cs b/src/OAP/OapApi.v1.Client/GetApplicationResponseDto.g.cs index 2d7baac..c7687b5 100644 --- a/src/OAP/OapApi.v1.Client/GetApplicationResponseDto.g.cs +++ b/src/OAP/OapApi.v1.Client/GetApplicationResponseDto.g.cs @@ -1,48 +1,48 @@ -// -// DO NOT EDIT: generated by fsdgencsharp -// -using System; -using System.Collections.Generic; -using Facility.Core; - -namespace OapApi.v1.Client -{ - /// - /// Response for GetApplication. - /// - [System.CodeDom.Compiler.GeneratedCode("fsdgencsharp", "")] - public sealed partial class GetApplicationResponseDto : ServiceDto - { - /// - /// Creates an instance. - /// - public GetApplicationResponseDto() - { - } - - /// - /// The requested widget. - /// - public ApplicationDto Application { get; set; } - - public string ETag { get; set; } - - public bool? NotModified { get; set; } - - /// - /// The JSON serializer. - /// - protected override JsonServiceSerializer JsonSerializer => SystemTextJsonServiceSerializer.Instance; - - /// - /// Determines if two DTOs are equivalent. - /// - public override bool IsEquivalentTo(GetApplicationResponseDto other) - { - return other != null && - ServiceDataUtility.AreEquivalentDtos(Application, other.Application) && - ETag == other.ETag && - NotModified == other.NotModified; - } - } -} +// +// DO NOT EDIT: generated by fsdgencsharp +// +using System; +using System.Collections.Generic; +using Facility.Core; + +namespace OapApi.v1.Client +{ + /// + /// Response for GetApplication. + /// + [System.CodeDom.Compiler.GeneratedCode("fsdgencsharp", "")] + public sealed partial class GetApplicationResponseDto : ServiceDto + { + /// + /// Creates an instance. + /// + public GetApplicationResponseDto() + { + } + + /// + /// The requested widget. + /// + public ApplicationDto Application { get; set; } + + public string ETag { get; set; } + + public bool? NotModified { get; set; } + + /// + /// The JSON serializer. + /// + protected override JsonServiceSerializer JsonSerializer => SystemTextJsonServiceSerializer.Instance; + + /// + /// Determines if two DTOs are equivalent. + /// + public override bool IsEquivalentTo(GetApplicationResponseDto other) + { + return other != null && + ServiceDataUtility.AreEquivalentDtos(Application, other.Application) && + ETag == other.ETag && + NotModified == other.NotModified; + } + } +} diff --git a/src/OAP/OapApi.v1.Client/GetApplicationsRequestDto.g.cs b/src/OAP/OapApi.v1.Client/GetApplicationsRequestDto.g.cs index 494b8d2..67066c3 100644 --- a/src/OAP/OapApi.v1.Client/GetApplicationsRequestDto.g.cs +++ b/src/OAP/OapApi.v1.Client/GetApplicationsRequestDto.g.cs @@ -1,54 +1,54 @@ -// -// DO NOT EDIT: generated by fsdgencsharp -// -using System; -using System.Collections.Generic; -using Facility.Core; - -namespace OapApi.v1.Client -{ - /// - /// Request for GetApplications. - /// - [System.CodeDom.Compiler.GeneratedCode("fsdgencsharp", "")] - public sealed partial class GetApplicationsRequestDto : ServiceDto - { - /// - /// Creates an instance. - /// - public GetApplicationsRequestDto() - { - } - - /// - /// Filter applications by the given status. - /// - public ApplicationStatus? Status { get; set; } - - /// - /// The limit of returned results. - /// - public int? Limit { get; set; } - - /// - /// The token presenting the next page of applications to get. - /// - public string NextToken { get; set; } - - /// - /// The JSON serializer. - /// - protected override JsonServiceSerializer JsonSerializer => SystemTextJsonServiceSerializer.Instance; - - /// - /// Determines if two DTOs are equivalent. - /// - public override bool IsEquivalentTo(GetApplicationsRequestDto other) - { - return other != null && - Status == other.Status && - Limit == other.Limit && - NextToken == other.NextToken; - } - } -} +// +// DO NOT EDIT: generated by fsdgencsharp +// +using System; +using System.Collections.Generic; +using Facility.Core; + +namespace OapApi.v1.Client +{ + /// + /// Request for GetApplications. + /// + [System.CodeDom.Compiler.GeneratedCode("fsdgencsharp", "")] + public sealed partial class GetApplicationsRequestDto : ServiceDto + { + /// + /// Creates an instance. + /// + public GetApplicationsRequestDto() + { + } + + /// + /// Filter applications by the given status. + /// + public ApplicationStatus? Status { get; set; } + + /// + /// The limit of returned results. + /// + public int? Limit { get; set; } + + /// + /// The token presenting the next page of applications to get. + /// + public string NextToken { get; set; } + + /// + /// The JSON serializer. + /// + protected override JsonServiceSerializer JsonSerializer => SystemTextJsonServiceSerializer.Instance; + + /// + /// Determines if two DTOs are equivalent. + /// + public override bool IsEquivalentTo(GetApplicationsRequestDto other) + { + return other != null && + Status == other.Status && + Limit == other.Limit && + NextToken == other.NextToken; + } + } +} diff --git a/src/OAP/OapApi.v1.Client/GetApplicationsResponseDto.g.cs b/src/OAP/OapApi.v1.Client/GetApplicationsResponseDto.g.cs index b0076f9..bdc8660 100644 --- a/src/OAP/OapApi.v1.Client/GetApplicationsResponseDto.g.cs +++ b/src/OAP/OapApi.v1.Client/GetApplicationsResponseDto.g.cs @@ -1,60 +1,60 @@ -// -// DO NOT EDIT: generated by fsdgencsharp -// -using System; -using System.Collections.Generic; -using Facility.Core; - -namespace OapApi.v1.Client -{ - /// - /// Response for GetApplications. - /// - [System.CodeDom.Compiler.GeneratedCode("fsdgencsharp", "")] - public sealed partial class GetApplicationsResponseDto : ServiceDto - { - /// - /// Creates an instance. - /// - public GetApplicationsResponseDto() - { - } - - /// - /// The applications. - /// - public IReadOnlyList Applications { get; set; } - - /// - /// The total number of applications. - /// - public long? Total { get; set; } - - /// - /// The token representing the next page of results. - /// - public string NextToken { get; set; } - - /// - /// True if this is the last page of results, false otherwise. - /// - public bool? IsLastPage { get; set; } - - /// - /// The JSON serializer. - /// - protected override JsonServiceSerializer JsonSerializer => SystemTextJsonServiceSerializer.Instance; - - /// - /// Determines if two DTOs are equivalent. - /// - public override bool IsEquivalentTo(GetApplicationsResponseDto other) - { - return other != null && - ServiceDataUtility.AreEquivalentFieldValues(Applications, other.Applications) && - Total == other.Total && - NextToken == other.NextToken && - IsLastPage == other.IsLastPage; - } - } -} +// +// DO NOT EDIT: generated by fsdgencsharp +// +using System; +using System.Collections.Generic; +using Facility.Core; + +namespace OapApi.v1.Client +{ + /// + /// Response for GetApplications. + /// + [System.CodeDom.Compiler.GeneratedCode("fsdgencsharp", "")] + public sealed partial class GetApplicationsResponseDto : ServiceDto + { + /// + /// Creates an instance. + /// + public GetApplicationsResponseDto() + { + } + + /// + /// The applications. + /// + public IReadOnlyList Applications { get; set; } + + /// + /// The total number of applications. + /// + public long? Total { get; set; } + + /// + /// The token representing the next page of results. + /// + public string NextToken { get; set; } + + /// + /// True if this is the last page of results, false otherwise. + /// + public bool? IsLastPage { get; set; } + + /// + /// The JSON serializer. + /// + protected override JsonServiceSerializer JsonSerializer => SystemTextJsonServiceSerializer.Instance; + + /// + /// Determines if two DTOs are equivalent. + /// + public override bool IsEquivalentTo(GetApplicationsResponseDto other) + { + return other != null && + ServiceDataUtility.AreEquivalentFieldValues(Applications, other.Applications) && + Total == other.Total && + NextToken == other.NextToken && + IsLastPage == other.IsLastPage; + } + } +} diff --git a/src/OAP/OapApi.v1.Client/Http/HttpClientOapApiV1.g.cs b/src/OAP/OapApi.v1.Client/Http/HttpClientOapApiV1.g.cs index a19d514..a151ada 100644 --- a/src/OAP/OapApi.v1.Client/Http/HttpClientOapApiV1.g.cs +++ b/src/OAP/OapApi.v1.Client/Http/HttpClientOapApiV1.g.cs @@ -1,53 +1,53 @@ -// -// DO NOT EDIT: generated by fsdgencsharp -// -using System; -using System.Threading; -using System.Threading.Tasks; -using Facility.Core; -using Facility.Core.Http; - -namespace OapApi.v1.Client.Http -{ - [System.CodeDom.Compiler.GeneratedCode("fsdgencsharp", "")] - public sealed partial class HttpClientOapApiV1 : HttpClientService, IOapApiV1 - { - /// - /// Creates the service. - /// - public HttpClientOapApiV1(HttpClientServiceSettings settings = null) - : base(settings, s_defaults) - { - } - - /// - /// Gets applications for the current user. - /// - public Task> GetApplicationsAsync(GetApplicationsRequestDto request, CancellationToken cancellationToken = default) => - TrySendRequestAsync(OapApiV1HttpMapping.GetApplicationsMapping, request, cancellationToken); - - /// - /// Creates a new application for the current user. - /// - public Task> CreateApplicationAsync(CreateApplicationRequestDto request, CancellationToken cancellationToken = default) => - TrySendRequestAsync(OapApiV1HttpMapping.CreateApplicationMapping, request, cancellationToken); - - /// - /// Gets the specified application for the current user. - /// - public Task> GetApplicationAsync(GetApplicationRequestDto request, CancellationToken cancellationToken = default) => - TrySendRequestAsync(OapApiV1HttpMapping.GetApplicationMapping, request, cancellationToken); - - /// - /// Updates the application. - /// - public Task> UpdateApplicationAsync(UpdateApplicationRequestDto request, CancellationToken cancellationToken = default) => - TrySendRequestAsync(OapApiV1HttpMapping.UpdateApplicationMapping, request, cancellationToken); - - private static readonly HttpClientServiceDefaults s_defaults = new HttpClientServiceDefaults - { - BaseUri = new Uri("https://oaprotection.org/api/v1"), - ContentSerializer = HttpContentSerializer.Create(SystemTextJsonServiceSerializer.Instance), - }; - } -} +// +// DO NOT EDIT: generated by fsdgencsharp +// +using System; +using System.Threading; +using System.Threading.Tasks; +using Facility.Core; +using Facility.Core.Http; + +namespace OapApi.v1.Client.Http +{ + [System.CodeDom.Compiler.GeneratedCode("fsdgencsharp", "")] + public sealed partial class HttpClientOapApiV1 : HttpClientService, IOapApiV1 + { + /// + /// Creates the service. + /// + public HttpClientOapApiV1(HttpClientServiceSettings settings = null) + : base(settings, s_defaults) + { + } + + /// + /// Gets applications for the current user. + /// + public Task> GetApplicationsAsync(GetApplicationsRequestDto request, CancellationToken cancellationToken = default) => + TrySendRequestAsync(OapApiV1HttpMapping.GetApplicationsMapping, request, cancellationToken); + + /// + /// Creates a new application for the current user. + /// + public Task> CreateApplicationAsync(CreateApplicationRequestDto request, CancellationToken cancellationToken = default) => + TrySendRequestAsync(OapApiV1HttpMapping.CreateApplicationMapping, request, cancellationToken); + + /// + /// Gets the specified application for the current user. + /// + public Task> GetApplicationAsync(GetApplicationRequestDto request, CancellationToken cancellationToken = default) => + TrySendRequestAsync(OapApiV1HttpMapping.GetApplicationMapping, request, cancellationToken); + + /// + /// Updates the application. + /// + public Task> UpdateApplicationAsync(UpdateApplicationRequestDto request, CancellationToken cancellationToken = default) => + TrySendRequestAsync(OapApiV1HttpMapping.UpdateApplicationMapping, request, cancellationToken); + + private static readonly HttpClientServiceDefaults s_defaults = new HttpClientServiceDefaults + { + BaseUri = new Uri("https://oaprotection.org/api/v1"), + ContentSerializer = HttpContentSerializer.Create(SystemTextJsonServiceSerializer.Instance), + }; + } +} diff --git a/src/OAP/OapApi.v1.Client/Http/OapApiV1HttpHandler.g.cs b/src/OAP/OapApi.v1.Client/Http/OapApiV1HttpHandler.g.cs index 2a7784b..6d4d18f 100644 --- a/src/OAP/OapApi.v1.Client/Http/OapApiV1HttpHandler.g.cs +++ b/src/OAP/OapApi.v1.Client/Http/OapApiV1HttpHandler.g.cs @@ -1,80 +1,80 @@ -// -// DO NOT EDIT: generated by fsdgencsharp -// -using System; -using System.Net; -using System.Net.Http; -using System.Threading; -using System.Threading.Tasks; -using Facility.Core; -using Facility.Core.Http; - -namespace OapApi.v1.Client.Http -{ - [System.CodeDom.Compiler.GeneratedCode("fsdgencsharp", "")] - public sealed partial class OapApiV1HttpHandler : ServiceHttpHandler - { - /// - /// Creates the handler. - /// - public OapApiV1HttpHandler(IOapApiV1 service, ServiceHttpHandlerSettings settings = null) - : base(settings, s_defaults) - { - m_service = service ?? throw new ArgumentNullException(nameof(service)); - } - - /// - /// Creates the handler. - /// - public OapApiV1HttpHandler(Func getService, ServiceHttpHandlerSettings settings = null) - : base(settings, s_defaults) - { - m_getService = getService ?? throw new ArgumentNullException(nameof(getService)); - } - - /// - /// Attempts to handle the HTTP request. - /// - public override async Task TryHandleHttpRequestAsync(HttpRequestMessage httpRequest, CancellationToken cancellationToken = default) - { - return await AdaptTask(TryHandleGetApplicationsAsync(httpRequest, cancellationToken)).ConfigureAwait(true) ?? - await AdaptTask(TryHandleCreateApplicationAsync(httpRequest, cancellationToken)).ConfigureAwait(true) ?? - await AdaptTask(TryHandleGetApplicationAsync(httpRequest, cancellationToken)).ConfigureAwait(true) ?? - await AdaptTask(TryHandleUpdateApplicationAsync(httpRequest, cancellationToken)).ConfigureAwait(true); - } - - /// - /// Gets applications for the current user. - /// - public Task TryHandleGetApplicationsAsync(HttpRequestMessage httpRequest, CancellationToken cancellationToken = default) => - TryHandleServiceMethodAsync(OapApiV1HttpMapping.GetApplicationsMapping, httpRequest, GetService(httpRequest).GetApplicationsAsync, cancellationToken); - - /// - /// Creates a new application for the current user. - /// - public Task TryHandleCreateApplicationAsync(HttpRequestMessage httpRequest, CancellationToken cancellationToken = default) => - TryHandleServiceMethodAsync(OapApiV1HttpMapping.CreateApplicationMapping, httpRequest, GetService(httpRequest).CreateApplicationAsync, cancellationToken); - - /// - /// Gets the specified application for the current user. - /// - public Task TryHandleGetApplicationAsync(HttpRequestMessage httpRequest, CancellationToken cancellationToken = default) => - TryHandleServiceMethodAsync(OapApiV1HttpMapping.GetApplicationMapping, httpRequest, GetService(httpRequest).GetApplicationAsync, cancellationToken); - - /// - /// Updates the application. - /// - public Task TryHandleUpdateApplicationAsync(HttpRequestMessage httpRequest, CancellationToken cancellationToken = default) => - TryHandleServiceMethodAsync(OapApiV1HttpMapping.UpdateApplicationMapping, httpRequest, GetService(httpRequest).UpdateApplicationAsync, cancellationToken); - - private IOapApiV1 GetService(HttpRequestMessage httpRequest) => m_service ?? m_getService(httpRequest); - - private static readonly ServiceHttpHandlerDefaults s_defaults = new ServiceHttpHandlerDefaults - { - ContentSerializer = HttpContentSerializer.Create(SystemTextJsonServiceSerializer.Instance), - }; - - private readonly IOapApiV1 m_service; - private readonly Func m_getService; - } -} +// +// DO NOT EDIT: generated by fsdgencsharp +// +using System; +using System.Net; +using System.Net.Http; +using System.Threading; +using System.Threading.Tasks; +using Facility.Core; +using Facility.Core.Http; + +namespace OapApi.v1.Client.Http +{ + [System.CodeDom.Compiler.GeneratedCode("fsdgencsharp", "")] + public sealed partial class OapApiV1HttpHandler : ServiceHttpHandler + { + /// + /// Creates the handler. + /// + public OapApiV1HttpHandler(IOapApiV1 service, ServiceHttpHandlerSettings settings = null) + : base(settings, s_defaults) + { + m_service = service ?? throw new ArgumentNullException(nameof(service)); + } + + /// + /// Creates the handler. + /// + public OapApiV1HttpHandler(Func getService, ServiceHttpHandlerSettings settings = null) + : base(settings, s_defaults) + { + m_getService = getService ?? throw new ArgumentNullException(nameof(getService)); + } + + /// + /// Attempts to handle the HTTP request. + /// + public override async Task TryHandleHttpRequestAsync(HttpRequestMessage httpRequest, CancellationToken cancellationToken = default) + { + return await AdaptTask(TryHandleGetApplicationsAsync(httpRequest, cancellationToken)).ConfigureAwait(true) ?? + await AdaptTask(TryHandleCreateApplicationAsync(httpRequest, cancellationToken)).ConfigureAwait(true) ?? + await AdaptTask(TryHandleGetApplicationAsync(httpRequest, cancellationToken)).ConfigureAwait(true) ?? + await AdaptTask(TryHandleUpdateApplicationAsync(httpRequest, cancellationToken)).ConfigureAwait(true); + } + + /// + /// Gets applications for the current user. + /// + public Task TryHandleGetApplicationsAsync(HttpRequestMessage httpRequest, CancellationToken cancellationToken = default) => + TryHandleServiceMethodAsync(OapApiV1HttpMapping.GetApplicationsMapping, httpRequest, GetService(httpRequest).GetApplicationsAsync, cancellationToken); + + /// + /// Creates a new application for the current user. + /// + public Task TryHandleCreateApplicationAsync(HttpRequestMessage httpRequest, CancellationToken cancellationToken = default) => + TryHandleServiceMethodAsync(OapApiV1HttpMapping.CreateApplicationMapping, httpRequest, GetService(httpRequest).CreateApplicationAsync, cancellationToken); + + /// + /// Gets the specified application for the current user. + /// + public Task TryHandleGetApplicationAsync(HttpRequestMessage httpRequest, CancellationToken cancellationToken = default) => + TryHandleServiceMethodAsync(OapApiV1HttpMapping.GetApplicationMapping, httpRequest, GetService(httpRequest).GetApplicationAsync, cancellationToken); + + /// + /// Updates the application. + /// + public Task TryHandleUpdateApplicationAsync(HttpRequestMessage httpRequest, CancellationToken cancellationToken = default) => + TryHandleServiceMethodAsync(OapApiV1HttpMapping.UpdateApplicationMapping, httpRequest, GetService(httpRequest).UpdateApplicationAsync, cancellationToken); + + private IOapApiV1 GetService(HttpRequestMessage httpRequest) => m_service ?? m_getService(httpRequest); + + private static readonly ServiceHttpHandlerDefaults s_defaults = new ServiceHttpHandlerDefaults + { + ContentSerializer = HttpContentSerializer.Create(SystemTextJsonServiceSerializer.Instance), + }; + + private readonly IOapApiV1 m_service; + private readonly Func m_getService; + } +} diff --git a/src/OAP/OapApi.v1.Client/Http/OapApiV1HttpMapping.g.cs b/src/OAP/OapApi.v1.Client/Http/OapApiV1HttpMapping.g.cs index 10a45db..5c48024 100644 --- a/src/OAP/OapApi.v1.Client/Http/OapApiV1HttpMapping.g.cs +++ b/src/OAP/OapApi.v1.Client/Http/OapApiV1HttpMapping.g.cs @@ -1,186 +1,186 @@ -// -// DO NOT EDIT: generated by fsdgencsharp -// -using System; -using System.Collections.Generic; -using System.Globalization; -using System.Net; -using System.Net.Http; -using Facility.Core; -using Facility.Core.Http; - -#pragma warning disable 612, 618 // member is obsolete - -namespace OapApi.v1.Client.Http -{ - [System.CodeDom.Compiler.GeneratedCode("fsdgencsharp", "")] - public static partial class OapApiV1HttpMapping - { - /// - /// Gets applications for the current user. - /// - public static readonly HttpMethodMapping GetApplicationsMapping = - new HttpMethodMapping.Builder - { - HttpMethod = HttpMethod.Get, - Path = "/applications", - GetUriParameters = request => - new Dictionary - { - { "status", request.Status == null ? null : request.Status.Value.ToString() }, - { "limit", request.Limit == null ? null : request.Limit.Value.ToString(CultureInfo.InvariantCulture) }, - { "nextToken", request.NextToken }, - }, - SetUriParameters = (request, parameters) => - { - parameters.TryGetValue("status", out var queryParameterStatus); - request.Status = queryParameterStatus == null ? default(ApplicationStatus?) : new ApplicationStatus(queryParameterStatus); - parameters.TryGetValue("limit", out var queryParameterLimit); - request.Limit = ServiceDataUtility.TryParseInt32(queryParameterLimit); - parameters.TryGetValue("nextToken", out var queryParameterNextToken); - request.NextToken = queryParameterNextToken; - return request; - }, - ResponseMappings = - { - new HttpResponseMapping.Builder - { - StatusCode = (HttpStatusCode) 200, - ResponseBodyType = typeof(GetApplicationsResponseDto), - }.Build(), - }, - }.Build(); - - /// - /// Creates a new application for the current user. - /// - public static readonly HttpMethodMapping CreateApplicationMapping = - new HttpMethodMapping.Builder - { - HttpMethod = HttpMethod.Post, - Path = "/applications/", - ValidateRequest = request => - { - if (request.ApplicationCreateSet == null) - return ServiceResult.Failure(ServiceErrors.CreateRequestFieldRequired("applicationCreateSet")); - return ServiceResult.Success(); - }, - RequestBodyType = typeof(ApplicationCreateSetDto), - GetRequestBody = request => request.ApplicationCreateSet, - CreateRequest = body => new CreateApplicationRequestDto { ApplicationCreateSet = (ApplicationCreateSetDto) body }, - ResponseMappings = - { - new HttpResponseMapping.Builder - { - StatusCode = (HttpStatusCode) 200, - ResponseBodyType = typeof(ApplicationDto), - MatchesResponse = response => response.Application != null, - GetResponseBody = response => response.Application, - CreateResponse = body => new CreateApplicationResponseDto { Application = (ApplicationDto) body }, - }.Build(), - new HttpResponseMapping.Builder - { - StatusCode = (HttpStatusCode) 201, - }.Build(), - }, - }.Build(); - - /// - /// Gets the specified application for the current user. - /// - public static readonly HttpMethodMapping GetApplicationMapping = - new HttpMethodMapping.Builder - { - HttpMethod = HttpMethod.Get, - Path = "/applications/{id}", - ValidateRequest = request => - { - if (string.IsNullOrEmpty(request.Id)) - return ServiceResult.Failure(ServiceErrors.CreateRequestFieldRequired("id")); - return ServiceResult.Success(); - }, - GetUriParameters = request => - new Dictionary - { - { "id", request.Id }, - }, - SetUriParameters = (request, parameters) => - { - parameters.TryGetValue("id", out var queryParameterId); - request.Id = queryParameterId; - return request; - }, - ResponseMappings = - { - new HttpResponseMapping.Builder - { - StatusCode = (HttpStatusCode) 200, - ResponseBodyType = typeof(ApplicationDto), - MatchesResponse = response => response.Application != null, - GetResponseBody = response => response.Application, - CreateResponse = body => new GetApplicationResponseDto { Application = (ApplicationDto) body }, - }.Build(), - new HttpResponseMapping.Builder - { - StatusCode = (HttpStatusCode) 304, - MatchesResponse = response => response.NotModified.GetValueOrDefault(), - CreateResponse = body => new GetApplicationResponseDto { NotModified = true }, - }.Build(), - }, - GetResponseHeaders = response => - new Dictionary - { - ["eTag"] = response.ETag, - }, - SetResponseHeaders = (response, headers) => - { - headers.TryGetValue("eTag", out var headerETag); - response.ETag = headerETag; - return response; - }, - }.Build(); - - /// - /// Updates the application. - /// - public static readonly HttpMethodMapping UpdateApplicationMapping = - new HttpMethodMapping.Builder - { - HttpMethod = new HttpMethod("PATCH"), - Path = "/applications/{id}", - ValidateRequest = request => - { - if (string.IsNullOrEmpty(request.Id)) - return ServiceResult.Failure(ServiceErrors.CreateRequestFieldRequired("id")); - if (request.ApplicationChangeSet == null) - return ServiceResult.Failure(ServiceErrors.CreateRequestFieldRequired("applicationChangeSet")); - return ServiceResult.Success(); - }, - GetUriParameters = request => - new Dictionary - { - { "id", request.Id }, - }, - SetUriParameters = (request, parameters) => - { - parameters.TryGetValue("id", out var queryParameterId); - request.Id = queryParameterId; - return request; - }, - RequestBodyType = typeof(ApplicationChangeSetDto), - GetRequestBody = request => request.ApplicationChangeSet, - CreateRequest = body => new UpdateApplicationRequestDto { ApplicationChangeSet = (ApplicationChangeSetDto) body }, - ResponseMappings = - { - new HttpResponseMapping.Builder - { - StatusCode = (HttpStatusCode) 200, - ResponseBodyType = typeof(ApplicationDto), - MatchesResponse = response => response.Application != null, - GetResponseBody = response => response.Application, - CreateResponse = body => new UpdateApplicationResponseDto { Application = (ApplicationDto) body }, - }.Build(), - }, - }.Build(); - } -} +// +// DO NOT EDIT: generated by fsdgencsharp +// +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Net; +using System.Net.Http; +using Facility.Core; +using Facility.Core.Http; + +#pragma warning disable 612, 618 // member is obsolete + +namespace OapApi.v1.Client.Http +{ + [System.CodeDom.Compiler.GeneratedCode("fsdgencsharp", "")] + public static partial class OapApiV1HttpMapping + { + /// + /// Gets applications for the current user. + /// + public static readonly HttpMethodMapping GetApplicationsMapping = + new HttpMethodMapping.Builder + { + HttpMethod = HttpMethod.Get, + Path = "/applications", + GetUriParameters = request => + new Dictionary + { + { "status", request.Status == null ? null : request.Status.Value.ToString() }, + { "limit", request.Limit == null ? null : request.Limit.Value.ToString(CultureInfo.InvariantCulture) }, + { "nextToken", request.NextToken }, + }, + SetUriParameters = (request, parameters) => + { + parameters.TryGetValue("status", out var queryParameterStatus); + request.Status = queryParameterStatus == null ? default(ApplicationStatus?) : new ApplicationStatus(queryParameterStatus); + parameters.TryGetValue("limit", out var queryParameterLimit); + request.Limit = ServiceDataUtility.TryParseInt32(queryParameterLimit); + parameters.TryGetValue("nextToken", out var queryParameterNextToken); + request.NextToken = queryParameterNextToken; + return request; + }, + ResponseMappings = + { + new HttpResponseMapping.Builder + { + StatusCode = (HttpStatusCode) 200, + ResponseBodyType = typeof(GetApplicationsResponseDto), + }.Build(), + }, + }.Build(); + + /// + /// Creates a new application for the current user. + /// + public static readonly HttpMethodMapping CreateApplicationMapping = + new HttpMethodMapping.Builder + { + HttpMethod = HttpMethod.Post, + Path = "/applications/", + ValidateRequest = request => + { + if (request.ApplicationCreateSet == null) + return ServiceResult.Failure(ServiceErrors.CreateRequestFieldRequired("applicationCreateSet")); + return ServiceResult.Success(); + }, + RequestBodyType = typeof(ApplicationCreateSetDto), + GetRequestBody = request => request.ApplicationCreateSet, + CreateRequest = body => new CreateApplicationRequestDto { ApplicationCreateSet = (ApplicationCreateSetDto) body }, + ResponseMappings = + { + new HttpResponseMapping.Builder + { + StatusCode = (HttpStatusCode) 200, + ResponseBodyType = typeof(ApplicationDto), + MatchesResponse = response => response.Application != null, + GetResponseBody = response => response.Application, + CreateResponse = body => new CreateApplicationResponseDto { Application = (ApplicationDto) body }, + }.Build(), + new HttpResponseMapping.Builder + { + StatusCode = (HttpStatusCode) 201, + }.Build(), + }, + }.Build(); + + /// + /// Gets the specified application for the current user. + /// + public static readonly HttpMethodMapping GetApplicationMapping = + new HttpMethodMapping.Builder + { + HttpMethod = HttpMethod.Get, + Path = "/applications/{id}", + ValidateRequest = request => + { + if (string.IsNullOrEmpty(request.Id)) + return ServiceResult.Failure(ServiceErrors.CreateRequestFieldRequired("id")); + return ServiceResult.Success(); + }, + GetUriParameters = request => + new Dictionary + { + { "id", request.Id }, + }, + SetUriParameters = (request, parameters) => + { + parameters.TryGetValue("id", out var queryParameterId); + request.Id = queryParameterId; + return request; + }, + ResponseMappings = + { + new HttpResponseMapping.Builder + { + StatusCode = (HttpStatusCode) 200, + ResponseBodyType = typeof(ApplicationDto), + MatchesResponse = response => response.Application != null, + GetResponseBody = response => response.Application, + CreateResponse = body => new GetApplicationResponseDto { Application = (ApplicationDto) body }, + }.Build(), + new HttpResponseMapping.Builder + { + StatusCode = (HttpStatusCode) 304, + MatchesResponse = response => response.NotModified.GetValueOrDefault(), + CreateResponse = body => new GetApplicationResponseDto { NotModified = true }, + }.Build(), + }, + GetResponseHeaders = response => + new Dictionary + { + ["eTag"] = response.ETag, + }, + SetResponseHeaders = (response, headers) => + { + headers.TryGetValue("eTag", out var headerETag); + response.ETag = headerETag; + return response; + }, + }.Build(); + + /// + /// Updates the application. + /// + public static readonly HttpMethodMapping UpdateApplicationMapping = + new HttpMethodMapping.Builder + { + HttpMethod = new HttpMethod("PATCH"), + Path = "/applications/{id}", + ValidateRequest = request => + { + if (string.IsNullOrEmpty(request.Id)) + return ServiceResult.Failure(ServiceErrors.CreateRequestFieldRequired("id")); + if (request.ApplicationChangeSet == null) + return ServiceResult.Failure(ServiceErrors.CreateRequestFieldRequired("applicationChangeSet")); + return ServiceResult.Success(); + }, + GetUriParameters = request => + new Dictionary + { + { "id", request.Id }, + }, + SetUriParameters = (request, parameters) => + { + parameters.TryGetValue("id", out var queryParameterId); + request.Id = queryParameterId; + return request; + }, + RequestBodyType = typeof(ApplicationChangeSetDto), + GetRequestBody = request => request.ApplicationChangeSet, + CreateRequest = body => new UpdateApplicationRequestDto { ApplicationChangeSet = (ApplicationChangeSetDto) body }, + ResponseMappings = + { + new HttpResponseMapping.Builder + { + StatusCode = (HttpStatusCode) 200, + ResponseBodyType = typeof(ApplicationDto), + MatchesResponse = response => response.Application != null, + GetResponseBody = response => response.Application, + CreateResponse = body => new UpdateApplicationResponseDto { Application = (ApplicationDto) body }, + }.Build(), + }, + }.Build(); + } +} diff --git a/src/OAP/OapApi.v1.Client/IOapApiV1.g.cs b/src/OAP/OapApi.v1.Client/IOapApiV1.g.cs index 06de5f2..4cee431 100644 --- a/src/OAP/OapApi.v1.Client/IOapApiV1.g.cs +++ b/src/OAP/OapApi.v1.Client/IOapApiV1.g.cs @@ -1,34 +1,34 @@ -// -// DO NOT EDIT: generated by fsdgencsharp -// -using System; -using System.Threading; -using System.Threading.Tasks; -using Facility.Core; - -namespace OapApi.v1.Client -{ - [System.CodeDom.Compiler.GeneratedCode("fsdgencsharp", "")] - public partial interface IOapApiV1 - { - /// - /// Gets applications for the current user. - /// - Task> GetApplicationsAsync(GetApplicationsRequestDto request, CancellationToken cancellationToken = default); - - /// - /// Creates a new application for the current user. - /// - Task> CreateApplicationAsync(CreateApplicationRequestDto request, CancellationToken cancellationToken = default); - - /// - /// Gets the specified application for the current user. - /// - Task> GetApplicationAsync(GetApplicationRequestDto request, CancellationToken cancellationToken = default); - - /// - /// Updates the application. - /// - Task> UpdateApplicationAsync(UpdateApplicationRequestDto request, CancellationToken cancellationToken = default); - } -} +// +// DO NOT EDIT: generated by fsdgencsharp +// +using System; +using System.Threading; +using System.Threading.Tasks; +using Facility.Core; + +namespace OapApi.v1.Client +{ + [System.CodeDom.Compiler.GeneratedCode("fsdgencsharp", "")] + public partial interface IOapApiV1 + { + /// + /// Gets applications for the current user. + /// + Task> GetApplicationsAsync(GetApplicationsRequestDto request, CancellationToken cancellationToken = default); + + /// + /// Creates a new application for the current user. + /// + Task> CreateApplicationAsync(CreateApplicationRequestDto request, CancellationToken cancellationToken = default); + + /// + /// Gets the specified application for the current user. + /// + Task> GetApplicationAsync(GetApplicationRequestDto request, CancellationToken cancellationToken = default); + + /// + /// Updates the application. + /// + Task> UpdateApplicationAsync(UpdateApplicationRequestDto request, CancellationToken cancellationToken = default); + } +} diff --git a/src/OAP/OapApi.v1.Client/OapApiV1Methods.g.cs b/src/OAP/OapApi.v1.Client/OapApiV1Methods.g.cs index 9578cba..4cf1866 100644 --- a/src/OAP/OapApi.v1.Client/OapApiV1Methods.g.cs +++ b/src/OAP/OapApi.v1.Client/OapApiV1Methods.g.cs @@ -1,28 +1,28 @@ -// -// DO NOT EDIT: generated by fsdgencsharp -// -using System; -using Facility.Core; - -namespace OapApi.v1.Client -{ - [System.CodeDom.Compiler.GeneratedCode("fsdgencsharp", "")] - internal static class OapApiV1Methods - { - public static readonly IServiceMethodInfo GetApplications = - ServiceMethodInfo.Create( - "getApplications", "OapApiV1", x => x.GetApplicationsAsync); - - public static readonly IServiceMethodInfo CreateApplication = - ServiceMethodInfo.Create( - "createApplication", "OapApiV1", x => x.CreateApplicationAsync); - - public static readonly IServiceMethodInfo GetApplication = - ServiceMethodInfo.Create( - "getApplication", "OapApiV1", x => x.GetApplicationAsync); - - public static readonly IServiceMethodInfo UpdateApplication = - ServiceMethodInfo.Create( - "updateApplication", "OapApiV1", x => x.UpdateApplicationAsync); - } -} +// +// DO NOT EDIT: generated by fsdgencsharp +// +using System; +using Facility.Core; + +namespace OapApi.v1.Client +{ + [System.CodeDom.Compiler.GeneratedCode("fsdgencsharp", "")] + internal static class OapApiV1Methods + { + public static readonly IServiceMethodInfo GetApplications = + ServiceMethodInfo.Create( + "getApplications", "OapApiV1", x => x.GetApplicationsAsync); + + public static readonly IServiceMethodInfo CreateApplication = + ServiceMethodInfo.Create( + "createApplication", "OapApiV1", x => x.CreateApplicationAsync); + + public static readonly IServiceMethodInfo GetApplication = + ServiceMethodInfo.Create( + "getApplication", "OapApiV1", x => x.GetApplicationAsync); + + public static readonly IServiceMethodInfo UpdateApplication = + ServiceMethodInfo.Create( + "updateApplication", "OapApiV1", x => x.UpdateApplicationAsync); + } +} diff --git a/src/OAP/OapApi.v1.Client/UpdateApplicationRequestDto.g.cs b/src/OAP/OapApi.v1.Client/UpdateApplicationRequestDto.g.cs index 2bf1f99..089462c 100644 --- a/src/OAP/OapApi.v1.Client/UpdateApplicationRequestDto.g.cs +++ b/src/OAP/OapApi.v1.Client/UpdateApplicationRequestDto.g.cs @@ -1,48 +1,48 @@ -// -// DO NOT EDIT: generated by fsdgencsharp -// -using System; -using System.Collections.Generic; -using Facility.Core; - -namespace OapApi.v1.Client -{ - /// - /// Request for UpdateApplication. - /// - [System.CodeDom.Compiler.GeneratedCode("fsdgencsharp", "")] - public sealed partial class UpdateApplicationRequestDto : ServiceDto - { - /// - /// Creates an instance. - /// - public UpdateApplicationRequestDto() - { - } - - /// - /// The application ID. - /// - public string Id { get; set; } - - /// - /// The application update set. - /// - public ApplicationChangeSetDto ApplicationChangeSet { get; set; } - - /// - /// The JSON serializer. - /// - protected override JsonServiceSerializer JsonSerializer => SystemTextJsonServiceSerializer.Instance; - - /// - /// Determines if two DTOs are equivalent. - /// - public override bool IsEquivalentTo(UpdateApplicationRequestDto other) - { - return other != null && - Id == other.Id && - ServiceDataUtility.AreEquivalentDtos(ApplicationChangeSet, other.ApplicationChangeSet); - } - } -} +// +// DO NOT EDIT: generated by fsdgencsharp +// +using System; +using System.Collections.Generic; +using Facility.Core; + +namespace OapApi.v1.Client +{ + /// + /// Request for UpdateApplication. + /// + [System.CodeDom.Compiler.GeneratedCode("fsdgencsharp", "")] + public sealed partial class UpdateApplicationRequestDto : ServiceDto + { + /// + /// Creates an instance. + /// + public UpdateApplicationRequestDto() + { + } + + /// + /// The application ID. + /// + public string Id { get; set; } + + /// + /// The application update set. + /// + public ApplicationChangeSetDto ApplicationChangeSet { get; set; } + + /// + /// The JSON serializer. + /// + protected override JsonServiceSerializer JsonSerializer => SystemTextJsonServiceSerializer.Instance; + + /// + /// Determines if two DTOs are equivalent. + /// + public override bool IsEquivalentTo(UpdateApplicationRequestDto other) + { + return other != null && + Id == other.Id && + ServiceDataUtility.AreEquivalentDtos(ApplicationChangeSet, other.ApplicationChangeSet); + } + } +} diff --git a/src/OAP/OapApi.v1.Client/UpdateApplicationResponseDto.g.cs b/src/OAP/OapApi.v1.Client/UpdateApplicationResponseDto.g.cs index 356ea68..660d4c3 100644 --- a/src/OAP/OapApi.v1.Client/UpdateApplicationResponseDto.g.cs +++ b/src/OAP/OapApi.v1.Client/UpdateApplicationResponseDto.g.cs @@ -1,42 +1,42 @@ -// -// DO NOT EDIT: generated by fsdgencsharp -// -using System; -using System.Collections.Generic; -using Facility.Core; - -namespace OapApi.v1.Client -{ - /// - /// Response for UpdateApplication. - /// - [System.CodeDom.Compiler.GeneratedCode("fsdgencsharp", "")] - public sealed partial class UpdateApplicationResponseDto : ServiceDto - { - /// - /// Creates an instance. - /// - public UpdateApplicationResponseDto() - { - } - - /// - /// The updated Application. - /// - public ApplicationDto Application { get; set; } - - /// - /// The JSON serializer. - /// - protected override JsonServiceSerializer JsonSerializer => SystemTextJsonServiceSerializer.Instance; - - /// - /// Determines if two DTOs are equivalent. - /// - public override bool IsEquivalentTo(UpdateApplicationResponseDto other) - { - return other != null && - ServiceDataUtility.AreEquivalentDtos(Application, other.Application); - } - } -} +// +// DO NOT EDIT: generated by fsdgencsharp +// +using System; +using System.Collections.Generic; +using Facility.Core; + +namespace OapApi.v1.Client +{ + /// + /// Response for UpdateApplication. + /// + [System.CodeDom.Compiler.GeneratedCode("fsdgencsharp", "")] + public sealed partial class UpdateApplicationResponseDto : ServiceDto + { + /// + /// Creates an instance. + /// + public UpdateApplicationResponseDto() + { + } + + /// + /// The updated Application. + /// + public ApplicationDto Application { get; set; } + + /// + /// The JSON serializer. + /// + protected override JsonServiceSerializer JsonSerializer => SystemTextJsonServiceSerializer.Instance; + + /// + /// Determines if two DTOs are equivalent. + /// + public override bool IsEquivalentTo(UpdateApplicationResponseDto other) + { + return other != null && + ServiceDataUtility.AreEquivalentDtos(Application, other.Application); + } + } +} diff --git a/src/OAP/OapApi.v1/OapApiV1.cs b/src/OAP/OapApi.v1/OapApiV1.cs index 9805551..c7f53c6 100644 --- a/src/OAP/OapApi.v1/OapApiV1.cs +++ b/src/OAP/OapApi.v1/OapApiV1.cs @@ -1,35 +1,49 @@ -using Facility.Core; -using Microsoft.AspNetCore.Mvc; -using OapApi.v1.Client; - -namespace OapApi.v1; - -public sealed class OapApiV1 : IOapApiV1 -{ - public OapApiV1() - { - - } - - public Task> CreateApplicationAsync(CreateApplicationRequestDto request, CancellationToken cancellationToken = default) => throw new NotImplementedException(); - - public Task> GetApplicationAsync(GetApplicationRequestDto request, CancellationToken cancellationToken = default) - { - return Task.FromResult(ServiceResult.Success(new GetApplicationResponseDto - { - Application = new ApplicationDto - { - Id = "1", - Status = ApplicationStatus.InProgress, - Terms = new ApplicationTermsDto - { - HasReadInstructions = true, - } - } - })); - } - - public Task> GetApplicationsAsync(GetApplicationsRequestDto request, CancellationToken cancellationToken = default) => throw new NotImplementedException(); - - public Task> UpdateApplicationAsync(UpdateApplicationRequestDto request, CancellationToken cancellationToken = default) => throw new NotImplementedException(); -} +using Facility.Core; +using Microsoft.AspNetCore.Mvc; +using OapApi.v1.Client; + +namespace OapApi.v1; + +public sealed class OapApiV1 : IOapApiV1 +{ + public OapApiV1() + { + + } + + public Task> CreateApplicationAsync(CreateApplicationRequestDto request, CancellationToken cancellationToken = default) + { + return Task.FromResult(ServiceResult.Success(new CreateApplicationResponseDto + { + Application = new ApplicationDto + { + Id = "-1", + Status = ApplicationStatus.InProgress, + Terms = new ApplicationTermsDto + { + HasReadInstructions = request.ApplicationCreateSet.Terms.HasReadInstructions, + } + } + })); + } + + public Task> GetApplicationAsync(GetApplicationRequestDto request, CancellationToken cancellationToken = default) + { + return Task.FromResult(ServiceResult.Success(new GetApplicationResponseDto + { + Application = new ApplicationDto + { + Id = "1", + Status = ApplicationStatus.InProgress, + Terms = new ApplicationTermsDto + { + HasReadInstructions = true, + } + } + })); + } + + public Task> GetApplicationsAsync(GetApplicationsRequestDto request, CancellationToken cancellationToken = default) => throw new NotImplementedException(); + + public Task> UpdateApplicationAsync(UpdateApplicationRequestDto request, CancellationToken cancellationToken = default) => throw new NotImplementedException(); +} diff --git a/src/OAP/OapApi.v1/Startup.cs b/src/OAP/OapApi.v1/Startup.cs index 1177aad..756b180 100644 --- a/src/OAP/OapApi.v1/Startup.cs +++ b/src/OAP/OapApi.v1/Startup.cs @@ -1,34 +1,35 @@ -using Facility.AspNetCore; -using Facility.Core.Http; -using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Routing; -using Microsoft.Extensions.DependencyInjection; -using OapApi.v1.Client; -using OapApi.v1.Client.Http; - -namespace OapApi.v1 -{ - public class Startup : OrchardCore.Modules.StartupBase - { - public override void ConfigureServices(IServiceCollection services) - { - services.AddScoped(); - - services.AddScoped(sp => - { - return new OapApiV1HttpHandler( - sp.GetRequiredService(), - new ServiceHttpHandlerSettings - { - RootPath = "/oap/api/v1", - }); - }); - } - - public override void Configure(IApplicationBuilder builder, IEndpointRouteBuilder routes, IServiceProvider serviceProvider) - { - builder.UseFacilityExceptionHandler(); - builder.UseFacilityHttpHandler(); - } - } -} +using Facility.AspNetCore; +using Facility.Core.Http; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Routing; +using Microsoft.Extensions.DependencyInjection; +using OapApi.v1.Client; +using OapApi.v1.Client.Http; +using OrchardCore.Mvc.Core.Utilities; + +namespace OapApi.v1 +{ + public class Startup : OrchardCore.Modules.StartupBase + { + public override void ConfigureServices(IServiceCollection services) + { + services.AddScoped(); + + services.AddScoped(sp => + { + return new OapApiV1HttpHandler( + sp.GetRequiredService(), + new ServiceHttpHandlerSettings + { + RootPath = "/oap/api/v1", + }); + }); + } + + public override void Configure(IApplicationBuilder builder, IEndpointRouteBuilder routes, IServiceProvider serviceProvider) + { + builder.UseFacilityExceptionHandler(); + builder.UseFacilityHttpHandler(); + } + } +}