orderItemsGetById method
Get an order item
Gets an order item: what was bought, its delivery, its refund and what you can do next. Requires the read order permission. Returns the item exactly as it appears in items[] of the order response, including orderId, the order it belongs to. fulfillment.status and refund.status give its state; actions.cancellation says whether it can be cancelled now, actions.amendment whether it can be amended and actions.update whether it can be updated. An item of another partner, or an unknown id, returns 404 with code 10004; a malformed id or an unknown query parameter returns 400 with code 10001.
Parameters:
- String id (required):
Order item id (
items[].idfrom the order response).
Implementation
Future<OrderItem?> orderItemsGetById(String id, { Future<void>? abortTrigger, }) async {
final response = await orderItemsGetByIdWithHttpInfo(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) {
return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'OrderItem',) as OrderItem;
}
return null;
}