From e410f8aa774db09a46743ba222a99faa3221b16a Mon Sep 17 00:00:00 2001 From: "fern-api[bot]" <115122769+fern-api[bot]@users.noreply.github.com> Date: Wed, 29 Apr 2026 18:12:52 +0000 Subject: [PATCH] SDK regeneration --- reference.md | 68 ++-- .../Clients/Connections/ConnectionsClient.cs | 2 +- .../Connections/ConnectionsClient.cs | 2 +- .../Events/EventsClient.cs | 10 +- .../SubscribeEventsRequestParameters.cs | 3 +- .../Flows/Executions/ExecutionsClient.cs | 11 +- src/Auth0.ManagementApi/Flows/FlowsClient.cs | 22 +- src/Auth0.ManagementApi/Forms/FormsClient.cs | 22 +- .../ClientGrants/ClientGrantsClient.cs | 2 +- .../ResourceServers/ResourceServersClient.cs | 2 +- ...AssertionDecryptionAlgorithmProfileEnum.cs | 124 +++++++ .../ConnectionAssertionDecryptionSettings.cs | 38 +++ .../Types/ConnectionOptionsCommonSaml.cs | 4 + .../Types/ConnectionOptionsPingFederate.cs | 4 + .../Types/ConnectionOptionsSaml.cs | 4 + .../Types/ConnectionPropertiesOptions.cs | 4 + ...ventStreamSubscribeEventsEventTypeParam.cs | 312 ------------------ .../Types/UpdateConnectionOptions.cs | 4 + .../MockServer/Clients/Connections/GetTest.cs | 2 +- .../Unit/MockServer/Connections/ListTest.cs | 2 +- .../MockServer/Flows/Executions/GetTest.cs | 11 +- .../Unit/MockServer/Flows/GetTest.cs | 11 +- .../Unit/MockServer/Flows/ListTest.cs | 11 +- .../Unit/MockServer/Forms/GetTest.cs | 11 +- .../Unit/MockServer/Forms/ListTest.cs | 11 +- .../Organizations/ClientGrants/ListTest.cs | 2 +- .../MockServer/ResourceServers/ListTest.cs | 2 +- 27 files changed, 265 insertions(+), 436 deletions(-) create mode 100644 src/Auth0.ManagementApi/Types/ConnectionAssertionDecryptionAlgorithmProfileEnum.cs create mode 100644 src/Auth0.ManagementApi/Types/ConnectionAssertionDecryptionSettings.cs delete mode 100644 src/Auth0.ManagementApi/Types/EventStreamSubscribeEventsEventTypeParam.cs diff --git a/reference.md b/reference.md index d307e7c6c..8106b4045 100644 --- a/reference.md +++ b/reference.md @@ -1805,7 +1805,7 @@ await client.Connections.ListAsync( { From = "from", Take = 1, - Strategy = [new List() { ConnectionStrategyEnum.Ad }], + Strategy = new List() { ConnectionStrategyEnum.Ad }, Name = "name", Fields = "fields", IncludeFields = true, @@ -3418,7 +3418,10 @@ client.Events.SubscribeAsync( { From = "from", FromTimestamp = "from_timestamp", - EventType = EventStreamSubscribeEventsEventTypeEnum.GroupCreated, + EventType = new List() + { + EventStreamSubscribeEventsEventTypeEnum.GroupCreated, + }, } ); ``` @@ -3467,13 +3470,10 @@ await client.Flows.ListAsync( Page = 1, PerPage = 1, IncludeTotals = true, - Hydrate = - [ - new List() - { - ListFlowsRequestParametersHydrateEnum.FormCount, - }, - ], + Hydrate = new List() + { + ListFlowsRequestParametersHydrateEnum.FormCount, + }, Synchronous = true, } ); @@ -3560,13 +3560,10 @@ await client.Flows.GetAsync( "id", new GetFlowRequestParameters { - Hydrate = - [ - new List() - { - GetFlowRequestParametersHydrateEnum.FormCount, - }, - ], + Hydrate = new List() + { + GetFlowRequestParametersHydrateEnum.FormCount, + }, } ); ``` @@ -3711,13 +3708,10 @@ await client.Forms.ListAsync( Page = 1, PerPage = 1, IncludeTotals = true, - Hydrate = - [ - new List() - { - FormsRequestParametersHydrateEnum.FlowCount, - }, - ], + Hydrate = new List() + { + FormsRequestParametersHydrateEnum.FlowCount, + }, } ); ``` @@ -3803,13 +3797,10 @@ await client.Forms.GetAsync( "id", new GetFormRequestParameters { - Hydrate = - [ - new List() - { - FormsRequestParametersHydrateEnum.FlowCount, - }, - ], + Hydrate = new List() + { + FormsRequestParametersHydrateEnum.FlowCount, + }, } ); ``` @@ -6696,7 +6687,7 @@ Retrieve details of all APIs associated with your tenant. await client.ResourceServers.ListAsync( new ListResourceServerRequestParameters { - Identifiers = [new List() { "identifiers" }], + Identifiers = new List() { "identifiers" }, Page = 1, PerPage = 1, IncludeTotals = true, @@ -13279,7 +13270,7 @@ await client.Clients.Connections.GetAsync( "id", new ConnectionsGetRequest { - Strategy = [new List() { ConnectionStrategyEnum.Ad }], + Strategy = new List() { ConnectionStrategyEnum.Ad }, From = "from", Take = 1, Fields = "fields", @@ -15334,13 +15325,10 @@ await client.Flows.Executions.GetAsync( "execution_id", new GetFlowExecutionRequestParameters { - Hydrate = - [ - new List() - { - GetFlowExecutionRequestParametersHydrateEnum.Debug, - }, - ], + Hydrate = new List() + { + GetFlowExecutionRequestParametersHydrateEnum.Debug, + }, } ); ``` @@ -18774,7 +18762,7 @@ await client.Organizations.ClientGrants.ListAsync( { Audience = "audience", ClientId = "client_id", - GrantIds = [new List() { "grant_ids" }], + GrantIds = new List() { "grant_ids" }, Page = 1, PerPage = 1, IncludeTotals = true, diff --git a/src/Auth0.ManagementApi/Clients/Connections/ConnectionsClient.cs b/src/Auth0.ManagementApi/Clients/Connections/ConnectionsClient.cs index 9003d648e..df29fc159 100644 --- a/src/Auth0.ManagementApi/Clients/Connections/ConnectionsClient.cs +++ b/src/Auth0.ManagementApi/Clients/Connections/ConnectionsClient.cs @@ -155,7 +155,7 @@ private async Task> GetInt /// "id", /// new ConnectionsGetRequest /// { - /// Strategy = [new List<ConnectionStrategyEnum?>() { ConnectionStrategyEnum.Ad }], + /// Strategy = new List<ConnectionStrategyEnum?>() { ConnectionStrategyEnum.Ad }, /// From = "from", /// Take = 1, /// Fields = "fields", diff --git a/src/Auth0.ManagementApi/Connections/ConnectionsClient.cs b/src/Auth0.ManagementApi/Connections/ConnectionsClient.cs index cfbfcebe7..372a2b2ad 100644 --- a/src/Auth0.ManagementApi/Connections/ConnectionsClient.cs +++ b/src/Auth0.ManagementApi/Connections/ConnectionsClient.cs @@ -466,7 +466,7 @@ private async Task> UpdateAsync /// { /// From = "from", /// Take = 1, - /// Strategy = [new List<ConnectionStrategyEnum?>() { ConnectionStrategyEnum.Ad }], + /// Strategy = new List<ConnectionStrategyEnum?>() { ConnectionStrategyEnum.Ad }, /// Name = "name", /// Fields = "fields", /// IncludeFields = true, diff --git a/src/Auth0.ManagementApi/Events/EventsClient.cs b/src/Auth0.ManagementApi/Events/EventsClient.cs index bb2ed13fd..2911f2bd5 100644 --- a/src/Auth0.ManagementApi/Events/EventsClient.cs +++ b/src/Auth0.ManagementApi/Events/EventsClient.cs @@ -22,7 +22,10 @@ internal EventsClient(RawClient client) /// { /// From = "from", /// FromTimestamp = "from_timestamp", - /// EventType = EventStreamSubscribeEventsEventTypeEnum.GroupCreated, + /// EventType = new List<EventStreamSubscribeEventsEventTypeEnum?>() + /// { + /// EventStreamSubscribeEventsEventTypeEnum.GroupCreated, + /// }, /// } /// ); /// @@ -38,10 +41,7 @@ public async IAsyncEnumerable Subscri "from_timestamp", request.FromTimestamp.IsDefined ? request.FromTimestamp.Value : null ) - .AddDeepObject( - "event_type", - request.EventType.IsDefined ? request.EventType.Value : null - ) + .Add("event_type", request.EventType) .MergeAdditional(options?.AdditionalQueryParameters) .Build(); var _headers = await new Auth0.ManagementApi.Core.HeadersBuilder.Builder() diff --git a/src/Auth0.ManagementApi/Events/Requests/SubscribeEventsRequestParameters.cs b/src/Auth0.ManagementApi/Events/Requests/SubscribeEventsRequestParameters.cs index 3dfbc8f2a..112285837 100644 --- a/src/Auth0.ManagementApi/Events/Requests/SubscribeEventsRequestParameters.cs +++ b/src/Auth0.ManagementApi/Events/Requests/SubscribeEventsRequestParameters.cs @@ -22,7 +22,8 @@ public record SubscribeEventsRequestParameters /// Event type(s) to listen for. Specify multiple times for multiple types (e.g., ?event_type=user.created&event_type=user.updated). If not provided, all event types will be streamed. /// [JsonIgnore] - public Optional EventType { get; set; } + public IEnumerable EventType { get; set; } = + new List(); /// public override string ToString() diff --git a/src/Auth0.ManagementApi/Flows/Executions/ExecutionsClient.cs b/src/Auth0.ManagementApi/Flows/Executions/ExecutionsClient.cs index 1c4c6102c..c49189983 100644 --- a/src/Auth0.ManagementApi/Flows/Executions/ExecutionsClient.cs +++ b/src/Auth0.ManagementApi/Flows/Executions/ExecutionsClient.cs @@ -267,13 +267,10 @@ await ListInternalAsync(flowId, request, options, cancellationToken) /// "execution_id", /// new GetFlowExecutionRequestParameters /// { - /// Hydrate = - /// [ - /// new List<GetFlowExecutionRequestParametersHydrateEnum?>() - /// { - /// GetFlowExecutionRequestParametersHydrateEnum.Debug, - /// }, - /// ], + /// Hydrate = new List<GetFlowExecutionRequestParametersHydrateEnum?>() + /// { + /// GetFlowExecutionRequestParametersHydrateEnum.Debug, + /// }, /// } /// ); /// diff --git a/src/Auth0.ManagementApi/Flows/FlowsClient.cs b/src/Auth0.ManagementApi/Flows/FlowsClient.cs index 020572a62..88bcbee72 100644 --- a/src/Auth0.ManagementApi/Flows/FlowsClient.cs +++ b/src/Auth0.ManagementApi/Flows/FlowsClient.cs @@ -398,13 +398,10 @@ private async Task> UpdateAsyncCore( /// Page = 1, /// PerPage = 1, /// IncludeTotals = true, - /// Hydrate = - /// [ - /// new List<ListFlowsRequestParametersHydrateEnum?>() - /// { - /// ListFlowsRequestParametersHydrateEnum.FormCount, - /// }, - /// ], + /// Hydrate = new List<ListFlowsRequestParametersHydrateEnum?>() + /// { + /// ListFlowsRequestParametersHydrateEnum.FormCount, + /// }, /// Synchronous = true, /// } /// ); @@ -462,13 +459,10 @@ public WithRawResponseTask CreateAsync( /// "id", /// new GetFlowRequestParameters /// { - /// Hydrate = - /// [ - /// new List<GetFlowRequestParametersHydrateEnum?>() - /// { - /// GetFlowRequestParametersHydrateEnum.FormCount, - /// }, - /// ], + /// Hydrate = new List<GetFlowRequestParametersHydrateEnum?>() + /// { + /// GetFlowRequestParametersHydrateEnum.FormCount, + /// }, /// } /// ); /// diff --git a/src/Auth0.ManagementApi/Forms/FormsClient.cs b/src/Auth0.ManagementApi/Forms/FormsClient.cs index b48f0ecaf..5c5385bf9 100644 --- a/src/Auth0.ManagementApi/Forms/FormsClient.cs +++ b/src/Auth0.ManagementApi/Forms/FormsClient.cs @@ -388,13 +388,10 @@ private async Task> UpdateAsyncCore( /// Page = 1, /// PerPage = 1, /// IncludeTotals = true, - /// Hydrate = - /// [ - /// new List<FormsRequestParametersHydrateEnum?>() - /// { - /// FormsRequestParametersHydrateEnum.FlowCount, - /// }, - /// ], + /// Hydrate = new List<FormsRequestParametersHydrateEnum?>() + /// { + /// FormsRequestParametersHydrateEnum.FlowCount, + /// }, /// } /// ); /// @@ -451,13 +448,10 @@ public WithRawResponseTask CreateAsync( /// "id", /// new GetFormRequestParameters /// { - /// Hydrate = - /// [ - /// new List<FormsRequestParametersHydrateEnum?>() - /// { - /// FormsRequestParametersHydrateEnum.FlowCount, - /// }, - /// ], + /// Hydrate = new List<FormsRequestParametersHydrateEnum?>() + /// { + /// FormsRequestParametersHydrateEnum.FlowCount, + /// }, /// } /// ); /// diff --git a/src/Auth0.ManagementApi/Organizations/ClientGrants/ClientGrantsClient.cs b/src/Auth0.ManagementApi/Organizations/ClientGrants/ClientGrantsClient.cs index 3cc356802..6a6373bed 100644 --- a/src/Auth0.ManagementApi/Organizations/ClientGrants/ClientGrantsClient.cs +++ b/src/Auth0.ManagementApi/Organizations/ClientGrants/ClientGrantsClient.cs @@ -235,7 +235,7 @@ private async Task< /// { /// Audience = "audience", /// ClientId = "client_id", - /// GrantIds = [new List<string?>() { "grant_ids" }], + /// GrantIds = new List<string?>() { "grant_ids" }, /// Page = 1, /// PerPage = 1, /// IncludeTotals = true, diff --git a/src/Auth0.ManagementApi/ResourceServers/ResourceServersClient.cs b/src/Auth0.ManagementApi/ResourceServers/ResourceServersClient.cs index 95d637391..7d92e028b 100644 --- a/src/Auth0.ManagementApi/ResourceServers/ResourceServersClient.cs +++ b/src/Auth0.ManagementApi/ResourceServers/ResourceServersClient.cs @@ -417,7 +417,7 @@ private async Task> UpdateA /// await client.ResourceServers.ListAsync( /// new ListResourceServerRequestParameters /// { - /// Identifiers = [new List<string?>() { "identifiers" }], + /// Identifiers = new List<string?>() { "identifiers" }, /// Page = 1, /// PerPage = 1, /// IncludeTotals = true, diff --git a/src/Auth0.ManagementApi/Types/ConnectionAssertionDecryptionAlgorithmProfileEnum.cs b/src/Auth0.ManagementApi/Types/ConnectionAssertionDecryptionAlgorithmProfileEnum.cs new file mode 100644 index 000000000..f10d514f9 --- /dev/null +++ b/src/Auth0.ManagementApi/Types/ConnectionAssertionDecryptionAlgorithmProfileEnum.cs @@ -0,0 +1,124 @@ +using Auth0.ManagementApi.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace Auth0.ManagementApi; + +[JsonConverter( + typeof(ConnectionAssertionDecryptionAlgorithmProfileEnum.ConnectionAssertionDecryptionAlgorithmProfileEnumSerializer) +)] +[Serializable] +public readonly record struct ConnectionAssertionDecryptionAlgorithmProfileEnum : IStringEnum +{ + public static readonly ConnectionAssertionDecryptionAlgorithmProfileEnum V20261 = new( + Values.V20261 + ); + + public ConnectionAssertionDecryptionAlgorithmProfileEnum(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static ConnectionAssertionDecryptionAlgorithmProfileEnum FromCustom(string value) + { + return new ConnectionAssertionDecryptionAlgorithmProfileEnum(value); + } + + public bool Equals(string? other) + { + return Value.Equals(other); + } + + /// + /// Returns the string value of the enum. + /// + public override string ToString() + { + return Value; + } + + public static bool operator ==( + ConnectionAssertionDecryptionAlgorithmProfileEnum value1, + string value2 + ) => value1.Value.Equals(value2); + + public static bool operator !=( + ConnectionAssertionDecryptionAlgorithmProfileEnum value1, + string value2 + ) => !value1.Value.Equals(value2); + + public static explicit operator string( + ConnectionAssertionDecryptionAlgorithmProfileEnum value + ) => value.Value; + + public static explicit operator ConnectionAssertionDecryptionAlgorithmProfileEnum( + string value + ) => new(value); + + internal class ConnectionAssertionDecryptionAlgorithmProfileEnumSerializer + : JsonConverter + { + public override ConnectionAssertionDecryptionAlgorithmProfileEnum Read( + ref Utf8JsonReader reader, + Type typeToConvert, + JsonSerializerOptions options + ) + { + var stringValue = + reader.GetString() + ?? throw new global::System.Exception( + "The JSON value could not be read as a string." + ); + return new ConnectionAssertionDecryptionAlgorithmProfileEnum(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + ConnectionAssertionDecryptionAlgorithmProfileEnum value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override ConnectionAssertionDecryptionAlgorithmProfileEnum ReadAsPropertyName( + ref Utf8JsonReader reader, + Type typeToConvert, + JsonSerializerOptions options + ) + { + var stringValue = + reader.GetString() + ?? throw new global::System.Exception( + "The JSON property name could not be read as a string." + ); + return new ConnectionAssertionDecryptionAlgorithmProfileEnum(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + ConnectionAssertionDecryptionAlgorithmProfileEnum value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string V20261 = "v2026-1"; + } +} diff --git a/src/Auth0.ManagementApi/Types/ConnectionAssertionDecryptionSettings.cs b/src/Auth0.ManagementApi/Types/ConnectionAssertionDecryptionSettings.cs new file mode 100644 index 000000000..b645cd545 --- /dev/null +++ b/src/Auth0.ManagementApi/Types/ConnectionAssertionDecryptionSettings.cs @@ -0,0 +1,38 @@ +using Auth0.ManagementApi.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace Auth0.ManagementApi; + +/// +/// Settings for SAML assertion decryption. +/// +[Serializable] +public record ConnectionAssertionDecryptionSettings : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("algorithm_profile")] + public required ConnectionAssertionDecryptionAlgorithmProfileEnum AlgorithmProfile { get; set; } + + /// + /// A list of insecure algorithms to allow for SAML assertion decryption. + /// + [Optional] + [JsonPropertyName("algorithm_exceptions")] + public IEnumerable? AlgorithmExceptions { get; set; } + + [JsonIgnore] + public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); + + void IJsonOnDeserialized.OnDeserialized() => + AdditionalProperties.CopyFromExtensionData(_extensionData); + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Auth0.ManagementApi/Types/ConnectionOptionsCommonSaml.cs b/src/Auth0.ManagementApi/Types/ConnectionOptionsCommonSaml.cs index 696092aca..fab473f73 100644 --- a/src/Auth0.ManagementApi/Types/ConnectionOptionsCommonSaml.cs +++ b/src/Auth0.ManagementApi/Types/ConnectionOptionsCommonSaml.cs @@ -14,6 +14,10 @@ public record ConnectionOptionsCommonSaml : IJsonOnDeserialized private readonly IDictionary _extensionData = new Dictionary(); + [Optional] + [JsonPropertyName("assertion_decryption_settings")] + public ConnectionAssertionDecryptionSettings? AssertionDecryptionSettings { get; set; } + [Optional] [JsonPropertyName("cert")] public string? Cert { get; set; } diff --git a/src/Auth0.ManagementApi/Types/ConnectionOptionsPingFederate.cs b/src/Auth0.ManagementApi/Types/ConnectionOptionsPingFederate.cs index 4d6ee1fa4..f8e76f3f8 100644 --- a/src/Auth0.ManagementApi/Types/ConnectionOptionsPingFederate.cs +++ b/src/Auth0.ManagementApi/Types/ConnectionOptionsPingFederate.cs @@ -21,6 +21,10 @@ public record ConnectionOptionsPingFederate : IJsonOnDeserialized, IJsonOnSerial [JsonPropertyName("signingCert")] public string? SigningCert { get; set; } + [Optional] + [JsonPropertyName("assertion_decryption_settings")] + public ConnectionAssertionDecryptionSettings? AssertionDecryptionSettings { get; set; } + [Optional] [JsonPropertyName("cert")] public string? Cert { get; set; } diff --git a/src/Auth0.ManagementApi/Types/ConnectionOptionsSaml.cs b/src/Auth0.ManagementApi/Types/ConnectionOptionsSaml.cs index a99f6d3bb..38a5d97dc 100644 --- a/src/Auth0.ManagementApi/Types/ConnectionOptionsSaml.cs +++ b/src/Auth0.ManagementApi/Types/ConnectionOptionsSaml.cs @@ -76,6 +76,10 @@ public record ConnectionOptionsSaml : IJsonOnDeserialized, IJsonOnSerializing [JsonPropertyName("user_id_attribute")] public string? UserIdAttribute { get; set; } + [Optional] + [JsonPropertyName("assertion_decryption_settings")] + public ConnectionAssertionDecryptionSettings? AssertionDecryptionSettings { get; set; } + [Optional] [JsonPropertyName("cert")] public string? Cert { get; set; } diff --git a/src/Auth0.ManagementApi/Types/ConnectionPropertiesOptions.cs b/src/Auth0.ManagementApi/Types/ConnectionPropertiesOptions.cs index 15cd4a380..2911226b3 100644 --- a/src/Auth0.ManagementApi/Types/ConnectionPropertiesOptions.cs +++ b/src/Auth0.ManagementApi/Types/ConnectionPropertiesOptions.cs @@ -158,6 +158,10 @@ public Optional?> IdTokenSignedResponseAlgs { get; set; } diff --git a/src/Auth0.ManagementApi/Types/EventStreamSubscribeEventsEventTypeParam.cs b/src/Auth0.ManagementApi/Types/EventStreamSubscribeEventsEventTypeParam.cs deleted file mode 100644 index c8be28bb5..000000000 --- a/src/Auth0.ManagementApi/Types/EventStreamSubscribeEventsEventTypeParam.cs +++ /dev/null @@ -1,312 +0,0 @@ -// ReSharper disable NullableWarningSuppressionIsUsed -// ReSharper disable InconsistentNaming - -using Auth0.ManagementApi.Core; -using global::System.Text.Json; -using global::System.Text.Json.Serialization; - -namespace Auth0.ManagementApi; - -/// -/// Event type(s) to listen for. Specify multiple times for multiple types (e.g., ?event_type=user.created&event_type=user.updated). If not provided, all event types will be streamed. -/// -[JsonConverter(typeof(EventStreamSubscribeEventsEventTypeParam.JsonConverter))] -[Serializable] -public class EventStreamSubscribeEventsEventTypeParam -{ - private EventStreamSubscribeEventsEventTypeParam(string type, object? value) - { - Type = type; - Value = value; - } - - /// - /// Type discriminator - /// - [JsonIgnore] - public string Type { get; internal set; } - - /// - /// Union value - /// - [JsonIgnore] - public object? Value { get; internal set; } - - /// - /// Factory method to create a union from a Auth0.ManagementApi.EventStreamSubscribeEventsEventTypeEnum value. - /// - public static EventStreamSubscribeEventsEventTypeParam FromEventStreamSubscribeEventsEventTypeEnum( - Auth0.ManagementApi.EventStreamSubscribeEventsEventTypeEnum value - ) => new("eventStreamSubscribeEventsEventTypeEnum", value); - - /// - /// Factory method to create a union from a IEnumerable value. - /// - public static EventStreamSubscribeEventsEventTypeParam FromListOfEventStreamSubscribeEventsEventTypeEnum( - IEnumerable value - ) => new("list", value); - - /// - /// Returns true if is "eventStreamSubscribeEventsEventTypeEnum" - /// - public bool IsEventStreamSubscribeEventsEventTypeEnum() => - Type == "eventStreamSubscribeEventsEventTypeEnum"; - - /// - /// Returns true if is "list" - /// - public bool IsListOfEventStreamSubscribeEventsEventTypeEnum() => Type == "list"; - - /// - /// Returns the value as a if is 'eventStreamSubscribeEventsEventTypeEnum', otherwise throws an exception. - /// - /// Thrown when is not 'eventStreamSubscribeEventsEventTypeEnum'. - public Auth0.ManagementApi.EventStreamSubscribeEventsEventTypeEnum AsEventStreamSubscribeEventsEventTypeEnum() => - IsEventStreamSubscribeEventsEventTypeEnum() - ? (Auth0.ManagementApi.EventStreamSubscribeEventsEventTypeEnum)Value! - : throw new ManagementException( - "Union type is not 'eventStreamSubscribeEventsEventTypeEnum'" - ); - - /// - /// Returns the value as a if is 'list', otherwise throws an exception. - /// - /// Thrown when is not 'list'. - public IEnumerable AsListOfEventStreamSubscribeEventsEventTypeEnum() => - IsListOfEventStreamSubscribeEventsEventTypeEnum() - ? (IEnumerable)Value! - : throw new ManagementException("Union type is not 'list'"); - - /// - /// Attempts to cast the value to a and returns true if successful. - /// - public bool TryGetEventStreamSubscribeEventsEventTypeEnum( - out Auth0.ManagementApi.EventStreamSubscribeEventsEventTypeEnum? value - ) - { - if (Type == "eventStreamSubscribeEventsEventTypeEnum") - { - value = (Auth0.ManagementApi.EventStreamSubscribeEventsEventTypeEnum)Value!; - return true; - } - value = null; - return false; - } - - /// - /// Attempts to cast the value to a and returns true if successful. - /// - public bool TryGetListOfEventStreamSubscribeEventsEventTypeEnum( - out IEnumerable? value - ) - { - if (Type == "list") - { - value = (IEnumerable)Value!; - return true; - } - value = null; - return false; - } - - public T Match( - Func< - Auth0.ManagementApi.EventStreamSubscribeEventsEventTypeEnum, - T - > onEventStreamSubscribeEventsEventTypeEnum, - Func< - IEnumerable, - T - > onListOfEventStreamSubscribeEventsEventTypeEnum - ) - { - return Type switch - { - "eventStreamSubscribeEventsEventTypeEnum" => onEventStreamSubscribeEventsEventTypeEnum( - AsEventStreamSubscribeEventsEventTypeEnum() - ), - "list" => onListOfEventStreamSubscribeEventsEventTypeEnum( - AsListOfEventStreamSubscribeEventsEventTypeEnum() - ), - _ => throw new ManagementException($"Unknown union type: {Type}"), - }; - } - - public void Visit( - global::System.Action onEventStreamSubscribeEventsEventTypeEnum, - global::System.Action< - IEnumerable - > onListOfEventStreamSubscribeEventsEventTypeEnum - ) - { - switch (Type) - { - case "eventStreamSubscribeEventsEventTypeEnum": - onEventStreamSubscribeEventsEventTypeEnum( - AsEventStreamSubscribeEventsEventTypeEnum() - ); - break; - case "list": - onListOfEventStreamSubscribeEventsEventTypeEnum( - AsListOfEventStreamSubscribeEventsEventTypeEnum() - ); - break; - default: - throw new ManagementException($"Unknown union type: {Type}"); - } - } - - public override int GetHashCode() - { - unchecked - { - var hashCode = Type.GetHashCode(); - if (Value != null) - { - hashCode = (hashCode * 397) ^ Value.GetHashCode(); - } - return hashCode; - } - } - - public override bool Equals(object? obj) - { - if (obj is null) - return false; - if (ReferenceEquals(this, obj)) - return true; - if (obj is not EventStreamSubscribeEventsEventTypeParam other) - return false; - - // Compare type discriminators - if (Type != other.Type) - return false; - - // Compare values using EqualityComparer for deep comparison - return System.Collections.Generic.EqualityComparer.Default.Equals( - Value, - other.Value - ); - } - - public override string ToString() => JsonUtils.Serialize(this); - - public static implicit operator EventStreamSubscribeEventsEventTypeParam( - Auth0.ManagementApi.EventStreamSubscribeEventsEventTypeEnum value - ) => new("eventStreamSubscribeEventsEventTypeEnum", value); - - [Serializable] - internal sealed class JsonConverter : JsonConverter - { - public override EventStreamSubscribeEventsEventTypeParam? Read( - ref Utf8JsonReader reader, - global::System.Type typeToConvert, - JsonSerializerOptions options - ) - { - if (reader.TokenType == JsonTokenType.Null) - { - return null; - } - - if (reader.TokenType == JsonTokenType.StartArray) - { - var document = JsonDocument.ParseValue(ref reader); - - var types = new (string Key, System.Type Type)[] - { - ("list", typeof(IEnumerable)), - }; - - foreach (var (key, type) in types) - { - try - { - var value = document.Deserialize(type, options); - if (value != null) - { - EventStreamSubscribeEventsEventTypeParam result = new(key, value); - return result; - } - } - catch (JsonException) - { - // Try next type; - } - } - } - - if (reader.TokenType == JsonTokenType.StartObject) - { - var document = JsonDocument.ParseValue(ref reader); - - var types = new (string Key, System.Type Type)[] - { - ( - "eventStreamSubscribeEventsEventTypeEnum", - typeof(Auth0.ManagementApi.EventStreamSubscribeEventsEventTypeEnum) - ), - }; - - foreach (var (key, type) in types) - { - try - { - var value = document.Deserialize(type, options); - if (value != null) - { - EventStreamSubscribeEventsEventTypeParam result = new(key, value); - return result; - } - } - catch (JsonException) - { - // Try next type; - } - } - } - - throw new JsonException( - $"Cannot deserialize JSON token {reader.TokenType} into EventStreamSubscribeEventsEventTypeParam" - ); - } - - public override void Write( - Utf8JsonWriter writer, - EventStreamSubscribeEventsEventTypeParam value, - JsonSerializerOptions options - ) - { - if (value == null) - { - writer.WriteNullValue(); - return; - } - - value.Visit( - obj => JsonSerializer.Serialize(writer, obj, options), - obj => JsonSerializer.Serialize(writer, obj, options) - ); - } - - public override EventStreamSubscribeEventsEventTypeParam ReadAsPropertyName( - ref Utf8JsonReader reader, - global::System.Type typeToConvert, - JsonSerializerOptions options - ) - { - var stringValue = reader.GetString()!; - EventStreamSubscribeEventsEventTypeParam result = new("string", stringValue); - return result; - } - - public override void WriteAsPropertyName( - Utf8JsonWriter writer, - EventStreamSubscribeEventsEventTypeParam value, - JsonSerializerOptions options - ) - { - writer.WritePropertyName(value.Value?.ToString() ?? "null"); - } - } -} diff --git a/src/Auth0.ManagementApi/Types/UpdateConnectionOptions.cs b/src/Auth0.ManagementApi/Types/UpdateConnectionOptions.cs index 3078abe17..467caf270 100644 --- a/src/Auth0.ManagementApi/Types/UpdateConnectionOptions.cs +++ b/src/Auth0.ManagementApi/Types/UpdateConnectionOptions.cs @@ -158,6 +158,10 @@ public Optional?> IdTokenSignedResponseAlgs { get; set; } diff --git a/tests/Auth0.ManagementApi.Test/Unit/MockServer/Clients/Connections/GetTest.cs b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Clients/Connections/GetTest.cs index ac6451a26..2489e3d38 100644 --- a/tests/Auth0.ManagementApi.Test/Unit/MockServer/Clients/Connections/GetTest.cs +++ b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Clients/Connections/GetTest.cs @@ -61,7 +61,7 @@ public async Task MockServerTest() "id", new ConnectionsGetRequest { - Strategy = [new List() { ConnectionStrategyEnum.Ad }], + Strategy = new List() { ConnectionStrategyEnum.Ad }, From = "from", Take = 1, Fields = "fields", diff --git a/tests/Auth0.ManagementApi.Test/Unit/MockServer/Connections/ListTest.cs b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Connections/ListTest.cs index d8f31737b..3d7240a25 100644 --- a/tests/Auth0.ManagementApi.Test/Unit/MockServer/Connections/ListTest.cs +++ b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Connections/ListTest.cs @@ -62,7 +62,7 @@ public async Task MockServerTest() { From = "from", Take = 1, - Strategy = [new List() { ConnectionStrategyEnum.Ad }], + Strategy = new List() { ConnectionStrategyEnum.Ad }, Name = "name", Fields = "fields", IncludeFields = true, diff --git a/tests/Auth0.ManagementApi.Test/Unit/MockServer/Flows/Executions/GetTest.cs b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Flows/Executions/GetTest.cs index 0c595c4f3..7806fb3b3 100644 --- a/tests/Auth0.ManagementApi.Test/Unit/MockServer/Flows/Executions/GetTest.cs +++ b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Flows/Executions/GetTest.cs @@ -48,13 +48,10 @@ public async Task MockServerTest() "execution_id", new GetFlowExecutionRequestParameters { - Hydrate = - [ - new List() - { - GetFlowExecutionRequestParametersHydrateEnum.Debug, - }, - ], + Hydrate = new List() + { + GetFlowExecutionRequestParametersHydrateEnum.Debug, + }, } ); JsonAssert.AreEqual(response, mockResponse); diff --git a/tests/Auth0.ManagementApi.Test/Unit/MockServer/Flows/GetTest.cs b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Flows/GetTest.cs index 473e09d97..7db4982af 100644 --- a/tests/Auth0.ManagementApi.Test/Unit/MockServer/Flows/GetTest.cs +++ b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Flows/GetTest.cs @@ -49,13 +49,10 @@ public async Task MockServerTest() "id", new GetFlowRequestParameters { - Hydrate = - [ - new List() - { - GetFlowRequestParametersHydrateEnum.FormCount, - }, - ], + Hydrate = new List() + { + GetFlowRequestParametersHydrateEnum.FormCount, + }, } ); JsonAssert.AreEqual(response, mockResponse); diff --git a/tests/Auth0.ManagementApi.Test/Unit/MockServer/Flows/ListTest.cs b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Flows/ListTest.cs index 6102de11b..da8c1f821 100644 --- a/tests/Auth0.ManagementApi.Test/Unit/MockServer/Flows/ListTest.cs +++ b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Flows/ListTest.cs @@ -50,13 +50,10 @@ public async Task MockServerTest() Page = 1, PerPage = 1, IncludeTotals = true, - Hydrate = - [ - new List() - { - ListFlowsRequestParametersHydrateEnum.FormCount, - }, - ], + Hydrate = new List() + { + ListFlowsRequestParametersHydrateEnum.FormCount, + }, Synchronous = true, } ); diff --git a/tests/Auth0.ManagementApi.Test/Unit/MockServer/Forms/GetTest.cs b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Forms/GetTest.cs index 21f8138eb..7b9eac751 100644 --- a/tests/Auth0.ManagementApi.Test/Unit/MockServer/Forms/GetTest.cs +++ b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Forms/GetTest.cs @@ -96,13 +96,10 @@ public async Task MockServerTest() "id", new GetFormRequestParameters { - Hydrate = - [ - new List() - { - FormsRequestParametersHydrateEnum.FlowCount, - }, - ], + Hydrate = new List() + { + FormsRequestParametersHydrateEnum.FlowCount, + }, } ); JsonAssert.AreEqual(response, mockResponse); diff --git a/tests/Auth0.ManagementApi.Test/Unit/MockServer/Forms/ListTest.cs b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Forms/ListTest.cs index 2af51c9d2..359bd8379 100644 --- a/tests/Auth0.ManagementApi.Test/Unit/MockServer/Forms/ListTest.cs +++ b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Forms/ListTest.cs @@ -51,13 +51,10 @@ public async Task MockServerTest() Page = 1, PerPage = 1, IncludeTotals = true, - Hydrate = - [ - new List() - { - FormsRequestParametersHydrateEnum.FlowCount, - }, - ], + Hydrate = new List() + { + FormsRequestParametersHydrateEnum.FlowCount, + }, } ); await foreach (var item in items) diff --git a/tests/Auth0.ManagementApi.Test/Unit/MockServer/Organizations/ClientGrants/ListTest.cs b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Organizations/ClientGrants/ListTest.cs index 3cc1fb6ad..78b496827 100644 --- a/tests/Auth0.ManagementApi.Test/Unit/MockServer/Organizations/ClientGrants/ListTest.cs +++ b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Organizations/ClientGrants/ListTest.cs @@ -55,7 +55,7 @@ public async Task MockServerTest() { Audience = "audience", ClientId = "client_id", - GrantIds = [new List() { "grant_ids" }], + GrantIds = new List() { "grant_ids" }, Page = 1, PerPage = 1, IncludeTotals = true, diff --git a/tests/Auth0.ManagementApi.Test/Unit/MockServer/ResourceServers/ListTest.cs b/tests/Auth0.ManagementApi.Test/Unit/MockServer/ResourceServers/ListTest.cs index 18f7973b6..3c144bcea 100644 --- a/tests/Auth0.ManagementApi.Test/Unit/MockServer/ResourceServers/ListTest.cs +++ b/tests/Auth0.ManagementApi.Test/Unit/MockServer/ResourceServers/ListTest.cs @@ -76,7 +76,7 @@ public async Task MockServerTest() var items = await Client.ResourceServers.ListAsync( new ListResourceServerRequestParameters { - Identifiers = [new List() { "identifiers" }], + Identifiers = new List() { "identifiers" }, Page = 1, PerPage = 1, IncludeTotals = true,