Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions V8_MIGRATION_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,12 @@ var request = new ListUsersRequestParameters

var pager = await client.Users.ListAsync(request);

// Access total count from the paginated response metadata (IncludeTotals must be true).
// Note: `Total` is the server-side total across all pages, not just the current page's item count.
var firstPageResponse = (ListUsersOffsetPaginatedResponseContent?)pager.CurrentPage.Response;
var totalUsers = firstPageResponse?.Total;
Console.WriteLine($"Total users: {totalUsers}");

// Option 1: Iterate through all items across all pages automatically
// The pager fetches subsequent pages as needed
await foreach (var user in pager)
Expand Down Expand Up @@ -600,6 +606,12 @@ var request = new ListUsersRequestParameters

var pager = await client.Users.ListAsync(request);

// Access total count from the paginated response metadata (IncludeTotals must be true).
// Note: `Total` is the server-side total across all pages, not just the current page's item count.
var firstPageResponse = (ListUsersOffsetPaginatedResponseContent?)pager.CurrentPage.Response;
var totalUsers = firstPageResponse?.Total;
Console.WriteLine($"Total users: {totalUsers}");

// Iterate through all pages automatically
await foreach (var user in pager)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Auth0.ManagementApi/Actions/ActionsClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,7 @@ public async Task<Pager<Action>> ListAsync(
request,
options,
async (request, options, cancellationToken) =>
await ListInternalAsync(request, options, cancellationToken),
await ListInternalAsync(request, options, cancellationToken).WithRawResponse(),
request => request.Page.GetValueOrDefault(0),
(request, offset) =>
{
Expand Down
4 changes: 2 additions & 2 deletions src/Auth0.ManagementApi/Actions/Modules/ModulesClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,7 @@ public async Task<Pager<ActionModuleListItem>> ListAsync(
request,
options,
async (request, options, cancellationToken) =>
await ListInternalAsync(request, options, cancellationToken),
await ListInternalAsync(request, options, cancellationToken).WithRawResponse(),
request => request.Page.GetValueOrDefault(0),
(request, offset) =>
{
Expand Down Expand Up @@ -803,7 +803,7 @@ public async Task<Pager<ActionModuleAction>> ListActionsAsync(
options,
async (request, options, cancellationToken) =>
await ListActionsInternalAsync(id, request, options, cancellationToken)
.ConfigureAwait(false),
.WithRawResponse(),
request => request.Page.GetValueOrDefault(0),
(request, offset) =>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ public async Task<Pager<ActionModuleVersion>> ListAsync(
options,
async (request, options, cancellationToken) =>
await ListInternalAsync(id, request, options, cancellationToken)
.ConfigureAwait(false),
.WithRawResponse(),
request => request.Page.GetValueOrDefault(0),
(request, offset) =>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ public async Task<Pager<ActionBinding>> ListAsync(
options,
async (request, options, cancellationToken) =>
await ListInternalAsync(triggerId, request, options, cancellationToken)
.ConfigureAwait(false),
.WithRawResponse(),
request => request.Page.GetValueOrDefault(0),
(request, offset) =>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ public async Task<Pager<ActionVersion>> ListAsync(
options,
async (request, options, cancellationToken) =>
await ListInternalAsync(actionId, request, options, cancellationToken)
.ConfigureAwait(false),
.WithRawResponse(),
request => request.Page.GetValueOrDefault(0),
(request, offset) =>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ public async Task<Pager<ClientGrantResponseContent>> ListAsync(
request,
options,
async (request, options, cancellationToken) =>
await ListInternalAsync(request, options, cancellationToken),
await ListInternalAsync(request, options, cancellationToken).WithRawResponse(),
(request, cursor) =>
{
request.From = cursor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ public async Task<Pager<Organization>> ListAsync(
options,
async (request, options, cancellationToken) =>
await ListInternalAsync(id, request, options, cancellationToken)
.ConfigureAwait(false),
.WithRawResponse(),
(request, cursor) =>
{
request.From = cursor;
Expand Down
2 changes: 1 addition & 1 deletion src/Auth0.ManagementApi/Clients/ClientsClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -795,7 +795,7 @@ public async Task<Pager<Client>> ListAsync(
request,
options,
async (request, options, cancellationToken) =>
await ListInternalAsync(request, options, cancellationToken),
await ListInternalAsync(request, options, cancellationToken).WithRawResponse(),
request => request.Page.GetValueOrDefault(0),
(request, offset) =>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ public async Task<Pager<ConnectionForList>> GetAsync(
options,
async (request, options, cancellationToken) =>
await GetInternalAsync(id, request, options, cancellationToken)
.ConfigureAwait(false),
.WithRawResponse(),
(request, cursor) =>
{
request.From = cursor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,7 @@ public async Task<Pager<ConnectionProfile>> ListAsync(
request,
options,
async (request, options, cancellationToken) =>
await ListInternalAsync(request, options, cancellationToken),
await ListInternalAsync(request, options, cancellationToken).WithRawResponse(),
(request, cursor) =>
{
request.From = cursor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ public async Task<Pager<ConnectionEnabledClient>> GetAsync(
options,
async (request, options, cancellationToken) =>
await GetInternalAsync(id, request, options, cancellationToken)
.ConfigureAwait(false),
.WithRawResponse(),
(request, cursor) =>
{
request.From = cursor;
Expand Down
2 changes: 1 addition & 1 deletion src/Auth0.ManagementApi/Connections/ConnectionsClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ public async Task<Pager<ConnectionForList>> ListAsync(
request,
options,
async (request, options, cancellationToken) =>
await ListInternalAsync(request, options, cancellationToken),
await ListInternalAsync(request, options, cancellationToken).WithRawResponse(),
(request, cursor) =>
{
request.From = cursor;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
using System.Text.Json;
using Auth0.ManagementApi;
using Auth0.ManagementApi.Connections.DirectoryProvisioning;
using Auth0.ManagementApi.Core;
using global::System.Text.Json;

namespace Auth0.ManagementApi.Connections;

public partial class DirectoryProvisioningClient : IDirectoryProvisioningClient
{
private RawClient _client;
private readonly RawClient _client;

internal DirectoryProvisioningClient(RawClient client)
{
Expand Down Expand Up @@ -54,7 +54,6 @@ private async Task<
.SendRequestAsync(
new JsonRequest
{
BaseUrl = _client.Options.BaseUrl,
Method = HttpMethod.Get,
Path = "connections-directory-provisionings",
QueryString = _queryString,
Expand All @@ -66,7 +65,9 @@ private async Task<
.ConfigureAwait(false);
if (response.StatusCode is >= 200 and < 400)
{
var responseBody = await response.Raw.Content.ReadAsStringAsync();
var responseBody = await response
.Raw.Content.ReadAsStringAsync(cancellationToken)
.ConfigureAwait(false);
try
{
var responseData = JsonUtils.Deserialize<ListDirectoryProvisioningsResponseContent>(
Expand All @@ -88,13 +89,15 @@ private async Task<
throw new ManagementApiException(
"Failed to deserialize response",
response.StatusCode,
responseBody,
null,
e
);
}
}
{
var responseBody = await response.Raw.Content.ReadAsStringAsync();
var responseBody = await response
.Raw.Content.ReadAsStringAsync(cancellationToken)
.ConfigureAwait(false);
try
{
switch (response.StatusCode)
Expand Down Expand Up @@ -137,7 +140,6 @@ private async Task<WithRawResponse<GetDirectoryProvisioningResponseContent>> Get
.SendRequestAsync(
new JsonRequest
{
BaseUrl = _client.Options.BaseUrl,
Method = HttpMethod.Get,
Path = string.Format(
"connections/{0}/directory-provisioning",
Expand All @@ -151,7 +153,9 @@ private async Task<WithRawResponse<GetDirectoryProvisioningResponseContent>> Get
.ConfigureAwait(false);
if (response.StatusCode is >= 200 and < 400)
{
var responseBody = await response.Raw.Content.ReadAsStringAsync();
var responseBody = await response
.Raw.Content.ReadAsStringAsync(cancellationToken)
.ConfigureAwait(false);
try
{
var responseData = JsonUtils.Deserialize<GetDirectoryProvisioningResponseContent>(
Expand All @@ -173,13 +177,15 @@ private async Task<WithRawResponse<GetDirectoryProvisioningResponseContent>> Get
throw new ManagementApiException(
"Failed to deserialize response",
response.StatusCode,
responseBody,
null,
e
);
}
}
{
var responseBody = await response.Raw.Content.ReadAsStringAsync();
var responseBody = await response
.Raw.Content.ReadAsStringAsync(cancellationToken)
.ConfigureAwait(false);
try
{
switch (response.StatusCode)
Expand Down Expand Up @@ -225,7 +231,6 @@ private async Task<WithRawResponse<CreateDirectoryProvisioningResponseContent>>
.SendRequestAsync(
new JsonRequest
{
BaseUrl = _client.Options.BaseUrl,
Method = HttpMethod.Post,
Path = string.Format(
"connections/{0}/directory-provisioning",
Expand All @@ -241,7 +246,9 @@ private async Task<WithRawResponse<CreateDirectoryProvisioningResponseContent>>
.ConfigureAwait(false);
if (response.StatusCode is >= 200 and < 400)
{
var responseBody = await response.Raw.Content.ReadAsStringAsync();
var responseBody = await response
.Raw.Content.ReadAsStringAsync(cancellationToken)
.ConfigureAwait(false);
try
{
var responseData =
Expand All @@ -264,13 +271,15 @@ private async Task<WithRawResponse<CreateDirectoryProvisioningResponseContent>>
throw new ManagementApiException(
"Failed to deserialize response",
response.StatusCode,
responseBody,
null,
e
);
}
}
{
var responseBody = await response.Raw.Content.ReadAsStringAsync();
var responseBody = await response
.Raw.Content.ReadAsStringAsync(cancellationToken)
.ConfigureAwait(false);
try
{
switch (response.StatusCode)
Expand Down Expand Up @@ -318,7 +327,6 @@ private async Task<WithRawResponse<UpdateDirectoryProvisioningResponseContent>>
.SendRequestAsync(
new JsonRequest
{
BaseUrl = _client.Options.BaseUrl,
Method = HttpMethodExtensions.Patch,
Path = string.Format(
"connections/{0}/directory-provisioning",
Expand All @@ -334,7 +342,9 @@ private async Task<WithRawResponse<UpdateDirectoryProvisioningResponseContent>>
.ConfigureAwait(false);
if (response.StatusCode is >= 200 and < 400)
{
var responseBody = await response.Raw.Content.ReadAsStringAsync();
var responseBody = await response
.Raw.Content.ReadAsStringAsync(cancellationToken)
.ConfigureAwait(false);
try
{
var responseData =
Expand All @@ -357,13 +367,15 @@ private async Task<WithRawResponse<UpdateDirectoryProvisioningResponseContent>>
throw new ManagementApiException(
"Failed to deserialize response",
response.StatusCode,
responseBody,
null,
e
);
}
}
{
var responseBody = await response.Raw.Content.ReadAsStringAsync();
var responseBody = await response
.Raw.Content.ReadAsStringAsync(cancellationToken)
.ConfigureAwait(false);
try
{
switch (response.StatusCode)
Expand Down Expand Up @@ -410,7 +422,6 @@ private async Task<
.SendRequestAsync(
new JsonRequest
{
BaseUrl = _client.Options.BaseUrl,
Method = HttpMethod.Get,
Path = string.Format(
"connections/{0}/directory-provisioning/default-mapping",
Expand All @@ -424,7 +435,9 @@ private async Task<
.ConfigureAwait(false);
if (response.StatusCode is >= 200 and < 400)
{
var responseBody = await response.Raw.Content.ReadAsStringAsync();
var responseBody = await response
.Raw.Content.ReadAsStringAsync(cancellationToken)
.ConfigureAwait(false);
try
{
var responseData =
Expand All @@ -447,13 +460,15 @@ private async Task<
throw new ManagementApiException(
"Failed to deserialize response",
response.StatusCode,
responseBody,
null,
e
);
}
}
{
var responseBody = await response.Raw.Content.ReadAsStringAsync();
var responseBody = await response
.Raw.Content.ReadAsStringAsync(cancellationToken)
.ConfigureAwait(false);
try
{
switch (response.StatusCode)
Expand Down Expand Up @@ -490,7 +505,7 @@ private async Task<
/// new ListDirectoryProvisioningsRequestParameters { From = "from", Take = 1 }
/// );
/// </code></example>
public async Task<Pager<global::Auth0.ManagementApi.DirectoryProvisioning>> ListAsync(
public async Task<Pager<Auth0.ManagementApi.DirectoryProvisioning>> ListAsync(
ListDirectoryProvisioningsRequestParameters request,
RequestOptions? options = null,
CancellationToken cancellationToken = default
Expand All @@ -505,13 +520,13 @@ private async Task<
RequestOptions?,
ListDirectoryProvisioningsResponseContent,
string?,
global::Auth0.ManagementApi.DirectoryProvisioning
Auth0.ManagementApi.DirectoryProvisioning
>
.CreateInstanceAsync(
request,
options,
async (request, options, cancellationToken) =>
await ListInternalAsync(request, options, cancellationToken),
await ListInternalAsync(request, options, cancellationToken).WithRawResponse(),
(request, cursor) =>
{
request.From = cursor;
Expand Down Expand Up @@ -584,7 +599,6 @@ public async Task DeleteAsync(
.SendRequestAsync(
new JsonRequest
{
BaseUrl = _client.Options.BaseUrl,
Method = HttpMethod.Delete,
Path = string.Format(
"connections/{0}/directory-provisioning",
Expand All @@ -601,7 +615,9 @@ public async Task DeleteAsync(
return;
}
{
var responseBody = await response.Raw.Content.ReadAsStringAsync();
var responseBody = await response
.Raw.Content.ReadAsStringAsync(cancellationToken)
.ConfigureAwait(false);
try
{
switch (response.StatusCode)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public partial interface IDirectoryProvisioningClient
/// <summary>
/// Retrieve a list of directory provisioning configurations of a tenant.
/// </summary>
Task<Pager<global::Auth0.ManagementApi.DirectoryProvisioning>> ListAsync(
Task<Pager<Auth0.ManagementApi.DirectoryProvisioning>> ListAsync(
ListDirectoryProvisioningsRequestParameters request,
RequestOptions? options = null,
CancellationToken cancellationToken = default
Expand Down
Loading
Loading