purchaseOffering method

Future<PurchaseOfferingResult> purchaseOffering({
  1. required String offeringId,
  2. required int quantity,
  3. String? offeringPromotionId,
})

Immediately purchases offerings for an AWS account. Offerings renew with the latest total purchased quantity for an offering, unless the renewal was overridden. The API returns a NotEligible error if the user is not permitted to invoke the operation. If you must be able to invoke this operation, contact aws-devicefarm-support@amazon.com.

May throw ArgumentException. May throw LimitExceededException. May throw NotEligibleException. May throw NotFoundException. May throw ServiceAccountException.

Parameter offeringId : The ID of the offering.

Parameter quantity : The number of device slots to purchase in an offering request.

Parameter offeringPromotionId : The ID of the offering promotion to be applied to the purchase.

Implementation

Future<PurchaseOfferingResult> purchaseOffering({
  required String offeringId,
  required int quantity,
  String? offeringPromotionId,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'DeviceFarm_20150623.PurchaseOffering'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'offeringId': offeringId,
      'quantity': quantity,
      if (offeringPromotionId != null)
        'offeringPromotionId': offeringPromotionId,
    },
  );

  return PurchaseOfferingResult.fromJson(jsonResponse.body);
}