listUsers method

Future<ListUsersResponse> listUsers({
  1. required String networkId,
  2. String? firstName,
  3. String? groupId,
  4. String? lastName,
  5. int? maxResults,
  6. String? nextToken,
  7. SortDirection? sortDirection,
  8. String? sortFields,
  9. int? status,
  10. String? username,
})

Retrieves a paginated list of users in a specified Wickr network. You can filter and sort the results based on various criteria such as name, status, or security group membership.

May throw BadRequestError. May throw ForbiddenError. May throw InternalServerError. May throw RateLimitError. May throw ResourceNotFoundError. May throw UnauthorizedError. May throw ValidationError.

Parameter networkId : The ID of the Wickr network from which to list users.

Parameter firstName : Filter results to only include users with first names matching this value.

Parameter groupId : Filter results to only include users belonging to this security group.

Parameter lastName : Filter results to only include users with last names matching this value.

Parameter maxResults : The maximum number of users to return in a single page. Valid range is 1-100. Default is 10.

Parameter nextToken : The token for retrieving the next page of results. This is returned from a previous request when there are more results available.

Parameter sortDirection : The direction to sort results. Valid values are 'ASC' (ascending) or 'DESC' (descending). Default is 'DESC'.

Parameter sortFields : The fields to sort users by. Multiple fields can be specified by separating them with '+'. Accepted values include 'username', 'firstName', 'lastName', 'status', and 'groupId'.

Parameter status : Filter results to only include users with this status (1 for pending, 2 for active).

Parameter username : Filter results to only include users with usernames matching this value.

Implementation

Future<ListUsersResponse> listUsers({
  required String networkId,
  String? firstName,
  String? groupId,
  String? lastName,
  int? maxResults,
  String? nextToken,
  SortDirection? sortDirection,
  String? sortFields,
  int? status,
  String? username,
}) async {
  final $query = <String, List<String>>{
    if (firstName != null) 'firstName': [firstName],
    if (groupId != null) 'groupId': [groupId],
    if (lastName != null) 'lastName': [lastName],
    if (maxResults != null) 'maxResults': [maxResults.toString()],
    if (nextToken != null) 'nextToken': [nextToken],
    if (sortDirection != null) 'sortDirection': [sortDirection.value],
    if (sortFields != null) 'sortFields': [sortFields],
    if (status != null) 'status': [status.toString()],
    if (username != null) 'username': [username],
  };
  final response = await _protocol.send(
    payload: null,
    method: 'GET',
    requestUri: '/networks/${Uri.encodeComponent(networkId)}/users',
    queryParams: $query,
    exceptionFnMap: _exceptionFns,
  );
  return ListUsersResponse.fromJson(response);
}