getUsers method
List Users The returned list can be sorted by full name or email address in ascending or descending order. The number of records to return at a time can also be controlled using the `page_size` query string parameter.
Parameters:
sort
- Field and order to sort the result by.pageSize
- Number of results per page. Defaults to 10 if parameter not sent.userId
- ID of the user to filter by.nextToken
- A string to get the next page of results if there are more results.email
- Filter the results by email address. The query string should be comma separated and url encoded.expand
- Specify additional data to retrieve. Use "organizations" and/or "identities".cancelToken
- ACancelToken
that can be used to cancel the operationheaders
- Can be used to add additional headers to the requestextras
- Can be used to add flags to the requestvalidateStatus
- AValidateStatus
callback that can be used to determine request success based on the HTTP status of the responseonSendProgress
- AProgressCallback
that can be used to get the send progressonReceiveProgress
- AProgressCallback
that can be used to get the receive progress
Returns a Future containing a Response
with a UsersResponse as data
Throws DioException
if API call or serialization fails
Implementation
Future<Response<UsersResponse>> getUsers({
String? sort,
int? pageSize,
String? userId,
String? nextToken,
String? email,
String? expand,
CancelToken? cancelToken,
Map<String, dynamic>? headers,
Map<String, dynamic>? extra,
ValidateStatus? validateStatus,
ProgressCallback? onSendProgress,
ProgressCallback? onReceiveProgress,
}) async {
const path = r'/api/v1/users';
final options = Options(
method: r'GET',
headers: <String, dynamic>{
...?headers,
},
extra: <String, dynamic>{
'secure': <Map<String, String>>[
{
'type': 'http',
'scheme': 'bearer',
'name': 'kindeBearerAuth',
},
],
...?extra,
},
validateStatus: validateStatus,
);
final queryParameters = <String, dynamic>{
r'sort': encodeQueryParameter(_serializers, sort, const FullType(String)),
r'page_size': encodeQueryParameter(_serializers, pageSize, const FullType(int)),
r'user_id': encodeQueryParameter(_serializers, userId, const FullType(String)),
r'next_token': encodeQueryParameter(_serializers, nextToken, const FullType(String)),
r'email': encodeQueryParameter(_serializers, email, const FullType(String)),
r'expand': encodeQueryParameter(_serializers, expand, const FullType(String)),
};
final response = await _dio.request<Object>(
path,
options: options,
queryParameters: queryParameters,
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
);
UsersResponse? responseData;
try {
final rawResponse = response.data;
responseData = rawResponse == null ? null : _serializers.deserialize(
rawResponse,
specifiedType: const FullType(UsersResponse),
) as UsersResponse;
} catch (error, stackTrace) {
throw DioException(
requestOptions: response.requestOptions,
response: response,
type: DioExceptionType.unknown,
error: error,
stackTrace: stackTrace,
);
}
return Response<UsersResponse>(
data: responseData,
headers: response.headers,
isRedirect: response.isRedirect,
requestOptions: response.requestOptions,
redirects: response.redirects,
statusCode: response.statusCode,
statusMessage: response.statusMessage,
extra: response.extra,
);
}