shipmentsGet method

Future<Response<BuiltList<Shipment>>> shipmentsGet({
  1. String? tenantId,
  2. String? orderId,
  3. String? carrierId,
  4. int? page,
  5. String? driverId,
  6. String? serialNumber,
  7. ShipmentType? type,
  8. ShipmentStatus? status,
  9. ShipmentSize? size,
  10. CancelToken? cancelToken,
  11. Map<String, dynamic>? headers,
  12. Map<String, dynamic>? extra,
  13. ValidateStatus? validateStatus,
  14. ProgressCallback? onSendProgress,
  15. ProgressCallback? onReceiveProgress,
})

List all Shipments List all Shipments

Parameters:

  • tenantId - The id of the tenant
  • orderId - The id of the order
  • carrierId - The id of the carrier
  • page - The page number
  • driverId - The id of the driver
  • serialNumber - The serialNumber of the shipment. Matches serialNumber that begin with the values
  • type - The type of the shipment.
  • status - The status of the shipment.
  • size - The size of the shipment.
  • cancelToken - A CancelToken that can be used to cancel the operation
  • headers - Can be used to add additional headers to the request
  • extras - Can be used to add flags to the request
  • validateStatus - A ValidateStatus callback that can be used to determine request success based on the HTTP status of the response
  • onSendProgress - A ProgressCallback that can be used to get the send progress
  • onReceiveProgress - A ProgressCallback 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,
  );
}