auth0/auth0.net

IPagedList<T>.Paging null on on .Users.GetAllAsync

Closed this issue · 3 comments

Checklist

  • I have looked into the Readme and have not found a suitable solution or answer.
  • I have looked into the API documentation and have not found a suitable solution or answer.
  • I have searched the issues and have not found a suitable solution or answer.
  • I have searched the Auth0 Community forums and have not found a suitable solution or answer.
  • I agree to the terms within the Auth0 Code of Conduct.

Description

Paging results from .Users.GetAllAsync doesn't work because I do not get PagingInformation Paging on IPagedList.

Reproduction

            var request = new GetUsersRequest
            {
                Query = $"email:*",
                SearchEngine = "v3"
            };

            var page = 0;
            var perPage = 1;

            var queryResult = await managementApiClient.Users.GetAllAsync(request,
                    new Auth0.ManagementApi.Paging.PaginationInfo(page, perPage),
                    cancellationToken);

I properly get exactly one item, however, queryResult.Paging is null (also for v2)

Additional context

No response

auth0.net version

7.26.2

.NET version

8.0

Thanks for reaching out @christophwille
The Paging property in the response gets populated only when the PaginationInfo in the request has includeTotals as true.

Can you try passing includeTotals as true like below?

            var request = new GetUsersRequest
            {
                Query = $"email:*",
                SearchEngine = "v3"
            };

            var page = 0;
            var perPage = 1;

            var queryResult = await managementApiClient.Users.GetAllAsync(request,
                    new Auth0.ManagementApi.Paging.PaginationInfo(page, perPage, true),
                    cancellationToken);

That indeed works. May I suggest that

//   includeTotals:
//     Whether to return the complete total result count (true) or not (false).

comment on PaginationInfo class is misleading? https://auth0.com/docs/manage-users/user-search/view-search-results-by-page is a bit better, but still "include_totals | Set to true to include a query summary as part of the result." doesn't indicate that is the information for paging.

Yes agreed.
We will update the documentation to explain it better.
Thanks!
We are closing this issue now. Please reach out in case there's anything else.