registerAppInstanceUserEndpoint method

Future<RegisterAppInstanceUserEndpointResponse> registerAppInstanceUserEndpoint({
  1. required String appInstanceUserArn,
  2. required EndpointAttributes endpointAttributes,
  3. required String resourceArn,
  4. required AppInstanceUserEndpointType type,
  5. AllowMessages? allowMessages,
  6. String? clientRequestToken,
  7. String? name,
})

Registers an endpoint under an Amazon Chime AppInstanceUser. The endpoint receives messages for a user. For push notifications, the endpoint is a mobile device used to receive mobile push notifications for a user.

May throw BadRequestException. May throw ConflictException. May throw ForbiddenException. May throw ResourceLimitExceededException. May throw ServiceFailureException. May throw ServiceUnavailableException. May throw ThrottledClientException. May throw UnauthorizedClientException.

Parameter appInstanceUserArn : The ARN of the AppInstanceUser.

Parameter endpointAttributes : The attributes of an Endpoint.

Parameter resourceArn : The ARN of the resource to which the endpoint belongs.

Parameter type : The type of the AppInstanceUserEndpoint. Supported types:

  • APNS: The mobile notification service for an Apple device.
  • APNS_SANDBOX: The sandbox environment of the mobile notification service for an Apple device.
  • GCM: The mobile notification service for an Android device.
Populate the ResourceArn value of each type as PinpointAppArn.

Parameter allowMessages : Boolean that controls whether the AppInstanceUserEndpoint is opted in to receive messages. ALL indicates the endpoint receives all messages. NONE indicates the endpoint receives no messages.

Parameter clientRequestToken : The unique ID assigned to the request. Use different tokens to register other endpoints.

Parameter name : The name of the AppInstanceUserEndpoint.

Implementation

Future<RegisterAppInstanceUserEndpointResponse>
    registerAppInstanceUserEndpoint({
  required String appInstanceUserArn,
  required EndpointAttributes endpointAttributes,
  required String resourceArn,
  required AppInstanceUserEndpointType type,
  AllowMessages? allowMessages,
  String? clientRequestToken,
  String? name,
}) async {
  final $payload = <String, dynamic>{
    'EndpointAttributes': endpointAttributes,
    'ResourceArn': resourceArn,
    'Type': type.value,
    if (allowMessages != null) 'AllowMessages': allowMessages.value,
    'ClientRequestToken': clientRequestToken ?? _s.generateIdempotencyToken(),
    if (name != null) 'Name': name,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri:
        '/app-instance-users/${Uri.encodeComponent(appInstanceUserArn)}/endpoints',
    exceptionFnMap: _exceptionFns,
  );
  return RegisterAppInstanceUserEndpointResponse.fromJson(response);
}