orderItemsGetAmendments method
List item amendments
Lists every amendment of an order item. Returns the whole list as an array, without paging. Each amendment has id, orderItemId, status, productType, createdAt, amountToPay and amountToRefund. An item of another partner, or an unknown id, returns 404 with code 10004.
Parameters:
- String id (required):
Order item id (
items[].idfrom the order response).
Implementation
Future<List<OrderItemAmendment>?> orderItemsGetAmendments(String id, { Future<void>? abortTrigger, }) async {
final response = await orderItemsGetAmendmentsWithHttpInfo(id, 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) {
final responseBody = await _decodeBodyBytes(response);
return (await apiClient.deserializeAsync(responseBody, 'List<OrderItemAmendment>') as List)
.cast<OrderItemAmendment>()
.toList(growable: false);
}
return null;
}