createOrder method

Future<CreateOrderOutput> createOrder({
  1. required String outpostIdentifier,
  2. required PaymentOption paymentOption,
  3. List<LineItemRequest>? lineItems,
  4. PaymentTerm? paymentTerm,
})

Creates an order for an Outpost.

May throw AccessDeniedException. May throw ConflictException. May throw InternalServerException. May throw NotFoundException. May throw ServiceQuotaExceededException. May throw ValidationException.

Parameter outpostIdentifier : The ID or the Amazon Resource Name (ARN) of the Outpost.

Parameter paymentOption : The payment option.

Parameter lineItems : The line items that make up the order.

Parameter paymentTerm : The payment terms.

Implementation

Future<CreateOrderOutput> createOrder({
  required String outpostIdentifier,
  required PaymentOption paymentOption,
  List<LineItemRequest>? lineItems,
  PaymentTerm? paymentTerm,
}) async {
  final $payload = <String, dynamic>{
    'OutpostIdentifier': outpostIdentifier,
    'PaymentOption': paymentOption.value,
    if (lineItems != null) 'LineItems': lineItems,
    if (paymentTerm != null) 'PaymentTerm': paymentTerm.value,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/orders',
    exceptionFnMap: _exceptionFns,
  );
  return CreateOrderOutput.fromJson(response);
}