diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 034c667c..011406cb 100755 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -1,12 +1,12 @@ lockVersion: 2.0.0 id: 986026b6-d725-4b86-9c4d-67f6e6904a30 management: - docChecksum: e82796aa3c96b5a7135e06b06d1414b1 + docChecksum: d17362762d19f1f23211a71e568bf249 docVersion: "2018-02-08" - speakeasyVersion: 1.438.1 - generationVersion: 2.457.2 - releaseVersion: 3.8.0 - configChecksum: 0fa4b8a354eb33058718b45cd5d73e32 + speakeasyVersion: 1.441.0 + generationVersion: 2.460.1 + releaseVersion: 3.8.1 + configChecksum: 7caf9a9e8acdea022dbcac299a6b3ab2 repoURL: https://github.com/goshippo/shippo-python-sdk.git installationURL: https://github.com/goshippo/shippo-python-sdk.git published: true @@ -14,7 +14,7 @@ features: python: additionalDependencies: 0.1.0 constsAndDefaults: 0.1.4 - core: 4.8.15 + core: 4.8.16 flattening: 2.81.1 globalSecurity: 2.83.7 globalSecurityCallbacks: 0.1.0 @@ -1196,7 +1196,7 @@ examples: SHIPPO-API-VERSION: "2018-02-08" responses: "200": - application/json: [{"description": "USPS shipping options", "flat_rate": "5", "flat_rate_currency": "USD", "free_shipping_threshold_currency": "USD", "free_shipping_threshold_min": "5", "name": "USPS Shipping", "rate_adjustment": 15, "type": "FLAT_RATE", "object_id": "80feb1633d4a43c898f005850", "is_active": true, "service_levels": [{"name": "Priority Mail Express", "token": "usps_priority_express", "parent_servicelevel": {"name": "Priority Mail Express", "token": "usps_priority_express"}}, {"name": "Priority Mail Express", "token": "usps_priority_express", "parent_servicelevel": {"name": "Priority Mail Express", "token": "usps_priority_express"}}]}, {"description": "USPS shipping options", "flat_rate": "5", "flat_rate_currency": "USD", "free_shipping_threshold_currency": "USD", "free_shipping_threshold_min": "5", "name": "USPS Shipping", "rate_adjustment": 15, "type": "FLAT_RATE", "object_id": "80feb1633d4a43c898f005850", "is_active": true, "service_levels": [{"name": "Priority Mail Express", "token": "usps_priority_express", "parent_servicelevel": {"name": "Priority Mail Express", "token": "usps_priority_express"}}, {"name": "Priority Mail Express", "token": "usps_priority_express", "parent_servicelevel": {"name": "Priority Mail Express", "token": "usps_priority_express"}}]}, {"description": "USPS shipping options", "flat_rate": "5", "flat_rate_currency": "USD", "free_shipping_threshold_currency": "USD", "free_shipping_threshold_min": "5", "name": "USPS Shipping", "rate_adjustment": 15, "type": "FLAT_RATE", "object_id": "80feb1633d4a43c898f005850", "is_active": true, "service_levels": []}] + application/json: [{"description": "USPS shipping options", "flat_rate": "5", "flat_rate_currency": "USD", "free_shipping_threshold_currency": "USD", "free_shipping_threshold_min": "5", "name": "USPS Shipping", "rate_adjustment": 15, "type": "FLAT_RATE", "object_id": "80feb1633d4a43c898f005850", "is_active": true, "service_levels": [{"account_object_id": "80feb1633d4a43c898f0058506cfd82d", "service_level_token": "ups_next_day_air_saver"}, {"account_object_id": "80feb1633d4a43c898f0058506cfd82d", "service_level_token": "ups_next_day_air_saver"}]}, {"description": "USPS shipping options", "flat_rate": "5", "flat_rate_currency": "USD", "free_shipping_threshold_currency": "USD", "free_shipping_threshold_min": "5", "name": "USPS Shipping", "rate_adjustment": 15, "type": "FLAT_RATE", "object_id": "80feb1633d4a43c898f005850", "is_active": true, "service_levels": [{"account_object_id": "80feb1633d4a43c898f0058506cfd82d", "service_level_token": "ups_next_day_air_saver"}, {"account_object_id": "80feb1633d4a43c898f0058506cfd82d", "service_level_token": "ups_next_day_air_saver"}]}, {"description": "USPS shipping options", "flat_rate": "5", "flat_rate_currency": "USD", "free_shipping_threshold_currency": "USD", "free_shipping_threshold_min": "5", "name": "USPS Shipping", "rate_adjustment": 15, "type": "FLAT_RATE", "object_id": "80feb1633d4a43c898f005850", "is_active": true, "service_levels": []}] CreateServiceGroup: speakeasy-default-create-service-group: parameters: @@ -1206,7 +1206,7 @@ examples: application/json: {"description": "USPS shipping options", "flat_rate": "5", "flat_rate_currency": "USD", "free_shipping_threshold_currency": "USD", "free_shipping_threshold_min": "5", "name": "USPS Shipping", "rate_adjustment": 15, "type": "FLAT_RATE", "service_levels": [{"account_object_id": "80feb1633d4a43c898f0058506cfd82d", "service_level_token": "ups_next_day_air_saver"}]} responses: "201": - application/json: {"description": "USPS shipping options", "flat_rate": "5", "flat_rate_currency": "USD", "free_shipping_threshold_currency": "USD", "free_shipping_threshold_min": "5", "name": "USPS Shipping", "rate_adjustment": 15, "type": "FLAT_RATE", "object_id": "80feb1633d4a43c898f005850", "is_active": true, "service_levels": [{"name": "Priority Mail Express", "token": "usps_priority_express", "parent_servicelevel": {"name": "Priority Mail Express", "token": "usps_priority_express"}}, {"name": "Priority Mail Express", "token": "usps_priority_express", "parent_servicelevel": {"name": "Priority Mail Express", "token": "usps_priority_express"}}]} + application/json: {"description": "USPS shipping options", "flat_rate": "5", "flat_rate_currency": "USD", "free_shipping_threshold_currency": "USD", "free_shipping_threshold_min": "5", "name": "USPS Shipping", "rate_adjustment": 15, "type": "FLAT_RATE", "object_id": "80feb1633d4a43c898f005850", "is_active": true, "service_levels": [{"account_object_id": "80feb1633d4a43c898f0058506cfd82d", "service_level_token": "ups_next_day_air_saver"}, {"account_object_id": "80feb1633d4a43c898f0058506cfd82d", "service_level_token": "ups_next_day_air_saver"}]} UpdateServiceGroup: speakeasy-default-update-service-group: parameters: @@ -1216,7 +1216,7 @@ examples: application/json: {"description": "USPS shipping options", "flat_rate": "5", "flat_rate_currency": "USD", "free_shipping_threshold_currency": "USD", "free_shipping_threshold_min": "5", "name": "USPS Shipping", "rate_adjustment": 15, "type": "FLAT_RATE", "object_id": "80feb1633d4a43c898f005850", "is_active": true, "service_levels": [{"account_object_id": "80feb1633d4a43c898f0058506cfd82d", "service_level_token": "ups_next_day_air_saver"}, {"account_object_id": "80feb1633d4a43c898f0058506cfd82d", "service_level_token": "ups_next_day_air_saver"}, {"account_object_id": "80feb1633d4a43c898f0058506cfd82d", "service_level_token": "ups_next_day_air_saver"}]} responses: "200": - application/json: {"description": "USPS shipping options", "flat_rate": "5", "flat_rate_currency": "USD", "free_shipping_threshold_currency": "USD", "free_shipping_threshold_min": "5", "name": "USPS Shipping", "rate_adjustment": 15, "type": "FLAT_RATE", "object_id": "80feb1633d4a43c898f005850", "is_active": true, "service_levels": [{"name": "Priority Mail Express", "token": "usps_priority_express", "parent_servicelevel": {"name": "Priority Mail Express", "token": "usps_priority_express"}}, {"name": "Priority Mail Express", "token": "usps_priority_express", "parent_servicelevel": {"name": "Priority Mail Express", "token": "usps_priority_express"}}]} + application/json: {"description": "USPS shipping options", "flat_rate": "5", "flat_rate_currency": "USD", "free_shipping_threshold_currency": "USD", "free_shipping_threshold_min": "5", "name": "USPS Shipping", "rate_adjustment": 15, "type": "FLAT_RATE", "object_id": "80feb1633d4a43c898f005850", "is_active": true, "service_levels": [{"account_object_id": "80feb1633d4a43c898f0058506cfd82d", "service_level_token": "ups_next_day_air_saver"}, {"account_object_id": "80feb1633d4a43c898f0058506cfd82d", "service_level_token": "ups_next_day_air_saver"}]} DeleteServiceGroup: speakeasy-default-delete-service-group: parameters: diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 9a4bf414..212fa13f 100755 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -13,7 +13,7 @@ generation: oAuth2ClientCredentialsEnabled: true oAuth2PasswordEnabled: false python: - version: 3.8.0 + version: 3.8.1 additionalDependencies: dependencies: {} extraDependencies: diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 0263a879..b0eda0e9 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -1,20 +1,20 @@ -speakeasyVersion: 1.438.1 +speakeasyVersion: 1.441.0 sources: openapi: sourceNamespace: openapi - sourceRevisionDigest: sha256:7a42db54e1c9c9069e5933a3746e166ac6847c306f881e72948cb0dfa1300604 - sourceBlobDigest: sha256:c8aca24ac7d30cd9ae966f86974c94b867610d4cae90d300d41e20d689223ec0 + sourceRevisionDigest: sha256:62de5eafa727cb0f50ccec494bcba6a7b4d6b452c574c107d202dc91b245e955 + sourceBlobDigest: sha256:481f6638b89baad7d8f2c108f74fc028b9999cc9708a00e72688330c720262e7 tags: - latest - - main + - speakeasy-sdk-regen-1731542695 targets: first-target: source: openapi sourceNamespace: openapi - sourceRevisionDigest: sha256:7a42db54e1c9c9069e5933a3746e166ac6847c306f881e72948cb0dfa1300604 - sourceBlobDigest: sha256:c8aca24ac7d30cd9ae966f86974c94b867610d4cae90d300d41e20d689223ec0 + sourceRevisionDigest: sha256:62de5eafa727cb0f50ccec494bcba6a7b4d6b452c574c107d202dc91b245e955 + sourceBlobDigest: sha256:481f6638b89baad7d8f2c108f74fc028b9999cc9708a00e72688330c720262e7 codeSamplesNamespace: openapi-code-samples - codeSamplesRevisionDigest: sha256:1324a247b19690d8b42a1f8e583408f0dfb77b8c4b221a2a0fa38ef18b35bbe2 + codeSamplesRevisionDigest: sha256:d1cce0262c44335b7a5d490a1845a0b65c0ccc79d225d2d55a1b080c4a0db614 workflow: workflowVersion: 1.0.0 speakeasyVersion: latest diff --git a/RELEASES.md b/RELEASES.md index 5501842c..8427bab0 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -378,4 +378,14 @@ Based on: ### Generated - [python v3.8.0] . ### Releases -- [PyPI v3.8.0] https://pypi.org/project/shippo/3.8.0 - . \ No newline at end of file +- [PyPI v3.8.0] https://pypi.org/project/shippo/3.8.0 - . + +## 2024-11-19 13:21:05 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.441.0 (2.460.1) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v3.8.1] . +### Releases +- [PyPI v3.8.1] https://pypi.org/project/shippo/3.8.1 - . \ No newline at end of file diff --git a/docs/models/components/servicegroup.md b/docs/models/components/servicegroup.md index 6dc58c23..167d4c23 100644 --- a/docs/models/components/servicegroup.md +++ b/docs/models/components/servicegroup.md @@ -9,7 +9,7 @@ | `name` | *str* | :heavy_check_mark: | Name for the service group that will be shown to customers in the response | USPS Shipping | | `type` | [components.ServiceGroupTypeEnum](../../models/components/servicegrouptypeenum.md) | :heavy_check_mark: | The type of the service group.

`LIVE_RATE` - Shippo will make a rating request and return real-time rates for the shipping group, only falling back to the specified flat rate amount if no rates match a service level in the service group.

`FLAT_RATE` - Returns a shipping option with the specified flat rate amount.

`FREE_SHIPPING` - Returns a shipping option with a price of $0 only if the total cost of items exceeds the amount defined by `free_shipping_threshold_min` | FLAT_RATE | | `object_id` | *str* | :heavy_check_mark: | The unique identifier of the given Service Group object. | 80feb1633d4a43c898f005850 | -| `service_levels` | List[[components.ServiceLevelWithParent](../../models/components/servicelevelwithparent.md)] | :heavy_check_mark: | N/A | | +| `service_levels` | List[[components.ServiceGroupAccountAndServiceLevel](../../models/components/servicegroupaccountandservicelevel.md)] | :heavy_check_mark: | N/A | | | `flat_rate` | *Optional[str]* | :heavy_minus_sign: | String representation of an amount to be returned as the flat rate
if 1. The service group is of type `LIVE_RATE` and no matching rates
were found; or 2. The service group is of type `FLAT_RATE`. Either
integers or decimals are accepted. Required unless type is
`FREE_SHIPPING` | 5 | | `flat_rate_currency` | *Optional[str]* | :heavy_minus_sign: | required unless type is `FREE_SHIPPING`. (ISO 4217 currency) | USD | | `free_shipping_threshold_currency` | *Optional[str]* | :heavy_minus_sign: | optional unless type is `FREE_SHIPPING`. (ISO 4217 currency) | USD | diff --git a/docs/models/components/servicelevelcanadapostenum.md b/docs/models/components/servicelevelcanadapostenum.md index abcbcfa7..2351d0b8 100644 --- a/docs/models/components/servicelevelcanadapostenum.md +++ b/docs/models/components/servicelevelcanadapostenum.md @@ -13,21 +13,27 @@ | canada_post_small_packet_usa_air | Small Packet USA Air| | canada_post_tracked_packet_international | Tracked Packet International| | canada_post_small_packet_international_air | Small Package International Air| +| canada_post_small_packet_international_surface | Small Packet International Surface +| canada_post_international_parcel_surface | International Parcel Surface +| canada_post_international_parcel_air | International Parcel Air ## Values -| Name | Value | -| -------------------------------------------- | -------------------------------------------- | -| `CANADA_POST_REGULAR_PARCEL` | canada_post_regular_parcel | -| `CANADA_POST_EXPEDITED_PARCEL` | canada_post_expedited_parcel | -| `CANADA_POST_PRIORITY` | canada_post_priority | -| `CANADA_POST_XPRESSPOST` | canada_post_xpresspost | -| `CANADA_POST_XPRESSPOST_INTERNATIONAL` | canada_post_xpresspost_international | -| `CANADA_POST_XPRESSPOST_USA` | canada_post_xpresspost_usa | -| `CANADA_POST_EXPEDITED_PARCEL_USA` | canada_post_expedited_parcel_usa | -| `CANADA_POST_TRACKED_PACKET_USA` | canada_post_tracked_packet_usa | -| `CANADA_POST_SMALL_PACKET_USA_AIR` | canada_post_small_packet_usa_air | -| `CANADA_POST_TRACKED_PACKET_INTERNATIONAL` | canada_post_tracked_packet_international | -| `CANADA_POST_SMALL_PACKET_INTERNATIONAL_AIR` | canada_post_small_packet_international_air | \ No newline at end of file +| Name | Value | +| ------------------------------------------------ | ------------------------------------------------ | +| `CANADA_POST_REGULAR_PARCEL` | canada_post_regular_parcel | +| `CANADA_POST_EXPEDITED_PARCEL` | canada_post_expedited_parcel | +| `CANADA_POST_PRIORITY` | canada_post_priority | +| `CANADA_POST_XPRESSPOST` | canada_post_xpresspost | +| `CANADA_POST_XPRESSPOST_INTERNATIONAL` | canada_post_xpresspost_international | +| `CANADA_POST_XPRESSPOST_USA` | canada_post_xpresspost_usa | +| `CANADA_POST_EXPEDITED_PARCEL_USA` | canada_post_expedited_parcel_usa | +| `CANADA_POST_TRACKED_PACKET_USA` | canada_post_tracked_packet_usa | +| `CANADA_POST_SMALL_PACKET_USA_AIR` | canada_post_small_packet_usa_air | +| `CANADA_POST_TRACKED_PACKET_INTERNATIONAL` | canada_post_tracked_packet_international | +| `CANADA_POST_SMALL_PACKET_INTERNATIONAL_AIR` | canada_post_small_packet_international_air | +| `CANADA_POST_SMALL_PACKET_INTERNATIONAL_SURFACE` | canada_post_small_packet_international_surface | +| `CANADA_POST_INTERNATIONAL_PARCEL_SURFACE` | canada_post_international_parcel_surface | +| `CANADA_POST_INTERNATIONAL_PARCEL_AIR` | canada_post_international_parcel_air | \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 00000000..52318528 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,16 @@ +certifi==2024.8.30 +charset-normalizer==3.4.0 +dataclasses-json==0.6.7 +idna==3.10 +iniconfig==2.0.0 +marshmallow==3.23.1 +mypy-extensions==1.0.0 +packaging==24.2 +pluggy==1.5.0 +pytest==8.3.3 +python-dateutil==2.9.0.post0 +requests==2.32.3 +six==1.16.0 +typing-inspect==0.9.0 +typing_extensions==4.12.2 +urllib3==2.2.3 diff --git a/setup.py b/setup.py index 227cfcd5..360d274a 100644 --- a/setup.py +++ b/setup.py @@ -19,7 +19,7 @@ setuptools.setup( name='shippo', - version='3.8.0', + version='3.8.1', author='Shippo', description='Shipping API Python library (USPS, FedEx, UPS and more)', license = 'MIT License', diff --git a/src/shippo/models/components/servicegroup.py b/src/shippo/models/components/servicegroup.py index 365557eb..1083bf72 100644 --- a/src/shippo/models/components/servicegroup.py +++ b/src/shippo/models/components/servicegroup.py @@ -2,8 +2,8 @@ from __future__ import annotations import dataclasses +from .servicegroupaccountandservicelevel import ServiceGroupAccountAndServiceLevel from .servicegrouptypeenum import ServiceGroupTypeEnum -from .servicelevelwithparent import ServiceLevelWithParent from dataclasses_json import Undefined, dataclass_json from shippo import utils from typing import List, Optional @@ -24,7 +24,7 @@ class ServiceGroup: """ object_id: str = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('object_id') }}) r"""The unique identifier of the given Service Group object.""" - service_levels: List[ServiceLevelWithParent] = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('service_levels') }}) + service_levels: List[ServiceGroupAccountAndServiceLevel] = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('service_levels') }}) flat_rate: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('flat_rate'), 'exclude': lambda f: f is None }}) r"""String representation of an amount to be returned as the flat rate if 1. The service group is of type `LIVE_RATE` and no matching rates diff --git a/src/shippo/models/components/servicelevelcanadapostenum.py b/src/shippo/models/components/servicelevelcanadapostenum.py index fbe9dc68..853ac9ef 100644 --- a/src/shippo/models/components/servicelevelcanadapostenum.py +++ b/src/shippo/models/components/servicelevelcanadapostenum.py @@ -18,6 +18,9 @@ class ServiceLevelCanadaPostEnum(str, Enum): | canada_post_small_packet_usa_air | Small Packet USA Air| | canada_post_tracked_packet_international | Tracked Packet International| | canada_post_small_packet_international_air | Small Package International Air| + | canada_post_small_packet_international_surface | Small Packet International Surface + | canada_post_international_parcel_surface | International Parcel Surface + | canada_post_international_parcel_air | International Parcel Air """ CANADA_POST_REGULAR_PARCEL = 'canada_post_regular_parcel' CANADA_POST_EXPEDITED_PARCEL = 'canada_post_expedited_parcel' @@ -30,3 +33,6 @@ class ServiceLevelCanadaPostEnum(str, Enum): CANADA_POST_SMALL_PACKET_USA_AIR = 'canada_post_small_packet_usa_air' CANADA_POST_TRACKED_PACKET_INTERNATIONAL = 'canada_post_tracked_packet_international' CANADA_POST_SMALL_PACKET_INTERNATIONAL_AIR = 'canada_post_small_packet_international_air' + CANADA_POST_SMALL_PACKET_INTERNATIONAL_SURFACE = 'canada_post_small_packet_international_surface' + CANADA_POST_INTERNATIONAL_PARCEL_SURFACE = 'canada_post_international_parcel_surface' + CANADA_POST_INTERNATIONAL_PARCEL_AIR = 'canada_post_international_parcel_air' diff --git a/src/shippo/sdkconfiguration.py b/src/shippo/sdkconfiguration.py index 21b9304e..74c8e129 100644 --- a/src/shippo/sdkconfiguration.py +++ b/src/shippo/sdkconfiguration.py @@ -24,9 +24,9 @@ class SDKConfiguration: server_idx: Optional[int] = 0 language: str = 'python' openapi_doc_version: str = '2018-02-08' - sdk_version: str = '3.8.0' - gen_version: str = '2.457.2' - user_agent: str = 'speakeasy-sdk/python 3.8.0 2.457.2 2018-02-08 shippo' + sdk_version: str = '3.8.1' + gen_version: str = '2.460.1' + user_agent: str = 'speakeasy-sdk/python 3.8.1 2.460.1 2018-02-08 shippo' retry_config: Optional[RetryConfig] = None def __post_init__(self): diff --git a/tests/test_service_group.py b/tests/test_service_group.py new file mode 100644 index 00000000..d7e2fe9b --- /dev/null +++ b/tests/test_service_group.py @@ -0,0 +1,27 @@ +from shippo.models.components import ServiceGroup, ServiceGroupAccountAndServiceLevel + +import shippo + + +class TestServiceGroups: + + def test_service_groups(self, api: shippo.Shippo): + service_groups = api.service_groups.list() + + assert service_groups is not None + assert isinstance(service_groups, list) + assert len(service_groups) > 0 + + first_service_group = service_groups[0] + assert first_service_group is not None + assert isinstance(first_service_group, ServiceGroup) + assert first_service_group.object_id is not None + assert first_service_group.name is not None + assert first_service_group.description is not None + assert first_service_group.flat_rate_currency == 'USD' + + first_service_level = first_service_group.service_levels[0] + assert first_service_level is not None + assert isinstance(first_service_level, ServiceGroupAccountAndServiceLevel) + assert first_service_level.account_object_id is not None + assert first_service_level.service_level_token is not None