Skip to content

list_devices_for_user async

list_devices_for_user(
    network_id: NetworkId,
    user_id: UserId,
    *,
    config_overrides: Optional[AsyncWickrClientConfig] = None,
    next_token: Optional[GenericString] = None,
    max_results: Optional[int] = None,
    sort_fields: Optional[GenericString] = None,
    sort_direction: Optional[SortDirection] = None,
) -> ListDevicesForUserResponse

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.

Parameters:

  • network_id (NetworkId) –

    The ID of the Wickr network containing the user.

  • user_id (UserId) –

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

  • next_token (Optional[GenericString], default: None ) –

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

  • max_results (Optional[int], default: None ) –

    The maximum number of devices to return in a single page. Valid range is 1-100. Default is 10.

  • sort_fields (Optional[GenericString], default: None ) –

    The fields to sort devices by. Multiple fields can be specified by separating them with '+'. Accepted values include 'lastlogin', 'type', 'suspend', and 'created'.

  • sort_direction (Optional[SortDirection], default: None ) –

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

Raises:

  • BadRequestError –

    The request was invalid or malformed. This error occurs when the request parameters do not meet the API requirements, such as invalid field values, missing required parameters, or improperly formatted data.

  • ForbiddenError –

    Access to the requested resource is forbidden. This error occurs when the authenticated user does not have the necessary permissions to perform the requested operation, even though they are authenticated.

  • InternalServerError –

    An unexpected error occurred on the server while processing the request. This indicates a problem with the Wickr service itself rather than with the request. If this error persists, contact Amazon Web Services Support.

  • RateLimitError –

    The request was throttled because too many requests were sent in a short period of time. Wait a moment and retry the request. Consider implementing exponential backoff in your application.

  • ResourceNotFoundError –

    The requested resource could not be found. This error occurs when you try to access or modify a network, user, bot, security group, or other resource that doesn't exist or has been deleted.

  • UnauthorizedError –

    The request was not authenticated or the authentication credentials were invalid. This error occurs when the request lacks valid authentication credentials or the credentials have expired.

  • ValidationError –

    One or more fields in the request failed validation. This error provides detailed information about which fields were invalid and why, allowing you to correct the request and retry.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Examples:

Successful device list retrieval

>>> await client.list_devices_for_user(network_id='12345678', user_id='12345', max_results=10, sort_fields='appId', sort_direction='DESC')
Retrieving subsequent page of devices
>>> await client.list_devices_for_user(network_id='12345678', user_id='12345', max_results=10, next_token='v1:pagination:6ba7b810-9dad-11d1-80b4-00c04fd430c8')
Invalid userId error
>>> await client.list_devices_for_user(network_id='12345678', user_id='99999', max_results=10)
Source code in docs_src/capo_wickr/_services/async_wickr.py
async def list_devices_for_user(
    self,
    network_id: "capo_wickr.types.network_id.NetworkId",
    user_id: "capo_wickr.types.user_id.UserId",
    *,
    config_overrides: Optional[AsyncWickrClientConfig] = None,
    next_token: Optional["capo_wickr.types.generic_string.GenericString"] = None,
    max_results: Optional[int] = None,
    sort_fields: Optional["capo_wickr.types.generic_string.GenericString"] = None,
    sort_direction: Optional[
        "capo_wickr.types.sort_direction.SortDirection"
    ] = None,
) -> "capo_wickr.types.list_devices_for_user_response.ListDevicesForUserResponse":
    """<p>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.</p>

    Args:
        network_id: <p>The ID of the Wickr network containing the user.</p>
        user_id: <p>The unique identifier of the user whose devices will be listed.</p>
        next_token: <p>The token for retrieving the next page of results. This is returned from a previous request when there are more results available.</p>
        max_results: <p>The maximum number of devices to return in a single page. Valid range is 1-100. Default is 10.</p>
        sort_fields: <p>The fields to sort devices by. Multiple fields can be specified by separating them with '+'. Accepted values include 'lastlogin', 'type', 'suspend', and 'created'.</p>
        sort_direction: <p>The direction to sort results. Valid values are 'ASC' (ascending) or 'DESC' (descending). Default is 'DESC'.</p>

    Raises:
        capo_wickr.errors.bad_request_error.BadRequestError: <p>The request was invalid or malformed. This error occurs when the request parameters do not meet the API requirements, such as invalid field values, missing required parameters, or improperly formatted data.</p>
        capo_wickr.errors.forbidden_error.ForbiddenError: <p>Access to the requested resource is forbidden. This error occurs when the authenticated user does not have the necessary permissions to perform the requested operation, even though they are authenticated.</p>
        capo_wickr.errors.internal_server_error.InternalServerError: <p>An unexpected error occurred on the server while processing the request. This indicates a problem with the Wickr service itself rather than with the request. If this error persists, contact Amazon Web Services Support.</p>
        capo_wickr.errors.rate_limit_error.RateLimitError: <p>The request was throttled because too many requests were sent in a short period of time. Wait a moment and retry the request. Consider implementing exponential backoff in your application.</p>
        capo_wickr.errors.resource_not_found_error.ResourceNotFoundError: <p>The requested resource could not be found. This error occurs when you try to access or modify a network, user, bot, security group, or other resource that doesn't exist or has been deleted.</p>
        capo_wickr.errors.unauthorized_error.UnauthorizedError: <p>The request was not authenticated or the authentication credentials were invalid. This error occurs when the request lacks valid authentication credentials or the credentials have expired.</p>
        capo_wickr.errors.validation_error.ValidationError: <p>One or more fields in the request failed validation. This error provides detailed information about which fields were invalid and why, allowing you to correct the request and retry.</p>
        capo_wickr.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        Successful device list retrieval

        >>> await client.list_devices_for_user(network_id='12345678', user_id='12345', max_results=10, sort_fields='appId', sort_direction='DESC')
        Retrieving subsequent page of devices

        >>> await client.list_devices_for_user(network_id='12345678', user_id='12345', max_results=10, next_token='v1:pagination:6ba7b810-9dad-11d1-80b4-00c04fd430c8')
        Invalid userId error

        >>> await client.list_devices_for_user(network_id='12345678', user_id='99999', max_results=10)
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_wickr.types.list_devices_for_user_request.ListDevicesForUserRequest]",
    ) -> AsyncOperationResponse[
        "capo_wickr.types.list_devices_for_user_response.ListDevicesForUserResponse"
    ]:
        import capo_wickr._operations.wickr_admin_api.list_devices_for_user

        (
            output,
            http_response,
        ) = await capo_wickr._operations.wickr_admin_api.list_devices_for_user.async_list_devices_for_user(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListDevicesForUser")
    )
    input_: capo_wickr.types.list_devices_for_user_request.ListDevicesForUserRequest = {
        "network_id": network_id,
        "user_id": user_id,
    }
    if next_token is not None:
        input_["next_token"] = next_token
    if max_results is not None:
        input_["max_results"] = max_results
    if sort_fields is not None:
        input_["sort_fields"] = sort_fields
    if sort_direction is not None:
        input_["sort_direction"] = sort_direction

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output