approvePaidSubscription method

Future<ApprovePaidSubscriptionOutput> approvePaidSubscription({
  1. required String arn,
  2. required String ifMatch,
  3. String? clientToken,
})

Approves a subscription that is in PENDING_APPROVAL status, activating it and starting billing.

May throw AccessDeniedException. May throw ConflictException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ThrottlingException. May throw ValidationException.

Parameter arn : The ARN of the subscription to approve.

Parameter ifMatch : The ETag value from a previous GetSubscription or ListSubscriptions response. This ensures you are approving the expected version of the subscription.

Parameter clientToken : A unique, case-sensitive identifier that you provide to ensure the request is handled only once.

Implementation

Future<ApprovePaidSubscriptionOutput> approvePaidSubscription({
  required String arn,
  required String ifMatch,
  String? clientToken,
}) async {
  final headers = <String, String>{
    'If-Match': ifMatch.toString(),
  };
  final $payload = <String, dynamic>{
    'arn': arn,
    'clientToken': clientToken ?? _s.generateIdempotencyToken(),
  };
  final response = await _protocol.sendRaw(
    payload: $payload,
    method: 'POST',
    requestUri: '/v1/ApprovePaidSubscription',
    headers: headers,
    exceptionFnMap: _exceptionFns,
  );
  final $json = await _s.jsonFromResponse(response);
  return ApprovePaidSubscriptionOutput(
    subscription: Subscription.fromJson($json),
    eTag: _s.extractHeaderStringValue(response.headers, 'ETag')!,
  );
}