shipmentsGet method
Future<Response<BuiltList<Shipment> > >
shipmentsGet({
- String? tenantId,
- String? orderId,
- String? carrierId,
- int? page,
- String? driverId,
- String? serialNumber,
- ShipmentType? type,
- ShipmentStatus? status,
- ShipmentSize? size,
- CancelToken? cancelToken,
- Map<
String, dynamic> ? headers, - Map<
String, dynamic> ? extra, - ValidateStatus? validateStatus,
- ProgressCallback? onSendProgress,
- ProgressCallback? onReceiveProgress,
List all Shipments List all Shipments
Parameters:
tenantId
- The id of the tenantorderId
- The id of the ordercarrierId
- The id of the carrierpage
- The page numberdriverId
- The id of the driverserialNumber
- The serialNumber of the shipment. Matches serialNumber that begin with the valuestype
- The type of the shipment.status
- The status of the shipment.size
- The size of the shipment.cancelToken
- ACancelToken
that can be used to cancel the operationheaders
- Can be used to add additional headers to the requestextras
- Can be used to add flags to the requestvalidateStatus
- AValidateStatus
callback that can be used to determine request success based on the HTTP status of the responseonSendProgress
- AProgressCallback
that can be used to get the send progressonReceiveProgress
- AProgressCallback
that can be used to get the receive progress
Returns a Future containing a Response
with a BuiltList<Shipment>
as data
Throws DioError
if API call or serialization fails
Implementation
Future<Response<BuiltList<Shipment>>> shipmentsGet({
String? tenantId,
String? orderId,
String? carrierId,
int? page,
String? driverId,
String? serialNumber,
ShipmentType? type,
ShipmentStatus? status,
ShipmentSize? size,
CancelToken? cancelToken,
Map<String, dynamic>? headers,
Map<String, dynamic>? extra,
ValidateStatus? validateStatus,
ProgressCallback? onSendProgress,
ProgressCallback? onReceiveProgress,
}) async {
final _path = r'/shipments';
final _options = Options(
method: r'GET',
headers: <String, dynamic>{
...?headers,
},
extra: <String, dynamic>{
'secure': <Map<String, String>>[
{
'type': 'apiKey',
'name': 'ApiKeyAuth',
'keyName': 'X-TOKEN',
'where': 'header',
},
],
...?extra,
},
validateStatus: validateStatus,
);
final _queryParameters = <String, dynamic>{
if (tenantId != null) r'tenant_id': encodeQueryParameter(_serializers, tenantId, const FullType(String)),
if (orderId != null) r'order_id': encodeQueryParameter(_serializers, orderId, const FullType(String)),
if (carrierId != null) r'carrier_id': encodeQueryParameter(_serializers, carrierId, const FullType(String)),
if (page != null) r'page': encodeQueryParameter(_serializers, page, const FullType(int)),
if (driverId != null) r'driver_id': encodeQueryParameter(_serializers, driverId, const FullType(String)),
if (serialNumber != null) r'serial_number': encodeQueryParameter(_serializers, serialNumber, const FullType(String)),
if (type != null) r'type': encodeQueryParameter(_serializers, type, const FullType(ShipmentType)),
if (status != null) r'status': encodeQueryParameter(_serializers, status, const FullType(ShipmentStatus)),
if (size != null) r'size': encodeQueryParameter(_serializers, size, const FullType(ShipmentSize)),
};
final _response = await _dio.request<Object>(
_path,
options: _options,
queryParameters: _queryParameters,
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
);
BuiltList<Shipment> _responseData;
try {
const _responseType = FullType(BuiltList, [FullType(Shipment)]);
_responseData = _serializers.deserialize(
_response.data!,
specifiedType: _responseType,
) as BuiltList<Shipment>;
} catch (error, stackTrace) {
throw DioError(
requestOptions: _response.requestOptions,
response: _response,
type: DioErrorType.other,
error: error,
)..stackTrace = stackTrace;
}
return Response<BuiltList<Shipment>>(
data: _responseData,
headers: _response.headers,
isRedirect: _response.isRedirect,
requestOptions: _response.requestOptions,
redirects: _response.redirects,
statusCode: _response.statusCode,
statusMessage: _response.statusMessage,
extra: _response.extra,
);
}