listBots method

Future<ListBotsResponse> listBots({
  1. required String networkId,
  2. String? displayName,
  3. String? groupId,
  4. int? maxResults,
  5. String? nextToken,
  6. SortDirection? sortDirection,
  7. String? sortFields,
  8. int? status,
  9. String? username,
})

Retrieves a paginated list of bots in a specified Wickr network. You can filter and sort the results based on various criteria.

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 bots.

Parameter displayName : Filter results to only include bots with display names matching this value.

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

Parameter maxResults : The maximum number of bots 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 bots by. Multiple fields can be specified by separating them with '+'. Accepted values include 'username', 'firstName', 'displayName', 'status', and 'groupId'.

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

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

Implementation

Future<ListBotsResponse> listBots({
  required String networkId,
  String? displayName,
  String? groupId,
  int? maxResults,
  String? nextToken,
  SortDirection? sortDirection,
  String? sortFields,
  int? status,
  String? username,
}) async {
  final $query = <String, List<String>>{
    if (displayName != null) 'displayName': [displayName],
    if (groupId != null) 'groupId': [groupId],
    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)}/bots',
    queryParams: $query,
    exceptionFnMap: _exceptionFns,
  );
  return ListBotsResponse.fromJson(response);
}