diff --git a/.fern/replay.lock b/.fern/replay.lock index b2daa0ee6..186ad1b6c 100644 --- a/.fern/replay.lock +++ b/.fern/replay.lock @@ -12,14 +12,20 @@ generations: cli_version: unknown generator_versions: fernapi/fern-csharp-sdk: 2.66.5 -current_generation: 10833198f7f22dc8865d845f315b3f437907409f + - commit_sha: 37f75e8c5a5b37f0d7a0250b398fbe938745aa74 + tree_hash: ceecc45d28906c6f68f55eaab7c16d4c26e65860 + timestamp: 2026-05-26T04:54:24.492Z + cli_version: unknown + generator_versions: + fernapi/fern-csharp-sdk: 2.66.5 +current_generation: 37f75e8c5a5b37f0d7a0250b398fbe938745aa74 patches: - id: patch-4a7a2c3e content_hash: sha256:afae223b4593598543491ca12e36149571f886b494dcf4311dcea092548f7bd0 original_commit: 4a7a2c3e44bfc06c1f164a3c6ef0ae748ce3075b original_message: Adds extension to convert UserDateSchema to DateTime original_author: Kailash B - base_generation: 10833198f7f22dc8865d845f315b3f437907409f + base_generation: 37f75e8c5a5b37f0d7a0250b398fbe938745aa74 files: - tests/Auth0.ManagementApi.Test/Unit/Extensions/UserDateSchemaExtensionsTest.cs patch_content: | @@ -222,3 +228,413 @@ patches: } } user_owned: true + - id: patch-composite-f898e213 + content_hash: sha256:d56e03ed340b1721f26a4d7a53e8da154be48eaaeeab6b38eb1f58493a06cbf2 + original_commit: f898e213a3bde5c59096e7f5eb940e6fd76c26d8 + original_message: Customer customizations (composite) + original_author: composite + base_generation: 37f75e8c5a5b37f0d7a0250b398fbe938745aa74 + files: + - src/Auth0.ManagementApi/Core/JsonConfiguration.cs + - tests/Auth0.ManagementApi.Test/Auth0.ManagementApi.Test.csproj + patch_content: | + diff --git a/src/Auth0.ManagementApi/Core/JsonConfiguration.cs b/src/Auth0.ManagementApi/Core/JsonConfiguration.cs + index 2ef97a37..7588e83c 100644 + --- a/src/Auth0.ManagementApi/Core/JsonConfiguration.cs + +++ b/src/Auth0.ManagementApi/Core/JsonConfiguration.cs + @@ -17,6 +17,7 @@ static JsonOptions() + var options = new JsonSerializerOptions + { + Converters = { new DateTimeSerializer(), + + new BooleanStringConverter(), + #if USE_PORTABLE_DATE_ONLY + new DateOnlyConverter(), + #endif + diff --git a/tests/Auth0.ManagementApi.Test/Auth0.ManagementApi.Test.csproj b/tests/Auth0.ManagementApi.Test/Auth0.ManagementApi.Test.csproj + index ab18c1f3..63c4abb2 100644 + --- a/tests/Auth0.ManagementApi.Test/Auth0.ManagementApi.Test.csproj + +++ b/tests/Auth0.ManagementApi.Test/Auth0.ManagementApi.Test.csproj + @@ -25,7 +25,7 @@ + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + - + + + + + + theirs_snapshot: + src/Auth0.ManagementApi/Core/JsonConfiguration.cs: | + using global::System.Reflection; + using global::System.Text.Encodings.Web; + using global::System.Text.Json; + using global::System.Text.Json.Nodes; + using global::System.Text.Json.Serialization; + using global::System.Text.Json.Serialization.Metadata; + + namespace Auth0.ManagementApi.Core; + + internal static partial class JsonOptions + { + internal static readonly JsonSerializerOptions JsonSerializerOptions; + internal static readonly JsonSerializerOptions JsonSerializerOptionsRelaxedEscaping; + + static JsonOptions() + { + var options = new JsonSerializerOptions + { + Converters = { new DateTimeSerializer(), + new BooleanStringConverter(), + #if USE_PORTABLE_DATE_ONLY + new DateOnlyConverter(), + #endif + new OptionalJsonConverterFactory() }, + #if DEBUG + WriteIndented = true, + #endif + DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull, + TypeInfoResolver = new DefaultJsonTypeInfoResolver + { + Modifiers = + { + NullableOptionalModifier, + JsonAccessAndIgnoreModifier, + HandleExtensionDataFields, + }, + }, + }; + ConfigureJsonSerializerOptions(options); + JsonSerializerOptions = options; + + var relaxedOptions = new JsonSerializerOptions(options) + { + Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping, + }; + JsonSerializerOptionsRelaxedEscaping = relaxedOptions; + } + + private static void NullableOptionalModifier(JsonTypeInfo typeInfo) + { + if (typeInfo.Kind != JsonTypeInfoKind.Object) + return; + + foreach (var property in typeInfo.Properties) + { + var propertyInfo = property.AttributeProvider as global::System.Reflection.PropertyInfo; + + if (propertyInfo is null) + continue; + + // Check for ReadOnly JsonAccessAttribute - it overrides Optional/Nullable behavior + var jsonAccessAttribute = propertyInfo.GetCustomAttribute(); + if (jsonAccessAttribute?.AccessType == JsonAccessType.ReadOnly) + { + // ReadOnly means "never serialize", which completely overrides Optional/Nullable. + // Skip Optional/Nullable processing since JsonAccessAndIgnoreModifier + // will set ShouldSerialize = false anyway. + continue; + } + // Note: WriteOnly doesn't conflict with Optional/Nullable since it only + // affects deserialization (Set), not serialization (ShouldSerialize) + + var isOptionalType = + property.PropertyType.IsGenericType + && property.PropertyType.GetGenericTypeDefinition() == typeof(Optional<>); + + var hasOptionalAttribute = + propertyInfo.GetCustomAttribute() is not null; + var hasNullableAttribute = + propertyInfo.GetCustomAttribute() is not null; + + if (isOptionalType && hasOptionalAttribute) + { + var originalGetter = property.Get; + if (originalGetter is not null) + { + var capturedIsNullable = hasNullableAttribute; + + property.ShouldSerialize = (obj, value) => + { + var optionalValue = originalGetter(obj); + if (optionalValue is not IOptional optional) + return false; + + if (!optional.IsDefined) + return false; + + if (!capturedIsNullable) + { + var innerValue = optional.GetBoxedValue(); + if (innerValue is null) + return false; + } + + return true; + }; + } + } + else if (hasNullableAttribute) + { + // Force serialization of nullable properties even when null + property.ShouldSerialize = (obj, value) => true; + } + } + } + + private static void JsonAccessAndIgnoreModifier(JsonTypeInfo typeInfo) + { + if (typeInfo.Kind != JsonTypeInfoKind.Object) + return; + + foreach (var propertyInfo in typeInfo.Properties) + { + var jsonAccessAttribute = propertyInfo + .AttributeProvider?.GetCustomAttributes(typeof(JsonAccessAttribute), true) + .OfType() + .FirstOrDefault(); + + if (jsonAccessAttribute is not null) + { + propertyInfo.IsRequired = false; + switch (jsonAccessAttribute.AccessType) + { + case JsonAccessType.ReadOnly: + propertyInfo.ShouldSerialize = (_, _) => false; + break; + case JsonAccessType.WriteOnly: + propertyInfo.Set = null; + break; + default: + throw new ArgumentOutOfRangeException(); + } + } + + var jsonIgnoreAttribute = propertyInfo + .AttributeProvider?.GetCustomAttributes(typeof(JsonIgnoreAttribute), true) + .OfType() + .FirstOrDefault(); + + if (jsonIgnoreAttribute is not null) + { + propertyInfo.IsRequired = false; + } + } + } + + private static void HandleExtensionDataFields(JsonTypeInfo typeInfo) + { + if ( + typeInfo.Kind == JsonTypeInfoKind.Object + && typeInfo.Properties.All(prop => !prop.IsExtensionData) + ) + { + var extensionProp = typeInfo + .Type.GetFields(BindingFlags.Instance | BindingFlags.NonPublic) + .FirstOrDefault(prop => + prop.GetCustomAttribute() is not null + ); + + if (extensionProp is not null) + { + var jsonPropertyInfo = typeInfo.CreateJsonPropertyInfo( + extensionProp.FieldType, + extensionProp.Name + ); + jsonPropertyInfo.Get = extensionProp.GetValue; + jsonPropertyInfo.Set = extensionProp.SetValue; + jsonPropertyInfo.IsExtensionData = true; + typeInfo.Properties.Add(jsonPropertyInfo); + } + } + } + + static partial void ConfigureJsonSerializerOptions(JsonSerializerOptions defaultOptions); + } + + internal static class JsonUtils + { + internal static string Serialize(T obj) => + JsonSerializer.Serialize(obj, JsonOptions.JsonSerializerOptions); + + internal static string Serialize(object obj, global::System.Type type) => + JsonSerializer.Serialize(obj, type, JsonOptions.JsonSerializerOptions); + + internal static string SerializeRelaxedEscaping(T obj) => + JsonSerializer.Serialize(obj, JsonOptions.JsonSerializerOptionsRelaxedEscaping); + + internal static string SerializeRelaxedEscaping(object obj, global::System.Type type) => + JsonSerializer.Serialize(obj, type, JsonOptions.JsonSerializerOptionsRelaxedEscaping); + + internal static JsonElement SerializeToElement(T obj) => + JsonSerializer.SerializeToElement(obj, JsonOptions.JsonSerializerOptions); + + internal static JsonElement SerializeToElement(object obj, global::System.Type type) => + JsonSerializer.SerializeToElement(obj, type, JsonOptions.JsonSerializerOptions); + + internal static JsonDocument SerializeToDocument(T obj) => + JsonSerializer.SerializeToDocument(obj, JsonOptions.JsonSerializerOptions); + + internal static JsonNode? SerializeToNode(T obj) => + JsonSerializer.SerializeToNode(obj, JsonOptions.JsonSerializerOptions); + + internal static byte[] SerializeToUtf8Bytes(T obj) => + JsonSerializer.SerializeToUtf8Bytes(obj, JsonOptions.JsonSerializerOptions); + + internal static string SerializeWithAdditionalProperties( + T obj, + object? additionalProperties = null + ) + { + if (additionalProperties is null) + { + return Serialize(obj); + } + var additionalPropertiesJsonNode = SerializeToNode(additionalProperties); + if (additionalPropertiesJsonNode is not JsonObject additionalPropertiesJsonObject) + { + throw new InvalidOperationException( + "The additional properties must serialize to a JSON object." + ); + } + var jsonNode = SerializeToNode(obj); + if (jsonNode is not JsonObject jsonObject) + { + throw new InvalidOperationException( + "The serialized object must be a JSON object to add properties." + ); + } + MergeJsonObjects(jsonObject, additionalPropertiesJsonObject); + return jsonObject.ToJsonString(JsonOptions.JsonSerializerOptions); + } + + private static void MergeJsonObjects(JsonObject baseObject, JsonObject overrideObject) + { + foreach (var property in overrideObject) + { + if (!baseObject.TryGetPropertyValue(property.Key, out JsonNode? existingValue)) + { + baseObject[property.Key] = property.Value is not null + ? JsonNode.Parse(property.Value.ToJsonString()) + : null; + continue; + } + if ( + existingValue is JsonObject nestedBaseObject + && property.Value is JsonObject nestedOverrideObject + ) + { + // If both values are objects, recursively merge them. + MergeJsonObjects(nestedBaseObject, nestedOverrideObject); + continue; + } + // Otherwise, the overrideObject takes precedence. + baseObject[property.Key] = property.Value is not null + ? JsonNode.Parse(property.Value.ToJsonString()) + : null; + } + } + + internal static T Deserialize(string json) => + JsonSerializer.Deserialize(json, JsonOptions.JsonSerializerOptions)!; + + internal static bool TryDeserialize(string json, out T? result) + where T : class + { + try + { + result = Deserialize(json); + return true; + } + catch (global::System.Exception) + { + result = null; + return false; + } + } + + internal static bool TryDeserialize(string json, out T? result) + where T : struct + { + try + { + result = Deserialize(json); + return true; + } + catch (global::System.Exception) + { + result = null; + return false; + } + } + + internal static bool TryDeserialize(JsonDocument json, out T? result) + where T : class + { + try + { + result = json.Deserialize(JsonOptions.JsonSerializerOptions); + return true; + } + catch (global::System.Exception) + { + result = null; + return false; + } + } + + internal static bool TryDeserialize(JsonDocument json, out T? result) + where T : struct + { + try + { + result = json.Deserialize(JsonOptions.JsonSerializerOptions); + return true; + } + catch (global::System.Exception) + { + result = null; + return false; + } + } + } + tests/Auth0.ManagementApi.Test/Auth0.ManagementApi.Test.csproj: | + + + net9.0 + 12 + enable + enable + false + true + true + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + + + + + user_owned: true diff --git a/reference.md b/reference.md index 7c1909646..ea29afbb5 100644 --- a/reference.md +++ b/reference.md @@ -5423,33 +5423,30 @@ await client.LogStreams.UpdateAsync("id", new UpdateLogStreamRequestContent()); Retrieve log entries that match the specified search criteria (or all log entries if no criteria specified). -Set custom search criteria using the q parameter, or search from a specific log ID ("search from checkpoint"). +Set custom search criteria using the `q` parameter, or search from a specific log ID (_"search from checkpoint"_). -For more information on all possible event types, their respective acronyms, and descriptions, see Log Event Type Codes. +For more information on all possible event types, their respective acronyms, and descriptions, see [Log Event Type Codes](https://auth0.com/docs/logs/log-event-type-codes). -
To set custom search criteria, use the following parameters:
+**To set custom search criteria, use the following parameters:** -
    -
  • q: Search Criteria using Query String Syntax
  • -
  • page: Page index of the results to return. First page is 0.
  • -
  • per_page: Number of results per page.
  • -
  • sort: Field to use for sorting appended with `:1` for ascending and `:-1` for descending. e.g. `date:-1`
  • -
  • fields: Comma-separated list of fields to include or exclude (depending on include_fields) from the result, empty to retrieve all fields.
  • -
  • include_fields: Whether specified fields are to be included (true) or excluded (false).
  • -
  • include_totals: Return results inside an object that contains the total result count (true) or as a direct array of results (false, default). Deprecated: this field is deprecated and should be removed from use. See Search Engine V3 Breaking Changes
  • -
+- **q:** Search Criteria using [Query String Syntax](https://auth0.com/docs/logs/log-search-query-syntax) +- **page:** Page index of the results to return. First page is 0. +- **per_page:** Number of results per page. +- **sort:** Field to use for sorting appended with `:1` for ascending and `:-1` for descending. e.g. `date:-1` +- **fields:** Comma-separated list of fields to include or exclude (depending on include_fields) from the result, empty to retrieve all fields. +- **include_fields:** Whether specified fields are to be included (true) or excluded (false). +- **include_totals:** Return results inside an object that contains the total result count (true) or as a direct array of results (false, default). **Deprecated:** this field is deprecated and should be removed from use. See [Search Engine V3 Breaking Changes](https://auth0.com/docs/product-lifecycle/deprecations-and-migrations/migrate-to-tenant-log-search-v3#pagination) -For more information on the list of fields that can be used in fields and sort, see Searchable Fields. +For more information on the list of fields that can be used in `fields` and `sort`, see [Searchable Fields](https://auth0.com/docs/logs/log-search-query-syntax#searchable-fields). -Auth0 limits the number of logs you can return by search criteria to 100 logs per request. Furthermore, you may paginate only through 1,000 search results. If you exceed this threshold, please redefine your search or use the get logs by checkpoint method. +Auth0 [limits the number of logs](https://auth0.com/docs/logs/retrieve-log-events-using-mgmt-api#limitations) you can return by search criteria to 100 logs per request. Furthermore, you may paginate only through 1,000 search results. If you exceed this threshold, please redefine your search or use the [get logs by checkpoint method](https://auth0.com/docs/logs/retrieve-log-events-using-mgmt-api#retrieve-logs-by-checkpoint). -
To search from a checkpoint log ID, use the following parameters:
-
    -
  • from: Log Event ID from which to start retrieving logs. You can limit the number of logs returned using the take parameter. If you use from at the same time as q, from takes precedence and q is ignored.
  • -
  • take: Number of entries to retrieve when using the from parameter.
  • -
+**To search from a checkpoint log ID, use the following parameters:** -Important: When fetching logs from a checkpoint log ID, any parameter other than from and take will be ignored, and date ordering is not guaranteed. +- **from:** Log Event ID from which to start retrieving logs. You can limit the number of logs returned using the `take` parameter. If you use `from` at the same time as `q`, `from` takes precedence and `q` is ignored. +- **take:** Number of entries to retrieve when using the `from` parameter. + +**Important:** When fetching logs from a checkpoint log ID, any parameter other than `from` and `take` will be ignored, and date ordering is not guaranteed. @@ -6377,6 +6374,244 @@ await client.Prompts.UpdateSettingsAsync(new UpdateSettingsRequestContent()); + + + + +## RateLimitPolicies +
client.RateLimitPolicies.ListAsync(ListRateLimitPoliciesRequestParameters { ... }) -> Pager<RateLimitPolicy> +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```csharp +await client.RateLimitPolicies.ListAsync( + new ListRateLimitPoliciesRequestParameters + { + Resource = RateLimitPolicyResourceEnum.OauthAuthenticationApi, + Consumer = RateLimitPolicyConsumerEnum.Client, + ConsumerSelector = "consumer_selector", + Take = 1, + From = "from", + } +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `ListRateLimitPoliciesRequestParameters` + +
+
+
+
+ + +
+
+
+ +
client.RateLimitPolicies.CreateAsync(CreateRateLimitPolicyRequestContent { ... }) -> WithRawResponseTask<CreateRateLimitPolicyResponseContent> +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```csharp +await client.RateLimitPolicies.CreateAsync( + new CreateRateLimitPolicyRequestContent + { + Resource = RateLimitPolicyResourceEnum.OauthAuthenticationApi, + Consumer = RateLimitPolicyConsumerEnum.Client, + ConsumerSelector = "consumer_selector", + Configuration = new RateLimitPolicyConfigurationZero + { + Action = RateLimitPolicyConfigurationZeroAction.Allow, + }, + } +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `CreateRateLimitPolicyRequestContent` + +
+
+
+
+ + +
+
+
+ +
client.RateLimitPolicies.GetAsync(id) -> WithRawResponseTask<GetRateLimitPolicyResponseContent> +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```csharp +await client.RateLimitPolicies.GetAsync("id"); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `string` — Unique identifier for the Rate Limit Policy. + +
+
+
+
+ + +
+
+
+ +
client.RateLimitPolicies.DeleteAsync(id) +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```csharp +await client.RateLimitPolicies.DeleteAsync("id"); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `string` — Unique identifier for the Rate Limit Policy. + +
+
+
+
+ + +
+
+
+ +
client.RateLimitPolicies.UpdateAsync(id, PatchRateLimitPolicyRequestContent { ... }) -> WithRawResponseTask<UpdateRateLimitPolicyResponseContent> +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```csharp +await client.RateLimitPolicies.UpdateAsync( + "id", + new PatchRateLimitPolicyRequestContent + { + Configuration = new PatchRateLimitPolicyConfigurationRequestContentZero + { + Action = PatchRateLimitPolicyConfigurationRequestContentZeroAction.Allow, + }, + } +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `string` — Unique identifier for the Rate Limit Policy. + +
+
+ +
+
+ +**request:** `PatchRateLimitPolicyRequestContent` + +
+
+
+
+ +
@@ -6986,7 +7221,7 @@ await client.ResourceServers.UpdateAsync("id", new UpdateResourceServerRequestCo Retrieve detailed list of user roles created in your tenant. -Note: The returned list does not include standard roles available for tenant members, such as Admin or Support Access. +**Note**: The returned list does not include standard roles available for tenant members, such as Admin or Support Access. @@ -7048,9 +7283,9 @@ await client.Roles.ListAsync(
-Create a user role for Role-Based Access Control. +Create a user role for [Role-Based Access Control](https://auth0.com/docs/manage-users/access-control/rbac). -Note: New roles are not associated with any permissions by default. To assign existing permissions to your role, review Associate Permissions with a Role. To create new permissions, review Add API Permissions. +**Note**: New roles are not associated with any permissions by default. To assign existing permissions to your role, review Associate Permissions with a Role. To create new permissions, review Add API Permissions.
@@ -7104,7 +7339,7 @@ await client.Roles.CreateAsync(new CreateRoleRequestContent { Name = "name" });
-Retrieve details about a specific user role specified by ID. +Retrieve details about a specific [user role](https://auth0.com/docs/manage-users/access-control/rbac) specified by ID.
@@ -7158,7 +7393,7 @@ await client.Roles.GetAsync("id");
-Delete a specific user role from your tenant. Once deleted, it is removed from any user who was previously assigned that role. This action cannot be undone. +Delete a specific [user role](https://auth0.com/docs/manage-users/access-control/rbac) from your tenant. Once deleted, it is removed from any user who was previously assigned that role. This action cannot be undone.
@@ -7212,7 +7447,7 @@ await client.Roles.DeleteAsync("id");
-Modify the details of a specific user role specified by ID. +Modify the details of a specific [user role](https://auth0.com/docs/manage-users/access-control/rbac) specified by ID.
@@ -8917,7 +9152,7 @@ await client.UserAttributeProfiles.ListAsync(
-Create a User Attribute Profile +Create a User Attribute Profile.
@@ -9085,7 +9320,7 @@ await client.UserAttributeProfiles.GetTemplateAsync("id");
-Retrieve details about a single User Attribute Profile specified by ID. +Retrieve details about a single User Attribute Profile specified by ID.
@@ -9505,14 +9740,18 @@ Retrieve details of users. It is possible to: - Sort the users to be returned - Select the fields to be returned - Specify the number of users to retrieve per page and the page index - -The q query parameter can be used to get users that match the specified criteria using query string syntax. -Learn more about searching for users. -Read about best practices when working with the API endpoints for retrieving users. -Auth0 limits the number of users you can return. If you exceed this threshold, please redefine your search, use the export job, or the User Import / Export extension. +The `q` query parameter can be used to get users that match the specified criteria [using query string syntax.](https://auth0.com/docs/users/search/v3/query-syntax) + +[Learn more about searching for users.](https://auth0.com/docs/users/search/v3) + +Read about [best practices](https://auth0.com/docs/users/search/best-practices) when working with the API endpoints for retrieving users. + + + +Auth0 limits the number of users you can return. If you exceed this threshold, please redefine your search, use the [export job](https://auth0.com/docs/api/management/v2#!/Jobs/post_users_exports), or the [User Import / Export](https://auth0.com/docs/extensions/user-import-export) extension. @@ -9580,9 +9819,9 @@ await client.Users.ListAsync(
-Create a new user for a given database or passwordless connection. +Create a new user for a given [database](https://auth0.com/docs/connections/database) or [passwordless](https://auth0.com/docs/connections/passwordless) connection. -Note: connection is required but other parameters such as email and password are dependent upon the type of connection. +Note: `connection` is required but other parameters such as `email` and `password` are dependent upon the type of connection.
@@ -9701,7 +9940,7 @@ await client.Users.ListUsersByEmailAsync(
-Retrieve user details. A list of fields to include or exclude may also be specified. For more information, see Retrieve Users with the Get Users Endpoint. +Retrieve user details. A list of fields to include or exclude may also be specified. For more information, see [Retrieve Users with the Get Users Endpoint](https://auth0.com/docs/manage-users/user-search/retrieve-users-with-get-users-endpoint).
@@ -9766,7 +10005,7 @@ await client.Users.GetAsync(
-Delete a user by user ID. This action cannot be undone. For Auth0 Dashboard instructions, see Delete Users. +Delete a user by user ID. This action cannot be undone. For Auth0 Dashboard instructions, see [Delete Users](https://auth0.com/docs/manage-users/user-accounts/delete-users).
@@ -9824,64 +10063,84 @@ Update a user. These are the attributes that can be updated at the root level: -
    -
  • app_metadata
  • -
  • blocked
  • -
  • email
  • -
  • email_verified
  • -
  • family_name
  • -
  • given_name
  • -
  • name
  • -
  • nickname
  • -
  • password
  • -
  • phone_number
  • -
  • phone_verified
  • -
  • picture
  • -
  • username
  • -
  • user_metadata
  • -
  • verify_email
  • -
+- app_metadata +- blocked +- email +- email_verified +- family_name +- given_name +- name +- nickname +- password +- phone_number +- phone_verified +- picture +- username +- user_metadata +- verify_email Some considerations: -
    -
  • The properties of the new object will replace the old ones.
  • -
  • The metadata fields are an exception to this rule (user_metadata and app_metadata). These properties are merged instead of being replaced but be careful, the merge only occurs on the first level.
  • -
  • If you are updating email, email_verified, phone_number, phone_verified, username or password of a secondary identity, you need to specify the connection property too.
  • -
  • If you are updating email or phone_number you can specify, optionally, the client_id property.
  • -
  • Updating email_verified is not supported for enterprise and passwordless sms connections.
  • -
  • Updating the blocked to false does not affect the user's blocked state from an excessive amount of incorrectly provided credentials. Use the "Unblock a user" endpoint from the "User Blocks" API to change the user's state.
  • -
  • Supported attributes can be unset by supplying null as the value.
  • -
-
Updating a field (non-metadata property)
+- The properties of the new object will replace the old ones. +- The metadata fields are an exception to this rule (`user_metadata` and `app_metadata`). These properties are merged instead of being replaced but be careful, the merge only occurs on the first level. +- If you are updating `email`, `email_verified`, `phone_number`, `phone_verified`, `username` or `password` of a secondary identity, you need to specify the `connection` property too. +- If you are updating `email` or `phone_number` you can specify, optionally, the `client_id` property. +- Updating `email_verified` is not supported for enterprise and passwordless sms connections. +- Updating the `blocked` to `false` does not affect the user's blocked state from an excessive amount of incorrectly provided credentials. Use the "Unblock a user" endpoint from the "User Blocks" API to change the user's state. +- Supported attributes can be unset by supplying `null` as the value. + +**Updating a field (non-metadata property)** + To mark the email address of a user as verified, the body to send should be: -
{ "email_verified": true }
-
Updating a user metadata root property
Let's assume that our test user has the following user_metadata: -
{ "user_metadata" : { "profileCode": 1479 } }
+```json +{ "email_verified": true } +``` + +**Updating a user metadata root property** + +Let's assume that our test user has the following `user_metadata`: + +```json +{ "user_metadata" : { "profileCode": 1479 } } +``` + +To add the field `addresses` the body to send should be: + +```json +{ "user_metadata" : { "addresses": {"work_address": "100 Industrial Way"} }} +``` -To add the field addresses the body to send should be: -
{ "user_metadata" : { "addresses": {"work_address": "100 Industrial Way"} }}
+The modified object ends up with the following `user_metadata` property: -The modified object ends up with the following user_metadata property:
{
+```json
+{
   "user_metadata": {
     "profileCode": 1479,
     "addresses": { "work_address": "100 Industrial Way" }
   }
-}
+} +``` + +**Updating an inner user metadata property** -
Updating an inner user metadata property
If there's existing user metadata to which we want to add "home_address": "742 Evergreen Terrace" (using the addresses property) we should send the whole addresses object. Since this is a first-level object, the object will be merged in, but its own properties will not be. The body to send should be: -
{
+If there's existing user metadata to which we want to add  `"home_address": "742 Evergreen Terrace"` (using the `addresses` property) we should send the whole `addresses` object. Since this is a first-level object, the object will be merged in, but its own properties will not be. The body to send should be:
+
+```json
+{
   "user_metadata": {
     "addresses": {
       "work_address": "100 Industrial Way",
       "home_address": "742 Evergreen Terrace"
     }
   }
-}
+} +``` -The modified object ends up with the following user_metadata property: -
{
+The modified object ends up with the following `user_metadata` property:
+
+```json
+{
   "user_metadata": {
     "profileCode": 1479,
     "addresses": {
@@ -9889,7 +10148,8 @@ The modified object ends up with the following user_metadata proper
       "home_address": "742 Evergreen Terrace"
     }
   }
-}
+} +``` @@ -9951,7 +10211,7 @@ await client.Users.UpdateAsync("id", new UpdateUserRequestContent());
-Remove an existing multi-factor authentication (MFA) recovery code and generate a new one. If a user cannot access the original device or account used for MFA enrollment, they can use a recovery code to authenticate. +Remove an existing multi-factor authentication (MFA) [recovery code](https://auth0.com/docs/secure/multi-factor-authentication/reset-user-mfa) and generate a new one. If a user cannot access the original device or account used for MFA enrollment, they can use a recovery code to authenticate.
@@ -13879,7 +14139,7 @@ await client.Connections.ScimConfiguration.ListAsync(
-Retrieves a scim configuration by its connectionId. +Retrieves a scim configuration by its `connectionId`.
@@ -13998,7 +14258,7 @@ await client.Connections.ScimConfiguration.CreateAsync(
-Deletes a scim configuration by its connectionId. +Deletes a scim configuration by its `connectionId`.
@@ -14052,7 +14312,7 @@ await client.Connections.ScimConfiguration.DeleteAsync("id");
-Update a scim configuration by its connectionId. +Update a scim configuration by its `connectionId`.
@@ -14121,7 +14381,7 @@ await client.Connections.ScimConfiguration.UpdateAsync(
-Retrieves a scim configuration's default mapping by its connectionId. +Retrieves a scim configuration's default mapping by its `connectionId`.
@@ -14602,7 +14862,7 @@ await client.Connections.DirectoryProvisioning.Synchronizations.CreateAsync("id"
-Retrieves all scim tokens by its connection id. +Retrieves all scim tokens by its connection `id`.
@@ -14721,7 +14981,7 @@ await client.Connections.ScimConfiguration.Tokens.CreateAsync(
-Deletes a scim token by its connection id and tokenId. +Deletes a scim token by its connection `id` and `tokenId`.
@@ -15734,6 +15994,202 @@ await client.Groups.Members.GetAsync( + + + + +## Groups Roles +
client.Groups.Roles.ListAsync(id, ListGroupRolesRequestParameters { ... }) -> Pager<Role> +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Lists the roles assigned to a group. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```csharp +await client.Groups.Roles.ListAsync( + "id", + new ListGroupRolesRequestParameters { From = "from", Take = 1 } +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `string` — Unique identifier for the group (service-generated). + +
+
+ +
+
+ +**request:** `ListGroupRolesRequestParameters` + +
+
+
+
+ + +
+
+
+ +
client.Groups.Roles.CreateAsync(id, CreateGroupRolesRequestParameters { ... }) +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Assign one or more roles to a specified group. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```csharp +await client.Groups.Roles.CreateAsync( + "id", + new CreateGroupRolesRequestParameters { Roles = new List() { "roles" } } +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `string` — Unique identifier for the group (service-generated). + +
+
+ +
+
+ +**request:** `CreateGroupRolesRequestParameters` + +
+
+
+
+ + +
+
+
+ +
client.Groups.Roles.DeleteAsync(id, DeleteGroupRolesRequestContent { ... }) +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Unassign one or more roles from a specified group. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```csharp +await client.Groups.Roles.DeleteAsync( + "id", + new DeleteGroupRolesRequestContent { Roles = new List() { "roles" } } +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `string` — Unique identifier for the group (service-generated). + +
+
+ +
+
+ +**request:** `DeleteGroupRolesRequestContent` + +
+
+
+
+ +
@@ -15751,10 +16207,7 @@ await client.Groups.Members.GetAsync(
-Create a multi-factor authentication (MFA) enrollment ticket, and optionally send an email with the created ticket, to a given user. -Create a multi-factor authentication (MFA) enrollment ticket, and optionally send an email with the created ticket to a given user. Enrollment tickets can specify which factor users must enroll with or allow existing MFA users to enroll in additional factors.
- -Note: Users cannot enroll in Email as a factor through custom enrollment tickets. +Create a [multi-factor authentication (MFA) enrollment ticket](https://auth0.com/docs/secure/multi-factor-authentication/auth0-guardian/create-custom-enrollment-tickets), and optionally send an email with the created ticket to a given user. Enrollment tickets can specify which factor users must enroll with or allow existing MFA users to enroll in additional factors.
@@ -15864,7 +16317,7 @@ await client.Guardian.Enrollments.GetAsync("id");
-Remove a specific multi-factor authentication (MFA) enrollment from a user's account. This allows the user to re-enroll with MFA. For more information, review Reset User Multi-Factor Authentication and Recovery Codes. +Remove a specific multi-factor authentication (MFA) enrollment from a user's account. This allows the user to re-enroll with MFA. For more information, review [Reset User Multi-Factor Authentication and Recovery Codes](https://auth0.com/docs/secure/multi-factor-authentication/reset-user-mfa).
@@ -16024,15 +16477,14 @@ await client.Guardian.Factors.SetAsync(
-Retrieve the multi-factor authentication (MFA) policies configured for your tenant. +Retrieve the [multi-factor authentication (MFA) policies](https://auth0.com/docs/secure/multi-factor-authentication/enable-mfa) configured for your tenant. The following policies are supported: -
    -
  • all-applications policy prompts with MFA for all logins.
  • -
  • confidence-score policy prompts with MFA only for low confidence logins.
  • -
-Note: The confidence-score policy is part of the Adaptive MFA feature. Adaptive MFA requires an add-on for the Enterprise plan; review Auth0 Pricing for more details. +- `all-applications` policy prompts with MFA for all logins. +- `confidence-score` policy prompts with MFA only for low confidence logins. + +**Note**: The `confidence-score` policy is part of the [Adaptive MFA feature](https://auth0.com/docs/secure/multi-factor-authentication/adaptive-mfa). Adaptive MFA requires an add-on for the Enterprise plan; review [Auth0 Pricing](https://auth0.com/pricing) for more details.
@@ -16071,15 +16523,14 @@ await client.Guardian.Policies.ListAsync();
-Set multi-factor authentication (MFA) policies for your tenant. +Set [multi-factor authentication (MFA) policies](https://auth0.com/docs/secure/multi-factor-authentication/enable-mfa) for your tenant. The following policies are supported: -
    -
  • all-applications policy prompts with MFA for all logins.
  • -
  • confidence-score policy prompts with MFA only for low confidence logins.
  • -
-Note: The confidence-score policy is part of the Adaptive MFA feature. Adaptive MFA requires an add-on for the Enterprise plan; review Auth0 Pricing for more details. +- `all-applications` policy prompts with MFA for all logins. +- `confidence-score` policy prompts with MFA only for low confidence logins. + +**Note**: The `confidence-score` policy is part of the [Adaptive MFA feature](https://auth0.com/docs/secure/multi-factor-authentication/adaptive-mfa). Adaptive MFA requires an add-on for the Enterprise plan; review [Auth0 Pricing](https://auth0.com/pricing) for more details.
@@ -16891,7 +17342,7 @@ await client.Guardian.Factors.PushNotification.UpdateFcmv1ProviderAsync(
-Retrieve configuration details for an AWS SNS push notification provider that has been enabled for MFA. To learn more, review Configure Push Notifications for MFA. +Retrieve configuration details for an AWS SNS push notification provider that has been enabled for MFA. To learn more, review [Configure Push Notifications for MFA](https://auth0.com/docs/secure/multi-factor-authentication/multi-factor-authentication-factors/configure-push-notifications-for-mfa).
@@ -16930,7 +17381,7 @@ await client.Guardian.Factors.PushNotification.GetSnsProviderAsync();
-Configure the AWS SNS push notification provider configuration (subscription required). +Configure the [AWS SNS push notification provider configuration](https://auth0.com/docs/multifactor-authentication/developer/sns-configuration) (subscription required).
@@ -16986,7 +17437,7 @@ await client.Guardian.Factors.PushNotification.SetSnsProviderAsync(
-Configure the AWS SNS push notification provider configuration (subscription required). +Configure the [AWS SNS push notification provider configuration](https://auth0.com/docs/multifactor-authentication/developer/sns-configuration) (subscription required).
@@ -17943,7 +18394,7 @@ await client.Jobs.UsersImports.CreateAsync(
-Send an email to the specified user that asks them to click a link to verify their email address. +Send an email to the specified user that asks them to click a link to [verify their email address](https://auth0.com/docs/email/custom#verification-email). Note: You must have the `Status` toggle enabled for the verification email template for the email to be sent.
@@ -21410,7 +21861,7 @@ await client.Roles.Permissions.ListAsync(
-Add one or more permissions to a specified user role. +Add one or more [permissions](https://auth0.com/docs/manage-users/access-control/configure-core-rbac/manage-permissions) to a specified user role.
@@ -21485,7 +21936,7 @@ await client.Roles.Permissions.AddAsync(
-Remove one or more permissions from a specified user role. +Remove one or more [permissions](https://auth0.com/docs/manage-users/access-control/configure-core-rbac/manage-permissions) from a specified user role.
@@ -21561,25 +22012,23 @@ await client.Roles.Permissions.DeleteAsync(
-Retrieve list of users associated with a specific role. For Dashboard instructions, review View Users Assigned to Roles. +Retrieve list of users associated with a specific role. For Dashboard instructions, review [View Users Assigned to Roles](https://auth0.com/docs/manage-users/access-control/configure-core-rbac/roles/view-users-assigned-to-roles). This endpoint supports two types of pagination: -
    -
  • Offset pagination
  • -
  • Checkpoint pagination
  • -
+ +- Offset pagination +- Checkpoint pagination Checkpoint pagination must be used if you need to retrieve more than 1000 organization members. -

Checkpoint Pagination

+**Checkpoint Pagination** To search by checkpoint, use the following parameters: -
    -
  • from: Optional id from which to start selection.
  • -
  • take: The total amount of entries to retrieve when using the from parameter. Defaults to 50.
  • -
-Note: The first time you call this endpoint using checkpoint pagination, omit the from parameter. If there are more results, a next value is included in the response. You can use this for subsequent API calls. When next is no longer included in the response, no pages are remaining. +- `from`: Optional id from which to start selection. +- `take`: The total amount of entries to retrieve when using the from parameter. Defaults to 50. + +**Note**: The first time you call this endpoint using checkpoint pagination, omit the `from` parameter. If there are more results, a `next` value is included in the response. You can use this for subsequent API calls. When `next` is no longer included in the response, no pages are remaining.
@@ -21644,9 +22093,9 @@ await client.Roles.Users.ListAsync(
-Assign one or more users to an existing user role. To learn more, review Role-Based Access Control. +Assign one or more users to an existing user role. To learn more, review [Role-Based Access Control](https://auth0.com/docs/manage-users/access-control/rbac). -Note: New roles cannot be created through this action. +**Note**: New roles cannot be created through this action.
@@ -22557,7 +23006,7 @@ await client.Users.AuthenticationMethods.UpdateAsync(
-Remove all authenticators registered to a given user ID, such as OTP, email, phone, and push-notification. This action cannot be undone. For more information, review Manage Authentication Methods with Management API. +Remove all authenticators registered to a given user ID, such as OTP, email, phone, and push-notification. This action cannot be undone. For more information, review [Manage Authentication Methods with Management API](https://auth0.com/docs/secure/multi-factor-authentication/manage-mfa-auth0-apis/manage-authentication-methods-with-management-api).
@@ -22678,7 +23127,7 @@ await client.Users.ConnectedAccounts.ListAsync(
-Retrieve the first multi-factor authentication enrollment that a specific user has confirmed. +Retrieve the first [multi-factor authentication](https://auth0.com/docs/secure/multi-factor-authentication/multi-factor-authentication-factors) enrollment that a specific user has confirmed.
@@ -22912,30 +23361,31 @@ Link two user accounts together forming a primary and secondary relationship. On Note: There are two ways of invoking the endpoint: -
    -
  • With the authenticated primary account's JWT in the Authorization header, which has the update:current_user_identities scope: -
    -      POST /api/v2/users/PRIMARY_ACCOUNT_USER_ID/identities
    -      Authorization: "Bearer PRIMARY_ACCOUNT_JWT"
    -      {
    -        "link_with": "SECONDARY_ACCOUNT_JWT"
    -      }
    -    
    - In this case, only the link_with param is required in the body, which also contains the JWT obtained upon the secondary account's authentication. -
  • -
  • With a token generated by the API V2 containing the update:users scope: -
    -    POST /api/v2/users/PRIMARY_ACCOUNT_USER_ID/identities
    -    Authorization: "Bearer YOUR_API_V2_TOKEN"
    -    {
    -      "provider": "SECONDARY_ACCOUNT_PROVIDER",
    -      "connection_id": "SECONDARY_ACCOUNT_CONNECTION_ID(OPTIONAL)",
    -      "user_id": "SECONDARY_ACCOUNT_USER_ID"
    -    }
    -    
    - In this case you need to send provider and user_id in the body. Optionally you can also send the connection_id param which is suitable for identifying a particular database connection for the 'auth0' provider. -
  • -
+- With the authenticated primary account's JWT in the Authorization header, which has the `update:current_user_identities` scope: + + ```http + POST /api/v2/users/PRIMARY_ACCOUNT_USER_ID/identities + Authorization: "Bearer PRIMARY_ACCOUNT_JWT" + { + "link_with": "SECONDARY_ACCOUNT_JWT" + } + ``` + + In this case, only the `link_with` param is required in the body, which also contains the JWT obtained upon the secondary account's authentication. + +- With a token generated by the API V2 containing the `update:users` scope: + + ```http + POST /api/v2/users/PRIMARY_ACCOUNT_USER_ID/identities + Authorization: "Bearer YOUR_API_V2_TOKEN" + { + "provider": "SECONDARY_ACCOUNT_PROVIDER", + "connection_id": "SECONDARY_ACCOUNT_CONNECTION_ID(OPTIONAL)", + "user_id": "SECONDARY_ACCOUNT_USER_ID" + } + ``` + + In this case you need to send `provider` and `user_id` in the body. Optionally you can also send the `connection_id` param which is suitable for identifying a particular database connection for the 'auth0' provider.
@@ -22999,7 +23449,7 @@ await client.Users.Identities.LinkAsync("id", new LinkUserIdentityRequestContent Unlink a specific secondary account from a target user. This action requires the ID of both the target user and the secondary account. -Unlinking the secondary account removes it from the identities array of the target user and creates a new standalone profile for the secondary account. To learn more, review Unlink User Accounts. +Unlinking the secondary account removes it from the identities array of the target user and creates a new standalone profile for the secondary account. To learn more, review [Unlink User Accounts](https://auth0.com/docs/manage-users/user-accounts/user-account-linking/unlink-user-accounts). @@ -23148,7 +23598,7 @@ await client.Users.Logs.ListAsync(
-Invalidate all remembered browsers across all authentication factors for a user. +Invalidate all remembered browsers across all [authentication factors](https://auth0.com/docs/multifactor-authentication) for a user.
@@ -23202,7 +23652,7 @@ await client.Users.Multifactor.InvalidateRememberBrowserAsync("id");
-Remove a multifactor authentication configuration from a user's account. This forces the user to manually reconfigure the multi-factor provider. +Remove a [multifactor](https://auth0.com/docs/multifactor-authentication) authentication configuration from a user's account. This forces the user to manually reconfigure the multi-factor provider.
@@ -23265,7 +23715,7 @@ await client.Users.Multifactor.DeleteProviderAsync("id", UserMultifactorProvider
-Retrieve list of the specified user's current Organization memberships. User must be specified by user ID. For more information, review Auth0 Organizations. +Retrieve list of the specified user's current Organization memberships. User must be specified by user ID. For more information, review [Auth0 Organizations](https://auth0.com/docs/manage-users/organizations).
@@ -23629,7 +24079,7 @@ await client.Users.RiskAssessments.ClearAsync( Retrieve detailed list of all user roles currently assigned to a user. -Note: This action retrieves all roles assigned to a user in the context of your whole tenant. To retrieve Organization-specific roles, use the following endpoint: Get user roles assigned to an Organization member. +**Note**: This action retrieves all roles assigned to a user in the context of your whole tenant. To retrieve Organization-specific roles, use the following endpoint: [Get user roles assigned to an Organization member](https://auth0.com/docs/api/management/v2/organizations/get-organization-member-roles). @@ -23699,9 +24149,9 @@ await client.Users.Roles.ListAsync(
-Assign one or more existing user roles to a user. For more information, review Role-Based Access Control. +Assign one or more existing user roles to a user. For more information, review [Role-Based Access Control](https://auth0.com/docs/manage-users/access-control/rbac). -Note: New roles cannot be created through this action. Additionally, this action is used to assign roles to a user in the context of your whole tenant. To assign roles in the context of a specific Organization, use the following endpoint: Assign user roles to an Organization member. +**Note**: New roles cannot be created through this action. Additionally, this action is used to assign roles to a user in the context of your whole tenant. To assign roles in the context of a specific Organization, use the following endpoint: [Assign user roles to an Organization member](https://auth0.com/docs/api/management/v2/organizations/post-organization-member-roles).
@@ -23768,7 +24218,7 @@ await client.Users.Roles.AssignAsync( Remove one or more specified user roles assigned to a user. -Note: This action removes a role from a user in the context of your whole tenant. If you want to unassign a role from a user in the context of a specific Organization, use the following endpoint: Delete user roles from an Organization member. +**Note**: This action removes a role from a user in the context of your whole tenant. If you want to unassign a role from a user in the context of a specific Organization, use the following endpoint: [Delete user roles from an Organization member](https://auth0.com/docs/api/management/v2/organizations/delete-organization-member-roles). diff --git a/src/Auth0.ManagementApi/Actions/Versions/VersionsClient.cs b/src/Auth0.ManagementApi/Actions/Versions/VersionsClient.cs index a129459fa..59fd531e5 100644 --- a/src/Auth0.ManagementApi/Actions/Versions/VersionsClient.cs +++ b/src/Auth0.ManagementApi/Actions/Versions/VersionsClient.cs @@ -244,7 +244,6 @@ private async Task> DeployAs ), Body = request, Headers = _headers, - ContentType = "application/json", Options = options, }, cancellationToken diff --git a/src/Auth0.ManagementApi/Branding/Phone/Templates/TemplatesClient.cs b/src/Auth0.ManagementApi/Branding/Phone/Templates/TemplatesClient.cs index a5a620a8e..0d4b5ff02 100644 --- a/src/Auth0.ManagementApi/Branding/Phone/Templates/TemplatesClient.cs +++ b/src/Auth0.ManagementApi/Branding/Phone/Templates/TemplatesClient.cs @@ -399,7 +399,6 @@ private async Task> ResetAsyn ), Body = request, Headers = _headers, - ContentType = "application/json", Options = options, }, cancellationToken diff --git a/src/Auth0.ManagementApi/Branding/Templates/TemplatesClient.cs b/src/Auth0.ManagementApi/Branding/Templates/TemplatesClient.cs index 4b2bd56c3..9df39dfe6 100644 --- a/src/Auth0.ManagementApi/Branding/Templates/TemplatesClient.cs +++ b/src/Auth0.ManagementApi/Branding/Templates/TemplatesClient.cs @@ -163,7 +163,6 @@ public async Task UpdateUniversalLoginAsync( Path = "branding/templates/universal-login", Body = request, Headers = _headers, - ContentType = "application/json", Options = options, }, cancellationToken diff --git a/src/Auth0.ManagementApi/Connections/Clients/ClientsClient.cs b/src/Auth0.ManagementApi/Connections/Clients/ClientsClient.cs index e2add2f9e..8b6cb9325 100644 --- a/src/Auth0.ManagementApi/Connections/Clients/ClientsClient.cs +++ b/src/Auth0.ManagementApi/Connections/Clients/ClientsClient.cs @@ -214,7 +214,6 @@ public async Task UpdateAsync( ), Body = request, Headers = _headers, - ContentType = "application/json", Options = options, }, cancellationToken diff --git a/src/Auth0.ManagementApi/Connections/DirectoryProvisioning/DirectoryProvisioningClient.cs b/src/Auth0.ManagementApi/Connections/DirectoryProvisioning/DirectoryProvisioningClient.cs index d91040d27..a23b9a0b1 100644 --- a/src/Auth0.ManagementApi/Connections/DirectoryProvisioning/DirectoryProvisioningClient.cs +++ b/src/Auth0.ManagementApi/Connections/DirectoryProvisioning/DirectoryProvisioningClient.cs @@ -238,7 +238,6 @@ private async Task> ), Body = request, Headers = _headers, - ContentType = "application/json", Options = options, }, cancellationToken @@ -334,7 +333,6 @@ private async Task> ), Body = request, Headers = _headers, - ContentType = "application/json", Options = options, }, cancellationToken diff --git a/src/Auth0.ManagementApi/Connections/Keys/KeysClient.cs b/src/Auth0.ManagementApi/Connections/Keys/KeysClient.cs index c5f949c03..f503bec7c 100644 --- a/src/Auth0.ManagementApi/Connections/Keys/KeysClient.cs +++ b/src/Auth0.ManagementApi/Connections/Keys/KeysClient.cs @@ -127,7 +127,6 @@ private async Task< ), Body = request, Headers = _headers, - ContentType = "application/json", Options = options, }, cancellationToken @@ -222,7 +221,6 @@ private async Task> Rotate ), Body = request, Headers = _headers, - ContentType = "application/json", Options = options, }, cancellationToken diff --git a/src/Auth0.ManagementApi/Connections/ScimConfiguration/IScimConfigurationClient.cs b/src/Auth0.ManagementApi/Connections/ScimConfiguration/IScimConfigurationClient.cs index 00236de17..09bac481f 100644 --- a/src/Auth0.ManagementApi/Connections/ScimConfiguration/IScimConfigurationClient.cs +++ b/src/Auth0.ManagementApi/Connections/ScimConfiguration/IScimConfigurationClient.cs @@ -18,7 +18,7 @@ public partial interface IScimConfigurationClient ); /// - /// Retrieves a scim configuration by its connectionId. + /// Retrieves a scim configuration by its `connectionId`. /// WithRawResponseTask GetAsync( string id, @@ -37,7 +37,7 @@ WithRawResponseTask CreateAsync( ); /// - /// Deletes a scim configuration by its connectionId. + /// Deletes a scim configuration by its `connectionId`. /// Task DeleteAsync( string id, @@ -46,7 +46,7 @@ Task DeleteAsync( ); /// - /// Update a scim configuration by its connectionId. + /// Update a scim configuration by its `connectionId`. /// WithRawResponseTask UpdateAsync( string id, @@ -56,7 +56,7 @@ WithRawResponseTask UpdateAsync( ); /// - /// Retrieves a scim configuration's default mapping by its connectionId. + /// Retrieves a scim configuration's default mapping by its `connectionId`. /// WithRawResponseTask GetDefaultMappingAsync( string id, diff --git a/src/Auth0.ManagementApi/Connections/ScimConfiguration/ScimConfigurationClient.cs b/src/Auth0.ManagementApi/Connections/ScimConfiguration/ScimConfigurationClient.cs index 4ea062cbb..f9a38ad40 100644 --- a/src/Auth0.ManagementApi/Connections/ScimConfiguration/ScimConfigurationClient.cs +++ b/src/Auth0.ManagementApi/Connections/ScimConfiguration/ScimConfigurationClient.cs @@ -232,7 +232,6 @@ private async Task> Crea ), Body = request, Headers = _headers, - ContentType = "application/json", Options = options, }, cancellationToken @@ -512,7 +511,7 @@ await ListInternalAsync(request, options, cancellationToken).WithRawResponse(), } /// - /// Retrieves a scim configuration by its connectionId. + /// Retrieves a scim configuration by its `connectionId`. /// /// /// await client.Connections.ScimConfiguration.GetAsync("id"); @@ -550,7 +549,7 @@ public WithRawResponseTask CreateAsync( } /// - /// Deletes a scim configuration by its connectionId. + /// Deletes a scim configuration by its `connectionId`. /// /// /// await client.Connections.ScimConfiguration.DeleteAsync("id"); @@ -613,7 +612,7 @@ public async Task DeleteAsync( } /// - /// Update a scim configuration by its connectionId. + /// Update a scim configuration by its `connectionId`. /// /// /// await client.Connections.ScimConfiguration.UpdateAsync( @@ -638,7 +637,7 @@ public WithRawResponseTask UpdateAsync( } /// - /// Retrieves a scim configuration's default mapping by its connectionId. + /// Retrieves a scim configuration's default mapping by its `connectionId`. /// /// /// await client.Connections.ScimConfiguration.GetDefaultMappingAsync("id"); diff --git a/src/Auth0.ManagementApi/Connections/ScimConfiguration/Tokens/ITokensClient.cs b/src/Auth0.ManagementApi/Connections/ScimConfiguration/Tokens/ITokensClient.cs index 7e655ac14..ade775a08 100644 --- a/src/Auth0.ManagementApi/Connections/ScimConfiguration/Tokens/ITokensClient.cs +++ b/src/Auth0.ManagementApi/Connections/ScimConfiguration/Tokens/ITokensClient.cs @@ -5,7 +5,7 @@ namespace Auth0.ManagementApi.Connections.ScimConfiguration; public partial interface ITokensClient { /// - /// Retrieves all scim tokens by its connection id. + /// Retrieves all scim tokens by its connection `id`. /// WithRawResponseTask> GetAsync( string id, @@ -24,7 +24,7 @@ WithRawResponseTask CreateAsync( ); /// - /// Deletes a scim token by its connection id and tokenId. + /// Deletes a scim token by its connection `id` and `tokenId`. /// Task DeleteAsync( string id, diff --git a/src/Auth0.ManagementApi/Connections/ScimConfiguration/Tokens/TokensClient.cs b/src/Auth0.ManagementApi/Connections/ScimConfiguration/Tokens/TokensClient.cs index b30497d1b..47127367b 100644 --- a/src/Auth0.ManagementApi/Connections/ScimConfiguration/Tokens/TokensClient.cs +++ b/src/Auth0.ManagementApi/Connections/ScimConfiguration/Tokens/TokensClient.cs @@ -185,7 +185,7 @@ private async Task> CreateAsyncC } /// - /// Retrieves all scim tokens by its connection id. + /// Retrieves all scim tokens by its connection `id`. /// /// /// await client.Connections.ScimConfiguration.Tokens.GetAsync("id"); @@ -223,7 +223,7 @@ public WithRawResponseTask CreateAsync( } /// - /// Deletes a scim token by its connection id and tokenId. + /// Deletes a scim token by its connection `id` and `tokenId`. /// /// /// await client.Connections.ScimConfiguration.Tokens.DeleteAsync("id", "tokenId"); diff --git a/src/Auth0.ManagementApi/EventStreams/EventStreamsClient.cs b/src/Auth0.ManagementApi/EventStreams/EventStreamsClient.cs index 609aed5e3..4a4589ea3 100644 --- a/src/Auth0.ManagementApi/EventStreams/EventStreamsClient.cs +++ b/src/Auth0.ManagementApi/EventStreams/EventStreamsClient.cs @@ -141,7 +141,6 @@ private async Task> CreateAsyn Path = "event-streams", Body = request, Headers = _headers, - ContentType = "application/json", Options = options, }, cancellationToken diff --git a/src/Auth0.ManagementApi/Flows/Vault/Connections/ConnectionsClient.cs b/src/Auth0.ManagementApi/Flows/Vault/Connections/ConnectionsClient.cs index 82883acfe..514bc2e73 100644 --- a/src/Auth0.ManagementApi/Flows/Vault/Connections/ConnectionsClient.cs +++ b/src/Auth0.ManagementApi/Flows/Vault/Connections/ConnectionsClient.cs @@ -142,7 +142,6 @@ private async Task> C Path = "flows/vault/connections", Body = request, Headers = _headers, - ContentType = "application/json", Options = options, }, cancellationToken diff --git a/src/Auth0.ManagementApi/Groups/GroupsClient.cs b/src/Auth0.ManagementApi/Groups/GroupsClient.cs index aaeb7a58d..aab3438ed 100644 --- a/src/Auth0.ManagementApi/Groups/GroupsClient.cs +++ b/src/Auth0.ManagementApi/Groups/GroupsClient.cs @@ -11,10 +11,13 @@ internal GroupsClient(RawClient client) { _client = client; Members = new Auth0.ManagementApi.Groups.MembersClient(_client); + Roles = new Auth0.ManagementApi.Groups.RolesClient(_client); } public Auth0.ManagementApi.Groups.IMembersClient Members { get; } + public Auth0.ManagementApi.Groups.IRolesClient Roles { get; } + /// /// List all groups in your tenant. /// diff --git a/src/Auth0.ManagementApi/Groups/IGroupsClient.cs b/src/Auth0.ManagementApi/Groups/IGroupsClient.cs index 597690172..2e60af160 100644 --- a/src/Auth0.ManagementApi/Groups/IGroupsClient.cs +++ b/src/Auth0.ManagementApi/Groups/IGroupsClient.cs @@ -5,6 +5,7 @@ namespace Auth0.ManagementApi; public partial interface IGroupsClient { public Auth0.ManagementApi.Groups.IMembersClient Members { get; } + public Auth0.ManagementApi.Groups.IRolesClient Roles { get; } /// /// List all groups in your tenant. diff --git a/src/Auth0.ManagementApi/Groups/Roles/IRolesClient.cs b/src/Auth0.ManagementApi/Groups/Roles/IRolesClient.cs new file mode 100644 index 000000000..69213ca71 --- /dev/null +++ b/src/Auth0.ManagementApi/Groups/Roles/IRolesClient.cs @@ -0,0 +1,37 @@ +using Auth0.ManagementApi; +using Auth0.ManagementApi.Core; + +namespace Auth0.ManagementApi.Groups; + +public partial interface IRolesClient +{ + /// + /// Lists the roles assigned to a group. + /// + Task> ListAsync( + string id, + ListGroupRolesRequestParameters request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ); + + /// + /// Assign one or more roles to a specified group. + /// + Task CreateAsync( + string id, + CreateGroupRolesRequestParameters request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ); + + /// + /// Unassign one or more roles from a specified group. + /// + Task DeleteAsync( + string id, + DeleteGroupRolesRequestContent request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ); +} diff --git a/src/Auth0.ManagementApi/Groups/Roles/Requests/CreateGroupRolesRequestParameters.cs b/src/Auth0.ManagementApi/Groups/Roles/Requests/CreateGroupRolesRequestParameters.cs new file mode 100644 index 000000000..7d94417ba --- /dev/null +++ b/src/Auth0.ManagementApi/Groups/Roles/Requests/CreateGroupRolesRequestParameters.cs @@ -0,0 +1,20 @@ +using Auth0.ManagementApi.Core; +using global::System.Text.Json.Serialization; + +namespace Auth0.ManagementApi.Groups; + +[Serializable] +public record CreateGroupRolesRequestParameters +{ + /// + /// Array of role IDs to assign to the group. + /// + [JsonPropertyName("roles")] + public IEnumerable Roles { get; set; } = new List(); + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Auth0.ManagementApi/Groups/Roles/Requests/DeleteGroupRolesRequestContent.cs b/src/Auth0.ManagementApi/Groups/Roles/Requests/DeleteGroupRolesRequestContent.cs new file mode 100644 index 000000000..718c3553d --- /dev/null +++ b/src/Auth0.ManagementApi/Groups/Roles/Requests/DeleteGroupRolesRequestContent.cs @@ -0,0 +1,20 @@ +using Auth0.ManagementApi.Core; +using global::System.Text.Json.Serialization; + +namespace Auth0.ManagementApi.Groups; + +[Serializable] +public record DeleteGroupRolesRequestContent +{ + /// + /// Array of role IDs to remove from the group. + /// + [JsonPropertyName("roles")] + public IEnumerable Roles { get; set; } = new List(); + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Auth0.ManagementApi/Groups/Roles/Requests/ListGroupRolesRequestParameters.cs b/src/Auth0.ManagementApi/Groups/Roles/Requests/ListGroupRolesRequestParameters.cs new file mode 100644 index 000000000..818566052 --- /dev/null +++ b/src/Auth0.ManagementApi/Groups/Roles/Requests/ListGroupRolesRequestParameters.cs @@ -0,0 +1,26 @@ +using Auth0.ManagementApi.Core; +using global::System.Text.Json.Serialization; + +namespace Auth0.ManagementApi.Groups; + +[Serializable] +public record ListGroupRolesRequestParameters +{ + /// + /// Optional Id from which to start selection. + /// + [JsonIgnore] + public Optional From { get; set; } + + /// + /// Number of results per page. Defaults to 50. + /// + [JsonIgnore] + public Optional Take { get; set; } = 50; + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Auth0.ManagementApi/Groups/Roles/RolesClient.cs b/src/Auth0.ManagementApi/Groups/Roles/RolesClient.cs new file mode 100644 index 000000000..e221ad051 --- /dev/null +++ b/src/Auth0.ManagementApi/Groups/Roles/RolesClient.cs @@ -0,0 +1,318 @@ +using Auth0.ManagementApi; +using Auth0.ManagementApi.Core; +using global::System.Text.Json; + +namespace Auth0.ManagementApi.Groups; + +public partial class RolesClient : IRolesClient +{ + private readonly RawClient _client; + + internal RolesClient(RawClient client) + { + _client = client; + } + + /// + /// Lists the roles assigned to a group. + /// + private WithRawResponseTask ListInternalAsync( + string id, + ListGroupRolesRequestParameters request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + return new WithRawResponseTask( + ListInternalAsyncCore(id, request, options, cancellationToken) + ); + } + + private async Task> ListInternalAsyncCore( + string id, + ListGroupRolesRequestParameters request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + var _queryString = new Auth0.ManagementApi.Core.QueryStringBuilder.Builder(capacity: 2) + .Add("from", request.From.IsDefined ? request.From.Value : null) + .Add("take", request.Take.IsDefined ? request.Take.Value : null) + .MergeAdditional(options?.AdditionalQueryParameters) + .Build(); + var _headers = await new Auth0.ManagementApi.Core.HeadersBuilder.Builder() + .Add(_client.Options.Headers) + .Add(_client.Options.AdditionalHeaders) + .Add(options?.AdditionalHeaders) + .BuildAsync() + .ConfigureAwait(false); + var response = await _client + .SendRequestAsync( + new JsonRequest + { + Method = HttpMethod.Get, + Path = string.Format( + "groups/{0}/roles", + ValueConvert.ToPathParameterString(id) + ), + QueryString = _queryString, + Headers = _headers, + Options = options, + }, + cancellationToken + ) + .ConfigureAwait(false); + if (response.StatusCode is >= 200 and < 400) + { + var responseBody = await response + .Raw.Content.ReadAsStringAsync(cancellationToken) + .ConfigureAwait(false); + try + { + var responseData = JsonUtils.Deserialize( + responseBody + )!; + return new WithRawResponse() + { + Data = responseData, + RawResponse = new RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = response.Raw.RequestMessage?.RequestUri ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + }, + }; + } + catch (JsonException e) + { + throw new ManagementApiException( + "Failed to deserialize response", + response.StatusCode, + null, + e + ); + } + } + { + var responseBody = await response + .Raw.Content.ReadAsStringAsync(cancellationToken) + .ConfigureAwait(false); + try + { + switch (response.StatusCode) + { + case 400: + throw new BadRequestError(JsonUtils.Deserialize(responseBody)); + case 401: + throw new UnauthorizedError(JsonUtils.Deserialize(responseBody)); + case 403: + throw new ForbiddenError(JsonUtils.Deserialize(responseBody)); + case 429: + throw new TooManyRequestsError(JsonUtils.Deserialize(responseBody)); + } + } + catch (JsonException) + { + // unable to map error response, throwing generic error + } + throw new ManagementApiException( + $"Error with status code {response.StatusCode}", + response.StatusCode, + responseBody + ); + } + } + + /// + /// Lists the roles assigned to a group. + /// + /// + /// await client.Groups.Roles.ListAsync( + /// "id", + /// new ListGroupRolesRequestParameters { From = "from", Take = 1 } + /// ); + /// + public async Task> ListAsync( + string id, + ListGroupRolesRequestParameters request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + if (request is not null) + { + request = request with { }; + } + var pager = await CursorPager< + ListGroupRolesRequestParameters, + RequestOptions?, + ListGroupRolesResponseContent, + string?, + Role + > + .CreateInstanceAsync( + request, + options, + async (request, options, cancellationToken) => + await ListInternalAsync(id, request, options, cancellationToken) + .WithRawResponse(), + (request, cursor) => + { + request.From = cursor; + }, + response => response.Next, + response => response.Roles?.ToList(), + cancellationToken + ) + .ConfigureAwait(false); + return pager; + } + + /// + /// Assign one or more roles to a specified group. + /// + /// + /// await client.Groups.Roles.CreateAsync( + /// "id", + /// new CreateGroupRolesRequestParameters { Roles = new List<string>() { "roles" } } + /// ); + /// + public async Task CreateAsync( + string id, + CreateGroupRolesRequestParameters request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + var _headers = await new Auth0.ManagementApi.Core.HeadersBuilder.Builder() + .Add(_client.Options.Headers) + .Add(_client.Options.AdditionalHeaders) + .Add(options?.AdditionalHeaders) + .BuildAsync() + .ConfigureAwait(false); + var response = await _client + .SendRequestAsync( + new JsonRequest + { + Method = HttpMethod.Post, + Path = string.Format( + "groups/{0}/roles", + ValueConvert.ToPathParameterString(id) + ), + Body = request, + Headers = _headers, + ContentType = "application/json", + Options = options, + }, + cancellationToken + ) + .ConfigureAwait(false); + if (response.StatusCode is >= 200 and < 400) + { + return; + } + { + var responseBody = await response + .Raw.Content.ReadAsStringAsync(cancellationToken) + .ConfigureAwait(false); + try + { + switch (response.StatusCode) + { + case 400: + throw new BadRequestError(JsonUtils.Deserialize(responseBody)); + case 401: + throw new UnauthorizedError(JsonUtils.Deserialize(responseBody)); + case 403: + throw new ForbiddenError(JsonUtils.Deserialize(responseBody)); + case 404: + throw new NotFoundError(JsonUtils.Deserialize(responseBody)); + case 429: + throw new TooManyRequestsError(JsonUtils.Deserialize(responseBody)); + } + } + catch (JsonException) + { + // unable to map error response, throwing generic error + } + throw new ManagementApiException( + $"Error with status code {response.StatusCode}", + response.StatusCode, + responseBody + ); + } + } + + /// + /// Unassign one or more roles from a specified group. + /// + /// + /// await client.Groups.Roles.DeleteAsync( + /// "id", + /// new DeleteGroupRolesRequestContent { Roles = new List<string>() { "roles" } } + /// ); + /// + public async Task DeleteAsync( + string id, + DeleteGroupRolesRequestContent request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + var _headers = await new Auth0.ManagementApi.Core.HeadersBuilder.Builder() + .Add(_client.Options.Headers) + .Add(_client.Options.AdditionalHeaders) + .Add(options?.AdditionalHeaders) + .BuildAsync() + .ConfigureAwait(false); + var response = await _client + .SendRequestAsync( + new JsonRequest + { + Method = HttpMethod.Delete, + Path = string.Format( + "groups/{0}/roles", + ValueConvert.ToPathParameterString(id) + ), + Body = request, + Headers = _headers, + ContentType = "application/json", + Options = options, + }, + cancellationToken + ) + .ConfigureAwait(false); + if (response.StatusCode is >= 200 and < 400) + { + return; + } + { + var responseBody = await response + .Raw.Content.ReadAsStringAsync(cancellationToken) + .ConfigureAwait(false); + try + { + switch (response.StatusCode) + { + case 400: + throw new BadRequestError(JsonUtils.Deserialize(responseBody)); + case 401: + throw new UnauthorizedError(JsonUtils.Deserialize(responseBody)); + case 403: + throw new ForbiddenError(JsonUtils.Deserialize(responseBody)); + case 429: + throw new TooManyRequestsError(JsonUtils.Deserialize(responseBody)); + } + } + catch (JsonException) + { + // unable to map error response, throwing generic error + } + throw new ManagementApiException( + $"Error with status code {response.StatusCode}", + response.StatusCode, + responseBody + ); + } + } +} diff --git a/src/Auth0.ManagementApi/Guardian/Enrollments/EnrollmentsClient.cs b/src/Auth0.ManagementApi/Guardian/Enrollments/EnrollmentsClient.cs index 91f012aa7..9eb41c8ac 100644 --- a/src/Auth0.ManagementApi/Guardian/Enrollments/EnrollmentsClient.cs +++ b/src/Auth0.ManagementApi/Guardian/Enrollments/EnrollmentsClient.cs @@ -190,10 +190,7 @@ private async Task> GetAsy } /// - /// Create a multi-factor authentication (MFA) enrollment ticket, and optionally send an email with the created ticket, to a given user. - /// Create a multi-factor authentication (MFA) enrollment ticket, and optionally send an email with the created ticket to a given user. Enrollment tickets can specify which factor users must enroll with or allow existing MFA users to enroll in additional factors.
- /// - /// Note: Users cannot enroll in Email as a factor through custom enrollment tickets. + /// Create a [multi-factor authentication (MFA) enrollment ticket](https://auth0.com/docs/secure/multi-factor-authentication/auth0-guardian/create-custom-enrollment-tickets), and optionally send an email with the created ticket to a given user. Enrollment tickets can specify which factor users must enroll with or allow existing MFA users to enroll in additional factors. ///
/// /// await client.Guardian.Enrollments.CreateTicketAsync( @@ -229,7 +226,7 @@ public WithRawResponseTask GetAsync( } /// - /// Remove a specific multi-factor authentication (MFA) enrollment from a user's account. This allows the user to re-enroll with MFA. For more information, review Reset User Multi-Factor Authentication and Recovery Codes. + /// Remove a specific multi-factor authentication (MFA) enrollment from a user's account. This allows the user to re-enroll with MFA. For more information, review [Reset User Multi-Factor Authentication and Recovery Codes](https://auth0.com/docs/secure/multi-factor-authentication/reset-user-mfa). /// /// /// await client.Guardian.Enrollments.DeleteAsync("id"); diff --git a/src/Auth0.ManagementApi/Guardian/Enrollments/IEnrollmentsClient.cs b/src/Auth0.ManagementApi/Guardian/Enrollments/IEnrollmentsClient.cs index 847fc293f..467420125 100644 --- a/src/Auth0.ManagementApi/Guardian/Enrollments/IEnrollmentsClient.cs +++ b/src/Auth0.ManagementApi/Guardian/Enrollments/IEnrollmentsClient.cs @@ -5,10 +5,7 @@ namespace Auth0.ManagementApi.Guardian; public partial interface IEnrollmentsClient { /// - /// Create a multi-factor authentication (MFA) enrollment ticket, and optionally send an email with the created ticket, to a given user. - /// Create a multi-factor authentication (MFA) enrollment ticket, and optionally send an email with the created ticket to a given user. Enrollment tickets can specify which factor users must enroll with or allow existing MFA users to enroll in additional factors.
- /// - /// Note: Users cannot enroll in Email as a factor through custom enrollment tickets. + /// Create a [multi-factor authentication (MFA) enrollment ticket](https://auth0.com/docs/secure/multi-factor-authentication/auth0-guardian/create-custom-enrollment-tickets), and optionally send an email with the created ticket to a given user. Enrollment tickets can specify which factor users must enroll with or allow existing MFA users to enroll in additional factors. ///
WithRawResponseTask CreateTicketAsync( CreateGuardianEnrollmentTicketRequestContent request, @@ -26,7 +23,7 @@ WithRawResponseTask GetAsync( ); /// - /// Remove a specific multi-factor authentication (MFA) enrollment from a user's account. This allows the user to re-enroll with MFA. For more information, review Reset User Multi-Factor Authentication and Recovery Codes. + /// Remove a specific multi-factor authentication (MFA) enrollment from a user's account. This allows the user to re-enroll with MFA. For more information, review [Reset User Multi-Factor Authentication and Recovery Codes](https://auth0.com/docs/secure/multi-factor-authentication/reset-user-mfa). /// Task DeleteAsync( string id, diff --git a/src/Auth0.ManagementApi/Guardian/Factors/PushNotification/IPushNotificationClient.cs b/src/Auth0.ManagementApi/Guardian/Factors/PushNotification/IPushNotificationClient.cs index 44fc2c269..92d1f14ce 100644 --- a/src/Auth0.ManagementApi/Guardian/Factors/PushNotification/IPushNotificationClient.cs +++ b/src/Auth0.ManagementApi/Guardian/Factors/PushNotification/IPushNotificationClient.cs @@ -67,7 +67,7 @@ WithRawResponseTask - /// Retrieve configuration details for an AWS SNS push notification provider that has been enabled for MFA. To learn more, review Configure Push Notifications for MFA. + /// Retrieve configuration details for an AWS SNS push notification provider that has been enabled for MFA. To learn more, review [Configure Push Notifications for MFA](https://auth0.com/docs/secure/multi-factor-authentication/multi-factor-authentication-factors/configure-push-notifications-for-mfa). /// WithRawResponseTask GetSnsProviderAsync( RequestOptions? options = null, @@ -75,7 +75,7 @@ WithRawResponseTask GetSnsProvider ); /// - /// Configure the AWS SNS push notification provider configuration (subscription required). + /// Configure the [AWS SNS push notification provider configuration](https://auth0.com/docs/multifactor-authentication/developer/sns-configuration) (subscription required). /// WithRawResponseTask SetSnsProviderAsync( SetGuardianFactorsProviderPushNotificationSnsRequestContent request, @@ -84,7 +84,7 @@ WithRawResponseTask - /// Configure the AWS SNS push notification provider configuration (subscription required). + /// Configure the [AWS SNS push notification provider configuration](https://auth0.com/docs/multifactor-authentication/developer/sns-configuration) (subscription required). /// WithRawResponseTask UpdateSnsProviderAsync( UpdateGuardianFactorsProviderPushNotificationSnsRequestContent request, diff --git a/src/Auth0.ManagementApi/Guardian/Factors/PushNotification/PushNotificationClient.cs b/src/Auth0.ManagementApi/Guardian/Factors/PushNotification/PushNotificationClient.cs index 46c47ae58..e5da74c4b 100644 --- a/src/Auth0.ManagementApi/Guardian/Factors/PushNotification/PushNotificationClient.cs +++ b/src/Auth0.ManagementApi/Guardian/Factors/PushNotification/PushNotificationClient.cs @@ -1179,7 +1179,7 @@ public WithRawResponseTask - /// Retrieve configuration details for an AWS SNS push notification provider that has been enabled for MFA. To learn more, review Configure Push Notifications for MFA. + /// Retrieve configuration details for an AWS SNS push notification provider that has been enabled for MFA. To learn more, review [Configure Push Notifications for MFA](https://auth0.com/docs/secure/multi-factor-authentication/multi-factor-authentication-factors/configure-push-notifications-for-mfa). /// /// /// await client.Guardian.Factors.PushNotification.GetSnsProviderAsync(); @@ -1195,7 +1195,7 @@ public WithRawResponseTask GetSnsP } /// - /// Configure the AWS SNS push notification provider configuration (subscription required). + /// Configure the [AWS SNS push notification provider configuration](https://auth0.com/docs/multifactor-authentication/developer/sns-configuration) (subscription required). /// /// /// await client.Guardian.Factors.PushNotification.SetSnsProviderAsync( @@ -1214,7 +1214,7 @@ public WithRawResponseTask - /// Configure the AWS SNS push notification provider configuration (subscription required). + /// Configure the [AWS SNS push notification provider configuration](https://auth0.com/docs/multifactor-authentication/developer/sns-configuration) (subscription required). /// /// /// await client.Guardian.Factors.PushNotification.UpdateSnsProviderAsync( diff --git a/src/Auth0.ManagementApi/Guardian/Policies/IPoliciesClient.cs b/src/Auth0.ManagementApi/Guardian/Policies/IPoliciesClient.cs index 09966c858..5dbd2bd8d 100644 --- a/src/Auth0.ManagementApi/Guardian/Policies/IPoliciesClient.cs +++ b/src/Auth0.ManagementApi/Guardian/Policies/IPoliciesClient.cs @@ -5,15 +5,14 @@ namespace Auth0.ManagementApi.Guardian; public partial interface IPoliciesClient { /// - /// Retrieve the multi-factor authentication (MFA) policies configured for your tenant. + /// Retrieve the [multi-factor authentication (MFA) policies](https://auth0.com/docs/secure/multi-factor-authentication/enable-mfa) configured for your tenant. /// /// The following policies are supported: - /// - /// all-applications policy prompts with MFA for all logins. - /// confidence-score policy prompts with MFA only for low confidence logins. - /// /// - /// Note: The confidence-score policy is part of the Adaptive MFA feature. Adaptive MFA requires an add-on for the Enterprise plan; review Auth0 Pricing for more details. + /// - `all-applications` policy prompts with MFA for all logins. + /// - `confidence-score` policy prompts with MFA only for low confidence logins. + /// + /// **Note**: The `confidence-score` policy is part of the [Adaptive MFA feature](https://auth0.com/docs/secure/multi-factor-authentication/adaptive-mfa). Adaptive MFA requires an add-on for the Enterprise plan; review [Auth0 Pricing](https://auth0.com/pricing) for more details. /// WithRawResponseTask> ListAsync( RequestOptions? options = null, @@ -21,15 +20,14 @@ WithRawResponseTask> ListAsync( ); /// - /// Set multi-factor authentication (MFA) policies for your tenant. + /// Set [multi-factor authentication (MFA) policies](https://auth0.com/docs/secure/multi-factor-authentication/enable-mfa) for your tenant. /// /// The following policies are supported: - /// - /// all-applications policy prompts with MFA for all logins. - /// confidence-score policy prompts with MFA only for low confidence logins. - /// /// - /// Note: The confidence-score policy is part of the Adaptive MFA feature. Adaptive MFA requires an add-on for the Enterprise plan; review Auth0 Pricing for more details. + /// - `all-applications` policy prompts with MFA for all logins. + /// - `confidence-score` policy prompts with MFA only for low confidence logins. + /// + /// **Note**: The `confidence-score` policy is part of the [Adaptive MFA feature](https://auth0.com/docs/secure/multi-factor-authentication/adaptive-mfa). Adaptive MFA requires an add-on for the Enterprise plan; review [Auth0 Pricing](https://auth0.com/pricing) for more details. /// WithRawResponseTask> SetAsync( IEnumerable request, diff --git a/src/Auth0.ManagementApi/Guardian/Policies/PoliciesClient.cs b/src/Auth0.ManagementApi/Guardian/Policies/PoliciesClient.cs index eabcbdbb4..0e7c3072d 100644 --- a/src/Auth0.ManagementApi/Guardian/Policies/PoliciesClient.cs +++ b/src/Auth0.ManagementApi/Guardian/Policies/PoliciesClient.cs @@ -113,7 +113,6 @@ private async Task>> SetAsyncCore( Path = "guardian/policies", Body = request, Headers = _headers, - ContentType = "application/json", Options = options, }, cancellationToken @@ -177,15 +176,14 @@ private async Task>> SetAsyncCore( } /// - /// Retrieve the multi-factor authentication (MFA) policies configured for your tenant. + /// Retrieve the [multi-factor authentication (MFA) policies](https://auth0.com/docs/secure/multi-factor-authentication/enable-mfa) configured for your tenant. /// /// The following policies are supported: - /// - /// all-applications policy prompts with MFA for all logins. - /// confidence-score policy prompts with MFA only for low confidence logins. - /// /// - /// Note: The confidence-score policy is part of the Adaptive MFA feature. Adaptive MFA requires an add-on for the Enterprise plan; review Auth0 Pricing for more details. + /// - `all-applications` policy prompts with MFA for all logins. + /// - `confidence-score` policy prompts with MFA only for low confidence logins. + /// + /// **Note**: The `confidence-score` policy is part of the [Adaptive MFA feature](https://auth0.com/docs/secure/multi-factor-authentication/adaptive-mfa). Adaptive MFA requires an add-on for the Enterprise plan; review [Auth0 Pricing](https://auth0.com/pricing) for more details. /// /// /// await client.Guardian.Policies.ListAsync(); @@ -201,15 +199,14 @@ public WithRawResponseTask> ListAsync( } /// - /// Set multi-factor authentication (MFA) policies for your tenant. + /// Set [multi-factor authentication (MFA) policies](https://auth0.com/docs/secure/multi-factor-authentication/enable-mfa) for your tenant. /// /// The following policies are supported: - /// - /// all-applications policy prompts with MFA for all logins. - /// confidence-score policy prompts with MFA only for low confidence logins. - /// /// - /// Note: The confidence-score policy is part of the Adaptive MFA feature. Adaptive MFA requires an add-on for the Enterprise plan; review Auth0 Pricing for more details. + /// - `all-applications` policy prompts with MFA for all logins. + /// - `confidence-score` policy prompts with MFA only for low confidence logins. + /// + /// **Note**: The `confidence-score` policy is part of the [Adaptive MFA feature](https://auth0.com/docs/secure/multi-factor-authentication/adaptive-mfa). Adaptive MFA requires an add-on for the Enterprise plan; review [Auth0 Pricing](https://auth0.com/pricing) for more details. /// /// /// await client.Guardian.Policies.SetAsync( diff --git a/src/Auth0.ManagementApi/Hooks/Secrets/SecretsClient.cs b/src/Auth0.ManagementApi/Hooks/Secrets/SecretsClient.cs index 0c2b6dae8..ee1700d1f 100644 --- a/src/Auth0.ManagementApi/Hooks/Secrets/SecretsClient.cs +++ b/src/Auth0.ManagementApi/Hooks/Secrets/SecretsClient.cs @@ -151,7 +151,6 @@ public async Task CreateAsync( ), Body = request, Headers = _headers, - ContentType = "application/json", Options = options, }, cancellationToken @@ -223,7 +222,6 @@ public async Task DeleteAsync( ), Body = request, Headers = _headers, - ContentType = "application/json", Options = options, }, cancellationToken @@ -296,7 +294,6 @@ public async Task UpdateAsync( ), Body = request, Headers = _headers, - ContentType = "application/json", Options = options, }, cancellationToken diff --git a/src/Auth0.ManagementApi/IManagementApiClient.cs b/src/Auth0.ManagementApi/IManagementApiClient.cs index 3c4e56b51..2d5f8bf19 100644 --- a/src/Auth0.ManagementApi/IManagementApiClient.cs +++ b/src/Auth0.ManagementApi/IManagementApiClient.cs @@ -31,6 +31,7 @@ public partial interface IManagementApiClient public INetworkAclsClient NetworkAcls { get; } public IOrganizationsClient Organizations { get; } public IPromptsClient Prompts { get; } + public IRateLimitPoliciesClient RateLimitPolicies { get; } public IRefreshTokensClient RefreshTokens { get; } public IResourceServersClient ResourceServers { get; } public IRolesClient Roles { get; } diff --git a/src/Auth0.ManagementApi/Jobs/VerificationEmail/IVerificationEmailClient.cs b/src/Auth0.ManagementApi/Jobs/VerificationEmail/IVerificationEmailClient.cs index 5664ecc4c..44d0efafe 100644 --- a/src/Auth0.ManagementApi/Jobs/VerificationEmail/IVerificationEmailClient.cs +++ b/src/Auth0.ManagementApi/Jobs/VerificationEmail/IVerificationEmailClient.cs @@ -5,7 +5,7 @@ namespace Auth0.ManagementApi.Jobs; public partial interface IVerificationEmailClient { /// - /// Send an email to the specified user that asks them to click a link to verify their email address. + /// Send an email to the specified user that asks them to click a link to [verify their email address](https://auth0.com/docs/email/custom#verification-email). /// /// Note: You must have the `Status` toggle enabled for the verification email template for the email to be sent. /// diff --git a/src/Auth0.ManagementApi/Jobs/VerificationEmail/VerificationEmailClient.cs b/src/Auth0.ManagementApi/Jobs/VerificationEmail/VerificationEmailClient.cs index 7af399938..e404305f7 100644 --- a/src/Auth0.ManagementApi/Jobs/VerificationEmail/VerificationEmailClient.cs +++ b/src/Auth0.ManagementApi/Jobs/VerificationEmail/VerificationEmailClient.cs @@ -101,7 +101,7 @@ private async Task> Crea } /// - /// Send an email to the specified user that asks them to click a link to verify their email address. + /// Send an email to the specified user that asks them to click a link to [verify their email address](https://auth0.com/docs/email/custom#verification-email). /// /// Note: You must have the `Status` toggle enabled for the verification email template for the email to be sent. /// diff --git a/src/Auth0.ManagementApi/LogStreams/LogStreamsClient.cs b/src/Auth0.ManagementApi/LogStreams/LogStreamsClient.cs index fddfaf6af..597fa9da2 100644 --- a/src/Auth0.ManagementApi/LogStreams/LogStreamsClient.cs +++ b/src/Auth0.ManagementApi/LogStreams/LogStreamsClient.cs @@ -116,7 +116,6 @@ private async Task> CreateAsyncC Path = "log-streams", Body = request, Headers = _headers, - ContentType = "application/json", Options = options, }, cancellationToken diff --git a/src/Auth0.ManagementApi/Logs/ILogsClient.cs b/src/Auth0.ManagementApi/Logs/ILogsClient.cs index 8df64bcd8..ea1404285 100644 --- a/src/Auth0.ManagementApi/Logs/ILogsClient.cs +++ b/src/Auth0.ManagementApi/Logs/ILogsClient.cs @@ -7,33 +7,30 @@ public partial interface ILogsClient /// /// Retrieve log entries that match the specified search criteria (or all log entries if no criteria specified). /// - /// Set custom search criteria using the q parameter, or search from a specific log ID ("search from checkpoint"). + /// Set custom search criteria using the `q` parameter, or search from a specific log ID (_"search from checkpoint"_). /// - /// For more information on all possible event types, their respective acronyms, and descriptions, see Log Event Type Codes. + /// For more information on all possible event types, their respective acronyms, and descriptions, see [Log Event Type Codes](https://auth0.com/docs/logs/log-event-type-codes). /// - /// To set custom search criteria, use the following parameters: + /// **To set custom search criteria, use the following parameters:** /// - /// - /// q: Search Criteria using Query String Syntax - /// page: Page index of the results to return. First page is 0. - /// per_page: Number of results per page. - /// sort: Field to use for sorting appended with `:1` for ascending and `:-1` for descending. e.g. `date:-1` - /// fields: Comma-separated list of fields to include or exclude (depending on include_fields) from the result, empty to retrieve all fields. - /// include_fields: Whether specified fields are to be included (true) or excluded (false). - /// include_totals: Return results inside an object that contains the total result count (true) or as a direct array of results (false, default). Deprecated: this field is deprecated and should be removed from use. See Search Engine V3 Breaking Changes - /// + /// - **q:** Search Criteria using [Query String Syntax](https://auth0.com/docs/logs/log-search-query-syntax) + /// - **page:** Page index of the results to return. First page is 0. + /// - **per_page:** Number of results per page. + /// - **sort:** Field to use for sorting appended with `:1` for ascending and `:-1` for descending. e.g. `date:-1` + /// - **fields:** Comma-separated list of fields to include or exclude (depending on include_fields) from the result, empty to retrieve all fields. + /// - **include_fields:** Whether specified fields are to be included (true) or excluded (false). + /// - **include_totals:** Return results inside an object that contains the total result count (true) or as a direct array of results (false, default). **Deprecated:** this field is deprecated and should be removed from use. See [Search Engine V3 Breaking Changes](https://auth0.com/docs/product-lifecycle/deprecations-and-migrations/migrate-to-tenant-log-search-v3#pagination) /// - /// For more information on the list of fields that can be used in fields and sort, see Searchable Fields. + /// For more information on the list of fields that can be used in `fields` and `sort`, see [Searchable Fields](https://auth0.com/docs/logs/log-search-query-syntax#searchable-fields). /// - /// Auth0 limits the number of logs you can return by search criteria to 100 logs per request. Furthermore, you may paginate only through 1,000 search results. If you exceed this threshold, please redefine your search or use the get logs by checkpoint method. + /// Auth0 [limits the number of logs](https://auth0.com/docs/logs/retrieve-log-events-using-mgmt-api#limitations) you can return by search criteria to 100 logs per request. Furthermore, you may paginate only through 1,000 search results. If you exceed this threshold, please redefine your search or use the [get logs by checkpoint method](https://auth0.com/docs/logs/retrieve-log-events-using-mgmt-api#retrieve-logs-by-checkpoint). /// - /// To search from a checkpoint log ID, use the following parameters: - /// - /// from: Log Event ID from which to start retrieving logs. You can limit the number of logs returned using the take parameter. If you use from at the same time as q, from takes precedence and q is ignored. - /// take: Number of entries to retrieve when using the from parameter. - /// + /// **To search from a checkpoint log ID, use the following parameters:** /// - /// Important: When fetching logs from a checkpoint log ID, any parameter other than from and take will be ignored, and date ordering is not guaranteed. + /// - **from:** Log Event ID from which to start retrieving logs. You can limit the number of logs returned using the `take` parameter. If you use `from` at the same time as `q`, `from` takes precedence and `q` is ignored. + /// - **take:** Number of entries to retrieve when using the `from` parameter. + /// + /// **Important:** When fetching logs from a checkpoint log ID, any parameter other than `from` and `take` will be ignored, and date ordering is not guaranteed. /// Task> ListAsync( ListLogsRequestParameters request, diff --git a/src/Auth0.ManagementApi/Logs/LogsClient.cs b/src/Auth0.ManagementApi/Logs/LogsClient.cs index 4cacc496a..5a022ee90 100644 --- a/src/Auth0.ManagementApi/Logs/LogsClient.cs +++ b/src/Auth0.ManagementApi/Logs/LogsClient.cs @@ -15,33 +15,30 @@ internal LogsClient(RawClient client) /// /// Retrieve log entries that match the specified search criteria (or all log entries if no criteria specified). /// - /// Set custom search criteria using the q parameter, or search from a specific log ID ("search from checkpoint"). + /// Set custom search criteria using the `q` parameter, or search from a specific log ID (_"search from checkpoint"_). /// - /// For more information on all possible event types, their respective acronyms, and descriptions, see Log Event Type Codes. + /// For more information on all possible event types, their respective acronyms, and descriptions, see [Log Event Type Codes](https://auth0.com/docs/logs/log-event-type-codes). /// - /// To set custom search criteria, use the following parameters: + /// **To set custom search criteria, use the following parameters:** /// - /// - /// q: Search Criteria using Query String Syntax - /// page: Page index of the results to return. First page is 0. - /// per_page: Number of results per page. - /// sort: Field to use for sorting appended with `:1` for ascending and `:-1` for descending. e.g. `date:-1` - /// fields: Comma-separated list of fields to include or exclude (depending on include_fields) from the result, empty to retrieve all fields. - /// include_fields: Whether specified fields are to be included (true) or excluded (false). - /// include_totals: Return results inside an object that contains the total result count (true) or as a direct array of results (false, default). Deprecated: this field is deprecated and should be removed from use. See Search Engine V3 Breaking Changes - /// + /// - **q:** Search Criteria using [Query String Syntax](https://auth0.com/docs/logs/log-search-query-syntax) + /// - **page:** Page index of the results to return. First page is 0. + /// - **per_page:** Number of results per page. + /// - **sort:** Field to use for sorting appended with `:1` for ascending and `:-1` for descending. e.g. `date:-1` + /// - **fields:** Comma-separated list of fields to include or exclude (depending on include_fields) from the result, empty to retrieve all fields. + /// - **include_fields:** Whether specified fields are to be included (true) or excluded (false). + /// - **include_totals:** Return results inside an object that contains the total result count (true) or as a direct array of results (false, default). **Deprecated:** this field is deprecated and should be removed from use. See [Search Engine V3 Breaking Changes](https://auth0.com/docs/product-lifecycle/deprecations-and-migrations/migrate-to-tenant-log-search-v3#pagination) /// - /// For more information on the list of fields that can be used in fields and sort, see Searchable Fields. + /// For more information on the list of fields that can be used in `fields` and `sort`, see [Searchable Fields](https://auth0.com/docs/logs/log-search-query-syntax#searchable-fields). /// - /// Auth0 limits the number of logs you can return by search criteria to 100 logs per request. Furthermore, you may paginate only through 1,000 search results. If you exceed this threshold, please redefine your search or use the get logs by checkpoint method. + /// Auth0 [limits the number of logs](https://auth0.com/docs/logs/retrieve-log-events-using-mgmt-api#limitations) you can return by search criteria to 100 logs per request. Furthermore, you may paginate only through 1,000 search results. If you exceed this threshold, please redefine your search or use the [get logs by checkpoint method](https://auth0.com/docs/logs/retrieve-log-events-using-mgmt-api#retrieve-logs-by-checkpoint). /// - /// To search from a checkpoint log ID, use the following parameters: - /// - /// from: Log Event ID from which to start retrieving logs. You can limit the number of logs returned using the take parameter. If you use from at the same time as q, from takes precedence and q is ignored. - /// take: Number of entries to retrieve when using the from parameter. - /// + /// **To search from a checkpoint log ID, use the following parameters:** /// - /// Important: When fetching logs from a checkpoint log ID, any parameter other than from and take will be ignored, and date ordering is not guaranteed. + /// - **from:** Log Event ID from which to start retrieving logs. You can limit the number of logs returned using the `take` parameter. If you use `from` at the same time as `q`, `from` takes precedence and `q` is ignored. + /// - **take:** Number of entries to retrieve when using the `from` parameter. + /// + /// **Important:** When fetching logs from a checkpoint log ID, any parameter other than `from` and `take` will be ignored, and date ordering is not guaranteed. /// private WithRawResponseTask ListInternalAsync( ListLogsRequestParameters request, @@ -246,33 +243,30 @@ private async Task> GetAsyncCore( /// /// Retrieve log entries that match the specified search criteria (or all log entries if no criteria specified). /// - /// Set custom search criteria using the q parameter, or search from a specific log ID ("search from checkpoint"). + /// Set custom search criteria using the `q` parameter, or search from a specific log ID (_"search from checkpoint"_). + /// + /// For more information on all possible event types, their respective acronyms, and descriptions, see [Log Event Type Codes](https://auth0.com/docs/logs/log-event-type-codes). /// - /// For more information on all possible event types, their respective acronyms, and descriptions, see Log Event Type Codes. + /// **To set custom search criteria, use the following parameters:** /// - /// To set custom search criteria, use the following parameters: + /// - **q:** Search Criteria using [Query String Syntax](https://auth0.com/docs/logs/log-search-query-syntax) + /// - **page:** Page index of the results to return. First page is 0. + /// - **per_page:** Number of results per page. + /// - **sort:** Field to use for sorting appended with `:1` for ascending and `:-1` for descending. e.g. `date:-1` + /// - **fields:** Comma-separated list of fields to include or exclude (depending on include_fields) from the result, empty to retrieve all fields. + /// - **include_fields:** Whether specified fields are to be included (true) or excluded (false). + /// - **include_totals:** Return results inside an object that contains the total result count (true) or as a direct array of results (false, default). **Deprecated:** this field is deprecated and should be removed from use. See [Search Engine V3 Breaking Changes](https://auth0.com/docs/product-lifecycle/deprecations-and-migrations/migrate-to-tenant-log-search-v3#pagination) /// - /// - /// q: Search Criteria using Query String Syntax - /// page: Page index of the results to return. First page is 0. - /// per_page: Number of results per page. - /// sort: Field to use for sorting appended with `:1` for ascending and `:-1` for descending. e.g. `date:-1` - /// fields: Comma-separated list of fields to include or exclude (depending on include_fields) from the result, empty to retrieve all fields. - /// include_fields: Whether specified fields are to be included (true) or excluded (false). - /// include_totals: Return results inside an object that contains the total result count (true) or as a direct array of results (false, default). Deprecated: this field is deprecated and should be removed from use. See Search Engine V3 Breaking Changes - /// + /// For more information on the list of fields that can be used in `fields` and `sort`, see [Searchable Fields](https://auth0.com/docs/logs/log-search-query-syntax#searchable-fields). /// - /// For more information on the list of fields that can be used in fields and sort, see Searchable Fields. + /// Auth0 [limits the number of logs](https://auth0.com/docs/logs/retrieve-log-events-using-mgmt-api#limitations) you can return by search criteria to 100 logs per request. Furthermore, you may paginate only through 1,000 search results. If you exceed this threshold, please redefine your search or use the [get logs by checkpoint method](https://auth0.com/docs/logs/retrieve-log-events-using-mgmt-api#retrieve-logs-by-checkpoint). /// - /// Auth0 limits the number of logs you can return by search criteria to 100 logs per request. Furthermore, you may paginate only through 1,000 search results. If you exceed this threshold, please redefine your search or use the get logs by checkpoint method. + /// **To search from a checkpoint log ID, use the following parameters:** /// - /// To search from a checkpoint log ID, use the following parameters: - /// - /// from: Log Event ID from which to start retrieving logs. You can limit the number of logs returned using the take parameter. If you use from at the same time as q, from takes precedence and q is ignored. - /// take: Number of entries to retrieve when using the from parameter. - /// + /// - **from:** Log Event ID from which to start retrieving logs. You can limit the number of logs returned using the `take` parameter. If you use `from` at the same time as `q`, `from` takes precedence and `q` is ignored. + /// - **take:** Number of entries to retrieve when using the `from` parameter. /// - /// Important: When fetching logs from a checkpoint log ID, any parameter other than from and take will be ignored, and date ordering is not guaranteed. + /// **Important:** When fetching logs from a checkpoint log ID, any parameter other than `from` and `take` will be ignored, and date ordering is not guaranteed. /// /// /// await client.Logs.ListAsync( diff --git a/src/Auth0.ManagementApi/ManagementApiClient.cs b/src/Auth0.ManagementApi/ManagementApiClient.cs index b26fb9f60..1a5f285d7 100644 --- a/src/Auth0.ManagementApi/ManagementApiClient.cs +++ b/src/Auth0.ManagementApi/ManagementApiClient.cs @@ -54,6 +54,7 @@ public ManagementApiClient(string? token = null, ClientOptions? clientOptions = NetworkAcls = new NetworkAclsClient(_client); Organizations = new OrganizationsClient(_client); Prompts = new PromptsClient(_client); + RateLimitPolicies = new RateLimitPoliciesClient(_client); RefreshTokens = new RefreshTokensClient(_client); ResourceServers = new ResourceServersClient(_client); Roles = new RolesClient(_client); @@ -122,6 +123,8 @@ public ManagementApiClient(string? token = null, ClientOptions? clientOptions = public IPromptsClient Prompts { get; } + public IRateLimitPoliciesClient RateLimitPolicies { get; } + public IRefreshTokensClient RefreshTokens { get; } public IResourceServersClient ResourceServers { get; } diff --git a/src/Auth0.ManagementApi/Prompts/CustomText/CustomTextClient.cs b/src/Auth0.ManagementApi/Prompts/CustomText/CustomTextClient.cs index f2cc28750..1c2cb76f1 100644 --- a/src/Auth0.ManagementApi/Prompts/CustomText/CustomTextClient.cs +++ b/src/Auth0.ManagementApi/Prompts/CustomText/CustomTextClient.cs @@ -159,7 +159,6 @@ public async Task SetAsync( ), Body = request, Headers = _headers, - ContentType = "application/json", Options = options, }, cancellationToken diff --git a/src/Auth0.ManagementApi/Prompts/Partials/PartialsClient.cs b/src/Auth0.ManagementApi/Prompts/Partials/PartialsClient.cs index b816369c3..44c699bc7 100644 --- a/src/Auth0.ManagementApi/Prompts/Partials/PartialsClient.cs +++ b/src/Auth0.ManagementApi/Prompts/Partials/PartialsClient.cs @@ -153,7 +153,6 @@ public async Task SetAsync( ), Body = request, Headers = _headers, - ContentType = "application/json", Options = options, }, cancellationToken diff --git a/src/Auth0.ManagementApi/RateLimitPolicies/IRateLimitPoliciesClient.cs b/src/Auth0.ManagementApi/RateLimitPolicies/IRateLimitPoliciesClient.cs new file mode 100644 index 000000000..de5f94ed5 --- /dev/null +++ b/src/Auth0.ManagementApi/RateLimitPolicies/IRateLimitPoliciesClient.cs @@ -0,0 +1,37 @@ +using Auth0.ManagementApi.Core; + +namespace Auth0.ManagementApi; + +public partial interface IRateLimitPoliciesClient +{ + Task> ListAsync( + ListRateLimitPoliciesRequestParameters request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ); + + WithRawResponseTask CreateAsync( + CreateRateLimitPolicyRequestContent request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ); + + WithRawResponseTask GetAsync( + string id, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ); + + Task DeleteAsync( + string id, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ); + + WithRawResponseTask UpdateAsync( + string id, + PatchRateLimitPolicyRequestContent request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ); +} diff --git a/src/Auth0.ManagementApi/RateLimitPolicies/RateLimitPoliciesClient.cs b/src/Auth0.ManagementApi/RateLimitPolicies/RateLimitPoliciesClient.cs new file mode 100644 index 000000000..8888ee424 --- /dev/null +++ b/src/Auth0.ManagementApi/RateLimitPolicies/RateLimitPoliciesClient.cs @@ -0,0 +1,568 @@ +using Auth0.ManagementApi.Core; +using global::System.Text.Json; + +namespace Auth0.ManagementApi; + +public partial class RateLimitPoliciesClient : IRateLimitPoliciesClient +{ + private readonly RawClient _client; + + internal RateLimitPoliciesClient(RawClient client) + { + _client = client; + } + + private WithRawResponseTask ListInternalAsync( + ListRateLimitPoliciesRequestParameters request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + return new WithRawResponseTask( + ListInternalAsyncCore(request, options, cancellationToken) + ); + } + + private async Task< + WithRawResponse + > ListInternalAsyncCore( + ListRateLimitPoliciesRequestParameters request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + var _queryString = new Auth0.ManagementApi.Core.QueryStringBuilder.Builder(capacity: 5) + .Add("resource", request.Resource.IsDefined ? request.Resource.Value : null) + .Add("consumer", request.Consumer.IsDefined ? request.Consumer.Value : null) + .Add( + "consumer_selector", + request.ConsumerSelector.IsDefined ? request.ConsumerSelector.Value : null + ) + .Add("take", request.Take.IsDefined ? request.Take.Value : null) + .Add("from", request.From.IsDefined ? request.From.Value : null) + .MergeAdditional(options?.AdditionalQueryParameters) + .Build(); + var _headers = await new Auth0.ManagementApi.Core.HeadersBuilder.Builder() + .Add(_client.Options.Headers) + .Add(_client.Options.AdditionalHeaders) + .Add(options?.AdditionalHeaders) + .BuildAsync() + .ConfigureAwait(false); + var response = await _client + .SendRequestAsync( + new JsonRequest + { + Method = HttpMethod.Get, + Path = "rate-limit-policies", + QueryString = _queryString, + Headers = _headers, + Options = options, + }, + cancellationToken + ) + .ConfigureAwait(false); + if (response.StatusCode is >= 200 and < 400) + { + var responseBody = await response + .Raw.Content.ReadAsStringAsync(cancellationToken) + .ConfigureAwait(false); + try + { + var responseData = + JsonUtils.Deserialize( + responseBody + )!; + return new WithRawResponse() + { + Data = responseData, + RawResponse = new RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = response.Raw.RequestMessage?.RequestUri ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + }, + }; + } + catch (JsonException e) + { + throw new ManagementApiException( + "Failed to deserialize response", + response.StatusCode, + null, + e + ); + } + } + { + var responseBody = await response + .Raw.Content.ReadAsStringAsync(cancellationToken) + .ConfigureAwait(false); + try + { + switch (response.StatusCode) + { + case 400: + throw new BadRequestError(JsonUtils.Deserialize(responseBody)); + case 401: + throw new UnauthorizedError(JsonUtils.Deserialize(responseBody)); + case 403: + throw new ForbiddenError(JsonUtils.Deserialize(responseBody)); + case 429: + throw new TooManyRequestsError(JsonUtils.Deserialize(responseBody)); + } + } + catch (JsonException) + { + // unable to map error response, throwing generic error + } + throw new ManagementApiException( + $"Error with status code {response.StatusCode}", + response.StatusCode, + responseBody + ); + } + } + + private async Task> CreateAsyncCore( + CreateRateLimitPolicyRequestContent request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + var _headers = await new Auth0.ManagementApi.Core.HeadersBuilder.Builder() + .Add(_client.Options.Headers) + .Add(_client.Options.AdditionalHeaders) + .Add(options?.AdditionalHeaders) + .BuildAsync() + .ConfigureAwait(false); + var response = await _client + .SendRequestAsync( + new JsonRequest + { + Method = HttpMethod.Post, + Path = "rate-limit-policies", + Body = request, + Headers = _headers, + ContentType = "application/json", + Options = options, + }, + cancellationToken + ) + .ConfigureAwait(false); + if (response.StatusCode is >= 200 and < 400) + { + var responseBody = await response + .Raw.Content.ReadAsStringAsync(cancellationToken) + .ConfigureAwait(false); + try + { + var responseData = JsonUtils.Deserialize( + responseBody + )!; + return new WithRawResponse() + { + Data = responseData, + RawResponse = new RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = response.Raw.RequestMessage?.RequestUri ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + }, + }; + } + catch (JsonException e) + { + throw new ManagementApiException( + "Failed to deserialize response", + response.StatusCode, + null, + e + ); + } + } + { + var responseBody = await response + .Raw.Content.ReadAsStringAsync(cancellationToken) + .ConfigureAwait(false); + try + { + switch (response.StatusCode) + { + case 400: + throw new BadRequestError(JsonUtils.Deserialize(responseBody)); + case 401: + throw new UnauthorizedError(JsonUtils.Deserialize(responseBody)); + case 403: + throw new ForbiddenError(JsonUtils.Deserialize(responseBody)); + case 409: + throw new ConflictError(JsonUtils.Deserialize(responseBody)); + case 429: + throw new TooManyRequestsError(JsonUtils.Deserialize(responseBody)); + } + } + catch (JsonException) + { + // unable to map error response, throwing generic error + } + throw new ManagementApiException( + $"Error with status code {response.StatusCode}", + response.StatusCode, + responseBody + ); + } + } + + private async Task> GetAsyncCore( + string id, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + var _headers = await new Auth0.ManagementApi.Core.HeadersBuilder.Builder() + .Add(_client.Options.Headers) + .Add(_client.Options.AdditionalHeaders) + .Add(options?.AdditionalHeaders) + .BuildAsync() + .ConfigureAwait(false); + var response = await _client + .SendRequestAsync( + new JsonRequest + { + Method = HttpMethod.Get, + Path = string.Format( + "rate-limit-policies/{0}", + ValueConvert.ToPathParameterString(id) + ), + Headers = _headers, + Options = options, + }, + cancellationToken + ) + .ConfigureAwait(false); + if (response.StatusCode is >= 200 and < 400) + { + var responseBody = await response + .Raw.Content.ReadAsStringAsync(cancellationToken) + .ConfigureAwait(false); + try + { + var responseData = JsonUtils.Deserialize( + responseBody + )!; + return new WithRawResponse() + { + Data = responseData, + RawResponse = new RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = response.Raw.RequestMessage?.RequestUri ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + }, + }; + } + catch (JsonException e) + { + throw new ManagementApiException( + "Failed to deserialize response", + response.StatusCode, + null, + e + ); + } + } + { + var responseBody = await response + .Raw.Content.ReadAsStringAsync(cancellationToken) + .ConfigureAwait(false); + try + { + switch (response.StatusCode) + { + case 401: + throw new UnauthorizedError(JsonUtils.Deserialize(responseBody)); + case 403: + throw new ForbiddenError(JsonUtils.Deserialize(responseBody)); + case 404: + throw new NotFoundError(JsonUtils.Deserialize(responseBody)); + case 429: + throw new TooManyRequestsError(JsonUtils.Deserialize(responseBody)); + } + } + catch (JsonException) + { + // unable to map error response, throwing generic error + } + throw new ManagementApiException( + $"Error with status code {response.StatusCode}", + response.StatusCode, + responseBody + ); + } + } + + private async Task> UpdateAsyncCore( + string id, + PatchRateLimitPolicyRequestContent request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + var _headers = await new Auth0.ManagementApi.Core.HeadersBuilder.Builder() + .Add(_client.Options.Headers) + .Add(_client.Options.AdditionalHeaders) + .Add(options?.AdditionalHeaders) + .BuildAsync() + .ConfigureAwait(false); + var response = await _client + .SendRequestAsync( + new JsonRequest + { + Method = HttpMethodExtensions.Patch, + Path = string.Format( + "rate-limit-policies/{0}", + ValueConvert.ToPathParameterString(id) + ), + Body = request, + Headers = _headers, + ContentType = "application/json", + Options = options, + }, + cancellationToken + ) + .ConfigureAwait(false); + if (response.StatusCode is >= 200 and < 400) + { + var responseBody = await response + .Raw.Content.ReadAsStringAsync(cancellationToken) + .ConfigureAwait(false); + try + { + var responseData = JsonUtils.Deserialize( + responseBody + )!; + return new WithRawResponse() + { + Data = responseData, + RawResponse = new RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = response.Raw.RequestMessage?.RequestUri ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + }, + }; + } + catch (JsonException e) + { + throw new ManagementApiException( + "Failed to deserialize response", + response.StatusCode, + null, + e + ); + } + } + { + var responseBody = await response + .Raw.Content.ReadAsStringAsync(cancellationToken) + .ConfigureAwait(false); + try + { + switch (response.StatusCode) + { + case 400: + throw new BadRequestError(JsonUtils.Deserialize(responseBody)); + case 401: + throw new UnauthorizedError(JsonUtils.Deserialize(responseBody)); + case 403: + throw new ForbiddenError(JsonUtils.Deserialize(responseBody)); + case 404: + throw new NotFoundError(JsonUtils.Deserialize(responseBody)); + case 429: + throw new TooManyRequestsError(JsonUtils.Deserialize(responseBody)); + } + } + catch (JsonException) + { + // unable to map error response, throwing generic error + } + throw new ManagementApiException( + $"Error with status code {response.StatusCode}", + response.StatusCode, + responseBody + ); + } + } + + /// + /// await client.RateLimitPolicies.ListAsync( + /// new ListRateLimitPoliciesRequestParameters + /// { + /// Resource = RateLimitPolicyResourceEnum.OauthAuthenticationApi, + /// Consumer = RateLimitPolicyConsumerEnum.Client, + /// ConsumerSelector = "consumer_selector", + /// Take = 1, + /// From = "from", + /// } + /// ); + /// + public async Task> ListAsync( + ListRateLimitPoliciesRequestParameters request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + if (request is not null) + { + request = request with { }; + } + var pager = await CursorPager< + ListRateLimitPoliciesRequestParameters, + RequestOptions?, + ListRateLimitPoliciesPaginatedResponseContent, + string?, + RateLimitPolicy + > + .CreateInstanceAsync( + request, + options, + async (request, options, cancellationToken) => + await ListInternalAsync(request, options, cancellationToken).WithRawResponse(), + (request, cursor) => + { + request.From = cursor; + }, + response => response.Next, + response => response.RateLimitPolicies?.ToList(), + cancellationToken + ) + .ConfigureAwait(false); + return pager; + } + + /// + /// await client.RateLimitPolicies.CreateAsync( + /// new CreateRateLimitPolicyRequestContent + /// { + /// Resource = RateLimitPolicyResourceEnum.OauthAuthenticationApi, + /// Consumer = RateLimitPolicyConsumerEnum.Client, + /// ConsumerSelector = "consumer_selector", + /// Configuration = new RateLimitPolicyConfigurationZero + /// { + /// Action = RateLimitPolicyConfigurationZeroAction.Allow, + /// }, + /// } + /// ); + /// + public WithRawResponseTask CreateAsync( + CreateRateLimitPolicyRequestContent request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + return new WithRawResponseTask( + CreateAsyncCore(request, options, cancellationToken) + ); + } + + /// + /// await client.RateLimitPolicies.GetAsync("id"); + /// + public WithRawResponseTask GetAsync( + string id, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + return new WithRawResponseTask( + GetAsyncCore(id, options, cancellationToken) + ); + } + + /// + /// await client.RateLimitPolicies.DeleteAsync("id"); + /// + public async Task DeleteAsync( + string id, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + var _headers = await new Auth0.ManagementApi.Core.HeadersBuilder.Builder() + .Add(_client.Options.Headers) + .Add(_client.Options.AdditionalHeaders) + .Add(options?.AdditionalHeaders) + .BuildAsync() + .ConfigureAwait(false); + var response = await _client + .SendRequestAsync( + new JsonRequest + { + Method = HttpMethod.Delete, + Path = string.Format( + "rate-limit-policies/{0}", + ValueConvert.ToPathParameterString(id) + ), + Headers = _headers, + Options = options, + }, + cancellationToken + ) + .ConfigureAwait(false); + if (response.StatusCode is >= 200 and < 400) + { + return; + } + { + var responseBody = await response + .Raw.Content.ReadAsStringAsync(cancellationToken) + .ConfigureAwait(false); + try + { + switch (response.StatusCode) + { + case 401: + throw new UnauthorizedError(JsonUtils.Deserialize(responseBody)); + case 403: + throw new ForbiddenError(JsonUtils.Deserialize(responseBody)); + case 404: + throw new NotFoundError(JsonUtils.Deserialize(responseBody)); + case 429: + throw new TooManyRequestsError(JsonUtils.Deserialize(responseBody)); + } + } + catch (JsonException) + { + // unable to map error response, throwing generic error + } + throw new ManagementApiException( + $"Error with status code {response.StatusCode}", + response.StatusCode, + responseBody + ); + } + } + + /// + /// await client.RateLimitPolicies.UpdateAsync( + /// "id", + /// new PatchRateLimitPolicyRequestContent + /// { + /// Configuration = new PatchRateLimitPolicyConfigurationRequestContentZero + /// { + /// Action = PatchRateLimitPolicyConfigurationRequestContentZeroAction.Allow, + /// }, + /// } + /// ); + /// + public WithRawResponseTask UpdateAsync( + string id, + PatchRateLimitPolicyRequestContent request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + return new WithRawResponseTask( + UpdateAsyncCore(id, request, options, cancellationToken) + ); + } +} diff --git a/src/Auth0.ManagementApi/RateLimitPolicies/Requests/CreateRateLimitPolicyRequestContent.cs b/src/Auth0.ManagementApi/RateLimitPolicies/Requests/CreateRateLimitPolicyRequestContent.cs new file mode 100644 index 000000000..38be97c4d --- /dev/null +++ b/src/Auth0.ManagementApi/RateLimitPolicies/Requests/CreateRateLimitPolicyRequestContent.cs @@ -0,0 +1,29 @@ +using Auth0.ManagementApi.Core; +using global::System.Text.Json.Serialization; + +namespace Auth0.ManagementApi; + +[Serializable] +public record CreateRateLimitPolicyRequestContent +{ + [JsonPropertyName("resource")] + public required RateLimitPolicyResourceEnum Resource { get; set; } + + [JsonPropertyName("consumer")] + public required RateLimitPolicyConsumerEnum Consumer { get; set; } + + /// + /// Identifier or category within the consumer to which the policy applies. Supported values: `client_id:` to target a specific client by ID, `client_id:` to target a CIMD client by URI, `cimd_clients` to target all CIMD clients, `third_party_clients` to target all third-party clients, or `default` to apply the policy to any consumer identifier not otherwise explicitly targeted. + /// + [JsonPropertyName("consumer_selector")] + public required string ConsumerSelector { get; set; } + + [JsonPropertyName("configuration")] + public required RateLimitPolicyConfiguration Configuration { get; set; } + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Auth0.ManagementApi/RateLimitPolicies/Requests/ListRateLimitPoliciesRequestParameters.cs b/src/Auth0.ManagementApi/RateLimitPolicies/Requests/ListRateLimitPoliciesRequestParameters.cs new file mode 100644 index 000000000..8d0b8f261 --- /dev/null +++ b/src/Auth0.ManagementApi/RateLimitPolicies/Requests/ListRateLimitPoliciesRequestParameters.cs @@ -0,0 +1,44 @@ +using Auth0.ManagementApi.Core; +using global::System.Text.Json.Serialization; + +namespace Auth0.ManagementApi; + +[Serializable] +public record ListRateLimitPoliciesRequestParameters +{ + /// + /// The API protected by the Rate Limit Policy. + /// + [JsonIgnore] + public Optional Resource { get; set; } + + /// + /// The consumer to which the rate limit policy applies. + /// + [JsonIgnore] + public Optional Consumer { get; set; } + + /// + /// Identifier or category within the consumer to which the policy applies. Supported values: `client_id:` to target a specific client by ID, `client_id:` to target a CIMD client by URI, `cimd_clients` to target all CIMD clients, `third_party_clients` to target all third-party clients, or `default` to apply the policy to any consumer identifier not otherwise explicitly targeted. + /// + [JsonIgnore] + public Optional ConsumerSelector { get; set; } + + /// + /// Number of results per page. Defaults to 50. + /// + [JsonIgnore] + public Optional Take { get; set; } = 50; + + /// + /// Cursor for pagination. + /// + [JsonIgnore] + public Optional From { get; set; } + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Auth0.ManagementApi/RateLimitPolicies/Requests/PatchRateLimitPolicyRequestContent.cs b/src/Auth0.ManagementApi/RateLimitPolicies/Requests/PatchRateLimitPolicyRequestContent.cs new file mode 100644 index 000000000..d00df5d52 --- /dev/null +++ b/src/Auth0.ManagementApi/RateLimitPolicies/Requests/PatchRateLimitPolicyRequestContent.cs @@ -0,0 +1,17 @@ +using Auth0.ManagementApi.Core; +using global::System.Text.Json.Serialization; + +namespace Auth0.ManagementApi; + +[Serializable] +public record PatchRateLimitPolicyRequestContent +{ + [JsonPropertyName("configuration")] + public required PatchRateLimitPolicyConfigurationRequestContent Configuration { get; set; } + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Auth0.ManagementApi/Roles/IRolesClient.cs b/src/Auth0.ManagementApi/Roles/IRolesClient.cs index f2a73164c..483485ee6 100644 --- a/src/Auth0.ManagementApi/Roles/IRolesClient.cs +++ b/src/Auth0.ManagementApi/Roles/IRolesClient.cs @@ -10,7 +10,7 @@ public partial interface IRolesClient /// /// Retrieve detailed list of user roles created in your tenant. /// - /// Note: The returned list does not include standard roles available for tenant members, such as Admin or Support Access. + /// **Note**: The returned list does not include standard roles available for tenant members, such as Admin or Support Access. /// Task> ListAsync( ListRolesRequestParameters request, @@ -19,9 +19,9 @@ Task> ListAsync( ); /// - /// Create a user role for Role-Based Access Control. + /// Create a user role for [Role-Based Access Control](https://auth0.com/docs/manage-users/access-control/rbac). /// - /// Note: New roles are not associated with any permissions by default. To assign existing permissions to your role, review Associate Permissions with a Role. To create new permissions, review Add API Permissions. + /// **Note**: New roles are not associated with any permissions by default. To assign existing permissions to your role, review Associate Permissions with a Role. To create new permissions, review Add API Permissions. /// WithRawResponseTask CreateAsync( CreateRoleRequestContent request, @@ -30,7 +30,7 @@ WithRawResponseTask CreateAsync( ); /// - /// Retrieve details about a specific user role specified by ID. + /// Retrieve details about a specific [user role](https://auth0.com/docs/manage-users/access-control/rbac) specified by ID. /// WithRawResponseTask GetAsync( string id, @@ -39,7 +39,7 @@ WithRawResponseTask GetAsync( ); /// - /// Delete a specific user role from your tenant. Once deleted, it is removed from any user who was previously assigned that role. This action cannot be undone. + /// Delete a specific [user role](https://auth0.com/docs/manage-users/access-control/rbac) from your tenant. Once deleted, it is removed from any user who was previously assigned that role. This action cannot be undone. /// Task DeleteAsync( string id, @@ -48,7 +48,7 @@ Task DeleteAsync( ); /// - /// Modify the details of a specific user role specified by ID. + /// Modify the details of a specific [user role](https://auth0.com/docs/manage-users/access-control/rbac) specified by ID. /// WithRawResponseTask UpdateAsync( string id, diff --git a/src/Auth0.ManagementApi/Roles/Permissions/IPermissionsClient.cs b/src/Auth0.ManagementApi/Roles/Permissions/IPermissionsClient.cs index 6be5edde6..8e0fbd025 100644 --- a/src/Auth0.ManagementApi/Roles/Permissions/IPermissionsClient.cs +++ b/src/Auth0.ManagementApi/Roles/Permissions/IPermissionsClient.cs @@ -16,7 +16,7 @@ Task> ListAsync( ); /// - /// Add one or more permissions to a specified user role. + /// Add one or more [permissions](https://auth0.com/docs/manage-users/access-control/configure-core-rbac/manage-permissions) to a specified user role. /// Task AddAsync( string id, @@ -26,7 +26,7 @@ Task AddAsync( ); /// - /// Remove one or more permissions from a specified user role. + /// Remove one or more [permissions](https://auth0.com/docs/manage-users/access-control/configure-core-rbac/manage-permissions) from a specified user role. /// Task DeleteAsync( string id, diff --git a/src/Auth0.ManagementApi/Roles/Permissions/PermissionsClient.cs b/src/Auth0.ManagementApi/Roles/Permissions/PermissionsClient.cs index a6bbaf6bc..d81a69bc7 100644 --- a/src/Auth0.ManagementApi/Roles/Permissions/PermissionsClient.cs +++ b/src/Auth0.ManagementApi/Roles/Permissions/PermissionsClient.cs @@ -183,7 +183,7 @@ await ListInternalAsync(id, request, options, cancellationToken) } /// - /// Add one or more permissions to a specified user role. + /// Add one or more [permissions](https://auth0.com/docs/manage-users/access-control/configure-core-rbac/manage-permissions) to a specified user role. /// /// /// await client.Roles.Permissions.AddAsync( @@ -266,7 +266,7 @@ public async Task AddAsync( } /// - /// Remove one or more permissions from a specified user role. + /// Remove one or more [permissions](https://auth0.com/docs/manage-users/access-control/configure-core-rbac/manage-permissions) from a specified user role. /// /// /// await client.Roles.Permissions.DeleteAsync( diff --git a/src/Auth0.ManagementApi/Roles/RolesClient.cs b/src/Auth0.ManagementApi/Roles/RolesClient.cs index 7960926df..9ff55eab7 100644 --- a/src/Auth0.ManagementApi/Roles/RolesClient.cs +++ b/src/Auth0.ManagementApi/Roles/RolesClient.cs @@ -21,7 +21,7 @@ internal RolesClient(RawClient client) /// /// Retrieve detailed list of user roles created in your tenant. /// - /// Note: The returned list does not include standard roles available for tenant members, such as Admin or Support Access. + /// **Note**: The returned list does not include standard roles available for tenant members, such as Admin or Support Access. /// private WithRawResponseTask ListInternalAsync( ListRolesRequestParameters request, @@ -393,7 +393,7 @@ private async Task> UpdateAsyncCore( /// /// Retrieve detailed list of user roles created in your tenant. /// - /// Note: The returned list does not include standard roles available for tenant members, such as Admin or Support Access. + /// **Note**: The returned list does not include standard roles available for tenant members, such as Admin or Support Access. /// /// /// await client.Roles.ListAsync( @@ -441,9 +441,9 @@ await ListInternalAsync(request, options, cancellationToken).WithRawResponse(), } /// - /// Create a user role for Role-Based Access Control. + /// Create a user role for [Role-Based Access Control](https://auth0.com/docs/manage-users/access-control/rbac). /// - /// Note: New roles are not associated with any permissions by default. To assign existing permissions to your role, review Associate Permissions with a Role. To create new permissions, review Add API Permissions. + /// **Note**: New roles are not associated with any permissions by default. To assign existing permissions to your role, review Associate Permissions with a Role. To create new permissions, review Add API Permissions. /// /// /// await client.Roles.CreateAsync(new CreateRoleRequestContent { Name = "name" }); @@ -460,7 +460,7 @@ public WithRawResponseTask CreateAsync( } /// - /// Retrieve details about a specific user role specified by ID. + /// Retrieve details about a specific [user role](https://auth0.com/docs/manage-users/access-control/rbac) specified by ID. /// /// /// await client.Roles.GetAsync("id"); @@ -477,7 +477,7 @@ public WithRawResponseTask GetAsync( } /// - /// Delete a specific user role from your tenant. Once deleted, it is removed from any user who was previously assigned that role. This action cannot be undone. + /// Delete a specific [user role](https://auth0.com/docs/manage-users/access-control/rbac) from your tenant. Once deleted, it is removed from any user who was previously assigned that role. This action cannot be undone. /// /// /// await client.Roles.DeleteAsync("id"); @@ -543,7 +543,7 @@ public async Task DeleteAsync( } /// - /// Modify the details of a specific user role specified by ID. + /// Modify the details of a specific [user role](https://auth0.com/docs/manage-users/access-control/rbac) specified by ID. /// /// /// await client.Roles.UpdateAsync("id", new UpdateRoleRequestContent()); diff --git a/src/Auth0.ManagementApi/Roles/Users/IUsersClient.cs b/src/Auth0.ManagementApi/Roles/Users/IUsersClient.cs index b8a34e19c..ac51c4ecf 100644 --- a/src/Auth0.ManagementApi/Roles/Users/IUsersClient.cs +++ b/src/Auth0.ManagementApi/Roles/Users/IUsersClient.cs @@ -6,25 +6,23 @@ namespace Auth0.ManagementApi.Roles; public partial interface IUsersClient { /// - /// Retrieve list of users associated with a specific role. For Dashboard instructions, review View Users Assigned to Roles. + /// Retrieve list of users associated with a specific role. For Dashboard instructions, review [View Users Assigned to Roles](https://auth0.com/docs/manage-users/access-control/configure-core-rbac/roles/view-users-assigned-to-roles). /// /// This endpoint supports two types of pagination: - /// - /// Offset pagination - /// Checkpoint pagination - /// + /// + /// - Offset pagination + /// - Checkpoint pagination /// /// Checkpoint pagination must be used if you need to retrieve more than 1000 organization members. /// - /// Checkpoint Pagination + /// **Checkpoint Pagination** /// /// To search by checkpoint, use the following parameters: - /// - /// from: Optional id from which to start selection. - /// take: The total amount of entries to retrieve when using the from parameter. Defaults to 50. - /// /// - /// Note: The first time you call this endpoint using checkpoint pagination, omit the from parameter. If there are more results, a next value is included in the response. You can use this for subsequent API calls. When next is no longer included in the response, no pages are remaining. + /// - `from`: Optional id from which to start selection. + /// - `take`: The total amount of entries to retrieve when using the from parameter. Defaults to 50. + /// + /// **Note**: The first time you call this endpoint using checkpoint pagination, omit the `from` parameter. If there are more results, a `next` value is included in the response. You can use this for subsequent API calls. When `next` is no longer included in the response, no pages are remaining. /// Task> ListAsync( string id, @@ -34,9 +32,9 @@ Task> ListAsync( ); /// - /// Assign one or more users to an existing user role. To learn more, review Role-Based Access Control. + /// Assign one or more users to an existing user role. To learn more, review [Role-Based Access Control](https://auth0.com/docs/manage-users/access-control/rbac). /// - /// Note: New roles cannot be created through this action. + /// **Note**: New roles cannot be created through this action. /// Task AssignAsync( string id, diff --git a/src/Auth0.ManagementApi/Roles/Users/UsersClient.cs b/src/Auth0.ManagementApi/Roles/Users/UsersClient.cs index 55380723f..ee708c73b 100644 --- a/src/Auth0.ManagementApi/Roles/Users/UsersClient.cs +++ b/src/Auth0.ManagementApi/Roles/Users/UsersClient.cs @@ -14,25 +14,23 @@ internal UsersClient(RawClient client) } /// - /// Retrieve list of users associated with a specific role. For Dashboard instructions, review View Users Assigned to Roles. + /// Retrieve list of users associated with a specific role. For Dashboard instructions, review [View Users Assigned to Roles](https://auth0.com/docs/manage-users/access-control/configure-core-rbac/roles/view-users-assigned-to-roles). /// /// This endpoint supports two types of pagination: - /// - /// Offset pagination - /// Checkpoint pagination - /// + /// + /// - Offset pagination + /// - Checkpoint pagination /// /// Checkpoint pagination must be used if you need to retrieve more than 1000 organization members. /// - /// Checkpoint Pagination + /// **Checkpoint Pagination** /// /// To search by checkpoint, use the following parameters: - /// - /// from: Optional id from which to start selection. - /// take: The total amount of entries to retrieve when using the from parameter. Defaults to 50. - /// /// - /// Note: The first time you call this endpoint using checkpoint pagination, omit the from parameter. If there are more results, a next value is included in the response. You can use this for subsequent API calls. When next is no longer included in the response, no pages are remaining. + /// - `from`: Optional id from which to start selection. + /// - `take`: The total amount of entries to retrieve when using the from parameter. Defaults to 50. + /// + /// **Note**: The first time you call this endpoint using checkpoint pagination, omit the `from` parameter. If there are more results, a `next` value is included in the response. You can use this for subsequent API calls. When `next` is no longer included in the response, no pages are remaining. /// private WithRawResponseTask ListInternalAsync( string id, @@ -143,25 +141,23 @@ private async Task< } /// - /// Retrieve list of users associated with a specific role. For Dashboard instructions, review View Users Assigned to Roles. + /// Retrieve list of users associated with a specific role. For Dashboard instructions, review [View Users Assigned to Roles](https://auth0.com/docs/manage-users/access-control/configure-core-rbac/roles/view-users-assigned-to-roles). /// /// This endpoint supports two types of pagination: - /// - /// Offset pagination - /// Checkpoint pagination - /// + /// + /// - Offset pagination + /// - Checkpoint pagination /// /// Checkpoint pagination must be used if you need to retrieve more than 1000 organization members. /// - /// Checkpoint Pagination + /// **Checkpoint Pagination** /// /// To search by checkpoint, use the following parameters: - /// - /// from: Optional id from which to start selection. - /// take: The total amount of entries to retrieve when using the from parameter. Defaults to 50. - /// /// - /// Note: The first time you call this endpoint using checkpoint pagination, omit the from parameter. If there are more results, a next value is included in the response. You can use this for subsequent API calls. When next is no longer included in the response, no pages are remaining. + /// - `from`: Optional id from which to start selection. + /// - `take`: The total amount of entries to retrieve when using the from parameter. Defaults to 50. + /// + /// **Note**: The first time you call this endpoint using checkpoint pagination, omit the `from` parameter. If there are more results, a `next` value is included in the response. You can use this for subsequent API calls. When `next` is no longer included in the response, no pages are remaining. /// /// /// await client.Roles.Users.ListAsync( @@ -206,9 +202,9 @@ await ListInternalAsync(id, request, options, cancellationToken) } /// - /// Assign one or more users to an existing user role. To learn more, review Role-Based Access Control. + /// Assign one or more users to an existing user role. To learn more, review [Role-Based Access Control](https://auth0.com/docs/manage-users/access-control/rbac). /// - /// Note: New roles cannot be created through this action. + /// **Note**: New roles cannot be created through this action. /// /// /// await client.Roles.Users.AssignAsync( diff --git a/src/Auth0.ManagementApi/SelfServiceProfiles/CustomText/CustomTextClient.cs b/src/Auth0.ManagementApi/SelfServiceProfiles/CustomText/CustomTextClient.cs index c176ea603..1a35e3048 100644 --- a/src/Auth0.ManagementApi/SelfServiceProfiles/CustomText/CustomTextClient.cs +++ b/src/Auth0.ManagementApi/SelfServiceProfiles/CustomText/CustomTextClient.cs @@ -131,7 +131,6 @@ private async Task>> SetAsyncCore( ), Body = request, Headers = _headers, - ContentType = "application/json", Options = options, }, cancellationToken diff --git a/src/Auth0.ManagementApi/Types/ClientExternalMetadataTypeEnum.cs b/src/Auth0.ManagementApi/Types/ClientExternalMetadataTypeEnum.cs index eafc6dbcc..ddb5022bf 100644 --- a/src/Auth0.ManagementApi/Types/ClientExternalMetadataTypeEnum.cs +++ b/src/Auth0.ManagementApi/Types/ClientExternalMetadataTypeEnum.cs @@ -10,6 +10,8 @@ namespace Auth0.ManagementApi; { public static readonly ClientExternalMetadataTypeEnum Cimd = new(Values.Cimd); + public static readonly ClientExternalMetadataTypeEnum Dcr = new(Values.Dcr); + public ClientExternalMetadataTypeEnum(string value) { Value = value; @@ -108,5 +110,7 @@ JsonSerializerOptions options public static class Values { public const string Cimd = "cimd"; + + public const string Dcr = "dcr"; } } diff --git a/src/Auth0.ManagementApi/Types/ConnectionPropertiesOptions.cs b/src/Auth0.ManagementApi/Types/ConnectionPropertiesOptions.cs index 2911226b3..1a2fb7eb1 100644 --- a/src/Auth0.ManagementApi/Types/ConnectionPropertiesOptions.cs +++ b/src/Auth0.ManagementApi/Types/ConnectionPropertiesOptions.cs @@ -166,6 +166,10 @@ public Optional?> IdTokenSignedResponseAlgs { get; set; } + [Optional] + [JsonPropertyName("dpop_signing_alg")] + public ConnectionDpopSigningAlgEnum? DpopSigningAlg { get; set; } + [Nullable, Optional] [JsonPropertyName("token_endpoint_auth_method")] public Optional TokenEndpointAuthMethod { get; set; } diff --git a/src/Auth0.ManagementApi/Types/CreateRateLimitPolicyResponseContent.cs b/src/Auth0.ManagementApi/Types/CreateRateLimitPolicyResponseContent.cs new file mode 100644 index 000000000..1778eb554 --- /dev/null +++ b/src/Auth0.ManagementApi/Types/CreateRateLimitPolicyResponseContent.cs @@ -0,0 +1,60 @@ +using Auth0.ManagementApi.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace Auth0.ManagementApi; + +[Serializable] +public record CreateRateLimitPolicyResponseContent : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + /// + /// Unique identifier for the Rate Limit Policy. + /// + [JsonPropertyName("id")] + public required string Id { get; set; } + + [JsonPropertyName("resource")] + public required RateLimitPolicyResourceEnum Resource { get; set; } + + [JsonPropertyName("consumer")] + public required RateLimitPolicyConsumerEnum Consumer { get; set; } + + /// + /// Identifier or category within the consumer to which the policy applies. Supported values: `client_id:` to target a specific client by ID, `client_id:` to target a CIMD client by URI, `cimd_clients` to target all CIMD clients, `third_party_clients` to target all third-party clients, or `default` to apply the policy to any consumer identifier not otherwise explicitly targeted. + /// + [JsonPropertyName("consumer_selector")] + public required string ConsumerSelector { get; set; } + + [JsonPropertyName("configuration")] + public required RateLimitPolicyConfiguration Configuration { get; set; } + + /// + /// The date and time when the rate limit policy was created. + /// + [Optional] + [JsonPropertyName("created_at")] + public DateTime? CreatedAt { get; set; } + + /// + /// The date and time when the rate limit policy was last updated. + /// + [Optional] + [JsonPropertyName("updated_at")] + public DateTime? UpdatedAt { 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/CreateUserResponseContent.cs b/src/Auth0.ManagementApi/Types/CreateUserResponseContent.cs index e69dbfa96..677c41d3d 100644 --- a/src/Auth0.ManagementApi/Types/CreateUserResponseContent.cs +++ b/src/Auth0.ManagementApi/Types/CreateUserResponseContent.cs @@ -103,6 +103,10 @@ public record CreateUserResponseContent : IJsonOnDeserialized, IJsonOnSerializin [JsonPropertyName("multifactor")] public IEnumerable? Multifactor { get; set; } + [Optional] + [JsonPropertyName("multifactor_last_modified")] + public UserDateSchema? MultifactorLastModified { get; set; } + /// /// Last IP address from which this user logged in. /// @@ -114,6 +118,10 @@ public record CreateUserResponseContent : IJsonOnDeserialized, IJsonOnSerializin [JsonPropertyName("last_login")] public UserDateSchema? LastLogin { get; set; } + [Optional] + [JsonPropertyName("last_password_reset")] + public UserDateSchema? LastPasswordReset { get; set; } + /// /// Total number of logins this user has performed. /// diff --git a/src/Auth0.ManagementApi/Types/GetRateLimitPolicyResponseContent.cs b/src/Auth0.ManagementApi/Types/GetRateLimitPolicyResponseContent.cs new file mode 100644 index 000000000..89b7844f8 --- /dev/null +++ b/src/Auth0.ManagementApi/Types/GetRateLimitPolicyResponseContent.cs @@ -0,0 +1,60 @@ +using Auth0.ManagementApi.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace Auth0.ManagementApi; + +[Serializable] +public record GetRateLimitPolicyResponseContent : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + /// + /// Unique identifier for the Rate Limit Policy. + /// + [JsonPropertyName("id")] + public required string Id { get; set; } + + [JsonPropertyName("resource")] + public required RateLimitPolicyResourceEnum Resource { get; set; } + + [JsonPropertyName("consumer")] + public required RateLimitPolicyConsumerEnum Consumer { get; set; } + + /// + /// Identifier or category within the consumer to which the policy applies. Supported values: `client_id:` to target a specific client by ID, `client_id:` to target a CIMD client by URI, `cimd_clients` to target all CIMD clients, `third_party_clients` to target all third-party clients, or `default` to apply the policy to any consumer identifier not otherwise explicitly targeted. + /// + [JsonPropertyName("consumer_selector")] + public required string ConsumerSelector { get; set; } + + [JsonPropertyName("configuration")] + public required RateLimitPolicyConfiguration Configuration { get; set; } + + /// + /// The date and time when the rate limit policy was created. + /// + [Optional] + [JsonPropertyName("created_at")] + public DateTime? CreatedAt { get; set; } + + /// + /// The date and time when the rate limit policy was last updated. + /// + [Optional] + [JsonPropertyName("updated_at")] + public DateTime? UpdatedAt { 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/GetUserResponseContent.cs b/src/Auth0.ManagementApi/Types/GetUserResponseContent.cs index 87921c836..2390ab388 100644 --- a/src/Auth0.ManagementApi/Types/GetUserResponseContent.cs +++ b/src/Auth0.ManagementApi/Types/GetUserResponseContent.cs @@ -103,6 +103,10 @@ public record GetUserResponseContent : IJsonOnDeserialized, IJsonOnSerializing [JsonPropertyName("multifactor")] public IEnumerable? Multifactor { get; set; } + [Optional] + [JsonPropertyName("multifactor_last_modified")] + public UserDateSchema? MultifactorLastModified { get; set; } + /// /// Last IP address from which this user logged in. /// @@ -114,6 +118,10 @@ public record GetUserResponseContent : IJsonOnDeserialized, IJsonOnSerializing [JsonPropertyName("last_login")] public UserDateSchema? LastLogin { get; set; } + [Optional] + [JsonPropertyName("last_password_reset")] + public UserDateSchema? LastPasswordReset { get; set; } + /// /// Total number of logins this user has performed. /// diff --git a/src/Auth0.ManagementApi/Types/ListGroupRolesResponseContent.cs b/src/Auth0.ManagementApi/Types/ListGroupRolesResponseContent.cs new file mode 100644 index 000000000..baf4462c7 --- /dev/null +++ b/src/Auth0.ManagementApi/Types/ListGroupRolesResponseContent.cs @@ -0,0 +1,35 @@ +using Auth0.ManagementApi.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace Auth0.ManagementApi; + +[Serializable] +public record ListGroupRolesResponseContent : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("roles")] + public IEnumerable Roles { get; set; } = new List(); + + /// + /// A cursor to be used as the "from" query parameter for the next page of results. + /// + [Optional] + [JsonPropertyName("next")] + public string? Next { 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/ListRateLimitPoliciesPaginatedResponseContent.cs b/src/Auth0.ManagementApi/Types/ListRateLimitPoliciesPaginatedResponseContent.cs new file mode 100644 index 000000000..aa068349c --- /dev/null +++ b/src/Auth0.ManagementApi/Types/ListRateLimitPoliciesPaginatedResponseContent.cs @@ -0,0 +1,36 @@ +using Auth0.ManagementApi.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace Auth0.ManagementApi; + +[Serializable] +public record ListRateLimitPoliciesPaginatedResponseContent : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [Optional] + [JsonPropertyName("rate_limit_policies")] + public IEnumerable? RateLimitPolicies { get; set; } + + /// + /// A cursor to be used as the "from" query parameter for the next page of results. + /// + [Optional] + [JsonPropertyName("next")] + public string? Next { 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/OauthScope.cs b/src/Auth0.ManagementApi/Types/OauthScope.cs index d73a40fa7..a88a3ecc6 100644 --- a/src/Auth0.ManagementApi/Types/OauthScope.cs +++ b/src/Auth0.ManagementApi/Types/OauthScope.cs @@ -547,6 +547,21 @@ namespace Auth0.ManagementApi; /// public static readonly OauthScope ReadGroupMembers = new(Values.ReadGroupMembers); + /// + /// Create Group Roles + /// + public static readonly OauthScope CreateGroupRoles = new(Values.CreateGroupRoles); + + /// + /// Read Group Roles + /// + public static readonly OauthScope ReadGroupRoles = new(Values.ReadGroupRoles); + + /// + /// Delete Group Roles + /// + public static readonly OauthScope DeleteGroupRoles = new(Values.DeleteGroupRoles); + /// /// Read Groups /// @@ -881,6 +896,26 @@ namespace Auth0.ManagementApi; /// public static readonly OauthScope UpdatePrompts = new(Values.UpdatePrompts); + /// + /// Create Rate Limit Policies + /// + public static readonly OauthScope CreateRateLimitPolicies = new(Values.CreateRateLimitPolicies); + + /// + /// Read Rate Limit Policies + /// + public static readonly OauthScope ReadRateLimitPolicies = new(Values.ReadRateLimitPolicies); + + /// + /// Update Rate Limit Policies + /// + public static readonly OauthScope UpdateRateLimitPolicies = new(Values.UpdateRateLimitPolicies); + + /// + /// Delete Rate Limit Policies + /// + public static readonly OauthScope DeleteRateLimitPolicies = new(Values.DeleteRateLimitPolicies); + /// /// Read Refresh Tokens /// @@ -1821,6 +1856,21 @@ public static class Values /// public const string ReadGroupMembers = "read:group_members"; + /// + /// Create Group Roles + /// + public const string CreateGroupRoles = "create:group_roles"; + + /// + /// Read Group Roles + /// + public const string ReadGroupRoles = "read:group_roles"; + + /// + /// Delete Group Roles + /// + public const string DeleteGroupRoles = "delete:group_roles"; + /// /// Read Groups /// @@ -2115,6 +2165,26 @@ public static class Values /// public const string UpdatePrompts = "update:prompts"; + /// + /// Create Rate Limit Policies + /// + public const string CreateRateLimitPolicies = "create:rate_limit_policies"; + + /// + /// Read Rate Limit Policies + /// + public const string ReadRateLimitPolicies = "read:rate_limit_policies"; + + /// + /// Update Rate Limit Policies + /// + public const string UpdateRateLimitPolicies = "update:rate_limit_policies"; + + /// + /// Delete Rate Limit Policies + /// + public const string DeleteRateLimitPolicies = "delete:rate_limit_policies"; + /// /// Read Refresh Tokens /// diff --git a/src/Auth0.ManagementApi/Types/PatchRateLimitPolicyConfigurationRequestContent.cs b/src/Auth0.ManagementApi/Types/PatchRateLimitPolicyConfigurationRequestContent.cs new file mode 100644 index 000000000..7605af0a0 --- /dev/null +++ b/src/Auth0.ManagementApi/Types/PatchRateLimitPolicyConfigurationRequestContent.cs @@ -0,0 +1,361 @@ +// ReSharper disable NullableWarningSuppressionIsUsed +// ReSharper disable InconsistentNaming + +using Auth0.ManagementApi.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace Auth0.ManagementApi; + +[JsonConverter(typeof(PatchRateLimitPolicyConfigurationRequestContent.JsonConverter))] +[Serializable] +public class PatchRateLimitPolicyConfigurationRequestContent +{ + private PatchRateLimitPolicyConfigurationRequestContent(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.PatchRateLimitPolicyConfigurationRequestContentZero value. + /// + public static PatchRateLimitPolicyConfigurationRequestContent FromPatchRateLimitPolicyConfigurationRequestContentZero( + Auth0.ManagementApi.PatchRateLimitPolicyConfigurationRequestContentZero value + ) => new("patchRateLimitPolicyConfigurationRequestContentZero", value); + + /// + /// Factory method to create a union from a Auth0.ManagementApi.PatchRateLimitPolicyConfigurationRequestContentOne value. + /// + public static PatchRateLimitPolicyConfigurationRequestContent FromPatchRateLimitPolicyConfigurationRequestContentOne( + Auth0.ManagementApi.PatchRateLimitPolicyConfigurationRequestContentOne value + ) => new("patchRateLimitPolicyConfigurationRequestContentOne", value); + + /// + /// Factory method to create a union from a Auth0.ManagementApi.PatchRateLimitPolicyConfigurationRequestContentAction value. + /// + public static PatchRateLimitPolicyConfigurationRequestContent FromPatchRateLimitPolicyConfigurationRequestContentAction( + Auth0.ManagementApi.PatchRateLimitPolicyConfigurationRequestContentAction value + ) => new("patchRateLimitPolicyConfigurationRequestContentAction", value); + + /// + /// Returns true if is "patchRateLimitPolicyConfigurationRequestContentZero" + /// + public bool IsPatchRateLimitPolicyConfigurationRequestContentZero() => + Type == "patchRateLimitPolicyConfigurationRequestContentZero"; + + /// + /// Returns true if is "patchRateLimitPolicyConfigurationRequestContentOne" + /// + public bool IsPatchRateLimitPolicyConfigurationRequestContentOne() => + Type == "patchRateLimitPolicyConfigurationRequestContentOne"; + + /// + /// Returns true if is "patchRateLimitPolicyConfigurationRequestContentAction" + /// + public bool IsPatchRateLimitPolicyConfigurationRequestContentAction() => + Type == "patchRateLimitPolicyConfigurationRequestContentAction"; + + /// + /// Returns the value as a if is 'patchRateLimitPolicyConfigurationRequestContentZero', otherwise throws an exception. + /// + /// Thrown when is not 'patchRateLimitPolicyConfigurationRequestContentZero'. + public Auth0.ManagementApi.PatchRateLimitPolicyConfigurationRequestContentZero AsPatchRateLimitPolicyConfigurationRequestContentZero() => + IsPatchRateLimitPolicyConfigurationRequestContentZero() + ? (Auth0.ManagementApi.PatchRateLimitPolicyConfigurationRequestContentZero)Value! + : throw new ManagementException( + "Union type is not 'patchRateLimitPolicyConfigurationRequestContentZero'" + ); + + /// + /// Returns the value as a if is 'patchRateLimitPolicyConfigurationRequestContentOne', otherwise throws an exception. + /// + /// Thrown when is not 'patchRateLimitPolicyConfigurationRequestContentOne'. + public Auth0.ManagementApi.PatchRateLimitPolicyConfigurationRequestContentOne AsPatchRateLimitPolicyConfigurationRequestContentOne() => + IsPatchRateLimitPolicyConfigurationRequestContentOne() + ? (Auth0.ManagementApi.PatchRateLimitPolicyConfigurationRequestContentOne)Value! + : throw new ManagementException( + "Union type is not 'patchRateLimitPolicyConfigurationRequestContentOne'" + ); + + /// + /// Returns the value as a if is 'patchRateLimitPolicyConfigurationRequestContentAction', otherwise throws an exception. + /// + /// Thrown when is not 'patchRateLimitPolicyConfigurationRequestContentAction'. + public Auth0.ManagementApi.PatchRateLimitPolicyConfigurationRequestContentAction AsPatchRateLimitPolicyConfigurationRequestContentAction() => + IsPatchRateLimitPolicyConfigurationRequestContentAction() + ? (Auth0.ManagementApi.PatchRateLimitPolicyConfigurationRequestContentAction)Value! + : throw new ManagementException( + "Union type is not 'patchRateLimitPolicyConfigurationRequestContentAction'" + ); + + /// + /// Attempts to cast the value to a and returns true if successful. + /// + public bool TryGetPatchRateLimitPolicyConfigurationRequestContentZero( + out Auth0.ManagementApi.PatchRateLimitPolicyConfigurationRequestContentZero? value + ) + { + if (Type == "patchRateLimitPolicyConfigurationRequestContentZero") + { + value = (Auth0.ManagementApi.PatchRateLimitPolicyConfigurationRequestContentZero)Value!; + return true; + } + value = null; + return false; + } + + /// + /// Attempts to cast the value to a and returns true if successful. + /// + public bool TryGetPatchRateLimitPolicyConfigurationRequestContentOne( + out Auth0.ManagementApi.PatchRateLimitPolicyConfigurationRequestContentOne? value + ) + { + if (Type == "patchRateLimitPolicyConfigurationRequestContentOne") + { + value = (Auth0.ManagementApi.PatchRateLimitPolicyConfigurationRequestContentOne)Value!; + return true; + } + value = null; + return false; + } + + /// + /// Attempts to cast the value to a and returns true if successful. + /// + public bool TryGetPatchRateLimitPolicyConfigurationRequestContentAction( + out Auth0.ManagementApi.PatchRateLimitPolicyConfigurationRequestContentAction? value + ) + { + if (Type == "patchRateLimitPolicyConfigurationRequestContentAction") + { + value = (Auth0.ManagementApi.PatchRateLimitPolicyConfigurationRequestContentAction) + Value!; + return true; + } + value = null; + return false; + } + + public T Match( + Func< + Auth0.ManagementApi.PatchRateLimitPolicyConfigurationRequestContentZero, + T + > onPatchRateLimitPolicyConfigurationRequestContentZero, + Func< + Auth0.ManagementApi.PatchRateLimitPolicyConfigurationRequestContentOne, + T + > onPatchRateLimitPolicyConfigurationRequestContentOne, + Func< + Auth0.ManagementApi.PatchRateLimitPolicyConfigurationRequestContentAction, + T + > onPatchRateLimitPolicyConfigurationRequestContentAction + ) + { + return Type switch + { + "patchRateLimitPolicyConfigurationRequestContentZero" => + onPatchRateLimitPolicyConfigurationRequestContentZero( + AsPatchRateLimitPolicyConfigurationRequestContentZero() + ), + "patchRateLimitPolicyConfigurationRequestContentOne" => + onPatchRateLimitPolicyConfigurationRequestContentOne( + AsPatchRateLimitPolicyConfigurationRequestContentOne() + ), + "patchRateLimitPolicyConfigurationRequestContentAction" => + onPatchRateLimitPolicyConfigurationRequestContentAction( + AsPatchRateLimitPolicyConfigurationRequestContentAction() + ), + _ => throw new ManagementException($"Unknown union type: {Type}"), + }; + } + + public void Visit( + global::System.Action onPatchRateLimitPolicyConfigurationRequestContentZero, + global::System.Action onPatchRateLimitPolicyConfigurationRequestContentOne, + global::System.Action onPatchRateLimitPolicyConfigurationRequestContentAction + ) + { + switch (Type) + { + case "patchRateLimitPolicyConfigurationRequestContentZero": + onPatchRateLimitPolicyConfigurationRequestContentZero( + AsPatchRateLimitPolicyConfigurationRequestContentZero() + ); + break; + case "patchRateLimitPolicyConfigurationRequestContentOne": + onPatchRateLimitPolicyConfigurationRequestContentOne( + AsPatchRateLimitPolicyConfigurationRequestContentOne() + ); + break; + case "patchRateLimitPolicyConfigurationRequestContentAction": + onPatchRateLimitPolicyConfigurationRequestContentAction( + AsPatchRateLimitPolicyConfigurationRequestContentAction() + ); + 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 PatchRateLimitPolicyConfigurationRequestContent 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 PatchRateLimitPolicyConfigurationRequestContent( + Auth0.ManagementApi.PatchRateLimitPolicyConfigurationRequestContentZero value + ) => new("patchRateLimitPolicyConfigurationRequestContentZero", value); + + public static implicit operator PatchRateLimitPolicyConfigurationRequestContent( + Auth0.ManagementApi.PatchRateLimitPolicyConfigurationRequestContentOne value + ) => new("patchRateLimitPolicyConfigurationRequestContentOne", value); + + public static implicit operator PatchRateLimitPolicyConfigurationRequestContent( + Auth0.ManagementApi.PatchRateLimitPolicyConfigurationRequestContentAction value + ) => new("patchRateLimitPolicyConfigurationRequestContentAction", value); + + [Serializable] + internal sealed class JsonConverter + : JsonConverter + { + public override PatchRateLimitPolicyConfigurationRequestContent? Read( + ref Utf8JsonReader reader, + global::System.Type typeToConvert, + JsonSerializerOptions options + ) + { + if (reader.TokenType == JsonTokenType.Null) + { + return null; + } + + if (reader.TokenType == JsonTokenType.StartObject) + { + var document = JsonDocument.ParseValue(ref reader); + + var types = new (string Key, System.Type Type)[] + { + ( + "patchRateLimitPolicyConfigurationRequestContentZero", + typeof(Auth0.ManagementApi.PatchRateLimitPolicyConfigurationRequestContentZero) + ), + ( + "patchRateLimitPolicyConfigurationRequestContentOne", + typeof(Auth0.ManagementApi.PatchRateLimitPolicyConfigurationRequestContentOne) + ), + ( + "patchRateLimitPolicyConfigurationRequestContentAction", + typeof(Auth0.ManagementApi.PatchRateLimitPolicyConfigurationRequestContentAction) + ), + }; + + foreach (var (key, type) in types) + { + try + { + var value = document.Deserialize(type, options); + if (value != null) + { + PatchRateLimitPolicyConfigurationRequestContent result = new( + key, + value + ); + return result; + } + } + catch (JsonException) + { + // Try next type; + } + } + } + + throw new JsonException( + $"Cannot deserialize JSON token {reader.TokenType} into PatchRateLimitPolicyConfigurationRequestContent" + ); + } + + public override void Write( + Utf8JsonWriter writer, + PatchRateLimitPolicyConfigurationRequestContent value, + JsonSerializerOptions options + ) + { + if (value == null) + { + writer.WriteNullValue(); + return; + } + + value.Visit( + obj => JsonSerializer.Serialize(writer, obj, options), + obj => JsonSerializer.Serialize(writer, obj, options), + obj => JsonSerializer.Serialize(writer, obj, options) + ); + } + + public override PatchRateLimitPolicyConfigurationRequestContent ReadAsPropertyName( + ref Utf8JsonReader reader, + global::System.Type typeToConvert, + JsonSerializerOptions options + ) + { + var stringValue = reader.GetString()!; + PatchRateLimitPolicyConfigurationRequestContent result = new("string", stringValue); + return result; + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + PatchRateLimitPolicyConfigurationRequestContent value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value?.ToString() ?? "null"); + } + } +} diff --git a/src/Auth0.ManagementApi/Types/PatchRateLimitPolicyConfigurationRequestContentAction.cs b/src/Auth0.ManagementApi/Types/PatchRateLimitPolicyConfigurationRequestContentAction.cs new file mode 100644 index 000000000..5c87c855d --- /dev/null +++ b/src/Auth0.ManagementApi/Types/PatchRateLimitPolicyConfigurationRequestContentAction.cs @@ -0,0 +1,43 @@ +using Auth0.ManagementApi.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace Auth0.ManagementApi; + +[Serializable] +public record PatchRateLimitPolicyConfigurationRequestContentAction : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + /// + /// Determines the action to take when the rate limit is exceeded. + /// + [JsonPropertyName("action")] + public required PatchRateLimitPolicyConfigurationRequestContentActionAction Action { get; set; } + + /// + /// The maximum number of requests allowed in a single refresh window. + /// + [JsonPropertyName("limit")] + public required int Limit { get; set; } + + /// + /// The HTTPS URI to redirect to when the rate limit is exceeded. + /// + [JsonPropertyName("redirect_uri")] + public required string RedirectUri { 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/PatchRateLimitPolicyConfigurationRequestContentActionAction.cs b/src/Auth0.ManagementApi/Types/PatchRateLimitPolicyConfigurationRequestContentActionAction.cs new file mode 100644 index 000000000..58d3f9a96 --- /dev/null +++ b/src/Auth0.ManagementApi/Types/PatchRateLimitPolicyConfigurationRequestContentActionAction.cs @@ -0,0 +1,126 @@ +using Auth0.ManagementApi.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace Auth0.ManagementApi; + +[JsonConverter( + typeof(PatchRateLimitPolicyConfigurationRequestContentActionAction.PatchRateLimitPolicyConfigurationRequestContentActionActionSerializer) +)] +[Serializable] +public readonly record struct PatchRateLimitPolicyConfigurationRequestContentActionAction + : IStringEnum +{ + public static readonly PatchRateLimitPolicyConfigurationRequestContentActionAction Redirect = + new(Values.Redirect); + + public PatchRateLimitPolicyConfigurationRequestContentActionAction(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static PatchRateLimitPolicyConfigurationRequestContentActionAction FromCustom( + string value + ) + { + return new PatchRateLimitPolicyConfigurationRequestContentActionAction(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 ==( + PatchRateLimitPolicyConfigurationRequestContentActionAction value1, + string value2 + ) => value1.Value.Equals(value2); + + public static bool operator !=( + PatchRateLimitPolicyConfigurationRequestContentActionAction value1, + string value2 + ) => !value1.Value.Equals(value2); + + public static explicit operator string( + PatchRateLimitPolicyConfigurationRequestContentActionAction value + ) => value.Value; + + public static explicit operator PatchRateLimitPolicyConfigurationRequestContentActionAction( + string value + ) => new(value); + + internal class PatchRateLimitPolicyConfigurationRequestContentActionActionSerializer + : JsonConverter + { + public override PatchRateLimitPolicyConfigurationRequestContentActionAction 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 PatchRateLimitPolicyConfigurationRequestContentActionAction(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + PatchRateLimitPolicyConfigurationRequestContentActionAction value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override PatchRateLimitPolicyConfigurationRequestContentActionAction 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 PatchRateLimitPolicyConfigurationRequestContentActionAction(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + PatchRateLimitPolicyConfigurationRequestContentActionAction value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string Redirect = "redirect"; + } +} diff --git a/src/Auth0.ManagementApi/Types/PatchRateLimitPolicyConfigurationRequestContentOne.cs b/src/Auth0.ManagementApi/Types/PatchRateLimitPolicyConfigurationRequestContentOne.cs new file mode 100644 index 000000000..a1a426955 --- /dev/null +++ b/src/Auth0.ManagementApi/Types/PatchRateLimitPolicyConfigurationRequestContentOne.cs @@ -0,0 +1,37 @@ +using Auth0.ManagementApi.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace Auth0.ManagementApi; + +[Serializable] +public record PatchRateLimitPolicyConfigurationRequestContentOne : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + /// + /// Determines the action to take when the rate limit is exceeded. + /// + [JsonPropertyName("action")] + public required PatchRateLimitPolicyConfigurationRequestContentOneAction Action { get; set; } + + /// + /// The maximum number of requests allowed in a single refresh window. + /// + [JsonPropertyName("limit")] + public required int Limit { 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/PatchRateLimitPolicyConfigurationRequestContentOneAction.cs b/src/Auth0.ManagementApi/Types/PatchRateLimitPolicyConfigurationRequestContentOneAction.cs new file mode 100644 index 000000000..8c231163e --- /dev/null +++ b/src/Auth0.ManagementApi/Types/PatchRateLimitPolicyConfigurationRequestContentOneAction.cs @@ -0,0 +1,130 @@ +using Auth0.ManagementApi.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace Auth0.ManagementApi; + +[JsonConverter( + typeof(PatchRateLimitPolicyConfigurationRequestContentOneAction.PatchRateLimitPolicyConfigurationRequestContentOneActionSerializer) +)] +[Serializable] +public readonly record struct PatchRateLimitPolicyConfigurationRequestContentOneAction : IStringEnum +{ + public static readonly PatchRateLimitPolicyConfigurationRequestContentOneAction Block = new( + Values.Block + ); + + public static readonly PatchRateLimitPolicyConfigurationRequestContentOneAction Log = new( + Values.Log + ); + + public PatchRateLimitPolicyConfigurationRequestContentOneAction(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static PatchRateLimitPolicyConfigurationRequestContentOneAction FromCustom(string value) + { + return new PatchRateLimitPolicyConfigurationRequestContentOneAction(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 ==( + PatchRateLimitPolicyConfigurationRequestContentOneAction value1, + string value2 + ) => value1.Value.Equals(value2); + + public static bool operator !=( + PatchRateLimitPolicyConfigurationRequestContentOneAction value1, + string value2 + ) => !value1.Value.Equals(value2); + + public static explicit operator string( + PatchRateLimitPolicyConfigurationRequestContentOneAction value + ) => value.Value; + + public static explicit operator PatchRateLimitPolicyConfigurationRequestContentOneAction( + string value + ) => new(value); + + internal class PatchRateLimitPolicyConfigurationRequestContentOneActionSerializer + : JsonConverter + { + public override PatchRateLimitPolicyConfigurationRequestContentOneAction 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 PatchRateLimitPolicyConfigurationRequestContentOneAction(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + PatchRateLimitPolicyConfigurationRequestContentOneAction value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override PatchRateLimitPolicyConfigurationRequestContentOneAction 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 PatchRateLimitPolicyConfigurationRequestContentOneAction(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + PatchRateLimitPolicyConfigurationRequestContentOneAction value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string Block = "block"; + + public const string Log = "log"; + } +} diff --git a/src/Auth0.ManagementApi/Types/PatchRateLimitPolicyConfigurationRequestContentZero.cs b/src/Auth0.ManagementApi/Types/PatchRateLimitPolicyConfigurationRequestContentZero.cs new file mode 100644 index 000000000..b67c13e31 --- /dev/null +++ b/src/Auth0.ManagementApi/Types/PatchRateLimitPolicyConfigurationRequestContentZero.cs @@ -0,0 +1,31 @@ +using Auth0.ManagementApi.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace Auth0.ManagementApi; + +[Serializable] +public record PatchRateLimitPolicyConfigurationRequestContentZero : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + /// + /// Determines the action to take when the rate limit is exceeded. + /// + [JsonPropertyName("action")] + public required PatchRateLimitPolicyConfigurationRequestContentZeroAction Action { 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/PatchRateLimitPolicyConfigurationRequestContentZeroAction.cs b/src/Auth0.ManagementApi/Types/PatchRateLimitPolicyConfigurationRequestContentZeroAction.cs new file mode 100644 index 000000000..35604ee35 --- /dev/null +++ b/src/Auth0.ManagementApi/Types/PatchRateLimitPolicyConfigurationRequestContentZeroAction.cs @@ -0,0 +1,125 @@ +using Auth0.ManagementApi.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace Auth0.ManagementApi; + +[JsonConverter( + typeof(PatchRateLimitPolicyConfigurationRequestContentZeroAction.PatchRateLimitPolicyConfigurationRequestContentZeroActionSerializer) +)] +[Serializable] +public readonly record struct PatchRateLimitPolicyConfigurationRequestContentZeroAction + : IStringEnum +{ + public static readonly PatchRateLimitPolicyConfigurationRequestContentZeroAction Allow = new( + Values.Allow + ); + + public PatchRateLimitPolicyConfigurationRequestContentZeroAction(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static PatchRateLimitPolicyConfigurationRequestContentZeroAction FromCustom(string value) + { + return new PatchRateLimitPolicyConfigurationRequestContentZeroAction(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 ==( + PatchRateLimitPolicyConfigurationRequestContentZeroAction value1, + string value2 + ) => value1.Value.Equals(value2); + + public static bool operator !=( + PatchRateLimitPolicyConfigurationRequestContentZeroAction value1, + string value2 + ) => !value1.Value.Equals(value2); + + public static explicit operator string( + PatchRateLimitPolicyConfigurationRequestContentZeroAction value + ) => value.Value; + + public static explicit operator PatchRateLimitPolicyConfigurationRequestContentZeroAction( + string value + ) => new(value); + + internal class PatchRateLimitPolicyConfigurationRequestContentZeroActionSerializer + : JsonConverter + { + public override PatchRateLimitPolicyConfigurationRequestContentZeroAction 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 PatchRateLimitPolicyConfigurationRequestContentZeroAction(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + PatchRateLimitPolicyConfigurationRequestContentZeroAction value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override PatchRateLimitPolicyConfigurationRequestContentZeroAction 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 PatchRateLimitPolicyConfigurationRequestContentZeroAction(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + PatchRateLimitPolicyConfigurationRequestContentZeroAction value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string Allow = "allow"; + } +} diff --git a/src/Auth0.ManagementApi/Types/RateLimitPolicy.cs b/src/Auth0.ManagementApi/Types/RateLimitPolicy.cs new file mode 100644 index 000000000..3bb29d436 --- /dev/null +++ b/src/Auth0.ManagementApi/Types/RateLimitPolicy.cs @@ -0,0 +1,60 @@ +using Auth0.ManagementApi.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace Auth0.ManagementApi; + +[Serializable] +public record RateLimitPolicy : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + /// + /// Unique identifier for the Rate Limit Policy. + /// + [JsonPropertyName("id")] + public required string Id { get; set; } + + [JsonPropertyName("resource")] + public required RateLimitPolicyResourceEnum Resource { get; set; } + + [JsonPropertyName("consumer")] + public required RateLimitPolicyConsumerEnum Consumer { get; set; } + + /// + /// Identifier or category within the consumer to which the policy applies. Supported values: `client_id:` to target a specific client by ID, `client_id:` to target a CIMD client by URI, `cimd_clients` to target all CIMD clients, `third_party_clients` to target all third-party clients, or `default` to apply the policy to any consumer identifier not otherwise explicitly targeted. + /// + [JsonPropertyName("consumer_selector")] + public required string ConsumerSelector { get; set; } + + [JsonPropertyName("configuration")] + public required RateLimitPolicyConfiguration Configuration { get; set; } + + /// + /// The date and time when the rate limit policy was created. + /// + [Optional] + [JsonPropertyName("created_at")] + public DateTime? CreatedAt { get; set; } + + /// + /// The date and time when the rate limit policy was last updated. + /// + [Optional] + [JsonPropertyName("updated_at")] + public DateTime? UpdatedAt { 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/RateLimitPolicyConfiguration.cs b/src/Auth0.ManagementApi/Types/RateLimitPolicyConfiguration.cs new file mode 100644 index 000000000..7a2134f16 --- /dev/null +++ b/src/Auth0.ManagementApi/Types/RateLimitPolicyConfiguration.cs @@ -0,0 +1,344 @@ +// ReSharper disable NullableWarningSuppressionIsUsed +// ReSharper disable InconsistentNaming + +using Auth0.ManagementApi.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace Auth0.ManagementApi; + +/// +/// The configuration of the rate limit policy. +/// +[JsonConverter(typeof(RateLimitPolicyConfiguration.JsonConverter))] +[Serializable] +public class RateLimitPolicyConfiguration +{ + private RateLimitPolicyConfiguration(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.RateLimitPolicyConfigurationZero value. + /// + public static RateLimitPolicyConfiguration FromRateLimitPolicyConfigurationZero( + Auth0.ManagementApi.RateLimitPolicyConfigurationZero value + ) => new("rateLimitPolicyConfigurationZero", value); + + /// + /// Factory method to create a union from a Auth0.ManagementApi.RateLimitPolicyConfigurationOne value. + /// + public static RateLimitPolicyConfiguration FromRateLimitPolicyConfigurationOne( + Auth0.ManagementApi.RateLimitPolicyConfigurationOne value + ) => new("rateLimitPolicyConfigurationOne", value); + + /// + /// Factory method to create a union from a Auth0.ManagementApi.RateLimitPolicyConfigurationAction value. + /// + public static RateLimitPolicyConfiguration FromRateLimitPolicyConfigurationAction( + Auth0.ManagementApi.RateLimitPolicyConfigurationAction value + ) => new("rateLimitPolicyConfigurationAction", value); + + /// + /// Returns true if is "rateLimitPolicyConfigurationZero" + /// + public bool IsRateLimitPolicyConfigurationZero() => Type == "rateLimitPolicyConfigurationZero"; + + /// + /// Returns true if is "rateLimitPolicyConfigurationOne" + /// + public bool IsRateLimitPolicyConfigurationOne() => Type == "rateLimitPolicyConfigurationOne"; + + /// + /// Returns true if is "rateLimitPolicyConfigurationAction" + /// + public bool IsRateLimitPolicyConfigurationAction() => + Type == "rateLimitPolicyConfigurationAction"; + + /// + /// Returns the value as a if is 'rateLimitPolicyConfigurationZero', otherwise throws an exception. + /// + /// Thrown when is not 'rateLimitPolicyConfigurationZero'. + public Auth0.ManagementApi.RateLimitPolicyConfigurationZero AsRateLimitPolicyConfigurationZero() => + IsRateLimitPolicyConfigurationZero() + ? (Auth0.ManagementApi.RateLimitPolicyConfigurationZero)Value! + : throw new ManagementException("Union type is not 'rateLimitPolicyConfigurationZero'"); + + /// + /// Returns the value as a if is 'rateLimitPolicyConfigurationOne', otherwise throws an exception. + /// + /// Thrown when is not 'rateLimitPolicyConfigurationOne'. + public Auth0.ManagementApi.RateLimitPolicyConfigurationOne AsRateLimitPolicyConfigurationOne() => + IsRateLimitPolicyConfigurationOne() + ? (Auth0.ManagementApi.RateLimitPolicyConfigurationOne)Value! + : throw new ManagementException("Union type is not 'rateLimitPolicyConfigurationOne'"); + + /// + /// Returns the value as a if is 'rateLimitPolicyConfigurationAction', otherwise throws an exception. + /// + /// Thrown when is not 'rateLimitPolicyConfigurationAction'. + public Auth0.ManagementApi.RateLimitPolicyConfigurationAction AsRateLimitPolicyConfigurationAction() => + IsRateLimitPolicyConfigurationAction() + ? (Auth0.ManagementApi.RateLimitPolicyConfigurationAction)Value! + : throw new ManagementException( + "Union type is not 'rateLimitPolicyConfigurationAction'" + ); + + /// + /// Attempts to cast the value to a and returns true if successful. + /// + public bool TryGetRateLimitPolicyConfigurationZero( + out Auth0.ManagementApi.RateLimitPolicyConfigurationZero? value + ) + { + if (Type == "rateLimitPolicyConfigurationZero") + { + value = (Auth0.ManagementApi.RateLimitPolicyConfigurationZero)Value!; + return true; + } + value = null; + return false; + } + + /// + /// Attempts to cast the value to a and returns true if successful. + /// + public bool TryGetRateLimitPolicyConfigurationOne( + out Auth0.ManagementApi.RateLimitPolicyConfigurationOne? value + ) + { + if (Type == "rateLimitPolicyConfigurationOne") + { + value = (Auth0.ManagementApi.RateLimitPolicyConfigurationOne)Value!; + return true; + } + value = null; + return false; + } + + /// + /// Attempts to cast the value to a and returns true if successful. + /// + public bool TryGetRateLimitPolicyConfigurationAction( + out Auth0.ManagementApi.RateLimitPolicyConfigurationAction? value + ) + { + if (Type == "rateLimitPolicyConfigurationAction") + { + value = (Auth0.ManagementApi.RateLimitPolicyConfigurationAction)Value!; + return true; + } + value = null; + return false; + } + + public T Match( + Func< + Auth0.ManagementApi.RateLimitPolicyConfigurationZero, + T + > onRateLimitPolicyConfigurationZero, + Func< + Auth0.ManagementApi.RateLimitPolicyConfigurationOne, + T + > onRateLimitPolicyConfigurationOne, + Func< + Auth0.ManagementApi.RateLimitPolicyConfigurationAction, + T + > onRateLimitPolicyConfigurationAction + ) + { + return Type switch + { + "rateLimitPolicyConfigurationZero" => onRateLimitPolicyConfigurationZero( + AsRateLimitPolicyConfigurationZero() + ), + "rateLimitPolicyConfigurationOne" => onRateLimitPolicyConfigurationOne( + AsRateLimitPolicyConfigurationOne() + ), + "rateLimitPolicyConfigurationAction" => onRateLimitPolicyConfigurationAction( + AsRateLimitPolicyConfigurationAction() + ), + _ => throw new ManagementException($"Unknown union type: {Type}"), + }; + } + + public void Visit( + global::System.Action onRateLimitPolicyConfigurationZero, + global::System.Action onRateLimitPolicyConfigurationOne, + global::System.Action onRateLimitPolicyConfigurationAction + ) + { + switch (Type) + { + case "rateLimitPolicyConfigurationZero": + onRateLimitPolicyConfigurationZero(AsRateLimitPolicyConfigurationZero()); + break; + case "rateLimitPolicyConfigurationOne": + onRateLimitPolicyConfigurationOne(AsRateLimitPolicyConfigurationOne()); + break; + case "rateLimitPolicyConfigurationAction": + onRateLimitPolicyConfigurationAction(AsRateLimitPolicyConfigurationAction()); + 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 RateLimitPolicyConfiguration 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 RateLimitPolicyConfiguration( + Auth0.ManagementApi.RateLimitPolicyConfigurationZero value + ) => new("rateLimitPolicyConfigurationZero", value); + + public static implicit operator RateLimitPolicyConfiguration( + Auth0.ManagementApi.RateLimitPolicyConfigurationOne value + ) => new("rateLimitPolicyConfigurationOne", value); + + public static implicit operator RateLimitPolicyConfiguration( + Auth0.ManagementApi.RateLimitPolicyConfigurationAction value + ) => new("rateLimitPolicyConfigurationAction", value); + + [Serializable] + internal sealed class JsonConverter : JsonConverter + { + public override RateLimitPolicyConfiguration? Read( + ref Utf8JsonReader reader, + global::System.Type typeToConvert, + JsonSerializerOptions options + ) + { + if (reader.TokenType == JsonTokenType.Null) + { + return null; + } + + if (reader.TokenType == JsonTokenType.StartObject) + { + var document = JsonDocument.ParseValue(ref reader); + + var types = new (string Key, System.Type Type)[] + { + ( + "rateLimitPolicyConfigurationZero", + typeof(Auth0.ManagementApi.RateLimitPolicyConfigurationZero) + ), + ( + "rateLimitPolicyConfigurationOne", + typeof(Auth0.ManagementApi.RateLimitPolicyConfigurationOne) + ), + ( + "rateLimitPolicyConfigurationAction", + typeof(Auth0.ManagementApi.RateLimitPolicyConfigurationAction) + ), + }; + + foreach (var (key, type) in types) + { + try + { + var value = document.Deserialize(type, options); + if (value != null) + { + RateLimitPolicyConfiguration result = new(key, value); + return result; + } + } + catch (JsonException) + { + // Try next type; + } + } + } + + throw new JsonException( + $"Cannot deserialize JSON token {reader.TokenType} into RateLimitPolicyConfiguration" + ); + } + + public override void Write( + Utf8JsonWriter writer, + RateLimitPolicyConfiguration value, + JsonSerializerOptions options + ) + { + if (value == null) + { + writer.WriteNullValue(); + return; + } + + value.Visit( + obj => JsonSerializer.Serialize(writer, obj, options), + obj => JsonSerializer.Serialize(writer, obj, options), + obj => JsonSerializer.Serialize(writer, obj, options) + ); + } + + public override RateLimitPolicyConfiguration ReadAsPropertyName( + ref Utf8JsonReader reader, + global::System.Type typeToConvert, + JsonSerializerOptions options + ) + { + var stringValue = reader.GetString()!; + RateLimitPolicyConfiguration result = new("string", stringValue); + return result; + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + RateLimitPolicyConfiguration value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value?.ToString() ?? "null"); + } + } +} diff --git a/src/Auth0.ManagementApi/Types/RateLimitPolicyConfigurationAction.cs b/src/Auth0.ManagementApi/Types/RateLimitPolicyConfigurationAction.cs new file mode 100644 index 000000000..416eafe51 --- /dev/null +++ b/src/Auth0.ManagementApi/Types/RateLimitPolicyConfigurationAction.cs @@ -0,0 +1,43 @@ +using Auth0.ManagementApi.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace Auth0.ManagementApi; + +[Serializable] +public record RateLimitPolicyConfigurationAction : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + /// + /// Determines the action to take when the rate limit is exceeded. + /// + [JsonPropertyName("action")] + public required RateLimitPolicyConfigurationActionAction Action { get; set; } + + /// + /// The maximum number of requests allowed in a single refresh window. + /// + [JsonPropertyName("limit")] + public required int Limit { get; set; } + + /// + /// The HTTPS URI to redirect to when the rate limit is exceeded. + /// + [JsonPropertyName("redirect_uri")] + public required string RedirectUri { 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/RateLimitPolicyConfigurationActionAction.cs b/src/Auth0.ManagementApi/Types/RateLimitPolicyConfigurationActionAction.cs new file mode 100644 index 000000000..bf71853f3 --- /dev/null +++ b/src/Auth0.ManagementApi/Types/RateLimitPolicyConfigurationActionAction.cs @@ -0,0 +1,120 @@ +using Auth0.ManagementApi.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace Auth0.ManagementApi; + +[JsonConverter( + typeof(RateLimitPolicyConfigurationActionAction.RateLimitPolicyConfigurationActionActionSerializer) +)] +[Serializable] +public readonly record struct RateLimitPolicyConfigurationActionAction : IStringEnum +{ + public static readonly RateLimitPolicyConfigurationActionAction Redirect = new(Values.Redirect); + + public RateLimitPolicyConfigurationActionAction(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static RateLimitPolicyConfigurationActionAction FromCustom(string value) + { + return new RateLimitPolicyConfigurationActionAction(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 ==( + RateLimitPolicyConfigurationActionAction value1, + string value2 + ) => value1.Value.Equals(value2); + + public static bool operator !=( + RateLimitPolicyConfigurationActionAction value1, + string value2 + ) => !value1.Value.Equals(value2); + + public static explicit operator string(RateLimitPolicyConfigurationActionAction value) => + value.Value; + + public static explicit operator RateLimitPolicyConfigurationActionAction(string value) => + new(value); + + internal class RateLimitPolicyConfigurationActionActionSerializer + : JsonConverter + { + public override RateLimitPolicyConfigurationActionAction 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 RateLimitPolicyConfigurationActionAction(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + RateLimitPolicyConfigurationActionAction value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override RateLimitPolicyConfigurationActionAction 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 RateLimitPolicyConfigurationActionAction(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + RateLimitPolicyConfigurationActionAction value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string Redirect = "redirect"; + } +} diff --git a/src/Auth0.ManagementApi/Types/RateLimitPolicyConfigurationOne.cs b/src/Auth0.ManagementApi/Types/RateLimitPolicyConfigurationOne.cs new file mode 100644 index 000000000..225195698 --- /dev/null +++ b/src/Auth0.ManagementApi/Types/RateLimitPolicyConfigurationOne.cs @@ -0,0 +1,37 @@ +using Auth0.ManagementApi.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace Auth0.ManagementApi; + +[Serializable] +public record RateLimitPolicyConfigurationOne : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + /// + /// Determines the action to take when the rate limit is exceeded. + /// + [JsonPropertyName("action")] + public required RateLimitPolicyConfigurationOneAction Action { get; set; } + + /// + /// The maximum number of requests allowed in a single refresh window. + /// + [JsonPropertyName("limit")] + public required int Limit { 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/RateLimitPolicyConfigurationOneAction.cs b/src/Auth0.ManagementApi/Types/RateLimitPolicyConfigurationOneAction.cs new file mode 100644 index 000000000..da752e2bd --- /dev/null +++ b/src/Auth0.ManagementApi/Types/RateLimitPolicyConfigurationOneAction.cs @@ -0,0 +1,120 @@ +using Auth0.ManagementApi.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace Auth0.ManagementApi; + +[JsonConverter( + typeof(RateLimitPolicyConfigurationOneAction.RateLimitPolicyConfigurationOneActionSerializer) +)] +[Serializable] +public readonly record struct RateLimitPolicyConfigurationOneAction : IStringEnum +{ + public static readonly RateLimitPolicyConfigurationOneAction Block = new(Values.Block); + + public static readonly RateLimitPolicyConfigurationOneAction Log = new(Values.Log); + + public RateLimitPolicyConfigurationOneAction(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static RateLimitPolicyConfigurationOneAction FromCustom(string value) + { + return new RateLimitPolicyConfigurationOneAction(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 ==(RateLimitPolicyConfigurationOneAction value1, string value2) => + value1.Value.Equals(value2); + + public static bool operator !=(RateLimitPolicyConfigurationOneAction value1, string value2) => + !value1.Value.Equals(value2); + + public static explicit operator string(RateLimitPolicyConfigurationOneAction value) => + value.Value; + + public static explicit operator RateLimitPolicyConfigurationOneAction(string value) => + new(value); + + internal class RateLimitPolicyConfigurationOneActionSerializer + : JsonConverter + { + public override RateLimitPolicyConfigurationOneAction 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 RateLimitPolicyConfigurationOneAction(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + RateLimitPolicyConfigurationOneAction value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override RateLimitPolicyConfigurationOneAction 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 RateLimitPolicyConfigurationOneAction(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + RateLimitPolicyConfigurationOneAction value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string Block = "block"; + + public const string Log = "log"; + } +} diff --git a/src/Auth0.ManagementApi/Types/RateLimitPolicyConfigurationZero.cs b/src/Auth0.ManagementApi/Types/RateLimitPolicyConfigurationZero.cs new file mode 100644 index 000000000..0f81dc7e5 --- /dev/null +++ b/src/Auth0.ManagementApi/Types/RateLimitPolicyConfigurationZero.cs @@ -0,0 +1,31 @@ +using Auth0.ManagementApi.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace Auth0.ManagementApi; + +[Serializable] +public record RateLimitPolicyConfigurationZero : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + /// + /// Determines the action to take when the rate limit is exceeded. + /// + [JsonPropertyName("action")] + public required RateLimitPolicyConfigurationZeroAction Action { 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/RateLimitPolicyConfigurationZeroAction.cs b/src/Auth0.ManagementApi/Types/RateLimitPolicyConfigurationZeroAction.cs new file mode 100644 index 000000000..1e50458d2 --- /dev/null +++ b/src/Auth0.ManagementApi/Types/RateLimitPolicyConfigurationZeroAction.cs @@ -0,0 +1,116 @@ +using Auth0.ManagementApi.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace Auth0.ManagementApi; + +[JsonConverter( + typeof(RateLimitPolicyConfigurationZeroAction.RateLimitPolicyConfigurationZeroActionSerializer) +)] +[Serializable] +public readonly record struct RateLimitPolicyConfigurationZeroAction : IStringEnum +{ + public static readonly RateLimitPolicyConfigurationZeroAction Allow = new(Values.Allow); + + public RateLimitPolicyConfigurationZeroAction(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static RateLimitPolicyConfigurationZeroAction FromCustom(string value) + { + return new RateLimitPolicyConfigurationZeroAction(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 ==(RateLimitPolicyConfigurationZeroAction value1, string value2) => + value1.Value.Equals(value2); + + public static bool operator !=(RateLimitPolicyConfigurationZeroAction value1, string value2) => + !value1.Value.Equals(value2); + + public static explicit operator string(RateLimitPolicyConfigurationZeroAction value) => + value.Value; + + public static explicit operator RateLimitPolicyConfigurationZeroAction(string value) => + new(value); + + internal class RateLimitPolicyConfigurationZeroActionSerializer + : JsonConverter + { + public override RateLimitPolicyConfigurationZeroAction 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 RateLimitPolicyConfigurationZeroAction(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + RateLimitPolicyConfigurationZeroAction value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override RateLimitPolicyConfigurationZeroAction 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 RateLimitPolicyConfigurationZeroAction(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + RateLimitPolicyConfigurationZeroAction value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string Allow = "allow"; + } +} diff --git a/src/Auth0.ManagementApi/Types/RateLimitPolicyConsumerEnum.cs b/src/Auth0.ManagementApi/Types/RateLimitPolicyConsumerEnum.cs new file mode 100644 index 000000000..7776e7161 --- /dev/null +++ b/src/Auth0.ManagementApi/Types/RateLimitPolicyConsumerEnum.cs @@ -0,0 +1,112 @@ +using Auth0.ManagementApi.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace Auth0.ManagementApi; + +[JsonConverter(typeof(RateLimitPolicyConsumerEnum.RateLimitPolicyConsumerEnumSerializer))] +[Serializable] +public readonly record struct RateLimitPolicyConsumerEnum : IStringEnum +{ + public static readonly RateLimitPolicyConsumerEnum Client = new(Values.Client); + + public RateLimitPolicyConsumerEnum(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static RateLimitPolicyConsumerEnum FromCustom(string value) + { + return new RateLimitPolicyConsumerEnum(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 ==(RateLimitPolicyConsumerEnum value1, string value2) => + value1.Value.Equals(value2); + + public static bool operator !=(RateLimitPolicyConsumerEnum value1, string value2) => + !value1.Value.Equals(value2); + + public static explicit operator string(RateLimitPolicyConsumerEnum value) => value.Value; + + public static explicit operator RateLimitPolicyConsumerEnum(string value) => new(value); + + internal class RateLimitPolicyConsumerEnumSerializer + : JsonConverter + { + public override RateLimitPolicyConsumerEnum 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 RateLimitPolicyConsumerEnum(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + RateLimitPolicyConsumerEnum value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override RateLimitPolicyConsumerEnum 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 RateLimitPolicyConsumerEnum(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + RateLimitPolicyConsumerEnum value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string Client = "client"; + } +} diff --git a/src/Auth0.ManagementApi/Types/RateLimitPolicyResourceEnum.cs b/src/Auth0.ManagementApi/Types/RateLimitPolicyResourceEnum.cs new file mode 100644 index 000000000..12674ef20 --- /dev/null +++ b/src/Auth0.ManagementApi/Types/RateLimitPolicyResourceEnum.cs @@ -0,0 +1,114 @@ +using Auth0.ManagementApi.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace Auth0.ManagementApi; + +[JsonConverter(typeof(RateLimitPolicyResourceEnum.RateLimitPolicyResourceEnumSerializer))] +[Serializable] +public readonly record struct RateLimitPolicyResourceEnum : IStringEnum +{ + public static readonly RateLimitPolicyResourceEnum OauthAuthenticationApi = new( + Values.OauthAuthenticationApi + ); + + public RateLimitPolicyResourceEnum(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static RateLimitPolicyResourceEnum FromCustom(string value) + { + return new RateLimitPolicyResourceEnum(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 ==(RateLimitPolicyResourceEnum value1, string value2) => + value1.Value.Equals(value2); + + public static bool operator !=(RateLimitPolicyResourceEnum value1, string value2) => + !value1.Value.Equals(value2); + + public static explicit operator string(RateLimitPolicyResourceEnum value) => value.Value; + + public static explicit operator RateLimitPolicyResourceEnum(string value) => new(value); + + internal class RateLimitPolicyResourceEnumSerializer + : JsonConverter + { + public override RateLimitPolicyResourceEnum 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 RateLimitPolicyResourceEnum(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + RateLimitPolicyResourceEnum value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override RateLimitPolicyResourceEnum 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 RateLimitPolicyResourceEnum(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + RateLimitPolicyResourceEnum value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string OauthAuthenticationApi = "oauth_authentication_api"; + } +} diff --git a/src/Auth0.ManagementApi/Types/UpdateConnectionOptions.cs b/src/Auth0.ManagementApi/Types/UpdateConnectionOptions.cs index 467caf270..a3cc83310 100644 --- a/src/Auth0.ManagementApi/Types/UpdateConnectionOptions.cs +++ b/src/Auth0.ManagementApi/Types/UpdateConnectionOptions.cs @@ -166,6 +166,10 @@ public Optional?> IdTokenSignedResponseAlgs { get; set; } + [Optional] + [JsonPropertyName("dpop_signing_alg")] + public ConnectionDpopSigningAlgEnum? DpopSigningAlg { get; set; } + [Nullable, Optional] [JsonPropertyName("token_endpoint_auth_method")] public Optional TokenEndpointAuthMethod { get; set; } diff --git a/src/Auth0.ManagementApi/Types/UpdateRateLimitPolicyResponseContent.cs b/src/Auth0.ManagementApi/Types/UpdateRateLimitPolicyResponseContent.cs new file mode 100644 index 000000000..7825c2a21 --- /dev/null +++ b/src/Auth0.ManagementApi/Types/UpdateRateLimitPolicyResponseContent.cs @@ -0,0 +1,60 @@ +using Auth0.ManagementApi.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace Auth0.ManagementApi; + +[Serializable] +public record UpdateRateLimitPolicyResponseContent : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + /// + /// Unique identifier for the Rate Limit Policy. + /// + [JsonPropertyName("id")] + public required string Id { get; set; } + + [JsonPropertyName("resource")] + public required RateLimitPolicyResourceEnum Resource { get; set; } + + [JsonPropertyName("consumer")] + public required RateLimitPolicyConsumerEnum Consumer { get; set; } + + /// + /// Identifier or category within the consumer to which the policy applies. Supported values: `client_id:` to target a specific client by ID, `client_id:` to target a CIMD client by URI, `cimd_clients` to target all CIMD clients, `third_party_clients` to target all third-party clients, or `default` to apply the policy to any consumer identifier not otherwise explicitly targeted. + /// + [JsonPropertyName("consumer_selector")] + public required string ConsumerSelector { get; set; } + + [JsonPropertyName("configuration")] + public required RateLimitPolicyConfiguration Configuration { get; set; } + + /// + /// The date and time when the rate limit policy was created. + /// + [Optional] + [JsonPropertyName("created_at")] + public DateTime? CreatedAt { get; set; } + + /// + /// The date and time when the rate limit policy was last updated. + /// + [Optional] + [JsonPropertyName("updated_at")] + public DateTime? UpdatedAt { 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/UpdateUserResponseContent.cs b/src/Auth0.ManagementApi/Types/UpdateUserResponseContent.cs index 8bf469a3b..1e3ceb697 100644 --- a/src/Auth0.ManagementApi/Types/UpdateUserResponseContent.cs +++ b/src/Auth0.ManagementApi/Types/UpdateUserResponseContent.cs @@ -103,6 +103,10 @@ public record UpdateUserResponseContent : IJsonOnDeserialized, IJsonOnSerializin [JsonPropertyName("multifactor")] public IEnumerable? Multifactor { get; set; } + [Optional] + [JsonPropertyName("multifactor_last_modified")] + public UserDateSchema? MultifactorLastModified { get; set; } + /// /// Last IP address from which this user logged in. /// @@ -114,6 +118,10 @@ public record UpdateUserResponseContent : IJsonOnDeserialized, IJsonOnSerializin [JsonPropertyName("last_login")] public UserDateSchema? LastLogin { get; set; } + [Optional] + [JsonPropertyName("last_password_reset")] + public UserDateSchema? LastPasswordReset { get; set; } + /// /// Total number of logins this user has performed. /// diff --git a/src/Auth0.ManagementApi/Types/UserResponseSchema.cs b/src/Auth0.ManagementApi/Types/UserResponseSchema.cs index c3b7cda91..f1e7f8ae8 100644 --- a/src/Auth0.ManagementApi/Types/UserResponseSchema.cs +++ b/src/Auth0.ManagementApi/Types/UserResponseSchema.cs @@ -103,6 +103,10 @@ public record UserResponseSchema : IJsonOnDeserialized, IJsonOnSerializing [JsonPropertyName("multifactor")] public IEnumerable? Multifactor { get; set; } + [Optional] + [JsonPropertyName("multifactor_last_modified")] + public UserDateSchema? MultifactorLastModified { get; set; } + /// /// Last IP address from which this user logged in. /// @@ -114,6 +118,10 @@ public record UserResponseSchema : IJsonOnDeserialized, IJsonOnSerializing [JsonPropertyName("last_login")] public UserDateSchema? LastLogin { get; set; } + [Optional] + [JsonPropertyName("last_password_reset")] + public UserDateSchema? LastPasswordReset { get; set; } + /// /// Total number of logins this user has performed. /// diff --git a/src/Auth0.ManagementApi/UserAttributeProfiles/IUserAttributeProfilesClient.cs b/src/Auth0.ManagementApi/UserAttributeProfiles/IUserAttributeProfilesClient.cs index 989cdf23c..305909eb4 100644 --- a/src/Auth0.ManagementApi/UserAttributeProfiles/IUserAttributeProfilesClient.cs +++ b/src/Auth0.ManagementApi/UserAttributeProfiles/IUserAttributeProfilesClient.cs @@ -14,7 +14,7 @@ Task> ListAsync( ); /// - /// Create a User Attribute Profile + /// Create a User Attribute Profile. /// WithRawResponseTask CreateAsync( CreateUserAttributeProfileRequestContent request, diff --git a/src/Auth0.ManagementApi/UserAttributeProfiles/UserAttributeProfilesClient.cs b/src/Auth0.ManagementApi/UserAttributeProfiles/UserAttributeProfilesClient.cs index 2a4b16b97..fe89613cc 100644 --- a/src/Auth0.ManagementApi/UserAttributeProfiles/UserAttributeProfilesClient.cs +++ b/src/Auth0.ManagementApi/UserAttributeProfiles/UserAttributeProfilesClient.cs @@ -607,7 +607,7 @@ await ListInternalAsync(request, options, cancellationToken).WithRawResponse(), } /// - /// Create a User Attribute Profile + /// Create a User Attribute Profile. /// /// /// await client.UserAttributeProfiles.CreateAsync( diff --git a/src/Auth0.ManagementApi/Users/AuthenticationMethods/AuthenticationMethodsClient.cs b/src/Auth0.ManagementApi/Users/AuthenticationMethods/AuthenticationMethodsClient.cs index 62a675476..f9b959d6a 100644 --- a/src/Auth0.ManagementApi/Users/AuthenticationMethods/AuthenticationMethodsClient.cs +++ b/src/Auth0.ManagementApi/Users/AuthenticationMethods/AuthenticationMethodsClient.cs @@ -256,7 +256,6 @@ private async Task< ), Body = request, Headers = _headers, - ContentType = "application/json", Options = options, }, cancellationToken diff --git a/src/Auth0.ManagementApi/Users/Authenticators/AuthenticatorsClient.cs b/src/Auth0.ManagementApi/Users/Authenticators/AuthenticatorsClient.cs index c3bb755f3..adf986621 100644 --- a/src/Auth0.ManagementApi/Users/Authenticators/AuthenticatorsClient.cs +++ b/src/Auth0.ManagementApi/Users/Authenticators/AuthenticatorsClient.cs @@ -14,7 +14,7 @@ internal AuthenticatorsClient(RawClient client) } /// - /// Remove all authenticators registered to a given user ID, such as OTP, email, phone, and push-notification. This action cannot be undone. For more information, review Manage Authentication Methods with Management API. + /// Remove all authenticators registered to a given user ID, such as OTP, email, phone, and push-notification. This action cannot be undone. For more information, review [Manage Authentication Methods with Management API](https://auth0.com/docs/secure/multi-factor-authentication/manage-mfa-auth0-apis/manage-authentication-methods-with-management-api). /// /// /// await client.Users.Authenticators.DeleteAllAsync("id"); diff --git a/src/Auth0.ManagementApi/Users/Authenticators/IAuthenticatorsClient.cs b/src/Auth0.ManagementApi/Users/Authenticators/IAuthenticatorsClient.cs index 526da2b4c..75cb729ee 100644 --- a/src/Auth0.ManagementApi/Users/Authenticators/IAuthenticatorsClient.cs +++ b/src/Auth0.ManagementApi/Users/Authenticators/IAuthenticatorsClient.cs @@ -5,7 +5,7 @@ namespace Auth0.ManagementApi.Users; public partial interface IAuthenticatorsClient { /// - /// Remove all authenticators registered to a given user ID, such as OTP, email, phone, and push-notification. This action cannot be undone. For more information, review Manage Authentication Methods with Management API. + /// Remove all authenticators registered to a given user ID, such as OTP, email, phone, and push-notification. This action cannot be undone. For more information, review [Manage Authentication Methods with Management API](https://auth0.com/docs/secure/multi-factor-authentication/manage-mfa-auth0-apis/manage-authentication-methods-with-management-api). /// Task DeleteAllAsync( string id, diff --git a/src/Auth0.ManagementApi/Users/Enrollments/EnrollmentsClient.cs b/src/Auth0.ManagementApi/Users/Enrollments/EnrollmentsClient.cs index 9fe154a24..60e637c25 100644 --- a/src/Auth0.ManagementApi/Users/Enrollments/EnrollmentsClient.cs +++ b/src/Auth0.ManagementApi/Users/Enrollments/EnrollmentsClient.cs @@ -104,7 +104,7 @@ private async Task>> GetAsyncCore( } /// - /// Retrieve the first multi-factor authentication enrollment that a specific user has confirmed. + /// Retrieve the first [multi-factor authentication](https://auth0.com/docs/secure/multi-factor-authentication/multi-factor-authentication-factors) enrollment that a specific user has confirmed. /// /// /// await client.Users.Enrollments.GetAsync("id"); diff --git a/src/Auth0.ManagementApi/Users/Enrollments/IEnrollmentsClient.cs b/src/Auth0.ManagementApi/Users/Enrollments/IEnrollmentsClient.cs index 265a85ff6..58f4cbaa4 100644 --- a/src/Auth0.ManagementApi/Users/Enrollments/IEnrollmentsClient.cs +++ b/src/Auth0.ManagementApi/Users/Enrollments/IEnrollmentsClient.cs @@ -5,7 +5,7 @@ namespace Auth0.ManagementApi.Users; public partial interface IEnrollmentsClient { /// - /// Retrieve the first multi-factor authentication enrollment that a specific user has confirmed. + /// Retrieve the first [multi-factor authentication](https://auth0.com/docs/secure/multi-factor-authentication/multi-factor-authentication-factors) enrollment that a specific user has confirmed. /// WithRawResponseTask> GetAsync( string id, diff --git a/src/Auth0.ManagementApi/Users/IUsersClient.cs b/src/Auth0.ManagementApi/Users/IUsersClient.cs index d1e4b9076..38e244612 100644 --- a/src/Auth0.ManagementApi/Users/IUsersClient.cs +++ b/src/Auth0.ManagementApi/Users/IUsersClient.cs @@ -29,13 +29,17 @@ public partial interface IUsersClient /// - Select the fields to be returned /// - Specify the number of users to retrieve per page and the page index /// - /// The q query parameter can be used to get users that match the specified criteria using query string syntax. /// - /// Learn more about searching for users. /// - /// Read about best practices when working with the API endpoints for retrieving users. + /// The `q` query parameter can be used to get users that match the specified criteria [using query string syntax.](https://auth0.com/docs/users/search/v3/query-syntax) /// - /// Auth0 limits the number of users you can return. If you exceed this threshold, please redefine your search, use the export job, or the User Import / Export extension. + /// [Learn more about searching for users.](https://auth0.com/docs/users/search/v3) + /// + /// Read about [best practices](https://auth0.com/docs/users/search/best-practices) when working with the API endpoints for retrieving users. + /// + /// + /// + /// Auth0 limits the number of users you can return. If you exceed this threshold, please redefine your search, use the [export job](https://auth0.com/docs/api/management/v2#!/Jobs/post_users_exports), or the [User Import / Export](https://auth0.com/docs/extensions/user-import-export) extension. /// Task> ListAsync( ListUsersRequestParameters request, @@ -44,9 +48,9 @@ Task> ListAsync( ); /// - /// Create a new user for a given database or passwordless connection. + /// Create a new user for a given [database](https://auth0.com/docs/connections/database) or [passwordless](https://auth0.com/docs/connections/passwordless) connection. /// - /// Note: connection is required but other parameters such as email and password are dependent upon the type of connection. + /// Note: `connection` is required but other parameters such as `email` and `password` are dependent upon the type of connection. /// WithRawResponseTask CreateAsync( CreateUserRequestContent request, @@ -68,7 +72,7 @@ WithRawResponseTask> ListUsersByEmailAsync( ); /// - /// Retrieve user details. A list of fields to include or exclude may also be specified. For more information, see Retrieve Users with the Get Users Endpoint. + /// Retrieve user details. A list of fields to include or exclude may also be specified. For more information, see [Retrieve Users with the Get Users Endpoint](https://auth0.com/docs/manage-users/user-search/retrieve-users-with-get-users-endpoint). /// WithRawResponseTask GetAsync( string id, @@ -78,7 +82,7 @@ WithRawResponseTask GetAsync( ); /// - /// Delete a user by user ID. This action cannot be undone. For Auth0 Dashboard instructions, see Delete Users. + /// Delete a user by user ID. This action cannot be undone. For Auth0 Dashboard instructions, see [Delete Users](https://auth0.com/docs/manage-users/user-accounts/delete-users). /// Task DeleteAsync( string id, @@ -91,64 +95,84 @@ Task DeleteAsync( /// /// These are the attributes that can be updated at the root level: /// - /// - /// app_metadata - /// blocked - /// email - /// email_verified - /// family_name - /// given_name - /// name - /// nickname - /// password - /// phone_number - /// phone_verified - /// picture - /// username - /// user_metadata - /// verify_email - /// + /// - app_metadata + /// - blocked + /// - email + /// - email_verified + /// - family_name + /// - given_name + /// - name + /// - nickname + /// - password + /// - phone_number + /// - phone_verified + /// - picture + /// - username + /// - user_metadata + /// - verify_email /// /// Some considerations: - /// - /// The properties of the new object will replace the old ones. - /// The metadata fields are an exception to this rule (user_metadata and app_metadata). These properties are merged instead of being replaced but be careful, the merge only occurs on the first level. - /// If you are updating email, email_verified, phone_number, phone_verified, username or password of a secondary identity, you need to specify the connection property too. - /// If you are updating email or phone_number you can specify, optionally, the client_id property. - /// Updating email_verified is not supported for enterprise and passwordless sms connections. - /// Updating the blocked to false does not affect the user's blocked state from an excessive amount of incorrectly provided credentials. Use the "Unblock a user" endpoint from the "User Blocks" API to change the user's state. - /// Supported attributes can be unset by supplying null as the value. - /// - /// - /// Updating a field (non-metadata property) + /// + /// - The properties of the new object will replace the old ones. + /// - The metadata fields are an exception to this rule (`user_metadata` and `app_metadata`). These properties are merged instead of being replaced but be careful, the merge only occurs on the first level. + /// - If you are updating `email`, `email_verified`, `phone_number`, `phone_verified`, `username` or `password` of a secondary identity, you need to specify the `connection` property too. + /// - If you are updating `email` or `phone_number` you can specify, optionally, the `client_id` property. + /// - Updating `email_verified` is not supported for enterprise and passwordless sms connections. + /// - Updating the `blocked` to `false` does not affect the user's blocked state from an excessive amount of incorrectly provided credentials. Use the "Unblock a user" endpoint from the "User Blocks" API to change the user's state. + /// - Supported attributes can be unset by supplying `null` as the value. + /// + /// **Updating a field (non-metadata property)** + /// /// To mark the email address of a user as verified, the body to send should be: - /// { "email_verified": true } /// - /// Updating a user metadata root propertyLet's assume that our test user has the following user_metadata: - /// { "user_metadata" : { "profileCode": 1479 } } + /// ```json + /// { "email_verified": true } + /// ``` + /// + /// **Updating a user metadata root property** /// - /// To add the field addresses the body to send should be: - /// { "user_metadata" : { "addresses": {"work_address": "100 Industrial Way"} }} + /// Let's assume that our test user has the following `user_metadata`: /// - /// The modified object ends up with the following user_metadata property:{ + /// ```json + /// { "user_metadata" : { "profileCode": 1479 } } + /// ``` + /// + /// To add the field `addresses` the body to send should be: + /// + /// ```json + /// { "user_metadata" : { "addresses": {"work_address": "100 Industrial Way"} }} + /// ``` + /// + /// The modified object ends up with the following `user_metadata` property: + /// + /// ```json + /// { /// "user_metadata": { /// "profileCode": 1479, /// "addresses": { "work_address": "100 Industrial Way" } /// } - /// } + /// } + /// ``` /// - /// Updating an inner user metadata propertyIf there's existing user metadata to which we want to add "home_address": "742 Evergreen Terrace" (using the addresses property) we should send the whole addresses object. Since this is a first-level object, the object will be merged in, but its own properties will not be. The body to send should be: - /// { + /// **Updating an inner user metadata property** + /// + /// If there's existing user metadata to which we want to add `"home_address": "742 Evergreen Terrace"` (using the `addresses` property) we should send the whole `addresses` object. Since this is a first-level object, the object will be merged in, but its own properties will not be. The body to send should be: + /// + /// ```json + /// { /// "user_metadata": { /// "addresses": { /// "work_address": "100 Industrial Way", /// "home_address": "742 Evergreen Terrace" /// } /// } - /// } + /// } + /// ``` + /// + /// The modified object ends up with the following `user_metadata` property: /// - /// The modified object ends up with the following user_metadata property: - /// { + /// ```json + /// { /// "user_metadata": { /// "profileCode": 1479, /// "addresses": { @@ -156,7 +180,8 @@ Task DeleteAsync( /// "home_address": "742 Evergreen Terrace" /// } /// } - /// } + /// } + /// ``` /// WithRawResponseTask UpdateAsync( string id, @@ -166,7 +191,7 @@ WithRawResponseTask UpdateAsync( ); /// - /// Remove an existing multi-factor authentication (MFA) recovery code and generate a new one. If a user cannot access the original device or account used for MFA enrollment, they can use a recovery code to authenticate. + /// Remove an existing multi-factor authentication (MFA) [recovery code](https://auth0.com/docs/secure/multi-factor-authentication/reset-user-mfa) and generate a new one. If a user cannot access the original device or account used for MFA enrollment, they can use a recovery code to authenticate. /// WithRawResponseTask RegenerateRecoveryCodeAsync( string id, diff --git a/src/Auth0.ManagementApi/Users/Identities/IIdentitiesClient.cs b/src/Auth0.ManagementApi/Users/Identities/IIdentitiesClient.cs index 3f925a101..363b1080b 100644 --- a/src/Auth0.ManagementApi/Users/Identities/IIdentitiesClient.cs +++ b/src/Auth0.ManagementApi/Users/Identities/IIdentitiesClient.cs @@ -9,30 +9,31 @@ public partial interface IIdentitiesClient /// /// Note: There are two ways of invoking the endpoint: /// - /// - /// With the authenticated primary account's JWT in the Authorization header, which has the update:current_user_identities scope: - /// - /// POST /api/v2/users/PRIMARY_ACCOUNT_USER_ID/identities - /// Authorization: "Bearer PRIMARY_ACCOUNT_JWT" - /// { - /// "link_with": "SECONDARY_ACCOUNT_JWT" - /// } - /// - /// In this case, only the link_with param is required in the body, which also contains the JWT obtained upon the secondary account's authentication. - /// - /// With a token generated by the API V2 containing the update:users scope: - /// - /// POST /api/v2/users/PRIMARY_ACCOUNT_USER_ID/identities - /// Authorization: "Bearer YOUR_API_V2_TOKEN" - /// { - /// "provider": "SECONDARY_ACCOUNT_PROVIDER", - /// "connection_id": "SECONDARY_ACCOUNT_CONNECTION_ID(OPTIONAL)", - /// "user_id": "SECONDARY_ACCOUNT_USER_ID" - /// } - /// - /// In this case you need to send provider and user_id in the body. Optionally you can also send the connection_id param which is suitable for identifying a particular database connection for the 'auth0' provider. - /// - /// + /// - With the authenticated primary account's JWT in the Authorization header, which has the `update:current_user_identities` scope: + /// + /// ```http + /// POST /api/v2/users/PRIMARY_ACCOUNT_USER_ID/identities + /// Authorization: "Bearer PRIMARY_ACCOUNT_JWT" + /// { + /// "link_with": "SECONDARY_ACCOUNT_JWT" + /// } + /// ``` + /// + /// In this case, only the `link_with` param is required in the body, which also contains the JWT obtained upon the secondary account's authentication. + /// + /// - With a token generated by the API V2 containing the `update:users` scope: + /// + /// ```http + /// POST /api/v2/users/PRIMARY_ACCOUNT_USER_ID/identities + /// Authorization: "Bearer YOUR_API_V2_TOKEN" + /// { + /// "provider": "SECONDARY_ACCOUNT_PROVIDER", + /// "connection_id": "SECONDARY_ACCOUNT_CONNECTION_ID(OPTIONAL)", + /// "user_id": "SECONDARY_ACCOUNT_USER_ID" + /// } + /// ``` + /// + /// In this case you need to send `provider` and `user_id` in the body. Optionally you can also send the `connection_id` param which is suitable for identifying a particular database connection for the 'auth0' provider. /// WithRawResponseTask> LinkAsync( string id, @@ -44,7 +45,7 @@ WithRawResponseTask> LinkAsync( /// /// Unlink a specific secondary account from a target user. This action requires the ID of both the target user and the secondary account. /// - /// Unlinking the secondary account removes it from the identities array of the target user and creates a new standalone profile for the secondary account. To learn more, review Unlink User Accounts. + /// Unlinking the secondary account removes it from the identities array of the target user and creates a new standalone profile for the secondary account. To learn more, review [Unlink User Accounts](https://auth0.com/docs/manage-users/user-accounts/user-account-linking/unlink-user-accounts). /// WithRawResponseTask> DeleteAsync( string id, diff --git a/src/Auth0.ManagementApi/Users/Identities/IdentitiesClient.cs b/src/Auth0.ManagementApi/Users/Identities/IdentitiesClient.cs index a2ebcd405..ca0455ed7 100644 --- a/src/Auth0.ManagementApi/Users/Identities/IdentitiesClient.cs +++ b/src/Auth0.ManagementApi/Users/Identities/IdentitiesClient.cs @@ -203,30 +203,31 @@ private async Task< /// /// Note: There are two ways of invoking the endpoint: /// - /// - /// With the authenticated primary account's JWT in the Authorization header, which has the update:current_user_identities scope: - /// - /// POST /api/v2/users/PRIMARY_ACCOUNT_USER_ID/identities - /// Authorization: "Bearer PRIMARY_ACCOUNT_JWT" - /// { - /// "link_with": "SECONDARY_ACCOUNT_JWT" - /// } - /// - /// In this case, only the link_with param is required in the body, which also contains the JWT obtained upon the secondary account's authentication. - /// - /// With a token generated by the API V2 containing the update:users scope: - /// - /// POST /api/v2/users/PRIMARY_ACCOUNT_USER_ID/identities - /// Authorization: "Bearer YOUR_API_V2_TOKEN" - /// { - /// "provider": "SECONDARY_ACCOUNT_PROVIDER", - /// "connection_id": "SECONDARY_ACCOUNT_CONNECTION_ID(OPTIONAL)", - /// "user_id": "SECONDARY_ACCOUNT_USER_ID" - /// } - /// - /// In this case you need to send provider and user_id in the body. Optionally you can also send the connection_id param which is suitable for identifying a particular database connection for the 'auth0' provider. - /// - /// + /// - With the authenticated primary account's JWT in the Authorization header, which has the `update:current_user_identities` scope: + /// + /// ```http + /// POST /api/v2/users/PRIMARY_ACCOUNT_USER_ID/identities + /// Authorization: "Bearer PRIMARY_ACCOUNT_JWT" + /// { + /// "link_with": "SECONDARY_ACCOUNT_JWT" + /// } + /// ``` + /// + /// In this case, only the `link_with` param is required in the body, which also contains the JWT obtained upon the secondary account's authentication. + /// + /// - With a token generated by the API V2 containing the `update:users` scope: + /// + /// ```http + /// POST /api/v2/users/PRIMARY_ACCOUNT_USER_ID/identities + /// Authorization: "Bearer YOUR_API_V2_TOKEN" + /// { + /// "provider": "SECONDARY_ACCOUNT_PROVIDER", + /// "connection_id": "SECONDARY_ACCOUNT_CONNECTION_ID(OPTIONAL)", + /// "user_id": "SECONDARY_ACCOUNT_USER_ID" + /// } + /// ``` + /// + /// In this case you need to send `provider` and `user_id` in the body. Optionally you can also send the `connection_id` param which is suitable for identifying a particular database connection for the 'auth0' provider. /// /// /// await client.Users.Identities.LinkAsync("id", new LinkUserIdentityRequestContent()); @@ -246,7 +247,7 @@ public WithRawResponseTask> LinkAsync( /// /// Unlink a specific secondary account from a target user. This action requires the ID of both the target user and the secondary account. /// - /// Unlinking the secondary account removes it from the identities array of the target user and creates a new standalone profile for the secondary account. To learn more, review Unlink User Accounts. + /// Unlinking the secondary account removes it from the identities array of the target user and creates a new standalone profile for the secondary account. To learn more, review [Unlink User Accounts](https://auth0.com/docs/manage-users/user-accounts/user-account-linking/unlink-user-accounts). /// /// /// await client.Users.Identities.DeleteAsync("id", UserIdentityProviderEnum.Ad, "user_id"); diff --git a/src/Auth0.ManagementApi/Users/Multifactor/IMultifactorClient.cs b/src/Auth0.ManagementApi/Users/Multifactor/IMultifactorClient.cs index a40a6f2c3..15c652e56 100644 --- a/src/Auth0.ManagementApi/Users/Multifactor/IMultifactorClient.cs +++ b/src/Auth0.ManagementApi/Users/Multifactor/IMultifactorClient.cs @@ -5,7 +5,7 @@ namespace Auth0.ManagementApi.Users; public partial interface IMultifactorClient { /// - /// Invalidate all remembered browsers across all authentication factors for a user. + /// Invalidate all remembered browsers across all [authentication factors](https://auth0.com/docs/multifactor-authentication) for a user. /// Task InvalidateRememberBrowserAsync( string id, @@ -14,7 +14,7 @@ Task InvalidateRememberBrowserAsync( ); /// - /// Remove a multifactor authentication configuration from a user's account. This forces the user to manually reconfigure the multi-factor provider. + /// Remove a [multifactor](https://auth0.com/docs/multifactor-authentication) authentication configuration from a user's account. This forces the user to manually reconfigure the multi-factor provider. /// Task DeleteProviderAsync( string id, diff --git a/src/Auth0.ManagementApi/Users/Multifactor/MultifactorClient.cs b/src/Auth0.ManagementApi/Users/Multifactor/MultifactorClient.cs index 51bf6e24f..47ab8a78f 100644 --- a/src/Auth0.ManagementApi/Users/Multifactor/MultifactorClient.cs +++ b/src/Auth0.ManagementApi/Users/Multifactor/MultifactorClient.cs @@ -14,7 +14,7 @@ internal MultifactorClient(RawClient client) } /// - /// Invalidate all remembered browsers across all authentication factors for a user. + /// Invalidate all remembered browsers across all [authentication factors](https://auth0.com/docs/multifactor-authentication) for a user. /// /// /// await client.Users.Multifactor.InvalidateRememberBrowserAsync("id"); @@ -79,7 +79,7 @@ public async Task InvalidateRememberBrowserAsync( } /// - /// Remove a multifactor authentication configuration from a user's account. This forces the user to manually reconfigure the multi-factor provider. + /// Remove a [multifactor](https://auth0.com/docs/multifactor-authentication) authentication configuration from a user's account. This forces the user to manually reconfigure the multi-factor provider. /// /// /// await client.Users.Multifactor.DeleteProviderAsync("id", UserMultifactorProviderEnum.Duo); diff --git a/src/Auth0.ManagementApi/Users/Organizations/IOrganizationsClient.cs b/src/Auth0.ManagementApi/Users/Organizations/IOrganizationsClient.cs index 93765caee..cd1c3f46e 100644 --- a/src/Auth0.ManagementApi/Users/Organizations/IOrganizationsClient.cs +++ b/src/Auth0.ManagementApi/Users/Organizations/IOrganizationsClient.cs @@ -6,7 +6,7 @@ namespace Auth0.ManagementApi.Users; public partial interface IOrganizationsClient { /// - /// Retrieve list of the specified user's current Organization memberships. User must be specified by user ID. For more information, review Auth0 Organizations. + /// Retrieve list of the specified user's current Organization memberships. User must be specified by user ID. For more information, review [Auth0 Organizations](https://auth0.com/docs/manage-users/organizations). /// Task> ListAsync( string id, diff --git a/src/Auth0.ManagementApi/Users/Organizations/OrganizationsClient.cs b/src/Auth0.ManagementApi/Users/Organizations/OrganizationsClient.cs index 45dda0f2d..7b11a0f39 100644 --- a/src/Auth0.ManagementApi/Users/Organizations/OrganizationsClient.cs +++ b/src/Auth0.ManagementApi/Users/Organizations/OrganizationsClient.cs @@ -14,7 +14,7 @@ internal OrganizationsClient(RawClient client) } /// - /// Retrieve list of the specified user's current Organization memberships. User must be specified by user ID. For more information, review Auth0 Organizations. + /// Retrieve list of the specified user's current Organization memberships. User must be specified by user ID. For more information, review [Auth0 Organizations](https://auth0.com/docs/manage-users/organizations). /// private WithRawResponseTask ListInternalAsync( string id, @@ -129,7 +129,7 @@ private async Task< } /// - /// Retrieve list of the specified user's current Organization memberships. User must be specified by user ID. For more information, review Auth0 Organizations. + /// Retrieve list of the specified user's current Organization memberships. User must be specified by user ID. For more information, review [Auth0 Organizations](https://auth0.com/docs/manage-users/organizations). /// /// /// await client.Users.Organizations.ListAsync( diff --git a/src/Auth0.ManagementApi/Users/Roles/IRolesClient.cs b/src/Auth0.ManagementApi/Users/Roles/IRolesClient.cs index 63db8feb5..f2a8fea50 100644 --- a/src/Auth0.ManagementApi/Users/Roles/IRolesClient.cs +++ b/src/Auth0.ManagementApi/Users/Roles/IRolesClient.cs @@ -8,7 +8,7 @@ public partial interface IRolesClient /// /// Retrieve detailed list of all user roles currently assigned to a user. /// - /// Note: This action retrieves all roles assigned to a user in the context of your whole tenant. To retrieve Organization-specific roles, use the following endpoint: Get user roles assigned to an Organization member. + /// **Note**: This action retrieves all roles assigned to a user in the context of your whole tenant. To retrieve Organization-specific roles, use the following endpoint: [Get user roles assigned to an Organization member](https://auth0.com/docs/api/management/v2/organizations/get-organization-member-roles). /// Task> ListAsync( string id, @@ -18,9 +18,9 @@ Task> ListAsync( ); /// - /// Assign one or more existing user roles to a user. For more information, review Role-Based Access Control. + /// Assign one or more existing user roles to a user. For more information, review [Role-Based Access Control](https://auth0.com/docs/manage-users/access-control/rbac). /// - /// Note: New roles cannot be created through this action. Additionally, this action is used to assign roles to a user in the context of your whole tenant. To assign roles in the context of a specific Organization, use the following endpoint: Assign user roles to an Organization member. + /// **Note**: New roles cannot be created through this action. Additionally, this action is used to assign roles to a user in the context of your whole tenant. To assign roles in the context of a specific Organization, use the following endpoint: [Assign user roles to an Organization member](https://auth0.com/docs/api/management/v2/organizations/post-organization-member-roles). /// Task AssignAsync( string id, @@ -32,7 +32,7 @@ Task AssignAsync( /// /// Remove one or more specified user roles assigned to a user. /// - /// Note: This action removes a role from a user in the context of your whole tenant. If you want to unassign a role from a user in the context of a specific Organization, use the following endpoint: Delete user roles from an Organization member. + /// **Note**: This action removes a role from a user in the context of your whole tenant. If you want to unassign a role from a user in the context of a specific Organization, use the following endpoint: [Delete user roles from an Organization member](https://auth0.com/docs/api/management/v2/organizations/delete-organization-member-roles). /// Task DeleteAsync( string id, diff --git a/src/Auth0.ManagementApi/Users/Roles/RolesClient.cs b/src/Auth0.ManagementApi/Users/Roles/RolesClient.cs index e48781261..c9e93dd60 100644 --- a/src/Auth0.ManagementApi/Users/Roles/RolesClient.cs +++ b/src/Auth0.ManagementApi/Users/Roles/RolesClient.cs @@ -16,7 +16,7 @@ internal RolesClient(RawClient client) /// /// Retrieve detailed list of all user roles currently assigned to a user. /// - /// Note: This action retrieves all roles assigned to a user in the context of your whole tenant. To retrieve Organization-specific roles, use the following endpoint: Get user roles assigned to an Organization member. + /// **Note**: This action retrieves all roles assigned to a user in the context of your whole tenant. To retrieve Organization-specific roles, use the following endpoint: [Get user roles assigned to an Organization member](https://auth0.com/docs/api/management/v2/organizations/get-organization-member-roles). /// private WithRawResponseTask ListInternalAsync( string id, @@ -134,7 +134,7 @@ private async Task< /// /// Retrieve detailed list of all user roles currently assigned to a user. /// - /// Note: This action retrieves all roles assigned to a user in the context of your whole tenant. To retrieve Organization-specific roles, use the following endpoint: Get user roles assigned to an Organization member. + /// **Note**: This action retrieves all roles assigned to a user in the context of your whole tenant. To retrieve Organization-specific roles, use the following endpoint: [Get user roles assigned to an Organization member](https://auth0.com/docs/api/management/v2/organizations/get-organization-member-roles). /// /// /// await client.Users.Roles.ListAsync( @@ -184,9 +184,9 @@ await ListInternalAsync(id, request, options, cancellationToken) } /// - /// Assign one or more existing user roles to a user. For more information, review Role-Based Access Control. + /// Assign one or more existing user roles to a user. For more information, review [Role-Based Access Control](https://auth0.com/docs/manage-users/access-control/rbac). /// - /// Note: New roles cannot be created through this action. Additionally, this action is used to assign roles to a user in the context of your whole tenant. To assign roles in the context of a specific Organization, use the following endpoint: Assign user roles to an Organization member. + /// **Note**: New roles cannot be created through this action. Additionally, this action is used to assign roles to a user in the context of your whole tenant. To assign roles in the context of a specific Organization, use the following endpoint: [Assign user roles to an Organization member](https://auth0.com/docs/api/management/v2/organizations/post-organization-member-roles). /// /// /// await client.Users.Roles.AssignAsync( @@ -258,7 +258,7 @@ public async Task AssignAsync( /// /// Remove one or more specified user roles assigned to a user. /// - /// Note: This action removes a role from a user in the context of your whole tenant. If you want to unassign a role from a user in the context of a specific Organization, use the following endpoint: Delete user roles from an Organization member. + /// **Note**: This action removes a role from a user in the context of your whole tenant. If you want to unassign a role from a user in the context of a specific Organization, use the following endpoint: [Delete user roles from an Organization member](https://auth0.com/docs/api/management/v2/organizations/delete-organization-member-roles). /// /// /// await client.Users.Roles.DeleteAsync( diff --git a/src/Auth0.ManagementApi/Users/UsersClient.cs b/src/Auth0.ManagementApi/Users/UsersClient.cs index 6dedcf975..9afaee40b 100644 --- a/src/Auth0.ManagementApi/Users/UsersClient.cs +++ b/src/Auth0.ManagementApi/Users/UsersClient.cs @@ -66,13 +66,17 @@ internal UsersClient(RawClient client) /// - Select the fields to be returned /// - Specify the number of users to retrieve per page and the page index /// - /// The q query parameter can be used to get users that match the specified criteria using query string syntax. /// - /// Learn more about searching for users. /// - /// Read about best practices when working with the API endpoints for retrieving users. + /// The `q` query parameter can be used to get users that match the specified criteria [using query string syntax.](https://auth0.com/docs/users/search/v3/query-syntax) /// - /// Auth0 limits the number of users you can return. If you exceed this threshold, please redefine your search, use the export job, or the User Import / Export extension. + /// [Learn more about searching for users.](https://auth0.com/docs/users/search/v3) + /// + /// Read about [best practices](https://auth0.com/docs/users/search/best-practices) when working with the API endpoints for retrieving users. + /// + /// + /// + /// Auth0 limits the number of users you can return. If you exceed this threshold, please redefine your search, use the [export job](https://auth0.com/docs/api/management/v2#!/Jobs/post_users_exports), or the [User Import / Export](https://auth0.com/docs/extensions/user-import-export) extension. /// private WithRawResponseTask ListInternalAsync( ListUsersRequestParameters request, @@ -666,13 +670,17 @@ private async Task< /// - Select the fields to be returned /// - Specify the number of users to retrieve per page and the page index /// - /// The q query parameter can be used to get users that match the specified criteria using query string syntax. /// - /// Learn more about searching for users. /// - /// Read about best practices when working with the API endpoints for retrieving users. + /// The `q` query parameter can be used to get users that match the specified criteria [using query string syntax.](https://auth0.com/docs/users/search/v3/query-syntax) + /// + /// [Learn more about searching for users.](https://auth0.com/docs/users/search/v3) /// - /// Auth0 limits the number of users you can return. If you exceed this threshold, please redefine your search, use the export job, or the User Import / Export extension. + /// Read about [best practices](https://auth0.com/docs/users/search/best-practices) when working with the API endpoints for retrieving users. + /// + /// + /// + /// Auth0 limits the number of users you can return. If you exceed this threshold, please redefine your search, use the [export job](https://auth0.com/docs/api/management/v2#!/Jobs/post_users_exports), or the [User Import / Export](https://auth0.com/docs/extensions/user-import-export) extension. /// /// /// await client.Users.ListAsync( @@ -726,9 +734,9 @@ await ListInternalAsync(request, options, cancellationToken).WithRawResponse(), } /// - /// Create a new user for a given database or passwordless connection. + /// Create a new user for a given [database](https://auth0.com/docs/connections/database) or [passwordless](https://auth0.com/docs/connections/passwordless) connection. /// - /// Note: connection is required but other parameters such as email and password are dependent upon the type of connection. + /// Note: `connection` is required but other parameters such as `email` and `password` are dependent upon the type of connection. /// /// /// await client.Users.CreateAsync(new CreateUserRequestContent { Connection = "connection" }); @@ -773,7 +781,7 @@ public WithRawResponseTask> ListUsersByEmailAsyn } /// - /// Retrieve user details. A list of fields to include or exclude may also be specified. For more information, see Retrieve Users with the Get Users Endpoint. + /// Retrieve user details. A list of fields to include or exclude may also be specified. For more information, see [Retrieve Users with the Get Users Endpoint](https://auth0.com/docs/manage-users/user-search/retrieve-users-with-get-users-endpoint). /// /// /// await client.Users.GetAsync( @@ -794,7 +802,7 @@ public WithRawResponseTask GetAsync( } /// - /// Delete a user by user ID. This action cannot be undone. For Auth0 Dashboard instructions, see Delete Users. + /// Delete a user by user ID. This action cannot be undone. For Auth0 Dashboard instructions, see [Delete Users](https://auth0.com/docs/manage-users/user-accounts/delete-users). /// /// /// await client.Users.DeleteAsync("id"); @@ -862,64 +870,84 @@ public async Task DeleteAsync( /// /// These are the attributes that can be updated at the root level: /// - /// - /// app_metadata - /// blocked - /// email - /// email_verified - /// family_name - /// given_name - /// name - /// nickname - /// password - /// phone_number - /// phone_verified - /// picture - /// username - /// user_metadata - /// verify_email - /// + /// - app_metadata + /// - blocked + /// - email + /// - email_verified + /// - family_name + /// - given_name + /// - name + /// - nickname + /// - password + /// - phone_number + /// - phone_verified + /// - picture + /// - username + /// - user_metadata + /// - verify_email /// /// Some considerations: - /// - /// The properties of the new object will replace the old ones. - /// The metadata fields are an exception to this rule (user_metadata and app_metadata). These properties are merged instead of being replaced but be careful, the merge only occurs on the first level. - /// If you are updating email, email_verified, phone_number, phone_verified, username or password of a secondary identity, you need to specify the connection property too. - /// If you are updating email or phone_number you can specify, optionally, the client_id property. - /// Updating email_verified is not supported for enterprise and passwordless sms connections. - /// Updating the blocked to false does not affect the user's blocked state from an excessive amount of incorrectly provided credentials. Use the "Unblock a user" endpoint from the "User Blocks" API to change the user's state. - /// Supported attributes can be unset by supplying null as the value. - /// /// - /// Updating a field (non-metadata property) + /// - The properties of the new object will replace the old ones. + /// - The metadata fields are an exception to this rule (`user_metadata` and `app_metadata`). These properties are merged instead of being replaced but be careful, the merge only occurs on the first level. + /// - If you are updating `email`, `email_verified`, `phone_number`, `phone_verified`, `username` or `password` of a secondary identity, you need to specify the `connection` property too. + /// - If you are updating `email` or `phone_number` you can specify, optionally, the `client_id` property. + /// - Updating `email_verified` is not supported for enterprise and passwordless sms connections. + /// - Updating the `blocked` to `false` does not affect the user's blocked state from an excessive amount of incorrectly provided credentials. Use the "Unblock a user" endpoint from the "User Blocks" API to change the user's state. + /// - Supported attributes can be unset by supplying `null` as the value. + /// + /// **Updating a field (non-metadata property)** + /// /// To mark the email address of a user as verified, the body to send should be: - /// { "email_verified": true } /// - /// Updating a user metadata root propertyLet's assume that our test user has the following user_metadata: - /// { "user_metadata" : { "profileCode": 1479 } } + /// ```json + /// { "email_verified": true } + /// ``` + /// + /// **Updating a user metadata root property** + /// + /// Let's assume that our test user has the following `user_metadata`: + /// + /// ```json + /// { "user_metadata" : { "profileCode": 1479 } } + /// ``` + /// + /// To add the field `addresses` the body to send should be: /// - /// To add the field addresses the body to send should be: - /// { "user_metadata" : { "addresses": {"work_address": "100 Industrial Way"} }} + /// ```json + /// { "user_metadata" : { "addresses": {"work_address": "100 Industrial Way"} }} + /// ``` /// - /// The modified object ends up with the following user_metadata property:{ + /// The modified object ends up with the following `user_metadata` property: + /// + /// ```json + /// { /// "user_metadata": { /// "profileCode": 1479, /// "addresses": { "work_address": "100 Industrial Way" } /// } - /// } + /// } + /// ``` + /// + /// **Updating an inner user metadata property** /// - /// Updating an inner user metadata propertyIf there's existing user metadata to which we want to add "home_address": "742 Evergreen Terrace" (using the addresses property) we should send the whole addresses object. Since this is a first-level object, the object will be merged in, but its own properties will not be. The body to send should be: - /// { + /// If there's existing user metadata to which we want to add `"home_address": "742 Evergreen Terrace"` (using the `addresses` property) we should send the whole `addresses` object. Since this is a first-level object, the object will be merged in, but its own properties will not be. The body to send should be: + /// + /// ```json + /// { /// "user_metadata": { /// "addresses": { /// "work_address": "100 Industrial Way", /// "home_address": "742 Evergreen Terrace" /// } /// } - /// } + /// } + /// ``` + /// + /// The modified object ends up with the following `user_metadata` property: /// - /// The modified object ends up with the following user_metadata property: - /// { + /// ```json + /// { /// "user_metadata": { /// "profileCode": 1479, /// "addresses": { @@ -927,7 +955,8 @@ public async Task DeleteAsync( /// "home_address": "742 Evergreen Terrace" /// } /// } - /// } + /// } + /// ``` /// /// /// await client.Users.UpdateAsync("id", new UpdateUserRequestContent()); @@ -945,7 +974,7 @@ public WithRawResponseTask UpdateAsync( } /// - /// Remove an existing multi-factor authentication (MFA) recovery code and generate a new one. If a user cannot access the original device or account used for MFA enrollment, they can use a recovery code to authenticate. + /// Remove an existing multi-factor authentication (MFA) [recovery code](https://auth0.com/docs/secure/multi-factor-authentication/reset-user-mfa) and generate a new one. If a user cannot access the original device or account used for MFA enrollment, they can use a recovery code to authenticate. /// /// /// await client.Users.RegenerateRecoveryCodeAsync("id"); diff --git a/tests/Auth0.ManagementApi.Test/Unit/MockServer/Actions/Versions/DeployTest.cs b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Actions/Versions/DeployTest.cs index 9898985c0..17a710fae 100644 --- a/tests/Auth0.ManagementApi.Test/Unit/MockServer/Actions/Versions/DeployTest.cs +++ b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Actions/Versions/DeployTest.cs @@ -94,7 +94,6 @@ public async Task MockServerTest() WireMock .RequestBuilders.Request.Create() .WithPath("/actions/actions/actionId/versions/id/deploy") - .WithHeader("Content-Type", "application/json") .UsingPost() .WithBodyAsJson(requestJson) ) diff --git a/tests/Auth0.ManagementApi.Test/Unit/MockServer/Branding/Phone/Templates/ResetTest.cs b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Branding/Phone/Templates/ResetTest.cs index 742d60783..d0d770802 100644 --- a/tests/Auth0.ManagementApi.Test/Unit/MockServer/Branding/Phone/Templates/ResetTest.cs +++ b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Branding/Phone/Templates/ResetTest.cs @@ -41,7 +41,6 @@ public async Task MockServerTest() WireMock .RequestBuilders.Request.Create() .WithPath("/branding/phone/templates/id/reset") - .WithHeader("Content-Type", "application/json") .UsingPatch() .WithBodyAsJson(requestJson) ) diff --git a/tests/Auth0.ManagementApi.Test/Unit/MockServer/Branding/Templates/UpdateUniversalLoginTest.cs b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Branding/Templates/UpdateUniversalLoginTest.cs index fb58c7cd7..9696f6c02 100644 --- a/tests/Auth0.ManagementApi.Test/Unit/MockServer/Branding/Templates/UpdateUniversalLoginTest.cs +++ b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Branding/Templates/UpdateUniversalLoginTest.cs @@ -19,7 +19,6 @@ public void MockServerTest() WireMock .RequestBuilders.Request.Create() .WithPath("/branding/templates/universal-login") - .WithHeader("Content-Type", "application/json") .UsingPut() .WithBody(requestJson) ) diff --git a/tests/Auth0.ManagementApi.Test/Unit/MockServer/Connections/Clients/UpdateTest.cs b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Connections/Clients/UpdateTest.cs index fd1414e7a..be1e82920 100644 --- a/tests/Auth0.ManagementApi.Test/Unit/MockServer/Connections/Clients/UpdateTest.cs +++ b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Connections/Clients/UpdateTest.cs @@ -25,7 +25,6 @@ public void MockServerTest() WireMock .RequestBuilders.Request.Create() .WithPath("/connections/id/clients") - .WithHeader("Content-Type", "application/json") .UsingPatch() .WithBodyAsJson(requestJson) ) diff --git a/tests/Auth0.ManagementApi.Test/Unit/MockServer/Connections/DirectoryProvisioning/CreateTest.cs b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Connections/DirectoryProvisioning/CreateTest.cs index 275803437..ba68f9470 100644 --- a/tests/Auth0.ManagementApi.Test/Unit/MockServer/Connections/DirectoryProvisioning/CreateTest.cs +++ b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Connections/DirectoryProvisioning/CreateTest.cs @@ -42,7 +42,6 @@ public async Task MockServerTest() WireMock .RequestBuilders.Request.Create() .WithPath("/connections/id/directory-provisioning") - .WithHeader("Content-Type", "application/json") .UsingPost() .WithBodyAsJson(requestJson) ) diff --git a/tests/Auth0.ManagementApi.Test/Unit/MockServer/Connections/DirectoryProvisioning/UpdateTest.cs b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Connections/DirectoryProvisioning/UpdateTest.cs index 4b07cf17c..905d59c42 100644 --- a/tests/Auth0.ManagementApi.Test/Unit/MockServer/Connections/DirectoryProvisioning/UpdateTest.cs +++ b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Connections/DirectoryProvisioning/UpdateTest.cs @@ -42,7 +42,6 @@ public async Task MockServerTest() WireMock .RequestBuilders.Request.Create() .WithPath("/connections/id/directory-provisioning") - .WithHeader("Content-Type", "application/json") .UsingPatch() .WithBodyAsJson(requestJson) ) diff --git a/tests/Auth0.ManagementApi.Test/Unit/MockServer/Connections/Keys/CreateTest.cs b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Connections/Keys/CreateTest.cs index 21b735477..d4272e20b 100644 --- a/tests/Auth0.ManagementApi.Test/Unit/MockServer/Connections/Keys/CreateTest.cs +++ b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Connections/Keys/CreateTest.cs @@ -39,7 +39,6 @@ public async Task MockServerTest() WireMock .RequestBuilders.Request.Create() .WithPath("/connections/id/keys") - .WithHeader("Content-Type", "application/json") .UsingPost() .WithBodyAsJson(requestJson) ) diff --git a/tests/Auth0.ManagementApi.Test/Unit/MockServer/Connections/Keys/RotateTest.cs b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Connections/Keys/RotateTest.cs index 3b21d0902..72433ba73 100644 --- a/tests/Auth0.ManagementApi.Test/Unit/MockServer/Connections/Keys/RotateTest.cs +++ b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Connections/Keys/RotateTest.cs @@ -35,7 +35,6 @@ public async Task MockServerTest() WireMock .RequestBuilders.Request.Create() .WithPath("/connections/id/keys/rotate") - .WithHeader("Content-Type", "application/json") .UsingPost() .WithBodyAsJson(requestJson) ) diff --git a/tests/Auth0.ManagementApi.Test/Unit/MockServer/Connections/ScimConfiguration/CreateTest.cs b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Connections/ScimConfiguration/CreateTest.cs index bbe99b69a..6bb877907 100644 --- a/tests/Auth0.ManagementApi.Test/Unit/MockServer/Connections/ScimConfiguration/CreateTest.cs +++ b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Connections/ScimConfiguration/CreateTest.cs @@ -39,7 +39,6 @@ public async Task MockServerTest() WireMock .RequestBuilders.Request.Create() .WithPath("/connections/id/scim-configuration") - .WithHeader("Content-Type", "application/json") .UsingPost() .WithBodyAsJson(requestJson) ) diff --git a/tests/Auth0.ManagementApi.Test/Unit/MockServer/EventStreams/CreateTest.cs b/tests/Auth0.ManagementApi.Test/Unit/MockServer/EventStreams/CreateTest.cs index a1c07eb50..ef12e647e 100644 --- a/tests/Auth0.ManagementApi.Test/Unit/MockServer/EventStreams/CreateTest.cs +++ b/tests/Auth0.ManagementApi.Test/Unit/MockServer/EventStreams/CreateTest.cs @@ -57,7 +57,6 @@ public async Task MockServerTest() WireMock .RequestBuilders.Request.Create() .WithPath("/event-streams") - .WithHeader("Content-Type", "application/json") .UsingPost() .WithBodyAsJson(requestJson) ) diff --git a/tests/Auth0.ManagementApi.Test/Unit/MockServer/Flows/Vault/Connections/CreateTest.cs b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Flows/Vault/Connections/CreateTest.cs index a32405b48..38cc10668 100644 --- a/tests/Auth0.ManagementApi.Test/Unit/MockServer/Flows/Vault/Connections/CreateTest.cs +++ b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Flows/Vault/Connections/CreateTest.cs @@ -44,7 +44,6 @@ public async Task MockServerTest() WireMock .RequestBuilders.Request.Create() .WithPath("/flows/vault/connections") - .WithHeader("Content-Type", "application/json") .UsingPost() .WithBodyAsJson(requestJson) ) diff --git a/tests/Auth0.ManagementApi.Test/Unit/MockServer/Groups/Roles/CreateTest.cs b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Groups/Roles/CreateTest.cs new file mode 100644 index 000000000..249086967 --- /dev/null +++ b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Groups/Roles/CreateTest.cs @@ -0,0 +1,40 @@ +using Auth0.ManagementApi.Groups; +using Auth0.ManagementApi.Test.Unit.MockServer; +using NUnit.Framework; + +namespace Auth0.ManagementApi.Test.Unit.MockServer.Groups.Roles; + +[TestFixture] +[Parallelizable(ParallelScope.Self)] +public class CreateTest : BaseMockServerTest +{ + [NUnit.Framework.Test] + public void MockServerTest() + { + const string requestJson = """ + { + "roles": [ + "roles" + ] + } + """; + + Server + .Given( + WireMock + .RequestBuilders.Request.Create() + .WithPath("/groups/id/roles") + .WithHeader("Content-Type", "application/json") + .UsingPost() + .WithBodyAsJson(requestJson) + ) + .RespondWith(WireMock.ResponseBuilders.Response.Create().WithStatusCode(200)); + + Assert.DoesNotThrowAsync(async () => + await Client.Groups.Roles.CreateAsync( + "id", + new CreateGroupRolesRequestParameters { Roles = new List() { "roles" } } + ) + ); + } +} diff --git a/tests/Auth0.ManagementApi.Test/Unit/MockServer/Groups/Roles/DeleteTest.cs b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Groups/Roles/DeleteTest.cs new file mode 100644 index 000000000..7afd63ecf --- /dev/null +++ b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Groups/Roles/DeleteTest.cs @@ -0,0 +1,40 @@ +using Auth0.ManagementApi.Groups; +using Auth0.ManagementApi.Test.Unit.MockServer; +using NUnit.Framework; + +namespace Auth0.ManagementApi.Test.Unit.MockServer.Groups.Roles; + +[TestFixture] +[Parallelizable(ParallelScope.Self)] +public class DeleteTest : BaseMockServerTest +{ + [NUnit.Framework.Test] + public void MockServerTest() + { + const string requestJson = """ + { + "roles": [ + "roles" + ] + } + """; + + Server + .Given( + WireMock + .RequestBuilders.Request.Create() + .WithPath("/groups/id/roles") + .WithHeader("Content-Type", "application/json") + .UsingDelete() + .WithBodyAsJson(requestJson) + ) + .RespondWith(WireMock.ResponseBuilders.Response.Create().WithStatusCode(200)); + + Assert.DoesNotThrowAsync(async () => + await Client.Groups.Roles.DeleteAsync( + "id", + new DeleteGroupRolesRequestContent { Roles = new List() { "roles" } } + ) + ); + } +} diff --git a/tests/Auth0.ManagementApi.Test/Unit/MockServer/Groups/Roles/ListTest.cs b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Groups/Roles/ListTest.cs new file mode 100644 index 000000000..bbe1935e0 --- /dev/null +++ b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Groups/Roles/ListTest.cs @@ -0,0 +1,53 @@ +using Auth0.ManagementApi.Groups; +using Auth0.ManagementApi.Test.Unit.MockServer; +using NUnit.Framework; + +namespace Auth0.ManagementApi.Test.Unit.MockServer.Groups.Roles; + +[TestFixture] +[Parallelizable(ParallelScope.Self)] +public class ListTest : BaseMockServerTest +{ + [NUnit.Framework.Test] + public async Task MockServerTest() + { + const string mockResponse = """ + { + "roles": [ + { + "id": "id", + "name": "name", + "description": "description" + } + ], + "next": "next" + } + """; + + Server + .Given( + WireMock + .RequestBuilders.Request.Create() + .WithPath("/groups/id/roles") + .WithParam("from", "from") + .WithParam("take", "1") + .UsingGet() + ) + .RespondWith( + WireMock + .ResponseBuilders.Response.Create() + .WithStatusCode(200) + .WithBody(mockResponse) + ); + + var items = await Client.Groups.Roles.ListAsync( + "id", + new ListGroupRolesRequestParameters { From = "from", Take = 1 } + ); + await foreach (var item in items) + { + Assert.That(item, Is.Not.Null); + break; // Only check the first item + } + } +} diff --git a/tests/Auth0.ManagementApi.Test/Unit/MockServer/Guardian/Policies/SetTest.cs b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Guardian/Policies/SetTest.cs index 68eb5b93f..d2cfc0e4e 100644 --- a/tests/Auth0.ManagementApi.Test/Unit/MockServer/Guardian/Policies/SetTest.cs +++ b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Guardian/Policies/SetTest.cs @@ -29,7 +29,6 @@ public async Task MockServerTest() WireMock .RequestBuilders.Request.Create() .WithPath("/guardian/policies") - .WithHeader("Content-Type", "application/json") .UsingPut() .WithBodyAsJson(requestJson) ) diff --git a/tests/Auth0.ManagementApi.Test/Unit/MockServer/Hooks/Secrets/CreateTest.cs b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Hooks/Secrets/CreateTest.cs index 3a6115086..b6b143de7 100644 --- a/tests/Auth0.ManagementApi.Test/Unit/MockServer/Hooks/Secrets/CreateTest.cs +++ b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Hooks/Secrets/CreateTest.cs @@ -21,7 +21,6 @@ public void MockServerTest() WireMock .RequestBuilders.Request.Create() .WithPath("/hooks/id/secrets") - .WithHeader("Content-Type", "application/json") .UsingPost() .WithBodyAsJson(requestJson) ) diff --git a/tests/Auth0.ManagementApi.Test/Unit/MockServer/Hooks/Secrets/DeleteTest.cs b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Hooks/Secrets/DeleteTest.cs index f83b0f9f0..ba52a5c16 100644 --- a/tests/Auth0.ManagementApi.Test/Unit/MockServer/Hooks/Secrets/DeleteTest.cs +++ b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Hooks/Secrets/DeleteTest.cs @@ -21,7 +21,6 @@ public void MockServerTest() WireMock .RequestBuilders.Request.Create() .WithPath("/hooks/id/secrets") - .WithHeader("Content-Type", "application/json") .UsingDelete() .WithBodyAsJson(requestJson) ) diff --git a/tests/Auth0.ManagementApi.Test/Unit/MockServer/Hooks/Secrets/UpdateTest.cs b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Hooks/Secrets/UpdateTest.cs index 5d3782e70..ca71a76b9 100644 --- a/tests/Auth0.ManagementApi.Test/Unit/MockServer/Hooks/Secrets/UpdateTest.cs +++ b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Hooks/Secrets/UpdateTest.cs @@ -21,7 +21,6 @@ public void MockServerTest() WireMock .RequestBuilders.Request.Create() .WithPath("/hooks/id/secrets") - .WithHeader("Content-Type", "application/json") .UsingPatch() .WithBodyAsJson(requestJson) ) diff --git a/tests/Auth0.ManagementApi.Test/Unit/MockServer/LogStreams/CreateTest.cs b/tests/Auth0.ManagementApi.Test/Unit/MockServer/LogStreams/CreateTest.cs index c7e2ac33f..c54d22471 100644 --- a/tests/Auth0.ManagementApi.Test/Unit/MockServer/LogStreams/CreateTest.cs +++ b/tests/Auth0.ManagementApi.Test/Unit/MockServer/LogStreams/CreateTest.cs @@ -58,7 +58,6 @@ public async Task MockServerTest() WireMock .RequestBuilders.Request.Create() .WithPath("/log-streams") - .WithHeader("Content-Type", "application/json") .UsingPost() .WithBodyAsJson(requestJson) ) diff --git a/tests/Auth0.ManagementApi.Test/Unit/MockServer/Prompts/CustomText/SetTest.cs b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Prompts/CustomText/SetTest.cs index 5a677c614..af22c0828 100644 --- a/tests/Auth0.ManagementApi.Test/Unit/MockServer/Prompts/CustomText/SetTest.cs +++ b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Prompts/CustomText/SetTest.cs @@ -22,7 +22,6 @@ public void MockServerTest() WireMock .RequestBuilders.Request.Create() .WithPath("/prompts/login/custom-text/am") - .WithHeader("Content-Type", "application/json") .UsingPut() .WithBodyAsJson(requestJson) ) diff --git a/tests/Auth0.ManagementApi.Test/Unit/MockServer/Prompts/Partials/SetTest.cs b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Prompts/Partials/SetTest.cs index 444749012..20547e639 100644 --- a/tests/Auth0.ManagementApi.Test/Unit/MockServer/Prompts/Partials/SetTest.cs +++ b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Prompts/Partials/SetTest.cs @@ -22,7 +22,6 @@ public void MockServerTest() WireMock .RequestBuilders.Request.Create() .WithPath("/prompts/login/partials") - .WithHeader("Content-Type", "application/json") .UsingPut() .WithBodyAsJson(requestJson) ) diff --git a/tests/Auth0.ManagementApi.Test/Unit/MockServer/RateLimitPolicies/CreateTest.cs b/tests/Auth0.ManagementApi.Test/Unit/MockServer/RateLimitPolicies/CreateTest.cs new file mode 100644 index 000000000..cf7cde3c7 --- /dev/null +++ b/tests/Auth0.ManagementApi.Test/Unit/MockServer/RateLimitPolicies/CreateTest.cs @@ -0,0 +1,70 @@ +using Auth0.ManagementApi; +using Auth0.ManagementApi.Test.Unit.MockServer; +using Auth0.ManagementApi.Test.Utils; +using NUnit.Framework; + +namespace Auth0.ManagementApi.Test.Unit.MockServer.RateLimitPolicies; + +[TestFixture] +[Parallelizable(ParallelScope.Self)] +public class CreateTest : BaseMockServerTest +{ + [NUnit.Framework.Test] + public async Task MockServerTest() + { + const string requestJson = """ + { + "resource": "oauth_authentication_api", + "consumer": "client", + "consumer_selector": "consumer_selector", + "configuration": { + "action": "allow" + } + } + """; + + const string mockResponse = """ + { + "id": "id", + "resource": "oauth_authentication_api", + "consumer": "client", + "consumer_selector": "consumer_selector", + "configuration": { + "action": "allow" + }, + "created_at": "2024-01-15T09:30:00.000Z", + "updated_at": "2024-01-15T09:30:00.000Z" + } + """; + + Server + .Given( + WireMock + .RequestBuilders.Request.Create() + .WithPath("/rate-limit-policies") + .WithHeader("Content-Type", "application/json") + .UsingPost() + .WithBodyAsJson(requestJson) + ) + .RespondWith( + WireMock + .ResponseBuilders.Response.Create() + .WithStatusCode(200) + .WithBody(mockResponse) + ); + + var response = await Client.RateLimitPolicies.CreateAsync( + new CreateRateLimitPolicyRequestContent + { + Resource = RateLimitPolicyResourceEnum.OauthAuthenticationApi, + Consumer = RateLimitPolicyConsumerEnum.Client, + ConsumerSelector = "consumer_selector", + Configuration = new RateLimitPolicyConfigurationZero + { + Action = RateLimitPolicyConfigurationZeroAction.Allow, + }, + } + ); + JsonAssert.AreEqual(response, mockResponse); + } +} diff --git a/tests/Auth0.ManagementApi.Test/Unit/MockServer/RateLimitPolicies/DeleteTest.cs b/tests/Auth0.ManagementApi.Test/Unit/MockServer/RateLimitPolicies/DeleteTest.cs new file mode 100644 index 000000000..33ac9d6f4 --- /dev/null +++ b/tests/Auth0.ManagementApi.Test/Unit/MockServer/RateLimitPolicies/DeleteTest.cs @@ -0,0 +1,24 @@ +using Auth0.ManagementApi.Test.Unit.MockServer; +using NUnit.Framework; + +namespace Auth0.ManagementApi.Test.Unit.MockServer.RateLimitPolicies; + +[TestFixture] +[Parallelizable(ParallelScope.Self)] +public class DeleteTest : BaseMockServerTest +{ + [NUnit.Framework.Test] + public void MockServerTest() + { + Server + .Given( + WireMock + .RequestBuilders.Request.Create() + .WithPath("/rate-limit-policies/id") + .UsingDelete() + ) + .RespondWith(WireMock.ResponseBuilders.Response.Create().WithStatusCode(200)); + + Assert.DoesNotThrowAsync(async () => await Client.RateLimitPolicies.DeleteAsync("id")); + } +} diff --git a/tests/Auth0.ManagementApi.Test/Unit/MockServer/RateLimitPolicies/GetTest.cs b/tests/Auth0.ManagementApi.Test/Unit/MockServer/RateLimitPolicies/GetTest.cs new file mode 100644 index 000000000..cd8c1c2b7 --- /dev/null +++ b/tests/Auth0.ManagementApi.Test/Unit/MockServer/RateLimitPolicies/GetTest.cs @@ -0,0 +1,45 @@ +using Auth0.ManagementApi.Test.Unit.MockServer; +using Auth0.ManagementApi.Test.Utils; +using NUnit.Framework; + +namespace Auth0.ManagementApi.Test.Unit.MockServer.RateLimitPolicies; + +[TestFixture] +[Parallelizable(ParallelScope.Self)] +public class GetTest : BaseMockServerTest +{ + [NUnit.Framework.Test] + public async Task MockServerTest() + { + const string mockResponse = """ + { + "id": "id", + "resource": "oauth_authentication_api", + "consumer": "client", + "consumer_selector": "consumer_selector", + "configuration": { + "action": "allow" + }, + "created_at": "2024-01-15T09:30:00.000Z", + "updated_at": "2024-01-15T09:30:00.000Z" + } + """; + + Server + .Given( + WireMock + .RequestBuilders.Request.Create() + .WithPath("/rate-limit-policies/id") + .UsingGet() + ) + .RespondWith( + WireMock + .ResponseBuilders.Response.Create() + .WithStatusCode(200) + .WithBody(mockResponse) + ); + + var response = await Client.RateLimitPolicies.GetAsync("id"); + JsonAssert.AreEqual(response, mockResponse); + } +} diff --git a/tests/Auth0.ManagementApi.Test/Unit/MockServer/RateLimitPolicies/ListTest.cs b/tests/Auth0.ManagementApi.Test/Unit/MockServer/RateLimitPolicies/ListTest.cs new file mode 100644 index 000000000..316ea5bae --- /dev/null +++ b/tests/Auth0.ManagementApi.Test/Unit/MockServer/RateLimitPolicies/ListTest.cs @@ -0,0 +1,68 @@ +using Auth0.ManagementApi; +using Auth0.ManagementApi.Test.Unit.MockServer; +using NUnit.Framework; + +namespace Auth0.ManagementApi.Test.Unit.MockServer.RateLimitPolicies; + +[TestFixture] +[Parallelizable(ParallelScope.Self)] +public class ListTest : BaseMockServerTest +{ + [NUnit.Framework.Test] + public async Task MockServerTest() + { + const string mockResponse = """ + { + "rate_limit_policies": [ + { + "id": "id", + "resource": "oauth_authentication_api", + "consumer": "client", + "consumer_selector": "consumer_selector", + "configuration": { + "action": "allow" + }, + "created_at": "2024-01-15T09:30:00.000Z", + "updated_at": "2024-01-15T09:30:00.000Z" + } + ], + "next": "next" + } + """; + + Server + .Given( + WireMock + .RequestBuilders.Request.Create() + .WithPath("/rate-limit-policies") + .WithParam("resource", "oauth_authentication_api") + .WithParam("consumer", "client") + .WithParam("consumer_selector", "consumer_selector") + .WithParam("take", "1") + .WithParam("from", "from") + .UsingGet() + ) + .RespondWith( + WireMock + .ResponseBuilders.Response.Create() + .WithStatusCode(200) + .WithBody(mockResponse) + ); + + var items = await Client.RateLimitPolicies.ListAsync( + new ListRateLimitPoliciesRequestParameters + { + Resource = RateLimitPolicyResourceEnum.OauthAuthenticationApi, + Consumer = RateLimitPolicyConsumerEnum.Client, + ConsumerSelector = "consumer_selector", + Take = 1, + From = "from", + } + ); + await foreach (var item in items) + { + Assert.That(item, Is.Not.Null); + break; // Only check the first item + } + } +} diff --git a/tests/Auth0.ManagementApi.Test/Unit/MockServer/RateLimitPolicies/UpdateTest.cs b/tests/Auth0.ManagementApi.Test/Unit/MockServer/RateLimitPolicies/UpdateTest.cs new file mode 100644 index 000000000..c54101fa1 --- /dev/null +++ b/tests/Auth0.ManagementApi.Test/Unit/MockServer/RateLimitPolicies/UpdateTest.cs @@ -0,0 +1,65 @@ +using Auth0.ManagementApi; +using Auth0.ManagementApi.Test.Unit.MockServer; +using Auth0.ManagementApi.Test.Utils; +using NUnit.Framework; + +namespace Auth0.ManagementApi.Test.Unit.MockServer.RateLimitPolicies; + +[TestFixture] +[Parallelizable(ParallelScope.Self)] +public class UpdateTest : BaseMockServerTest +{ + [NUnit.Framework.Test] + public async Task MockServerTest() + { + const string requestJson = """ + { + "configuration": { + "action": "allow" + } + } + """; + + const string mockResponse = """ + { + "id": "id", + "resource": "oauth_authentication_api", + "consumer": "client", + "consumer_selector": "consumer_selector", + "configuration": { + "action": "allow" + }, + "created_at": "2024-01-15T09:30:00.000Z", + "updated_at": "2024-01-15T09:30:00.000Z" + } + """; + + Server + .Given( + WireMock + .RequestBuilders.Request.Create() + .WithPath("/rate-limit-policies/id") + .WithHeader("Content-Type", "application/json") + .UsingPatch() + .WithBodyAsJson(requestJson) + ) + .RespondWith( + WireMock + .ResponseBuilders.Response.Create() + .WithStatusCode(200) + .WithBody(mockResponse) + ); + + var response = await Client.RateLimitPolicies.UpdateAsync( + "id", + new PatchRateLimitPolicyRequestContent + { + Configuration = new PatchRateLimitPolicyConfigurationRequestContentZero + { + Action = PatchRateLimitPolicyConfigurationRequestContentZeroAction.Allow, + }, + } + ); + JsonAssert.AreEqual(response, mockResponse); + } +} diff --git a/tests/Auth0.ManagementApi.Test/Unit/MockServer/SelfServiceProfiles/CustomText/SetTest.cs b/tests/Auth0.ManagementApi.Test/Unit/MockServer/SelfServiceProfiles/CustomText/SetTest.cs index edfc4a96a..458c46890 100644 --- a/tests/Auth0.ManagementApi.Test/Unit/MockServer/SelfServiceProfiles/CustomText/SetTest.cs +++ b/tests/Auth0.ManagementApi.Test/Unit/MockServer/SelfServiceProfiles/CustomText/SetTest.cs @@ -29,7 +29,6 @@ public async Task MockServerTest() WireMock .RequestBuilders.Request.Create() .WithPath("/self-service-profiles/id/custom-text/en/get-started") - .WithHeader("Content-Type", "application/json") .UsingPut() .WithBodyAsJson(requestJson) ) diff --git a/tests/Auth0.ManagementApi.Test/Unit/MockServer/Users/AuthenticationMethods/SetTest.cs b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Users/AuthenticationMethods/SetTest.cs index 45ee25332..198c6c020 100644 --- a/tests/Auth0.ManagementApi.Test/Unit/MockServer/Users/AuthenticationMethods/SetTest.cs +++ b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Users/AuthenticationMethods/SetTest.cs @@ -47,7 +47,6 @@ public async Task MockServerTest() WireMock .RequestBuilders.Request.Create() .WithPath("/users/id/authentication-methods") - .WithHeader("Content-Type", "application/json") .UsingPut() .WithBodyAsJson(requestJson) ) diff --git a/tests/Auth0.ManagementApi.Test/Unit/MockServer/Users/CreateTest.cs b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Users/CreateTest.cs index 1a786ddb3..6ba47b679 100644 --- a/tests/Auth0.ManagementApi.Test/Unit/MockServer/Users/CreateTest.cs +++ b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Users/CreateTest.cs @@ -51,8 +51,10 @@ public async Task MockServerTest() "multifactor": [ "multifactor" ], + "multifactor_last_modified": "multifactor_last_modified", "last_ip": "last_ip", "last_login": "last_login", + "last_password_reset": "last_password_reset", "logins_count": 1, "blocked": true, "given_name": "given_name", diff --git a/tests/Auth0.ManagementApi.Test/Unit/MockServer/Users/GetTest.cs b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Users/GetTest.cs index 13025ec08..b81cea66f 100644 --- a/tests/Auth0.ManagementApi.Test/Unit/MockServer/Users/GetTest.cs +++ b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Users/GetTest.cs @@ -45,8 +45,10 @@ public async Task MockServerTest() "multifactor": [ "multifactor" ], + "multifactor_last_modified": "multifactor_last_modified", "last_ip": "last_ip", "last_login": "last_login", + "last_password_reset": "last_password_reset", "logins_count": 1, "blocked": true, "given_name": "given_name", diff --git a/tests/Auth0.ManagementApi.Test/Unit/MockServer/Users/ListTest.cs b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Users/ListTest.cs index b6d4506d8..5326e2bc5 100644 --- a/tests/Auth0.ManagementApi.Test/Unit/MockServer/Users/ListTest.cs +++ b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Users/ListTest.cs @@ -42,8 +42,10 @@ public async Task MockServerTest() "multifactor": [ "multifactor" ], + "multifactor_last_modified": "multifactor_last_modified", "last_ip": "last_ip", "last_login": "last_login", + "last_password_reset": "last_password_reset", "logins_count": 1, "blocked": true, "given_name": "given_name", diff --git a/tests/Auth0.ManagementApi.Test/Unit/MockServer/Users/ListUsersByEmailTest.cs b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Users/ListUsersByEmailTest.cs index 4b377b074..ba78906e6 100644 --- a/tests/Auth0.ManagementApi.Test/Unit/MockServer/Users/ListUsersByEmailTest.cs +++ b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Users/ListUsersByEmailTest.cs @@ -38,8 +38,10 @@ public async Task MockServerTest() "multifactor": [ "multifactor" ], + "multifactor_last_modified": "multifactor_last_modified", "last_ip": "last_ip", "last_login": "last_login", + "last_password_reset": "last_password_reset", "logins_count": 1, "blocked": true, "given_name": "given_name", diff --git a/tests/Auth0.ManagementApi.Test/Unit/MockServer/Users/UpdateTest.cs b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Users/UpdateTest.cs index 4d76f8bb5..5cd11558b 100644 --- a/tests/Auth0.ManagementApi.Test/Unit/MockServer/Users/UpdateTest.cs +++ b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Users/UpdateTest.cs @@ -49,8 +49,10 @@ public async Task MockServerTest() "multifactor": [ "multifactor" ], + "multifactor_last_modified": "multifactor_last_modified", "last_ip": "last_ip", "last_login": "last_login", + "last_password_reset": "last_password_reset", "logins_count": 1, "blocked": true, "given_name": "given_name",