list method

Future<OrdersListResponse> list(
  1. String merchantId, {
  2. bool? acknowledged,
  3. int? maxResults,
  4. String? orderBy,
  5. String? pageToken,
  6. String? placedDateEnd,
  7. String? placedDateStart,
  8. List<String>? statuses,
  9. String? $fields,
})

Lists the orders in your Merchant Center account.

Request parameters:

merchantId - The ID of the account that manages the order. This cannot be a multi-client account.

acknowledged - Obtains orders that match the acknowledgement status. When set to true, obtains orders that have been acknowledged. When false, obtains orders that have not been acknowledged. We recommend using this filter set to false, in conjunction with the acknowledge call, such that only un-acknowledged orders are returned.

maxResults - The maximum number of orders to return in the response, used for paging. The default value is 25 orders per page, and the maximum allowed value is 250 orders per page.

orderBy - Order results by placement date in descending or ascending order. Acceptable values are: - placedDateAsc - placedDateDesc

pageToken - The token returned by the previous request.

placedDateEnd - Obtains orders placed before this date (exclusively), in ISO 8601 format.

placedDateStart - Obtains orders placed after this date (inclusively), in ISO 8601 format.

statuses - Obtains orders that match any of the specified statuses. Note that active is a shortcut for pendingShipment and partiallyShipped, and completed is a shortcut for shipped, partiallyDelivered, delivered, partiallyReturned, returned, and canceled.

$fields - Selector specifying which fields to include in a partial response.

Completes with a OrdersListResponse.

Completes with a commons.ApiRequestError if the API endpoint returned an error.

If the used http.Client completes with an error when making a REST call, this method will complete with the same error.

Implementation

async.Future<OrdersListResponse> list(
  core.String merchantId, {
  core.bool? acknowledged,
  core.int? maxResults,
  core.String? orderBy,
  core.String? pageToken,
  core.String? placedDateEnd,
  core.String? placedDateStart,
  core.List<core.String>? statuses,
  core.String? $fields,
}) async {
  final queryParams_ = <core.String, core.List<core.String>>{
    if (acknowledged != null) 'acknowledged': ['${acknowledged}'],
    if (maxResults != null) 'maxResults': ['${maxResults}'],
    if (orderBy != null) 'orderBy': [orderBy],
    if (pageToken != null) 'pageToken': [pageToken],
    if (placedDateEnd != null) 'placedDateEnd': [placedDateEnd],
    if (placedDateStart != null) 'placedDateStart': [placedDateStart],
    if (statuses != null) 'statuses': statuses,
    if ($fields != null) 'fields': [$fields],
  };

  final url_ = commons.escapeVariable('$merchantId') + '/orders';

  final response_ = await _requester.request(
    url_,
    'GET',
    queryParams: queryParams_,
  );
  return OrdersListResponse.fromJson(
      response_ as core.Map<core.String, core.dynamic>);
}