listDevicesForUser method

Future<ListDevicesForUserResponse> listDevicesForUser({
  1. required String networkId,
  2. required String userId,
  3. int? maxResults,
  4. String? nextToken,
  5. SortDirection? sortDirection,
  6. String? sortFields,
})

Retrieves a paginated list of devices associated with a specific user in a Wickr network. This operation returns information about all devices where the user has logged into Wickr.

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 containing the user.

Parameter userId : The unique identifier of the user whose devices will be listed.

Parameter maxResults : The maximum number of devices 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 devices by. Multiple fields can be specified by separating them with '+'. Accepted values include 'lastlogin', 'type', 'suspend', and 'created'.

Implementation

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