ordersGetAll method
List orders
Lists the partner's orders, newest first, with optional filters. Returns { orders, pagination }. Each summary has id, referenceId, origin, status, total, the latest payment and itemCount; read one order for its items, actions and timeline. Orders created through the API and through the dashboard are both listed. Filters combine with AND; repeated productTypes or orderStatuses values combine with OR. A productTypes filter selects orders containing at least one item of that type and still returns the whole order. Filters apply before counting and paging, so send the same filters on every page. Use flat page (default 1) and limit (default 10, 1 to 100) query parameters. cursor, skip, offset, nested paging keys and repeated paging parameters return 400 with code 10001 (INVALID_REQUEST).
Parameters:
-
int page: One-based page number. Default 1.
-
int limit: Page size, 1 to 100. Default 10.
-
DateTime startDate: Only orders created at or after this time (UTC).
-
DateTime endDate: Only orders created at or before this time (UTC).
-
num minAmount: Only orders whose
total.amount, in the order's currency, is at least this value. -
num maxAmount: Only orders whose
total.amount, in the order's currency, is at most this value. -
String search: An order id returns that order only; any other text matches part of the email or full name of the user who placed the order.
-
String referenceId: Only the order with exactly this
referenceId. -
String salesChannel: Only orders created through this channel: the dashboard or the API.
-
List<String> productTypes: Only orders containing at least one item of one of these product types. Repeat the parameter for several types, for example
productTypes=esim&productTypes=giftCard. -
List<String> orderStatuses: Only orders currently in one of these statuses. Repeat the parameter for several statuses.
Implementation
Future<OrderList?> ordersGetAll({ int? page, int? limit, DateTime? startDate, DateTime? endDate, num? minAmount, num? maxAmount, String? search, String? referenceId, String? salesChannel, List<String>? productTypes, List<String>? orderStatuses, Future<void>? abortTrigger, }) async {
final response = await ordersGetAllWithHttpInfo(page: page, limit: limit, startDate: startDate, endDate: endDate, minAmount: minAmount, maxAmount: maxAmount, search: search, referenceId: referenceId, salesChannel: salesChannel, productTypes: productTypes, orderStatuses: orderStatuses, abortTrigger: abortTrigger,);
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
}
// When a remote server returns no body with a status of 204, we shall not decode it.
// At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
// FormatException when trying to decode an empty string.
if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'OrderList',) as OrderList;
}
return null;
}