From f1ea985954a0906206bc04d5906dc69fd8001c95 Mon Sep 17 00:00:00 2001 From: DanH91 Date: Thu, 16 Sep 2021 09:15:37 -0400 Subject: [PATCH] generate Python client for Purplship Server 2021.7 Edition --- README.md | 100 +- docs/AccessToken.md | 12 + docs/Address.md | 33 +- docs/AddressData.md | 30 +- docs/AddressList.md | 5 +- docs/AddressValidation.md | 14 + docs/CarrierList.md | 5 +- docs/CarrierSettings.md | 3 + docs/Charge.md | 10 +- docs/Commodity.md | 20 +- docs/CommodityData.md | 19 + docs/Customs.md | 30 +- docs/CustomsData.md | 30 +- docs/CustomsList.md | 5 +- docs/Duty.md | 17 + docs/ErrorResponse.md | 5 +- docs/Message.md | 10 +- docs/Operation.md | 3 + docs/OperationConfirmation.md | 5 +- docs/OperationResponse.md | 5 +- docs/Parcel.md | 25 +- docs/ParcelData.md | 25 +- docs/ParcelList.md | 5 +- docs/Payment.md | 13 +- docs/PaymentData.md | 13 - docs/Pickup.md | 21 +- docs/PickupCancelData.md | 3 + docs/PickupCancelRequest.md | 5 +- docs/PickupData.md | 13 +- docs/PickupList.md | 5 +- docs/PickupRequest.md | 11 +- docs/PickupResponse.md | 5 +- docs/PickupUpdateData.md | 17 +- docs/PickupUpdateRequest.md | 11 +- docs/Rate.md | 28 +- docs/RateRequest.md | 17 +- docs/RateResponse.md | 7 +- docs/References.md | 30 +- docs/Shipment.md | 48 +- docs/ShipmentCancelRequest.md | 7 +- docs/ShipmentData.md | 17 +- docs/ShipmentList.md | 5 +- docs/ShipmentPurchaseData.md | 6 +- docs/ShipmentRateData.md | 14 + docs/ShippingRequest.md | 15 +- docs/TokenObtainPair.md | 14 + docs/TokenPair.md | 13 + docs/TokenRefresh.md | 13 + ...LabelPrintingRequest.md => TokenVerify.md} | 8 +- docs/TrackerList.md | 5 +- docs/TrackingEvent.md | 14 +- docs/TrackingResponse.md | 5 +- docs/TrackingStatus.md | 11 +- docs/Webhook.md | 18 + docs/WebhookData.md | 16 + docs/WebhookList.md | 14 + docs/WebhookTestRequest.md | 12 + purplship/__init__.py | 31 +- purplship/api/__init__.py | 18 +- purplship/api/addresses_api.py | 1131 +++++---- purplship/api/api_api.py | 882 ++++--- purplship/api/carriers_api.py | 311 ++- purplship/api/customs_api.py | 1601 ++++++------ purplship/api/parcels_api.py | 1131 +++++---- purplship/api/pickups_api.py | 1195 +++++---- purplship/api/proxy_api.py | 1720 +++++++------ purplship/api/shipments_api.py | 2192 ++++++++++------- purplship/api/trackers_api.py | 977 +++++--- purplship/api/webhooks_api.py | 1380 ++++++----- purplship/api_client.py | 796 +++--- purplship/apis/__init__.py | 26 + purplship/configuration.py | 404 ++- purplship/exceptions.py | 160 ++ purplship/model/__init__.py | 5 + purplship/model/access_token.py | 265 ++ purplship/model/address.py | 571 +++++ purplship/model/address_data.py | 554 +++++ purplship/model/address_list.py | 282 +++ purplship/model/address_validation.py | 266 ++ purplship/model/carrier_list.py | 282 +++ purplship/model/carrier_settings.py | 314 +++ purplship/model/charge.py | 264 ++ purplship/model/commodity.py | 303 +++ purplship/model/commodity_data.py | 296 +++ purplship/model/customs.py | 348 +++ purplship/model/customs_data.py | 341 +++ purplship/model/customs_list.py | 282 +++ purplship/model/duty.py | 430 ++++ purplship/model/error_response.py | 262 ++ purplship/model/message.py | 284 +++ purplship/model/operation.py | 271 ++ purplship/model/operation_confirmation.py | 289 +++ purplship/model/operation_response.py | 268 ++ purplship/model/parcel.py | 320 +++ purplship/model/parcel_data.py | 313 +++ purplship/model/parcel_list.py | 282 +++ purplship/model/payment.py | 414 ++++ purplship/model/pickup.py | 355 +++ purplship/model/pickup_cancel_data.py | 259 ++ purplship/model/pickup_cancel_request.py | 289 +++ purplship/model/pickup_data.py | 311 +++ purplship/model/pickup_list.py | 282 +++ purplship/model/pickup_request.py | 315 +++ purplship/model/pickup_response.py | 268 ++ purplship/model/pickup_update_data.py | 306 +++ purplship/model/pickup_update_request.py | 324 +++ purplship/model/rate.py | 338 +++ purplship/model/rate_request.py | 298 +++ purplship/model/rate_response.py | 274 +++ purplship/model/references.py | 358 +++ purplship/model/shipment.py | 409 +++ purplship/model/shipment_cancel_request.py | 273 ++ purplship/model/shipment_data.py | 318 +++ purplship/model/shipment_list.py | 282 +++ purplship/model/shipment_purchase_data.py | 287 +++ purplship/model/shipment_rate_data.py | 264 ++ purplship/model/shipping_request.py | 329 +++ purplship/model/token_obtain_pair.py | 281 +++ purplship/model/token_pair.py | 274 +++ purplship/model/token_refresh.py | 270 ++ purplship/model/token_verify.py | 265 ++ purplship/model/tracker_list.py | 282 +++ purplship/model/tracking_event.py | 281 +++ purplship/model/tracking_response.py | 268 ++ purplship/model/tracking_status.py | 322 +++ purplship/model/webhook.py | 304 +++ purplship/model/webhook_data.py | 293 +++ purplship/model/webhook_list.py | 282 +++ purplship/model/webhook_test_request.py | 262 ++ purplship/model_utils.py | 1993 +++++++++++++++ purplship/models/__init__.py | 130 +- purplship/models/access_token.py | 111 - purplship/models/address.py | 565 ----- purplship/models/address_data.py | 511 ---- purplship/models/address_list.py | 163 -- purplship/models/address_validation.py | 141 -- purplship/models/carrier_list.py | 163 -- purplship/models/carrier_settings.py | 235 -- purplship/models/charge.py | 168 -- purplship/models/commodity.py | 344 --- purplship/models/commodity_data.py | 316 --- purplship/models/customs.py | 500 ---- purplship/models/customs_data.py | 472 ---- purplship/models/customs_list.py | 163 -- purplship/models/duty.py | 234 -- purplship/models/error_response.py | 112 - purplship/models/message.py | 224 -- purplship/models/operation.py | 142 -- purplship/models/operation_confirmation.py | 200 -- purplship/models/operation_response.py | 138 -- purplship/models/parcel.py | 434 ---- purplship/models/parcel_data.py | 406 --- purplship/models/parcel_list.py | 163 -- purplship/models/payment.py | 180 -- purplship/models/pickup.py | 478 ---- purplship/models/pickup_cancel_data.py | 112 - purplship/models/pickup_cancel_request.py | 195 -- purplship/models/pickup_data.py | 310 --- purplship/models/pickup_list.py | 163 -- purplship/models/pickup_request.py | 311 --- purplship/models/pickup_response.py | 138 -- purplship/models/pickup_update_data.py | 335 --- purplship/models/pickup_update_request.py | 340 --- purplship/models/rate.py | 480 ---- purplship/models/rate_request.py | 279 --- purplship/models/rate_response.py | 141 -- purplship/models/references.py | 489 ---- purplship/models/shipment.py | 847 ------- purplship/models/shipment_cancel_request.py | 169 -- purplship/models/shipment_data.py | 365 --- purplship/models/shipment_list.py | 163 -- purplship/models/shipment_purchase_data.py | 173 -- purplship/models/shipping_request.py | 368 --- purplship/models/token_obtain_pair.py | 166 -- purplship/models/token_pair.py | 138 -- purplship/models/token_refresh.py | 111 - purplship/models/token_verify.py | 111 - purplship/models/tracker_list.py | 163 -- purplship/models/tracking_event.py | 224 -- purplship/models/tracking_response.py | 138 -- purplship/models/tracking_status.py | 312 --- purplship/models/webhook.py | 290 --- purplship/models/webhook_data.py | 234 -- purplship/models/webhook_list.py | 163 -- purplship/models/webhook_test_request.py | 111 - purplship/rest.py | 99 +- scripts.sh | 3 - setup.py | 4 +- 188 files changed, 27768 insertions(+), 20417 deletions(-) create mode 100644 docs/AccessToken.md create mode 100644 docs/AddressValidation.md create mode 100644 docs/CommodityData.md create mode 100644 docs/Duty.md delete mode 100644 docs/PaymentData.md create mode 100644 docs/ShipmentRateData.md create mode 100644 docs/TokenObtainPair.md create mode 100644 docs/TokenPair.md create mode 100644 docs/TokenRefresh.md rename docs/{LabelPrintingRequest.md => TokenVerify.md} (56%) create mode 100644 docs/Webhook.md create mode 100644 docs/WebhookData.md create mode 100644 docs/WebhookList.md create mode 100644 docs/WebhookTestRequest.md create mode 100644 purplship/apis/__init__.py create mode 100644 purplship/exceptions.py create mode 100644 purplship/model/__init__.py create mode 100644 purplship/model/access_token.py create mode 100644 purplship/model/address.py create mode 100644 purplship/model/address_data.py create mode 100644 purplship/model/address_list.py create mode 100644 purplship/model/address_validation.py create mode 100644 purplship/model/carrier_list.py create mode 100644 purplship/model/carrier_settings.py create mode 100644 purplship/model/charge.py create mode 100644 purplship/model/commodity.py create mode 100644 purplship/model/commodity_data.py create mode 100644 purplship/model/customs.py create mode 100644 purplship/model/customs_data.py create mode 100644 purplship/model/customs_list.py create mode 100644 purplship/model/duty.py create mode 100644 purplship/model/error_response.py create mode 100644 purplship/model/message.py create mode 100644 purplship/model/operation.py create mode 100644 purplship/model/operation_confirmation.py create mode 100644 purplship/model/operation_response.py create mode 100644 purplship/model/parcel.py create mode 100644 purplship/model/parcel_data.py create mode 100644 purplship/model/parcel_list.py create mode 100644 purplship/model/payment.py create mode 100644 purplship/model/pickup.py create mode 100644 purplship/model/pickup_cancel_data.py create mode 100644 purplship/model/pickup_cancel_request.py create mode 100644 purplship/model/pickup_data.py create mode 100644 purplship/model/pickup_list.py create mode 100644 purplship/model/pickup_request.py create mode 100644 purplship/model/pickup_response.py create mode 100644 purplship/model/pickup_update_data.py create mode 100644 purplship/model/pickup_update_request.py create mode 100644 purplship/model/rate.py create mode 100644 purplship/model/rate_request.py create mode 100644 purplship/model/rate_response.py create mode 100644 purplship/model/references.py create mode 100644 purplship/model/shipment.py create mode 100644 purplship/model/shipment_cancel_request.py create mode 100644 purplship/model/shipment_data.py create mode 100644 purplship/model/shipment_list.py create mode 100644 purplship/model/shipment_purchase_data.py create mode 100644 purplship/model/shipment_rate_data.py create mode 100644 purplship/model/shipping_request.py create mode 100644 purplship/model/token_obtain_pair.py create mode 100644 purplship/model/token_pair.py create mode 100644 purplship/model/token_refresh.py create mode 100644 purplship/model/token_verify.py create mode 100644 purplship/model/tracker_list.py create mode 100644 purplship/model/tracking_event.py create mode 100644 purplship/model/tracking_response.py create mode 100644 purplship/model/tracking_status.py create mode 100644 purplship/model/webhook.py create mode 100644 purplship/model/webhook_data.py create mode 100644 purplship/model/webhook_list.py create mode 100644 purplship/model/webhook_test_request.py create mode 100644 purplship/model_utils.py delete mode 100644 purplship/models/access_token.py delete mode 100644 purplship/models/address.py delete mode 100644 purplship/models/address_data.py delete mode 100644 purplship/models/address_list.py delete mode 100644 purplship/models/address_validation.py delete mode 100644 purplship/models/carrier_list.py delete mode 100644 purplship/models/carrier_settings.py delete mode 100644 purplship/models/charge.py delete mode 100644 purplship/models/commodity.py delete mode 100644 purplship/models/commodity_data.py delete mode 100644 purplship/models/customs.py delete mode 100644 purplship/models/customs_data.py delete mode 100644 purplship/models/customs_list.py delete mode 100644 purplship/models/duty.py delete mode 100644 purplship/models/error_response.py delete mode 100644 purplship/models/message.py delete mode 100644 purplship/models/operation.py delete mode 100644 purplship/models/operation_confirmation.py delete mode 100644 purplship/models/operation_response.py delete mode 100644 purplship/models/parcel.py delete mode 100644 purplship/models/parcel_data.py delete mode 100644 purplship/models/parcel_list.py delete mode 100644 purplship/models/payment.py delete mode 100644 purplship/models/pickup.py delete mode 100644 purplship/models/pickup_cancel_data.py delete mode 100644 purplship/models/pickup_cancel_request.py delete mode 100644 purplship/models/pickup_data.py delete mode 100644 purplship/models/pickup_list.py delete mode 100644 purplship/models/pickup_request.py delete mode 100644 purplship/models/pickup_response.py delete mode 100644 purplship/models/pickup_update_data.py delete mode 100644 purplship/models/pickup_update_request.py delete mode 100644 purplship/models/rate.py delete mode 100644 purplship/models/rate_request.py delete mode 100644 purplship/models/rate_response.py delete mode 100644 purplship/models/references.py delete mode 100644 purplship/models/shipment.py delete mode 100644 purplship/models/shipment_cancel_request.py delete mode 100644 purplship/models/shipment_data.py delete mode 100644 purplship/models/shipment_list.py delete mode 100644 purplship/models/shipment_purchase_data.py delete mode 100644 purplship/models/shipping_request.py delete mode 100644 purplship/models/token_obtain_pair.py delete mode 100644 purplship/models/token_pair.py delete mode 100644 purplship/models/token_refresh.py delete mode 100644 purplship/models/token_verify.py delete mode 100644 purplship/models/tracker_list.py delete mode 100644 purplship/models/tracking_event.py delete mode 100644 purplship/models/tracking_response.py delete mode 100644 purplship/models/tracking_status.py delete mode 100644 purplship/models/webhook.py delete mode 100644 purplship/models/webhook_data.py delete mode 100644 purplship/models/webhook_list.py delete mode 100644 purplship/models/webhook_test_request.py diff --git a/README.md b/README.md index 748ae1e..a4a4f8a 100755 --- a/README.md +++ b/README.md @@ -50,50 +50,62 @@ except ApiException as e: ## Documentation For Models -- [Address](docs/Address.md) -- [AddressData](docs/AddressData.md) -- [AddressList](docs/AddressList.md) -- [CarrierList](docs/CarrierList.md) -- [CarrierSettings](docs/CarrierSettings.md) -- [Charge](docs/Charge.md) -- [Commodity](docs/Commodity.md) -- [Customs](docs/Customs.md) -- [CustomsData](docs/CustomsData.md) -- [CustomsList](docs/CustomsList.md) -- [ErrorResponse](docs/ErrorResponse.md) -- [LabelPrintingRequest](docs/LabelPrintingRequest.md) -- [Message](docs/Message.md) -- [Operation](docs/Operation.md) -- [OperationConfirmation](docs/OperationConfirmation.md) -- [OperationResponse](docs/OperationResponse.md) -- [Parcel](docs/Parcel.md) -- [ParcelData](docs/ParcelData.md) -- [ParcelList](docs/ParcelList.md) -- [Payment](docs/Payment.md) -- [PaymentData](docs/PaymentData.md) -- [Pickup](docs/Pickup.md) -- [PickupCancelData](docs/PickupCancelData.md) -- [PickupCancelRequest](docs/PickupCancelRequest.md) -- [PickupData](docs/PickupData.md) -- [PickupList](docs/PickupList.md) -- [PickupRequest](docs/PickupRequest.md) -- [PickupResponse](docs/PickupResponse.md) -- [PickupUpdateData](docs/PickupUpdateData.md) -- [PickupUpdateRequest](docs/PickupUpdateRequest.md) -- [Rate](docs/Rate.md) -- [RateRequest](docs/RateRequest.md) -- [RateResponse](docs/RateResponse.md) -- [References](docs/References.md) -- [Shipment](docs/Shipment.md) -- [ShipmentCancelRequest](docs/ShipmentCancelRequest.md) -- [ShipmentData](docs/ShipmentData.md) -- [ShipmentList](docs/ShipmentList.md) -- [ShipmentPurchaseData](docs/ShipmentPurchaseData.md) -- [ShippingRequest](docs/ShippingRequest.md) -- [TrackerList](docs/TrackerList.md) -- [TrackingEvent](docs/TrackingEvent.md) -- [TrackingResponse](docs/TrackingResponse.md) -- [TrackingStatus](docs/TrackingStatus.md) + - [AccessToken](docs/AccessToken.md) + - [Address](docs/Address.md) + - [AddressData](docs/AddressData.md) + - [AddressList](docs/AddressList.md) + - [AddressValidation](docs/AddressValidation.md) + - [CarrierList](docs/CarrierList.md) + - [CarrierSettings](docs/CarrierSettings.md) + - [Charge](docs/Charge.md) + - [Commodity](docs/Commodity.md) + - [CommodityData](docs/CommodityData.md) + - [Customs](docs/Customs.md) + - [CustomsData](docs/CustomsData.md) + - [CustomsList](docs/CustomsList.md) + - [Duty](docs/Duty.md) + - [ErrorResponse](docs/ErrorResponse.md) + - [Message](docs/Message.md) + - [Operation](docs/Operation.md) + - [OperationConfirmation](docs/OperationConfirmation.md) + - [OperationResponse](docs/OperationResponse.md) + - [Parcel](docs/Parcel.md) + - [ParcelData](docs/ParcelData.md) + - [ParcelList](docs/ParcelList.md) + - [Payment](docs/Payment.md) + - [Pickup](docs/Pickup.md) + - [PickupCancelData](docs/PickupCancelData.md) + - [PickupCancelRequest](docs/PickupCancelRequest.md) + - [PickupData](docs/PickupData.md) + - [PickupList](docs/PickupList.md) + - [PickupRequest](docs/PickupRequest.md) + - [PickupResponse](docs/PickupResponse.md) + - [PickupUpdateData](docs/PickupUpdateData.md) + - [PickupUpdateRequest](docs/PickupUpdateRequest.md) + - [Rate](docs/Rate.md) + - [RateRequest](docs/RateRequest.md) + - [RateResponse](docs/RateResponse.md) + - [References](docs/References.md) + - [Shipment](docs/Shipment.md) + - [ShipmentCancelRequest](docs/ShipmentCancelRequest.md) + - [ShipmentData](docs/ShipmentData.md) + - [ShipmentList](docs/ShipmentList.md) + - [ShipmentPurchaseData](docs/ShipmentPurchaseData.md) + - [ShipmentRateData](docs/ShipmentRateData.md) + - [ShippingRequest](docs/ShippingRequest.md) + - [TokenObtainPair](docs/TokenObtainPair.md) + - [TokenPair](docs/TokenPair.md) + - [TokenRefresh](docs/TokenRefresh.md) + - [TokenVerify](docs/TokenVerify.md) + - [TrackerList](docs/TrackerList.md) + - [TrackingEvent](docs/TrackingEvent.md) + - [TrackingResponse](docs/TrackingResponse.md) + - [TrackingStatus](docs/TrackingStatus.md) + - [Webhook](docs/Webhook.md) + - [WebhookData](docs/WebhookData.md) + - [WebhookList](docs/WebhookList.md) + - [WebhookTestRequest](docs/WebhookTestRequest.md) + ## Author diff --git a/docs/AccessToken.md b/docs/AccessToken.md new file mode 100644 index 0000000..4122c3f --- /dev/null +++ b/docs/AccessToken.md @@ -0,0 +1,12 @@ +# AccessToken + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**access** | **str** | | +**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/Address.md b/docs/Address.md index d9d59ae..92b407c 100644 --- a/docs/Address.md +++ b/docs/Address.md @@ -1,23 +1,28 @@ # Address + ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **str** | A unique identifier | [optional] -**postal_code** | **str** | The address postal code **(required for shipment purchase)** | [optional] -**city** | **str** | The address city. **(required for shipment purchase)** | [optional] -**federal_tax_id** | **str** | The party frederal tax id | [optional] -**state_tax_id** | **str** | The party state id | [optional] -**person_name** | **str** | attention to **(required for shipment purchase)** | [optional] -**company_name** | **str** | The company name if the party is a company | [optional] **country_code** | **str** | The address country code | -**email** | **str** | The party email | [optional] -**phone_number** | **str** | The party phone number. | [optional] -**state_code** | **str** | The address state code | [optional] -**suburb** | **str** | The address suburb if known | [optional] -**residential** | **bool** | Indicate if the address is residential or commercial (enterprise) | [optional] [default to False] -**address_line1** | **str** | The address line with street number <br/> **(required for shipment purchase)** | [optional] -**address_line2** | **str** | The address line with suite number | [optional] +**id** | **str** | A unique identifier | [optional] +**postal_code** | **str, none_type** | The address postal code **(required for shipment purchase)** | [optional] +**city** | **str, none_type** | The address city. **(required for shipment purchase)** | [optional] +**federal_tax_id** | **str, none_type** | The party frederal tax id | [optional] +**state_tax_id** | **str, none_type** | The party state id | [optional] +**person_name** | **str, none_type** | attention to **(required for shipment purchase)** | [optional] +**company_name** | **str, none_type** | The company name if the party is a company | [optional] +**email** | **str, none_type** | The party email | [optional] +**phone_number** | **str, none_type** | The party phone number. | [optional] +**state_code** | **str, none_type** | The address state code | [optional] +**suburb** | **str, none_type** | The address suburb if known | [optional] +**residential** | **bool, none_type** | Indicate if the address is residential or commercial (enterprise) | [optional] if omitted the server will use the default value of False +**address_line1** | **str, none_type** | The address line with street number <br/> **(required for shipment purchase)** | [optional] +**address_line2** | **str, none_type** | The address line with suite number | [optional] +**validate_location** | **bool, none_type** | Indicate if the address should be validated | [optional] if omitted the server will use the default value of False +**validation** | [**AddressValidation**](AddressValidation.md) | | [optional] +**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/AddressData.md b/docs/AddressData.md index 385aeb2..b8ca4c4 100644 --- a/docs/AddressData.md +++ b/docs/AddressData.md @@ -1,22 +1,26 @@ # AddressData + ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**postal_code** | **str** | The address postal code **(required for shipment purchase)** | [optional] -**city** | **str** | The address city. **(required for shipment purchase)** | [optional] -**federal_tax_id** | **str** | The party frederal tax id | [optional] -**state_tax_id** | **str** | The party state id | [optional] -**person_name** | **str** | attention to **(required for shipment purchase)** | [optional] -**company_name** | **str** | The company name if the party is a company | [optional] **country_code** | **str** | The address country code | -**email** | **str** | The party email | [optional] -**phone_number** | **str** | The party phone number. | [optional] -**state_code** | **str** | The address state code | [optional] -**suburb** | **str** | The address suburb if known | [optional] -**residential** | **bool** | Indicate if the address is residential or commercial (enterprise) | [optional] [default to False] -**address_line1** | **str** | The address line with street number <br/> **(required for shipment purchase)** | [optional] -**address_line2** | **str** | The address line with suite number | [optional] +**postal_code** | **str, none_type** | The address postal code **(required for shipment purchase)** | [optional] +**city** | **str, none_type** | The address city. **(required for shipment purchase)** | [optional] +**federal_tax_id** | **str, none_type** | The party frederal tax id | [optional] +**state_tax_id** | **str, none_type** | The party state id | [optional] +**person_name** | **str, none_type** | attention to **(required for shipment purchase)** | [optional] +**company_name** | **str, none_type** | The company name if the party is a company | [optional] +**email** | **str, none_type** | The party email | [optional] +**phone_number** | **str, none_type** | The party phone number. | [optional] +**state_code** | **str, none_type** | The address state code | [optional] +**suburb** | **str, none_type** | The address suburb if known | [optional] +**residential** | **bool, none_type** | Indicate if the address is residential or commercial (enterprise) | [optional] if omitted the server will use the default value of False +**address_line1** | **str, none_type** | The address line with street number <br/> **(required for shipment purchase)** | [optional] +**address_line2** | **str, none_type** | The address line with suite number | [optional] +**validate_location** | **bool, none_type** | Indicate if the address should be validated | [optional] if omitted the server will use the default value of False +**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/AddressList.md b/docs/AddressList.md index 1685d7e..71ccc03 100644 --- a/docs/AddressList.md +++ b/docs/AddressList.md @@ -1,11 +1,14 @@ # AddressList + ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**results** | [**[Address]**](Address.md) | | **next** | **str** | | [optional] **previous** | **str** | | [optional] -**results** | [**list[Address]**](Address.md) | | +**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/AddressValidation.md b/docs/AddressValidation.md new file mode 100644 index 0000000..d213a94 --- /dev/null +++ b/docs/AddressValidation.md @@ -0,0 +1,14 @@ +# AddressValidation + +Specify address validation result + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**success** | **bool** | True if the address is valid | +**meta** | **{str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type** | validation service details | [optional] +**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/CarrierList.md b/docs/CarrierList.md index 4458bd9..e3a67dd 100644 --- a/docs/CarrierList.md +++ b/docs/CarrierList.md @@ -1,11 +1,14 @@ # CarrierList + ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**results** | [**[CarrierSettings]**](CarrierSettings.md) | | **next** | **str** | | [optional] **previous** | **str** | | [optional] -**results** | [**list[CarrierSettings]**](CarrierSettings.md) | | +**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/CarrierSettings.md b/docs/CarrierSettings.md index 638380a..18bf45a 100644 --- a/docs/CarrierSettings.md +++ b/docs/CarrierSettings.md @@ -1,5 +1,6 @@ # CarrierSettings + ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- @@ -8,6 +9,8 @@ Name | Type | Description | Notes **carrier_id** | **str** | Indicates a specific carrier configuration name. | **test** | **bool** | The test flag indicates whether to use a carrier configured for test. | **active** | **bool** | The active flag indicates whether the carrier account is active or not. | +**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/Charge.md b/docs/Charge.md index 1e75982..809190c 100644 --- a/docs/Charge.md +++ b/docs/Charge.md @@ -1,11 +1,15 @@ # Charge +The pickup cost details + ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**name** | **str** | The charge description | [optional] -**amount** | **float** | The charge monetary value | [optional] -**currency** | **str** | The charge amount currency | [optional] +**name** | **str, none_type** | The charge description | [optional] +**amount** | **float, none_type** | The charge monetary value | [optional] +**currency** | **str, none_type** | The charge amount currency | [optional] +**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/Commodity.md b/docs/Commodity.md index ea7495e..92e087b 100644 --- a/docs/Commodity.md +++ b/docs/Commodity.md @@ -1,17 +1,21 @@ # Commodity +The parcel content items + ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**weight** | **float** | The commodity's weight | +**weight_unit** | **str** | The commodity's weight unit | **id** | **str** | A unique identifier | [optional] -**weight** | **float** | The commodity's weight | -**weight_unit** | **str** | The commodity's weight unit | -**description** | **str** | A description of the commodity | [optional] -**quantity** | **int** | The commodity's quantity (number or item) | [optional] -**sku** | **str** | The commodity's sku number | [optional] -**value_amount** | **float** | The monetary value of the commodity | [optional] -**value_currency** | **str** | The currency of the commodity value amount | [optional] -**origin_country** | **str** | The origin or manufacture country | [optional] +**description** | **str, none_type** | A description of the commodity | [optional] +**quantity** | **int, none_type** | The commodity's quantity (number or item) | [optional] +**sku** | **str, none_type** | The commodity's sku number | [optional] +**value_amount** | **float, none_type** | The monetary value of the commodity | [optional] +**value_currency** | **str, none_type** | The currency of the commodity value amount | [optional] +**origin_country** | **str, none_type** | The origin or manufacture country | [optional] +**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/CommodityData.md b/docs/CommodityData.md new file mode 100644 index 0000000..b040905 --- /dev/null +++ b/docs/CommodityData.md @@ -0,0 +1,19 @@ +# CommodityData + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**weight** | **float** | The commodity's weight | +**weight_unit** | **str** | The commodity's weight unit | +**description** | **str, none_type** | A description of the commodity | [optional] +**quantity** | **int, none_type** | The commodity's quantity (number or item) | [optional] +**sku** | **str, none_type** | The commodity's sku number | [optional] +**value_amount** | **float, none_type** | The monetary value of the commodity | [optional] +**value_currency** | **str, none_type** | The currency of the commodity value amount | [optional] +**origin_country** | **str, none_type** | The origin or manufacture country | [optional] +**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/Customs.md b/docs/Customs.md index 214d0ce..6043334 100644 --- a/docs/Customs.md +++ b/docs/Customs.md @@ -1,22 +1,26 @@ # Customs + ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | **str** | A unique identifier | [optional] -**aes** | **str** | | [optional] -**eel_pfc** | **str** | | [optional] -**content_type** | **str** | | [optional] -**content_description** | **str** | | [optional] -**incoterm** | **str** | The customs 'term of trade' also known as 'incoterm' | [optional] -**commodities** | [**list[Commodity]**](Commodity.md) | The parcel content items | [optional] -**duty** | [**Payment**](Payment.md) | | [optional] -**invoice** | **str** | The invoice reference number | [optional] -**commercial_invoice** | **bool** | Indicates if the shipment is commercial | [optional] -**certify** | **bool** | Indicate that signer certified confirmed all | [optional] -**signer** | **str** | | [optional] -**certificate_number** | **str** | | [optional] -**options** | **object** | | [optional] +**aes** | **str, none_type** | | [optional] +**eel_pfc** | **str, none_type** | | [optional] +**content_type** | **str, none_type** | | [optional] +**content_description** | **str, none_type** | | [optional] +**incoterm** | **str, none_type** | The customs 'term of trade' also known as 'incoterm' | [optional] +**commodities** | [**[Commodity], none_type**](Commodity.md) | The parcel content items | [optional] +**duty** | [**Duty**](Duty.md) | | [optional] +**invoice** | **str, none_type** | The invoice reference number | [optional] +**invoice_date** | **str, none_type** | The invoice date | [optional] +**commercial_invoice** | **bool, none_type** | Indicates if the shipment is commercial | [optional] +**certify** | **bool, none_type** | Indicate that signer certified confirmed all | [optional] +**signer** | **str, none_type** | | [optional] +**certificate_number** | **str, none_type** | | [optional] +**options** | **{str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type** | | [optional] +**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/CustomsData.md b/docs/CustomsData.md index 5416e95..d01aa3d 100644 --- a/docs/CustomsData.md +++ b/docs/CustomsData.md @@ -1,21 +1,25 @@ # CustomsData + ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**aes** | **str** | | [optional] -**eel_pfc** | **str** | | [optional] -**content_type** | **str** | | [optional] -**content_description** | **str** | | [optional] -**incoterm** | **str** | The customs 'term of trade' also known as 'incoterm' | [optional] -**commodities** | [**list[Commodity]**](Commodity.md) | The parcel content items | [optional] -**duty** | [**Payment**](Payment.md) | | [optional] -**invoice** | **str** | The invoice reference number | [optional] -**commercial_invoice** | **bool** | Indicates if the shipment is commercial | [optional] -**certify** | **bool** | Indicate that signer certified confirmed all | [optional] -**signer** | **str** | | [optional] -**certificate_number** | **str** | | [optional] -**options** | **object** | | [optional] +**aes** | **str, none_type** | | [optional] +**eel_pfc** | **str, none_type** | | [optional] +**content_type** | **str, none_type** | | [optional] +**content_description** | **str, none_type** | | [optional] +**incoterm** | **str, none_type** | The customs 'term of trade' also known as 'incoterm' | [optional] +**commodities** | [**[Commodity], none_type**](Commodity.md) | The parcel content items | [optional] +**duty** | [**Duty**](Duty.md) | | [optional] +**invoice** | **str, none_type** | The invoice reference number | [optional] +**invoice_date** | **str, none_type** | The invoice date | [optional] +**commercial_invoice** | **bool, none_type** | Indicates if the shipment is commercial | [optional] +**certify** | **bool, none_type** | Indicate that signer certified confirmed all | [optional] +**signer** | **str, none_type** | | [optional] +**certificate_number** | **str, none_type** | | [optional] +**options** | **{str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type** | | [optional] +**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/CustomsList.md b/docs/CustomsList.md index e5ed4d9..0158095 100644 --- a/docs/CustomsList.md +++ b/docs/CustomsList.md @@ -1,11 +1,14 @@ # CustomsList + ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**results** | [**[Customs]**](Customs.md) | | **next** | **str** | | [optional] **previous** | **str** | | [optional] -**results** | [**list[Customs]**](Customs.md) | | +**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/Duty.md b/docs/Duty.md new file mode 100644 index 0000000..280a97d --- /dev/null +++ b/docs/Duty.md @@ -0,0 +1,17 @@ +# Duty + + The payment details.
Note that this is required for a Dutiable parcel shipped internationally. + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**paid_by** | **str, none_type** | The duty payer | [optional] +**currency** | **str, none_type** | The declared value currency | [optional] +**declared_value** | **float, none_type** | The package declared value | [optional] +**account_number** | **str, none_type** | The duty payment account number | [optional] +**bill_to** | [**Address**](Address.md) | | [optional] +**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/ErrorResponse.md b/docs/ErrorResponse.md index da103ae..752396a 100644 --- a/docs/ErrorResponse.md +++ b/docs/ErrorResponse.md @@ -1,9 +1,12 @@ # ErrorResponse + ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**messages** | [**list[Message]**](Message.md) | The list of error messages | [optional] +**messages** | [**[Message]**](Message.md) | The list of error messages | [optional] +**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/Message.md b/docs/Message.md index 03b9657..0111b98 100644 --- a/docs/Message.md +++ b/docs/Message.md @@ -1,13 +1,17 @@ # Message +The list of error messages + ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**carrier_name** | **str** | The targeted carrier | -**carrier_id** | **str** | The targeted carrier name (unique identifier) | +**carrier_name** | **str** | The targeted carrier | [optional] +**carrier_id** | **str** | The targeted carrier name (unique identifier) | [optional] **message** | **str** | The error or warning message | [optional] **code** | **str** | The message code | [optional] -**details** | **dict(str, str)** | any additional details | [optional] +**details** | **{str: (str, none_type)}** | any additional details | [optional] +**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/Operation.md b/docs/Operation.md index 3b4e040..28345aa 100644 --- a/docs/Operation.md +++ b/docs/Operation.md @@ -1,10 +1,13 @@ # Operation + ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **operation** | **str** | Operation performed | **success** | **bool** | Specify whether the operation was successful | +**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/OperationConfirmation.md b/docs/OperationConfirmation.md index 118773e..2e0a36a 100644 --- a/docs/OperationConfirmation.md +++ b/docs/OperationConfirmation.md @@ -1,12 +1,15 @@ # OperationConfirmation + ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **operation** | **str** | Operation performed | **success** | **bool** | Specify whether the operation was successful | **carrier_name** | **str** | The operation carrier | -**carrier_id** | **str** | The targeted carrier's name (unique identifier) | +**carrier_id** | **str** | The targeted carrier's name (unique identifier) | +**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/OperationResponse.md b/docs/OperationResponse.md index cebee4a..3793c39 100644 --- a/docs/OperationResponse.md +++ b/docs/OperationResponse.md @@ -1,10 +1,13 @@ # OperationResponse + ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**messages** | [**list[Message]**](Message.md) | The list of note or warning messages | [optional] +**messages** | [**[Message]**](Message.md) | The list of note or warning messages | [optional] **confirmation** | [**OperationConfirmation**](OperationConfirmation.md) | | [optional] +**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/Parcel.md b/docs/Parcel.md index c7d9478..17f7a3a 100644 --- a/docs/Parcel.md +++ b/docs/Parcel.md @@ -1,20 +1,23 @@ # Parcel + ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**weight** | **float** | The parcel's weight | +**weight_unit** | **str** | The parcel's weight unit | **id** | **str** | A unique identifier | [optional] -**weight** | **float** | The parcel's weight | -**width** | **float** | The parcel's width | [optional] -**height** | **float** | The parcel's height | [optional] -**length** | **float** | The parcel's length | [optional] -**packaging_type** | **str** | The parcel's packaging type. **Note that the packaging is optional when using a package preset** values: <br/>- **envelope**<br/>- **pak**<br/>- **tube**<br/>- **pallet**<br/>- **small_box**<br/>- **medium_box**<br/>- **your_packaging** For specific carriers packaging type, please consult [the reference](#operation/references). | [optional] -**package_preset** | **str** | The parcel's package preset. For specific carriers package preset, please consult [the reference](#operation/references). | [optional] -**description** | **str** | The parcel's description | [optional] -**content** | **str** | The parcel's content description | [optional] -**is_document** | **bool** | Indicates if the parcel is composed of documents only | [optional] [default to False] -**weight_unit** | **str** | The parcel's weight unit | -**dimension_unit** | **str** | The parcel's dimension unit | [optional] +**width** | **float, none_type** | The parcel's width | [optional] +**height** | **float, none_type** | The parcel's height | [optional] +**length** | **float, none_type** | The parcel's length | [optional] +**packaging_type** | **str, none_type** | The parcel's packaging type. **Note that the packaging is optional when using a package preset** values: <br/>- **envelope**<br/>- **pak**<br/>- **tube**<br/>- **pallet**<br/>- **small_box**<br/>- **medium_box**<br/>- **your_packaging** For specific carriers packaging type, please consult [the reference](#operation/references). | [optional] +**package_preset** | **str, none_type** | The parcel's package preset. For specific carriers package preset, please consult [the reference](#operation/references). | [optional] +**description** | **str, none_type** | The parcel's description | [optional] +**content** | **str, none_type** | The parcel's content description | [optional] +**is_document** | **bool, none_type** | Indicates if the parcel is composed of documents only | [optional] if omitted the server will use the default value of False +**dimension_unit** | **str, none_type** | The parcel's dimension unit | [optional] +**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/ParcelData.md b/docs/ParcelData.md index 79ed750..cccdfeb 100644 --- a/docs/ParcelData.md +++ b/docs/ParcelData.md @@ -1,19 +1,22 @@ # ParcelData + ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**weight** | **float** | The parcel's weight | -**width** | **float** | The parcel's width | [optional] -**height** | **float** | The parcel's height | [optional] -**length** | **float** | The parcel's length | [optional] -**packaging_type** | **str** | The parcel's packaging type. **Note that the packaging is optional when using a package preset** values: <br/>- **envelope**<br/>- **pak**<br/>- **tube**<br/>- **pallet**<br/>- **small_box**<br/>- **medium_box**<br/>- **your_packaging** For specific carriers packaging type, please consult [the reference](#operation/references). | [optional] -**package_preset** | **str** | The parcel's package preset. For specific carriers package preset, please consult [the reference](#operation/references). | [optional] -**description** | **str** | The parcel's description | [optional] -**content** | **str** | The parcel's content description | [optional] -**is_document** | **bool** | Indicates if the parcel is composed of documents only | [optional] [default to False] -**weight_unit** | **str** | The parcel's weight unit | -**dimension_unit** | **str** | The parcel's dimension unit | [optional] +**weight** | **float** | The parcel's weight | +**weight_unit** | **str** | The parcel's weight unit | +**width** | **float, none_type** | The parcel's width | [optional] +**height** | **float, none_type** | The parcel's height | [optional] +**length** | **float, none_type** | The parcel's length | [optional] +**packaging_type** | **str, none_type** | The parcel's packaging type. **Note that the packaging is optional when using a package preset** values: <br/>- **envelope**<br/>- **pak**<br/>- **tube**<br/>- **pallet**<br/>- **small_box**<br/>- **medium_box**<br/>- **your_packaging** For specific carriers packaging type, please consult [the reference](#operation/references). | [optional] +**package_preset** | **str, none_type** | The parcel's package preset. For specific carriers package preset, please consult [the reference](#operation/references). | [optional] +**description** | **str, none_type** | The parcel's description | [optional] +**content** | **str, none_type** | The parcel's content description | [optional] +**is_document** | **bool, none_type** | Indicates if the parcel is composed of documents only | [optional] if omitted the server will use the default value of False +**dimension_unit** | **str, none_type** | The parcel's dimension unit | [optional] +**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/ParcelList.md b/docs/ParcelList.md index e2bce8c..2fc6dd0 100644 --- a/docs/ParcelList.md +++ b/docs/ParcelList.md @@ -1,11 +1,14 @@ # ParcelList + ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**results** | [**[Parcel]**](Parcel.md) | | **next** | **str** | | [optional] **previous** | **str** | | [optional] -**results** | [**list[Parcel]**](Parcel.md) | | +**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/Payment.md b/docs/Payment.md index 5193c24..4c626f8 100644 --- a/docs/Payment.md +++ b/docs/Payment.md @@ -1,14 +1,15 @@ # Payment +The payment details + ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **str** | A unique identifier | [optional] -**paid_by** | **str** | The payment payer | [optional] [default to 'sender'] -**amount** | **float** | The payment amount if known | [optional] -**currency** | **str** | The payment amount currency | -**account_number** | **str** | The selected rate carrier payer account number | [optional] -**contact** | [**Address**](Address.md) | | [optional] +**paid_by** | **str** | The payor type | [optional] if omitted the server will use the default value of "sender" +**currency** | **str** | The payment amount currency | [optional] +**account_number** | **str, none_type** | The payor account number | [optional] +**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/PaymentData.md b/docs/PaymentData.md deleted file mode 100644 index 2415573..0000000 --- a/docs/PaymentData.md +++ /dev/null @@ -1,13 +0,0 @@ -# PaymentData - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**paid_by** | **str** | The payment payer | [optional] [default to 'sender'] -**amount** | **float** | The payment amount if known | [optional] -**currency** | **str** | The payment amount currency | -**account_number** | **str** | The selected rate carrier payer account number | [optional] -**contact** | [**Address**](Address.md) | | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - diff --git a/docs/Pickup.md b/docs/Pickup.md index c8b5e7d..463bb88 100644 --- a/docs/Pickup.md +++ b/docs/Pickup.md @@ -1,22 +1,25 @@ # Pickup + ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **str** | A unique pickup identifier | [optional] **carrier_name** | **str** | The pickup carrier | **carrier_id** | **str** | The pickup carrier configured name | **confirmation_number** | **str** | The pickup confirmation identifier | -**pickup_date** | **str** | The pickup date | [optional] -**pickup_charge** | [**Charge**](Charge.md) | | [optional] -**ready_time** | **str** | The pickup expected ready time | [optional] -**closing_time** | **str** | The pickup expected closing or late time | [optional] **address** | [**Address**](Address.md) | | -**parcels** | [**list[Parcel]**](Parcel.md) | The shipment parcels to pickup. | -**instruction** | **str** | The pickup instruction. eg: Handle with care. | [optional] -**package_location** | **str** | The package(s) location. eg: Behind the entrance door. | [optional] -**options** | **object** | Advanced carrier specific pickup options | [optional] +**parcels** | [**[Parcel], none_type**](Parcel.md) | The shipment parcels to pickup. | **test_mode** | **bool** | Specified whether it was created with a carrier in test mode | +**id** | **str** | A unique pickup identifier | [optional] +**pickup_date** | **str, none_type** | The pickup date | [optional] +**pickup_charge** | [**Charge**](Charge.md) | | [optional] +**ready_time** | **str, none_type** | The pickup expected ready time | [optional] +**closing_time** | **str, none_type** | The pickup expected closing or late time | [optional] +**instruction** | **str, none_type** | The pickup instruction. eg: Handle with care. | [optional] +**package_location** | **str, none_type** | The package(s) location. eg: Behind the entrance door. | [optional] +**options** | **{str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type** | Advanced carrier specific pickup options | [optional] +**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/PickupCancelData.md b/docs/PickupCancelData.md index 8538966..42e4983 100644 --- a/docs/PickupCancelData.md +++ b/docs/PickupCancelData.md @@ -1,9 +1,12 @@ # PickupCancelData + ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **reason** | **str** | The reason of the pickup cancellation | [optional] +**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/PickupCancelRequest.md b/docs/PickupCancelRequest.md index 787ad35..a6b72e0 100644 --- a/docs/PickupCancelRequest.md +++ b/docs/PickupCancelRequest.md @@ -1,12 +1,15 @@ # PickupCancelRequest + ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **confirmation_number** | **str** | The pickup confirmation identifier | **address** | [**AddressData**](AddressData.md) | | [optional] -**pickup_date** | **str** | The pickup date Date Format: `YYYY-MM-DD` | [optional] +**pickup_date** | **str, none_type** | The pickup date Date Format: `YYYY-MM-DD` | [optional] **reason** | **str** | The reason of the pickup cancellation | [optional] +**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/PickupData.md b/docs/PickupData.md index 318101e..99612c1 100644 --- a/docs/PickupData.md +++ b/docs/PickupData.md @@ -1,16 +1,19 @@ # PickupData + ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **pickup_date** | **str** | The expected pickup date Date Format: `YYYY-MM-DD` | -**address** | [**AddressData**](AddressData.md) | | [optional] **ready_time** | **str** | The ready time for pickup. Time Format: `HH:MM` | **closing_time** | **str** | The closing or late time of the pickup Time Format: `HH:MM` | -**instruction** | **str** | The pickup instruction. eg: Handle with care. | [optional] -**package_location** | **str** | The package(s) location. eg: Behind the entrance door. | [optional] -**options** | **object** | Advanced carrier specific pickup options | [optional] -**tracking_numbers** | **list[str]** | The list of shipments to be picked up | +**tracking_numbers** | **[str]** | The list of shipments to be picked up | +**address** | [**AddressData**](AddressData.md) | | [optional] +**instruction** | **str, none_type** | The pickup instruction. eg: Handle with care. | [optional] +**package_location** | **str, none_type** | The package(s) location. eg: Behind the entrance door. | [optional] +**options** | **{str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type** | Advanced carrier specific pickup options | [optional] +**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/PickupList.md b/docs/PickupList.md index 1dfd5f1..4173b05 100644 --- a/docs/PickupList.md +++ b/docs/PickupList.md @@ -1,11 +1,14 @@ # PickupList + ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**results** | [**[Pickup]**](Pickup.md) | | **next** | **str** | | [optional] **previous** | **str** | | [optional] -**results** | [**list[Pickup]**](Pickup.md) | | +**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/PickupRequest.md b/docs/PickupRequest.md index 2fd694a..7894126 100644 --- a/docs/PickupRequest.md +++ b/docs/PickupRequest.md @@ -1,16 +1,19 @@ # PickupRequest + ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **pickup_date** | **str** | The expected pickup date Date Format: `YYYY-MM-DD` | **address** | [**AddressData**](AddressData.md) | | -**parcels** | [**list[ParcelData]**](ParcelData.md) | The shipment parcels to pickup. | +**parcels** | [**[ParcelData], none_type**](ParcelData.md) | The shipment parcels to pickup. | **ready_time** | **str** | The ready time for pickup. Time Format: `HH:MM` | **closing_time** | **str** | The closing or late time of the pickup Time Format: `HH:MM` | -**instruction** | **str** | The pickup instruction. eg: Handle with care. | [optional] -**package_location** | **str** | The package(s) location. eg: Behind the entrance door. | [optional] -**options** | **object** | Advanced carrier specific pickup options | [optional] +**instruction** | **str, none_type** | The pickup instruction. eg: Handle with care. | [optional] +**package_location** | **str, none_type** | The package(s) location. eg: Behind the entrance door. | [optional] +**options** | **{str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type** | Advanced carrier specific pickup options | [optional] +**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/PickupResponse.md b/docs/PickupResponse.md index 2761579..a60acba 100644 --- a/docs/PickupResponse.md +++ b/docs/PickupResponse.md @@ -1,10 +1,13 @@ # PickupResponse + ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**messages** | [**list[Message]**](Message.md) | The list of note or warning messages | [optional] +**messages** | [**[Message]**](Message.md) | The list of note or warning messages | [optional] **pickup** | [**Pickup**](Pickup.md) | | [optional] +**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/PickupUpdateData.md b/docs/PickupUpdateData.md index e8072f3..19247d7 100644 --- a/docs/PickupUpdateData.md +++ b/docs/PickupUpdateData.md @@ -1,17 +1,20 @@ # PickupUpdateData + ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**confirmation_number** | **str** | pickup identification number | **pickup_date** | **str** | The expected pickup date Date Format: YYYY-MM-DD | [optional] **address** | [**AddressData**](AddressData.md) | | [optional] -**ready_time** | **str** | The ready time for pickup. | [optional] -**closing_time** | **str** | The closing or late time of the pickup | [optional] -**instruction** | **str** | The pickup instruction. eg: Handle with care. | [optional] -**package_location** | **str** | The package(s) location. eg: Behind the entrance door. | [optional] -**options** | **object** | Advanced carrier specific pickup options | [optional] -**tracking_numbers** | **list[str]** | The list of shipments to be picked up | [optional] -**confirmation_number** | **str** | pickup identification number | +**ready_time** | **str, none_type** | The ready time for pickup. | [optional] +**closing_time** | **str, none_type** | The closing or late time of the pickup | [optional] +**instruction** | **str, none_type** | The pickup instruction. eg: Handle with care. | [optional] +**package_location** | **str, none_type** | The package(s) location. eg: Behind the entrance door. | [optional] +**options** | **{str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type** | Advanced carrier specific pickup options | [optional] +**tracking_numbers** | **[str]** | The list of shipments to be picked up | [optional] +**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/PickupUpdateRequest.md b/docs/PickupUpdateRequest.md index 0e5cf29..6ad8b98 100644 --- a/docs/PickupUpdateRequest.md +++ b/docs/PickupUpdateRequest.md @@ -1,17 +1,20 @@ # PickupUpdateRequest + ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **pickup_date** | **str** | The expected pickup date Date Format: `YYYY-MM-DD` | **address** | [**Address**](Address.md) | | -**parcels** | [**list[Parcel]**](Parcel.md) | The shipment parcels to pickup. | +**parcels** | [**[Parcel], none_type**](Parcel.md) | The shipment parcels to pickup. | **confirmation_number** | **str** | pickup identification number | **ready_time** | **str** | The ready time for pickup. Time Format: `HH:MM` | **closing_time** | **str** | The closing or late time of the pickup Time Format: `HH:MM` | -**instruction** | **str** | The pickup instruction. eg: Handle with care. | [optional] -**package_location** | **str** | The package(s) location. eg: Behind the entrance door. | [optional] -**options** | **object** | Advanced carrier specific pickup options | [optional] +**instruction** | **str, none_type** | The pickup instruction. eg: Handle with care. | [optional] +**package_location** | **str, none_type** | The package(s) location. eg: Behind the entrance door. | [optional] +**options** | **{str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type** | Advanced carrier specific pickup options | [optional] +**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/Rate.md b/docs/Rate.md index 393bb74..796c6c3 100644 --- a/docs/Rate.md +++ b/docs/Rate.md @@ -1,22 +1,26 @@ # Rate +The list of returned rates + ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **str** | A unique identifier | [optional] -**carrier_name** | **str** | The rate's carrier | -**carrier_id** | **str** | The targeted carrier's name (unique identifier) | +**carrier_name** | **str** | The rate's carrier | +**carrier_id** | **str** | The targeted carrier's name (unique identifier) | **currency** | **str** | The rate monetary values currency code | -**service** | **str** | The carrier's rate (quote) service | [optional] -**discount** | **float** | The monetary amount of the discount on the rate | [optional] -**base_charge** | **float** | The rate's monetary amount of the base charge.<br/> This is the net amount of the rate before additional charges | [optional] -**total_charge** | **float** | The rate's monetary amount of the total charge.<br/> This is the gross amount of the rate after adding the additional charges | [optional] -**duties_and_taxes** | **float** | The monetary amount of the duties and taxes if applied | [optional] -**transit_days** | **int** | The estimated delivery transit days | [optional] -**extra_charges** | [**list[Charge]**](Charge.md) | list of the rate's additional charges | [optional] -**meta** | **object** | provider specific metadata | [optional] -**carrier_ref** | **str** | The system carrier configuration id | [optional] **test_mode** | **bool** | Specified whether it was created with a carrier in test mode | +**id** | **str** | A unique identifier | [optional] +**service** | **str, none_type** | The carrier's rate (quote) service | [optional] +**discount** | **float, none_type** | The monetary amount of the discount on the rate | [optional] +**base_charge** | **float** | The rate's monetary amount of the base charge.<br/> This is the net amount of the rate before additional charges | [optional] +**total_charge** | **float** | The rate's monetary amount of the total charge.<br/> This is the gross amount of the rate after adding the additional charges | [optional] +**duties_and_taxes** | **float, none_type** | The monetary amount of the duties and taxes if applied | [optional] +**transit_days** | **int, none_type** | The estimated delivery transit days | [optional] +**extra_charges** | [**[Charge]**](Charge.md) | list of the rate's additional charges | [optional] +**meta** | **{str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type** | provider specific metadata | [optional] +**carrier_ref** | **str, none_type** | The system carrier configuration id | [optional] +**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/RateRequest.md b/docs/RateRequest.md index 83d350b..aec7f18 100644 --- a/docs/RateRequest.md +++ b/docs/RateRequest.md @@ -1,15 +1,18 @@ # RateRequest + ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**shipper** | [**Address**](Address.md) | | -**recipient** | [**Address**](Address.md) | | -**parcels** | [**list[Parcel]**](Parcel.md) | The shipment's parcels | -**services** | **list[str]** | The requested carrier service for the shipment.<br/> Please consult [the reference](#operation/references) for specific carriers services. Note that this is a list because on a Multi-carrier rate request you could specify a service per carrier. | [optional] -**options** | **object** | The options available for the shipment. Please consult [the reference](#operation/references) for additional specific carriers options. | [optional] -**reference** | **str** | The shipment reference | [optional] -**carrier_ids** | **list[str]** | The list of configured carriers you wish to get rates from. | [optional] +**shipper** | [**AddressData**](AddressData.md) | | +**recipient** | [**AddressData**](AddressData.md) | | +**parcels** | [**[ParcelData]**](ParcelData.md) | The shipment's parcels | +**services** | **[str], none_type** | The requested carrier service for the shipment.<br/> Please consult [the reference](#operation/references) for specific carriers services. Note that this is a list because on a Multi-carrier rate request you could specify a service per carrier. | [optional] +**options** | **{str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type** | The options available for the shipment. Please consult [the reference](#operation/references) for additional specific carriers options. | [optional] +**reference** | **str, none_type** | The shipment reference | [optional] +**carrier_ids** | **[str], none_type** | The list of configured carriers you wish to get rates from. | [optional] +**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/RateResponse.md b/docs/RateResponse.md index 3a233b6..5534b75 100644 --- a/docs/RateResponse.md +++ b/docs/RateResponse.md @@ -1,10 +1,13 @@ # RateResponse + ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**messages** | [**list[Message]**](Message.md) | The list of note or warning messages | [optional] -**rates** | [**list[Rate]**](Rate.md) | The list of returned rates | +**rates** | [**[Rate]**](Rate.md) | The list of returned rates | +**messages** | [**[Message]**](Message.md) | The list of note or warning messages | [optional] +**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/References.md b/docs/References.md index c6700d7..6650ec6 100644 --- a/docs/References.md +++ b/docs/References.md @@ -1,19 +1,27 @@ # References + ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**countries** | **object** | | -**currencies** | **object** | | -**carriers** | **object** | | -**customs_content_type** | **object** | | -**incoterms** | **object** | | -**states** | **object** | | -**services** | **object** | | -**options** | **object** | | -**package_presets** | **object** | | -**packaging_types** | **object** | | -**payment_types** | **object** | | +**app_name** | **str** | | +**app_version** | **str** | | +**countries** | **{str: (bool, date, datetime, dict, float, int, list, str, none_type)}** | | +**currencies** | **{str: (bool, date, datetime, dict, float, int, list, str, none_type)}** | | +**carriers** | **{str: (bool, date, datetime, dict, float, int, list, str, none_type)}** | | +**customs_content_type** | **{str: (bool, date, datetime, dict, float, int, list, str, none_type)}** | | +**incoterms** | **{str: (bool, date, datetime, dict, float, int, list, str, none_type)}** | | +**states** | **{str: (bool, date, datetime, dict, float, int, list, str, none_type)}** | | +**services** | **{str: (bool, date, datetime, dict, float, int, list, str, none_type)}** | | +**service_names** | **{str: (bool, date, datetime, dict, float, int, list, str, none_type)}** | | +**options** | **{str: (bool, date, datetime, dict, float, int, list, str, none_type)}** | | +**option_names** | **{str: (bool, date, datetime, dict, float, int, list, str, none_type)}** | | +**package_presets** | **{str: (bool, date, datetime, dict, float, int, list, str, none_type)}** | | +**packaging_types** | **{str: (bool, date, datetime, dict, float, int, list, str, none_type)}** | | +**payment_types** | **{str: (bool, date, datetime, dict, float, int, list, str, none_type)}** | | +**carrier_capabilities** | **{str: (bool, date, datetime, dict, float, int, list, str, none_type)}** | | +**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/Shipment.md b/docs/Shipment.md index 831dcda..252d91c 100644 --- a/docs/Shipment.md +++ b/docs/Shipment.md @@ -1,34 +1,38 @@ # Shipment + ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **str** | A unique identifier | [optional] -**status** | **str** | The current Shipment status | [optional] [default to 'created'] -**carrier_name** | **str** | The shipment carrier | [optional] -**carrier_id** | **str** | The shipment carrier configured identifier | [optional] -**label** | **str** | The shipment label in base64 string | [optional] -**tracking_number** | **str** | The shipment tracking number | [optional] -**shipment_identifier** | **str** | The shipment carrier system identifier | [optional] -**selected_rate** | [**Rate**](Rate.md) | | [optional] -**selected_rate_id** | **str** | The shipment selected rate. | [optional] -**rates** | [**list[Rate]**](Rate.md) | The list for shipment rates fetched previously | [optional] -**tracking_url** | **str** | The shipment tracking url | [optional] -**service** | **str** | The selected service | [optional] **shipper** | [**Address**](Address.md) | | **recipient** | [**Address**](Address.md) | | -**parcels** | [**list[Parcel]**](Parcel.md) | The shipment's parcels | -**services** | **list[str]** | The carriers services requested for the shipment. Please consult [the reference](#operation/references) for specific carriers services.<br/> Note that this is a list because on a Multi-carrier rate request you could specify a service per carrier. | [optional] -**options** | **object** | The options available for the shipment.<br/> Please consult [the reference](#operation/references) for additional specific carriers options. | [optional] +**parcels** | [**[Parcel]**](Parcel.md) | The shipment's parcels | +**created_at** | **str** | The shipment creation datetime Date Format: `YYYY-MM-DD HH:MM:SS.mmmmmmz` | +**test_mode** | **bool** | Specified whether it was created with a carrier in test mode | +**id** | **str** | A unique identifier | [optional] +**status** | **str** | The current Shipment status | [optional] if omitted the server will use the default value of "created" +**carrier_name** | **str, none_type** | The shipment carrier | [optional] +**carrier_id** | **str, none_type** | The shipment carrier configured identifier | [optional] +**label** | **str, none_type** | The shipment label in base64 string | [optional] +**tracking_number** | **str, none_type** | The shipment tracking number | [optional] +**shipment_identifier** | **str, none_type** | The shipment carrier system identifier | [optional] +**selected_rate** | [**Rate**](Rate.md) | | [optional] +**selected_rate_id** | **str, none_type** | The shipment selected rate. | [optional] +**rates** | [**[Rate]**](Rate.md) | The list for shipment rates fetched previously | [optional] +**tracking_url** | **str, none_type** | The shipment tracking url | [optional] +**service** | **str, none_type** | The selected service | [optional] +**services** | **[str], none_type** | The carriers services requested for the shipment. Please consult [the reference](#operation/references) for specific carriers services.<br/> Note that this is a list because on a Multi-carrier rate request you could specify a service per carrier. | [optional] +**options** | **{str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type** | The options available for the shipment.<br/> Please consult [the reference](#operation/references) for additional specific carriers options. | [optional] **payment** | [**Payment**](Payment.md) | | [optional] **customs** | [**Customs**](Customs.md) | | [optional] -**reference** | **str** | The shipment reference | [optional] -**label_type** | **str** | The shipment label file type. | [optional] -**carrier_ids** | **list[str]** | The list of configured carriers you wish to get rates from. *Note that the request will be sent to all carriers in nothing is specified* | [optional] -**meta** | **object** | provider specific metadata | [optional] -**created_at** | **str** | The shipment creation date Date Format: `YYYY-MM-DD` | -**test_mode** | **bool** | Specified whether it was created with a carrier in test mode | -**messages** | [**list[Message]**](Message.md) | The list of note or warning messages | [optional] +**reference** | **str, none_type** | The shipment reference | [optional] +**label_type** | **str, none_type** | The shipment label file type. | [optional] +**carrier_ids** | **[str], none_type** | The list of configured carriers you wish to get rates from. *Note that the request will be sent to all carriers in nothing is specified* | [optional] +**tracker_id** | **str, none_type** | The attached tracker id | [optional] +**meta** | **{str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type** | provider specific metadata | [optional] +**messages** | [**[Message]**](Message.md) | The list of note or warning messages | [optional] +**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/ShipmentCancelRequest.md b/docs/ShipmentCancelRequest.md index 7a595b4..ea1089f 100644 --- a/docs/ShipmentCancelRequest.md +++ b/docs/ShipmentCancelRequest.md @@ -1,11 +1,14 @@ # ShipmentCancelRequest + ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **shipment_identifier** | **str** | The shipment identifier returned during creation | -**service** | **str** | The selected shipment service | [optional] -**options** | **object** | Advanced carrier specific cancellation options | [optional] +**service** | **str, none_type** | The selected shipment service | [optional] +**options** | **{str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type** | Advanced carrier specific cancellation options | [optional] +**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/ShipmentData.md b/docs/ShipmentData.md index 485129b..1a190f5 100644 --- a/docs/ShipmentData.md +++ b/docs/ShipmentData.md @@ -1,18 +1,21 @@ # ShipmentData + ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **shipper** | [**AddressData**](AddressData.md) | | **recipient** | [**AddressData**](AddressData.md) | | -**parcels** | [**list[ParcelData]**](ParcelData.md) | The shipment's parcels | -**options** | **object** | The options available for the shipment.<br/> Please consult [the reference](#operation/references) for additional specific carriers options. | [optional] -**payment** | [**PaymentData**](PaymentData.md) | | [optional] +**parcels** | [**[ParcelData]**](ParcelData.md) | The shipment's parcels | +**options** | **{str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type** | The options available for the shipment.<br/> Please consult [the reference](#operation/references) for additional specific carriers options. | [optional] +**payment** | [**Payment**](Payment.md) | | [optional] **customs** | [**CustomsData**](CustomsData.md) | | [optional] -**reference** | **str** | The shipment reference | [optional] -**label_type** | **str** | The shipment label file type. | [optional] [default to 'PDF'] -**services** | **list[str]** | The requested carrier service for the shipment. Please consult [the reference](#operation/references) for specific carriers services.<br/> Note that this is a list because on a Multi-carrier rate request you could specify a service per carrier. | [optional] -**carrier_ids** | **list[str]** | The list of configured carriers you wish to get rates from. *Note that the request will be sent to all carriers in nothing is specified* | [optional] +**reference** | **str, none_type** | The shipment reference | [optional] +**label_type** | **str** | The shipment label file type. | [optional] if omitted the server will use the default value of "PDF" +**services** | **[str], none_type** | The requested carrier service for the shipment. Please consult [the reference](#operation/references) for specific carriers services.<br/> Note that this is a list because on a Multi-carrier rate request you could specify a service per carrier. | [optional] +**carrier_ids** | **[str], none_type** | The list of configured carriers you wish to get rates from. *Note that the request will be sent to all carriers in nothing is specified* | [optional] +**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/ShipmentList.md b/docs/ShipmentList.md index 843694c..03ed5e3 100644 --- a/docs/ShipmentList.md +++ b/docs/ShipmentList.md @@ -1,11 +1,14 @@ # ShipmentList + ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**results** | [**[Shipment]**](Shipment.md) | | **next** | **str** | | [optional] **previous** | **str** | | [optional] -**results** | [**list[Shipment]**](Shipment.md) | | +**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/ShipmentPurchaseData.md b/docs/ShipmentPurchaseData.md index 1a06fc8..cf97f3c 100644 --- a/docs/ShipmentPurchaseData.md +++ b/docs/ShipmentPurchaseData.md @@ -1,11 +1,15 @@ # ShipmentPurchaseData + ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **selected_rate_id** | **str** | The shipment selected rate. | -**label_type** | **str** | The shipment label file type. | [optional] [default to 'PDF'] +**label_type** | **str** | The shipment label file type. | [optional] if omitted the server will use the default value of "PDF" **payment** | [**Payment**](Payment.md) | | [optional] +**reference** | **str, none_type** | The shipment reference | [optional] +**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/ShipmentRateData.md b/docs/ShipmentRateData.md new file mode 100644 index 0000000..4fdf70a --- /dev/null +++ b/docs/ShipmentRateData.md @@ -0,0 +1,14 @@ +# ShipmentRateData + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**services** | **[str], none_type** | The requested carrier service for the shipment. Please consult [the reference](#operation/references) for specific carriers services.<br/> Note that this is a list because on a Multi-carrier rate request you could specify a service per carrier. | [optional] +**carrier_ids** | **[str], none_type** | The list of configured carriers you wish to get rates from. *Note that the request will be sent to all carriers in nothing is specified* | [optional] +**reference** | **str, none_type** | The shipment reference | [optional] +**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/ShippingRequest.md b/docs/ShippingRequest.md index a83932c..22198f3 100644 --- a/docs/ShippingRequest.md +++ b/docs/ShippingRequest.md @@ -1,18 +1,21 @@ # ShippingRequest + ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **shipper** | [**AddressData**](AddressData.md) | | **recipient** | [**AddressData**](AddressData.md) | | -**parcels** | [**list[ParcelData]**](ParcelData.md) | The shipment's parcels | -**options** | **object** | The options available for the shipment.<br/> Please consult [the reference](#operation/references) for additional specific carriers options. | [optional] +**parcels** | [**[ParcelData]**](ParcelData.md) | The shipment's parcels | **payment** | [**Payment**](Payment.md) | | -**customs** | [**CustomsData**](CustomsData.md) | | [optional] -**reference** | **str** | The shipment reference | [optional] -**label_type** | **str** | The shipment label file type. | [optional] [default to 'PDF'] **selected_rate_id** | **str** | The shipment selected rate. | -**rates** | [**list[Rate]**](Rate.md) | The list for shipment rates fetched previously | +**rates** | [**[Rate]**](Rate.md) | The list for shipment rates fetched previously | +**options** | **{str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type** | The options available for the shipment.<br/> Please consult [the reference](#operation/references) for additional specific carriers options. | [optional] +**customs** | [**CustomsData**](CustomsData.md) | | [optional] +**reference** | **str, none_type** | The shipment reference | [optional] +**label_type** | **str** | The shipment label file type. | [optional] if omitted the server will use the default value of "PDF" +**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/TokenObtainPair.md b/docs/TokenObtainPair.md new file mode 100644 index 0000000..187c7c4 --- /dev/null +++ b/docs/TokenObtainPair.md @@ -0,0 +1,14 @@ +# TokenObtainPair + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**email** | **str** | | +**password** | **str** | | +**org_id** | **str** | **should be specified only in a multi-org deployment.** Note the first org related to the user is selected by default. | [optional] +**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/TokenPair.md b/docs/TokenPair.md new file mode 100644 index 0000000..fab0308 --- /dev/null +++ b/docs/TokenPair.md @@ -0,0 +1,13 @@ +# TokenPair + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**access** | **str** | | +**refresh** | **str** | | +**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/TokenRefresh.md b/docs/TokenRefresh.md new file mode 100644 index 0000000..6fef9e7 --- /dev/null +++ b/docs/TokenRefresh.md @@ -0,0 +1,13 @@ +# TokenRefresh + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**refresh** | **str** | | +**access** | **str** | | [optional] [readonly] +**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/LabelPrintingRequest.md b/docs/TokenVerify.md similarity index 56% rename from docs/LabelPrintingRequest.md rename to docs/TokenVerify.md index 58e5f88..ce3b63b 100644 --- a/docs/LabelPrintingRequest.md +++ b/docs/TokenVerify.md @@ -1,10 +1,12 @@ -# LabelPrintingRequest +# TokenVerify + ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**name** | **str** | PDF file name. eg: shipment-[trackingNumber] | -**label** | **str** | Shipment base64 label | +**token** | **str** | | +**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/TrackerList.md b/docs/TrackerList.md index 84c953c..f9ee82a 100644 --- a/docs/TrackerList.md +++ b/docs/TrackerList.md @@ -1,11 +1,14 @@ # TrackerList + ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**results** | [**[TrackingStatus]**](TrackingStatus.md) | | **next** | **str** | | [optional] **previous** | **str** | | [optional] -**results** | [**list[TrackingStatus]**](TrackingStatus.md) | | +**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/TrackingEvent.md b/docs/TrackingEvent.md index 0f27a3e..b16bcda 100644 --- a/docs/TrackingEvent.md +++ b/docs/TrackingEvent.md @@ -1,13 +1,17 @@ # TrackingEvent +The tracking details events + ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**_date** | **str** | The tracking event's date | [optional] -**description** | **str** | The tracking event's description | [optional] -**location** | **str** | The tracking event's location | [optional] -**code** | **str** | The tracking event's code | [optional] -**time** | **str** | The tracking event's time | [optional] +**date** | **str** | The tracking event's date | [optional] +**description** | **str** | The tracking event's description | [optional] +**location** | **str** | The tracking event's location | [optional] +**code** | **str, none_type** | The tracking event's code | [optional] +**time** | **str, none_type** | The tracking event's time | [optional] +**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/TrackingResponse.md b/docs/TrackingResponse.md index 74b11f2..aa671fb 100644 --- a/docs/TrackingResponse.md +++ b/docs/TrackingResponse.md @@ -1,10 +1,13 @@ # TrackingResponse + ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**messages** | [**list[Message]**](Message.md) | The list of note or warning messages | [optional] +**messages** | [**[Message]**](Message.md) | The list of note or warning messages | [optional] **tracking** | [**TrackingStatus**](TrackingStatus.md) | | [optional] +**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/TrackingStatus.md b/docs/TrackingStatus.md index a9f6fc2..bd9ef2a 100644 --- a/docs/TrackingStatus.md +++ b/docs/TrackingStatus.md @@ -1,15 +1,20 @@ # TrackingStatus +The tracking details retrieved + ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **str** | A unique identifier | [optional] **carrier_name** | **str** | The tracking carrier | **carrier_id** | **str** | The tracking carrier configured identifier | **tracking_number** | **str** | The shipment tracking number | -**events** | [**list[TrackingEvent]**](TrackingEvent.md) | The tracking details events | [optional] -**delivered** | **bool** | Specified whether the related shipment was delivered | [optional] **test_mode** | **bool** | Specified whether the object was created with a carrier in test mode | +**id** | **str** | A unique identifier | [optional] +**events** | [**[TrackingEvent], none_type**](TrackingEvent.md) | The tracking details events | [optional] +**delivered** | **bool** | Specified whether the related shipment was delivered | [optional] +**status** | **str** | The current tracking status | [optional] if omitted the server will use the default value of "created" +**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/Webhook.md b/docs/Webhook.md new file mode 100644 index 0000000..8397206 --- /dev/null +++ b/docs/Webhook.md @@ -0,0 +1,18 @@ +# Webhook + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**url** | **str** | The URL of the webhook endpoint. | +**enabled_events** | **[str]** | The list of events to enable for this endpoint. | +**test_mode** | **bool** | Specified whether it was created with a carrier in test mode | +**description** | **str, none_type** | An optional description of what the webhook is used for. | [optional] +**disabled** | **bool, none_type** | Indicates that the webhook is disabled | [optional] +**id** | **str** | A unique identifier | [optional] +**last_event_at** | **datetime, none_type** | The datetime of the last event sent. | [optional] +**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/WebhookData.md b/docs/WebhookData.md new file mode 100644 index 0000000..981a871 --- /dev/null +++ b/docs/WebhookData.md @@ -0,0 +1,16 @@ +# WebhookData + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**url** | **str** | The URL of the webhook endpoint. | +**enabled_events** | **[str]** | The list of events to enable for this endpoint. | +**test_mode** | **bool** | Specified whether it was created with a carrier in test mode | +**description** | **str, none_type** | An optional description of what the webhook is used for. | [optional] +**disabled** | **bool, none_type** | Indicates that the webhook is disabled | [optional] +**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/WebhookList.md b/docs/WebhookList.md new file mode 100644 index 0000000..d32347c --- /dev/null +++ b/docs/WebhookList.md @@ -0,0 +1,14 @@ +# WebhookList + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**results** | [**[Webhook]**](Webhook.md) | | +**next** | **str** | | [optional] +**previous** | **str** | | [optional] +**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/WebhookTestRequest.md b/docs/WebhookTestRequest.md new file mode 100644 index 0000000..ab9a013 --- /dev/null +++ b/docs/WebhookTestRequest.md @@ -0,0 +1,12 @@ +# WebhookTestRequest + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**payload** | **{str: (bool, date, datetime, dict, float, int, list, str, none_type)}** | | +**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/purplship/__init__.py b/purplship/__init__.py index 0b003d0..5ccddd8 100644 --- a/purplship/__init__.py +++ b/purplship/__init__.py @@ -1,20 +1,34 @@ -## coding: utf-8 - # flake8: noqa """ - Purplship Open Source Multi-carrier Shipping API + Purplship API - Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services The **proxy** endpoints are stateless and forwards calls to carriers web services. # noqa: E501 + ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.7`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 - OpenAPI spec version: v1-2021.2 + The version of the OpenAPI document: 2021.7 Contact: hello@purplship.com - Generated by: https://github.com/swagger-api/swagger-codegen.git + Generated by: https://openapi-generator.tech """ -from __future__ import absolute_import + +__version__ = "2021.7" + import typing +# import ApiClient +from purplship.api_client import ApiClient + +# import Configuration +from purplship.configuration import Configuration + +# import exceptions +from purplship.exceptions import OpenApiException +from purplship.exceptions import ApiAttributeError +from purplship.exceptions import ApiTypeError +from purplship.exceptions import ApiValueError +from purplship.exceptions import ApiKeyError +from purplship.exceptions import ApiException + # import apis into sdk package from purplship.api.api_api import APIApi from purplship.api.addresses_api import AddressesApi @@ -26,9 +40,6 @@ from purplship.api.shipments_api import ShipmentsApi from purplship.api.trackers_api import TrackersApi from purplship.api.webhooks_api import WebhooksApi -# import ApiClient -from purplship.api_client import ApiClient -from purplship.configuration import Configuration api_key = None diff --git a/purplship/api/__init__.py b/purplship/api/__init__.py index 1919bee..51e6695 100644 --- a/purplship/api/__init__.py +++ b/purplship/api/__init__.py @@ -1,15 +1,3 @@ -from __future__ import absolute_import - -# flake8: noqa - -# import apis into api package -from purplship.api.api_api import APIApi -from purplship.api.addresses_api import AddressesApi -from purplship.api.carriers_api import CarriersApi -from purplship.api.customs_api import CustomsApi -from purplship.api.parcels_api import ParcelsApi -from purplship.api.pickups_api import PickupsApi -from purplship.api.proxy_api import ProxyApi -from purplship.api.shipments_api import ShipmentsApi -from purplship.api.trackers_api import TrackersApi -from purplship.api.webhooks_api import WebhooksApi +# do not import all apis into this module because that uses a lot of memory and stack frames +# if you need the ability to import all apis from one package, import them with +# from purplship.apis import APIApi diff --git a/purplship/api/addresses_api.py b/purplship/api/addresses_api.py index 9daac1d..7bbdcd9 100644 --- a/purplship/api/addresses_api.py +++ b/purplship/api/addresses_api.py @@ -1,30 +1,39 @@ -# coding: utf-8 - """ Purplship API - ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.6.2`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 + ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.7`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 - OpenAPI spec version: 2021.6.2 + The version of the OpenAPI document: 2021.7 Contact: hello@purplship.com - Generated by: https://github.com/swagger-api/swagger-codegen.git + Generated by: https://openapi-generator.tech """ -from __future__ import absolute_import import re # noqa: F401 - -# python 2 and python 3 compatibility library -import six - -from purplship.api_client import ApiClient +import sys # noqa: F401 + +from purplship.api_client import ApiClient, Endpoint as _Endpoint +from purplship.model_utils import ( # noqa: F401 + check_allowed_values, + check_validations, + date, + datetime, + file_type, + none_type, + validate_and_convert_types +) +from purplship.model.address import Address +from purplship.model.address_data import AddressData +from purplship.model.address_list import AddressList +from purplship.model.error_response import ErrorResponse +from purplship.model.operation import Operation class AddressesApi(object): - """NOTE: This class is auto generated by the swagger code generator program. + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech Do not edit the class manually. - Ref: https://github.com/swagger-api/swagger-codegen """ def __init__(self, api_client=None): @@ -32,493 +41,609 @@ def __init__(self, api_client=None): api_client = ApiClient() self.api_client = api_client - def create(self, body, **kwargs): # noqa: E501 - """Create an address # noqa: E501 - - Create a new address. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.create(body, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param AddressData body: (required) - :return: Address - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.create_with_http_info(body, **kwargs) # noqa: E501 - else: - (data) = self.create_with_http_info(body, **kwargs) # noqa: E501 - return data - - def create_with_http_info(self, body, **kwargs): # noqa: E501 - """Create an address # noqa: E501 - - Create a new address. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.create_with_http_info(body, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param AddressData body: (required) - :return: Address - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['body'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method create" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'body' is set - if ('body' not in params or - params['body'] is None): - raise ValueError("Missing the required parameter `body` when calling `create`") # noqa: E501 - - collection_formats = {} - - path_params = {} - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if 'body' in params: - body_params = params['body'] - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['Token'] # noqa: E501 - - return self.api_client.call_api( - '/v1/addresses', 'POST', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='Address', # noqa: E501 - auth_settings=auth_settings, - async_req=params.get('async_req'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def discard(self, id, **kwargs): # noqa: E501 - """Discard an address # noqa: E501 - - Discard an address. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.discard(id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param str id: (required) - :return: Operation - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.discard_with_http_info(id, **kwargs) # noqa: E501 - else: - (data) = self.discard_with_http_info(id, **kwargs) # noqa: E501 - return data - - def discard_with_http_info(self, id, **kwargs): # noqa: E501 - """Discard an address # noqa: E501 - - Discard an address. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.discard_with_http_info(id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param str id: (required) - :return: Operation - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['id'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method discard" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'id' is set - if ('id' not in params or - params['id'] is None): - raise ValueError("Missing the required parameter `id` when calling `discard`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'id' in params: - path_params['id'] = params['id'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['Token'] # noqa: E501 - - return self.api_client.call_api( - '/v1/addresses/{id}', 'DELETE', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='Operation', # noqa: E501 - auth_settings=auth_settings, - async_req=params.get('async_req'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def list(self, **kwargs): # noqa: E501 - """List all addresses # noqa: E501 - - Retrieve all addresses. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.list(async_req=True) - >>> result = thread.get() - - :param async_req bool - :param int limit: Number of results to return per page. - :param int offset: The initial index from which to return the results. - :return: AddressList - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.list_with_http_info(**kwargs) # noqa: E501 - else: - (data) = self.list_with_http_info(**kwargs) # noqa: E501 - return data - - def list_with_http_info(self, **kwargs): # noqa: E501 - """List all addresses # noqa: E501 - - Retrieve all addresses. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.list_with_http_info(async_req=True) - >>> result = thread.get() - - :param async_req bool - :param int limit: Number of results to return per page. - :param int offset: The initial index from which to return the results. - :return: AddressList - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['limit', 'offset'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method list" % key - ) - params[key] = val - del params['kwargs'] - - collection_formats = {} - - path_params = {} - - query_params = [] - if 'limit' in params: - query_params.append(('limit', params['limit'])) # noqa: E501 - if 'offset' in params: - query_params.append(('offset', params['offset'])) # noqa: E501 - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['Token'] # noqa: E501 - - return self.api_client.call_api( - '/v1/addresses', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='AddressList', # noqa: E501 - auth_settings=auth_settings, - async_req=params.get('async_req'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def retrieve(self, id, **kwargs): # noqa: E501 - """Retrieve an address # noqa: E501 - - Retrieve an address. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.retrieve(id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param str id: (required) - :return: Address - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.retrieve_with_http_info(id, **kwargs) # noqa: E501 - else: - (data) = self.retrieve_with_http_info(id, **kwargs) # noqa: E501 - return data - - def retrieve_with_http_info(self, id, **kwargs): # noqa: E501 - """Retrieve an address # noqa: E501 - - Retrieve an address. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.retrieve_with_http_info(id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param str id: (required) - :return: Address - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['id'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method retrieve" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'id' is set - if ('id' not in params or - params['id'] is None): - raise ValueError("Missing the required parameter `id` when calling `retrieve`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'id' in params: - path_params['id'] = params['id'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['Token'] # noqa: E501 - - return self.api_client.call_api( - '/v1/addresses/{id}', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='Address', # noqa: E501 - auth_settings=auth_settings, - async_req=params.get('async_req'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def update(self, body, id, **kwargs): # noqa: E501 - """Update an address # noqa: E501 - - update an address. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.update(body, id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param AddressData body: (required) - :param str id: (required) - :return: Address - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.update_with_http_info(body, id, **kwargs) # noqa: E501 - else: - (data) = self.update_with_http_info(body, id, **kwargs) # noqa: E501 - return data - - def update_with_http_info(self, body, id, **kwargs): # noqa: E501 - """Update an address # noqa: E501 - - update an address. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.update_with_http_info(body, id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param AddressData body: (required) - :param str id: (required) - :return: Address - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['body', 'id'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method update" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'body' is set - if ('body' not in params or - params['body'] is None): - raise ValueError("Missing the required parameter `body` when calling `update`") # noqa: E501 - # verify the required parameter 'id' is set - if ('id' not in params or - params['id'] is None): - raise ValueError("Missing the required parameter `id` when calling `update`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'id' in params: - path_params['id'] = params['id'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if 'body' in params: - body_params = params['body'] - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['Token'] # noqa: E501 - - return self.api_client.call_api( - '/v1/addresses/{id}', 'PATCH', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='Address', # noqa: E501 - auth_settings=auth_settings, - async_req=params.get('async_req'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) + def __create( + self, + data, + **kwargs + ): + """Create an address # noqa: E501 + + Create a new address. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.create(data, async_req=True) + >>> result = thread.get() + + Args: + data (AddressData): + + Keyword Args: + _return_http_data_only (bool): response data without head status + code and headers. Default is True. + _preload_content (bool): if False, the urllib3.HTTPResponse object + will be returned without reading/decoding response data. + Default is True. + _request_timeout (int/float/tuple): timeout setting for this request. If + one number provided, it will be total request timeout. It can also + be a pair (tuple) of (connection, read) timeouts. + Default is None. + _check_input_type (bool): specifies if type checking + should be done one the data sent to the server. + Default is True. + _check_return_type (bool): specifies if type checking + should be done one the data received from the server. + Default is True. + _host_index (int/None): specifies the index of the server + that we want to use. + Default is read from the configuration. + async_req (bool): execute request asynchronously + + Returns: + Address + If the method is called asynchronously, returns the request + thread. + """ + kwargs['async_req'] = kwargs.get( + 'async_req', False + ) + kwargs['_return_http_data_only'] = kwargs.get( + '_return_http_data_only', True + ) + kwargs['_preload_content'] = kwargs.get( + '_preload_content', True + ) + kwargs['_request_timeout'] = kwargs.get( + '_request_timeout', None + ) + kwargs['_check_input_type'] = kwargs.get( + '_check_input_type', True + ) + kwargs['_check_return_type'] = kwargs.get( + '_check_return_type', True + ) + kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['data'] = \ + data + return self.call_with_http_info(**kwargs) + + self.create = _Endpoint( + settings={ + 'response_type': (Address,), + 'auth': [ + 'Token' + ], + 'endpoint_path': '/v1/addresses', + 'operation_id': 'create', + 'http_method': 'POST', + 'servers': None, + }, + params_map={ + 'all': [ + 'data', + ], + 'required': [ + 'data', + ], + 'nullable': [ + ], + 'enum': [ + ], + 'validation': [ + ] + }, + root_map={ + 'validations': { + }, + 'allowed_values': { + }, + 'openapi_types': { + 'data': + (AddressData,), + }, + 'attribute_map': { + }, + 'location_map': { + 'data': 'body', + }, + 'collection_format_map': { + } + }, + headers_map={ + 'accept': [ + 'application/json' + ], + 'content_type': [ + 'application/json' + ] + }, + api_client=api_client, + callable=__create + ) + + def __discard( + self, + id, + **kwargs + ): + """Discard an address # noqa: E501 + + Discard an address. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.discard(id, async_req=True) + >>> result = thread.get() + + Args: + id (str): + + Keyword Args: + _return_http_data_only (bool): response data without head status + code and headers. Default is True. + _preload_content (bool): if False, the urllib3.HTTPResponse object + will be returned without reading/decoding response data. + Default is True. + _request_timeout (int/float/tuple): timeout setting for this request. If + one number provided, it will be total request timeout. It can also + be a pair (tuple) of (connection, read) timeouts. + Default is None. + _check_input_type (bool): specifies if type checking + should be done one the data sent to the server. + Default is True. + _check_return_type (bool): specifies if type checking + should be done one the data received from the server. + Default is True. + _host_index (int/None): specifies the index of the server + that we want to use. + Default is read from the configuration. + async_req (bool): execute request asynchronously + + Returns: + Operation + If the method is called asynchronously, returns the request + thread. + """ + kwargs['async_req'] = kwargs.get( + 'async_req', False + ) + kwargs['_return_http_data_only'] = kwargs.get( + '_return_http_data_only', True + ) + kwargs['_preload_content'] = kwargs.get( + '_preload_content', True + ) + kwargs['_request_timeout'] = kwargs.get( + '_request_timeout', None + ) + kwargs['_check_input_type'] = kwargs.get( + '_check_input_type', True + ) + kwargs['_check_return_type'] = kwargs.get( + '_check_return_type', True + ) + kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['id'] = \ + id + return self.call_with_http_info(**kwargs) + + self.discard = _Endpoint( + settings={ + 'response_type': (Operation,), + 'auth': [ + 'Token' + ], + 'endpoint_path': '/v1/addresses/{id}', + 'operation_id': 'discard', + 'http_method': 'DELETE', + 'servers': None, + }, + params_map={ + 'all': [ + 'id', + ], + 'required': [ + 'id', + ], + 'nullable': [ + ], + 'enum': [ + ], + 'validation': [ + ] + }, + root_map={ + 'validations': { + }, + 'allowed_values': { + }, + 'openapi_types': { + 'id': + (str,), + }, + 'attribute_map': { + 'id': 'id', + }, + 'location_map': { + 'id': 'path', + }, + 'collection_format_map': { + } + }, + headers_map={ + 'accept': [ + 'application/json' + ], + 'content_type': [], + }, + api_client=api_client, + callable=__discard + ) + + def __list( + self, + **kwargs + ): + """List all addresses # noqa: E501 + + Retrieve all addresses. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.list(async_req=True) + >>> result = thread.get() + + + Keyword Args: + limit (int): Number of results to return per page.. [optional] + offset (int): The initial index from which to return the results.. [optional] + _return_http_data_only (bool): response data without head status + code and headers. Default is True. + _preload_content (bool): if False, the urllib3.HTTPResponse object + will be returned without reading/decoding response data. + Default is True. + _request_timeout (int/float/tuple): timeout setting for this request. If + one number provided, it will be total request timeout. It can also + be a pair (tuple) of (connection, read) timeouts. + Default is None. + _check_input_type (bool): specifies if type checking + should be done one the data sent to the server. + Default is True. + _check_return_type (bool): specifies if type checking + should be done one the data received from the server. + Default is True. + _host_index (int/None): specifies the index of the server + that we want to use. + Default is read from the configuration. + async_req (bool): execute request asynchronously + + Returns: + AddressList + If the method is called asynchronously, returns the request + thread. + """ + kwargs['async_req'] = kwargs.get( + 'async_req', False + ) + kwargs['_return_http_data_only'] = kwargs.get( + '_return_http_data_only', True + ) + kwargs['_preload_content'] = kwargs.get( + '_preload_content', True + ) + kwargs['_request_timeout'] = kwargs.get( + '_request_timeout', None + ) + kwargs['_check_input_type'] = kwargs.get( + '_check_input_type', True + ) + kwargs['_check_return_type'] = kwargs.get( + '_check_return_type', True + ) + kwargs['_host_index'] = kwargs.get('_host_index') + return self.call_with_http_info(**kwargs) + + self.list = _Endpoint( + settings={ + 'response_type': (AddressList,), + 'auth': [ + 'Token' + ], + 'endpoint_path': '/v1/addresses', + 'operation_id': 'list', + 'http_method': 'GET', + 'servers': None, + }, + params_map={ + 'all': [ + 'limit', + 'offset', + ], + 'required': [], + 'nullable': [ + ], + 'enum': [ + ], + 'validation': [ + ] + }, + root_map={ + 'validations': { + }, + 'allowed_values': { + }, + 'openapi_types': { + 'limit': + (int,), + 'offset': + (int,), + }, + 'attribute_map': { + 'limit': 'limit', + 'offset': 'offset', + }, + 'location_map': { + 'limit': 'query', + 'offset': 'query', + }, + 'collection_format_map': { + } + }, + headers_map={ + 'accept': [ + 'application/json' + ], + 'content_type': [], + }, + api_client=api_client, + callable=__list + ) + + def __retrieve( + self, + id, + **kwargs + ): + """Retrieve an address # noqa: E501 + + Retrieve an address. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.retrieve(id, async_req=True) + >>> result = thread.get() + + Args: + id (str): + + Keyword Args: + _return_http_data_only (bool): response data without head status + code and headers. Default is True. + _preload_content (bool): if False, the urllib3.HTTPResponse object + will be returned without reading/decoding response data. + Default is True. + _request_timeout (int/float/tuple): timeout setting for this request. If + one number provided, it will be total request timeout. It can also + be a pair (tuple) of (connection, read) timeouts. + Default is None. + _check_input_type (bool): specifies if type checking + should be done one the data sent to the server. + Default is True. + _check_return_type (bool): specifies if type checking + should be done one the data received from the server. + Default is True. + _host_index (int/None): specifies the index of the server + that we want to use. + Default is read from the configuration. + async_req (bool): execute request asynchronously + + Returns: + Address + If the method is called asynchronously, returns the request + thread. + """ + kwargs['async_req'] = kwargs.get( + 'async_req', False + ) + kwargs['_return_http_data_only'] = kwargs.get( + '_return_http_data_only', True + ) + kwargs['_preload_content'] = kwargs.get( + '_preload_content', True + ) + kwargs['_request_timeout'] = kwargs.get( + '_request_timeout', None + ) + kwargs['_check_input_type'] = kwargs.get( + '_check_input_type', True + ) + kwargs['_check_return_type'] = kwargs.get( + '_check_return_type', True + ) + kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['id'] = \ + id + return self.call_with_http_info(**kwargs) + + self.retrieve = _Endpoint( + settings={ + 'response_type': (Address,), + 'auth': [ + 'Token' + ], + 'endpoint_path': '/v1/addresses/{id}', + 'operation_id': 'retrieve', + 'http_method': 'GET', + 'servers': None, + }, + params_map={ + 'all': [ + 'id', + ], + 'required': [ + 'id', + ], + 'nullable': [ + ], + 'enum': [ + ], + 'validation': [ + ] + }, + root_map={ + 'validations': { + }, + 'allowed_values': { + }, + 'openapi_types': { + 'id': + (str,), + }, + 'attribute_map': { + 'id': 'id', + }, + 'location_map': { + 'id': 'path', + }, + 'collection_format_map': { + } + }, + headers_map={ + 'accept': [ + 'application/json' + ], + 'content_type': [], + }, + api_client=api_client, + callable=__retrieve + ) + + def __update( + self, + id, + data, + **kwargs + ): + """Update an address # noqa: E501 + + update an address. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.update(id, data, async_req=True) + >>> result = thread.get() + + Args: + id (str): + data (AddressData): + + Keyword Args: + _return_http_data_only (bool): response data without head status + code and headers. Default is True. + _preload_content (bool): if False, the urllib3.HTTPResponse object + will be returned without reading/decoding response data. + Default is True. + _request_timeout (int/float/tuple): timeout setting for this request. If + one number provided, it will be total request timeout. It can also + be a pair (tuple) of (connection, read) timeouts. + Default is None. + _check_input_type (bool): specifies if type checking + should be done one the data sent to the server. + Default is True. + _check_return_type (bool): specifies if type checking + should be done one the data received from the server. + Default is True. + _host_index (int/None): specifies the index of the server + that we want to use. + Default is read from the configuration. + async_req (bool): execute request asynchronously + + Returns: + Address + If the method is called asynchronously, returns the request + thread. + """ + kwargs['async_req'] = kwargs.get( + 'async_req', False + ) + kwargs['_return_http_data_only'] = kwargs.get( + '_return_http_data_only', True + ) + kwargs['_preload_content'] = kwargs.get( + '_preload_content', True + ) + kwargs['_request_timeout'] = kwargs.get( + '_request_timeout', None + ) + kwargs['_check_input_type'] = kwargs.get( + '_check_input_type', True + ) + kwargs['_check_return_type'] = kwargs.get( + '_check_return_type', True + ) + kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['id'] = \ + id + kwargs['data'] = \ + data + return self.call_with_http_info(**kwargs) + + self.update = _Endpoint( + settings={ + 'response_type': (Address,), + 'auth': [ + 'Token' + ], + 'endpoint_path': '/v1/addresses/{id}', + 'operation_id': 'update', + 'http_method': 'PATCH', + 'servers': None, + }, + params_map={ + 'all': [ + 'id', + 'data', + ], + 'required': [ + 'id', + 'data', + ], + 'nullable': [ + ], + 'enum': [ + ], + 'validation': [ + ] + }, + root_map={ + 'validations': { + }, + 'allowed_values': { + }, + 'openapi_types': { + 'id': + (str,), + 'data': + (AddressData,), + }, + 'attribute_map': { + 'id': 'id', + }, + 'location_map': { + 'id': 'path', + 'data': 'body', + }, + 'collection_format_map': { + } + }, + headers_map={ + 'accept': [ + 'application/json' + ], + 'content_type': [ + 'application/json' + ] + }, + api_client=api_client, + callable=__update + ) diff --git a/purplship/api/api_api.py b/purplship/api/api_api.py index f8b4c87..fd70329 100644 --- a/purplship/api/api_api.py +++ b/purplship/api/api_api.py @@ -1,30 +1,40 @@ -# coding: utf-8 - """ Purplship API - ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.6.2`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 + ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.7`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 - OpenAPI spec version: 2021.6.2 + The version of the OpenAPI document: 2021.7 Contact: hello@purplship.com - Generated by: https://github.com/swagger-api/swagger-codegen.git + Generated by: https://openapi-generator.tech """ -from __future__ import absolute_import import re # noqa: F401 - -# python 2 and python 3 compatibility library -import six - -from purplship.api_client import ApiClient +import sys # noqa: F401 + +from purplship.api_client import ApiClient, Endpoint as _Endpoint +from purplship.model_utils import ( # noqa: F401 + check_allowed_values, + check_validations, + date, + datetime, + file_type, + none_type, + validate_and_convert_types +) +from purplship.model.access_token import AccessToken +from purplship.model.references import References +from purplship.model.token_obtain_pair import TokenObtainPair +from purplship.model.token_pair import TokenPair +from purplship.model.token_refresh import TokenRefresh +from purplship.model.token_verify import TokenVerify class APIApi(object): - """NOTE: This class is auto generated by the swagger code generator program. + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech Do not edit the class manually. - Ref: https://github.com/swagger-api/swagger-codegen """ def __init__(self, api_client=None): @@ -32,384 +42,468 @@ def __init__(self, api_client=None): api_client = ApiClient() self.api_client = api_client - def authenticate(self, body, **kwargs): # noqa: E501 - """Obtain auth token pair # noqa: E501 - - Authenticate the user and return a token pair # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.authenticate(body, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param TokenObtainPair body: (required) - :return: TokenPair - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.authenticate_with_http_info(body, **kwargs) # noqa: E501 - else: - (data) = self.authenticate_with_http_info(body, **kwargs) # noqa: E501 - return data - - def authenticate_with_http_info(self, body, **kwargs): # noqa: E501 - """Obtain auth token pair # noqa: E501 - - Authenticate the user and return a token pair # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.authenticate_with_http_info(body, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param TokenObtainPair body: (required) - :return: TokenPair - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['body'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method authenticate" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'body' is set - if ('body' not in params or - params['body'] is None): - raise ValueError("Missing the required parameter `body` when calling `authenticate`") # noqa: E501 - - collection_formats = {} - - path_params = {} - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if 'body' in params: - body_params = params['body'] - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['Token'] # noqa: E501 - - return self.api_client.call_api( - '/api/token', 'POST', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='TokenPair', # noqa: E501 - auth_settings=auth_settings, - async_req=params.get('async_req'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def data(self, **kwargs): # noqa: E501 - """Data References # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.data(async_req=True) - >>> result = thread.get() - - :param async_req bool - :return: References - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.data_with_http_info(**kwargs) # noqa: E501 - else: - (data) = self.data_with_http_info(**kwargs) # noqa: E501 - return data - - def data_with_http_info(self, **kwargs): # noqa: E501 - """Data References # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.data_with_http_info(async_req=True) - >>> result = thread.get() - - :param async_req bool - :return: References - If the method is called asynchronously, - returns the request thread. - """ - - all_params = [] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method data" % key - ) - params[key] = val - del params['kwargs'] - - collection_formats = {} - - path_params = {} - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['Token'] # noqa: E501 - - return self.api_client.call_api( - '/v1/references', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='References', # noqa: E501 - auth_settings=auth_settings, - async_req=params.get('async_req'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def refresh_token(self, body, **kwargs): # noqa: E501 - """Refresh auth token # noqa: E501 - - Authenticate the user and return a token pair # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.refresh_token(body, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param TokenRefresh body: (required) - :return: AccessToken - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.refresh_token_with_http_info(body, **kwargs) # noqa: E501 - else: - (data) = self.refresh_token_with_http_info(body, **kwargs) # noqa: E501 - return data - - def refresh_token_with_http_info(self, body, **kwargs): # noqa: E501 - """Refresh auth token # noqa: E501 - - Authenticate the user and return a token pair # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.refresh_token_with_http_info(body, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param TokenRefresh body: (required) - :return: AccessToken - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['body'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method refresh_token" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'body' is set - if ('body' not in params or - params['body'] is None): - raise ValueError("Missing the required parameter `body` when calling `refresh_token`") # noqa: E501 - - collection_formats = {} - - path_params = {} - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if 'body' in params: - body_params = params['body'] - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['Token'] # noqa: E501 - - return self.api_client.call_api( - '/api/token/refresh', 'POST', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='AccessToken', # noqa: E501 - auth_settings=auth_settings, - async_req=params.get('async_req'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def verify_token(self, body, **kwargs): # noqa: E501 - """Verify auth token # noqa: E501 - - Verify an existent authentication token # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.verify_token(body, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param TokenVerify body: (required) - :return: dict(str, object) - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.verify_token_with_http_info(body, **kwargs) # noqa: E501 - else: - (data) = self.verify_token_with_http_info(body, **kwargs) # noqa: E501 - return data - - def verify_token_with_http_info(self, body, **kwargs): # noqa: E501 - """Verify auth token # noqa: E501 - - Verify an existent authentication token # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.verify_token_with_http_info(body, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param TokenVerify body: (required) - :return: dict(str, object) - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['body'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method verify_token" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'body' is set - if ('body' not in params or - params['body'] is None): - raise ValueError("Missing the required parameter `body` when calling `verify_token`") # noqa: E501 - - collection_formats = {} - - path_params = {} - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if 'body' in params: - body_params = params['body'] - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['Token'] # noqa: E501 - - return self.api_client.call_api( - '/api/token/verify', 'POST', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='dict(str, object)', # noqa: E501 - auth_settings=auth_settings, - async_req=params.get('async_req'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) + def __authenticate( + self, + data, + **kwargs + ): + """Obtain auth token pair # noqa: E501 + + Authenticate the user and return a token pair # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.authenticate(data, async_req=True) + >>> result = thread.get() + + Args: + data (TokenObtainPair): + + Keyword Args: + _return_http_data_only (bool): response data without head status + code and headers. Default is True. + _preload_content (bool): if False, the urllib3.HTTPResponse object + will be returned without reading/decoding response data. + Default is True. + _request_timeout (int/float/tuple): timeout setting for this request. If + one number provided, it will be total request timeout. It can also + be a pair (tuple) of (connection, read) timeouts. + Default is None. + _check_input_type (bool): specifies if type checking + should be done one the data sent to the server. + Default is True. + _check_return_type (bool): specifies if type checking + should be done one the data received from the server. + Default is True. + _host_index (int/None): specifies the index of the server + that we want to use. + Default is read from the configuration. + async_req (bool): execute request asynchronously + + Returns: + TokenPair + If the method is called asynchronously, returns the request + thread. + """ + kwargs['async_req'] = kwargs.get( + 'async_req', False + ) + kwargs['_return_http_data_only'] = kwargs.get( + '_return_http_data_only', True + ) + kwargs['_preload_content'] = kwargs.get( + '_preload_content', True + ) + kwargs['_request_timeout'] = kwargs.get( + '_request_timeout', None + ) + kwargs['_check_input_type'] = kwargs.get( + '_check_input_type', True + ) + kwargs['_check_return_type'] = kwargs.get( + '_check_return_type', True + ) + kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['data'] = \ + data + return self.call_with_http_info(**kwargs) + + self.authenticate = _Endpoint( + settings={ + 'response_type': (TokenPair,), + 'auth': [ + 'Token' + ], + 'endpoint_path': '/api/token', + 'operation_id': 'authenticate', + 'http_method': 'POST', + 'servers': None, + }, + params_map={ + 'all': [ + 'data', + ], + 'required': [ + 'data', + ], + 'nullable': [ + ], + 'enum': [ + ], + 'validation': [ + ] + }, + root_map={ + 'validations': { + }, + 'allowed_values': { + }, + 'openapi_types': { + 'data': + (TokenObtainPair,), + }, + 'attribute_map': { + }, + 'location_map': { + 'data': 'body', + }, + 'collection_format_map': { + } + }, + headers_map={ + 'accept': [ + 'application/json' + ], + 'content_type': [ + 'application/json' + ] + }, + api_client=api_client, + callable=__authenticate + ) + + def __data( + self, + **kwargs + ): + """Data References # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.data(async_req=True) + >>> result = thread.get() + + + Keyword Args: + _return_http_data_only (bool): response data without head status + code and headers. Default is True. + _preload_content (bool): if False, the urllib3.HTTPResponse object + will be returned without reading/decoding response data. + Default is True. + _request_timeout (int/float/tuple): timeout setting for this request. If + one number provided, it will be total request timeout. It can also + be a pair (tuple) of (connection, read) timeouts. + Default is None. + _check_input_type (bool): specifies if type checking + should be done one the data sent to the server. + Default is True. + _check_return_type (bool): specifies if type checking + should be done one the data received from the server. + Default is True. + _host_index (int/None): specifies the index of the server + that we want to use. + Default is read from the configuration. + async_req (bool): execute request asynchronously + + Returns: + References + If the method is called asynchronously, returns the request + thread. + """ + kwargs['async_req'] = kwargs.get( + 'async_req', False + ) + kwargs['_return_http_data_only'] = kwargs.get( + '_return_http_data_only', True + ) + kwargs['_preload_content'] = kwargs.get( + '_preload_content', True + ) + kwargs['_request_timeout'] = kwargs.get( + '_request_timeout', None + ) + kwargs['_check_input_type'] = kwargs.get( + '_check_input_type', True + ) + kwargs['_check_return_type'] = kwargs.get( + '_check_return_type', True + ) + kwargs['_host_index'] = kwargs.get('_host_index') + return self.call_with_http_info(**kwargs) + + self.data = _Endpoint( + settings={ + 'response_type': (References,), + 'auth': [ + 'Token' + ], + 'endpoint_path': '/v1/references', + 'operation_id': 'data', + 'http_method': 'GET', + 'servers': None, + }, + params_map={ + 'all': [ + ], + 'required': [], + 'nullable': [ + ], + 'enum': [ + ], + 'validation': [ + ] + }, + root_map={ + 'validations': { + }, + 'allowed_values': { + }, + 'openapi_types': { + }, + 'attribute_map': { + }, + 'location_map': { + }, + 'collection_format_map': { + } + }, + headers_map={ + 'accept': [ + 'application/json' + ], + 'content_type': [], + }, + api_client=api_client, + callable=__data + ) + + def __refresh_token( + self, + data, + **kwargs + ): + """Refresh auth token # noqa: E501 + + Authenticate the user and return a token pair # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.refresh_token(data, async_req=True) + >>> result = thread.get() + + Args: + data (TokenRefresh): + + Keyword Args: + _return_http_data_only (bool): response data without head status + code and headers. Default is True. + _preload_content (bool): if False, the urllib3.HTTPResponse object + will be returned without reading/decoding response data. + Default is True. + _request_timeout (int/float/tuple): timeout setting for this request. If + one number provided, it will be total request timeout. It can also + be a pair (tuple) of (connection, read) timeouts. + Default is None. + _check_input_type (bool): specifies if type checking + should be done one the data sent to the server. + Default is True. + _check_return_type (bool): specifies if type checking + should be done one the data received from the server. + Default is True. + _host_index (int/None): specifies the index of the server + that we want to use. + Default is read from the configuration. + async_req (bool): execute request asynchronously + + Returns: + AccessToken + If the method is called asynchronously, returns the request + thread. + """ + kwargs['async_req'] = kwargs.get( + 'async_req', False + ) + kwargs['_return_http_data_only'] = kwargs.get( + '_return_http_data_only', True + ) + kwargs['_preload_content'] = kwargs.get( + '_preload_content', True + ) + kwargs['_request_timeout'] = kwargs.get( + '_request_timeout', None + ) + kwargs['_check_input_type'] = kwargs.get( + '_check_input_type', True + ) + kwargs['_check_return_type'] = kwargs.get( + '_check_return_type', True + ) + kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['data'] = \ + data + return self.call_with_http_info(**kwargs) + + self.refresh_token = _Endpoint( + settings={ + 'response_type': (AccessToken,), + 'auth': [ + 'Token' + ], + 'endpoint_path': '/api/token/refresh', + 'operation_id': 'refresh_token', + 'http_method': 'POST', + 'servers': None, + }, + params_map={ + 'all': [ + 'data', + ], + 'required': [ + 'data', + ], + 'nullable': [ + ], + 'enum': [ + ], + 'validation': [ + ] + }, + root_map={ + 'validations': { + }, + 'allowed_values': { + }, + 'openapi_types': { + 'data': + (TokenRefresh,), + }, + 'attribute_map': { + }, + 'location_map': { + 'data': 'body', + }, + 'collection_format_map': { + } + }, + headers_map={ + 'accept': [ + 'application/json' + ], + 'content_type': [ + 'application/json' + ] + }, + api_client=api_client, + callable=__refresh_token + ) + + def __verify_token( + self, + data, + **kwargs + ): + """Verify auth token # noqa: E501 + + Verify an existent authentication token # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.verify_token(data, async_req=True) + >>> result = thread.get() + + Args: + data (TokenVerify): + + Keyword Args: + _return_http_data_only (bool): response data without head status + code and headers. Default is True. + _preload_content (bool): if False, the urllib3.HTTPResponse object + will be returned without reading/decoding response data. + Default is True. + _request_timeout (int/float/tuple): timeout setting for this request. If + one number provided, it will be total request timeout. It can also + be a pair (tuple) of (connection, read) timeouts. + Default is None. + _check_input_type (bool): specifies if type checking + should be done one the data sent to the server. + Default is True. + _check_return_type (bool): specifies if type checking + should be done one the data received from the server. + Default is True. + _host_index (int/None): specifies the index of the server + that we want to use. + Default is read from the configuration. + async_req (bool): execute request asynchronously + + Returns: + {str: ({str: (bool, date, datetime, dict, float, int, list, str, none_type)},)} + If the method is called asynchronously, returns the request + thread. + """ + kwargs['async_req'] = kwargs.get( + 'async_req', False + ) + kwargs['_return_http_data_only'] = kwargs.get( + '_return_http_data_only', True + ) + kwargs['_preload_content'] = kwargs.get( + '_preload_content', True + ) + kwargs['_request_timeout'] = kwargs.get( + '_request_timeout', None + ) + kwargs['_check_input_type'] = kwargs.get( + '_check_input_type', True + ) + kwargs['_check_return_type'] = kwargs.get( + '_check_return_type', True + ) + kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['data'] = \ + data + return self.call_with_http_info(**kwargs) + + self.verify_token = _Endpoint( + settings={ + 'response_type': ({str: ({str: (bool, date, datetime, dict, float, int, list, str, none_type)},)},), + 'auth': [ + 'Token' + ], + 'endpoint_path': '/api/token/verify', + 'operation_id': 'verify_token', + 'http_method': 'POST', + 'servers': None, + }, + params_map={ + 'all': [ + 'data', + ], + 'required': [ + 'data', + ], + 'nullable': [ + ], + 'enum': [ + ], + 'validation': [ + ] + }, + root_map={ + 'validations': { + }, + 'allowed_values': { + }, + 'openapi_types': { + 'data': + (TokenVerify,), + }, + 'attribute_map': { + }, + 'location_map': { + 'data': 'body', + }, + 'collection_format_map': { + } + }, + headers_map={ + 'accept': [ + 'application/json' + ], + 'content_type': [ + 'application/json' + ] + }, + api_client=api_client, + callable=__verify_token + ) diff --git a/purplship/api/carriers_api.py b/purplship/api/carriers_api.py index 00fa95b..a0cc590 100644 --- a/purplship/api/carriers_api.py +++ b/purplship/api/carriers_api.py @@ -1,30 +1,36 @@ -# coding: utf-8 - """ Purplship API - ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.6.2`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 + ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.7`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 - OpenAPI spec version: 2021.6.2 + The version of the OpenAPI document: 2021.7 Contact: hello@purplship.com - Generated by: https://github.com/swagger-api/swagger-codegen.git + Generated by: https://openapi-generator.tech """ -from __future__ import absolute_import import re # noqa: F401 - -# python 2 and python 3 compatibility library -import six - -from purplship.api_client import ApiClient +import sys # noqa: F401 + +from purplship.api_client import ApiClient, Endpoint as _Endpoint +from purplship.model_utils import ( # noqa: F401 + check_allowed_values, + check_validations, + date, + datetime, + file_type, + none_type, + validate_and_convert_types +) +from purplship.model.carrier_list import CarrierList +from purplship.model.error_response import ErrorResponse class CarriersApi(object): - """NOTE: This class is auto generated by the swagger code generator program. + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech Do not edit the class manually. - Ref: https://github.com/swagger-api/swagger-codegen """ def __init__(self, api_client=None): @@ -32,113 +38,172 @@ def __init__(self, api_client=None): api_client = ApiClient() self.api_client = api_client - def list(self, **kwargs): # noqa: E501 - """List all carriers # noqa: E501 - - Returns the list of configured carriers # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.list(async_req=True) - >>> result = thread.get() - - :param async_req bool - :param int limit: Number of results to return per page. - :param int offset: The initial index from which to return the results. - :param str carrier_name: Indicates a carrier (type) - :param bool test: This flag filter out carriers in test or prod mode - :param bool active: This flag indicates whether to return active carriers only - :param bool system_only: This flag indicates that only system carriers should be returned - :return: CarrierList - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.list_with_http_info(**kwargs) # noqa: E501 - else: - (data) = self.list_with_http_info(**kwargs) # noqa: E501 - return data - - def list_with_http_info(self, **kwargs): # noqa: E501 - """List all carriers # noqa: E501 - - Returns the list of configured carriers # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.list_with_http_info(async_req=True) - >>> result = thread.get() - - :param async_req bool - :param int limit: Number of results to return per page. - :param int offset: The initial index from which to return the results. - :param str carrier_name: Indicates a carrier (type) - :param bool test: This flag filter out carriers in test or prod mode - :param bool active: This flag indicates whether to return active carriers only - :param bool system_only: This flag indicates that only system carriers should be returned - :return: CarrierList - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['limit', 'offset', 'carrier_name', 'test', 'active', 'system_only'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method list" % key - ) - params[key] = val - del params['kwargs'] - - collection_formats = {} - - path_params = {} - - query_params = [] - if 'limit' in params: - query_params.append(('limit', params['limit'])) # noqa: E501 - if 'offset' in params: - query_params.append(('offset', params['offset'])) # noqa: E501 - if 'carrier_name' in params: - query_params.append(('carrier_name', params['carrier_name'])) # noqa: E501 - if 'test' in params: - query_params.append(('test', params['test'])) # noqa: E501 - if 'active' in params: - query_params.append(('active', params['active'])) # noqa: E501 - if 'system_only' in params: - query_params.append(('system_only', params['system_only'])) # noqa: E501 - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['Token'] # noqa: E501 - - return self.api_client.call_api( - '/v1/carriers', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='CarrierList', # noqa: E501 - auth_settings=auth_settings, - async_req=params.get('async_req'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) + def __list( + self, + **kwargs + ): + """List all carriers # noqa: E501 + + Returns the list of configured carriers # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.list(async_req=True) + >>> result = thread.get() + + + Keyword Args: + limit (int): Number of results to return per page.. [optional] + offset (int): The initial index from which to return the results.. [optional] + carrier_name (str): Indicates a carrier (type). [optional] + test (bool, none_type): This flag filter out carriers in test or prod mode. [optional] + active (bool, none_type): This flag indicates whether to return active carriers only. [optional] + system_only (bool, none_type): This flag indicates that only system carriers should be returned. [optional] if omitted the server will use the default value of False + _return_http_data_only (bool): response data without head status + code and headers. Default is True. + _preload_content (bool): if False, the urllib3.HTTPResponse object + will be returned without reading/decoding response data. + Default is True. + _request_timeout (int/float/tuple): timeout setting for this request. If + one number provided, it will be total request timeout. It can also + be a pair (tuple) of (connection, read) timeouts. + Default is None. + _check_input_type (bool): specifies if type checking + should be done one the data sent to the server. + Default is True. + _check_return_type (bool): specifies if type checking + should be done one the data received from the server. + Default is True. + _host_index (int/None): specifies the index of the server + that we want to use. + Default is read from the configuration. + async_req (bool): execute request asynchronously + + Returns: + CarrierList + If the method is called asynchronously, returns the request + thread. + """ + kwargs['async_req'] = kwargs.get( + 'async_req', False + ) + kwargs['_return_http_data_only'] = kwargs.get( + '_return_http_data_only', True + ) + kwargs['_preload_content'] = kwargs.get( + '_preload_content', True + ) + kwargs['_request_timeout'] = kwargs.get( + '_request_timeout', None + ) + kwargs['_check_input_type'] = kwargs.get( + '_check_input_type', True + ) + kwargs['_check_return_type'] = kwargs.get( + '_check_return_type', True + ) + kwargs['_host_index'] = kwargs.get('_host_index') + return self.call_with_http_info(**kwargs) + + self.list = _Endpoint( + settings={ + 'response_type': (CarrierList,), + 'auth': [ + 'Token' + ], + 'endpoint_path': '/v1/carriers', + 'operation_id': 'list', + 'http_method': 'GET', + 'servers': None, + }, + params_map={ + 'all': [ + 'limit', + 'offset', + 'carrier_name', + 'test', + 'active', + 'system_only', + ], + 'required': [], + 'nullable': [ + 'test', + 'active', + 'system_only', + ], + 'enum': [ + 'carrier_name', + ], + 'validation': [ + ] + }, + root_map={ + 'validations': { + }, + 'allowed_values': { + ('carrier_name',): { + + "ARAMEX": "aramex", + "AUSTRALIAPOST": "australiapost", + "CANADAPOST": "canadapost", + "CANPAR": "canpar", + "DHL_EXPRESS": "dhl_express", + "DHL_UNIVERSAL": "dhl_universal", + "DICOM": "dicom", + "ESHIPPER": "eshipper", + "FEDEX": "fedex", + "FREIGHTCOM": "freightcom", + "PUROLATOR": "purolator", + "ROYALMAIL": "royalmail", + "SENDLE": "sendle", + "SF_EXPRESS": "sf_express", + "TNT": "tnt", + "UPS": "ups", + "USPS": "usps", + "USPS_INTERNATIONAL": "usps_international", + "YANWEN": "yanwen", + "YUNEXPRESS": "yunexpress" + }, + }, + 'openapi_types': { + 'limit': + (int,), + 'offset': + (int,), + 'carrier_name': + (str,), + 'test': + (bool, none_type,), + 'active': + (bool, none_type,), + 'system_only': + (bool, none_type,), + }, + 'attribute_map': { + 'limit': 'limit', + 'offset': 'offset', + 'carrier_name': 'carrier_name', + 'test': 'test', + 'active': 'active', + 'system_only': 'system_only', + }, + 'location_map': { + 'limit': 'query', + 'offset': 'query', + 'carrier_name': 'query', + 'test': 'query', + 'active': 'query', + 'system_only': 'query', + }, + 'collection_format_map': { + } + }, + headers_map={ + 'accept': [ + 'application/json' + ], + 'content_type': [], + }, + api_client=api_client, + callable=__list + ) diff --git a/purplship/api/customs_api.py b/purplship/api/customs_api.py index 55d8ac2..814c2f0 100644 --- a/purplship/api/customs_api.py +++ b/purplship/api/customs_api.py @@ -1,30 +1,40 @@ -# coding: utf-8 - """ Purplship API - ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.6.2`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 + ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.7`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 - OpenAPI spec version: 2021.6.2 + The version of the OpenAPI document: 2021.7 Contact: hello@purplship.com - Generated by: https://github.com/swagger-api/swagger-codegen.git + Generated by: https://openapi-generator.tech """ -from __future__ import absolute_import import re # noqa: F401 - -# python 2 and python 3 compatibility library -import six - -from purplship.api_client import ApiClient +import sys # noqa: F401 + +from purplship.api_client import ApiClient, Endpoint as _Endpoint +from purplship.model_utils import ( # noqa: F401 + check_allowed_values, + check_validations, + date, + datetime, + file_type, + none_type, + validate_and_convert_types +) +from purplship.model.commodity_data import CommodityData +from purplship.model.customs import Customs +from purplship.model.customs_data import CustomsData +from purplship.model.customs_list import CustomsList +from purplship.model.error_response import ErrorResponse +from purplship.model.operation import Operation class CustomsApi(object): - """NOTE: This class is auto generated by the swagger code generator program. + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech Do not edit the class manually. - Ref: https://github.com/swagger-api/swagger-codegen """ def __init__(self, api_client=None): @@ -32,703 +42,868 @@ def __init__(self, api_client=None): api_client = ApiClient() self.api_client = api_client - def add_commodity(self, body, id, **kwargs): # noqa: E501 - """Add a commodity # noqa: E501 - - Add a customs commodity. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.add_commodity(body, id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param CommodityData body: (required) - :param str id: (required) - :return: Customs - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.add_commodity_with_http_info(body, id, **kwargs) # noqa: E501 - else: - (data) = self.add_commodity_with_http_info(body, id, **kwargs) # noqa: E501 - return data - - def add_commodity_with_http_info(self, body, id, **kwargs): # noqa: E501 - """Add a commodity # noqa: E501 - - Add a customs commodity. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.add_commodity_with_http_info(body, id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param CommodityData body: (required) - :param str id: (required) - :return: Customs - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['body', 'id'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method add_commodity" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'body' is set - if ('body' not in params or - params['body'] is None): - raise ValueError("Missing the required parameter `body` when calling `add_commodity`") # noqa: E501 - # verify the required parameter 'id' is set - if ('id' not in params or - params['id'] is None): - raise ValueError("Missing the required parameter `id` when calling `add_commodity`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'id' in params: - path_params['id'] = params['id'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if 'body' in params: - body_params = params['body'] - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['Token'] # noqa: E501 - - return self.api_client.call_api( - '/v1/customs_info/{id}/commodities', 'POST', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='Customs', # noqa: E501 - auth_settings=auth_settings, - async_req=params.get('async_req'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def create(self, body, **kwargs): # noqa: E501 - """Create a customs info # noqa: E501 - - Create a new customs declaration. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.create(body, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param CustomsData body: (required) - :return: Customs - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.create_with_http_info(body, **kwargs) # noqa: E501 - else: - (data) = self.create_with_http_info(body, **kwargs) # noqa: E501 - return data - - def create_with_http_info(self, body, **kwargs): # noqa: E501 - """Create a customs info # noqa: E501 - - Create a new customs declaration. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.create_with_http_info(body, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param CustomsData body: (required) - :return: Customs - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['body'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method create" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'body' is set - if ('body' not in params or - params['body'] is None): - raise ValueError("Missing the required parameter `body` when calling `create`") # noqa: E501 - - collection_formats = {} - - path_params = {} - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if 'body' in params: - body_params = params['body'] - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['Token'] # noqa: E501 - - return self.api_client.call_api( - '/v1/customs_info', 'POST', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='Customs', # noqa: E501 - auth_settings=auth_settings, - async_req=params.get('async_req'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def discard(self, id, **kwargs): # noqa: E501 - """Discard a customs info # noqa: E501 - - Discard a customs declaration. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.discard(id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param str id: (required) - :return: Operation - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.discard_with_http_info(id, **kwargs) # noqa: E501 - else: - (data) = self.discard_with_http_info(id, **kwargs) # noqa: E501 - return data - - def discard_with_http_info(self, id, **kwargs): # noqa: E501 - """Discard a customs info # noqa: E501 - - Discard a customs declaration. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.discard_with_http_info(id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param str id: (required) - :return: Operation - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['id'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method discard" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'id' is set - if ('id' not in params or - params['id'] is None): - raise ValueError("Missing the required parameter `id` when calling `discard`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'id' in params: - path_params['id'] = params['id'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['Token'] # noqa: E501 - - return self.api_client.call_api( - '/v1/customs_info/{id}', 'DELETE', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='Operation', # noqa: E501 - auth_settings=auth_settings, - async_req=params.get('async_req'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def discard_commodity(self, ck, id, **kwargs): # noqa: E501 - """Discard a commodity # noqa: E501 - - Discard a customs commodity. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.discard_commodity(ck, id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param str ck: (required) - :param str id: (required) - :return: Operation - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.discard_commodity_with_http_info(ck, id, **kwargs) # noqa: E501 - else: - (data) = self.discard_commodity_with_http_info(ck, id, **kwargs) # noqa: E501 - return data - - def discard_commodity_with_http_info(self, ck, id, **kwargs): # noqa: E501 - """Discard a commodity # noqa: E501 - - Discard a customs commodity. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.discard_commodity_with_http_info(ck, id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param str ck: (required) - :param str id: (required) - :return: Operation - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['ck', 'id'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method discard_commodity" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'ck' is set - if ('ck' not in params or - params['ck'] is None): - raise ValueError("Missing the required parameter `ck` when calling `discard_commodity`") # noqa: E501 - # verify the required parameter 'id' is set - if ('id' not in params or - params['id'] is None): - raise ValueError("Missing the required parameter `id` when calling `discard_commodity`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'ck' in params: - path_params['ck'] = params['ck'] # noqa: E501 - if 'id' in params: - path_params['id'] = params['id'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['Token'] # noqa: E501 - - return self.api_client.call_api( - '/v1/customs_info/{id}/commodities/{ck}', 'DELETE', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='Operation', # noqa: E501 - auth_settings=auth_settings, - async_req=params.get('async_req'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def list(self, **kwargs): # noqa: E501 - """List all customs info # noqa: E501 - - Retrieve all stored customs declarations. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.list(async_req=True) - >>> result = thread.get() - - :param async_req bool - :param int limit: Number of results to return per page. - :param int offset: The initial index from which to return the results. - :return: CustomsList - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.list_with_http_info(**kwargs) # noqa: E501 - else: - (data) = self.list_with_http_info(**kwargs) # noqa: E501 - return data - - def list_with_http_info(self, **kwargs): # noqa: E501 - """List all customs info # noqa: E501 - - Retrieve all stored customs declarations. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.list_with_http_info(async_req=True) - >>> result = thread.get() - - :param async_req bool - :param int limit: Number of results to return per page. - :param int offset: The initial index from which to return the results. - :return: CustomsList - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['limit', 'offset'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method list" % key - ) - params[key] = val - del params['kwargs'] - - collection_formats = {} - - path_params = {} - - query_params = [] - if 'limit' in params: - query_params.append(('limit', params['limit'])) # noqa: E501 - if 'offset' in params: - query_params.append(('offset', params['offset'])) # noqa: E501 - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['Token'] # noqa: E501 - - return self.api_client.call_api( - '/v1/customs_info', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='CustomsList', # noqa: E501 - auth_settings=auth_settings, - async_req=params.get('async_req'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def retrieve(self, id, **kwargs): # noqa: E501 - """Retrieve a customs info # noqa: E501 - - Retrieve customs declaration. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.retrieve(id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param str id: (required) - :return: Customs - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.retrieve_with_http_info(id, **kwargs) # noqa: E501 - else: - (data) = self.retrieve_with_http_info(id, **kwargs) # noqa: E501 - return data - - def retrieve_with_http_info(self, id, **kwargs): # noqa: E501 - """Retrieve a customs info # noqa: E501 - - Retrieve customs declaration. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.retrieve_with_http_info(id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param str id: (required) - :return: Customs - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['id'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method retrieve" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'id' is set - if ('id' not in params or - params['id'] is None): - raise ValueError("Missing the required parameter `id` when calling `retrieve`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'id' in params: - path_params['id'] = params['id'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['Token'] # noqa: E501 - - return self.api_client.call_api( - '/v1/customs_info/{id}', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='Customs', # noqa: E501 - auth_settings=auth_settings, - async_req=params.get('async_req'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def update(self, body, id, **kwargs): # noqa: E501 - """Update a customs info # noqa: E501 - - modify an existing customs declaration. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.update(body, id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param CustomsData body: (required) - :param str id: (required) - :return: Customs - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.update_with_http_info(body, id, **kwargs) # noqa: E501 - else: - (data) = self.update_with_http_info(body, id, **kwargs) # noqa: E501 - return data - - def update_with_http_info(self, body, id, **kwargs): # noqa: E501 - """Update a customs info # noqa: E501 - - modify an existing customs declaration. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.update_with_http_info(body, id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param CustomsData body: (required) - :param str id: (required) - :return: Customs - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['body', 'id'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method update" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'body' is set - if ('body' not in params or - params['body'] is None): - raise ValueError("Missing the required parameter `body` when calling `update`") # noqa: E501 - # verify the required parameter 'id' is set - if ('id' not in params or - params['id'] is None): - raise ValueError("Missing the required parameter `id` when calling `update`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'id' in params: - path_params['id'] = params['id'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if 'body' in params: - body_params = params['body'] - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['Token'] # noqa: E501 - - return self.api_client.call_api( - '/v1/customs_info/{id}', 'PATCH', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='Customs', # noqa: E501 - auth_settings=auth_settings, - async_req=params.get('async_req'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) + def __add_commodity( + self, + id, + data, + **kwargs + ): + """Add a commodity # noqa: E501 + + Add a customs commodity. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.add_commodity(id, data, async_req=True) + >>> result = thread.get() + + Args: + id (str): + data (CommodityData): + + Keyword Args: + _return_http_data_only (bool): response data without head status + code and headers. Default is True. + _preload_content (bool): if False, the urllib3.HTTPResponse object + will be returned without reading/decoding response data. + Default is True. + _request_timeout (int/float/tuple): timeout setting for this request. If + one number provided, it will be total request timeout. It can also + be a pair (tuple) of (connection, read) timeouts. + Default is None. + _check_input_type (bool): specifies if type checking + should be done one the data sent to the server. + Default is True. + _check_return_type (bool): specifies if type checking + should be done one the data received from the server. + Default is True. + _host_index (int/None): specifies the index of the server + that we want to use. + Default is read from the configuration. + async_req (bool): execute request asynchronously + + Returns: + Customs + If the method is called asynchronously, returns the request + thread. + """ + kwargs['async_req'] = kwargs.get( + 'async_req', False + ) + kwargs['_return_http_data_only'] = kwargs.get( + '_return_http_data_only', True + ) + kwargs['_preload_content'] = kwargs.get( + '_preload_content', True + ) + kwargs['_request_timeout'] = kwargs.get( + '_request_timeout', None + ) + kwargs['_check_input_type'] = kwargs.get( + '_check_input_type', True + ) + kwargs['_check_return_type'] = kwargs.get( + '_check_return_type', True + ) + kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['id'] = \ + id + kwargs['data'] = \ + data + return self.call_with_http_info(**kwargs) + + self.add_commodity = _Endpoint( + settings={ + 'response_type': (Customs,), + 'auth': [ + 'Token' + ], + 'endpoint_path': '/v1/customs_info/{id}/commodities', + 'operation_id': 'add_commodity', + 'http_method': 'POST', + 'servers': None, + }, + params_map={ + 'all': [ + 'id', + 'data', + ], + 'required': [ + 'id', + 'data', + ], + 'nullable': [ + ], + 'enum': [ + ], + 'validation': [ + ] + }, + root_map={ + 'validations': { + }, + 'allowed_values': { + }, + 'openapi_types': { + 'id': + (str,), + 'data': + (CommodityData,), + }, + 'attribute_map': { + 'id': 'id', + }, + 'location_map': { + 'id': 'path', + 'data': 'body', + }, + 'collection_format_map': { + } + }, + headers_map={ + 'accept': [ + 'application/json' + ], + 'content_type': [ + 'application/json' + ] + }, + api_client=api_client, + callable=__add_commodity + ) + + def __create( + self, + data, + **kwargs + ): + """Create a customs info # noqa: E501 + + Create a new customs declaration. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.create(data, async_req=True) + >>> result = thread.get() + + Args: + data (CustomsData): + + Keyword Args: + _return_http_data_only (bool): response data without head status + code and headers. Default is True. + _preload_content (bool): if False, the urllib3.HTTPResponse object + will be returned without reading/decoding response data. + Default is True. + _request_timeout (int/float/tuple): timeout setting for this request. If + one number provided, it will be total request timeout. It can also + be a pair (tuple) of (connection, read) timeouts. + Default is None. + _check_input_type (bool): specifies if type checking + should be done one the data sent to the server. + Default is True. + _check_return_type (bool): specifies if type checking + should be done one the data received from the server. + Default is True. + _host_index (int/None): specifies the index of the server + that we want to use. + Default is read from the configuration. + async_req (bool): execute request asynchronously + + Returns: + Customs + If the method is called asynchronously, returns the request + thread. + """ + kwargs['async_req'] = kwargs.get( + 'async_req', False + ) + kwargs['_return_http_data_only'] = kwargs.get( + '_return_http_data_only', True + ) + kwargs['_preload_content'] = kwargs.get( + '_preload_content', True + ) + kwargs['_request_timeout'] = kwargs.get( + '_request_timeout', None + ) + kwargs['_check_input_type'] = kwargs.get( + '_check_input_type', True + ) + kwargs['_check_return_type'] = kwargs.get( + '_check_return_type', True + ) + kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['data'] = \ + data + return self.call_with_http_info(**kwargs) + + self.create = _Endpoint( + settings={ + 'response_type': (Customs,), + 'auth': [ + 'Token' + ], + 'endpoint_path': '/v1/customs_info', + 'operation_id': 'create', + 'http_method': 'POST', + 'servers': None, + }, + params_map={ + 'all': [ + 'data', + ], + 'required': [ + 'data', + ], + 'nullable': [ + ], + 'enum': [ + ], + 'validation': [ + ] + }, + root_map={ + 'validations': { + }, + 'allowed_values': { + }, + 'openapi_types': { + 'data': + (CustomsData,), + }, + 'attribute_map': { + }, + 'location_map': { + 'data': 'body', + }, + 'collection_format_map': { + } + }, + headers_map={ + 'accept': [ + 'application/json' + ], + 'content_type': [ + 'application/json' + ] + }, + api_client=api_client, + callable=__create + ) + + def __discard( + self, + id, + **kwargs + ): + """Discard a customs info # noqa: E501 + + Discard a customs declaration. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.discard(id, async_req=True) + >>> result = thread.get() + + Args: + id (str): + + Keyword Args: + _return_http_data_only (bool): response data without head status + code and headers. Default is True. + _preload_content (bool): if False, the urllib3.HTTPResponse object + will be returned without reading/decoding response data. + Default is True. + _request_timeout (int/float/tuple): timeout setting for this request. If + one number provided, it will be total request timeout. It can also + be a pair (tuple) of (connection, read) timeouts. + Default is None. + _check_input_type (bool): specifies if type checking + should be done one the data sent to the server. + Default is True. + _check_return_type (bool): specifies if type checking + should be done one the data received from the server. + Default is True. + _host_index (int/None): specifies the index of the server + that we want to use. + Default is read from the configuration. + async_req (bool): execute request asynchronously + + Returns: + Operation + If the method is called asynchronously, returns the request + thread. + """ + kwargs['async_req'] = kwargs.get( + 'async_req', False + ) + kwargs['_return_http_data_only'] = kwargs.get( + '_return_http_data_only', True + ) + kwargs['_preload_content'] = kwargs.get( + '_preload_content', True + ) + kwargs['_request_timeout'] = kwargs.get( + '_request_timeout', None + ) + kwargs['_check_input_type'] = kwargs.get( + '_check_input_type', True + ) + kwargs['_check_return_type'] = kwargs.get( + '_check_return_type', True + ) + kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['id'] = \ + id + return self.call_with_http_info(**kwargs) + + self.discard = _Endpoint( + settings={ + 'response_type': (Operation,), + 'auth': [ + 'Token' + ], + 'endpoint_path': '/v1/customs_info/{id}', + 'operation_id': 'discard', + 'http_method': 'DELETE', + 'servers': None, + }, + params_map={ + 'all': [ + 'id', + ], + 'required': [ + 'id', + ], + 'nullable': [ + ], + 'enum': [ + ], + 'validation': [ + ] + }, + root_map={ + 'validations': { + }, + 'allowed_values': { + }, + 'openapi_types': { + 'id': + (str,), + }, + 'attribute_map': { + 'id': 'id', + }, + 'location_map': { + 'id': 'path', + }, + 'collection_format_map': { + } + }, + headers_map={ + 'accept': [ + 'application/json' + ], + 'content_type': [], + }, + api_client=api_client, + callable=__discard + ) + + def __discard_commodity( + self, + ck, + id, + **kwargs + ): + """Discard a commodity # noqa: E501 + + Discard a customs commodity. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.discard_commodity(ck, id, async_req=True) + >>> result = thread.get() + + Args: + ck (str): + id (str): + + Keyword Args: + _return_http_data_only (bool): response data without head status + code and headers. Default is True. + _preload_content (bool): if False, the urllib3.HTTPResponse object + will be returned without reading/decoding response data. + Default is True. + _request_timeout (int/float/tuple): timeout setting for this request. If + one number provided, it will be total request timeout. It can also + be a pair (tuple) of (connection, read) timeouts. + Default is None. + _check_input_type (bool): specifies if type checking + should be done one the data sent to the server. + Default is True. + _check_return_type (bool): specifies if type checking + should be done one the data received from the server. + Default is True. + _host_index (int/None): specifies the index of the server + that we want to use. + Default is read from the configuration. + async_req (bool): execute request asynchronously + + Returns: + Operation + If the method is called asynchronously, returns the request + thread. + """ + kwargs['async_req'] = kwargs.get( + 'async_req', False + ) + kwargs['_return_http_data_only'] = kwargs.get( + '_return_http_data_only', True + ) + kwargs['_preload_content'] = kwargs.get( + '_preload_content', True + ) + kwargs['_request_timeout'] = kwargs.get( + '_request_timeout', None + ) + kwargs['_check_input_type'] = kwargs.get( + '_check_input_type', True + ) + kwargs['_check_return_type'] = kwargs.get( + '_check_return_type', True + ) + kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['ck'] = \ + ck + kwargs['id'] = \ + id + return self.call_with_http_info(**kwargs) + + self.discard_commodity = _Endpoint( + settings={ + 'response_type': (Operation,), + 'auth': [ + 'Token' + ], + 'endpoint_path': '/v1/customs_info/{id}/commodities/{ck}', + 'operation_id': 'discard_commodity', + 'http_method': 'DELETE', + 'servers': None, + }, + params_map={ + 'all': [ + 'ck', + 'id', + ], + 'required': [ + 'ck', + 'id', + ], + 'nullable': [ + ], + 'enum': [ + ], + 'validation': [ + ] + }, + root_map={ + 'validations': { + }, + 'allowed_values': { + }, + 'openapi_types': { + 'ck': + (str,), + 'id': + (str,), + }, + 'attribute_map': { + 'ck': 'ck', + 'id': 'id', + }, + 'location_map': { + 'ck': 'path', + 'id': 'path', + }, + 'collection_format_map': { + } + }, + headers_map={ + 'accept': [ + 'application/json' + ], + 'content_type': [], + }, + api_client=api_client, + callable=__discard_commodity + ) + + def __list( + self, + **kwargs + ): + """List all customs info # noqa: E501 + + Retrieve all stored customs declarations. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.list(async_req=True) + >>> result = thread.get() + + + Keyword Args: + limit (int): Number of results to return per page.. [optional] + offset (int): The initial index from which to return the results.. [optional] + _return_http_data_only (bool): response data without head status + code and headers. Default is True. + _preload_content (bool): if False, the urllib3.HTTPResponse object + will be returned without reading/decoding response data. + Default is True. + _request_timeout (int/float/tuple): timeout setting for this request. If + one number provided, it will be total request timeout. It can also + be a pair (tuple) of (connection, read) timeouts. + Default is None. + _check_input_type (bool): specifies if type checking + should be done one the data sent to the server. + Default is True. + _check_return_type (bool): specifies if type checking + should be done one the data received from the server. + Default is True. + _host_index (int/None): specifies the index of the server + that we want to use. + Default is read from the configuration. + async_req (bool): execute request asynchronously + + Returns: + CustomsList + If the method is called asynchronously, returns the request + thread. + """ + kwargs['async_req'] = kwargs.get( + 'async_req', False + ) + kwargs['_return_http_data_only'] = kwargs.get( + '_return_http_data_only', True + ) + kwargs['_preload_content'] = kwargs.get( + '_preload_content', True + ) + kwargs['_request_timeout'] = kwargs.get( + '_request_timeout', None + ) + kwargs['_check_input_type'] = kwargs.get( + '_check_input_type', True + ) + kwargs['_check_return_type'] = kwargs.get( + '_check_return_type', True + ) + kwargs['_host_index'] = kwargs.get('_host_index') + return self.call_with_http_info(**kwargs) + + self.list = _Endpoint( + settings={ + 'response_type': (CustomsList,), + 'auth': [ + 'Token' + ], + 'endpoint_path': '/v1/customs_info', + 'operation_id': 'list', + 'http_method': 'GET', + 'servers': None, + }, + params_map={ + 'all': [ + 'limit', + 'offset', + ], + 'required': [], + 'nullable': [ + ], + 'enum': [ + ], + 'validation': [ + ] + }, + root_map={ + 'validations': { + }, + 'allowed_values': { + }, + 'openapi_types': { + 'limit': + (int,), + 'offset': + (int,), + }, + 'attribute_map': { + 'limit': 'limit', + 'offset': 'offset', + }, + 'location_map': { + 'limit': 'query', + 'offset': 'query', + }, + 'collection_format_map': { + } + }, + headers_map={ + 'accept': [ + 'application/json' + ], + 'content_type': [], + }, + api_client=api_client, + callable=__list + ) + + def __retrieve( + self, + id, + **kwargs + ): + """Retrieve a customs info # noqa: E501 + + Retrieve customs declaration. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.retrieve(id, async_req=True) + >>> result = thread.get() + + Args: + id (str): + + Keyword Args: + _return_http_data_only (bool): response data without head status + code and headers. Default is True. + _preload_content (bool): if False, the urllib3.HTTPResponse object + will be returned without reading/decoding response data. + Default is True. + _request_timeout (int/float/tuple): timeout setting for this request. If + one number provided, it will be total request timeout. It can also + be a pair (tuple) of (connection, read) timeouts. + Default is None. + _check_input_type (bool): specifies if type checking + should be done one the data sent to the server. + Default is True. + _check_return_type (bool): specifies if type checking + should be done one the data received from the server. + Default is True. + _host_index (int/None): specifies the index of the server + that we want to use. + Default is read from the configuration. + async_req (bool): execute request asynchronously + + Returns: + Customs + If the method is called asynchronously, returns the request + thread. + """ + kwargs['async_req'] = kwargs.get( + 'async_req', False + ) + kwargs['_return_http_data_only'] = kwargs.get( + '_return_http_data_only', True + ) + kwargs['_preload_content'] = kwargs.get( + '_preload_content', True + ) + kwargs['_request_timeout'] = kwargs.get( + '_request_timeout', None + ) + kwargs['_check_input_type'] = kwargs.get( + '_check_input_type', True + ) + kwargs['_check_return_type'] = kwargs.get( + '_check_return_type', True + ) + kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['id'] = \ + id + return self.call_with_http_info(**kwargs) + + self.retrieve = _Endpoint( + settings={ + 'response_type': (Customs,), + 'auth': [ + 'Token' + ], + 'endpoint_path': '/v1/customs_info/{id}', + 'operation_id': 'retrieve', + 'http_method': 'GET', + 'servers': None, + }, + params_map={ + 'all': [ + 'id', + ], + 'required': [ + 'id', + ], + 'nullable': [ + ], + 'enum': [ + ], + 'validation': [ + ] + }, + root_map={ + 'validations': { + }, + 'allowed_values': { + }, + 'openapi_types': { + 'id': + (str,), + }, + 'attribute_map': { + 'id': 'id', + }, + 'location_map': { + 'id': 'path', + }, + 'collection_format_map': { + } + }, + headers_map={ + 'accept': [ + 'application/json' + ], + 'content_type': [], + }, + api_client=api_client, + callable=__retrieve + ) + + def __update( + self, + id, + data, + **kwargs + ): + """Update a customs info # noqa: E501 + + modify an existing customs declaration. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.update(id, data, async_req=True) + >>> result = thread.get() + + Args: + id (str): + data (CustomsData): + + Keyword Args: + _return_http_data_only (bool): response data without head status + code and headers. Default is True. + _preload_content (bool): if False, the urllib3.HTTPResponse object + will be returned without reading/decoding response data. + Default is True. + _request_timeout (int/float/tuple): timeout setting for this request. If + one number provided, it will be total request timeout. It can also + be a pair (tuple) of (connection, read) timeouts. + Default is None. + _check_input_type (bool): specifies if type checking + should be done one the data sent to the server. + Default is True. + _check_return_type (bool): specifies if type checking + should be done one the data received from the server. + Default is True. + _host_index (int/None): specifies the index of the server + that we want to use. + Default is read from the configuration. + async_req (bool): execute request asynchronously + + Returns: + Customs + If the method is called asynchronously, returns the request + thread. + """ + kwargs['async_req'] = kwargs.get( + 'async_req', False + ) + kwargs['_return_http_data_only'] = kwargs.get( + '_return_http_data_only', True + ) + kwargs['_preload_content'] = kwargs.get( + '_preload_content', True + ) + kwargs['_request_timeout'] = kwargs.get( + '_request_timeout', None + ) + kwargs['_check_input_type'] = kwargs.get( + '_check_input_type', True + ) + kwargs['_check_return_type'] = kwargs.get( + '_check_return_type', True + ) + kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['id'] = \ + id + kwargs['data'] = \ + data + return self.call_with_http_info(**kwargs) + + self.update = _Endpoint( + settings={ + 'response_type': (Customs,), + 'auth': [ + 'Token' + ], + 'endpoint_path': '/v1/customs_info/{id}', + 'operation_id': 'update', + 'http_method': 'PATCH', + 'servers': None, + }, + params_map={ + 'all': [ + 'id', + 'data', + ], + 'required': [ + 'id', + 'data', + ], + 'nullable': [ + ], + 'enum': [ + ], + 'validation': [ + ] + }, + root_map={ + 'validations': { + }, + 'allowed_values': { + }, + 'openapi_types': { + 'id': + (str,), + 'data': + (CustomsData,), + }, + 'attribute_map': { + 'id': 'id', + }, + 'location_map': { + 'id': 'path', + 'data': 'body', + }, + 'collection_format_map': { + } + }, + headers_map={ + 'accept': [ + 'application/json' + ], + 'content_type': [ + 'application/json' + ] + }, + api_client=api_client, + callable=__update + ) diff --git a/purplship/api/parcels_api.py b/purplship/api/parcels_api.py index 053efd3..3f7d0cc 100644 --- a/purplship/api/parcels_api.py +++ b/purplship/api/parcels_api.py @@ -1,30 +1,39 @@ -# coding: utf-8 - """ Purplship API - ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.6.2`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 + ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.7`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 - OpenAPI spec version: 2021.6.2 + The version of the OpenAPI document: 2021.7 Contact: hello@purplship.com - Generated by: https://github.com/swagger-api/swagger-codegen.git + Generated by: https://openapi-generator.tech """ -from __future__ import absolute_import import re # noqa: F401 - -# python 2 and python 3 compatibility library -import six - -from purplship.api_client import ApiClient +import sys # noqa: F401 + +from purplship.api_client import ApiClient, Endpoint as _Endpoint +from purplship.model_utils import ( # noqa: F401 + check_allowed_values, + check_validations, + date, + datetime, + file_type, + none_type, + validate_and_convert_types +) +from purplship.model.error_response import ErrorResponse +from purplship.model.operation import Operation +from purplship.model.parcel import Parcel +from purplship.model.parcel_data import ParcelData +from purplship.model.parcel_list import ParcelList class ParcelsApi(object): - """NOTE: This class is auto generated by the swagger code generator program. + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech Do not edit the class manually. - Ref: https://github.com/swagger-api/swagger-codegen """ def __init__(self, api_client=None): @@ -32,493 +41,609 @@ def __init__(self, api_client=None): api_client = ApiClient() self.api_client = api_client - def create(self, body, **kwargs): # noqa: E501 - """Create a parcel # noqa: E501 - - Create a new parcel. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.create(body, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param ParcelData body: (required) - :return: Parcel - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.create_with_http_info(body, **kwargs) # noqa: E501 - else: - (data) = self.create_with_http_info(body, **kwargs) # noqa: E501 - return data - - def create_with_http_info(self, body, **kwargs): # noqa: E501 - """Create a parcel # noqa: E501 - - Create a new parcel. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.create_with_http_info(body, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param ParcelData body: (required) - :return: Parcel - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['body'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method create" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'body' is set - if ('body' not in params or - params['body'] is None): - raise ValueError("Missing the required parameter `body` when calling `create`") # noqa: E501 - - collection_formats = {} - - path_params = {} - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if 'body' in params: - body_params = params['body'] - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['Token'] # noqa: E501 - - return self.api_client.call_api( - '/v1/parcels', 'POST', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='Parcel', # noqa: E501 - auth_settings=auth_settings, - async_req=params.get('async_req'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def discard(self, id, **kwargs): # noqa: E501 - """Remove a parcel # noqa: E501 - - Remove a parcel. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.discard(id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param str id: (required) - :return: Operation - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.discard_with_http_info(id, **kwargs) # noqa: E501 - else: - (data) = self.discard_with_http_info(id, **kwargs) # noqa: E501 - return data - - def discard_with_http_info(self, id, **kwargs): # noqa: E501 - """Remove a parcel # noqa: E501 - - Remove a parcel. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.discard_with_http_info(id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param str id: (required) - :return: Operation - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['id'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method discard" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'id' is set - if ('id' not in params or - params['id'] is None): - raise ValueError("Missing the required parameter `id` when calling `discard`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'id' in params: - path_params['id'] = params['id'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['Token'] # noqa: E501 - - return self.api_client.call_api( - '/v1/parcels/{id}', 'DELETE', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='Operation', # noqa: E501 - auth_settings=auth_settings, - async_req=params.get('async_req'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def list(self, **kwargs): # noqa: E501 - """List all parcels # noqa: E501 - - Retrieve all stored parcels. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.list(async_req=True) - >>> result = thread.get() - - :param async_req bool - :param int limit: Number of results to return per page. - :param int offset: The initial index from which to return the results. - :return: ParcelList - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.list_with_http_info(**kwargs) # noqa: E501 - else: - (data) = self.list_with_http_info(**kwargs) # noqa: E501 - return data - - def list_with_http_info(self, **kwargs): # noqa: E501 - """List all parcels # noqa: E501 - - Retrieve all stored parcels. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.list_with_http_info(async_req=True) - >>> result = thread.get() - - :param async_req bool - :param int limit: Number of results to return per page. - :param int offset: The initial index from which to return the results. - :return: ParcelList - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['limit', 'offset'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method list" % key - ) - params[key] = val - del params['kwargs'] - - collection_formats = {} - - path_params = {} - - query_params = [] - if 'limit' in params: - query_params.append(('limit', params['limit'])) # noqa: E501 - if 'offset' in params: - query_params.append(('offset', params['offset'])) # noqa: E501 - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['Token'] # noqa: E501 - - return self.api_client.call_api( - '/v1/parcels', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='ParcelList', # noqa: E501 - auth_settings=auth_settings, - async_req=params.get('async_req'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def retrieve(self, id, **kwargs): # noqa: E501 - """Retrieve a parcel # noqa: E501 - - Retrieve a parcel. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.retrieve(id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param str id: (required) - :return: Parcel - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.retrieve_with_http_info(id, **kwargs) # noqa: E501 - else: - (data) = self.retrieve_with_http_info(id, **kwargs) # noqa: E501 - return data - - def retrieve_with_http_info(self, id, **kwargs): # noqa: E501 - """Retrieve a parcel # noqa: E501 - - Retrieve a parcel. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.retrieve_with_http_info(id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param str id: (required) - :return: Parcel - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['id'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method retrieve" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'id' is set - if ('id' not in params or - params['id'] is None): - raise ValueError("Missing the required parameter `id` when calling `retrieve`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'id' in params: - path_params['id'] = params['id'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['Token'] # noqa: E501 - - return self.api_client.call_api( - '/v1/parcels/{id}', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='Parcel', # noqa: E501 - auth_settings=auth_settings, - async_req=params.get('async_req'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def update(self, body, id, **kwargs): # noqa: E501 - """Update a parcel # noqa: E501 - - modify an existing parcel's details. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.update(body, id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param ParcelData body: (required) - :param str id: (required) - :return: Parcel - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.update_with_http_info(body, id, **kwargs) # noqa: E501 - else: - (data) = self.update_with_http_info(body, id, **kwargs) # noqa: E501 - return data - - def update_with_http_info(self, body, id, **kwargs): # noqa: E501 - """Update a parcel # noqa: E501 - - modify an existing parcel's details. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.update_with_http_info(body, id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param ParcelData body: (required) - :param str id: (required) - :return: Parcel - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['body', 'id'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method update" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'body' is set - if ('body' not in params or - params['body'] is None): - raise ValueError("Missing the required parameter `body` when calling `update`") # noqa: E501 - # verify the required parameter 'id' is set - if ('id' not in params or - params['id'] is None): - raise ValueError("Missing the required parameter `id` when calling `update`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'id' in params: - path_params['id'] = params['id'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if 'body' in params: - body_params = params['body'] - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['Token'] # noqa: E501 - - return self.api_client.call_api( - '/v1/parcels/{id}', 'PATCH', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='Parcel', # noqa: E501 - auth_settings=auth_settings, - async_req=params.get('async_req'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) + def __create( + self, + data, + **kwargs + ): + """Create a parcel # noqa: E501 + + Create a new parcel. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.create(data, async_req=True) + >>> result = thread.get() + + Args: + data (ParcelData): + + Keyword Args: + _return_http_data_only (bool): response data without head status + code and headers. Default is True. + _preload_content (bool): if False, the urllib3.HTTPResponse object + will be returned without reading/decoding response data. + Default is True. + _request_timeout (int/float/tuple): timeout setting for this request. If + one number provided, it will be total request timeout. It can also + be a pair (tuple) of (connection, read) timeouts. + Default is None. + _check_input_type (bool): specifies if type checking + should be done one the data sent to the server. + Default is True. + _check_return_type (bool): specifies if type checking + should be done one the data received from the server. + Default is True. + _host_index (int/None): specifies the index of the server + that we want to use. + Default is read from the configuration. + async_req (bool): execute request asynchronously + + Returns: + Parcel + If the method is called asynchronously, returns the request + thread. + """ + kwargs['async_req'] = kwargs.get( + 'async_req', False + ) + kwargs['_return_http_data_only'] = kwargs.get( + '_return_http_data_only', True + ) + kwargs['_preload_content'] = kwargs.get( + '_preload_content', True + ) + kwargs['_request_timeout'] = kwargs.get( + '_request_timeout', None + ) + kwargs['_check_input_type'] = kwargs.get( + '_check_input_type', True + ) + kwargs['_check_return_type'] = kwargs.get( + '_check_return_type', True + ) + kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['data'] = \ + data + return self.call_with_http_info(**kwargs) + + self.create = _Endpoint( + settings={ + 'response_type': (Parcel,), + 'auth': [ + 'Token' + ], + 'endpoint_path': '/v1/parcels', + 'operation_id': 'create', + 'http_method': 'POST', + 'servers': None, + }, + params_map={ + 'all': [ + 'data', + ], + 'required': [ + 'data', + ], + 'nullable': [ + ], + 'enum': [ + ], + 'validation': [ + ] + }, + root_map={ + 'validations': { + }, + 'allowed_values': { + }, + 'openapi_types': { + 'data': + (ParcelData,), + }, + 'attribute_map': { + }, + 'location_map': { + 'data': 'body', + }, + 'collection_format_map': { + } + }, + headers_map={ + 'accept': [ + 'application/json' + ], + 'content_type': [ + 'application/json' + ] + }, + api_client=api_client, + callable=__create + ) + + def __discard( + self, + id, + **kwargs + ): + """Remove a parcel # noqa: E501 + + Remove a parcel. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.discard(id, async_req=True) + >>> result = thread.get() + + Args: + id (str): + + Keyword Args: + _return_http_data_only (bool): response data without head status + code and headers. Default is True. + _preload_content (bool): if False, the urllib3.HTTPResponse object + will be returned without reading/decoding response data. + Default is True. + _request_timeout (int/float/tuple): timeout setting for this request. If + one number provided, it will be total request timeout. It can also + be a pair (tuple) of (connection, read) timeouts. + Default is None. + _check_input_type (bool): specifies if type checking + should be done one the data sent to the server. + Default is True. + _check_return_type (bool): specifies if type checking + should be done one the data received from the server. + Default is True. + _host_index (int/None): specifies the index of the server + that we want to use. + Default is read from the configuration. + async_req (bool): execute request asynchronously + + Returns: + Operation + If the method is called asynchronously, returns the request + thread. + """ + kwargs['async_req'] = kwargs.get( + 'async_req', False + ) + kwargs['_return_http_data_only'] = kwargs.get( + '_return_http_data_only', True + ) + kwargs['_preload_content'] = kwargs.get( + '_preload_content', True + ) + kwargs['_request_timeout'] = kwargs.get( + '_request_timeout', None + ) + kwargs['_check_input_type'] = kwargs.get( + '_check_input_type', True + ) + kwargs['_check_return_type'] = kwargs.get( + '_check_return_type', True + ) + kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['id'] = \ + id + return self.call_with_http_info(**kwargs) + + self.discard = _Endpoint( + settings={ + 'response_type': (Operation,), + 'auth': [ + 'Token' + ], + 'endpoint_path': '/v1/parcels/{id}', + 'operation_id': 'discard', + 'http_method': 'DELETE', + 'servers': None, + }, + params_map={ + 'all': [ + 'id', + ], + 'required': [ + 'id', + ], + 'nullable': [ + ], + 'enum': [ + ], + 'validation': [ + ] + }, + root_map={ + 'validations': { + }, + 'allowed_values': { + }, + 'openapi_types': { + 'id': + (str,), + }, + 'attribute_map': { + 'id': 'id', + }, + 'location_map': { + 'id': 'path', + }, + 'collection_format_map': { + } + }, + headers_map={ + 'accept': [ + 'application/json' + ], + 'content_type': [], + }, + api_client=api_client, + callable=__discard + ) + + def __list( + self, + **kwargs + ): + """List all parcels # noqa: E501 + + Retrieve all stored parcels. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.list(async_req=True) + >>> result = thread.get() + + + Keyword Args: + limit (int): Number of results to return per page.. [optional] + offset (int): The initial index from which to return the results.. [optional] + _return_http_data_only (bool): response data without head status + code and headers. Default is True. + _preload_content (bool): if False, the urllib3.HTTPResponse object + will be returned without reading/decoding response data. + Default is True. + _request_timeout (int/float/tuple): timeout setting for this request. If + one number provided, it will be total request timeout. It can also + be a pair (tuple) of (connection, read) timeouts. + Default is None. + _check_input_type (bool): specifies if type checking + should be done one the data sent to the server. + Default is True. + _check_return_type (bool): specifies if type checking + should be done one the data received from the server. + Default is True. + _host_index (int/None): specifies the index of the server + that we want to use. + Default is read from the configuration. + async_req (bool): execute request asynchronously + + Returns: + ParcelList + If the method is called asynchronously, returns the request + thread. + """ + kwargs['async_req'] = kwargs.get( + 'async_req', False + ) + kwargs['_return_http_data_only'] = kwargs.get( + '_return_http_data_only', True + ) + kwargs['_preload_content'] = kwargs.get( + '_preload_content', True + ) + kwargs['_request_timeout'] = kwargs.get( + '_request_timeout', None + ) + kwargs['_check_input_type'] = kwargs.get( + '_check_input_type', True + ) + kwargs['_check_return_type'] = kwargs.get( + '_check_return_type', True + ) + kwargs['_host_index'] = kwargs.get('_host_index') + return self.call_with_http_info(**kwargs) + + self.list = _Endpoint( + settings={ + 'response_type': (ParcelList,), + 'auth': [ + 'Token' + ], + 'endpoint_path': '/v1/parcels', + 'operation_id': 'list', + 'http_method': 'GET', + 'servers': None, + }, + params_map={ + 'all': [ + 'limit', + 'offset', + ], + 'required': [], + 'nullable': [ + ], + 'enum': [ + ], + 'validation': [ + ] + }, + root_map={ + 'validations': { + }, + 'allowed_values': { + }, + 'openapi_types': { + 'limit': + (int,), + 'offset': + (int,), + }, + 'attribute_map': { + 'limit': 'limit', + 'offset': 'offset', + }, + 'location_map': { + 'limit': 'query', + 'offset': 'query', + }, + 'collection_format_map': { + } + }, + headers_map={ + 'accept': [ + 'application/json' + ], + 'content_type': [], + }, + api_client=api_client, + callable=__list + ) + + def __retrieve( + self, + id, + **kwargs + ): + """Retrieve a parcel # noqa: E501 + + Retrieve a parcel. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.retrieve(id, async_req=True) + >>> result = thread.get() + + Args: + id (str): + + Keyword Args: + _return_http_data_only (bool): response data without head status + code and headers. Default is True. + _preload_content (bool): if False, the urllib3.HTTPResponse object + will be returned without reading/decoding response data. + Default is True. + _request_timeout (int/float/tuple): timeout setting for this request. If + one number provided, it will be total request timeout. It can also + be a pair (tuple) of (connection, read) timeouts. + Default is None. + _check_input_type (bool): specifies if type checking + should be done one the data sent to the server. + Default is True. + _check_return_type (bool): specifies if type checking + should be done one the data received from the server. + Default is True. + _host_index (int/None): specifies the index of the server + that we want to use. + Default is read from the configuration. + async_req (bool): execute request asynchronously + + Returns: + Parcel + If the method is called asynchronously, returns the request + thread. + """ + kwargs['async_req'] = kwargs.get( + 'async_req', False + ) + kwargs['_return_http_data_only'] = kwargs.get( + '_return_http_data_only', True + ) + kwargs['_preload_content'] = kwargs.get( + '_preload_content', True + ) + kwargs['_request_timeout'] = kwargs.get( + '_request_timeout', None + ) + kwargs['_check_input_type'] = kwargs.get( + '_check_input_type', True + ) + kwargs['_check_return_type'] = kwargs.get( + '_check_return_type', True + ) + kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['id'] = \ + id + return self.call_with_http_info(**kwargs) + + self.retrieve = _Endpoint( + settings={ + 'response_type': (Parcel,), + 'auth': [ + 'Token' + ], + 'endpoint_path': '/v1/parcels/{id}', + 'operation_id': 'retrieve', + 'http_method': 'GET', + 'servers': None, + }, + params_map={ + 'all': [ + 'id', + ], + 'required': [ + 'id', + ], + 'nullable': [ + ], + 'enum': [ + ], + 'validation': [ + ] + }, + root_map={ + 'validations': { + }, + 'allowed_values': { + }, + 'openapi_types': { + 'id': + (str,), + }, + 'attribute_map': { + 'id': 'id', + }, + 'location_map': { + 'id': 'path', + }, + 'collection_format_map': { + } + }, + headers_map={ + 'accept': [ + 'application/json' + ], + 'content_type': [], + }, + api_client=api_client, + callable=__retrieve + ) + + def __update( + self, + id, + data, + **kwargs + ): + """Update a parcel # noqa: E501 + + modify an existing parcel's details. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.update(id, data, async_req=True) + >>> result = thread.get() + + Args: + id (str): + data (ParcelData): + + Keyword Args: + _return_http_data_only (bool): response data without head status + code and headers. Default is True. + _preload_content (bool): if False, the urllib3.HTTPResponse object + will be returned without reading/decoding response data. + Default is True. + _request_timeout (int/float/tuple): timeout setting for this request. If + one number provided, it will be total request timeout. It can also + be a pair (tuple) of (connection, read) timeouts. + Default is None. + _check_input_type (bool): specifies if type checking + should be done one the data sent to the server. + Default is True. + _check_return_type (bool): specifies if type checking + should be done one the data received from the server. + Default is True. + _host_index (int/None): specifies the index of the server + that we want to use. + Default is read from the configuration. + async_req (bool): execute request asynchronously + + Returns: + Parcel + If the method is called asynchronously, returns the request + thread. + """ + kwargs['async_req'] = kwargs.get( + 'async_req', False + ) + kwargs['_return_http_data_only'] = kwargs.get( + '_return_http_data_only', True + ) + kwargs['_preload_content'] = kwargs.get( + '_preload_content', True + ) + kwargs['_request_timeout'] = kwargs.get( + '_request_timeout', None + ) + kwargs['_check_input_type'] = kwargs.get( + '_check_input_type', True + ) + kwargs['_check_return_type'] = kwargs.get( + '_check_return_type', True + ) + kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['id'] = \ + id + kwargs['data'] = \ + data + return self.call_with_http_info(**kwargs) + + self.update = _Endpoint( + settings={ + 'response_type': (Parcel,), + 'auth': [ + 'Token' + ], + 'endpoint_path': '/v1/parcels/{id}', + 'operation_id': 'update', + 'http_method': 'PATCH', + 'servers': None, + }, + params_map={ + 'all': [ + 'id', + 'data', + ], + 'required': [ + 'id', + 'data', + ], + 'nullable': [ + ], + 'enum': [ + ], + 'validation': [ + ] + }, + root_map={ + 'validations': { + }, + 'allowed_values': { + }, + 'openapi_types': { + 'id': + (str,), + 'data': + (ParcelData,), + }, + 'attribute_map': { + 'id': 'id', + }, + 'location_map': { + 'id': 'path', + 'data': 'body', + }, + 'collection_format_map': { + } + }, + headers_map={ + 'accept': [ + 'application/json' + ], + 'content_type': [ + 'application/json' + ] + }, + api_client=api_client, + callable=__update + ) diff --git a/purplship/api/pickups_api.py b/purplship/api/pickups_api.py index c0efc53..df65828 100644 --- a/purplship/api/pickups_api.py +++ b/purplship/api/pickups_api.py @@ -1,30 +1,41 @@ -# coding: utf-8 - """ Purplship API - ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.6.2`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 + ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.7`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 - OpenAPI spec version: 2021.6.2 + The version of the OpenAPI document: 2021.7 Contact: hello@purplship.com - Generated by: https://github.com/swagger-api/swagger-codegen.git + Generated by: https://openapi-generator.tech """ -from __future__ import absolute_import import re # noqa: F401 - -# python 2 and python 3 compatibility library -import six - -from purplship.api_client import ApiClient +import sys # noqa: F401 + +from purplship.api_client import ApiClient, Endpoint as _Endpoint +from purplship.model_utils import ( # noqa: F401 + check_allowed_values, + check_validations, + date, + datetime, + file_type, + none_type, + validate_and_convert_types +) +from purplship.model.error_response import ErrorResponse +from purplship.model.operation_confirmation import OperationConfirmation +from purplship.model.pickup import Pickup +from purplship.model.pickup_cancel_data import PickupCancelData +from purplship.model.pickup_data import PickupData +from purplship.model.pickup_list import PickupList +from purplship.model.pickup_update_data import PickupUpdateData class PickupsApi(object): - """NOTE: This class is auto generated by the swagger code generator program. + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech Do not edit the class manually. - Ref: https://github.com/swagger-api/swagger-codegen """ def __init__(self, api_client=None): @@ -32,521 +43,643 @@ def __init__(self, api_client=None): api_client = ApiClient() self.api_client = api_client - def cancel(self, body, id, **kwargs): # noqa: E501 - """Cancel a pickup # noqa: E501 - - Cancel a pickup of one or more shipments. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.cancel(body, id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param PickupCancelData body: (required) - :param str id: (required) - :return: OperationConfirmation - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.cancel_with_http_info(body, id, **kwargs) # noqa: E501 - else: - (data) = self.cancel_with_http_info(body, id, **kwargs) # noqa: E501 - return data - - def cancel_with_http_info(self, body, id, **kwargs): # noqa: E501 - """Cancel a pickup # noqa: E501 - - Cancel a pickup of one or more shipments. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.cancel_with_http_info(body, id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param PickupCancelData body: (required) - :param str id: (required) - :return: OperationConfirmation - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['body', 'id'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method cancel" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'body' is set - if ('body' not in params or - params['body'] is None): - raise ValueError("Missing the required parameter `body` when calling `cancel`") # noqa: E501 - # verify the required parameter 'id' is set - if ('id' not in params or - params['id'] is None): - raise ValueError("Missing the required parameter `id` when calling `cancel`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'id' in params: - path_params['id'] = params['id'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if 'body' in params: - body_params = params['body'] - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['Token'] # noqa: E501 - - return self.api_client.call_api( - '/v1/pickups/{id}/cancel', 'POST', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='OperationConfirmation', # noqa: E501 - auth_settings=auth_settings, - async_req=params.get('async_req'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def list(self, **kwargs): # noqa: E501 - """List shipment pickups # noqa: E501 - - Retrieve all scheduled pickups. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.list(async_req=True) - >>> result = thread.get() - - :param async_req bool - :param bool test_mode: - :param int limit: Number of results to return per page. - :param int offset: The initial index from which to return the results. - :return: PickupList - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.list_with_http_info(**kwargs) # noqa: E501 - else: - (data) = self.list_with_http_info(**kwargs) # noqa: E501 - return data - - def list_with_http_info(self, **kwargs): # noqa: E501 - """List shipment pickups # noqa: E501 - - Retrieve all scheduled pickups. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.list_with_http_info(async_req=True) - >>> result = thread.get() - - :param async_req bool - :param bool test_mode: - :param int limit: Number of results to return per page. - :param int offset: The initial index from which to return the results. - :return: PickupList - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['test_mode', 'limit', 'offset'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method list" % key - ) - params[key] = val - del params['kwargs'] - - collection_formats = {} - - path_params = {} - - query_params = [] - if 'test_mode' in params: - query_params.append(('test_mode', params['test_mode'])) # noqa: E501 - if 'limit' in params: - query_params.append(('limit', params['limit'])) # noqa: E501 - if 'offset' in params: - query_params.append(('offset', params['offset'])) # noqa: E501 - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['Token'] # noqa: E501 - - return self.api_client.call_api( - '/v1/pickups', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='PickupList', # noqa: E501 - auth_settings=auth_settings, - async_req=params.get('async_req'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def retrieve(self, id, **kwargs): # noqa: E501 - """Retrieve a pickup # noqa: E501 - - Retrieve a scheduled pickup. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.retrieve(id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param str id: (required) - :return: Pickup - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.retrieve_with_http_info(id, **kwargs) # noqa: E501 - else: - (data) = self.retrieve_with_http_info(id, **kwargs) # noqa: E501 - return data - - def retrieve_with_http_info(self, id, **kwargs): # noqa: E501 - """Retrieve a pickup # noqa: E501 - - Retrieve a scheduled pickup. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.retrieve_with_http_info(id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param str id: (required) - :return: Pickup - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['id'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method retrieve" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'id' is set - if ('id' not in params or - params['id'] is None): - raise ValueError("Missing the required parameter `id` when calling `retrieve`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'id' in params: - path_params['id'] = params['id'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['Token'] # noqa: E501 - - return self.api_client.call_api( - '/v1/pickups/{id}', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='Pickup', # noqa: E501 - auth_settings=auth_settings, - async_req=params.get('async_req'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def schedule(self, body, carrier_name, **kwargs): # noqa: E501 - """Schedule a pickup # noqa: E501 - - Schedule a pickup for one or many shipments with labels already purchased. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.schedule(body, carrier_name, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param PickupData body: (required) - :param str carrier_name: (required) - :param bool test: The test flag indicates whether to use a carrier configured for test. - :return: Pickup - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.schedule_with_http_info(body, carrier_name, **kwargs) # noqa: E501 - else: - (data) = self.schedule_with_http_info(body, carrier_name, **kwargs) # noqa: E501 - return data - - def schedule_with_http_info(self, body, carrier_name, **kwargs): # noqa: E501 - """Schedule a pickup # noqa: E501 - - Schedule a pickup for one or many shipments with labels already purchased. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.schedule_with_http_info(body, carrier_name, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param PickupData body: (required) - :param str carrier_name: (required) - :param bool test: The test flag indicates whether to use a carrier configured for test. - :return: Pickup - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['body', 'carrier_name', 'test'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method schedule" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'body' is set - if ('body' not in params or - params['body'] is None): - raise ValueError("Missing the required parameter `body` when calling `schedule`") # noqa: E501 - # verify the required parameter 'carrier_name' is set - if ('carrier_name' not in params or - params['carrier_name'] is None): - raise ValueError("Missing the required parameter `carrier_name` when calling `schedule`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'carrier_name' in params: - path_params['carrier_name'] = params['carrier_name'] # noqa: E501 - - query_params = [] - if 'test' in params: - query_params.append(('test', params['test'])) # noqa: E501 - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if 'body' in params: - body_params = params['body'] - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['Token'] # noqa: E501 - - return self.api_client.call_api( - '/v1/pickups/{carrier_name}/schedule', 'POST', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='Pickup', # noqa: E501 - auth_settings=auth_settings, - async_req=params.get('async_req'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def update(self, body, id, **kwargs): # noqa: E501 - """Update a pickup # noqa: E501 - - Modify a pickup for one or many shipments with labels already purchased. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.update(body, id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param PickupUpdateData body: (required) - :param str id: (required) - :return: OperationConfirmation - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.update_with_http_info(body, id, **kwargs) # noqa: E501 - else: - (data) = self.update_with_http_info(body, id, **kwargs) # noqa: E501 - return data - - def update_with_http_info(self, body, id, **kwargs): # noqa: E501 - """Update a pickup # noqa: E501 - - Modify a pickup for one or many shipments with labels already purchased. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.update_with_http_info(body, id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param PickupUpdateData body: (required) - :param str id: (required) - :return: OperationConfirmation - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['body', 'id'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method update" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'body' is set - if ('body' not in params or - params['body'] is None): - raise ValueError("Missing the required parameter `body` when calling `update`") # noqa: E501 - # verify the required parameter 'id' is set - if ('id' not in params or - params['id'] is None): - raise ValueError("Missing the required parameter `id` when calling `update`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'id' in params: - path_params['id'] = params['id'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if 'body' in params: - body_params = params['body'] - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['Token'] # noqa: E501 - - return self.api_client.call_api( - '/v1/pickups/{id}', 'PATCH', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='OperationConfirmation', # noqa: E501 - auth_settings=auth_settings, - async_req=params.get('async_req'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) + def __cancel( + self, + id, + data, + **kwargs + ): + """Cancel a pickup # noqa: E501 + + Cancel a pickup of one or more shipments. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.cancel(id, data, async_req=True) + >>> result = thread.get() + + Args: + id (str): + data (PickupCancelData): + + Keyword Args: + _return_http_data_only (bool): response data without head status + code and headers. Default is True. + _preload_content (bool): if False, the urllib3.HTTPResponse object + will be returned without reading/decoding response data. + Default is True. + _request_timeout (int/float/tuple): timeout setting for this request. If + one number provided, it will be total request timeout. It can also + be a pair (tuple) of (connection, read) timeouts. + Default is None. + _check_input_type (bool): specifies if type checking + should be done one the data sent to the server. + Default is True. + _check_return_type (bool): specifies if type checking + should be done one the data received from the server. + Default is True. + _host_index (int/None): specifies the index of the server + that we want to use. + Default is read from the configuration. + async_req (bool): execute request asynchronously + + Returns: + OperationConfirmation + If the method is called asynchronously, returns the request + thread. + """ + kwargs['async_req'] = kwargs.get( + 'async_req', False + ) + kwargs['_return_http_data_only'] = kwargs.get( + '_return_http_data_only', True + ) + kwargs['_preload_content'] = kwargs.get( + '_preload_content', True + ) + kwargs['_request_timeout'] = kwargs.get( + '_request_timeout', None + ) + kwargs['_check_input_type'] = kwargs.get( + '_check_input_type', True + ) + kwargs['_check_return_type'] = kwargs.get( + '_check_return_type', True + ) + kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['id'] = \ + id + kwargs['data'] = \ + data + return self.call_with_http_info(**kwargs) + + self.cancel = _Endpoint( + settings={ + 'response_type': (OperationConfirmation,), + 'auth': [ + 'Token' + ], + 'endpoint_path': '/v1/pickups/{id}/cancel', + 'operation_id': 'cancel', + 'http_method': 'POST', + 'servers': None, + }, + params_map={ + 'all': [ + 'id', + 'data', + ], + 'required': [ + 'id', + 'data', + ], + 'nullable': [ + ], + 'enum': [ + ], + 'validation': [ + ] + }, + root_map={ + 'validations': { + }, + 'allowed_values': { + }, + 'openapi_types': { + 'id': + (str,), + 'data': + (PickupCancelData,), + }, + 'attribute_map': { + 'id': 'id', + }, + 'location_map': { + 'id': 'path', + 'data': 'body', + }, + 'collection_format_map': { + } + }, + headers_map={ + 'accept': [ + 'application/json' + ], + 'content_type': [ + 'application/json' + ] + }, + api_client=api_client, + callable=__cancel + ) + + def __list( + self, + **kwargs + ): + """List shipment pickups # noqa: E501 + + Retrieve all scheduled pickups. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.list(async_req=True) + >>> result = thread.get() + + + Keyword Args: + test_mode (bool): [optional] + limit (int): Number of results to return per page.. [optional] + offset (int): The initial index from which to return the results.. [optional] + _return_http_data_only (bool): response data without head status + code and headers. Default is True. + _preload_content (bool): if False, the urllib3.HTTPResponse object + will be returned without reading/decoding response data. + Default is True. + _request_timeout (int/float/tuple): timeout setting for this request. If + one number provided, it will be total request timeout. It can also + be a pair (tuple) of (connection, read) timeouts. + Default is None. + _check_input_type (bool): specifies if type checking + should be done one the data sent to the server. + Default is True. + _check_return_type (bool): specifies if type checking + should be done one the data received from the server. + Default is True. + _host_index (int/None): specifies the index of the server + that we want to use. + Default is read from the configuration. + async_req (bool): execute request asynchronously + + Returns: + PickupList + If the method is called asynchronously, returns the request + thread. + """ + kwargs['async_req'] = kwargs.get( + 'async_req', False + ) + kwargs['_return_http_data_only'] = kwargs.get( + '_return_http_data_only', True + ) + kwargs['_preload_content'] = kwargs.get( + '_preload_content', True + ) + kwargs['_request_timeout'] = kwargs.get( + '_request_timeout', None + ) + kwargs['_check_input_type'] = kwargs.get( + '_check_input_type', True + ) + kwargs['_check_return_type'] = kwargs.get( + '_check_return_type', True + ) + kwargs['_host_index'] = kwargs.get('_host_index') + return self.call_with_http_info(**kwargs) + + self.list = _Endpoint( + settings={ + 'response_type': (PickupList,), + 'auth': [ + 'Token' + ], + 'endpoint_path': '/v1/pickups', + 'operation_id': 'list', + 'http_method': 'GET', + 'servers': None, + }, + params_map={ + 'all': [ + 'test_mode', + 'limit', + 'offset', + ], + 'required': [], + 'nullable': [ + ], + 'enum': [ + ], + 'validation': [ + ] + }, + root_map={ + 'validations': { + }, + 'allowed_values': { + }, + 'openapi_types': { + 'test_mode': + (bool,), + 'limit': + (int,), + 'offset': + (int,), + }, + 'attribute_map': { + 'test_mode': 'test_mode', + 'limit': 'limit', + 'offset': 'offset', + }, + 'location_map': { + 'test_mode': 'query', + 'limit': 'query', + 'offset': 'query', + }, + 'collection_format_map': { + } + }, + headers_map={ + 'accept': [ + 'application/json' + ], + 'content_type': [], + }, + api_client=api_client, + callable=__list + ) + + def __retrieve( + self, + id, + **kwargs + ): + """Retrieve a pickup # noqa: E501 + + Retrieve a scheduled pickup. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.retrieve(id, async_req=True) + >>> result = thread.get() + + Args: + id (str): + + Keyword Args: + _return_http_data_only (bool): response data without head status + code and headers. Default is True. + _preload_content (bool): if False, the urllib3.HTTPResponse object + will be returned without reading/decoding response data. + Default is True. + _request_timeout (int/float/tuple): timeout setting for this request. If + one number provided, it will be total request timeout. It can also + be a pair (tuple) of (connection, read) timeouts. + Default is None. + _check_input_type (bool): specifies if type checking + should be done one the data sent to the server. + Default is True. + _check_return_type (bool): specifies if type checking + should be done one the data received from the server. + Default is True. + _host_index (int/None): specifies the index of the server + that we want to use. + Default is read from the configuration. + async_req (bool): execute request asynchronously + + Returns: + Pickup + If the method is called asynchronously, returns the request + thread. + """ + kwargs['async_req'] = kwargs.get( + 'async_req', False + ) + kwargs['_return_http_data_only'] = kwargs.get( + '_return_http_data_only', True + ) + kwargs['_preload_content'] = kwargs.get( + '_preload_content', True + ) + kwargs['_request_timeout'] = kwargs.get( + '_request_timeout', None + ) + kwargs['_check_input_type'] = kwargs.get( + '_check_input_type', True + ) + kwargs['_check_return_type'] = kwargs.get( + '_check_return_type', True + ) + kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['id'] = \ + id + return self.call_with_http_info(**kwargs) + + self.retrieve = _Endpoint( + settings={ + 'response_type': (Pickup,), + 'auth': [ + 'Token' + ], + 'endpoint_path': '/v1/pickups/{id}', + 'operation_id': 'retrieve', + 'http_method': 'GET', + 'servers': None, + }, + params_map={ + 'all': [ + 'id', + ], + 'required': [ + 'id', + ], + 'nullable': [ + ], + 'enum': [ + ], + 'validation': [ + ] + }, + root_map={ + 'validations': { + }, + 'allowed_values': { + }, + 'openapi_types': { + 'id': + (str,), + }, + 'attribute_map': { + 'id': 'id', + }, + 'location_map': { + 'id': 'path', + }, + 'collection_format_map': { + } + }, + headers_map={ + 'accept': [ + 'application/json' + ], + 'content_type': [], + }, + api_client=api_client, + callable=__retrieve + ) + + def __schedule( + self, + carrier_name, + data, + **kwargs + ): + """Schedule a pickup # noqa: E501 + + Schedule a pickup for one or many shipments with labels already purchased. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.schedule(carrier_name, data, async_req=True) + >>> result = thread.get() + + Args: + carrier_name (str): + data (PickupData): + + Keyword Args: + test (bool, none_type): The test flag indicates whether to use a carrier configured for test.. [optional] if omitted the server will use the default value of False + _return_http_data_only (bool): response data without head status + code and headers. Default is True. + _preload_content (bool): if False, the urllib3.HTTPResponse object + will be returned without reading/decoding response data. + Default is True. + _request_timeout (int/float/tuple): timeout setting for this request. If + one number provided, it will be total request timeout. It can also + be a pair (tuple) of (connection, read) timeouts. + Default is None. + _check_input_type (bool): specifies if type checking + should be done one the data sent to the server. + Default is True. + _check_return_type (bool): specifies if type checking + should be done one the data received from the server. + Default is True. + _host_index (int/None): specifies the index of the server + that we want to use. + Default is read from the configuration. + async_req (bool): execute request asynchronously + + Returns: + Pickup + If the method is called asynchronously, returns the request + thread. + """ + kwargs['async_req'] = kwargs.get( + 'async_req', False + ) + kwargs['_return_http_data_only'] = kwargs.get( + '_return_http_data_only', True + ) + kwargs['_preload_content'] = kwargs.get( + '_preload_content', True + ) + kwargs['_request_timeout'] = kwargs.get( + '_request_timeout', None + ) + kwargs['_check_input_type'] = kwargs.get( + '_check_input_type', True + ) + kwargs['_check_return_type'] = kwargs.get( + '_check_return_type', True + ) + kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['carrier_name'] = \ + carrier_name + kwargs['data'] = \ + data + return self.call_with_http_info(**kwargs) + + self.schedule = _Endpoint( + settings={ + 'response_type': (Pickup,), + 'auth': [ + 'Token' + ], + 'endpoint_path': '/v1/pickups/{carrier_name}/schedule', + 'operation_id': 'schedule', + 'http_method': 'POST', + 'servers': None, + }, + params_map={ + 'all': [ + 'carrier_name', + 'data', + 'test', + ], + 'required': [ + 'carrier_name', + 'data', + ], + 'nullable': [ + 'test', + ], + 'enum': [ + ], + 'validation': [ + ] + }, + root_map={ + 'validations': { + }, + 'allowed_values': { + }, + 'openapi_types': { + 'carrier_name': + (str,), + 'data': + (PickupData,), + 'test': + (bool, none_type,), + }, + 'attribute_map': { + 'carrier_name': 'carrier_name', + 'test': 'test', + }, + 'location_map': { + 'carrier_name': 'path', + 'data': 'body', + 'test': 'query', + }, + 'collection_format_map': { + } + }, + headers_map={ + 'accept': [ + 'application/json' + ], + 'content_type': [ + 'application/json' + ] + }, + api_client=api_client, + callable=__schedule + ) + + def __update( + self, + id, + data, + **kwargs + ): + """Update a pickup # noqa: E501 + + Modify a pickup for one or many shipments with labels already purchased. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.update(id, data, async_req=True) + >>> result = thread.get() + + Args: + id (str): + data (PickupUpdateData): + + Keyword Args: + _return_http_data_only (bool): response data without head status + code and headers. Default is True. + _preload_content (bool): if False, the urllib3.HTTPResponse object + will be returned without reading/decoding response data. + Default is True. + _request_timeout (int/float/tuple): timeout setting for this request. If + one number provided, it will be total request timeout. It can also + be a pair (tuple) of (connection, read) timeouts. + Default is None. + _check_input_type (bool): specifies if type checking + should be done one the data sent to the server. + Default is True. + _check_return_type (bool): specifies if type checking + should be done one the data received from the server. + Default is True. + _host_index (int/None): specifies the index of the server + that we want to use. + Default is read from the configuration. + async_req (bool): execute request asynchronously + + Returns: + OperationConfirmation + If the method is called asynchronously, returns the request + thread. + """ + kwargs['async_req'] = kwargs.get( + 'async_req', False + ) + kwargs['_return_http_data_only'] = kwargs.get( + '_return_http_data_only', True + ) + kwargs['_preload_content'] = kwargs.get( + '_preload_content', True + ) + kwargs['_request_timeout'] = kwargs.get( + '_request_timeout', None + ) + kwargs['_check_input_type'] = kwargs.get( + '_check_input_type', True + ) + kwargs['_check_return_type'] = kwargs.get( + '_check_return_type', True + ) + kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['id'] = \ + id + kwargs['data'] = \ + data + return self.call_with_http_info(**kwargs) + + self.update = _Endpoint( + settings={ + 'response_type': (OperationConfirmation,), + 'auth': [ + 'Token' + ], + 'endpoint_path': '/v1/pickups/{id}', + 'operation_id': 'update', + 'http_method': 'PATCH', + 'servers': None, + }, + params_map={ + 'all': [ + 'id', + 'data', + ], + 'required': [ + 'id', + 'data', + ], + 'nullable': [ + ], + 'enum': [ + ], + 'validation': [ + ] + }, + root_map={ + 'validations': { + }, + 'allowed_values': { + }, + 'openapi_types': { + 'id': + (str,), + 'data': + (PickupUpdateData,), + }, + 'attribute_map': { + 'id': 'id', + }, + 'location_map': { + 'id': 'path', + 'data': 'body', + }, + 'collection_format_map': { + } + }, + headers_map={ + 'accept': [ + 'application/json' + ], + 'content_type': [ + 'application/json' + ] + }, + api_client=api_client, + callable=__update + ) diff --git a/purplship/api/proxy_api.py b/purplship/api/proxy_api.py index a29c82c..28f9801 100644 --- a/purplship/api/proxy_api.py +++ b/purplship/api/proxy_api.py @@ -1,30 +1,46 @@ -# coding: utf-8 - """ Purplship API - ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.6.2`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 + ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.7`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 - OpenAPI spec version: 2021.6.2 + The version of the OpenAPI document: 2021.7 Contact: hello@purplship.com - Generated by: https://github.com/swagger-api/swagger-codegen.git + Generated by: https://openapi-generator.tech """ -from __future__ import absolute_import import re # noqa: F401 - -# python 2 and python 3 compatibility library -import six - -from purplship.api_client import ApiClient +import sys # noqa: F401 + +from purplship.api_client import ApiClient, Endpoint as _Endpoint +from purplship.model_utils import ( # noqa: F401 + check_allowed_values, + check_validations, + date, + datetime, + file_type, + none_type, + validate_and_convert_types +) +from purplship.model.error_response import ErrorResponse +from purplship.model.operation_response import OperationResponse +from purplship.model.pickup_cancel_request import PickupCancelRequest +from purplship.model.pickup_request import PickupRequest +from purplship.model.pickup_response import PickupResponse +from purplship.model.pickup_update_request import PickupUpdateRequest +from purplship.model.rate_request import RateRequest +from purplship.model.rate_response import RateResponse +from purplship.model.shipment import Shipment +from purplship.model.shipment_cancel_request import ShipmentCancelRequest +from purplship.model.shipping_request import ShippingRequest +from purplship.model.tracking_response import TrackingResponse class ProxyApi(object): - """NOTE: This class is auto generated by the swagger code generator program. + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech Do not edit the class manually. - Ref: https://github.com/swagger-api/swagger-codegen """ def __init__(self, api_client=None): @@ -32,751 +48,933 @@ def __init__(self, api_client=None): api_client = ApiClient() self.api_client = api_client - def buy_label(self, body, **kwargs): # noqa: E501 - """Buy a shipment label # noqa: E501 - - Once the shipping rates are retrieved, provide the required info to submit the shipment by specifying your preferred rate. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.buy_label(body, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param ShippingRequest body: (required) - :return: Shipment - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.buy_label_with_http_info(body, **kwargs) # noqa: E501 - else: - (data) = self.buy_label_with_http_info(body, **kwargs) # noqa: E501 - return data - - def buy_label_with_http_info(self, body, **kwargs): # noqa: E501 - """Buy a shipment label # noqa: E501 - - Once the shipping rates are retrieved, provide the required info to submit the shipment by specifying your preferred rate. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.buy_label_with_http_info(body, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param ShippingRequest body: (required) - :return: Shipment - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['body'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method buy_label" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'body' is set - if ('body' not in params or - params['body'] is None): - raise ValueError("Missing the required parameter `body` when calling `buy_label`") # noqa: E501 - - collection_formats = {} - - path_params = {} - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if 'body' in params: - body_params = params['body'] - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['Token'] # noqa: E501 - - return self.api_client.call_api( - '/v1/proxy/shipping', 'POST', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='Shipment', # noqa: E501 - auth_settings=auth_settings, - async_req=params.get('async_req'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def cancel_pickup(self, body, carrier_name, **kwargs): # noqa: E501 - """Cancel a pickup # noqa: E501 - - Cancel a pickup previously scheduled # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.cancel_pickup(body, carrier_name, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param PickupCancelRequest body: (required) - :param str carrier_name: (required) - :param bool test: The test flag indicates whether to use a carrier configured for test. - :return: OperationResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.cancel_pickup_with_http_info(body, carrier_name, **kwargs) # noqa: E501 - else: - (data) = self.cancel_pickup_with_http_info(body, carrier_name, **kwargs) # noqa: E501 - return data - - def cancel_pickup_with_http_info(self, body, carrier_name, **kwargs): # noqa: E501 - """Cancel a pickup # noqa: E501 - - Cancel a pickup previously scheduled # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.cancel_pickup_with_http_info(body, carrier_name, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param PickupCancelRequest body: (required) - :param str carrier_name: (required) - :param bool test: The test flag indicates whether to use a carrier configured for test. - :return: OperationResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['body', 'carrier_name', 'test'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method cancel_pickup" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'body' is set - if ('body' not in params or - params['body'] is None): - raise ValueError("Missing the required parameter `body` when calling `cancel_pickup`") # noqa: E501 - # verify the required parameter 'carrier_name' is set - if ('carrier_name' not in params or - params['carrier_name'] is None): - raise ValueError("Missing the required parameter `carrier_name` when calling `cancel_pickup`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'carrier_name' in params: - path_params['carrier_name'] = params['carrier_name'] # noqa: E501 - - query_params = [] - if 'test' in params: - query_params.append(('test', params['test'])) # noqa: E501 - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if 'body' in params: - body_params = params['body'] - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['Token'] # noqa: E501 - - return self.api_client.call_api( - '/v1/proxy/pickups/{carrier_name}/cancel', 'POST', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='OperationResponse', # noqa: E501 - auth_settings=auth_settings, - async_req=params.get('async_req'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def fetch_rates(self, body, **kwargs): # noqa: E501 - """Fetch shipment rates # noqa: E501 - - The Shipping process begins by fetching rates for your shipment. Use this service to fetch a shipping rates available. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.fetch_rates(body, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param RateRequest body: (required) - :return: RateResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.fetch_rates_with_http_info(body, **kwargs) # noqa: E501 - else: - (data) = self.fetch_rates_with_http_info(body, **kwargs) # noqa: E501 - return data - - def fetch_rates_with_http_info(self, body, **kwargs): # noqa: E501 - """Fetch shipment rates # noqa: E501 - - The Shipping process begins by fetching rates for your shipment. Use this service to fetch a shipping rates available. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.fetch_rates_with_http_info(body, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param RateRequest body: (required) - :return: RateResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['body'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method fetch_rates" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'body' is set - if ('body' not in params or - params['body'] is None): - raise ValueError("Missing the required parameter `body` when calling `fetch_rates`") # noqa: E501 - - collection_formats = {} - - path_params = {} - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if 'body' in params: - body_params = params['body'] - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['Token'] # noqa: E501 - - return self.api_client.call_api( - '/v1/proxy/rates', 'POST', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='RateResponse', # noqa: E501 - auth_settings=auth_settings, - async_req=params.get('async_req'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def schedule_pickup(self, body, carrier_name, **kwargs): # noqa: E501 - """Schedule a pickup # noqa: E501 - - Schedule one or many parcels pickup # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.schedule_pickup(body, carrier_name, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param PickupRequest body: (required) - :param str carrier_name: (required) - :param bool test: The test flag indicates whether to use a carrier configured for test. - :return: PickupResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.schedule_pickup_with_http_info(body, carrier_name, **kwargs) # noqa: E501 - else: - (data) = self.schedule_pickup_with_http_info(body, carrier_name, **kwargs) # noqa: E501 - return data - - def schedule_pickup_with_http_info(self, body, carrier_name, **kwargs): # noqa: E501 - """Schedule a pickup # noqa: E501 - - Schedule one or many parcels pickup # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.schedule_pickup_with_http_info(body, carrier_name, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param PickupRequest body: (required) - :param str carrier_name: (required) - :param bool test: The test flag indicates whether to use a carrier configured for test. - :return: PickupResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['body', 'carrier_name', 'test'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method schedule_pickup" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'body' is set - if ('body' not in params or - params['body'] is None): - raise ValueError("Missing the required parameter `body` when calling `schedule_pickup`") # noqa: E501 - # verify the required parameter 'carrier_name' is set - if ('carrier_name' not in params or - params['carrier_name'] is None): - raise ValueError("Missing the required parameter `carrier_name` when calling `schedule_pickup`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'carrier_name' in params: - path_params['carrier_name'] = params['carrier_name'] # noqa: E501 - - query_params = [] - if 'test' in params: - query_params.append(('test', params['test'])) # noqa: E501 - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if 'body' in params: - body_params = params['body'] - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['Token'] # noqa: E501 - - return self.api_client.call_api( - '/v1/proxy/pickups/{carrier_name}', 'POST', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='PickupResponse', # noqa: E501 - auth_settings=auth_settings, - async_req=params.get('async_req'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def track_shipment(self, carrier_name, tracking_number, **kwargs): # noqa: E501 - """Track a shipment # noqa: E501 - - You can track a shipment by specifying the carrier and the shipment tracking number. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.track_shipment(carrier_name, tracking_number, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param str carrier_name: (required) - :param str tracking_number: (required) - :param bool test: The test flag indicates whether to use a carrier configured for test. - :return: TrackingResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.track_shipment_with_http_info(carrier_name, tracking_number, **kwargs) # noqa: E501 - else: - (data) = self.track_shipment_with_http_info(carrier_name, tracking_number, **kwargs) # noqa: E501 - return data - - def track_shipment_with_http_info(self, carrier_name, tracking_number, **kwargs): # noqa: E501 - """Track a shipment # noqa: E501 - - You can track a shipment by specifying the carrier and the shipment tracking number. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.track_shipment_with_http_info(carrier_name, tracking_number, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param str carrier_name: (required) - :param str tracking_number: (required) - :param bool test: The test flag indicates whether to use a carrier configured for test. - :return: TrackingResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['carrier_name', 'tracking_number', 'test'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method track_shipment" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'carrier_name' is set - if ('carrier_name' not in params or - params['carrier_name'] is None): - raise ValueError("Missing the required parameter `carrier_name` when calling `track_shipment`") # noqa: E501 - # verify the required parameter 'tracking_number' is set - if ('tracking_number' not in params or - params['tracking_number'] is None): - raise ValueError("Missing the required parameter `tracking_number` when calling `track_shipment`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'carrier_name' in params: - path_params['carrier_name'] = params['carrier_name'] # noqa: E501 - if 'tracking_number' in params: - path_params['tracking_number'] = params['tracking_number'] # noqa: E501 - - query_params = [] - if 'test' in params: - query_params.append(('test', params['test'])) # noqa: E501 - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['Token'] # noqa: E501 - - return self.api_client.call_api( - '/v1/proxy/tracking/{carrier_name}/{tracking_number}', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='TrackingResponse', # noqa: E501 - auth_settings=auth_settings, - async_req=params.get('async_req'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def update_pickup(self, body, carrier_name, **kwargs): # noqa: E501 - """Update a pickup # noqa: E501 - - Modify a scheduled pickup # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.update_pickup(body, carrier_name, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param PickupUpdateRequest body: (required) - :param str carrier_name: (required) - :param bool test: The test flag indicates whether to use a carrier configured for test. - :return: PickupResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.update_pickup_with_http_info(body, carrier_name, **kwargs) # noqa: E501 - else: - (data) = self.update_pickup_with_http_info(body, carrier_name, **kwargs) # noqa: E501 - return data - - def update_pickup_with_http_info(self, body, carrier_name, **kwargs): # noqa: E501 - """Update a pickup # noqa: E501 - - Modify a scheduled pickup # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.update_pickup_with_http_info(body, carrier_name, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param PickupUpdateRequest body: (required) - :param str carrier_name: (required) - :param bool test: The test flag indicates whether to use a carrier configured for test. - :return: PickupResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['body', 'carrier_name', 'test'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method update_pickup" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'body' is set - if ('body' not in params or - params['body'] is None): - raise ValueError("Missing the required parameter `body` when calling `update_pickup`") # noqa: E501 - # verify the required parameter 'carrier_name' is set - if ('carrier_name' not in params or - params['carrier_name'] is None): - raise ValueError("Missing the required parameter `carrier_name` when calling `update_pickup`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'carrier_name' in params: - path_params['carrier_name'] = params['carrier_name'] # noqa: E501 - - query_params = [] - if 'test' in params: - query_params.append(('test', params['test'])) # noqa: E501 - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if 'body' in params: - body_params = params['body'] - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['Token'] # noqa: E501 - - return self.api_client.call_api( - '/v1/proxy/pickups/{carrier_name}', 'PUT', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='PickupResponse', # noqa: E501 - auth_settings=auth_settings, - async_req=params.get('async_req'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def void_label(self, body, carrier_name, **kwargs): # noqa: E501 - """Void a shipment label # noqa: E501 - - Cancel a shipment and the label previously created # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.void_label(body, carrier_name, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param ShipmentCancelRequest body: (required) - :param str carrier_name: (required) - :param bool test: The test flag indicates whether to use a carrier configured for test. - :return: OperationResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.void_label_with_http_info(body, carrier_name, **kwargs) # noqa: E501 - else: - (data) = self.void_label_with_http_info(body, carrier_name, **kwargs) # noqa: E501 - return data - - def void_label_with_http_info(self, body, carrier_name, **kwargs): # noqa: E501 - """Void a shipment label # noqa: E501 - - Cancel a shipment and the label previously created # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.void_label_with_http_info(body, carrier_name, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param ShipmentCancelRequest body: (required) - :param str carrier_name: (required) - :param bool test: The test flag indicates whether to use a carrier configured for test. - :return: OperationResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['body', 'carrier_name', 'test'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method void_label" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'body' is set - if ('body' not in params or - params['body'] is None): - raise ValueError("Missing the required parameter `body` when calling `void_label`") # noqa: E501 - # verify the required parameter 'carrier_name' is set - if ('carrier_name' not in params or - params['carrier_name'] is None): - raise ValueError("Missing the required parameter `carrier_name` when calling `void_label`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'carrier_name' in params: - path_params['carrier_name'] = params['carrier_name'] # noqa: E501 - - query_params = [] - if 'test' in params: - query_params.append(('test', params['test'])) # noqa: E501 - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if 'body' in params: - body_params = params['body'] - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['Token'] # noqa: E501 - - return self.api_client.call_api( - '/v1/proxy/shipping/{carrier_name}/cancel', 'POST', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='OperationResponse', # noqa: E501 - auth_settings=auth_settings, - async_req=params.get('async_req'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) + def __buy_label( + self, + data, + **kwargs + ): + """Buy a shipment label # noqa: E501 + + Once the shipping rates are retrieved, provide the required info to submit the shipment by specifying your preferred rate. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.buy_label(data, async_req=True) + >>> result = thread.get() + + Args: + data (ShippingRequest): + + Keyword Args: + _return_http_data_only (bool): response data without head status + code and headers. Default is True. + _preload_content (bool): if False, the urllib3.HTTPResponse object + will be returned without reading/decoding response data. + Default is True. + _request_timeout (int/float/tuple): timeout setting for this request. If + one number provided, it will be total request timeout. It can also + be a pair (tuple) of (connection, read) timeouts. + Default is None. + _check_input_type (bool): specifies if type checking + should be done one the data sent to the server. + Default is True. + _check_return_type (bool): specifies if type checking + should be done one the data received from the server. + Default is True. + _host_index (int/None): specifies the index of the server + that we want to use. + Default is read from the configuration. + async_req (bool): execute request asynchronously + + Returns: + Shipment + If the method is called asynchronously, returns the request + thread. + """ + kwargs['async_req'] = kwargs.get( + 'async_req', False + ) + kwargs['_return_http_data_only'] = kwargs.get( + '_return_http_data_only', True + ) + kwargs['_preload_content'] = kwargs.get( + '_preload_content', True + ) + kwargs['_request_timeout'] = kwargs.get( + '_request_timeout', None + ) + kwargs['_check_input_type'] = kwargs.get( + '_check_input_type', True + ) + kwargs['_check_return_type'] = kwargs.get( + '_check_return_type', True + ) + kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['data'] = \ + data + return self.call_with_http_info(**kwargs) + + self.buy_label = _Endpoint( + settings={ + 'response_type': (Shipment,), + 'auth': [ + 'Token' + ], + 'endpoint_path': '/v1/proxy/shipping', + 'operation_id': 'buy_label', + 'http_method': 'POST', + 'servers': None, + }, + params_map={ + 'all': [ + 'data', + ], + 'required': [ + 'data', + ], + 'nullable': [ + ], + 'enum': [ + ], + 'validation': [ + ] + }, + root_map={ + 'validations': { + }, + 'allowed_values': { + }, + 'openapi_types': { + 'data': + (ShippingRequest,), + }, + 'attribute_map': { + }, + 'location_map': { + 'data': 'body', + }, + 'collection_format_map': { + } + }, + headers_map={ + 'accept': [ + 'application/json' + ], + 'content_type': [ + 'application/json' + ] + }, + api_client=api_client, + callable=__buy_label + ) + + def __cancel_pickup( + self, + carrier_name, + data, + **kwargs + ): + """Cancel a pickup # noqa: E501 + + Cancel a pickup previously scheduled # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.cancel_pickup(carrier_name, data, async_req=True) + >>> result = thread.get() + + Args: + carrier_name (str): + data (PickupCancelRequest): + + Keyword Args: + test (bool, none_type): The test flag indicates whether to use a carrier configured for test.. [optional] if omitted the server will use the default value of False + _return_http_data_only (bool): response data without head status + code and headers. Default is True. + _preload_content (bool): if False, the urllib3.HTTPResponse object + will be returned without reading/decoding response data. + Default is True. + _request_timeout (int/float/tuple): timeout setting for this request. If + one number provided, it will be total request timeout. It can also + be a pair (tuple) of (connection, read) timeouts. + Default is None. + _check_input_type (bool): specifies if type checking + should be done one the data sent to the server. + Default is True. + _check_return_type (bool): specifies if type checking + should be done one the data received from the server. + Default is True. + _host_index (int/None): specifies the index of the server + that we want to use. + Default is read from the configuration. + async_req (bool): execute request asynchronously + + Returns: + OperationResponse + If the method is called asynchronously, returns the request + thread. + """ + kwargs['async_req'] = kwargs.get( + 'async_req', False + ) + kwargs['_return_http_data_only'] = kwargs.get( + '_return_http_data_only', True + ) + kwargs['_preload_content'] = kwargs.get( + '_preload_content', True + ) + kwargs['_request_timeout'] = kwargs.get( + '_request_timeout', None + ) + kwargs['_check_input_type'] = kwargs.get( + '_check_input_type', True + ) + kwargs['_check_return_type'] = kwargs.get( + '_check_return_type', True + ) + kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['carrier_name'] = \ + carrier_name + kwargs['data'] = \ + data + return self.call_with_http_info(**kwargs) + + self.cancel_pickup = _Endpoint( + settings={ + 'response_type': (OperationResponse,), + 'auth': [ + 'Token' + ], + 'endpoint_path': '/v1/proxy/pickups/{carrier_name}/cancel', + 'operation_id': 'cancel_pickup', + 'http_method': 'POST', + 'servers': None, + }, + params_map={ + 'all': [ + 'carrier_name', + 'data', + 'test', + ], + 'required': [ + 'carrier_name', + 'data', + ], + 'nullable': [ + 'test', + ], + 'enum': [ + ], + 'validation': [ + ] + }, + root_map={ + 'validations': { + }, + 'allowed_values': { + }, + 'openapi_types': { + 'carrier_name': + (str,), + 'data': + (PickupCancelRequest,), + 'test': + (bool, none_type,), + }, + 'attribute_map': { + 'carrier_name': 'carrier_name', + 'test': 'test', + }, + 'location_map': { + 'carrier_name': 'path', + 'data': 'body', + 'test': 'query', + }, + 'collection_format_map': { + } + }, + headers_map={ + 'accept': [ + 'application/json' + ], + 'content_type': [ + 'application/json' + ] + }, + api_client=api_client, + callable=__cancel_pickup + ) + + def __fetch_rates( + self, + data, + **kwargs + ): + """Fetch shipment rates # noqa: E501 + + The Shipping process begins by fetching rates for your shipment. Use this service to fetch a shipping rates available. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.fetch_rates(data, async_req=True) + >>> result = thread.get() + + Args: + data (RateRequest): + + Keyword Args: + test (bool, none_type): The test flag indicates whether to use a carrier configured for test.. [optional] if omitted the server will use the default value of False + _return_http_data_only (bool): response data without head status + code and headers. Default is True. + _preload_content (bool): if False, the urllib3.HTTPResponse object + will be returned without reading/decoding response data. + Default is True. + _request_timeout (int/float/tuple): timeout setting for this request. If + one number provided, it will be total request timeout. It can also + be a pair (tuple) of (connection, read) timeouts. + Default is None. + _check_input_type (bool): specifies if type checking + should be done one the data sent to the server. + Default is True. + _check_return_type (bool): specifies if type checking + should be done one the data received from the server. + Default is True. + _host_index (int/None): specifies the index of the server + that we want to use. + Default is read from the configuration. + async_req (bool): execute request asynchronously + + Returns: + RateResponse + If the method is called asynchronously, returns the request + thread. + """ + kwargs['async_req'] = kwargs.get( + 'async_req', False + ) + kwargs['_return_http_data_only'] = kwargs.get( + '_return_http_data_only', True + ) + kwargs['_preload_content'] = kwargs.get( + '_preload_content', True + ) + kwargs['_request_timeout'] = kwargs.get( + '_request_timeout', None + ) + kwargs['_check_input_type'] = kwargs.get( + '_check_input_type', True + ) + kwargs['_check_return_type'] = kwargs.get( + '_check_return_type', True + ) + kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['data'] = \ + data + return self.call_with_http_info(**kwargs) + + self.fetch_rates = _Endpoint( + settings={ + 'response_type': (RateResponse,), + 'auth': [ + 'Token' + ], + 'endpoint_path': '/v1/proxy/rates', + 'operation_id': 'fetch_rates', + 'http_method': 'POST', + 'servers': None, + }, + params_map={ + 'all': [ + 'data', + 'test', + ], + 'required': [ + 'data', + ], + 'nullable': [ + 'test', + ], + 'enum': [ + ], + 'validation': [ + ] + }, + root_map={ + 'validations': { + }, + 'allowed_values': { + }, + 'openapi_types': { + 'data': + (RateRequest,), + 'test': + (bool, none_type,), + }, + 'attribute_map': { + 'test': 'test', + }, + 'location_map': { + 'data': 'body', + 'test': 'query', + }, + 'collection_format_map': { + } + }, + headers_map={ + 'accept': [ + 'application/json' + ], + 'content_type': [ + 'application/json' + ] + }, + api_client=api_client, + callable=__fetch_rates + ) + + def __schedule_pickup( + self, + carrier_name, + data, + **kwargs + ): + """Schedule a pickup # noqa: E501 + + Schedule one or many parcels pickup # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.schedule_pickup(carrier_name, data, async_req=True) + >>> result = thread.get() + + Args: + carrier_name (str): + data (PickupRequest): + + Keyword Args: + test (bool, none_type): The test flag indicates whether to use a carrier configured for test.. [optional] if omitted the server will use the default value of False + _return_http_data_only (bool): response data without head status + code and headers. Default is True. + _preload_content (bool): if False, the urllib3.HTTPResponse object + will be returned without reading/decoding response data. + Default is True. + _request_timeout (int/float/tuple): timeout setting for this request. If + one number provided, it will be total request timeout. It can also + be a pair (tuple) of (connection, read) timeouts. + Default is None. + _check_input_type (bool): specifies if type checking + should be done one the data sent to the server. + Default is True. + _check_return_type (bool): specifies if type checking + should be done one the data received from the server. + Default is True. + _host_index (int/None): specifies the index of the server + that we want to use. + Default is read from the configuration. + async_req (bool): execute request asynchronously + + Returns: + PickupResponse + If the method is called asynchronously, returns the request + thread. + """ + kwargs['async_req'] = kwargs.get( + 'async_req', False + ) + kwargs['_return_http_data_only'] = kwargs.get( + '_return_http_data_only', True + ) + kwargs['_preload_content'] = kwargs.get( + '_preload_content', True + ) + kwargs['_request_timeout'] = kwargs.get( + '_request_timeout', None + ) + kwargs['_check_input_type'] = kwargs.get( + '_check_input_type', True + ) + kwargs['_check_return_type'] = kwargs.get( + '_check_return_type', True + ) + kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['carrier_name'] = \ + carrier_name + kwargs['data'] = \ + data + return self.call_with_http_info(**kwargs) + + self.schedule_pickup = _Endpoint( + settings={ + 'response_type': (PickupResponse,), + 'auth': [ + 'Token' + ], + 'endpoint_path': '/v1/proxy/pickups/{carrier_name}', + 'operation_id': 'schedule_pickup', + 'http_method': 'POST', + 'servers': None, + }, + params_map={ + 'all': [ + 'carrier_name', + 'data', + 'test', + ], + 'required': [ + 'carrier_name', + 'data', + ], + 'nullable': [ + 'test', + ], + 'enum': [ + ], + 'validation': [ + ] + }, + root_map={ + 'validations': { + }, + 'allowed_values': { + }, + 'openapi_types': { + 'carrier_name': + (str,), + 'data': + (PickupRequest,), + 'test': + (bool, none_type,), + }, + 'attribute_map': { + 'carrier_name': 'carrier_name', + 'test': 'test', + }, + 'location_map': { + 'carrier_name': 'path', + 'data': 'body', + 'test': 'query', + }, + 'collection_format_map': { + } + }, + headers_map={ + 'accept': [ + 'application/json' + ], + 'content_type': [ + 'application/json' + ] + }, + api_client=api_client, + callable=__schedule_pickup + ) + + def __track_shipment( + self, + carrier_name, + tracking_number, + **kwargs + ): + """Track a shipment # noqa: E501 + + You can track a shipment by specifying the carrier and the shipment tracking number. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.track_shipment(carrier_name, tracking_number, async_req=True) + >>> result = thread.get() + + Args: + carrier_name (str): + tracking_number (str): + + Keyword Args: + test (bool, none_type): The test flag indicates whether to use a carrier configured for test.. [optional] if omitted the server will use the default value of False + _return_http_data_only (bool): response data without head status + code and headers. Default is True. + _preload_content (bool): if False, the urllib3.HTTPResponse object + will be returned without reading/decoding response data. + Default is True. + _request_timeout (int/float/tuple): timeout setting for this request. If + one number provided, it will be total request timeout. It can also + be a pair (tuple) of (connection, read) timeouts. + Default is None. + _check_input_type (bool): specifies if type checking + should be done one the data sent to the server. + Default is True. + _check_return_type (bool): specifies if type checking + should be done one the data received from the server. + Default is True. + _host_index (int/None): specifies the index of the server + that we want to use. + Default is read from the configuration. + async_req (bool): execute request asynchronously + + Returns: + TrackingResponse + If the method is called asynchronously, returns the request + thread. + """ + kwargs['async_req'] = kwargs.get( + 'async_req', False + ) + kwargs['_return_http_data_only'] = kwargs.get( + '_return_http_data_only', True + ) + kwargs['_preload_content'] = kwargs.get( + '_preload_content', True + ) + kwargs['_request_timeout'] = kwargs.get( + '_request_timeout', None + ) + kwargs['_check_input_type'] = kwargs.get( + '_check_input_type', True + ) + kwargs['_check_return_type'] = kwargs.get( + '_check_return_type', True + ) + kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['carrier_name'] = \ + carrier_name + kwargs['tracking_number'] = \ + tracking_number + return self.call_with_http_info(**kwargs) + + self.track_shipment = _Endpoint( + settings={ + 'response_type': (TrackingResponse,), + 'auth': [ + 'Token' + ], + 'endpoint_path': '/v1/proxy/tracking/{carrier_name}/{tracking_number}', + 'operation_id': 'track_shipment', + 'http_method': 'GET', + 'servers': None, + }, + params_map={ + 'all': [ + 'carrier_name', + 'tracking_number', + 'test', + ], + 'required': [ + 'carrier_name', + 'tracking_number', + ], + 'nullable': [ + 'test', + ], + 'enum': [ + ], + 'validation': [ + ] + }, + root_map={ + 'validations': { + }, + 'allowed_values': { + }, + 'openapi_types': { + 'carrier_name': + (str,), + 'tracking_number': + (str,), + 'test': + (bool, none_type,), + }, + 'attribute_map': { + 'carrier_name': 'carrier_name', + 'tracking_number': 'tracking_number', + 'test': 'test', + }, + 'location_map': { + 'carrier_name': 'path', + 'tracking_number': 'path', + 'test': 'query', + }, + 'collection_format_map': { + } + }, + headers_map={ + 'accept': [ + 'application/json' + ], + 'content_type': [], + }, + api_client=api_client, + callable=__track_shipment + ) + + def __update_pickup( + self, + carrier_name, + data, + **kwargs + ): + """Update a pickup # noqa: E501 + + Modify a scheduled pickup # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.update_pickup(carrier_name, data, async_req=True) + >>> result = thread.get() + + Args: + carrier_name (str): + data (PickupUpdateRequest): + + Keyword Args: + test (bool, none_type): The test flag indicates whether to use a carrier configured for test.. [optional] if omitted the server will use the default value of False + _return_http_data_only (bool): response data without head status + code and headers. Default is True. + _preload_content (bool): if False, the urllib3.HTTPResponse object + will be returned without reading/decoding response data. + Default is True. + _request_timeout (int/float/tuple): timeout setting for this request. If + one number provided, it will be total request timeout. It can also + be a pair (tuple) of (connection, read) timeouts. + Default is None. + _check_input_type (bool): specifies if type checking + should be done one the data sent to the server. + Default is True. + _check_return_type (bool): specifies if type checking + should be done one the data received from the server. + Default is True. + _host_index (int/None): specifies the index of the server + that we want to use. + Default is read from the configuration. + async_req (bool): execute request asynchronously + + Returns: + PickupResponse + If the method is called asynchronously, returns the request + thread. + """ + kwargs['async_req'] = kwargs.get( + 'async_req', False + ) + kwargs['_return_http_data_only'] = kwargs.get( + '_return_http_data_only', True + ) + kwargs['_preload_content'] = kwargs.get( + '_preload_content', True + ) + kwargs['_request_timeout'] = kwargs.get( + '_request_timeout', None + ) + kwargs['_check_input_type'] = kwargs.get( + '_check_input_type', True + ) + kwargs['_check_return_type'] = kwargs.get( + '_check_return_type', True + ) + kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['carrier_name'] = \ + carrier_name + kwargs['data'] = \ + data + return self.call_with_http_info(**kwargs) + + self.update_pickup = _Endpoint( + settings={ + 'response_type': (PickupResponse,), + 'auth': [ + 'Token' + ], + 'endpoint_path': '/v1/proxy/pickups/{carrier_name}', + 'operation_id': 'update_pickup', + 'http_method': 'PUT', + 'servers': None, + }, + params_map={ + 'all': [ + 'carrier_name', + 'data', + 'test', + ], + 'required': [ + 'carrier_name', + 'data', + ], + 'nullable': [ + 'test', + ], + 'enum': [ + ], + 'validation': [ + ] + }, + root_map={ + 'validations': { + }, + 'allowed_values': { + }, + 'openapi_types': { + 'carrier_name': + (str,), + 'data': + (PickupUpdateRequest,), + 'test': + (bool, none_type,), + }, + 'attribute_map': { + 'carrier_name': 'carrier_name', + 'test': 'test', + }, + 'location_map': { + 'carrier_name': 'path', + 'data': 'body', + 'test': 'query', + }, + 'collection_format_map': { + } + }, + headers_map={ + 'accept': [ + 'application/json' + ], + 'content_type': [ + 'application/json' + ] + }, + api_client=api_client, + callable=__update_pickup + ) + + def __void_label( + self, + carrier_name, + data, + **kwargs + ): + """Void a shipment label # noqa: E501 + + Cancel a shipment and the label previously created # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.void_label(carrier_name, data, async_req=True) + >>> result = thread.get() + + Args: + carrier_name (str): + data (ShipmentCancelRequest): + + Keyword Args: + test (bool, none_type): The test flag indicates whether to use a carrier configured for test.. [optional] if omitted the server will use the default value of False + _return_http_data_only (bool): response data without head status + code and headers. Default is True. + _preload_content (bool): if False, the urllib3.HTTPResponse object + will be returned without reading/decoding response data. + Default is True. + _request_timeout (int/float/tuple): timeout setting for this request. If + one number provided, it will be total request timeout. It can also + be a pair (tuple) of (connection, read) timeouts. + Default is None. + _check_input_type (bool): specifies if type checking + should be done one the data sent to the server. + Default is True. + _check_return_type (bool): specifies if type checking + should be done one the data received from the server. + Default is True. + _host_index (int/None): specifies the index of the server + that we want to use. + Default is read from the configuration. + async_req (bool): execute request asynchronously + + Returns: + OperationResponse + If the method is called asynchronously, returns the request + thread. + """ + kwargs['async_req'] = kwargs.get( + 'async_req', False + ) + kwargs['_return_http_data_only'] = kwargs.get( + '_return_http_data_only', True + ) + kwargs['_preload_content'] = kwargs.get( + '_preload_content', True + ) + kwargs['_request_timeout'] = kwargs.get( + '_request_timeout', None + ) + kwargs['_check_input_type'] = kwargs.get( + '_check_input_type', True + ) + kwargs['_check_return_type'] = kwargs.get( + '_check_return_type', True + ) + kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['carrier_name'] = \ + carrier_name + kwargs['data'] = \ + data + return self.call_with_http_info(**kwargs) + + self.void_label = _Endpoint( + settings={ + 'response_type': (OperationResponse,), + 'auth': [ + 'Token' + ], + 'endpoint_path': '/v1/proxy/shipping/{carrier_name}/cancel', + 'operation_id': 'void_label', + 'http_method': 'POST', + 'servers': None, + }, + params_map={ + 'all': [ + 'carrier_name', + 'data', + 'test', + ], + 'required': [ + 'carrier_name', + 'data', + ], + 'nullable': [ + 'test', + ], + 'enum': [ + ], + 'validation': [ + ] + }, + root_map={ + 'validations': { + }, + 'allowed_values': { + }, + 'openapi_types': { + 'carrier_name': + (str,), + 'data': + (ShipmentCancelRequest,), + 'test': + (bool, none_type,), + }, + 'attribute_map': { + 'carrier_name': 'carrier_name', + 'test': 'test', + }, + 'location_map': { + 'carrier_name': 'path', + 'data': 'body', + 'test': 'query', + }, + 'collection_format_map': { + } + }, + headers_map={ + 'accept': [ + 'application/json' + ], + 'content_type': [ + 'application/json' + ] + }, + api_client=api_client, + callable=__void_label + ) diff --git a/purplship/api/shipments_api.py b/purplship/api/shipments_api.py index 5cb16fb..a78d313 100644 --- a/purplship/api/shipments_api.py +++ b/purplship/api/shipments_api.py @@ -1,30 +1,43 @@ -# coding: utf-8 - """ Purplship API - ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.6.2`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 + ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.7`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 - OpenAPI spec version: 2021.6.2 + The version of the OpenAPI document: 2021.7 Contact: hello@purplship.com - Generated by: https://github.com/swagger-api/swagger-codegen.git + Generated by: https://openapi-generator.tech """ -from __future__ import absolute_import import re # noqa: F401 - -# python 2 and python 3 compatibility library -import six - -from purplship.api_client import ApiClient +import sys # noqa: F401 + +from purplship.api_client import ApiClient, Endpoint as _Endpoint +from purplship.model_utils import ( # noqa: F401 + check_allowed_values, + check_validations, + date, + datetime, + file_type, + none_type, + validate_and_convert_types +) +from purplship.model.customs_data import CustomsData +from purplship.model.error_response import ErrorResponse +from purplship.model.operation_response import OperationResponse +from purplship.model.parcel_data import ParcelData +from purplship.model.shipment import Shipment +from purplship.model.shipment_data import ShipmentData +from purplship.model.shipment_list import ShipmentList +from purplship.model.shipment_purchase_data import ShipmentPurchaseData +from purplship.model.shipment_rate_data import ShipmentRateData class ShipmentsApi(object): - """NOTE: This class is auto generated by the swagger code generator program. + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech Do not edit the class manually. - Ref: https://github.com/swagger-api/swagger-codegen """ def __init__(self, api_client=None): @@ -32,941 +45,1218 @@ def __init__(self, api_client=None): api_client = ApiClient() self.api_client = api_client - def add_customs(self, body, id, **kwargs): # noqa: E501 - """Add a customs declaration # noqa: E501 - - Add the customs declaration for the shipment if non existent. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.add_customs(body, id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param CustomsData body: (required) - :param str id: (required) - :return: Shipment - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.add_customs_with_http_info(body, id, **kwargs) # noqa: E501 - else: - (data) = self.add_customs_with_http_info(body, id, **kwargs) # noqa: E501 - return data - - def add_customs_with_http_info(self, body, id, **kwargs): # noqa: E501 - """Add a customs declaration # noqa: E501 - - Add the customs declaration for the shipment if non existent. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.add_customs_with_http_info(body, id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param CustomsData body: (required) - :param str id: (required) - :return: Shipment - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['body', 'id'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method add_customs" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'body' is set - if ('body' not in params or - params['body'] is None): - raise ValueError("Missing the required parameter `body` when calling `add_customs`") # noqa: E501 - # verify the required parameter 'id' is set - if ('id' not in params or - params['id'] is None): - raise ValueError("Missing the required parameter `id` when calling `add_customs`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'id' in params: - path_params['id'] = params['id'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if 'body' in params: - body_params = params['body'] - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['Token'] # noqa: E501 - - return self.api_client.call_api( - '/v1/shipments/{id}/customs', 'POST', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='Shipment', # noqa: E501 - auth_settings=auth_settings, - async_req=params.get('async_req'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def add_parcel(self, body, id, **kwargs): # noqa: E501 - """Add a shipment parcel # noqa: E501 - - Add a parcel to an existing shipment for a multi-parcel shipment. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.add_parcel(body, id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param ParcelData body: (required) - :param str id: (required) - :return: Shipment - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.add_parcel_with_http_info(body, id, **kwargs) # noqa: E501 - else: - (data) = self.add_parcel_with_http_info(body, id, **kwargs) # noqa: E501 - return data - - def add_parcel_with_http_info(self, body, id, **kwargs): # noqa: E501 - """Add a shipment parcel # noqa: E501 - - Add a parcel to an existing shipment for a multi-parcel shipment. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.add_parcel_with_http_info(body, id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param ParcelData body: (required) - :param str id: (required) - :return: Shipment - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['body', 'id'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method add_parcel" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'body' is set - if ('body' not in params or - params['body'] is None): - raise ValueError("Missing the required parameter `body` when calling `add_parcel`") # noqa: E501 - # verify the required parameter 'id' is set - if ('id' not in params or - params['id'] is None): - raise ValueError("Missing the required parameter `id` when calling `add_parcel`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'id' in params: - path_params['id'] = params['id'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if 'body' in params: - body_params = params['body'] - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['Token'] # noqa: E501 - - return self.api_client.call_api( - '/v1/shipments/{id}/parcels', 'POST', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='Shipment', # noqa: E501 - auth_settings=auth_settings, - async_req=params.get('async_req'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def cancel(self, id, **kwargs): # noqa: E501 - """Cancel a shipment # noqa: E501 - - Void a shipment with the associated label. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.cancel(id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param str id: (required) - :return: OperationResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.cancel_with_http_info(id, **kwargs) # noqa: E501 - else: - (data) = self.cancel_with_http_info(id, **kwargs) # noqa: E501 - return data - - def cancel_with_http_info(self, id, **kwargs): # noqa: E501 - """Cancel a shipment # noqa: E501 - - Void a shipment with the associated label. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.cancel_with_http_info(id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param str id: (required) - :return: OperationResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['id'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method cancel" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'id' is set - if ('id' not in params or - params['id'] is None): - raise ValueError("Missing the required parameter `id` when calling `cancel`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'id' in params: - path_params['id'] = params['id'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['Token'] # noqa: E501 - - return self.api_client.call_api( - '/v1/shipments/{id}', 'DELETE', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='OperationResponse', # noqa: E501 - auth_settings=auth_settings, - async_req=params.get('async_req'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def create(self, body, **kwargs): # noqa: E501 - """Create a shipment # noqa: E501 - - Create a new shipment instance. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.create(body, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param ShipmentData body: (required) - :param bool test: Create shipment in test or prod mode - :return: Shipment - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.create_with_http_info(body, **kwargs) # noqa: E501 - else: - (data) = self.create_with_http_info(body, **kwargs) # noqa: E501 - return data - - def create_with_http_info(self, body, **kwargs): # noqa: E501 - """Create a shipment # noqa: E501 - - Create a new shipment instance. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.create_with_http_info(body, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param ShipmentData body: (required) - :param bool test: Create shipment in test or prod mode - :return: Shipment - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['body', 'test'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method create" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'body' is set - if ('body' not in params or - params['body'] is None): - raise ValueError("Missing the required parameter `body` when calling `create`") # noqa: E501 - - collection_formats = {} - - path_params = {} - - query_params = [] - if 'test' in params: - query_params.append(('test', params['test'])) # noqa: E501 - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if 'body' in params: - body_params = params['body'] - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['Token'] # noqa: E501 - - return self.api_client.call_api( - '/v1/shipments', 'POST', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='Shipment', # noqa: E501 - auth_settings=auth_settings, - async_req=params.get('async_req'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def list(self, **kwargs): # noqa: E501 - """List all shipments # noqa: E501 - - Retrieve all shipments. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.list(async_req=True) - >>> result = thread.get() - - :param async_req bool - :param bool test_mode: - :param str status: - :param date created_start: - :param date created_end: - :param str carrier_id: - :param str service: - :param int limit: Number of results to return per page. - :param int offset: The initial index from which to return the results. - :param str carrier_name: - :return: ShipmentList - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.list_with_http_info(**kwargs) # noqa: E501 - else: - (data) = self.list_with_http_info(**kwargs) # noqa: E501 - return data - - def list_with_http_info(self, **kwargs): # noqa: E501 - """List all shipments # noqa: E501 - - Retrieve all shipments. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.list_with_http_info(async_req=True) - >>> result = thread.get() - - :param async_req bool - :param bool test_mode: - :param str status: - :param date created_start: - :param date created_end: - :param str carrier_id: - :param str service: - :param int limit: Number of results to return per page. - :param int offset: The initial index from which to return the results. - :param str carrier_name: - :return: ShipmentList - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['test_mode', 'status', 'created_start', 'created_end', 'carrier_id', 'service', 'limit', 'offset', 'carrier_name'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method list" % key - ) - params[key] = val - del params['kwargs'] - - collection_formats = {} - - path_params = {} - - query_params = [] - if 'test_mode' in params: - query_params.append(('test_mode', params['test_mode'])) # noqa: E501 - if 'status' in params: - query_params.append(('status', params['status'])) # noqa: E501 - if 'created_start' in params: - query_params.append(('created_start', params['created_start'])) # noqa: E501 - if 'created_end' in params: - query_params.append(('created_end', params['created_end'])) # noqa: E501 - if 'carrier_id' in params: - query_params.append(('carrier_id', params['carrier_id'])) # noqa: E501 - if 'service' in params: - query_params.append(('service', params['service'])) # noqa: E501 - if 'limit' in params: - query_params.append(('limit', params['limit'])) # noqa: E501 - if 'offset' in params: - query_params.append(('offset', params['offset'])) # noqa: E501 - if 'carrier_name' in params: - query_params.append(('carrier_name', params['carrier_name'])) # noqa: E501 - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['Token'] # noqa: E501 - - return self.api_client.call_api( - '/v1/shipments', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='ShipmentList', # noqa: E501 - auth_settings=auth_settings, - async_req=params.get('async_req'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def purchase(self, body, id, **kwargs): # noqa: E501 - """Buy a shipment label # noqa: E501 - - Select your preferred rates to buy a shipment label. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.purchase(body, id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param ShipmentPurchaseData body: (required) - :param str id: (required) - :return: Shipment - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.purchase_with_http_info(body, id, **kwargs) # noqa: E501 - else: - (data) = self.purchase_with_http_info(body, id, **kwargs) # noqa: E501 - return data - - def purchase_with_http_info(self, body, id, **kwargs): # noqa: E501 - """Buy a shipment label # noqa: E501 - - Select your preferred rates to buy a shipment label. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.purchase_with_http_info(body, id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param ShipmentPurchaseData body: (required) - :param str id: (required) - :return: Shipment - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['body', 'id'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method purchase" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'body' is set - if ('body' not in params or - params['body'] is None): - raise ValueError("Missing the required parameter `body` when calling `purchase`") # noqa: E501 - # verify the required parameter 'id' is set - if ('id' not in params or - params['id'] is None): - raise ValueError("Missing the required parameter `id` when calling `purchase`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'id' in params: - path_params['id'] = params['id'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if 'body' in params: - body_params = params['body'] - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['Token'] # noqa: E501 - - return self.api_client.call_api( - '/v1/shipments/{id}/purchase', 'POST', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='Shipment', # noqa: E501 - auth_settings=auth_settings, - async_req=params.get('async_req'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def rates(self, id, **kwargs): # noqa: E501 - """Fetch new shipment rates # noqa: E501 - - Refresh the list of the shipment rates # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.rates(id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param str id: (required) - :return: Shipment - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.rates_with_http_info(id, **kwargs) # noqa: E501 - else: - (data) = self.rates_with_http_info(id, **kwargs) # noqa: E501 - return data - - def rates_with_http_info(self, id, **kwargs): # noqa: E501 - """Fetch new shipment rates # noqa: E501 - - Refresh the list of the shipment rates # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.rates_with_http_info(id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param str id: (required) - :return: Shipment - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['id'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method rates" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'id' is set - if ('id' not in params or - params['id'] is None): - raise ValueError("Missing the required parameter `id` when calling `rates`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'id' in params: - path_params['id'] = params['id'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['Token'] # noqa: E501 - - return self.api_client.call_api( - '/v1/shipments/{id}/rates', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='Shipment', # noqa: E501 - auth_settings=auth_settings, - async_req=params.get('async_req'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def retrieve(self, id, **kwargs): # noqa: E501 - """Retrieve a shipment # noqa: E501 - - Retrieve a shipment. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.retrieve(id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param str id: (required) - :return: Shipment - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.retrieve_with_http_info(id, **kwargs) # noqa: E501 - else: - (data) = self.retrieve_with_http_info(id, **kwargs) # noqa: E501 - return data - - def retrieve_with_http_info(self, id, **kwargs): # noqa: E501 - """Retrieve a shipment # noqa: E501 - - Retrieve a shipment. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.retrieve_with_http_info(id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param str id: (required) - :return: Shipment - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['id'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method retrieve" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'id' is set - if ('id' not in params or - params['id'] is None): - raise ValueError("Missing the required parameter `id` when calling `retrieve`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'id' in params: - path_params['id'] = params['id'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['Token'] # noqa: E501 - - return self.api_client.call_api( - '/v1/shipments/{id}', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='Shipment', # noqa: E501 - auth_settings=auth_settings, - async_req=params.get('async_req'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def set_options(self, body, id, **kwargs): # noqa: E501 - """Add shipment options # noqa: E501 - - Add one or many options to your shipment.
**eg:**
- add shipment **insurance** - specify the preferred transaction **currency** - setup a **cash collected on delivery** option ```json { \"insurance\": 120, \"currency\": \"USD\" } ``` And many more, check additional options available in the [reference](#operation/all_references). # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.set_options(body, id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param object body: (required) - :param str id: (required) - :return: Shipment - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.set_options_with_http_info(body, id, **kwargs) # noqa: E501 - else: - (data) = self.set_options_with_http_info(body, id, **kwargs) # noqa: E501 - return data - - def set_options_with_http_info(self, body, id, **kwargs): # noqa: E501 - """Add shipment options # noqa: E501 - - Add one or many options to your shipment.
**eg:**
- add shipment **insurance** - specify the preferred transaction **currency** - setup a **cash collected on delivery** option ```json { \"insurance\": 120, \"currency\": \"USD\" } ``` And many more, check additional options available in the [reference](#operation/all_references). # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.set_options_with_http_info(body, id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param object body: (required) - :param str id: (required) - :return: Shipment - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['body', 'id'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method set_options" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'body' is set - if ('body' not in params or - params['body'] is None): - raise ValueError("Missing the required parameter `body` when calling `set_options`") # noqa: E501 - # verify the required parameter 'id' is set - if ('id' not in params or - params['id'] is None): - raise ValueError("Missing the required parameter `id` when calling `set_options`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'id' in params: - path_params['id'] = params['id'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if 'body' in params: - body_params = params['body'] - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['Token'] # noqa: E501 - - return self.api_client.call_api( - '/v1/shipments/{id}/options', 'POST', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='Shipment', # noqa: E501 - auth_settings=auth_settings, - async_req=params.get('async_req'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) + def __add_customs( + self, + id, + data, + **kwargs + ): + """Add a customs declaration # noqa: E501 + + Add the customs declaration for the shipment if non existent. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.add_customs(id, data, async_req=True) + >>> result = thread.get() + + Args: + id (str): + data (CustomsData): + + Keyword Args: + _return_http_data_only (bool): response data without head status + code and headers. Default is True. + _preload_content (bool): if False, the urllib3.HTTPResponse object + will be returned without reading/decoding response data. + Default is True. + _request_timeout (int/float/tuple): timeout setting for this request. If + one number provided, it will be total request timeout. It can also + be a pair (tuple) of (connection, read) timeouts. + Default is None. + _check_input_type (bool): specifies if type checking + should be done one the data sent to the server. + Default is True. + _check_return_type (bool): specifies if type checking + should be done one the data received from the server. + Default is True. + _host_index (int/None): specifies the index of the server + that we want to use. + Default is read from the configuration. + async_req (bool): execute request asynchronously + + Returns: + Shipment + If the method is called asynchronously, returns the request + thread. + """ + kwargs['async_req'] = kwargs.get( + 'async_req', False + ) + kwargs['_return_http_data_only'] = kwargs.get( + '_return_http_data_only', True + ) + kwargs['_preload_content'] = kwargs.get( + '_preload_content', True + ) + kwargs['_request_timeout'] = kwargs.get( + '_request_timeout', None + ) + kwargs['_check_input_type'] = kwargs.get( + '_check_input_type', True + ) + kwargs['_check_return_type'] = kwargs.get( + '_check_return_type', True + ) + kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['id'] = \ + id + kwargs['data'] = \ + data + return self.call_with_http_info(**kwargs) + + self.add_customs = _Endpoint( + settings={ + 'response_type': (Shipment,), + 'auth': [ + 'Token' + ], + 'endpoint_path': '/v1/shipments/{id}/customs', + 'operation_id': 'add_customs', + 'http_method': 'POST', + 'servers': None, + }, + params_map={ + 'all': [ + 'id', + 'data', + ], + 'required': [ + 'id', + 'data', + ], + 'nullable': [ + ], + 'enum': [ + ], + 'validation': [ + ] + }, + root_map={ + 'validations': { + }, + 'allowed_values': { + }, + 'openapi_types': { + 'id': + (str,), + 'data': + (CustomsData,), + }, + 'attribute_map': { + 'id': 'id', + }, + 'location_map': { + 'id': 'path', + 'data': 'body', + }, + 'collection_format_map': { + } + }, + headers_map={ + 'accept': [ + 'application/json' + ], + 'content_type': [ + 'application/json' + ] + }, + api_client=api_client, + callable=__add_customs + ) + + def __add_parcel( + self, + id, + data, + **kwargs + ): + """Add a shipment parcel # noqa: E501 + + Add a parcel to an existing shipment for a multi-parcel shipment. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.add_parcel(id, data, async_req=True) + >>> result = thread.get() + + Args: + id (str): + data (ParcelData): + + Keyword Args: + _return_http_data_only (bool): response data without head status + code and headers. Default is True. + _preload_content (bool): if False, the urllib3.HTTPResponse object + will be returned without reading/decoding response data. + Default is True. + _request_timeout (int/float/tuple): timeout setting for this request. If + one number provided, it will be total request timeout. It can also + be a pair (tuple) of (connection, read) timeouts. + Default is None. + _check_input_type (bool): specifies if type checking + should be done one the data sent to the server. + Default is True. + _check_return_type (bool): specifies if type checking + should be done one the data received from the server. + Default is True. + _host_index (int/None): specifies the index of the server + that we want to use. + Default is read from the configuration. + async_req (bool): execute request asynchronously + + Returns: + Shipment + If the method is called asynchronously, returns the request + thread. + """ + kwargs['async_req'] = kwargs.get( + 'async_req', False + ) + kwargs['_return_http_data_only'] = kwargs.get( + '_return_http_data_only', True + ) + kwargs['_preload_content'] = kwargs.get( + '_preload_content', True + ) + kwargs['_request_timeout'] = kwargs.get( + '_request_timeout', None + ) + kwargs['_check_input_type'] = kwargs.get( + '_check_input_type', True + ) + kwargs['_check_return_type'] = kwargs.get( + '_check_return_type', True + ) + kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['id'] = \ + id + kwargs['data'] = \ + data + return self.call_with_http_info(**kwargs) + + self.add_parcel = _Endpoint( + settings={ + 'response_type': (Shipment,), + 'auth': [ + 'Token' + ], + 'endpoint_path': '/v1/shipments/{id}/parcels', + 'operation_id': 'add_parcel', + 'http_method': 'POST', + 'servers': None, + }, + params_map={ + 'all': [ + 'id', + 'data', + ], + 'required': [ + 'id', + 'data', + ], + 'nullable': [ + ], + 'enum': [ + ], + 'validation': [ + ] + }, + root_map={ + 'validations': { + }, + 'allowed_values': { + }, + 'openapi_types': { + 'id': + (str,), + 'data': + (ParcelData,), + }, + 'attribute_map': { + 'id': 'id', + }, + 'location_map': { + 'id': 'path', + 'data': 'body', + }, + 'collection_format_map': { + } + }, + headers_map={ + 'accept': [ + 'application/json' + ], + 'content_type': [ + 'application/json' + ] + }, + api_client=api_client, + callable=__add_parcel + ) + + def __cancel( + self, + id, + **kwargs + ): + """Cancel a shipment # noqa: E501 + + Void a shipment with the associated label. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.cancel(id, async_req=True) + >>> result = thread.get() + + Args: + id (str): + + Keyword Args: + _return_http_data_only (bool): response data without head status + code and headers. Default is True. + _preload_content (bool): if False, the urllib3.HTTPResponse object + will be returned without reading/decoding response data. + Default is True. + _request_timeout (int/float/tuple): timeout setting for this request. If + one number provided, it will be total request timeout. It can also + be a pair (tuple) of (connection, read) timeouts. + Default is None. + _check_input_type (bool): specifies if type checking + should be done one the data sent to the server. + Default is True. + _check_return_type (bool): specifies if type checking + should be done one the data received from the server. + Default is True. + _host_index (int/None): specifies the index of the server + that we want to use. + Default is read from the configuration. + async_req (bool): execute request asynchronously + + Returns: + OperationResponse + If the method is called asynchronously, returns the request + thread. + """ + kwargs['async_req'] = kwargs.get( + 'async_req', False + ) + kwargs['_return_http_data_only'] = kwargs.get( + '_return_http_data_only', True + ) + kwargs['_preload_content'] = kwargs.get( + '_preload_content', True + ) + kwargs['_request_timeout'] = kwargs.get( + '_request_timeout', None + ) + kwargs['_check_input_type'] = kwargs.get( + '_check_input_type', True + ) + kwargs['_check_return_type'] = kwargs.get( + '_check_return_type', True + ) + kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['id'] = \ + id + return self.call_with_http_info(**kwargs) + + self.cancel = _Endpoint( + settings={ + 'response_type': (OperationResponse,), + 'auth': [ + 'Token' + ], + 'endpoint_path': '/v1/shipments/{id}', + 'operation_id': 'cancel', + 'http_method': 'DELETE', + 'servers': None, + }, + params_map={ + 'all': [ + 'id', + ], + 'required': [ + 'id', + ], + 'nullable': [ + ], + 'enum': [ + ], + 'validation': [ + ] + }, + root_map={ + 'validations': { + }, + 'allowed_values': { + }, + 'openapi_types': { + 'id': + (str,), + }, + 'attribute_map': { + 'id': 'id', + }, + 'location_map': { + 'id': 'path', + }, + 'collection_format_map': { + } + }, + headers_map={ + 'accept': [ + 'application/json' + ], + 'content_type': [], + }, + api_client=api_client, + callable=__cancel + ) + + def __create( + self, + data, + **kwargs + ): + """Create a shipment # noqa: E501 + + Create a new shipment instance. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.create(data, async_req=True) + >>> result = thread.get() + + Args: + data (ShipmentData): + + Keyword Args: + test (bool, none_type): Create shipment in test or prod mode. [optional] + _return_http_data_only (bool): response data without head status + code and headers. Default is True. + _preload_content (bool): if False, the urllib3.HTTPResponse object + will be returned without reading/decoding response data. + Default is True. + _request_timeout (int/float/tuple): timeout setting for this request. If + one number provided, it will be total request timeout. It can also + be a pair (tuple) of (connection, read) timeouts. + Default is None. + _check_input_type (bool): specifies if type checking + should be done one the data sent to the server. + Default is True. + _check_return_type (bool): specifies if type checking + should be done one the data received from the server. + Default is True. + _host_index (int/None): specifies the index of the server + that we want to use. + Default is read from the configuration. + async_req (bool): execute request asynchronously + + Returns: + Shipment + If the method is called asynchronously, returns the request + thread. + """ + kwargs['async_req'] = kwargs.get( + 'async_req', False + ) + kwargs['_return_http_data_only'] = kwargs.get( + '_return_http_data_only', True + ) + kwargs['_preload_content'] = kwargs.get( + '_preload_content', True + ) + kwargs['_request_timeout'] = kwargs.get( + '_request_timeout', None + ) + kwargs['_check_input_type'] = kwargs.get( + '_check_input_type', True + ) + kwargs['_check_return_type'] = kwargs.get( + '_check_return_type', True + ) + kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['data'] = \ + data + return self.call_with_http_info(**kwargs) + + self.create = _Endpoint( + settings={ + 'response_type': (Shipment,), + 'auth': [ + 'Token' + ], + 'endpoint_path': '/v1/shipments', + 'operation_id': 'create', + 'http_method': 'POST', + 'servers': None, + }, + params_map={ + 'all': [ + 'data', + 'test', + ], + 'required': [ + 'data', + ], + 'nullable': [ + 'test', + ], + 'enum': [ + ], + 'validation': [ + ] + }, + root_map={ + 'validations': { + }, + 'allowed_values': { + }, + 'openapi_types': { + 'data': + (ShipmentData,), + 'test': + (bool, none_type,), + }, + 'attribute_map': { + 'test': 'test', + }, + 'location_map': { + 'data': 'body', + 'test': 'query', + }, + 'collection_format_map': { + } + }, + headers_map={ + 'accept': [ + 'application/json' + ], + 'content_type': [ + 'application/json' + ] + }, + api_client=api_client, + callable=__create + ) + + def __list( + self, + **kwargs + ): + """List all shipments # noqa: E501 + + Retrieve all shipments. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.list(async_req=True) + >>> result = thread.get() + + + Keyword Args: + test_mode (bool): [optional] + status (str): [optional] + created_start (date): [optional] + created_end (date): [optional] + carrier_id (str): [optional] + service (str): [optional] + reference (str): [optional] + limit (int): Number of results to return per page.. [optional] + offset (int): The initial index from which to return the results.. [optional] + carrier_name (str): [optional] + _return_http_data_only (bool): response data without head status + code and headers. Default is True. + _preload_content (bool): if False, the urllib3.HTTPResponse object + will be returned without reading/decoding response data. + Default is True. + _request_timeout (int/float/tuple): timeout setting for this request. If + one number provided, it will be total request timeout. It can also + be a pair (tuple) of (connection, read) timeouts. + Default is None. + _check_input_type (bool): specifies if type checking + should be done one the data sent to the server. + Default is True. + _check_return_type (bool): specifies if type checking + should be done one the data received from the server. + Default is True. + _host_index (int/None): specifies the index of the server + that we want to use. + Default is read from the configuration. + async_req (bool): execute request asynchronously + + Returns: + ShipmentList + If the method is called asynchronously, returns the request + thread. + """ + kwargs['async_req'] = kwargs.get( + 'async_req', False + ) + kwargs['_return_http_data_only'] = kwargs.get( + '_return_http_data_only', True + ) + kwargs['_preload_content'] = kwargs.get( + '_preload_content', True + ) + kwargs['_request_timeout'] = kwargs.get( + '_request_timeout', None + ) + kwargs['_check_input_type'] = kwargs.get( + '_check_input_type', True + ) + kwargs['_check_return_type'] = kwargs.get( + '_check_return_type', True + ) + kwargs['_host_index'] = kwargs.get('_host_index') + return self.call_with_http_info(**kwargs) + + self.list = _Endpoint( + settings={ + 'response_type': (ShipmentList,), + 'auth': [ + 'Token' + ], + 'endpoint_path': '/v1/shipments', + 'operation_id': 'list', + 'http_method': 'GET', + 'servers': None, + }, + params_map={ + 'all': [ + 'test_mode', + 'status', + 'created_start', + 'created_end', + 'carrier_id', + 'service', + 'reference', + 'limit', + 'offset', + 'carrier_name', + ], + 'required': [], + 'nullable': [ + ], + 'enum': [ + 'status', + 'carrier_name', + ], + 'validation': [ + ] + }, + root_map={ + 'validations': { + }, + 'allowed_values': { + ('status',): { + + "CREATED": "created", + "PURCHASED": "purchased", + "CANCELLED": "cancelled", + "SHIPPED": "shipped", + "IN-TRANSIT": "in-transit", + "DELIVERED": "delivered" + }, + ('carrier_name',): { + + "ARAMEX": "aramex", + "AUSTRALIAPOST": "australiapost", + "CANADAPOST": "canadapost", + "CANPAR": "canpar", + "DHL_EXPRESS": "dhl_express", + "DHL_UNIVERSAL": "dhl_universal", + "DICOM": "dicom", + "FEDEX": "fedex", + "PUROLATOR": "purolator", + "ROYALMAIL": "royalmail", + "SENDLE": "sendle", + "SF_EXPRESS": "sf_express", + "TNT": "tnt", + "UPS": "ups", + "USPS": "usps", + "USPS_INTERNATIONAL": "usps_international", + "YANWEN": "yanwen", + "YUNEXPRESS": "yunexpress", + "ESHIPPER": "eshipper", + "FREIGHTCOM": "freightcom" + }, + }, + 'openapi_types': { + 'test_mode': + (bool,), + 'status': + (str,), + 'created_start': + (date,), + 'created_end': + (date,), + 'carrier_id': + (str,), + 'service': + (str,), + 'reference': + (str,), + 'limit': + (int,), + 'offset': + (int,), + 'carrier_name': + (str,), + }, + 'attribute_map': { + 'test_mode': 'test_mode', + 'status': 'status', + 'created_start': 'created_start', + 'created_end': 'created_end', + 'carrier_id': 'carrier_id', + 'service': 'service', + 'reference': 'reference', + 'limit': 'limit', + 'offset': 'offset', + 'carrier_name': 'carrier_name', + }, + 'location_map': { + 'test_mode': 'query', + 'status': 'query', + 'created_start': 'query', + 'created_end': 'query', + 'carrier_id': 'query', + 'service': 'query', + 'reference': 'query', + 'limit': 'query', + 'offset': 'query', + 'carrier_name': 'query', + }, + 'collection_format_map': { + } + }, + headers_map={ + 'accept': [ + 'application/json' + ], + 'content_type': [], + }, + api_client=api_client, + callable=__list + ) + + def __purchase( + self, + id, + data, + **kwargs + ): + """Buy a shipment label # noqa: E501 + + Select your preferred rates to buy a shipment label. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.purchase(id, data, async_req=True) + >>> result = thread.get() + + Args: + id (str): + data (ShipmentPurchaseData): + + Keyword Args: + _return_http_data_only (bool): response data without head status + code and headers. Default is True. + _preload_content (bool): if False, the urllib3.HTTPResponse object + will be returned without reading/decoding response data. + Default is True. + _request_timeout (int/float/tuple): timeout setting for this request. If + one number provided, it will be total request timeout. It can also + be a pair (tuple) of (connection, read) timeouts. + Default is None. + _check_input_type (bool): specifies if type checking + should be done one the data sent to the server. + Default is True. + _check_return_type (bool): specifies if type checking + should be done one the data received from the server. + Default is True. + _host_index (int/None): specifies the index of the server + that we want to use. + Default is read from the configuration. + async_req (bool): execute request asynchronously + + Returns: + Shipment + If the method is called asynchronously, returns the request + thread. + """ + kwargs['async_req'] = kwargs.get( + 'async_req', False + ) + kwargs['_return_http_data_only'] = kwargs.get( + '_return_http_data_only', True + ) + kwargs['_preload_content'] = kwargs.get( + '_preload_content', True + ) + kwargs['_request_timeout'] = kwargs.get( + '_request_timeout', None + ) + kwargs['_check_input_type'] = kwargs.get( + '_check_input_type', True + ) + kwargs['_check_return_type'] = kwargs.get( + '_check_return_type', True + ) + kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['id'] = \ + id + kwargs['data'] = \ + data + return self.call_with_http_info(**kwargs) + + self.purchase = _Endpoint( + settings={ + 'response_type': (Shipment,), + 'auth': [ + 'Token' + ], + 'endpoint_path': '/v1/shipments/{id}/purchase', + 'operation_id': 'purchase', + 'http_method': 'POST', + 'servers': None, + }, + params_map={ + 'all': [ + 'id', + 'data', + ], + 'required': [ + 'id', + 'data', + ], + 'nullable': [ + ], + 'enum': [ + ], + 'validation': [ + ] + }, + root_map={ + 'validations': { + }, + 'allowed_values': { + }, + 'openapi_types': { + 'id': + (str,), + 'data': + (ShipmentPurchaseData,), + }, + 'attribute_map': { + 'id': 'id', + }, + 'location_map': { + 'id': 'path', + 'data': 'body', + }, + 'collection_format_map': { + } + }, + headers_map={ + 'accept': [ + 'application/json' + ], + 'content_type': [ + 'application/json' + ] + }, + api_client=api_client, + callable=__purchase + ) + + def __rates( + self, + id, + data, + **kwargs + ): + """Fetch new shipment rates # noqa: E501 + + Refresh the list of the shipment rates # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.rates(id, data, async_req=True) + >>> result = thread.get() + + Args: + id (str): + data (ShipmentRateData): + + Keyword Args: + _return_http_data_only (bool): response data without head status + code and headers. Default is True. + _preload_content (bool): if False, the urllib3.HTTPResponse object + will be returned without reading/decoding response data. + Default is True. + _request_timeout (int/float/tuple): timeout setting for this request. If + one number provided, it will be total request timeout. It can also + be a pair (tuple) of (connection, read) timeouts. + Default is None. + _check_input_type (bool): specifies if type checking + should be done one the data sent to the server. + Default is True. + _check_return_type (bool): specifies if type checking + should be done one the data received from the server. + Default is True. + _host_index (int/None): specifies the index of the server + that we want to use. + Default is read from the configuration. + async_req (bool): execute request asynchronously + + Returns: + Shipment + If the method is called asynchronously, returns the request + thread. + """ + kwargs['async_req'] = kwargs.get( + 'async_req', False + ) + kwargs['_return_http_data_only'] = kwargs.get( + '_return_http_data_only', True + ) + kwargs['_preload_content'] = kwargs.get( + '_preload_content', True + ) + kwargs['_request_timeout'] = kwargs.get( + '_request_timeout', None + ) + kwargs['_check_input_type'] = kwargs.get( + '_check_input_type', True + ) + kwargs['_check_return_type'] = kwargs.get( + '_check_return_type', True + ) + kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['id'] = \ + id + kwargs['data'] = \ + data + return self.call_with_http_info(**kwargs) + + self.rates = _Endpoint( + settings={ + 'response_type': (Shipment,), + 'auth': [ + 'Token' + ], + 'endpoint_path': '/v1/shipments/{id}/rates', + 'operation_id': 'rates', + 'http_method': 'POST', + 'servers': None, + }, + params_map={ + 'all': [ + 'id', + 'data', + ], + 'required': [ + 'id', + 'data', + ], + 'nullable': [ + ], + 'enum': [ + ], + 'validation': [ + ] + }, + root_map={ + 'validations': { + }, + 'allowed_values': { + }, + 'openapi_types': { + 'id': + (str,), + 'data': + (ShipmentRateData,), + }, + 'attribute_map': { + 'id': 'id', + }, + 'location_map': { + 'id': 'path', + 'data': 'body', + }, + 'collection_format_map': { + } + }, + headers_map={ + 'accept': [ + 'application/json' + ], + 'content_type': [ + 'application/json' + ] + }, + api_client=api_client, + callable=__rates + ) + + def __retrieve( + self, + id, + **kwargs + ): + """Retrieve a shipment # noqa: E501 + + Retrieve a shipment. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.retrieve(id, async_req=True) + >>> result = thread.get() + + Args: + id (str): + + Keyword Args: + _return_http_data_only (bool): response data without head status + code and headers. Default is True. + _preload_content (bool): if False, the urllib3.HTTPResponse object + will be returned without reading/decoding response data. + Default is True. + _request_timeout (int/float/tuple): timeout setting for this request. If + one number provided, it will be total request timeout. It can also + be a pair (tuple) of (connection, read) timeouts. + Default is None. + _check_input_type (bool): specifies if type checking + should be done one the data sent to the server. + Default is True. + _check_return_type (bool): specifies if type checking + should be done one the data received from the server. + Default is True. + _host_index (int/None): specifies the index of the server + that we want to use. + Default is read from the configuration. + async_req (bool): execute request asynchronously + + Returns: + Shipment + If the method is called asynchronously, returns the request + thread. + """ + kwargs['async_req'] = kwargs.get( + 'async_req', False + ) + kwargs['_return_http_data_only'] = kwargs.get( + '_return_http_data_only', True + ) + kwargs['_preload_content'] = kwargs.get( + '_preload_content', True + ) + kwargs['_request_timeout'] = kwargs.get( + '_request_timeout', None + ) + kwargs['_check_input_type'] = kwargs.get( + '_check_input_type', True + ) + kwargs['_check_return_type'] = kwargs.get( + '_check_return_type', True + ) + kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['id'] = \ + id + return self.call_with_http_info(**kwargs) + + self.retrieve = _Endpoint( + settings={ + 'response_type': (Shipment,), + 'auth': [ + 'Token' + ], + 'endpoint_path': '/v1/shipments/{id}', + 'operation_id': 'retrieve', + 'http_method': 'GET', + 'servers': None, + }, + params_map={ + 'all': [ + 'id', + ], + 'required': [ + 'id', + ], + 'nullable': [ + ], + 'enum': [ + ], + 'validation': [ + ] + }, + root_map={ + 'validations': { + }, + 'allowed_values': { + }, + 'openapi_types': { + 'id': + (str,), + }, + 'attribute_map': { + 'id': 'id', + }, + 'location_map': { + 'id': 'path', + }, + 'collection_format_map': { + } + }, + headers_map={ + 'accept': [ + 'application/json' + ], + 'content_type': [], + }, + api_client=api_client, + callable=__retrieve + ) + + def __set_options( + self, + id, + data, + **kwargs + ): + """Add shipment options # noqa: E501 + + Add one or many options to your shipment.
**eg:**
- add shipment **insurance** - specify the preferred transaction **currency** - setup a **cash collected on delivery** option ```json { \"insurance\": 120, \"currency\": \"USD\" } ``` And many more, check additional options available in the [reference](#operation/all_references). # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.set_options(id, data, async_req=True) + >>> result = thread.get() + + Args: + id (str): + data ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}): + + Keyword Args: + _return_http_data_only (bool): response data without head status + code and headers. Default is True. + _preload_content (bool): if False, the urllib3.HTTPResponse object + will be returned without reading/decoding response data. + Default is True. + _request_timeout (int/float/tuple): timeout setting for this request. If + one number provided, it will be total request timeout. It can also + be a pair (tuple) of (connection, read) timeouts. + Default is None. + _check_input_type (bool): specifies if type checking + should be done one the data sent to the server. + Default is True. + _check_return_type (bool): specifies if type checking + should be done one the data received from the server. + Default is True. + _host_index (int/None): specifies the index of the server + that we want to use. + Default is read from the configuration. + async_req (bool): execute request asynchronously + + Returns: + Shipment + If the method is called asynchronously, returns the request + thread. + """ + kwargs['async_req'] = kwargs.get( + 'async_req', False + ) + kwargs['_return_http_data_only'] = kwargs.get( + '_return_http_data_only', True + ) + kwargs['_preload_content'] = kwargs.get( + '_preload_content', True + ) + kwargs['_request_timeout'] = kwargs.get( + '_request_timeout', None + ) + kwargs['_check_input_type'] = kwargs.get( + '_check_input_type', True + ) + kwargs['_check_return_type'] = kwargs.get( + '_check_return_type', True + ) + kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['id'] = \ + id + kwargs['data'] = \ + data + return self.call_with_http_info(**kwargs) + + self.set_options = _Endpoint( + settings={ + 'response_type': (Shipment,), + 'auth': [ + 'Token' + ], + 'endpoint_path': '/v1/shipments/{id}/options', + 'operation_id': 'set_options', + 'http_method': 'POST', + 'servers': None, + }, + params_map={ + 'all': [ + 'id', + 'data', + ], + 'required': [ + 'id', + 'data', + ], + 'nullable': [ + ], + 'enum': [ + ], + 'validation': [ + ] + }, + root_map={ + 'validations': { + }, + 'allowed_values': { + }, + 'openapi_types': { + 'id': + (str,), + 'data': + ({str: (bool, date, datetime, dict, float, int, list, str, none_type)},), + }, + 'attribute_map': { + 'id': 'id', + }, + 'location_map': { + 'id': 'path', + 'data': 'body', + }, + 'collection_format_map': { + } + }, + headers_map={ + 'accept': [ + 'application/json' + ], + 'content_type': [ + 'application/json' + ] + }, + api_client=api_client, + callable=__set_options + ) diff --git a/purplship/api/trackers_api.py b/purplship/api/trackers_api.py index fd8eaf6..6b8b0e6 100644 --- a/purplship/api/trackers_api.py +++ b/purplship/api/trackers_api.py @@ -1,30 +1,38 @@ -# coding: utf-8 - """ Purplship API - ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.6.2`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 + ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.7`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 - OpenAPI spec version: 2021.6.2 + The version of the OpenAPI document: 2021.7 Contact: hello@purplship.com - Generated by: https://github.com/swagger-api/swagger-codegen.git + Generated by: https://openapi-generator.tech """ -from __future__ import absolute_import import re # noqa: F401 - -# python 2 and python 3 compatibility library -import six - -from purplship.api_client import ApiClient +import sys # noqa: F401 + +from purplship.api_client import ApiClient, Endpoint as _Endpoint +from purplship.model_utils import ( # noqa: F401 + check_allowed_values, + check_validations, + date, + datetime, + file_type, + none_type, + validate_and_convert_types +) +from purplship.model.error_response import ErrorResponse +from purplship.model.operation import Operation +from purplship.model.tracker_list import TrackerList +from purplship.model.tracking_status import TrackingStatus class TrackersApi(object): - """NOTE: This class is auto generated by the swagger code generator program. + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech Do not edit the class manually. - Ref: https://github.com/swagger-api/swagger-codegen """ def __init__(self, api_client=None): @@ -32,398 +40,551 @@ def __init__(self, api_client=None): api_client = ApiClient() self.api_client = api_client - def create(self, carrier_name, tracking_number, **kwargs): # noqa: E501 - """Create a shipment tracker # noqa: E501 - - This API creates or retrieves (if existent) a tracking status object containing the details and events of a shipping in progress. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.create(carrier_name, tracking_number, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param str carrier_name: (required) - :param str tracking_number: (required) - :param bool test: The test flag indicates whether to use a carrier configured for test. - :return: TrackingStatus - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.create_with_http_info(carrier_name, tracking_number, **kwargs) # noqa: E501 - else: - (data) = self.create_with_http_info(carrier_name, tracking_number, **kwargs) # noqa: E501 - return data - - def create_with_http_info(self, carrier_name, tracking_number, **kwargs): # noqa: E501 - """Create a shipment tracker # noqa: E501 - - This API creates or retrieves (if existent) a tracking status object containing the details and events of a shipping in progress. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.create_with_http_info(carrier_name, tracking_number, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param str carrier_name: (required) - :param str tracking_number: (required) - :param bool test: The test flag indicates whether to use a carrier configured for test. - :return: TrackingStatus - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['carrier_name', 'tracking_number', 'test'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method create" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'carrier_name' is set - if ('carrier_name' not in params or - params['carrier_name'] is None): - raise ValueError("Missing the required parameter `carrier_name` when calling `create`") # noqa: E501 - # verify the required parameter 'tracking_number' is set - if ('tracking_number' not in params or - params['tracking_number'] is None): - raise ValueError("Missing the required parameter `tracking_number` when calling `create`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'carrier_name' in params: - path_params['carrier_name'] = params['carrier_name'] # noqa: E501 - if 'tracking_number' in params: - path_params['tracking_number'] = params['tracking_number'] # noqa: E501 - - query_params = [] - if 'test' in params: - query_params.append(('test', params['test'])) # noqa: E501 - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['Token'] # noqa: E501 - - return self.api_client.call_api( - '/v1/trackers/{carrier_name}/{tracking_number}', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='TrackingStatus', # noqa: E501 - auth_settings=auth_settings, - async_req=params.get('async_req'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def list(self, **kwargs): # noqa: E501 - """List all shipment trackers # noqa: E501 - - Retrieve all shipment trackers. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.list(async_req=True) - >>> result = thread.get() - - :param async_req bool - :param bool test_mode: - :param int limit: Number of results to return per page. - :param int offset: The initial index from which to return the results. - :return: TrackerList - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.list_with_http_info(**kwargs) # noqa: E501 - else: - (data) = self.list_with_http_info(**kwargs) # noqa: E501 - return data - - def list_with_http_info(self, **kwargs): # noqa: E501 - """List all shipment trackers # noqa: E501 - - Retrieve all shipment trackers. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.list_with_http_info(async_req=True) - >>> result = thread.get() - - :param async_req bool - :param bool test_mode: - :param int limit: Number of results to return per page. - :param int offset: The initial index from which to return the results. - :return: TrackerList - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['test_mode', 'limit', 'offset'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method list" % key - ) - params[key] = val - del params['kwargs'] - - collection_formats = {} - - path_params = {} - - query_params = [] - if 'test_mode' in params: - query_params.append(('test_mode', params['test_mode'])) # noqa: E501 - if 'limit' in params: - query_params.append(('limit', params['limit'])) # noqa: E501 - if 'offset' in params: - query_params.append(('offset', params['offset'])) # noqa: E501 - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['Token'] # noqa: E501 - - return self.api_client.call_api( - '/v1/trackers', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='TrackerList', # noqa: E501 - auth_settings=auth_settings, - async_req=params.get('async_req'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def remove(self, id_or_tracking_number, **kwargs): # noqa: E501 - """Discard a shipment tracker # noqa: E501 - - Discard a shipment tracker. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.remove(id_or_tracking_number, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param str id_or_tracking_number: (required) - :return: Operation - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.remove_with_http_info(id_or_tracking_number, **kwargs) # noqa: E501 - else: - (data) = self.remove_with_http_info(id_or_tracking_number, **kwargs) # noqa: E501 - return data - - def remove_with_http_info(self, id_or_tracking_number, **kwargs): # noqa: E501 - """Discard a shipment tracker # noqa: E501 - - Discard a shipment tracker. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.remove_with_http_info(id_or_tracking_number, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param str id_or_tracking_number: (required) - :return: Operation - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['id_or_tracking_number'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method remove" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'id_or_tracking_number' is set - if ('id_or_tracking_number' not in params or - params['id_or_tracking_number'] is None): - raise ValueError("Missing the required parameter `id_or_tracking_number` when calling `remove`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'id_or_tracking_number' in params: - path_params['id_or_tracking_number'] = params['id_or_tracking_number'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['Token'] # noqa: E501 - - return self.api_client.call_api( - '/v1/trackers/{id_or_tracking_number}', 'DELETE', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='Operation', # noqa: E501 - auth_settings=auth_settings, - async_req=params.get('async_req'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def retrieves(self, id_or_tracking_number, **kwargs): # noqa: E501 - """Retrieves a shipment tracker # noqa: E501 - - Retrieve a shipment tracker # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.retrieves(id_or_tracking_number, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param str id_or_tracking_number: (required) - :return: TrackingStatus - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.retrieves_with_http_info(id_or_tracking_number, **kwargs) # noqa: E501 - else: - (data) = self.retrieves_with_http_info(id_or_tracking_number, **kwargs) # noqa: E501 - return data - - def retrieves_with_http_info(self, id_or_tracking_number, **kwargs): # noqa: E501 - """Retrieves a shipment tracker # noqa: E501 - - Retrieve a shipment tracker # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.retrieves_with_http_info(id_or_tracking_number, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param str id_or_tracking_number: (required) - :return: TrackingStatus - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['id_or_tracking_number'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method retrieves" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'id_or_tracking_number' is set - if ('id_or_tracking_number' not in params or - params['id_or_tracking_number'] is None): - raise ValueError("Missing the required parameter `id_or_tracking_number` when calling `retrieves`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'id_or_tracking_number' in params: - path_params['id_or_tracking_number'] = params['id_or_tracking_number'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['Token'] # noqa: E501 - - return self.api_client.call_api( - '/v1/trackers/{id_or_tracking_number}', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='TrackingStatus', # noqa: E501 - auth_settings=auth_settings, - async_req=params.get('async_req'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) + def __create( + self, + carrier_name, + tracking_number, + **kwargs + ): + """Create a shipment tracker # noqa: E501 + + This API creates or retrieves (if existent) a tracking status object containing the details and events of a shipping in progress. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.create(carrier_name, tracking_number, async_req=True) + >>> result = thread.get() + + Args: + carrier_name (str): + tracking_number (str): + + Keyword Args: + test (bool, none_type): The test flag indicates whether to use a carrier configured for test.. [optional] if omitted the server will use the default value of False + _return_http_data_only (bool): response data without head status + code and headers. Default is True. + _preload_content (bool): if False, the urllib3.HTTPResponse object + will be returned without reading/decoding response data. + Default is True. + _request_timeout (int/float/tuple): timeout setting for this request. If + one number provided, it will be total request timeout. It can also + be a pair (tuple) of (connection, read) timeouts. + Default is None. + _check_input_type (bool): specifies if type checking + should be done one the data sent to the server. + Default is True. + _check_return_type (bool): specifies if type checking + should be done one the data received from the server. + Default is True. + _host_index (int/None): specifies the index of the server + that we want to use. + Default is read from the configuration. + async_req (bool): execute request asynchronously + + Returns: + TrackingStatus + If the method is called asynchronously, returns the request + thread. + """ + kwargs['async_req'] = kwargs.get( + 'async_req', False + ) + kwargs['_return_http_data_only'] = kwargs.get( + '_return_http_data_only', True + ) + kwargs['_preload_content'] = kwargs.get( + '_preload_content', True + ) + kwargs['_request_timeout'] = kwargs.get( + '_request_timeout', None + ) + kwargs['_check_input_type'] = kwargs.get( + '_check_input_type', True + ) + kwargs['_check_return_type'] = kwargs.get( + '_check_return_type', True + ) + kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['carrier_name'] = \ + carrier_name + kwargs['tracking_number'] = \ + tracking_number + return self.call_with_http_info(**kwargs) + + self.create = _Endpoint( + settings={ + 'response_type': (TrackingStatus,), + 'auth': [ + 'Token' + ], + 'endpoint_path': '/v1/trackers/{carrier_name}/{tracking_number}', + 'operation_id': 'create', + 'http_method': 'GET', + 'servers': None, + }, + params_map={ + 'all': [ + 'carrier_name', + 'tracking_number', + 'test', + ], + 'required': [ + 'carrier_name', + 'tracking_number', + ], + 'nullable': [ + 'test', + ], + 'enum': [ + ], + 'validation': [ + ] + }, + root_map={ + 'validations': { + }, + 'allowed_values': { + }, + 'openapi_types': { + 'carrier_name': + (str,), + 'tracking_number': + (str,), + 'test': + (bool, none_type,), + }, + 'attribute_map': { + 'carrier_name': 'carrier_name', + 'tracking_number': 'tracking_number', + 'test': 'test', + }, + 'location_map': { + 'carrier_name': 'path', + 'tracking_number': 'path', + 'test': 'query', + }, + 'collection_format_map': { + } + }, + headers_map={ + 'accept': [ + 'application/json' + ], + 'content_type': [], + }, + api_client=api_client, + callable=__create + ) + + def __list( + self, + **kwargs + ): + """List all shipment trackers # noqa: E501 + + Retrieve all shipment trackers. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.list(async_req=True) + >>> result = thread.get() + + + Keyword Args: + test_mode (bool): [optional] + status (str): [optional] + carrier_id (str): [optional] + limit (int): Number of results to return per page.. [optional] + offset (int): The initial index from which to return the results.. [optional] + carrier_name (str): [optional] + _return_http_data_only (bool): response data without head status + code and headers. Default is True. + _preload_content (bool): if False, the urllib3.HTTPResponse object + will be returned without reading/decoding response data. + Default is True. + _request_timeout (int/float/tuple): timeout setting for this request. If + one number provided, it will be total request timeout. It can also + be a pair (tuple) of (connection, read) timeouts. + Default is None. + _check_input_type (bool): specifies if type checking + should be done one the data sent to the server. + Default is True. + _check_return_type (bool): specifies if type checking + should be done one the data received from the server. + Default is True. + _host_index (int/None): specifies the index of the server + that we want to use. + Default is read from the configuration. + async_req (bool): execute request asynchronously + + Returns: + TrackerList + If the method is called asynchronously, returns the request + thread. + """ + kwargs['async_req'] = kwargs.get( + 'async_req', False + ) + kwargs['_return_http_data_only'] = kwargs.get( + '_return_http_data_only', True + ) + kwargs['_preload_content'] = kwargs.get( + '_preload_content', True + ) + kwargs['_request_timeout'] = kwargs.get( + '_request_timeout', None + ) + kwargs['_check_input_type'] = kwargs.get( + '_check_input_type', True + ) + kwargs['_check_return_type'] = kwargs.get( + '_check_return_type', True + ) + kwargs['_host_index'] = kwargs.get('_host_index') + return self.call_with_http_info(**kwargs) + + self.list = _Endpoint( + settings={ + 'response_type': (TrackerList,), + 'auth': [ + 'Token' + ], + 'endpoint_path': '/v1/trackers', + 'operation_id': 'list', + 'http_method': 'GET', + 'servers': None, + }, + params_map={ + 'all': [ + 'test_mode', + 'status', + 'carrier_id', + 'limit', + 'offset', + 'carrier_name', + ], + 'required': [], + 'nullable': [ + ], + 'enum': [ + 'status', + 'carrier_name', + ], + 'validation': [ + ] + }, + root_map={ + 'validations': { + }, + 'allowed_values': { + ('status',): { + + "PENDING": "pending", + "IN-TRANSIT": "in-transit", + "INCIDENT": "incident", + "DELIVERED": "delivered" + }, + ('carrier_name',): { + + "ARAMEX": "aramex", + "AUSTRALIAPOST": "australiapost", + "CANADAPOST": "canadapost", + "CANPAR": "canpar", + "DHL_EXPRESS": "dhl_express", + "DHL_UNIVERSAL": "dhl_universal", + "DICOM": "dicom", + "FEDEX": "fedex", + "PUROLATOR": "purolator", + "ROYALMAIL": "royalmail", + "SENDLE": "sendle", + "SF_EXPRESS": "sf_express", + "TNT": "tnt", + "UPS": "ups", + "USPS": "usps", + "USPS_INTERNATIONAL": "usps_international", + "YANWEN": "yanwen", + "YUNEXPRESS": "yunexpress", + "ESHIPPER": "eshipper", + "FREIGHTCOM": "freightcom" + }, + }, + 'openapi_types': { + 'test_mode': + (bool,), + 'status': + (str,), + 'carrier_id': + (str,), + 'limit': + (int,), + 'offset': + (int,), + 'carrier_name': + (str,), + }, + 'attribute_map': { + 'test_mode': 'test_mode', + 'status': 'status', + 'carrier_id': 'carrier_id', + 'limit': 'limit', + 'offset': 'offset', + 'carrier_name': 'carrier_name', + }, + 'location_map': { + 'test_mode': 'query', + 'status': 'query', + 'carrier_id': 'query', + 'limit': 'query', + 'offset': 'query', + 'carrier_name': 'query', + }, + 'collection_format_map': { + } + }, + headers_map={ + 'accept': [ + 'application/json' + ], + 'content_type': [], + }, + api_client=api_client, + callable=__list + ) + + def __remove( + self, + id_or_tracking_number, + **kwargs + ): + """Discard a shipment tracker # noqa: E501 + + Discard a shipment tracker. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.remove(id_or_tracking_number, async_req=True) + >>> result = thread.get() + + Args: + id_or_tracking_number (str): + + Keyword Args: + _return_http_data_only (bool): response data without head status + code and headers. Default is True. + _preload_content (bool): if False, the urllib3.HTTPResponse object + will be returned without reading/decoding response data. + Default is True. + _request_timeout (int/float/tuple): timeout setting for this request. If + one number provided, it will be total request timeout. It can also + be a pair (tuple) of (connection, read) timeouts. + Default is None. + _check_input_type (bool): specifies if type checking + should be done one the data sent to the server. + Default is True. + _check_return_type (bool): specifies if type checking + should be done one the data received from the server. + Default is True. + _host_index (int/None): specifies the index of the server + that we want to use. + Default is read from the configuration. + async_req (bool): execute request asynchronously + + Returns: + Operation + If the method is called asynchronously, returns the request + thread. + """ + kwargs['async_req'] = kwargs.get( + 'async_req', False + ) + kwargs['_return_http_data_only'] = kwargs.get( + '_return_http_data_only', True + ) + kwargs['_preload_content'] = kwargs.get( + '_preload_content', True + ) + kwargs['_request_timeout'] = kwargs.get( + '_request_timeout', None + ) + kwargs['_check_input_type'] = kwargs.get( + '_check_input_type', True + ) + kwargs['_check_return_type'] = kwargs.get( + '_check_return_type', True + ) + kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['id_or_tracking_number'] = \ + id_or_tracking_number + return self.call_with_http_info(**kwargs) + + self.remove = _Endpoint( + settings={ + 'response_type': (Operation,), + 'auth': [ + 'Token' + ], + 'endpoint_path': '/v1/trackers/{id_or_tracking_number}', + 'operation_id': 'remove', + 'http_method': 'DELETE', + 'servers': None, + }, + params_map={ + 'all': [ + 'id_or_tracking_number', + ], + 'required': [ + 'id_or_tracking_number', + ], + 'nullable': [ + ], + 'enum': [ + ], + 'validation': [ + ] + }, + root_map={ + 'validations': { + }, + 'allowed_values': { + }, + 'openapi_types': { + 'id_or_tracking_number': + (str,), + }, + 'attribute_map': { + 'id_or_tracking_number': 'id_or_tracking_number', + }, + 'location_map': { + 'id_or_tracking_number': 'path', + }, + 'collection_format_map': { + } + }, + headers_map={ + 'accept': [ + 'application/json' + ], + 'content_type': [], + }, + api_client=api_client, + callable=__remove + ) + + def __retrieves( + self, + id_or_tracking_number, + **kwargs + ): + """Retrieves a shipment tracker # noqa: E501 + + Retrieve a shipment tracker # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.retrieves(id_or_tracking_number, async_req=True) + >>> result = thread.get() + + Args: + id_or_tracking_number (str): + + Keyword Args: + _return_http_data_only (bool): response data without head status + code and headers. Default is True. + _preload_content (bool): if False, the urllib3.HTTPResponse object + will be returned without reading/decoding response data. + Default is True. + _request_timeout (int/float/tuple): timeout setting for this request. If + one number provided, it will be total request timeout. It can also + be a pair (tuple) of (connection, read) timeouts. + Default is None. + _check_input_type (bool): specifies if type checking + should be done one the data sent to the server. + Default is True. + _check_return_type (bool): specifies if type checking + should be done one the data received from the server. + Default is True. + _host_index (int/None): specifies the index of the server + that we want to use. + Default is read from the configuration. + async_req (bool): execute request asynchronously + + Returns: + TrackingStatus + If the method is called asynchronously, returns the request + thread. + """ + kwargs['async_req'] = kwargs.get( + 'async_req', False + ) + kwargs['_return_http_data_only'] = kwargs.get( + '_return_http_data_only', True + ) + kwargs['_preload_content'] = kwargs.get( + '_preload_content', True + ) + kwargs['_request_timeout'] = kwargs.get( + '_request_timeout', None + ) + kwargs['_check_input_type'] = kwargs.get( + '_check_input_type', True + ) + kwargs['_check_return_type'] = kwargs.get( + '_check_return_type', True + ) + kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['id_or_tracking_number'] = \ + id_or_tracking_number + return self.call_with_http_info(**kwargs) + + self.retrieves = _Endpoint( + settings={ + 'response_type': (TrackingStatus,), + 'auth': [ + 'Token' + ], + 'endpoint_path': '/v1/trackers/{id_or_tracking_number}', + 'operation_id': 'retrieves', + 'http_method': 'GET', + 'servers': None, + }, + params_map={ + 'all': [ + 'id_or_tracking_number', + ], + 'required': [ + 'id_or_tracking_number', + ], + 'nullable': [ + ], + 'enum': [ + ], + 'validation': [ + ] + }, + root_map={ + 'validations': { + }, + 'allowed_values': { + }, + 'openapi_types': { + 'id_or_tracking_number': + (str,), + }, + 'attribute_map': { + 'id_or_tracking_number': 'id_or_tracking_number', + }, + 'location_map': { + 'id_or_tracking_number': 'path', + }, + 'collection_format_map': { + } + }, + headers_map={ + 'accept': [ + 'application/json' + ], + 'content_type': [], + }, + api_client=api_client, + callable=__retrieves + ) diff --git a/purplship/api/webhooks_api.py b/purplship/api/webhooks_api.py index d7c293b..1e4522d 100644 --- a/purplship/api/webhooks_api.py +++ b/purplship/api/webhooks_api.py @@ -1,30 +1,40 @@ -# coding: utf-8 - """ Purplship API - ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.6.2`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 + ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.7`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 - OpenAPI spec version: 2021.6.2 + The version of the OpenAPI document: 2021.7 Contact: hello@purplship.com - Generated by: https://github.com/swagger-api/swagger-codegen.git + Generated by: https://openapi-generator.tech """ -from __future__ import absolute_import import re # noqa: F401 - -# python 2 and python 3 compatibility library -import six - -from purplship.api_client import ApiClient +import sys # noqa: F401 + +from purplship.api_client import ApiClient, Endpoint as _Endpoint +from purplship.model_utils import ( # noqa: F401 + check_allowed_values, + check_validations, + date, + datetime, + file_type, + none_type, + validate_and_convert_types +) +from purplship.model.error_response import ErrorResponse +from purplship.model.operation import Operation +from purplship.model.webhook import Webhook +from purplship.model.webhook_data import WebhookData +from purplship.model.webhook_list import WebhookList +from purplship.model.webhook_test_request import WebhookTestRequest class WebhooksApi(object): - """NOTE: This class is auto generated by the swagger code generator program. + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech Do not edit the class manually. - Ref: https://github.com/swagger-api/swagger-codegen """ def __init__(self, api_client=None): @@ -32,604 +42,746 @@ def __init__(self, api_client=None): api_client = ApiClient() self.api_client = api_client - def create(self, body, **kwargs): # noqa: E501 - """Create a webhook # noqa: E501 - - Create a new webhook. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.create(body, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param WebhookData body: (required) - :return: Webhook - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.create_with_http_info(body, **kwargs) # noqa: E501 - else: - (data) = self.create_with_http_info(body, **kwargs) # noqa: E501 - return data - - def create_with_http_info(self, body, **kwargs): # noqa: E501 - """Create a webhook # noqa: E501 - - Create a new webhook. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.create_with_http_info(body, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param WebhookData body: (required) - :return: Webhook - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['body'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method create" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'body' is set - if ('body' not in params or - params['body'] is None): - raise ValueError("Missing the required parameter `body` when calling `create`") # noqa: E501 - - collection_formats = {} - - path_params = {} - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if 'body' in params: - body_params = params['body'] - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['Token'] # noqa: E501 - - return self.api_client.call_api( - '/v1/webhooks', 'POST', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='Webhook', # noqa: E501 - auth_settings=auth_settings, - async_req=params.get('async_req'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def list(self, **kwargs): # noqa: E501 - """List all webhooks # noqa: E501 - - Retrieve all webhooks. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.list(async_req=True) - >>> result = thread.get() - - :param async_req bool - :param int limit: Number of results to return per page. - :param int offset: The initial index from which to return the results. - :param bool test_mode: This flag filter out webhooks created in test or live mode - :return: WebhookList - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.list_with_http_info(**kwargs) # noqa: E501 - else: - (data) = self.list_with_http_info(**kwargs) # noqa: E501 - return data - - def list_with_http_info(self, **kwargs): # noqa: E501 - """List all webhooks # noqa: E501 - - Retrieve all webhooks. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.list_with_http_info(async_req=True) - >>> result = thread.get() - - :param async_req bool - :param int limit: Number of results to return per page. - :param int offset: The initial index from which to return the results. - :param bool test_mode: This flag filter out webhooks created in test or live mode - :return: WebhookList - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['limit', 'offset', 'test_mode'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method list" % key - ) - params[key] = val - del params['kwargs'] - - collection_formats = {} - - path_params = {} - - query_params = [] - if 'limit' in params: - query_params.append(('limit', params['limit'])) # noqa: E501 - if 'offset' in params: - query_params.append(('offset', params['offset'])) # noqa: E501 - if 'test_mode' in params: - query_params.append(('test_mode', params['test_mode'])) # noqa: E501 - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['Token'] # noqa: E501 - - return self.api_client.call_api( - '/v1/webhooks', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='WebhookList', # noqa: E501 - auth_settings=auth_settings, - async_req=params.get('async_req'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def remove(self, id, **kwargs): # noqa: E501 - """Remove a webhook # noqa: E501 - - Remove a webhook. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.remove(id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param str id: (required) - :return: Operation - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.remove_with_http_info(id, **kwargs) # noqa: E501 - else: - (data) = self.remove_with_http_info(id, **kwargs) # noqa: E501 - return data - - def remove_with_http_info(self, id, **kwargs): # noqa: E501 - """Remove a webhook # noqa: E501 - - Remove a webhook. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.remove_with_http_info(id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param str id: (required) - :return: Operation - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['id'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method remove" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'id' is set - if ('id' not in params or - params['id'] is None): - raise ValueError("Missing the required parameter `id` when calling `remove`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'id' in params: - path_params['id'] = params['id'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['Token'] # noqa: E501 - - return self.api_client.call_api( - '/v1/webhooks/{id}', 'DELETE', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='Operation', # noqa: E501 - auth_settings=auth_settings, - async_req=params.get('async_req'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def retrieve(self, id, **kwargs): # noqa: E501 - """Retrieve a webhook # noqa: E501 - - Retrieve a webhook. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.retrieve(id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param str id: (required) - :return: Webhook - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.retrieve_with_http_info(id, **kwargs) # noqa: E501 - else: - (data) = self.retrieve_with_http_info(id, **kwargs) # noqa: E501 - return data - - def retrieve_with_http_info(self, id, **kwargs): # noqa: E501 - """Retrieve a webhook # noqa: E501 - - Retrieve a webhook. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.retrieve_with_http_info(id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param str id: (required) - :return: Webhook - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['id'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method retrieve" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'id' is set - if ('id' not in params or - params['id'] is None): - raise ValueError("Missing the required parameter `id` when calling `retrieve`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'id' in params: - path_params['id'] = params['id'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['Token'] # noqa: E501 - - return self.api_client.call_api( - '/v1/webhooks/{id}', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='Webhook', # noqa: E501 - auth_settings=auth_settings, - async_req=params.get('async_req'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def test(self, body, id, **kwargs): # noqa: E501 - """Test a webhook # noqa: E501 - - test a webhook. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.test(body, id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param WebhookTestRequest body: (required) - :param str id: (required) - :return: Operation - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.test_with_http_info(body, id, **kwargs) # noqa: E501 - else: - (data) = self.test_with_http_info(body, id, **kwargs) # noqa: E501 - return data - - def test_with_http_info(self, body, id, **kwargs): # noqa: E501 - """Test a webhook # noqa: E501 - - test a webhook. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.test_with_http_info(body, id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param WebhookTestRequest body: (required) - :param str id: (required) - :return: Operation - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['body', 'id'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method test" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'body' is set - if ('body' not in params or - params['body'] is None): - raise ValueError("Missing the required parameter `body` when calling `test`") # noqa: E501 - # verify the required parameter 'id' is set - if ('id' not in params or - params['id'] is None): - raise ValueError("Missing the required parameter `id` when calling `test`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'id' in params: - path_params['id'] = params['id'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if 'body' in params: - body_params = params['body'] - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['Token'] # noqa: E501 - - return self.api_client.call_api( - '/v1/webhooks/{id}/test', 'POST', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='Operation', # noqa: E501 - auth_settings=auth_settings, - async_req=params.get('async_req'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def update(self, body, id, **kwargs): # noqa: E501 - """Update a webhook # noqa: E501 - - update a webhook. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.update(body, id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param WebhookData body: (required) - :param str id: (required) - :return: Webhook - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.update_with_http_info(body, id, **kwargs) # noqa: E501 - else: - (data) = self.update_with_http_info(body, id, **kwargs) # noqa: E501 - return data - - def update_with_http_info(self, body, id, **kwargs): # noqa: E501 - """Update a webhook # noqa: E501 - - update a webhook. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.update_with_http_info(body, id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param WebhookData body: (required) - :param str id: (required) - :return: Webhook - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['body', 'id'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method update" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'body' is set - if ('body' not in params or - params['body'] is None): - raise ValueError("Missing the required parameter `body` when calling `update`") # noqa: E501 - # verify the required parameter 'id' is set - if ('id' not in params or - params['id'] is None): - raise ValueError("Missing the required parameter `id` when calling `update`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'id' in params: - path_params['id'] = params['id'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if 'body' in params: - body_params = params['body'] - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = ['Token'] # noqa: E501 - - return self.api_client.call_api( - '/v1/webhooks/{id}', 'PATCH', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='Webhook', # noqa: E501 - auth_settings=auth_settings, - async_req=params.get('async_req'), - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) + def __create( + self, + data, + **kwargs + ): + """Create a webhook # noqa: E501 + + Create a new webhook. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.create(data, async_req=True) + >>> result = thread.get() + + Args: + data (WebhookData): + + Keyword Args: + _return_http_data_only (bool): response data without head status + code and headers. Default is True. + _preload_content (bool): if False, the urllib3.HTTPResponse object + will be returned without reading/decoding response data. + Default is True. + _request_timeout (int/float/tuple): timeout setting for this request. If + one number provided, it will be total request timeout. It can also + be a pair (tuple) of (connection, read) timeouts. + Default is None. + _check_input_type (bool): specifies if type checking + should be done one the data sent to the server. + Default is True. + _check_return_type (bool): specifies if type checking + should be done one the data received from the server. + Default is True. + _host_index (int/None): specifies the index of the server + that we want to use. + Default is read from the configuration. + async_req (bool): execute request asynchronously + + Returns: + Webhook + If the method is called asynchronously, returns the request + thread. + """ + kwargs['async_req'] = kwargs.get( + 'async_req', False + ) + kwargs['_return_http_data_only'] = kwargs.get( + '_return_http_data_only', True + ) + kwargs['_preload_content'] = kwargs.get( + '_preload_content', True + ) + kwargs['_request_timeout'] = kwargs.get( + '_request_timeout', None + ) + kwargs['_check_input_type'] = kwargs.get( + '_check_input_type', True + ) + kwargs['_check_return_type'] = kwargs.get( + '_check_return_type', True + ) + kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['data'] = \ + data + return self.call_with_http_info(**kwargs) + + self.create = _Endpoint( + settings={ + 'response_type': (Webhook,), + 'auth': [ + 'Token' + ], + 'endpoint_path': '/v1/webhooks', + 'operation_id': 'create', + 'http_method': 'POST', + 'servers': None, + }, + params_map={ + 'all': [ + 'data', + ], + 'required': [ + 'data', + ], + 'nullable': [ + ], + 'enum': [ + ], + 'validation': [ + ] + }, + root_map={ + 'validations': { + }, + 'allowed_values': { + }, + 'openapi_types': { + 'data': + (WebhookData,), + }, + 'attribute_map': { + }, + 'location_map': { + 'data': 'body', + }, + 'collection_format_map': { + } + }, + headers_map={ + 'accept': [ + 'application/json' + ], + 'content_type': [ + 'application/json' + ] + }, + api_client=api_client, + callable=__create + ) + + def __list( + self, + **kwargs + ): + """List all webhooks # noqa: E501 + + Retrieve all webhooks. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.list(async_req=True) + >>> result = thread.get() + + + Keyword Args: + limit (int): Number of results to return per page.. [optional] + offset (int): The initial index from which to return the results.. [optional] + test_mode (bool, none_type): This flag filter out webhooks created in test or live mode. [optional] + _return_http_data_only (bool): response data without head status + code and headers. Default is True. + _preload_content (bool): if False, the urllib3.HTTPResponse object + will be returned without reading/decoding response data. + Default is True. + _request_timeout (int/float/tuple): timeout setting for this request. If + one number provided, it will be total request timeout. It can also + be a pair (tuple) of (connection, read) timeouts. + Default is None. + _check_input_type (bool): specifies if type checking + should be done one the data sent to the server. + Default is True. + _check_return_type (bool): specifies if type checking + should be done one the data received from the server. + Default is True. + _host_index (int/None): specifies the index of the server + that we want to use. + Default is read from the configuration. + async_req (bool): execute request asynchronously + + Returns: + WebhookList + If the method is called asynchronously, returns the request + thread. + """ + kwargs['async_req'] = kwargs.get( + 'async_req', False + ) + kwargs['_return_http_data_only'] = kwargs.get( + '_return_http_data_only', True + ) + kwargs['_preload_content'] = kwargs.get( + '_preload_content', True + ) + kwargs['_request_timeout'] = kwargs.get( + '_request_timeout', None + ) + kwargs['_check_input_type'] = kwargs.get( + '_check_input_type', True + ) + kwargs['_check_return_type'] = kwargs.get( + '_check_return_type', True + ) + kwargs['_host_index'] = kwargs.get('_host_index') + return self.call_with_http_info(**kwargs) + + self.list = _Endpoint( + settings={ + 'response_type': (WebhookList,), + 'auth': [ + 'Token' + ], + 'endpoint_path': '/v1/webhooks', + 'operation_id': 'list', + 'http_method': 'GET', + 'servers': None, + }, + params_map={ + 'all': [ + 'limit', + 'offset', + 'test_mode', + ], + 'required': [], + 'nullable': [ + 'test_mode', + ], + 'enum': [ + ], + 'validation': [ + ] + }, + root_map={ + 'validations': { + }, + 'allowed_values': { + }, + 'openapi_types': { + 'limit': + (int,), + 'offset': + (int,), + 'test_mode': + (bool, none_type,), + }, + 'attribute_map': { + 'limit': 'limit', + 'offset': 'offset', + 'test_mode': 'test_mode', + }, + 'location_map': { + 'limit': 'query', + 'offset': 'query', + 'test_mode': 'query', + }, + 'collection_format_map': { + } + }, + headers_map={ + 'accept': [ + 'application/json' + ], + 'content_type': [], + }, + api_client=api_client, + callable=__list + ) + + def __remove( + self, + id, + **kwargs + ): + """Remove a webhook # noqa: E501 + + Remove a webhook. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.remove(id, async_req=True) + >>> result = thread.get() + + Args: + id (str): + + Keyword Args: + _return_http_data_only (bool): response data without head status + code and headers. Default is True. + _preload_content (bool): if False, the urllib3.HTTPResponse object + will be returned without reading/decoding response data. + Default is True. + _request_timeout (int/float/tuple): timeout setting for this request. If + one number provided, it will be total request timeout. It can also + be a pair (tuple) of (connection, read) timeouts. + Default is None. + _check_input_type (bool): specifies if type checking + should be done one the data sent to the server. + Default is True. + _check_return_type (bool): specifies if type checking + should be done one the data received from the server. + Default is True. + _host_index (int/None): specifies the index of the server + that we want to use. + Default is read from the configuration. + async_req (bool): execute request asynchronously + + Returns: + Operation + If the method is called asynchronously, returns the request + thread. + """ + kwargs['async_req'] = kwargs.get( + 'async_req', False + ) + kwargs['_return_http_data_only'] = kwargs.get( + '_return_http_data_only', True + ) + kwargs['_preload_content'] = kwargs.get( + '_preload_content', True + ) + kwargs['_request_timeout'] = kwargs.get( + '_request_timeout', None + ) + kwargs['_check_input_type'] = kwargs.get( + '_check_input_type', True + ) + kwargs['_check_return_type'] = kwargs.get( + '_check_return_type', True + ) + kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['id'] = \ + id + return self.call_with_http_info(**kwargs) + + self.remove = _Endpoint( + settings={ + 'response_type': (Operation,), + 'auth': [ + 'Token' + ], + 'endpoint_path': '/v1/webhooks/{id}', + 'operation_id': 'remove', + 'http_method': 'DELETE', + 'servers': None, + }, + params_map={ + 'all': [ + 'id', + ], + 'required': [ + 'id', + ], + 'nullable': [ + ], + 'enum': [ + ], + 'validation': [ + ] + }, + root_map={ + 'validations': { + }, + 'allowed_values': { + }, + 'openapi_types': { + 'id': + (str,), + }, + 'attribute_map': { + 'id': 'id', + }, + 'location_map': { + 'id': 'path', + }, + 'collection_format_map': { + } + }, + headers_map={ + 'accept': [ + 'application/json' + ], + 'content_type': [], + }, + api_client=api_client, + callable=__remove + ) + + def __retrieve( + self, + id, + **kwargs + ): + """Retrieve a webhook # noqa: E501 + + Retrieve a webhook. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.retrieve(id, async_req=True) + >>> result = thread.get() + + Args: + id (str): + + Keyword Args: + _return_http_data_only (bool): response data without head status + code and headers. Default is True. + _preload_content (bool): if False, the urllib3.HTTPResponse object + will be returned without reading/decoding response data. + Default is True. + _request_timeout (int/float/tuple): timeout setting for this request. If + one number provided, it will be total request timeout. It can also + be a pair (tuple) of (connection, read) timeouts. + Default is None. + _check_input_type (bool): specifies if type checking + should be done one the data sent to the server. + Default is True. + _check_return_type (bool): specifies if type checking + should be done one the data received from the server. + Default is True. + _host_index (int/None): specifies the index of the server + that we want to use. + Default is read from the configuration. + async_req (bool): execute request asynchronously + + Returns: + Webhook + If the method is called asynchronously, returns the request + thread. + """ + kwargs['async_req'] = kwargs.get( + 'async_req', False + ) + kwargs['_return_http_data_only'] = kwargs.get( + '_return_http_data_only', True + ) + kwargs['_preload_content'] = kwargs.get( + '_preload_content', True + ) + kwargs['_request_timeout'] = kwargs.get( + '_request_timeout', None + ) + kwargs['_check_input_type'] = kwargs.get( + '_check_input_type', True + ) + kwargs['_check_return_type'] = kwargs.get( + '_check_return_type', True + ) + kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['id'] = \ + id + return self.call_with_http_info(**kwargs) + + self.retrieve = _Endpoint( + settings={ + 'response_type': (Webhook,), + 'auth': [ + 'Token' + ], + 'endpoint_path': '/v1/webhooks/{id}', + 'operation_id': 'retrieve', + 'http_method': 'GET', + 'servers': None, + }, + params_map={ + 'all': [ + 'id', + ], + 'required': [ + 'id', + ], + 'nullable': [ + ], + 'enum': [ + ], + 'validation': [ + ] + }, + root_map={ + 'validations': { + }, + 'allowed_values': { + }, + 'openapi_types': { + 'id': + (str,), + }, + 'attribute_map': { + 'id': 'id', + }, + 'location_map': { + 'id': 'path', + }, + 'collection_format_map': { + } + }, + headers_map={ + 'accept': [ + 'application/json' + ], + 'content_type': [], + }, + api_client=api_client, + callable=__retrieve + ) + + def __test( + self, + id, + data, + **kwargs + ): + """Test a webhook # noqa: E501 + + test a webhook. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.test(id, data, async_req=True) + >>> result = thread.get() + + Args: + id (str): + data (WebhookTestRequest): + + Keyword Args: + _return_http_data_only (bool): response data without head status + code and headers. Default is True. + _preload_content (bool): if False, the urllib3.HTTPResponse object + will be returned without reading/decoding response data. + Default is True. + _request_timeout (int/float/tuple): timeout setting for this request. If + one number provided, it will be total request timeout. It can also + be a pair (tuple) of (connection, read) timeouts. + Default is None. + _check_input_type (bool): specifies if type checking + should be done one the data sent to the server. + Default is True. + _check_return_type (bool): specifies if type checking + should be done one the data received from the server. + Default is True. + _host_index (int/None): specifies the index of the server + that we want to use. + Default is read from the configuration. + async_req (bool): execute request asynchronously + + Returns: + Operation + If the method is called asynchronously, returns the request + thread. + """ + kwargs['async_req'] = kwargs.get( + 'async_req', False + ) + kwargs['_return_http_data_only'] = kwargs.get( + '_return_http_data_only', True + ) + kwargs['_preload_content'] = kwargs.get( + '_preload_content', True + ) + kwargs['_request_timeout'] = kwargs.get( + '_request_timeout', None + ) + kwargs['_check_input_type'] = kwargs.get( + '_check_input_type', True + ) + kwargs['_check_return_type'] = kwargs.get( + '_check_return_type', True + ) + kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['id'] = \ + id + kwargs['data'] = \ + data + return self.call_with_http_info(**kwargs) + + self.test = _Endpoint( + settings={ + 'response_type': (Operation,), + 'auth': [ + 'Token' + ], + 'endpoint_path': '/v1/webhooks/{id}/test', + 'operation_id': 'test', + 'http_method': 'POST', + 'servers': None, + }, + params_map={ + 'all': [ + 'id', + 'data', + ], + 'required': [ + 'id', + 'data', + ], + 'nullable': [ + ], + 'enum': [ + ], + 'validation': [ + ] + }, + root_map={ + 'validations': { + }, + 'allowed_values': { + }, + 'openapi_types': { + 'id': + (str,), + 'data': + (WebhookTestRequest,), + }, + 'attribute_map': { + 'id': 'id', + }, + 'location_map': { + 'id': 'path', + 'data': 'body', + }, + 'collection_format_map': { + } + }, + headers_map={ + 'accept': [ + 'application/json' + ], + 'content_type': [ + 'application/json' + ] + }, + api_client=api_client, + callable=__test + ) + + def __update( + self, + id, + data, + **kwargs + ): + """Update a webhook # noqa: E501 + + update a webhook. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.update(id, data, async_req=True) + >>> result = thread.get() + + Args: + id (str): + data (WebhookData): + + Keyword Args: + _return_http_data_only (bool): response data without head status + code and headers. Default is True. + _preload_content (bool): if False, the urllib3.HTTPResponse object + will be returned without reading/decoding response data. + Default is True. + _request_timeout (int/float/tuple): timeout setting for this request. If + one number provided, it will be total request timeout. It can also + be a pair (tuple) of (connection, read) timeouts. + Default is None. + _check_input_type (bool): specifies if type checking + should be done one the data sent to the server. + Default is True. + _check_return_type (bool): specifies if type checking + should be done one the data received from the server. + Default is True. + _host_index (int/None): specifies the index of the server + that we want to use. + Default is read from the configuration. + async_req (bool): execute request asynchronously + + Returns: + Webhook + If the method is called asynchronously, returns the request + thread. + """ + kwargs['async_req'] = kwargs.get( + 'async_req', False + ) + kwargs['_return_http_data_only'] = kwargs.get( + '_return_http_data_only', True + ) + kwargs['_preload_content'] = kwargs.get( + '_preload_content', True + ) + kwargs['_request_timeout'] = kwargs.get( + '_request_timeout', None + ) + kwargs['_check_input_type'] = kwargs.get( + '_check_input_type', True + ) + kwargs['_check_return_type'] = kwargs.get( + '_check_return_type', True + ) + kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['id'] = \ + id + kwargs['data'] = \ + data + return self.call_with_http_info(**kwargs) + + self.update = _Endpoint( + settings={ + 'response_type': (Webhook,), + 'auth': [ + 'Token' + ], + 'endpoint_path': '/v1/webhooks/{id}', + 'operation_id': 'update', + 'http_method': 'PATCH', + 'servers': None, + }, + params_map={ + 'all': [ + 'id', + 'data', + ], + 'required': [ + 'id', + 'data', + ], + 'nullable': [ + ], + 'enum': [ + ], + 'validation': [ + ] + }, + root_map={ + 'validations': { + }, + 'allowed_values': { + }, + 'openapi_types': { + 'id': + (str,), + 'data': + (WebhookData,), + }, + 'attribute_map': { + 'id': 'id', + }, + 'location_map': { + 'id': 'path', + 'data': 'body', + }, + 'collection_format_map': { + } + }, + headers_map={ + 'accept': [ + 'application/json' + ], + 'content_type': [ + 'application/json' + ] + }, + api_client=api_client, + callable=__update + ) diff --git a/purplship/api_client.py b/purplship/api_client.py index f1d6f7f..2e00bf7 100644 --- a/purplship/api_client.py +++ b/purplship/api_client.py @@ -1,42 +1,55 @@ -# coding: utf-8 """ Purplship API - ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.6.2`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 + ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.7`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 - OpenAPI spec version: 2021.6.2 + The version of the OpenAPI document: 2021.7 Contact: hello@purplship.com - Generated by: https://github.com/swagger-api/swagger-codegen.git + Generated by: https://openapi-generator.tech """ -from __future__ import absolute_import -import datetime + import json +import atexit import mimetypes from multiprocessing.pool import ThreadPool +import io import os import re -import tempfile +import typing +from urllib.parse import quote +from urllib3.fields import RequestField -# python 2 and python 3 compatibility library -import six -from six.moves.urllib.parse import quote -from purplship.configuration import Configuration -import purplship.models from purplship import rest +from purplship.configuration import Configuration +from purplship.exceptions import ApiTypeError, ApiValueError, ApiException +from purplship.model_utils import ( + ModelNormal, + ModelSimple, + ModelComposed, + check_allowed_values, + check_validations, + date, + datetime, + deserialize_file, + file_type, + model_to_dict, + none_type, + validate_and_convert_types +) class ApiClient(object): - """Generic API client for Swagger client library builds. + """Generic API client for OpenAPI client library builds. - Swagger generic API client. This client handles the client- + OpenAPI generic API client. This client handles the client- server communication, and is invariant across implementations. Specifics of - the methods and models for each application are generated from the Swagger + the methods and models for each application are generated from the OpenAPI templates. - NOTE: This class is auto generated by the swagger code generator program. - Ref: https://github.com/swagger-api/swagger-codegen + NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech Do not edit the class manually. :param configuration: .Configuration object for this client @@ -45,38 +58,50 @@ class ApiClient(object): the API. :param cookie: a cookie to include in the header when making calls to the API + :param pool_threads: The number of threads to use for async requests + to the API. More threads means more concurrent API requests. """ - PRIMITIVE_TYPES = (float, bool, bytes, six.text_type) + six.integer_types - NATIVE_TYPES_MAPPING = { - 'int': int, - 'long': int if six.PY3 else long, # noqa: F821 - 'float': float, - 'str': str, - 'bool': bool, - 'date': datetime.date, - 'datetime': datetime.datetime, - 'object': object, - } + _pool = None def __init__(self, configuration=None, header_name=None, header_value=None, - cookie=None): + cookie=None, pool_threads=1): if configuration is None: - configuration = Configuration() + configuration = Configuration.get_default_copy() self.configuration = configuration + self.pool_threads = pool_threads - self.pool = ThreadPool() self.rest_client = rest.RESTClientObject(configuration) self.default_headers = {} if header_name is not None: self.default_headers[header_name] = header_value self.cookie = cookie # Set default User-Agent. - self.user_agent = 'Swagger-Codegen/1.0.0/python' + self.user_agent = 'OpenAPI-Generator/1.0.0/python' + + def __enter__(self): + return self + + def __exit__(self, exc_type, exc_value, traceback): + self.close() - def __del__(self): - self.pool.close() - self.pool.join() + def close(self): + if self._pool: + self._pool.close() + self._pool.join() + self._pool = None + if hasattr(atexit, 'unregister'): + atexit.unregister(self.close) + + @property + def pool(self): + """Create thread pool on first request + avoids instantiating unused threadpool for blocking clients. + """ + if self._pool is None: + atexit.register(self.close) + self._pool = ThreadPool(self.pool_threads) + return self._pool @property def user_agent(self): @@ -91,11 +116,24 @@ def set_default_header(self, header_name, header_value): self.default_headers[header_name] = header_value def __call_api( - self, resource_path, method, path_params=None, - query_params=None, header_params=None, body=None, post_params=None, - files=None, response_type=None, auth_settings=None, - _return_http_data_only=None, collection_formats=None, - _preload_content=True, _request_timeout=None): + self, + resource_path: str, + method: str, + path_params: typing.Optional[typing.Dict[str, typing.Any]] = None, + query_params: typing.Optional[typing.List[typing.Tuple[str, typing.Any]]] = None, + header_params: typing.Optional[typing.Dict[str, typing.Any]] = None, + body: typing.Optional[typing.Any] = None, + post_params: typing.Optional[typing.List[typing.Tuple[str, typing.Any]]] = None, + files: typing.Optional[typing.Dict[str, typing.List[io.IOBase]]] = None, + response_type: typing.Optional[typing.Tuple[typing.Any]] = None, + auth_settings: typing.Optional[typing.List[str]] = None, + _return_http_data_only: typing.Optional[bool] = None, + collection_formats: typing.Optional[typing.Dict[str, str]] = None, + _preload_content: bool = True, + _request_timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, + _host: typing.Optional[str] = None, + _check_type: typing.Optional[bool] = None + ): config = self.configuration @@ -129,37 +167,67 @@ def __call_api( # post parameters if post_params or files: - post_params = self.prepare_post_parameters(post_params, files) + post_params = post_params if post_params else [] post_params = self.sanitize_for_serialization(post_params) post_params = self.parameters_to_tuples(post_params, collection_formats) - - # auth setting - self.update_params_for_auth(header_params, query_params, auth_settings) + post_params.extend(self.files_parameters(files)) + if header_params['Content-Type'].startswith("multipart"): + post_params = self.parameters_to_multipart(post_params, + (dict) ) # body if body: body = self.sanitize_for_serialization(body) + # auth setting + self.update_params_for_auth(header_params, query_params, + auth_settings, resource_path, method, body) + # request url - url = self.configuration.host + resource_path + if _host is None: + url = self.configuration.host + resource_path + else: + # use server/host defined in path or operation instead + url = _host + resource_path - # perform request and return response - response_data = self.request( - method, url, query_params=query_params, headers=header_params, - post_params=post_params, body=body, - _preload_content=_preload_content, - _request_timeout=_request_timeout) + try: + # perform request and return response + response_data = self.request( + method, url, query_params=query_params, headers=header_params, + post_params=post_params, body=body, + _preload_content=_preload_content, + _request_timeout=_request_timeout) + except ApiException as e: + e.body = e.body.decode('utf-8') + raise e self.last_response = response_data return_data = response_data - if _preload_content: - # deserialize response data - if response_type: - return_data = self.deserialize(response_data, response_type) - else: - return_data = None + + if not _preload_content: + return (return_data) + return return_data + + # deserialize response data + if response_type: + if response_type != (file_type,): + encoding = "utf-8" + content_type = response_data.getheader('content-type') + if content_type is not None: + match = re.search(r"charset=([a-zA-Z\-\d]+)[\s\;]?", content_type) + if match: + encoding = match.group(1) + response_data.data = response_data.data.decode(encoding) + + return_data = self.deserialize( + response_data, + response_type, + _check_type + ) + else: + return_data = None if _return_http_data_only: return (return_data) @@ -167,118 +235,126 @@ def __call_api( return (return_data, response_data.status, response_data.getheaders()) - def sanitize_for_serialization(self, obj): - """Builds a JSON POST object. + def parameters_to_multipart(self, params, collection_types): + """Get parameters as list of tuples, formatting as json if value is collection_types + :param params: Parameters as list of two-tuples + :param dict collection_types: Parameter collection types + :return: Parameters as list of tuple or urllib3.fields.RequestField + """ + new_params = [] + if collection_types is None: + collection_types = (dict) + for k, v in params.items() if isinstance(params, dict) else params: # noqa: E501 + if isinstance(v, collection_types): # v is instance of collection_type, formatting as application/json + v = json.dumps(v, ensure_ascii=False).encode("utf-8") + field = RequestField(k, v) + field.make_multipart(content_type="application/json; charset=utf-8") + new_params.append(field) + else: + new_params.append((k, v)) + return new_params + + @classmethod + def sanitize_for_serialization(cls, obj): + """Prepares data for transmission before it is sent with the rest client If obj is None, return None. If obj is str, int, long, float, bool, return directly. If obj is datetime.datetime, datetime.date convert to string in iso8601 format. If obj is list, sanitize each element in the list. If obj is dict, return the dict. - If obj is swagger model, return the properties dict. - + If obj is OpenAPI model, return the properties dict. + If obj is io.IOBase, return the bytes :param obj: The data to serialize. :return: The serialized form of data. """ - if obj is None: - return None - elif isinstance(obj, self.PRIMITIVE_TYPES): + if isinstance(obj, (ModelNormal, ModelComposed)): + return { + key: cls.sanitize_for_serialization(val) for key, val in model_to_dict(obj, serialize=True).items() + } + elif isinstance(obj, io.IOBase): + return cls.get_file_data_and_close_file(obj) + elif isinstance(obj, (str, int, float, none_type, bool)): return obj - elif isinstance(obj, list): - return [self.sanitize_for_serialization(sub_obj) - for sub_obj in obj] - elif isinstance(obj, tuple): - return tuple(self.sanitize_for_serialization(sub_obj) - for sub_obj in obj) - elif isinstance(obj, (datetime.datetime, datetime.date)): + elif isinstance(obj, (datetime, date)): return obj.isoformat() - + elif isinstance(obj, ModelSimple): + return cls.sanitize_for_serialization(obj.value) + elif isinstance(obj, (list, tuple)): + return [cls.sanitize_for_serialization(item) for item in obj] if isinstance(obj, dict): - obj_dict = obj - else: - # Convert model obj to dict except - # attributes `swagger_types`, `attribute_map` - # and attributes which value is not None. - # Convert attribute name to json key in - # model definition for request. - obj_dict = {obj.attribute_map[attr]: getattr(obj, attr) - for attr, _ in six.iteritems(obj.swagger_types) - if getattr(obj, attr) is not None} - - return {key: self.sanitize_for_serialization(val) - for key, val in six.iteritems(obj_dict)} - - def deserialize(self, response, response_type): + return {key: cls.sanitize_for_serialization(val) for key, val in obj.items()} + raise ApiValueError('Unable to prepare type {} for serialization'.format(obj.__class__.__name__)) + + def deserialize(self, response, response_type, _check_type): """Deserializes response into an object. :param response: RESTResponse object to be deserialized. - :param response_type: class literal for - deserialized object, or string of class name. + :param response_type: For the response, a tuple containing: + valid classes + a list containing valid classes (for list schemas) + a dict containing a tuple of valid classes as the value + Example values: + (str,) + (Pet,) + (float, none_type) + ([int, none_type],) + ({str: (bool, str, int, float, date, datetime, str, none_type)},) + :param _check_type: boolean, whether to check the types of the data + received from the server + :type _check_type: bool :return: deserialized object. """ # handle file downloading # save response body into a tmp file and return the instance - if response_type == "file": - return self.__deserialize_file(response) + if response_type == (file_type,): + content_disposition = response.getheader("Content-Disposition") + return deserialize_file(response.data, self.configuration, + content_disposition=content_disposition) # fetch data from response object try: - data = json.loads(response.data) + received_data = json.loads(response.data) except ValueError: - data = response.data - - return self.__deserialize(data, response_type) - - def __deserialize(self, data, klass): - """Deserializes dict, list, str into an object. - - :param data: dict, list or str. - :param klass: class literal, or string of class name. - - :return: object. - """ - if data is None: - return None - - if type(klass) == str: - if klass.startswith('list['): - sub_kls = re.match(r'list\[(.*)\]', klass).group(1) - return [self.__deserialize(sub_data, sub_kls) - for sub_data in data] - - if klass.startswith('dict('): - sub_kls = re.match(r'dict\(([^,]*), (.*)\)', klass).group(2) - return {k: self.__deserialize(v, sub_kls) - for k, v in six.iteritems(data)} - - # convert str to class - if klass in self.NATIVE_TYPES_MAPPING: - klass = self.NATIVE_TYPES_MAPPING[klass] - else: - klass = getattr(purplship.models, klass) - - if klass in self.PRIMITIVE_TYPES: - return self.__deserialize_primitive(data, klass) - elif klass == object: - return self.__deserialize_object(data) - elif klass == datetime.date: - return self.__deserialize_date(data) - elif klass == datetime.datetime: - return self.__deserialize_datatime(data) - else: - return self.__deserialize_model(data, klass) - - def call_api(self, resource_path, method, - path_params=None, query_params=None, header_params=None, - body=None, post_params=None, files=None, - response_type=None, auth_settings=None, async_req=None, - _return_http_data_only=None, collection_formats=None, - _preload_content=True, _request_timeout=None): + received_data = response.data + + # store our data under the key of 'received_data' so users have some + # context if they are deserializing a string and the data type is wrong + deserialized_data = validate_and_convert_types( + received_data, + response_type, + ['received_data'], + True, + _check_type, + configuration=self.configuration + ) + return deserialized_data + + def call_api( + self, + resource_path: str, + method: str, + path_params: typing.Optional[typing.Dict[str, typing.Any]] = None, + query_params: typing.Optional[typing.List[typing.Tuple[str, typing.Any]]] = None, + header_params: typing.Optional[typing.Dict[str, typing.Any]] = None, + body: typing.Optional[typing.Any] = None, + post_params: typing.Optional[typing.List[typing.Tuple[str, typing.Any]]] = None, + files: typing.Optional[typing.Dict[str, typing.List[io.IOBase]]] = None, + response_type: typing.Optional[typing.Tuple[typing.Any]] = None, + auth_settings: typing.Optional[typing.List[str]] = None, + async_req: typing.Optional[bool] = None, + _return_http_data_only: typing.Optional[bool] = None, + collection_formats: typing.Optional[typing.Dict[str, str]] = None, + _preload_content: bool = True, + _request_timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, + _host: typing.Optional[str] = None, + _check_type: typing.Optional[bool] = None + ): """Makes the HTTP request (synchronous) and returns deserialized data. - To make an async request, set the async_req parameter. + To make an async_req request, set the async_req parameter. :param resource_path: Path to method endpoint. :param method: Method to call. @@ -290,21 +366,38 @@ def call_api(self, resource_path, method, :param post_params dict: Request post form parameters, for `application/x-www-form-urlencoded`, `multipart/form-data`. :param auth_settings list: Auth Settings names for the request. - :param response: Response data type. - :param files dict: key -> filename, value -> filepath, - for `multipart/form-data`. + :param response_type: For the response, a tuple containing: + valid classes + a list containing valid classes (for list schemas) + a dict containing a tuple of valid classes as the value + Example values: + (str,) + (Pet,) + (float, none_type) + ([int, none_type],) + ({str: (bool, str, int, float, date, datetime, str, none_type)},) + :param files: key -> field name, value -> a list of open file + objects for `multipart/form-data`. + :type files: dict :param async_req bool: execute request asynchronously + :type async_req: bool, optional :param _return_http_data_only: response data without head status code and headers + :type _return_http_data_only: bool, optional :param collection_formats: dict of collection formats for path, query, header, and post parameters. + :type collection_formats: dict, optional :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. + :type _preload_content: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _check_type: boolean describing if the data back from the server + should have its type checked. + :type _check_type: bool, optional :return: If async_req parameter is True, the request will be called asynchronously. @@ -318,17 +411,21 @@ def call_api(self, resource_path, method, body, post_params, files, response_type, auth_settings, _return_http_data_only, collection_formats, - _preload_content, _request_timeout) - else: - thread = self.pool.apply_async(self.__call_api, (resource_path, - method, path_params, query_params, - header_params, body, - post_params, files, - response_type, auth_settings, - _return_http_data_only, - collection_formats, - _preload_content, _request_timeout)) - return thread + _preload_content, _request_timeout, _host, + _check_type) + + return self.pool.apply_async(self.__call_api, (resource_path, + method, path_params, + query_params, + header_params, body, + post_params, files, + response_type, + auth_settings, + _return_http_data_only, + collection_formats, + _preload_content, + _request_timeout, + _host, _check_type)) def request(self, method, url, query_params=None, headers=None, post_params=None, body=None, _preload_content=True, @@ -386,7 +483,7 @@ def request(self, method, url, query_params=None, headers=None, _request_timeout=_request_timeout, body=body) else: - raise ValueError( + raise ApiValueError( "http method must be `GET`, `HEAD`, `OPTIONS`," " `POST`, `PATCH`, `PUT` or `DELETE`." ) @@ -401,7 +498,7 @@ def parameters_to_tuples(self, params, collection_formats): new_params = [] if collection_formats is None: collection_formats = {} - for k, v in six.iteritems(params) if isinstance(params, dict) else params: # noqa: E501 + for k, v in params.items() if isinstance(params, dict) else params: # noqa: E501 if k in collection_formats: collection_format = collection_formats[k] if collection_format == 'multi': @@ -421,31 +518,42 @@ def parameters_to_tuples(self, params, collection_formats): new_params.append((k, v)) return new_params - def prepare_post_parameters(self, post_params=None, files=None): + @staticmethod + def get_file_data_and_close_file(file_instance: io.IOBase) -> bytes: + file_data = file_instance.read() + file_instance.close() + return file_data + + def files_parameters(self, files: typing.Optional[typing.Dict[str, typing.List[io.IOBase]]] = None): """Builds form parameters. - :param post_params: Normal form parameters. - :param files: File parameters. - :return: Form parameters with files. + :param files: None or a dict with key=param_name and + value is a list of open file objects + :return: List of tuples of form parameters with file data """ - params = [] - - if post_params: - params = post_params + if files is None: + return [] - if files: - for k, v in six.iteritems(files): - if not v: + params = [] + for param_name, file_instances in files.items(): + if file_instances is None: + # if the file field is nullable, skip None values + continue + for file_instance in file_instances: + if file_instance is None: + # if the file field is nullable, skip None values continue - file_names = v if type(v) is list else [v] - for n in file_names: - with open(n, 'rb') as f: - filename = os.path.basename(f.name) - filedata = f.read() - mimetype = (mimetypes.guess_type(filename)[0] or - 'application/octet-stream') - params.append( - tuple([k, tuple([filename, filedata, mimetype])])) + if file_instance.closed is True: + raise ApiValueError( + "Cannot read a closed file. The passed in file_type " + "for %s must be open." % param_name + ) + filename = os.path.basename(file_instance.name) + filedata = self.get_file_data_and_close_file(file_instance) + mimetype = (mimetypes.guess_type(filename)[0] or + 'application/octet-stream') + params.append( + tuple([param_name, tuple([filename, filedata, mimetype])])) return params @@ -481,12 +589,17 @@ def select_header_content_type(self, content_types): else: return content_types[0] - def update_params_for_auth(self, headers, querys, auth_settings): + def update_params_for_auth(self, headers, querys, auth_settings, + resource_path, method, body): """Updates header and query params based on authentication setting. :param headers: Header parameters dict to be updated. :param querys: Query parameters tuple list to be updated. :param auth_settings: Authentication setting identifiers list. + :param resource_path: A string representation of the HTTP request resource path. + :param method: A string representation of the HTTP request method. + :param body: A object representing the body of the HTTP request. + The object type is the return value of _encoder.default(). """ if not auth_settings: return @@ -494,135 +607,244 @@ def update_params_for_auth(self, headers, querys, auth_settings): for auth in auth_settings: auth_setting = self.configuration.auth_settings().get(auth) if auth_setting: - if not auth_setting['value']: - continue + if auth_setting['in'] == 'cookie': + headers['Cookie'] = auth_setting['value'] elif auth_setting['in'] == 'header': - headers[auth_setting['key']] = auth_setting['value'] + if auth_setting['type'] != 'http-signature': + headers[auth_setting['key']] = auth_setting['value'] elif auth_setting['in'] == 'query': querys.append((auth_setting['key'], auth_setting['value'])) else: - raise ValueError( + raise ApiValueError( 'Authentication token must be in `query` or `header`' ) - def __deserialize_file(self, response): - """Deserializes body to file - - Saves response body into a file in a temporary folder, - using the filename from the `Content-Disposition` header if provided. - :param response: RESTResponse. - :return: file path. +class Endpoint(object): + def __init__(self, settings=None, params_map=None, root_map=None, + headers_map=None, api_client=None, callable=None): + """Creates an endpoint + + Args: + settings (dict): see below key value pairs + 'response_type' (tuple/None): response type + 'auth' (list): a list of auth type keys + 'endpoint_path' (str): the endpoint path + 'operation_id' (str): endpoint string identifier + 'http_method' (str): POST/PUT/PATCH/GET etc + 'servers' (list): list of str servers that this endpoint is at + params_map (dict): see below key value pairs + 'all' (list): list of str endpoint parameter names + 'required' (list): list of required parameter names + 'nullable' (list): list of nullable parameter names + 'enum' (list): list of parameters with enum values + 'validation' (list): list of parameters with validations + root_map + 'validations' (dict): the dict mapping endpoint parameter tuple + paths to their validation dictionaries + 'allowed_values' (dict): the dict mapping endpoint parameter + tuple paths to their allowed_values (enum) dictionaries + 'openapi_types' (dict): param_name to openapi type + 'attribute_map' (dict): param_name to camelCase name + 'location_map' (dict): param_name to 'body', 'file', 'form', + 'header', 'path', 'query' + collection_format_map (dict): param_name to `csv` etc. + headers_map (dict): see below key value pairs + 'accept' (list): list of Accept header strings + 'content_type' (list): list of Content-Type header strings + api_client (ApiClient) api client instance + callable (function): the function which is invoked when the + Endpoint is called """ - fd, path = tempfile.mkstemp(dir=self.configuration.temp_folder_path) - os.close(fd) - os.remove(path) - - content_disposition = response.getheader("Content-Disposition") - if content_disposition: - filename = re.search(r'filename=[\'"]?([^\'"\s]+)[\'"]?', - content_disposition).group(1) - path = os.path.join(os.path.dirname(path), filename) + self.settings = settings + self.params_map = params_map + self.params_map['all'].extend([ + 'async_req', + '_host_index', + '_preload_content', + '_request_timeout', + '_return_http_data_only', + '_check_input_type', + '_check_return_type' + ]) + self.params_map['nullable'].extend(['_request_timeout']) + self.validations = root_map['validations'] + self.allowed_values = root_map['allowed_values'] + self.openapi_types = root_map['openapi_types'] + extra_types = { + 'async_req': (bool,), + '_host_index': (none_type, int), + '_preload_content': (bool,), + '_request_timeout': (none_type, float, (float,), [float], int, (int,), [int]), + '_return_http_data_only': (bool,), + '_check_input_type': (bool,), + '_check_return_type': (bool,) + } + self.openapi_types.update(extra_types) + self.attribute_map = root_map['attribute_map'] + self.location_map = root_map['location_map'] + self.collection_format_map = root_map['collection_format_map'] + self.headers_map = headers_map + self.api_client = api_client + self.callable = callable + + def __validate_inputs(self, kwargs): + for param in self.params_map['enum']: + if param in kwargs: + check_allowed_values( + self.allowed_values, + (param,), + kwargs[param] + ) - with open(path, "wb") as f: - f.write(response.data) + for param in self.params_map['validation']: + if param in kwargs: + check_validations( + self.validations, + (param,), + kwargs[param], + configuration=self.api_client.configuration + ) - return path + if kwargs['_check_input_type'] is False: + return - def __deserialize_primitive(self, data, klass): - """Deserializes string to primitive type. + for key, value in kwargs.items(): + fixed_val = validate_and_convert_types( + value, + self.openapi_types[key], + [key], + False, + kwargs['_check_input_type'], + configuration=self.api_client.configuration + ) + kwargs[key] = fixed_val + + def __gather_params(self, kwargs): + params = { + 'body': None, + 'collection_format': {}, + 'file': {}, + 'form': [], + 'header': {}, + 'path': {}, + 'query': [] + } + + for param_name, param_value in kwargs.items(): + param_location = self.location_map.get(param_name) + if param_location is None: + continue + if param_location: + if param_location == 'body': + params['body'] = param_value + continue + base_name = self.attribute_map[param_name] + if (param_location == 'form' and + self.openapi_types[param_name] == (file_type,)): + params['file'][param_name] = [param_value] + elif (param_location == 'form' and + self.openapi_types[param_name] == ([file_type],)): + # param_value is already a list + params['file'][param_name] = param_value + elif param_location in {'form', 'query'}: + param_value_full = (base_name, param_value) + params[param_location].append(param_value_full) + if param_location not in {'form', 'query'}: + params[param_location][base_name] = param_value + collection_format = self.collection_format_map.get(param_name) + if collection_format: + params['collection_format'][base_name] = collection_format - :param data: str. - :param klass: class literal. + return params - :return: int, long, float, str, bool. - """ - try: - return klass(data) - except UnicodeEncodeError: - return six.text_type(data) - except TypeError: - return data + def __call__(self, *args, **kwargs): + """ This method is invoked when endpoints are called + Example: - def __deserialize_object(self, value): - """Return a original value. + api_instance = APIApi() + api_instance.authenticate # this is an instance of the class Endpoint + api_instance.authenticate() # this invokes api_instance.authenticate.__call__() + which then invokes the callable functions stored in that endpoint at + api_instance.authenticate.callable or self.callable in this class - :return: object. """ - return value + return self.callable(self, *args, **kwargs) - def __deserialize_date(self, string): - """Deserializes string to date. + def call_with_http_info(self, **kwargs): - :param string: str. - :return: date. - """ try: - from dateutil.parser import parse - return parse(string).date() - except ImportError: - return string - except ValueError: - raise rest.ApiException( - status=0, - reason="Failed to parse `{0}` as date object".format(string) + index = self.api_client.configuration.server_operation_index.get( + self.settings['operation_id'], self.api_client.configuration.server_index + ) if kwargs['_host_index'] is None else kwargs['_host_index'] + server_variables = self.api_client.configuration.server_operation_variables.get( + self.settings['operation_id'], self.api_client.configuration.server_variables ) - - def __deserialize_datatime(self, string): - """Deserializes string to datetime. - - The string should be in iso8601 datetime format. - - :param string: str. - :return: datetime. - """ - try: - from dateutil.parser import parse - return parse(string) - except ImportError: - return string - except ValueError: - raise rest.ApiException( - status=0, - reason=( - "Failed to parse `{0}` as datetime object" - .format(string) - ) + _host = self.api_client.configuration.get_host_from_settings( + index, variables=server_variables, servers=self.settings['servers'] ) + except IndexError: + if self.settings['servers']: + raise ApiValueError( + "Invalid host index. Must be 0 <= index < %s" % + len(self.settings['servers']) + ) + _host = None + + for key, value in kwargs.items(): + if key not in self.params_map['all']: + raise ApiTypeError( + "Got an unexpected parameter '%s'" + " to method `%s`" % + (key, self.settings['operation_id']) + ) + # only throw this nullable ApiValueError if _check_input_type + # is False, if _check_input_type==True we catch this case + # in self.__validate_inputs + if (key not in self.params_map['nullable'] and value is None + and kwargs['_check_input_type'] is False): + raise ApiValueError( + "Value may not be None for non-nullable parameter `%s`" + " when calling `%s`" % + (key, self.settings['operation_id']) + ) - def __hasattr(self, object, name): - return name in object.__class__.__dict__ - - def __deserialize_model(self, data, klass): - """Deserializes list or dict to model. - - :param data: dict, list. - :param klass: class literal. - :return: model object. - """ + for key in self.params_map['required']: + if key not in kwargs.keys(): + raise ApiValueError( + "Missing the required parameter `%s` when calling " + "`%s`" % (key, self.settings['operation_id']) + ) - if not klass.swagger_types and not self.__hasattr(klass, 'get_real_child_model'): - return data - - kwargs = {} - if klass.swagger_types is not None: - for attr, attr_type in six.iteritems(klass.swagger_types): - if (data is not None and - klass.attribute_map[attr] in data and - isinstance(data, (list, dict))): - value = data[klass.attribute_map[attr]] - kwargs[attr] = self.__deserialize(value, attr_type) - - instance = klass(**kwargs) - - if (isinstance(instance, dict) and - klass.swagger_types is not None and - isinstance(data, dict)): - for key, value in data.items(): - if key not in klass.swagger_types: - instance[key] = value - if self.__hasattr(instance, 'get_real_child_model'): - klass_name = instance.get_real_child_model(data) - if klass_name: - instance = self.__deserialize(data, klass_name) - return instance + self.__validate_inputs(kwargs) + + params = self.__gather_params(kwargs) + + accept_headers_list = self.headers_map['accept'] + if accept_headers_list: + params['header']['Accept'] = self.api_client.select_header_accept( + accept_headers_list) + + content_type_headers_list = self.headers_map['content_type'] + if content_type_headers_list: + header_list = self.api_client.select_header_content_type( + content_type_headers_list) + params['header']['Content-Type'] = header_list + + return self.api_client.call_api( + self.settings['endpoint_path'], self.settings['http_method'], + params['path'], + params['query'], + params['header'], + body=params['body'], + post_params=params['form'], + files=params['file'], + response_type=self.settings['response_type'], + auth_settings=self.settings['auth'], + async_req=kwargs['async_req'], + _check_type=kwargs['_check_return_type'], + _return_http_data_only=kwargs['_return_http_data_only'], + _preload_content=kwargs['_preload_content'], + _request_timeout=kwargs['_request_timeout'], + _host=_host, + collection_formats=params['collection_format']) diff --git a/purplship/apis/__init__.py b/purplship/apis/__init__.py new file mode 100644 index 0000000..c7cb6e9 --- /dev/null +++ b/purplship/apis/__init__.py @@ -0,0 +1,26 @@ + +# flake8: noqa + +# Import all APIs into this package. +# If you have many APIs here with many many models used in each API this may +# raise a `RecursionError`. +# In order to avoid this, import only the API that you directly need like: +# +# from .api.api_api import APIApi +# +# or import this package, but before doing it, use: +# +# import sys +# sys.setrecursionlimit(n) + +# Import APIs into API package: +from purplship.api.api_api import APIApi +from purplship.api.addresses_api import AddressesApi +from purplship.api.carriers_api import CarriersApi +from purplship.api.customs_api import CustomsApi +from purplship.api.parcels_api import ParcelsApi +from purplship.api.pickups_api import PickupsApi +from purplship.api.proxy_api import ProxyApi +from purplship.api.shipments_api import ShipmentsApi +from purplship.api.trackers_api import TrackersApi +from purplship.api.webhooks_api import WebhooksApi diff --git a/purplship/configuration.py b/purplship/configuration.py index 8e0a2d0..81ad7c3 100644 --- a/purplship/configuration.py +++ b/purplship/configuration.py @@ -1,16 +1,13 @@ -# coding: utf-8 - """ Purplship API - ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.6.2`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 + ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.7`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 - OpenAPI spec version: 2021.6.2 + The version of the OpenAPI document: 2021.7 Contact: hello@purplship.com - Generated by: https://github.com/swagger-api/swagger-codegen.git + Generated by: https://openapi-generator.tech """ -from __future__ import absolute_import import copy import logging @@ -18,88 +15,254 @@ import sys import urllib3 -import six -from six.moves import http_client as httplib - +from http import client as http_client +from purplship.exceptions import ApiValueError -class TypeWithDefault(type): - def __init__(cls, name, bases, dct): - super(TypeWithDefault, cls).__init__(name, bases, dct) - cls._default = None - def __call__(cls): - if cls._default is None: - cls._default = type.__call__(cls) - return copy.copy(cls._default) - - def set_default(cls, default): - cls._default = copy.copy(default) +JSON_SCHEMA_VALIDATION_KEYWORDS = { + 'multipleOf', 'maximum', 'exclusiveMaximum', + 'minimum', 'exclusiveMinimum', 'maxLength', + 'minLength', 'pattern', 'maxItems', 'minItems' +} +class Configuration(object): + """NOTE: This class is auto generated by OpenAPI Generator -class Configuration(six.with_metaclass(TypeWithDefault, object)): - """NOTE: This class is auto generated by the swagger code generator program. - - Ref: https://github.com/swagger-api/swagger-codegen + Ref: https://openapi-generator.tech Do not edit the class manually. + + :param host: Base url + :param api_key: Dict to store API key(s). + Each entry in the dict specifies an API key. + The dict key is the name of the security scheme in the OAS specification. + The dict value is the API key secret. + :param api_key_prefix: Dict to store API prefix (e.g. Bearer) + The dict key is the name of the security scheme in the OAS specification. + The dict value is an API key prefix when generating the auth data. + :param username: Username for HTTP basic authentication + :param password: Password for HTTP basic authentication + :param discard_unknown_keys: Boolean value indicating whether to discard + unknown properties. A server may send a response that includes additional + properties that are not known by the client in the following scenarios: + 1. The OpenAPI document is incomplete, i.e. it does not match the server + implementation. + 2. The client was generated using an older version of the OpenAPI document + and the server has been upgraded since then. + If a schema in the OpenAPI document defines the additionalProperties attribute, + then all undeclared properties received by the server are injected into the + additional properties map. In that case, there are undeclared properties, and + nothing to discard. + :param disabled_client_side_validations (string): Comma-separated list of + JSON schema validation keywords to disable JSON schema structural validation + rules. The following keywords may be specified: multipleOf, maximum, + exclusiveMaximum, minimum, exclusiveMinimum, maxLength, minLength, pattern, + maxItems, minItems. + By default, the validation is performed for data generated locally by the client + and data received from the server, independent of any validation performed by + the server side. If the input data does not satisfy the JSON schema validation + rules specified in the OpenAPI document, an exception is raised. + If disabled_client_side_validations is set, structural validation is + disabled. This can be useful to troubleshoot data validation problem, such as + when the OpenAPI document validation rules do not match the actual API data + received by the server. + :param server_index: Index to servers configuration. + :param server_variables: Mapping with string values to replace variables in + templated server configuration. The validation of enums is performed for + variables with defined enum values before. + :param server_operation_index: Mapping from operation ID to an index to server + configuration. + :param server_operation_variables: Mapping from operation ID to a mapping with + string values to replace variables in templated server configuration. + The validation of enums is performed for variables with defined enum values before. + :param ssl_ca_cert: str - the path to a file of concatenated CA certificates + in PEM format + + :Example: + + API Key Authentication Example. + Given the following security scheme in the OpenAPI specification: + components: + securitySchemes: + cookieAuth: # name for the security scheme + type: apiKey + in: cookie + name: JSESSIONID # cookie name + + You can programmatically set the cookie: + +conf = purplship.Configuration( + api_key={'cookieAuth': 'abc123'} + api_key_prefix={'cookieAuth': 'JSESSIONID'} +) + + The following cookie will be added to the HTTP request: + Cookie: JSESSIONID abc123 """ - def __init__(self): - """Constructor""" - # Default Base url - self.host = "https://app.purplship.com/" - # Temp file folder for downloading files + _default = None + + def __init__(self, host=None, + api_key=None, api_key_prefix=None, + access_token=None, + username=None, password=None, + discard_unknown_keys=False, + disabled_client_side_validations="", + server_index=None, server_variables=None, + server_operation_index=None, server_operation_variables=None, + ssl_ca_cert=None, + ): + """Constructor + """ + self._base_path = "https://app.purplship.com" if host is None else host + """Default Base url + """ + self.server_index = 0 if server_index is None and host is None else server_index + self.server_operation_index = server_operation_index or {} + """Default server index + """ + self.server_variables = server_variables or {} + self.server_operation_variables = server_operation_variables or {} + """Default server variables + """ self.temp_folder_path = None - + """Temp file folder for downloading files + """ # Authentication Settings - # dict to store API key(s) + self.access_token = access_token self.api_key = {} - # dict to store API prefix (e.g. Bearer) + if api_key: + self.api_key = api_key + """dict to store API key(s) + """ self.api_key_prefix = {} - # function to refresh API key if expired + if api_key_prefix: + self.api_key_prefix = api_key_prefix + """dict to store API prefix (e.g. Bearer) + """ self.refresh_api_key_hook = None - # Username for HTTP basic authentication - self.username = "" - # Password for HTTP basic authentication - self.password = "" - # Logging Settings + """function hook to refresh API key if expired + """ + self.username = username + """Username for HTTP basic authentication + """ + self.password = password + """Password for HTTP basic authentication + """ + self.discard_unknown_keys = discard_unknown_keys + self.disabled_client_side_validations = disabled_client_side_validations self.logger = {} + """Logging Settings + """ self.logger["package_logger"] = logging.getLogger("purplship") self.logger["urllib3_logger"] = logging.getLogger("urllib3") - # Log format self.logger_format = '%(asctime)s %(levelname)s %(message)s' - # Log stream handler + """Log format + """ self.logger_stream_handler = None - # Log file handler + """Log stream handler + """ self.logger_file_handler = None - # Debug file location + """Log file handler + """ self.logger_file = None - # Debug switch + """Debug file location + """ self.debug = False + """Debug switch + """ - # SSL/TLS verification - # Set this to false to skip verifying SSL certificate when calling API - # from https server. self.verify_ssl = True - # Set this to customize the certificate file to verify the peer. - self.ssl_ca_cert = None - # client certificate file + """SSL/TLS verification + Set this to false to skip verifying SSL certificate when calling API + from https server. + """ + self.ssl_ca_cert = ssl_ca_cert + """Set this to customize the certificate file to verify the peer. + """ self.cert_file = None - # client key file + """client certificate file + """ self.key_file = None - # Set this to True/False to enable/disable SSL hostname verification. + """client key file + """ self.assert_hostname = None + """Set this to True/False to enable/disable SSL hostname verification. + """ - # urllib3 connection pool's maximum number of connections saved - # per pool. urllib3 uses 1 connection as default value, but this is - # not the best value when you are making a lot of possibly parallel - # requests to the same host, which is often the case here. - # cpu_count * 5 is used as default value to increase performance. self.connection_pool_maxsize = multiprocessing.cpu_count() * 5 + """urllib3 connection pool's maximum number of connections saved + per pool. urllib3 uses 1 connection as default value, but this is + not the best value when you are making a lot of possibly parallel + requests to the same host, which is often the case here. + cpu_count * 5 is used as default value to increase performance. + """ - # Proxy URL self.proxy = None - # Safe chars for path_param + """Proxy URL + """ + self.proxy_headers = None + """Proxy headers + """ self.safe_chars_for_path_param = '' + """Safe chars for path_param + """ + self.retries = None + """Adding retries to override urllib3 default value 3 + """ + # Enable client side validation + self.client_side_validation = True + + # Options to pass down to the underlying urllib3 socket + self.socket_options = None + + def __deepcopy__(self, memo): + cls = self.__class__ + result = cls.__new__(cls) + memo[id(self)] = result + for k, v in self.__dict__.items(): + if k not in ('logger', 'logger_file_handler'): + setattr(result, k, copy.deepcopy(v, memo)) + # shallow copy of loggers + result.logger = copy.copy(self.logger) + # use setters to configure loggers + result.logger_file = self.logger_file + result.debug = self.debug + return result + + def __setattr__(self, name, value): + object.__setattr__(self, name, value) + if name == 'disabled_client_side_validations': + s = set(filter(None, value.split(','))) + for v in s: + if v not in JSON_SCHEMA_VALIDATION_KEYWORDS: + raise ApiValueError( + "Invalid keyword: '{0}''".format(v)) + self._disabled_client_side_validations = s + + @classmethod + def set_default(cls, default): + """Set default instance of configuration. + + It stores default configuration, which can be + returned by get_default_copy method. + + :param default: object of Configuration + """ + cls._default = copy.deepcopy(default) + + @classmethod + def get_default_copy(cls): + """Return new instance of configuration. + + This method returns newly created, based on default constructor, + object of Configuration class or returns a copy of default + configuration passed by the set_default method. + + :return: The configuration object. + """ + if cls._default is not None: + return copy.deepcopy(cls._default) + return Configuration() @property def logger_file(self): @@ -129,19 +292,8 @@ def logger_file(self, value): # then add file handler and remove stream handler. self.logger_file_handler = logging.FileHandler(self.__logger_file) self.logger_file_handler.setFormatter(self.logger_formatter) - for _, logger in six.iteritems(self.logger): + for _, logger in self.logger.items(): logger.addHandler(self.logger_file_handler) - if self.logger_stream_handler: - logger.removeHandler(self.logger_stream_handler) - else: - # If not set logging file, - # then add stream handler and remove file handler. - self.logger_stream_handler = logging.StreamHandler() - self.logger_stream_handler.setFormatter(self.logger_formatter) - for _, logger in six.iteritems(self.logger): - logger.addHandler(self.logger_stream_handler) - if self.logger_file_handler: - logger.removeHandler(self.logger_file_handler) @property def debug(self): @@ -162,17 +314,17 @@ def debug(self, value): self.__debug = value if self.__debug: # if debug status is True, turn on debug logging - for _, logger in six.iteritems(self.logger): + for _, logger in self.logger.items(): logger.setLevel(logging.DEBUG) - # turn on httplib debug - httplib.HTTPConnection.debuglevel = 1 + # turn on http_client debug + http_client.HTTPConnection.debuglevel = 1 else: # if debug status is False, turn off debug logging, # setting log level to default `logging.WARNING` - for _, logger in six.iteritems(self.logger): + for _, logger in self.logger.items(): logger.setLevel(logging.WARNING) - # turn off httplib debug - httplib.HTTPConnection.debuglevel = 0 + # turn off http_client debug + http_client.HTTPConnection.debuglevel = 0 @property def logger_format(self): @@ -197,16 +349,16 @@ def logger_format(self, value): self.__logger_format = value self.logger_formatter = logging.Formatter(self.__logger_format) - def get_api_key_with_prefix(self, identifier): + def get_api_key_with_prefix(self, identifier, alias=None): """Gets API key (with prefix if set). :param identifier: The identifier of apiKey. + :param alias: The alternative identifier of apiKey. :return: The token for api key authentication. """ - if self.refresh_api_key_hook: + if self.refresh_api_key_hook is not None: self.refresh_api_key_hook(self) - - key = self.api_key.get(identifier) + key = self.api_key.get(identifier, self.api_key.get(alias) if alias is not None else None) if key: prefix = self.api_key_prefix.get(identifier) if prefix: @@ -219,8 +371,14 @@ def get_basic_auth_token(self): :return: The token for basic HTTP authentication. """ + username = "" + if self.username is not None: + username = self.username + password = "" + if self.password is not None: + password = self.password return urllib3.util.make_headers( - basic_auth=self.username + ':' + self.password + basic_auth=username + ':' + password ).get('authorization') def auth_settings(self): @@ -228,15 +386,17 @@ def auth_settings(self): :return: The Auth Settings information dict. """ - return { - 'Token': - { - 'type': 'api_key', - 'in': 'header', - 'key': 'Authorization', - 'value': self.get_api_key_with_prefix('Authorization') - }, - } + auth = {} + if 'Token' in self.api_key: + auth['Token'] = { + 'type': 'api_key', + 'in': 'header', + 'key': 'Authorization', + 'value': self.get_api_key_with_prefix( + 'Token', + ), + } + return auth def to_debug_report(self): """Gets the essential information for debugging. @@ -246,6 +406,68 @@ def to_debug_report(self): return "Python SDK Debug Report:\n"\ "OS: {env}\n"\ "Python Version: {pyversion}\n"\ - "Version of the API: 2021.6.2\n"\ + "Version of the API: 2021.7\n"\ "SDK Package Version: 1.0.0".\ format(env=sys.platform, pyversion=sys.version) + + def get_host_settings(self): + """Gets an array of host settings + + :return: An array of host settings + """ + return [ + { + 'url': "https://app.purplship.com", + 'description': "No description provided", + } + ] + + def get_host_from_settings(self, index, variables=None, servers=None): + """Gets host URL based on the index and variables + :param index: array index of the host settings + :param variables: hash of variable and the corresponding value + :param servers: an array of host settings or None + :return: URL based on host settings + """ + if index is None: + return self._base_path + + variables = {} if variables is None else variables + servers = self.get_host_settings() if servers is None else servers + + try: + server = servers[index] + except IndexError: + raise ValueError( + "Invalid index {0} when selecting the host settings. " + "Must be less than {1}".format(index, len(servers))) + + url = server['url'] + + # go through variables and replace placeholders + for variable_name, variable in server.get('variables', {}).items(): + used_value = variables.get( + variable_name, variable['default_value']) + + if 'enum_values' in variable \ + and used_value not in variable['enum_values']: + raise ValueError( + "The variable `{0}` in the host URL has invalid value " + "{1}. Must be {2}.".format( + variable_name, variables[variable_name], + variable['enum_values'])) + + url = url.replace("{" + variable_name + "}", used_value) + + return url + + @property + def host(self): + """Return generated host.""" + return self.get_host_from_settings(self.server_index, variables=self.server_variables) + + @host.setter + def host(self, value): + """Fix base path.""" + self._base_path = value + self.server_index = None diff --git a/purplship/exceptions.py b/purplship/exceptions.py new file mode 100644 index 0000000..0238af4 --- /dev/null +++ b/purplship/exceptions.py @@ -0,0 +1,160 @@ +""" + Purplship API + + ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.7`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 + + The version of the OpenAPI document: 2021.7 + Contact: hello@purplship.com + Generated by: https://openapi-generator.tech +""" + + + +class OpenApiException(Exception): + """The base exception class for all OpenAPIExceptions""" + + +class ApiTypeError(OpenApiException, TypeError): + def __init__(self, msg, path_to_item=None, valid_classes=None, + key_type=None): + """ Raises an exception for TypeErrors + + Args: + msg (str): the exception message + + Keyword Args: + path_to_item (list): a list of keys an indices to get to the + current_item + None if unset + valid_classes (tuple): the primitive classes that current item + should be an instance of + None if unset + key_type (bool): False if our value is a value in a dict + True if it is a key in a dict + False if our item is an item in a list + None if unset + """ + self.path_to_item = path_to_item + self.valid_classes = valid_classes + self.key_type = key_type + full_msg = msg + if path_to_item: + full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) + super(ApiTypeError, self).__init__(full_msg) + + +class ApiValueError(OpenApiException, ValueError): + def __init__(self, msg, path_to_item=None): + """ + Args: + msg (str): the exception message + + Keyword Args: + path_to_item (list) the path to the exception in the + received_data dict. None if unset + """ + + self.path_to_item = path_to_item + full_msg = msg + if path_to_item: + full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) + super(ApiValueError, self).__init__(full_msg) + + +class ApiAttributeError(OpenApiException, AttributeError): + def __init__(self, msg, path_to_item=None): + """ + Raised when an attribute reference or assignment fails. + + Args: + msg (str): the exception message + + Keyword Args: + path_to_item (None/list) the path to the exception in the + received_data dict + """ + self.path_to_item = path_to_item + full_msg = msg + if path_to_item: + full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) + super(ApiAttributeError, self).__init__(full_msg) + + +class ApiKeyError(OpenApiException, KeyError): + def __init__(self, msg, path_to_item=None): + """ + Args: + msg (str): the exception message + + Keyword Args: + path_to_item (None/list) the path to the exception in the + received_data dict + """ + self.path_to_item = path_to_item + full_msg = msg + if path_to_item: + full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) + super(ApiKeyError, self).__init__(full_msg) + + +class ApiException(OpenApiException): + + def __init__(self, status=None, reason=None, http_resp=None): + if http_resp: + self.status = http_resp.status + self.reason = http_resp.reason + self.body = http_resp.data + self.headers = http_resp.getheaders() + else: + self.status = status + self.reason = reason + self.body = None + self.headers = None + + def __str__(self): + """Custom error messages for exception""" + error_message = "({0})\n"\ + "Reason: {1}\n".format(self.status, self.reason) + if self.headers: + error_message += "HTTP response headers: {0}\n".format( + self.headers) + + if self.body: + error_message += "HTTP response body: {0}\n".format(self.body) + + return error_message + + +class NotFoundException(ApiException): + + def __init__(self, status=None, reason=None, http_resp=None): + super(NotFoundException, self).__init__(status, reason, http_resp) + + +class UnauthorizedException(ApiException): + + def __init__(self, status=None, reason=None, http_resp=None): + super(UnauthorizedException, self).__init__(status, reason, http_resp) + + +class ForbiddenException(ApiException): + + def __init__(self, status=None, reason=None, http_resp=None): + super(ForbiddenException, self).__init__(status, reason, http_resp) + + +class ServiceException(ApiException): + + def __init__(self, status=None, reason=None, http_resp=None): + super(ServiceException, self).__init__(status, reason, http_resp) + + +def render_path(path_to_item): + """Returns a string representation of a path""" + result = "" + for pth in path_to_item: + if isinstance(pth, int): + result += "[{0}]".format(pth) + else: + result += "['{0}']".format(pth) + return result diff --git a/purplship/model/__init__.py b/purplship/model/__init__.py new file mode 100644 index 0000000..cfe32b7 --- /dev/null +++ b/purplship/model/__init__.py @@ -0,0 +1,5 @@ +# we can not import model classes here because that would create a circular +# reference which would not work in python2 +# do not import all models into this module because that uses a lot of memory and stack frames +# if you need the ability to import all models from one package, import them with +# from {{packageName}.models import ModelA, ModelB diff --git a/purplship/model/access_token.py b/purplship/model/access_token.py new file mode 100644 index 0000000..62f4568 --- /dev/null +++ b/purplship/model/access_token.py @@ -0,0 +1,265 @@ +""" + Purplship API + + ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.7`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 + + The version of the OpenAPI document: 2021.7 + Contact: hello@purplship.com + Generated by: https://openapi-generator.tech +""" + + +import re # noqa: F401 +import sys # noqa: F401 + +from purplship.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) +from ..model_utils import OpenApiModel +from purplship.exceptions import ApiAttributeError + + + +class AccessToken(ModelNormal): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + } + + validations = { + ('access',): { + 'min_length': 1, + }, + } + + @cached_property + def additional_properties_type(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + """ + return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + + _nullable = False + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'access': (str,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'access': 'access', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, access, *args, **kwargs): # noqa: E501 + """AccessToken - a model defined in OpenAPI + + Args: + access (str): + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.access = access + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + required_properties = set([ + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) + + @convert_js_args_to_python_args + def __init__(self, access, *args, **kwargs): # noqa: E501 + """AccessToken - a model defined in OpenAPI + + Args: + access (str): + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.access = access + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + f"class with read only attributes.") diff --git a/purplship/model/address.py b/purplship/model/address.py new file mode 100644 index 0000000..1f177f1 --- /dev/null +++ b/purplship/model/address.py @@ -0,0 +1,571 @@ +""" + Purplship API + + ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.7`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 + + The version of the OpenAPI document: 2021.7 + Contact: hello@purplship.com + Generated by: https://openapi-generator.tech +""" + + +import re # noqa: F401 +import sys # noqa: F401 + +from purplship.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) +from ..model_utils import OpenApiModel +from purplship.exceptions import ApiAttributeError + + +def lazy_import(): + from purplship.model.address_validation import AddressValidation + globals()['AddressValidation'] = AddressValidation + + +class Address(ModelNormal): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + ('country_code',): { + 'AD': "AD", + 'AE': "AE", + 'AF': "AF", + 'AG': "AG", + 'AI': "AI", + 'AL': "AL", + 'AM': "AM", + 'AN': "AN", + 'AO': "AO", + 'AR': "AR", + 'AS': "AS", + 'AT': "AT", + 'AU': "AU", + 'AW': "AW", + 'AZ': "AZ", + 'BA': "BA", + 'BB': "BB", + 'BD': "BD", + 'BE': "BE", + 'BF': "BF", + 'BG': "BG", + 'BH': "BH", + 'BI': "BI", + 'BJ': "BJ", + 'BM': "BM", + 'BN': "BN", + 'BO': "BO", + 'BR': "BR", + 'BS': "BS", + 'BT': "BT", + 'BW': "BW", + 'BY': "BY", + 'BZ': "BZ", + 'CA': "CA", + 'CD': "CD", + 'CF': "CF", + 'CG': "CG", + 'CH': "CH", + 'CI': "CI", + 'CK': "CK", + 'CL': "CL", + 'CM': "CM", + 'CN': "CN", + 'CO': "CO", + 'CR': "CR", + 'CU': "CU", + 'CV': "CV", + 'CY': "CY", + 'CZ': "CZ", + 'DE': "DE", + 'DJ': "DJ", + 'DK': "DK", + 'DM': "DM", + 'DO': "DO", + 'DZ': "DZ", + 'EC': "EC", + 'EE': "EE", + 'EG': "EG", + 'ER': "ER", + 'ES': "ES", + 'ET': "ET", + 'FI': "FI", + 'FJ': "FJ", + 'FK': "FK", + 'FM': "FM", + 'FO': "FO", + 'FR': "FR", + 'GA': "GA", + 'GB': "GB", + 'GD': "GD", + 'GE': "GE", + 'GF': "GF", + 'GG': "GG", + 'GH': "GH", + 'GI': "GI", + 'GL': "GL", + 'GM': "GM", + 'GN': "GN", + 'GP': "GP", + 'GQ': "GQ", + 'GR': "GR", + 'GT': "GT", + 'GU': "GU", + 'GW': "GW", + 'GY': "GY", + 'HK': "HK", + 'HN': "HN", + 'HR': "HR", + 'HT': "HT", + 'HU': "HU", + 'IC': "IC", + 'ID': "ID", + 'IE': "IE", + 'IL': "IL", + 'IN': "IN", + 'IQ': "IQ", + 'IR': "IR", + 'IS': "IS", + 'IT': "IT", + 'JE': "JE", + 'JM': "JM", + 'JO': "JO", + 'JP': "JP", + 'KE': "KE", + 'KG': "KG", + 'KH': "KH", + 'KI': "KI", + 'KM': "KM", + 'KN': "KN", + 'KP': "KP", + 'KR': "KR", + 'KV': "KV", + 'KW': "KW", + 'KY': "KY", + 'KZ': "KZ", + 'LA': "LA", + 'LB': "LB", + 'LC': "LC", + 'LI': "LI", + 'LK': "LK", + 'LR': "LR", + 'LS': "LS", + 'LT': "LT", + 'LU': "LU", + 'LV': "LV", + 'LY': "LY", + 'MA': "MA", + 'MC': "MC", + 'MD': "MD", + 'ME': "ME", + 'MG': "MG", + 'MH': "MH", + 'MK': "MK", + 'ML': "ML", + 'MM': "MM", + 'MN': "MN", + 'MO': "MO", + 'MP': "MP", + 'MQ': "MQ", + 'MR': "MR", + 'MS': "MS", + 'MT': "MT", + 'MU': "MU", + 'MV': "MV", + 'MW': "MW", + 'MX': "MX", + 'MY': "MY", + 'MZ': "MZ", + 'NA': "NA", + 'NC': "NC", + 'NE': "NE", + 'NG': "NG", + 'NI': "NI", + 'NL': "NL", + 'NO': "NO", + 'NP': "NP", + 'NR': "NR", + 'NU': "NU", + 'NZ': "NZ", + 'OM': "OM", + 'PA': "PA", + 'PE': "PE", + 'PF': "PF", + 'PG': "PG", + 'PH': "PH", + 'PK': "PK", + 'PL': "PL", + 'PR': "PR", + 'PT': "PT", + 'PW': "PW", + 'PY': "PY", + 'QA': "QA", + 'RE': "RE", + 'RO': "RO", + 'RS': "RS", + 'RU': "RU", + 'RW': "RW", + 'SA': "SA", + 'SB': "SB", + 'SC': "SC", + 'SD': "SD", + 'SE': "SE", + 'SG': "SG", + 'SH': "SH", + 'SI': "SI", + 'SK': "SK", + 'SL': "SL", + 'SM': "SM", + 'SN': "SN", + 'SO': "SO", + 'SR': "SR", + 'SS': "SS", + 'ST': "ST", + 'SV': "SV", + 'SY': "SY", + 'SZ': "SZ", + 'TC': "TC", + 'TD': "TD", + 'TG': "TG", + 'TH': "TH", + 'TJ': "TJ", + 'TL': "TL", + 'TN': "TN", + 'TO': "TO", + 'TR': "TR", + 'TT': "TT", + 'TV': "TV", + 'TW': "TW", + 'TZ': "TZ", + 'UA': "UA", + 'UG': "UG", + 'US': "US", + 'UY': "UY", + 'UZ': "UZ", + 'VA': "VA", + 'VC': "VC", + 'VE': "VE", + 'VG': "VG", + 'VI': "VI", + 'VN': "VN", + 'VU': "VU", + 'WS': "WS", + 'XB': "XB", + 'XC': "XC", + 'XE': "XE", + 'XM': "XM", + 'XN': "XN", + 'XS': "XS", + 'XY': "XY", + 'YE': "YE", + 'YT': "YT", + 'ZA': "ZA", + 'ZM': "ZM", + 'ZW': "ZW", + }, + } + + validations = { + ('id',): { + 'min_length': 1, + }, + } + + @cached_property + def additional_properties_type(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + """ + lazy_import() + return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + + _nullable = False + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + lazy_import() + return { + 'country_code': (str,), # noqa: E501 + 'id': (str,), # noqa: E501 + 'postal_code': (str, none_type,), # noqa: E501 + 'city': (str, none_type,), # noqa: E501 + 'federal_tax_id': (str, none_type,), # noqa: E501 + 'state_tax_id': (str, none_type,), # noqa: E501 + 'person_name': (str, none_type,), # noqa: E501 + 'company_name': (str, none_type,), # noqa: E501 + 'email': (str, none_type,), # noqa: E501 + 'phone_number': (str, none_type,), # noqa: E501 + 'state_code': (str, none_type,), # noqa: E501 + 'suburb': (str, none_type,), # noqa: E501 + 'residential': (bool, none_type,), # noqa: E501 + 'address_line1': (str, none_type,), # noqa: E501 + 'address_line2': (str, none_type,), # noqa: E501 + 'validate_location': (bool, none_type,), # noqa: E501 + 'validation': (AddressValidation,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'country_code': 'country_code', # noqa: E501 + 'id': 'id', # noqa: E501 + 'postal_code': 'postal_code', # noqa: E501 + 'city': 'city', # noqa: E501 + 'federal_tax_id': 'federal_tax_id', # noqa: E501 + 'state_tax_id': 'state_tax_id', # noqa: E501 + 'person_name': 'person_name', # noqa: E501 + 'company_name': 'company_name', # noqa: E501 + 'email': 'email', # noqa: E501 + 'phone_number': 'phone_number', # noqa: E501 + 'state_code': 'state_code', # noqa: E501 + 'suburb': 'suburb', # noqa: E501 + 'residential': 'residential', # noqa: E501 + 'address_line1': 'address_line1', # noqa: E501 + 'address_line2': 'address_line2', # noqa: E501 + 'validate_location': 'validate_location', # noqa: E501 + 'validation': 'validation', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, country_code, *args, **kwargs): # noqa: E501 + """Address - a model defined in OpenAPI + + Args: + country_code (str): The address country code + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + id (str): A unique identifier. [optional] # noqa: E501 + postal_code (str, none_type): The address postal code **(required for shipment purchase)** . [optional] # noqa: E501 + city (str, none_type): The address city. **(required for shipment purchase)** . [optional] # noqa: E501 + federal_tax_id (str, none_type): The party frederal tax id. [optional] # noqa: E501 + state_tax_id (str, none_type): The party state id. [optional] # noqa: E501 + person_name (str, none_type): attention to **(required for shipment purchase)** . [optional] # noqa: E501 + company_name (str, none_type): The company name if the party is a company. [optional] # noqa: E501 + email (str, none_type): The party email. [optional] # noqa: E501 + phone_number (str, none_type): The party phone number.. [optional] # noqa: E501 + state_code (str, none_type): The address state code. [optional] # noqa: E501 + suburb (str, none_type): The address suburb if known. [optional] # noqa: E501 + residential (bool, none_type): Indicate if the address is residential or commercial (enterprise). [optional] if omitted the server will use the default value of False # noqa: E501 + address_line1 (str, none_type): The address line with street number
**(required for shipment purchase)** . [optional] # noqa: E501 + address_line2 (str, none_type): The address line with suite number. [optional] # noqa: E501 + validate_location (bool, none_type): Indicate if the address should be validated. [optional] if omitted the server will use the default value of False # noqa: E501 + validation (AddressValidation): [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.country_code = country_code + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + required_properties = set([ + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) + + @convert_js_args_to_python_args + def __init__(self, country_code, *args, **kwargs): # noqa: E501 + """Address - a model defined in OpenAPI + + Args: + country_code (str): The address country code + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + id (str): A unique identifier. [optional] # noqa: E501 + postal_code (str, none_type): The address postal code **(required for shipment purchase)** . [optional] # noqa: E501 + city (str, none_type): The address city. **(required for shipment purchase)** . [optional] # noqa: E501 + federal_tax_id (str, none_type): The party frederal tax id. [optional] # noqa: E501 + state_tax_id (str, none_type): The party state id. [optional] # noqa: E501 + person_name (str, none_type): attention to **(required for shipment purchase)** . [optional] # noqa: E501 + company_name (str, none_type): The company name if the party is a company. [optional] # noqa: E501 + email (str, none_type): The party email. [optional] # noqa: E501 + phone_number (str, none_type): The party phone number.. [optional] # noqa: E501 + state_code (str, none_type): The address state code. [optional] # noqa: E501 + suburb (str, none_type): The address suburb if known. [optional] # noqa: E501 + residential (bool, none_type): Indicate if the address is residential or commercial (enterprise). [optional] if omitted the server will use the default value of False # noqa: E501 + address_line1 (str, none_type): The address line with street number
**(required for shipment purchase)** . [optional] # noqa: E501 + address_line2 (str, none_type): The address line with suite number. [optional] # noqa: E501 + validate_location (bool, none_type): Indicate if the address should be validated. [optional] if omitted the server will use the default value of False # noqa: E501 + validation (AddressValidation): [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.country_code = country_code + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + f"class with read only attributes.") diff --git a/purplship/model/address_data.py b/purplship/model/address_data.py new file mode 100644 index 0000000..c55b707 --- /dev/null +++ b/purplship/model/address_data.py @@ -0,0 +1,554 @@ +""" + Purplship API + + ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.7`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 + + The version of the OpenAPI document: 2021.7 + Contact: hello@purplship.com + Generated by: https://openapi-generator.tech +""" + + +import re # noqa: F401 +import sys # noqa: F401 + +from purplship.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) +from ..model_utils import OpenApiModel +from purplship.exceptions import ApiAttributeError + + + +class AddressData(ModelNormal): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + ('country_code',): { + 'AD': "AD", + 'AE': "AE", + 'AF': "AF", + 'AG': "AG", + 'AI': "AI", + 'AL': "AL", + 'AM': "AM", + 'AN': "AN", + 'AO': "AO", + 'AR': "AR", + 'AS': "AS", + 'AT': "AT", + 'AU': "AU", + 'AW': "AW", + 'AZ': "AZ", + 'BA': "BA", + 'BB': "BB", + 'BD': "BD", + 'BE': "BE", + 'BF': "BF", + 'BG': "BG", + 'BH': "BH", + 'BI': "BI", + 'BJ': "BJ", + 'BM': "BM", + 'BN': "BN", + 'BO': "BO", + 'BR': "BR", + 'BS': "BS", + 'BT': "BT", + 'BW': "BW", + 'BY': "BY", + 'BZ': "BZ", + 'CA': "CA", + 'CD': "CD", + 'CF': "CF", + 'CG': "CG", + 'CH': "CH", + 'CI': "CI", + 'CK': "CK", + 'CL': "CL", + 'CM': "CM", + 'CN': "CN", + 'CO': "CO", + 'CR': "CR", + 'CU': "CU", + 'CV': "CV", + 'CY': "CY", + 'CZ': "CZ", + 'DE': "DE", + 'DJ': "DJ", + 'DK': "DK", + 'DM': "DM", + 'DO': "DO", + 'DZ': "DZ", + 'EC': "EC", + 'EE': "EE", + 'EG': "EG", + 'ER': "ER", + 'ES': "ES", + 'ET': "ET", + 'FI': "FI", + 'FJ': "FJ", + 'FK': "FK", + 'FM': "FM", + 'FO': "FO", + 'FR': "FR", + 'GA': "GA", + 'GB': "GB", + 'GD': "GD", + 'GE': "GE", + 'GF': "GF", + 'GG': "GG", + 'GH': "GH", + 'GI': "GI", + 'GL': "GL", + 'GM': "GM", + 'GN': "GN", + 'GP': "GP", + 'GQ': "GQ", + 'GR': "GR", + 'GT': "GT", + 'GU': "GU", + 'GW': "GW", + 'GY': "GY", + 'HK': "HK", + 'HN': "HN", + 'HR': "HR", + 'HT': "HT", + 'HU': "HU", + 'IC': "IC", + 'ID': "ID", + 'IE': "IE", + 'IL': "IL", + 'IN': "IN", + 'IQ': "IQ", + 'IR': "IR", + 'IS': "IS", + 'IT': "IT", + 'JE': "JE", + 'JM': "JM", + 'JO': "JO", + 'JP': "JP", + 'KE': "KE", + 'KG': "KG", + 'KH': "KH", + 'KI': "KI", + 'KM': "KM", + 'KN': "KN", + 'KP': "KP", + 'KR': "KR", + 'KV': "KV", + 'KW': "KW", + 'KY': "KY", + 'KZ': "KZ", + 'LA': "LA", + 'LB': "LB", + 'LC': "LC", + 'LI': "LI", + 'LK': "LK", + 'LR': "LR", + 'LS': "LS", + 'LT': "LT", + 'LU': "LU", + 'LV': "LV", + 'LY': "LY", + 'MA': "MA", + 'MC': "MC", + 'MD': "MD", + 'ME': "ME", + 'MG': "MG", + 'MH': "MH", + 'MK': "MK", + 'ML': "ML", + 'MM': "MM", + 'MN': "MN", + 'MO': "MO", + 'MP': "MP", + 'MQ': "MQ", + 'MR': "MR", + 'MS': "MS", + 'MT': "MT", + 'MU': "MU", + 'MV': "MV", + 'MW': "MW", + 'MX': "MX", + 'MY': "MY", + 'MZ': "MZ", + 'NA': "NA", + 'NC': "NC", + 'NE': "NE", + 'NG': "NG", + 'NI': "NI", + 'NL': "NL", + 'NO': "NO", + 'NP': "NP", + 'NR': "NR", + 'NU': "NU", + 'NZ': "NZ", + 'OM': "OM", + 'PA': "PA", + 'PE': "PE", + 'PF': "PF", + 'PG': "PG", + 'PH': "PH", + 'PK': "PK", + 'PL': "PL", + 'PR': "PR", + 'PT': "PT", + 'PW': "PW", + 'PY': "PY", + 'QA': "QA", + 'RE': "RE", + 'RO': "RO", + 'RS': "RS", + 'RU': "RU", + 'RW': "RW", + 'SA': "SA", + 'SB': "SB", + 'SC': "SC", + 'SD': "SD", + 'SE': "SE", + 'SG': "SG", + 'SH': "SH", + 'SI': "SI", + 'SK': "SK", + 'SL': "SL", + 'SM': "SM", + 'SN': "SN", + 'SO': "SO", + 'SR': "SR", + 'SS': "SS", + 'ST': "ST", + 'SV': "SV", + 'SY': "SY", + 'SZ': "SZ", + 'TC': "TC", + 'TD': "TD", + 'TG': "TG", + 'TH': "TH", + 'TJ': "TJ", + 'TL': "TL", + 'TN': "TN", + 'TO': "TO", + 'TR': "TR", + 'TT': "TT", + 'TV': "TV", + 'TW': "TW", + 'TZ': "TZ", + 'UA': "UA", + 'UG': "UG", + 'US': "US", + 'UY': "UY", + 'UZ': "UZ", + 'VA': "VA", + 'VC': "VC", + 'VE': "VE", + 'VG': "VG", + 'VI': "VI", + 'VN': "VN", + 'VU': "VU", + 'WS': "WS", + 'XB': "XB", + 'XC': "XC", + 'XE': "XE", + 'XM': "XM", + 'XN': "XN", + 'XS': "XS", + 'XY': "XY", + 'YE': "YE", + 'YT': "YT", + 'ZA': "ZA", + 'ZM': "ZM", + 'ZW': "ZW", + }, + } + + validations = { + } + + @cached_property + def additional_properties_type(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + """ + return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + + _nullable = False + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'country_code': (str,), # noqa: E501 + 'postal_code': (str, none_type,), # noqa: E501 + 'city': (str, none_type,), # noqa: E501 + 'federal_tax_id': (str, none_type,), # noqa: E501 + 'state_tax_id': (str, none_type,), # noqa: E501 + 'person_name': (str, none_type,), # noqa: E501 + 'company_name': (str, none_type,), # noqa: E501 + 'email': (str, none_type,), # noqa: E501 + 'phone_number': (str, none_type,), # noqa: E501 + 'state_code': (str, none_type,), # noqa: E501 + 'suburb': (str, none_type,), # noqa: E501 + 'residential': (bool, none_type,), # noqa: E501 + 'address_line1': (str, none_type,), # noqa: E501 + 'address_line2': (str, none_type,), # noqa: E501 + 'validate_location': (bool, none_type,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'country_code': 'country_code', # noqa: E501 + 'postal_code': 'postal_code', # noqa: E501 + 'city': 'city', # noqa: E501 + 'federal_tax_id': 'federal_tax_id', # noqa: E501 + 'state_tax_id': 'state_tax_id', # noqa: E501 + 'person_name': 'person_name', # noqa: E501 + 'company_name': 'company_name', # noqa: E501 + 'email': 'email', # noqa: E501 + 'phone_number': 'phone_number', # noqa: E501 + 'state_code': 'state_code', # noqa: E501 + 'suburb': 'suburb', # noqa: E501 + 'residential': 'residential', # noqa: E501 + 'address_line1': 'address_line1', # noqa: E501 + 'address_line2': 'address_line2', # noqa: E501 + 'validate_location': 'validate_location', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, country_code, *args, **kwargs): # noqa: E501 + """AddressData - a model defined in OpenAPI + + Args: + country_code (str): The address country code + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + postal_code (str, none_type): The address postal code **(required for shipment purchase)** . [optional] # noqa: E501 + city (str, none_type): The address city. **(required for shipment purchase)** . [optional] # noqa: E501 + federal_tax_id (str, none_type): The party frederal tax id. [optional] # noqa: E501 + state_tax_id (str, none_type): The party state id. [optional] # noqa: E501 + person_name (str, none_type): attention to **(required for shipment purchase)** . [optional] # noqa: E501 + company_name (str, none_type): The company name if the party is a company. [optional] # noqa: E501 + email (str, none_type): The party email. [optional] # noqa: E501 + phone_number (str, none_type): The party phone number.. [optional] # noqa: E501 + state_code (str, none_type): The address state code. [optional] # noqa: E501 + suburb (str, none_type): The address suburb if known. [optional] # noqa: E501 + residential (bool, none_type): Indicate if the address is residential or commercial (enterprise). [optional] if omitted the server will use the default value of False # noqa: E501 + address_line1 (str, none_type): The address line with street number
**(required for shipment purchase)** . [optional] # noqa: E501 + address_line2 (str, none_type): The address line with suite number. [optional] # noqa: E501 + validate_location (bool, none_type): Indicate if the address should be validated. [optional] if omitted the server will use the default value of False # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.country_code = country_code + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + required_properties = set([ + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) + + @convert_js_args_to_python_args + def __init__(self, country_code, *args, **kwargs): # noqa: E501 + """AddressData - a model defined in OpenAPI + + Args: + country_code (str): The address country code + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + postal_code (str, none_type): The address postal code **(required for shipment purchase)** . [optional] # noqa: E501 + city (str, none_type): The address city. **(required for shipment purchase)** . [optional] # noqa: E501 + federal_tax_id (str, none_type): The party frederal tax id. [optional] # noqa: E501 + state_tax_id (str, none_type): The party state id. [optional] # noqa: E501 + person_name (str, none_type): attention to **(required for shipment purchase)** . [optional] # noqa: E501 + company_name (str, none_type): The company name if the party is a company. [optional] # noqa: E501 + email (str, none_type): The party email. [optional] # noqa: E501 + phone_number (str, none_type): The party phone number.. [optional] # noqa: E501 + state_code (str, none_type): The address state code. [optional] # noqa: E501 + suburb (str, none_type): The address suburb if known. [optional] # noqa: E501 + residential (bool, none_type): Indicate if the address is residential or commercial (enterprise). [optional] if omitted the server will use the default value of False # noqa: E501 + address_line1 (str, none_type): The address line with street number
**(required for shipment purchase)** . [optional] # noqa: E501 + address_line2 (str, none_type): The address line with suite number. [optional] # noqa: E501 + validate_location (bool, none_type): Indicate if the address should be validated. [optional] if omitted the server will use the default value of False # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.country_code = country_code + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + f"class with read only attributes.") diff --git a/purplship/model/address_list.py b/purplship/model/address_list.py new file mode 100644 index 0000000..89d30a5 --- /dev/null +++ b/purplship/model/address_list.py @@ -0,0 +1,282 @@ +""" + Purplship API + + ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.7`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 + + The version of the OpenAPI document: 2021.7 + Contact: hello@purplship.com + Generated by: https://openapi-generator.tech +""" + + +import re # noqa: F401 +import sys # noqa: F401 + +from purplship.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) +from ..model_utils import OpenApiModel +from purplship.exceptions import ApiAttributeError + + +def lazy_import(): + from purplship.model.address import Address + globals()['Address'] = Address + + +class AddressList(ModelNormal): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + } + + validations = { + ('next',): { + 'min_length': 1, + }, + ('previous',): { + 'min_length': 1, + }, + } + + @cached_property + def additional_properties_type(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + """ + lazy_import() + return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + + _nullable = False + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + lazy_import() + return { + 'results': ([Address],), # noqa: E501 + 'next': (str,), # noqa: E501 + 'previous': (str,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'results': 'results', # noqa: E501 + 'next': 'next', # noqa: E501 + 'previous': 'previous', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, results, *args, **kwargs): # noqa: E501 + """AddressList - a model defined in OpenAPI + + Args: + results ([Address]): + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + next (str): [optional] # noqa: E501 + previous (str): [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.results = results + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + required_properties = set([ + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) + + @convert_js_args_to_python_args + def __init__(self, results, *args, **kwargs): # noqa: E501 + """AddressList - a model defined in OpenAPI + + Args: + results ([Address]): + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + next (str): [optional] # noqa: E501 + previous (str): [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.results = results + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + f"class with read only attributes.") diff --git a/purplship/model/address_validation.py b/purplship/model/address_validation.py new file mode 100644 index 0000000..707522e --- /dev/null +++ b/purplship/model/address_validation.py @@ -0,0 +1,266 @@ +""" + Purplship API + + ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.7`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 + + The version of the OpenAPI document: 2021.7 + Contact: hello@purplship.com + Generated by: https://openapi-generator.tech +""" + + +import re # noqa: F401 +import sys # noqa: F401 + +from purplship.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) +from ..model_utils import OpenApiModel +from purplship.exceptions import ApiAttributeError + + + +class AddressValidation(ModelNormal): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + } + + validations = { + } + + @cached_property + def additional_properties_type(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + """ + return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + + _nullable = True + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'success': (bool,), # noqa: E501 + 'meta': ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'success': 'success', # noqa: E501 + 'meta': 'meta', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, success, *args, **kwargs): # noqa: E501 + """AddressValidation - a model defined in OpenAPI + + Args: + success (bool): True if the address is valid + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + meta ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type): validation service details. [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.success = success + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + required_properties = set([ + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) + + @convert_js_args_to_python_args + def __init__(self, success, *args, **kwargs): # noqa: E501 + """AddressValidation - a model defined in OpenAPI + + Args: + success (bool): True if the address is valid + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + meta ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type): validation service details. [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.success = success + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + f"class with read only attributes.") diff --git a/purplship/model/carrier_list.py b/purplship/model/carrier_list.py new file mode 100644 index 0000000..a0b6867 --- /dev/null +++ b/purplship/model/carrier_list.py @@ -0,0 +1,282 @@ +""" + Purplship API + + ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.7`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 + + The version of the OpenAPI document: 2021.7 + Contact: hello@purplship.com + Generated by: https://openapi-generator.tech +""" + + +import re # noqa: F401 +import sys # noqa: F401 + +from purplship.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) +from ..model_utils import OpenApiModel +from purplship.exceptions import ApiAttributeError + + +def lazy_import(): + from purplship.model.carrier_settings import CarrierSettings + globals()['CarrierSettings'] = CarrierSettings + + +class CarrierList(ModelNormal): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + } + + validations = { + ('next',): { + 'min_length': 1, + }, + ('previous',): { + 'min_length': 1, + }, + } + + @cached_property + def additional_properties_type(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + """ + lazy_import() + return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + + _nullable = False + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + lazy_import() + return { + 'results': ([CarrierSettings],), # noqa: E501 + 'next': (str,), # noqa: E501 + 'previous': (str,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'results': 'results', # noqa: E501 + 'next': 'next', # noqa: E501 + 'previous': 'previous', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, results, *args, **kwargs): # noqa: E501 + """CarrierList - a model defined in OpenAPI + + Args: + results ([CarrierSettings]): + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + next (str): [optional] # noqa: E501 + previous (str): [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.results = results + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + required_properties = set([ + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) + + @convert_js_args_to_python_args + def __init__(self, results, *args, **kwargs): # noqa: E501 + """CarrierList - a model defined in OpenAPI + + Args: + results ([CarrierSettings]): + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + next (str): [optional] # noqa: E501 + previous (str): [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.results = results + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + f"class with read only attributes.") diff --git a/purplship/model/carrier_settings.py b/purplship/model/carrier_settings.py new file mode 100644 index 0000000..75b6ce7 --- /dev/null +++ b/purplship/model/carrier_settings.py @@ -0,0 +1,314 @@ +""" + Purplship API + + ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.7`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 + + The version of the OpenAPI document: 2021.7 + Contact: hello@purplship.com + Generated by: https://openapi-generator.tech +""" + + +import re # noqa: F401 +import sys # noqa: F401 + +from purplship.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) +from ..model_utils import OpenApiModel +from purplship.exceptions import ApiAttributeError + + + +class CarrierSettings(ModelNormal): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + ('carrier_name',): { + 'ARAMEX': "aramex", + 'AUSTRALIAPOST': "australiapost", + 'CANADAPOST': "canadapost", + 'CANPAR': "canpar", + 'DHL_EXPRESS': "dhl_express", + 'DHL_UNIVERSAL': "dhl_universal", + 'DICOM': "dicom", + 'ESHIPPER': "eshipper", + 'FEDEX': "fedex", + 'FREIGHTCOM': "freightcom", + 'PUROLATOR': "purolator", + 'ROYALMAIL': "royalmail", + 'SENDLE': "sendle", + 'SF_EXPRESS': "sf_express", + 'TNT': "tnt", + 'UPS': "ups", + 'USPS': "usps", + 'USPS_INTERNATIONAL': "usps_international", + 'YANWEN': "yanwen", + 'YUNEXPRESS': "yunexpress", + }, + } + + validations = { + ('id',): { + 'min_length': 1, + }, + ('carrier_id',): { + 'min_length': 1, + }, + } + + @cached_property + def additional_properties_type(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + """ + return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + + _nullable = False + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'id': (str,), # noqa: E501 + 'carrier_name': (str,), # noqa: E501 + 'carrier_id': (str,), # noqa: E501 + 'test': (bool,), # noqa: E501 + 'active': (bool,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'id': 'id', # noqa: E501 + 'carrier_name': 'carrier_name', # noqa: E501 + 'carrier_id': 'carrier_id', # noqa: E501 + 'test': 'test', # noqa: E501 + 'active': 'active', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, id, carrier_name, carrier_id, test, active, *args, **kwargs): # noqa: E501 + """CarrierSettings - a model defined in OpenAPI + + Args: + id (str): A unique address identifier + carrier_name (str): Indicates a carrier (type) + carrier_id (str): Indicates a specific carrier configuration name. + test (bool): The test flag indicates whether to use a carrier configured for test. + active (bool): The active flag indicates whether the carrier account is active or not. + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.id = id + self.carrier_name = carrier_name + self.carrier_id = carrier_id + self.test = test + self.active = active + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + required_properties = set([ + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) + + @convert_js_args_to_python_args + def __init__(self, id, carrier_name, carrier_id, test, active, *args, **kwargs): # noqa: E501 + """CarrierSettings - a model defined in OpenAPI + + Args: + id (str): A unique address identifier + carrier_name (str): Indicates a carrier (type) + carrier_id (str): Indicates a specific carrier configuration name. + test (bool): The test flag indicates whether to use a carrier configured for test. + active (bool): The active flag indicates whether the carrier account is active or not. + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.id = id + self.carrier_name = carrier_name + self.carrier_id = carrier_id + self.test = test + self.active = active + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + f"class with read only attributes.") diff --git a/purplship/model/charge.py b/purplship/model/charge.py new file mode 100644 index 0000000..bf4dd12 --- /dev/null +++ b/purplship/model/charge.py @@ -0,0 +1,264 @@ +""" + Purplship API + + ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.7`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 + + The version of the OpenAPI document: 2021.7 + Contact: hello@purplship.com + Generated by: https://openapi-generator.tech +""" + + +import re # noqa: F401 +import sys # noqa: F401 + +from purplship.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) +from ..model_utils import OpenApiModel +from purplship.exceptions import ApiAttributeError + + + +class Charge(ModelNormal): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + } + + validations = { + } + + @cached_property + def additional_properties_type(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + """ + return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + + _nullable = True + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'name': (str, none_type,), # noqa: E501 + 'amount': (float, none_type,), # noqa: E501 + 'currency': (str, none_type,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'name': 'name', # noqa: E501 + 'amount': 'amount', # noqa: E501 + 'currency': 'currency', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 + """Charge - a model defined in OpenAPI + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + name (str, none_type): The charge description. [optional] # noqa: E501 + amount (float, none_type): The charge monetary value. [optional] # noqa: E501 + currency (str, none_type): The charge amount currency. [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + required_properties = set([ + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) + + @convert_js_args_to_python_args + def __init__(self, *args, **kwargs): # noqa: E501 + """Charge - a model defined in OpenAPI + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + name (str, none_type): The charge description. [optional] # noqa: E501 + amount (float, none_type): The charge monetary value. [optional] # noqa: E501 + currency (str, none_type): The charge amount currency. [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + f"class with read only attributes.") diff --git a/purplship/model/commodity.py b/purplship/model/commodity.py new file mode 100644 index 0000000..3bcf279 --- /dev/null +++ b/purplship/model/commodity.py @@ -0,0 +1,303 @@ +""" + Purplship API + + ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.7`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 + + The version of the OpenAPI document: 2021.7 + Contact: hello@purplship.com + Generated by: https://openapi-generator.tech +""" + + +import re # noqa: F401 +import sys # noqa: F401 + +from purplship.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) +from ..model_utils import OpenApiModel +from purplship.exceptions import ApiAttributeError + + + +class Commodity(ModelNormal): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + ('weight_unit',): { + 'KG': "KG", + 'LB': "LB", + }, + } + + validations = { + ('id',): { + 'min_length': 1, + }, + } + + @cached_property + def additional_properties_type(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + """ + return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + + _nullable = True + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'weight': (float,), # noqa: E501 + 'weight_unit': (str,), # noqa: E501 + 'id': (str,), # noqa: E501 + 'description': (str, none_type,), # noqa: E501 + 'quantity': (int, none_type,), # noqa: E501 + 'sku': (str, none_type,), # noqa: E501 + 'value_amount': (float, none_type,), # noqa: E501 + 'value_currency': (str, none_type,), # noqa: E501 + 'origin_country': (str, none_type,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'weight': 'weight', # noqa: E501 + 'weight_unit': 'weight_unit', # noqa: E501 + 'id': 'id', # noqa: E501 + 'description': 'description', # noqa: E501 + 'quantity': 'quantity', # noqa: E501 + 'sku': 'sku', # noqa: E501 + 'value_amount': 'value_amount', # noqa: E501 + 'value_currency': 'value_currency', # noqa: E501 + 'origin_country': 'origin_country', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, weight, weight_unit, *args, **kwargs): # noqa: E501 + """Commodity - a model defined in OpenAPI + + Args: + weight (float): The commodity's weight + weight_unit (str): The commodity's weight unit + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + id (str): A unique identifier. [optional] # noqa: E501 + description (str, none_type): A description of the commodity. [optional] # noqa: E501 + quantity (int, none_type): The commodity's quantity (number or item). [optional] # noqa: E501 + sku (str, none_type): The commodity's sku number. [optional] # noqa: E501 + value_amount (float, none_type): The monetary value of the commodity. [optional] # noqa: E501 + value_currency (str, none_type): The currency of the commodity value amount. [optional] # noqa: E501 + origin_country (str, none_type): The origin or manufacture country. [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.weight = weight + self.weight_unit = weight_unit + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + required_properties = set([ + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) + + @convert_js_args_to_python_args + def __init__(self, weight, weight_unit, *args, **kwargs): # noqa: E501 + """Commodity - a model defined in OpenAPI + + Args: + weight (float): The commodity's weight + weight_unit (str): The commodity's weight unit + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + id (str): A unique identifier. [optional] # noqa: E501 + description (str, none_type): A description of the commodity. [optional] # noqa: E501 + quantity (int, none_type): The commodity's quantity (number or item). [optional] # noqa: E501 + sku (str, none_type): The commodity's sku number. [optional] # noqa: E501 + value_amount (float, none_type): The monetary value of the commodity. [optional] # noqa: E501 + value_currency (str, none_type): The currency of the commodity value amount. [optional] # noqa: E501 + origin_country (str, none_type): The origin or manufacture country. [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.weight = weight + self.weight_unit = weight_unit + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + f"class with read only attributes.") diff --git a/purplship/model/commodity_data.py b/purplship/model/commodity_data.py new file mode 100644 index 0000000..6b7ce66 --- /dev/null +++ b/purplship/model/commodity_data.py @@ -0,0 +1,296 @@ +""" + Purplship API + + ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.7`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 + + The version of the OpenAPI document: 2021.7 + Contact: hello@purplship.com + Generated by: https://openapi-generator.tech +""" + + +import re # noqa: F401 +import sys # noqa: F401 + +from purplship.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) +from ..model_utils import OpenApiModel +from purplship.exceptions import ApiAttributeError + + + +class CommodityData(ModelNormal): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + ('weight_unit',): { + 'KG': "KG", + 'LB': "LB", + }, + } + + validations = { + } + + @cached_property + def additional_properties_type(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + """ + return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + + _nullable = False + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'weight': (float,), # noqa: E501 + 'weight_unit': (str,), # noqa: E501 + 'description': (str, none_type,), # noqa: E501 + 'quantity': (int, none_type,), # noqa: E501 + 'sku': (str, none_type,), # noqa: E501 + 'value_amount': (float, none_type,), # noqa: E501 + 'value_currency': (str, none_type,), # noqa: E501 + 'origin_country': (str, none_type,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'weight': 'weight', # noqa: E501 + 'weight_unit': 'weight_unit', # noqa: E501 + 'description': 'description', # noqa: E501 + 'quantity': 'quantity', # noqa: E501 + 'sku': 'sku', # noqa: E501 + 'value_amount': 'value_amount', # noqa: E501 + 'value_currency': 'value_currency', # noqa: E501 + 'origin_country': 'origin_country', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, weight, weight_unit, *args, **kwargs): # noqa: E501 + """CommodityData - a model defined in OpenAPI + + Args: + weight (float): The commodity's weight + weight_unit (str): The commodity's weight unit + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + description (str, none_type): A description of the commodity. [optional] # noqa: E501 + quantity (int, none_type): The commodity's quantity (number or item). [optional] # noqa: E501 + sku (str, none_type): The commodity's sku number. [optional] # noqa: E501 + value_amount (float, none_type): The monetary value of the commodity. [optional] # noqa: E501 + value_currency (str, none_type): The currency of the commodity value amount. [optional] # noqa: E501 + origin_country (str, none_type): The origin or manufacture country. [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.weight = weight + self.weight_unit = weight_unit + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + required_properties = set([ + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) + + @convert_js_args_to_python_args + def __init__(self, weight, weight_unit, *args, **kwargs): # noqa: E501 + """CommodityData - a model defined in OpenAPI + + Args: + weight (float): The commodity's weight + weight_unit (str): The commodity's weight unit + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + description (str, none_type): A description of the commodity. [optional] # noqa: E501 + quantity (int, none_type): The commodity's quantity (number or item). [optional] # noqa: E501 + sku (str, none_type): The commodity's sku number. [optional] # noqa: E501 + value_amount (float, none_type): The monetary value of the commodity. [optional] # noqa: E501 + value_currency (str, none_type): The currency of the commodity value amount. [optional] # noqa: E501 + origin_country (str, none_type): The origin or manufacture country. [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.weight = weight + self.weight_unit = weight_unit + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + f"class with read only attributes.") diff --git a/purplship/model/customs.py b/purplship/model/customs.py new file mode 100644 index 0000000..77c59a2 --- /dev/null +++ b/purplship/model/customs.py @@ -0,0 +1,348 @@ +""" + Purplship API + + ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.7`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 + + The version of the OpenAPI document: 2021.7 + Contact: hello@purplship.com + Generated by: https://openapi-generator.tech +""" + + +import re # noqa: F401 +import sys # noqa: F401 + +from purplship.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) +from ..model_utils import OpenApiModel +from purplship.exceptions import ApiAttributeError + + +def lazy_import(): + from purplship.model.commodity import Commodity + from purplship.model.duty import Duty + globals()['Commodity'] = Commodity + globals()['Duty'] = Duty + + +class Customs(ModelNormal): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + ('content_type',): { + 'None': None, + 'DOCUMENTS': "documents", + 'GIFT': "gift", + 'SAMPLE': "sample", + 'MERCHANDISE': "merchandise", + 'RETURN_MERCHANDISE': "return_merchandise", + 'OTHER': "other", + }, + ('incoterm',): { + 'None': None, + 'CFR': "CFR", + 'CIF': "CIF", + 'CIP': "CIP", + 'CPT': "CPT", + 'DAF': "DAF", + 'DDP': "DDP", + 'DDU': "DDU", + 'DEQ': "DEQ", + 'DES': "DES", + 'EXW': "EXW", + 'FAS': "FAS", + 'FCA': "FCA", + 'FOB': "FOB", + }, + } + + validations = { + ('id',): { + 'min_length': 1, + }, + } + + @cached_property + def additional_properties_type(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + """ + lazy_import() + return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + + _nullable = False + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + lazy_import() + return { + 'id': (str,), # noqa: E501 + 'aes': (str, none_type,), # noqa: E501 + 'eel_pfc': (str, none_type,), # noqa: E501 + 'content_type': (str, none_type,), # noqa: E501 + 'content_description': (str, none_type,), # noqa: E501 + 'incoterm': (str, none_type,), # noqa: E501 + 'commodities': ([Commodity], none_type,), # noqa: E501 + 'duty': (Duty,), # noqa: E501 + 'invoice': (str, none_type,), # noqa: E501 + 'invoice_date': (str, none_type,), # noqa: E501 + 'commercial_invoice': (bool, none_type,), # noqa: E501 + 'certify': (bool, none_type,), # noqa: E501 + 'signer': (str, none_type,), # noqa: E501 + 'certificate_number': (str, none_type,), # noqa: E501 + 'options': ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'id': 'id', # noqa: E501 + 'aes': 'aes', # noqa: E501 + 'eel_pfc': 'eel_pfc', # noqa: E501 + 'content_type': 'content_type', # noqa: E501 + 'content_description': 'content_description', # noqa: E501 + 'incoterm': 'incoterm', # noqa: E501 + 'commodities': 'commodities', # noqa: E501 + 'duty': 'duty', # noqa: E501 + 'invoice': 'invoice', # noqa: E501 + 'invoice_date': 'invoice_date', # noqa: E501 + 'commercial_invoice': 'commercial_invoice', # noqa: E501 + 'certify': 'certify', # noqa: E501 + 'signer': 'signer', # noqa: E501 + 'certificate_number': 'certificate_number', # noqa: E501 + 'options': 'options', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 + """Customs - a model defined in OpenAPI + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + id (str): A unique identifier. [optional] # noqa: E501 + aes (str, none_type): [optional] # noqa: E501 + eel_pfc (str, none_type): [optional] # noqa: E501 + content_type (str, none_type): [optional] # noqa: E501 + content_description (str, none_type): [optional] # noqa: E501 + incoterm (str, none_type): The customs 'term of trade' also known as 'incoterm'. [optional] # noqa: E501 + commodities ([Commodity], none_type): The parcel content items. [optional] # noqa: E501 + duty (Duty): [optional] # noqa: E501 + invoice (str, none_type): The invoice reference number. [optional] # noqa: E501 + invoice_date (str, none_type): The invoice date. [optional] # noqa: E501 + commercial_invoice (bool, none_type): Indicates if the shipment is commercial. [optional] # noqa: E501 + certify (bool, none_type): Indicate that signer certified confirmed all. [optional] # noqa: E501 + signer (str, none_type): [optional] # noqa: E501 + certificate_number (str, none_type): [optional] # noqa: E501 + options ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type): [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + required_properties = set([ + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) + + @convert_js_args_to_python_args + def __init__(self, *args, **kwargs): # noqa: E501 + """Customs - a model defined in OpenAPI + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + id (str): A unique identifier. [optional] # noqa: E501 + aes (str, none_type): [optional] # noqa: E501 + eel_pfc (str, none_type): [optional] # noqa: E501 + content_type (str, none_type): [optional] # noqa: E501 + content_description (str, none_type): [optional] # noqa: E501 + incoterm (str, none_type): The customs 'term of trade' also known as 'incoterm'. [optional] # noqa: E501 + commodities ([Commodity], none_type): The parcel content items. [optional] # noqa: E501 + duty (Duty): [optional] # noqa: E501 + invoice (str, none_type): The invoice reference number. [optional] # noqa: E501 + invoice_date (str, none_type): The invoice date. [optional] # noqa: E501 + commercial_invoice (bool, none_type): Indicates if the shipment is commercial. [optional] # noqa: E501 + certify (bool, none_type): Indicate that signer certified confirmed all. [optional] # noqa: E501 + signer (str, none_type): [optional] # noqa: E501 + certificate_number (str, none_type): [optional] # noqa: E501 + options ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type): [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + f"class with read only attributes.") diff --git a/purplship/model/customs_data.py b/purplship/model/customs_data.py new file mode 100644 index 0000000..f2060ad --- /dev/null +++ b/purplship/model/customs_data.py @@ -0,0 +1,341 @@ +""" + Purplship API + + ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.7`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 + + The version of the OpenAPI document: 2021.7 + Contact: hello@purplship.com + Generated by: https://openapi-generator.tech +""" + + +import re # noqa: F401 +import sys # noqa: F401 + +from purplship.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) +from ..model_utils import OpenApiModel +from purplship.exceptions import ApiAttributeError + + +def lazy_import(): + from purplship.model.commodity import Commodity + from purplship.model.duty import Duty + globals()['Commodity'] = Commodity + globals()['Duty'] = Duty + + +class CustomsData(ModelNormal): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + ('content_type',): { + 'None': None, + 'DOCUMENTS': "documents", + 'GIFT': "gift", + 'SAMPLE': "sample", + 'MERCHANDISE': "merchandise", + 'RETURN_MERCHANDISE': "return_merchandise", + 'OTHER': "other", + }, + ('incoterm',): { + 'None': None, + 'CFR': "CFR", + 'CIF': "CIF", + 'CIP': "CIP", + 'CPT': "CPT", + 'DAF': "DAF", + 'DDP': "DDP", + 'DDU': "DDU", + 'DEQ': "DEQ", + 'DES': "DES", + 'EXW': "EXW", + 'FAS': "FAS", + 'FCA': "FCA", + 'FOB': "FOB", + }, + } + + validations = { + } + + @cached_property + def additional_properties_type(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + """ + lazy_import() + return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + + _nullable = False + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + lazy_import() + return { + 'aes': (str, none_type,), # noqa: E501 + 'eel_pfc': (str, none_type,), # noqa: E501 + 'content_type': (str, none_type,), # noqa: E501 + 'content_description': (str, none_type,), # noqa: E501 + 'incoterm': (str, none_type,), # noqa: E501 + 'commodities': ([Commodity], none_type,), # noqa: E501 + 'duty': (Duty,), # noqa: E501 + 'invoice': (str, none_type,), # noqa: E501 + 'invoice_date': (str, none_type,), # noqa: E501 + 'commercial_invoice': (bool, none_type,), # noqa: E501 + 'certify': (bool, none_type,), # noqa: E501 + 'signer': (str, none_type,), # noqa: E501 + 'certificate_number': (str, none_type,), # noqa: E501 + 'options': ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'aes': 'aes', # noqa: E501 + 'eel_pfc': 'eel_pfc', # noqa: E501 + 'content_type': 'content_type', # noqa: E501 + 'content_description': 'content_description', # noqa: E501 + 'incoterm': 'incoterm', # noqa: E501 + 'commodities': 'commodities', # noqa: E501 + 'duty': 'duty', # noqa: E501 + 'invoice': 'invoice', # noqa: E501 + 'invoice_date': 'invoice_date', # noqa: E501 + 'commercial_invoice': 'commercial_invoice', # noqa: E501 + 'certify': 'certify', # noqa: E501 + 'signer': 'signer', # noqa: E501 + 'certificate_number': 'certificate_number', # noqa: E501 + 'options': 'options', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 + """CustomsData - a model defined in OpenAPI + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + aes (str, none_type): [optional] # noqa: E501 + eel_pfc (str, none_type): [optional] # noqa: E501 + content_type (str, none_type): [optional] # noqa: E501 + content_description (str, none_type): [optional] # noqa: E501 + incoterm (str, none_type): The customs 'term of trade' also known as 'incoterm'. [optional] # noqa: E501 + commodities ([Commodity], none_type): The parcel content items. [optional] # noqa: E501 + duty (Duty): [optional] # noqa: E501 + invoice (str, none_type): The invoice reference number. [optional] # noqa: E501 + invoice_date (str, none_type): The invoice date. [optional] # noqa: E501 + commercial_invoice (bool, none_type): Indicates if the shipment is commercial. [optional] # noqa: E501 + certify (bool, none_type): Indicate that signer certified confirmed all. [optional] # noqa: E501 + signer (str, none_type): [optional] # noqa: E501 + certificate_number (str, none_type): [optional] # noqa: E501 + options ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type): [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + required_properties = set([ + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) + + @convert_js_args_to_python_args + def __init__(self, *args, **kwargs): # noqa: E501 + """CustomsData - a model defined in OpenAPI + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + aes (str, none_type): [optional] # noqa: E501 + eel_pfc (str, none_type): [optional] # noqa: E501 + content_type (str, none_type): [optional] # noqa: E501 + content_description (str, none_type): [optional] # noqa: E501 + incoterm (str, none_type): The customs 'term of trade' also known as 'incoterm'. [optional] # noqa: E501 + commodities ([Commodity], none_type): The parcel content items. [optional] # noqa: E501 + duty (Duty): [optional] # noqa: E501 + invoice (str, none_type): The invoice reference number. [optional] # noqa: E501 + invoice_date (str, none_type): The invoice date. [optional] # noqa: E501 + commercial_invoice (bool, none_type): Indicates if the shipment is commercial. [optional] # noqa: E501 + certify (bool, none_type): Indicate that signer certified confirmed all. [optional] # noqa: E501 + signer (str, none_type): [optional] # noqa: E501 + certificate_number (str, none_type): [optional] # noqa: E501 + options ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type): [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + f"class with read only attributes.") diff --git a/purplship/model/customs_list.py b/purplship/model/customs_list.py new file mode 100644 index 0000000..b72fd33 --- /dev/null +++ b/purplship/model/customs_list.py @@ -0,0 +1,282 @@ +""" + Purplship API + + ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.7`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 + + The version of the OpenAPI document: 2021.7 + Contact: hello@purplship.com + Generated by: https://openapi-generator.tech +""" + + +import re # noqa: F401 +import sys # noqa: F401 + +from purplship.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) +from ..model_utils import OpenApiModel +from purplship.exceptions import ApiAttributeError + + +def lazy_import(): + from purplship.model.customs import Customs + globals()['Customs'] = Customs + + +class CustomsList(ModelNormal): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + } + + validations = { + ('next',): { + 'min_length': 1, + }, + ('previous',): { + 'min_length': 1, + }, + } + + @cached_property + def additional_properties_type(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + """ + lazy_import() + return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + + _nullable = False + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + lazy_import() + return { + 'results': ([Customs],), # noqa: E501 + 'next': (str,), # noqa: E501 + 'previous': (str,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'results': 'results', # noqa: E501 + 'next': 'next', # noqa: E501 + 'previous': 'previous', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, results, *args, **kwargs): # noqa: E501 + """CustomsList - a model defined in OpenAPI + + Args: + results ([Customs]): + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + next (str): [optional] # noqa: E501 + previous (str): [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.results = results + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + required_properties = set([ + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) + + @convert_js_args_to_python_args + def __init__(self, results, *args, **kwargs): # noqa: E501 + """CustomsList - a model defined in OpenAPI + + Args: + results ([Customs]): + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + next (str): [optional] # noqa: E501 + previous (str): [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.results = results + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + f"class with read only attributes.") diff --git a/purplship/model/duty.py b/purplship/model/duty.py new file mode 100644 index 0000000..3d9482a --- /dev/null +++ b/purplship/model/duty.py @@ -0,0 +1,430 @@ +""" + Purplship API + + ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.7`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 + + The version of the OpenAPI document: 2021.7 + Contact: hello@purplship.com + Generated by: https://openapi-generator.tech +""" + + +import re # noqa: F401 +import sys # noqa: F401 + +from purplship.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) +from ..model_utils import OpenApiModel +from purplship.exceptions import ApiAttributeError + + +def lazy_import(): + from purplship.model.address import Address + globals()['Address'] = Address + + +class Duty(ModelNormal): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + ('paid_by',): { + 'None': None, + 'SENDER': "sender", + 'RECIPIENT': "recipient", + 'THIRD_PARTY': "third_party", + }, + ('currency',): { + 'None': None, + 'EUR': "EUR", + 'AED': "AED", + 'USD': "USD", + 'XCD': "XCD", + 'AMD': "AMD", + 'ANG': "ANG", + 'AOA': "AOA", + 'ARS': "ARS", + 'AUD': "AUD", + 'AWG': "AWG", + 'AZN': "AZN", + 'BAM': "BAM", + 'BBD': "BBD", + 'BDT': "BDT", + 'XOF': "XOF", + 'BGN': "BGN", + 'BHD': "BHD", + 'BIF': "BIF", + 'BMD': "BMD", + 'BND': "BND", + 'BOB': "BOB", + 'BRL': "BRL", + 'BSD': "BSD", + 'BTN': "BTN", + 'BWP': "BWP", + 'BYN': "BYN", + 'BZD': "BZD", + 'CAD': "CAD", + 'CDF': "CDF", + 'XAF': "XAF", + 'CHF': "CHF", + 'NZD': "NZD", + 'CLP': "CLP", + 'CNY': "CNY", + 'COP': "COP", + 'CRC': "CRC", + 'CUC': "CUC", + 'CVE': "CVE", + 'CZK': "CZK", + 'DJF': "DJF", + 'DKK': "DKK", + 'DOP': "DOP", + 'DZD': "DZD", + 'EGP': "EGP", + 'ERN': "ERN", + 'ETB': "ETB", + 'FJD': "FJD", + 'GBP': "GBP", + 'GEL': "GEL", + 'GHS': "GHS", + 'GMD': "GMD", + 'GNF': "GNF", + 'GTQ': "GTQ", + 'GYD': "GYD", + 'HKD': "HKD", + 'HNL': "HNL", + 'HRK': "HRK", + 'HTG': "HTG", + 'HUF': "HUF", + 'IDR': "IDR", + 'ILS': "ILS", + 'INR': "INR", + 'IRR': "IRR", + 'ISK': "ISK", + 'JMD': "JMD", + 'JOD': "JOD", + 'JPY': "JPY", + 'KES': "KES", + 'KGS': "KGS", + 'KHR': "KHR", + 'KMF': "KMF", + 'KPW': "KPW", + 'KRW': "KRW", + 'KWD': "KWD", + 'KYD': "KYD", + 'KZT': "KZT", + 'LAK': "LAK", + 'LKR': "LKR", + 'LRD': "LRD", + 'LSL': "LSL", + 'LYD': "LYD", + 'MAD': "MAD", + 'MDL': "MDL", + 'MGA': "MGA", + 'MKD': "MKD", + 'MMK': "MMK", + 'MNT': "MNT", + 'MOP': "MOP", + 'MRO': "MRO", + 'MUR': "MUR", + 'MVR': "MVR", + 'MWK': "MWK", + 'MXN': "MXN", + 'MYR': "MYR", + 'MZN': "MZN", + 'NAD': "NAD", + 'XPF': "XPF", + 'NGN': "NGN", + 'NIO': "NIO", + 'NOK': "NOK", + 'NPR': "NPR", + 'OMR': "OMR", + 'PEN': "PEN", + 'PGK': "PGK", + 'PHP': "PHP", + 'PKR': "PKR", + 'PLN': "PLN", + 'PYG': "PYG", + 'QAR': "QAR", + 'RSD': "RSD", + 'RUB': "RUB", + 'RWF': "RWF", + 'SAR': "SAR", + 'SBD': "SBD", + 'SCR': "SCR", + 'SDG': "SDG", + 'SEK': "SEK", + 'SGD': "SGD", + 'SHP': "SHP", + 'SLL': "SLL", + 'SOS': "SOS", + 'SRD': "SRD", + 'SSP': "SSP", + 'STD': "STD", + 'SYP': "SYP", + 'SZL': "SZL", + 'THB': "THB", + 'TJS': "TJS", + 'TND': "TND", + 'TOP': "TOP", + 'TRY': "TRY", + 'TTD': "TTD", + 'TWD': "TWD", + 'TZS': "TZS", + 'UAH': "UAH", + 'UYU': "UYU", + 'UZS': "UZS", + 'VEF': "VEF", + 'VND': "VND", + 'VUV': "VUV", + 'WST': "WST", + 'YER': "YER", + 'ZAR': "ZAR", + }, + } + + validations = { + } + + @cached_property + def additional_properties_type(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + """ + lazy_import() + return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + + _nullable = True + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + lazy_import() + return { + 'paid_by': (str, none_type,), # noqa: E501 + 'currency': (str, none_type,), # noqa: E501 + 'declared_value': (float, none_type,), # noqa: E501 + 'account_number': (str, none_type,), # noqa: E501 + 'bill_to': (Address,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'paid_by': 'paid_by', # noqa: E501 + 'currency': 'currency', # noqa: E501 + 'declared_value': 'declared_value', # noqa: E501 + 'account_number': 'account_number', # noqa: E501 + 'bill_to': 'bill_to', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 + """Duty - a model defined in OpenAPI + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + paid_by (str, none_type): The duty payer. [optional] # noqa: E501 + currency (str, none_type): The declared value currency. [optional] # noqa: E501 + declared_value (float, none_type): The package declared value. [optional] # noqa: E501 + account_number (str, none_type): The duty payment account number. [optional] # noqa: E501 + bill_to (Address): [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + required_properties = set([ + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) + + @convert_js_args_to_python_args + def __init__(self, *args, **kwargs): # noqa: E501 + """Duty - a model defined in OpenAPI + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + paid_by (str, none_type): The duty payer. [optional] # noqa: E501 + currency (str, none_type): The declared value currency. [optional] # noqa: E501 + declared_value (float, none_type): The package declared value. [optional] # noqa: E501 + account_number (str, none_type): The duty payment account number. [optional] # noqa: E501 + bill_to (Address): [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + f"class with read only attributes.") diff --git a/purplship/model/error_response.py b/purplship/model/error_response.py new file mode 100644 index 0000000..aed1209 --- /dev/null +++ b/purplship/model/error_response.py @@ -0,0 +1,262 @@ +""" + Purplship API + + ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.7`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 + + The version of the OpenAPI document: 2021.7 + Contact: hello@purplship.com + Generated by: https://openapi-generator.tech +""" + + +import re # noqa: F401 +import sys # noqa: F401 + +from purplship.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) +from ..model_utils import OpenApiModel +from purplship.exceptions import ApiAttributeError + + +def lazy_import(): + from purplship.model.message import Message + globals()['Message'] = Message + + +class ErrorResponse(ModelNormal): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + } + + validations = { + } + + @cached_property + def additional_properties_type(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + """ + lazy_import() + return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + + _nullable = False + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + lazy_import() + return { + 'messages': ([Message],), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'messages': 'messages', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 + """ErrorResponse - a model defined in OpenAPI + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + messages ([Message]): The list of error messages. [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + required_properties = set([ + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) + + @convert_js_args_to_python_args + def __init__(self, *args, **kwargs): # noqa: E501 + """ErrorResponse - a model defined in OpenAPI + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + messages ([Message]): The list of error messages. [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + f"class with read only attributes.") diff --git a/purplship/model/message.py b/purplship/model/message.py new file mode 100644 index 0000000..3c8aacc --- /dev/null +++ b/purplship/model/message.py @@ -0,0 +1,284 @@ +""" + Purplship API + + ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.7`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 + + The version of the OpenAPI document: 2021.7 + Contact: hello@purplship.com + Generated by: https://openapi-generator.tech +""" + + +import re # noqa: F401 +import sys # noqa: F401 + +from purplship.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) +from ..model_utils import OpenApiModel +from purplship.exceptions import ApiAttributeError + + + +class Message(ModelNormal): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + } + + validations = { + ('carrier_name',): { + 'min_length': 1, + }, + ('carrier_id',): { + 'min_length': 1, + }, + ('message',): { + 'min_length': 1, + }, + ('code',): { + 'min_length': 1, + }, + } + + @cached_property + def additional_properties_type(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + """ + return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + + _nullable = False + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'carrier_name': (str,), # noqa: E501 + 'carrier_id': (str,), # noqa: E501 + 'message': (str,), # noqa: E501 + 'code': (str,), # noqa: E501 + 'details': ({str: (str, none_type)},), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'carrier_name': 'carrier_name', # noqa: E501 + 'carrier_id': 'carrier_id', # noqa: E501 + 'message': 'message', # noqa: E501 + 'code': 'code', # noqa: E501 + 'details': 'details', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 + """Message - a model defined in OpenAPI + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + carrier_name (str): The targeted carrier. [optional] # noqa: E501 + carrier_id (str): The targeted carrier name (unique identifier). [optional] # noqa: E501 + message (str): The error or warning message. [optional] # noqa: E501 + code (str): The message code. [optional] # noqa: E501 + details ({str: (str, none_type)}): any additional details. [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + required_properties = set([ + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) + + @convert_js_args_to_python_args + def __init__(self, *args, **kwargs): # noqa: E501 + """Message - a model defined in OpenAPI + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + carrier_name (str): The targeted carrier. [optional] # noqa: E501 + carrier_id (str): The targeted carrier name (unique identifier). [optional] # noqa: E501 + message (str): The error or warning message. [optional] # noqa: E501 + code (str): The message code. [optional] # noqa: E501 + details ({str: (str, none_type)}): any additional details. [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + f"class with read only attributes.") diff --git a/purplship/model/operation.py b/purplship/model/operation.py new file mode 100644 index 0000000..f22e316 --- /dev/null +++ b/purplship/model/operation.py @@ -0,0 +1,271 @@ +""" + Purplship API + + ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.7`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 + + The version of the OpenAPI document: 2021.7 + Contact: hello@purplship.com + Generated by: https://openapi-generator.tech +""" + + +import re # noqa: F401 +import sys # noqa: F401 + +from purplship.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) +from ..model_utils import OpenApiModel +from purplship.exceptions import ApiAttributeError + + + +class Operation(ModelNormal): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + } + + validations = { + ('operation',): { + 'min_length': 1, + }, + } + + @cached_property + def additional_properties_type(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + """ + return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + + _nullable = False + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'operation': (str,), # noqa: E501 + 'success': (bool,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'operation': 'operation', # noqa: E501 + 'success': 'success', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, operation, success, *args, **kwargs): # noqa: E501 + """Operation - a model defined in OpenAPI + + Args: + operation (str): Operation performed + success (bool): Specify whether the operation was successful + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.operation = operation + self.success = success + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + required_properties = set([ + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) + + @convert_js_args_to_python_args + def __init__(self, operation, success, *args, **kwargs): # noqa: E501 + """Operation - a model defined in OpenAPI + + Args: + operation (str): Operation performed + success (bool): Specify whether the operation was successful + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.operation = operation + self.success = success + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + f"class with read only attributes.") diff --git a/purplship/model/operation_confirmation.py b/purplship/model/operation_confirmation.py new file mode 100644 index 0000000..10b3e63 --- /dev/null +++ b/purplship/model/operation_confirmation.py @@ -0,0 +1,289 @@ +""" + Purplship API + + ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.7`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 + + The version of the OpenAPI document: 2021.7 + Contact: hello@purplship.com + Generated by: https://openapi-generator.tech +""" + + +import re # noqa: F401 +import sys # noqa: F401 + +from purplship.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) +from ..model_utils import OpenApiModel +from purplship.exceptions import ApiAttributeError + + + +class OperationConfirmation(ModelNormal): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + } + + validations = { + ('operation',): { + 'min_length': 1, + }, + ('carrier_name',): { + 'min_length': 1, + }, + ('carrier_id',): { + 'min_length': 1, + }, + } + + @cached_property + def additional_properties_type(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + """ + return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + + _nullable = False + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'operation': (str,), # noqa: E501 + 'success': (bool,), # noqa: E501 + 'carrier_name': (str,), # noqa: E501 + 'carrier_id': (str,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'operation': 'operation', # noqa: E501 + 'success': 'success', # noqa: E501 + 'carrier_name': 'carrier_name', # noqa: E501 + 'carrier_id': 'carrier_id', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, operation, success, carrier_name, carrier_id, *args, **kwargs): # noqa: E501 + """OperationConfirmation - a model defined in OpenAPI + + Args: + operation (str): Operation performed + success (bool): Specify whether the operation was successful + carrier_name (str): The operation carrier + carrier_id (str): The targeted carrier's name (unique identifier) + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.operation = operation + self.success = success + self.carrier_name = carrier_name + self.carrier_id = carrier_id + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + required_properties = set([ + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) + + @convert_js_args_to_python_args + def __init__(self, operation, success, carrier_name, carrier_id, *args, **kwargs): # noqa: E501 + """OperationConfirmation - a model defined in OpenAPI + + Args: + operation (str): Operation performed + success (bool): Specify whether the operation was successful + carrier_name (str): The operation carrier + carrier_id (str): The targeted carrier's name (unique identifier) + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.operation = operation + self.success = success + self.carrier_name = carrier_name + self.carrier_id = carrier_id + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + f"class with read only attributes.") diff --git a/purplship/model/operation_response.py b/purplship/model/operation_response.py new file mode 100644 index 0000000..8cdd860 --- /dev/null +++ b/purplship/model/operation_response.py @@ -0,0 +1,268 @@ +""" + Purplship API + + ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.7`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 + + The version of the OpenAPI document: 2021.7 + Contact: hello@purplship.com + Generated by: https://openapi-generator.tech +""" + + +import re # noqa: F401 +import sys # noqa: F401 + +from purplship.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) +from ..model_utils import OpenApiModel +from purplship.exceptions import ApiAttributeError + + +def lazy_import(): + from purplship.model.message import Message + from purplship.model.operation_confirmation import OperationConfirmation + globals()['Message'] = Message + globals()['OperationConfirmation'] = OperationConfirmation + + +class OperationResponse(ModelNormal): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + } + + validations = { + } + + @cached_property + def additional_properties_type(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + """ + lazy_import() + return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + + _nullable = False + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + lazy_import() + return { + 'messages': ([Message],), # noqa: E501 + 'confirmation': (OperationConfirmation,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'messages': 'messages', # noqa: E501 + 'confirmation': 'confirmation', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 + """OperationResponse - a model defined in OpenAPI + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + messages ([Message]): The list of note or warning messages. [optional] # noqa: E501 + confirmation (OperationConfirmation): [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + required_properties = set([ + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) + + @convert_js_args_to_python_args + def __init__(self, *args, **kwargs): # noqa: E501 + """OperationResponse - a model defined in OpenAPI + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + messages ([Message]): The list of note or warning messages. [optional] # noqa: E501 + confirmation (OperationConfirmation): [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + f"class with read only attributes.") diff --git a/purplship/model/parcel.py b/purplship/model/parcel.py new file mode 100644 index 0000000..44ae8a5 --- /dev/null +++ b/purplship/model/parcel.py @@ -0,0 +1,320 @@ +""" + Purplship API + + ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.7`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 + + The version of the OpenAPI document: 2021.7 + Contact: hello@purplship.com + Generated by: https://openapi-generator.tech +""" + + +import re # noqa: F401 +import sys # noqa: F401 + +from purplship.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) +from ..model_utils import OpenApiModel +from purplship.exceptions import ApiAttributeError + + + +class Parcel(ModelNormal): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + ('weight_unit',): { + 'KG': "KG", + 'LB': "LB", + }, + ('dimension_unit',): { + 'None': None, + 'CM': "CM", + 'IN': "IN", + }, + } + + validations = { + ('id',): { + 'min_length': 1, + }, + } + + @cached_property + def additional_properties_type(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + """ + return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + + _nullable = False + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'weight': (float,), # noqa: E501 + 'weight_unit': (str,), # noqa: E501 + 'id': (str,), # noqa: E501 + 'width': (float, none_type,), # noqa: E501 + 'height': (float, none_type,), # noqa: E501 + 'length': (float, none_type,), # noqa: E501 + 'packaging_type': (str, none_type,), # noqa: E501 + 'package_preset': (str, none_type,), # noqa: E501 + 'description': (str, none_type,), # noqa: E501 + 'content': (str, none_type,), # noqa: E501 + 'is_document': (bool, none_type,), # noqa: E501 + 'dimension_unit': (str, none_type,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'weight': 'weight', # noqa: E501 + 'weight_unit': 'weight_unit', # noqa: E501 + 'id': 'id', # noqa: E501 + 'width': 'width', # noqa: E501 + 'height': 'height', # noqa: E501 + 'length': 'length', # noqa: E501 + 'packaging_type': 'packaging_type', # noqa: E501 + 'package_preset': 'package_preset', # noqa: E501 + 'description': 'description', # noqa: E501 + 'content': 'content', # noqa: E501 + 'is_document': 'is_document', # noqa: E501 + 'dimension_unit': 'dimension_unit', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, weight, weight_unit, *args, **kwargs): # noqa: E501 + """Parcel - a model defined in OpenAPI + + Args: + weight (float): The parcel's weight + weight_unit (str): The parcel's weight unit + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + id (str): A unique identifier. [optional] # noqa: E501 + width (float, none_type): The parcel's width. [optional] # noqa: E501 + height (float, none_type): The parcel's height. [optional] # noqa: E501 + length (float, none_type): The parcel's length. [optional] # noqa: E501 + packaging_type (str, none_type): The parcel's packaging type. **Note that the packaging is optional when using a package preset** values:
- **envelope**
- **pak**
- **tube**
- **pallet**
- **small_box**
- **medium_box**
- **your_packaging** For specific carriers packaging type, please consult [the reference](#operation/references). . [optional] # noqa: E501 + package_preset (str, none_type): The parcel's package preset. For specific carriers package preset, please consult [the reference](#operation/references). . [optional] # noqa: E501 + description (str, none_type): The parcel's description. [optional] # noqa: E501 + content (str, none_type): The parcel's content description. [optional] # noqa: E501 + is_document (bool, none_type): Indicates if the parcel is composed of documents only. [optional] if omitted the server will use the default value of False # noqa: E501 + dimension_unit (str, none_type): The parcel's dimension unit. [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.weight = weight + self.weight_unit = weight_unit + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + required_properties = set([ + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) + + @convert_js_args_to_python_args + def __init__(self, weight, weight_unit, *args, **kwargs): # noqa: E501 + """Parcel - a model defined in OpenAPI + + Args: + weight (float): The parcel's weight + weight_unit (str): The parcel's weight unit + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + id (str): A unique identifier. [optional] # noqa: E501 + width (float, none_type): The parcel's width. [optional] # noqa: E501 + height (float, none_type): The parcel's height. [optional] # noqa: E501 + length (float, none_type): The parcel's length. [optional] # noqa: E501 + packaging_type (str, none_type): The parcel's packaging type. **Note that the packaging is optional when using a package preset** values:
- **envelope**
- **pak**
- **tube**
- **pallet**
- **small_box**
- **medium_box**
- **your_packaging** For specific carriers packaging type, please consult [the reference](#operation/references). . [optional] # noqa: E501 + package_preset (str, none_type): The parcel's package preset. For specific carriers package preset, please consult [the reference](#operation/references). . [optional] # noqa: E501 + description (str, none_type): The parcel's description. [optional] # noqa: E501 + content (str, none_type): The parcel's content description. [optional] # noqa: E501 + is_document (bool, none_type): Indicates if the parcel is composed of documents only. [optional] if omitted the server will use the default value of False # noqa: E501 + dimension_unit (str, none_type): The parcel's dimension unit. [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.weight = weight + self.weight_unit = weight_unit + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + f"class with read only attributes.") diff --git a/purplship/model/parcel_data.py b/purplship/model/parcel_data.py new file mode 100644 index 0000000..87cd98c --- /dev/null +++ b/purplship/model/parcel_data.py @@ -0,0 +1,313 @@ +""" + Purplship API + + ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.7`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 + + The version of the OpenAPI document: 2021.7 + Contact: hello@purplship.com + Generated by: https://openapi-generator.tech +""" + + +import re # noqa: F401 +import sys # noqa: F401 + +from purplship.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) +from ..model_utils import OpenApiModel +from purplship.exceptions import ApiAttributeError + + + +class ParcelData(ModelNormal): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + ('weight_unit',): { + 'KG': "KG", + 'LB': "LB", + }, + ('dimension_unit',): { + 'None': None, + 'CM': "CM", + 'IN': "IN", + }, + } + + validations = { + } + + @cached_property + def additional_properties_type(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + """ + return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + + _nullable = False + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'weight': (float,), # noqa: E501 + 'weight_unit': (str,), # noqa: E501 + 'width': (float, none_type,), # noqa: E501 + 'height': (float, none_type,), # noqa: E501 + 'length': (float, none_type,), # noqa: E501 + 'packaging_type': (str, none_type,), # noqa: E501 + 'package_preset': (str, none_type,), # noqa: E501 + 'description': (str, none_type,), # noqa: E501 + 'content': (str, none_type,), # noqa: E501 + 'is_document': (bool, none_type,), # noqa: E501 + 'dimension_unit': (str, none_type,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'weight': 'weight', # noqa: E501 + 'weight_unit': 'weight_unit', # noqa: E501 + 'width': 'width', # noqa: E501 + 'height': 'height', # noqa: E501 + 'length': 'length', # noqa: E501 + 'packaging_type': 'packaging_type', # noqa: E501 + 'package_preset': 'package_preset', # noqa: E501 + 'description': 'description', # noqa: E501 + 'content': 'content', # noqa: E501 + 'is_document': 'is_document', # noqa: E501 + 'dimension_unit': 'dimension_unit', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, weight, weight_unit, *args, **kwargs): # noqa: E501 + """ParcelData - a model defined in OpenAPI + + Args: + weight (float): The parcel's weight + weight_unit (str): The parcel's weight unit + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + width (float, none_type): The parcel's width. [optional] # noqa: E501 + height (float, none_type): The parcel's height. [optional] # noqa: E501 + length (float, none_type): The parcel's length. [optional] # noqa: E501 + packaging_type (str, none_type): The parcel's packaging type. **Note that the packaging is optional when using a package preset** values:
- **envelope**
- **pak**
- **tube**
- **pallet**
- **small_box**
- **medium_box**
- **your_packaging** For specific carriers packaging type, please consult [the reference](#operation/references). . [optional] # noqa: E501 + package_preset (str, none_type): The parcel's package preset. For specific carriers package preset, please consult [the reference](#operation/references). . [optional] # noqa: E501 + description (str, none_type): The parcel's description. [optional] # noqa: E501 + content (str, none_type): The parcel's content description. [optional] # noqa: E501 + is_document (bool, none_type): Indicates if the parcel is composed of documents only. [optional] if omitted the server will use the default value of False # noqa: E501 + dimension_unit (str, none_type): The parcel's dimension unit. [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.weight = weight + self.weight_unit = weight_unit + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + required_properties = set([ + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) + + @convert_js_args_to_python_args + def __init__(self, weight, weight_unit, *args, **kwargs): # noqa: E501 + """ParcelData - a model defined in OpenAPI + + Args: + weight (float): The parcel's weight + weight_unit (str): The parcel's weight unit + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + width (float, none_type): The parcel's width. [optional] # noqa: E501 + height (float, none_type): The parcel's height. [optional] # noqa: E501 + length (float, none_type): The parcel's length. [optional] # noqa: E501 + packaging_type (str, none_type): The parcel's packaging type. **Note that the packaging is optional when using a package preset** values:
- **envelope**
- **pak**
- **tube**
- **pallet**
- **small_box**
- **medium_box**
- **your_packaging** For specific carriers packaging type, please consult [the reference](#operation/references). . [optional] # noqa: E501 + package_preset (str, none_type): The parcel's package preset. For specific carriers package preset, please consult [the reference](#operation/references). . [optional] # noqa: E501 + description (str, none_type): The parcel's description. [optional] # noqa: E501 + content (str, none_type): The parcel's content description. [optional] # noqa: E501 + is_document (bool, none_type): Indicates if the parcel is composed of documents only. [optional] if omitted the server will use the default value of False # noqa: E501 + dimension_unit (str, none_type): The parcel's dimension unit. [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.weight = weight + self.weight_unit = weight_unit + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + f"class with read only attributes.") diff --git a/purplship/model/parcel_list.py b/purplship/model/parcel_list.py new file mode 100644 index 0000000..1bf14d5 --- /dev/null +++ b/purplship/model/parcel_list.py @@ -0,0 +1,282 @@ +""" + Purplship API + + ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.7`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 + + The version of the OpenAPI document: 2021.7 + Contact: hello@purplship.com + Generated by: https://openapi-generator.tech +""" + + +import re # noqa: F401 +import sys # noqa: F401 + +from purplship.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) +from ..model_utils import OpenApiModel +from purplship.exceptions import ApiAttributeError + + +def lazy_import(): + from purplship.model.parcel import Parcel + globals()['Parcel'] = Parcel + + +class ParcelList(ModelNormal): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + } + + validations = { + ('next',): { + 'min_length': 1, + }, + ('previous',): { + 'min_length': 1, + }, + } + + @cached_property + def additional_properties_type(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + """ + lazy_import() + return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + + _nullable = False + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + lazy_import() + return { + 'results': ([Parcel],), # noqa: E501 + 'next': (str,), # noqa: E501 + 'previous': (str,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'results': 'results', # noqa: E501 + 'next': 'next', # noqa: E501 + 'previous': 'previous', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, results, *args, **kwargs): # noqa: E501 + """ParcelList - a model defined in OpenAPI + + Args: + results ([Parcel]): + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + next (str): [optional] # noqa: E501 + previous (str): [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.results = results + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + required_properties = set([ + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) + + @convert_js_args_to_python_args + def __init__(self, results, *args, **kwargs): # noqa: E501 + """ParcelList - a model defined in OpenAPI + + Args: + results ([Parcel]): + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + next (str): [optional] # noqa: E501 + previous (str): [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.results = results + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + f"class with read only attributes.") diff --git a/purplship/model/payment.py b/purplship/model/payment.py new file mode 100644 index 0000000..101c16b --- /dev/null +++ b/purplship/model/payment.py @@ -0,0 +1,414 @@ +""" + Purplship API + + ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.7`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 + + The version of the OpenAPI document: 2021.7 + Contact: hello@purplship.com + Generated by: https://openapi-generator.tech +""" + + +import re # noqa: F401 +import sys # noqa: F401 + +from purplship.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) +from ..model_utils import OpenApiModel +from purplship.exceptions import ApiAttributeError + + + +class Payment(ModelNormal): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + ('paid_by',): { + 'SENDER': "sender", + 'RECIPIENT': "recipient", + 'THIRD_PARTY': "third_party", + }, + ('currency',): { + 'EUR': "EUR", + 'AED': "AED", + 'USD': "USD", + 'XCD': "XCD", + 'AMD': "AMD", + 'ANG': "ANG", + 'AOA': "AOA", + 'ARS': "ARS", + 'AUD': "AUD", + 'AWG': "AWG", + 'AZN': "AZN", + 'BAM': "BAM", + 'BBD': "BBD", + 'BDT': "BDT", + 'XOF': "XOF", + 'BGN': "BGN", + 'BHD': "BHD", + 'BIF': "BIF", + 'BMD': "BMD", + 'BND': "BND", + 'BOB': "BOB", + 'BRL': "BRL", + 'BSD': "BSD", + 'BTN': "BTN", + 'BWP': "BWP", + 'BYN': "BYN", + 'BZD': "BZD", + 'CAD': "CAD", + 'CDF': "CDF", + 'XAF': "XAF", + 'CHF': "CHF", + 'NZD': "NZD", + 'CLP': "CLP", + 'CNY': "CNY", + 'COP': "COP", + 'CRC': "CRC", + 'CUC': "CUC", + 'CVE': "CVE", + 'CZK': "CZK", + 'DJF': "DJF", + 'DKK': "DKK", + 'DOP': "DOP", + 'DZD': "DZD", + 'EGP': "EGP", + 'ERN': "ERN", + 'ETB': "ETB", + 'FJD': "FJD", + 'GBP': "GBP", + 'GEL': "GEL", + 'GHS': "GHS", + 'GMD': "GMD", + 'GNF': "GNF", + 'GTQ': "GTQ", + 'GYD': "GYD", + 'HKD': "HKD", + 'HNL': "HNL", + 'HRK': "HRK", + 'HTG': "HTG", + 'HUF': "HUF", + 'IDR': "IDR", + 'ILS': "ILS", + 'INR': "INR", + 'IRR': "IRR", + 'ISK': "ISK", + 'JMD': "JMD", + 'JOD': "JOD", + 'JPY': "JPY", + 'KES': "KES", + 'KGS': "KGS", + 'KHR': "KHR", + 'KMF': "KMF", + 'KPW': "KPW", + 'KRW': "KRW", + 'KWD': "KWD", + 'KYD': "KYD", + 'KZT': "KZT", + 'LAK': "LAK", + 'LKR': "LKR", + 'LRD': "LRD", + 'LSL': "LSL", + 'LYD': "LYD", + 'MAD': "MAD", + 'MDL': "MDL", + 'MGA': "MGA", + 'MKD': "MKD", + 'MMK': "MMK", + 'MNT': "MNT", + 'MOP': "MOP", + 'MRO': "MRO", + 'MUR': "MUR", + 'MVR': "MVR", + 'MWK': "MWK", + 'MXN': "MXN", + 'MYR': "MYR", + 'MZN': "MZN", + 'NAD': "NAD", + 'XPF': "XPF", + 'NGN': "NGN", + 'NIO': "NIO", + 'NOK': "NOK", + 'NPR': "NPR", + 'OMR': "OMR", + 'PEN': "PEN", + 'PGK': "PGK", + 'PHP': "PHP", + 'PKR': "PKR", + 'PLN': "PLN", + 'PYG': "PYG", + 'QAR': "QAR", + 'RSD': "RSD", + 'RUB': "RUB", + 'RWF': "RWF", + 'SAR': "SAR", + 'SBD': "SBD", + 'SCR': "SCR", + 'SDG': "SDG", + 'SEK': "SEK", + 'SGD': "SGD", + 'SHP': "SHP", + 'SLL': "SLL", + 'SOS': "SOS", + 'SRD': "SRD", + 'SSP': "SSP", + 'STD': "STD", + 'SYP': "SYP", + 'SZL': "SZL", + 'THB': "THB", + 'TJS': "TJS", + 'TND': "TND", + 'TOP': "TOP", + 'TRY': "TRY", + 'TTD': "TTD", + 'TWD': "TWD", + 'TZS': "TZS", + 'UAH': "UAH", + 'UYU': "UYU", + 'UZS': "UZS", + 'VEF': "VEF", + 'VND': "VND", + 'VUV': "VUV", + 'WST': "WST", + 'YER': "YER", + 'ZAR': "ZAR", + }, + } + + validations = { + } + + @cached_property + def additional_properties_type(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + """ + return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + + _nullable = False + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'paid_by': (str,), # noqa: E501 + 'currency': (str,), # noqa: E501 + 'account_number': (str, none_type,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'paid_by': 'paid_by', # noqa: E501 + 'currency': 'currency', # noqa: E501 + 'account_number': 'account_number', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 + """Payment - a model defined in OpenAPI + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + paid_by (str): The payor type. [optional] if omitted the server will use the default value of "sender" # noqa: E501 + currency (str): The payment amount currency. [optional] # noqa: E501 + account_number (str, none_type): The payor account number. [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + required_properties = set([ + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) + + @convert_js_args_to_python_args + def __init__(self, *args, **kwargs): # noqa: E501 + """Payment - a model defined in OpenAPI + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + paid_by (str): The payor type. [optional] if omitted the server will use the default value of "sender" # noqa: E501 + currency (str): The payment amount currency. [optional] # noqa: E501 + account_number (str, none_type): The payor account number. [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + f"class with read only attributes.") diff --git a/purplship/model/pickup.py b/purplship/model/pickup.py new file mode 100644 index 0000000..676e9d4 --- /dev/null +++ b/purplship/model/pickup.py @@ -0,0 +1,355 @@ +""" + Purplship API + + ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.7`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 + + The version of the OpenAPI document: 2021.7 + Contact: hello@purplship.com + Generated by: https://openapi-generator.tech +""" + + +import re # noqa: F401 +import sys # noqa: F401 + +from purplship.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) +from ..model_utils import OpenApiModel +from purplship.exceptions import ApiAttributeError + + +def lazy_import(): + from purplship.model.address import Address + from purplship.model.charge import Charge + from purplship.model.parcel import Parcel + globals()['Address'] = Address + globals()['Charge'] = Charge + globals()['Parcel'] = Parcel + + +class Pickup(ModelNormal): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + } + + validations = { + ('carrier_name',): { + 'min_length': 1, + }, + ('carrier_id',): { + 'min_length': 1, + }, + ('confirmation_number',): { + 'min_length': 1, + }, + ('id',): { + 'min_length': 1, + }, + ('pickup_date',): { + 'min_length': 1, + }, + ('ready_time',): { + 'min_length': 1, + }, + ('closing_time',): { + 'min_length': 1, + }, + } + + @cached_property + def additional_properties_type(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + """ + lazy_import() + return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + + _nullable = False + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + lazy_import() + return { + 'carrier_name': (str,), # noqa: E501 + 'carrier_id': (str,), # noqa: E501 + 'confirmation_number': (str,), # noqa: E501 + 'address': (Address,), # noqa: E501 + 'parcels': ([Parcel], none_type,), # noqa: E501 + 'test_mode': (bool,), # noqa: E501 + 'id': (str,), # noqa: E501 + 'pickup_date': (str, none_type,), # noqa: E501 + 'pickup_charge': (Charge,), # noqa: E501 + 'ready_time': (str, none_type,), # noqa: E501 + 'closing_time': (str, none_type,), # noqa: E501 + 'instruction': (str, none_type,), # noqa: E501 + 'package_location': (str, none_type,), # noqa: E501 + 'options': ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'carrier_name': 'carrier_name', # noqa: E501 + 'carrier_id': 'carrier_id', # noqa: E501 + 'confirmation_number': 'confirmation_number', # noqa: E501 + 'address': 'address', # noqa: E501 + 'parcels': 'parcels', # noqa: E501 + 'test_mode': 'test_mode', # noqa: E501 + 'id': 'id', # noqa: E501 + 'pickup_date': 'pickup_date', # noqa: E501 + 'pickup_charge': 'pickup_charge', # noqa: E501 + 'ready_time': 'ready_time', # noqa: E501 + 'closing_time': 'closing_time', # noqa: E501 + 'instruction': 'instruction', # noqa: E501 + 'package_location': 'package_location', # noqa: E501 + 'options': 'options', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, carrier_name, carrier_id, confirmation_number, address, parcels, test_mode, *args, **kwargs): # noqa: E501 + """Pickup - a model defined in OpenAPI + + Args: + carrier_name (str): The pickup carrier + carrier_id (str): The pickup carrier configured name + confirmation_number (str): The pickup confirmation identifier + address (Address): + parcels ([Parcel], none_type): The shipment parcels to pickup. + test_mode (bool): Specified whether it was created with a carrier in test mode + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + id (str): A unique pickup identifier. [optional] # noqa: E501 + pickup_date (str, none_type): The pickup date. [optional] # noqa: E501 + pickup_charge (Charge): [optional] # noqa: E501 + ready_time (str, none_type): The pickup expected ready time. [optional] # noqa: E501 + closing_time (str, none_type): The pickup expected closing or late time. [optional] # noqa: E501 + instruction (str, none_type): The pickup instruction. eg: Handle with care. . [optional] # noqa: E501 + package_location (str, none_type): The package(s) location. eg: Behind the entrance door. . [optional] # noqa: E501 + options ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type): Advanced carrier specific pickup options. [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.carrier_name = carrier_name + self.carrier_id = carrier_id + self.confirmation_number = confirmation_number + self.address = address + self.parcels = parcels + self.test_mode = test_mode + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + required_properties = set([ + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) + + @convert_js_args_to_python_args + def __init__(self, carrier_name, carrier_id, confirmation_number, address, parcels, test_mode, *args, **kwargs): # noqa: E501 + """Pickup - a model defined in OpenAPI + + Args: + carrier_name (str): The pickup carrier + carrier_id (str): The pickup carrier configured name + confirmation_number (str): The pickup confirmation identifier + address (Address): + parcels ([Parcel], none_type): The shipment parcels to pickup. + test_mode (bool): Specified whether it was created with a carrier in test mode + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + id (str): A unique pickup identifier. [optional] # noqa: E501 + pickup_date (str, none_type): The pickup date. [optional] # noqa: E501 + pickup_charge (Charge): [optional] # noqa: E501 + ready_time (str, none_type): The pickup expected ready time. [optional] # noqa: E501 + closing_time (str, none_type): The pickup expected closing or late time. [optional] # noqa: E501 + instruction (str, none_type): The pickup instruction. eg: Handle with care. . [optional] # noqa: E501 + package_location (str, none_type): The package(s) location. eg: Behind the entrance door. . [optional] # noqa: E501 + options ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type): Advanced carrier specific pickup options. [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.carrier_name = carrier_name + self.carrier_id = carrier_id + self.confirmation_number = confirmation_number + self.address = address + self.parcels = parcels + self.test_mode = test_mode + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + f"class with read only attributes.") diff --git a/purplship/model/pickup_cancel_data.py b/purplship/model/pickup_cancel_data.py new file mode 100644 index 0000000..fabfa89 --- /dev/null +++ b/purplship/model/pickup_cancel_data.py @@ -0,0 +1,259 @@ +""" + Purplship API + + ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.7`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 + + The version of the OpenAPI document: 2021.7 + Contact: hello@purplship.com + Generated by: https://openapi-generator.tech +""" + + +import re # noqa: F401 +import sys # noqa: F401 + +from purplship.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) +from ..model_utils import OpenApiModel +from purplship.exceptions import ApiAttributeError + + + +class PickupCancelData(ModelNormal): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + } + + validations = { + ('reason',): { + 'min_length': 1, + }, + } + + @cached_property + def additional_properties_type(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + """ + return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + + _nullable = False + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'reason': (str,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'reason': 'reason', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 + """PickupCancelData - a model defined in OpenAPI + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + reason (str): The reason of the pickup cancellation. [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + required_properties = set([ + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) + + @convert_js_args_to_python_args + def __init__(self, *args, **kwargs): # noqa: E501 + """PickupCancelData - a model defined in OpenAPI + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + reason (str): The reason of the pickup cancellation. [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + f"class with read only attributes.") diff --git a/purplship/model/pickup_cancel_request.py b/purplship/model/pickup_cancel_request.py new file mode 100644 index 0000000..1a447d3 --- /dev/null +++ b/purplship/model/pickup_cancel_request.py @@ -0,0 +1,289 @@ +""" + Purplship API + + ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.7`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 + + The version of the OpenAPI document: 2021.7 + Contact: hello@purplship.com + Generated by: https://openapi-generator.tech +""" + + +import re # noqa: F401 +import sys # noqa: F401 + +from purplship.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) +from ..model_utils import OpenApiModel +from purplship.exceptions import ApiAttributeError + + +def lazy_import(): + from purplship.model.address_data import AddressData + globals()['AddressData'] = AddressData + + +class PickupCancelRequest(ModelNormal): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + } + + validations = { + ('confirmation_number',): { + 'min_length': 1, + }, + ('pickup_date',): { + 'min_length': 1, + }, + ('reason',): { + 'min_length': 1, + }, + } + + @cached_property + def additional_properties_type(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + """ + lazy_import() + return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + + _nullable = False + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + lazy_import() + return { + 'confirmation_number': (str,), # noqa: E501 + 'address': (AddressData,), # noqa: E501 + 'pickup_date': (str, none_type,), # noqa: E501 + 'reason': (str,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'confirmation_number': 'confirmation_number', # noqa: E501 + 'address': 'address', # noqa: E501 + 'pickup_date': 'pickup_date', # noqa: E501 + 'reason': 'reason', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, confirmation_number, *args, **kwargs): # noqa: E501 + """PickupCancelRequest - a model defined in OpenAPI + + Args: + confirmation_number (str): The pickup confirmation identifier + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + address (AddressData): [optional] # noqa: E501 + pickup_date (str, none_type): The pickup date Date Format: `YYYY-MM-DD` . [optional] # noqa: E501 + reason (str): The reason of the pickup cancellation. [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.confirmation_number = confirmation_number + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + required_properties = set([ + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) + + @convert_js_args_to_python_args + def __init__(self, confirmation_number, *args, **kwargs): # noqa: E501 + """PickupCancelRequest - a model defined in OpenAPI + + Args: + confirmation_number (str): The pickup confirmation identifier + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + address (AddressData): [optional] # noqa: E501 + pickup_date (str, none_type): The pickup date Date Format: `YYYY-MM-DD` . [optional] # noqa: E501 + reason (str): The reason of the pickup cancellation. [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.confirmation_number = confirmation_number + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + f"class with read only attributes.") diff --git a/purplship/model/pickup_data.py b/purplship/model/pickup_data.py new file mode 100644 index 0000000..961104a --- /dev/null +++ b/purplship/model/pickup_data.py @@ -0,0 +1,311 @@ +""" + Purplship API + + ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.7`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 + + The version of the OpenAPI document: 2021.7 + Contact: hello@purplship.com + Generated by: https://openapi-generator.tech +""" + + +import re # noqa: F401 +import sys # noqa: F401 + +from purplship.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) +from ..model_utils import OpenApiModel +from purplship.exceptions import ApiAttributeError + + +def lazy_import(): + from purplship.model.address_data import AddressData + globals()['AddressData'] = AddressData + + +class PickupData(ModelNormal): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + } + + validations = { + ('pickup_date',): { + 'min_length': 1, + }, + ('ready_time',): { + 'min_length': 1, + }, + ('closing_time',): { + 'min_length': 1, + }, + } + + @cached_property + def additional_properties_type(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + """ + lazy_import() + return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + + _nullable = False + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + lazy_import() + return { + 'pickup_date': (str,), # noqa: E501 + 'ready_time': (str,), # noqa: E501 + 'closing_time': (str,), # noqa: E501 + 'tracking_numbers': ([str],), # noqa: E501 + 'address': (AddressData,), # noqa: E501 + 'instruction': (str, none_type,), # noqa: E501 + 'package_location': (str, none_type,), # noqa: E501 + 'options': ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'pickup_date': 'pickup_date', # noqa: E501 + 'ready_time': 'ready_time', # noqa: E501 + 'closing_time': 'closing_time', # noqa: E501 + 'tracking_numbers': 'tracking_numbers', # noqa: E501 + 'address': 'address', # noqa: E501 + 'instruction': 'instruction', # noqa: E501 + 'package_location': 'package_location', # noqa: E501 + 'options': 'options', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, pickup_date, ready_time, closing_time, tracking_numbers, *args, **kwargs): # noqa: E501 + """PickupData - a model defined in OpenAPI + + Args: + pickup_date (str): The expected pickup date Date Format: `YYYY-MM-DD` + ready_time (str): The ready time for pickup. Time Format: `HH:MM` + closing_time (str): The closing or late time of the pickup Time Format: `HH:MM` + tracking_numbers ([str]): The list of shipments to be picked up + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + address (AddressData): [optional] # noqa: E501 + instruction (str, none_type): The pickup instruction. eg: Handle with care. . [optional] # noqa: E501 + package_location (str, none_type): The package(s) location. eg: Behind the entrance door. . [optional] # noqa: E501 + options ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type): Advanced carrier specific pickup options. [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.pickup_date = pickup_date + self.ready_time = ready_time + self.closing_time = closing_time + self.tracking_numbers = tracking_numbers + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + required_properties = set([ + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) + + @convert_js_args_to_python_args + def __init__(self, pickup_date, ready_time, closing_time, tracking_numbers, *args, **kwargs): # noqa: E501 + """PickupData - a model defined in OpenAPI + + Args: + pickup_date (str): The expected pickup date Date Format: `YYYY-MM-DD` + ready_time (str): The ready time for pickup. Time Format: `HH:MM` + closing_time (str): The closing or late time of the pickup Time Format: `HH:MM` + tracking_numbers ([str]): The list of shipments to be picked up + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + address (AddressData): [optional] # noqa: E501 + instruction (str, none_type): The pickup instruction. eg: Handle with care. . [optional] # noqa: E501 + package_location (str, none_type): The package(s) location. eg: Behind the entrance door. . [optional] # noqa: E501 + options ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type): Advanced carrier specific pickup options. [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.pickup_date = pickup_date + self.ready_time = ready_time + self.closing_time = closing_time + self.tracking_numbers = tracking_numbers + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + f"class with read only attributes.") diff --git a/purplship/model/pickup_list.py b/purplship/model/pickup_list.py new file mode 100644 index 0000000..0de5c32 --- /dev/null +++ b/purplship/model/pickup_list.py @@ -0,0 +1,282 @@ +""" + Purplship API + + ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.7`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 + + The version of the OpenAPI document: 2021.7 + Contact: hello@purplship.com + Generated by: https://openapi-generator.tech +""" + + +import re # noqa: F401 +import sys # noqa: F401 + +from purplship.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) +from ..model_utils import OpenApiModel +from purplship.exceptions import ApiAttributeError + + +def lazy_import(): + from purplship.model.pickup import Pickup + globals()['Pickup'] = Pickup + + +class PickupList(ModelNormal): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + } + + validations = { + ('next',): { + 'min_length': 1, + }, + ('previous',): { + 'min_length': 1, + }, + } + + @cached_property + def additional_properties_type(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + """ + lazy_import() + return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + + _nullable = False + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + lazy_import() + return { + 'results': ([Pickup],), # noqa: E501 + 'next': (str,), # noqa: E501 + 'previous': (str,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'results': 'results', # noqa: E501 + 'next': 'next', # noqa: E501 + 'previous': 'previous', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, results, *args, **kwargs): # noqa: E501 + """PickupList - a model defined in OpenAPI + + Args: + results ([Pickup]): + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + next (str): [optional] # noqa: E501 + previous (str): [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.results = results + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + required_properties = set([ + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) + + @convert_js_args_to_python_args + def __init__(self, results, *args, **kwargs): # noqa: E501 + """PickupList - a model defined in OpenAPI + + Args: + results ([Pickup]): + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + next (str): [optional] # noqa: E501 + previous (str): [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.results = results + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + f"class with read only attributes.") diff --git a/purplship/model/pickup_request.py b/purplship/model/pickup_request.py new file mode 100644 index 0000000..a4614b0 --- /dev/null +++ b/purplship/model/pickup_request.py @@ -0,0 +1,315 @@ +""" + Purplship API + + ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.7`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 + + The version of the OpenAPI document: 2021.7 + Contact: hello@purplship.com + Generated by: https://openapi-generator.tech +""" + + +import re # noqa: F401 +import sys # noqa: F401 + +from purplship.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) +from ..model_utils import OpenApiModel +from purplship.exceptions import ApiAttributeError + + +def lazy_import(): + from purplship.model.address_data import AddressData + from purplship.model.parcel_data import ParcelData + globals()['AddressData'] = AddressData + globals()['ParcelData'] = ParcelData + + +class PickupRequest(ModelNormal): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + } + + validations = { + ('pickup_date',): { + 'min_length': 1, + }, + ('ready_time',): { + 'min_length': 1, + }, + ('closing_time',): { + 'min_length': 1, + }, + } + + @cached_property + def additional_properties_type(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + """ + lazy_import() + return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + + _nullable = False + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + lazy_import() + return { + 'pickup_date': (str,), # noqa: E501 + 'address': (AddressData,), # noqa: E501 + 'parcels': ([ParcelData], none_type,), # noqa: E501 + 'ready_time': (str,), # noqa: E501 + 'closing_time': (str,), # noqa: E501 + 'instruction': (str, none_type,), # noqa: E501 + 'package_location': (str, none_type,), # noqa: E501 + 'options': ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'pickup_date': 'pickup_date', # noqa: E501 + 'address': 'address', # noqa: E501 + 'parcels': 'parcels', # noqa: E501 + 'ready_time': 'ready_time', # noqa: E501 + 'closing_time': 'closing_time', # noqa: E501 + 'instruction': 'instruction', # noqa: E501 + 'package_location': 'package_location', # noqa: E501 + 'options': 'options', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, pickup_date, address, parcels, ready_time, closing_time, *args, **kwargs): # noqa: E501 + """PickupRequest - a model defined in OpenAPI + + Args: + pickup_date (str): The expected pickup date Date Format: `YYYY-MM-DD` + address (AddressData): + parcels ([ParcelData], none_type): The shipment parcels to pickup. + ready_time (str): The ready time for pickup. Time Format: `HH:MM` + closing_time (str): The closing or late time of the pickup Time Format: `HH:MM` + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + instruction (str, none_type): The pickup instruction. eg: Handle with care. . [optional] # noqa: E501 + package_location (str, none_type): The package(s) location. eg: Behind the entrance door. . [optional] # noqa: E501 + options ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type): Advanced carrier specific pickup options. [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.pickup_date = pickup_date + self.address = address + self.parcels = parcels + self.ready_time = ready_time + self.closing_time = closing_time + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + required_properties = set([ + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) + + @convert_js_args_to_python_args + def __init__(self, pickup_date, address, parcels, ready_time, closing_time, *args, **kwargs): # noqa: E501 + """PickupRequest - a model defined in OpenAPI + + Args: + pickup_date (str): The expected pickup date Date Format: `YYYY-MM-DD` + address (AddressData): + parcels ([ParcelData], none_type): The shipment parcels to pickup. + ready_time (str): The ready time for pickup. Time Format: `HH:MM` + closing_time (str): The closing or late time of the pickup Time Format: `HH:MM` + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + instruction (str, none_type): The pickup instruction. eg: Handle with care. . [optional] # noqa: E501 + package_location (str, none_type): The package(s) location. eg: Behind the entrance door. . [optional] # noqa: E501 + options ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type): Advanced carrier specific pickup options. [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.pickup_date = pickup_date + self.address = address + self.parcels = parcels + self.ready_time = ready_time + self.closing_time = closing_time + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + f"class with read only attributes.") diff --git a/purplship/model/pickup_response.py b/purplship/model/pickup_response.py new file mode 100644 index 0000000..d58be5d --- /dev/null +++ b/purplship/model/pickup_response.py @@ -0,0 +1,268 @@ +""" + Purplship API + + ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.7`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 + + The version of the OpenAPI document: 2021.7 + Contact: hello@purplship.com + Generated by: https://openapi-generator.tech +""" + + +import re # noqa: F401 +import sys # noqa: F401 + +from purplship.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) +from ..model_utils import OpenApiModel +from purplship.exceptions import ApiAttributeError + + +def lazy_import(): + from purplship.model.message import Message + from purplship.model.pickup import Pickup + globals()['Message'] = Message + globals()['Pickup'] = Pickup + + +class PickupResponse(ModelNormal): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + } + + validations = { + } + + @cached_property + def additional_properties_type(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + """ + lazy_import() + return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + + _nullable = False + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + lazy_import() + return { + 'messages': ([Message],), # noqa: E501 + 'pickup': (Pickup,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'messages': 'messages', # noqa: E501 + 'pickup': 'pickup', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 + """PickupResponse - a model defined in OpenAPI + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + messages ([Message]): The list of note or warning messages. [optional] # noqa: E501 + pickup (Pickup): [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + required_properties = set([ + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) + + @convert_js_args_to_python_args + def __init__(self, *args, **kwargs): # noqa: E501 + """PickupResponse - a model defined in OpenAPI + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + messages ([Message]): The list of note or warning messages. [optional] # noqa: E501 + pickup (Pickup): [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + f"class with read only attributes.") diff --git a/purplship/model/pickup_update_data.py b/purplship/model/pickup_update_data.py new file mode 100644 index 0000000..d98fc49 --- /dev/null +++ b/purplship/model/pickup_update_data.py @@ -0,0 +1,306 @@ +""" + Purplship API + + ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.7`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 + + The version of the OpenAPI document: 2021.7 + Contact: hello@purplship.com + Generated by: https://openapi-generator.tech +""" + + +import re # noqa: F401 +import sys # noqa: F401 + +from purplship.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) +from ..model_utils import OpenApiModel +from purplship.exceptions import ApiAttributeError + + +def lazy_import(): + from purplship.model.address_data import AddressData + globals()['AddressData'] = AddressData + + +class PickupUpdateData(ModelNormal): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + } + + validations = { + ('confirmation_number',): { + 'min_length': 1, + }, + ('pickup_date',): { + 'min_length': 1, + }, + } + + @cached_property + def additional_properties_type(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + """ + lazy_import() + return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + + _nullable = False + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + lazy_import() + return { + 'confirmation_number': (str,), # noqa: E501 + 'pickup_date': (str,), # noqa: E501 + 'address': (AddressData,), # noqa: E501 + 'ready_time': (str, none_type,), # noqa: E501 + 'closing_time': (str, none_type,), # noqa: E501 + 'instruction': (str, none_type,), # noqa: E501 + 'package_location': (str, none_type,), # noqa: E501 + 'options': ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type,), # noqa: E501 + 'tracking_numbers': ([str],), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'confirmation_number': 'confirmation_number', # noqa: E501 + 'pickup_date': 'pickup_date', # noqa: E501 + 'address': 'address', # noqa: E501 + 'ready_time': 'ready_time', # noqa: E501 + 'closing_time': 'closing_time', # noqa: E501 + 'instruction': 'instruction', # noqa: E501 + 'package_location': 'package_location', # noqa: E501 + 'options': 'options', # noqa: E501 + 'tracking_numbers': 'tracking_numbers', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, confirmation_number, *args, **kwargs): # noqa: E501 + """PickupUpdateData - a model defined in OpenAPI + + Args: + confirmation_number (str): pickup identification number + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + pickup_date (str): The expected pickup date Date Format: YYYY-MM-DD . [optional] # noqa: E501 + address (AddressData): [optional] # noqa: E501 + ready_time (str, none_type): The ready time for pickup.. [optional] # noqa: E501 + closing_time (str, none_type): The closing or late time of the pickup. [optional] # noqa: E501 + instruction (str, none_type): The pickup instruction. eg: Handle with care. . [optional] # noqa: E501 + package_location (str, none_type): The package(s) location. eg: Behind the entrance door. . [optional] # noqa: E501 + options ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type): Advanced carrier specific pickup options. [optional] # noqa: E501 + tracking_numbers ([str]): The list of shipments to be picked up. [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.confirmation_number = confirmation_number + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + required_properties = set([ + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) + + @convert_js_args_to_python_args + def __init__(self, confirmation_number, *args, **kwargs): # noqa: E501 + """PickupUpdateData - a model defined in OpenAPI + + Args: + confirmation_number (str): pickup identification number + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + pickup_date (str): The expected pickup date Date Format: YYYY-MM-DD . [optional] # noqa: E501 + address (AddressData): [optional] # noqa: E501 + ready_time (str, none_type): The ready time for pickup.. [optional] # noqa: E501 + closing_time (str, none_type): The closing or late time of the pickup. [optional] # noqa: E501 + instruction (str, none_type): The pickup instruction. eg: Handle with care. . [optional] # noqa: E501 + package_location (str, none_type): The package(s) location. eg: Behind the entrance door. . [optional] # noqa: E501 + options ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type): Advanced carrier specific pickup options. [optional] # noqa: E501 + tracking_numbers ([str]): The list of shipments to be picked up. [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.confirmation_number = confirmation_number + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + f"class with read only attributes.") diff --git a/purplship/model/pickup_update_request.py b/purplship/model/pickup_update_request.py new file mode 100644 index 0000000..f2b4d63 --- /dev/null +++ b/purplship/model/pickup_update_request.py @@ -0,0 +1,324 @@ +""" + Purplship API + + ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.7`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 + + The version of the OpenAPI document: 2021.7 + Contact: hello@purplship.com + Generated by: https://openapi-generator.tech +""" + + +import re # noqa: F401 +import sys # noqa: F401 + +from purplship.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) +from ..model_utils import OpenApiModel +from purplship.exceptions import ApiAttributeError + + +def lazy_import(): + from purplship.model.address import Address + from purplship.model.parcel import Parcel + globals()['Address'] = Address + globals()['Parcel'] = Parcel + + +class PickupUpdateRequest(ModelNormal): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + } + + validations = { + ('pickup_date',): { + 'min_length': 1, + }, + ('confirmation_number',): { + 'min_length': 1, + }, + ('ready_time',): { + 'min_length': 1, + }, + ('closing_time',): { + 'min_length': 1, + }, + } + + @cached_property + def additional_properties_type(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + """ + lazy_import() + return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + + _nullable = False + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + lazy_import() + return { + 'pickup_date': (str,), # noqa: E501 + 'address': (Address,), # noqa: E501 + 'parcels': ([Parcel], none_type,), # noqa: E501 + 'confirmation_number': (str,), # noqa: E501 + 'ready_time': (str,), # noqa: E501 + 'closing_time': (str,), # noqa: E501 + 'instruction': (str, none_type,), # noqa: E501 + 'package_location': (str, none_type,), # noqa: E501 + 'options': ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'pickup_date': 'pickup_date', # noqa: E501 + 'address': 'address', # noqa: E501 + 'parcels': 'parcels', # noqa: E501 + 'confirmation_number': 'confirmation_number', # noqa: E501 + 'ready_time': 'ready_time', # noqa: E501 + 'closing_time': 'closing_time', # noqa: E501 + 'instruction': 'instruction', # noqa: E501 + 'package_location': 'package_location', # noqa: E501 + 'options': 'options', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, pickup_date, address, parcels, confirmation_number, ready_time, closing_time, *args, **kwargs): # noqa: E501 + """PickupUpdateRequest - a model defined in OpenAPI + + Args: + pickup_date (str): The expected pickup date Date Format: `YYYY-MM-DD` + address (Address): + parcels ([Parcel], none_type): The shipment parcels to pickup. + confirmation_number (str): pickup identification number + ready_time (str): The ready time for pickup. Time Format: `HH:MM` + closing_time (str): The closing or late time of the pickup Time Format: `HH:MM` + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + instruction (str, none_type): The pickup instruction. eg: Handle with care. . [optional] # noqa: E501 + package_location (str, none_type): The package(s) location. eg: Behind the entrance door. . [optional] # noqa: E501 + options ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type): Advanced carrier specific pickup options. [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.pickup_date = pickup_date + self.address = address + self.parcels = parcels + self.confirmation_number = confirmation_number + self.ready_time = ready_time + self.closing_time = closing_time + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + required_properties = set([ + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) + + @convert_js_args_to_python_args + def __init__(self, pickup_date, address, parcels, confirmation_number, ready_time, closing_time, *args, **kwargs): # noqa: E501 + """PickupUpdateRequest - a model defined in OpenAPI + + Args: + pickup_date (str): The expected pickup date Date Format: `YYYY-MM-DD` + address (Address): + parcels ([Parcel], none_type): The shipment parcels to pickup. + confirmation_number (str): pickup identification number + ready_time (str): The ready time for pickup. Time Format: `HH:MM` + closing_time (str): The closing or late time of the pickup Time Format: `HH:MM` + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + instruction (str, none_type): The pickup instruction. eg: Handle with care. . [optional] # noqa: E501 + package_location (str, none_type): The package(s) location. eg: Behind the entrance door. . [optional] # noqa: E501 + options ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type): Advanced carrier specific pickup options. [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.pickup_date = pickup_date + self.address = address + self.parcels = parcels + self.confirmation_number = confirmation_number + self.ready_time = ready_time + self.closing_time = closing_time + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + f"class with read only attributes.") diff --git a/purplship/model/rate.py b/purplship/model/rate.py new file mode 100644 index 0000000..ca87834 --- /dev/null +++ b/purplship/model/rate.py @@ -0,0 +1,338 @@ +""" + Purplship API + + ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.7`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 + + The version of the OpenAPI document: 2021.7 + Contact: hello@purplship.com + Generated by: https://openapi-generator.tech +""" + + +import re # noqa: F401 +import sys # noqa: F401 + +from purplship.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) +from ..model_utils import OpenApiModel +from purplship.exceptions import ApiAttributeError + + +def lazy_import(): + from purplship.model.charge import Charge + globals()['Charge'] = Charge + + +class Rate(ModelNormal): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + } + + validations = { + ('carrier_name',): { + 'min_length': 1, + }, + ('carrier_id',): { + 'min_length': 1, + }, + ('currency',): { + 'min_length': 1, + }, + ('id',): { + 'min_length': 1, + }, + } + + @cached_property + def additional_properties_type(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + """ + lazy_import() + return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + + _nullable = False + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + lazy_import() + return { + 'carrier_name': (str,), # noqa: E501 + 'carrier_id': (str,), # noqa: E501 + 'currency': (str,), # noqa: E501 + 'test_mode': (bool,), # noqa: E501 + 'id': (str,), # noqa: E501 + 'service': (str, none_type,), # noqa: E501 + 'discount': (float, none_type,), # noqa: E501 + 'base_charge': (float,), # noqa: E501 + 'total_charge': (float,), # noqa: E501 + 'duties_and_taxes': (float, none_type,), # noqa: E501 + 'transit_days': (int, none_type,), # noqa: E501 + 'extra_charges': ([Charge],), # noqa: E501 + 'meta': ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type,), # noqa: E501 + 'carrier_ref': (str, none_type,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'carrier_name': 'carrier_name', # noqa: E501 + 'carrier_id': 'carrier_id', # noqa: E501 + 'currency': 'currency', # noqa: E501 + 'test_mode': 'test_mode', # noqa: E501 + 'id': 'id', # noqa: E501 + 'service': 'service', # noqa: E501 + 'discount': 'discount', # noqa: E501 + 'base_charge': 'base_charge', # noqa: E501 + 'total_charge': 'total_charge', # noqa: E501 + 'duties_and_taxes': 'duties_and_taxes', # noqa: E501 + 'transit_days': 'transit_days', # noqa: E501 + 'extra_charges': 'extra_charges', # noqa: E501 + 'meta': 'meta', # noqa: E501 + 'carrier_ref': 'carrier_ref', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, carrier_name, carrier_id, currency, test_mode, *args, **kwargs): # noqa: E501 + """Rate - a model defined in OpenAPI + + Args: + carrier_name (str): The rate's carrier + carrier_id (str): The targeted carrier's name (unique identifier) + currency (str): The rate monetary values currency code + test_mode (bool): Specified whether it was created with a carrier in test mode + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + id (str): A unique identifier. [optional] # noqa: E501 + service (str, none_type): The carrier's rate (quote) service. [optional] # noqa: E501 + discount (float, none_type): The monetary amount of the discount on the rate. [optional] # noqa: E501 + base_charge (float): The rate's monetary amount of the base charge.
This is the net amount of the rate before additional charges . [optional] # noqa: E501 + total_charge (float): The rate's monetary amount of the total charge.
This is the gross amount of the rate after adding the additional charges . [optional] # noqa: E501 + duties_and_taxes (float, none_type): The monetary amount of the duties and taxes if applied. [optional] # noqa: E501 + transit_days (int, none_type): The estimated delivery transit days. [optional] # noqa: E501 + extra_charges ([Charge]): list of the rate's additional charges. [optional] # noqa: E501 + meta ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type): provider specific metadata. [optional] # noqa: E501 + carrier_ref (str, none_type): The system carrier configuration id. [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.carrier_name = carrier_name + self.carrier_id = carrier_id + self.currency = currency + self.test_mode = test_mode + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + required_properties = set([ + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) + + @convert_js_args_to_python_args + def __init__(self, carrier_name, carrier_id, currency, test_mode, *args, **kwargs): # noqa: E501 + """Rate - a model defined in OpenAPI + + Args: + carrier_name (str): The rate's carrier + carrier_id (str): The targeted carrier's name (unique identifier) + currency (str): The rate monetary values currency code + test_mode (bool): Specified whether it was created with a carrier in test mode + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + id (str): A unique identifier. [optional] # noqa: E501 + service (str, none_type): The carrier's rate (quote) service. [optional] # noqa: E501 + discount (float, none_type): The monetary amount of the discount on the rate. [optional] # noqa: E501 + base_charge (float): The rate's monetary amount of the base charge.
This is the net amount of the rate before additional charges . [optional] # noqa: E501 + total_charge (float): The rate's monetary amount of the total charge.
This is the gross amount of the rate after adding the additional charges . [optional] # noqa: E501 + duties_and_taxes (float, none_type): The monetary amount of the duties and taxes if applied. [optional] # noqa: E501 + transit_days (int, none_type): The estimated delivery transit days. [optional] # noqa: E501 + extra_charges ([Charge]): list of the rate's additional charges. [optional] # noqa: E501 + meta ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type): provider specific metadata. [optional] # noqa: E501 + carrier_ref (str, none_type): The system carrier configuration id. [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.carrier_name = carrier_name + self.carrier_id = carrier_id + self.currency = currency + self.test_mode = test_mode + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + f"class with read only attributes.") diff --git a/purplship/model/rate_request.py b/purplship/model/rate_request.py new file mode 100644 index 0000000..98d75c9 --- /dev/null +++ b/purplship/model/rate_request.py @@ -0,0 +1,298 @@ +""" + Purplship API + + ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.7`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 + + The version of the OpenAPI document: 2021.7 + Contact: hello@purplship.com + Generated by: https://openapi-generator.tech +""" + + +import re # noqa: F401 +import sys # noqa: F401 + +from purplship.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) +from ..model_utils import OpenApiModel +from purplship.exceptions import ApiAttributeError + + +def lazy_import(): + from purplship.model.address_data import AddressData + from purplship.model.parcel_data import ParcelData + globals()['AddressData'] = AddressData + globals()['ParcelData'] = ParcelData + + +class RateRequest(ModelNormal): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + } + + validations = { + } + + @cached_property + def additional_properties_type(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + """ + lazy_import() + return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + + _nullable = False + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + lazy_import() + return { + 'shipper': (AddressData,), # noqa: E501 + 'recipient': (AddressData,), # noqa: E501 + 'parcels': ([ParcelData],), # noqa: E501 + 'services': ([str], none_type,), # noqa: E501 + 'options': ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type,), # noqa: E501 + 'reference': (str, none_type,), # noqa: E501 + 'carrier_ids': ([str], none_type,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'shipper': 'shipper', # noqa: E501 + 'recipient': 'recipient', # noqa: E501 + 'parcels': 'parcels', # noqa: E501 + 'services': 'services', # noqa: E501 + 'options': 'options', # noqa: E501 + 'reference': 'reference', # noqa: E501 + 'carrier_ids': 'carrier_ids', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, shipper, recipient, parcels, *args, **kwargs): # noqa: E501 + """RateRequest - a model defined in OpenAPI + + Args: + shipper (AddressData): + recipient (AddressData): + parcels ([ParcelData]): The shipment's parcels + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + services ([str], none_type): The requested carrier service for the shipment.
Please consult [the reference](#operation/references) for specific carriers services. Note that this is a list because on a Multi-carrier rate request you could specify a service per carrier. . [optional] # noqa: E501 + options ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type): The options available for the shipment. Please consult [the reference](#operation/references) for additional specific carriers options. . [optional] # noqa: E501 + reference (str, none_type): The shipment reference. [optional] # noqa: E501 + carrier_ids ([str], none_type): The list of configured carriers you wish to get rates from. . [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.shipper = shipper + self.recipient = recipient + self.parcels = parcels + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + required_properties = set([ + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) + + @convert_js_args_to_python_args + def __init__(self, shipper, recipient, parcels, *args, **kwargs): # noqa: E501 + """RateRequest - a model defined in OpenAPI + + Args: + shipper (AddressData): + recipient (AddressData): + parcels ([ParcelData]): The shipment's parcels + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + services ([str], none_type): The requested carrier service for the shipment.
Please consult [the reference](#operation/references) for specific carriers services. Note that this is a list because on a Multi-carrier rate request you could specify a service per carrier. . [optional] # noqa: E501 + options ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type): The options available for the shipment. Please consult [the reference](#operation/references) for additional specific carriers options. . [optional] # noqa: E501 + reference (str, none_type): The shipment reference. [optional] # noqa: E501 + carrier_ids ([str], none_type): The list of configured carriers you wish to get rates from. . [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.shipper = shipper + self.recipient = recipient + self.parcels = parcels + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + f"class with read only attributes.") diff --git a/purplship/model/rate_response.py b/purplship/model/rate_response.py new file mode 100644 index 0000000..40de93d --- /dev/null +++ b/purplship/model/rate_response.py @@ -0,0 +1,274 @@ +""" + Purplship API + + ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.7`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 + + The version of the OpenAPI document: 2021.7 + Contact: hello@purplship.com + Generated by: https://openapi-generator.tech +""" + + +import re # noqa: F401 +import sys # noqa: F401 + +from purplship.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) +from ..model_utils import OpenApiModel +from purplship.exceptions import ApiAttributeError + + +def lazy_import(): + from purplship.model.message import Message + from purplship.model.rate import Rate + globals()['Message'] = Message + globals()['Rate'] = Rate + + +class RateResponse(ModelNormal): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + } + + validations = { + } + + @cached_property + def additional_properties_type(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + """ + lazy_import() + return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + + _nullable = False + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + lazy_import() + return { + 'rates': ([Rate],), # noqa: E501 + 'messages': ([Message],), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'rates': 'rates', # noqa: E501 + 'messages': 'messages', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, rates, *args, **kwargs): # noqa: E501 + """RateResponse - a model defined in OpenAPI + + Args: + rates ([Rate]): The list of returned rates + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + messages ([Message]): The list of note or warning messages. [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.rates = rates + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + required_properties = set([ + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) + + @convert_js_args_to_python_args + def __init__(self, rates, *args, **kwargs): # noqa: E501 + """RateResponse - a model defined in OpenAPI + + Args: + rates ([Rate]): The list of returned rates + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + messages ([Message]): The list of note or warning messages. [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.rates = rates + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + f"class with read only attributes.") diff --git a/purplship/model/references.py b/purplship/model/references.py new file mode 100644 index 0000000..eed5da4 --- /dev/null +++ b/purplship/model/references.py @@ -0,0 +1,358 @@ +""" + Purplship API + + ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.7`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 + + The version of the OpenAPI document: 2021.7 + Contact: hello@purplship.com + Generated by: https://openapi-generator.tech +""" + + +import re # noqa: F401 +import sys # noqa: F401 + +from purplship.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) +from ..model_utils import OpenApiModel +from purplship.exceptions import ApiAttributeError + + + +class References(ModelNormal): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + } + + validations = { + ('app_name',): { + 'min_length': 1, + }, + ('app_version',): { + 'min_length': 1, + }, + } + + @cached_property + def additional_properties_type(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + """ + return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + + _nullable = False + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'app_name': (str,), # noqa: E501 + 'app_version': (str,), # noqa: E501 + 'countries': ({str: (bool, date, datetime, dict, float, int, list, str, none_type)},), # noqa: E501 + 'currencies': ({str: (bool, date, datetime, dict, float, int, list, str, none_type)},), # noqa: E501 + 'carriers': ({str: (bool, date, datetime, dict, float, int, list, str, none_type)},), # noqa: E501 + 'customs_content_type': ({str: (bool, date, datetime, dict, float, int, list, str, none_type)},), # noqa: E501 + 'incoterms': ({str: (bool, date, datetime, dict, float, int, list, str, none_type)},), # noqa: E501 + 'states': ({str: (bool, date, datetime, dict, float, int, list, str, none_type)},), # noqa: E501 + 'services': ({str: (bool, date, datetime, dict, float, int, list, str, none_type)},), # noqa: E501 + 'service_names': ({str: (bool, date, datetime, dict, float, int, list, str, none_type)},), # noqa: E501 + 'options': ({str: (bool, date, datetime, dict, float, int, list, str, none_type)},), # noqa: E501 + 'option_names': ({str: (bool, date, datetime, dict, float, int, list, str, none_type)},), # noqa: E501 + 'package_presets': ({str: (bool, date, datetime, dict, float, int, list, str, none_type)},), # noqa: E501 + 'packaging_types': ({str: (bool, date, datetime, dict, float, int, list, str, none_type)},), # noqa: E501 + 'payment_types': ({str: (bool, date, datetime, dict, float, int, list, str, none_type)},), # noqa: E501 + 'carrier_capabilities': ({str: (bool, date, datetime, dict, float, int, list, str, none_type)},), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'app_name': 'APP_NAME', # noqa: E501 + 'app_version': 'APP_VERSION', # noqa: E501 + 'countries': 'countries', # noqa: E501 + 'currencies': 'currencies', # noqa: E501 + 'carriers': 'carriers', # noqa: E501 + 'customs_content_type': 'customs_content_type', # noqa: E501 + 'incoterms': 'incoterms', # noqa: E501 + 'states': 'states', # noqa: E501 + 'services': 'services', # noqa: E501 + 'service_names': 'service_names', # noqa: E501 + 'options': 'options', # noqa: E501 + 'option_names': 'option_names', # noqa: E501 + 'package_presets': 'package_presets', # noqa: E501 + 'packaging_types': 'packaging_types', # noqa: E501 + 'payment_types': 'payment_types', # noqa: E501 + 'carrier_capabilities': 'carrier_capabilities', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, app_name, app_version, countries, currencies, carriers, customs_content_type, incoterms, states, services, service_names, options, option_names, package_presets, packaging_types, payment_types, carrier_capabilities, *args, **kwargs): # noqa: E501 + """References - a model defined in OpenAPI + + Args: + app_name (str): + app_version (str): + countries ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}): + currencies ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}): + carriers ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}): + customs_content_type ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}): + incoterms ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}): + states ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}): + services ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}): + service_names ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}): + options ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}): + option_names ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}): + package_presets ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}): + packaging_types ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}): + payment_types ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}): + carrier_capabilities ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}): + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.app_name = app_name + self.app_version = app_version + self.countries = countries + self.currencies = currencies + self.carriers = carriers + self.customs_content_type = customs_content_type + self.incoterms = incoterms + self.states = states + self.services = services + self.service_names = service_names + self.options = options + self.option_names = option_names + self.package_presets = package_presets + self.packaging_types = packaging_types + self.payment_types = payment_types + self.carrier_capabilities = carrier_capabilities + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + required_properties = set([ + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) + + @convert_js_args_to_python_args + def __init__(self, app_name, app_version, countries, currencies, carriers, customs_content_type, incoterms, states, services, service_names, options, option_names, package_presets, packaging_types, payment_types, carrier_capabilities, *args, **kwargs): # noqa: E501 + """References - a model defined in OpenAPI + + Args: + app_name (str): + app_version (str): + countries ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}): + currencies ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}): + carriers ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}): + customs_content_type ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}): + incoterms ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}): + states ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}): + services ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}): + service_names ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}): + options ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}): + option_names ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}): + package_presets ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}): + packaging_types ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}): + payment_types ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}): + carrier_capabilities ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}): + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.app_name = app_name + self.app_version = app_version + self.countries = countries + self.currencies = currencies + self.carriers = carriers + self.customs_content_type = customs_content_type + self.incoterms = incoterms + self.states = states + self.services = services + self.service_names = service_names + self.options = options + self.option_names = option_names + self.package_presets = package_presets + self.packaging_types = packaging_types + self.payment_types = payment_types + self.carrier_capabilities = carrier_capabilities + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + f"class with read only attributes.") diff --git a/purplship/model/shipment.py b/purplship/model/shipment.py new file mode 100644 index 0000000..e04b789 --- /dev/null +++ b/purplship/model/shipment.py @@ -0,0 +1,409 @@ +""" + Purplship API + + ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.7`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 + + The version of the OpenAPI document: 2021.7 + Contact: hello@purplship.com + Generated by: https://openapi-generator.tech +""" + + +import re # noqa: F401 +import sys # noqa: F401 + +from purplship.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) +from ..model_utils import OpenApiModel +from purplship.exceptions import ApiAttributeError + + +def lazy_import(): + from purplship.model.address import Address + from purplship.model.customs import Customs + from purplship.model.message import Message + from purplship.model.parcel import Parcel + from purplship.model.payment import Payment + from purplship.model.rate import Rate + globals()['Address'] = Address + globals()['Customs'] = Customs + globals()['Message'] = Message + globals()['Parcel'] = Parcel + globals()['Payment'] = Payment + globals()['Rate'] = Rate + + +class Shipment(ModelNormal): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + ('status',): { + 'CREATED': "created", + 'PURCHASED': "purchased", + 'CANCELLED': "cancelled", + 'SHIPPED': "shipped", + 'IN-TRANSIT': "in-transit", + 'DELIVERED': "delivered", + }, + ('label_type',): { + 'None': None, + 'PDF': "PDF", + 'ZPL': "ZPL", + }, + } + + validations = { + ('created_at',): { + 'min_length': 1, + }, + ('id',): { + 'min_length': 1, + }, + } + + @cached_property + def additional_properties_type(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + """ + lazy_import() + return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + + _nullable = False + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + lazy_import() + return { + 'shipper': (Address,), # noqa: E501 + 'recipient': (Address,), # noqa: E501 + 'parcels': ([Parcel],), # noqa: E501 + 'created_at': (str,), # noqa: E501 + 'test_mode': (bool,), # noqa: E501 + 'id': (str,), # noqa: E501 + 'status': (str,), # noqa: E501 + 'carrier_name': (str, none_type,), # noqa: E501 + 'carrier_id': (str, none_type,), # noqa: E501 + 'label': (str, none_type,), # noqa: E501 + 'tracking_number': (str, none_type,), # noqa: E501 + 'shipment_identifier': (str, none_type,), # noqa: E501 + 'selected_rate': (Rate,), # noqa: E501 + 'selected_rate_id': (str, none_type,), # noqa: E501 + 'rates': ([Rate],), # noqa: E501 + 'tracking_url': (str, none_type,), # noqa: E501 + 'service': (str, none_type,), # noqa: E501 + 'services': ([str], none_type,), # noqa: E501 + 'options': ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type,), # noqa: E501 + 'payment': (Payment,), # noqa: E501 + 'customs': (Customs,), # noqa: E501 + 'reference': (str, none_type,), # noqa: E501 + 'label_type': (str, none_type,), # noqa: E501 + 'carrier_ids': ([str], none_type,), # noqa: E501 + 'tracker_id': (str, none_type,), # noqa: E501 + 'meta': ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type,), # noqa: E501 + 'messages': ([Message],), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'shipper': 'shipper', # noqa: E501 + 'recipient': 'recipient', # noqa: E501 + 'parcels': 'parcels', # noqa: E501 + 'created_at': 'created_at', # noqa: E501 + 'test_mode': 'test_mode', # noqa: E501 + 'id': 'id', # noqa: E501 + 'status': 'status', # noqa: E501 + 'carrier_name': 'carrier_name', # noqa: E501 + 'carrier_id': 'carrier_id', # noqa: E501 + 'label': 'label', # noqa: E501 + 'tracking_number': 'tracking_number', # noqa: E501 + 'shipment_identifier': 'shipment_identifier', # noqa: E501 + 'selected_rate': 'selected_rate', # noqa: E501 + 'selected_rate_id': 'selected_rate_id', # noqa: E501 + 'rates': 'rates', # noqa: E501 + 'tracking_url': 'tracking_url', # noqa: E501 + 'service': 'service', # noqa: E501 + 'services': 'services', # noqa: E501 + 'options': 'options', # noqa: E501 + 'payment': 'payment', # noqa: E501 + 'customs': 'customs', # noqa: E501 + 'reference': 'reference', # noqa: E501 + 'label_type': 'label_type', # noqa: E501 + 'carrier_ids': 'carrier_ids', # noqa: E501 + 'tracker_id': 'tracker_id', # noqa: E501 + 'meta': 'meta', # noqa: E501 + 'messages': 'messages', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, shipper, recipient, parcels, created_at, test_mode, *args, **kwargs): # noqa: E501 + """Shipment - a model defined in OpenAPI + + Args: + shipper (Address): + recipient (Address): + parcels ([Parcel]): The shipment's parcels + created_at (str): The shipment creation datetime Date Format: `YYYY-MM-DD HH:MM:SS.mmmmmmz` + test_mode (bool): Specified whether it was created with a carrier in test mode + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + id (str): A unique identifier. [optional] # noqa: E501 + status (str): The current Shipment status. [optional] if omitted the server will use the default value of "created" # noqa: E501 + carrier_name (str, none_type): The shipment carrier. [optional] # noqa: E501 + carrier_id (str, none_type): The shipment carrier configured identifier. [optional] # noqa: E501 + label (str, none_type): The shipment label in base64 string. [optional] # noqa: E501 + tracking_number (str, none_type): The shipment tracking number. [optional] # noqa: E501 + shipment_identifier (str, none_type): The shipment carrier system identifier. [optional] # noqa: E501 + selected_rate (Rate): [optional] # noqa: E501 + selected_rate_id (str, none_type): The shipment selected rate.. [optional] # noqa: E501 + rates ([Rate]): The list for shipment rates fetched previously. [optional] # noqa: E501 + tracking_url (str, none_type): The shipment tracking url. [optional] # noqa: E501 + service (str, none_type): The selected service. [optional] # noqa: E501 + services ([str], none_type): The carriers services requested for the shipment. Please consult [the reference](#operation/references) for specific carriers services.
Note that this is a list because on a Multi-carrier rate request you could specify a service per carrier. . [optional] # noqa: E501 + options ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type): The options available for the shipment.
Please consult [the reference](#operation/references) for additional specific carriers options. . [optional] # noqa: E501 + payment (Payment): [optional] # noqa: E501 + customs (Customs): [optional] # noqa: E501 + reference (str, none_type): The shipment reference. [optional] # noqa: E501 + label_type (str, none_type): The shipment label file type.. [optional] # noqa: E501 + carrier_ids ([str], none_type): The list of configured carriers you wish to get rates from. *Note that the request will be sent to all carriers in nothing is specified* . [optional] # noqa: E501 + tracker_id (str, none_type): The attached tracker id. [optional] # noqa: E501 + meta ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type): provider specific metadata. [optional] # noqa: E501 + messages ([Message]): The list of note or warning messages. [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.shipper = shipper + self.recipient = recipient + self.parcels = parcels + self.created_at = created_at + self.test_mode = test_mode + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + required_properties = set([ + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) + + @convert_js_args_to_python_args + def __init__(self, shipper, recipient, parcels, created_at, test_mode, *args, **kwargs): # noqa: E501 + """Shipment - a model defined in OpenAPI + + Args: + shipper (Address): + recipient (Address): + parcels ([Parcel]): The shipment's parcels + created_at (str): The shipment creation datetime Date Format: `YYYY-MM-DD HH:MM:SS.mmmmmmz` + test_mode (bool): Specified whether it was created with a carrier in test mode + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + id (str): A unique identifier. [optional] # noqa: E501 + status (str): The current Shipment status. [optional] if omitted the server will use the default value of "created" # noqa: E501 + carrier_name (str, none_type): The shipment carrier. [optional] # noqa: E501 + carrier_id (str, none_type): The shipment carrier configured identifier. [optional] # noqa: E501 + label (str, none_type): The shipment label in base64 string. [optional] # noqa: E501 + tracking_number (str, none_type): The shipment tracking number. [optional] # noqa: E501 + shipment_identifier (str, none_type): The shipment carrier system identifier. [optional] # noqa: E501 + selected_rate (Rate): [optional] # noqa: E501 + selected_rate_id (str, none_type): The shipment selected rate.. [optional] # noqa: E501 + rates ([Rate]): The list for shipment rates fetched previously. [optional] # noqa: E501 + tracking_url (str, none_type): The shipment tracking url. [optional] # noqa: E501 + service (str, none_type): The selected service. [optional] # noqa: E501 + services ([str], none_type): The carriers services requested for the shipment. Please consult [the reference](#operation/references) for specific carriers services.
Note that this is a list because on a Multi-carrier rate request you could specify a service per carrier. . [optional] # noqa: E501 + options ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type): The options available for the shipment.
Please consult [the reference](#operation/references) for additional specific carriers options. . [optional] # noqa: E501 + payment (Payment): [optional] # noqa: E501 + customs (Customs): [optional] # noqa: E501 + reference (str, none_type): The shipment reference. [optional] # noqa: E501 + label_type (str, none_type): The shipment label file type.. [optional] # noqa: E501 + carrier_ids ([str], none_type): The list of configured carriers you wish to get rates from. *Note that the request will be sent to all carriers in nothing is specified* . [optional] # noqa: E501 + tracker_id (str, none_type): The attached tracker id. [optional] # noqa: E501 + meta ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type): provider specific metadata. [optional] # noqa: E501 + messages ([Message]): The list of note or warning messages. [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.shipper = shipper + self.recipient = recipient + self.parcels = parcels + self.created_at = created_at + self.test_mode = test_mode + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + f"class with read only attributes.") diff --git a/purplship/model/shipment_cancel_request.py b/purplship/model/shipment_cancel_request.py new file mode 100644 index 0000000..df1afff --- /dev/null +++ b/purplship/model/shipment_cancel_request.py @@ -0,0 +1,273 @@ +""" + Purplship API + + ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.7`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 + + The version of the OpenAPI document: 2021.7 + Contact: hello@purplship.com + Generated by: https://openapi-generator.tech +""" + + +import re # noqa: F401 +import sys # noqa: F401 + +from purplship.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) +from ..model_utils import OpenApiModel +from purplship.exceptions import ApiAttributeError + + + +class ShipmentCancelRequest(ModelNormal): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + } + + validations = { + ('shipment_identifier',): { + 'min_length': 1, + }, + } + + @cached_property + def additional_properties_type(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + """ + return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + + _nullable = False + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'shipment_identifier': (str,), # noqa: E501 + 'service': (str, none_type,), # noqa: E501 + 'options': ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'shipment_identifier': 'shipment_identifier', # noqa: E501 + 'service': 'service', # noqa: E501 + 'options': 'options', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, shipment_identifier, *args, **kwargs): # noqa: E501 + """ShipmentCancelRequest - a model defined in OpenAPI + + Args: + shipment_identifier (str): The shipment identifier returned during creation + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + service (str, none_type): The selected shipment service. [optional] # noqa: E501 + options ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type): Advanced carrier specific cancellation options. [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.shipment_identifier = shipment_identifier + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + required_properties = set([ + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) + + @convert_js_args_to_python_args + def __init__(self, shipment_identifier, *args, **kwargs): # noqa: E501 + """ShipmentCancelRequest - a model defined in OpenAPI + + Args: + shipment_identifier (str): The shipment identifier returned during creation + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + service (str, none_type): The selected shipment service. [optional] # noqa: E501 + options ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type): Advanced carrier specific cancellation options. [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.shipment_identifier = shipment_identifier + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + f"class with read only attributes.") diff --git a/purplship/model/shipment_data.py b/purplship/model/shipment_data.py new file mode 100644 index 0000000..11ade6e --- /dev/null +++ b/purplship/model/shipment_data.py @@ -0,0 +1,318 @@ +""" + Purplship API + + ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.7`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 + + The version of the OpenAPI document: 2021.7 + Contact: hello@purplship.com + Generated by: https://openapi-generator.tech +""" + + +import re # noqa: F401 +import sys # noqa: F401 + +from purplship.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) +from ..model_utils import OpenApiModel +from purplship.exceptions import ApiAttributeError + + +def lazy_import(): + from purplship.model.address_data import AddressData + from purplship.model.customs_data import CustomsData + from purplship.model.parcel_data import ParcelData + from purplship.model.payment import Payment + globals()['AddressData'] = AddressData + globals()['CustomsData'] = CustomsData + globals()['ParcelData'] = ParcelData + globals()['Payment'] = Payment + + +class ShipmentData(ModelNormal): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + ('label_type',): { + 'PDF': "PDF", + 'ZPL': "ZPL", + }, + } + + validations = { + } + + @cached_property + def additional_properties_type(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + """ + lazy_import() + return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + + _nullable = False + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + lazy_import() + return { + 'shipper': (AddressData,), # noqa: E501 + 'recipient': (AddressData,), # noqa: E501 + 'parcels': ([ParcelData],), # noqa: E501 + 'options': ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type,), # noqa: E501 + 'payment': (Payment,), # noqa: E501 + 'customs': (CustomsData,), # noqa: E501 + 'reference': (str, none_type,), # noqa: E501 + 'label_type': (str,), # noqa: E501 + 'services': ([str], none_type,), # noqa: E501 + 'carrier_ids': ([str], none_type,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'shipper': 'shipper', # noqa: E501 + 'recipient': 'recipient', # noqa: E501 + 'parcels': 'parcels', # noqa: E501 + 'options': 'options', # noqa: E501 + 'payment': 'payment', # noqa: E501 + 'customs': 'customs', # noqa: E501 + 'reference': 'reference', # noqa: E501 + 'label_type': 'label_type', # noqa: E501 + 'services': 'services', # noqa: E501 + 'carrier_ids': 'carrier_ids', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, shipper, recipient, parcels, *args, **kwargs): # noqa: E501 + """ShipmentData - a model defined in OpenAPI + + Args: + shipper (AddressData): + recipient (AddressData): + parcels ([ParcelData]): The shipment's parcels + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + options ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type): The options available for the shipment.
Please consult [the reference](#operation/references) for additional specific carriers options. . [optional] # noqa: E501 + payment (Payment): [optional] # noqa: E501 + customs (CustomsData): [optional] # noqa: E501 + reference (str, none_type): The shipment reference. [optional] # noqa: E501 + label_type (str): The shipment label file type.. [optional] if omitted the server will use the default value of "PDF" # noqa: E501 + services ([str], none_type): The requested carrier service for the shipment. Please consult [the reference](#operation/references) for specific carriers services.
Note that this is a list because on a Multi-carrier rate request you could specify a service per carrier. . [optional] # noqa: E501 + carrier_ids ([str], none_type): The list of configured carriers you wish to get rates from. *Note that the request will be sent to all carriers in nothing is specified* . [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.shipper = shipper + self.recipient = recipient + self.parcels = parcels + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + required_properties = set([ + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) + + @convert_js_args_to_python_args + def __init__(self, shipper, recipient, parcels, *args, **kwargs): # noqa: E501 + """ShipmentData - a model defined in OpenAPI + + Args: + shipper (AddressData): + recipient (AddressData): + parcels ([ParcelData]): The shipment's parcels + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + options ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type): The options available for the shipment.
Please consult [the reference](#operation/references) for additional specific carriers options. . [optional] # noqa: E501 + payment (Payment): [optional] # noqa: E501 + customs (CustomsData): [optional] # noqa: E501 + reference (str, none_type): The shipment reference. [optional] # noqa: E501 + label_type (str): The shipment label file type.. [optional] if omitted the server will use the default value of "PDF" # noqa: E501 + services ([str], none_type): The requested carrier service for the shipment. Please consult [the reference](#operation/references) for specific carriers services.
Note that this is a list because on a Multi-carrier rate request you could specify a service per carrier. . [optional] # noqa: E501 + carrier_ids ([str], none_type): The list of configured carriers you wish to get rates from. *Note that the request will be sent to all carriers in nothing is specified* . [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.shipper = shipper + self.recipient = recipient + self.parcels = parcels + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + f"class with read only attributes.") diff --git a/purplship/model/shipment_list.py b/purplship/model/shipment_list.py new file mode 100644 index 0000000..147eb5c --- /dev/null +++ b/purplship/model/shipment_list.py @@ -0,0 +1,282 @@ +""" + Purplship API + + ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.7`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 + + The version of the OpenAPI document: 2021.7 + Contact: hello@purplship.com + Generated by: https://openapi-generator.tech +""" + + +import re # noqa: F401 +import sys # noqa: F401 + +from purplship.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) +from ..model_utils import OpenApiModel +from purplship.exceptions import ApiAttributeError + + +def lazy_import(): + from purplship.model.shipment import Shipment + globals()['Shipment'] = Shipment + + +class ShipmentList(ModelNormal): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + } + + validations = { + ('next',): { + 'min_length': 1, + }, + ('previous',): { + 'min_length': 1, + }, + } + + @cached_property + def additional_properties_type(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + """ + lazy_import() + return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + + _nullable = False + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + lazy_import() + return { + 'results': ([Shipment],), # noqa: E501 + 'next': (str,), # noqa: E501 + 'previous': (str,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'results': 'results', # noqa: E501 + 'next': 'next', # noqa: E501 + 'previous': 'previous', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, results, *args, **kwargs): # noqa: E501 + """ShipmentList - a model defined in OpenAPI + + Args: + results ([Shipment]): + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + next (str): [optional] # noqa: E501 + previous (str): [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.results = results + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + required_properties = set([ + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) + + @convert_js_args_to_python_args + def __init__(self, results, *args, **kwargs): # noqa: E501 + """ShipmentList - a model defined in OpenAPI + + Args: + results ([Shipment]): + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + next (str): [optional] # noqa: E501 + previous (str): [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.results = results + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + f"class with read only attributes.") diff --git a/purplship/model/shipment_purchase_data.py b/purplship/model/shipment_purchase_data.py new file mode 100644 index 0000000..46267b8 --- /dev/null +++ b/purplship/model/shipment_purchase_data.py @@ -0,0 +1,287 @@ +""" + Purplship API + + ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.7`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 + + The version of the OpenAPI document: 2021.7 + Contact: hello@purplship.com + Generated by: https://openapi-generator.tech +""" + + +import re # noqa: F401 +import sys # noqa: F401 + +from purplship.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) +from ..model_utils import OpenApiModel +from purplship.exceptions import ApiAttributeError + + +def lazy_import(): + from purplship.model.payment import Payment + globals()['Payment'] = Payment + + +class ShipmentPurchaseData(ModelNormal): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + ('label_type',): { + 'PDF': "PDF", + 'ZPL': "ZPL", + }, + } + + validations = { + ('selected_rate_id',): { + 'min_length': 1, + }, + } + + @cached_property + def additional_properties_type(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + """ + lazy_import() + return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + + _nullable = False + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + lazy_import() + return { + 'selected_rate_id': (str,), # noqa: E501 + 'label_type': (str,), # noqa: E501 + 'payment': (Payment,), # noqa: E501 + 'reference': (str, none_type,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'selected_rate_id': 'selected_rate_id', # noqa: E501 + 'label_type': 'label_type', # noqa: E501 + 'payment': 'payment', # noqa: E501 + 'reference': 'reference', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, selected_rate_id, *args, **kwargs): # noqa: E501 + """ShipmentPurchaseData - a model defined in OpenAPI + + Args: + selected_rate_id (str): The shipment selected rate. + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + label_type (str): The shipment label file type.. [optional] if omitted the server will use the default value of "PDF" # noqa: E501 + payment (Payment): [optional] # noqa: E501 + reference (str, none_type): The shipment reference. [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.selected_rate_id = selected_rate_id + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + required_properties = set([ + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) + + @convert_js_args_to_python_args + def __init__(self, selected_rate_id, *args, **kwargs): # noqa: E501 + """ShipmentPurchaseData - a model defined in OpenAPI + + Args: + selected_rate_id (str): The shipment selected rate. + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + label_type (str): The shipment label file type.. [optional] if omitted the server will use the default value of "PDF" # noqa: E501 + payment (Payment): [optional] # noqa: E501 + reference (str, none_type): The shipment reference. [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.selected_rate_id = selected_rate_id + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + f"class with read only attributes.") diff --git a/purplship/model/shipment_rate_data.py b/purplship/model/shipment_rate_data.py new file mode 100644 index 0000000..25f1724 --- /dev/null +++ b/purplship/model/shipment_rate_data.py @@ -0,0 +1,264 @@ +""" + Purplship API + + ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.7`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 + + The version of the OpenAPI document: 2021.7 + Contact: hello@purplship.com + Generated by: https://openapi-generator.tech +""" + + +import re # noqa: F401 +import sys # noqa: F401 + +from purplship.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) +from ..model_utils import OpenApiModel +from purplship.exceptions import ApiAttributeError + + + +class ShipmentRateData(ModelNormal): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + } + + validations = { + } + + @cached_property + def additional_properties_type(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + """ + return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + + _nullable = False + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'services': ([str], none_type,), # noqa: E501 + 'carrier_ids': ([str], none_type,), # noqa: E501 + 'reference': (str, none_type,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'services': 'services', # noqa: E501 + 'carrier_ids': 'carrier_ids', # noqa: E501 + 'reference': 'reference', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 + """ShipmentRateData - a model defined in OpenAPI + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + services ([str], none_type): The requested carrier service for the shipment. Please consult [the reference](#operation/references) for specific carriers services.
Note that this is a list because on a Multi-carrier rate request you could specify a service per carrier. . [optional] # noqa: E501 + carrier_ids ([str], none_type): The list of configured carriers you wish to get rates from. *Note that the request will be sent to all carriers in nothing is specified* . [optional] # noqa: E501 + reference (str, none_type): The shipment reference. [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + required_properties = set([ + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) + + @convert_js_args_to_python_args + def __init__(self, *args, **kwargs): # noqa: E501 + """ShipmentRateData - a model defined in OpenAPI + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + services ([str], none_type): The requested carrier service for the shipment. Please consult [the reference](#operation/references) for specific carriers services.
Note that this is a list because on a Multi-carrier rate request you could specify a service per carrier. . [optional] # noqa: E501 + carrier_ids ([str], none_type): The list of configured carriers you wish to get rates from. *Note that the request will be sent to all carriers in nothing is specified* . [optional] # noqa: E501 + reference (str, none_type): The shipment reference. [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + f"class with read only attributes.") diff --git a/purplship/model/shipping_request.py b/purplship/model/shipping_request.py new file mode 100644 index 0000000..445a609 --- /dev/null +++ b/purplship/model/shipping_request.py @@ -0,0 +1,329 @@ +""" + Purplship API + + ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.7`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 + + The version of the OpenAPI document: 2021.7 + Contact: hello@purplship.com + Generated by: https://openapi-generator.tech +""" + + +import re # noqa: F401 +import sys # noqa: F401 + +from purplship.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) +from ..model_utils import OpenApiModel +from purplship.exceptions import ApiAttributeError + + +def lazy_import(): + from purplship.model.address_data import AddressData + from purplship.model.customs_data import CustomsData + from purplship.model.parcel_data import ParcelData + from purplship.model.payment import Payment + from purplship.model.rate import Rate + globals()['AddressData'] = AddressData + globals()['CustomsData'] = CustomsData + globals()['ParcelData'] = ParcelData + globals()['Payment'] = Payment + globals()['Rate'] = Rate + + +class ShippingRequest(ModelNormal): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + ('label_type',): { + 'PDF': "PDF", + 'ZPL': "ZPL", + }, + } + + validations = { + ('selected_rate_id',): { + 'min_length': 1, + }, + } + + @cached_property + def additional_properties_type(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + """ + lazy_import() + return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + + _nullable = False + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + lazy_import() + return { + 'shipper': (AddressData,), # noqa: E501 + 'recipient': (AddressData,), # noqa: E501 + 'parcels': ([ParcelData],), # noqa: E501 + 'payment': (Payment,), # noqa: E501 + 'selected_rate_id': (str,), # noqa: E501 + 'rates': ([Rate],), # noqa: E501 + 'options': ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type,), # noqa: E501 + 'customs': (CustomsData,), # noqa: E501 + 'reference': (str, none_type,), # noqa: E501 + 'label_type': (str,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'shipper': 'shipper', # noqa: E501 + 'recipient': 'recipient', # noqa: E501 + 'parcels': 'parcels', # noqa: E501 + 'payment': 'payment', # noqa: E501 + 'selected_rate_id': 'selected_rate_id', # noqa: E501 + 'rates': 'rates', # noqa: E501 + 'options': 'options', # noqa: E501 + 'customs': 'customs', # noqa: E501 + 'reference': 'reference', # noqa: E501 + 'label_type': 'label_type', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, shipper, recipient, parcels, payment, selected_rate_id, rates, *args, **kwargs): # noqa: E501 + """ShippingRequest - a model defined in OpenAPI + + Args: + shipper (AddressData): + recipient (AddressData): + parcels ([ParcelData]): The shipment's parcels + payment (Payment): + selected_rate_id (str): The shipment selected rate. + rates ([Rate]): The list for shipment rates fetched previously + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + options ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type): The options available for the shipment.
Please consult [the reference](#operation/references) for additional specific carriers options. . [optional] # noqa: E501 + customs (CustomsData): [optional] # noqa: E501 + reference (str, none_type): The shipment reference. [optional] # noqa: E501 + label_type (str): The shipment label file type.. [optional] if omitted the server will use the default value of "PDF" # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.shipper = shipper + self.recipient = recipient + self.parcels = parcels + self.payment = payment + self.selected_rate_id = selected_rate_id + self.rates = rates + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + required_properties = set([ + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) + + @convert_js_args_to_python_args + def __init__(self, shipper, recipient, parcels, payment, selected_rate_id, rates, *args, **kwargs): # noqa: E501 + """ShippingRequest - a model defined in OpenAPI + + Args: + shipper (AddressData): + recipient (AddressData): + parcels ([ParcelData]): The shipment's parcels + payment (Payment): + selected_rate_id (str): The shipment selected rate. + rates ([Rate]): The list for shipment rates fetched previously + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + options ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type): The options available for the shipment.
Please consult [the reference](#operation/references) for additional specific carriers options. . [optional] # noqa: E501 + customs (CustomsData): [optional] # noqa: E501 + reference (str, none_type): The shipment reference. [optional] # noqa: E501 + label_type (str): The shipment label file type.. [optional] if omitted the server will use the default value of "PDF" # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.shipper = shipper + self.recipient = recipient + self.parcels = parcels + self.payment = payment + self.selected_rate_id = selected_rate_id + self.rates = rates + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + f"class with read only attributes.") diff --git a/purplship/model/token_obtain_pair.py b/purplship/model/token_obtain_pair.py new file mode 100644 index 0000000..ace288e --- /dev/null +++ b/purplship/model/token_obtain_pair.py @@ -0,0 +1,281 @@ +""" + Purplship API + + ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.7`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 + + The version of the OpenAPI document: 2021.7 + Contact: hello@purplship.com + Generated by: https://openapi-generator.tech +""" + + +import re # noqa: F401 +import sys # noqa: F401 + +from purplship.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) +from ..model_utils import OpenApiModel +from purplship.exceptions import ApiAttributeError + + + +class TokenObtainPair(ModelNormal): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + } + + validations = { + ('email',): { + 'min_length': 1, + }, + ('password',): { + 'min_length': 1, + }, + ('org_id',): { + 'min_length': 1, + }, + } + + @cached_property + def additional_properties_type(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + """ + return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + + _nullable = False + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'email': (str,), # noqa: E501 + 'password': (str,), # noqa: E501 + 'org_id': (str,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'email': 'email', # noqa: E501 + 'password': 'password', # noqa: E501 + 'org_id': 'org_id', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, email, password, *args, **kwargs): # noqa: E501 + """TokenObtainPair - a model defined in OpenAPI + + Args: + email (str): + password (str): + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + org_id (str): **should be specified only in a multi-org deployment.** Note the first org related to the user is selected by default. . [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.email = email + self.password = password + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + required_properties = set([ + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) + + @convert_js_args_to_python_args + def __init__(self, email, password, *args, **kwargs): # noqa: E501 + """TokenObtainPair - a model defined in OpenAPI + + Args: + email (str): + password (str): + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + org_id (str): **should be specified only in a multi-org deployment.** Note the first org related to the user is selected by default. . [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.email = email + self.password = password + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + f"class with read only attributes.") diff --git a/purplship/model/token_pair.py b/purplship/model/token_pair.py new file mode 100644 index 0000000..bc154c1 --- /dev/null +++ b/purplship/model/token_pair.py @@ -0,0 +1,274 @@ +""" + Purplship API + + ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.7`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 + + The version of the OpenAPI document: 2021.7 + Contact: hello@purplship.com + Generated by: https://openapi-generator.tech +""" + + +import re # noqa: F401 +import sys # noqa: F401 + +from purplship.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) +from ..model_utils import OpenApiModel +from purplship.exceptions import ApiAttributeError + + + +class TokenPair(ModelNormal): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + } + + validations = { + ('access',): { + 'min_length': 1, + }, + ('refresh',): { + 'min_length': 1, + }, + } + + @cached_property + def additional_properties_type(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + """ + return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + + _nullable = False + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'access': (str,), # noqa: E501 + 'refresh': (str,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'access': 'access', # noqa: E501 + 'refresh': 'refresh', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, access, refresh, *args, **kwargs): # noqa: E501 + """TokenPair - a model defined in OpenAPI + + Args: + access (str): + refresh (str): + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.access = access + self.refresh = refresh + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + required_properties = set([ + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) + + @convert_js_args_to_python_args + def __init__(self, access, refresh, *args, **kwargs): # noqa: E501 + """TokenPair - a model defined in OpenAPI + + Args: + access (str): + refresh (str): + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.access = access + self.refresh = refresh + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + f"class with read only attributes.") diff --git a/purplship/model/token_refresh.py b/purplship/model/token_refresh.py new file mode 100644 index 0000000..ba520c8 --- /dev/null +++ b/purplship/model/token_refresh.py @@ -0,0 +1,270 @@ +""" + Purplship API + + ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.7`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 + + The version of the OpenAPI document: 2021.7 + Contact: hello@purplship.com + Generated by: https://openapi-generator.tech +""" + + +import re # noqa: F401 +import sys # noqa: F401 + +from purplship.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) +from ..model_utils import OpenApiModel +from purplship.exceptions import ApiAttributeError + + + +class TokenRefresh(ModelNormal): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + } + + validations = { + ('refresh',): { + 'min_length': 1, + }, + } + + @cached_property + def additional_properties_type(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + """ + return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + + _nullable = False + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'refresh': (str,), # noqa: E501 + 'access': (str,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'refresh': 'refresh', # noqa: E501 + 'access': 'access', # noqa: E501 + } + + read_only_vars = { + 'access', # noqa: E501 + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, refresh, *args, **kwargs): # noqa: E501 + """TokenRefresh - a model defined in OpenAPI + + Args: + refresh (str): + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + access (str): [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.refresh = refresh + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + required_properties = set([ + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) + + @convert_js_args_to_python_args + def __init__(self, refresh, *args, **kwargs): # noqa: E501 + """TokenRefresh - a model defined in OpenAPI + + Args: + refresh (str): + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + access (str): [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.refresh = refresh + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + f"class with read only attributes.") diff --git a/purplship/model/token_verify.py b/purplship/model/token_verify.py new file mode 100644 index 0000000..d3afed7 --- /dev/null +++ b/purplship/model/token_verify.py @@ -0,0 +1,265 @@ +""" + Purplship API + + ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.7`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 + + The version of the OpenAPI document: 2021.7 + Contact: hello@purplship.com + Generated by: https://openapi-generator.tech +""" + + +import re # noqa: F401 +import sys # noqa: F401 + +from purplship.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) +from ..model_utils import OpenApiModel +from purplship.exceptions import ApiAttributeError + + + +class TokenVerify(ModelNormal): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + } + + validations = { + ('token',): { + 'min_length': 1, + }, + } + + @cached_property + def additional_properties_type(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + """ + return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + + _nullable = False + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'token': (str,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'token': 'token', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, token, *args, **kwargs): # noqa: E501 + """TokenVerify - a model defined in OpenAPI + + Args: + token (str): + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.token = token + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + required_properties = set([ + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) + + @convert_js_args_to_python_args + def __init__(self, token, *args, **kwargs): # noqa: E501 + """TokenVerify - a model defined in OpenAPI + + Args: + token (str): + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.token = token + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + f"class with read only attributes.") diff --git a/purplship/model/tracker_list.py b/purplship/model/tracker_list.py new file mode 100644 index 0000000..df42d70 --- /dev/null +++ b/purplship/model/tracker_list.py @@ -0,0 +1,282 @@ +""" + Purplship API + + ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.7`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 + + The version of the OpenAPI document: 2021.7 + Contact: hello@purplship.com + Generated by: https://openapi-generator.tech +""" + + +import re # noqa: F401 +import sys # noqa: F401 + +from purplship.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) +from ..model_utils import OpenApiModel +from purplship.exceptions import ApiAttributeError + + +def lazy_import(): + from purplship.model.tracking_status import TrackingStatus + globals()['TrackingStatus'] = TrackingStatus + + +class TrackerList(ModelNormal): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + } + + validations = { + ('next',): { + 'min_length': 1, + }, + ('previous',): { + 'min_length': 1, + }, + } + + @cached_property + def additional_properties_type(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + """ + lazy_import() + return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + + _nullable = False + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + lazy_import() + return { + 'results': ([TrackingStatus],), # noqa: E501 + 'next': (str,), # noqa: E501 + 'previous': (str,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'results': 'results', # noqa: E501 + 'next': 'next', # noqa: E501 + 'previous': 'previous', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, results, *args, **kwargs): # noqa: E501 + """TrackerList - a model defined in OpenAPI + + Args: + results ([TrackingStatus]): + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + next (str): [optional] # noqa: E501 + previous (str): [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.results = results + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + required_properties = set([ + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) + + @convert_js_args_to_python_args + def __init__(self, results, *args, **kwargs): # noqa: E501 + """TrackerList - a model defined in OpenAPI + + Args: + results ([TrackingStatus]): + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + next (str): [optional] # noqa: E501 + previous (str): [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.results = results + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + f"class with read only attributes.") diff --git a/purplship/model/tracking_event.py b/purplship/model/tracking_event.py new file mode 100644 index 0000000..6b19900 --- /dev/null +++ b/purplship/model/tracking_event.py @@ -0,0 +1,281 @@ +""" + Purplship API + + ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.7`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 + + The version of the OpenAPI document: 2021.7 + Contact: hello@purplship.com + Generated by: https://openapi-generator.tech +""" + + +import re # noqa: F401 +import sys # noqa: F401 + +from purplship.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) +from ..model_utils import OpenApiModel +from purplship.exceptions import ApiAttributeError + + + +class TrackingEvent(ModelNormal): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + } + + validations = { + ('date',): { + 'min_length': 1, + }, + ('description',): { + 'min_length': 1, + }, + ('location',): { + 'min_length': 1, + }, + } + + @cached_property + def additional_properties_type(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + """ + return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + + _nullable = True + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'date': (str,), # noqa: E501 + 'description': (str,), # noqa: E501 + 'location': (str,), # noqa: E501 + 'code': (str, none_type,), # noqa: E501 + 'time': (str, none_type,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'date': 'date', # noqa: E501 + 'description': 'description', # noqa: E501 + 'location': 'location', # noqa: E501 + 'code': 'code', # noqa: E501 + 'time': 'time', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 + """TrackingEvent - a model defined in OpenAPI + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + date (str): The tracking event's date. [optional] # noqa: E501 + description (str): The tracking event's description. [optional] # noqa: E501 + location (str): The tracking event's location. [optional] # noqa: E501 + code (str, none_type): The tracking event's code. [optional] # noqa: E501 + time (str, none_type): The tracking event's time. [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + required_properties = set([ + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) + + @convert_js_args_to_python_args + def __init__(self, *args, **kwargs): # noqa: E501 + """TrackingEvent - a model defined in OpenAPI + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + date (str): The tracking event's date. [optional] # noqa: E501 + description (str): The tracking event's description. [optional] # noqa: E501 + location (str): The tracking event's location. [optional] # noqa: E501 + code (str, none_type): The tracking event's code. [optional] # noqa: E501 + time (str, none_type): The tracking event's time. [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + f"class with read only attributes.") diff --git a/purplship/model/tracking_response.py b/purplship/model/tracking_response.py new file mode 100644 index 0000000..26580f4 --- /dev/null +++ b/purplship/model/tracking_response.py @@ -0,0 +1,268 @@ +""" + Purplship API + + ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.7`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 + + The version of the OpenAPI document: 2021.7 + Contact: hello@purplship.com + Generated by: https://openapi-generator.tech +""" + + +import re # noqa: F401 +import sys # noqa: F401 + +from purplship.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) +from ..model_utils import OpenApiModel +from purplship.exceptions import ApiAttributeError + + +def lazy_import(): + from purplship.model.message import Message + from purplship.model.tracking_status import TrackingStatus + globals()['Message'] = Message + globals()['TrackingStatus'] = TrackingStatus + + +class TrackingResponse(ModelNormal): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + } + + validations = { + } + + @cached_property + def additional_properties_type(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + """ + lazy_import() + return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + + _nullable = False + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + lazy_import() + return { + 'messages': ([Message],), # noqa: E501 + 'tracking': (TrackingStatus,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'messages': 'messages', # noqa: E501 + 'tracking': 'tracking', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 + """TrackingResponse - a model defined in OpenAPI + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + messages ([Message]): The list of note or warning messages. [optional] # noqa: E501 + tracking (TrackingStatus): [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + required_properties = set([ + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) + + @convert_js_args_to_python_args + def __init__(self, *args, **kwargs): # noqa: E501 + """TrackingResponse - a model defined in OpenAPI + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + messages ([Message]): The list of note or warning messages. [optional] # noqa: E501 + tracking (TrackingStatus): [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + f"class with read only attributes.") diff --git a/purplship/model/tracking_status.py b/purplship/model/tracking_status.py new file mode 100644 index 0000000..08877bb --- /dev/null +++ b/purplship/model/tracking_status.py @@ -0,0 +1,322 @@ +""" + Purplship API + + ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.7`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 + + The version of the OpenAPI document: 2021.7 + Contact: hello@purplship.com + Generated by: https://openapi-generator.tech +""" + + +import re # noqa: F401 +import sys # noqa: F401 + +from purplship.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) +from ..model_utils import OpenApiModel +from purplship.exceptions import ApiAttributeError + + +def lazy_import(): + from purplship.model.tracking_event import TrackingEvent + globals()['TrackingEvent'] = TrackingEvent + + +class TrackingStatus(ModelNormal): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + ('status',): { + 'CREATED': "created", + 'PURCHASED': "purchased", + 'CANCELLED': "cancelled", + 'SHIPPED': "shipped", + 'IN-TRANSIT': "in-transit", + 'DELIVERED': "delivered", + }, + } + + validations = { + ('carrier_name',): { + 'min_length': 1, + }, + ('carrier_id',): { + 'min_length': 1, + }, + ('tracking_number',): { + 'min_length': 1, + }, + ('id',): { + 'min_length': 1, + }, + } + + @cached_property + def additional_properties_type(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + """ + lazy_import() + return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + + _nullable = False + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + lazy_import() + return { + 'carrier_name': (str,), # noqa: E501 + 'carrier_id': (str,), # noqa: E501 + 'tracking_number': (str,), # noqa: E501 + 'test_mode': (bool,), # noqa: E501 + 'id': (str,), # noqa: E501 + 'events': ([TrackingEvent], none_type,), # noqa: E501 + 'delivered': (bool,), # noqa: E501 + 'status': (str,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'carrier_name': 'carrier_name', # noqa: E501 + 'carrier_id': 'carrier_id', # noqa: E501 + 'tracking_number': 'tracking_number', # noqa: E501 + 'test_mode': 'test_mode', # noqa: E501 + 'id': 'id', # noqa: E501 + 'events': 'events', # noqa: E501 + 'delivered': 'delivered', # noqa: E501 + 'status': 'status', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, carrier_name, carrier_id, tracking_number, test_mode, *args, **kwargs): # noqa: E501 + """TrackingStatus - a model defined in OpenAPI + + Args: + carrier_name (str): The tracking carrier + carrier_id (str): The tracking carrier configured identifier + tracking_number (str): The shipment tracking number + test_mode (bool): Specified whether the object was created with a carrier in test mode + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + id (str): A unique identifier. [optional] # noqa: E501 + events ([TrackingEvent], none_type): The tracking details events. [optional] # noqa: E501 + delivered (bool): Specified whether the related shipment was delivered. [optional] # noqa: E501 + status (str): The current tracking status. [optional] if omitted the server will use the default value of "created" # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.carrier_name = carrier_name + self.carrier_id = carrier_id + self.tracking_number = tracking_number + self.test_mode = test_mode + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + required_properties = set([ + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) + + @convert_js_args_to_python_args + def __init__(self, carrier_name, carrier_id, tracking_number, test_mode, *args, **kwargs): # noqa: E501 + """TrackingStatus - a model defined in OpenAPI + + Args: + carrier_name (str): The tracking carrier + carrier_id (str): The tracking carrier configured identifier + tracking_number (str): The shipment tracking number + test_mode (bool): Specified whether the object was created with a carrier in test mode + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + id (str): A unique identifier. [optional] # noqa: E501 + events ([TrackingEvent], none_type): The tracking details events. [optional] # noqa: E501 + delivered (bool): Specified whether the related shipment was delivered. [optional] # noqa: E501 + status (str): The current tracking status. [optional] if omitted the server will use the default value of "created" # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.carrier_name = carrier_name + self.carrier_id = carrier_id + self.tracking_number = tracking_number + self.test_mode = test_mode + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + f"class with read only attributes.") diff --git a/purplship/model/webhook.py b/purplship/model/webhook.py new file mode 100644 index 0000000..31fde78 --- /dev/null +++ b/purplship/model/webhook.py @@ -0,0 +1,304 @@ +""" + Purplship API + + ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.7`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 + + The version of the OpenAPI document: 2021.7 + Contact: hello@purplship.com + Generated by: https://openapi-generator.tech +""" + + +import re # noqa: F401 +import sys # noqa: F401 + +from purplship.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) +from ..model_utils import OpenApiModel +from purplship.exceptions import ApiAttributeError + + + +class Webhook(ModelNormal): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + ('enabled_events',): { + 'ALL': "all", + 'SHIPMENT.PURCHASED': "shipment.purchased", + 'SHIPMENT.CANCELLED': "shipment.cancelled", + 'SHIPMENT.FULFILLED': "shipment.fulfilled", + 'TRACKER.CREATED': "tracker.created", + 'TRACKER.UPDATED': "tracker.updated", + }, + } + + validations = { + ('url',): { + 'min_length': 1, + }, + ('id',): { + 'min_length': 1, + }, + } + + @cached_property + def additional_properties_type(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + """ + return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + + _nullable = False + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'url': (str,), # noqa: E501 + 'enabled_events': ([str],), # noqa: E501 + 'test_mode': (bool,), # noqa: E501 + 'description': (str, none_type,), # noqa: E501 + 'disabled': (bool, none_type,), # noqa: E501 + 'id': (str,), # noqa: E501 + 'last_event_at': (datetime, none_type,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'url': 'url', # noqa: E501 + 'enabled_events': 'enabled_events', # noqa: E501 + 'test_mode': 'test_mode', # noqa: E501 + 'description': 'description', # noqa: E501 + 'disabled': 'disabled', # noqa: E501 + 'id': 'id', # noqa: E501 + 'last_event_at': 'last_event_at', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, url, enabled_events, test_mode, *args, **kwargs): # noqa: E501 + """Webhook - a model defined in OpenAPI + + Args: + url (str): The URL of the webhook endpoint. + enabled_events ([str]): The list of events to enable for this endpoint. + test_mode (bool): Specified whether it was created with a carrier in test mode + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + description (str, none_type): An optional description of what the webhook is used for.. [optional] # noqa: E501 + disabled (bool, none_type): Indicates that the webhook is disabled. [optional] # noqa: E501 + id (str): A unique identifier. [optional] # noqa: E501 + last_event_at (datetime, none_type): The datetime of the last event sent.. [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.url = url + self.enabled_events = enabled_events + self.test_mode = test_mode + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + required_properties = set([ + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) + + @convert_js_args_to_python_args + def __init__(self, url, enabled_events, test_mode, *args, **kwargs): # noqa: E501 + """Webhook - a model defined in OpenAPI + + Args: + url (str): The URL of the webhook endpoint. + enabled_events ([str]): The list of events to enable for this endpoint. + test_mode (bool): Specified whether it was created with a carrier in test mode + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + description (str, none_type): An optional description of what the webhook is used for.. [optional] # noqa: E501 + disabled (bool, none_type): Indicates that the webhook is disabled. [optional] # noqa: E501 + id (str): A unique identifier. [optional] # noqa: E501 + last_event_at (datetime, none_type): The datetime of the last event sent.. [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.url = url + self.enabled_events = enabled_events + self.test_mode = test_mode + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + f"class with read only attributes.") diff --git a/purplship/model/webhook_data.py b/purplship/model/webhook_data.py new file mode 100644 index 0000000..e4f98d7 --- /dev/null +++ b/purplship/model/webhook_data.py @@ -0,0 +1,293 @@ +""" + Purplship API + + ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.7`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 + + The version of the OpenAPI document: 2021.7 + Contact: hello@purplship.com + Generated by: https://openapi-generator.tech +""" + + +import re # noqa: F401 +import sys # noqa: F401 + +from purplship.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) +from ..model_utils import OpenApiModel +from purplship.exceptions import ApiAttributeError + + + +class WebhookData(ModelNormal): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + ('enabled_events',): { + 'ALL': "all", + 'SHIPMENT.PURCHASED': "shipment.purchased", + 'SHIPMENT.CANCELLED': "shipment.cancelled", + 'SHIPMENT.FULFILLED': "shipment.fulfilled", + 'TRACKER.CREATED': "tracker.created", + 'TRACKER.UPDATED': "tracker.updated", + }, + } + + validations = { + ('url',): { + 'min_length': 1, + }, + } + + @cached_property + def additional_properties_type(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + """ + return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + + _nullable = False + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'url': (str,), # noqa: E501 + 'enabled_events': ([str],), # noqa: E501 + 'test_mode': (bool,), # noqa: E501 + 'description': (str, none_type,), # noqa: E501 + 'disabled': (bool, none_type,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'url': 'url', # noqa: E501 + 'enabled_events': 'enabled_events', # noqa: E501 + 'test_mode': 'test_mode', # noqa: E501 + 'description': 'description', # noqa: E501 + 'disabled': 'disabled', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, url, enabled_events, test_mode, *args, **kwargs): # noqa: E501 + """WebhookData - a model defined in OpenAPI + + Args: + url (str): The URL of the webhook endpoint. + enabled_events ([str]): The list of events to enable for this endpoint. + test_mode (bool): Specified whether it was created with a carrier in test mode + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + description (str, none_type): An optional description of what the webhook is used for.. [optional] # noqa: E501 + disabled (bool, none_type): Indicates that the webhook is disabled. [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.url = url + self.enabled_events = enabled_events + self.test_mode = test_mode + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + required_properties = set([ + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) + + @convert_js_args_to_python_args + def __init__(self, url, enabled_events, test_mode, *args, **kwargs): # noqa: E501 + """WebhookData - a model defined in OpenAPI + + Args: + url (str): The URL of the webhook endpoint. + enabled_events ([str]): The list of events to enable for this endpoint. + test_mode (bool): Specified whether it was created with a carrier in test mode + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + description (str, none_type): An optional description of what the webhook is used for.. [optional] # noqa: E501 + disabled (bool, none_type): Indicates that the webhook is disabled. [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.url = url + self.enabled_events = enabled_events + self.test_mode = test_mode + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + f"class with read only attributes.") diff --git a/purplship/model/webhook_list.py b/purplship/model/webhook_list.py new file mode 100644 index 0000000..3eb5700 --- /dev/null +++ b/purplship/model/webhook_list.py @@ -0,0 +1,282 @@ +""" + Purplship API + + ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.7`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 + + The version of the OpenAPI document: 2021.7 + Contact: hello@purplship.com + Generated by: https://openapi-generator.tech +""" + + +import re # noqa: F401 +import sys # noqa: F401 + +from purplship.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) +from ..model_utils import OpenApiModel +from purplship.exceptions import ApiAttributeError + + +def lazy_import(): + from purplship.model.webhook import Webhook + globals()['Webhook'] = Webhook + + +class WebhookList(ModelNormal): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + } + + validations = { + ('next',): { + 'min_length': 1, + }, + ('previous',): { + 'min_length': 1, + }, + } + + @cached_property + def additional_properties_type(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + """ + lazy_import() + return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + + _nullable = False + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + lazy_import() + return { + 'results': ([Webhook],), # noqa: E501 + 'next': (str,), # noqa: E501 + 'previous': (str,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'results': 'results', # noqa: E501 + 'next': 'next', # noqa: E501 + 'previous': 'previous', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, results, *args, **kwargs): # noqa: E501 + """WebhookList - a model defined in OpenAPI + + Args: + results ([Webhook]): + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + next (str): [optional] # noqa: E501 + previous (str): [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.results = results + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + required_properties = set([ + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) + + @convert_js_args_to_python_args + def __init__(self, results, *args, **kwargs): # noqa: E501 + """WebhookList - a model defined in OpenAPI + + Args: + results ([Webhook]): + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + next (str): [optional] # noqa: E501 + previous (str): [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.results = results + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + f"class with read only attributes.") diff --git a/purplship/model/webhook_test_request.py b/purplship/model/webhook_test_request.py new file mode 100644 index 0000000..a3a6fe3 --- /dev/null +++ b/purplship/model/webhook_test_request.py @@ -0,0 +1,262 @@ +""" + Purplship API + + ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.7`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 + + The version of the OpenAPI document: 2021.7 + Contact: hello@purplship.com + Generated by: https://openapi-generator.tech +""" + + +import re # noqa: F401 +import sys # noqa: F401 + +from purplship.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) +from ..model_utils import OpenApiModel +from purplship.exceptions import ApiAttributeError + + + +class WebhookTestRequest(ModelNormal): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + } + + validations = { + } + + @cached_property + def additional_properties_type(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + """ + return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + + _nullable = False + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'payload': ({str: (bool, date, datetime, dict, float, int, list, str, none_type)},), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'payload': 'payload', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, payload, *args, **kwargs): # noqa: E501 + """WebhookTestRequest - a model defined in OpenAPI + + Args: + payload ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}): + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.payload = payload + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + required_properties = set([ + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) + + @convert_js_args_to_python_args + def __init__(self, payload, *args, **kwargs): # noqa: E501 + """WebhookTestRequest - a model defined in OpenAPI + + Args: + payload ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}): + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.payload = payload + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + f"class with read only attributes.") diff --git a/purplship/model_utils.py b/purplship/model_utils.py new file mode 100644 index 0000000..c56fdcf --- /dev/null +++ b/purplship/model_utils.py @@ -0,0 +1,1993 @@ +""" + Purplship API + + ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.7`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 + + The version of the OpenAPI document: 2021.7 + Contact: hello@purplship.com + Generated by: https://openapi-generator.tech +""" + + +from datetime import date, datetime # noqa: F401 +import inspect +import io +import os +import pprint +import re +import tempfile + +from dateutil.parser import parse + +from purplship.exceptions import ( + ApiKeyError, + ApiAttributeError, + ApiTypeError, + ApiValueError, +) + +none_type = type(None) +file_type = io.IOBase + + +def convert_js_args_to_python_args(fn): + from functools import wraps + @wraps(fn) + def wrapped_init(_self, *args, **kwargs): + """ + An attribute named `self` received from the api will conflicts with the reserved `self` + parameter of a class method. During generation, `self` attributes are mapped + to `_self` in models. Here, we name `_self` instead of `self` to avoid conflicts. + """ + spec_property_naming = kwargs.get('_spec_property_naming', False) + if spec_property_naming: + kwargs = change_keys_js_to_python(kwargs, _self if isinstance(_self, type) else _self.__class__) + return fn(_self, *args, **kwargs) + return wrapped_init + + +class cached_property(object): + # this caches the result of the function call for fn with no inputs + # use this as a decorator on function methods that you want converted + # into cached properties + result_key = '_results' + + def __init__(self, fn): + self._fn = fn + + def __get__(self, instance, cls=None): + if self.result_key in vars(self): + return vars(self)[self.result_key] + else: + result = self._fn() + setattr(self, self.result_key, result) + return result + + +PRIMITIVE_TYPES = (list, float, int, bool, datetime, date, str, file_type) + +def allows_single_value_input(cls): + """ + This function returns True if the input composed schema model or any + descendant model allows a value only input + This is true for cases where oneOf contains items like: + oneOf: + - float + - NumberWithValidation + - StringEnum + - ArrayModel + - null + TODO: lru_cache this + """ + if ( + issubclass(cls, ModelSimple) or + cls in PRIMITIVE_TYPES + ): + return True + elif issubclass(cls, ModelComposed): + if not cls._composed_schemas['oneOf']: + return False + return any(allows_single_value_input(c) for c in cls._composed_schemas['oneOf']) + return False + +def composed_model_input_classes(cls): + """ + This function returns a list of the possible models that can be accepted as + inputs. + TODO: lru_cache this + """ + if issubclass(cls, ModelSimple) or cls in PRIMITIVE_TYPES: + return [cls] + elif issubclass(cls, ModelNormal): + if cls.discriminator is None: + return [cls] + else: + return get_discriminated_classes(cls) + elif issubclass(cls, ModelComposed): + if not cls._composed_schemas['oneOf']: + return [] + if cls.discriminator is None: + input_classes = [] + for c in cls._composed_schemas['oneOf']: + input_classes.extend(composed_model_input_classes(c)) + return input_classes + else: + return get_discriminated_classes(cls) + return [] + + +class OpenApiModel(object): + """The base class for all OpenAPIModels""" + + def set_attribute(self, name, value): + # this is only used to set properties on self + + path_to_item = [] + if self._path_to_item: + path_to_item.extend(self._path_to_item) + path_to_item.append(name) + + if name in self.openapi_types: + required_types_mixed = self.openapi_types[name] + elif self.additional_properties_type is None: + raise ApiAttributeError( + "{0} has no attribute '{1}'".format( + type(self).__name__, name), + path_to_item + ) + elif self.additional_properties_type is not None: + required_types_mixed = self.additional_properties_type + + if get_simple_class(name) != str: + error_msg = type_error_message( + var_name=name, + var_value=name, + valid_classes=(str,), + key_type=True + ) + raise ApiTypeError( + error_msg, + path_to_item=path_to_item, + valid_classes=(str,), + key_type=True + ) + + if self._check_type: + value = validate_and_convert_types( + value, required_types_mixed, path_to_item, self._spec_property_naming, + self._check_type, configuration=self._configuration) + if (name,) in self.allowed_values: + check_allowed_values( + self.allowed_values, + (name,), + value + ) + if (name,) in self.validations: + check_validations( + self.validations, + (name,), + value, + self._configuration + ) + self.__dict__['_data_store'][name] = value + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other + + def __setattr__(self, attr, value): + """set the value of an attribute using dot notation: `instance.attr = val`""" + self[attr] = value + + def __getattr__(self, attr): + """get the value of an attribute using dot notation: `instance.attr`""" + return self.__getitem__(attr) + + def __new__(cls, *args, **kwargs): + # this function uses the discriminator to + # pick a new schema/class to instantiate because a discriminator + # propertyName value was passed in + + if len(args) == 1: + arg = args[0] + if arg is None and is_type_nullable(cls): + # The input data is the 'null' value and the type is nullable. + return None + + if issubclass(cls, ModelComposed) and allows_single_value_input(cls): + model_kwargs = {} + oneof_instance = get_oneof_instance(cls, model_kwargs, kwargs, model_arg=arg) + return oneof_instance + + + visited_composed_classes = kwargs.get('_visited_composed_classes', ()) + if ( + cls.discriminator is None or + cls in visited_composed_classes + ): + # Use case 1: this openapi schema (cls) does not have a discriminator + # Use case 2: we have already visited this class before and are sure that we + # want to instantiate it this time. We have visited this class deserializing + # a payload with a discriminator. During that process we traveled through + # this class but did not make an instance of it. Now we are making an + # instance of a composed class which contains cls in it, so this time make an instance of cls. + # + # Here's an example of use case 2: If Animal has a discriminator + # petType and we pass in "Dog", and the class Dog + # allOf includes Animal, we move through Animal + # once using the discriminator, and pick Dog. + # Then in the composed schema dog Dog, we will make an instance of the + # Animal class (because Dal has allOf: Animal) but this time we won't travel + # through Animal's discriminator because we passed in + # _visited_composed_classes = (Animal,) + + return super(OpenApiModel, cls).__new__(cls) + + # Get the name and value of the discriminator property. + # The discriminator name is obtained from the discriminator meta-data + # and the discriminator value is obtained from the input data. + discr_propertyname_py = list(cls.discriminator.keys())[0] + discr_propertyname_js = cls.attribute_map[discr_propertyname_py] + if discr_propertyname_js in kwargs: + discr_value = kwargs[discr_propertyname_js] + elif discr_propertyname_py in kwargs: + discr_value = kwargs[discr_propertyname_py] + else: + # The input data does not contain the discriminator property. + path_to_item = kwargs.get('_path_to_item', ()) + raise ApiValueError( + "Cannot deserialize input data due to missing discriminator. " + "The discriminator property '%s' is missing at path: %s" % + (discr_propertyname_js, path_to_item) + ) + + # Implementation note: the last argument to get_discriminator_class + # is a list of visited classes. get_discriminator_class may recursively + # call itself and update the list of visited classes, and the initial + # value must be an empty list. Hence not using 'visited_composed_classes' + new_cls = get_discriminator_class( + cls, discr_propertyname_py, discr_value, []) + if new_cls is None: + path_to_item = kwargs.get('_path_to_item', ()) + disc_prop_value = kwargs.get( + discr_propertyname_js, kwargs.get(discr_propertyname_py)) + raise ApiValueError( + "Cannot deserialize input data due to invalid discriminator " + "value. The OpenAPI document has no mapping for discriminator " + "property '%s'='%s' at path: %s" % + (discr_propertyname_js, disc_prop_value, path_to_item) + ) + + if new_cls in visited_composed_classes: + # if we are making an instance of a composed schema Descendent + # which allOf includes Ancestor, then Ancestor contains + # a discriminator that includes Descendent. + # So if we make an instance of Descendent, we have to make an + # instance of Ancestor to hold the allOf properties. + # This code detects that use case and makes the instance of Ancestor + # For example: + # When making an instance of Dog, _visited_composed_classes = (Dog,) + # then we make an instance of Animal to include in dog._composed_instances + # so when we are here, cls is Animal + # cls.discriminator != None + # cls not in _visited_composed_classes + # new_cls = Dog + # but we know we know that we already have Dog + # because it is in visited_composed_classes + # so make Animal here + return super(OpenApiModel, cls).__new__(cls) + + # Build a list containing all oneOf and anyOf descendants. + oneof_anyof_classes = None + if cls._composed_schemas is not None: + oneof_anyof_classes = ( + cls._composed_schemas.get('oneOf', ()) + + cls._composed_schemas.get('anyOf', ())) + oneof_anyof_child = new_cls in oneof_anyof_classes + kwargs['_visited_composed_classes'] = visited_composed_classes + (cls,) + + if cls._composed_schemas.get('allOf') and oneof_anyof_child: + # Validate that we can make self because when we make the + # new_cls it will not include the allOf validations in self + self_inst = super(OpenApiModel, cls).__new__(cls) + self_inst.__init__(*args, **kwargs) + + new_inst = new_cls.__new__(new_cls, *args, **kwargs) + new_inst.__init__(*args, **kwargs) + return new_inst + + + @classmethod + @convert_js_args_to_python_args + def _new_from_openapi_data(cls, *args, **kwargs): + # this function uses the discriminator to + # pick a new schema/class to instantiate because a discriminator + # propertyName value was passed in + + if len(args) == 1: + arg = args[0] + if arg is None and is_type_nullable(cls): + # The input data is the 'null' value and the type is nullable. + return None + + if issubclass(cls, ModelComposed) and allows_single_value_input(cls): + model_kwargs = {} + oneof_instance = get_oneof_instance(cls, model_kwargs, kwargs, model_arg=arg) + return oneof_instance + + + visited_composed_classes = kwargs.get('_visited_composed_classes', ()) + if ( + cls.discriminator is None or + cls in visited_composed_classes + ): + # Use case 1: this openapi schema (cls) does not have a discriminator + # Use case 2: we have already visited this class before and are sure that we + # want to instantiate it this time. We have visited this class deserializing + # a payload with a discriminator. During that process we traveled through + # this class but did not make an instance of it. Now we are making an + # instance of a composed class which contains cls in it, so this time make an instance of cls. + # + # Here's an example of use case 2: If Animal has a discriminator + # petType and we pass in "Dog", and the class Dog + # allOf includes Animal, we move through Animal + # once using the discriminator, and pick Dog. + # Then in the composed schema dog Dog, we will make an instance of the + # Animal class (because Dal has allOf: Animal) but this time we won't travel + # through Animal's discriminator because we passed in + # _visited_composed_classes = (Animal,) + + return cls._from_openapi_data(*args, **kwargs) + + # Get the name and value of the discriminator property. + # The discriminator name is obtained from the discriminator meta-data + # and the discriminator value is obtained from the input data. + discr_propertyname_py = list(cls.discriminator.keys())[0] + discr_propertyname_js = cls.attribute_map[discr_propertyname_py] + if discr_propertyname_js in kwargs: + discr_value = kwargs[discr_propertyname_js] + elif discr_propertyname_py in kwargs: + discr_value = kwargs[discr_propertyname_py] + else: + # The input data does not contain the discriminator property. + path_to_item = kwargs.get('_path_to_item', ()) + raise ApiValueError( + "Cannot deserialize input data due to missing discriminator. " + "The discriminator property '%s' is missing at path: %s" % + (discr_propertyname_js, path_to_item) + ) + + # Implementation note: the last argument to get_discriminator_class + # is a list of visited classes. get_discriminator_class may recursively + # call itself and update the list of visited classes, and the initial + # value must be an empty list. Hence not using 'visited_composed_classes' + new_cls = get_discriminator_class( + cls, discr_propertyname_py, discr_value, []) + if new_cls is None: + path_to_item = kwargs.get('_path_to_item', ()) + disc_prop_value = kwargs.get( + discr_propertyname_js, kwargs.get(discr_propertyname_py)) + raise ApiValueError( + "Cannot deserialize input data due to invalid discriminator " + "value. The OpenAPI document has no mapping for discriminator " + "property '%s'='%s' at path: %s" % + (discr_propertyname_js, disc_prop_value, path_to_item) + ) + + if new_cls in visited_composed_classes: + # if we are making an instance of a composed schema Descendent + # which allOf includes Ancestor, then Ancestor contains + # a discriminator that includes Descendent. + # So if we make an instance of Descendent, we have to make an + # instance of Ancestor to hold the allOf properties. + # This code detects that use case and makes the instance of Ancestor + # For example: + # When making an instance of Dog, _visited_composed_classes = (Dog,) + # then we make an instance of Animal to include in dog._composed_instances + # so when we are here, cls is Animal + # cls.discriminator != None + # cls not in _visited_composed_classes + # new_cls = Dog + # but we know we know that we already have Dog + # because it is in visited_composed_classes + # so make Animal here + return cls._from_openapi_data(*args, **kwargs) + + # Build a list containing all oneOf and anyOf descendants. + oneof_anyof_classes = None + if cls._composed_schemas is not None: + oneof_anyof_classes = ( + cls._composed_schemas.get('oneOf', ()) + + cls._composed_schemas.get('anyOf', ())) + oneof_anyof_child = new_cls in oneof_anyof_classes + kwargs['_visited_composed_classes'] = visited_composed_classes + (cls,) + + if cls._composed_schemas.get('allOf') and oneof_anyof_child: + # Validate that we can make self because when we make the + # new_cls it will not include the allOf validations in self + self_inst = cls._from_openapi_data(*args, **kwargs) + + + new_inst = new_cls._new_from_openapi_data(*args, **kwargs) + return new_inst + + +class ModelSimple(OpenApiModel): + """the parent class of models whose type != object in their + swagger/openapi""" + + def __setitem__(self, name, value): + """set the value of an attribute using square-bracket notation: `instance[attr] = val`""" + if name in self.required_properties: + self.__dict__[name] = value + return + + self.set_attribute(name, value) + + def get(self, name, default=None): + """returns the value of an attribute or some default value if the attribute was not set""" + if name in self.required_properties: + return self.__dict__[name] + + return self.__dict__['_data_store'].get(name, default) + + def __getitem__(self, name): + """get the value of an attribute using square-bracket notation: `instance[attr]`""" + if name in self: + return self.get(name) + + raise ApiAttributeError( + "{0} has no attribute '{1}'".format( + type(self).__name__, name), + [e for e in [self._path_to_item, name] if e] + ) + + def __contains__(self, name): + """used by `in` operator to check if an attrbute value was set in an instance: `'attr' in instance`""" + if name in self.required_properties: + return name in self.__dict__ + + return name in self.__dict__['_data_store'] + + def to_str(self): + """Returns the string representation of the model""" + return str(self.value) + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, self.__class__): + return False + + this_val = self._data_store['value'] + that_val = other._data_store['value'] + types = set() + types.add(this_val.__class__) + types.add(that_val.__class__) + vals_equal = this_val == that_val + return vals_equal + + +class ModelNormal(OpenApiModel): + """the parent class of models whose type == object in their + swagger/openapi""" + + def __setitem__(self, name, value): + """set the value of an attribute using square-bracket notation: `instance[attr] = val`""" + if name in self.required_properties: + self.__dict__[name] = value + return + + self.set_attribute(name, value) + + def get(self, name, default=None): + """returns the value of an attribute or some default value if the attribute was not set""" + if name in self.required_properties: + return self.__dict__[name] + + return self.__dict__['_data_store'].get(name, default) + + def __getitem__(self, name): + """get the value of an attribute using square-bracket notation: `instance[attr]`""" + if name in self: + return self.get(name) + + raise ApiAttributeError( + "{0} has no attribute '{1}'".format( + type(self).__name__, name), + [e for e in [self._path_to_item, name] if e] + ) + + def __contains__(self, name): + """used by `in` operator to check if an attrbute value was set in an instance: `'attr' in instance`""" + if name in self.required_properties: + return name in self.__dict__ + + return name in self.__dict__['_data_store'] + + def to_dict(self): + """Returns the model properties as a dict""" + return model_to_dict(self, serialize=False) + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, self.__class__): + return False + + if not set(self._data_store.keys()) == set(other._data_store.keys()): + return False + for _var_name, this_val in self._data_store.items(): + that_val = other._data_store[_var_name] + types = set() + types.add(this_val.__class__) + types.add(that_val.__class__) + vals_equal = this_val == that_val + if not vals_equal: + return False + return True + + +class ModelComposed(OpenApiModel): + """the parent class of models whose type == object in their + swagger/openapi and have oneOf/allOf/anyOf + + When one sets a property we use var_name_to_model_instances to store the value in + the correct class instances + run any type checking + validation code. + When one gets a property we use var_name_to_model_instances to get the value + from the correct class instances. + This allows multiple composed schemas to contain the same property with additive + constraints on the value. + + _composed_schemas (dict) stores the anyOf/allOf/oneOf classes + key (str): allOf/oneOf/anyOf + value (list): the classes in the XOf definition. + Note: none_type can be included when the openapi document version >= 3.1.0 + _composed_instances (list): stores a list of instances of the composed schemas + defined in _composed_schemas. When properties are accessed in the self instance, + they are returned from the self._data_store or the data stores in the instances + in self._composed_schemas + _var_name_to_model_instances (dict): maps between a variable name on self and + the composed instances (self included) which contain that data + key (str): property name + value (list): list of class instances, self or instances in _composed_instances + which contain the value that the key is referring to. + """ + + def __setitem__(self, name, value): + """set the value of an attribute using square-bracket notation: `instance[attr] = val`""" + if name in self.required_properties: + self.__dict__[name] = value + return + + """ + Use cases: + 1. additional_properties_type is None (additionalProperties == False in spec) + Check for property presence in self.openapi_types + if not present then throw an error + if present set in self, set attribute + always set on composed schemas + 2. additional_properties_type exists + set attribute on self + always set on composed schemas + """ + if self.additional_properties_type is None: + """ + For an attribute to exist on a composed schema it must: + - fulfill schema_requirements in the self composed schema not considering oneOf/anyOf/allOf schemas AND + - fulfill schema_requirements in each oneOf/anyOf/allOf schemas + + schema_requirements: + For an attribute to exist on a schema it must: + - be present in properties at the schema OR + - have additionalProperties unset (defaults additionalProperties = any type) OR + - have additionalProperties set + """ + if name not in self.openapi_types: + raise ApiAttributeError( + "{0} has no attribute '{1}'".format( + type(self).__name__, name), + [e for e in [self._path_to_item, name] if e] + ) + # attribute must be set on self and composed instances + self.set_attribute(name, value) + for model_instance in self._composed_instances: + setattr(model_instance, name, value) + if name not in self._var_name_to_model_instances: + # we assigned an additional property + self.__dict__['_var_name_to_model_instances'][name] = self._composed_instances + [self] + return None + + __unset_attribute_value__ = object() + + def get(self, name, default=None): + """returns the value of an attribute or some default value if the attribute was not set""" + if name in self.required_properties: + return self.__dict__[name] + + # get the attribute from the correct instance + model_instances = self._var_name_to_model_instances.get(name) + values = [] + # A composed model stores self and child (oneof/anyOf/allOf) models under + # self._var_name_to_model_instances. + # Any property must exist in self and all model instances + # The value stored in all model instances must be the same + if model_instances: + for model_instance in model_instances: + if name in model_instance._data_store: + v = model_instance._data_store[name] + if v not in values: + values.append(v) + len_values = len(values) + if len_values == 0: + return default + elif len_values == 1: + return values[0] + elif len_values > 1: + raise ApiValueError( + "Values stored for property {0} in {1} differ when looking " + "at self and self's composed instances. All values must be " + "the same".format(name, type(self).__name__), + [e for e in [self._path_to_item, name] if e] + ) + + def __getitem__(self, name): + """get the value of an attribute using square-bracket notation: `instance[attr]`""" + value = self.get(name, self.__unset_attribute_value__) + if value is self.__unset_attribute_value__: + raise ApiAttributeError( + "{0} has no attribute '{1}'".format( + type(self).__name__, name), + [e for e in [self._path_to_item, name] if e] + ) + return value + + def __contains__(self, name): + """used by `in` operator to check if an attrbute value was set in an instance: `'attr' in instance`""" + + if name in self.required_properties: + return name in self.__dict__ + + model_instances = self._var_name_to_model_instances.get( + name, self._additional_properties_model_instances) + + if model_instances: + for model_instance in model_instances: + if name in model_instance._data_store: + return True + + return False + + def to_dict(self): + """Returns the model properties as a dict""" + return model_to_dict(self, serialize=False) + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, self.__class__): + return False + + if not set(self._data_store.keys()) == set(other._data_store.keys()): + return False + for _var_name, this_val in self._data_store.items(): + that_val = other._data_store[_var_name] + types = set() + types.add(this_val.__class__) + types.add(that_val.__class__) + vals_equal = this_val == that_val + if not vals_equal: + return False + return True + + +COERCION_INDEX_BY_TYPE = { + ModelComposed: 0, + ModelNormal: 1, + ModelSimple: 2, + none_type: 3, # The type of 'None'. + list: 4, + dict: 5, + float: 6, + int: 7, + bool: 8, + datetime: 9, + date: 10, + str: 11, + file_type: 12, # 'file_type' is an alias for the built-in 'file' or 'io.IOBase' type. +} + +# these are used to limit what type conversions we try to do +# when we have a valid type already and we want to try converting +# to another type +UPCONVERSION_TYPE_PAIRS = ( + (str, datetime), + (str, date), + (int, float), # A float may be serialized as an integer, e.g. '3' is a valid serialized float. + (list, ModelComposed), + (dict, ModelComposed), + (str, ModelComposed), + (int, ModelComposed), + (float, ModelComposed), + (list, ModelComposed), + (list, ModelNormal), + (dict, ModelNormal), + (str, ModelSimple), + (int, ModelSimple), + (float, ModelSimple), + (list, ModelSimple), +) + +COERCIBLE_TYPE_PAIRS = { + False: ( # client instantiation of a model with client data + # (dict, ModelComposed), + # (list, ModelComposed), + # (dict, ModelNormal), + # (list, ModelNormal), + # (str, ModelSimple), + # (int, ModelSimple), + # (float, ModelSimple), + # (list, ModelSimple), + # (str, int), + # (str, float), + # (str, datetime), + # (str, date), + # (int, str), + # (float, str), + ), + True: ( # server -> client data + (dict, ModelComposed), + (list, ModelComposed), + (dict, ModelNormal), + (list, ModelNormal), + (str, ModelSimple), + (int, ModelSimple), + (float, ModelSimple), + (list, ModelSimple), + # (str, int), + # (str, float), + (str, datetime), + (str, date), + # (int, str), + # (float, str), + (str, file_type) + ), +} + + +def get_simple_class(input_value): + """Returns an input_value's simple class that we will use for type checking + Python2: + float and int will return int, where int is the python3 int backport + str and unicode will return str, where str is the python3 str backport + Note: float and int ARE both instances of int backport + Note: str_py2 and unicode_py2 are NOT both instances of str backport + + Args: + input_value (class/class_instance): the item for which we will return + the simple class + """ + if isinstance(input_value, type): + # input_value is a class + return input_value + elif isinstance(input_value, tuple): + return tuple + elif isinstance(input_value, list): + return list + elif isinstance(input_value, dict): + return dict + elif isinstance(input_value, none_type): + return none_type + elif isinstance(input_value, file_type): + return file_type + elif isinstance(input_value, bool): + # this must be higher than the int check because + # isinstance(True, int) == True + return bool + elif isinstance(input_value, int): + return int + elif isinstance(input_value, datetime): + # this must be higher than the date check because + # isinstance(datetime_instance, date) == True + return datetime + elif isinstance(input_value, date): + return date + elif isinstance(input_value, str): + return str + return type(input_value) + + +def check_allowed_values(allowed_values, input_variable_path, input_values): + """Raises an exception if the input_values are not allowed + + Args: + allowed_values (dict): the allowed_values dict + input_variable_path (tuple): the path to the input variable + input_values (list/str/int/float/date/datetime): the values that we + are checking to see if they are in allowed_values + """ + these_allowed_values = list(allowed_values[input_variable_path].values()) + if (isinstance(input_values, list) + and not set(input_values).issubset( + set(these_allowed_values))): + invalid_values = ", ".join( + map(str, set(input_values) - set(these_allowed_values))), + raise ApiValueError( + "Invalid values for `%s` [%s], must be a subset of [%s]" % + ( + input_variable_path[0], + invalid_values, + ", ".join(map(str, these_allowed_values)) + ) + ) + elif (isinstance(input_values, dict) + and not set( + input_values.keys()).issubset(set(these_allowed_values))): + invalid_values = ", ".join( + map(str, set(input_values.keys()) - set(these_allowed_values))) + raise ApiValueError( + "Invalid keys in `%s` [%s], must be a subset of [%s]" % + ( + input_variable_path[0], + invalid_values, + ", ".join(map(str, these_allowed_values)) + ) + ) + elif (not isinstance(input_values, (list, dict)) + and input_values not in these_allowed_values): + raise ApiValueError( + "Invalid value for `%s` (%s), must be one of %s" % + ( + input_variable_path[0], + input_values, + these_allowed_values + ) + ) + + +def is_json_validation_enabled(schema_keyword, configuration=None): + """Returns true if JSON schema validation is enabled for the specified + validation keyword. This can be used to skip JSON schema structural validation + as requested in the configuration. + + Args: + schema_keyword (string): the name of a JSON schema validation keyword. + configuration (Configuration): the configuration class. + """ + + return (configuration is None or + not hasattr(configuration, '_disabled_client_side_validations') or + schema_keyword not in configuration._disabled_client_side_validations) + + +def check_validations( + validations, input_variable_path, input_values, + configuration=None): + """Raises an exception if the input_values are invalid + + Args: + validations (dict): the validation dictionary. + input_variable_path (tuple): the path to the input variable. + input_values (list/str/int/float/date/datetime): the values that we + are checking. + configuration (Configuration): the configuration class. + """ + + if input_values is None: + return + + current_validations = validations[input_variable_path] + if (is_json_validation_enabled('multipleOf', configuration) and + 'multiple_of' in current_validations and + isinstance(input_values, (int, float)) and + not (float(input_values) / current_validations['multiple_of']).is_integer()): + # Note 'multipleOf' will be as good as the floating point arithmetic. + raise ApiValueError( + "Invalid value for `%s`, value must be a multiple of " + "`%s`" % ( + input_variable_path[0], + current_validations['multiple_of'] + ) + ) + + if (is_json_validation_enabled('maxLength', configuration) and + 'max_length' in current_validations and + len(input_values) > current_validations['max_length']): + raise ApiValueError( + "Invalid value for `%s`, length must be less than or equal to " + "`%s`" % ( + input_variable_path[0], + current_validations['max_length'] + ) + ) + + if (is_json_validation_enabled('minLength', configuration) and + 'min_length' in current_validations and + len(input_values) < current_validations['min_length']): + raise ApiValueError( + "Invalid value for `%s`, length must be greater than or equal to " + "`%s`" % ( + input_variable_path[0], + current_validations['min_length'] + ) + ) + + if (is_json_validation_enabled('maxItems', configuration) and + 'max_items' in current_validations and + len(input_values) > current_validations['max_items']): + raise ApiValueError( + "Invalid value for `%s`, number of items must be less than or " + "equal to `%s`" % ( + input_variable_path[0], + current_validations['max_items'] + ) + ) + + if (is_json_validation_enabled('minItems', configuration) and + 'min_items' in current_validations and + len(input_values) < current_validations['min_items']): + raise ValueError( + "Invalid value for `%s`, number of items must be greater than or " + "equal to `%s`" % ( + input_variable_path[0], + current_validations['min_items'] + ) + ) + + items = ('exclusive_maximum', 'inclusive_maximum', 'exclusive_minimum', + 'inclusive_minimum') + if (any(item in current_validations for item in items)): + if isinstance(input_values, list): + max_val = max(input_values) + min_val = min(input_values) + elif isinstance(input_values, dict): + max_val = max(input_values.values()) + min_val = min(input_values.values()) + else: + max_val = input_values + min_val = input_values + + if (is_json_validation_enabled('exclusiveMaximum', configuration) and + 'exclusive_maximum' in current_validations and + max_val >= current_validations['exclusive_maximum']): + raise ApiValueError( + "Invalid value for `%s`, must be a value less than `%s`" % ( + input_variable_path[0], + current_validations['exclusive_maximum'] + ) + ) + + if (is_json_validation_enabled('maximum', configuration) and + 'inclusive_maximum' in current_validations and + max_val > current_validations['inclusive_maximum']): + raise ApiValueError( + "Invalid value for `%s`, must be a value less than or equal to " + "`%s`" % ( + input_variable_path[0], + current_validations['inclusive_maximum'] + ) + ) + + if (is_json_validation_enabled('exclusiveMinimum', configuration) and + 'exclusive_minimum' in current_validations and + min_val <= current_validations['exclusive_minimum']): + raise ApiValueError( + "Invalid value for `%s`, must be a value greater than `%s`" % + ( + input_variable_path[0], + current_validations['exclusive_maximum'] + ) + ) + + if (is_json_validation_enabled('minimum', configuration) and + 'inclusive_minimum' in current_validations and + min_val < current_validations['inclusive_minimum']): + raise ApiValueError( + "Invalid value for `%s`, must be a value greater than or equal " + "to `%s`" % ( + input_variable_path[0], + current_validations['inclusive_minimum'] + ) + ) + flags = current_validations.get('regex', {}).get('flags', 0) + if (is_json_validation_enabled('pattern', configuration) and + 'regex' in current_validations and + not re.search(current_validations['regex']['pattern'], + input_values, flags=flags)): + err_msg = r"Invalid value for `%s`, must match regular expression `%s`" % ( + input_variable_path[0], + current_validations['regex']['pattern'] + ) + if flags != 0: + # Don't print the regex flags if the flags are not + # specified in the OAS document. + err_msg = r"%s with flags=`%s`" % (err_msg, flags) + raise ApiValueError(err_msg) + + +def order_response_types(required_types): + """Returns the required types sorted in coercion order + + Args: + required_types (list/tuple): collection of classes or instance of + list or dict with class information inside it. + + Returns: + (list): coercion order sorted collection of classes or instance + of list or dict with class information inside it. + """ + + def index_getter(class_or_instance): + if isinstance(class_or_instance, list): + return COERCION_INDEX_BY_TYPE[list] + elif isinstance(class_or_instance, dict): + return COERCION_INDEX_BY_TYPE[dict] + elif (inspect.isclass(class_or_instance) + and issubclass(class_or_instance, ModelComposed)): + return COERCION_INDEX_BY_TYPE[ModelComposed] + elif (inspect.isclass(class_or_instance) + and issubclass(class_or_instance, ModelNormal)): + return COERCION_INDEX_BY_TYPE[ModelNormal] + elif (inspect.isclass(class_or_instance) + and issubclass(class_or_instance, ModelSimple)): + return COERCION_INDEX_BY_TYPE[ModelSimple] + elif class_or_instance in COERCION_INDEX_BY_TYPE: + return COERCION_INDEX_BY_TYPE[class_or_instance] + raise ApiValueError("Unsupported type: %s" % class_or_instance) + + sorted_types = sorted( + required_types, + key=lambda class_or_instance: index_getter(class_or_instance) + ) + return sorted_types + + +def remove_uncoercible(required_types_classes, current_item, spec_property_naming, + must_convert=True): + """Only keeps the type conversions that are possible + + Args: + required_types_classes (tuple): tuple of classes that are required + these should be ordered by COERCION_INDEX_BY_TYPE + spec_property_naming (bool): True if the variable names in the input + data are serialized names as specified in the OpenAPI document. + False if the variables names in the input data are python + variable names in PEP-8 snake case. + current_item (any): the current item (input data) to be converted + + Keyword Args: + must_convert (bool): if True the item to convert is of the wrong + type and we want a big list of coercibles + if False, we want a limited list of coercibles + + Returns: + (list): the remaining coercible required types, classes only + """ + current_type_simple = get_simple_class(current_item) + + results_classes = [] + for required_type_class in required_types_classes: + # convert our models to OpenApiModel + required_type_class_simplified = required_type_class + if isinstance(required_type_class_simplified, type): + if issubclass(required_type_class_simplified, ModelComposed): + required_type_class_simplified = ModelComposed + elif issubclass(required_type_class_simplified, ModelNormal): + required_type_class_simplified = ModelNormal + elif issubclass(required_type_class_simplified, ModelSimple): + required_type_class_simplified = ModelSimple + + if required_type_class_simplified == current_type_simple: + # don't consider converting to one's own class + continue + + class_pair = (current_type_simple, required_type_class_simplified) + if must_convert and class_pair in COERCIBLE_TYPE_PAIRS[spec_property_naming]: + results_classes.append(required_type_class) + elif class_pair in UPCONVERSION_TYPE_PAIRS: + results_classes.append(required_type_class) + return results_classes + +def get_discriminated_classes(cls): + """ + Returns all the classes that a discriminator converts to + TODO: lru_cache this + """ + possible_classes = [] + key = list(cls.discriminator.keys())[0] + if is_type_nullable(cls): + possible_classes.append(cls) + for discr_cls in cls.discriminator[key].values(): + if hasattr(discr_cls, 'discriminator') and discr_cls.discriminator is not None: + possible_classes.extend(get_discriminated_classes(discr_cls)) + else: + possible_classes.append(discr_cls) + return possible_classes + + +def get_possible_classes(cls, from_server_context): + # TODO: lru_cache this + possible_classes = [cls] + if from_server_context: + return possible_classes + if hasattr(cls, 'discriminator') and cls.discriminator is not None: + possible_classes = [] + possible_classes.extend(get_discriminated_classes(cls)) + elif issubclass(cls, ModelComposed): + possible_classes.extend(composed_model_input_classes(cls)) + return possible_classes + + +def get_required_type_classes(required_types_mixed, spec_property_naming): + """Converts the tuple required_types into a tuple and a dict described + below + + Args: + required_types_mixed (tuple/list): will contain either classes or + instance of list or dict + spec_property_naming (bool): if True these values came from the + server, and we use the data types in our endpoints. + If False, we are client side and we need to include + oneOf and discriminator classes inside the data types in our endpoints + + Returns: + (valid_classes, dict_valid_class_to_child_types_mixed): + valid_classes (tuple): the valid classes that the current item + should be + dict_valid_class_to_child_types_mixed (dict): + valid_class (class): this is the key + child_types_mixed (list/dict/tuple): describes the valid child + types + """ + valid_classes = [] + child_req_types_by_current_type = {} + for required_type in required_types_mixed: + if isinstance(required_type, list): + valid_classes.append(list) + child_req_types_by_current_type[list] = required_type + elif isinstance(required_type, tuple): + valid_classes.append(tuple) + child_req_types_by_current_type[tuple] = required_type + elif isinstance(required_type, dict): + valid_classes.append(dict) + child_req_types_by_current_type[dict] = required_type[str] + else: + valid_classes.extend(get_possible_classes(required_type, spec_property_naming)) + return tuple(valid_classes), child_req_types_by_current_type + + +def change_keys_js_to_python(input_dict, model_class): + """ + Converts from javascript_key keys in the input_dict to python_keys in + the output dict using the mapping in model_class. + If the input_dict contains a key which does not declared in the model_class, + the key is added to the output dict as is. The assumption is the model_class + may have undeclared properties (additionalProperties attribute in the OAS + document). + """ + + if getattr(model_class, 'attribute_map', None) is None: + return input_dict + output_dict = {} + reversed_attr_map = {value: key for key, value in + model_class.attribute_map.items()} + for javascript_key, value in input_dict.items(): + python_key = reversed_attr_map.get(javascript_key) + if python_key is None: + # if the key is unknown, it is in error or it is an + # additionalProperties variable + python_key = javascript_key + output_dict[python_key] = value + return output_dict + + +def get_type_error(var_value, path_to_item, valid_classes, key_type=False): + error_msg = type_error_message( + var_name=path_to_item[-1], + var_value=var_value, + valid_classes=valid_classes, + key_type=key_type + ) + return ApiTypeError( + error_msg, + path_to_item=path_to_item, + valid_classes=valid_classes, + key_type=key_type + ) + + +def deserialize_primitive(data, klass, path_to_item): + """Deserializes string to primitive type. + + :param data: str/int/float + :param klass: str/class the class to convert to + + :return: int, float, str, bool, date, datetime + """ + additional_message = "" + try: + if klass in {datetime, date}: + additional_message = ( + "If you need your parameter to have a fallback " + "string value, please set its type as `type: {}` in your " + "spec. That allows the value to be any type. " + ) + if klass == datetime: + if len(data) < 8: + raise ValueError("This is not a datetime") + # The string should be in iso8601 datetime format. + parsed_datetime = parse(data) + date_only = ( + parsed_datetime.hour == 0 and + parsed_datetime.minute == 0 and + parsed_datetime.second == 0 and + parsed_datetime.tzinfo is None and + 8 <= len(data) <= 10 + ) + if date_only: + raise ValueError("This is a date, not a datetime") + return parsed_datetime + elif klass == date: + if len(data) < 8: + raise ValueError("This is not a date") + return parse(data).date() + else: + converted_value = klass(data) + if isinstance(data, str) and klass == float: + if str(converted_value) != data: + # '7' -> 7.0 -> '7.0' != '7' + raise ValueError('This is not a float') + return converted_value + except (OverflowError, ValueError) as ex: + # parse can raise OverflowError + raise ApiValueError( + "{0}Failed to parse {1} as {2}".format( + additional_message, repr(data), klass.__name__ + ), + path_to_item=path_to_item + ) from ex + + +def get_discriminator_class(model_class, + discr_name, + discr_value, cls_visited): + """Returns the child class specified by the discriminator. + + Args: + model_class (OpenApiModel): the model class. + discr_name (string): the name of the discriminator property. + discr_value (any): the discriminator value. + cls_visited (list): list of model classes that have been visited. + Used to determine the discriminator class without + visiting circular references indefinitely. + + Returns: + used_model_class (class/None): the chosen child class that will be used + to deserialize the data, for example dog.Dog. + If a class is not found, None is returned. + """ + + if model_class in cls_visited: + # The class has already been visited and no suitable class was found. + return None + cls_visited.append(model_class) + used_model_class = None + if discr_name in model_class.discriminator: + class_name_to_discr_class = model_class.discriminator[discr_name] + used_model_class = class_name_to_discr_class.get(discr_value) + if used_model_class is None: + # We didn't find a discriminated class in class_name_to_discr_class. + # So look in the ancestor or descendant discriminators + # The discriminator mapping may exist in a descendant (anyOf, oneOf) + # or ancestor (allOf). + # Ancestor example: in the GrandparentAnimal -> ParentPet -> ChildCat + # hierarchy, the discriminator mappings may be defined at any level + # in the hierarchy. + # Descendant example: mammal -> whale/zebra/Pig -> BasquePig/DanishPig + # if we try to make BasquePig from mammal, we need to travel through + # the oneOf descendant discriminators to find BasquePig + descendant_classes = model_class._composed_schemas.get('oneOf', ()) + \ + model_class._composed_schemas.get('anyOf', ()) + ancestor_classes = model_class._composed_schemas.get('allOf', ()) + possible_classes = descendant_classes + ancestor_classes + for cls in possible_classes: + # Check if the schema has inherited discriminators. + if hasattr(cls, 'discriminator') and cls.discriminator is not None: + used_model_class = get_discriminator_class( + cls, discr_name, discr_value, cls_visited) + if used_model_class is not None: + return used_model_class + return used_model_class + + +def deserialize_model(model_data, model_class, path_to_item, check_type, + configuration, spec_property_naming): + """Deserializes model_data to model instance. + + Args: + model_data (int/str/float/bool/none_type/list/dict): data to instantiate the model + model_class (OpenApiModel): the model class + path_to_item (list): path to the model in the received data + check_type (bool): whether to check the data tupe for the values in + the model + configuration (Configuration): the instance to use to convert files + spec_property_naming (bool): True if the variable names in the input + data are serialized names as specified in the OpenAPI document. + False if the variables names in the input data are python + variable names in PEP-8 snake case. + + Returns: + model instance + + Raise: + ApiTypeError + ApiValueError + ApiKeyError + """ + + kw_args = dict(_check_type=check_type, + _path_to_item=path_to_item, + _configuration=configuration, + _spec_property_naming=spec_property_naming) + + if issubclass(model_class, ModelSimple): + return model_class._new_from_openapi_data(model_data, **kw_args) + elif isinstance(model_data, list): + return model_class._new_from_openapi_data(*model_data, **kw_args) + if isinstance(model_data, dict): + kw_args.update(model_data) + return model_class._new_from_openapi_data(**kw_args) + elif isinstance(model_data, PRIMITIVE_TYPES): + return model_class._new_from_openapi_data(model_data, **kw_args) + + +def deserialize_file(response_data, configuration, content_disposition=None): + """Deserializes body to file + + Saves response body into a file in a temporary folder, + using the filename from the `Content-Disposition` header if provided. + + Args: + param response_data (str): the file data to write + configuration (Configuration): the instance to use to convert files + + Keyword Args: + content_disposition (str): the value of the Content-Disposition + header + + Returns: + (file_type): the deserialized file which is open + The user is responsible for closing and reading the file + """ + fd, path = tempfile.mkstemp(dir=configuration.temp_folder_path) + os.close(fd) + os.remove(path) + + if content_disposition: + filename = re.search(r'filename=[\'"]?([^\'"\s]+)[\'"]?', + content_disposition).group(1) + path = os.path.join(os.path.dirname(path), filename) + + with open(path, "wb") as f: + if isinstance(response_data, str): + # change str to bytes so we can write it + response_data = response_data.encode('utf-8') + f.write(response_data) + + f = open(path, "rb") + return f + + +def attempt_convert_item(input_value, valid_classes, path_to_item, + configuration, spec_property_naming, key_type=False, + must_convert=False, check_type=True): + """ + Args: + input_value (any): the data to convert + valid_classes (any): the classes that are valid + path_to_item (list): the path to the item to convert + configuration (Configuration): the instance to use to convert files + spec_property_naming (bool): True if the variable names in the input + data are serialized names as specified in the OpenAPI document. + False if the variables names in the input data are python + variable names in PEP-8 snake case. + key_type (bool): if True we need to convert a key type (not supported) + must_convert (bool): if True we must convert + check_type (bool): if True we check the type or the returned data in + ModelComposed/ModelNormal/ModelSimple instances + + Returns: + instance (any) the fixed item + + Raises: + ApiTypeError + ApiValueError + ApiKeyError + """ + valid_classes_ordered = order_response_types(valid_classes) + valid_classes_coercible = remove_uncoercible( + valid_classes_ordered, input_value, spec_property_naming) + if not valid_classes_coercible or key_type: + # we do not handle keytype errors, json will take care + # of this for us + if configuration is None or not configuration.discard_unknown_keys: + raise get_type_error(input_value, path_to_item, valid_classes, + key_type=key_type) + for valid_class in valid_classes_coercible: + try: + if issubclass(valid_class, OpenApiModel): + return deserialize_model(input_value, valid_class, + path_to_item, check_type, + configuration, spec_property_naming) + elif valid_class == file_type: + return deserialize_file(input_value, configuration) + return deserialize_primitive(input_value, valid_class, + path_to_item) + except (ApiTypeError, ApiValueError, ApiKeyError) as conversion_exc: + if must_convert: + raise conversion_exc + # if we have conversion errors when must_convert == False + # we ignore the exception and move on to the next class + continue + # we were unable to convert, must_convert == False + return input_value + + +def is_type_nullable(input_type): + """ + Returns true if None is an allowed value for the specified input_type. + + A type is nullable if at least one of the following conditions is true: + 1. The OAS 'nullable' attribute has been specified, + 1. The type is the 'null' type, + 1. The type is a anyOf/oneOf composed schema, and a child schema is + the 'null' type. + Args: + input_type (type): the class of the input_value that we are + checking + Returns: + bool + """ + if input_type is none_type: + return True + if issubclass(input_type, OpenApiModel) and input_type._nullable: + return True + if issubclass(input_type, ModelComposed): + # If oneOf/anyOf, check if the 'null' type is one of the allowed types. + for t in input_type._composed_schemas.get('oneOf', ()): + if is_type_nullable(t): return True + for t in input_type._composed_schemas.get('anyOf', ()): + if is_type_nullable(t): return True + return False + + +def is_valid_type(input_class_simple, valid_classes): + """ + Args: + input_class_simple (class): the class of the input_value that we are + checking + valid_classes (tuple): the valid classes that the current item + should be + Returns: + bool + """ + valid_type = input_class_simple in valid_classes + if not valid_type and ( + issubclass(input_class_simple, OpenApiModel) or + input_class_simple is none_type): + for valid_class in valid_classes: + if input_class_simple is none_type and is_type_nullable(valid_class): + # Schema is oneOf/anyOf and the 'null' type is one of the allowed types. + return True + if not (issubclass(valid_class, OpenApiModel) and valid_class.discriminator): + continue + discr_propertyname_py = list(valid_class.discriminator.keys())[0] + discriminator_classes = ( + valid_class.discriminator[discr_propertyname_py].values() + ) + valid_type = is_valid_type(input_class_simple, discriminator_classes) + if valid_type: + return True + return valid_type + + +def validate_and_convert_types(input_value, required_types_mixed, path_to_item, + spec_property_naming, _check_type, configuration=None): + """Raises a TypeError is there is a problem, otherwise returns value + + Args: + input_value (any): the data to validate/convert + required_types_mixed (list/dict/tuple): A list of + valid classes, or a list tuples of valid classes, or a dict where + the value is a tuple of value classes + path_to_item: (list) the path to the data being validated + this stores a list of keys or indices to get to the data being + validated + spec_property_naming (bool): True if the variable names in the input + data are serialized names as specified in the OpenAPI document. + False if the variables names in the input data are python + variable names in PEP-8 snake case. + _check_type: (boolean) if true, type will be checked and conversion + will be attempted. + configuration: (Configuration): the configuration class to use + when converting file_type items. + If passed, conversion will be attempted when possible + If not passed, no conversions will be attempted and + exceptions will be raised + + Returns: + the correctly typed value + + Raises: + ApiTypeError + """ + results = get_required_type_classes(required_types_mixed, spec_property_naming) + valid_classes, child_req_types_by_current_type = results + + input_class_simple = get_simple_class(input_value) + valid_type = is_valid_type(input_class_simple, valid_classes) + if not valid_type: + if configuration: + # if input_value is not valid_type try to convert it + converted_instance = attempt_convert_item( + input_value, + valid_classes, + path_to_item, + configuration, + spec_property_naming, + key_type=False, + must_convert=True, + check_type=_check_type + ) + return converted_instance + else: + raise get_type_error(input_value, path_to_item, valid_classes, + key_type=False) + + # input_value's type is in valid_classes + if len(valid_classes) > 1 and configuration: + # there are valid classes which are not the current class + valid_classes_coercible = remove_uncoercible( + valid_classes, input_value, spec_property_naming, must_convert=False) + if valid_classes_coercible: + converted_instance = attempt_convert_item( + input_value, + valid_classes_coercible, + path_to_item, + configuration, + spec_property_naming, + key_type=False, + must_convert=False, + check_type=_check_type + ) + return converted_instance + + if child_req_types_by_current_type == {}: + # all types are of the required types and there are no more inner + # variables left to look at + return input_value + inner_required_types = child_req_types_by_current_type.get( + type(input_value) + ) + if inner_required_types is None: + # for this type, there are not more inner variables left to look at + return input_value + if isinstance(input_value, list): + if input_value == []: + # allow an empty list + return input_value + for index, inner_value in enumerate(input_value): + inner_path = list(path_to_item) + inner_path.append(index) + input_value[index] = validate_and_convert_types( + inner_value, + inner_required_types, + inner_path, + spec_property_naming, + _check_type, + configuration=configuration + ) + elif isinstance(input_value, dict): + if input_value == {}: + # allow an empty dict + return input_value + for inner_key, inner_val in input_value.items(): + inner_path = list(path_to_item) + inner_path.append(inner_key) + if get_simple_class(inner_key) != str: + raise get_type_error(inner_key, inner_path, valid_classes, + key_type=True) + input_value[inner_key] = validate_and_convert_types( + inner_val, + inner_required_types, + inner_path, + spec_property_naming, + _check_type, + configuration=configuration + ) + return input_value + + +def model_to_dict(model_instance, serialize=True): + """Returns the model properties as a dict + + Args: + model_instance (one of your model instances): the model instance that + will be converted to a dict. + + Keyword Args: + serialize (bool): if True, the keys in the dict will be values from + attribute_map + """ + result = {} + + model_instances = [model_instance] + if model_instance._composed_schemas: + model_instances.extend(model_instance._composed_instances) + seen_json_attribute_names = set() + used_fallback_python_attribute_names = set() + py_to_json_map = {} + for model_instance in model_instances: + for attr, value in model_instance._data_store.items(): + if serialize: + # we use get here because additional property key names do not + # exist in attribute_map + try: + attr = model_instance.attribute_map[attr] + py_to_json_map.update(model_instance.attribute_map) + seen_json_attribute_names.add(attr) + except KeyError: + used_fallback_python_attribute_names.add(attr) + if isinstance(value, list): + if not value: + # empty list or None + result[attr] = value + else: + res = [] + for v in value: + if isinstance(v, PRIMITIVE_TYPES) or v is None: + res.append(v) + elif isinstance(v, ModelSimple): + res.append(v.value) + else: + res.append(model_to_dict(v, serialize=serialize)) + result[attr] = res + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], + model_to_dict(item[1], serialize=serialize)) + if hasattr(item[1], '_data_store') else item, + value.items() + )) + elif isinstance(value, ModelSimple): + result[attr] = value.value + elif hasattr(value, '_data_store'): + result[attr] = model_to_dict(value, serialize=serialize) + else: + result[attr] = value + if serialize: + for python_key in used_fallback_python_attribute_names: + json_key = py_to_json_map.get(python_key) + if json_key is None: + continue + if python_key == json_key: + continue + json_key_assigned_no_need_for_python_key = json_key in seen_json_attribute_names + if json_key_assigned_no_need_for_python_key: + del result[python_key] + + return result + + +def type_error_message(var_value=None, var_name=None, valid_classes=None, + key_type=None): + """ + Keyword Args: + var_value (any): the variable which has the type_error + var_name (str): the name of the variable which has the typ error + valid_classes (tuple): the accepted classes for current_item's + value + key_type (bool): False if our value is a value in a dict + True if it is a key in a dict + False if our item is an item in a list + """ + key_or_value = 'value' + if key_type: + key_or_value = 'key' + valid_classes_phrase = get_valid_classes_phrase(valid_classes) + msg = ( + "Invalid type for variable '{0}'. Required {1} type {2} and " + "passed type was {3}".format( + var_name, + key_or_value, + valid_classes_phrase, + type(var_value).__name__, + ) + ) + return msg + + +def get_valid_classes_phrase(input_classes): + """Returns a string phrase describing what types are allowed + """ + all_classes = list(input_classes) + all_classes = sorted(all_classes, key=lambda cls: cls.__name__) + all_class_names = [cls.__name__ for cls in all_classes] + if len(all_class_names) == 1: + return 'is {0}'.format(all_class_names[0]) + return "is one of [{0}]".format(", ".join(all_class_names)) + + +def get_allof_instances(self, model_args, constant_args): + """ + Args: + self: the class we are handling + model_args (dict): var_name to var_value + used to make instances + constant_args (dict): + metadata arguments: + _check_type + _path_to_item + _spec_property_naming + _configuration + _visited_composed_classes + + Returns + composed_instances (list) + """ + composed_instances = [] + for allof_class in self._composed_schemas['allOf']: + + try: + allof_instance = allof_class(**model_args, **constant_args) + composed_instances.append(allof_instance) + except Exception as ex: + raise ApiValueError( + "Invalid inputs given to generate an instance of '%s'. The " + "input data was invalid for the allOf schema '%s' in the composed " + "schema '%s'. Error=%s" % ( + allof_class.__name__, + allof_class.__name__, + self.__class__.__name__, + str(ex) + ) + ) from ex + return composed_instances + + +def get_oneof_instance(cls, model_kwargs, constant_kwargs, model_arg=None): + """ + Find the oneOf schema that matches the input data (e.g. payload). + If exactly one schema matches the input data, an instance of that schema + is returned. + If zero or more than one schema match the input data, an exception is raised. + In OAS 3.x, the payload MUST, by validation, match exactly one of the + schemas described by oneOf. + + Args: + cls: the class we are handling + model_kwargs (dict): var_name to var_value + The input data, e.g. the payload that must match a oneOf schema + in the OpenAPI document. + constant_kwargs (dict): var_name to var_value + args that every model requires, including configuration, server + and path to item. + + Kwargs: + model_arg: (int, float, bool, str, date, datetime, ModelSimple, None): + the value to assign to a primitive class or ModelSimple class + Notes: + - this is only passed in when oneOf includes types which are not object + - None is used to suppress handling of model_arg, nullable models are handled in __new__ + + Returns + oneof_instance (instance) + """ + if len(cls._composed_schemas['oneOf']) == 0: + return None + + oneof_instances = [] + # Iterate over each oneOf schema and determine if the input data + # matches the oneOf schemas. + for oneof_class in cls._composed_schemas['oneOf']: + # The composed oneOf schema allows the 'null' type and the input data + # is the null value. This is a OAS >= 3.1 feature. + if oneof_class is none_type: + # skip none_types because we are deserializing dict data. + # none_type deserialization is handled in the __new__ method + continue + + single_value_input = allows_single_value_input(oneof_class) + + try: + if not single_value_input: + oneof_instance = oneof_class(**model_kwargs, **constant_kwargs) + else: + if issubclass(oneof_class, ModelSimple): + oneof_instance = oneof_class(model_arg, **constant_kwargs) + elif oneof_class in PRIMITIVE_TYPES: + oneof_instance = validate_and_convert_types( + model_arg, + (oneof_class,), + constant_kwargs['_path_to_item'], + constant_kwargs['_spec_property_naming'], + constant_kwargs['_check_type'], + configuration=constant_kwargs['_configuration'] + ) + oneof_instances.append(oneof_instance) + except Exception: + pass + if len(oneof_instances) == 0: + raise ApiValueError( + "Invalid inputs given to generate an instance of %s. None " + "of the oneOf schemas matched the input data." % + cls.__name__ + ) + elif len(oneof_instances) > 1: + raise ApiValueError( + "Invalid inputs given to generate an instance of %s. Multiple " + "oneOf schemas matched the inputs, but a max of one is allowed." % + cls.__name__ + ) + return oneof_instances[0] + + +def get_anyof_instances(self, model_args, constant_args): + """ + Args: + self: the class we are handling + model_args (dict): var_name to var_value + The input data, e.g. the payload that must match at least one + anyOf child schema in the OpenAPI document. + constant_args (dict): var_name to var_value + args that every model requires, including configuration, server + and path to item. + + Returns + anyof_instances (list) + """ + anyof_instances = [] + if len(self._composed_schemas['anyOf']) == 0: + return anyof_instances + + for anyof_class in self._composed_schemas['anyOf']: + # The composed oneOf schema allows the 'null' type and the input data + # is the null value. This is a OAS >= 3.1 feature. + if anyof_class is none_type: + # skip none_types because we are deserializing dict data. + # none_type deserialization is handled in the __new__ method + continue + + try: + anyof_instance = anyof_class(**model_args, **constant_args) + anyof_instances.append(anyof_instance) + except Exception: + pass + if len(anyof_instances) == 0: + raise ApiValueError( + "Invalid inputs given to generate an instance of %s. None of the " + "anyOf schemas matched the inputs." % + self.__class__.__name__ + ) + return anyof_instances + + +def get_discarded_args(self, composed_instances, model_args): + """ + Gathers the args that were discarded by configuration.discard_unknown_keys + """ + model_arg_keys = model_args.keys() + discarded_args = set() + # arguments passed to self were already converted to python names + # before __init__ was called + for instance in composed_instances: + if instance.__class__ in self._composed_schemas['allOf']: + try: + keys = instance.to_dict().keys() + discarded_keys = model_args - keys + discarded_args.update(discarded_keys) + except Exception: + # allOf integer schema will throw exception + pass + else: + try: + all_keys = set(model_to_dict(instance, serialize=False).keys()) + js_keys = model_to_dict(instance, serialize=True).keys() + all_keys.update(js_keys) + discarded_keys = model_arg_keys - all_keys + discarded_args.update(discarded_keys) + except Exception: + # allOf integer schema will throw exception + pass + return discarded_args + + +def validate_get_composed_info(constant_args, model_args, self): + """ + For composed schemas, generate schema instances for + all schemas in the oneOf/anyOf/allOf definition. If additional + properties are allowed, also assign those properties on + all matched schemas that contain additionalProperties. + Openapi schemas are python classes. + + Exceptions are raised if: + - 0 or > 1 oneOf schema matches the model_args input data + - no anyOf schema matches the model_args input data + - any of the allOf schemas do not match the model_args input data + + Args: + constant_args (dict): these are the args that every model requires + model_args (dict): these are the required and optional spec args that + were passed in to make this model + self (class): the class that we are instantiating + This class contains self._composed_schemas + + Returns: + composed_info (list): length three + composed_instances (list): the composed instances which are not + self + var_name_to_model_instances (dict): a dict going from var_name + to the model_instance which holds that var_name + the model_instance may be self or an instance of one of the + classes in self.composed_instances() + additional_properties_model_instances (list): a list of the + model instances which have the property + additional_properties_type. This list can include self + """ + # create composed_instances + composed_instances = [] + allof_instances = get_allof_instances(self, model_args, constant_args) + composed_instances.extend(allof_instances) + oneof_instance = get_oneof_instance(self.__class__, model_args, constant_args) + if oneof_instance is not None: + composed_instances.append(oneof_instance) + anyof_instances = get_anyof_instances(self, model_args, constant_args) + composed_instances.extend(anyof_instances) + """ + set additional_properties_model_instances + additional properties must be evaluated at the schema level + so self's additional properties are most important + If self is a composed schema with: + - no properties defined in self + - additionalProperties: False + Then for object payloads every property is an additional property + and they are not allowed, so only empty dict is allowed + + Properties must be set on all matching schemas + so when a property is assigned toa composed instance, it must be set on all + composed instances regardless of additionalProperties presence + keeping it to prevent breaking changes in v5.0.1 + TODO remove cls._additional_properties_model_instances in 6.0.0 + """ + additional_properties_model_instances = [] + if self.additional_properties_type is not None: + additional_properties_model_instances = [self] + + """ + no need to set properties on self in here, they will be set in __init__ + By here all composed schema oneOf/anyOf/allOf instances have their properties set using + model_args + """ + discarded_args = get_discarded_args(self, composed_instances, model_args) + + # map variable names to composed_instances + var_name_to_model_instances = {} + for prop_name in model_args: + if prop_name not in discarded_args: + var_name_to_model_instances[prop_name] = [self] + composed_instances + + return [ + composed_instances, + var_name_to_model_instances, + additional_properties_model_instances, + discarded_args + ] diff --git a/purplship/models/__init__.py b/purplship/models/__init__.py index bb57525..f28e28c 100644 --- a/purplship/models/__init__.py +++ b/purplship/models/__init__.py @@ -1,70 +1,66 @@ -# coding: utf-8 - # flake8: noqa -""" - Purplship API - - ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.6.2`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 - - OpenAPI spec version: 2021.6.2 - Contact: hello@purplship.com - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" -from __future__ import absolute_import +# import all models into this package +# if you have many models here with many references from one model to another this may +# raise a RecursionError +# to avoid this, import only the models that you directly need like: +# from from purplship.model.pet import Pet +# or import this package, but before doing it, use: +# import sys +# sys.setrecursionlimit(n) -# import models into model package -from purplship.models.access_token import AccessToken -from purplship.models.address import Address -from purplship.models.address_data import AddressData -from purplship.models.address_list import AddressList -from purplship.models.address_validation import AddressValidation -from purplship.models.carrier_list import CarrierList -from purplship.models.carrier_settings import CarrierSettings -from purplship.models.charge import Charge -from purplship.models.commodity import Commodity -from purplship.models.commodity_data import CommodityData -from purplship.models.customs import Customs -from purplship.models.customs_data import CustomsData -from purplship.models.customs_list import CustomsList -from purplship.models.duty import Duty -from purplship.models.error_response import ErrorResponse -from purplship.models.message import Message -from purplship.models.operation import Operation -from purplship.models.operation_confirmation import OperationConfirmation -from purplship.models.operation_response import OperationResponse -from purplship.models.parcel import Parcel -from purplship.models.parcel_data import ParcelData -from purplship.models.parcel_list import ParcelList -from purplship.models.payment import Payment -from purplship.models.pickup import Pickup -from purplship.models.pickup_cancel_data import PickupCancelData -from purplship.models.pickup_cancel_request import PickupCancelRequest -from purplship.models.pickup_data import PickupData -from purplship.models.pickup_list import PickupList -from purplship.models.pickup_request import PickupRequest -from purplship.models.pickup_response import PickupResponse -from purplship.models.pickup_update_data import PickupUpdateData -from purplship.models.pickup_update_request import PickupUpdateRequest -from purplship.models.rate import Rate -from purplship.models.rate_request import RateRequest -from purplship.models.rate_response import RateResponse -from purplship.models.references import References -from purplship.models.shipment import Shipment -from purplship.models.shipment_cancel_request import ShipmentCancelRequest -from purplship.models.shipment_data import ShipmentData -from purplship.models.shipment_list import ShipmentList -from purplship.models.shipment_purchase_data import ShipmentPurchaseData -from purplship.models.shipping_request import ShippingRequest -from purplship.models.token_obtain_pair import TokenObtainPair -from purplship.models.token_pair import TokenPair -from purplship.models.token_refresh import TokenRefresh -from purplship.models.token_verify import TokenVerify -from purplship.models.tracker_list import TrackerList -from purplship.models.tracking_event import TrackingEvent -from purplship.models.tracking_response import TrackingResponse -from purplship.models.tracking_status import TrackingStatus -from purplship.models.webhook import Webhook -from purplship.models.webhook_data import WebhookData -from purplship.models.webhook_list import WebhookList -from purplship.models.webhook_test_request import WebhookTestRequest +from purplship.model.access_token import AccessToken +from purplship.model.address import Address +from purplship.model.address_data import AddressData +from purplship.model.address_list import AddressList +from purplship.model.address_validation import AddressValidation +from purplship.model.carrier_list import CarrierList +from purplship.model.carrier_settings import CarrierSettings +from purplship.model.charge import Charge +from purplship.model.commodity import Commodity +from purplship.model.commodity_data import CommodityData +from purplship.model.customs import Customs +from purplship.model.customs_data import CustomsData +from purplship.model.customs_list import CustomsList +from purplship.model.duty import Duty +from purplship.model.error_response import ErrorResponse +from purplship.model.message import Message +from purplship.model.operation import Operation +from purplship.model.operation_confirmation import OperationConfirmation +from purplship.model.operation_response import OperationResponse +from purplship.model.parcel import Parcel +from purplship.model.parcel_data import ParcelData +from purplship.model.parcel_list import ParcelList +from purplship.model.payment import Payment +from purplship.model.pickup import Pickup +from purplship.model.pickup_cancel_data import PickupCancelData +from purplship.model.pickup_cancel_request import PickupCancelRequest +from purplship.model.pickup_data import PickupData +from purplship.model.pickup_list import PickupList +from purplship.model.pickup_request import PickupRequest +from purplship.model.pickup_response import PickupResponse +from purplship.model.pickup_update_data import PickupUpdateData +from purplship.model.pickup_update_request import PickupUpdateRequest +from purplship.model.rate import Rate +from purplship.model.rate_request import RateRequest +from purplship.model.rate_response import RateResponse +from purplship.model.references import References +from purplship.model.shipment import Shipment +from purplship.model.shipment_cancel_request import ShipmentCancelRequest +from purplship.model.shipment_data import ShipmentData +from purplship.model.shipment_list import ShipmentList +from purplship.model.shipment_purchase_data import ShipmentPurchaseData +from purplship.model.shipment_rate_data import ShipmentRateData +from purplship.model.shipping_request import ShippingRequest +from purplship.model.token_obtain_pair import TokenObtainPair +from purplship.model.token_pair import TokenPair +from purplship.model.token_refresh import TokenRefresh +from purplship.model.token_verify import TokenVerify +from purplship.model.tracker_list import TrackerList +from purplship.model.tracking_event import TrackingEvent +from purplship.model.tracking_response import TrackingResponse +from purplship.model.tracking_status import TrackingStatus +from purplship.model.webhook import Webhook +from purplship.model.webhook_data import WebhookData +from purplship.model.webhook_list import WebhookList +from purplship.model.webhook_test_request import WebhookTestRequest diff --git a/purplship/models/access_token.py b/purplship/models/access_token.py deleted file mode 100644 index 4e3bf85..0000000 --- a/purplship/models/access_token.py +++ /dev/null @@ -1,111 +0,0 @@ -# coding: utf-8 - -""" - Purplship API - - ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.6.2`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 - - OpenAPI spec version: 2021.6.2 - Contact: hello@purplship.com - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - -import pprint -import re # noqa: F401 - -import six - -class AccessToken(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'access': 'str' - } - - attribute_map = { - 'access': 'access' - } - - def __init__(self, access=None): # noqa: E501 - """AccessToken - a model defined in Swagger""" # noqa: E501 - self._access = None - self.discriminator = None - self.access = access - - @property - def access(self): - """Gets the access of this AccessToken. # noqa: E501 - - - :return: The access of this AccessToken. # noqa: E501 - :rtype: str - """ - return self._access - - @access.setter - def access(self, access): - """Sets the access of this AccessToken. - - - :param access: The access of this AccessToken. # noqa: E501 - :type: str - """ - if access is None: - raise ValueError("Invalid value for `access`, must not be `None`") # noqa: E501 - - self._access = access - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(AccessToken, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, AccessToken): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/purplship/models/address.py b/purplship/models/address.py deleted file mode 100644 index 32771b5..0000000 --- a/purplship/models/address.py +++ /dev/null @@ -1,565 +0,0 @@ -# coding: utf-8 - -""" - Purplship API - - ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.6.2`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 - - OpenAPI spec version: 2021.6.2 - Contact: hello@purplship.com - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - -import pprint -import re # noqa: F401 - -import six - -class Address(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'id': 'str', - 'postal_code': 'str', - 'city': 'str', - 'federal_tax_id': 'str', - 'state_tax_id': 'str', - 'person_name': 'str', - 'company_name': 'str', - 'country_code': 'str', - 'email': 'str', - 'phone_number': 'str', - 'state_code': 'str', - 'suburb': 'str', - 'residential': 'bool', - 'address_line1': 'str', - 'address_line2': 'str', - 'validate_location': 'bool', - 'validation': 'AddressValidation' - } - - attribute_map = { - 'id': 'id', - 'postal_code': 'postal_code', - 'city': 'city', - 'federal_tax_id': 'federal_tax_id', - 'state_tax_id': 'state_tax_id', - 'person_name': 'person_name', - 'company_name': 'company_name', - 'country_code': 'country_code', - 'email': 'email', - 'phone_number': 'phone_number', - 'state_code': 'state_code', - 'suburb': 'suburb', - 'residential': 'residential', - 'address_line1': 'address_line1', - 'address_line2': 'address_line2', - 'validate_location': 'validate_location', - 'validation': 'validation' - } - - def __init__(self, id=None, postal_code=None, city=None, federal_tax_id=None, state_tax_id=None, person_name=None, company_name=None, country_code=None, email=None, phone_number=None, state_code=None, suburb=None, residential=False, address_line1=None, address_line2=None, validate_location=False, validation=None): # noqa: E501 - """Address - a model defined in Swagger""" # noqa: E501 - self._id = None - self._postal_code = None - self._city = None - self._federal_tax_id = None - self._state_tax_id = None - self._person_name = None - self._company_name = None - self._country_code = None - self._email = None - self._phone_number = None - self._state_code = None - self._suburb = None - self._residential = None - self._address_line1 = None - self._address_line2 = None - self._validate_location = None - self._validation = None - self.discriminator = None - if id is not None: - self.id = id - if postal_code is not None: - self.postal_code = postal_code - if city is not None: - self.city = city - if federal_tax_id is not None: - self.federal_tax_id = federal_tax_id - if state_tax_id is not None: - self.state_tax_id = state_tax_id - if person_name is not None: - self.person_name = person_name - if company_name is not None: - self.company_name = company_name - self.country_code = country_code - if email is not None: - self.email = email - if phone_number is not None: - self.phone_number = phone_number - if state_code is not None: - self.state_code = state_code - if suburb is not None: - self.suburb = suburb - if residential is not None: - self.residential = residential - if address_line1 is not None: - self.address_line1 = address_line1 - if address_line2 is not None: - self.address_line2 = address_line2 - if validate_location is not None: - self.validate_location = validate_location - if validation is not None: - self.validation = validation - - @property - def id(self): - """Gets the id of this Address. # noqa: E501 - - A unique identifier # noqa: E501 - - :return: The id of this Address. # noqa: E501 - :rtype: str - """ - return self._id - - @id.setter - def id(self, id): - """Sets the id of this Address. - - A unique identifier # noqa: E501 - - :param id: The id of this Address. # noqa: E501 - :type: str - """ - - self._id = id - - @property - def postal_code(self): - """Gets the postal_code of this Address. # noqa: E501 - - The address postal code **(required for shipment purchase)** # noqa: E501 - - :return: The postal_code of this Address. # noqa: E501 - :rtype: str - """ - return self._postal_code - - @postal_code.setter - def postal_code(self, postal_code): - """Sets the postal_code of this Address. - - The address postal code **(required for shipment purchase)** # noqa: E501 - - :param postal_code: The postal_code of this Address. # noqa: E501 - :type: str - """ - - self._postal_code = postal_code - - @property - def city(self): - """Gets the city of this Address. # noqa: E501 - - The address city. **(required for shipment purchase)** # noqa: E501 - - :return: The city of this Address. # noqa: E501 - :rtype: str - """ - return self._city - - @city.setter - def city(self, city): - """Sets the city of this Address. - - The address city. **(required for shipment purchase)** # noqa: E501 - - :param city: The city of this Address. # noqa: E501 - :type: str - """ - - self._city = city - - @property - def federal_tax_id(self): - """Gets the federal_tax_id of this Address. # noqa: E501 - - The party frederal tax id # noqa: E501 - - :return: The federal_tax_id of this Address. # noqa: E501 - :rtype: str - """ - return self._federal_tax_id - - @federal_tax_id.setter - def federal_tax_id(self, federal_tax_id): - """Sets the federal_tax_id of this Address. - - The party frederal tax id # noqa: E501 - - :param federal_tax_id: The federal_tax_id of this Address. # noqa: E501 - :type: str - """ - - self._federal_tax_id = federal_tax_id - - @property - def state_tax_id(self): - """Gets the state_tax_id of this Address. # noqa: E501 - - The party state id # noqa: E501 - - :return: The state_tax_id of this Address. # noqa: E501 - :rtype: str - """ - return self._state_tax_id - - @state_tax_id.setter - def state_tax_id(self, state_tax_id): - """Sets the state_tax_id of this Address. - - The party state id # noqa: E501 - - :param state_tax_id: The state_tax_id of this Address. # noqa: E501 - :type: str - """ - - self._state_tax_id = state_tax_id - - @property - def person_name(self): - """Gets the person_name of this Address. # noqa: E501 - - attention to **(required for shipment purchase)** # noqa: E501 - - :return: The person_name of this Address. # noqa: E501 - :rtype: str - """ - return self._person_name - - @person_name.setter - def person_name(self, person_name): - """Sets the person_name of this Address. - - attention to **(required for shipment purchase)** # noqa: E501 - - :param person_name: The person_name of this Address. # noqa: E501 - :type: str - """ - - self._person_name = person_name - - @property - def company_name(self): - """Gets the company_name of this Address. # noqa: E501 - - The company name if the party is a company # noqa: E501 - - :return: The company_name of this Address. # noqa: E501 - :rtype: str - """ - return self._company_name - - @company_name.setter - def company_name(self, company_name): - """Sets the company_name of this Address. - - The company name if the party is a company # noqa: E501 - - :param company_name: The company_name of this Address. # noqa: E501 - :type: str - """ - - self._company_name = company_name - - @property - def country_code(self): - """Gets the country_code of this Address. # noqa: E501 - - The address country code # noqa: E501 - - :return: The country_code of this Address. # noqa: E501 - :rtype: str - """ - return self._country_code - - @country_code.setter - def country_code(self, country_code): - """Sets the country_code of this Address. - - The address country code # noqa: E501 - - :param country_code: The country_code of this Address. # noqa: E501 - :type: str - """ - if country_code is None: - raise ValueError("Invalid value for `country_code`, must not be `None`") # noqa: E501 - allowed_values = ["AD", "AE", "AF", "AG", "AI", "AL", "AM", "AN", "AO", "AR", "AS", "AT", "AU", "AW", "AZ", "BA", "BB", "BD", "BE", "BF", "BG", "BH", "BI", "BJ", "BM", "BN", "BO", "BR", "BS", "BT", "BW", "BY", "BZ", "CA", "CD", "CF", "CG", "CH", "CI", "CK", "CL", "CM", "CN", "CO", "CR", "CU", "CV", "CY", "CZ", "DE", "DJ", "DK", "DM", "DO", "DZ", "EC", "EE", "EG", "ER", "ES", "ET", "FI", "FJ", "FK", "FM", "FO", "FR", "GA", "GB", "GD", "GE", "GF", "GG", "GH", "GI", "GL", "GM", "GN", "GP", "GQ", "GR", "GT", "GU", "GW", "GY", "HK", "HN", "HR", "HT", "HU", "IC", "ID", "IE", "IL", "IN", "IQ", "IR", "IS", "IT", "JE", "JM", "JO", "JP", "KE", "KG", "KH", "KI", "KM", "KN", "KP", "KR", "KV", "KW", "KY", "KZ", "LA", "LB", "LC", "LI", "LK", "LR", "LS", "LT", "LU", "LV", "LY", "MA", "MC", "MD", "ME", "MG", "MH", "MK", "ML", "MM", "MN", "MO", "MP", "MQ", "MR", "MS", "MT", "MU", "MV", "MW", "MX", "MY", "MZ", "NA", "NC", "NE", "NG", "NI", "NL", "NO", "NP", "NR", "NU", "NZ", "OM", "PA", "PE", "PF", "PG", "PH", "PK", "PL", "PR", "PT", "PW", "PY", "QA", "RE", "RO", "RS", "RU", "RW", "SA", "SB", "SC", "SD", "SE", "SG", "SH", "SI", "SK", "SL", "SM", "SN", "SO", "SR", "SS", "ST", "SV", "SY", "SZ", "TC", "TD", "TG", "TH", "TJ", "TL", "TN", "TO", "TR", "TT", "TV", "TW", "TZ", "UA", "UG", "US", "UY", "UZ", "VA", "VC", "VE", "VG", "VI", "VN", "VU", "WS", "XB", "XC", "XE", "XM", "XN", "XS", "XY", "YE", "YT", "ZA", "ZM", "ZW"] # noqa: E501 - if country_code not in allowed_values: - raise ValueError( - "Invalid value for `country_code` ({0}), must be one of {1}" # noqa: E501 - .format(country_code, allowed_values) - ) - - self._country_code = country_code - - @property - def email(self): - """Gets the email of this Address. # noqa: E501 - - The party email # noqa: E501 - - :return: The email of this Address. # noqa: E501 - :rtype: str - """ - return self._email - - @email.setter - def email(self, email): - """Sets the email of this Address. - - The party email # noqa: E501 - - :param email: The email of this Address. # noqa: E501 - :type: str - """ - - self._email = email - - @property - def phone_number(self): - """Gets the phone_number of this Address. # noqa: E501 - - The party phone number. # noqa: E501 - - :return: The phone_number of this Address. # noqa: E501 - :rtype: str - """ - return self._phone_number - - @phone_number.setter - def phone_number(self, phone_number): - """Sets the phone_number of this Address. - - The party phone number. # noqa: E501 - - :param phone_number: The phone_number of this Address. # noqa: E501 - :type: str - """ - - self._phone_number = phone_number - - @property - def state_code(self): - """Gets the state_code of this Address. # noqa: E501 - - The address state code # noqa: E501 - - :return: The state_code of this Address. # noqa: E501 - :rtype: str - """ - return self._state_code - - @state_code.setter - def state_code(self, state_code): - """Sets the state_code of this Address. - - The address state code # noqa: E501 - - :param state_code: The state_code of this Address. # noqa: E501 - :type: str - """ - - self._state_code = state_code - - @property - def suburb(self): - """Gets the suburb of this Address. # noqa: E501 - - The address suburb if known # noqa: E501 - - :return: The suburb of this Address. # noqa: E501 - :rtype: str - """ - return self._suburb - - @suburb.setter - def suburb(self, suburb): - """Sets the suburb of this Address. - - The address suburb if known # noqa: E501 - - :param suburb: The suburb of this Address. # noqa: E501 - :type: str - """ - - self._suburb = suburb - - @property - def residential(self): - """Gets the residential of this Address. # noqa: E501 - - Indicate if the address is residential or commercial (enterprise) # noqa: E501 - - :return: The residential of this Address. # noqa: E501 - :rtype: bool - """ - return self._residential - - @residential.setter - def residential(self, residential): - """Sets the residential of this Address. - - Indicate if the address is residential or commercial (enterprise) # noqa: E501 - - :param residential: The residential of this Address. # noqa: E501 - :type: bool - """ - - self._residential = residential - - @property - def address_line1(self): - """Gets the address_line1 of this Address. # noqa: E501 - - The address line with street number
**(required for shipment purchase)** # noqa: E501 - - :return: The address_line1 of this Address. # noqa: E501 - :rtype: str - """ - return self._address_line1 - - @address_line1.setter - def address_line1(self, address_line1): - """Sets the address_line1 of this Address. - - The address line with street number
**(required for shipment purchase)** # noqa: E501 - - :param address_line1: The address_line1 of this Address. # noqa: E501 - :type: str - """ - - self._address_line1 = address_line1 - - @property - def address_line2(self): - """Gets the address_line2 of this Address. # noqa: E501 - - The address line with suite number # noqa: E501 - - :return: The address_line2 of this Address. # noqa: E501 - :rtype: str - """ - return self._address_line2 - - @address_line2.setter - def address_line2(self, address_line2): - """Sets the address_line2 of this Address. - - The address line with suite number # noqa: E501 - - :param address_line2: The address_line2 of this Address. # noqa: E501 - :type: str - """ - - self._address_line2 = address_line2 - - @property - def validate_location(self): - """Gets the validate_location of this Address. # noqa: E501 - - Indicate if the address should be validated # noqa: E501 - - :return: The validate_location of this Address. # noqa: E501 - :rtype: bool - """ - return self._validate_location - - @validate_location.setter - def validate_location(self, validate_location): - """Sets the validate_location of this Address. - - Indicate if the address should be validated # noqa: E501 - - :param validate_location: The validate_location of this Address. # noqa: E501 - :type: bool - """ - - self._validate_location = validate_location - - @property - def validation(self): - """Gets the validation of this Address. # noqa: E501 - - - :return: The validation of this Address. # noqa: E501 - :rtype: AddressValidation - """ - return self._validation - - @validation.setter - def validation(self, validation): - """Sets the validation of this Address. - - - :param validation: The validation of this Address. # noqa: E501 - :type: AddressValidation - """ - - self._validation = validation - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(Address, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, Address): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/purplship/models/address_data.py b/purplship/models/address_data.py deleted file mode 100644 index c66fc27..0000000 --- a/purplship/models/address_data.py +++ /dev/null @@ -1,511 +0,0 @@ -# coding: utf-8 - -""" - Purplship API - - ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.6.2`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 - - OpenAPI spec version: 2021.6.2 - Contact: hello@purplship.com - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - -import pprint -import re # noqa: F401 - -import six - -class AddressData(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'postal_code': 'str', - 'city': 'str', - 'federal_tax_id': 'str', - 'state_tax_id': 'str', - 'person_name': 'str', - 'company_name': 'str', - 'country_code': 'str', - 'email': 'str', - 'phone_number': 'str', - 'state_code': 'str', - 'suburb': 'str', - 'residential': 'bool', - 'address_line1': 'str', - 'address_line2': 'str', - 'validate_location': 'bool' - } - - attribute_map = { - 'postal_code': 'postal_code', - 'city': 'city', - 'federal_tax_id': 'federal_tax_id', - 'state_tax_id': 'state_tax_id', - 'person_name': 'person_name', - 'company_name': 'company_name', - 'country_code': 'country_code', - 'email': 'email', - 'phone_number': 'phone_number', - 'state_code': 'state_code', - 'suburb': 'suburb', - 'residential': 'residential', - 'address_line1': 'address_line1', - 'address_line2': 'address_line2', - 'validate_location': 'validate_location' - } - - def __init__(self, postal_code=None, city=None, federal_tax_id=None, state_tax_id=None, person_name=None, company_name=None, country_code=None, email=None, phone_number=None, state_code=None, suburb=None, residential=False, address_line1=None, address_line2=None, validate_location=False): # noqa: E501 - """AddressData - a model defined in Swagger""" # noqa: E501 - self._postal_code = None - self._city = None - self._federal_tax_id = None - self._state_tax_id = None - self._person_name = None - self._company_name = None - self._country_code = None - self._email = None - self._phone_number = None - self._state_code = None - self._suburb = None - self._residential = None - self._address_line1 = None - self._address_line2 = None - self._validate_location = None - self.discriminator = None - if postal_code is not None: - self.postal_code = postal_code - if city is not None: - self.city = city - if federal_tax_id is not None: - self.federal_tax_id = federal_tax_id - if state_tax_id is not None: - self.state_tax_id = state_tax_id - if person_name is not None: - self.person_name = person_name - if company_name is not None: - self.company_name = company_name - self.country_code = country_code - if email is not None: - self.email = email - if phone_number is not None: - self.phone_number = phone_number - if state_code is not None: - self.state_code = state_code - if suburb is not None: - self.suburb = suburb - if residential is not None: - self.residential = residential - if address_line1 is not None: - self.address_line1 = address_line1 - if address_line2 is not None: - self.address_line2 = address_line2 - if validate_location is not None: - self.validate_location = validate_location - - @property - def postal_code(self): - """Gets the postal_code of this AddressData. # noqa: E501 - - The address postal code **(required for shipment purchase)** # noqa: E501 - - :return: The postal_code of this AddressData. # noqa: E501 - :rtype: str - """ - return self._postal_code - - @postal_code.setter - def postal_code(self, postal_code): - """Sets the postal_code of this AddressData. - - The address postal code **(required for shipment purchase)** # noqa: E501 - - :param postal_code: The postal_code of this AddressData. # noqa: E501 - :type: str - """ - - self._postal_code = postal_code - - @property - def city(self): - """Gets the city of this AddressData. # noqa: E501 - - The address city. **(required for shipment purchase)** # noqa: E501 - - :return: The city of this AddressData. # noqa: E501 - :rtype: str - """ - return self._city - - @city.setter - def city(self, city): - """Sets the city of this AddressData. - - The address city. **(required for shipment purchase)** # noqa: E501 - - :param city: The city of this AddressData. # noqa: E501 - :type: str - """ - - self._city = city - - @property - def federal_tax_id(self): - """Gets the federal_tax_id of this AddressData. # noqa: E501 - - The party frederal tax id # noqa: E501 - - :return: The federal_tax_id of this AddressData. # noqa: E501 - :rtype: str - """ - return self._federal_tax_id - - @federal_tax_id.setter - def federal_tax_id(self, federal_tax_id): - """Sets the federal_tax_id of this AddressData. - - The party frederal tax id # noqa: E501 - - :param federal_tax_id: The federal_tax_id of this AddressData. # noqa: E501 - :type: str - """ - - self._federal_tax_id = federal_tax_id - - @property - def state_tax_id(self): - """Gets the state_tax_id of this AddressData. # noqa: E501 - - The party state id # noqa: E501 - - :return: The state_tax_id of this AddressData. # noqa: E501 - :rtype: str - """ - return self._state_tax_id - - @state_tax_id.setter - def state_tax_id(self, state_tax_id): - """Sets the state_tax_id of this AddressData. - - The party state id # noqa: E501 - - :param state_tax_id: The state_tax_id of this AddressData. # noqa: E501 - :type: str - """ - - self._state_tax_id = state_tax_id - - @property - def person_name(self): - """Gets the person_name of this AddressData. # noqa: E501 - - attention to **(required for shipment purchase)** # noqa: E501 - - :return: The person_name of this AddressData. # noqa: E501 - :rtype: str - """ - return self._person_name - - @person_name.setter - def person_name(self, person_name): - """Sets the person_name of this AddressData. - - attention to **(required for shipment purchase)** # noqa: E501 - - :param person_name: The person_name of this AddressData. # noqa: E501 - :type: str - """ - - self._person_name = person_name - - @property - def company_name(self): - """Gets the company_name of this AddressData. # noqa: E501 - - The company name if the party is a company # noqa: E501 - - :return: The company_name of this AddressData. # noqa: E501 - :rtype: str - """ - return self._company_name - - @company_name.setter - def company_name(self, company_name): - """Sets the company_name of this AddressData. - - The company name if the party is a company # noqa: E501 - - :param company_name: The company_name of this AddressData. # noqa: E501 - :type: str - """ - - self._company_name = company_name - - @property - def country_code(self): - """Gets the country_code of this AddressData. # noqa: E501 - - The address country code # noqa: E501 - - :return: The country_code of this AddressData. # noqa: E501 - :rtype: str - """ - return self._country_code - - @country_code.setter - def country_code(self, country_code): - """Sets the country_code of this AddressData. - - The address country code # noqa: E501 - - :param country_code: The country_code of this AddressData. # noqa: E501 - :type: str - """ - if country_code is None: - raise ValueError("Invalid value for `country_code`, must not be `None`") # noqa: E501 - allowed_values = ["AD", "AE", "AF", "AG", "AI", "AL", "AM", "AN", "AO", "AR", "AS", "AT", "AU", "AW", "AZ", "BA", "BB", "BD", "BE", "BF", "BG", "BH", "BI", "BJ", "BM", "BN", "BO", "BR", "BS", "BT", "BW", "BY", "BZ", "CA", "CD", "CF", "CG", "CH", "CI", "CK", "CL", "CM", "CN", "CO", "CR", "CU", "CV", "CY", "CZ", "DE", "DJ", "DK", "DM", "DO", "DZ", "EC", "EE", "EG", "ER", "ES", "ET", "FI", "FJ", "FK", "FM", "FO", "FR", "GA", "GB", "GD", "GE", "GF", "GG", "GH", "GI", "GL", "GM", "GN", "GP", "GQ", "GR", "GT", "GU", "GW", "GY", "HK", "HN", "HR", "HT", "HU", "IC", "ID", "IE", "IL", "IN", "IQ", "IR", "IS", "IT", "JE", "JM", "JO", "JP", "KE", "KG", "KH", "KI", "KM", "KN", "KP", "KR", "KV", "KW", "KY", "KZ", "LA", "LB", "LC", "LI", "LK", "LR", "LS", "LT", "LU", "LV", "LY", "MA", "MC", "MD", "ME", "MG", "MH", "MK", "ML", "MM", "MN", "MO", "MP", "MQ", "MR", "MS", "MT", "MU", "MV", "MW", "MX", "MY", "MZ", "NA", "NC", "NE", "NG", "NI", "NL", "NO", "NP", "NR", "NU", "NZ", "OM", "PA", "PE", "PF", "PG", "PH", "PK", "PL", "PR", "PT", "PW", "PY", "QA", "RE", "RO", "RS", "RU", "RW", "SA", "SB", "SC", "SD", "SE", "SG", "SH", "SI", "SK", "SL", "SM", "SN", "SO", "SR", "SS", "ST", "SV", "SY", "SZ", "TC", "TD", "TG", "TH", "TJ", "TL", "TN", "TO", "TR", "TT", "TV", "TW", "TZ", "UA", "UG", "US", "UY", "UZ", "VA", "VC", "VE", "VG", "VI", "VN", "VU", "WS", "XB", "XC", "XE", "XM", "XN", "XS", "XY", "YE", "YT", "ZA", "ZM", "ZW"] # noqa: E501 - if country_code not in allowed_values: - raise ValueError( - "Invalid value for `country_code` ({0}), must be one of {1}" # noqa: E501 - .format(country_code, allowed_values) - ) - - self._country_code = country_code - - @property - def email(self): - """Gets the email of this AddressData. # noqa: E501 - - The party email # noqa: E501 - - :return: The email of this AddressData. # noqa: E501 - :rtype: str - """ - return self._email - - @email.setter - def email(self, email): - """Sets the email of this AddressData. - - The party email # noqa: E501 - - :param email: The email of this AddressData. # noqa: E501 - :type: str - """ - - self._email = email - - @property - def phone_number(self): - """Gets the phone_number of this AddressData. # noqa: E501 - - The party phone number. # noqa: E501 - - :return: The phone_number of this AddressData. # noqa: E501 - :rtype: str - """ - return self._phone_number - - @phone_number.setter - def phone_number(self, phone_number): - """Sets the phone_number of this AddressData. - - The party phone number. # noqa: E501 - - :param phone_number: The phone_number of this AddressData. # noqa: E501 - :type: str - """ - - self._phone_number = phone_number - - @property - def state_code(self): - """Gets the state_code of this AddressData. # noqa: E501 - - The address state code # noqa: E501 - - :return: The state_code of this AddressData. # noqa: E501 - :rtype: str - """ - return self._state_code - - @state_code.setter - def state_code(self, state_code): - """Sets the state_code of this AddressData. - - The address state code # noqa: E501 - - :param state_code: The state_code of this AddressData. # noqa: E501 - :type: str - """ - - self._state_code = state_code - - @property - def suburb(self): - """Gets the suburb of this AddressData. # noqa: E501 - - The address suburb if known # noqa: E501 - - :return: The suburb of this AddressData. # noqa: E501 - :rtype: str - """ - return self._suburb - - @suburb.setter - def suburb(self, suburb): - """Sets the suburb of this AddressData. - - The address suburb if known # noqa: E501 - - :param suburb: The suburb of this AddressData. # noqa: E501 - :type: str - """ - - self._suburb = suburb - - @property - def residential(self): - """Gets the residential of this AddressData. # noqa: E501 - - Indicate if the address is residential or commercial (enterprise) # noqa: E501 - - :return: The residential of this AddressData. # noqa: E501 - :rtype: bool - """ - return self._residential - - @residential.setter - def residential(self, residential): - """Sets the residential of this AddressData. - - Indicate if the address is residential or commercial (enterprise) # noqa: E501 - - :param residential: The residential of this AddressData. # noqa: E501 - :type: bool - """ - - self._residential = residential - - @property - def address_line1(self): - """Gets the address_line1 of this AddressData. # noqa: E501 - - The address line with street number
**(required for shipment purchase)** # noqa: E501 - - :return: The address_line1 of this AddressData. # noqa: E501 - :rtype: str - """ - return self._address_line1 - - @address_line1.setter - def address_line1(self, address_line1): - """Sets the address_line1 of this AddressData. - - The address line with street number
**(required for shipment purchase)** # noqa: E501 - - :param address_line1: The address_line1 of this AddressData. # noqa: E501 - :type: str - """ - - self._address_line1 = address_line1 - - @property - def address_line2(self): - """Gets the address_line2 of this AddressData. # noqa: E501 - - The address line with suite number # noqa: E501 - - :return: The address_line2 of this AddressData. # noqa: E501 - :rtype: str - """ - return self._address_line2 - - @address_line2.setter - def address_line2(self, address_line2): - """Sets the address_line2 of this AddressData. - - The address line with suite number # noqa: E501 - - :param address_line2: The address_line2 of this AddressData. # noqa: E501 - :type: str - """ - - self._address_line2 = address_line2 - - @property - def validate_location(self): - """Gets the validate_location of this AddressData. # noqa: E501 - - Indicate if the address should be validated # noqa: E501 - - :return: The validate_location of this AddressData. # noqa: E501 - :rtype: bool - """ - return self._validate_location - - @validate_location.setter - def validate_location(self, validate_location): - """Sets the validate_location of this AddressData. - - Indicate if the address should be validated # noqa: E501 - - :param validate_location: The validate_location of this AddressData. # noqa: E501 - :type: bool - """ - - self._validate_location = validate_location - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(AddressData, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, AddressData): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/purplship/models/address_list.py b/purplship/models/address_list.py deleted file mode 100644 index fa2ad4c..0000000 --- a/purplship/models/address_list.py +++ /dev/null @@ -1,163 +0,0 @@ -# coding: utf-8 - -""" - Purplship API - - ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.6.2`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 - - OpenAPI spec version: 2021.6.2 - Contact: hello@purplship.com - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - -import pprint -import re # noqa: F401 - -import six - -class AddressList(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'next': 'str', - 'previous': 'str', - 'results': 'list[Address]' - } - - attribute_map = { - 'next': 'next', - 'previous': 'previous', - 'results': 'results' - } - - def __init__(self, next=None, previous=None, results=None): # noqa: E501 - """AddressList - a model defined in Swagger""" # noqa: E501 - self._next = None - self._previous = None - self._results = None - self.discriminator = None - if next is not None: - self.next = next - if previous is not None: - self.previous = previous - self.results = results - - @property - def next(self): - """Gets the next of this AddressList. # noqa: E501 - - - :return: The next of this AddressList. # noqa: E501 - :rtype: str - """ - return self._next - - @next.setter - def next(self, next): - """Sets the next of this AddressList. - - - :param next: The next of this AddressList. # noqa: E501 - :type: str - """ - - self._next = next - - @property - def previous(self): - """Gets the previous of this AddressList. # noqa: E501 - - - :return: The previous of this AddressList. # noqa: E501 - :rtype: str - """ - return self._previous - - @previous.setter - def previous(self, previous): - """Sets the previous of this AddressList. - - - :param previous: The previous of this AddressList. # noqa: E501 - :type: str - """ - - self._previous = previous - - @property - def results(self): - """Gets the results of this AddressList. # noqa: E501 - - - :return: The results of this AddressList. # noqa: E501 - :rtype: list[Address] - """ - return self._results - - @results.setter - def results(self, results): - """Sets the results of this AddressList. - - - :param results: The results of this AddressList. # noqa: E501 - :type: list[Address] - """ - if results is None: - raise ValueError("Invalid value for `results`, must not be `None`") # noqa: E501 - - self._results = results - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(AddressList, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, AddressList): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/purplship/models/address_validation.py b/purplship/models/address_validation.py deleted file mode 100644 index 960c183..0000000 --- a/purplship/models/address_validation.py +++ /dev/null @@ -1,141 +0,0 @@ -# coding: utf-8 - -""" - Purplship API - - ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.6.2`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 - - OpenAPI spec version: 2021.6.2 - Contact: hello@purplship.com - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - -import pprint -import re # noqa: F401 - -import six - -class AddressValidation(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'success': 'bool', - 'meta': 'object' - } - - attribute_map = { - 'success': 'success', - 'meta': 'meta' - } - - def __init__(self, success=None, meta=None): # noqa: E501 - """AddressValidation - a model defined in Swagger""" # noqa: E501 - self._success = None - self._meta = None - self.discriminator = None - self.success = success - if meta is not None: - self.meta = meta - - @property - def success(self): - """Gets the success of this AddressValidation. # noqa: E501 - - True if the address is valid # noqa: E501 - - :return: The success of this AddressValidation. # noqa: E501 - :rtype: bool - """ - return self._success - - @success.setter - def success(self, success): - """Sets the success of this AddressValidation. - - True if the address is valid # noqa: E501 - - :param success: The success of this AddressValidation. # noqa: E501 - :type: bool - """ - if success is None: - raise ValueError("Invalid value for `success`, must not be `None`") # noqa: E501 - - self._success = success - - @property - def meta(self): - """Gets the meta of this AddressValidation. # noqa: E501 - - validation service details # noqa: E501 - - :return: The meta of this AddressValidation. # noqa: E501 - :rtype: object - """ - return self._meta - - @meta.setter - def meta(self, meta): - """Sets the meta of this AddressValidation. - - validation service details # noqa: E501 - - :param meta: The meta of this AddressValidation. # noqa: E501 - :type: object - """ - - self._meta = meta - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(AddressValidation, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, AddressValidation): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/purplship/models/carrier_list.py b/purplship/models/carrier_list.py deleted file mode 100644 index d1db26d..0000000 --- a/purplship/models/carrier_list.py +++ /dev/null @@ -1,163 +0,0 @@ -# coding: utf-8 - -""" - Purplship API - - ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.6.2`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 - - OpenAPI spec version: 2021.6.2 - Contact: hello@purplship.com - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - -import pprint -import re # noqa: F401 - -import six - -class CarrierList(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'next': 'str', - 'previous': 'str', - 'results': 'list[CarrierSettings]' - } - - attribute_map = { - 'next': 'next', - 'previous': 'previous', - 'results': 'results' - } - - def __init__(self, next=None, previous=None, results=None): # noqa: E501 - """CarrierList - a model defined in Swagger""" # noqa: E501 - self._next = None - self._previous = None - self._results = None - self.discriminator = None - if next is not None: - self.next = next - if previous is not None: - self.previous = previous - self.results = results - - @property - def next(self): - """Gets the next of this CarrierList. # noqa: E501 - - - :return: The next of this CarrierList. # noqa: E501 - :rtype: str - """ - return self._next - - @next.setter - def next(self, next): - """Sets the next of this CarrierList. - - - :param next: The next of this CarrierList. # noqa: E501 - :type: str - """ - - self._next = next - - @property - def previous(self): - """Gets the previous of this CarrierList. # noqa: E501 - - - :return: The previous of this CarrierList. # noqa: E501 - :rtype: str - """ - return self._previous - - @previous.setter - def previous(self, previous): - """Sets the previous of this CarrierList. - - - :param previous: The previous of this CarrierList. # noqa: E501 - :type: str - """ - - self._previous = previous - - @property - def results(self): - """Gets the results of this CarrierList. # noqa: E501 - - - :return: The results of this CarrierList. # noqa: E501 - :rtype: list[CarrierSettings] - """ - return self._results - - @results.setter - def results(self, results): - """Sets the results of this CarrierList. - - - :param results: The results of this CarrierList. # noqa: E501 - :type: list[CarrierSettings] - """ - if results is None: - raise ValueError("Invalid value for `results`, must not be `None`") # noqa: E501 - - self._results = results - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(CarrierList, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, CarrierList): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/purplship/models/carrier_settings.py b/purplship/models/carrier_settings.py deleted file mode 100644 index b570a24..0000000 --- a/purplship/models/carrier_settings.py +++ /dev/null @@ -1,235 +0,0 @@ -# coding: utf-8 - -""" - Purplship API - - ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.6.2`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 - - OpenAPI spec version: 2021.6.2 - Contact: hello@purplship.com - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - -import pprint -import re # noqa: F401 - -import six - -class CarrierSettings(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'id': 'str', - 'carrier_name': 'str', - 'carrier_id': 'str', - 'test': 'bool', - 'active': 'bool' - } - - attribute_map = { - 'id': 'id', - 'carrier_name': 'carrier_name', - 'carrier_id': 'carrier_id', - 'test': 'test', - 'active': 'active' - } - - def __init__(self, id=None, carrier_name=None, carrier_id=None, test=None, active=None): # noqa: E501 - """CarrierSettings - a model defined in Swagger""" # noqa: E501 - self._id = None - self._carrier_name = None - self._carrier_id = None - self._test = None - self._active = None - self.discriminator = None - self.id = id - self.carrier_name = carrier_name - self.carrier_id = carrier_id - self.test = test - self.active = active - - @property - def id(self): - """Gets the id of this CarrierSettings. # noqa: E501 - - A unique address identifier # noqa: E501 - - :return: The id of this CarrierSettings. # noqa: E501 - :rtype: str - """ - return self._id - - @id.setter - def id(self, id): - """Sets the id of this CarrierSettings. - - A unique address identifier # noqa: E501 - - :param id: The id of this CarrierSettings. # noqa: E501 - :type: str - """ - if id is None: - raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 - - self._id = id - - @property - def carrier_name(self): - """Gets the carrier_name of this CarrierSettings. # noqa: E501 - - Indicates a carrier (type) # noqa: E501 - - :return: The carrier_name of this CarrierSettings. # noqa: E501 - :rtype: str - """ - return self._carrier_name - - @carrier_name.setter - def carrier_name(self, carrier_name): - """Sets the carrier_name of this CarrierSettings. - - Indicates a carrier (type) # noqa: E501 - - :param carrier_name: The carrier_name of this CarrierSettings. # noqa: E501 - :type: str - """ - if carrier_name is None: - raise ValueError("Invalid value for `carrier_name`, must not be `None`") # noqa: E501 - allowed_values = ["aramex", "australiapost", "canadapost", "canpar", "dhl_express", "dhl_universal", "dicom", "eshipper", "fedex", "freightcom", "purolator", "royalmail", "sendle", "sf_express", "tnt", "ups", "usps", "usps_international", "yanwen", "yunexpress"] # noqa: E501 - if carrier_name not in allowed_values: - raise ValueError( - "Invalid value for `carrier_name` ({0}), must be one of {1}" # noqa: E501 - .format(carrier_name, allowed_values) - ) - - self._carrier_name = carrier_name - - @property - def carrier_id(self): - """Gets the carrier_id of this CarrierSettings. # noqa: E501 - - Indicates a specific carrier configuration name. # noqa: E501 - - :return: The carrier_id of this CarrierSettings. # noqa: E501 - :rtype: str - """ - return self._carrier_id - - @carrier_id.setter - def carrier_id(self, carrier_id): - """Sets the carrier_id of this CarrierSettings. - - Indicates a specific carrier configuration name. # noqa: E501 - - :param carrier_id: The carrier_id of this CarrierSettings. # noqa: E501 - :type: str - """ - if carrier_id is None: - raise ValueError("Invalid value for `carrier_id`, must not be `None`") # noqa: E501 - - self._carrier_id = carrier_id - - @property - def test(self): - """Gets the test of this CarrierSettings. # noqa: E501 - - The test flag indicates whether to use a carrier configured for test. # noqa: E501 - - :return: The test of this CarrierSettings. # noqa: E501 - :rtype: bool - """ - return self._test - - @test.setter - def test(self, test): - """Sets the test of this CarrierSettings. - - The test flag indicates whether to use a carrier configured for test. # noqa: E501 - - :param test: The test of this CarrierSettings. # noqa: E501 - :type: bool - """ - if test is None: - raise ValueError("Invalid value for `test`, must not be `None`") # noqa: E501 - - self._test = test - - @property - def active(self): - """Gets the active of this CarrierSettings. # noqa: E501 - - The active flag indicates whether the carrier account is active or not. # noqa: E501 - - :return: The active of this CarrierSettings. # noqa: E501 - :rtype: bool - """ - return self._active - - @active.setter - def active(self, active): - """Sets the active of this CarrierSettings. - - The active flag indicates whether the carrier account is active or not. # noqa: E501 - - :param active: The active of this CarrierSettings. # noqa: E501 - :type: bool - """ - if active is None: - raise ValueError("Invalid value for `active`, must not be `None`") # noqa: E501 - - self._active = active - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(CarrierSettings, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, CarrierSettings): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/purplship/models/charge.py b/purplship/models/charge.py deleted file mode 100644 index ae9df92..0000000 --- a/purplship/models/charge.py +++ /dev/null @@ -1,168 +0,0 @@ -# coding: utf-8 - -""" - Purplship API - - ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.6.2`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 - - OpenAPI spec version: 2021.6.2 - Contact: hello@purplship.com - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - -import pprint -import re # noqa: F401 - -import six - -class Charge(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'name': 'str', - 'amount': 'float', - 'currency': 'str' - } - - attribute_map = { - 'name': 'name', - 'amount': 'amount', - 'currency': 'currency' - } - - def __init__(self, name=None, amount=None, currency=None): # noqa: E501 - """Charge - a model defined in Swagger""" # noqa: E501 - self._name = None - self._amount = None - self._currency = None - self.discriminator = None - if name is not None: - self.name = name - if amount is not None: - self.amount = amount - if currency is not None: - self.currency = currency - - @property - def name(self): - """Gets the name of this Charge. # noqa: E501 - - The charge description # noqa: E501 - - :return: The name of this Charge. # noqa: E501 - :rtype: str - """ - return self._name - - @name.setter - def name(self, name): - """Sets the name of this Charge. - - The charge description # noqa: E501 - - :param name: The name of this Charge. # noqa: E501 - :type: str - """ - - self._name = name - - @property - def amount(self): - """Gets the amount of this Charge. # noqa: E501 - - The charge monetary value # noqa: E501 - - :return: The amount of this Charge. # noqa: E501 - :rtype: float - """ - return self._amount - - @amount.setter - def amount(self, amount): - """Sets the amount of this Charge. - - The charge monetary value # noqa: E501 - - :param amount: The amount of this Charge. # noqa: E501 - :type: float - """ - - self._amount = amount - - @property - def currency(self): - """Gets the currency of this Charge. # noqa: E501 - - The charge amount currency # noqa: E501 - - :return: The currency of this Charge. # noqa: E501 - :rtype: str - """ - return self._currency - - @currency.setter - def currency(self, currency): - """Sets the currency of this Charge. - - The charge amount currency # noqa: E501 - - :param currency: The currency of this Charge. # noqa: E501 - :type: str - """ - - self._currency = currency - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(Charge, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, Charge): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/purplship/models/commodity.py b/purplship/models/commodity.py deleted file mode 100644 index f1f8da1..0000000 --- a/purplship/models/commodity.py +++ /dev/null @@ -1,344 +0,0 @@ -# coding: utf-8 - -""" - Purplship API - - ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.6.2`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 - - OpenAPI spec version: 2021.6.2 - Contact: hello@purplship.com - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - -import pprint -import re # noqa: F401 - -import six - -class Commodity(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'id': 'str', - 'weight': 'float', - 'weight_unit': 'str', - 'description': 'str', - 'quantity': 'int', - 'sku': 'str', - 'value_amount': 'float', - 'value_currency': 'str', - 'origin_country': 'str' - } - - attribute_map = { - 'id': 'id', - 'weight': 'weight', - 'weight_unit': 'weight_unit', - 'description': 'description', - 'quantity': 'quantity', - 'sku': 'sku', - 'value_amount': 'value_amount', - 'value_currency': 'value_currency', - 'origin_country': 'origin_country' - } - - def __init__(self, id=None, weight=None, weight_unit=None, description=None, quantity=None, sku=None, value_amount=None, value_currency=None, origin_country=None): # noqa: E501 - """Commodity - a model defined in Swagger""" # noqa: E501 - self._id = None - self._weight = None - self._weight_unit = None - self._description = None - self._quantity = None - self._sku = None - self._value_amount = None - self._value_currency = None - self._origin_country = None - self.discriminator = None - if id is not None: - self.id = id - self.weight = weight - self.weight_unit = weight_unit - if description is not None: - self.description = description - if quantity is not None: - self.quantity = quantity - if sku is not None: - self.sku = sku - if value_amount is not None: - self.value_amount = value_amount - if value_currency is not None: - self.value_currency = value_currency - if origin_country is not None: - self.origin_country = origin_country - - @property - def id(self): - """Gets the id of this Commodity. # noqa: E501 - - A unique identifier # noqa: E501 - - :return: The id of this Commodity. # noqa: E501 - :rtype: str - """ - return self._id - - @id.setter - def id(self, id): - """Sets the id of this Commodity. - - A unique identifier # noqa: E501 - - :param id: The id of this Commodity. # noqa: E501 - :type: str - """ - - self._id = id - - @property - def weight(self): - """Gets the weight of this Commodity. # noqa: E501 - - The commodity's weight # noqa: E501 - - :return: The weight of this Commodity. # noqa: E501 - :rtype: float - """ - return self._weight - - @weight.setter - def weight(self, weight): - """Sets the weight of this Commodity. - - The commodity's weight # noqa: E501 - - :param weight: The weight of this Commodity. # noqa: E501 - :type: float - """ - if weight is None: - raise ValueError("Invalid value for `weight`, must not be `None`") # noqa: E501 - - self._weight = weight - - @property - def weight_unit(self): - """Gets the weight_unit of this Commodity. # noqa: E501 - - The commodity's weight unit # noqa: E501 - - :return: The weight_unit of this Commodity. # noqa: E501 - :rtype: str - """ - return self._weight_unit - - @weight_unit.setter - def weight_unit(self, weight_unit): - """Sets the weight_unit of this Commodity. - - The commodity's weight unit # noqa: E501 - - :param weight_unit: The weight_unit of this Commodity. # noqa: E501 - :type: str - """ - if weight_unit is None: - raise ValueError("Invalid value for `weight_unit`, must not be `None`") # noqa: E501 - allowed_values = ["KG", "LB"] # noqa: E501 - if weight_unit not in allowed_values: - raise ValueError( - "Invalid value for `weight_unit` ({0}), must be one of {1}" # noqa: E501 - .format(weight_unit, allowed_values) - ) - - self._weight_unit = weight_unit - - @property - def description(self): - """Gets the description of this Commodity. # noqa: E501 - - A description of the commodity # noqa: E501 - - :return: The description of this Commodity. # noqa: E501 - :rtype: str - """ - return self._description - - @description.setter - def description(self, description): - """Sets the description of this Commodity. - - A description of the commodity # noqa: E501 - - :param description: The description of this Commodity. # noqa: E501 - :type: str - """ - - self._description = description - - @property - def quantity(self): - """Gets the quantity of this Commodity. # noqa: E501 - - The commodity's quantity (number or item) # noqa: E501 - - :return: The quantity of this Commodity. # noqa: E501 - :rtype: int - """ - return self._quantity - - @quantity.setter - def quantity(self, quantity): - """Sets the quantity of this Commodity. - - The commodity's quantity (number or item) # noqa: E501 - - :param quantity: The quantity of this Commodity. # noqa: E501 - :type: int - """ - - self._quantity = quantity - - @property - def sku(self): - """Gets the sku of this Commodity. # noqa: E501 - - The commodity's sku number # noqa: E501 - - :return: The sku of this Commodity. # noqa: E501 - :rtype: str - """ - return self._sku - - @sku.setter - def sku(self, sku): - """Sets the sku of this Commodity. - - The commodity's sku number # noqa: E501 - - :param sku: The sku of this Commodity. # noqa: E501 - :type: str - """ - - self._sku = sku - - @property - def value_amount(self): - """Gets the value_amount of this Commodity. # noqa: E501 - - The monetary value of the commodity # noqa: E501 - - :return: The value_amount of this Commodity. # noqa: E501 - :rtype: float - """ - return self._value_amount - - @value_amount.setter - def value_amount(self, value_amount): - """Sets the value_amount of this Commodity. - - The monetary value of the commodity # noqa: E501 - - :param value_amount: The value_amount of this Commodity. # noqa: E501 - :type: float - """ - - self._value_amount = value_amount - - @property - def value_currency(self): - """Gets the value_currency of this Commodity. # noqa: E501 - - The currency of the commodity value amount # noqa: E501 - - :return: The value_currency of this Commodity. # noqa: E501 - :rtype: str - """ - return self._value_currency - - @value_currency.setter - def value_currency(self, value_currency): - """Sets the value_currency of this Commodity. - - The currency of the commodity value amount # noqa: E501 - - :param value_currency: The value_currency of this Commodity. # noqa: E501 - :type: str - """ - - self._value_currency = value_currency - - @property - def origin_country(self): - """Gets the origin_country of this Commodity. # noqa: E501 - - The origin or manufacture country # noqa: E501 - - :return: The origin_country of this Commodity. # noqa: E501 - :rtype: str - """ - return self._origin_country - - @origin_country.setter - def origin_country(self, origin_country): - """Sets the origin_country of this Commodity. - - The origin or manufacture country # noqa: E501 - - :param origin_country: The origin_country of this Commodity. # noqa: E501 - :type: str - """ - - self._origin_country = origin_country - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(Commodity, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, Commodity): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/purplship/models/commodity_data.py b/purplship/models/commodity_data.py deleted file mode 100644 index b4812ab..0000000 --- a/purplship/models/commodity_data.py +++ /dev/null @@ -1,316 +0,0 @@ -# coding: utf-8 - -""" - Purplship API - - ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.6.2`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 - - OpenAPI spec version: 2021.6.2 - Contact: hello@purplship.com - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - -import pprint -import re # noqa: F401 - -import six - -class CommodityData(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'weight': 'float', - 'weight_unit': 'str', - 'description': 'str', - 'quantity': 'int', - 'sku': 'str', - 'value_amount': 'float', - 'value_currency': 'str', - 'origin_country': 'str' - } - - attribute_map = { - 'weight': 'weight', - 'weight_unit': 'weight_unit', - 'description': 'description', - 'quantity': 'quantity', - 'sku': 'sku', - 'value_amount': 'value_amount', - 'value_currency': 'value_currency', - 'origin_country': 'origin_country' - } - - def __init__(self, weight=None, weight_unit=None, description=None, quantity=None, sku=None, value_amount=None, value_currency=None, origin_country=None): # noqa: E501 - """CommodityData - a model defined in Swagger""" # noqa: E501 - self._weight = None - self._weight_unit = None - self._description = None - self._quantity = None - self._sku = None - self._value_amount = None - self._value_currency = None - self._origin_country = None - self.discriminator = None - self.weight = weight - self.weight_unit = weight_unit - if description is not None: - self.description = description - if quantity is not None: - self.quantity = quantity - if sku is not None: - self.sku = sku - if value_amount is not None: - self.value_amount = value_amount - if value_currency is not None: - self.value_currency = value_currency - if origin_country is not None: - self.origin_country = origin_country - - @property - def weight(self): - """Gets the weight of this CommodityData. # noqa: E501 - - The commodity's weight # noqa: E501 - - :return: The weight of this CommodityData. # noqa: E501 - :rtype: float - """ - return self._weight - - @weight.setter - def weight(self, weight): - """Sets the weight of this CommodityData. - - The commodity's weight # noqa: E501 - - :param weight: The weight of this CommodityData. # noqa: E501 - :type: float - """ - if weight is None: - raise ValueError("Invalid value for `weight`, must not be `None`") # noqa: E501 - - self._weight = weight - - @property - def weight_unit(self): - """Gets the weight_unit of this CommodityData. # noqa: E501 - - The commodity's weight unit # noqa: E501 - - :return: The weight_unit of this CommodityData. # noqa: E501 - :rtype: str - """ - return self._weight_unit - - @weight_unit.setter - def weight_unit(self, weight_unit): - """Sets the weight_unit of this CommodityData. - - The commodity's weight unit # noqa: E501 - - :param weight_unit: The weight_unit of this CommodityData. # noqa: E501 - :type: str - """ - if weight_unit is None: - raise ValueError("Invalid value for `weight_unit`, must not be `None`") # noqa: E501 - allowed_values = ["KG", "LB"] # noqa: E501 - if weight_unit not in allowed_values: - raise ValueError( - "Invalid value for `weight_unit` ({0}), must be one of {1}" # noqa: E501 - .format(weight_unit, allowed_values) - ) - - self._weight_unit = weight_unit - - @property - def description(self): - """Gets the description of this CommodityData. # noqa: E501 - - A description of the commodity # noqa: E501 - - :return: The description of this CommodityData. # noqa: E501 - :rtype: str - """ - return self._description - - @description.setter - def description(self, description): - """Sets the description of this CommodityData. - - A description of the commodity # noqa: E501 - - :param description: The description of this CommodityData. # noqa: E501 - :type: str - """ - - self._description = description - - @property - def quantity(self): - """Gets the quantity of this CommodityData. # noqa: E501 - - The commodity's quantity (number or item) # noqa: E501 - - :return: The quantity of this CommodityData. # noqa: E501 - :rtype: int - """ - return self._quantity - - @quantity.setter - def quantity(self, quantity): - """Sets the quantity of this CommodityData. - - The commodity's quantity (number or item) # noqa: E501 - - :param quantity: The quantity of this CommodityData. # noqa: E501 - :type: int - """ - - self._quantity = quantity - - @property - def sku(self): - """Gets the sku of this CommodityData. # noqa: E501 - - The commodity's sku number # noqa: E501 - - :return: The sku of this CommodityData. # noqa: E501 - :rtype: str - """ - return self._sku - - @sku.setter - def sku(self, sku): - """Sets the sku of this CommodityData. - - The commodity's sku number # noqa: E501 - - :param sku: The sku of this CommodityData. # noqa: E501 - :type: str - """ - - self._sku = sku - - @property - def value_amount(self): - """Gets the value_amount of this CommodityData. # noqa: E501 - - The monetary value of the commodity # noqa: E501 - - :return: The value_amount of this CommodityData. # noqa: E501 - :rtype: float - """ - return self._value_amount - - @value_amount.setter - def value_amount(self, value_amount): - """Sets the value_amount of this CommodityData. - - The monetary value of the commodity # noqa: E501 - - :param value_amount: The value_amount of this CommodityData. # noqa: E501 - :type: float - """ - - self._value_amount = value_amount - - @property - def value_currency(self): - """Gets the value_currency of this CommodityData. # noqa: E501 - - The currency of the commodity value amount # noqa: E501 - - :return: The value_currency of this CommodityData. # noqa: E501 - :rtype: str - """ - return self._value_currency - - @value_currency.setter - def value_currency(self, value_currency): - """Sets the value_currency of this CommodityData. - - The currency of the commodity value amount # noqa: E501 - - :param value_currency: The value_currency of this CommodityData. # noqa: E501 - :type: str - """ - - self._value_currency = value_currency - - @property - def origin_country(self): - """Gets the origin_country of this CommodityData. # noqa: E501 - - The origin or manufacture country # noqa: E501 - - :return: The origin_country of this CommodityData. # noqa: E501 - :rtype: str - """ - return self._origin_country - - @origin_country.setter - def origin_country(self, origin_country): - """Sets the origin_country of this CommodityData. - - The origin or manufacture country # noqa: E501 - - :param origin_country: The origin_country of this CommodityData. # noqa: E501 - :type: str - """ - - self._origin_country = origin_country - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(CommodityData, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, CommodityData): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/purplship/models/customs.py b/purplship/models/customs.py deleted file mode 100644 index b58ec48..0000000 --- a/purplship/models/customs.py +++ /dev/null @@ -1,500 +0,0 @@ -# coding: utf-8 - -""" - Purplship API - - ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.6.2`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 - - OpenAPI spec version: 2021.6.2 - Contact: hello@purplship.com - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - -import pprint -import re # noqa: F401 - -import six - -class Customs(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'id': 'str', - 'aes': 'str', - 'eel_pfc': 'str', - 'content_type': 'str', - 'content_description': 'str', - 'incoterm': 'str', - 'commodities': 'list[Commodity]', - 'duty': 'Duty', - 'invoice': 'str', - 'invoice_date': 'str', - 'commercial_invoice': 'bool', - 'certify': 'bool', - 'signer': 'str', - 'certificate_number': 'str', - 'options': 'object' - } - - attribute_map = { - 'id': 'id', - 'aes': 'aes', - 'eel_pfc': 'eel_pfc', - 'content_type': 'content_type', - 'content_description': 'content_description', - 'incoterm': 'incoterm', - 'commodities': 'commodities', - 'duty': 'duty', - 'invoice': 'invoice', - 'invoice_date': 'invoice_date', - 'commercial_invoice': 'commercial_invoice', - 'certify': 'certify', - 'signer': 'signer', - 'certificate_number': 'certificate_number', - 'options': 'options' - } - - def __init__(self, id=None, aes=None, eel_pfc=None, content_type=None, content_description=None, incoterm=None, commodities=None, duty=None, invoice=None, invoice_date=None, commercial_invoice=None, certify=None, signer=None, certificate_number=None, options=None): # noqa: E501 - """Customs - a model defined in Swagger""" # noqa: E501 - self._id = None - self._aes = None - self._eel_pfc = None - self._content_type = None - self._content_description = None - self._incoterm = None - self._commodities = None - self._duty = None - self._invoice = None - self._invoice_date = None - self._commercial_invoice = None - self._certify = None - self._signer = None - self._certificate_number = None - self._options = None - self.discriminator = None - if id is not None: - self.id = id - if aes is not None: - self.aes = aes - if eel_pfc is not None: - self.eel_pfc = eel_pfc - if content_type is not None: - self.content_type = content_type - if content_description is not None: - self.content_description = content_description - if incoterm is not None: - self.incoterm = incoterm - if commodities is not None: - self.commodities = commodities - if duty is not None: - self.duty = duty - if invoice is not None: - self.invoice = invoice - if invoice_date is not None: - self.invoice_date = invoice_date - if commercial_invoice is not None: - self.commercial_invoice = commercial_invoice - if certify is not None: - self.certify = certify - if signer is not None: - self.signer = signer - if certificate_number is not None: - self.certificate_number = certificate_number - if options is not None: - self.options = options - - @property - def id(self): - """Gets the id of this Customs. # noqa: E501 - - A unique identifier # noqa: E501 - - :return: The id of this Customs. # noqa: E501 - :rtype: str - """ - return self._id - - @id.setter - def id(self, id): - """Sets the id of this Customs. - - A unique identifier # noqa: E501 - - :param id: The id of this Customs. # noqa: E501 - :type: str - """ - - self._id = id - - @property - def aes(self): - """Gets the aes of this Customs. # noqa: E501 - - - :return: The aes of this Customs. # noqa: E501 - :rtype: str - """ - return self._aes - - @aes.setter - def aes(self, aes): - """Sets the aes of this Customs. - - - :param aes: The aes of this Customs. # noqa: E501 - :type: str - """ - - self._aes = aes - - @property - def eel_pfc(self): - """Gets the eel_pfc of this Customs. # noqa: E501 - - - :return: The eel_pfc of this Customs. # noqa: E501 - :rtype: str - """ - return self._eel_pfc - - @eel_pfc.setter - def eel_pfc(self, eel_pfc): - """Sets the eel_pfc of this Customs. - - - :param eel_pfc: The eel_pfc of this Customs. # noqa: E501 - :type: str - """ - - self._eel_pfc = eel_pfc - - @property - def content_type(self): - """Gets the content_type of this Customs. # noqa: E501 - - - :return: The content_type of this Customs. # noqa: E501 - :rtype: str - """ - return self._content_type - - @content_type.setter - def content_type(self, content_type): - """Sets the content_type of this Customs. - - - :param content_type: The content_type of this Customs. # noqa: E501 - :type: str - """ - allowed_values = ["documents", "gift", "sample", "merchandise", "return_merchandise", "other"] # noqa: E501 - if content_type not in allowed_values: - raise ValueError( - "Invalid value for `content_type` ({0}), must be one of {1}" # noqa: E501 - .format(content_type, allowed_values) - ) - - self._content_type = content_type - - @property - def content_description(self): - """Gets the content_description of this Customs. # noqa: E501 - - - :return: The content_description of this Customs. # noqa: E501 - :rtype: str - """ - return self._content_description - - @content_description.setter - def content_description(self, content_description): - """Sets the content_description of this Customs. - - - :param content_description: The content_description of this Customs. # noqa: E501 - :type: str - """ - - self._content_description = content_description - - @property - def incoterm(self): - """Gets the incoterm of this Customs. # noqa: E501 - - The customs 'term of trade' also known as 'incoterm' # noqa: E501 - - :return: The incoterm of this Customs. # noqa: E501 - :rtype: str - """ - return self._incoterm - - @incoterm.setter - def incoterm(self, incoterm): - """Sets the incoterm of this Customs. - - The customs 'term of trade' also known as 'incoterm' # noqa: E501 - - :param incoterm: The incoterm of this Customs. # noqa: E501 - :type: str - """ - allowed_values = ["CFR", "CIF", "CIP", "CPT", "DAF", "DDP", "DDU", "DEQ", "DES", "EXW", "FAS", "FCA", "FOB"] # noqa: E501 - if incoterm not in allowed_values: - raise ValueError( - "Invalid value for `incoterm` ({0}), must be one of {1}" # noqa: E501 - .format(incoterm, allowed_values) - ) - - self._incoterm = incoterm - - @property - def commodities(self): - """Gets the commodities of this Customs. # noqa: E501 - - The parcel content items # noqa: E501 - - :return: The commodities of this Customs. # noqa: E501 - :rtype: list[Commodity] - """ - return self._commodities - - @commodities.setter - def commodities(self, commodities): - """Sets the commodities of this Customs. - - The parcel content items # noqa: E501 - - :param commodities: The commodities of this Customs. # noqa: E501 - :type: list[Commodity] - """ - - self._commodities = commodities - - @property - def duty(self): - """Gets the duty of this Customs. # noqa: E501 - - - :return: The duty of this Customs. # noqa: E501 - :rtype: Duty - """ - return self._duty - - @duty.setter - def duty(self, duty): - """Sets the duty of this Customs. - - - :param duty: The duty of this Customs. # noqa: E501 - :type: Duty - """ - - self._duty = duty - - @property - def invoice(self): - """Gets the invoice of this Customs. # noqa: E501 - - The invoice reference number # noqa: E501 - - :return: The invoice of this Customs. # noqa: E501 - :rtype: str - """ - return self._invoice - - @invoice.setter - def invoice(self, invoice): - """Sets the invoice of this Customs. - - The invoice reference number # noqa: E501 - - :param invoice: The invoice of this Customs. # noqa: E501 - :type: str - """ - - self._invoice = invoice - - @property - def invoice_date(self): - """Gets the invoice_date of this Customs. # noqa: E501 - - The invoice date # noqa: E501 - - :return: The invoice_date of this Customs. # noqa: E501 - :rtype: str - """ - return self._invoice_date - - @invoice_date.setter - def invoice_date(self, invoice_date): - """Sets the invoice_date of this Customs. - - The invoice date # noqa: E501 - - :param invoice_date: The invoice_date of this Customs. # noqa: E501 - :type: str - """ - - self._invoice_date = invoice_date - - @property - def commercial_invoice(self): - """Gets the commercial_invoice of this Customs. # noqa: E501 - - Indicates if the shipment is commercial # noqa: E501 - - :return: The commercial_invoice of this Customs. # noqa: E501 - :rtype: bool - """ - return self._commercial_invoice - - @commercial_invoice.setter - def commercial_invoice(self, commercial_invoice): - """Sets the commercial_invoice of this Customs. - - Indicates if the shipment is commercial # noqa: E501 - - :param commercial_invoice: The commercial_invoice of this Customs. # noqa: E501 - :type: bool - """ - - self._commercial_invoice = commercial_invoice - - @property - def certify(self): - """Gets the certify of this Customs. # noqa: E501 - - Indicate that signer certified confirmed all # noqa: E501 - - :return: The certify of this Customs. # noqa: E501 - :rtype: bool - """ - return self._certify - - @certify.setter - def certify(self, certify): - """Sets the certify of this Customs. - - Indicate that signer certified confirmed all # noqa: E501 - - :param certify: The certify of this Customs. # noqa: E501 - :type: bool - """ - - self._certify = certify - - @property - def signer(self): - """Gets the signer of this Customs. # noqa: E501 - - - :return: The signer of this Customs. # noqa: E501 - :rtype: str - """ - return self._signer - - @signer.setter - def signer(self, signer): - """Sets the signer of this Customs. - - - :param signer: The signer of this Customs. # noqa: E501 - :type: str - """ - - self._signer = signer - - @property - def certificate_number(self): - """Gets the certificate_number of this Customs. # noqa: E501 - - - :return: The certificate_number of this Customs. # noqa: E501 - :rtype: str - """ - return self._certificate_number - - @certificate_number.setter - def certificate_number(self, certificate_number): - """Sets the certificate_number of this Customs. - - - :param certificate_number: The certificate_number of this Customs. # noqa: E501 - :type: str - """ - - self._certificate_number = certificate_number - - @property - def options(self): - """Gets the options of this Customs. # noqa: E501 - - - :return: The options of this Customs. # noqa: E501 - :rtype: object - """ - return self._options - - @options.setter - def options(self, options): - """Sets the options of this Customs. - - - :param options: The options of this Customs. # noqa: E501 - :type: object - """ - - self._options = options - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(Customs, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, Customs): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/purplship/models/customs_data.py b/purplship/models/customs_data.py deleted file mode 100644 index c20f88b..0000000 --- a/purplship/models/customs_data.py +++ /dev/null @@ -1,472 +0,0 @@ -# coding: utf-8 - -""" - Purplship API - - ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.6.2`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 - - OpenAPI spec version: 2021.6.2 - Contact: hello@purplship.com - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - -import pprint -import re # noqa: F401 - -import six - -class CustomsData(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'aes': 'str', - 'eel_pfc': 'str', - 'content_type': 'str', - 'content_description': 'str', - 'incoterm': 'str', - 'commodities': 'list[Commodity]', - 'duty': 'Duty', - 'invoice': 'str', - 'invoice_date': 'str', - 'commercial_invoice': 'bool', - 'certify': 'bool', - 'signer': 'str', - 'certificate_number': 'str', - 'options': 'object' - } - - attribute_map = { - 'aes': 'aes', - 'eel_pfc': 'eel_pfc', - 'content_type': 'content_type', - 'content_description': 'content_description', - 'incoterm': 'incoterm', - 'commodities': 'commodities', - 'duty': 'duty', - 'invoice': 'invoice', - 'invoice_date': 'invoice_date', - 'commercial_invoice': 'commercial_invoice', - 'certify': 'certify', - 'signer': 'signer', - 'certificate_number': 'certificate_number', - 'options': 'options' - } - - def __init__(self, aes=None, eel_pfc=None, content_type=None, content_description=None, incoterm=None, commodities=None, duty=None, invoice=None, invoice_date=None, commercial_invoice=None, certify=None, signer=None, certificate_number=None, options=None): # noqa: E501 - """CustomsData - a model defined in Swagger""" # noqa: E501 - self._aes = None - self._eel_pfc = None - self._content_type = None - self._content_description = None - self._incoterm = None - self._commodities = None - self._duty = None - self._invoice = None - self._invoice_date = None - self._commercial_invoice = None - self._certify = None - self._signer = None - self._certificate_number = None - self._options = None - self.discriminator = None - if aes is not None: - self.aes = aes - if eel_pfc is not None: - self.eel_pfc = eel_pfc - if content_type is not None: - self.content_type = content_type - if content_description is not None: - self.content_description = content_description - if incoterm is not None: - self.incoterm = incoterm - if commodities is not None: - self.commodities = commodities - if duty is not None: - self.duty = duty - if invoice is not None: - self.invoice = invoice - if invoice_date is not None: - self.invoice_date = invoice_date - if commercial_invoice is not None: - self.commercial_invoice = commercial_invoice - if certify is not None: - self.certify = certify - if signer is not None: - self.signer = signer - if certificate_number is not None: - self.certificate_number = certificate_number - if options is not None: - self.options = options - - @property - def aes(self): - """Gets the aes of this CustomsData. # noqa: E501 - - - :return: The aes of this CustomsData. # noqa: E501 - :rtype: str - """ - return self._aes - - @aes.setter - def aes(self, aes): - """Sets the aes of this CustomsData. - - - :param aes: The aes of this CustomsData. # noqa: E501 - :type: str - """ - - self._aes = aes - - @property - def eel_pfc(self): - """Gets the eel_pfc of this CustomsData. # noqa: E501 - - - :return: The eel_pfc of this CustomsData. # noqa: E501 - :rtype: str - """ - return self._eel_pfc - - @eel_pfc.setter - def eel_pfc(self, eel_pfc): - """Sets the eel_pfc of this CustomsData. - - - :param eel_pfc: The eel_pfc of this CustomsData. # noqa: E501 - :type: str - """ - - self._eel_pfc = eel_pfc - - @property - def content_type(self): - """Gets the content_type of this CustomsData. # noqa: E501 - - - :return: The content_type of this CustomsData. # noqa: E501 - :rtype: str - """ - return self._content_type - - @content_type.setter - def content_type(self, content_type): - """Sets the content_type of this CustomsData. - - - :param content_type: The content_type of this CustomsData. # noqa: E501 - :type: str - """ - allowed_values = ["documents", "gift", "sample", "merchandise", "return_merchandise", "other"] # noqa: E501 - if content_type not in allowed_values: - raise ValueError( - "Invalid value for `content_type` ({0}), must be one of {1}" # noqa: E501 - .format(content_type, allowed_values) - ) - - self._content_type = content_type - - @property - def content_description(self): - """Gets the content_description of this CustomsData. # noqa: E501 - - - :return: The content_description of this CustomsData. # noqa: E501 - :rtype: str - """ - return self._content_description - - @content_description.setter - def content_description(self, content_description): - """Sets the content_description of this CustomsData. - - - :param content_description: The content_description of this CustomsData. # noqa: E501 - :type: str - """ - - self._content_description = content_description - - @property - def incoterm(self): - """Gets the incoterm of this CustomsData. # noqa: E501 - - The customs 'term of trade' also known as 'incoterm' # noqa: E501 - - :return: The incoterm of this CustomsData. # noqa: E501 - :rtype: str - """ - return self._incoterm - - @incoterm.setter - def incoterm(self, incoterm): - """Sets the incoterm of this CustomsData. - - The customs 'term of trade' also known as 'incoterm' # noqa: E501 - - :param incoterm: The incoterm of this CustomsData. # noqa: E501 - :type: str - """ - allowed_values = ["CFR", "CIF", "CIP", "CPT", "DAF", "DDP", "DDU", "DEQ", "DES", "EXW", "FAS", "FCA", "FOB"] # noqa: E501 - if incoterm not in allowed_values: - raise ValueError( - "Invalid value for `incoterm` ({0}), must be one of {1}" # noqa: E501 - .format(incoterm, allowed_values) - ) - - self._incoterm = incoterm - - @property - def commodities(self): - """Gets the commodities of this CustomsData. # noqa: E501 - - The parcel content items # noqa: E501 - - :return: The commodities of this CustomsData. # noqa: E501 - :rtype: list[Commodity] - """ - return self._commodities - - @commodities.setter - def commodities(self, commodities): - """Sets the commodities of this CustomsData. - - The parcel content items # noqa: E501 - - :param commodities: The commodities of this CustomsData. # noqa: E501 - :type: list[Commodity] - """ - - self._commodities = commodities - - @property - def duty(self): - """Gets the duty of this CustomsData. # noqa: E501 - - - :return: The duty of this CustomsData. # noqa: E501 - :rtype: Duty - """ - return self._duty - - @duty.setter - def duty(self, duty): - """Sets the duty of this CustomsData. - - - :param duty: The duty of this CustomsData. # noqa: E501 - :type: Duty - """ - - self._duty = duty - - @property - def invoice(self): - """Gets the invoice of this CustomsData. # noqa: E501 - - The invoice reference number # noqa: E501 - - :return: The invoice of this CustomsData. # noqa: E501 - :rtype: str - """ - return self._invoice - - @invoice.setter - def invoice(self, invoice): - """Sets the invoice of this CustomsData. - - The invoice reference number # noqa: E501 - - :param invoice: The invoice of this CustomsData. # noqa: E501 - :type: str - """ - - self._invoice = invoice - - @property - def invoice_date(self): - """Gets the invoice_date of this CustomsData. # noqa: E501 - - The invoice date # noqa: E501 - - :return: The invoice_date of this CustomsData. # noqa: E501 - :rtype: str - """ - return self._invoice_date - - @invoice_date.setter - def invoice_date(self, invoice_date): - """Sets the invoice_date of this CustomsData. - - The invoice date # noqa: E501 - - :param invoice_date: The invoice_date of this CustomsData. # noqa: E501 - :type: str - """ - - self._invoice_date = invoice_date - - @property - def commercial_invoice(self): - """Gets the commercial_invoice of this CustomsData. # noqa: E501 - - Indicates if the shipment is commercial # noqa: E501 - - :return: The commercial_invoice of this CustomsData. # noqa: E501 - :rtype: bool - """ - return self._commercial_invoice - - @commercial_invoice.setter - def commercial_invoice(self, commercial_invoice): - """Sets the commercial_invoice of this CustomsData. - - Indicates if the shipment is commercial # noqa: E501 - - :param commercial_invoice: The commercial_invoice of this CustomsData. # noqa: E501 - :type: bool - """ - - self._commercial_invoice = commercial_invoice - - @property - def certify(self): - """Gets the certify of this CustomsData. # noqa: E501 - - Indicate that signer certified confirmed all # noqa: E501 - - :return: The certify of this CustomsData. # noqa: E501 - :rtype: bool - """ - return self._certify - - @certify.setter - def certify(self, certify): - """Sets the certify of this CustomsData. - - Indicate that signer certified confirmed all # noqa: E501 - - :param certify: The certify of this CustomsData. # noqa: E501 - :type: bool - """ - - self._certify = certify - - @property - def signer(self): - """Gets the signer of this CustomsData. # noqa: E501 - - - :return: The signer of this CustomsData. # noqa: E501 - :rtype: str - """ - return self._signer - - @signer.setter - def signer(self, signer): - """Sets the signer of this CustomsData. - - - :param signer: The signer of this CustomsData. # noqa: E501 - :type: str - """ - - self._signer = signer - - @property - def certificate_number(self): - """Gets the certificate_number of this CustomsData. # noqa: E501 - - - :return: The certificate_number of this CustomsData. # noqa: E501 - :rtype: str - """ - return self._certificate_number - - @certificate_number.setter - def certificate_number(self, certificate_number): - """Sets the certificate_number of this CustomsData. - - - :param certificate_number: The certificate_number of this CustomsData. # noqa: E501 - :type: str - """ - - self._certificate_number = certificate_number - - @property - def options(self): - """Gets the options of this CustomsData. # noqa: E501 - - - :return: The options of this CustomsData. # noqa: E501 - :rtype: object - """ - return self._options - - @options.setter - def options(self, options): - """Sets the options of this CustomsData. - - - :param options: The options of this CustomsData. # noqa: E501 - :type: object - """ - - self._options = options - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(CustomsData, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, CustomsData): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/purplship/models/customs_list.py b/purplship/models/customs_list.py deleted file mode 100644 index 7fbd8f6..0000000 --- a/purplship/models/customs_list.py +++ /dev/null @@ -1,163 +0,0 @@ -# coding: utf-8 - -""" - Purplship API - - ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.6.2`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 - - OpenAPI spec version: 2021.6.2 - Contact: hello@purplship.com - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - -import pprint -import re # noqa: F401 - -import six - -class CustomsList(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'next': 'str', - 'previous': 'str', - 'results': 'list[Customs]' - } - - attribute_map = { - 'next': 'next', - 'previous': 'previous', - 'results': 'results' - } - - def __init__(self, next=None, previous=None, results=None): # noqa: E501 - """CustomsList - a model defined in Swagger""" # noqa: E501 - self._next = None - self._previous = None - self._results = None - self.discriminator = None - if next is not None: - self.next = next - if previous is not None: - self.previous = previous - self.results = results - - @property - def next(self): - """Gets the next of this CustomsList. # noqa: E501 - - - :return: The next of this CustomsList. # noqa: E501 - :rtype: str - """ - return self._next - - @next.setter - def next(self, next): - """Sets the next of this CustomsList. - - - :param next: The next of this CustomsList. # noqa: E501 - :type: str - """ - - self._next = next - - @property - def previous(self): - """Gets the previous of this CustomsList. # noqa: E501 - - - :return: The previous of this CustomsList. # noqa: E501 - :rtype: str - """ - return self._previous - - @previous.setter - def previous(self, previous): - """Sets the previous of this CustomsList. - - - :param previous: The previous of this CustomsList. # noqa: E501 - :type: str - """ - - self._previous = previous - - @property - def results(self): - """Gets the results of this CustomsList. # noqa: E501 - - - :return: The results of this CustomsList. # noqa: E501 - :rtype: list[Customs] - """ - return self._results - - @results.setter - def results(self, results): - """Sets the results of this CustomsList. - - - :param results: The results of this CustomsList. # noqa: E501 - :type: list[Customs] - """ - if results is None: - raise ValueError("Invalid value for `results`, must not be `None`") # noqa: E501 - - self._results = results - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(CustomsList, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, CustomsList): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/purplship/models/duty.py b/purplship/models/duty.py deleted file mode 100644 index 03a3c0b..0000000 --- a/purplship/models/duty.py +++ /dev/null @@ -1,234 +0,0 @@ -# coding: utf-8 - -""" - Purplship API - - ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.6.2`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 - - OpenAPI spec version: 2021.6.2 - Contact: hello@purplship.com - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - -import pprint -import re # noqa: F401 - -import six - -class Duty(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'paid_by': 'str', - 'currency': 'str', - 'declared_value': 'float', - 'account_number': 'str', - 'bill_to': 'Address' - } - - attribute_map = { - 'paid_by': 'paid_by', - 'currency': 'currency', - 'declared_value': 'declared_value', - 'account_number': 'account_number', - 'bill_to': 'bill_to' - } - - def __init__(self, paid_by=None, currency=None, declared_value=None, account_number=None, bill_to=None): # noqa: E501 - """Duty - a model defined in Swagger""" # noqa: E501 - self._paid_by = None - self._currency = None - self._declared_value = None - self._account_number = None - self._bill_to = None - self.discriminator = None - if paid_by is not None: - self.paid_by = paid_by - if currency is not None: - self.currency = currency - if declared_value is not None: - self.declared_value = declared_value - if account_number is not None: - self.account_number = account_number - if bill_to is not None: - self.bill_to = bill_to - - @property - def paid_by(self): - """Gets the paid_by of this Duty. # noqa: E501 - - The duty payer # noqa: E501 - - :return: The paid_by of this Duty. # noqa: E501 - :rtype: str - """ - return self._paid_by - - @paid_by.setter - def paid_by(self, paid_by): - """Sets the paid_by of this Duty. - - The duty payer # noqa: E501 - - :param paid_by: The paid_by of this Duty. # noqa: E501 - :type: str - """ - allowed_values = ["sender", "recipient", "third_party"] # noqa: E501 - if paid_by not in allowed_values: - raise ValueError( - "Invalid value for `paid_by` ({0}), must be one of {1}" # noqa: E501 - .format(paid_by, allowed_values) - ) - - self._paid_by = paid_by - - @property - def currency(self): - """Gets the currency of this Duty. # noqa: E501 - - The declared value currency # noqa: E501 - - :return: The currency of this Duty. # noqa: E501 - :rtype: str - """ - return self._currency - - @currency.setter - def currency(self, currency): - """Sets the currency of this Duty. - - The declared value currency # noqa: E501 - - :param currency: The currency of this Duty. # noqa: E501 - :type: str - """ - allowed_values = ["EUR", "AED", "USD", "XCD", "AMD", "ANG", "AOA", "ARS", "AUD", "AWG", "AZN", "BAM", "BBD", "BDT", "XOF", "BGN", "BHD", "BIF", "BMD", "BND", "BOB", "BRL", "BSD", "BTN", "BWP", "BYN", "BZD", "CAD", "CDF", "XAF", "CHF", "NZD", "CLP", "CNY", "COP", "CRC", "CUC", "CVE", "CZK", "DJF", "DKK", "DOP", "DZD", "EGP", "ERN", "ETB", "FJD", "GBP", "GEL", "GHS", "GMD", "GNF", "GTQ", "GYD", "HKD", "HNL", "HRK", "HTG", "HUF", "IDR", "ILS", "INR", "IRR", "ISK", "JMD", "JOD", "JPY", "KES", "KGS", "KHR", "KMF", "KPW", "KRW", "KWD", "KYD", "KZT", "LAK", "LKR", "LRD", "LSL", "LYD", "MAD", "MDL", "MGA", "MKD", "MMK", "MNT", "MOP", "MRO", "MUR", "MVR", "MWK", "MXN", "MYR", "MZN", "NAD", "XPF", "NGN", "NIO", "NOK", "NPR", "OMR", "PEN", "PGK", "PHP", "PKR", "PLN", "PYG", "QAR", "RSD", "RUB", "RWF", "SAR", "SBD", "SCR", "SDG", "SEK", "SGD", "SHP", "SLL", "SOS", "SRD", "SSP", "STD", "SYP", "SZL", "THB", "TJS", "TND", "TOP", "TRY", "TTD", "TWD", "TZS", "UAH", "UYU", "UZS", "VEF", "VND", "VUV", "WST", "YER", "ZAR"] # noqa: E501 - if currency not in allowed_values: - raise ValueError( - "Invalid value for `currency` ({0}), must be one of {1}" # noqa: E501 - .format(currency, allowed_values) - ) - - self._currency = currency - - @property - def declared_value(self): - """Gets the declared_value of this Duty. # noqa: E501 - - The package declared value # noqa: E501 - - :return: The declared_value of this Duty. # noqa: E501 - :rtype: float - """ - return self._declared_value - - @declared_value.setter - def declared_value(self, declared_value): - """Sets the declared_value of this Duty. - - The package declared value # noqa: E501 - - :param declared_value: The declared_value of this Duty. # noqa: E501 - :type: float - """ - - self._declared_value = declared_value - - @property - def account_number(self): - """Gets the account_number of this Duty. # noqa: E501 - - The duty payment account number # noqa: E501 - - :return: The account_number of this Duty. # noqa: E501 - :rtype: str - """ - return self._account_number - - @account_number.setter - def account_number(self, account_number): - """Sets the account_number of this Duty. - - The duty payment account number # noqa: E501 - - :param account_number: The account_number of this Duty. # noqa: E501 - :type: str - """ - - self._account_number = account_number - - @property - def bill_to(self): - """Gets the bill_to of this Duty. # noqa: E501 - - - :return: The bill_to of this Duty. # noqa: E501 - :rtype: Address - """ - return self._bill_to - - @bill_to.setter - def bill_to(self, bill_to): - """Sets the bill_to of this Duty. - - - :param bill_to: The bill_to of this Duty. # noqa: E501 - :type: Address - """ - - self._bill_to = bill_to - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(Duty, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, Duty): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/purplship/models/error_response.py b/purplship/models/error_response.py deleted file mode 100644 index 4e01ad8..0000000 --- a/purplship/models/error_response.py +++ /dev/null @@ -1,112 +0,0 @@ -# coding: utf-8 - -""" - Purplship API - - ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.6.2`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 - - OpenAPI spec version: 2021.6.2 - Contact: hello@purplship.com - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - -import pprint -import re # noqa: F401 - -import six - -class ErrorResponse(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'messages': 'list[Message]' - } - - attribute_map = { - 'messages': 'messages' - } - - def __init__(self, messages=None): # noqa: E501 - """ErrorResponse - a model defined in Swagger""" # noqa: E501 - self._messages = None - self.discriminator = None - if messages is not None: - self.messages = messages - - @property - def messages(self): - """Gets the messages of this ErrorResponse. # noqa: E501 - - The list of error messages # noqa: E501 - - :return: The messages of this ErrorResponse. # noqa: E501 - :rtype: list[Message] - """ - return self._messages - - @messages.setter - def messages(self, messages): - """Sets the messages of this ErrorResponse. - - The list of error messages # noqa: E501 - - :param messages: The messages of this ErrorResponse. # noqa: E501 - :type: list[Message] - """ - - self._messages = messages - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(ErrorResponse, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, ErrorResponse): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/purplship/models/message.py b/purplship/models/message.py deleted file mode 100644 index bffff3e..0000000 --- a/purplship/models/message.py +++ /dev/null @@ -1,224 +0,0 @@ -# coding: utf-8 - -""" - Purplship API - - ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.6.2`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 - - OpenAPI spec version: 2021.6.2 - Contact: hello@purplship.com - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - -import pprint -import re # noqa: F401 - -import six - -class Message(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'carrier_name': 'str', - 'carrier_id': 'str', - 'message': 'str', - 'code': 'str', - 'details': 'dict(str, str)' - } - - attribute_map = { - 'carrier_name': 'carrier_name', - 'carrier_id': 'carrier_id', - 'message': 'message', - 'code': 'code', - 'details': 'details' - } - - def __init__(self, carrier_name=None, carrier_id=None, message=None, code=None, details=None): # noqa: E501 - """Message - a model defined in Swagger""" # noqa: E501 - self._carrier_name = None - self._carrier_id = None - self._message = None - self._code = None - self._details = None - self.discriminator = None - if carrier_name is not None: - self.carrier_name = carrier_name - if carrier_id is not None: - self.carrier_id = carrier_id - if message is not None: - self.message = message - if code is not None: - self.code = code - if details is not None: - self.details = details - - @property - def carrier_name(self): - """Gets the carrier_name of this Message. # noqa: E501 - - The targeted carrier # noqa: E501 - - :return: The carrier_name of this Message. # noqa: E501 - :rtype: str - """ - return self._carrier_name - - @carrier_name.setter - def carrier_name(self, carrier_name): - """Sets the carrier_name of this Message. - - The targeted carrier # noqa: E501 - - :param carrier_name: The carrier_name of this Message. # noqa: E501 - :type: str - """ - - self._carrier_name = carrier_name - - @property - def carrier_id(self): - """Gets the carrier_id of this Message. # noqa: E501 - - The targeted carrier name (unique identifier) # noqa: E501 - - :return: The carrier_id of this Message. # noqa: E501 - :rtype: str - """ - return self._carrier_id - - @carrier_id.setter - def carrier_id(self, carrier_id): - """Sets the carrier_id of this Message. - - The targeted carrier name (unique identifier) # noqa: E501 - - :param carrier_id: The carrier_id of this Message. # noqa: E501 - :type: str - """ - - self._carrier_id = carrier_id - - @property - def message(self): - """Gets the message of this Message. # noqa: E501 - - The error or warning message # noqa: E501 - - :return: The message of this Message. # noqa: E501 - :rtype: str - """ - return self._message - - @message.setter - def message(self, message): - """Sets the message of this Message. - - The error or warning message # noqa: E501 - - :param message: The message of this Message. # noqa: E501 - :type: str - """ - - self._message = message - - @property - def code(self): - """Gets the code of this Message. # noqa: E501 - - The message code # noqa: E501 - - :return: The code of this Message. # noqa: E501 - :rtype: str - """ - return self._code - - @code.setter - def code(self, code): - """Sets the code of this Message. - - The message code # noqa: E501 - - :param code: The code of this Message. # noqa: E501 - :type: str - """ - - self._code = code - - @property - def details(self): - """Gets the details of this Message. # noqa: E501 - - any additional details # noqa: E501 - - :return: The details of this Message. # noqa: E501 - :rtype: dict(str, str) - """ - return self._details - - @details.setter - def details(self, details): - """Sets the details of this Message. - - any additional details # noqa: E501 - - :param details: The details of this Message. # noqa: E501 - :type: dict(str, str) - """ - - self._details = details - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(Message, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, Message): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/purplship/models/operation.py b/purplship/models/operation.py deleted file mode 100644 index 5a0f3d7..0000000 --- a/purplship/models/operation.py +++ /dev/null @@ -1,142 +0,0 @@ -# coding: utf-8 - -""" - Purplship API - - ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.6.2`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 - - OpenAPI spec version: 2021.6.2 - Contact: hello@purplship.com - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - -import pprint -import re # noqa: F401 - -import six - -class Operation(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'operation': 'str', - 'success': 'bool' - } - - attribute_map = { - 'operation': 'operation', - 'success': 'success' - } - - def __init__(self, operation=None, success=None): # noqa: E501 - """Operation - a model defined in Swagger""" # noqa: E501 - self._operation = None - self._success = None - self.discriminator = None - self.operation = operation - self.success = success - - @property - def operation(self): - """Gets the operation of this Operation. # noqa: E501 - - Operation performed # noqa: E501 - - :return: The operation of this Operation. # noqa: E501 - :rtype: str - """ - return self._operation - - @operation.setter - def operation(self, operation): - """Sets the operation of this Operation. - - Operation performed # noqa: E501 - - :param operation: The operation of this Operation. # noqa: E501 - :type: str - """ - if operation is None: - raise ValueError("Invalid value for `operation`, must not be `None`") # noqa: E501 - - self._operation = operation - - @property - def success(self): - """Gets the success of this Operation. # noqa: E501 - - Specify whether the operation was successful # noqa: E501 - - :return: The success of this Operation. # noqa: E501 - :rtype: bool - """ - return self._success - - @success.setter - def success(self, success): - """Sets the success of this Operation. - - Specify whether the operation was successful # noqa: E501 - - :param success: The success of this Operation. # noqa: E501 - :type: bool - """ - if success is None: - raise ValueError("Invalid value for `success`, must not be `None`") # noqa: E501 - - self._success = success - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(Operation, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, Operation): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/purplship/models/operation_confirmation.py b/purplship/models/operation_confirmation.py deleted file mode 100644 index 5604339..0000000 --- a/purplship/models/operation_confirmation.py +++ /dev/null @@ -1,200 +0,0 @@ -# coding: utf-8 - -""" - Purplship API - - ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.6.2`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 - - OpenAPI spec version: 2021.6.2 - Contact: hello@purplship.com - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - -import pprint -import re # noqa: F401 - -import six - -class OperationConfirmation(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'operation': 'str', - 'success': 'bool', - 'carrier_name': 'str', - 'carrier_id': 'str' - } - - attribute_map = { - 'operation': 'operation', - 'success': 'success', - 'carrier_name': 'carrier_name', - 'carrier_id': 'carrier_id' - } - - def __init__(self, operation=None, success=None, carrier_name=None, carrier_id=None): # noqa: E501 - """OperationConfirmation - a model defined in Swagger""" # noqa: E501 - self._operation = None - self._success = None - self._carrier_name = None - self._carrier_id = None - self.discriminator = None - self.operation = operation - self.success = success - self.carrier_name = carrier_name - self.carrier_id = carrier_id - - @property - def operation(self): - """Gets the operation of this OperationConfirmation. # noqa: E501 - - Operation performed # noqa: E501 - - :return: The operation of this OperationConfirmation. # noqa: E501 - :rtype: str - """ - return self._operation - - @operation.setter - def operation(self, operation): - """Sets the operation of this OperationConfirmation. - - Operation performed # noqa: E501 - - :param operation: The operation of this OperationConfirmation. # noqa: E501 - :type: str - """ - if operation is None: - raise ValueError("Invalid value for `operation`, must not be `None`") # noqa: E501 - - self._operation = operation - - @property - def success(self): - """Gets the success of this OperationConfirmation. # noqa: E501 - - Specify whether the operation was successful # noqa: E501 - - :return: The success of this OperationConfirmation. # noqa: E501 - :rtype: bool - """ - return self._success - - @success.setter - def success(self, success): - """Sets the success of this OperationConfirmation. - - Specify whether the operation was successful # noqa: E501 - - :param success: The success of this OperationConfirmation. # noqa: E501 - :type: bool - """ - if success is None: - raise ValueError("Invalid value for `success`, must not be `None`") # noqa: E501 - - self._success = success - - @property - def carrier_name(self): - """Gets the carrier_name of this OperationConfirmation. # noqa: E501 - - The operation carrier # noqa: E501 - - :return: The carrier_name of this OperationConfirmation. # noqa: E501 - :rtype: str - """ - return self._carrier_name - - @carrier_name.setter - def carrier_name(self, carrier_name): - """Sets the carrier_name of this OperationConfirmation. - - The operation carrier # noqa: E501 - - :param carrier_name: The carrier_name of this OperationConfirmation. # noqa: E501 - :type: str - """ - if carrier_name is None: - raise ValueError("Invalid value for `carrier_name`, must not be `None`") # noqa: E501 - - self._carrier_name = carrier_name - - @property - def carrier_id(self): - """Gets the carrier_id of this OperationConfirmation. # noqa: E501 - - The targeted carrier's name (unique identifier) # noqa: E501 - - :return: The carrier_id of this OperationConfirmation. # noqa: E501 - :rtype: str - """ - return self._carrier_id - - @carrier_id.setter - def carrier_id(self, carrier_id): - """Sets the carrier_id of this OperationConfirmation. - - The targeted carrier's name (unique identifier) # noqa: E501 - - :param carrier_id: The carrier_id of this OperationConfirmation. # noqa: E501 - :type: str - """ - if carrier_id is None: - raise ValueError("Invalid value for `carrier_id`, must not be `None`") # noqa: E501 - - self._carrier_id = carrier_id - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(OperationConfirmation, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, OperationConfirmation): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/purplship/models/operation_response.py b/purplship/models/operation_response.py deleted file mode 100644 index 1c0494b..0000000 --- a/purplship/models/operation_response.py +++ /dev/null @@ -1,138 +0,0 @@ -# coding: utf-8 - -""" - Purplship API - - ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.6.2`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 - - OpenAPI spec version: 2021.6.2 - Contact: hello@purplship.com - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - -import pprint -import re # noqa: F401 - -import six - -class OperationResponse(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'messages': 'list[Message]', - 'confirmation': 'OperationConfirmation' - } - - attribute_map = { - 'messages': 'messages', - 'confirmation': 'confirmation' - } - - def __init__(self, messages=None, confirmation=None): # noqa: E501 - """OperationResponse - a model defined in Swagger""" # noqa: E501 - self._messages = None - self._confirmation = None - self.discriminator = None - if messages is not None: - self.messages = messages - if confirmation is not None: - self.confirmation = confirmation - - @property - def messages(self): - """Gets the messages of this OperationResponse. # noqa: E501 - - The list of note or warning messages # noqa: E501 - - :return: The messages of this OperationResponse. # noqa: E501 - :rtype: list[Message] - """ - return self._messages - - @messages.setter - def messages(self, messages): - """Sets the messages of this OperationResponse. - - The list of note or warning messages # noqa: E501 - - :param messages: The messages of this OperationResponse. # noqa: E501 - :type: list[Message] - """ - - self._messages = messages - - @property - def confirmation(self): - """Gets the confirmation of this OperationResponse. # noqa: E501 - - - :return: The confirmation of this OperationResponse. # noqa: E501 - :rtype: OperationConfirmation - """ - return self._confirmation - - @confirmation.setter - def confirmation(self, confirmation): - """Sets the confirmation of this OperationResponse. - - - :param confirmation: The confirmation of this OperationResponse. # noqa: E501 - :type: OperationConfirmation - """ - - self._confirmation = confirmation - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(OperationResponse, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, OperationResponse): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/purplship/models/parcel.py b/purplship/models/parcel.py deleted file mode 100644 index 543fb59..0000000 --- a/purplship/models/parcel.py +++ /dev/null @@ -1,434 +0,0 @@ -# coding: utf-8 - -""" - Purplship API - - ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.6.2`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 - - OpenAPI spec version: 2021.6.2 - Contact: hello@purplship.com - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - -import pprint -import re # noqa: F401 - -import six - -class Parcel(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'id': 'str', - 'weight': 'float', - 'width': 'float', - 'height': 'float', - 'length': 'float', - 'packaging_type': 'str', - 'package_preset': 'str', - 'description': 'str', - 'content': 'str', - 'is_document': 'bool', - 'weight_unit': 'str', - 'dimension_unit': 'str' - } - - attribute_map = { - 'id': 'id', - 'weight': 'weight', - 'width': 'width', - 'height': 'height', - 'length': 'length', - 'packaging_type': 'packaging_type', - 'package_preset': 'package_preset', - 'description': 'description', - 'content': 'content', - 'is_document': 'is_document', - 'weight_unit': 'weight_unit', - 'dimension_unit': 'dimension_unit' - } - - def __init__(self, id=None, weight=None, width=None, height=None, length=None, packaging_type=None, package_preset=None, description=None, content=None, is_document=False, weight_unit=None, dimension_unit=None): # noqa: E501 - """Parcel - a model defined in Swagger""" # noqa: E501 - self._id = None - self._weight = None - self._width = None - self._height = None - self._length = None - self._packaging_type = None - self._package_preset = None - self._description = None - self._content = None - self._is_document = None - self._weight_unit = None - self._dimension_unit = None - self.discriminator = None - if id is not None: - self.id = id - self.weight = weight - if width is not None: - self.width = width - if height is not None: - self.height = height - if length is not None: - self.length = length - if packaging_type is not None: - self.packaging_type = packaging_type - if package_preset is not None: - self.package_preset = package_preset - if description is not None: - self.description = description - if content is not None: - self.content = content - if is_document is not None: - self.is_document = is_document - self.weight_unit = weight_unit - if dimension_unit is not None: - self.dimension_unit = dimension_unit - - @property - def id(self): - """Gets the id of this Parcel. # noqa: E501 - - A unique identifier # noqa: E501 - - :return: The id of this Parcel. # noqa: E501 - :rtype: str - """ - return self._id - - @id.setter - def id(self, id): - """Sets the id of this Parcel. - - A unique identifier # noqa: E501 - - :param id: The id of this Parcel. # noqa: E501 - :type: str - """ - - self._id = id - - @property - def weight(self): - """Gets the weight of this Parcel. # noqa: E501 - - The parcel's weight # noqa: E501 - - :return: The weight of this Parcel. # noqa: E501 - :rtype: float - """ - return self._weight - - @weight.setter - def weight(self, weight): - """Sets the weight of this Parcel. - - The parcel's weight # noqa: E501 - - :param weight: The weight of this Parcel. # noqa: E501 - :type: float - """ - if weight is None: - raise ValueError("Invalid value for `weight`, must not be `None`") # noqa: E501 - - self._weight = weight - - @property - def width(self): - """Gets the width of this Parcel. # noqa: E501 - - The parcel's width # noqa: E501 - - :return: The width of this Parcel. # noqa: E501 - :rtype: float - """ - return self._width - - @width.setter - def width(self, width): - """Sets the width of this Parcel. - - The parcel's width # noqa: E501 - - :param width: The width of this Parcel. # noqa: E501 - :type: float - """ - - self._width = width - - @property - def height(self): - """Gets the height of this Parcel. # noqa: E501 - - The parcel's height # noqa: E501 - - :return: The height of this Parcel. # noqa: E501 - :rtype: float - """ - return self._height - - @height.setter - def height(self, height): - """Sets the height of this Parcel. - - The parcel's height # noqa: E501 - - :param height: The height of this Parcel. # noqa: E501 - :type: float - """ - - self._height = height - - @property - def length(self): - """Gets the length of this Parcel. # noqa: E501 - - The parcel's length # noqa: E501 - - :return: The length of this Parcel. # noqa: E501 - :rtype: float - """ - return self._length - - @length.setter - def length(self, length): - """Sets the length of this Parcel. - - The parcel's length # noqa: E501 - - :param length: The length of this Parcel. # noqa: E501 - :type: float - """ - - self._length = length - - @property - def packaging_type(self): - """Gets the packaging_type of this Parcel. # noqa: E501 - - The parcel's packaging type. **Note that the packaging is optional when using a package preset** values:
- **envelope**
- **pak**
- **tube**
- **pallet**
- **small_box**
- **medium_box**
- **your_packaging** For specific carriers packaging type, please consult [the reference](#operation/references). # noqa: E501 - - :return: The packaging_type of this Parcel. # noqa: E501 - :rtype: str - """ - return self._packaging_type - - @packaging_type.setter - def packaging_type(self, packaging_type): - """Sets the packaging_type of this Parcel. - - The parcel's packaging type. **Note that the packaging is optional when using a package preset** values:
- **envelope**
- **pak**
- **tube**
- **pallet**
- **small_box**
- **medium_box**
- **your_packaging** For specific carriers packaging type, please consult [the reference](#operation/references). # noqa: E501 - - :param packaging_type: The packaging_type of this Parcel. # noqa: E501 - :type: str - """ - - self._packaging_type = packaging_type - - @property - def package_preset(self): - """Gets the package_preset of this Parcel. # noqa: E501 - - The parcel's package preset. For specific carriers package preset, please consult [the reference](#operation/references). # noqa: E501 - - :return: The package_preset of this Parcel. # noqa: E501 - :rtype: str - """ - return self._package_preset - - @package_preset.setter - def package_preset(self, package_preset): - """Sets the package_preset of this Parcel. - - The parcel's package preset. For specific carriers package preset, please consult [the reference](#operation/references). # noqa: E501 - - :param package_preset: The package_preset of this Parcel. # noqa: E501 - :type: str - """ - - self._package_preset = package_preset - - @property - def description(self): - """Gets the description of this Parcel. # noqa: E501 - - The parcel's description # noqa: E501 - - :return: The description of this Parcel. # noqa: E501 - :rtype: str - """ - return self._description - - @description.setter - def description(self, description): - """Sets the description of this Parcel. - - The parcel's description # noqa: E501 - - :param description: The description of this Parcel. # noqa: E501 - :type: str - """ - - self._description = description - - @property - def content(self): - """Gets the content of this Parcel. # noqa: E501 - - The parcel's content description # noqa: E501 - - :return: The content of this Parcel. # noqa: E501 - :rtype: str - """ - return self._content - - @content.setter - def content(self, content): - """Sets the content of this Parcel. - - The parcel's content description # noqa: E501 - - :param content: The content of this Parcel. # noqa: E501 - :type: str - """ - - self._content = content - - @property - def is_document(self): - """Gets the is_document of this Parcel. # noqa: E501 - - Indicates if the parcel is composed of documents only # noqa: E501 - - :return: The is_document of this Parcel. # noqa: E501 - :rtype: bool - """ - return self._is_document - - @is_document.setter - def is_document(self, is_document): - """Sets the is_document of this Parcel. - - Indicates if the parcel is composed of documents only # noqa: E501 - - :param is_document: The is_document of this Parcel. # noqa: E501 - :type: bool - """ - - self._is_document = is_document - - @property - def weight_unit(self): - """Gets the weight_unit of this Parcel. # noqa: E501 - - The parcel's weight unit # noqa: E501 - - :return: The weight_unit of this Parcel. # noqa: E501 - :rtype: str - """ - return self._weight_unit - - @weight_unit.setter - def weight_unit(self, weight_unit): - """Sets the weight_unit of this Parcel. - - The parcel's weight unit # noqa: E501 - - :param weight_unit: The weight_unit of this Parcel. # noqa: E501 - :type: str - """ - if weight_unit is None: - raise ValueError("Invalid value for `weight_unit`, must not be `None`") # noqa: E501 - allowed_values = ["KG", "LB"] # noqa: E501 - if weight_unit not in allowed_values: - raise ValueError( - "Invalid value for `weight_unit` ({0}), must be one of {1}" # noqa: E501 - .format(weight_unit, allowed_values) - ) - - self._weight_unit = weight_unit - - @property - def dimension_unit(self): - """Gets the dimension_unit of this Parcel. # noqa: E501 - - The parcel's dimension unit # noqa: E501 - - :return: The dimension_unit of this Parcel. # noqa: E501 - :rtype: str - """ - return self._dimension_unit - - @dimension_unit.setter - def dimension_unit(self, dimension_unit): - """Sets the dimension_unit of this Parcel. - - The parcel's dimension unit # noqa: E501 - - :param dimension_unit: The dimension_unit of this Parcel. # noqa: E501 - :type: str - """ - allowed_values = ["CM", "IN"] # noqa: E501 - if dimension_unit not in allowed_values: - raise ValueError( - "Invalid value for `dimension_unit` ({0}), must be one of {1}" # noqa: E501 - .format(dimension_unit, allowed_values) - ) - - self._dimension_unit = dimension_unit - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(Parcel, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, Parcel): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/purplship/models/parcel_data.py b/purplship/models/parcel_data.py deleted file mode 100644 index 504887c..0000000 --- a/purplship/models/parcel_data.py +++ /dev/null @@ -1,406 +0,0 @@ -# coding: utf-8 - -""" - Purplship API - - ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.6.2`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 - - OpenAPI spec version: 2021.6.2 - Contact: hello@purplship.com - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - -import pprint -import re # noqa: F401 - -import six - -class ParcelData(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'weight': 'float', - 'width': 'float', - 'height': 'float', - 'length': 'float', - 'packaging_type': 'str', - 'package_preset': 'str', - 'description': 'str', - 'content': 'str', - 'is_document': 'bool', - 'weight_unit': 'str', - 'dimension_unit': 'str' - } - - attribute_map = { - 'weight': 'weight', - 'width': 'width', - 'height': 'height', - 'length': 'length', - 'packaging_type': 'packaging_type', - 'package_preset': 'package_preset', - 'description': 'description', - 'content': 'content', - 'is_document': 'is_document', - 'weight_unit': 'weight_unit', - 'dimension_unit': 'dimension_unit' - } - - def __init__(self, weight=None, width=None, height=None, length=None, packaging_type=None, package_preset=None, description=None, content=None, is_document=False, weight_unit=None, dimension_unit=None): # noqa: E501 - """ParcelData - a model defined in Swagger""" # noqa: E501 - self._weight = None - self._width = None - self._height = None - self._length = None - self._packaging_type = None - self._package_preset = None - self._description = None - self._content = None - self._is_document = None - self._weight_unit = None - self._dimension_unit = None - self.discriminator = None - self.weight = weight - if width is not None: - self.width = width - if height is not None: - self.height = height - if length is not None: - self.length = length - if packaging_type is not None: - self.packaging_type = packaging_type - if package_preset is not None: - self.package_preset = package_preset - if description is not None: - self.description = description - if content is not None: - self.content = content - if is_document is not None: - self.is_document = is_document - self.weight_unit = weight_unit - if dimension_unit is not None: - self.dimension_unit = dimension_unit - - @property - def weight(self): - """Gets the weight of this ParcelData. # noqa: E501 - - The parcel's weight # noqa: E501 - - :return: The weight of this ParcelData. # noqa: E501 - :rtype: float - """ - return self._weight - - @weight.setter - def weight(self, weight): - """Sets the weight of this ParcelData. - - The parcel's weight # noqa: E501 - - :param weight: The weight of this ParcelData. # noqa: E501 - :type: float - """ - if weight is None: - raise ValueError("Invalid value for `weight`, must not be `None`") # noqa: E501 - - self._weight = weight - - @property - def width(self): - """Gets the width of this ParcelData. # noqa: E501 - - The parcel's width # noqa: E501 - - :return: The width of this ParcelData. # noqa: E501 - :rtype: float - """ - return self._width - - @width.setter - def width(self, width): - """Sets the width of this ParcelData. - - The parcel's width # noqa: E501 - - :param width: The width of this ParcelData. # noqa: E501 - :type: float - """ - - self._width = width - - @property - def height(self): - """Gets the height of this ParcelData. # noqa: E501 - - The parcel's height # noqa: E501 - - :return: The height of this ParcelData. # noqa: E501 - :rtype: float - """ - return self._height - - @height.setter - def height(self, height): - """Sets the height of this ParcelData. - - The parcel's height # noqa: E501 - - :param height: The height of this ParcelData. # noqa: E501 - :type: float - """ - - self._height = height - - @property - def length(self): - """Gets the length of this ParcelData. # noqa: E501 - - The parcel's length # noqa: E501 - - :return: The length of this ParcelData. # noqa: E501 - :rtype: float - """ - return self._length - - @length.setter - def length(self, length): - """Sets the length of this ParcelData. - - The parcel's length # noqa: E501 - - :param length: The length of this ParcelData. # noqa: E501 - :type: float - """ - - self._length = length - - @property - def packaging_type(self): - """Gets the packaging_type of this ParcelData. # noqa: E501 - - The parcel's packaging type. **Note that the packaging is optional when using a package preset** values:
- **envelope**
- **pak**
- **tube**
- **pallet**
- **small_box**
- **medium_box**
- **your_packaging** For specific carriers packaging type, please consult [the reference](#operation/references). # noqa: E501 - - :return: The packaging_type of this ParcelData. # noqa: E501 - :rtype: str - """ - return self._packaging_type - - @packaging_type.setter - def packaging_type(self, packaging_type): - """Sets the packaging_type of this ParcelData. - - The parcel's packaging type. **Note that the packaging is optional when using a package preset** values:
- **envelope**
- **pak**
- **tube**
- **pallet**
- **small_box**
- **medium_box**
- **your_packaging** For specific carriers packaging type, please consult [the reference](#operation/references). # noqa: E501 - - :param packaging_type: The packaging_type of this ParcelData. # noqa: E501 - :type: str - """ - - self._packaging_type = packaging_type - - @property - def package_preset(self): - """Gets the package_preset of this ParcelData. # noqa: E501 - - The parcel's package preset. For specific carriers package preset, please consult [the reference](#operation/references). # noqa: E501 - - :return: The package_preset of this ParcelData. # noqa: E501 - :rtype: str - """ - return self._package_preset - - @package_preset.setter - def package_preset(self, package_preset): - """Sets the package_preset of this ParcelData. - - The parcel's package preset. For specific carriers package preset, please consult [the reference](#operation/references). # noqa: E501 - - :param package_preset: The package_preset of this ParcelData. # noqa: E501 - :type: str - """ - - self._package_preset = package_preset - - @property - def description(self): - """Gets the description of this ParcelData. # noqa: E501 - - The parcel's description # noqa: E501 - - :return: The description of this ParcelData. # noqa: E501 - :rtype: str - """ - return self._description - - @description.setter - def description(self, description): - """Sets the description of this ParcelData. - - The parcel's description # noqa: E501 - - :param description: The description of this ParcelData. # noqa: E501 - :type: str - """ - - self._description = description - - @property - def content(self): - """Gets the content of this ParcelData. # noqa: E501 - - The parcel's content description # noqa: E501 - - :return: The content of this ParcelData. # noqa: E501 - :rtype: str - """ - return self._content - - @content.setter - def content(self, content): - """Sets the content of this ParcelData. - - The parcel's content description # noqa: E501 - - :param content: The content of this ParcelData. # noqa: E501 - :type: str - """ - - self._content = content - - @property - def is_document(self): - """Gets the is_document of this ParcelData. # noqa: E501 - - Indicates if the parcel is composed of documents only # noqa: E501 - - :return: The is_document of this ParcelData. # noqa: E501 - :rtype: bool - """ - return self._is_document - - @is_document.setter - def is_document(self, is_document): - """Sets the is_document of this ParcelData. - - Indicates if the parcel is composed of documents only # noqa: E501 - - :param is_document: The is_document of this ParcelData. # noqa: E501 - :type: bool - """ - - self._is_document = is_document - - @property - def weight_unit(self): - """Gets the weight_unit of this ParcelData. # noqa: E501 - - The parcel's weight unit # noqa: E501 - - :return: The weight_unit of this ParcelData. # noqa: E501 - :rtype: str - """ - return self._weight_unit - - @weight_unit.setter - def weight_unit(self, weight_unit): - """Sets the weight_unit of this ParcelData. - - The parcel's weight unit # noqa: E501 - - :param weight_unit: The weight_unit of this ParcelData. # noqa: E501 - :type: str - """ - if weight_unit is None: - raise ValueError("Invalid value for `weight_unit`, must not be `None`") # noqa: E501 - allowed_values = ["KG", "LB"] # noqa: E501 - if weight_unit not in allowed_values: - raise ValueError( - "Invalid value for `weight_unit` ({0}), must be one of {1}" # noqa: E501 - .format(weight_unit, allowed_values) - ) - - self._weight_unit = weight_unit - - @property - def dimension_unit(self): - """Gets the dimension_unit of this ParcelData. # noqa: E501 - - The parcel's dimension unit # noqa: E501 - - :return: The dimension_unit of this ParcelData. # noqa: E501 - :rtype: str - """ - return self._dimension_unit - - @dimension_unit.setter - def dimension_unit(self, dimension_unit): - """Sets the dimension_unit of this ParcelData. - - The parcel's dimension unit # noqa: E501 - - :param dimension_unit: The dimension_unit of this ParcelData. # noqa: E501 - :type: str - """ - allowed_values = ["CM", "IN"] # noqa: E501 - if dimension_unit not in allowed_values: - raise ValueError( - "Invalid value for `dimension_unit` ({0}), must be one of {1}" # noqa: E501 - .format(dimension_unit, allowed_values) - ) - - self._dimension_unit = dimension_unit - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(ParcelData, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, ParcelData): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/purplship/models/parcel_list.py b/purplship/models/parcel_list.py deleted file mode 100644 index c614291..0000000 --- a/purplship/models/parcel_list.py +++ /dev/null @@ -1,163 +0,0 @@ -# coding: utf-8 - -""" - Purplship API - - ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.6.2`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 - - OpenAPI spec version: 2021.6.2 - Contact: hello@purplship.com - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - -import pprint -import re # noqa: F401 - -import six - -class ParcelList(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'next': 'str', - 'previous': 'str', - 'results': 'list[Parcel]' - } - - attribute_map = { - 'next': 'next', - 'previous': 'previous', - 'results': 'results' - } - - def __init__(self, next=None, previous=None, results=None): # noqa: E501 - """ParcelList - a model defined in Swagger""" # noqa: E501 - self._next = None - self._previous = None - self._results = None - self.discriminator = None - if next is not None: - self.next = next - if previous is not None: - self.previous = previous - self.results = results - - @property - def next(self): - """Gets the next of this ParcelList. # noqa: E501 - - - :return: The next of this ParcelList. # noqa: E501 - :rtype: str - """ - return self._next - - @next.setter - def next(self, next): - """Sets the next of this ParcelList. - - - :param next: The next of this ParcelList. # noqa: E501 - :type: str - """ - - self._next = next - - @property - def previous(self): - """Gets the previous of this ParcelList. # noqa: E501 - - - :return: The previous of this ParcelList. # noqa: E501 - :rtype: str - """ - return self._previous - - @previous.setter - def previous(self, previous): - """Sets the previous of this ParcelList. - - - :param previous: The previous of this ParcelList. # noqa: E501 - :type: str - """ - - self._previous = previous - - @property - def results(self): - """Gets the results of this ParcelList. # noqa: E501 - - - :return: The results of this ParcelList. # noqa: E501 - :rtype: list[Parcel] - """ - return self._results - - @results.setter - def results(self, results): - """Sets the results of this ParcelList. - - - :param results: The results of this ParcelList. # noqa: E501 - :type: list[Parcel] - """ - if results is None: - raise ValueError("Invalid value for `results`, must not be `None`") # noqa: E501 - - self._results = results - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(ParcelList, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, ParcelList): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/purplship/models/payment.py b/purplship/models/payment.py deleted file mode 100644 index a24f039..0000000 --- a/purplship/models/payment.py +++ /dev/null @@ -1,180 +0,0 @@ -# coding: utf-8 - -""" - Purplship API - - ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.6.2`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 - - OpenAPI spec version: 2021.6.2 - Contact: hello@purplship.com - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - -import pprint -import re # noqa: F401 - -import six - -class Payment(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'paid_by': 'str', - 'currency': 'str', - 'account_number': 'str' - } - - attribute_map = { - 'paid_by': 'paid_by', - 'currency': 'currency', - 'account_number': 'account_number' - } - - def __init__(self, paid_by='sender', currency=None, account_number=None): # noqa: E501 - """Payment - a model defined in Swagger""" # noqa: E501 - self._paid_by = None - self._currency = None - self._account_number = None - self.discriminator = None - if paid_by is not None: - self.paid_by = paid_by - if currency is not None: - self.currency = currency - if account_number is not None: - self.account_number = account_number - - @property - def paid_by(self): - """Gets the paid_by of this Payment. # noqa: E501 - - The payor type # noqa: E501 - - :return: The paid_by of this Payment. # noqa: E501 - :rtype: str - """ - return self._paid_by - - @paid_by.setter - def paid_by(self, paid_by): - """Sets the paid_by of this Payment. - - The payor type # noqa: E501 - - :param paid_by: The paid_by of this Payment. # noqa: E501 - :type: str - """ - allowed_values = ["sender", "recipient", "third_party"] # noqa: E501 - if paid_by not in allowed_values: - raise ValueError( - "Invalid value for `paid_by` ({0}), must be one of {1}" # noqa: E501 - .format(paid_by, allowed_values) - ) - - self._paid_by = paid_by - - @property - def currency(self): - """Gets the currency of this Payment. # noqa: E501 - - The payment amount currency # noqa: E501 - - :return: The currency of this Payment. # noqa: E501 - :rtype: str - """ - return self._currency - - @currency.setter - def currency(self, currency): - """Sets the currency of this Payment. - - The payment amount currency # noqa: E501 - - :param currency: The currency of this Payment. # noqa: E501 - :type: str - """ - allowed_values = ["EUR", "AED", "USD", "XCD", "AMD", "ANG", "AOA", "ARS", "AUD", "AWG", "AZN", "BAM", "BBD", "BDT", "XOF", "BGN", "BHD", "BIF", "BMD", "BND", "BOB", "BRL", "BSD", "BTN", "BWP", "BYN", "BZD", "CAD", "CDF", "XAF", "CHF", "NZD", "CLP", "CNY", "COP", "CRC", "CUC", "CVE", "CZK", "DJF", "DKK", "DOP", "DZD", "EGP", "ERN", "ETB", "FJD", "GBP", "GEL", "GHS", "GMD", "GNF", "GTQ", "GYD", "HKD", "HNL", "HRK", "HTG", "HUF", "IDR", "ILS", "INR", "IRR", "ISK", "JMD", "JOD", "JPY", "KES", "KGS", "KHR", "KMF", "KPW", "KRW", "KWD", "KYD", "KZT", "LAK", "LKR", "LRD", "LSL", "LYD", "MAD", "MDL", "MGA", "MKD", "MMK", "MNT", "MOP", "MRO", "MUR", "MVR", "MWK", "MXN", "MYR", "MZN", "NAD", "XPF", "NGN", "NIO", "NOK", "NPR", "OMR", "PEN", "PGK", "PHP", "PKR", "PLN", "PYG", "QAR", "RSD", "RUB", "RWF", "SAR", "SBD", "SCR", "SDG", "SEK", "SGD", "SHP", "SLL", "SOS", "SRD", "SSP", "STD", "SYP", "SZL", "THB", "TJS", "TND", "TOP", "TRY", "TTD", "TWD", "TZS", "UAH", "UYU", "UZS", "VEF", "VND", "VUV", "WST", "YER", "ZAR"] # noqa: E501 - if currency not in allowed_values: - raise ValueError( - "Invalid value for `currency` ({0}), must be one of {1}" # noqa: E501 - .format(currency, allowed_values) - ) - - self._currency = currency - - @property - def account_number(self): - """Gets the account_number of this Payment. # noqa: E501 - - The payor account number # noqa: E501 - - :return: The account_number of this Payment. # noqa: E501 - :rtype: str - """ - return self._account_number - - @account_number.setter - def account_number(self, account_number): - """Sets the account_number of this Payment. - - The payor account number # noqa: E501 - - :param account_number: The account_number of this Payment. # noqa: E501 - :type: str - """ - - self._account_number = account_number - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(Payment, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, Payment): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/purplship/models/pickup.py b/purplship/models/pickup.py deleted file mode 100644 index 4bb4720..0000000 --- a/purplship/models/pickup.py +++ /dev/null @@ -1,478 +0,0 @@ -# coding: utf-8 - -""" - Purplship API - - ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.6.2`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 - - OpenAPI spec version: 2021.6.2 - Contact: hello@purplship.com - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - -import pprint -import re # noqa: F401 - -import six - -class Pickup(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'id': 'str', - 'carrier_name': 'str', - 'carrier_id': 'str', - 'confirmation_number': 'str', - 'pickup_date': 'str', - 'pickup_charge': 'Charge', - 'ready_time': 'str', - 'closing_time': 'str', - 'address': 'Address', - 'parcels': 'list[Parcel]', - 'instruction': 'str', - 'package_location': 'str', - 'options': 'object', - 'test_mode': 'bool' - } - - attribute_map = { - 'id': 'id', - 'carrier_name': 'carrier_name', - 'carrier_id': 'carrier_id', - 'confirmation_number': 'confirmation_number', - 'pickup_date': 'pickup_date', - 'pickup_charge': 'pickup_charge', - 'ready_time': 'ready_time', - 'closing_time': 'closing_time', - 'address': 'address', - 'parcels': 'parcels', - 'instruction': 'instruction', - 'package_location': 'package_location', - 'options': 'options', - 'test_mode': 'test_mode' - } - - def __init__(self, id=None, carrier_name=None, carrier_id=None, confirmation_number=None, pickup_date=None, pickup_charge=None, ready_time=None, closing_time=None, address=None, parcels=None, instruction=None, package_location=None, options=None, test_mode=None): # noqa: E501 - """Pickup - a model defined in Swagger""" # noqa: E501 - self._id = None - self._carrier_name = None - self._carrier_id = None - self._confirmation_number = None - self._pickup_date = None - self._pickup_charge = None - self._ready_time = None - self._closing_time = None - self._address = None - self._parcels = None - self._instruction = None - self._package_location = None - self._options = None - self._test_mode = None - self.discriminator = None - if id is not None: - self.id = id - self.carrier_name = carrier_name - self.carrier_id = carrier_id - self.confirmation_number = confirmation_number - if pickup_date is not None: - self.pickup_date = pickup_date - if pickup_charge is not None: - self.pickup_charge = pickup_charge - if ready_time is not None: - self.ready_time = ready_time - if closing_time is not None: - self.closing_time = closing_time - self.address = address - self.parcels = parcels - if instruction is not None: - self.instruction = instruction - if package_location is not None: - self.package_location = package_location - if options is not None: - self.options = options - self.test_mode = test_mode - - @property - def id(self): - """Gets the id of this Pickup. # noqa: E501 - - A unique pickup identifier # noqa: E501 - - :return: The id of this Pickup. # noqa: E501 - :rtype: str - """ - return self._id - - @id.setter - def id(self, id): - """Sets the id of this Pickup. - - A unique pickup identifier # noqa: E501 - - :param id: The id of this Pickup. # noqa: E501 - :type: str - """ - - self._id = id - - @property - def carrier_name(self): - """Gets the carrier_name of this Pickup. # noqa: E501 - - The pickup carrier # noqa: E501 - - :return: The carrier_name of this Pickup. # noqa: E501 - :rtype: str - """ - return self._carrier_name - - @carrier_name.setter - def carrier_name(self, carrier_name): - """Sets the carrier_name of this Pickup. - - The pickup carrier # noqa: E501 - - :param carrier_name: The carrier_name of this Pickup. # noqa: E501 - :type: str - """ - if carrier_name is None: - raise ValueError("Invalid value for `carrier_name`, must not be `None`") # noqa: E501 - - self._carrier_name = carrier_name - - @property - def carrier_id(self): - """Gets the carrier_id of this Pickup. # noqa: E501 - - The pickup carrier configured name # noqa: E501 - - :return: The carrier_id of this Pickup. # noqa: E501 - :rtype: str - """ - return self._carrier_id - - @carrier_id.setter - def carrier_id(self, carrier_id): - """Sets the carrier_id of this Pickup. - - The pickup carrier configured name # noqa: E501 - - :param carrier_id: The carrier_id of this Pickup. # noqa: E501 - :type: str - """ - if carrier_id is None: - raise ValueError("Invalid value for `carrier_id`, must not be `None`") # noqa: E501 - - self._carrier_id = carrier_id - - @property - def confirmation_number(self): - """Gets the confirmation_number of this Pickup. # noqa: E501 - - The pickup confirmation identifier # noqa: E501 - - :return: The confirmation_number of this Pickup. # noqa: E501 - :rtype: str - """ - return self._confirmation_number - - @confirmation_number.setter - def confirmation_number(self, confirmation_number): - """Sets the confirmation_number of this Pickup. - - The pickup confirmation identifier # noqa: E501 - - :param confirmation_number: The confirmation_number of this Pickup. # noqa: E501 - :type: str - """ - if confirmation_number is None: - raise ValueError("Invalid value for `confirmation_number`, must not be `None`") # noqa: E501 - - self._confirmation_number = confirmation_number - - @property - def pickup_date(self): - """Gets the pickup_date of this Pickup. # noqa: E501 - - The pickup date # noqa: E501 - - :return: The pickup_date of this Pickup. # noqa: E501 - :rtype: str - """ - return self._pickup_date - - @pickup_date.setter - def pickup_date(self, pickup_date): - """Sets the pickup_date of this Pickup. - - The pickup date # noqa: E501 - - :param pickup_date: The pickup_date of this Pickup. # noqa: E501 - :type: str - """ - - self._pickup_date = pickup_date - - @property - def pickup_charge(self): - """Gets the pickup_charge of this Pickup. # noqa: E501 - - - :return: The pickup_charge of this Pickup. # noqa: E501 - :rtype: Charge - """ - return self._pickup_charge - - @pickup_charge.setter - def pickup_charge(self, pickup_charge): - """Sets the pickup_charge of this Pickup. - - - :param pickup_charge: The pickup_charge of this Pickup. # noqa: E501 - :type: Charge - """ - - self._pickup_charge = pickup_charge - - @property - def ready_time(self): - """Gets the ready_time of this Pickup. # noqa: E501 - - The pickup expected ready time # noqa: E501 - - :return: The ready_time of this Pickup. # noqa: E501 - :rtype: str - """ - return self._ready_time - - @ready_time.setter - def ready_time(self, ready_time): - """Sets the ready_time of this Pickup. - - The pickup expected ready time # noqa: E501 - - :param ready_time: The ready_time of this Pickup. # noqa: E501 - :type: str - """ - - self._ready_time = ready_time - - @property - def closing_time(self): - """Gets the closing_time of this Pickup. # noqa: E501 - - The pickup expected closing or late time # noqa: E501 - - :return: The closing_time of this Pickup. # noqa: E501 - :rtype: str - """ - return self._closing_time - - @closing_time.setter - def closing_time(self, closing_time): - """Sets the closing_time of this Pickup. - - The pickup expected closing or late time # noqa: E501 - - :param closing_time: The closing_time of this Pickup. # noqa: E501 - :type: str - """ - - self._closing_time = closing_time - - @property - def address(self): - """Gets the address of this Pickup. # noqa: E501 - - - :return: The address of this Pickup. # noqa: E501 - :rtype: Address - """ - return self._address - - @address.setter - def address(self, address): - """Sets the address of this Pickup. - - - :param address: The address of this Pickup. # noqa: E501 - :type: Address - """ - if address is None: - raise ValueError("Invalid value for `address`, must not be `None`") # noqa: E501 - - self._address = address - - @property - def parcels(self): - """Gets the parcels of this Pickup. # noqa: E501 - - The shipment parcels to pickup. # noqa: E501 - - :return: The parcels of this Pickup. # noqa: E501 - :rtype: list[Parcel] - """ - return self._parcels - - @parcels.setter - def parcels(self, parcels): - """Sets the parcels of this Pickup. - - The shipment parcels to pickup. # noqa: E501 - - :param parcels: The parcels of this Pickup. # noqa: E501 - :type: list[Parcel] - """ - if parcels is None: - raise ValueError("Invalid value for `parcels`, must not be `None`") # noqa: E501 - - self._parcels = parcels - - @property - def instruction(self): - """Gets the instruction of this Pickup. # noqa: E501 - - The pickup instruction. eg: Handle with care. # noqa: E501 - - :return: The instruction of this Pickup. # noqa: E501 - :rtype: str - """ - return self._instruction - - @instruction.setter - def instruction(self, instruction): - """Sets the instruction of this Pickup. - - The pickup instruction. eg: Handle with care. # noqa: E501 - - :param instruction: The instruction of this Pickup. # noqa: E501 - :type: str - """ - - self._instruction = instruction - - @property - def package_location(self): - """Gets the package_location of this Pickup. # noqa: E501 - - The package(s) location. eg: Behind the entrance door. # noqa: E501 - - :return: The package_location of this Pickup. # noqa: E501 - :rtype: str - """ - return self._package_location - - @package_location.setter - def package_location(self, package_location): - """Sets the package_location of this Pickup. - - The package(s) location. eg: Behind the entrance door. # noqa: E501 - - :param package_location: The package_location of this Pickup. # noqa: E501 - :type: str - """ - - self._package_location = package_location - - @property - def options(self): - """Gets the options of this Pickup. # noqa: E501 - - Advanced carrier specific pickup options # noqa: E501 - - :return: The options of this Pickup. # noqa: E501 - :rtype: object - """ - return self._options - - @options.setter - def options(self, options): - """Sets the options of this Pickup. - - Advanced carrier specific pickup options # noqa: E501 - - :param options: The options of this Pickup. # noqa: E501 - :type: object - """ - - self._options = options - - @property - def test_mode(self): - """Gets the test_mode of this Pickup. # noqa: E501 - - Specified whether it was created with a carrier in test mode # noqa: E501 - - :return: The test_mode of this Pickup. # noqa: E501 - :rtype: bool - """ - return self._test_mode - - @test_mode.setter - def test_mode(self, test_mode): - """Sets the test_mode of this Pickup. - - Specified whether it was created with a carrier in test mode # noqa: E501 - - :param test_mode: The test_mode of this Pickup. # noqa: E501 - :type: bool - """ - if test_mode is None: - raise ValueError("Invalid value for `test_mode`, must not be `None`") # noqa: E501 - - self._test_mode = test_mode - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(Pickup, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, Pickup): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/purplship/models/pickup_cancel_data.py b/purplship/models/pickup_cancel_data.py deleted file mode 100644 index 9fa6d27..0000000 --- a/purplship/models/pickup_cancel_data.py +++ /dev/null @@ -1,112 +0,0 @@ -# coding: utf-8 - -""" - Purplship API - - ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.6.2`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 - - OpenAPI spec version: 2021.6.2 - Contact: hello@purplship.com - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - -import pprint -import re # noqa: F401 - -import six - -class PickupCancelData(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'reason': 'str' - } - - attribute_map = { - 'reason': 'reason' - } - - def __init__(self, reason=None): # noqa: E501 - """PickupCancelData - a model defined in Swagger""" # noqa: E501 - self._reason = None - self.discriminator = None - if reason is not None: - self.reason = reason - - @property - def reason(self): - """Gets the reason of this PickupCancelData. # noqa: E501 - - The reason of the pickup cancellation # noqa: E501 - - :return: The reason of this PickupCancelData. # noqa: E501 - :rtype: str - """ - return self._reason - - @reason.setter - def reason(self, reason): - """Sets the reason of this PickupCancelData. - - The reason of the pickup cancellation # noqa: E501 - - :param reason: The reason of this PickupCancelData. # noqa: E501 - :type: str - """ - - self._reason = reason - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(PickupCancelData, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, PickupCancelData): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/purplship/models/pickup_cancel_request.py b/purplship/models/pickup_cancel_request.py deleted file mode 100644 index fcce478..0000000 --- a/purplship/models/pickup_cancel_request.py +++ /dev/null @@ -1,195 +0,0 @@ -# coding: utf-8 - -""" - Purplship API - - ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.6.2`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 - - OpenAPI spec version: 2021.6.2 - Contact: hello@purplship.com - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - -import pprint -import re # noqa: F401 - -import six - -class PickupCancelRequest(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'confirmation_number': 'str', - 'address': 'AddressData', - 'pickup_date': 'str', - 'reason': 'str' - } - - attribute_map = { - 'confirmation_number': 'confirmation_number', - 'address': 'address', - 'pickup_date': 'pickup_date', - 'reason': 'reason' - } - - def __init__(self, confirmation_number=None, address=None, pickup_date=None, reason=None): # noqa: E501 - """PickupCancelRequest - a model defined in Swagger""" # noqa: E501 - self._confirmation_number = None - self._address = None - self._pickup_date = None - self._reason = None - self.discriminator = None - self.confirmation_number = confirmation_number - if address is not None: - self.address = address - if pickup_date is not None: - self.pickup_date = pickup_date - if reason is not None: - self.reason = reason - - @property - def confirmation_number(self): - """Gets the confirmation_number of this PickupCancelRequest. # noqa: E501 - - The pickup confirmation identifier # noqa: E501 - - :return: The confirmation_number of this PickupCancelRequest. # noqa: E501 - :rtype: str - """ - return self._confirmation_number - - @confirmation_number.setter - def confirmation_number(self, confirmation_number): - """Sets the confirmation_number of this PickupCancelRequest. - - The pickup confirmation identifier # noqa: E501 - - :param confirmation_number: The confirmation_number of this PickupCancelRequest. # noqa: E501 - :type: str - """ - if confirmation_number is None: - raise ValueError("Invalid value for `confirmation_number`, must not be `None`") # noqa: E501 - - self._confirmation_number = confirmation_number - - @property - def address(self): - """Gets the address of this PickupCancelRequest. # noqa: E501 - - - :return: The address of this PickupCancelRequest. # noqa: E501 - :rtype: AddressData - """ - return self._address - - @address.setter - def address(self, address): - """Sets the address of this PickupCancelRequest. - - - :param address: The address of this PickupCancelRequest. # noqa: E501 - :type: AddressData - """ - - self._address = address - - @property - def pickup_date(self): - """Gets the pickup_date of this PickupCancelRequest. # noqa: E501 - - The pickup date Date Format: `YYYY-MM-DD` # noqa: E501 - - :return: The pickup_date of this PickupCancelRequest. # noqa: E501 - :rtype: str - """ - return self._pickup_date - - @pickup_date.setter - def pickup_date(self, pickup_date): - """Sets the pickup_date of this PickupCancelRequest. - - The pickup date Date Format: `YYYY-MM-DD` # noqa: E501 - - :param pickup_date: The pickup_date of this PickupCancelRequest. # noqa: E501 - :type: str - """ - - self._pickup_date = pickup_date - - @property - def reason(self): - """Gets the reason of this PickupCancelRequest. # noqa: E501 - - The reason of the pickup cancellation # noqa: E501 - - :return: The reason of this PickupCancelRequest. # noqa: E501 - :rtype: str - """ - return self._reason - - @reason.setter - def reason(self, reason): - """Sets the reason of this PickupCancelRequest. - - The reason of the pickup cancellation # noqa: E501 - - :param reason: The reason of this PickupCancelRequest. # noqa: E501 - :type: str - """ - - self._reason = reason - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(PickupCancelRequest, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, PickupCancelRequest): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/purplship/models/pickup_data.py b/purplship/models/pickup_data.py deleted file mode 100644 index 7de20b4..0000000 --- a/purplship/models/pickup_data.py +++ /dev/null @@ -1,310 +0,0 @@ -# coding: utf-8 - -""" - Purplship API - - ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.6.2`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 - - OpenAPI spec version: 2021.6.2 - Contact: hello@purplship.com - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - -import pprint -import re # noqa: F401 - -import six - -class PickupData(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'pickup_date': 'str', - 'address': 'AddressData', - 'ready_time': 'str', - 'closing_time': 'str', - 'instruction': 'str', - 'package_location': 'str', - 'options': 'object', - 'tracking_numbers': 'list[str]' - } - - attribute_map = { - 'pickup_date': 'pickup_date', - 'address': 'address', - 'ready_time': 'ready_time', - 'closing_time': 'closing_time', - 'instruction': 'instruction', - 'package_location': 'package_location', - 'options': 'options', - 'tracking_numbers': 'tracking_numbers' - } - - def __init__(self, pickup_date=None, address=None, ready_time=None, closing_time=None, instruction=None, package_location=None, options=None, tracking_numbers=None): # noqa: E501 - """PickupData - a model defined in Swagger""" # noqa: E501 - self._pickup_date = None - self._address = None - self._ready_time = None - self._closing_time = None - self._instruction = None - self._package_location = None - self._options = None - self._tracking_numbers = None - self.discriminator = None - self.pickup_date = pickup_date - if address is not None: - self.address = address - self.ready_time = ready_time - self.closing_time = closing_time - if instruction is not None: - self.instruction = instruction - if package_location is not None: - self.package_location = package_location - if options is not None: - self.options = options - self.tracking_numbers = tracking_numbers - - @property - def pickup_date(self): - """Gets the pickup_date of this PickupData. # noqa: E501 - - The expected pickup date Date Format: `YYYY-MM-DD` # noqa: E501 - - :return: The pickup_date of this PickupData. # noqa: E501 - :rtype: str - """ - return self._pickup_date - - @pickup_date.setter - def pickup_date(self, pickup_date): - """Sets the pickup_date of this PickupData. - - The expected pickup date Date Format: `YYYY-MM-DD` # noqa: E501 - - :param pickup_date: The pickup_date of this PickupData. # noqa: E501 - :type: str - """ - if pickup_date is None: - raise ValueError("Invalid value for `pickup_date`, must not be `None`") # noqa: E501 - - self._pickup_date = pickup_date - - @property - def address(self): - """Gets the address of this PickupData. # noqa: E501 - - - :return: The address of this PickupData. # noqa: E501 - :rtype: AddressData - """ - return self._address - - @address.setter - def address(self, address): - """Sets the address of this PickupData. - - - :param address: The address of this PickupData. # noqa: E501 - :type: AddressData - """ - - self._address = address - - @property - def ready_time(self): - """Gets the ready_time of this PickupData. # noqa: E501 - - The ready time for pickup. Time Format: `HH:MM` # noqa: E501 - - :return: The ready_time of this PickupData. # noqa: E501 - :rtype: str - """ - return self._ready_time - - @ready_time.setter - def ready_time(self, ready_time): - """Sets the ready_time of this PickupData. - - The ready time for pickup. Time Format: `HH:MM` # noqa: E501 - - :param ready_time: The ready_time of this PickupData. # noqa: E501 - :type: str - """ - if ready_time is None: - raise ValueError("Invalid value for `ready_time`, must not be `None`") # noqa: E501 - - self._ready_time = ready_time - - @property - def closing_time(self): - """Gets the closing_time of this PickupData. # noqa: E501 - - The closing or late time of the pickup Time Format: `HH:MM` # noqa: E501 - - :return: The closing_time of this PickupData. # noqa: E501 - :rtype: str - """ - return self._closing_time - - @closing_time.setter - def closing_time(self, closing_time): - """Sets the closing_time of this PickupData. - - The closing or late time of the pickup Time Format: `HH:MM` # noqa: E501 - - :param closing_time: The closing_time of this PickupData. # noqa: E501 - :type: str - """ - if closing_time is None: - raise ValueError("Invalid value for `closing_time`, must not be `None`") # noqa: E501 - - self._closing_time = closing_time - - @property - def instruction(self): - """Gets the instruction of this PickupData. # noqa: E501 - - The pickup instruction. eg: Handle with care. # noqa: E501 - - :return: The instruction of this PickupData. # noqa: E501 - :rtype: str - """ - return self._instruction - - @instruction.setter - def instruction(self, instruction): - """Sets the instruction of this PickupData. - - The pickup instruction. eg: Handle with care. # noqa: E501 - - :param instruction: The instruction of this PickupData. # noqa: E501 - :type: str - """ - - self._instruction = instruction - - @property - def package_location(self): - """Gets the package_location of this PickupData. # noqa: E501 - - The package(s) location. eg: Behind the entrance door. # noqa: E501 - - :return: The package_location of this PickupData. # noqa: E501 - :rtype: str - """ - return self._package_location - - @package_location.setter - def package_location(self, package_location): - """Sets the package_location of this PickupData. - - The package(s) location. eg: Behind the entrance door. # noqa: E501 - - :param package_location: The package_location of this PickupData. # noqa: E501 - :type: str - """ - - self._package_location = package_location - - @property - def options(self): - """Gets the options of this PickupData. # noqa: E501 - - Advanced carrier specific pickup options # noqa: E501 - - :return: The options of this PickupData. # noqa: E501 - :rtype: object - """ - return self._options - - @options.setter - def options(self, options): - """Sets the options of this PickupData. - - Advanced carrier specific pickup options # noqa: E501 - - :param options: The options of this PickupData. # noqa: E501 - :type: object - """ - - self._options = options - - @property - def tracking_numbers(self): - """Gets the tracking_numbers of this PickupData. # noqa: E501 - - The list of shipments to be picked up # noqa: E501 - - :return: The tracking_numbers of this PickupData. # noqa: E501 - :rtype: list[str] - """ - return self._tracking_numbers - - @tracking_numbers.setter - def tracking_numbers(self, tracking_numbers): - """Sets the tracking_numbers of this PickupData. - - The list of shipments to be picked up # noqa: E501 - - :param tracking_numbers: The tracking_numbers of this PickupData. # noqa: E501 - :type: list[str] - """ - if tracking_numbers is None: - raise ValueError("Invalid value for `tracking_numbers`, must not be `None`") # noqa: E501 - - self._tracking_numbers = tracking_numbers - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(PickupData, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, PickupData): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/purplship/models/pickup_list.py b/purplship/models/pickup_list.py deleted file mode 100644 index 7115631..0000000 --- a/purplship/models/pickup_list.py +++ /dev/null @@ -1,163 +0,0 @@ -# coding: utf-8 - -""" - Purplship API - - ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.6.2`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 - - OpenAPI spec version: 2021.6.2 - Contact: hello@purplship.com - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - -import pprint -import re # noqa: F401 - -import six - -class PickupList(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'next': 'str', - 'previous': 'str', - 'results': 'list[Pickup]' - } - - attribute_map = { - 'next': 'next', - 'previous': 'previous', - 'results': 'results' - } - - def __init__(self, next=None, previous=None, results=None): # noqa: E501 - """PickupList - a model defined in Swagger""" # noqa: E501 - self._next = None - self._previous = None - self._results = None - self.discriminator = None - if next is not None: - self.next = next - if previous is not None: - self.previous = previous - self.results = results - - @property - def next(self): - """Gets the next of this PickupList. # noqa: E501 - - - :return: The next of this PickupList. # noqa: E501 - :rtype: str - """ - return self._next - - @next.setter - def next(self, next): - """Sets the next of this PickupList. - - - :param next: The next of this PickupList. # noqa: E501 - :type: str - """ - - self._next = next - - @property - def previous(self): - """Gets the previous of this PickupList. # noqa: E501 - - - :return: The previous of this PickupList. # noqa: E501 - :rtype: str - """ - return self._previous - - @previous.setter - def previous(self, previous): - """Sets the previous of this PickupList. - - - :param previous: The previous of this PickupList. # noqa: E501 - :type: str - """ - - self._previous = previous - - @property - def results(self): - """Gets the results of this PickupList. # noqa: E501 - - - :return: The results of this PickupList. # noqa: E501 - :rtype: list[Pickup] - """ - return self._results - - @results.setter - def results(self, results): - """Sets the results of this PickupList. - - - :param results: The results of this PickupList. # noqa: E501 - :type: list[Pickup] - """ - if results is None: - raise ValueError("Invalid value for `results`, must not be `None`") # noqa: E501 - - self._results = results - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(PickupList, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, PickupList): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/purplship/models/pickup_request.py b/purplship/models/pickup_request.py deleted file mode 100644 index 7019a2f..0000000 --- a/purplship/models/pickup_request.py +++ /dev/null @@ -1,311 +0,0 @@ -# coding: utf-8 - -""" - Purplship API - - ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.6.2`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 - - OpenAPI spec version: 2021.6.2 - Contact: hello@purplship.com - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - -import pprint -import re # noqa: F401 - -import six - -class PickupRequest(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'pickup_date': 'str', - 'address': 'AddressData', - 'parcels': 'list[ParcelData]', - 'ready_time': 'str', - 'closing_time': 'str', - 'instruction': 'str', - 'package_location': 'str', - 'options': 'object' - } - - attribute_map = { - 'pickup_date': 'pickup_date', - 'address': 'address', - 'parcels': 'parcels', - 'ready_time': 'ready_time', - 'closing_time': 'closing_time', - 'instruction': 'instruction', - 'package_location': 'package_location', - 'options': 'options' - } - - def __init__(self, pickup_date=None, address=None, parcels=None, ready_time=None, closing_time=None, instruction=None, package_location=None, options=None): # noqa: E501 - """PickupRequest - a model defined in Swagger""" # noqa: E501 - self._pickup_date = None - self._address = None - self._parcels = None - self._ready_time = None - self._closing_time = None - self._instruction = None - self._package_location = None - self._options = None - self.discriminator = None - self.pickup_date = pickup_date - self.address = address - self.parcels = parcels - self.ready_time = ready_time - self.closing_time = closing_time - if instruction is not None: - self.instruction = instruction - if package_location is not None: - self.package_location = package_location - if options is not None: - self.options = options - - @property - def pickup_date(self): - """Gets the pickup_date of this PickupRequest. # noqa: E501 - - The expected pickup date Date Format: `YYYY-MM-DD` # noqa: E501 - - :return: The pickup_date of this PickupRequest. # noqa: E501 - :rtype: str - """ - return self._pickup_date - - @pickup_date.setter - def pickup_date(self, pickup_date): - """Sets the pickup_date of this PickupRequest. - - The expected pickup date Date Format: `YYYY-MM-DD` # noqa: E501 - - :param pickup_date: The pickup_date of this PickupRequest. # noqa: E501 - :type: str - """ - if pickup_date is None: - raise ValueError("Invalid value for `pickup_date`, must not be `None`") # noqa: E501 - - self._pickup_date = pickup_date - - @property - def address(self): - """Gets the address of this PickupRequest. # noqa: E501 - - - :return: The address of this PickupRequest. # noqa: E501 - :rtype: AddressData - """ - return self._address - - @address.setter - def address(self, address): - """Sets the address of this PickupRequest. - - - :param address: The address of this PickupRequest. # noqa: E501 - :type: AddressData - """ - if address is None: - raise ValueError("Invalid value for `address`, must not be `None`") # noqa: E501 - - self._address = address - - @property - def parcels(self): - """Gets the parcels of this PickupRequest. # noqa: E501 - - The shipment parcels to pickup. # noqa: E501 - - :return: The parcels of this PickupRequest. # noqa: E501 - :rtype: list[ParcelData] - """ - return self._parcels - - @parcels.setter - def parcels(self, parcels): - """Sets the parcels of this PickupRequest. - - The shipment parcels to pickup. # noqa: E501 - - :param parcels: The parcels of this PickupRequest. # noqa: E501 - :type: list[ParcelData] - """ - if parcels is None: - raise ValueError("Invalid value for `parcels`, must not be `None`") # noqa: E501 - - self._parcels = parcels - - @property - def ready_time(self): - """Gets the ready_time of this PickupRequest. # noqa: E501 - - The ready time for pickup. Time Format: `HH:MM` # noqa: E501 - - :return: The ready_time of this PickupRequest. # noqa: E501 - :rtype: str - """ - return self._ready_time - - @ready_time.setter - def ready_time(self, ready_time): - """Sets the ready_time of this PickupRequest. - - The ready time for pickup. Time Format: `HH:MM` # noqa: E501 - - :param ready_time: The ready_time of this PickupRequest. # noqa: E501 - :type: str - """ - if ready_time is None: - raise ValueError("Invalid value for `ready_time`, must not be `None`") # noqa: E501 - - self._ready_time = ready_time - - @property - def closing_time(self): - """Gets the closing_time of this PickupRequest. # noqa: E501 - - The closing or late time of the pickup Time Format: `HH:MM` # noqa: E501 - - :return: The closing_time of this PickupRequest. # noqa: E501 - :rtype: str - """ - return self._closing_time - - @closing_time.setter - def closing_time(self, closing_time): - """Sets the closing_time of this PickupRequest. - - The closing or late time of the pickup Time Format: `HH:MM` # noqa: E501 - - :param closing_time: The closing_time of this PickupRequest. # noqa: E501 - :type: str - """ - if closing_time is None: - raise ValueError("Invalid value for `closing_time`, must not be `None`") # noqa: E501 - - self._closing_time = closing_time - - @property - def instruction(self): - """Gets the instruction of this PickupRequest. # noqa: E501 - - The pickup instruction. eg: Handle with care. # noqa: E501 - - :return: The instruction of this PickupRequest. # noqa: E501 - :rtype: str - """ - return self._instruction - - @instruction.setter - def instruction(self, instruction): - """Sets the instruction of this PickupRequest. - - The pickup instruction. eg: Handle with care. # noqa: E501 - - :param instruction: The instruction of this PickupRequest. # noqa: E501 - :type: str - """ - - self._instruction = instruction - - @property - def package_location(self): - """Gets the package_location of this PickupRequest. # noqa: E501 - - The package(s) location. eg: Behind the entrance door. # noqa: E501 - - :return: The package_location of this PickupRequest. # noqa: E501 - :rtype: str - """ - return self._package_location - - @package_location.setter - def package_location(self, package_location): - """Sets the package_location of this PickupRequest. - - The package(s) location. eg: Behind the entrance door. # noqa: E501 - - :param package_location: The package_location of this PickupRequest. # noqa: E501 - :type: str - """ - - self._package_location = package_location - - @property - def options(self): - """Gets the options of this PickupRequest. # noqa: E501 - - Advanced carrier specific pickup options # noqa: E501 - - :return: The options of this PickupRequest. # noqa: E501 - :rtype: object - """ - return self._options - - @options.setter - def options(self, options): - """Sets the options of this PickupRequest. - - Advanced carrier specific pickup options # noqa: E501 - - :param options: The options of this PickupRequest. # noqa: E501 - :type: object - """ - - self._options = options - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(PickupRequest, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, PickupRequest): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/purplship/models/pickup_response.py b/purplship/models/pickup_response.py deleted file mode 100644 index 0990bac..0000000 --- a/purplship/models/pickup_response.py +++ /dev/null @@ -1,138 +0,0 @@ -# coding: utf-8 - -""" - Purplship API - - ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.6.2`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 - - OpenAPI spec version: 2021.6.2 - Contact: hello@purplship.com - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - -import pprint -import re # noqa: F401 - -import six - -class PickupResponse(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'messages': 'list[Message]', - 'pickup': 'Pickup' - } - - attribute_map = { - 'messages': 'messages', - 'pickup': 'pickup' - } - - def __init__(self, messages=None, pickup=None): # noqa: E501 - """PickupResponse - a model defined in Swagger""" # noqa: E501 - self._messages = None - self._pickup = None - self.discriminator = None - if messages is not None: - self.messages = messages - if pickup is not None: - self.pickup = pickup - - @property - def messages(self): - """Gets the messages of this PickupResponse. # noqa: E501 - - The list of note or warning messages # noqa: E501 - - :return: The messages of this PickupResponse. # noqa: E501 - :rtype: list[Message] - """ - return self._messages - - @messages.setter - def messages(self, messages): - """Sets the messages of this PickupResponse. - - The list of note or warning messages # noqa: E501 - - :param messages: The messages of this PickupResponse. # noqa: E501 - :type: list[Message] - """ - - self._messages = messages - - @property - def pickup(self): - """Gets the pickup of this PickupResponse. # noqa: E501 - - - :return: The pickup of this PickupResponse. # noqa: E501 - :rtype: Pickup - """ - return self._pickup - - @pickup.setter - def pickup(self, pickup): - """Sets the pickup of this PickupResponse. - - - :param pickup: The pickup of this PickupResponse. # noqa: E501 - :type: Pickup - """ - - self._pickup = pickup - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(PickupResponse, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, PickupResponse): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/purplship/models/pickup_update_data.py b/purplship/models/pickup_update_data.py deleted file mode 100644 index 7435f2b..0000000 --- a/purplship/models/pickup_update_data.py +++ /dev/null @@ -1,335 +0,0 @@ -# coding: utf-8 - -""" - Purplship API - - ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.6.2`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 - - OpenAPI spec version: 2021.6.2 - Contact: hello@purplship.com - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - -import pprint -import re # noqa: F401 - -import six - -class PickupUpdateData(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'pickup_date': 'str', - 'address': 'AddressData', - 'ready_time': 'str', - 'closing_time': 'str', - 'instruction': 'str', - 'package_location': 'str', - 'options': 'object', - 'tracking_numbers': 'list[str]', - 'confirmation_number': 'str' - } - - attribute_map = { - 'pickup_date': 'pickup_date', - 'address': 'address', - 'ready_time': 'ready_time', - 'closing_time': 'closing_time', - 'instruction': 'instruction', - 'package_location': 'package_location', - 'options': 'options', - 'tracking_numbers': 'tracking_numbers', - 'confirmation_number': 'confirmation_number' - } - - def __init__(self, pickup_date=None, address=None, ready_time=None, closing_time=None, instruction=None, package_location=None, options=None, tracking_numbers=None, confirmation_number=None): # noqa: E501 - """PickupUpdateData - a model defined in Swagger""" # noqa: E501 - self._pickup_date = None - self._address = None - self._ready_time = None - self._closing_time = None - self._instruction = None - self._package_location = None - self._options = None - self._tracking_numbers = None - self._confirmation_number = None - self.discriminator = None - if pickup_date is not None: - self.pickup_date = pickup_date - if address is not None: - self.address = address - if ready_time is not None: - self.ready_time = ready_time - if closing_time is not None: - self.closing_time = closing_time - if instruction is not None: - self.instruction = instruction - if package_location is not None: - self.package_location = package_location - if options is not None: - self.options = options - if tracking_numbers is not None: - self.tracking_numbers = tracking_numbers - self.confirmation_number = confirmation_number - - @property - def pickup_date(self): - """Gets the pickup_date of this PickupUpdateData. # noqa: E501 - - The expected pickup date Date Format: YYYY-MM-DD # noqa: E501 - - :return: The pickup_date of this PickupUpdateData. # noqa: E501 - :rtype: str - """ - return self._pickup_date - - @pickup_date.setter - def pickup_date(self, pickup_date): - """Sets the pickup_date of this PickupUpdateData. - - The expected pickup date Date Format: YYYY-MM-DD # noqa: E501 - - :param pickup_date: The pickup_date of this PickupUpdateData. # noqa: E501 - :type: str - """ - - self._pickup_date = pickup_date - - @property - def address(self): - """Gets the address of this PickupUpdateData. # noqa: E501 - - - :return: The address of this PickupUpdateData. # noqa: E501 - :rtype: AddressData - """ - return self._address - - @address.setter - def address(self, address): - """Sets the address of this PickupUpdateData. - - - :param address: The address of this PickupUpdateData. # noqa: E501 - :type: AddressData - """ - - self._address = address - - @property - def ready_time(self): - """Gets the ready_time of this PickupUpdateData. # noqa: E501 - - The ready time for pickup. # noqa: E501 - - :return: The ready_time of this PickupUpdateData. # noqa: E501 - :rtype: str - """ - return self._ready_time - - @ready_time.setter - def ready_time(self, ready_time): - """Sets the ready_time of this PickupUpdateData. - - The ready time for pickup. # noqa: E501 - - :param ready_time: The ready_time of this PickupUpdateData. # noqa: E501 - :type: str - """ - - self._ready_time = ready_time - - @property - def closing_time(self): - """Gets the closing_time of this PickupUpdateData. # noqa: E501 - - The closing or late time of the pickup # noqa: E501 - - :return: The closing_time of this PickupUpdateData. # noqa: E501 - :rtype: str - """ - return self._closing_time - - @closing_time.setter - def closing_time(self, closing_time): - """Sets the closing_time of this PickupUpdateData. - - The closing or late time of the pickup # noqa: E501 - - :param closing_time: The closing_time of this PickupUpdateData. # noqa: E501 - :type: str - """ - - self._closing_time = closing_time - - @property - def instruction(self): - """Gets the instruction of this PickupUpdateData. # noqa: E501 - - The pickup instruction. eg: Handle with care. # noqa: E501 - - :return: The instruction of this PickupUpdateData. # noqa: E501 - :rtype: str - """ - return self._instruction - - @instruction.setter - def instruction(self, instruction): - """Sets the instruction of this PickupUpdateData. - - The pickup instruction. eg: Handle with care. # noqa: E501 - - :param instruction: The instruction of this PickupUpdateData. # noqa: E501 - :type: str - """ - - self._instruction = instruction - - @property - def package_location(self): - """Gets the package_location of this PickupUpdateData. # noqa: E501 - - The package(s) location. eg: Behind the entrance door. # noqa: E501 - - :return: The package_location of this PickupUpdateData. # noqa: E501 - :rtype: str - """ - return self._package_location - - @package_location.setter - def package_location(self, package_location): - """Sets the package_location of this PickupUpdateData. - - The package(s) location. eg: Behind the entrance door. # noqa: E501 - - :param package_location: The package_location of this PickupUpdateData. # noqa: E501 - :type: str - """ - - self._package_location = package_location - - @property - def options(self): - """Gets the options of this PickupUpdateData. # noqa: E501 - - Advanced carrier specific pickup options # noqa: E501 - - :return: The options of this PickupUpdateData. # noqa: E501 - :rtype: object - """ - return self._options - - @options.setter - def options(self, options): - """Sets the options of this PickupUpdateData. - - Advanced carrier specific pickup options # noqa: E501 - - :param options: The options of this PickupUpdateData. # noqa: E501 - :type: object - """ - - self._options = options - - @property - def tracking_numbers(self): - """Gets the tracking_numbers of this PickupUpdateData. # noqa: E501 - - The list of shipments to be picked up # noqa: E501 - - :return: The tracking_numbers of this PickupUpdateData. # noqa: E501 - :rtype: list[str] - """ - return self._tracking_numbers - - @tracking_numbers.setter - def tracking_numbers(self, tracking_numbers): - """Sets the tracking_numbers of this PickupUpdateData. - - The list of shipments to be picked up # noqa: E501 - - :param tracking_numbers: The tracking_numbers of this PickupUpdateData. # noqa: E501 - :type: list[str] - """ - - self._tracking_numbers = tracking_numbers - - @property - def confirmation_number(self): - """Gets the confirmation_number of this PickupUpdateData. # noqa: E501 - - pickup identification number # noqa: E501 - - :return: The confirmation_number of this PickupUpdateData. # noqa: E501 - :rtype: str - """ - return self._confirmation_number - - @confirmation_number.setter - def confirmation_number(self, confirmation_number): - """Sets the confirmation_number of this PickupUpdateData. - - pickup identification number # noqa: E501 - - :param confirmation_number: The confirmation_number of this PickupUpdateData. # noqa: E501 - :type: str - """ - if confirmation_number is None: - raise ValueError("Invalid value for `confirmation_number`, must not be `None`") # noqa: E501 - - self._confirmation_number = confirmation_number - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(PickupUpdateData, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, PickupUpdateData): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/purplship/models/pickup_update_request.py b/purplship/models/pickup_update_request.py deleted file mode 100644 index 89bcf0d..0000000 --- a/purplship/models/pickup_update_request.py +++ /dev/null @@ -1,340 +0,0 @@ -# coding: utf-8 - -""" - Purplship API - - ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.6.2`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 - - OpenAPI spec version: 2021.6.2 - Contact: hello@purplship.com - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - -import pprint -import re # noqa: F401 - -import six - -class PickupUpdateRequest(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'pickup_date': 'str', - 'address': 'Address', - 'parcels': 'list[Parcel]', - 'confirmation_number': 'str', - 'ready_time': 'str', - 'closing_time': 'str', - 'instruction': 'str', - 'package_location': 'str', - 'options': 'object' - } - - attribute_map = { - 'pickup_date': 'pickup_date', - 'address': 'address', - 'parcels': 'parcels', - 'confirmation_number': 'confirmation_number', - 'ready_time': 'ready_time', - 'closing_time': 'closing_time', - 'instruction': 'instruction', - 'package_location': 'package_location', - 'options': 'options' - } - - def __init__(self, pickup_date=None, address=None, parcels=None, confirmation_number=None, ready_time=None, closing_time=None, instruction=None, package_location=None, options=None): # noqa: E501 - """PickupUpdateRequest - a model defined in Swagger""" # noqa: E501 - self._pickup_date = None - self._address = None - self._parcels = None - self._confirmation_number = None - self._ready_time = None - self._closing_time = None - self._instruction = None - self._package_location = None - self._options = None - self.discriminator = None - self.pickup_date = pickup_date - self.address = address - self.parcels = parcels - self.confirmation_number = confirmation_number - self.ready_time = ready_time - self.closing_time = closing_time - if instruction is not None: - self.instruction = instruction - if package_location is not None: - self.package_location = package_location - if options is not None: - self.options = options - - @property - def pickup_date(self): - """Gets the pickup_date of this PickupUpdateRequest. # noqa: E501 - - The expected pickup date Date Format: `YYYY-MM-DD` # noqa: E501 - - :return: The pickup_date of this PickupUpdateRequest. # noqa: E501 - :rtype: str - """ - return self._pickup_date - - @pickup_date.setter - def pickup_date(self, pickup_date): - """Sets the pickup_date of this PickupUpdateRequest. - - The expected pickup date Date Format: `YYYY-MM-DD` # noqa: E501 - - :param pickup_date: The pickup_date of this PickupUpdateRequest. # noqa: E501 - :type: str - """ - if pickup_date is None: - raise ValueError("Invalid value for `pickup_date`, must not be `None`") # noqa: E501 - - self._pickup_date = pickup_date - - @property - def address(self): - """Gets the address of this PickupUpdateRequest. # noqa: E501 - - - :return: The address of this PickupUpdateRequest. # noqa: E501 - :rtype: Address - """ - return self._address - - @address.setter - def address(self, address): - """Sets the address of this PickupUpdateRequest. - - - :param address: The address of this PickupUpdateRequest. # noqa: E501 - :type: Address - """ - if address is None: - raise ValueError("Invalid value for `address`, must not be `None`") # noqa: E501 - - self._address = address - - @property - def parcels(self): - """Gets the parcels of this PickupUpdateRequest. # noqa: E501 - - The shipment parcels to pickup. # noqa: E501 - - :return: The parcels of this PickupUpdateRequest. # noqa: E501 - :rtype: list[Parcel] - """ - return self._parcels - - @parcels.setter - def parcels(self, parcels): - """Sets the parcels of this PickupUpdateRequest. - - The shipment parcels to pickup. # noqa: E501 - - :param parcels: The parcels of this PickupUpdateRequest. # noqa: E501 - :type: list[Parcel] - """ - if parcels is None: - raise ValueError("Invalid value for `parcels`, must not be `None`") # noqa: E501 - - self._parcels = parcels - - @property - def confirmation_number(self): - """Gets the confirmation_number of this PickupUpdateRequest. # noqa: E501 - - pickup identification number # noqa: E501 - - :return: The confirmation_number of this PickupUpdateRequest. # noqa: E501 - :rtype: str - """ - return self._confirmation_number - - @confirmation_number.setter - def confirmation_number(self, confirmation_number): - """Sets the confirmation_number of this PickupUpdateRequest. - - pickup identification number # noqa: E501 - - :param confirmation_number: The confirmation_number of this PickupUpdateRequest. # noqa: E501 - :type: str - """ - if confirmation_number is None: - raise ValueError("Invalid value for `confirmation_number`, must not be `None`") # noqa: E501 - - self._confirmation_number = confirmation_number - - @property - def ready_time(self): - """Gets the ready_time of this PickupUpdateRequest. # noqa: E501 - - The ready time for pickup. Time Format: `HH:MM` # noqa: E501 - - :return: The ready_time of this PickupUpdateRequest. # noqa: E501 - :rtype: str - """ - return self._ready_time - - @ready_time.setter - def ready_time(self, ready_time): - """Sets the ready_time of this PickupUpdateRequest. - - The ready time for pickup. Time Format: `HH:MM` # noqa: E501 - - :param ready_time: The ready_time of this PickupUpdateRequest. # noqa: E501 - :type: str - """ - if ready_time is None: - raise ValueError("Invalid value for `ready_time`, must not be `None`") # noqa: E501 - - self._ready_time = ready_time - - @property - def closing_time(self): - """Gets the closing_time of this PickupUpdateRequest. # noqa: E501 - - The closing or late time of the pickup Time Format: `HH:MM` # noqa: E501 - - :return: The closing_time of this PickupUpdateRequest. # noqa: E501 - :rtype: str - """ - return self._closing_time - - @closing_time.setter - def closing_time(self, closing_time): - """Sets the closing_time of this PickupUpdateRequest. - - The closing or late time of the pickup Time Format: `HH:MM` # noqa: E501 - - :param closing_time: The closing_time of this PickupUpdateRequest. # noqa: E501 - :type: str - """ - if closing_time is None: - raise ValueError("Invalid value for `closing_time`, must not be `None`") # noqa: E501 - - self._closing_time = closing_time - - @property - def instruction(self): - """Gets the instruction of this PickupUpdateRequest. # noqa: E501 - - The pickup instruction. eg: Handle with care. # noqa: E501 - - :return: The instruction of this PickupUpdateRequest. # noqa: E501 - :rtype: str - """ - return self._instruction - - @instruction.setter - def instruction(self, instruction): - """Sets the instruction of this PickupUpdateRequest. - - The pickup instruction. eg: Handle with care. # noqa: E501 - - :param instruction: The instruction of this PickupUpdateRequest. # noqa: E501 - :type: str - """ - - self._instruction = instruction - - @property - def package_location(self): - """Gets the package_location of this PickupUpdateRequest. # noqa: E501 - - The package(s) location. eg: Behind the entrance door. # noqa: E501 - - :return: The package_location of this PickupUpdateRequest. # noqa: E501 - :rtype: str - """ - return self._package_location - - @package_location.setter - def package_location(self, package_location): - """Sets the package_location of this PickupUpdateRequest. - - The package(s) location. eg: Behind the entrance door. # noqa: E501 - - :param package_location: The package_location of this PickupUpdateRequest. # noqa: E501 - :type: str - """ - - self._package_location = package_location - - @property - def options(self): - """Gets the options of this PickupUpdateRequest. # noqa: E501 - - Advanced carrier specific pickup options # noqa: E501 - - :return: The options of this PickupUpdateRequest. # noqa: E501 - :rtype: object - """ - return self._options - - @options.setter - def options(self, options): - """Sets the options of this PickupUpdateRequest. - - Advanced carrier specific pickup options # noqa: E501 - - :param options: The options of this PickupUpdateRequest. # noqa: E501 - :type: object - """ - - self._options = options - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(PickupUpdateRequest, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, PickupUpdateRequest): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/purplship/models/rate.py b/purplship/models/rate.py deleted file mode 100644 index e19f9e9..0000000 --- a/purplship/models/rate.py +++ /dev/null @@ -1,480 +0,0 @@ -# coding: utf-8 - -""" - Purplship API - - ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.6.2`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 - - OpenAPI spec version: 2021.6.2 - Contact: hello@purplship.com - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - -import pprint -import re # noqa: F401 - -import six - -class Rate(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'id': 'str', - 'carrier_name': 'str', - 'carrier_id': 'str', - 'currency': 'str', - 'service': 'str', - 'discount': 'float', - 'base_charge': 'float', - 'total_charge': 'float', - 'duties_and_taxes': 'float', - 'transit_days': 'int', - 'extra_charges': 'list[Charge]', - 'meta': 'object', - 'carrier_ref': 'str', - 'test_mode': 'bool' - } - - attribute_map = { - 'id': 'id', - 'carrier_name': 'carrier_name', - 'carrier_id': 'carrier_id', - 'currency': 'currency', - 'service': 'service', - 'discount': 'discount', - 'base_charge': 'base_charge', - 'total_charge': 'total_charge', - 'duties_and_taxes': 'duties_and_taxes', - 'transit_days': 'transit_days', - 'extra_charges': 'extra_charges', - 'meta': 'meta', - 'carrier_ref': 'carrier_ref', - 'test_mode': 'test_mode' - } - - def __init__(self, id=None, carrier_name=None, carrier_id=None, currency=None, service=None, discount=None, base_charge=None, total_charge=None, duties_and_taxes=None, transit_days=None, extra_charges=None, meta=None, carrier_ref=None, test_mode=None): # noqa: E501 - """Rate - a model defined in Swagger""" # noqa: E501 - self._id = None - self._carrier_name = None - self._carrier_id = None - self._currency = None - self._service = None - self._discount = None - self._base_charge = None - self._total_charge = None - self._duties_and_taxes = None - self._transit_days = None - self._extra_charges = None - self._meta = None - self._carrier_ref = None - self._test_mode = None - self.discriminator = None - if id is not None: - self.id = id - self.carrier_name = carrier_name - self.carrier_id = carrier_id - self.currency = currency - if service is not None: - self.service = service - if discount is not None: - self.discount = discount - if base_charge is not None: - self.base_charge = base_charge - if total_charge is not None: - self.total_charge = total_charge - if duties_and_taxes is not None: - self.duties_and_taxes = duties_and_taxes - if transit_days is not None: - self.transit_days = transit_days - if extra_charges is not None: - self.extra_charges = extra_charges - if meta is not None: - self.meta = meta - if carrier_ref is not None: - self.carrier_ref = carrier_ref - self.test_mode = test_mode - - @property - def id(self): - """Gets the id of this Rate. # noqa: E501 - - A unique identifier # noqa: E501 - - :return: The id of this Rate. # noqa: E501 - :rtype: str - """ - return self._id - - @id.setter - def id(self, id): - """Sets the id of this Rate. - - A unique identifier # noqa: E501 - - :param id: The id of this Rate. # noqa: E501 - :type: str - """ - - self._id = id - - @property - def carrier_name(self): - """Gets the carrier_name of this Rate. # noqa: E501 - - The rate's carrier # noqa: E501 - - :return: The carrier_name of this Rate. # noqa: E501 - :rtype: str - """ - return self._carrier_name - - @carrier_name.setter - def carrier_name(self, carrier_name): - """Sets the carrier_name of this Rate. - - The rate's carrier # noqa: E501 - - :param carrier_name: The carrier_name of this Rate. # noqa: E501 - :type: str - """ - if carrier_name is None: - raise ValueError("Invalid value for `carrier_name`, must not be `None`") # noqa: E501 - - self._carrier_name = carrier_name - - @property - def carrier_id(self): - """Gets the carrier_id of this Rate. # noqa: E501 - - The targeted carrier's name (unique identifier) # noqa: E501 - - :return: The carrier_id of this Rate. # noqa: E501 - :rtype: str - """ - return self._carrier_id - - @carrier_id.setter - def carrier_id(self, carrier_id): - """Sets the carrier_id of this Rate. - - The targeted carrier's name (unique identifier) # noqa: E501 - - :param carrier_id: The carrier_id of this Rate. # noqa: E501 - :type: str - """ - if carrier_id is None: - raise ValueError("Invalid value for `carrier_id`, must not be `None`") # noqa: E501 - - self._carrier_id = carrier_id - - @property - def currency(self): - """Gets the currency of this Rate. # noqa: E501 - - The rate monetary values currency code # noqa: E501 - - :return: The currency of this Rate. # noqa: E501 - :rtype: str - """ - return self._currency - - @currency.setter - def currency(self, currency): - """Sets the currency of this Rate. - - The rate monetary values currency code # noqa: E501 - - :param currency: The currency of this Rate. # noqa: E501 - :type: str - """ - if currency is None: - raise ValueError("Invalid value for `currency`, must not be `None`") # noqa: E501 - - self._currency = currency - - @property - def service(self): - """Gets the service of this Rate. # noqa: E501 - - The carrier's rate (quote) service # noqa: E501 - - :return: The service of this Rate. # noqa: E501 - :rtype: str - """ - return self._service - - @service.setter - def service(self, service): - """Sets the service of this Rate. - - The carrier's rate (quote) service # noqa: E501 - - :param service: The service of this Rate. # noqa: E501 - :type: str - """ - - self._service = service - - @property - def discount(self): - """Gets the discount of this Rate. # noqa: E501 - - The monetary amount of the discount on the rate # noqa: E501 - - :return: The discount of this Rate. # noqa: E501 - :rtype: float - """ - return self._discount - - @discount.setter - def discount(self, discount): - """Sets the discount of this Rate. - - The monetary amount of the discount on the rate # noqa: E501 - - :param discount: The discount of this Rate. # noqa: E501 - :type: float - """ - - self._discount = discount - - @property - def base_charge(self): - """Gets the base_charge of this Rate. # noqa: E501 - - The rate's monetary amount of the base charge.
This is the net amount of the rate before additional charges # noqa: E501 - - :return: The base_charge of this Rate. # noqa: E501 - :rtype: float - """ - return self._base_charge - - @base_charge.setter - def base_charge(self, base_charge): - """Sets the base_charge of this Rate. - - The rate's monetary amount of the base charge.
This is the net amount of the rate before additional charges # noqa: E501 - - :param base_charge: The base_charge of this Rate. # noqa: E501 - :type: float - """ - - self._base_charge = base_charge - - @property - def total_charge(self): - """Gets the total_charge of this Rate. # noqa: E501 - - The rate's monetary amount of the total charge.
This is the gross amount of the rate after adding the additional charges # noqa: E501 - - :return: The total_charge of this Rate. # noqa: E501 - :rtype: float - """ - return self._total_charge - - @total_charge.setter - def total_charge(self, total_charge): - """Sets the total_charge of this Rate. - - The rate's monetary amount of the total charge.
This is the gross amount of the rate after adding the additional charges # noqa: E501 - - :param total_charge: The total_charge of this Rate. # noqa: E501 - :type: float - """ - - self._total_charge = total_charge - - @property - def duties_and_taxes(self): - """Gets the duties_and_taxes of this Rate. # noqa: E501 - - The monetary amount of the duties and taxes if applied # noqa: E501 - - :return: The duties_and_taxes of this Rate. # noqa: E501 - :rtype: float - """ - return self._duties_and_taxes - - @duties_and_taxes.setter - def duties_and_taxes(self, duties_and_taxes): - """Sets the duties_and_taxes of this Rate. - - The monetary amount of the duties and taxes if applied # noqa: E501 - - :param duties_and_taxes: The duties_and_taxes of this Rate. # noqa: E501 - :type: float - """ - - self._duties_and_taxes = duties_and_taxes - - @property - def transit_days(self): - """Gets the transit_days of this Rate. # noqa: E501 - - The estimated delivery transit days # noqa: E501 - - :return: The transit_days of this Rate. # noqa: E501 - :rtype: int - """ - return self._transit_days - - @transit_days.setter - def transit_days(self, transit_days): - """Sets the transit_days of this Rate. - - The estimated delivery transit days # noqa: E501 - - :param transit_days: The transit_days of this Rate. # noqa: E501 - :type: int - """ - - self._transit_days = transit_days - - @property - def extra_charges(self): - """Gets the extra_charges of this Rate. # noqa: E501 - - list of the rate's additional charges # noqa: E501 - - :return: The extra_charges of this Rate. # noqa: E501 - :rtype: list[Charge] - """ - return self._extra_charges - - @extra_charges.setter - def extra_charges(self, extra_charges): - """Sets the extra_charges of this Rate. - - list of the rate's additional charges # noqa: E501 - - :param extra_charges: The extra_charges of this Rate. # noqa: E501 - :type: list[Charge] - """ - - self._extra_charges = extra_charges - - @property - def meta(self): - """Gets the meta of this Rate. # noqa: E501 - - provider specific metadata # noqa: E501 - - :return: The meta of this Rate. # noqa: E501 - :rtype: object - """ - return self._meta - - @meta.setter - def meta(self, meta): - """Sets the meta of this Rate. - - provider specific metadata # noqa: E501 - - :param meta: The meta of this Rate. # noqa: E501 - :type: object - """ - - self._meta = meta - - @property - def carrier_ref(self): - """Gets the carrier_ref of this Rate. # noqa: E501 - - The system carrier configuration id # noqa: E501 - - :return: The carrier_ref of this Rate. # noqa: E501 - :rtype: str - """ - return self._carrier_ref - - @carrier_ref.setter - def carrier_ref(self, carrier_ref): - """Sets the carrier_ref of this Rate. - - The system carrier configuration id # noqa: E501 - - :param carrier_ref: The carrier_ref of this Rate. # noqa: E501 - :type: str - """ - - self._carrier_ref = carrier_ref - - @property - def test_mode(self): - """Gets the test_mode of this Rate. # noqa: E501 - - Specified whether it was created with a carrier in test mode # noqa: E501 - - :return: The test_mode of this Rate. # noqa: E501 - :rtype: bool - """ - return self._test_mode - - @test_mode.setter - def test_mode(self, test_mode): - """Sets the test_mode of this Rate. - - Specified whether it was created with a carrier in test mode # noqa: E501 - - :param test_mode: The test_mode of this Rate. # noqa: E501 - :type: bool - """ - if test_mode is None: - raise ValueError("Invalid value for `test_mode`, must not be `None`") # noqa: E501 - - self._test_mode = test_mode - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(Rate, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, Rate): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/purplship/models/rate_request.py b/purplship/models/rate_request.py deleted file mode 100644 index 534ebc4..0000000 --- a/purplship/models/rate_request.py +++ /dev/null @@ -1,279 +0,0 @@ -# coding: utf-8 - -""" - Purplship API - - ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.6.2`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 - - OpenAPI spec version: 2021.6.2 - Contact: hello@purplship.com - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - -import pprint -import re # noqa: F401 - -import six - -class RateRequest(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'shipper': 'AddressData', - 'recipient': 'AddressData', - 'parcels': 'list[ParcelData]', - 'services': 'list[str]', - 'options': 'object', - 'reference': 'str', - 'carrier_ids': 'list[str]' - } - - attribute_map = { - 'shipper': 'shipper', - 'recipient': 'recipient', - 'parcels': 'parcels', - 'services': 'services', - 'options': 'options', - 'reference': 'reference', - 'carrier_ids': 'carrier_ids' - } - - def __init__(self, shipper=None, recipient=None, parcels=None, services=None, options=None, reference=None, carrier_ids=None): # noqa: E501 - """RateRequest - a model defined in Swagger""" # noqa: E501 - self._shipper = None - self._recipient = None - self._parcels = None - self._services = None - self._options = None - self._reference = None - self._carrier_ids = None - self.discriminator = None - self.shipper = shipper - self.recipient = recipient - self.parcels = parcels - if services is not None: - self.services = services - if options is not None: - self.options = options - if reference is not None: - self.reference = reference - if carrier_ids is not None: - self.carrier_ids = carrier_ids - - @property - def shipper(self): - """Gets the shipper of this RateRequest. # noqa: E501 - - - :return: The shipper of this RateRequest. # noqa: E501 - :rtype: AddressData - """ - return self._shipper - - @shipper.setter - def shipper(self, shipper): - """Sets the shipper of this RateRequest. - - - :param shipper: The shipper of this RateRequest. # noqa: E501 - :type: AddressData - """ - if shipper is None: - raise ValueError("Invalid value for `shipper`, must not be `None`") # noqa: E501 - - self._shipper = shipper - - @property - def recipient(self): - """Gets the recipient of this RateRequest. # noqa: E501 - - - :return: The recipient of this RateRequest. # noqa: E501 - :rtype: AddressData - """ - return self._recipient - - @recipient.setter - def recipient(self, recipient): - """Sets the recipient of this RateRequest. - - - :param recipient: The recipient of this RateRequest. # noqa: E501 - :type: AddressData - """ - if recipient is None: - raise ValueError("Invalid value for `recipient`, must not be `None`") # noqa: E501 - - self._recipient = recipient - - @property - def parcels(self): - """Gets the parcels of this RateRequest. # noqa: E501 - - The shipment's parcels # noqa: E501 - - :return: The parcels of this RateRequest. # noqa: E501 - :rtype: list[ParcelData] - """ - return self._parcels - - @parcels.setter - def parcels(self, parcels): - """Sets the parcels of this RateRequest. - - The shipment's parcels # noqa: E501 - - :param parcels: The parcels of this RateRequest. # noqa: E501 - :type: list[ParcelData] - """ - if parcels is None: - raise ValueError("Invalid value for `parcels`, must not be `None`") # noqa: E501 - - self._parcels = parcels - - @property - def services(self): - """Gets the services of this RateRequest. # noqa: E501 - - The requested carrier service for the shipment.
Please consult [the reference](#operation/references) for specific carriers services. Note that this is a list because on a Multi-carrier rate request you could specify a service per carrier. # noqa: E501 - - :return: The services of this RateRequest. # noqa: E501 - :rtype: list[str] - """ - return self._services - - @services.setter - def services(self, services): - """Sets the services of this RateRequest. - - The requested carrier service for the shipment.
Please consult [the reference](#operation/references) for specific carriers services. Note that this is a list because on a Multi-carrier rate request you could specify a service per carrier. # noqa: E501 - - :param services: The services of this RateRequest. # noqa: E501 - :type: list[str] - """ - - self._services = services - - @property - def options(self): - """Gets the options of this RateRequest. # noqa: E501 - - The options available for the shipment. Please consult [the reference](#operation/references) for additional specific carriers options. # noqa: E501 - - :return: The options of this RateRequest. # noqa: E501 - :rtype: object - """ - return self._options - - @options.setter - def options(self, options): - """Sets the options of this RateRequest. - - The options available for the shipment. Please consult [the reference](#operation/references) for additional specific carriers options. # noqa: E501 - - :param options: The options of this RateRequest. # noqa: E501 - :type: object - """ - - self._options = options - - @property - def reference(self): - """Gets the reference of this RateRequest. # noqa: E501 - - The shipment reference # noqa: E501 - - :return: The reference of this RateRequest. # noqa: E501 - :rtype: str - """ - return self._reference - - @reference.setter - def reference(self, reference): - """Sets the reference of this RateRequest. - - The shipment reference # noqa: E501 - - :param reference: The reference of this RateRequest. # noqa: E501 - :type: str - """ - - self._reference = reference - - @property - def carrier_ids(self): - """Gets the carrier_ids of this RateRequest. # noqa: E501 - - The list of configured carriers you wish to get rates from. # noqa: E501 - - :return: The carrier_ids of this RateRequest. # noqa: E501 - :rtype: list[str] - """ - return self._carrier_ids - - @carrier_ids.setter - def carrier_ids(self, carrier_ids): - """Sets the carrier_ids of this RateRequest. - - The list of configured carriers you wish to get rates from. # noqa: E501 - - :param carrier_ids: The carrier_ids of this RateRequest. # noqa: E501 - :type: list[str] - """ - - self._carrier_ids = carrier_ids - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(RateRequest, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, RateRequest): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/purplship/models/rate_response.py b/purplship/models/rate_response.py deleted file mode 100644 index 59f6487..0000000 --- a/purplship/models/rate_response.py +++ /dev/null @@ -1,141 +0,0 @@ -# coding: utf-8 - -""" - Purplship API - - ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.6.2`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 - - OpenAPI spec version: 2021.6.2 - Contact: hello@purplship.com - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - -import pprint -import re # noqa: F401 - -import six - -class RateResponse(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'messages': 'list[Message]', - 'rates': 'list[Rate]' - } - - attribute_map = { - 'messages': 'messages', - 'rates': 'rates' - } - - def __init__(self, messages=None, rates=None): # noqa: E501 - """RateResponse - a model defined in Swagger""" # noqa: E501 - self._messages = None - self._rates = None - self.discriminator = None - if messages is not None: - self.messages = messages - self.rates = rates - - @property - def messages(self): - """Gets the messages of this RateResponse. # noqa: E501 - - The list of note or warning messages # noqa: E501 - - :return: The messages of this RateResponse. # noqa: E501 - :rtype: list[Message] - """ - return self._messages - - @messages.setter - def messages(self, messages): - """Sets the messages of this RateResponse. - - The list of note or warning messages # noqa: E501 - - :param messages: The messages of this RateResponse. # noqa: E501 - :type: list[Message] - """ - - self._messages = messages - - @property - def rates(self): - """Gets the rates of this RateResponse. # noqa: E501 - - The list of returned rates # noqa: E501 - - :return: The rates of this RateResponse. # noqa: E501 - :rtype: list[Rate] - """ - return self._rates - - @rates.setter - def rates(self, rates): - """Sets the rates of this RateResponse. - - The list of returned rates # noqa: E501 - - :param rates: The rates of this RateResponse. # noqa: E501 - :type: list[Rate] - """ - if rates is None: - raise ValueError("Invalid value for `rates`, must not be `None`") # noqa: E501 - - self._rates = rates - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(RateResponse, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, RateResponse): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/purplship/models/references.py b/purplship/models/references.py deleted file mode 100644 index 6db079f..0000000 --- a/purplship/models/references.py +++ /dev/null @@ -1,489 +0,0 @@ -# coding: utf-8 - -""" - Purplship API - - ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.6.2`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 - - OpenAPI spec version: 2021.6.2 - Contact: hello@purplship.com - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - -import pprint -import re # noqa: F401 - -import six - -class References(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'app_name': 'str', - 'app_version': 'str', - 'countries': 'object', - 'currencies': 'object', - 'carriers': 'object', - 'customs_content_type': 'object', - 'incoterms': 'object', - 'states': 'object', - 'services': 'object', - 'service_names': 'object', - 'options': 'object', - 'option_names': 'object', - 'package_presets': 'object', - 'packaging_types': 'object', - 'payment_types': 'object' - } - - attribute_map = { - 'app_name': 'APP_NAME', - 'app_version': 'APP_VERSION', - 'countries': 'countries', - 'currencies': 'currencies', - 'carriers': 'carriers', - 'customs_content_type': 'customs_content_type', - 'incoterms': 'incoterms', - 'states': 'states', - 'services': 'services', - 'service_names': 'service_names', - 'options': 'options', - 'option_names': 'option_names', - 'package_presets': 'package_presets', - 'packaging_types': 'packaging_types', - 'payment_types': 'payment_types' - } - - def __init__(self, app_name=None, app_version=None, countries=None, currencies=None, carriers=None, customs_content_type=None, incoterms=None, states=None, services=None, service_names=None, options=None, option_names=None, package_presets=None, packaging_types=None, payment_types=None): # noqa: E501 - """References - a model defined in Swagger""" # noqa: E501 - self._app_name = None - self._app_version = None - self._countries = None - self._currencies = None - self._carriers = None - self._customs_content_type = None - self._incoterms = None - self._states = None - self._services = None - self._service_names = None - self._options = None - self._option_names = None - self._package_presets = None - self._packaging_types = None - self._payment_types = None - self.discriminator = None - self.app_name = app_name - self.app_version = app_version - self.countries = countries - self.currencies = currencies - self.carriers = carriers - self.customs_content_type = customs_content_type - self.incoterms = incoterms - self.states = states - self.services = services - self.service_names = service_names - self.options = options - self.option_names = option_names - self.package_presets = package_presets - self.packaging_types = packaging_types - self.payment_types = payment_types - - @property - def app_name(self): - """Gets the app_name of this References. # noqa: E501 - - - :return: The app_name of this References. # noqa: E501 - :rtype: str - """ - return self._app_name - - @app_name.setter - def app_name(self, app_name): - """Sets the app_name of this References. - - - :param app_name: The app_name of this References. # noqa: E501 - :type: str - """ - if app_name is None: - raise ValueError("Invalid value for `app_name`, must not be `None`") # noqa: E501 - - self._app_name = app_name - - @property - def app_version(self): - """Gets the app_version of this References. # noqa: E501 - - - :return: The app_version of this References. # noqa: E501 - :rtype: str - """ - return self._app_version - - @app_version.setter - def app_version(self, app_version): - """Sets the app_version of this References. - - - :param app_version: The app_version of this References. # noqa: E501 - :type: str - """ - if app_version is None: - raise ValueError("Invalid value for `app_version`, must not be `None`") # noqa: E501 - - self._app_version = app_version - - @property - def countries(self): - """Gets the countries of this References. # noqa: E501 - - - :return: The countries of this References. # noqa: E501 - :rtype: object - """ - return self._countries - - @countries.setter - def countries(self, countries): - """Sets the countries of this References. - - - :param countries: The countries of this References. # noqa: E501 - :type: object - """ - if countries is None: - raise ValueError("Invalid value for `countries`, must not be `None`") # noqa: E501 - - self._countries = countries - - @property - def currencies(self): - """Gets the currencies of this References. # noqa: E501 - - - :return: The currencies of this References. # noqa: E501 - :rtype: object - """ - return self._currencies - - @currencies.setter - def currencies(self, currencies): - """Sets the currencies of this References. - - - :param currencies: The currencies of this References. # noqa: E501 - :type: object - """ - if currencies is None: - raise ValueError("Invalid value for `currencies`, must not be `None`") # noqa: E501 - - self._currencies = currencies - - @property - def carriers(self): - """Gets the carriers of this References. # noqa: E501 - - - :return: The carriers of this References. # noqa: E501 - :rtype: object - """ - return self._carriers - - @carriers.setter - def carriers(self, carriers): - """Sets the carriers of this References. - - - :param carriers: The carriers of this References. # noqa: E501 - :type: object - """ - if carriers is None: - raise ValueError("Invalid value for `carriers`, must not be `None`") # noqa: E501 - - self._carriers = carriers - - @property - def customs_content_type(self): - """Gets the customs_content_type of this References. # noqa: E501 - - - :return: The customs_content_type of this References. # noqa: E501 - :rtype: object - """ - return self._customs_content_type - - @customs_content_type.setter - def customs_content_type(self, customs_content_type): - """Sets the customs_content_type of this References. - - - :param customs_content_type: The customs_content_type of this References. # noqa: E501 - :type: object - """ - if customs_content_type is None: - raise ValueError("Invalid value for `customs_content_type`, must not be `None`") # noqa: E501 - - self._customs_content_type = customs_content_type - - @property - def incoterms(self): - """Gets the incoterms of this References. # noqa: E501 - - - :return: The incoterms of this References. # noqa: E501 - :rtype: object - """ - return self._incoterms - - @incoterms.setter - def incoterms(self, incoterms): - """Sets the incoterms of this References. - - - :param incoterms: The incoterms of this References. # noqa: E501 - :type: object - """ - if incoterms is None: - raise ValueError("Invalid value for `incoterms`, must not be `None`") # noqa: E501 - - self._incoterms = incoterms - - @property - def states(self): - """Gets the states of this References. # noqa: E501 - - - :return: The states of this References. # noqa: E501 - :rtype: object - """ - return self._states - - @states.setter - def states(self, states): - """Sets the states of this References. - - - :param states: The states of this References. # noqa: E501 - :type: object - """ - if states is None: - raise ValueError("Invalid value for `states`, must not be `None`") # noqa: E501 - - self._states = states - - @property - def services(self): - """Gets the services of this References. # noqa: E501 - - - :return: The services of this References. # noqa: E501 - :rtype: object - """ - return self._services - - @services.setter - def services(self, services): - """Sets the services of this References. - - - :param services: The services of this References. # noqa: E501 - :type: object - """ - if services is None: - raise ValueError("Invalid value for `services`, must not be `None`") # noqa: E501 - - self._services = services - - @property - def service_names(self): - """Gets the service_names of this References. # noqa: E501 - - - :return: The service_names of this References. # noqa: E501 - :rtype: object - """ - return self._service_names - - @service_names.setter - def service_names(self, service_names): - """Sets the service_names of this References. - - - :param service_names: The service_names of this References. # noqa: E501 - :type: object - """ - if service_names is None: - raise ValueError("Invalid value for `service_names`, must not be `None`") # noqa: E501 - - self._service_names = service_names - - @property - def options(self): - """Gets the options of this References. # noqa: E501 - - - :return: The options of this References. # noqa: E501 - :rtype: object - """ - return self._options - - @options.setter - def options(self, options): - """Sets the options of this References. - - - :param options: The options of this References. # noqa: E501 - :type: object - """ - if options is None: - raise ValueError("Invalid value for `options`, must not be `None`") # noqa: E501 - - self._options = options - - @property - def option_names(self): - """Gets the option_names of this References. # noqa: E501 - - - :return: The option_names of this References. # noqa: E501 - :rtype: object - """ - return self._option_names - - @option_names.setter - def option_names(self, option_names): - """Sets the option_names of this References. - - - :param option_names: The option_names of this References. # noqa: E501 - :type: object - """ - if option_names is None: - raise ValueError("Invalid value for `option_names`, must not be `None`") # noqa: E501 - - self._option_names = option_names - - @property - def package_presets(self): - """Gets the package_presets of this References. # noqa: E501 - - - :return: The package_presets of this References. # noqa: E501 - :rtype: object - """ - return self._package_presets - - @package_presets.setter - def package_presets(self, package_presets): - """Sets the package_presets of this References. - - - :param package_presets: The package_presets of this References. # noqa: E501 - :type: object - """ - if package_presets is None: - raise ValueError("Invalid value for `package_presets`, must not be `None`") # noqa: E501 - - self._package_presets = package_presets - - @property - def packaging_types(self): - """Gets the packaging_types of this References. # noqa: E501 - - - :return: The packaging_types of this References. # noqa: E501 - :rtype: object - """ - return self._packaging_types - - @packaging_types.setter - def packaging_types(self, packaging_types): - """Sets the packaging_types of this References. - - - :param packaging_types: The packaging_types of this References. # noqa: E501 - :type: object - """ - if packaging_types is None: - raise ValueError("Invalid value for `packaging_types`, must not be `None`") # noqa: E501 - - self._packaging_types = packaging_types - - @property - def payment_types(self): - """Gets the payment_types of this References. # noqa: E501 - - - :return: The payment_types of this References. # noqa: E501 - :rtype: object - """ - return self._payment_types - - @payment_types.setter - def payment_types(self, payment_types): - """Sets the payment_types of this References. - - - :param payment_types: The payment_types of this References. # noqa: E501 - :type: object - """ - if payment_types is None: - raise ValueError("Invalid value for `payment_types`, must not be `None`") # noqa: E501 - - self._payment_types = payment_types - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(References, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, References): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/purplship/models/shipment.py b/purplship/models/shipment.py deleted file mode 100644 index b8973a0..0000000 --- a/purplship/models/shipment.py +++ /dev/null @@ -1,847 +0,0 @@ -# coding: utf-8 - -""" - Purplship API - - ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.6.2`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 - - OpenAPI spec version: 2021.6.2 - Contact: hello@purplship.com - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - -import pprint -import re # noqa: F401 - -import six - -class Shipment(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'id': 'str', - 'status': 'str', - 'carrier_name': 'str', - 'carrier_id': 'str', - 'label': 'str', - 'tracking_number': 'str', - 'shipment_identifier': 'str', - 'selected_rate': 'Rate', - 'selected_rate_id': 'str', - 'rates': 'list[Rate]', - 'tracking_url': 'str', - 'service': 'str', - 'shipper': 'Address', - 'recipient': 'Address', - 'parcels': 'list[Parcel]', - 'services': 'list[str]', - 'options': 'object', - 'payment': 'Payment', - 'customs': 'Customs', - 'reference': 'str', - 'label_type': 'str', - 'carrier_ids': 'list[str]', - 'meta': 'object', - 'created_at': 'str', - 'test_mode': 'bool', - 'messages': 'list[Message]', - 'tracker_id': 'str' - } - - attribute_map = { - 'id': 'id', - 'status': 'status', - 'carrier_name': 'carrier_name', - 'carrier_id': 'carrier_id', - 'label': 'label', - 'tracking_number': 'tracking_number', - 'shipment_identifier': 'shipment_identifier', - 'selected_rate': 'selected_rate', - 'selected_rate_id': 'selected_rate_id', - 'rates': 'rates', - 'tracking_url': 'tracking_url', - 'service': 'service', - 'shipper': 'shipper', - 'recipient': 'recipient', - 'parcels': 'parcels', - 'services': 'services', - 'options': 'options', - 'payment': 'payment', - 'customs': 'customs', - 'reference': 'reference', - 'label_type': 'label_type', - 'carrier_ids': 'carrier_ids', - 'meta': 'meta', - 'created_at': 'created_at', - 'test_mode': 'test_mode', - 'messages': 'messages', - 'tracker_id': 'tracker_id' - } - - def __init__(self, id=None, status='created', carrier_name=None, carrier_id=None, label=None, tracking_number=None, shipment_identifier=None, selected_rate=None, selected_rate_id=None, rates=None, tracking_url=None, service=None, shipper=None, recipient=None, parcels=None, services=None, options=None, payment=None, customs=None, reference=None, label_type=None, carrier_ids=None, meta=None, created_at=None, test_mode=None, messages=None, tracker_id=None): # noqa: E501 - """Shipment - a model defined in Swagger""" # noqa: E501 - self._id = None - self._status = None - self._carrier_name = None - self._carrier_id = None - self._label = None - self._tracking_number = None - self._shipment_identifier = None - self._selected_rate = None - self._selected_rate_id = None - self._rates = None - self._tracking_url = None - self._service = None - self._shipper = None - self._recipient = None - self._parcels = None - self._services = None - self._options = None - self._payment = None - self._customs = None - self._reference = None - self._label_type = None - self._carrier_ids = None - self._meta = None - self._created_at = None - self._test_mode = None - self._messages = None - self._tracker_id = None - self.discriminator = None - if id is not None: - self.id = id - if status is not None: - self.status = status - if carrier_name is not None: - self.carrier_name = carrier_name - if carrier_id is not None: - self.carrier_id = carrier_id - if label is not None: - self.label = label - if tracking_number is not None: - self.tracking_number = tracking_number - if shipment_identifier is not None: - self.shipment_identifier = shipment_identifier - if selected_rate is not None: - self.selected_rate = selected_rate - if selected_rate_id is not None: - self.selected_rate_id = selected_rate_id - if rates is not None: - self.rates = rates - if tracking_url is not None: - self.tracking_url = tracking_url - if service is not None: - self.service = service - self.shipper = shipper - self.recipient = recipient - self.parcels = parcels - if services is not None: - self.services = services - if options is not None: - self.options = options - if payment is not None: - self.payment = payment - if customs is not None: - self.customs = customs - if reference is not None: - self.reference = reference - if label_type is not None: - self.label_type = label_type - if carrier_ids is not None: - self.carrier_ids = carrier_ids - if meta is not None: - self.meta = meta - self.created_at = created_at - self.test_mode = test_mode - if messages is not None: - self.messages = messages - if tracker_id is not None: - self.tracker_id = tracker_id - - @property - def id(self): - """Gets the id of this Shipment. # noqa: E501 - - A unique identifier # noqa: E501 - - :return: The id of this Shipment. # noqa: E501 - :rtype: str - """ - return self._id - - @id.setter - def id(self, id): - """Sets the id of this Shipment. - - A unique identifier # noqa: E501 - - :param id: The id of this Shipment. # noqa: E501 - :type: str - """ - - self._id = id - - @property - def status(self): - """Gets the status of this Shipment. # noqa: E501 - - The current Shipment status # noqa: E501 - - :return: The status of this Shipment. # noqa: E501 - :rtype: str - """ - return self._status - - @status.setter - def status(self, status): - """Sets the status of this Shipment. - - The current Shipment status # noqa: E501 - - :param status: The status of this Shipment. # noqa: E501 - :type: str - """ - allowed_values = ["created", "purchased", "cancelled", "shipped", "transit", "delivered"] # noqa: E501 - if status not in allowed_values: - raise ValueError( - "Invalid value for `status` ({0}), must be one of {1}" # noqa: E501 - .format(status, allowed_values) - ) - - self._status = status - - @property - def carrier_name(self): - """Gets the carrier_name of this Shipment. # noqa: E501 - - The shipment carrier # noqa: E501 - - :return: The carrier_name of this Shipment. # noqa: E501 - :rtype: str - """ - return self._carrier_name - - @carrier_name.setter - def carrier_name(self, carrier_name): - """Sets the carrier_name of this Shipment. - - The shipment carrier # noqa: E501 - - :param carrier_name: The carrier_name of this Shipment. # noqa: E501 - :type: str - """ - - self._carrier_name = carrier_name - - @property - def carrier_id(self): - """Gets the carrier_id of this Shipment. # noqa: E501 - - The shipment carrier configured identifier # noqa: E501 - - :return: The carrier_id of this Shipment. # noqa: E501 - :rtype: str - """ - return self._carrier_id - - @carrier_id.setter - def carrier_id(self, carrier_id): - """Sets the carrier_id of this Shipment. - - The shipment carrier configured identifier # noqa: E501 - - :param carrier_id: The carrier_id of this Shipment. # noqa: E501 - :type: str - """ - - self._carrier_id = carrier_id - - @property - def label(self): - """Gets the label of this Shipment. # noqa: E501 - - The shipment label in base64 string # noqa: E501 - - :return: The label of this Shipment. # noqa: E501 - :rtype: str - """ - return self._label - - @label.setter - def label(self, label): - """Sets the label of this Shipment. - - The shipment label in base64 string # noqa: E501 - - :param label: The label of this Shipment. # noqa: E501 - :type: str - """ - - self._label = label - - @property - def tracking_number(self): - """Gets the tracking_number of this Shipment. # noqa: E501 - - The shipment tracking number # noqa: E501 - - :return: The tracking_number of this Shipment. # noqa: E501 - :rtype: str - """ - return self._tracking_number - - @tracking_number.setter - def tracking_number(self, tracking_number): - """Sets the tracking_number of this Shipment. - - The shipment tracking number # noqa: E501 - - :param tracking_number: The tracking_number of this Shipment. # noqa: E501 - :type: str - """ - - self._tracking_number = tracking_number - - @property - def shipment_identifier(self): - """Gets the shipment_identifier of this Shipment. # noqa: E501 - - The shipment carrier system identifier # noqa: E501 - - :return: The shipment_identifier of this Shipment. # noqa: E501 - :rtype: str - """ - return self._shipment_identifier - - @shipment_identifier.setter - def shipment_identifier(self, shipment_identifier): - """Sets the shipment_identifier of this Shipment. - - The shipment carrier system identifier # noqa: E501 - - :param shipment_identifier: The shipment_identifier of this Shipment. # noqa: E501 - :type: str - """ - - self._shipment_identifier = shipment_identifier - - @property - def selected_rate(self): - """Gets the selected_rate of this Shipment. # noqa: E501 - - - :return: The selected_rate of this Shipment. # noqa: E501 - :rtype: Rate - """ - return self._selected_rate - - @selected_rate.setter - def selected_rate(self, selected_rate): - """Sets the selected_rate of this Shipment. - - - :param selected_rate: The selected_rate of this Shipment. # noqa: E501 - :type: Rate - """ - - self._selected_rate = selected_rate - - @property - def selected_rate_id(self): - """Gets the selected_rate_id of this Shipment. # noqa: E501 - - The shipment selected rate. # noqa: E501 - - :return: The selected_rate_id of this Shipment. # noqa: E501 - :rtype: str - """ - return self._selected_rate_id - - @selected_rate_id.setter - def selected_rate_id(self, selected_rate_id): - """Sets the selected_rate_id of this Shipment. - - The shipment selected rate. # noqa: E501 - - :param selected_rate_id: The selected_rate_id of this Shipment. # noqa: E501 - :type: str - """ - - self._selected_rate_id = selected_rate_id - - @property - def rates(self): - """Gets the rates of this Shipment. # noqa: E501 - - The list for shipment rates fetched previously # noqa: E501 - - :return: The rates of this Shipment. # noqa: E501 - :rtype: list[Rate] - """ - return self._rates - - @rates.setter - def rates(self, rates): - """Sets the rates of this Shipment. - - The list for shipment rates fetched previously # noqa: E501 - - :param rates: The rates of this Shipment. # noqa: E501 - :type: list[Rate] - """ - - self._rates = rates - - @property - def tracking_url(self): - """Gets the tracking_url of this Shipment. # noqa: E501 - - The shipment tracking url # noqa: E501 - - :return: The tracking_url of this Shipment. # noqa: E501 - :rtype: str - """ - return self._tracking_url - - @tracking_url.setter - def tracking_url(self, tracking_url): - """Sets the tracking_url of this Shipment. - - The shipment tracking url # noqa: E501 - - :param tracking_url: The tracking_url of this Shipment. # noqa: E501 - :type: str - """ - - self._tracking_url = tracking_url - - @property - def service(self): - """Gets the service of this Shipment. # noqa: E501 - - The selected service # noqa: E501 - - :return: The service of this Shipment. # noqa: E501 - :rtype: str - """ - return self._service - - @service.setter - def service(self, service): - """Sets the service of this Shipment. - - The selected service # noqa: E501 - - :param service: The service of this Shipment. # noqa: E501 - :type: str - """ - - self._service = service - - @property - def shipper(self): - """Gets the shipper of this Shipment. # noqa: E501 - - - :return: The shipper of this Shipment. # noqa: E501 - :rtype: Address - """ - return self._shipper - - @shipper.setter - def shipper(self, shipper): - """Sets the shipper of this Shipment. - - - :param shipper: The shipper of this Shipment. # noqa: E501 - :type: Address - """ - if shipper is None: - raise ValueError("Invalid value for `shipper`, must not be `None`") # noqa: E501 - - self._shipper = shipper - - @property - def recipient(self): - """Gets the recipient of this Shipment. # noqa: E501 - - - :return: The recipient of this Shipment. # noqa: E501 - :rtype: Address - """ - return self._recipient - - @recipient.setter - def recipient(self, recipient): - """Sets the recipient of this Shipment. - - - :param recipient: The recipient of this Shipment. # noqa: E501 - :type: Address - """ - if recipient is None: - raise ValueError("Invalid value for `recipient`, must not be `None`") # noqa: E501 - - self._recipient = recipient - - @property - def parcels(self): - """Gets the parcels of this Shipment. # noqa: E501 - - The shipment's parcels # noqa: E501 - - :return: The parcels of this Shipment. # noqa: E501 - :rtype: list[Parcel] - """ - return self._parcels - - @parcels.setter - def parcels(self, parcels): - """Sets the parcels of this Shipment. - - The shipment's parcels # noqa: E501 - - :param parcels: The parcels of this Shipment. # noqa: E501 - :type: list[Parcel] - """ - if parcels is None: - raise ValueError("Invalid value for `parcels`, must not be `None`") # noqa: E501 - - self._parcels = parcels - - @property - def services(self): - """Gets the services of this Shipment. # noqa: E501 - - The carriers services requested for the shipment. Please consult [the reference](#operation/references) for specific carriers services.
Note that this is a list because on a Multi-carrier rate request you could specify a service per carrier. # noqa: E501 - - :return: The services of this Shipment. # noqa: E501 - :rtype: list[str] - """ - return self._services - - @services.setter - def services(self, services): - """Sets the services of this Shipment. - - The carriers services requested for the shipment. Please consult [the reference](#operation/references) for specific carriers services.
Note that this is a list because on a Multi-carrier rate request you could specify a service per carrier. # noqa: E501 - - :param services: The services of this Shipment. # noqa: E501 - :type: list[str] - """ - - self._services = services - - @property - def options(self): - """Gets the options of this Shipment. # noqa: E501 - - The options available for the shipment.
Please consult [the reference](#operation/references) for additional specific carriers options. # noqa: E501 - - :return: The options of this Shipment. # noqa: E501 - :rtype: object - """ - return self._options - - @options.setter - def options(self, options): - """Sets the options of this Shipment. - - The options available for the shipment.
Please consult [the reference](#operation/references) for additional specific carriers options. # noqa: E501 - - :param options: The options of this Shipment. # noqa: E501 - :type: object - """ - - self._options = options - - @property - def payment(self): - """Gets the payment of this Shipment. # noqa: E501 - - - :return: The payment of this Shipment. # noqa: E501 - :rtype: Payment - """ - return self._payment - - @payment.setter - def payment(self, payment): - """Sets the payment of this Shipment. - - - :param payment: The payment of this Shipment. # noqa: E501 - :type: Payment - """ - - self._payment = payment - - @property - def customs(self): - """Gets the customs of this Shipment. # noqa: E501 - - - :return: The customs of this Shipment. # noqa: E501 - :rtype: Customs - """ - return self._customs - - @customs.setter - def customs(self, customs): - """Sets the customs of this Shipment. - - - :param customs: The customs of this Shipment. # noqa: E501 - :type: Customs - """ - - self._customs = customs - - @property - def reference(self): - """Gets the reference of this Shipment. # noqa: E501 - - The shipment reference # noqa: E501 - - :return: The reference of this Shipment. # noqa: E501 - :rtype: str - """ - return self._reference - - @reference.setter - def reference(self, reference): - """Sets the reference of this Shipment. - - The shipment reference # noqa: E501 - - :param reference: The reference of this Shipment. # noqa: E501 - :type: str - """ - - self._reference = reference - - @property - def label_type(self): - """Gets the label_type of this Shipment. # noqa: E501 - - The shipment label file type. # noqa: E501 - - :return: The label_type of this Shipment. # noqa: E501 - :rtype: str - """ - return self._label_type - - @label_type.setter - def label_type(self, label_type): - """Sets the label_type of this Shipment. - - The shipment label file type. # noqa: E501 - - :param label_type: The label_type of this Shipment. # noqa: E501 - :type: str - """ - allowed_values = ["PDF", "ZPL"] # noqa: E501 - if label_type not in allowed_values: - raise ValueError( - "Invalid value for `label_type` ({0}), must be one of {1}" # noqa: E501 - .format(label_type, allowed_values) - ) - - self._label_type = label_type - - @property - def carrier_ids(self): - """Gets the carrier_ids of this Shipment. # noqa: E501 - - The list of configured carriers you wish to get rates from. *Note that the request will be sent to all carriers in nothing is specified* # noqa: E501 - - :return: The carrier_ids of this Shipment. # noqa: E501 - :rtype: list[str] - """ - return self._carrier_ids - - @carrier_ids.setter - def carrier_ids(self, carrier_ids): - """Sets the carrier_ids of this Shipment. - - The list of configured carriers you wish to get rates from. *Note that the request will be sent to all carriers in nothing is specified* # noqa: E501 - - :param carrier_ids: The carrier_ids of this Shipment. # noqa: E501 - :type: list[str] - """ - - self._carrier_ids = carrier_ids - - @property - def meta(self): - """Gets the meta of this Shipment. # noqa: E501 - - provider specific metadata # noqa: E501 - - :return: The meta of this Shipment. # noqa: E501 - :rtype: object - """ - return self._meta - - @meta.setter - def meta(self, meta): - """Sets the meta of this Shipment. - - provider specific metadata # noqa: E501 - - :param meta: The meta of this Shipment. # noqa: E501 - :type: object - """ - - self._meta = meta - - @property - def created_at(self): - """Gets the created_at of this Shipment. # noqa: E501 - - The shipment creation date Date Format: `YYYY-MM-DD` # noqa: E501 - - :return: The created_at of this Shipment. # noqa: E501 - :rtype: str - """ - return self._created_at - - @created_at.setter - def created_at(self, created_at): - """Sets the created_at of this Shipment. - - The shipment creation date Date Format: `YYYY-MM-DD` # noqa: E501 - - :param created_at: The created_at of this Shipment. # noqa: E501 - :type: str - """ - if created_at is None: - raise ValueError("Invalid value for `created_at`, must not be `None`") # noqa: E501 - - self._created_at = created_at - - @property - def test_mode(self): - """Gets the test_mode of this Shipment. # noqa: E501 - - Specified whether it was created with a carrier in test mode # noqa: E501 - - :return: The test_mode of this Shipment. # noqa: E501 - :rtype: bool - """ - return self._test_mode - - @test_mode.setter - def test_mode(self, test_mode): - """Sets the test_mode of this Shipment. - - Specified whether it was created with a carrier in test mode # noqa: E501 - - :param test_mode: The test_mode of this Shipment. # noqa: E501 - :type: bool - """ - if test_mode is None: - raise ValueError("Invalid value for `test_mode`, must not be `None`") # noqa: E501 - - self._test_mode = test_mode - - @property - def messages(self): - """Gets the messages of this Shipment. # noqa: E501 - - The list of note or warning messages # noqa: E501 - - :return: The messages of this Shipment. # noqa: E501 - :rtype: list[Message] - """ - return self._messages - - @messages.setter - def messages(self, messages): - """Sets the messages of this Shipment. - - The list of note or warning messages # noqa: E501 - - :param messages: The messages of this Shipment. # noqa: E501 - :type: list[Message] - """ - - self._messages = messages - - @property - def tracker_id(self): - """Gets the tracker_id of this Shipment. # noqa: E501 - - The selected service # noqa: E501 - - :return: The tracker_id of this Shipment. # noqa: E501 - :rtype: str - """ - return self._tracker_id - - @tracker_id.setter - def tracker_id(self, tracker_id): - """Sets the tracker_id of this Shipment. - - The selected service # noqa: E501 - - :param tracker_id: The tracker_id of this Shipment. # noqa: E501 - :type: str - """ - - self._tracker_id = tracker_id - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(Shipment, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, Shipment): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/purplship/models/shipment_cancel_request.py b/purplship/models/shipment_cancel_request.py deleted file mode 100644 index e5ec0b8..0000000 --- a/purplship/models/shipment_cancel_request.py +++ /dev/null @@ -1,169 +0,0 @@ -# coding: utf-8 - -""" - Purplship API - - ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.6.2`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 - - OpenAPI spec version: 2021.6.2 - Contact: hello@purplship.com - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - -import pprint -import re # noqa: F401 - -import six - -class ShipmentCancelRequest(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'shipment_identifier': 'str', - 'service': 'str', - 'options': 'object' - } - - attribute_map = { - 'shipment_identifier': 'shipment_identifier', - 'service': 'service', - 'options': 'options' - } - - def __init__(self, shipment_identifier=None, service=None, options=None): # noqa: E501 - """ShipmentCancelRequest - a model defined in Swagger""" # noqa: E501 - self._shipment_identifier = None - self._service = None - self._options = None - self.discriminator = None - self.shipment_identifier = shipment_identifier - if service is not None: - self.service = service - if options is not None: - self.options = options - - @property - def shipment_identifier(self): - """Gets the shipment_identifier of this ShipmentCancelRequest. # noqa: E501 - - The shipment identifier returned during creation # noqa: E501 - - :return: The shipment_identifier of this ShipmentCancelRequest. # noqa: E501 - :rtype: str - """ - return self._shipment_identifier - - @shipment_identifier.setter - def shipment_identifier(self, shipment_identifier): - """Sets the shipment_identifier of this ShipmentCancelRequest. - - The shipment identifier returned during creation # noqa: E501 - - :param shipment_identifier: The shipment_identifier of this ShipmentCancelRequest. # noqa: E501 - :type: str - """ - if shipment_identifier is None: - raise ValueError("Invalid value for `shipment_identifier`, must not be `None`") # noqa: E501 - - self._shipment_identifier = shipment_identifier - - @property - def service(self): - """Gets the service of this ShipmentCancelRequest. # noqa: E501 - - The selected shipment service # noqa: E501 - - :return: The service of this ShipmentCancelRequest. # noqa: E501 - :rtype: str - """ - return self._service - - @service.setter - def service(self, service): - """Sets the service of this ShipmentCancelRequest. - - The selected shipment service # noqa: E501 - - :param service: The service of this ShipmentCancelRequest. # noqa: E501 - :type: str - """ - - self._service = service - - @property - def options(self): - """Gets the options of this ShipmentCancelRequest. # noqa: E501 - - Advanced carrier specific cancellation options # noqa: E501 - - :return: The options of this ShipmentCancelRequest. # noqa: E501 - :rtype: object - """ - return self._options - - @options.setter - def options(self, options): - """Sets the options of this ShipmentCancelRequest. - - Advanced carrier specific cancellation options # noqa: E501 - - :param options: The options of this ShipmentCancelRequest. # noqa: E501 - :type: object - """ - - self._options = options - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(ShipmentCancelRequest, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, ShipmentCancelRequest): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/purplship/models/shipment_data.py b/purplship/models/shipment_data.py deleted file mode 100644 index 24c2c5c..0000000 --- a/purplship/models/shipment_data.py +++ /dev/null @@ -1,365 +0,0 @@ -# coding: utf-8 - -""" - Purplship API - - ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.6.2`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 - - OpenAPI spec version: 2021.6.2 - Contact: hello@purplship.com - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - -import pprint -import re # noqa: F401 - -import six - -class ShipmentData(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'shipper': 'AddressData', - 'recipient': 'AddressData', - 'parcels': 'list[ParcelData]', - 'options': 'object', - 'payment': 'Payment', - 'customs': 'CustomsData', - 'reference': 'str', - 'label_type': 'str', - 'services': 'list[str]', - 'carrier_ids': 'list[str]' - } - - attribute_map = { - 'shipper': 'shipper', - 'recipient': 'recipient', - 'parcels': 'parcels', - 'options': 'options', - 'payment': 'payment', - 'customs': 'customs', - 'reference': 'reference', - 'label_type': 'label_type', - 'services': 'services', - 'carrier_ids': 'carrier_ids' - } - - def __init__(self, shipper=None, recipient=None, parcels=None, options=None, payment=None, customs=None, reference=None, label_type='PDF', services=None, carrier_ids=None): # noqa: E501 - """ShipmentData - a model defined in Swagger""" # noqa: E501 - self._shipper = None - self._recipient = None - self._parcels = None - self._options = None - self._payment = None - self._customs = None - self._reference = None - self._label_type = None - self._services = None - self._carrier_ids = None - self.discriminator = None - self.shipper = shipper - self.recipient = recipient - self.parcels = parcels - if options is not None: - self.options = options - if payment is not None: - self.payment = payment - if customs is not None: - self.customs = customs - if reference is not None: - self.reference = reference - if label_type is not None: - self.label_type = label_type - if services is not None: - self.services = services - if carrier_ids is not None: - self.carrier_ids = carrier_ids - - @property - def shipper(self): - """Gets the shipper of this ShipmentData. # noqa: E501 - - - :return: The shipper of this ShipmentData. # noqa: E501 - :rtype: AddressData - """ - return self._shipper - - @shipper.setter - def shipper(self, shipper): - """Sets the shipper of this ShipmentData. - - - :param shipper: The shipper of this ShipmentData. # noqa: E501 - :type: AddressData - """ - if shipper is None: - raise ValueError("Invalid value for `shipper`, must not be `None`") # noqa: E501 - - self._shipper = shipper - - @property - def recipient(self): - """Gets the recipient of this ShipmentData. # noqa: E501 - - - :return: The recipient of this ShipmentData. # noqa: E501 - :rtype: AddressData - """ - return self._recipient - - @recipient.setter - def recipient(self, recipient): - """Sets the recipient of this ShipmentData. - - - :param recipient: The recipient of this ShipmentData. # noqa: E501 - :type: AddressData - """ - if recipient is None: - raise ValueError("Invalid value for `recipient`, must not be `None`") # noqa: E501 - - self._recipient = recipient - - @property - def parcels(self): - """Gets the parcels of this ShipmentData. # noqa: E501 - - The shipment's parcels # noqa: E501 - - :return: The parcels of this ShipmentData. # noqa: E501 - :rtype: list[ParcelData] - """ - return self._parcels - - @parcels.setter - def parcels(self, parcels): - """Sets the parcels of this ShipmentData. - - The shipment's parcels # noqa: E501 - - :param parcels: The parcels of this ShipmentData. # noqa: E501 - :type: list[ParcelData] - """ - if parcels is None: - raise ValueError("Invalid value for `parcels`, must not be `None`") # noqa: E501 - - self._parcels = parcels - - @property - def options(self): - """Gets the options of this ShipmentData. # noqa: E501 - - The options available for the shipment.
Please consult [the reference](#operation/references) for additional specific carriers options. # noqa: E501 - - :return: The options of this ShipmentData. # noqa: E501 - :rtype: object - """ - return self._options - - @options.setter - def options(self, options): - """Sets the options of this ShipmentData. - - The options available for the shipment.
Please consult [the reference](#operation/references) for additional specific carriers options. # noqa: E501 - - :param options: The options of this ShipmentData. # noqa: E501 - :type: object - """ - - self._options = options - - @property - def payment(self): - """Gets the payment of this ShipmentData. # noqa: E501 - - - :return: The payment of this ShipmentData. # noqa: E501 - :rtype: Payment - """ - return self._payment - - @payment.setter - def payment(self, payment): - """Sets the payment of this ShipmentData. - - - :param payment: The payment of this ShipmentData. # noqa: E501 - :type: Payment - """ - - self._payment = payment - - @property - def customs(self): - """Gets the customs of this ShipmentData. # noqa: E501 - - - :return: The customs of this ShipmentData. # noqa: E501 - :rtype: CustomsData - """ - return self._customs - - @customs.setter - def customs(self, customs): - """Sets the customs of this ShipmentData. - - - :param customs: The customs of this ShipmentData. # noqa: E501 - :type: CustomsData - """ - - self._customs = customs - - @property - def reference(self): - """Gets the reference of this ShipmentData. # noqa: E501 - - The shipment reference # noqa: E501 - - :return: The reference of this ShipmentData. # noqa: E501 - :rtype: str - """ - return self._reference - - @reference.setter - def reference(self, reference): - """Sets the reference of this ShipmentData. - - The shipment reference # noqa: E501 - - :param reference: The reference of this ShipmentData. # noqa: E501 - :type: str - """ - - self._reference = reference - - @property - def label_type(self): - """Gets the label_type of this ShipmentData. # noqa: E501 - - The shipment label file type. # noqa: E501 - - :return: The label_type of this ShipmentData. # noqa: E501 - :rtype: str - """ - return self._label_type - - @label_type.setter - def label_type(self, label_type): - """Sets the label_type of this ShipmentData. - - The shipment label file type. # noqa: E501 - - :param label_type: The label_type of this ShipmentData. # noqa: E501 - :type: str - """ - allowed_values = ["PDF", "ZPL"] # noqa: E501 - if label_type not in allowed_values: - raise ValueError( - "Invalid value for `label_type` ({0}), must be one of {1}" # noqa: E501 - .format(label_type, allowed_values) - ) - - self._label_type = label_type - - @property - def services(self): - """Gets the services of this ShipmentData. # noqa: E501 - - The requested carrier service for the shipment. Please consult [the reference](#operation/references) for specific carriers services.
Note that this is a list because on a Multi-carrier rate request you could specify a service per carrier. # noqa: E501 - - :return: The services of this ShipmentData. # noqa: E501 - :rtype: list[str] - """ - return self._services - - @services.setter - def services(self, services): - """Sets the services of this ShipmentData. - - The requested carrier service for the shipment. Please consult [the reference](#operation/references) for specific carriers services.
Note that this is a list because on a Multi-carrier rate request you could specify a service per carrier. # noqa: E501 - - :param services: The services of this ShipmentData. # noqa: E501 - :type: list[str] - """ - - self._services = services - - @property - def carrier_ids(self): - """Gets the carrier_ids of this ShipmentData. # noqa: E501 - - The list of configured carriers you wish to get rates from. *Note that the request will be sent to all carriers in nothing is specified* # noqa: E501 - - :return: The carrier_ids of this ShipmentData. # noqa: E501 - :rtype: list[str] - """ - return self._carrier_ids - - @carrier_ids.setter - def carrier_ids(self, carrier_ids): - """Sets the carrier_ids of this ShipmentData. - - The list of configured carriers you wish to get rates from. *Note that the request will be sent to all carriers in nothing is specified* # noqa: E501 - - :param carrier_ids: The carrier_ids of this ShipmentData. # noqa: E501 - :type: list[str] - """ - - self._carrier_ids = carrier_ids - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(ShipmentData, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, ShipmentData): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/purplship/models/shipment_list.py b/purplship/models/shipment_list.py deleted file mode 100644 index dad10fa..0000000 --- a/purplship/models/shipment_list.py +++ /dev/null @@ -1,163 +0,0 @@ -# coding: utf-8 - -""" - Purplship API - - ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.6.2`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 - - OpenAPI spec version: 2021.6.2 - Contact: hello@purplship.com - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - -import pprint -import re # noqa: F401 - -import six - -class ShipmentList(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'next': 'str', - 'previous': 'str', - 'results': 'list[Shipment]' - } - - attribute_map = { - 'next': 'next', - 'previous': 'previous', - 'results': 'results' - } - - def __init__(self, next=None, previous=None, results=None): # noqa: E501 - """ShipmentList - a model defined in Swagger""" # noqa: E501 - self._next = None - self._previous = None - self._results = None - self.discriminator = None - if next is not None: - self.next = next - if previous is not None: - self.previous = previous - self.results = results - - @property - def next(self): - """Gets the next of this ShipmentList. # noqa: E501 - - - :return: The next of this ShipmentList. # noqa: E501 - :rtype: str - """ - return self._next - - @next.setter - def next(self, next): - """Sets the next of this ShipmentList. - - - :param next: The next of this ShipmentList. # noqa: E501 - :type: str - """ - - self._next = next - - @property - def previous(self): - """Gets the previous of this ShipmentList. # noqa: E501 - - - :return: The previous of this ShipmentList. # noqa: E501 - :rtype: str - """ - return self._previous - - @previous.setter - def previous(self, previous): - """Sets the previous of this ShipmentList. - - - :param previous: The previous of this ShipmentList. # noqa: E501 - :type: str - """ - - self._previous = previous - - @property - def results(self): - """Gets the results of this ShipmentList. # noqa: E501 - - - :return: The results of this ShipmentList. # noqa: E501 - :rtype: list[Shipment] - """ - return self._results - - @results.setter - def results(self, results): - """Sets the results of this ShipmentList. - - - :param results: The results of this ShipmentList. # noqa: E501 - :type: list[Shipment] - """ - if results is None: - raise ValueError("Invalid value for `results`, must not be `None`") # noqa: E501 - - self._results = results - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(ShipmentList, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, ShipmentList): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/purplship/models/shipment_purchase_data.py b/purplship/models/shipment_purchase_data.py deleted file mode 100644 index 67749c7..0000000 --- a/purplship/models/shipment_purchase_data.py +++ /dev/null @@ -1,173 +0,0 @@ -# coding: utf-8 - -""" - Purplship API - - ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.6.2`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 - - OpenAPI spec version: 2021.6.2 - Contact: hello@purplship.com - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - -import pprint -import re # noqa: F401 - -import six - -class ShipmentPurchaseData(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'selected_rate_id': 'str', - 'label_type': 'str', - 'payment': 'Payment' - } - - attribute_map = { - 'selected_rate_id': 'selected_rate_id', - 'label_type': 'label_type', - 'payment': 'payment' - } - - def __init__(self, selected_rate_id=None, label_type='PDF', payment=None): # noqa: E501 - """ShipmentPurchaseData - a model defined in Swagger""" # noqa: E501 - self._selected_rate_id = None - self._label_type = None - self._payment = None - self.discriminator = None - self.selected_rate_id = selected_rate_id - if label_type is not None: - self.label_type = label_type - if payment is not None: - self.payment = payment - - @property - def selected_rate_id(self): - """Gets the selected_rate_id of this ShipmentPurchaseData. # noqa: E501 - - The shipment selected rate. # noqa: E501 - - :return: The selected_rate_id of this ShipmentPurchaseData. # noqa: E501 - :rtype: str - """ - return self._selected_rate_id - - @selected_rate_id.setter - def selected_rate_id(self, selected_rate_id): - """Sets the selected_rate_id of this ShipmentPurchaseData. - - The shipment selected rate. # noqa: E501 - - :param selected_rate_id: The selected_rate_id of this ShipmentPurchaseData. # noqa: E501 - :type: str - """ - if selected_rate_id is None: - raise ValueError("Invalid value for `selected_rate_id`, must not be `None`") # noqa: E501 - - self._selected_rate_id = selected_rate_id - - @property - def label_type(self): - """Gets the label_type of this ShipmentPurchaseData. # noqa: E501 - - The shipment label file type. # noqa: E501 - - :return: The label_type of this ShipmentPurchaseData. # noqa: E501 - :rtype: str - """ - return self._label_type - - @label_type.setter - def label_type(self, label_type): - """Sets the label_type of this ShipmentPurchaseData. - - The shipment label file type. # noqa: E501 - - :param label_type: The label_type of this ShipmentPurchaseData. # noqa: E501 - :type: str - """ - allowed_values = ["PDF", "ZPL"] # noqa: E501 - if label_type not in allowed_values: - raise ValueError( - "Invalid value for `label_type` ({0}), must be one of {1}" # noqa: E501 - .format(label_type, allowed_values) - ) - - self._label_type = label_type - - @property - def payment(self): - """Gets the payment of this ShipmentPurchaseData. # noqa: E501 - - - :return: The payment of this ShipmentPurchaseData. # noqa: E501 - :rtype: Payment - """ - return self._payment - - @payment.setter - def payment(self, payment): - """Sets the payment of this ShipmentPurchaseData. - - - :param payment: The payment of this ShipmentPurchaseData. # noqa: E501 - :type: Payment - """ - - self._payment = payment - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(ShipmentPurchaseData, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, ShipmentPurchaseData): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/purplship/models/shipping_request.py b/purplship/models/shipping_request.py deleted file mode 100644 index 469a0c8..0000000 --- a/purplship/models/shipping_request.py +++ /dev/null @@ -1,368 +0,0 @@ -# coding: utf-8 - -""" - Purplship API - - ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.6.2`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 - - OpenAPI spec version: 2021.6.2 - Contact: hello@purplship.com - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - -import pprint -import re # noqa: F401 - -import six - -class ShippingRequest(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'shipper': 'AddressData', - 'recipient': 'AddressData', - 'parcels': 'list[ParcelData]', - 'options': 'object', - 'payment': 'Payment', - 'customs': 'CustomsData', - 'reference': 'str', - 'label_type': 'str', - 'selected_rate_id': 'str', - 'rates': 'list[Rate]' - } - - attribute_map = { - 'shipper': 'shipper', - 'recipient': 'recipient', - 'parcels': 'parcels', - 'options': 'options', - 'payment': 'payment', - 'customs': 'customs', - 'reference': 'reference', - 'label_type': 'label_type', - 'selected_rate_id': 'selected_rate_id', - 'rates': 'rates' - } - - def __init__(self, shipper=None, recipient=None, parcels=None, options=None, payment=None, customs=None, reference=None, label_type='PDF', selected_rate_id=None, rates=None): # noqa: E501 - """ShippingRequest - a model defined in Swagger""" # noqa: E501 - self._shipper = None - self._recipient = None - self._parcels = None - self._options = None - self._payment = None - self._customs = None - self._reference = None - self._label_type = None - self._selected_rate_id = None - self._rates = None - self.discriminator = None - self.shipper = shipper - self.recipient = recipient - self.parcels = parcels - if options is not None: - self.options = options - self.payment = payment - if customs is not None: - self.customs = customs - if reference is not None: - self.reference = reference - if label_type is not None: - self.label_type = label_type - self.selected_rate_id = selected_rate_id - self.rates = rates - - @property - def shipper(self): - """Gets the shipper of this ShippingRequest. # noqa: E501 - - - :return: The shipper of this ShippingRequest. # noqa: E501 - :rtype: AddressData - """ - return self._shipper - - @shipper.setter - def shipper(self, shipper): - """Sets the shipper of this ShippingRequest. - - - :param shipper: The shipper of this ShippingRequest. # noqa: E501 - :type: AddressData - """ - if shipper is None: - raise ValueError("Invalid value for `shipper`, must not be `None`") # noqa: E501 - - self._shipper = shipper - - @property - def recipient(self): - """Gets the recipient of this ShippingRequest. # noqa: E501 - - - :return: The recipient of this ShippingRequest. # noqa: E501 - :rtype: AddressData - """ - return self._recipient - - @recipient.setter - def recipient(self, recipient): - """Sets the recipient of this ShippingRequest. - - - :param recipient: The recipient of this ShippingRequest. # noqa: E501 - :type: AddressData - """ - if recipient is None: - raise ValueError("Invalid value for `recipient`, must not be `None`") # noqa: E501 - - self._recipient = recipient - - @property - def parcels(self): - """Gets the parcels of this ShippingRequest. # noqa: E501 - - The shipment's parcels # noqa: E501 - - :return: The parcels of this ShippingRequest. # noqa: E501 - :rtype: list[ParcelData] - """ - return self._parcels - - @parcels.setter - def parcels(self, parcels): - """Sets the parcels of this ShippingRequest. - - The shipment's parcels # noqa: E501 - - :param parcels: The parcels of this ShippingRequest. # noqa: E501 - :type: list[ParcelData] - """ - if parcels is None: - raise ValueError("Invalid value for `parcels`, must not be `None`") # noqa: E501 - - self._parcels = parcels - - @property - def options(self): - """Gets the options of this ShippingRequest. # noqa: E501 - - The options available for the shipment.
Please consult [the reference](#operation/references) for additional specific carriers options. # noqa: E501 - - :return: The options of this ShippingRequest. # noqa: E501 - :rtype: object - """ - return self._options - - @options.setter - def options(self, options): - """Sets the options of this ShippingRequest. - - The options available for the shipment.
Please consult [the reference](#operation/references) for additional specific carriers options. # noqa: E501 - - :param options: The options of this ShippingRequest. # noqa: E501 - :type: object - """ - - self._options = options - - @property - def payment(self): - """Gets the payment of this ShippingRequest. # noqa: E501 - - - :return: The payment of this ShippingRequest. # noqa: E501 - :rtype: Payment - """ - return self._payment - - @payment.setter - def payment(self, payment): - """Sets the payment of this ShippingRequest. - - - :param payment: The payment of this ShippingRequest. # noqa: E501 - :type: Payment - """ - if payment is None: - raise ValueError("Invalid value for `payment`, must not be `None`") # noqa: E501 - - self._payment = payment - - @property - def customs(self): - """Gets the customs of this ShippingRequest. # noqa: E501 - - - :return: The customs of this ShippingRequest. # noqa: E501 - :rtype: CustomsData - """ - return self._customs - - @customs.setter - def customs(self, customs): - """Sets the customs of this ShippingRequest. - - - :param customs: The customs of this ShippingRequest. # noqa: E501 - :type: CustomsData - """ - - self._customs = customs - - @property - def reference(self): - """Gets the reference of this ShippingRequest. # noqa: E501 - - The shipment reference # noqa: E501 - - :return: The reference of this ShippingRequest. # noqa: E501 - :rtype: str - """ - return self._reference - - @reference.setter - def reference(self, reference): - """Sets the reference of this ShippingRequest. - - The shipment reference # noqa: E501 - - :param reference: The reference of this ShippingRequest. # noqa: E501 - :type: str - """ - - self._reference = reference - - @property - def label_type(self): - """Gets the label_type of this ShippingRequest. # noqa: E501 - - The shipment label file type. # noqa: E501 - - :return: The label_type of this ShippingRequest. # noqa: E501 - :rtype: str - """ - return self._label_type - - @label_type.setter - def label_type(self, label_type): - """Sets the label_type of this ShippingRequest. - - The shipment label file type. # noqa: E501 - - :param label_type: The label_type of this ShippingRequest. # noqa: E501 - :type: str - """ - allowed_values = ["PDF", "ZPL"] # noqa: E501 - if label_type not in allowed_values: - raise ValueError( - "Invalid value for `label_type` ({0}), must be one of {1}" # noqa: E501 - .format(label_type, allowed_values) - ) - - self._label_type = label_type - - @property - def selected_rate_id(self): - """Gets the selected_rate_id of this ShippingRequest. # noqa: E501 - - The shipment selected rate. # noqa: E501 - - :return: The selected_rate_id of this ShippingRequest. # noqa: E501 - :rtype: str - """ - return self._selected_rate_id - - @selected_rate_id.setter - def selected_rate_id(self, selected_rate_id): - """Sets the selected_rate_id of this ShippingRequest. - - The shipment selected rate. # noqa: E501 - - :param selected_rate_id: The selected_rate_id of this ShippingRequest. # noqa: E501 - :type: str - """ - if selected_rate_id is None: - raise ValueError("Invalid value for `selected_rate_id`, must not be `None`") # noqa: E501 - - self._selected_rate_id = selected_rate_id - - @property - def rates(self): - """Gets the rates of this ShippingRequest. # noqa: E501 - - The list for shipment rates fetched previously # noqa: E501 - - :return: The rates of this ShippingRequest. # noqa: E501 - :rtype: list[Rate] - """ - return self._rates - - @rates.setter - def rates(self, rates): - """Sets the rates of this ShippingRequest. - - The list for shipment rates fetched previously # noqa: E501 - - :param rates: The rates of this ShippingRequest. # noqa: E501 - :type: list[Rate] - """ - if rates is None: - raise ValueError("Invalid value for `rates`, must not be `None`") # noqa: E501 - - self._rates = rates - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(ShippingRequest, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, ShippingRequest): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/purplship/models/token_obtain_pair.py b/purplship/models/token_obtain_pair.py deleted file mode 100644 index 2c1b427..0000000 --- a/purplship/models/token_obtain_pair.py +++ /dev/null @@ -1,166 +0,0 @@ -# coding: utf-8 - -""" - Purplship API - - ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.6.2`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 - - OpenAPI spec version: 2021.6.2 - Contact: hello@purplship.com - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - -import pprint -import re # noqa: F401 - -import six - -class TokenObtainPair(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'email': 'str', - 'password': 'str', - 'org_id': 'str' - } - - attribute_map = { - 'email': 'email', - 'password': 'password', - 'org_id': 'org_id' - } - - def __init__(self, email=None, password=None, org_id=None): # noqa: E501 - """TokenObtainPair - a model defined in Swagger""" # noqa: E501 - self._email = None - self._password = None - self._org_id = None - self.discriminator = None - self.email = email - self.password = password - if org_id is not None: - self.org_id = org_id - - @property - def email(self): - """Gets the email of this TokenObtainPair. # noqa: E501 - - - :return: The email of this TokenObtainPair. # noqa: E501 - :rtype: str - """ - return self._email - - @email.setter - def email(self, email): - """Sets the email of this TokenObtainPair. - - - :param email: The email of this TokenObtainPair. # noqa: E501 - :type: str - """ - if email is None: - raise ValueError("Invalid value for `email`, must not be `None`") # noqa: E501 - - self._email = email - - @property - def password(self): - """Gets the password of this TokenObtainPair. # noqa: E501 - - - :return: The password of this TokenObtainPair. # noqa: E501 - :rtype: str - """ - return self._password - - @password.setter - def password(self, password): - """Sets the password of this TokenObtainPair. - - - :param password: The password of this TokenObtainPair. # noqa: E501 - :type: str - """ - if password is None: - raise ValueError("Invalid value for `password`, must not be `None`") # noqa: E501 - - self._password = password - - @property - def org_id(self): - """Gets the org_id of this TokenObtainPair. # noqa: E501 - - **should be specified only in a multi-org deployment.** Note the first org related to the user is selected by default. # noqa: E501 - - :return: The org_id of this TokenObtainPair. # noqa: E501 - :rtype: str - """ - return self._org_id - - @org_id.setter - def org_id(self, org_id): - """Sets the org_id of this TokenObtainPair. - - **should be specified only in a multi-org deployment.** Note the first org related to the user is selected by default. # noqa: E501 - - :param org_id: The org_id of this TokenObtainPair. # noqa: E501 - :type: str - """ - - self._org_id = org_id - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(TokenObtainPair, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, TokenObtainPair): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/purplship/models/token_pair.py b/purplship/models/token_pair.py deleted file mode 100644 index d08876b..0000000 --- a/purplship/models/token_pair.py +++ /dev/null @@ -1,138 +0,0 @@ -# coding: utf-8 - -""" - Purplship API - - ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.6.2`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 - - OpenAPI spec version: 2021.6.2 - Contact: hello@purplship.com - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - -import pprint -import re # noqa: F401 - -import six - -class TokenPair(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'access': 'str', - 'refresh': 'str' - } - - attribute_map = { - 'access': 'access', - 'refresh': 'refresh' - } - - def __init__(self, access=None, refresh=None): # noqa: E501 - """TokenPair - a model defined in Swagger""" # noqa: E501 - self._access = None - self._refresh = None - self.discriminator = None - self.access = access - self.refresh = refresh - - @property - def access(self): - """Gets the access of this TokenPair. # noqa: E501 - - - :return: The access of this TokenPair. # noqa: E501 - :rtype: str - """ - return self._access - - @access.setter - def access(self, access): - """Sets the access of this TokenPair. - - - :param access: The access of this TokenPair. # noqa: E501 - :type: str - """ - if access is None: - raise ValueError("Invalid value for `access`, must not be `None`") # noqa: E501 - - self._access = access - - @property - def refresh(self): - """Gets the refresh of this TokenPair. # noqa: E501 - - - :return: The refresh of this TokenPair. # noqa: E501 - :rtype: str - """ - return self._refresh - - @refresh.setter - def refresh(self, refresh): - """Sets the refresh of this TokenPair. - - - :param refresh: The refresh of this TokenPair. # noqa: E501 - :type: str - """ - if refresh is None: - raise ValueError("Invalid value for `refresh`, must not be `None`") # noqa: E501 - - self._refresh = refresh - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(TokenPair, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, TokenPair): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/purplship/models/token_refresh.py b/purplship/models/token_refresh.py deleted file mode 100644 index 2983d63..0000000 --- a/purplship/models/token_refresh.py +++ /dev/null @@ -1,111 +0,0 @@ -# coding: utf-8 - -""" - Purplship API - - ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.6.2`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 - - OpenAPI spec version: 2021.6.2 - Contact: hello@purplship.com - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - -import pprint -import re # noqa: F401 - -import six - -class TokenRefresh(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'refresh': 'str' - } - - attribute_map = { - 'refresh': 'refresh' - } - - def __init__(self, refresh=None): # noqa: E501 - """TokenRefresh - a model defined in Swagger""" # noqa: E501 - self._refresh = None - self.discriminator = None - self.refresh = refresh - - @property - def refresh(self): - """Gets the refresh of this TokenRefresh. # noqa: E501 - - - :return: The refresh of this TokenRefresh. # noqa: E501 - :rtype: str - """ - return self._refresh - - @refresh.setter - def refresh(self, refresh): - """Sets the refresh of this TokenRefresh. - - - :param refresh: The refresh of this TokenRefresh. # noqa: E501 - :type: str - """ - if refresh is None: - raise ValueError("Invalid value for `refresh`, must not be `None`") # noqa: E501 - - self._refresh = refresh - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(TokenRefresh, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, TokenRefresh): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/purplship/models/token_verify.py b/purplship/models/token_verify.py deleted file mode 100644 index 5bad754..0000000 --- a/purplship/models/token_verify.py +++ /dev/null @@ -1,111 +0,0 @@ -# coding: utf-8 - -""" - Purplship API - - ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.6.2`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 - - OpenAPI spec version: 2021.6.2 - Contact: hello@purplship.com - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - -import pprint -import re # noqa: F401 - -import six - -class TokenVerify(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'token': 'str' - } - - attribute_map = { - 'token': 'token' - } - - def __init__(self, token=None): # noqa: E501 - """TokenVerify - a model defined in Swagger""" # noqa: E501 - self._token = None - self.discriminator = None - self.token = token - - @property - def token(self): - """Gets the token of this TokenVerify. # noqa: E501 - - - :return: The token of this TokenVerify. # noqa: E501 - :rtype: str - """ - return self._token - - @token.setter - def token(self, token): - """Sets the token of this TokenVerify. - - - :param token: The token of this TokenVerify. # noqa: E501 - :type: str - """ - if token is None: - raise ValueError("Invalid value for `token`, must not be `None`") # noqa: E501 - - self._token = token - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(TokenVerify, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, TokenVerify): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/purplship/models/tracker_list.py b/purplship/models/tracker_list.py deleted file mode 100644 index 00b9ad5..0000000 --- a/purplship/models/tracker_list.py +++ /dev/null @@ -1,163 +0,0 @@ -# coding: utf-8 - -""" - Purplship API - - ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.6.2`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 - - OpenAPI spec version: 2021.6.2 - Contact: hello@purplship.com - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - -import pprint -import re # noqa: F401 - -import six - -class TrackerList(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'next': 'str', - 'previous': 'str', - 'results': 'list[TrackingStatus]' - } - - attribute_map = { - 'next': 'next', - 'previous': 'previous', - 'results': 'results' - } - - def __init__(self, next=None, previous=None, results=None): # noqa: E501 - """TrackerList - a model defined in Swagger""" # noqa: E501 - self._next = None - self._previous = None - self._results = None - self.discriminator = None - if next is not None: - self.next = next - if previous is not None: - self.previous = previous - self.results = results - - @property - def next(self): - """Gets the next of this TrackerList. # noqa: E501 - - - :return: The next of this TrackerList. # noqa: E501 - :rtype: str - """ - return self._next - - @next.setter - def next(self, next): - """Sets the next of this TrackerList. - - - :param next: The next of this TrackerList. # noqa: E501 - :type: str - """ - - self._next = next - - @property - def previous(self): - """Gets the previous of this TrackerList. # noqa: E501 - - - :return: The previous of this TrackerList. # noqa: E501 - :rtype: str - """ - return self._previous - - @previous.setter - def previous(self, previous): - """Sets the previous of this TrackerList. - - - :param previous: The previous of this TrackerList. # noqa: E501 - :type: str - """ - - self._previous = previous - - @property - def results(self): - """Gets the results of this TrackerList. # noqa: E501 - - - :return: The results of this TrackerList. # noqa: E501 - :rtype: list[TrackingStatus] - """ - return self._results - - @results.setter - def results(self, results): - """Sets the results of this TrackerList. - - - :param results: The results of this TrackerList. # noqa: E501 - :type: list[TrackingStatus] - """ - if results is None: - raise ValueError("Invalid value for `results`, must not be `None`") # noqa: E501 - - self._results = results - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(TrackerList, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, TrackerList): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/purplship/models/tracking_event.py b/purplship/models/tracking_event.py deleted file mode 100644 index 7a2fa6f..0000000 --- a/purplship/models/tracking_event.py +++ /dev/null @@ -1,224 +0,0 @@ -# coding: utf-8 - -""" - Purplship API - - ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.6.2`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 - - OpenAPI spec version: 2021.6.2 - Contact: hello@purplship.com - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - -import pprint -import re # noqa: F401 - -import six - -class TrackingEvent(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - '_date': 'str', - 'description': 'str', - 'location': 'str', - 'code': 'str', - 'time': 'str' - } - - attribute_map = { - '_date': 'date', - 'description': 'description', - 'location': 'location', - 'code': 'code', - 'time': 'time' - } - - def __init__(self, _date=None, description=None, location=None, code=None, time=None): # noqa: E501 - """TrackingEvent - a model defined in Swagger""" # noqa: E501 - self.__date = None - self._description = None - self._location = None - self._code = None - self._time = None - self.discriminator = None - if _date is not None: - self._date = _date - if description is not None: - self.description = description - if location is not None: - self.location = location - if code is not None: - self.code = code - if time is not None: - self.time = time - - @property - def _date(self): - """Gets the _date of this TrackingEvent. # noqa: E501 - - The tracking event's date # noqa: E501 - - :return: The _date of this TrackingEvent. # noqa: E501 - :rtype: str - """ - return self.__date - - @_date.setter - def _date(self, _date): - """Sets the _date of this TrackingEvent. - - The tracking event's date # noqa: E501 - - :param _date: The _date of this TrackingEvent. # noqa: E501 - :type: str - """ - - self.__date = _date - - @property - def description(self): - """Gets the description of this TrackingEvent. # noqa: E501 - - The tracking event's description # noqa: E501 - - :return: The description of this TrackingEvent. # noqa: E501 - :rtype: str - """ - return self._description - - @description.setter - def description(self, description): - """Sets the description of this TrackingEvent. - - The tracking event's description # noqa: E501 - - :param description: The description of this TrackingEvent. # noqa: E501 - :type: str - """ - - self._description = description - - @property - def location(self): - """Gets the location of this TrackingEvent. # noqa: E501 - - The tracking event's location # noqa: E501 - - :return: The location of this TrackingEvent. # noqa: E501 - :rtype: str - """ - return self._location - - @location.setter - def location(self, location): - """Sets the location of this TrackingEvent. - - The tracking event's location # noqa: E501 - - :param location: The location of this TrackingEvent. # noqa: E501 - :type: str - """ - - self._location = location - - @property - def code(self): - """Gets the code of this TrackingEvent. # noqa: E501 - - The tracking event's code # noqa: E501 - - :return: The code of this TrackingEvent. # noqa: E501 - :rtype: str - """ - return self._code - - @code.setter - def code(self, code): - """Sets the code of this TrackingEvent. - - The tracking event's code # noqa: E501 - - :param code: The code of this TrackingEvent. # noqa: E501 - :type: str - """ - - self._code = code - - @property - def time(self): - """Gets the time of this TrackingEvent. # noqa: E501 - - The tracking event's time # noqa: E501 - - :return: The time of this TrackingEvent. # noqa: E501 - :rtype: str - """ - return self._time - - @time.setter - def time(self, time): - """Sets the time of this TrackingEvent. - - The tracking event's time # noqa: E501 - - :param time: The time of this TrackingEvent. # noqa: E501 - :type: str - """ - - self._time = time - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(TrackingEvent, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, TrackingEvent): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/purplship/models/tracking_response.py b/purplship/models/tracking_response.py deleted file mode 100644 index 70dd185..0000000 --- a/purplship/models/tracking_response.py +++ /dev/null @@ -1,138 +0,0 @@ -# coding: utf-8 - -""" - Purplship API - - ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.6.2`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 - - OpenAPI spec version: 2021.6.2 - Contact: hello@purplship.com - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - -import pprint -import re # noqa: F401 - -import six - -class TrackingResponse(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'messages': 'list[Message]', - 'tracking': 'TrackingStatus' - } - - attribute_map = { - 'messages': 'messages', - 'tracking': 'tracking' - } - - def __init__(self, messages=None, tracking=None): # noqa: E501 - """TrackingResponse - a model defined in Swagger""" # noqa: E501 - self._messages = None - self._tracking = None - self.discriminator = None - if messages is not None: - self.messages = messages - if tracking is not None: - self.tracking = tracking - - @property - def messages(self): - """Gets the messages of this TrackingResponse. # noqa: E501 - - The list of note or warning messages # noqa: E501 - - :return: The messages of this TrackingResponse. # noqa: E501 - :rtype: list[Message] - """ - return self._messages - - @messages.setter - def messages(self, messages): - """Sets the messages of this TrackingResponse. - - The list of note or warning messages # noqa: E501 - - :param messages: The messages of this TrackingResponse. # noqa: E501 - :type: list[Message] - """ - - self._messages = messages - - @property - def tracking(self): - """Gets the tracking of this TrackingResponse. # noqa: E501 - - - :return: The tracking of this TrackingResponse. # noqa: E501 - :rtype: TrackingStatus - """ - return self._tracking - - @tracking.setter - def tracking(self, tracking): - """Sets the tracking of this TrackingResponse. - - - :param tracking: The tracking of this TrackingResponse. # noqa: E501 - :type: TrackingStatus - """ - - self._tracking = tracking - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(TrackingResponse, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, TrackingResponse): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/purplship/models/tracking_status.py b/purplship/models/tracking_status.py deleted file mode 100644 index 3a21db3..0000000 --- a/purplship/models/tracking_status.py +++ /dev/null @@ -1,312 +0,0 @@ -# coding: utf-8 - -""" - Purplship API - - ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.6.2`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 - - OpenAPI spec version: 2021.6.2 - Contact: hello@purplship.com - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - -import pprint -import re # noqa: F401 - -import six - -class TrackingStatus(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'id': 'str', - 'carrier_name': 'str', - 'carrier_id': 'str', - 'tracking_number': 'str', - 'events': 'list[TrackingEvent]', - 'delivered': 'bool', - 'test_mode': 'bool', - 'pending': 'bool' - } - - attribute_map = { - 'id': 'id', - 'carrier_name': 'carrier_name', - 'carrier_id': 'carrier_id', - 'tracking_number': 'tracking_number', - 'events': 'events', - 'delivered': 'delivered', - 'test_mode': 'test_mode', - 'pending': 'pending' - } - - def __init__(self, id=None, carrier_name=None, carrier_id=None, tracking_number=None, events=None, delivered=None, test_mode=None, pending=None): # noqa: E501 - """TrackingStatus - a model defined in Swagger""" # noqa: E501 - self._id = None - self._carrier_name = None - self._carrier_id = None - self._tracking_number = None - self._events = None - self._delivered = None - self._test_mode = None - self._pending = None - self.discriminator = None - if id is not None: - self.id = id - self.carrier_name = carrier_name - self.carrier_id = carrier_id - self.tracking_number = tracking_number - if events is not None: - self.events = events - if delivered is not None: - self.delivered = delivered - self.test_mode = test_mode - if pending is not None: - self.pending = pending - - @property - def id(self): - """Gets the id of this TrackingStatus. # noqa: E501 - - A unique identifier # noqa: E501 - - :return: The id of this TrackingStatus. # noqa: E501 - :rtype: str - """ - return self._id - - @id.setter - def id(self, id): - """Sets the id of this TrackingStatus. - - A unique identifier # noqa: E501 - - :param id: The id of this TrackingStatus. # noqa: E501 - :type: str - """ - - self._id = id - - @property - def carrier_name(self): - """Gets the carrier_name of this TrackingStatus. # noqa: E501 - - The tracking carrier # noqa: E501 - - :return: The carrier_name of this TrackingStatus. # noqa: E501 - :rtype: str - """ - return self._carrier_name - - @carrier_name.setter - def carrier_name(self, carrier_name): - """Sets the carrier_name of this TrackingStatus. - - The tracking carrier # noqa: E501 - - :param carrier_name: The carrier_name of this TrackingStatus. # noqa: E501 - :type: str - """ - if carrier_name is None: - raise ValueError("Invalid value for `carrier_name`, must not be `None`") # noqa: E501 - - self._carrier_name = carrier_name - - @property - def carrier_id(self): - """Gets the carrier_id of this TrackingStatus. # noqa: E501 - - The tracking carrier configured identifier # noqa: E501 - - :return: The carrier_id of this TrackingStatus. # noqa: E501 - :rtype: str - """ - return self._carrier_id - - @carrier_id.setter - def carrier_id(self, carrier_id): - """Sets the carrier_id of this TrackingStatus. - - The tracking carrier configured identifier # noqa: E501 - - :param carrier_id: The carrier_id of this TrackingStatus. # noqa: E501 - :type: str - """ - if carrier_id is None: - raise ValueError("Invalid value for `carrier_id`, must not be `None`") # noqa: E501 - - self._carrier_id = carrier_id - - @property - def tracking_number(self): - """Gets the tracking_number of this TrackingStatus. # noqa: E501 - - The shipment tracking number # noqa: E501 - - :return: The tracking_number of this TrackingStatus. # noqa: E501 - :rtype: str - """ - return self._tracking_number - - @tracking_number.setter - def tracking_number(self, tracking_number): - """Sets the tracking_number of this TrackingStatus. - - The shipment tracking number # noqa: E501 - - :param tracking_number: The tracking_number of this TrackingStatus. # noqa: E501 - :type: str - """ - if tracking_number is None: - raise ValueError("Invalid value for `tracking_number`, must not be `None`") # noqa: E501 - - self._tracking_number = tracking_number - - @property - def events(self): - """Gets the events of this TrackingStatus. # noqa: E501 - - The tracking details events # noqa: E501 - - :return: The events of this TrackingStatus. # noqa: E501 - :rtype: list[TrackingEvent] - """ - return self._events - - @events.setter - def events(self, events): - """Sets the events of this TrackingStatus. - - The tracking details events # noqa: E501 - - :param events: The events of this TrackingStatus. # noqa: E501 - :type: list[TrackingEvent] - """ - - self._events = events - - @property - def delivered(self): - """Gets the delivered of this TrackingStatus. # noqa: E501 - - Specified whether the related shipment was delivered # noqa: E501 - - :return: The delivered of this TrackingStatus. # noqa: E501 - :rtype: bool - """ - return self._delivered - - @delivered.setter - def delivered(self, delivered): - """Sets the delivered of this TrackingStatus. - - Specified whether the related shipment was delivered # noqa: E501 - - :param delivered: The delivered of this TrackingStatus. # noqa: E501 - :type: bool - """ - - self._delivered = delivered - - @property - def test_mode(self): - """Gets the test_mode of this TrackingStatus. # noqa: E501 - - Specified whether the object was created with a carrier in test mode # noqa: E501 - - :return: The test_mode of this TrackingStatus. # noqa: E501 - :rtype: bool - """ - return self._test_mode - - @test_mode.setter - def test_mode(self, test_mode): - """Sets the test_mode of this TrackingStatus. - - Specified whether the object was created with a carrier in test mode # noqa: E501 - - :param test_mode: The test_mode of this TrackingStatus. # noqa: E501 - :type: bool - """ - if test_mode is None: - raise ValueError("Invalid value for `test_mode`, must not be `None`") # noqa: E501 - - self._test_mode = test_mode - - @property - def pending(self): - """Gets the pending of this TrackingStatus. # noqa: E501 - - Specified whether the shipment hasn't been picked up or is in an unknown state # noqa: E501 - - :return: The pending of this TrackingStatus. # noqa: E501 - :rtype: bool - """ - return self._pending - - @pending.setter - def pending(self, pending): - """Sets the pending of this TrackingStatus. - - Specified whether the shipment hasn't been picked up or is in an unknown state # noqa: E501 - - :param pending: The pending of this TrackingStatus. # noqa: E501 - :type: bool - """ - - self._pending = pending - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(TrackingStatus, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, TrackingStatus): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/purplship/models/webhook.py b/purplship/models/webhook.py deleted file mode 100644 index 197e974..0000000 --- a/purplship/models/webhook.py +++ /dev/null @@ -1,290 +0,0 @@ -# coding: utf-8 - -""" - Purplship API - - ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.6.2`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 - - OpenAPI spec version: 2021.6.2 - Contact: hello@purplship.com - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - -import pprint -import re # noqa: F401 - -import six - -class Webhook(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'url': 'str', - 'description': 'str', - 'enabled_events': 'list[str]', - 'test_mode': 'bool', - 'disabled': 'bool', - 'id': 'str', - 'last_event_at': 'datetime' - } - - attribute_map = { - 'url': 'url', - 'description': 'description', - 'enabled_events': 'enabled_events', - 'test_mode': 'test_mode', - 'disabled': 'disabled', - 'id': 'id', - 'last_event_at': 'last_event_at' - } - - def __init__(self, url=None, description=None, enabled_events=None, test_mode=None, disabled=None, id=None, last_event_at=None): # noqa: E501 - """Webhook - a model defined in Swagger""" # noqa: E501 - self._url = None - self._description = None - self._enabled_events = None - self._test_mode = None - self._disabled = None - self._id = None - self._last_event_at = None - self.discriminator = None - self.url = url - if description is not None: - self.description = description - self.enabled_events = enabled_events - self.test_mode = test_mode - if disabled is not None: - self.disabled = disabled - if id is not None: - self.id = id - if last_event_at is not None: - self.last_event_at = last_event_at - - @property - def url(self): - """Gets the url of this Webhook. # noqa: E501 - - The URL of the webhook endpoint. # noqa: E501 - - :return: The url of this Webhook. # noqa: E501 - :rtype: str - """ - return self._url - - @url.setter - def url(self, url): - """Sets the url of this Webhook. - - The URL of the webhook endpoint. # noqa: E501 - - :param url: The url of this Webhook. # noqa: E501 - :type: str - """ - if url is None: - raise ValueError("Invalid value for `url`, must not be `None`") # noqa: E501 - - self._url = url - - @property - def description(self): - """Gets the description of this Webhook. # noqa: E501 - - An optional description of what the webhook is used for. # noqa: E501 - - :return: The description of this Webhook. # noqa: E501 - :rtype: str - """ - return self._description - - @description.setter - def description(self, description): - """Sets the description of this Webhook. - - An optional description of what the webhook is used for. # noqa: E501 - - :param description: The description of this Webhook. # noqa: E501 - :type: str - """ - - self._description = description - - @property - def enabled_events(self): - """Gets the enabled_events of this Webhook. # noqa: E501 - - The list of events to enable for this endpoint. # noqa: E501 - - :return: The enabled_events of this Webhook. # noqa: E501 - :rtype: list[str] - """ - return self._enabled_events - - @enabled_events.setter - def enabled_events(self, enabled_events): - """Sets the enabled_events of this Webhook. - - The list of events to enable for this endpoint. # noqa: E501 - - :param enabled_events: The enabled_events of this Webhook. # noqa: E501 - :type: list[str] - """ - if enabled_events is None: - raise ValueError("Invalid value for `enabled_events`, must not be `None`") # noqa: E501 - allowed_values = ["all", "shipment.purchased", "shipment.cancelled", "shipment.fulfilled", "tracker.created", "tracker.updated"] # noqa: E501 - if not set(enabled_events).issubset(set(allowed_values)): - raise ValueError( - "Invalid values for `enabled_events` [{0}], must be a subset of [{1}]" # noqa: E501 - .format(", ".join(map(str, set(enabled_events) - set(allowed_values))), # noqa: E501 - ", ".join(map(str, allowed_values))) - ) - - self._enabled_events = enabled_events - - @property - def test_mode(self): - """Gets the test_mode of this Webhook. # noqa: E501 - - Specified whether it was created with a carrier in test mode # noqa: E501 - - :return: The test_mode of this Webhook. # noqa: E501 - :rtype: bool - """ - return self._test_mode - - @test_mode.setter - def test_mode(self, test_mode): - """Sets the test_mode of this Webhook. - - Specified whether it was created with a carrier in test mode # noqa: E501 - - :param test_mode: The test_mode of this Webhook. # noqa: E501 - :type: bool - """ - if test_mode is None: - raise ValueError("Invalid value for `test_mode`, must not be `None`") # noqa: E501 - - self._test_mode = test_mode - - @property - def disabled(self): - """Gets the disabled of this Webhook. # noqa: E501 - - Indicates that the webhook is disabled # noqa: E501 - - :return: The disabled of this Webhook. # noqa: E501 - :rtype: bool - """ - return self._disabled - - @disabled.setter - def disabled(self, disabled): - """Sets the disabled of this Webhook. - - Indicates that the webhook is disabled # noqa: E501 - - :param disabled: The disabled of this Webhook. # noqa: E501 - :type: bool - """ - - self._disabled = disabled - - @property - def id(self): - """Gets the id of this Webhook. # noqa: E501 - - A unique identifier # noqa: E501 - - :return: The id of this Webhook. # noqa: E501 - :rtype: str - """ - return self._id - - @id.setter - def id(self, id): - """Sets the id of this Webhook. - - A unique identifier # noqa: E501 - - :param id: The id of this Webhook. # noqa: E501 - :type: str - """ - - self._id = id - - @property - def last_event_at(self): - """Gets the last_event_at of this Webhook. # noqa: E501 - - The datetime of the last event sent. # noqa: E501 - - :return: The last_event_at of this Webhook. # noqa: E501 - :rtype: datetime - """ - return self._last_event_at - - @last_event_at.setter - def last_event_at(self, last_event_at): - """Sets the last_event_at of this Webhook. - - The datetime of the last event sent. # noqa: E501 - - :param last_event_at: The last_event_at of this Webhook. # noqa: E501 - :type: datetime - """ - - self._last_event_at = last_event_at - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(Webhook, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, Webhook): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/purplship/models/webhook_data.py b/purplship/models/webhook_data.py deleted file mode 100644 index 6faf06b..0000000 --- a/purplship/models/webhook_data.py +++ /dev/null @@ -1,234 +0,0 @@ -# coding: utf-8 - -""" - Purplship API - - ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.6.2`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 - - OpenAPI spec version: 2021.6.2 - Contact: hello@purplship.com - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - -import pprint -import re # noqa: F401 - -import six - -class WebhookData(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'url': 'str', - 'description': 'str', - 'enabled_events': 'list[str]', - 'test_mode': 'bool', - 'disabled': 'bool' - } - - attribute_map = { - 'url': 'url', - 'description': 'description', - 'enabled_events': 'enabled_events', - 'test_mode': 'test_mode', - 'disabled': 'disabled' - } - - def __init__(self, url=None, description=None, enabled_events=None, test_mode=None, disabled=None): # noqa: E501 - """WebhookData - a model defined in Swagger""" # noqa: E501 - self._url = None - self._description = None - self._enabled_events = None - self._test_mode = None - self._disabled = None - self.discriminator = None - self.url = url - if description is not None: - self.description = description - self.enabled_events = enabled_events - self.test_mode = test_mode - if disabled is not None: - self.disabled = disabled - - @property - def url(self): - """Gets the url of this WebhookData. # noqa: E501 - - The URL of the webhook endpoint. # noqa: E501 - - :return: The url of this WebhookData. # noqa: E501 - :rtype: str - """ - return self._url - - @url.setter - def url(self, url): - """Sets the url of this WebhookData. - - The URL of the webhook endpoint. # noqa: E501 - - :param url: The url of this WebhookData. # noqa: E501 - :type: str - """ - if url is None: - raise ValueError("Invalid value for `url`, must not be `None`") # noqa: E501 - - self._url = url - - @property - def description(self): - """Gets the description of this WebhookData. # noqa: E501 - - An optional description of what the webhook is used for. # noqa: E501 - - :return: The description of this WebhookData. # noqa: E501 - :rtype: str - """ - return self._description - - @description.setter - def description(self, description): - """Sets the description of this WebhookData. - - An optional description of what the webhook is used for. # noqa: E501 - - :param description: The description of this WebhookData. # noqa: E501 - :type: str - """ - - self._description = description - - @property - def enabled_events(self): - """Gets the enabled_events of this WebhookData. # noqa: E501 - - The list of events to enable for this endpoint. # noqa: E501 - - :return: The enabled_events of this WebhookData. # noqa: E501 - :rtype: list[str] - """ - return self._enabled_events - - @enabled_events.setter - def enabled_events(self, enabled_events): - """Sets the enabled_events of this WebhookData. - - The list of events to enable for this endpoint. # noqa: E501 - - :param enabled_events: The enabled_events of this WebhookData. # noqa: E501 - :type: list[str] - """ - if enabled_events is None: - raise ValueError("Invalid value for `enabled_events`, must not be `None`") # noqa: E501 - allowed_values = ["all", "shipment.purchased", "shipment.cancelled", "shipment.fulfilled", "tracker.created", "tracker.updated"] # noqa: E501 - if not set(enabled_events).issubset(set(allowed_values)): - raise ValueError( - "Invalid values for `enabled_events` [{0}], must be a subset of [{1}]" # noqa: E501 - .format(", ".join(map(str, set(enabled_events) - set(allowed_values))), # noqa: E501 - ", ".join(map(str, allowed_values))) - ) - - self._enabled_events = enabled_events - - @property - def test_mode(self): - """Gets the test_mode of this WebhookData. # noqa: E501 - - Specified whether it was created with a carrier in test mode # noqa: E501 - - :return: The test_mode of this WebhookData. # noqa: E501 - :rtype: bool - """ - return self._test_mode - - @test_mode.setter - def test_mode(self, test_mode): - """Sets the test_mode of this WebhookData. - - Specified whether it was created with a carrier in test mode # noqa: E501 - - :param test_mode: The test_mode of this WebhookData. # noqa: E501 - :type: bool - """ - if test_mode is None: - raise ValueError("Invalid value for `test_mode`, must not be `None`") # noqa: E501 - - self._test_mode = test_mode - - @property - def disabled(self): - """Gets the disabled of this WebhookData. # noqa: E501 - - Indicates that the webhook is disabled # noqa: E501 - - :return: The disabled of this WebhookData. # noqa: E501 - :rtype: bool - """ - return self._disabled - - @disabled.setter - def disabled(self, disabled): - """Sets the disabled of this WebhookData. - - Indicates that the webhook is disabled # noqa: E501 - - :param disabled: The disabled of this WebhookData. # noqa: E501 - :type: bool - """ - - self._disabled = disabled - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(WebhookData, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, WebhookData): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/purplship/models/webhook_list.py b/purplship/models/webhook_list.py deleted file mode 100644 index 80a24d1..0000000 --- a/purplship/models/webhook_list.py +++ /dev/null @@ -1,163 +0,0 @@ -# coding: utf-8 - -""" - Purplship API - - ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.6.2`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 - - OpenAPI spec version: 2021.6.2 - Contact: hello@purplship.com - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - -import pprint -import re # noqa: F401 - -import six - -class WebhookList(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'next': 'str', - 'previous': 'str', - 'results': 'list[Webhook]' - } - - attribute_map = { - 'next': 'next', - 'previous': 'previous', - 'results': 'results' - } - - def __init__(self, next=None, previous=None, results=None): # noqa: E501 - """WebhookList - a model defined in Swagger""" # noqa: E501 - self._next = None - self._previous = None - self._results = None - self.discriminator = None - if next is not None: - self.next = next - if previous is not None: - self.previous = previous - self.results = results - - @property - def next(self): - """Gets the next of this WebhookList. # noqa: E501 - - - :return: The next of this WebhookList. # noqa: E501 - :rtype: str - """ - return self._next - - @next.setter - def next(self, next): - """Sets the next of this WebhookList. - - - :param next: The next of this WebhookList. # noqa: E501 - :type: str - """ - - self._next = next - - @property - def previous(self): - """Gets the previous of this WebhookList. # noqa: E501 - - - :return: The previous of this WebhookList. # noqa: E501 - :rtype: str - """ - return self._previous - - @previous.setter - def previous(self, previous): - """Sets the previous of this WebhookList. - - - :param previous: The previous of this WebhookList. # noqa: E501 - :type: str - """ - - self._previous = previous - - @property - def results(self): - """Gets the results of this WebhookList. # noqa: E501 - - - :return: The results of this WebhookList. # noqa: E501 - :rtype: list[Webhook] - """ - return self._results - - @results.setter - def results(self, results): - """Sets the results of this WebhookList. - - - :param results: The results of this WebhookList. # noqa: E501 - :type: list[Webhook] - """ - if results is None: - raise ValueError("Invalid value for `results`, must not be `None`") # noqa: E501 - - self._results = results - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(WebhookList, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, WebhookList): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/purplship/models/webhook_test_request.py b/purplship/models/webhook_test_request.py deleted file mode 100644 index f11126c..0000000 --- a/purplship/models/webhook_test_request.py +++ /dev/null @@ -1,111 +0,0 @@ -# coding: utf-8 - -""" - Purplship API - - ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.6.2`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 - - OpenAPI spec version: 2021.6.2 - Contact: hello@purplship.com - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - -import pprint -import re # noqa: F401 - -import six - -class WebhookTestRequest(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'payload': 'object' - } - - attribute_map = { - 'payload': 'payload' - } - - def __init__(self, payload=None): # noqa: E501 - """WebhookTestRequest - a model defined in Swagger""" # noqa: E501 - self._payload = None - self.discriminator = None - self.payload = payload - - @property - def payload(self): - """Gets the payload of this WebhookTestRequest. # noqa: E501 - - - :return: The payload of this WebhookTestRequest. # noqa: E501 - :rtype: object - """ - return self._payload - - @payload.setter - def payload(self, payload): - """Sets the payload of this WebhookTestRequest. - - - :param payload: The payload of this WebhookTestRequest. # noqa: E501 - :type: object - """ - if payload is None: - raise ValueError("Invalid value for `payload`, must not be `None`") # noqa: E501 - - self._payload = payload - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(WebhookTestRequest, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, WebhookTestRequest): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/purplship/rest.py b/purplship/rest.py index 32885cd..379b281 100644 --- a/purplship/rest.py +++ b/purplship/rest.py @@ -1,32 +1,24 @@ -# coding: utf-8 - """ Purplship API - ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.6.2`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 + ## API Reference Purplship is an open source multi-carrier shipping API that simplifies the integration of logistic carrier services. The Purplship API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. The Purplship API differs for every account as we release new versions. These docs are customized to your version of the API. ## Versioning When backwards-incompatible changes are made to the API, a new, dated version is released. The current version is `2021.7`. Read our API changelog and to learn more about backwards compatibility. As a precaution, use API versioning to check a new API version before committing to an upgrade. ## Pagination All top-level API resources have support for bulk fetches via \"list\" API methods. For instance, you can list addresses, list shipments, and list trackers. These list API methods share a common structure, taking at least these two parameters: limit, and offset. Purplship utilizes offset-based pagination via the offset and limit parameters. Both parameters take a number as value (see below) and return objects in reverse chronological order. The offset parameter returns objects listed after an index. The limit parameter take a limit on the number of objects to be returned from 1 to 100. ```json { \"next\": \"/v1/shipments?limit=25&offset=25\", \"previous\": \"/v1/shipments?limit=25&offset=25\", \"results\": [ ] } ``` ## Environments The Purplship API offer the possibility to create and retrieve certain objects in `test_mode`. In development, it is therefore possible to add carrier connections, get live rates, buy labels, create trackers and schedule pickups in `test_mode`. # noqa: E501 - OpenAPI spec version: 2021.6.2 + The version of the OpenAPI document: 2021.7 Contact: hello@purplship.com - Generated by: https://github.com/swagger-api/swagger-codegen.git + Generated by: https://openapi-generator.tech """ -from __future__ import absolute_import import io import json import logging import re import ssl +from urllib.parse import urlencode -import certifi -# python 2 and python 3 compatibility library -import six -from six.moves.urllib.parse import urlencode +import urllib3 -try: - import urllib3 -except ImportError: - raise ImportError('Swagger python client requires urllib3.') +from purplship.exceptions import ApiException, UnauthorizedException, ForbiddenException, NotFoundException, ServiceException, ApiValueError logger = logging.getLogger(__name__) @@ -64,17 +56,16 @@ def __init__(self, configuration, pools_size=4, maxsize=None): else: cert_reqs = ssl.CERT_NONE - # ca_certs - if configuration.ssl_ca_cert: - ca_certs = configuration.ssl_ca_cert - else: - # if not set certificate file, use Mozilla's root certificates. - ca_certs = certifi.where() - addition_pool_args = {} if configuration.assert_hostname is not None: addition_pool_args['assert_hostname'] = configuration.assert_hostname # noqa: E501 + if configuration.retries is not None: + addition_pool_args['retries'] = configuration.retries + + if configuration.socket_options is not None: + addition_pool_args['socket_options'] = configuration.socket_options + if maxsize is None: if configuration.connection_pool_maxsize is not None: maxsize = configuration.connection_pool_maxsize @@ -87,10 +78,11 @@ def __init__(self, configuration, pools_size=4, maxsize=None): num_pools=pools_size, maxsize=maxsize, cert_reqs=cert_reqs, - ca_certs=ca_certs, + ca_certs=configuration.ssl_ca_cert, cert_file=configuration.cert_file, key_file=configuration.key_file, proxy_url=configuration.proxy, + proxy_headers=configuration.proxy_headers, **addition_pool_args ) else: @@ -98,7 +90,7 @@ def __init__(self, configuration, pools_size=4, maxsize=None): num_pools=pools_size, maxsize=maxsize, cert_reqs=cert_reqs, - ca_certs=ca_certs, + ca_certs=configuration.ssl_ca_cert, cert_file=configuration.cert_file, key_file=configuration.key_file, **addition_pool_args @@ -130,7 +122,7 @@ def request(self, method, url, query_params=None, headers=None, 'PATCH', 'OPTIONS'] if post_params and body: - raise ValueError( + raise ApiValueError( "body parameter cannot be used with post_params parameter." ) @@ -139,23 +131,23 @@ def request(self, method, url, query_params=None, headers=None, timeout = None if _request_timeout: - if isinstance(_request_timeout, (int, ) if six.PY3 else (int, long)): # noqa: E501,F821 + if isinstance(_request_timeout, (int, float)): # noqa: E501,F821 timeout = urllib3.Timeout(total=_request_timeout) elif (isinstance(_request_timeout, tuple) and len(_request_timeout) == 2): timeout = urllib3.Timeout( connect=_request_timeout[0], read=_request_timeout[1]) - if 'Content-Type' not in headers: - headers['Content-Type'] = 'application/json' - try: # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE` if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']: + # Only set a default Content-Type for POST, PUT, PATCH and OPTIONS requests + if (method != 'DELETE') and ('Content-Type' not in headers): + headers['Content-Type'] = 'application/json' if query_params: url += '?' + urlencode(query_params) - if re.search('json', headers['Content-Type'], re.IGNORECASE): - request_body = '{}' + if ('Content-Type' not in headers) or (re.search('json', headers['Content-Type'], re.IGNORECASE)): + request_body = None if body is not None: request_body = json.dumps(body) r = self.pool_manager.request( @@ -187,7 +179,7 @@ def request(self, method, url, query_params=None, headers=None, # Pass a `string` parameter directly in the body to support # other content types than Json when `body` argument is # provided in serialized form - elif isinstance(body, str): + elif isinstance(body, str) or isinstance(body, bytes): request_body = body r = self.pool_manager.request( method, url, @@ -215,15 +207,22 @@ def request(self, method, url, query_params=None, headers=None, if _preload_content: r = RESTResponse(r) - # In the python 3, the response.data is bytes. - # we need to decode it to string. - if six.PY3: - r.data = r.data.decode('utf8') - # log response body logger.debug("response body: %s", r.data) if not 200 <= r.status <= 299: + if r.status == 401: + raise UnauthorizedException(http_resp=r) + + if r.status == 403: + raise ForbiddenException(http_resp=r) + + if r.status == 404: + raise NotFoundException(http_resp=r) + + if 500 <= r.status <= 599: + raise ServiceException(http_resp=r) + raise ApiException(http_resp=r) return r @@ -292,31 +291,3 @@ def PATCH(self, url, headers=None, query_params=None, post_params=None, _preload_content=_preload_content, _request_timeout=_request_timeout, body=body) - - -class ApiException(Exception): - - def __init__(self, status=None, reason=None, http_resp=None): - if http_resp: - self.status = http_resp.status - self.reason = http_resp.reason - self.body = http_resp.data - self.headers = http_resp.getheaders() - else: - self.status = status - self.reason = reason - self.body = None - self.headers = None - - def __str__(self): - """Custom error messages for exception""" - error_message = "({0})\n"\ - "Reason: {1}\n".format(self.status, self.reason) - if self.headers: - error_message += "HTTP response headers: {0}\n".format( - self.headers) - - if self.body: - error_message += "HTTP response body: {0}\n".format(self.body) - - return error_message diff --git a/scripts.sh b/scripts.sh index 4100d4a..aa431bc 100755 --- a/scripts.sh +++ b/scripts.sh @@ -6,9 +6,6 @@ ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" BASE_DIR="${PWD##*/}" ENV_DIR=".venv" -export EMAIL_HOST="localhost" -export EMAIL_PORT=1025 - deactivate_env() { if command -v deactivate &> /dev/null then diff --git a/setup.py b/setup.py index 00a445f..67f1bb3 100755 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ """ Purplship Open Source Multi-carrier Shipping API - OpenAPI spec version: 2021.6 + OpenAPI spec version: 2021.7 Contact: hello@purplship.com Generated by: https://github.com/swagger-api/swagger-codegen.git """ @@ -15,7 +15,7 @@ long_description = fh.read() NAME = "purplship-python" -VERSION = "2021.6" +VERSION = "2021.7" # To install the library, run the following #