list method

Future<OrderreturnsListResponse> list(
  1. String merchantId, {
  2. bool? acknowledged,
  3. String? createdEndDate,
  4. String? createdStartDate,
  5. List<String>? googleOrderIds,
  6. int? maxResults,
  7. String? orderBy,
  8. String? pageToken,
  9. List<String>? shipmentStates,
  10. List<String>? shipmentStatus,
  11. List<String>? shipmentTrackingNumbers,
  12. List<String>? shipmentTypes,
  13. String? $fields,
})

Lists order returns 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 order returns that match the acknowledgement status. When set to true, obtains order returns that have been acknowledged. When false, obtains order returns that have not been acknowledged. When not provided, obtains order returns regardless of their acknowledgement status. We recommend using this filter set to false, in conjunction with the acknowledge call, such that only un-acknowledged order returns are returned.

createdEndDate - Obtains order returns created before this date (inclusively), in ISO 8601 format.

createdStartDate - Obtains order returns created after this date (inclusively), in ISO 8601 format.

googleOrderIds - Obtains order returns with the specified order ids. If this parameter is provided, createdStartDate, createdEndDate, shipmentType, shipmentStatus, shipmentState and acknowledged parameters must be not set. Note: if googleOrderId and shipmentTrackingNumber parameters are provided, the obtained results will include all order returns that either match the specified order id or the specified tracking number.

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

orderBy - Return the results in the specified order. Possible string values are:

  • "RETURN_CREATION_TIME_DESC" : Return results in descending order.
  • "RETURN_CREATION_TIME_ASC" : Return results in ascending order.

pageToken - The token returned by the previous request.

shipmentStates - Obtains order returns that match any shipment state provided in this parameter. When this parameter is not provided, order returns are obtained regardless of their shipment states.

shipmentStatus - Obtains order returns that match any shipment status provided in this parameter. When this parameter is not provided, order returns are obtained regardless of their shipment statuses.

shipmentTrackingNumbers - Obtains order returns with the specified tracking numbers. If this parameter is provided, createdStartDate, createdEndDate, shipmentType, shipmentStatus, shipmentState and acknowledged parameters must be not set. Note: if googleOrderId and shipmentTrackingNumber parameters are provided, the obtained results will include all order returns that either match the specified order id or the specified tracking number.

shipmentTypes - Obtains order returns that match any shipment type provided in this parameter. When this parameter is not provided, order returns are obtained regardless of their shipment types.

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

Completes with a OrderreturnsListResponse.

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<OrderreturnsListResponse> list(
  core.String merchantId, {
  core.bool? acknowledged,
  core.String? createdEndDate,
  core.String? createdStartDate,
  core.List<core.String>? googleOrderIds,
  core.int? maxResults,
  core.String? orderBy,
  core.String? pageToken,
  core.List<core.String>? shipmentStates,
  core.List<core.String>? shipmentStatus,
  core.List<core.String>? shipmentTrackingNumbers,
  core.List<core.String>? shipmentTypes,
  core.String? $fields,
}) async {
  final queryParams_ = <core.String, core.List<core.String>>{
    if (acknowledged != null) 'acknowledged': ['${acknowledged}'],
    if (createdEndDate != null) 'createdEndDate': [createdEndDate],
    if (createdStartDate != null) 'createdStartDate': [createdStartDate],
    if (googleOrderIds != null) 'googleOrderIds': googleOrderIds,
    if (maxResults != null) 'maxResults': ['${maxResults}'],
    if (orderBy != null) 'orderBy': [orderBy],
    if (pageToken != null) 'pageToken': [pageToken],
    if (shipmentStates != null) 'shipmentStates': shipmentStates,
    if (shipmentStatus != null) 'shipmentStatus': shipmentStatus,
    if (shipmentTrackingNumbers != null)
      'shipmentTrackingNumbers': shipmentTrackingNumbers,
    if (shipmentTypes != null) 'shipmentTypes': shipmentTypes,
    if ($fields != null) 'fields': [$fields],
  };

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

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