Integrate Deutsche Post shipping API and models
Added Deutsche Post as a shipping carrier, including new models, admin, serializers, and API client integration. Updated Carrier and SiteConfiguration models to support Deutsche Post, including shipping price and API credentials. Added requirements for the Deutsche Post API client and dependencies.
This commit is contained in:
@@ -20,12 +20,18 @@ password_reset_token = PasswordResetTokenGenerator()
|
|||||||
from rest_framework_simplejwt.authentication import JWTAuthentication
|
from rest_framework_simplejwt.authentication import JWTAuthentication
|
||||||
from rest_framework_simplejwt.exceptions import InvalidToken, TokenError
|
from rest_framework_simplejwt.exceptions import InvalidToken, TokenError
|
||||||
|
|
||||||
#NEMĚNIT CUSTOM SBÍRANÍ COOKIE TOKENU
|
#COOKIE + AUTHORIZATION HEADER JWT AUTHENTICATION FOR AXIOS COMPATIBILITY
|
||||||
class CookieJWTAuthentication(JWTAuthentication):
|
class CookieJWTAuthentication(JWTAuthentication):
|
||||||
def authenticate(self, request):
|
def authenticate(self, request):
|
||||||
|
# First try Authorization header (standard axios pattern)
|
||||||
|
header_token = self.get_header(request)
|
||||||
|
if header_token is not None:
|
||||||
|
validated_token = self.get_validated_token(header_token)
|
||||||
|
return self.get_user(validated_token), validated_token
|
||||||
|
|
||||||
|
# Fallback to cookie-based authentication
|
||||||
raw_token = request.COOKIES.get('access_token')
|
raw_token = request.COOKIES.get('access_token')
|
||||||
|
|
||||||
if not raw_token:
|
if not raw_token:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|||||||
@@ -53,7 +53,6 @@ class Product(models.Model):
|
|||||||
"self",
|
"self",
|
||||||
symmetrical=True,
|
symmetrical=True,
|
||||||
blank=True,
|
blank=True,
|
||||||
related_name="variant_of",
|
|
||||||
help_text=(
|
help_text=(
|
||||||
"Symetrické varianty produktu: pokud přidáte variantu A → B, "
|
"Symetrické varianty produktu: pokud přidáte variantu A → B, "
|
||||||
"Django automaticky přidá i variantu B → A. "
|
"Django automaticky přidá i variantu B → A. "
|
||||||
@@ -208,6 +207,7 @@ class Order(models.Model):
|
|||||||
class Carrier(models.Model):
|
class Carrier(models.Model):
|
||||||
class SHIPPING(models.TextChoices):
|
class SHIPPING(models.TextChoices):
|
||||||
ZASILKOVNA = "packeta", "cz#Zásilkovna"
|
ZASILKOVNA = "packeta", "cz#Zásilkovna"
|
||||||
|
DEUTSCHEPOST = "deutschepost", "cz#Deutsche Post"
|
||||||
STORE = "store", "cz#Osobní odběr"
|
STORE = "store", "cz#Osobní odběr"
|
||||||
shipping_method = models.CharField(max_length=20, choices=SHIPPING.choices, default=SHIPPING.STORE)
|
shipping_method = models.CharField(max_length=20, choices=SHIPPING.choices, default=SHIPPING.STORE)
|
||||||
|
|
||||||
@@ -223,6 +223,11 @@ class Carrier(models.Model):
|
|||||||
zasilkovna = models.ManyToManyField(
|
zasilkovna = models.ManyToManyField(
|
||||||
ZasilkovnaPacket, blank=True, related_name="carriers"
|
ZasilkovnaPacket, blank=True, related_name="carriers"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Deutsche Post integration (same pattern as zasilkovna)
|
||||||
|
deutschepost = models.ManyToManyField(
|
||||||
|
"deutschepost.DeutschePostOrder", blank=True, related_name="carriers"
|
||||||
|
)
|
||||||
|
|
||||||
weight = models.DecimalField(max_digits=10, decimal_places=2, null=True, blank=True, help_text="Hmotnost zásilky v kg")
|
weight = models.DecimalField(max_digits=10, decimal_places=2, null=True, blank=True, help_text="Hmotnost zásilky v kg")
|
||||||
|
|
||||||
@@ -241,6 +246,8 @@ class Carrier(models.Model):
|
|||||||
def get_price(self):
|
def get_price(self):
|
||||||
if self.shipping_method == self.SHIPPING.ZASILKOVNA:
|
if self.shipping_method == self.SHIPPING.ZASILKOVNA:
|
||||||
return SiteConfiguration.get_solo().zasilkovna_shipping_price
|
return SiteConfiguration.get_solo().zasilkovna_shipping_price
|
||||||
|
elif self.shipping_method == self.SHIPPING.DEUTSCHEPOST:
|
||||||
|
return SiteConfiguration.get_solo().deutschepost_shipping_price
|
||||||
else:
|
else:
|
||||||
return Decimal('0.0')
|
return Decimal('0.0')
|
||||||
|
|
||||||
@@ -255,6 +262,19 @@ class Carrier(models.Model):
|
|||||||
|
|
||||||
notify_zasilkovna_sended.delay(order=self.orders.first(), user=self.orders.first().user)
|
notify_zasilkovna_sended.delay(order=self.orders.first(), user=self.orders.first().user)
|
||||||
|
|
||||||
|
elif self.shipping_method == self.SHIPPING.DEUTSCHEPOST:
|
||||||
|
# Import here to avoid circular imports
|
||||||
|
from thirdparty.deutschepost.models import DeutschePostOrder
|
||||||
|
|
||||||
|
# Create new Deutsche Post order and add to carrier (same pattern as zasilkovna)
|
||||||
|
dp_order = DeutschePostOrder.objects.create()
|
||||||
|
self.deutschepost.add(dp_order)
|
||||||
|
self.returning = False
|
||||||
|
self.save()
|
||||||
|
|
||||||
|
# Order shipping through Deutsche Post API
|
||||||
|
dp_order.order_shippment()
|
||||||
|
|
||||||
elif self.shipping_method == self.SHIPPING.STORE:
|
elif self.shipping_method == self.SHIPPING.STORE:
|
||||||
self.state = self.STATE.READY_TO_PICKUP
|
self.state = self.STATE.READY_TO_PICKUP
|
||||||
self.save()
|
self.save()
|
||||||
|
|||||||
@@ -29,6 +29,13 @@ class SiteConfiguration(models.Model):
|
|||||||
#FIXME: není implementováno ↓↓↓
|
#FIXME: není implementováno ↓↓↓
|
||||||
free_shipping_over = models.DecimalField(max_digits=10, decimal_places=2, default=2000)
|
free_shipping_over = models.DecimalField(max_digits=10, decimal_places=2, default=2000)
|
||||||
|
|
||||||
|
# Deutsche Post settings
|
||||||
|
deutschepost_api_url = models.URLField(max_length=255, default="https://gw.sandbox.deutschepost.com", help_text="Deutsche Post API URL (sandbox/production)")
|
||||||
|
deutschepost_client_id = models.CharField(max_length=255, blank=True, null=True, help_text="Deutsche Post OAuth Client ID")
|
||||||
|
deutschepost_client_secret = models.CharField(max_length=255, blank=True, null=True, help_text="Deutsche Post OAuth Client Secret")
|
||||||
|
deutschepost_customer_ekp = models.CharField(max_length=20, blank=True, null=True, help_text="Deutsche Post Customer EKP number")
|
||||||
|
deutschepost_shipping_price = models.DecimalField(max_digits=10, decimal_places=2, default=150, help_text="Default Deutsche Post shipping price")
|
||||||
|
|
||||||
#coupon settings
|
#coupon settings
|
||||||
multiplying_coupons = models.BooleanField(default=True, help_text="Násobení kupónů v objednávce (ano/ne), pokud ne tak se použije pouze nejvyšší slevový kupón")
|
multiplying_coupons = models.BooleanField(default=True, help_text="Násobení kupónů v objednávce (ano/ne), pokud ne tak se použije pouze nejvyšší slevový kupón")
|
||||||
addition_of_coupons_amount = models.BooleanField(default=False, help_text="Sčítání slevových kupónů v objednávce (ano/ne), pokud ne tak se použije pouze nejvyšší slevový kupón")
|
addition_of_coupons_amount = models.BooleanField(default=False, help_text="Sčítání slevových kupónů v objednávce (ano/ne), pokud ne tak se použije pouze nejvyšší slevový kupón")
|
||||||
|
|||||||
@@ -45,6 +45,12 @@ daphne
|
|||||||
|
|
||||||
gunicorn
|
gunicorn
|
||||||
|
|
||||||
|
# -- THIRD PARTY APIS --
|
||||||
|
# Deutsche Post International Shipping API client (local package)
|
||||||
|
httpx>=0.23.0,<0.29.0 # Required by Deutsche Post client
|
||||||
|
attrs>=22.2.0 # Required by Deutsche Post client
|
||||||
|
python-dateutil>=2.8.0 # Required by Deutsche Post client
|
||||||
|
|
||||||
# -- REST API --
|
# -- REST API --
|
||||||
djangorestframework #REST Framework
|
djangorestframework #REST Framework
|
||||||
|
|
||||||
@@ -90,6 +96,12 @@ faker #generates fake data for testing purposes
|
|||||||
|
|
||||||
zeep #SOAP tool
|
zeep #SOAP tool
|
||||||
|
|
||||||
## -- api --
|
|
||||||
|
|
||||||
|
## -- API --
|
||||||
|
|
||||||
|
#generates api (if schema exists (ONLY USE OPENAPI NO SWAGGER))
|
||||||
|
openapi-python-client
|
||||||
|
|
||||||
stripe
|
stripe
|
||||||
gopay
|
gopay
|
||||||
0
backend/thirdparty/deutschepost/__init__.py
vendored
Normal file
0
backend/thirdparty/deutschepost/__init__.py
vendored
Normal file
183
backend/thirdparty/deutschepost/admin.py
vendored
Normal file
183
backend/thirdparty/deutschepost/admin.py
vendored
Normal file
@@ -0,0 +1,183 @@
|
|||||||
|
from django.contrib import admin
|
||||||
|
|
||||||
|
from django.contrib import admin
|
||||||
|
from django.utils.html import format_html
|
||||||
|
from django.urls import reverse
|
||||||
|
from django.http import HttpResponseRedirect
|
||||||
|
from django.contrib import messages
|
||||||
|
|
||||||
|
from .models import DeutschePostOrder, DeutschePostBulkOrder
|
||||||
|
|
||||||
|
|
||||||
|
@admin.register(DeutschePostOrder)
|
||||||
|
class DeutschePostOrderAdmin(admin.ModelAdmin):
|
||||||
|
list_display = [
|
||||||
|
'id', 'order_id', 'recipient_name', 'state', 'commerce_order_link',
|
||||||
|
'awb_number', 'created_at'
|
||||||
|
]
|
||||||
|
list_filter = ['state', 'product_type', 'service_level', 'destination_country', 'created_at']
|
||||||
|
search_fields = ['order_id', 'recipient_name', 'recipient_email', 'awb_number', 'barcode']
|
||||||
|
readonly_fields = [
|
||||||
|
'order_id', 'awb_number', 'barcode', 'tracking_url',
|
||||||
|
'metadata', 'last_error', 'created_at'
|
||||||
|
]
|
||||||
|
|
||||||
|
fieldsets = (
|
||||||
|
('Basic Information', {
|
||||||
|
'fields': ('state', 'commerce_order', 'order_id', 'customer_ekp')
|
||||||
|
}),
|
||||||
|
('Recipient Information', {
|
||||||
|
'fields': (
|
||||||
|
'recipient_name', 'recipient_phone', 'recipient_email',
|
||||||
|
'address_line1', 'address_line2', 'address_line3',
|
||||||
|
'city', 'address_state', 'postal_code', 'destination_country'
|
||||||
|
)
|
||||||
|
}),
|
||||||
|
('Shipment Details', {
|
||||||
|
'fields': (
|
||||||
|
'product_type', 'service_level', 'shipment_gross_weight',
|
||||||
|
'shipment_amount', 'shipment_currency',
|
||||||
|
'sender_tax_id', 'importer_tax_id', 'return_item_wanted',
|
||||||
|
'cust_ref'
|
||||||
|
)
|
||||||
|
}),
|
||||||
|
('Tracking Information', {
|
||||||
|
'fields': ('awb_number', 'barcode', 'tracking_url'),
|
||||||
|
'classes': ['collapse']
|
||||||
|
}),
|
||||||
|
('API Data', {
|
||||||
|
'fields': ('metadata', 'last_error', 'created_at'),
|
||||||
|
'classes': ['collapse']
|
||||||
|
})
|
||||||
|
)
|
||||||
|
|
||||||
|
actions = ['create_remote_order', 'finalize_remote_order', 'refresh_tracking']
|
||||||
|
|
||||||
|
def commerce_order_link(self, obj):
|
||||||
|
"""Link to related commerce order."""
|
||||||
|
if obj.commerce_order:
|
||||||
|
url = reverse('admin:commerce_order_change', args=[obj.commerce_order.pk])
|
||||||
|
return format_html('<a href="{}">{}</a>', url, obj.commerce_order)
|
||||||
|
return '-'
|
||||||
|
commerce_order_link.short_description = 'Commerce Order'
|
||||||
|
|
||||||
|
def create_remote_order(self, request, queryset):
|
||||||
|
"""Admin action to create orders remotely."""
|
||||||
|
created_count = 0
|
||||||
|
error_count = 0
|
||||||
|
|
||||||
|
for order in queryset:
|
||||||
|
try:
|
||||||
|
if not order.order_id:
|
||||||
|
order.create_remote_order()
|
||||||
|
created_count += 1
|
||||||
|
else:
|
||||||
|
error_count += 1
|
||||||
|
except Exception as e:
|
||||||
|
messages.error(request, f'Error creating order {order.id}: {str(e)}')
|
||||||
|
error_count += 1
|
||||||
|
|
||||||
|
if created_count:
|
||||||
|
messages.success(request, f'{created_count} orders created remotely')
|
||||||
|
if error_count:
|
||||||
|
messages.warning(request, f'{error_count} orders could not be created')
|
||||||
|
|
||||||
|
create_remote_order.short_description = 'Create selected orders remotely'
|
||||||
|
|
||||||
|
def finalize_remote_order(self, request, queryset):
|
||||||
|
"""Admin action to finalize orders remotely."""
|
||||||
|
finalized_count = 0
|
||||||
|
error_count = 0
|
||||||
|
|
||||||
|
for order in queryset:
|
||||||
|
try:
|
||||||
|
if order.order_id and order.state != DeutschePostOrder.STATE.FINALIZED:
|
||||||
|
order.finalize_remote_order()
|
||||||
|
finalized_count += 1
|
||||||
|
else:
|
||||||
|
error_count += 1
|
||||||
|
except Exception as e:
|
||||||
|
messages.error(request, f'Error finalizing order {order.id}: {str(e)}')
|
||||||
|
error_count += 1
|
||||||
|
|
||||||
|
if finalized_count:
|
||||||
|
messages.success(request, f'{finalized_count} orders finalized')
|
||||||
|
if error_count:
|
||||||
|
messages.warning(request, f'{error_count} orders could not be finalized')
|
||||||
|
|
||||||
|
finalize_remote_order.short_description = 'Finalize selected orders'
|
||||||
|
|
||||||
|
def refresh_tracking(self, request, queryset):
|
||||||
|
"""Admin action to refresh tracking information."""
|
||||||
|
updated_count = 0
|
||||||
|
error_count = 0
|
||||||
|
|
||||||
|
for order in queryset:
|
||||||
|
try:
|
||||||
|
if order.order_id:
|
||||||
|
order.refresh_tracking()
|
||||||
|
updated_count += 1
|
||||||
|
else:
|
||||||
|
error_count += 1
|
||||||
|
except Exception as e:
|
||||||
|
messages.error(request, f'Error refreshing tracking for order {order.id}: {str(e)}')
|
||||||
|
error_count += 1
|
||||||
|
|
||||||
|
if updated_count:
|
||||||
|
messages.success(request, f'{updated_count} orders tracking updated')
|
||||||
|
if error_count:
|
||||||
|
messages.warning(request, f'{error_count} orders could not be updated')
|
||||||
|
|
||||||
|
refresh_tracking.short_description = 'Refresh tracking for selected orders'
|
||||||
|
|
||||||
|
|
||||||
|
@admin.register(DeutschePostBulkOrder)
|
||||||
|
class DeutschePostBulkOrderAdmin(admin.ModelAdmin):
|
||||||
|
list_display = ['id', 'bulk_order_id', 'status', 'orders_count', 'created_at']
|
||||||
|
list_filter = ['status', 'bulk_order_type', 'created_at']
|
||||||
|
search_fields = ['bulk_order_id', 'description']
|
||||||
|
readonly_fields = ['bulk_order_id', 'orders_count', 'metadata', 'last_error', 'created_at']
|
||||||
|
|
||||||
|
fieldsets = (
|
||||||
|
('Basic Information', {
|
||||||
|
'fields': ('status', 'bulk_order_id', 'bulk_order_type', 'description')
|
||||||
|
}),
|
||||||
|
('Orders', {
|
||||||
|
'fields': ('deutschepost_orders', 'orders_count')
|
||||||
|
}),
|
||||||
|
('API Data', {
|
||||||
|
'fields': ('metadata', 'last_error', 'created_at'),
|
||||||
|
'classes': ['collapse']
|
||||||
|
})
|
||||||
|
)
|
||||||
|
|
||||||
|
filter_horizontal = ['deutschepost_orders']
|
||||||
|
actions = ['create_remote_bulk_order']
|
||||||
|
|
||||||
|
def orders_count(self, obj):
|
||||||
|
"""Count of orders in this bulk order."""
|
||||||
|
return obj.deutschepost_orders.count()
|
||||||
|
orders_count.short_description = 'Orders Count'
|
||||||
|
|
||||||
|
def create_remote_bulk_order(self, request, queryset):
|
||||||
|
"""Admin action to create bulk orders remotely."""
|
||||||
|
created_count = 0
|
||||||
|
error_count = 0
|
||||||
|
|
||||||
|
for bulk_order in queryset:
|
||||||
|
try:
|
||||||
|
if not bulk_order.bulk_order_id:
|
||||||
|
bulk_order.create_remote_bulk_order()
|
||||||
|
created_count += 1
|
||||||
|
else:
|
||||||
|
error_count += 1
|
||||||
|
except Exception as e:
|
||||||
|
messages.error(request, f'Error creating bulk order {bulk_order.id}: {str(e)}')
|
||||||
|
error_count += 1
|
||||||
|
|
||||||
|
if created_count:
|
||||||
|
messages.success(request, f'{created_count} bulk orders created remotely')
|
||||||
|
if error_count:
|
||||||
|
messages.warning(request, f'{error_count} bulk orders could not be created')
|
||||||
|
|
||||||
|
create_remote_bulk_order.short_description = 'Create selected bulk orders remotely'
|
||||||
6
backend/thirdparty/deutschepost/apps.py
vendored
Normal file
6
backend/thirdparty/deutschepost/apps.py
vendored
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
from django.apps import AppConfig
|
||||||
|
|
||||||
|
|
||||||
|
class DeutschepostConfig(AppConfig):
|
||||||
|
default_auto_field = 'django.db.models.BigAutoField'
|
||||||
|
name = 'thirdparty.deutschepost'
|
||||||
23
backend/thirdparty/deutschepost/client/.gitignore
vendored
Normal file
23
backend/thirdparty/deutschepost/client/.gitignore
vendored
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
__pycache__/
|
||||||
|
build/
|
||||||
|
dist/
|
||||||
|
*.egg-info/
|
||||||
|
.pytest_cache/
|
||||||
|
|
||||||
|
# pyenv
|
||||||
|
.python-version
|
||||||
|
|
||||||
|
# Environments
|
||||||
|
.env
|
||||||
|
.venv
|
||||||
|
|
||||||
|
# mypy
|
||||||
|
.mypy_cache/
|
||||||
|
.dmypy.json
|
||||||
|
dmypy.json
|
||||||
|
|
||||||
|
# JetBrains
|
||||||
|
.idea/
|
||||||
|
|
||||||
|
/coverage.xml
|
||||||
|
/.coverage
|
||||||
124
backend/thirdparty/deutschepost/client/README.md
vendored
Normal file
124
backend/thirdparty/deutschepost/client/README.md
vendored
Normal file
@@ -0,0 +1,124 @@
|
|||||||
|
# deutsche-post-international-shipping-api-client
|
||||||
|
A client library for accessing Deutsche Post International Shipping API
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
First, create a client:
|
||||||
|
|
||||||
|
```python
|
||||||
|
from deutsche_post_international_shipping_api_client import Client
|
||||||
|
|
||||||
|
client = Client(base_url="https://api.example.com")
|
||||||
|
```
|
||||||
|
|
||||||
|
If the endpoints you're going to hit require authentication, use `AuthenticatedClient` instead:
|
||||||
|
|
||||||
|
```python
|
||||||
|
from deutsche_post_international_shipping_api_client import AuthenticatedClient
|
||||||
|
|
||||||
|
client = AuthenticatedClient(base_url="https://api.example.com", token="SuperSecretToken")
|
||||||
|
```
|
||||||
|
|
||||||
|
Now call your endpoint and use your models:
|
||||||
|
|
||||||
|
```python
|
||||||
|
from deutsche_post_international_shipping_api_client.models import MyDataModel
|
||||||
|
from deutsche_post_international_shipping_api_client.api.my_tag import get_my_data_model
|
||||||
|
from deutsche_post_international_shipping_api_client.types import Response
|
||||||
|
|
||||||
|
with client as client:
|
||||||
|
my_data: MyDataModel = get_my_data_model.sync(client=client)
|
||||||
|
# or if you need more info (e.g. status_code)
|
||||||
|
response: Response[MyDataModel] = get_my_data_model.sync_detailed(client=client)
|
||||||
|
```
|
||||||
|
|
||||||
|
Or do the same thing with an async version:
|
||||||
|
|
||||||
|
```python
|
||||||
|
from deutsche_post_international_shipping_api_client.models import MyDataModel
|
||||||
|
from deutsche_post_international_shipping_api_client.api.my_tag import get_my_data_model
|
||||||
|
from deutsche_post_international_shipping_api_client.types import Response
|
||||||
|
|
||||||
|
async with client as client:
|
||||||
|
my_data: MyDataModel = await get_my_data_model.asyncio(client=client)
|
||||||
|
response: Response[MyDataModel] = await get_my_data_model.asyncio_detailed(client=client)
|
||||||
|
```
|
||||||
|
|
||||||
|
By default, when you're calling an HTTPS API it will attempt to verify that SSL is working correctly. Using certificate verification is highly recommended most of the time, but sometimes you may need to authenticate to a server (especially an internal server) using a custom certificate bundle.
|
||||||
|
|
||||||
|
```python
|
||||||
|
client = AuthenticatedClient(
|
||||||
|
base_url="https://internal_api.example.com",
|
||||||
|
token="SuperSecretToken",
|
||||||
|
verify_ssl="/path/to/certificate_bundle.pem",
|
||||||
|
)
|
||||||
|
```
|
||||||
|
|
||||||
|
You can also disable certificate validation altogether, but beware that **this is a security risk**.
|
||||||
|
|
||||||
|
```python
|
||||||
|
client = AuthenticatedClient(
|
||||||
|
base_url="https://internal_api.example.com",
|
||||||
|
token="SuperSecretToken",
|
||||||
|
verify_ssl=False
|
||||||
|
)
|
||||||
|
```
|
||||||
|
|
||||||
|
Things to know:
|
||||||
|
1. Every path/method combo becomes a Python module with four functions:
|
||||||
|
1. `sync`: Blocking request that returns parsed data (if successful) or `None`
|
||||||
|
1. `sync_detailed`: Blocking request that always returns a `Request`, optionally with `parsed` set if the request was successful.
|
||||||
|
1. `asyncio`: Like `sync` but async instead of blocking
|
||||||
|
1. `asyncio_detailed`: Like `sync_detailed` but async instead of blocking
|
||||||
|
|
||||||
|
1. All path/query params, and bodies become method arguments.
|
||||||
|
1. If your endpoint had any tags on it, the first tag will be used as a module name for the function (my_tag above)
|
||||||
|
1. Any endpoint which did not have a tag will be in `deutsche_post_international_shipping_api_client.api.default`
|
||||||
|
|
||||||
|
## Advanced customizations
|
||||||
|
|
||||||
|
There are more settings on the generated `Client` class which let you control more runtime behavior, check out the docstring on that class for more info. You can also customize the underlying `httpx.Client` or `httpx.AsyncClient` (depending on your use-case):
|
||||||
|
|
||||||
|
```python
|
||||||
|
from deutsche_post_international_shipping_api_client import Client
|
||||||
|
|
||||||
|
def log_request(request):
|
||||||
|
print(f"Request event hook: {request.method} {request.url} - Waiting for response")
|
||||||
|
|
||||||
|
def log_response(response):
|
||||||
|
request = response.request
|
||||||
|
print(f"Response event hook: {request.method} {request.url} - Status {response.status_code}")
|
||||||
|
|
||||||
|
client = Client(
|
||||||
|
base_url="https://api.example.com",
|
||||||
|
httpx_args={"event_hooks": {"request": [log_request], "response": [log_response]}},
|
||||||
|
)
|
||||||
|
|
||||||
|
# Or get the underlying httpx client to modify directly with client.get_httpx_client() or client.get_async_httpx_client()
|
||||||
|
```
|
||||||
|
|
||||||
|
You can even set the httpx client directly, but beware that this will override any existing settings (e.g., base_url):
|
||||||
|
|
||||||
|
```python
|
||||||
|
import httpx
|
||||||
|
from deutsche_post_international_shipping_api_client import Client
|
||||||
|
|
||||||
|
client = Client(
|
||||||
|
base_url="https://api.example.com",
|
||||||
|
)
|
||||||
|
# Note that base_url needs to be re-set, as would any shared cookies, headers, etc.
|
||||||
|
client.set_httpx_client(httpx.Client(base_url="https://api.example.com", proxies="http://localhost:8030"))
|
||||||
|
```
|
||||||
|
|
||||||
|
## Building / publishing this package
|
||||||
|
This project uses [Poetry](https://python-poetry.org/) to manage dependencies and packaging. Here are the basics:
|
||||||
|
1. Update the metadata in pyproject.toml (e.g. authors, version)
|
||||||
|
1. If you're using a private repository, configure it with Poetry
|
||||||
|
1. `poetry config repositories.<your-repository-name> <url-to-your-repository>`
|
||||||
|
1. `poetry config http-basic.<your-repository-name> <username> <password>`
|
||||||
|
1. Publish the client with `poetry publish --build -r <your-repository-name>` or, if for public PyPI, just `poetry publish --build`
|
||||||
|
|
||||||
|
If you want to install this client into another project without publishing it (e.g. for development) then:
|
||||||
|
1. If that project **is using Poetry**, you can simply do `poetry add <path-to-this-client>` from that project
|
||||||
|
1. If that project is not using Poetry:
|
||||||
|
1. Build a wheel with `poetry build -f wheel`
|
||||||
|
1. Install that wheel from the other project `pip install <path-to-wheel>`
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
"""A client library for accessing Deutsche Post International Shipping API"""
|
||||||
|
|
||||||
|
from .client import AuthenticatedClient, Client
|
||||||
|
|
||||||
|
__all__ = (
|
||||||
|
"AuthenticatedClient",
|
||||||
|
"Client",
|
||||||
|
)
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
"""Contains methods for accessing the API"""
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
"""Contains endpoint functions for accessing the API"""
|
||||||
@@ -0,0 +1,369 @@
|
|||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ... import errors
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...models.get_access_token_response import GetAccessTokenResponse
|
||||||
|
from ...types import Response
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
*,
|
||||||
|
authorization: str,
|
||||||
|
accept: str,
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
headers: dict[str, Any] = {}
|
||||||
|
headers["Authorization"] = authorization
|
||||||
|
|
||||||
|
headers["Accept"] = accept
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "get",
|
||||||
|
"url": "/dpi/v1/auth/accesstoken",
|
||||||
|
}
|
||||||
|
|
||||||
|
_kwargs["headers"] = headers
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> GetAccessTokenResponse | None:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = GetAccessTokenResponse.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_200
|
||||||
|
|
||||||
|
if client.raise_on_unexpected_status:
|
||||||
|
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def _build_response(
|
||||||
|
*, client: AuthenticatedClient | Client, response: httpx.Response
|
||||||
|
) -> Response[GetAccessTokenResponse]:
|
||||||
|
return Response(
|
||||||
|
status_code=HTTPStatus(response.status_code),
|
||||||
|
content=response.content,
|
||||||
|
headers=response.headers,
|
||||||
|
parsed=_parse_response(client=client, response=response),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def sync_detailed(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
authorization: str,
|
||||||
|
accept: str,
|
||||||
|
) -> Response[GetAccessTokenResponse]:
|
||||||
|
r"""Get Access New Token
|
||||||
|
|
||||||
|
|
||||||
|
The Get access_token API call provides OAuth 2.0 Bearer token, assigned to your Consumer_key and
|
||||||
|
Consumer_secret, which will grants you an access to the Deutsche Post International Shipping
|
||||||
|
APIs.<br/><br/> If you already received credentials for the old gateway these remain valid until
|
||||||
|
further notice.<br/><br/> The API operation is secured by HTTP Basic authentication, therefore you
|
||||||
|
have to provide `Consumer_key` and `Consumer_secret` as an username and password, when calling the
|
||||||
|
API..<br/><br/> **Example:**
|
||||||
|
1. You will receive `Consumer_key` and `Consumer_secret` from Deutsche Post International
|
||||||
|
representative in following format.<br/>
|
||||||
|
Credentials below are exemplary and can _NOT_ be used in this Sandbox environment to get the
|
||||||
|
access_token.
|
||||||
|
|
||||||
|
````
|
||||||
|
Consumer_key: 5qsFCFLzeoz4C6PKJ7yH3NDQHgBEJLt7
|
||||||
|
Consumer_secret: P6mEGGaAZ2TdkLpD
|
||||||
|
````
|
||||||
|
|
||||||
|
2. When passing the `Consumer_key` and `Consumer_secret` via HTTPS request, using HTTP Basic
|
||||||
|
authentication, you have to
|
||||||
|
populate HTTP Header Authorization in following format.
|
||||||
|
> **Note:** *`Consumer_key` and `Consumer_secret` has to be encoded in base64-encoding. There is
|
||||||
|
a `space` characeter between Basic and the base64-encoded string. There is a `:` character between
|
||||||
|
the Consumer_key and Consumer_secret, when encoded in base64-encoding.*
|
||||||
|
|
||||||
|
````
|
||||||
|
Authorization: Basic base64-encoded(Consumer_key:Consumer_secret)
|
||||||
|
Authorization: Basic NXFzRkNGTHplb3o0QzZQS0o3eUgzTkRRSGdCRUpMdDc6UDZtRUdHYUFaMlRka0xwRA==
|
||||||
|
````
|
||||||
|
|
||||||
|
> **Note:** *You can test the Get access_token API directly from the documentation page. The
|
||||||
|
Authorization HTTP Header was populated for you in the Console View on the right side of the
|
||||||
|
screen.*
|
||||||
|
|
||||||
|
3. You will receive following response in the JSON format.
|
||||||
|
|
||||||
|
````
|
||||||
|
{
|
||||||
|
\"access_token\": \"8CyAkmSppbfG5KAQ4AinTZ8RVJnD\",
|
||||||
|
\"token_type\": \"Bearer\",
|
||||||
|
\"expires_in\": 17999
|
||||||
|
}
|
||||||
|
````
|
||||||
|
|
||||||
|
Understanding of the response fields:
|
||||||
|
`access_token:` Contains access_token string for the Shipping / Tracking API authentication and
|
||||||
|
authorization.<br/><br/>
|
||||||
|
`token_type:` Type of the OAuth 2.0 access_token. Default value is \"Bearer\".<br/><br/>
|
||||||
|
`expires_in:` Time to live of the access_token. Default value is 18000 seconds / 5 hours. After this
|
||||||
|
time the token expires. <br/><br/>
|
||||||
|
|
||||||
|
Args:
|
||||||
|
authorization (str):
|
||||||
|
accept (str):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[GetAccessTokenResponse]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
authorization=authorization,
|
||||||
|
accept=accept,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
def sync(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
authorization: str,
|
||||||
|
accept: str,
|
||||||
|
) -> GetAccessTokenResponse | None:
|
||||||
|
r"""Get Access New Token
|
||||||
|
|
||||||
|
|
||||||
|
The Get access_token API call provides OAuth 2.0 Bearer token, assigned to your Consumer_key and
|
||||||
|
Consumer_secret, which will grants you an access to the Deutsche Post International Shipping
|
||||||
|
APIs.<br/><br/> If you already received credentials for the old gateway these remain valid until
|
||||||
|
further notice.<br/><br/> The API operation is secured by HTTP Basic authentication, therefore you
|
||||||
|
have to provide `Consumer_key` and `Consumer_secret` as an username and password, when calling the
|
||||||
|
API..<br/><br/> **Example:**
|
||||||
|
1. You will receive `Consumer_key` and `Consumer_secret` from Deutsche Post International
|
||||||
|
representative in following format.<br/>
|
||||||
|
Credentials below are exemplary and can _NOT_ be used in this Sandbox environment to get the
|
||||||
|
access_token.
|
||||||
|
|
||||||
|
````
|
||||||
|
Consumer_key: 5qsFCFLzeoz4C6PKJ7yH3NDQHgBEJLt7
|
||||||
|
Consumer_secret: P6mEGGaAZ2TdkLpD
|
||||||
|
````
|
||||||
|
|
||||||
|
2. When passing the `Consumer_key` and `Consumer_secret` via HTTPS request, using HTTP Basic
|
||||||
|
authentication, you have to
|
||||||
|
populate HTTP Header Authorization in following format.
|
||||||
|
> **Note:** *`Consumer_key` and `Consumer_secret` has to be encoded in base64-encoding. There is
|
||||||
|
a `space` characeter between Basic and the base64-encoded string. There is a `:` character between
|
||||||
|
the Consumer_key and Consumer_secret, when encoded in base64-encoding.*
|
||||||
|
|
||||||
|
````
|
||||||
|
Authorization: Basic base64-encoded(Consumer_key:Consumer_secret)
|
||||||
|
Authorization: Basic NXFzRkNGTHplb3o0QzZQS0o3eUgzTkRRSGdCRUpMdDc6UDZtRUdHYUFaMlRka0xwRA==
|
||||||
|
````
|
||||||
|
|
||||||
|
> **Note:** *You can test the Get access_token API directly from the documentation page. The
|
||||||
|
Authorization HTTP Header was populated for you in the Console View on the right side of the
|
||||||
|
screen.*
|
||||||
|
|
||||||
|
3. You will receive following response in the JSON format.
|
||||||
|
|
||||||
|
````
|
||||||
|
{
|
||||||
|
\"access_token\": \"8CyAkmSppbfG5KAQ4AinTZ8RVJnD\",
|
||||||
|
\"token_type\": \"Bearer\",
|
||||||
|
\"expires_in\": 17999
|
||||||
|
}
|
||||||
|
````
|
||||||
|
|
||||||
|
Understanding of the response fields:
|
||||||
|
`access_token:` Contains access_token string for the Shipping / Tracking API authentication and
|
||||||
|
authorization.<br/><br/>
|
||||||
|
`token_type:` Type of the OAuth 2.0 access_token. Default value is \"Bearer\".<br/><br/>
|
||||||
|
`expires_in:` Time to live of the access_token. Default value is 18000 seconds / 5 hours. After this
|
||||||
|
time the token expires. <br/><br/>
|
||||||
|
|
||||||
|
Args:
|
||||||
|
authorization (str):
|
||||||
|
accept (str):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
GetAccessTokenResponse
|
||||||
|
"""
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
client=client,
|
||||||
|
authorization=authorization,
|
||||||
|
accept=accept,
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
authorization: str,
|
||||||
|
accept: str,
|
||||||
|
) -> Response[GetAccessTokenResponse]:
|
||||||
|
r"""Get Access New Token
|
||||||
|
|
||||||
|
|
||||||
|
The Get access_token API call provides OAuth 2.0 Bearer token, assigned to your Consumer_key and
|
||||||
|
Consumer_secret, which will grants you an access to the Deutsche Post International Shipping
|
||||||
|
APIs.<br/><br/> If you already received credentials for the old gateway these remain valid until
|
||||||
|
further notice.<br/><br/> The API operation is secured by HTTP Basic authentication, therefore you
|
||||||
|
have to provide `Consumer_key` and `Consumer_secret` as an username and password, when calling the
|
||||||
|
API..<br/><br/> **Example:**
|
||||||
|
1. You will receive `Consumer_key` and `Consumer_secret` from Deutsche Post International
|
||||||
|
representative in following format.<br/>
|
||||||
|
Credentials below are exemplary and can _NOT_ be used in this Sandbox environment to get the
|
||||||
|
access_token.
|
||||||
|
|
||||||
|
````
|
||||||
|
Consumer_key: 5qsFCFLzeoz4C6PKJ7yH3NDQHgBEJLt7
|
||||||
|
Consumer_secret: P6mEGGaAZ2TdkLpD
|
||||||
|
````
|
||||||
|
|
||||||
|
2. When passing the `Consumer_key` and `Consumer_secret` via HTTPS request, using HTTP Basic
|
||||||
|
authentication, you have to
|
||||||
|
populate HTTP Header Authorization in following format.
|
||||||
|
> **Note:** *`Consumer_key` and `Consumer_secret` has to be encoded in base64-encoding. There is
|
||||||
|
a `space` characeter between Basic and the base64-encoded string. There is a `:` character between
|
||||||
|
the Consumer_key and Consumer_secret, when encoded in base64-encoding.*
|
||||||
|
|
||||||
|
````
|
||||||
|
Authorization: Basic base64-encoded(Consumer_key:Consumer_secret)
|
||||||
|
Authorization: Basic NXFzRkNGTHplb3o0QzZQS0o3eUgzTkRRSGdCRUpMdDc6UDZtRUdHYUFaMlRka0xwRA==
|
||||||
|
````
|
||||||
|
|
||||||
|
> **Note:** *You can test the Get access_token API directly from the documentation page. The
|
||||||
|
Authorization HTTP Header was populated for you in the Console View on the right side of the
|
||||||
|
screen.*
|
||||||
|
|
||||||
|
3. You will receive following response in the JSON format.
|
||||||
|
|
||||||
|
````
|
||||||
|
{
|
||||||
|
\"access_token\": \"8CyAkmSppbfG5KAQ4AinTZ8RVJnD\",
|
||||||
|
\"token_type\": \"Bearer\",
|
||||||
|
\"expires_in\": 17999
|
||||||
|
}
|
||||||
|
````
|
||||||
|
|
||||||
|
Understanding of the response fields:
|
||||||
|
`access_token:` Contains access_token string for the Shipping / Tracking API authentication and
|
||||||
|
authorization.<br/><br/>
|
||||||
|
`token_type:` Type of the OAuth 2.0 access_token. Default value is \"Bearer\".<br/><br/>
|
||||||
|
`expires_in:` Time to live of the access_token. Default value is 18000 seconds / 5 hours. After this
|
||||||
|
time the token expires. <br/><br/>
|
||||||
|
|
||||||
|
Args:
|
||||||
|
authorization (str):
|
||||||
|
accept (str):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[GetAccessTokenResponse]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
authorization=authorization,
|
||||||
|
accept=accept,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = await client.get_async_httpx_client().request(**kwargs)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
authorization: str,
|
||||||
|
accept: str,
|
||||||
|
) -> GetAccessTokenResponse | None:
|
||||||
|
r"""Get Access New Token
|
||||||
|
|
||||||
|
|
||||||
|
The Get access_token API call provides OAuth 2.0 Bearer token, assigned to your Consumer_key and
|
||||||
|
Consumer_secret, which will grants you an access to the Deutsche Post International Shipping
|
||||||
|
APIs.<br/><br/> If you already received credentials for the old gateway these remain valid until
|
||||||
|
further notice.<br/><br/> The API operation is secured by HTTP Basic authentication, therefore you
|
||||||
|
have to provide `Consumer_key` and `Consumer_secret` as an username and password, when calling the
|
||||||
|
API..<br/><br/> **Example:**
|
||||||
|
1. You will receive `Consumer_key` and `Consumer_secret` from Deutsche Post International
|
||||||
|
representative in following format.<br/>
|
||||||
|
Credentials below are exemplary and can _NOT_ be used in this Sandbox environment to get the
|
||||||
|
access_token.
|
||||||
|
|
||||||
|
````
|
||||||
|
Consumer_key: 5qsFCFLzeoz4C6PKJ7yH3NDQHgBEJLt7
|
||||||
|
Consumer_secret: P6mEGGaAZ2TdkLpD
|
||||||
|
````
|
||||||
|
|
||||||
|
2. When passing the `Consumer_key` and `Consumer_secret` via HTTPS request, using HTTP Basic
|
||||||
|
authentication, you have to
|
||||||
|
populate HTTP Header Authorization in following format.
|
||||||
|
> **Note:** *`Consumer_key` and `Consumer_secret` has to be encoded in base64-encoding. There is
|
||||||
|
a `space` characeter between Basic and the base64-encoded string. There is a `:` character between
|
||||||
|
the Consumer_key and Consumer_secret, when encoded in base64-encoding.*
|
||||||
|
|
||||||
|
````
|
||||||
|
Authorization: Basic base64-encoded(Consumer_key:Consumer_secret)
|
||||||
|
Authorization: Basic NXFzRkNGTHplb3o0QzZQS0o3eUgzTkRRSGdCRUpMdDc6UDZtRUdHYUFaMlRka0xwRA==
|
||||||
|
````
|
||||||
|
|
||||||
|
> **Note:** *You can test the Get access_token API directly from the documentation page. The
|
||||||
|
Authorization HTTP Header was populated for you in the Console View on the right side of the
|
||||||
|
screen.*
|
||||||
|
|
||||||
|
3. You will receive following response in the JSON format.
|
||||||
|
|
||||||
|
````
|
||||||
|
{
|
||||||
|
\"access_token\": \"8CyAkmSppbfG5KAQ4AinTZ8RVJnD\",
|
||||||
|
\"token_type\": \"Bearer\",
|
||||||
|
\"expires_in\": 17999
|
||||||
|
}
|
||||||
|
````
|
||||||
|
|
||||||
|
Understanding of the response fields:
|
||||||
|
`access_token:` Contains access_token string for the Shipping / Tracking API authentication and
|
||||||
|
authorization.<br/><br/>
|
||||||
|
`token_type:` Type of the OAuth 2.0 access_token. Default value is \"Bearer\".<br/><br/>
|
||||||
|
`expires_in:` Time to live of the access_token. Default value is 18000 seconds / 5 hours. After this
|
||||||
|
time the token expires. <br/><br/>
|
||||||
|
|
||||||
|
Args:
|
||||||
|
authorization (str):
|
||||||
|
accept (str):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
GetAccessTokenResponse
|
||||||
|
"""
|
||||||
|
|
||||||
|
return (
|
||||||
|
await asyncio_detailed(
|
||||||
|
client=client,
|
||||||
|
authorization=authorization,
|
||||||
|
accept=accept,
|
||||||
|
)
|
||||||
|
).parsed
|
||||||
@@ -0,0 +1,173 @@
|
|||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ... import errors
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...models.get_access_token_info_401_response import GetAccessTokenInfo401Response
|
||||||
|
from ...models.get_access_token_info_response import GetAccessTokenInfoResponse
|
||||||
|
from ...types import UNSET, Response, Unset
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
*,
|
||||||
|
token: str | Unset = UNSET,
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
params: dict[str, Any] = {}
|
||||||
|
|
||||||
|
params["token"] = token
|
||||||
|
|
||||||
|
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "get",
|
||||||
|
"url": "/dpi/v1/auth/accesstoken/info",
|
||||||
|
"params": params,
|
||||||
|
}
|
||||||
|
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(
|
||||||
|
*, client: AuthenticatedClient | Client, response: httpx.Response
|
||||||
|
) -> GetAccessTokenInfo401Response | GetAccessTokenInfoResponse | None:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = GetAccessTokenInfoResponse.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_200
|
||||||
|
|
||||||
|
if response.status_code == 401:
|
||||||
|
response_401 = GetAccessTokenInfo401Response.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_401
|
||||||
|
|
||||||
|
if client.raise_on_unexpected_status:
|
||||||
|
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def _build_response(
|
||||||
|
*, client: AuthenticatedClient | Client, response: httpx.Response
|
||||||
|
) -> Response[GetAccessTokenInfo401Response | GetAccessTokenInfoResponse]:
|
||||||
|
return Response(
|
||||||
|
status_code=HTTPStatus(response.status_code),
|
||||||
|
content=response.content,
|
||||||
|
headers=response.headers,
|
||||||
|
parsed=_parse_response(client=client, response=response),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def sync_detailed(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
token: str | Unset = UNSET,
|
||||||
|
) -> Response[GetAccessTokenInfo401Response | GetAccessTokenInfoResponse]:
|
||||||
|
"""Get Access Token Info
|
||||||
|
|
||||||
|
The Get access_token Info API call provides an information about the issued token.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
token (str | Unset):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[GetAccessTokenInfo401Response | GetAccessTokenInfoResponse]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
token=token,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
def sync(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
token: str | Unset = UNSET,
|
||||||
|
) -> GetAccessTokenInfo401Response | GetAccessTokenInfoResponse | None:
|
||||||
|
"""Get Access Token Info
|
||||||
|
|
||||||
|
The Get access_token Info API call provides an information about the issued token.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
token (str | Unset):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
GetAccessTokenInfo401Response | GetAccessTokenInfoResponse
|
||||||
|
"""
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
client=client,
|
||||||
|
token=token,
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
token: str | Unset = UNSET,
|
||||||
|
) -> Response[GetAccessTokenInfo401Response | GetAccessTokenInfoResponse]:
|
||||||
|
"""Get Access Token Info
|
||||||
|
|
||||||
|
The Get access_token Info API call provides an information about the issued token.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
token (str | Unset):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[GetAccessTokenInfo401Response | GetAccessTokenInfoResponse]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
token=token,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = await client.get_async_httpx_client().request(**kwargs)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
token: str | Unset = UNSET,
|
||||||
|
) -> GetAccessTokenInfo401Response | GetAccessTokenInfoResponse | None:
|
||||||
|
"""Get Access Token Info
|
||||||
|
|
||||||
|
The Get access_token Info API call provides an information about the issued token.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
token (str | Unset):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
GetAccessTokenInfo401Response | GetAccessTokenInfoResponse
|
||||||
|
"""
|
||||||
|
|
||||||
|
return (
|
||||||
|
await asyncio_detailed(
|
||||||
|
client=client,
|
||||||
|
token=token,
|
||||||
|
)
|
||||||
|
).parsed
|
||||||
@@ -0,0 +1,171 @@
|
|||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ... import errors
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...models.revoke_access_token_response import RevokeAccessTokenResponse
|
||||||
|
from ...types import UNSET, Response, Unset
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
*,
|
||||||
|
token: str | Unset = UNSET,
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
params: dict[str, Any] = {}
|
||||||
|
|
||||||
|
params["token"] = token
|
||||||
|
|
||||||
|
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "get",
|
||||||
|
"url": "/dpi/v1/auth/accesstoken/revoke",
|
||||||
|
"params": params,
|
||||||
|
}
|
||||||
|
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(
|
||||||
|
*, client: AuthenticatedClient | Client, response: httpx.Response
|
||||||
|
) -> RevokeAccessTokenResponse | None:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = RevokeAccessTokenResponse.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_200
|
||||||
|
|
||||||
|
if client.raise_on_unexpected_status:
|
||||||
|
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def _build_response(
|
||||||
|
*, client: AuthenticatedClient | Client, response: httpx.Response
|
||||||
|
) -> Response[RevokeAccessTokenResponse]:
|
||||||
|
return Response(
|
||||||
|
status_code=HTTPStatus(response.status_code),
|
||||||
|
content=response.content,
|
||||||
|
headers=response.headers,
|
||||||
|
parsed=_parse_response(client=client, response=response),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def sync_detailed(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
token: str | Unset = UNSET,
|
||||||
|
) -> Response[RevokeAccessTokenResponse]:
|
||||||
|
"""Revoke Access Token
|
||||||
|
|
||||||
|
The Revoke access_token API call provides you an option to revoke your access_token, which not yet
|
||||||
|
expired.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
token (str | Unset):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[RevokeAccessTokenResponse]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
token=token,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
def sync(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
token: str | Unset = UNSET,
|
||||||
|
) -> RevokeAccessTokenResponse | None:
|
||||||
|
"""Revoke Access Token
|
||||||
|
|
||||||
|
The Revoke access_token API call provides you an option to revoke your access_token, which not yet
|
||||||
|
expired.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
token (str | Unset):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
RevokeAccessTokenResponse
|
||||||
|
"""
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
client=client,
|
||||||
|
token=token,
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
token: str | Unset = UNSET,
|
||||||
|
) -> Response[RevokeAccessTokenResponse]:
|
||||||
|
"""Revoke Access Token
|
||||||
|
|
||||||
|
The Revoke access_token API call provides you an option to revoke your access_token, which not yet
|
||||||
|
expired.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
token (str | Unset):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[RevokeAccessTokenResponse]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
token=token,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = await client.get_async_httpx_client().request(**kwargs)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
token: str | Unset = UNSET,
|
||||||
|
) -> RevokeAccessTokenResponse | None:
|
||||||
|
"""Revoke Access Token
|
||||||
|
|
||||||
|
The Revoke access_token API call provides you an option to revoke your access_token, which not yet
|
||||||
|
expired.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
token (str | Unset):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
RevokeAccessTokenResponse
|
||||||
|
"""
|
||||||
|
|
||||||
|
return (
|
||||||
|
await asyncio_detailed(
|
||||||
|
client=client,
|
||||||
|
token=token,
|
||||||
|
)
|
||||||
|
).parsed
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
"""Contains endpoint functions for accessing the API"""
|
||||||
@@ -0,0 +1,214 @@
|
|||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ... import errors
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...models.awb import Awb
|
||||||
|
from ...models.cws_error_dto import CwsErrorDTO
|
||||||
|
from ...types import Response
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
*,
|
||||||
|
body: Awb,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
headers: dict[str, Any] = {}
|
||||||
|
headers["Authorization"] = authorization
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "post",
|
||||||
|
"url": "/dpi/shipping/v1/awbs",
|
||||||
|
}
|
||||||
|
|
||||||
|
_kwargs["json"] = body.to_dict()
|
||||||
|
|
||||||
|
headers["Content-Type"] = "application/json"
|
||||||
|
|
||||||
|
_kwargs["headers"] = headers
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Awb | CwsErrorDTO | None:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = Awb.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_200
|
||||||
|
|
||||||
|
if response.status_code == 403:
|
||||||
|
response_403 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_403
|
||||||
|
|
||||||
|
if response.status_code == 404:
|
||||||
|
response_404 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_404
|
||||||
|
|
||||||
|
if response.status_code == 422:
|
||||||
|
response_422 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_422
|
||||||
|
|
||||||
|
if response.status_code == 500:
|
||||||
|
response_500 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_500
|
||||||
|
|
||||||
|
if client.raise_on_unexpected_status:
|
||||||
|
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Awb | CwsErrorDTO]:
|
||||||
|
return Response(
|
||||||
|
status_code=HTTPStatus(response.status_code),
|
||||||
|
content=response.content,
|
||||||
|
headers=response.headers,
|
||||||
|
parsed=_parse_response(client=client, response=response),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def sync_detailed(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
body: Awb,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
) -> Response[Awb | CwsErrorDTO]:
|
||||||
|
"""Create a Single AWB
|
||||||
|
|
||||||
|
Creates a new single awb based on the given data. This request will be decommissioned. Please use
|
||||||
|
/dpi/v1/bulk/{customerEkp}/mixedorders instead.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
body (Awb): Example: {'customerEkp': '9012345678', 'contactName': 'Max Mustermann',
|
||||||
|
'awbCopyCount': 3, 'product': 'GMP', 'serviceLevel': 'PRIORITY', 'itemFormat': 'P',
|
||||||
|
'jobReference': 'Job ref', 'totalWeight': 5, 'telephoneNumber': '+4935120681234'}.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[Awb | CwsErrorDTO]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
body=body,
|
||||||
|
authorization=authorization,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
def sync(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
body: Awb,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
) -> Awb | CwsErrorDTO | None:
|
||||||
|
"""Create a Single AWB
|
||||||
|
|
||||||
|
Creates a new single awb based on the given data. This request will be decommissioned. Please use
|
||||||
|
/dpi/v1/bulk/{customerEkp}/mixedorders instead.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
body (Awb): Example: {'customerEkp': '9012345678', 'contactName': 'Max Mustermann',
|
||||||
|
'awbCopyCount': 3, 'product': 'GMP', 'serviceLevel': 'PRIORITY', 'itemFormat': 'P',
|
||||||
|
'jobReference': 'Job ref', 'totalWeight': 5, 'telephoneNumber': '+4935120681234'}.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Awb | CwsErrorDTO
|
||||||
|
"""
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
client=client,
|
||||||
|
body=body,
|
||||||
|
authorization=authorization,
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
body: Awb,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
) -> Response[Awb | CwsErrorDTO]:
|
||||||
|
"""Create a Single AWB
|
||||||
|
|
||||||
|
Creates a new single awb based on the given data. This request will be decommissioned. Please use
|
||||||
|
/dpi/v1/bulk/{customerEkp}/mixedorders instead.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
body (Awb): Example: {'customerEkp': '9012345678', 'contactName': 'Max Mustermann',
|
||||||
|
'awbCopyCount': 3, 'product': 'GMP', 'serviceLevel': 'PRIORITY', 'itemFormat': 'P',
|
||||||
|
'jobReference': 'Job ref', 'totalWeight': 5, 'telephoneNumber': '+4935120681234'}.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[Awb | CwsErrorDTO]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
body=body,
|
||||||
|
authorization=authorization,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = await client.get_async_httpx_client().request(**kwargs)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
body: Awb,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
) -> Awb | CwsErrorDTO | None:
|
||||||
|
"""Create a Single AWB
|
||||||
|
|
||||||
|
Creates a new single awb based on the given data. This request will be decommissioned. Please use
|
||||||
|
/dpi/v1/bulk/{customerEkp}/mixedorders instead.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
body (Awb): Example: {'customerEkp': '9012345678', 'contactName': 'Max Mustermann',
|
||||||
|
'awbCopyCount': 3, 'product': 'GMP', 'serviceLevel': 'PRIORITY', 'itemFormat': 'P',
|
||||||
|
'jobReference': 'Job ref', 'totalWeight': 5, 'telephoneNumber': '+4935120681234'}.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Awb | CwsErrorDTO
|
||||||
|
"""
|
||||||
|
|
||||||
|
return (
|
||||||
|
await asyncio_detailed(
|
||||||
|
client=client,
|
||||||
|
body=body,
|
||||||
|
authorization=authorization,
|
||||||
|
)
|
||||||
|
).parsed
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
"""Contains endpoint functions for accessing the API"""
|
||||||
@@ -0,0 +1,220 @@
|
|||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any
|
||||||
|
from urllib.parse import quote
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ... import errors
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...models.bag_order import BagOrder
|
||||||
|
from ...models.cws_error_dto import CwsErrorDTO
|
||||||
|
from ...types import Response
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
customer_ekp: int,
|
||||||
|
*,
|
||||||
|
body: BagOrder,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
headers: dict[str, Any] = {}
|
||||||
|
headers["Authorization"] = authorization
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "post",
|
||||||
|
"url": "/dpi/shipping/v1/bulk/{customer_ekp}/orders".format(
|
||||||
|
customer_ekp=quote(str(customer_ekp), safe=""),
|
||||||
|
),
|
||||||
|
}
|
||||||
|
|
||||||
|
_kwargs["json"] = body.to_dict()
|
||||||
|
|
||||||
|
headers["Content-Type"] = "application/json"
|
||||||
|
|
||||||
|
_kwargs["headers"] = headers
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> BagOrder | CwsErrorDTO | None:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = BagOrder.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_200
|
||||||
|
|
||||||
|
if response.status_code == 403:
|
||||||
|
response_403 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_403
|
||||||
|
|
||||||
|
if response.status_code == 404:
|
||||||
|
response_404 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_404
|
||||||
|
|
||||||
|
if response.status_code == 422:
|
||||||
|
response_422 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_422
|
||||||
|
|
||||||
|
if response.status_code == 500:
|
||||||
|
response_500 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_500
|
||||||
|
|
||||||
|
if client.raise_on_unexpected_status:
|
||||||
|
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def _build_response(
|
||||||
|
*, client: AuthenticatedClient | Client, response: httpx.Response
|
||||||
|
) -> Response[BagOrder | CwsErrorDTO]:
|
||||||
|
return Response(
|
||||||
|
status_code=HTTPStatus(response.status_code),
|
||||||
|
content=response.content,
|
||||||
|
headers=response.headers,
|
||||||
|
parsed=_parse_response(client=client, response=response),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def sync_detailed(
|
||||||
|
customer_ekp: int,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
body: BagOrder,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
) -> Response[BagOrder | CwsErrorDTO]:
|
||||||
|
"""Create a Bulk Order
|
||||||
|
|
||||||
|
Creates a new bulk order based on the given data
|
||||||
|
|
||||||
|
Args:
|
||||||
|
customer_ekp (int):
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
body (BagOrder):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[BagOrder | CwsErrorDTO]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
customer_ekp=customer_ekp,
|
||||||
|
body=body,
|
||||||
|
authorization=authorization,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
def sync(
|
||||||
|
customer_ekp: int,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
body: BagOrder,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
) -> BagOrder | CwsErrorDTO | None:
|
||||||
|
"""Create a Bulk Order
|
||||||
|
|
||||||
|
Creates a new bulk order based on the given data
|
||||||
|
|
||||||
|
Args:
|
||||||
|
customer_ekp (int):
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
body (BagOrder):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
BagOrder | CwsErrorDTO
|
||||||
|
"""
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
customer_ekp=customer_ekp,
|
||||||
|
client=client,
|
||||||
|
body=body,
|
||||||
|
authorization=authorization,
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
customer_ekp: int,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
body: BagOrder,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
) -> Response[BagOrder | CwsErrorDTO]:
|
||||||
|
"""Create a Bulk Order
|
||||||
|
|
||||||
|
Creates a new bulk order based on the given data
|
||||||
|
|
||||||
|
Args:
|
||||||
|
customer_ekp (int):
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
body (BagOrder):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[BagOrder | CwsErrorDTO]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
customer_ekp=customer_ekp,
|
||||||
|
body=body,
|
||||||
|
authorization=authorization,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = await client.get_async_httpx_client().request(**kwargs)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio(
|
||||||
|
customer_ekp: int,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
body: BagOrder,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
) -> BagOrder | CwsErrorDTO | None:
|
||||||
|
"""Create a Bulk Order
|
||||||
|
|
||||||
|
Creates a new bulk order based on the given data
|
||||||
|
|
||||||
|
Args:
|
||||||
|
customer_ekp (int):
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
body (BagOrder):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
BagOrder | CwsErrorDTO
|
||||||
|
"""
|
||||||
|
|
||||||
|
return (
|
||||||
|
await asyncio_detailed(
|
||||||
|
customer_ekp=customer_ekp,
|
||||||
|
client=client,
|
||||||
|
body=body,
|
||||||
|
authorization=authorization,
|
||||||
|
)
|
||||||
|
).parsed
|
||||||
@@ -0,0 +1,223 @@
|
|||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any
|
||||||
|
from urllib.parse import quote
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ... import errors
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...models.bulk_order_dto import BulkOrderDto
|
||||||
|
from ...models.cws_error_dto import CwsErrorDTO
|
||||||
|
from ...models.mixed_bag_order_dto import MixedBagOrderDTO
|
||||||
|
from ...types import Response
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
customer_ekp: str,
|
||||||
|
*,
|
||||||
|
body: MixedBagOrderDTO,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
headers: dict[str, Any] = {}
|
||||||
|
headers["Authorization"] = authorization
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "post",
|
||||||
|
"url": "/dpi/shipping/v1/bulk/{customer_ekp}/mixedorders".format(
|
||||||
|
customer_ekp=quote(str(customer_ekp), safe=""),
|
||||||
|
),
|
||||||
|
}
|
||||||
|
|
||||||
|
_kwargs["json"] = body.to_dict()
|
||||||
|
|
||||||
|
headers["Content-Type"] = "application/json"
|
||||||
|
|
||||||
|
_kwargs["headers"] = headers
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(
|
||||||
|
*, client: AuthenticatedClient | Client, response: httpx.Response
|
||||||
|
) -> BulkOrderDto | CwsErrorDTO | None:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = BulkOrderDto.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_200
|
||||||
|
|
||||||
|
if response.status_code == 403:
|
||||||
|
response_403 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_403
|
||||||
|
|
||||||
|
if response.status_code == 404:
|
||||||
|
response_404 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_404
|
||||||
|
|
||||||
|
if response.status_code == 422:
|
||||||
|
response_422 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_422
|
||||||
|
|
||||||
|
if response.status_code == 500:
|
||||||
|
response_500 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_500
|
||||||
|
|
||||||
|
if client.raise_on_unexpected_status:
|
||||||
|
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def _build_response(
|
||||||
|
*, client: AuthenticatedClient | Client, response: httpx.Response
|
||||||
|
) -> Response[BulkOrderDto | CwsErrorDTO]:
|
||||||
|
return Response(
|
||||||
|
status_code=HTTPStatus(response.status_code),
|
||||||
|
content=response.content,
|
||||||
|
headers=response.headers,
|
||||||
|
parsed=_parse_response(client=client, response=response),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def sync_detailed(
|
||||||
|
customer_ekp: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
body: MixedBagOrderDTO,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
) -> Response[BulkOrderDto | CwsErrorDTO]:
|
||||||
|
"""Create a Mixed Order
|
||||||
|
|
||||||
|
Creates a new mixed order based on the given data.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
customer_ekp (str):
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
body (MixedBagOrderDTO):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[BulkOrderDto | CwsErrorDTO]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
customer_ekp=customer_ekp,
|
||||||
|
body=body,
|
||||||
|
authorization=authorization,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
def sync(
|
||||||
|
customer_ekp: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
body: MixedBagOrderDTO,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
) -> BulkOrderDto | CwsErrorDTO | None:
|
||||||
|
"""Create a Mixed Order
|
||||||
|
|
||||||
|
Creates a new mixed order based on the given data.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
customer_ekp (str):
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
body (MixedBagOrderDTO):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
BulkOrderDto | CwsErrorDTO
|
||||||
|
"""
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
customer_ekp=customer_ekp,
|
||||||
|
client=client,
|
||||||
|
body=body,
|
||||||
|
authorization=authorization,
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
customer_ekp: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
body: MixedBagOrderDTO,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
) -> Response[BulkOrderDto | CwsErrorDTO]:
|
||||||
|
"""Create a Mixed Order
|
||||||
|
|
||||||
|
Creates a new mixed order based on the given data.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
customer_ekp (str):
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
body (MixedBagOrderDTO):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[BulkOrderDto | CwsErrorDTO]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
customer_ekp=customer_ekp,
|
||||||
|
body=body,
|
||||||
|
authorization=authorization,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = await client.get_async_httpx_client().request(**kwargs)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio(
|
||||||
|
customer_ekp: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
body: MixedBagOrderDTO,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
) -> BulkOrderDto | CwsErrorDTO | None:
|
||||||
|
"""Create a Mixed Order
|
||||||
|
|
||||||
|
Creates a new mixed order based on the given data.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
customer_ekp (str):
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
body (MixedBagOrderDTO):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
BulkOrderDto | CwsErrorDTO
|
||||||
|
"""
|
||||||
|
|
||||||
|
return (
|
||||||
|
await asyncio_detailed(
|
||||||
|
customer_ekp=customer_ekp,
|
||||||
|
client=client,
|
||||||
|
body=body,
|
||||||
|
authorization=authorization,
|
||||||
|
)
|
||||||
|
).parsed
|
||||||
@@ -0,0 +1,210 @@
|
|||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any
|
||||||
|
from urllib.parse import quote
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ... import errors
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...models.cws_error_dto import CwsErrorDTO
|
||||||
|
from ...models.order import Order
|
||||||
|
from ...types import Response
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
customer_ekp: str,
|
||||||
|
order_id: str,
|
||||||
|
*,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
headers: dict[str, Any] = {}
|
||||||
|
headers["Authorization"] = authorization
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "get",
|
||||||
|
"url": "/dpi/shipping/v1/bulk/{customer_ekp}/orders/{order_id}/paperwork".format(
|
||||||
|
customer_ekp=quote(str(customer_ekp), safe=""),
|
||||||
|
order_id=quote(str(order_id), safe=""),
|
||||||
|
),
|
||||||
|
}
|
||||||
|
|
||||||
|
_kwargs["headers"] = headers
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> CwsErrorDTO | Order | None:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = Order.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_200
|
||||||
|
|
||||||
|
if response.status_code == 403:
|
||||||
|
response_403 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_403
|
||||||
|
|
||||||
|
if response.status_code == 404:
|
||||||
|
response_404 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_404
|
||||||
|
|
||||||
|
if response.status_code == 500:
|
||||||
|
response_500 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_500
|
||||||
|
|
||||||
|
if client.raise_on_unexpected_status:
|
||||||
|
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[CwsErrorDTO | Order]:
|
||||||
|
return Response(
|
||||||
|
status_code=HTTPStatus(response.status_code),
|
||||||
|
content=response.content,
|
||||||
|
headers=response.headers,
|
||||||
|
parsed=_parse_response(client=client, response=response),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def sync_detailed(
|
||||||
|
customer_ekp: str,
|
||||||
|
order_id: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
) -> Response[CwsErrorDTO | Order]:
|
||||||
|
"""Get Bulk Paperwork
|
||||||
|
|
||||||
|
Gets the paperwork in zip format for the given orderId.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
customer_ekp (str):
|
||||||
|
order_id (str):
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[CwsErrorDTO | Order]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
customer_ekp=customer_ekp,
|
||||||
|
order_id=order_id,
|
||||||
|
authorization=authorization,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
def sync(
|
||||||
|
customer_ekp: str,
|
||||||
|
order_id: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
) -> CwsErrorDTO | Order | None:
|
||||||
|
"""Get Bulk Paperwork
|
||||||
|
|
||||||
|
Gets the paperwork in zip format for the given orderId.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
customer_ekp (str):
|
||||||
|
order_id (str):
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
CwsErrorDTO | Order
|
||||||
|
"""
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
customer_ekp=customer_ekp,
|
||||||
|
order_id=order_id,
|
||||||
|
client=client,
|
||||||
|
authorization=authorization,
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
customer_ekp: str,
|
||||||
|
order_id: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
) -> Response[CwsErrorDTO | Order]:
|
||||||
|
"""Get Bulk Paperwork
|
||||||
|
|
||||||
|
Gets the paperwork in zip format for the given orderId.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
customer_ekp (str):
|
||||||
|
order_id (str):
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[CwsErrorDTO | Order]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
customer_ekp=customer_ekp,
|
||||||
|
order_id=order_id,
|
||||||
|
authorization=authorization,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = await client.get_async_httpx_client().request(**kwargs)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio(
|
||||||
|
customer_ekp: str,
|
||||||
|
order_id: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
) -> CwsErrorDTO | Order | None:
|
||||||
|
"""Get Bulk Paperwork
|
||||||
|
|
||||||
|
Gets the paperwork in zip format for the given orderId.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
customer_ekp (str):
|
||||||
|
order_id (str):
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
CwsErrorDTO | Order
|
||||||
|
"""
|
||||||
|
|
||||||
|
return (
|
||||||
|
await asyncio_detailed(
|
||||||
|
customer_ekp=customer_ekp,
|
||||||
|
order_id=order_id,
|
||||||
|
client=client,
|
||||||
|
authorization=authorization,
|
||||||
|
)
|
||||||
|
).parsed
|
||||||
@@ -0,0 +1,216 @@
|
|||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any, cast
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ... import errors
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...models.cws_error_dto import CwsErrorDTO
|
||||||
|
from ...models.get_bag_tag_label_accept import GetBagTagLabelAccept
|
||||||
|
from ...types import UNSET, Response
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
*,
|
||||||
|
bag_ids: list[str],
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
accept: GetBagTagLabelAccept,
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
headers: dict[str, Any] = {}
|
||||||
|
headers["Authorization"] = authorization
|
||||||
|
|
||||||
|
headers["accept"] = str(accept)
|
||||||
|
|
||||||
|
params: dict[str, Any] = {}
|
||||||
|
|
||||||
|
json_bag_ids = bag_ids
|
||||||
|
|
||||||
|
params["bagIds"] = json_bag_ids
|
||||||
|
|
||||||
|
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "get",
|
||||||
|
"url": "/dpi/shipping/v1/bulk/label",
|
||||||
|
"params": params,
|
||||||
|
}
|
||||||
|
|
||||||
|
_kwargs["headers"] = headers
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | CwsErrorDTO | None:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = cast(Any, None)
|
||||||
|
return response_200
|
||||||
|
|
||||||
|
if response.status_code == 403:
|
||||||
|
response_403 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_403
|
||||||
|
|
||||||
|
if response.status_code == 404:
|
||||||
|
response_404 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_404
|
||||||
|
|
||||||
|
if response.status_code == 500:
|
||||||
|
response_500 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_500
|
||||||
|
|
||||||
|
if client.raise_on_unexpected_status:
|
||||||
|
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any | CwsErrorDTO]:
|
||||||
|
return Response(
|
||||||
|
status_code=HTTPStatus(response.status_code),
|
||||||
|
content=response.content,
|
||||||
|
headers=response.headers,
|
||||||
|
parsed=_parse_response(client=client, response=response),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def sync_detailed(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
bag_ids: list[str],
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
accept: GetBagTagLabelAccept,
|
||||||
|
) -> Response[Any | CwsErrorDTO]:
|
||||||
|
"""Get Bag Tag Label
|
||||||
|
|
||||||
|
For a given bag get the label of the bag tag, sentt as a bytestream response.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
bag_ids (list[str]):
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
accept (GetBagTagLabelAccept):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[Any | CwsErrorDTO]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
bag_ids=bag_ids,
|
||||||
|
authorization=authorization,
|
||||||
|
accept=accept,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
def sync(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
bag_ids: list[str],
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
accept: GetBagTagLabelAccept,
|
||||||
|
) -> Any | CwsErrorDTO | None:
|
||||||
|
"""Get Bag Tag Label
|
||||||
|
|
||||||
|
For a given bag get the label of the bag tag, sentt as a bytestream response.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
bag_ids (list[str]):
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
accept (GetBagTagLabelAccept):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Any | CwsErrorDTO
|
||||||
|
"""
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
client=client,
|
||||||
|
bag_ids=bag_ids,
|
||||||
|
authorization=authorization,
|
||||||
|
accept=accept,
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
bag_ids: list[str],
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
accept: GetBagTagLabelAccept,
|
||||||
|
) -> Response[Any | CwsErrorDTO]:
|
||||||
|
"""Get Bag Tag Label
|
||||||
|
|
||||||
|
For a given bag get the label of the bag tag, sentt as a bytestream response.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
bag_ids (list[str]):
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
accept (GetBagTagLabelAccept):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[Any | CwsErrorDTO]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
bag_ids=bag_ids,
|
||||||
|
authorization=authorization,
|
||||||
|
accept=accept,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = await client.get_async_httpx_client().request(**kwargs)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
bag_ids: list[str],
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
accept: GetBagTagLabelAccept,
|
||||||
|
) -> Any | CwsErrorDTO | None:
|
||||||
|
"""Get Bag Tag Label
|
||||||
|
|
||||||
|
For a given bag get the label of the bag tag, sentt as a bytestream response.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
bag_ids (list[str]):
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
accept (GetBagTagLabelAccept):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Any | CwsErrorDTO
|
||||||
|
"""
|
||||||
|
|
||||||
|
return (
|
||||||
|
await asyncio_detailed(
|
||||||
|
client=client,
|
||||||
|
bag_ids=bag_ids,
|
||||||
|
authorization=authorization,
|
||||||
|
accept=accept,
|
||||||
|
)
|
||||||
|
).parsed
|
||||||
@@ -0,0 +1,210 @@
|
|||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any
|
||||||
|
from urllib.parse import quote
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ... import errors
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...models.cws_error_dto import CwsErrorDTO
|
||||||
|
from ...models.order import Order
|
||||||
|
from ...types import Response
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
customer_ekp: str,
|
||||||
|
order_id: str,
|
||||||
|
*,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
headers: dict[str, Any] = {}
|
||||||
|
headers["Authorization"] = authorization
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "get",
|
||||||
|
"url": "/dpi/shipping/v1/bulk/{customer_ekp}/orders/{order_id}".format(
|
||||||
|
customer_ekp=quote(str(customer_ekp), safe=""),
|
||||||
|
order_id=quote(str(order_id), safe=""),
|
||||||
|
),
|
||||||
|
}
|
||||||
|
|
||||||
|
_kwargs["headers"] = headers
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> CwsErrorDTO | Order | None:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = Order.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_200
|
||||||
|
|
||||||
|
if response.status_code == 403:
|
||||||
|
response_403 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_403
|
||||||
|
|
||||||
|
if response.status_code == 404:
|
||||||
|
response_404 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_404
|
||||||
|
|
||||||
|
if response.status_code == 500:
|
||||||
|
response_500 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_500
|
||||||
|
|
||||||
|
if client.raise_on_unexpected_status:
|
||||||
|
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[CwsErrorDTO | Order]:
|
||||||
|
return Response(
|
||||||
|
status_code=HTTPStatus(response.status_code),
|
||||||
|
content=response.content,
|
||||||
|
headers=response.headers,
|
||||||
|
parsed=_parse_response(client=client, response=response),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def sync_detailed(
|
||||||
|
customer_ekp: str,
|
||||||
|
order_id: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
) -> Response[CwsErrorDTO | Order]:
|
||||||
|
"""Get a Bulk Order
|
||||||
|
|
||||||
|
Searches the order for the given orderId.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
customer_ekp (str):
|
||||||
|
order_id (str):
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[CwsErrorDTO | Order]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
customer_ekp=customer_ekp,
|
||||||
|
order_id=order_id,
|
||||||
|
authorization=authorization,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
def sync(
|
||||||
|
customer_ekp: str,
|
||||||
|
order_id: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
) -> CwsErrorDTO | Order | None:
|
||||||
|
"""Get a Bulk Order
|
||||||
|
|
||||||
|
Searches the order for the given orderId.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
customer_ekp (str):
|
||||||
|
order_id (str):
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
CwsErrorDTO | Order
|
||||||
|
"""
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
customer_ekp=customer_ekp,
|
||||||
|
order_id=order_id,
|
||||||
|
client=client,
|
||||||
|
authorization=authorization,
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
customer_ekp: str,
|
||||||
|
order_id: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
) -> Response[CwsErrorDTO | Order]:
|
||||||
|
"""Get a Bulk Order
|
||||||
|
|
||||||
|
Searches the order for the given orderId.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
customer_ekp (str):
|
||||||
|
order_id (str):
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[CwsErrorDTO | Order]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
customer_ekp=customer_ekp,
|
||||||
|
order_id=order_id,
|
||||||
|
authorization=authorization,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = await client.get_async_httpx_client().request(**kwargs)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio(
|
||||||
|
customer_ekp: str,
|
||||||
|
order_id: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
) -> CwsErrorDTO | Order | None:
|
||||||
|
"""Get a Bulk Order
|
||||||
|
|
||||||
|
Searches the order for the given orderId.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
customer_ekp (str):
|
||||||
|
order_id (str):
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
CwsErrorDTO | Order
|
||||||
|
"""
|
||||||
|
|
||||||
|
return (
|
||||||
|
await asyncio_detailed(
|
||||||
|
customer_ekp=customer_ekp,
|
||||||
|
order_id=order_id,
|
||||||
|
client=client,
|
||||||
|
authorization=authorization,
|
||||||
|
)
|
||||||
|
).parsed
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
"""Contains endpoint functions for accessing the API"""
|
||||||
@@ -0,0 +1,238 @@
|
|||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any
|
||||||
|
from urllib.parse import quote
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ... import errors
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...models.closed_bag import ClosedBag
|
||||||
|
from ...models.cws_error_dto import CwsErrorDTO
|
||||||
|
from ...types import UNSET, Response, Unset
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
customer_ekp: str,
|
||||||
|
*,
|
||||||
|
body: ClosedBag,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
third_party_vendor_id: str | Unset = UNSET,
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
headers: dict[str, Any] = {}
|
||||||
|
headers["Authorization"] = authorization
|
||||||
|
|
||||||
|
if not isinstance(third_party_vendor_id, Unset):
|
||||||
|
headers["ThirdPartyVendor-ID"] = third_party_vendor_id
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "post",
|
||||||
|
"url": "/dpi/shipping/v1/customers/{customer_ekp}/bags".format(
|
||||||
|
customer_ekp=quote(str(customer_ekp), safe=""),
|
||||||
|
),
|
||||||
|
}
|
||||||
|
|
||||||
|
_kwargs["json"] = body.to_dict()
|
||||||
|
|
||||||
|
headers["Content-Type"] = "application/json"
|
||||||
|
|
||||||
|
_kwargs["headers"] = headers
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(
|
||||||
|
*, client: AuthenticatedClient | Client, response: httpx.Response
|
||||||
|
) -> ClosedBag | CwsErrorDTO | None:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = ClosedBag.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_200
|
||||||
|
|
||||||
|
if response.status_code == 403:
|
||||||
|
response_403 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_403
|
||||||
|
|
||||||
|
if response.status_code == 404:
|
||||||
|
response_404 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_404
|
||||||
|
|
||||||
|
if response.status_code == 422:
|
||||||
|
response_422 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_422
|
||||||
|
|
||||||
|
if response.status_code == 500:
|
||||||
|
response_500 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_500
|
||||||
|
|
||||||
|
if client.raise_on_unexpected_status:
|
||||||
|
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def _build_response(
|
||||||
|
*, client: AuthenticatedClient | Client, response: httpx.Response
|
||||||
|
) -> Response[ClosedBag | CwsErrorDTO]:
|
||||||
|
return Response(
|
||||||
|
status_code=HTTPStatus(response.status_code),
|
||||||
|
content=response.content,
|
||||||
|
headers=response.headers,
|
||||||
|
parsed=_parse_response(client=client, response=response),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def sync_detailed(
|
||||||
|
customer_ekp: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
body: ClosedBag,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
third_party_vendor_id: str | Unset = UNSET,
|
||||||
|
) -> Response[ClosedBag | CwsErrorDTO]:
|
||||||
|
"""Create a Closed Bag
|
||||||
|
|
||||||
|
Creates and closes a bag.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
customer_ekp (str):
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
third_party_vendor_id (str | Unset):
|
||||||
|
body (ClosedBag):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[ClosedBag | CwsErrorDTO]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
customer_ekp=customer_ekp,
|
||||||
|
body=body,
|
||||||
|
authorization=authorization,
|
||||||
|
third_party_vendor_id=third_party_vendor_id,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
def sync(
|
||||||
|
customer_ekp: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
body: ClosedBag,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
third_party_vendor_id: str | Unset = UNSET,
|
||||||
|
) -> ClosedBag | CwsErrorDTO | None:
|
||||||
|
"""Create a Closed Bag
|
||||||
|
|
||||||
|
Creates and closes a bag.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
customer_ekp (str):
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
third_party_vendor_id (str | Unset):
|
||||||
|
body (ClosedBag):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
ClosedBag | CwsErrorDTO
|
||||||
|
"""
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
customer_ekp=customer_ekp,
|
||||||
|
client=client,
|
||||||
|
body=body,
|
||||||
|
authorization=authorization,
|
||||||
|
third_party_vendor_id=third_party_vendor_id,
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
customer_ekp: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
body: ClosedBag,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
third_party_vendor_id: str | Unset = UNSET,
|
||||||
|
) -> Response[ClosedBag | CwsErrorDTO]:
|
||||||
|
"""Create a Closed Bag
|
||||||
|
|
||||||
|
Creates and closes a bag.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
customer_ekp (str):
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
third_party_vendor_id (str | Unset):
|
||||||
|
body (ClosedBag):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[ClosedBag | CwsErrorDTO]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
customer_ekp=customer_ekp,
|
||||||
|
body=body,
|
||||||
|
authorization=authorization,
|
||||||
|
third_party_vendor_id=third_party_vendor_id,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = await client.get_async_httpx_client().request(**kwargs)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio(
|
||||||
|
customer_ekp: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
body: ClosedBag,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
third_party_vendor_id: str | Unset = UNSET,
|
||||||
|
) -> ClosedBag | CwsErrorDTO | None:
|
||||||
|
"""Create a Closed Bag
|
||||||
|
|
||||||
|
Creates and closes a bag.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
customer_ekp (str):
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
third_party_vendor_id (str | Unset):
|
||||||
|
body (ClosedBag):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
ClosedBag | CwsErrorDTO
|
||||||
|
"""
|
||||||
|
|
||||||
|
return (
|
||||||
|
await asyncio_detailed(
|
||||||
|
customer_ekp=customer_ekp,
|
||||||
|
client=client,
|
||||||
|
body=body,
|
||||||
|
authorization=authorization,
|
||||||
|
third_party_vendor_id=third_party_vendor_id,
|
||||||
|
)
|
||||||
|
).parsed
|
||||||
@@ -0,0 +1,243 @@
|
|||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any
|
||||||
|
from urllib.parse import quote
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ... import errors
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...models.assemble_order import AssembleOrder
|
||||||
|
from ...models.cws_error_dto import CwsErrorDTO
|
||||||
|
from ...models.order import Order
|
||||||
|
from ...types import UNSET, Response, Unset
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
customer_ekp: str,
|
||||||
|
*,
|
||||||
|
body: AssembleOrder,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
third_party_vendor_id: str | Unset = UNSET,
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
headers: dict[str, Any] = {}
|
||||||
|
headers["Authorization"] = authorization
|
||||||
|
|
||||||
|
if not isinstance(third_party_vendor_id, Unset):
|
||||||
|
headers["ThirdPartyVendor-ID"] = third_party_vendor_id
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "post",
|
||||||
|
"url": "/dpi/shipping/v1/customers/{customer_ekp}/orders".format(
|
||||||
|
customer_ekp=quote(str(customer_ekp), safe=""),
|
||||||
|
),
|
||||||
|
}
|
||||||
|
|
||||||
|
_kwargs["json"] = body.to_dict()
|
||||||
|
|
||||||
|
headers["Content-Type"] = "application/json"
|
||||||
|
|
||||||
|
_kwargs["headers"] = headers
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> CwsErrorDTO | Order | None:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = Order.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_200
|
||||||
|
|
||||||
|
if response.status_code == 403:
|
||||||
|
response_403 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_403
|
||||||
|
|
||||||
|
if response.status_code == 404:
|
||||||
|
response_404 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_404
|
||||||
|
|
||||||
|
if response.status_code == 422:
|
||||||
|
response_422 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_422
|
||||||
|
|
||||||
|
if response.status_code == 500:
|
||||||
|
response_500 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_500
|
||||||
|
|
||||||
|
if client.raise_on_unexpected_status:
|
||||||
|
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[CwsErrorDTO | Order]:
|
||||||
|
return Response(
|
||||||
|
status_code=HTTPStatus(response.status_code),
|
||||||
|
content=response.content,
|
||||||
|
headers=response.headers,
|
||||||
|
parsed=_parse_response(client=client, response=response),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def sync_detailed(
|
||||||
|
customer_ekp: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
body: AssembleOrder,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
third_party_vendor_id: str | Unset = UNSET,
|
||||||
|
) -> Response[CwsErrorDTO | Order]:
|
||||||
|
"""Create Order
|
||||||
|
|
||||||
|
Creates an order from already existing items.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
customer_ekp (str):
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
third_party_vendor_id (str | Unset):
|
||||||
|
body (AssembleOrder): This assembles the items or bags to a new order. EITHER bagIds OR
|
||||||
|
itemBarcodes is REQUIRED Example: {'itemBarcodes': ['BC123456789DE', 'BC123456790DE',
|
||||||
|
'BC123456791DE'], 'paperwork': {'contactName': 'John Doe', 'awbCopyCount': 3}}.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[CwsErrorDTO | Order]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
customer_ekp=customer_ekp,
|
||||||
|
body=body,
|
||||||
|
authorization=authorization,
|
||||||
|
third_party_vendor_id=third_party_vendor_id,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
def sync(
|
||||||
|
customer_ekp: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
body: AssembleOrder,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
third_party_vendor_id: str | Unset = UNSET,
|
||||||
|
) -> CwsErrorDTO | Order | None:
|
||||||
|
"""Create Order
|
||||||
|
|
||||||
|
Creates an order from already existing items.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
customer_ekp (str):
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
third_party_vendor_id (str | Unset):
|
||||||
|
body (AssembleOrder): This assembles the items or bags to a new order. EITHER bagIds OR
|
||||||
|
itemBarcodes is REQUIRED Example: {'itemBarcodes': ['BC123456789DE', 'BC123456790DE',
|
||||||
|
'BC123456791DE'], 'paperwork': {'contactName': 'John Doe', 'awbCopyCount': 3}}.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
CwsErrorDTO | Order
|
||||||
|
"""
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
customer_ekp=customer_ekp,
|
||||||
|
client=client,
|
||||||
|
body=body,
|
||||||
|
authorization=authorization,
|
||||||
|
third_party_vendor_id=third_party_vendor_id,
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
customer_ekp: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
body: AssembleOrder,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
third_party_vendor_id: str | Unset = UNSET,
|
||||||
|
) -> Response[CwsErrorDTO | Order]:
|
||||||
|
"""Create Order
|
||||||
|
|
||||||
|
Creates an order from already existing items.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
customer_ekp (str):
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
third_party_vendor_id (str | Unset):
|
||||||
|
body (AssembleOrder): This assembles the items or bags to a new order. EITHER bagIds OR
|
||||||
|
itemBarcodes is REQUIRED Example: {'itemBarcodes': ['BC123456789DE', 'BC123456790DE',
|
||||||
|
'BC123456791DE'], 'paperwork': {'contactName': 'John Doe', 'awbCopyCount': 3}}.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[CwsErrorDTO | Order]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
customer_ekp=customer_ekp,
|
||||||
|
body=body,
|
||||||
|
authorization=authorization,
|
||||||
|
third_party_vendor_id=third_party_vendor_id,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = await client.get_async_httpx_client().request(**kwargs)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio(
|
||||||
|
customer_ekp: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
body: AssembleOrder,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
third_party_vendor_id: str | Unset = UNSET,
|
||||||
|
) -> CwsErrorDTO | Order | None:
|
||||||
|
"""Create Order
|
||||||
|
|
||||||
|
Creates an order from already existing items.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
customer_ekp (str):
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
third_party_vendor_id (str | Unset):
|
||||||
|
body (AssembleOrder): This assembles the items or bags to a new order. EITHER bagIds OR
|
||||||
|
itemBarcodes is REQUIRED Example: {'itemBarcodes': ['BC123456789DE', 'BC123456790DE',
|
||||||
|
'BC123456791DE'], 'paperwork': {'contactName': 'John Doe', 'awbCopyCount': 3}}.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
CwsErrorDTO | Order
|
||||||
|
"""
|
||||||
|
|
||||||
|
return (
|
||||||
|
await asyncio_detailed(
|
||||||
|
customer_ekp=customer_ekp,
|
||||||
|
client=client,
|
||||||
|
body=body,
|
||||||
|
authorization=authorization,
|
||||||
|
third_party_vendor_id=third_party_vendor_id,
|
||||||
|
)
|
||||||
|
).parsed
|
||||||
@@ -0,0 +1,261 @@
|
|||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any
|
||||||
|
from urllib.parse import quote
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ... import errors
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...models.cws_error_dto import CwsErrorDTO
|
||||||
|
from ...models.item import Item
|
||||||
|
from ...types import UNSET, Response, Unset
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
customer_ekp: str,
|
||||||
|
*,
|
||||||
|
body: Item,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
third_party_vendor_id: str | Unset = UNSET,
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
headers: dict[str, Any] = {}
|
||||||
|
headers["Authorization"] = authorization
|
||||||
|
|
||||||
|
if not isinstance(third_party_vendor_id, Unset):
|
||||||
|
headers["ThirdPartyVendor-ID"] = third_party_vendor_id
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "post",
|
||||||
|
"url": "/dpi/shipping/v1/customers/{customer_ekp}/items".format(
|
||||||
|
customer_ekp=quote(str(customer_ekp), safe=""),
|
||||||
|
),
|
||||||
|
}
|
||||||
|
|
||||||
|
_kwargs["json"] = body.to_dict()
|
||||||
|
|
||||||
|
headers["Content-Type"] = "application/json"
|
||||||
|
|
||||||
|
_kwargs["headers"] = headers
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> CwsErrorDTO | Item | None:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = Item.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_200
|
||||||
|
|
||||||
|
if response.status_code == 403:
|
||||||
|
response_403 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_403
|
||||||
|
|
||||||
|
if response.status_code == 422:
|
||||||
|
response_422 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_422
|
||||||
|
|
||||||
|
if response.status_code == 500:
|
||||||
|
response_500 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_500
|
||||||
|
|
||||||
|
if client.raise_on_unexpected_status:
|
||||||
|
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[CwsErrorDTO | Item]:
|
||||||
|
return Response(
|
||||||
|
status_code=HTTPStatus(response.status_code),
|
||||||
|
content=response.content,
|
||||||
|
headers=response.headers,
|
||||||
|
parsed=_parse_response(client=client, response=response),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def sync_detailed(
|
||||||
|
customer_ekp: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
body: Item,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
third_party_vendor_id: str | Unset = UNSET,
|
||||||
|
) -> Response[CwsErrorDTO | Item]:
|
||||||
|
"""Create Single Item
|
||||||
|
|
||||||
|
Single items are not attached to an order. Adding items to an order can be done later.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
customer_ekp (str):
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
third_party_vendor_id (str | Unset):
|
||||||
|
body (Item): Example: {'product': 'GPT', 'serviceLevel': 'PRIORITY', 'recipient': 'Doris
|
||||||
|
Bronson', 'addressLine1': 'Uptown street 10', 'addressLine2': '2nd floor', 'postalCode':
|
||||||
|
'SW1A 2AA', 'city': 'London', 'destinationCountry': 'GB', 'custRef': 'BRE-2021-XIT',
|
||||||
|
'recipientPhone': '+441234567890', 'recipientEmail': 'doris@somewhere.non.eu',
|
||||||
|
'senderTaxId': 'IOSS number', 'importerTaxId': 'IOSS number', 'shipmentAmount': 100,
|
||||||
|
'shipmentCurrency': 'EUR', 'shipmentGrossWeight': 1500, 'returnItemWanted': False,
|
||||||
|
'shipmentNaturetype': 'SALE_GOODS', 'contents': [{'contentPieceHsCode': 1234567890,
|
||||||
|
'contentPieceDescription': 'Hairspray', 'contentPieceValue': '120.50',
|
||||||
|
'contentPieceNetweight': 1200, 'contentPieceOrigin': 'DE', 'contentPieceAmount': 2}]}.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[CwsErrorDTO | Item]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
customer_ekp=customer_ekp,
|
||||||
|
body=body,
|
||||||
|
authorization=authorization,
|
||||||
|
third_party_vendor_id=third_party_vendor_id,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
def sync(
|
||||||
|
customer_ekp: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
body: Item,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
third_party_vendor_id: str | Unset = UNSET,
|
||||||
|
) -> CwsErrorDTO | Item | None:
|
||||||
|
"""Create Single Item
|
||||||
|
|
||||||
|
Single items are not attached to an order. Adding items to an order can be done later.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
customer_ekp (str):
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
third_party_vendor_id (str | Unset):
|
||||||
|
body (Item): Example: {'product': 'GPT', 'serviceLevel': 'PRIORITY', 'recipient': 'Doris
|
||||||
|
Bronson', 'addressLine1': 'Uptown street 10', 'addressLine2': '2nd floor', 'postalCode':
|
||||||
|
'SW1A 2AA', 'city': 'London', 'destinationCountry': 'GB', 'custRef': 'BRE-2021-XIT',
|
||||||
|
'recipientPhone': '+441234567890', 'recipientEmail': 'doris@somewhere.non.eu',
|
||||||
|
'senderTaxId': 'IOSS number', 'importerTaxId': 'IOSS number', 'shipmentAmount': 100,
|
||||||
|
'shipmentCurrency': 'EUR', 'shipmentGrossWeight': 1500, 'returnItemWanted': False,
|
||||||
|
'shipmentNaturetype': 'SALE_GOODS', 'contents': [{'contentPieceHsCode': 1234567890,
|
||||||
|
'contentPieceDescription': 'Hairspray', 'contentPieceValue': '120.50',
|
||||||
|
'contentPieceNetweight': 1200, 'contentPieceOrigin': 'DE', 'contentPieceAmount': 2}]}.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
CwsErrorDTO | Item
|
||||||
|
"""
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
customer_ekp=customer_ekp,
|
||||||
|
client=client,
|
||||||
|
body=body,
|
||||||
|
authorization=authorization,
|
||||||
|
third_party_vendor_id=third_party_vendor_id,
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
customer_ekp: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
body: Item,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
third_party_vendor_id: str | Unset = UNSET,
|
||||||
|
) -> Response[CwsErrorDTO | Item]:
|
||||||
|
"""Create Single Item
|
||||||
|
|
||||||
|
Single items are not attached to an order. Adding items to an order can be done later.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
customer_ekp (str):
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
third_party_vendor_id (str | Unset):
|
||||||
|
body (Item): Example: {'product': 'GPT', 'serviceLevel': 'PRIORITY', 'recipient': 'Doris
|
||||||
|
Bronson', 'addressLine1': 'Uptown street 10', 'addressLine2': '2nd floor', 'postalCode':
|
||||||
|
'SW1A 2AA', 'city': 'London', 'destinationCountry': 'GB', 'custRef': 'BRE-2021-XIT',
|
||||||
|
'recipientPhone': '+441234567890', 'recipientEmail': 'doris@somewhere.non.eu',
|
||||||
|
'senderTaxId': 'IOSS number', 'importerTaxId': 'IOSS number', 'shipmentAmount': 100,
|
||||||
|
'shipmentCurrency': 'EUR', 'shipmentGrossWeight': 1500, 'returnItemWanted': False,
|
||||||
|
'shipmentNaturetype': 'SALE_GOODS', 'contents': [{'contentPieceHsCode': 1234567890,
|
||||||
|
'contentPieceDescription': 'Hairspray', 'contentPieceValue': '120.50',
|
||||||
|
'contentPieceNetweight': 1200, 'contentPieceOrigin': 'DE', 'contentPieceAmount': 2}]}.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[CwsErrorDTO | Item]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
customer_ekp=customer_ekp,
|
||||||
|
body=body,
|
||||||
|
authorization=authorization,
|
||||||
|
third_party_vendor_id=third_party_vendor_id,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = await client.get_async_httpx_client().request(**kwargs)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio(
|
||||||
|
customer_ekp: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
body: Item,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
third_party_vendor_id: str | Unset = UNSET,
|
||||||
|
) -> CwsErrorDTO | Item | None:
|
||||||
|
"""Create Single Item
|
||||||
|
|
||||||
|
Single items are not attached to an order. Adding items to an order can be done later.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
customer_ekp (str):
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
third_party_vendor_id (str | Unset):
|
||||||
|
body (Item): Example: {'product': 'GPT', 'serviceLevel': 'PRIORITY', 'recipient': 'Doris
|
||||||
|
Bronson', 'addressLine1': 'Uptown street 10', 'addressLine2': '2nd floor', 'postalCode':
|
||||||
|
'SW1A 2AA', 'city': 'London', 'destinationCountry': 'GB', 'custRef': 'BRE-2021-XIT',
|
||||||
|
'recipientPhone': '+441234567890', 'recipientEmail': 'doris@somewhere.non.eu',
|
||||||
|
'senderTaxId': 'IOSS number', 'importerTaxId': 'IOSS number', 'shipmentAmount': 100,
|
||||||
|
'shipmentCurrency': 'EUR', 'shipmentGrossWeight': 1500, 'returnItemWanted': False,
|
||||||
|
'shipmentNaturetype': 'SALE_GOODS', 'contents': [{'contentPieceHsCode': 1234567890,
|
||||||
|
'contentPieceDescription': 'Hairspray', 'contentPieceValue': '120.50',
|
||||||
|
'contentPieceNetweight': 1200, 'contentPieceOrigin': 'DE', 'contentPieceAmount': 2}]}.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
CwsErrorDTO | Item
|
||||||
|
"""
|
||||||
|
|
||||||
|
return (
|
||||||
|
await asyncio_detailed(
|
||||||
|
customer_ekp=customer_ekp,
|
||||||
|
client=client,
|
||||||
|
body=body,
|
||||||
|
authorization=authorization,
|
||||||
|
third_party_vendor_id=third_party_vendor_id,
|
||||||
|
)
|
||||||
|
).parsed
|
||||||
@@ -0,0 +1,224 @@
|
|||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any, cast
|
||||||
|
from urllib.parse import quote
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ... import errors
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...models.cws_error_dto import CwsErrorDTO
|
||||||
|
from ...models.get_bag_tag_accept import GetBagTagAccept
|
||||||
|
from ...types import Response
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
customer_ekp: str,
|
||||||
|
bag_id: str,
|
||||||
|
*,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
accept: GetBagTagAccept,
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
headers: dict[str, Any] = {}
|
||||||
|
headers["Authorization"] = authorization
|
||||||
|
|
||||||
|
headers["accept"] = str(accept)
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "get",
|
||||||
|
"url": "/dpi/shipping/v1/customers/{customer_ekp}/bags/{bag_id}/label".format(
|
||||||
|
customer_ekp=quote(str(customer_ekp), safe=""),
|
||||||
|
bag_id=quote(str(bag_id), safe=""),
|
||||||
|
),
|
||||||
|
}
|
||||||
|
|
||||||
|
_kwargs["headers"] = headers
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(
|
||||||
|
*, client: AuthenticatedClient | Client, response: httpx.Response
|
||||||
|
) -> CwsErrorDTO | list[str] | None:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = cast(list[str], response.json())
|
||||||
|
|
||||||
|
return response_200
|
||||||
|
|
||||||
|
if response.status_code == 404:
|
||||||
|
response_404 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_404
|
||||||
|
|
||||||
|
if response.status_code == 500:
|
||||||
|
response_500 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_500
|
||||||
|
|
||||||
|
if client.raise_on_unexpected_status:
|
||||||
|
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def _build_response(
|
||||||
|
*, client: AuthenticatedClient | Client, response: httpx.Response
|
||||||
|
) -> Response[CwsErrorDTO | list[str]]:
|
||||||
|
return Response(
|
||||||
|
status_code=HTTPStatus(response.status_code),
|
||||||
|
content=response.content,
|
||||||
|
headers=response.headers,
|
||||||
|
parsed=_parse_response(client=client, response=response),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def sync_detailed(
|
||||||
|
customer_ekp: str,
|
||||||
|
bag_id: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
accept: GetBagTagAccept,
|
||||||
|
) -> Response[CwsErrorDTO | list[str]]:
|
||||||
|
"""Get Label for Bag
|
||||||
|
|
||||||
|
For a given bag a label is generated or retrieved from the cache and send to the requestor.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
customer_ekp (str):
|
||||||
|
bag_id (str):
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
accept (GetBagTagAccept):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[CwsErrorDTO | list[str]]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
customer_ekp=customer_ekp,
|
||||||
|
bag_id=bag_id,
|
||||||
|
authorization=authorization,
|
||||||
|
accept=accept,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
def sync(
|
||||||
|
customer_ekp: str,
|
||||||
|
bag_id: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
accept: GetBagTagAccept,
|
||||||
|
) -> CwsErrorDTO | list[str] | None:
|
||||||
|
"""Get Label for Bag
|
||||||
|
|
||||||
|
For a given bag a label is generated or retrieved from the cache and send to the requestor.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
customer_ekp (str):
|
||||||
|
bag_id (str):
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
accept (GetBagTagAccept):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
CwsErrorDTO | list[str]
|
||||||
|
"""
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
customer_ekp=customer_ekp,
|
||||||
|
bag_id=bag_id,
|
||||||
|
client=client,
|
||||||
|
authorization=authorization,
|
||||||
|
accept=accept,
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
customer_ekp: str,
|
||||||
|
bag_id: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
accept: GetBagTagAccept,
|
||||||
|
) -> Response[CwsErrorDTO | list[str]]:
|
||||||
|
"""Get Label for Bag
|
||||||
|
|
||||||
|
For a given bag a label is generated or retrieved from the cache and send to the requestor.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
customer_ekp (str):
|
||||||
|
bag_id (str):
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
accept (GetBagTagAccept):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[CwsErrorDTO | list[str]]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
customer_ekp=customer_ekp,
|
||||||
|
bag_id=bag_id,
|
||||||
|
authorization=authorization,
|
||||||
|
accept=accept,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = await client.get_async_httpx_client().request(**kwargs)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio(
|
||||||
|
customer_ekp: str,
|
||||||
|
bag_id: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
accept: GetBagTagAccept,
|
||||||
|
) -> CwsErrorDTO | list[str] | None:
|
||||||
|
"""Get Label for Bag
|
||||||
|
|
||||||
|
For a given bag a label is generated or retrieved from the cache and send to the requestor.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
customer_ekp (str):
|
||||||
|
bag_id (str):
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
accept (GetBagTagAccept):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
CwsErrorDTO | list[str]
|
||||||
|
"""
|
||||||
|
|
||||||
|
return (
|
||||||
|
await asyncio_detailed(
|
||||||
|
customer_ekp=customer_ekp,
|
||||||
|
bag_id=bag_id,
|
||||||
|
client=client,
|
||||||
|
authorization=authorization,
|
||||||
|
accept=accept,
|
||||||
|
)
|
||||||
|
).parsed
|
||||||
@@ -0,0 +1,223 @@
|
|||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any, cast
|
||||||
|
from urllib.parse import quote
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ... import errors
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...models.cws_error_dto import CwsErrorDTO
|
||||||
|
from ...models.get_customer_item_label_accept import GetCustomerItemLabelAccept
|
||||||
|
from ...types import Response
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
customer_ekp: str,
|
||||||
|
barcode: str,
|
||||||
|
*,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
accept: GetCustomerItemLabelAccept,
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
headers: dict[str, Any] = {}
|
||||||
|
headers["Authorization"] = authorization
|
||||||
|
|
||||||
|
headers["accept"] = str(accept)
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "get",
|
||||||
|
"url": "/dpi/shipping/v1/customers/{customer_ekp}/items/{barcode}/label".format(
|
||||||
|
customer_ekp=quote(str(customer_ekp), safe=""),
|
||||||
|
barcode=quote(str(barcode), safe=""),
|
||||||
|
),
|
||||||
|
}
|
||||||
|
|
||||||
|
_kwargs["headers"] = headers
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> CwsErrorDTO | str | None:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = cast(str, response.json())
|
||||||
|
return response_200
|
||||||
|
|
||||||
|
if response.status_code == 403:
|
||||||
|
response_403 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_403
|
||||||
|
|
||||||
|
if response.status_code == 500:
|
||||||
|
response_500 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_500
|
||||||
|
|
||||||
|
if client.raise_on_unexpected_status:
|
||||||
|
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[CwsErrorDTO | str]:
|
||||||
|
return Response(
|
||||||
|
status_code=HTTPStatus(response.status_code),
|
||||||
|
content=response.content,
|
||||||
|
headers=response.headers,
|
||||||
|
parsed=_parse_response(client=client, response=response),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def sync_detailed(
|
||||||
|
customer_ekp: str,
|
||||||
|
barcode: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
accept: GetCustomerItemLabelAccept,
|
||||||
|
) -> Response[CwsErrorDTO | str]:
|
||||||
|
"""Get Label for Item
|
||||||
|
|
||||||
|
For a given item a label is generated or retrieved from the cache and send to the requestor as a
|
||||||
|
bytestream response.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
customer_ekp (str):
|
||||||
|
barcode (str):
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
accept (GetCustomerItemLabelAccept):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[CwsErrorDTO | str]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
customer_ekp=customer_ekp,
|
||||||
|
barcode=barcode,
|
||||||
|
authorization=authorization,
|
||||||
|
accept=accept,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
def sync(
|
||||||
|
customer_ekp: str,
|
||||||
|
barcode: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
accept: GetCustomerItemLabelAccept,
|
||||||
|
) -> CwsErrorDTO | str | None:
|
||||||
|
"""Get Label for Item
|
||||||
|
|
||||||
|
For a given item a label is generated or retrieved from the cache and send to the requestor as a
|
||||||
|
bytestream response.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
customer_ekp (str):
|
||||||
|
barcode (str):
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
accept (GetCustomerItemLabelAccept):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
CwsErrorDTO | str
|
||||||
|
"""
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
customer_ekp=customer_ekp,
|
||||||
|
barcode=barcode,
|
||||||
|
client=client,
|
||||||
|
authorization=authorization,
|
||||||
|
accept=accept,
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
customer_ekp: str,
|
||||||
|
barcode: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
accept: GetCustomerItemLabelAccept,
|
||||||
|
) -> Response[CwsErrorDTO | str]:
|
||||||
|
"""Get Label for Item
|
||||||
|
|
||||||
|
For a given item a label is generated or retrieved from the cache and send to the requestor as a
|
||||||
|
bytestream response.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
customer_ekp (str):
|
||||||
|
barcode (str):
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
accept (GetCustomerItemLabelAccept):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[CwsErrorDTO | str]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
customer_ekp=customer_ekp,
|
||||||
|
barcode=barcode,
|
||||||
|
authorization=authorization,
|
||||||
|
accept=accept,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = await client.get_async_httpx_client().request(**kwargs)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio(
|
||||||
|
customer_ekp: str,
|
||||||
|
barcode: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
accept: GetCustomerItemLabelAccept,
|
||||||
|
) -> CwsErrorDTO | str | None:
|
||||||
|
"""Get Label for Item
|
||||||
|
|
||||||
|
For a given item a label is generated or retrieved from the cache and send to the requestor as a
|
||||||
|
bytestream response.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
customer_ekp (str):
|
||||||
|
barcode (str):
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
accept (GetCustomerItemLabelAccept):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
CwsErrorDTO | str
|
||||||
|
"""
|
||||||
|
|
||||||
|
return (
|
||||||
|
await asyncio_detailed(
|
||||||
|
customer_ekp=customer_ekp,
|
||||||
|
barcode=barcode,
|
||||||
|
client=client,
|
||||||
|
authorization=authorization,
|
||||||
|
accept=accept,
|
||||||
|
)
|
||||||
|
).parsed
|
||||||
@@ -0,0 +1,205 @@
|
|||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any
|
||||||
|
from urllib.parse import quote
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ... import errors
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...models.cws_error_dto import CwsErrorDTO
|
||||||
|
from ...models.item import Item
|
||||||
|
from ...types import Response
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
customer_ekp: str,
|
||||||
|
barcode: str,
|
||||||
|
*,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
headers: dict[str, Any] = {}
|
||||||
|
headers["Authorization"] = authorization
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "get",
|
||||||
|
"url": "/dpi/shipping/v1/customers/{customer_ekp}/items/{barcode}".format(
|
||||||
|
customer_ekp=quote(str(customer_ekp), safe=""),
|
||||||
|
barcode=quote(str(barcode), safe=""),
|
||||||
|
),
|
||||||
|
}
|
||||||
|
|
||||||
|
_kwargs["headers"] = headers
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> CwsErrorDTO | Item | None:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = Item.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_200
|
||||||
|
|
||||||
|
if response.status_code == 403:
|
||||||
|
response_403 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_403
|
||||||
|
|
||||||
|
if response.status_code == 500:
|
||||||
|
response_500 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_500
|
||||||
|
|
||||||
|
if client.raise_on_unexpected_status:
|
||||||
|
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[CwsErrorDTO | Item]:
|
||||||
|
return Response(
|
||||||
|
status_code=HTTPStatus(response.status_code),
|
||||||
|
content=response.content,
|
||||||
|
headers=response.headers,
|
||||||
|
parsed=_parse_response(client=client, response=response),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def sync_detailed(
|
||||||
|
customer_ekp: str,
|
||||||
|
barcode: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
) -> Response[CwsErrorDTO | Item]:
|
||||||
|
"""Retrieve Data for Item
|
||||||
|
|
||||||
|
For a given item of a customer the data is retrieved.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
customer_ekp (str):
|
||||||
|
barcode (str):
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[CwsErrorDTO | Item]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
customer_ekp=customer_ekp,
|
||||||
|
barcode=barcode,
|
||||||
|
authorization=authorization,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
def sync(
|
||||||
|
customer_ekp: str,
|
||||||
|
barcode: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
) -> CwsErrorDTO | Item | None:
|
||||||
|
"""Retrieve Data for Item
|
||||||
|
|
||||||
|
For a given item of a customer the data is retrieved.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
customer_ekp (str):
|
||||||
|
barcode (str):
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
CwsErrorDTO | Item
|
||||||
|
"""
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
customer_ekp=customer_ekp,
|
||||||
|
barcode=barcode,
|
||||||
|
client=client,
|
||||||
|
authorization=authorization,
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
customer_ekp: str,
|
||||||
|
barcode: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
) -> Response[CwsErrorDTO | Item]:
|
||||||
|
"""Retrieve Data for Item
|
||||||
|
|
||||||
|
For a given item of a customer the data is retrieved.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
customer_ekp (str):
|
||||||
|
barcode (str):
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[CwsErrorDTO | Item]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
customer_ekp=customer_ekp,
|
||||||
|
barcode=barcode,
|
||||||
|
authorization=authorization,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = await client.get_async_httpx_client().request(**kwargs)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio(
|
||||||
|
customer_ekp: str,
|
||||||
|
barcode: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
) -> CwsErrorDTO | Item | None:
|
||||||
|
"""Retrieve Data for Item
|
||||||
|
|
||||||
|
For a given item of a customer the data is retrieved.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
customer_ekp (str):
|
||||||
|
barcode (str):
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
CwsErrorDTO | Item
|
||||||
|
"""
|
||||||
|
|
||||||
|
return (
|
||||||
|
await asyncio_detailed(
|
||||||
|
customer_ekp=customer_ekp,
|
||||||
|
barcode=barcode,
|
||||||
|
client=client,
|
||||||
|
authorization=authorization,
|
||||||
|
)
|
||||||
|
).parsed
|
||||||
@@ -0,0 +1,260 @@
|
|||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any
|
||||||
|
from urllib.parse import quote
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ... import errors
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...models.cws_error_dto import CwsErrorDTO
|
||||||
|
from ...models.get_items_status import GetItemsStatus
|
||||||
|
from ...models.item import Item
|
||||||
|
from ...types import UNSET, Response, Unset
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
customer_ekp: str,
|
||||||
|
*,
|
||||||
|
status: GetItemsStatus | Unset = GetItemsStatus.NEW,
|
||||||
|
page: int | Unset = 0,
|
||||||
|
page_size: int | Unset = 10,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
headers: dict[str, Any] = {}
|
||||||
|
headers["Authorization"] = authorization
|
||||||
|
|
||||||
|
params: dict[str, Any] = {}
|
||||||
|
|
||||||
|
json_status: str | Unset = UNSET
|
||||||
|
if not isinstance(status, Unset):
|
||||||
|
json_status = status.value
|
||||||
|
|
||||||
|
params["status"] = json_status
|
||||||
|
|
||||||
|
params["page"] = page
|
||||||
|
|
||||||
|
params["pageSize"] = page_size
|
||||||
|
|
||||||
|
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "get",
|
||||||
|
"url": "/dpi/shipping/v1/customers/{customer_ekp}/items".format(
|
||||||
|
customer_ekp=quote(str(customer_ekp), safe=""),
|
||||||
|
),
|
||||||
|
"params": params,
|
||||||
|
}
|
||||||
|
|
||||||
|
_kwargs["headers"] = headers
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(
|
||||||
|
*, client: AuthenticatedClient | Client, response: httpx.Response
|
||||||
|
) -> CwsErrorDTO | list[Item] | None:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = []
|
||||||
|
_response_200 = response.json()
|
||||||
|
for componentsschemas_list_of_items_item_data in _response_200:
|
||||||
|
componentsschemas_list_of_items_item = Item.from_dict(componentsschemas_list_of_items_item_data)
|
||||||
|
|
||||||
|
response_200.append(componentsschemas_list_of_items_item)
|
||||||
|
|
||||||
|
return response_200
|
||||||
|
|
||||||
|
if response.status_code == 403:
|
||||||
|
response_403 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_403
|
||||||
|
|
||||||
|
if response.status_code == 422:
|
||||||
|
response_422 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_422
|
||||||
|
|
||||||
|
if response.status_code == 500:
|
||||||
|
response_500 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_500
|
||||||
|
|
||||||
|
if client.raise_on_unexpected_status:
|
||||||
|
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def _build_response(
|
||||||
|
*, client: AuthenticatedClient | Client, response: httpx.Response
|
||||||
|
) -> Response[CwsErrorDTO | list[Item]]:
|
||||||
|
return Response(
|
||||||
|
status_code=HTTPStatus(response.status_code),
|
||||||
|
content=response.content,
|
||||||
|
headers=response.headers,
|
||||||
|
parsed=_parse_response(client=client, response=response),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def sync_detailed(
|
||||||
|
customer_ekp: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
status: GetItemsStatus | Unset = GetItemsStatus.NEW,
|
||||||
|
page: int | Unset = 0,
|
||||||
|
page_size: int | Unset = 10,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
) -> Response[CwsErrorDTO | list[Item]]:
|
||||||
|
"""Get Available Items
|
||||||
|
|
||||||
|
Single items are not attached to an order. Adding items to an order can be done later.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
customer_ekp (str):
|
||||||
|
status (GetItemsStatus | Unset): Default: GetItemsStatus.NEW.
|
||||||
|
page (int | Unset): Default: 0.
|
||||||
|
page_size (int | Unset): Default: 10.
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[CwsErrorDTO | list[Item]]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
customer_ekp=customer_ekp,
|
||||||
|
status=status,
|
||||||
|
page=page,
|
||||||
|
page_size=page_size,
|
||||||
|
authorization=authorization,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
def sync(
|
||||||
|
customer_ekp: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
status: GetItemsStatus | Unset = GetItemsStatus.NEW,
|
||||||
|
page: int | Unset = 0,
|
||||||
|
page_size: int | Unset = 10,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
) -> CwsErrorDTO | list[Item] | None:
|
||||||
|
"""Get Available Items
|
||||||
|
|
||||||
|
Single items are not attached to an order. Adding items to an order can be done later.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
customer_ekp (str):
|
||||||
|
status (GetItemsStatus | Unset): Default: GetItemsStatus.NEW.
|
||||||
|
page (int | Unset): Default: 0.
|
||||||
|
page_size (int | Unset): Default: 10.
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
CwsErrorDTO | list[Item]
|
||||||
|
"""
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
customer_ekp=customer_ekp,
|
||||||
|
client=client,
|
||||||
|
status=status,
|
||||||
|
page=page,
|
||||||
|
page_size=page_size,
|
||||||
|
authorization=authorization,
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
customer_ekp: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
status: GetItemsStatus | Unset = GetItemsStatus.NEW,
|
||||||
|
page: int | Unset = 0,
|
||||||
|
page_size: int | Unset = 10,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
) -> Response[CwsErrorDTO | list[Item]]:
|
||||||
|
"""Get Available Items
|
||||||
|
|
||||||
|
Single items are not attached to an order. Adding items to an order can be done later.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
customer_ekp (str):
|
||||||
|
status (GetItemsStatus | Unset): Default: GetItemsStatus.NEW.
|
||||||
|
page (int | Unset): Default: 0.
|
||||||
|
page_size (int | Unset): Default: 10.
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[CwsErrorDTO | list[Item]]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
customer_ekp=customer_ekp,
|
||||||
|
status=status,
|
||||||
|
page=page,
|
||||||
|
page_size=page_size,
|
||||||
|
authorization=authorization,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = await client.get_async_httpx_client().request(**kwargs)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio(
|
||||||
|
customer_ekp: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
status: GetItemsStatus | Unset = GetItemsStatus.NEW,
|
||||||
|
page: int | Unset = 0,
|
||||||
|
page_size: int | Unset = 10,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
) -> CwsErrorDTO | list[Item] | None:
|
||||||
|
"""Get Available Items
|
||||||
|
|
||||||
|
Single items are not attached to an order. Adding items to an order can be done later.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
customer_ekp (str):
|
||||||
|
status (GetItemsStatus | Unset): Default: GetItemsStatus.NEW.
|
||||||
|
page (int | Unset): Default: 0.
|
||||||
|
page_size (int | Unset): Default: 10.
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
CwsErrorDTO | list[Item]
|
||||||
|
"""
|
||||||
|
|
||||||
|
return (
|
||||||
|
await asyncio_detailed(
|
||||||
|
customer_ekp=customer_ekp,
|
||||||
|
client=client,
|
||||||
|
status=status,
|
||||||
|
page=page,
|
||||||
|
page_size=page_size,
|
||||||
|
authorization=authorization,
|
||||||
|
)
|
||||||
|
).parsed
|
||||||
@@ -0,0 +1,256 @@
|
|||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any
|
||||||
|
from urllib.parse import quote
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ... import errors
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...models.cws_error_dto import CwsErrorDTO
|
||||||
|
from ...models.item import Item
|
||||||
|
from ...types import UNSET, Response, Unset
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
customer_ekp: str,
|
||||||
|
barcode: str,
|
||||||
|
*,
|
||||||
|
body: Item,
|
||||||
|
third_party_vendor_id: str | Unset = UNSET,
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
headers: dict[str, Any] = {}
|
||||||
|
if not isinstance(third_party_vendor_id, Unset):
|
||||||
|
headers["ThirdPartyVendor-ID"] = third_party_vendor_id
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "put",
|
||||||
|
"url": "/dpi/shipping/v1/customers/{customer_ekp}/items/{barcode}".format(
|
||||||
|
customer_ekp=quote(str(customer_ekp), safe=""),
|
||||||
|
barcode=quote(str(barcode), safe=""),
|
||||||
|
),
|
||||||
|
}
|
||||||
|
|
||||||
|
_kwargs["json"] = body.to_dict()
|
||||||
|
|
||||||
|
headers["Content-Type"] = "application/json"
|
||||||
|
|
||||||
|
_kwargs["headers"] = headers
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> CwsErrorDTO | Item | None:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = Item.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_200
|
||||||
|
|
||||||
|
if response.status_code == 403:
|
||||||
|
response_403 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_403
|
||||||
|
|
||||||
|
if response.status_code == 422:
|
||||||
|
response_422 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_422
|
||||||
|
|
||||||
|
if response.status_code == 500:
|
||||||
|
response_500 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_500
|
||||||
|
|
||||||
|
if client.raise_on_unexpected_status:
|
||||||
|
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[CwsErrorDTO | Item]:
|
||||||
|
return Response(
|
||||||
|
status_code=HTTPStatus(response.status_code),
|
||||||
|
content=response.content,
|
||||||
|
headers=response.headers,
|
||||||
|
parsed=_parse_response(client=client, response=response),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def sync_detailed(
|
||||||
|
customer_ekp: str,
|
||||||
|
barcode: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
body: Item,
|
||||||
|
third_party_vendor_id: str | Unset = UNSET,
|
||||||
|
) -> Response[CwsErrorDTO | Item]:
|
||||||
|
"""Update a single item.
|
||||||
|
|
||||||
|
Single items are not attached to an order. Adding items to an order can be done later.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
customer_ekp (str):
|
||||||
|
barcode (str):
|
||||||
|
third_party_vendor_id (str | Unset):
|
||||||
|
body (Item): Example: {'product': 'GPT', 'serviceLevel': 'PRIORITY', 'recipient': 'Doris
|
||||||
|
Bronson', 'addressLine1': 'Uptown street 10', 'addressLine2': '2nd floor', 'postalCode':
|
||||||
|
'SW1A 2AA', 'city': 'London', 'destinationCountry': 'GB', 'custRef': 'BRE-2021-XIT',
|
||||||
|
'recipientPhone': '+441234567890', 'recipientEmail': 'doris@somewhere.non.eu',
|
||||||
|
'senderTaxId': 'IOSS number', 'importerTaxId': 'IOSS number', 'shipmentAmount': 100,
|
||||||
|
'shipmentCurrency': 'EUR', 'shipmentGrossWeight': 1500, 'returnItemWanted': False,
|
||||||
|
'shipmentNaturetype': 'SALE_GOODS', 'contents': [{'contentPieceHsCode': 1234567890,
|
||||||
|
'contentPieceDescription': 'Hairspray', 'contentPieceValue': '120.50',
|
||||||
|
'contentPieceNetweight': 1200, 'contentPieceOrigin': 'DE', 'contentPieceAmount': 2}]}.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[CwsErrorDTO | Item]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
customer_ekp=customer_ekp,
|
||||||
|
barcode=barcode,
|
||||||
|
body=body,
|
||||||
|
third_party_vendor_id=third_party_vendor_id,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
def sync(
|
||||||
|
customer_ekp: str,
|
||||||
|
barcode: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
body: Item,
|
||||||
|
third_party_vendor_id: str | Unset = UNSET,
|
||||||
|
) -> CwsErrorDTO | Item | None:
|
||||||
|
"""Update a single item.
|
||||||
|
|
||||||
|
Single items are not attached to an order. Adding items to an order can be done later.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
customer_ekp (str):
|
||||||
|
barcode (str):
|
||||||
|
third_party_vendor_id (str | Unset):
|
||||||
|
body (Item): Example: {'product': 'GPT', 'serviceLevel': 'PRIORITY', 'recipient': 'Doris
|
||||||
|
Bronson', 'addressLine1': 'Uptown street 10', 'addressLine2': '2nd floor', 'postalCode':
|
||||||
|
'SW1A 2AA', 'city': 'London', 'destinationCountry': 'GB', 'custRef': 'BRE-2021-XIT',
|
||||||
|
'recipientPhone': '+441234567890', 'recipientEmail': 'doris@somewhere.non.eu',
|
||||||
|
'senderTaxId': 'IOSS number', 'importerTaxId': 'IOSS number', 'shipmentAmount': 100,
|
||||||
|
'shipmentCurrency': 'EUR', 'shipmentGrossWeight': 1500, 'returnItemWanted': False,
|
||||||
|
'shipmentNaturetype': 'SALE_GOODS', 'contents': [{'contentPieceHsCode': 1234567890,
|
||||||
|
'contentPieceDescription': 'Hairspray', 'contentPieceValue': '120.50',
|
||||||
|
'contentPieceNetweight': 1200, 'contentPieceOrigin': 'DE', 'contentPieceAmount': 2}]}.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
CwsErrorDTO | Item
|
||||||
|
"""
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
customer_ekp=customer_ekp,
|
||||||
|
barcode=barcode,
|
||||||
|
client=client,
|
||||||
|
body=body,
|
||||||
|
third_party_vendor_id=third_party_vendor_id,
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
customer_ekp: str,
|
||||||
|
barcode: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
body: Item,
|
||||||
|
third_party_vendor_id: str | Unset = UNSET,
|
||||||
|
) -> Response[CwsErrorDTO | Item]:
|
||||||
|
"""Update a single item.
|
||||||
|
|
||||||
|
Single items are not attached to an order. Adding items to an order can be done later.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
customer_ekp (str):
|
||||||
|
barcode (str):
|
||||||
|
third_party_vendor_id (str | Unset):
|
||||||
|
body (Item): Example: {'product': 'GPT', 'serviceLevel': 'PRIORITY', 'recipient': 'Doris
|
||||||
|
Bronson', 'addressLine1': 'Uptown street 10', 'addressLine2': '2nd floor', 'postalCode':
|
||||||
|
'SW1A 2AA', 'city': 'London', 'destinationCountry': 'GB', 'custRef': 'BRE-2021-XIT',
|
||||||
|
'recipientPhone': '+441234567890', 'recipientEmail': 'doris@somewhere.non.eu',
|
||||||
|
'senderTaxId': 'IOSS number', 'importerTaxId': 'IOSS number', 'shipmentAmount': 100,
|
||||||
|
'shipmentCurrency': 'EUR', 'shipmentGrossWeight': 1500, 'returnItemWanted': False,
|
||||||
|
'shipmentNaturetype': 'SALE_GOODS', 'contents': [{'contentPieceHsCode': 1234567890,
|
||||||
|
'contentPieceDescription': 'Hairspray', 'contentPieceValue': '120.50',
|
||||||
|
'contentPieceNetweight': 1200, 'contentPieceOrigin': 'DE', 'contentPieceAmount': 2}]}.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[CwsErrorDTO | Item]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
customer_ekp=customer_ekp,
|
||||||
|
barcode=barcode,
|
||||||
|
body=body,
|
||||||
|
third_party_vendor_id=third_party_vendor_id,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = await client.get_async_httpx_client().request(**kwargs)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio(
|
||||||
|
customer_ekp: str,
|
||||||
|
barcode: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
body: Item,
|
||||||
|
third_party_vendor_id: str | Unset = UNSET,
|
||||||
|
) -> CwsErrorDTO | Item | None:
|
||||||
|
"""Update a single item.
|
||||||
|
|
||||||
|
Single items are not attached to an order. Adding items to an order can be done later.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
customer_ekp (str):
|
||||||
|
barcode (str):
|
||||||
|
third_party_vendor_id (str | Unset):
|
||||||
|
body (Item): Example: {'product': 'GPT', 'serviceLevel': 'PRIORITY', 'recipient': 'Doris
|
||||||
|
Bronson', 'addressLine1': 'Uptown street 10', 'addressLine2': '2nd floor', 'postalCode':
|
||||||
|
'SW1A 2AA', 'city': 'London', 'destinationCountry': 'GB', 'custRef': 'BRE-2021-XIT',
|
||||||
|
'recipientPhone': '+441234567890', 'recipientEmail': 'doris@somewhere.non.eu',
|
||||||
|
'senderTaxId': 'IOSS number', 'importerTaxId': 'IOSS number', 'shipmentAmount': 100,
|
||||||
|
'shipmentCurrency': 'EUR', 'shipmentGrossWeight': 1500, 'returnItemWanted': False,
|
||||||
|
'shipmentNaturetype': 'SALE_GOODS', 'contents': [{'contentPieceHsCode': 1234567890,
|
||||||
|
'contentPieceDescription': 'Hairspray', 'contentPieceValue': '120.50',
|
||||||
|
'contentPieceNetweight': 1200, 'contentPieceOrigin': 'DE', 'contentPieceAmount': 2}]}.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
CwsErrorDTO | Item
|
||||||
|
"""
|
||||||
|
|
||||||
|
return (
|
||||||
|
await asyncio_detailed(
|
||||||
|
customer_ekp=customer_ekp,
|
||||||
|
barcode=barcode,
|
||||||
|
client=client,
|
||||||
|
body=body,
|
||||||
|
third_party_vendor_id=third_party_vendor_id,
|
||||||
|
)
|
||||||
|
).parsed
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
"""Contains endpoint functions for accessing the API"""
|
||||||
@@ -0,0 +1,202 @@
|
|||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any, cast
|
||||||
|
from urllib.parse import quote
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ... import errors
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...models.cws_error_dto import CwsErrorDTO
|
||||||
|
from ...types import Response
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
item_id: str,
|
||||||
|
*,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
headers: dict[str, Any] = {}
|
||||||
|
headers["Authorization"] = authorization
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "delete",
|
||||||
|
"url": "/dpi/shipping/v1/items/{item_id}".format(
|
||||||
|
item_id=quote(str(item_id), safe=""),
|
||||||
|
),
|
||||||
|
}
|
||||||
|
|
||||||
|
_kwargs["headers"] = headers
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | CwsErrorDTO | None:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = cast(Any, None)
|
||||||
|
return response_200
|
||||||
|
|
||||||
|
if response.status_code == 403:
|
||||||
|
response_403 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_403
|
||||||
|
|
||||||
|
if response.status_code == 404:
|
||||||
|
response_404 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_404
|
||||||
|
|
||||||
|
if response.status_code == 500:
|
||||||
|
response_500 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_500
|
||||||
|
|
||||||
|
if client.raise_on_unexpected_status:
|
||||||
|
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any | CwsErrorDTO]:
|
||||||
|
return Response(
|
||||||
|
status_code=HTTPStatus(response.status_code),
|
||||||
|
content=response.content,
|
||||||
|
headers=response.headers,
|
||||||
|
parsed=_parse_response(client=client, response=response),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def sync_detailed(
|
||||||
|
item_id: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
) -> Response[Any | CwsErrorDTO]:
|
||||||
|
"""Delete Item
|
||||||
|
|
||||||
|
Deletes the item for the specified item id. <br><br>This operation only works for items attached to
|
||||||
|
orders that are in the OPEN state. Called on items of orders in the FINALIZED state leads to an 404
|
||||||
|
error (an item with the desired attributes cannot be found).
|
||||||
|
|
||||||
|
Args:
|
||||||
|
item_id (str):
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[Any | CwsErrorDTO]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
item_id=item_id,
|
||||||
|
authorization=authorization,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
def sync(
|
||||||
|
item_id: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
) -> Any | CwsErrorDTO | None:
|
||||||
|
"""Delete Item
|
||||||
|
|
||||||
|
Deletes the item for the specified item id. <br><br>This operation only works for items attached to
|
||||||
|
orders that are in the OPEN state. Called on items of orders in the FINALIZED state leads to an 404
|
||||||
|
error (an item with the desired attributes cannot be found).
|
||||||
|
|
||||||
|
Args:
|
||||||
|
item_id (str):
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Any | CwsErrorDTO
|
||||||
|
"""
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
item_id=item_id,
|
||||||
|
client=client,
|
||||||
|
authorization=authorization,
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
item_id: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
) -> Response[Any | CwsErrorDTO]:
|
||||||
|
"""Delete Item
|
||||||
|
|
||||||
|
Deletes the item for the specified item id. <br><br>This operation only works for items attached to
|
||||||
|
orders that are in the OPEN state. Called on items of orders in the FINALIZED state leads to an 404
|
||||||
|
error (an item with the desired attributes cannot be found).
|
||||||
|
|
||||||
|
Args:
|
||||||
|
item_id (str):
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[Any | CwsErrorDTO]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
item_id=item_id,
|
||||||
|
authorization=authorization,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = await client.get_async_httpx_client().request(**kwargs)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio(
|
||||||
|
item_id: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
) -> Any | CwsErrorDTO | None:
|
||||||
|
"""Delete Item
|
||||||
|
|
||||||
|
Deletes the item for the specified item id. <br><br>This operation only works for items attached to
|
||||||
|
orders that are in the OPEN state. Called on items of orders in the FINALIZED state leads to an 404
|
||||||
|
error (an item with the desired attributes cannot be found).
|
||||||
|
|
||||||
|
Args:
|
||||||
|
item_id (str):
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Any | CwsErrorDTO
|
||||||
|
"""
|
||||||
|
|
||||||
|
return (
|
||||||
|
await asyncio_detailed(
|
||||||
|
item_id=item_id,
|
||||||
|
client=client,
|
||||||
|
authorization=authorization,
|
||||||
|
)
|
||||||
|
).parsed
|
||||||
@@ -0,0 +1,196 @@
|
|||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any
|
||||||
|
from urllib.parse import quote
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ... import errors
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...models.cws_error_dto import CwsErrorDTO
|
||||||
|
from ...models.item import Item
|
||||||
|
from ...types import Response
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
item_id: str,
|
||||||
|
*,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
headers: dict[str, Any] = {}
|
||||||
|
headers["Authorization"] = authorization
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "get",
|
||||||
|
"url": "/dpi/shipping/v1/items/{item_id}".format(
|
||||||
|
item_id=quote(str(item_id), safe=""),
|
||||||
|
),
|
||||||
|
}
|
||||||
|
|
||||||
|
_kwargs["headers"] = headers
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> CwsErrorDTO | Item | None:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = Item.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_200
|
||||||
|
|
||||||
|
if response.status_code == 403:
|
||||||
|
response_403 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_403
|
||||||
|
|
||||||
|
if response.status_code == 404:
|
||||||
|
response_404 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_404
|
||||||
|
|
||||||
|
if response.status_code == 500:
|
||||||
|
response_500 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_500
|
||||||
|
|
||||||
|
if client.raise_on_unexpected_status:
|
||||||
|
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[CwsErrorDTO | Item]:
|
||||||
|
return Response(
|
||||||
|
status_code=HTTPStatus(response.status_code),
|
||||||
|
content=response.content,
|
||||||
|
headers=response.headers,
|
||||||
|
parsed=_parse_response(client=client, response=response),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def sync_detailed(
|
||||||
|
item_id: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
) -> Response[CwsErrorDTO | Item]:
|
||||||
|
"""Get Item
|
||||||
|
|
||||||
|
You get all information about a given item.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
item_id (str):
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[CwsErrorDTO | Item]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
item_id=item_id,
|
||||||
|
authorization=authorization,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
def sync(
|
||||||
|
item_id: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
) -> CwsErrorDTO | Item | None:
|
||||||
|
"""Get Item
|
||||||
|
|
||||||
|
You get all information about a given item.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
item_id (str):
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
CwsErrorDTO | Item
|
||||||
|
"""
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
item_id=item_id,
|
||||||
|
client=client,
|
||||||
|
authorization=authorization,
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
item_id: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
) -> Response[CwsErrorDTO | Item]:
|
||||||
|
"""Get Item
|
||||||
|
|
||||||
|
You get all information about a given item.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
item_id (str):
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[CwsErrorDTO | Item]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
item_id=item_id,
|
||||||
|
authorization=authorization,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = await client.get_async_httpx_client().request(**kwargs)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio(
|
||||||
|
item_id: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
) -> CwsErrorDTO | Item | None:
|
||||||
|
"""Get Item
|
||||||
|
|
||||||
|
You get all information about a given item.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
item_id (str):
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
CwsErrorDTO | Item
|
||||||
|
"""
|
||||||
|
|
||||||
|
return (
|
||||||
|
await asyncio_detailed(
|
||||||
|
item_id=item_id,
|
||||||
|
client=client,
|
||||||
|
authorization=authorization,
|
||||||
|
)
|
||||||
|
).parsed
|
||||||
@@ -0,0 +1,209 @@
|
|||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any, cast
|
||||||
|
from urllib.parse import quote
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ... import errors
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...models.cws_error_dto import CwsErrorDTO
|
||||||
|
from ...models.get_item_label_accept import GetItemLabelAccept
|
||||||
|
from ...types import Response
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
item_id: str,
|
||||||
|
*,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
accept: GetItemLabelAccept,
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
headers: dict[str, Any] = {}
|
||||||
|
headers["Authorization"] = authorization
|
||||||
|
|
||||||
|
headers["accept"] = str(accept)
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "get",
|
||||||
|
"url": "/dpi/shipping/v1/items/{item_id}/label".format(
|
||||||
|
item_id=quote(str(item_id), safe=""),
|
||||||
|
),
|
||||||
|
}
|
||||||
|
|
||||||
|
_kwargs["headers"] = headers
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> CwsErrorDTO | str | None:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = cast(str, response.json())
|
||||||
|
return response_200
|
||||||
|
|
||||||
|
if response.status_code == 404:
|
||||||
|
response_404 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_404
|
||||||
|
|
||||||
|
if response.status_code == 500:
|
||||||
|
response_500 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_500
|
||||||
|
|
||||||
|
if client.raise_on_unexpected_status:
|
||||||
|
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[CwsErrorDTO | str]:
|
||||||
|
return Response(
|
||||||
|
status_code=HTTPStatus(response.status_code),
|
||||||
|
content=response.content,
|
||||||
|
headers=response.headers,
|
||||||
|
parsed=_parse_response(client=client, response=response),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def sync_detailed(
|
||||||
|
item_id: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
accept: GetItemLabelAccept,
|
||||||
|
) -> Response[CwsErrorDTO | str]:
|
||||||
|
"""Get Item Label
|
||||||
|
|
||||||
|
For a given item a label is generated or retrieved from the cache and send to the requestor as a
|
||||||
|
bytestream response.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
item_id (str):
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
accept (GetItemLabelAccept):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[CwsErrorDTO | str]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
item_id=item_id,
|
||||||
|
authorization=authorization,
|
||||||
|
accept=accept,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
def sync(
|
||||||
|
item_id: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
accept: GetItemLabelAccept,
|
||||||
|
) -> CwsErrorDTO | str | None:
|
||||||
|
"""Get Item Label
|
||||||
|
|
||||||
|
For a given item a label is generated or retrieved from the cache and send to the requestor as a
|
||||||
|
bytestream response.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
item_id (str):
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
accept (GetItemLabelAccept):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
CwsErrorDTO | str
|
||||||
|
"""
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
item_id=item_id,
|
||||||
|
client=client,
|
||||||
|
authorization=authorization,
|
||||||
|
accept=accept,
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
item_id: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
accept: GetItemLabelAccept,
|
||||||
|
) -> Response[CwsErrorDTO | str]:
|
||||||
|
"""Get Item Label
|
||||||
|
|
||||||
|
For a given item a label is generated or retrieved from the cache and send to the requestor as a
|
||||||
|
bytestream response.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
item_id (str):
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
accept (GetItemLabelAccept):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[CwsErrorDTO | str]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
item_id=item_id,
|
||||||
|
authorization=authorization,
|
||||||
|
accept=accept,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = await client.get_async_httpx_client().request(**kwargs)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio(
|
||||||
|
item_id: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
accept: GetItemLabelAccept,
|
||||||
|
) -> CwsErrorDTO | str | None:
|
||||||
|
"""Get Item Label
|
||||||
|
|
||||||
|
For a given item a label is generated or retrieved from the cache and send to the requestor as a
|
||||||
|
bytestream response.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
item_id (str):
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
accept (GetItemLabelAccept):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
CwsErrorDTO | str
|
||||||
|
"""
|
||||||
|
|
||||||
|
return (
|
||||||
|
await asyncio_detailed(
|
||||||
|
item_id=item_id,
|
||||||
|
client=client,
|
||||||
|
authorization=authorization,
|
||||||
|
accept=accept,
|
||||||
|
)
|
||||||
|
).parsed
|
||||||
@@ -0,0 +1,257 @@
|
|||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any
|
||||||
|
from urllib.parse import quote
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ... import errors
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...models.cws_error_dto import CwsErrorDTO
|
||||||
|
from ...models.item import Item
|
||||||
|
from ...types import Response
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
item_id: str,
|
||||||
|
*,
|
||||||
|
body: Item,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
headers: dict[str, Any] = {}
|
||||||
|
headers["Authorization"] = authorization
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "put",
|
||||||
|
"url": "/dpi/shipping/v1/items/{item_id}".format(
|
||||||
|
item_id=quote(str(item_id), safe=""),
|
||||||
|
),
|
||||||
|
}
|
||||||
|
|
||||||
|
_kwargs["json"] = body.to_dict()
|
||||||
|
|
||||||
|
headers["Content-Type"] = "application/json"
|
||||||
|
|
||||||
|
_kwargs["headers"] = headers
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> CwsErrorDTO | Item | None:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = Item.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_200
|
||||||
|
|
||||||
|
if response.status_code == 403:
|
||||||
|
response_403 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_403
|
||||||
|
|
||||||
|
if response.status_code == 404:
|
||||||
|
response_404 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_404
|
||||||
|
|
||||||
|
if response.status_code == 500:
|
||||||
|
response_500 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_500
|
||||||
|
|
||||||
|
if client.raise_on_unexpected_status:
|
||||||
|
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[CwsErrorDTO | Item]:
|
||||||
|
return Response(
|
||||||
|
status_code=HTTPStatus(response.status_code),
|
||||||
|
content=response.content,
|
||||||
|
headers=response.headers,
|
||||||
|
parsed=_parse_response(client=client, response=response),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def sync_detailed(
|
||||||
|
item_id: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
body: Item,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
) -> Response[CwsErrorDTO | Item]:
|
||||||
|
"""Update item
|
||||||
|
|
||||||
|
Updates the item for the specified item id. <br><br>This operation only works for items attached to
|
||||||
|
orders that are in the OPEN state. Called on items of orders in the FINALIZED state leads to an 404
|
||||||
|
error (an item with the desired attributes cannot be found). The following fields are not updatable:
|
||||||
|
product, serviceLevel, destinationCountry
|
||||||
|
|
||||||
|
Args:
|
||||||
|
item_id (str):
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
body (Item): Example: {'product': 'GPT', 'serviceLevel': 'PRIORITY', 'recipient': 'Doris
|
||||||
|
Bronson', 'addressLine1': 'Uptown street 10', 'addressLine2': '2nd floor', 'postalCode':
|
||||||
|
'SW1A 2AA', 'city': 'London', 'destinationCountry': 'GB', 'custRef': 'BRE-2021-XIT',
|
||||||
|
'recipientPhone': '+441234567890', 'recipientEmail': 'doris@somewhere.non.eu',
|
||||||
|
'senderTaxId': 'IOSS number', 'importerTaxId': 'IOSS number', 'shipmentAmount': 100,
|
||||||
|
'shipmentCurrency': 'EUR', 'shipmentGrossWeight': 1500, 'returnItemWanted': False,
|
||||||
|
'shipmentNaturetype': 'SALE_GOODS', 'contents': [{'contentPieceHsCode': 1234567890,
|
||||||
|
'contentPieceDescription': 'Hairspray', 'contentPieceValue': '120.50',
|
||||||
|
'contentPieceNetweight': 1200, 'contentPieceOrigin': 'DE', 'contentPieceAmount': 2}]}.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[CwsErrorDTO | Item]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
item_id=item_id,
|
||||||
|
body=body,
|
||||||
|
authorization=authorization,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
def sync(
|
||||||
|
item_id: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
body: Item,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
) -> CwsErrorDTO | Item | None:
|
||||||
|
"""Update item
|
||||||
|
|
||||||
|
Updates the item for the specified item id. <br><br>This operation only works for items attached to
|
||||||
|
orders that are in the OPEN state. Called on items of orders in the FINALIZED state leads to an 404
|
||||||
|
error (an item with the desired attributes cannot be found). The following fields are not updatable:
|
||||||
|
product, serviceLevel, destinationCountry
|
||||||
|
|
||||||
|
Args:
|
||||||
|
item_id (str):
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
body (Item): Example: {'product': 'GPT', 'serviceLevel': 'PRIORITY', 'recipient': 'Doris
|
||||||
|
Bronson', 'addressLine1': 'Uptown street 10', 'addressLine2': '2nd floor', 'postalCode':
|
||||||
|
'SW1A 2AA', 'city': 'London', 'destinationCountry': 'GB', 'custRef': 'BRE-2021-XIT',
|
||||||
|
'recipientPhone': '+441234567890', 'recipientEmail': 'doris@somewhere.non.eu',
|
||||||
|
'senderTaxId': 'IOSS number', 'importerTaxId': 'IOSS number', 'shipmentAmount': 100,
|
||||||
|
'shipmentCurrency': 'EUR', 'shipmentGrossWeight': 1500, 'returnItemWanted': False,
|
||||||
|
'shipmentNaturetype': 'SALE_GOODS', 'contents': [{'contentPieceHsCode': 1234567890,
|
||||||
|
'contentPieceDescription': 'Hairspray', 'contentPieceValue': '120.50',
|
||||||
|
'contentPieceNetweight': 1200, 'contentPieceOrigin': 'DE', 'contentPieceAmount': 2}]}.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
CwsErrorDTO | Item
|
||||||
|
"""
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
item_id=item_id,
|
||||||
|
client=client,
|
||||||
|
body=body,
|
||||||
|
authorization=authorization,
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
item_id: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
body: Item,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
) -> Response[CwsErrorDTO | Item]:
|
||||||
|
"""Update item
|
||||||
|
|
||||||
|
Updates the item for the specified item id. <br><br>This operation only works for items attached to
|
||||||
|
orders that are in the OPEN state. Called on items of orders in the FINALIZED state leads to an 404
|
||||||
|
error (an item with the desired attributes cannot be found). The following fields are not updatable:
|
||||||
|
product, serviceLevel, destinationCountry
|
||||||
|
|
||||||
|
Args:
|
||||||
|
item_id (str):
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
body (Item): Example: {'product': 'GPT', 'serviceLevel': 'PRIORITY', 'recipient': 'Doris
|
||||||
|
Bronson', 'addressLine1': 'Uptown street 10', 'addressLine2': '2nd floor', 'postalCode':
|
||||||
|
'SW1A 2AA', 'city': 'London', 'destinationCountry': 'GB', 'custRef': 'BRE-2021-XIT',
|
||||||
|
'recipientPhone': '+441234567890', 'recipientEmail': 'doris@somewhere.non.eu',
|
||||||
|
'senderTaxId': 'IOSS number', 'importerTaxId': 'IOSS number', 'shipmentAmount': 100,
|
||||||
|
'shipmentCurrency': 'EUR', 'shipmentGrossWeight': 1500, 'returnItemWanted': False,
|
||||||
|
'shipmentNaturetype': 'SALE_GOODS', 'contents': [{'contentPieceHsCode': 1234567890,
|
||||||
|
'contentPieceDescription': 'Hairspray', 'contentPieceValue': '120.50',
|
||||||
|
'contentPieceNetweight': 1200, 'contentPieceOrigin': 'DE', 'contentPieceAmount': 2}]}.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[CwsErrorDTO | Item]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
item_id=item_id,
|
||||||
|
body=body,
|
||||||
|
authorization=authorization,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = await client.get_async_httpx_client().request(**kwargs)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio(
|
||||||
|
item_id: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
body: Item,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
) -> CwsErrorDTO | Item | None:
|
||||||
|
"""Update item
|
||||||
|
|
||||||
|
Updates the item for the specified item id. <br><br>This operation only works for items attached to
|
||||||
|
orders that are in the OPEN state. Called on items of orders in the FINALIZED state leads to an 404
|
||||||
|
error (an item with the desired attributes cannot be found). The following fields are not updatable:
|
||||||
|
product, serviceLevel, destinationCountry
|
||||||
|
|
||||||
|
Args:
|
||||||
|
item_id (str):
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
body (Item): Example: {'product': 'GPT', 'serviceLevel': 'PRIORITY', 'recipient': 'Doris
|
||||||
|
Bronson', 'addressLine1': 'Uptown street 10', 'addressLine2': '2nd floor', 'postalCode':
|
||||||
|
'SW1A 2AA', 'city': 'London', 'destinationCountry': 'GB', 'custRef': 'BRE-2021-XIT',
|
||||||
|
'recipientPhone': '+441234567890', 'recipientEmail': 'doris@somewhere.non.eu',
|
||||||
|
'senderTaxId': 'IOSS number', 'importerTaxId': 'IOSS number', 'shipmentAmount': 100,
|
||||||
|
'shipmentCurrency': 'EUR', 'shipmentGrossWeight': 1500, 'returnItemWanted': False,
|
||||||
|
'shipmentNaturetype': 'SALE_GOODS', 'contents': [{'contentPieceHsCode': 1234567890,
|
||||||
|
'contentPieceDescription': 'Hairspray', 'contentPieceValue': '120.50',
|
||||||
|
'contentPieceNetweight': 1200, 'contentPieceOrigin': 'DE', 'contentPieceAmount': 2}]}.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
CwsErrorDTO | Item
|
||||||
|
"""
|
||||||
|
|
||||||
|
return (
|
||||||
|
await asyncio_detailed(
|
||||||
|
item_id=item_id,
|
||||||
|
client=client,
|
||||||
|
body=body,
|
||||||
|
authorization=authorization,
|
||||||
|
)
|
||||||
|
).parsed
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
"""Contains endpoint functions for accessing the API"""
|
||||||
@@ -0,0 +1,242 @@
|
|||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any
|
||||||
|
from urllib.parse import quote
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ... import errors
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...models.cws_error_dto import CwsErrorDTO
|
||||||
|
from ...models.item import Item
|
||||||
|
from ...models.item_response import ItemResponse
|
||||||
|
from ...types import UNSET, Response, Unset
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
order_id: str,
|
||||||
|
*,
|
||||||
|
body: list[Item],
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
third_party_vendor_id: str | Unset = UNSET,
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
headers: dict[str, Any] = {}
|
||||||
|
headers["Authorization"] = authorization
|
||||||
|
|
||||||
|
if not isinstance(third_party_vendor_id, Unset):
|
||||||
|
headers["ThirdPartyVendor-ID"] = third_party_vendor_id
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "post",
|
||||||
|
"url": "/dpi/shipping/v1/orders/{order_id}/items".format(
|
||||||
|
order_id=quote(str(order_id), safe=""),
|
||||||
|
),
|
||||||
|
}
|
||||||
|
|
||||||
|
_kwargs["json"] = []
|
||||||
|
for body_item_data in body:
|
||||||
|
body_item = body_item_data.to_dict()
|
||||||
|
_kwargs["json"].append(body_item)
|
||||||
|
|
||||||
|
headers["Content-Type"] = "application/json"
|
||||||
|
|
||||||
|
_kwargs["headers"] = headers
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(
|
||||||
|
*, client: AuthenticatedClient | Client, response: httpx.Response
|
||||||
|
) -> CwsErrorDTO | ItemResponse | None:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = ItemResponse.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_200
|
||||||
|
|
||||||
|
if response.status_code == 403:
|
||||||
|
response_403 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_403
|
||||||
|
|
||||||
|
if response.status_code == 404:
|
||||||
|
response_404 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_404
|
||||||
|
|
||||||
|
if response.status_code == 422:
|
||||||
|
response_422 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_422
|
||||||
|
|
||||||
|
if response.status_code == 500:
|
||||||
|
response_500 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_500
|
||||||
|
|
||||||
|
if client.raise_on_unexpected_status:
|
||||||
|
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def _build_response(
|
||||||
|
*, client: AuthenticatedClient | Client, response: httpx.Response
|
||||||
|
) -> Response[CwsErrorDTO | ItemResponse]:
|
||||||
|
return Response(
|
||||||
|
status_code=HTTPStatus(response.status_code),
|
||||||
|
content=response.content,
|
||||||
|
headers=response.headers,
|
||||||
|
parsed=_parse_response(client=client, response=response),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def sync_detailed(
|
||||||
|
order_id: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
body: list[Item],
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
third_party_vendor_id: str | Unset = UNSET,
|
||||||
|
) -> Response[CwsErrorDTO | ItemResponse]:
|
||||||
|
"""Add Items to an Order
|
||||||
|
|
||||||
|
Add new item(s) to a open order.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
order_id (str):
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
third_party_vendor_id (str | Unset):
|
||||||
|
body (list[Item]):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[CwsErrorDTO | ItemResponse]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
order_id=order_id,
|
||||||
|
body=body,
|
||||||
|
authorization=authorization,
|
||||||
|
third_party_vendor_id=third_party_vendor_id,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
def sync(
|
||||||
|
order_id: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
body: list[Item],
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
third_party_vendor_id: str | Unset = UNSET,
|
||||||
|
) -> CwsErrorDTO | ItemResponse | None:
|
||||||
|
"""Add Items to an Order
|
||||||
|
|
||||||
|
Add new item(s) to a open order.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
order_id (str):
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
third_party_vendor_id (str | Unset):
|
||||||
|
body (list[Item]):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
CwsErrorDTO | ItemResponse
|
||||||
|
"""
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
order_id=order_id,
|
||||||
|
client=client,
|
||||||
|
body=body,
|
||||||
|
authorization=authorization,
|
||||||
|
third_party_vendor_id=third_party_vendor_id,
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
order_id: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
body: list[Item],
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
third_party_vendor_id: str | Unset = UNSET,
|
||||||
|
) -> Response[CwsErrorDTO | ItemResponse]:
|
||||||
|
"""Add Items to an Order
|
||||||
|
|
||||||
|
Add new item(s) to a open order.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
order_id (str):
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
third_party_vendor_id (str | Unset):
|
||||||
|
body (list[Item]):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[CwsErrorDTO | ItemResponse]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
order_id=order_id,
|
||||||
|
body=body,
|
||||||
|
authorization=authorization,
|
||||||
|
third_party_vendor_id=third_party_vendor_id,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = await client.get_async_httpx_client().request(**kwargs)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio(
|
||||||
|
order_id: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
body: list[Item],
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
third_party_vendor_id: str | Unset = UNSET,
|
||||||
|
) -> CwsErrorDTO | ItemResponse | None:
|
||||||
|
"""Add Items to an Order
|
||||||
|
|
||||||
|
Add new item(s) to a open order.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
order_id (str):
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
third_party_vendor_id (str | Unset):
|
||||||
|
body (list[Item]):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
CwsErrorDTO | ItemResponse
|
||||||
|
"""
|
||||||
|
|
||||||
|
return (
|
||||||
|
await asyncio_detailed(
|
||||||
|
order_id=order_id,
|
||||||
|
client=client,
|
||||||
|
body=body,
|
||||||
|
authorization=authorization,
|
||||||
|
third_party_vendor_id=third_party_vendor_id,
|
||||||
|
)
|
||||||
|
).parsed
|
||||||
@@ -0,0 +1,271 @@
|
|||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ... import errors
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...models.cws_error_dto import CwsErrorDTO
|
||||||
|
from ...models.order_data import OrderData
|
||||||
|
from ...models.order_response import OrderResponse
|
||||||
|
from ...types import UNSET, Response, Unset
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
*,
|
||||||
|
body: OrderData,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
third_party_vendor_id: str | Unset = UNSET,
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
headers: dict[str, Any] = {}
|
||||||
|
headers["Authorization"] = authorization
|
||||||
|
|
||||||
|
if not isinstance(third_party_vendor_id, Unset):
|
||||||
|
headers["ThirdPartyVendor-ID"] = third_party_vendor_id
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "post",
|
||||||
|
"url": "/dpi/shipping/v1/orders",
|
||||||
|
}
|
||||||
|
|
||||||
|
_kwargs["json"] = body.to_dict()
|
||||||
|
|
||||||
|
headers["Content-Type"] = "application/json"
|
||||||
|
|
||||||
|
_kwargs["headers"] = headers
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(
|
||||||
|
*, client: AuthenticatedClient | Client, response: httpx.Response
|
||||||
|
) -> CwsErrorDTO | OrderResponse | None:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = OrderResponse.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_200
|
||||||
|
|
||||||
|
if response.status_code == 403:
|
||||||
|
response_403 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_403
|
||||||
|
|
||||||
|
if response.status_code == 404:
|
||||||
|
response_404 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_404
|
||||||
|
|
||||||
|
if response.status_code == 422:
|
||||||
|
response_422 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_422
|
||||||
|
|
||||||
|
if response.status_code == 500:
|
||||||
|
response_500 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_500
|
||||||
|
|
||||||
|
if client.raise_on_unexpected_status:
|
||||||
|
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def _build_response(
|
||||||
|
*, client: AuthenticatedClient | Client, response: httpx.Response
|
||||||
|
) -> Response[CwsErrorDTO | OrderResponse]:
|
||||||
|
return Response(
|
||||||
|
status_code=HTTPStatus(response.status_code),
|
||||||
|
content=response.content,
|
||||||
|
headers=response.headers,
|
||||||
|
parsed=_parse_response(client=client, response=response),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def sync_detailed(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
body: OrderData,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
third_party_vendor_id: str | Unset = UNSET,
|
||||||
|
) -> Response[CwsErrorDTO | OrderResponse]:
|
||||||
|
"""Create Order
|
||||||
|
|
||||||
|
Creates a new order based on the given JSON data
|
||||||
|
|
||||||
|
Args:
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
third_party_vendor_id (str | Unset):
|
||||||
|
body (OrderData): Example: {'customerEkp': '9012345678', 'orderStatus': 'FINALIZE',
|
||||||
|
'paperwork': {'contactName': 'John Doe', 'awbCopyCount': 3, 'jobReference': 'Job ref',
|
||||||
|
'pickupType': 'CUSTOMER_DROP_OFF', 'telephoneNumber': '+4935120681234'}, 'items':
|
||||||
|
[{'product': 'GMP', 'serviceLevel': 'PRIORITY', 'recipient': 'John Doe', 'addressLine1':
|
||||||
|
'Any Street', 'addressLine2': 'Flat 2', 'addressLine3': '1st floor', 'postalCode':
|
||||||
|
'01432', 'city': 'Any City', 'state': 'Any State', 'destinationCountry': 'DE', 'custRef':
|
||||||
|
'REF-2361890-AB', 'recipientPhone': '+44123456789', 'recipientFax': '+44123456789',
|
||||||
|
'recipientEmail': 'john.doe@example.eu', 'senderTaxId': 'IOSS number', 'importerTaxId':
|
||||||
|
'IOSS number', 'shipmentAmount': 100, 'shipmentCurrency': 'EUR', 'shipmentGrossWeight':
|
||||||
|
1500, 'returnItemWanted': False, 'shipmentNaturetype': 'SALE_GOODS', 'contents':
|
||||||
|
[{'contentPieceHsCode': 1234567890, 'contentPieceDescription': 'Trousers',
|
||||||
|
'contentPieceValue': '120.50', 'contentPieceNetweight': 1200, 'contentPieceOrigin': 'DE',
|
||||||
|
'contentPieceAmount': 2}]}]}.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[CwsErrorDTO | OrderResponse]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
body=body,
|
||||||
|
authorization=authorization,
|
||||||
|
third_party_vendor_id=third_party_vendor_id,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
def sync(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
body: OrderData,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
third_party_vendor_id: str | Unset = UNSET,
|
||||||
|
) -> CwsErrorDTO | OrderResponse | None:
|
||||||
|
"""Create Order
|
||||||
|
|
||||||
|
Creates a new order based on the given JSON data
|
||||||
|
|
||||||
|
Args:
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
third_party_vendor_id (str | Unset):
|
||||||
|
body (OrderData): Example: {'customerEkp': '9012345678', 'orderStatus': 'FINALIZE',
|
||||||
|
'paperwork': {'contactName': 'John Doe', 'awbCopyCount': 3, 'jobReference': 'Job ref',
|
||||||
|
'pickupType': 'CUSTOMER_DROP_OFF', 'telephoneNumber': '+4935120681234'}, 'items':
|
||||||
|
[{'product': 'GMP', 'serviceLevel': 'PRIORITY', 'recipient': 'John Doe', 'addressLine1':
|
||||||
|
'Any Street', 'addressLine2': 'Flat 2', 'addressLine3': '1st floor', 'postalCode':
|
||||||
|
'01432', 'city': 'Any City', 'state': 'Any State', 'destinationCountry': 'DE', 'custRef':
|
||||||
|
'REF-2361890-AB', 'recipientPhone': '+44123456789', 'recipientFax': '+44123456789',
|
||||||
|
'recipientEmail': 'john.doe@example.eu', 'senderTaxId': 'IOSS number', 'importerTaxId':
|
||||||
|
'IOSS number', 'shipmentAmount': 100, 'shipmentCurrency': 'EUR', 'shipmentGrossWeight':
|
||||||
|
1500, 'returnItemWanted': False, 'shipmentNaturetype': 'SALE_GOODS', 'contents':
|
||||||
|
[{'contentPieceHsCode': 1234567890, 'contentPieceDescription': 'Trousers',
|
||||||
|
'contentPieceValue': '120.50', 'contentPieceNetweight': 1200, 'contentPieceOrigin': 'DE',
|
||||||
|
'contentPieceAmount': 2}]}]}.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
CwsErrorDTO | OrderResponse
|
||||||
|
"""
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
client=client,
|
||||||
|
body=body,
|
||||||
|
authorization=authorization,
|
||||||
|
third_party_vendor_id=third_party_vendor_id,
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
body: OrderData,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
third_party_vendor_id: str | Unset = UNSET,
|
||||||
|
) -> Response[CwsErrorDTO | OrderResponse]:
|
||||||
|
"""Create Order
|
||||||
|
|
||||||
|
Creates a new order based on the given JSON data
|
||||||
|
|
||||||
|
Args:
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
third_party_vendor_id (str | Unset):
|
||||||
|
body (OrderData): Example: {'customerEkp': '9012345678', 'orderStatus': 'FINALIZE',
|
||||||
|
'paperwork': {'contactName': 'John Doe', 'awbCopyCount': 3, 'jobReference': 'Job ref',
|
||||||
|
'pickupType': 'CUSTOMER_DROP_OFF', 'telephoneNumber': '+4935120681234'}, 'items':
|
||||||
|
[{'product': 'GMP', 'serviceLevel': 'PRIORITY', 'recipient': 'John Doe', 'addressLine1':
|
||||||
|
'Any Street', 'addressLine2': 'Flat 2', 'addressLine3': '1st floor', 'postalCode':
|
||||||
|
'01432', 'city': 'Any City', 'state': 'Any State', 'destinationCountry': 'DE', 'custRef':
|
||||||
|
'REF-2361890-AB', 'recipientPhone': '+44123456789', 'recipientFax': '+44123456789',
|
||||||
|
'recipientEmail': 'john.doe@example.eu', 'senderTaxId': 'IOSS number', 'importerTaxId':
|
||||||
|
'IOSS number', 'shipmentAmount': 100, 'shipmentCurrency': 'EUR', 'shipmentGrossWeight':
|
||||||
|
1500, 'returnItemWanted': False, 'shipmentNaturetype': 'SALE_GOODS', 'contents':
|
||||||
|
[{'contentPieceHsCode': 1234567890, 'contentPieceDescription': 'Trousers',
|
||||||
|
'contentPieceValue': '120.50', 'contentPieceNetweight': 1200, 'contentPieceOrigin': 'DE',
|
||||||
|
'contentPieceAmount': 2}]}]}.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[CwsErrorDTO | OrderResponse]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
body=body,
|
||||||
|
authorization=authorization,
|
||||||
|
third_party_vendor_id=third_party_vendor_id,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = await client.get_async_httpx_client().request(**kwargs)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
body: OrderData,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
third_party_vendor_id: str | Unset = UNSET,
|
||||||
|
) -> CwsErrorDTO | OrderResponse | None:
|
||||||
|
"""Create Order
|
||||||
|
|
||||||
|
Creates a new order based on the given JSON data
|
||||||
|
|
||||||
|
Args:
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
third_party_vendor_id (str | Unset):
|
||||||
|
body (OrderData): Example: {'customerEkp': '9012345678', 'orderStatus': 'FINALIZE',
|
||||||
|
'paperwork': {'contactName': 'John Doe', 'awbCopyCount': 3, 'jobReference': 'Job ref',
|
||||||
|
'pickupType': 'CUSTOMER_DROP_OFF', 'telephoneNumber': '+4935120681234'}, 'items':
|
||||||
|
[{'product': 'GMP', 'serviceLevel': 'PRIORITY', 'recipient': 'John Doe', 'addressLine1':
|
||||||
|
'Any Street', 'addressLine2': 'Flat 2', 'addressLine3': '1st floor', 'postalCode':
|
||||||
|
'01432', 'city': 'Any City', 'state': 'Any State', 'destinationCountry': 'DE', 'custRef':
|
||||||
|
'REF-2361890-AB', 'recipientPhone': '+44123456789', 'recipientFax': '+44123456789',
|
||||||
|
'recipientEmail': 'john.doe@example.eu', 'senderTaxId': 'IOSS number', 'importerTaxId':
|
||||||
|
'IOSS number', 'shipmentAmount': 100, 'shipmentCurrency': 'EUR', 'shipmentGrossWeight':
|
||||||
|
1500, 'returnItemWanted': False, 'shipmentNaturetype': 'SALE_GOODS', 'contents':
|
||||||
|
[{'contentPieceHsCode': 1234567890, 'contentPieceDescription': 'Trousers',
|
||||||
|
'contentPieceValue': '120.50', 'contentPieceNetweight': 1200, 'contentPieceOrigin': 'DE',
|
||||||
|
'contentPieceAmount': 2}]}]}.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
CwsErrorDTO | OrderResponse
|
||||||
|
"""
|
||||||
|
|
||||||
|
return (
|
||||||
|
await asyncio_detailed(
|
||||||
|
client=client,
|
||||||
|
body=body,
|
||||||
|
authorization=authorization,
|
||||||
|
third_party_vendor_id=third_party_vendor_id,
|
||||||
|
)
|
||||||
|
).parsed
|
||||||
@@ -0,0 +1,239 @@
|
|||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any
|
||||||
|
from urllib.parse import quote
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ... import errors
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...models.cws_error_dto import CwsErrorDTO
|
||||||
|
from ...models.order import Order
|
||||||
|
from ...models.paperwork import Paperwork
|
||||||
|
from ...types import UNSET, Response, Unset
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
order_id: str,
|
||||||
|
*,
|
||||||
|
body: Paperwork,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
third_party_vendor_id: str | Unset = UNSET,
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
headers: dict[str, Any] = {}
|
||||||
|
headers["Authorization"] = authorization
|
||||||
|
|
||||||
|
if not isinstance(third_party_vendor_id, Unset):
|
||||||
|
headers["ThirdPartyVendor-ID"] = third_party_vendor_id
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "post",
|
||||||
|
"url": "/dpi/shipping/v1/orders/{order_id}/finalization".format(
|
||||||
|
order_id=quote(str(order_id), safe=""),
|
||||||
|
),
|
||||||
|
}
|
||||||
|
|
||||||
|
_kwargs["json"] = body.to_dict()
|
||||||
|
|
||||||
|
headers["Content-Type"] = "application/json"
|
||||||
|
|
||||||
|
_kwargs["headers"] = headers
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> CwsErrorDTO | Order | None:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = Order.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_200
|
||||||
|
|
||||||
|
if response.status_code == 403:
|
||||||
|
response_403 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_403
|
||||||
|
|
||||||
|
if response.status_code == 404:
|
||||||
|
response_404 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_404
|
||||||
|
|
||||||
|
if response.status_code == 422:
|
||||||
|
response_422 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_422
|
||||||
|
|
||||||
|
if response.status_code == 500:
|
||||||
|
response_500 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_500
|
||||||
|
|
||||||
|
if client.raise_on_unexpected_status:
|
||||||
|
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[CwsErrorDTO | Order]:
|
||||||
|
return Response(
|
||||||
|
status_code=HTTPStatus(response.status_code),
|
||||||
|
content=response.content,
|
||||||
|
headers=response.headers,
|
||||||
|
parsed=_parse_response(client=client, response=response),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def sync_detailed(
|
||||||
|
order_id: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
body: Paperwork,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
third_party_vendor_id: str | Unset = UNSET,
|
||||||
|
) -> Response[CwsErrorDTO | Order]:
|
||||||
|
"""Finalize open Order
|
||||||
|
|
||||||
|
Finalize the given open Order.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
order_id (str):
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
third_party_vendor_id (str | Unset):
|
||||||
|
body (Paperwork): Example: {'contactName': 'John Doe', 'awbCopyCount': 3, 'jobReference':
|
||||||
|
'Job ref', 'pickupType': 'CUSTOMER_DROP_OFF', 'telephoneNumber': '+4935120681234'}.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[CwsErrorDTO | Order]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
order_id=order_id,
|
||||||
|
body=body,
|
||||||
|
authorization=authorization,
|
||||||
|
third_party_vendor_id=third_party_vendor_id,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
def sync(
|
||||||
|
order_id: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
body: Paperwork,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
third_party_vendor_id: str | Unset = UNSET,
|
||||||
|
) -> CwsErrorDTO | Order | None:
|
||||||
|
"""Finalize open Order
|
||||||
|
|
||||||
|
Finalize the given open Order.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
order_id (str):
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
third_party_vendor_id (str | Unset):
|
||||||
|
body (Paperwork): Example: {'contactName': 'John Doe', 'awbCopyCount': 3, 'jobReference':
|
||||||
|
'Job ref', 'pickupType': 'CUSTOMER_DROP_OFF', 'telephoneNumber': '+4935120681234'}.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
CwsErrorDTO | Order
|
||||||
|
"""
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
order_id=order_id,
|
||||||
|
client=client,
|
||||||
|
body=body,
|
||||||
|
authorization=authorization,
|
||||||
|
third_party_vendor_id=third_party_vendor_id,
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
order_id: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
body: Paperwork,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
third_party_vendor_id: str | Unset = UNSET,
|
||||||
|
) -> Response[CwsErrorDTO | Order]:
|
||||||
|
"""Finalize open Order
|
||||||
|
|
||||||
|
Finalize the given open Order.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
order_id (str):
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
third_party_vendor_id (str | Unset):
|
||||||
|
body (Paperwork): Example: {'contactName': 'John Doe', 'awbCopyCount': 3, 'jobReference':
|
||||||
|
'Job ref', 'pickupType': 'CUSTOMER_DROP_OFF', 'telephoneNumber': '+4935120681234'}.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[CwsErrorDTO | Order]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
order_id=order_id,
|
||||||
|
body=body,
|
||||||
|
authorization=authorization,
|
||||||
|
third_party_vendor_id=third_party_vendor_id,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = await client.get_async_httpx_client().request(**kwargs)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio(
|
||||||
|
order_id: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
body: Paperwork,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
third_party_vendor_id: str | Unset = UNSET,
|
||||||
|
) -> CwsErrorDTO | Order | None:
|
||||||
|
"""Finalize open Order
|
||||||
|
|
||||||
|
Finalize the given open Order.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
order_id (str):
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
third_party_vendor_id (str | Unset):
|
||||||
|
body (Paperwork): Example: {'contactName': 'John Doe', 'awbCopyCount': 3, 'jobReference':
|
||||||
|
'Job ref', 'pickupType': 'CUSTOMER_DROP_OFF', 'telephoneNumber': '+4935120681234'}.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
CwsErrorDTO | Order
|
||||||
|
"""
|
||||||
|
|
||||||
|
return (
|
||||||
|
await asyncio_detailed(
|
||||||
|
order_id=order_id,
|
||||||
|
client=client,
|
||||||
|
body=body,
|
||||||
|
authorization=authorization,
|
||||||
|
third_party_vendor_id=third_party_vendor_id,
|
||||||
|
)
|
||||||
|
).parsed
|
||||||
@@ -0,0 +1,196 @@
|
|||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any
|
||||||
|
from urllib.parse import quote
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ... import errors
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...models.cws_error_dto import CwsErrorDTO
|
||||||
|
from ...models.order import Order
|
||||||
|
from ...types import Response
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
order_id: str,
|
||||||
|
*,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
headers: dict[str, Any] = {}
|
||||||
|
headers["Authorization"] = authorization
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "get",
|
||||||
|
"url": "/dpi/shipping/v1/orders/{order_id}".format(
|
||||||
|
order_id=quote(str(order_id), safe=""),
|
||||||
|
),
|
||||||
|
}
|
||||||
|
|
||||||
|
_kwargs["headers"] = headers
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> CwsErrorDTO | Order | None:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = Order.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_200
|
||||||
|
|
||||||
|
if response.status_code == 403:
|
||||||
|
response_403 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_403
|
||||||
|
|
||||||
|
if response.status_code == 404:
|
||||||
|
response_404 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_404
|
||||||
|
|
||||||
|
if response.status_code == 500:
|
||||||
|
response_500 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_500
|
||||||
|
|
||||||
|
if client.raise_on_unexpected_status:
|
||||||
|
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[CwsErrorDTO | Order]:
|
||||||
|
return Response(
|
||||||
|
status_code=HTTPStatus(response.status_code),
|
||||||
|
content=response.content,
|
||||||
|
headers=response.headers,
|
||||||
|
parsed=_parse_response(client=client, response=response),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def sync_detailed(
|
||||||
|
order_id: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
) -> Response[CwsErrorDTO | Order]:
|
||||||
|
"""Get Order
|
||||||
|
|
||||||
|
Searches the order for the given orderId.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
order_id (str):
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[CwsErrorDTO | Order]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
order_id=order_id,
|
||||||
|
authorization=authorization,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
def sync(
|
||||||
|
order_id: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
) -> CwsErrorDTO | Order | None:
|
||||||
|
"""Get Order
|
||||||
|
|
||||||
|
Searches the order for the given orderId.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
order_id (str):
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
CwsErrorDTO | Order
|
||||||
|
"""
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
order_id=order_id,
|
||||||
|
client=client,
|
||||||
|
authorization=authorization,
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
order_id: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
) -> Response[CwsErrorDTO | Order]:
|
||||||
|
"""Get Order
|
||||||
|
|
||||||
|
Searches the order for the given orderId.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
order_id (str):
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[CwsErrorDTO | Order]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
order_id=order_id,
|
||||||
|
authorization=authorization,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = await client.get_async_httpx_client().request(**kwargs)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio(
|
||||||
|
order_id: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
) -> CwsErrorDTO | Order | None:
|
||||||
|
"""Get Order
|
||||||
|
|
||||||
|
Searches the order for the given orderId.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
order_id (str):
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
CwsErrorDTO | Order
|
||||||
|
"""
|
||||||
|
|
||||||
|
return (
|
||||||
|
await asyncio_detailed(
|
||||||
|
order_id=order_id,
|
||||||
|
client=client,
|
||||||
|
authorization=authorization,
|
||||||
|
)
|
||||||
|
).parsed
|
||||||
@@ -0,0 +1,209 @@
|
|||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any
|
||||||
|
from urllib.parse import quote
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ... import errors
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...models.cws_error_dto import CwsErrorDTO
|
||||||
|
from ...models.shipment import Shipment
|
||||||
|
from ...types import Response
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
order_id: str,
|
||||||
|
*,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
headers: dict[str, Any] = {}
|
||||||
|
headers["Authorization"] = authorization
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "get",
|
||||||
|
"url": "/dpi/shipping/v1/orders/{order_id}/shipments".format(
|
||||||
|
order_id=quote(str(order_id), safe=""),
|
||||||
|
),
|
||||||
|
}
|
||||||
|
|
||||||
|
_kwargs["headers"] = headers
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(
|
||||||
|
*, client: AuthenticatedClient | Client, response: httpx.Response
|
||||||
|
) -> CwsErrorDTO | list[Shipment] | None:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = []
|
||||||
|
_response_200 = response.json()
|
||||||
|
for response_200_item_data in _response_200:
|
||||||
|
response_200_item = Shipment.from_dict(response_200_item_data)
|
||||||
|
|
||||||
|
response_200.append(response_200_item)
|
||||||
|
|
||||||
|
return response_200
|
||||||
|
|
||||||
|
if response.status_code == 403:
|
||||||
|
response_403 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_403
|
||||||
|
|
||||||
|
if response.status_code == 404:
|
||||||
|
response_404 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_404
|
||||||
|
|
||||||
|
if response.status_code == 500:
|
||||||
|
response_500 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_500
|
||||||
|
|
||||||
|
if client.raise_on_unexpected_status:
|
||||||
|
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def _build_response(
|
||||||
|
*, client: AuthenticatedClient | Client, response: httpx.Response
|
||||||
|
) -> Response[CwsErrorDTO | list[Shipment]]:
|
||||||
|
return Response(
|
||||||
|
status_code=HTTPStatus(response.status_code),
|
||||||
|
content=response.content,
|
||||||
|
headers=response.headers,
|
||||||
|
parsed=_parse_response(client=client, response=response),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def sync_detailed(
|
||||||
|
order_id: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
) -> Response[CwsErrorDTO | list[Shipment]]:
|
||||||
|
"""Get Shipments for an Order
|
||||||
|
|
||||||
|
Searches shipments attached to an given order. Answers with a not found status (404) if order does
|
||||||
|
not exist or if there are no shipmments attached to this order.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
order_id (str):
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[CwsErrorDTO | list[Shipment]]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
order_id=order_id,
|
||||||
|
authorization=authorization,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
def sync(
|
||||||
|
order_id: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
) -> CwsErrorDTO | list[Shipment] | None:
|
||||||
|
"""Get Shipments for an Order
|
||||||
|
|
||||||
|
Searches shipments attached to an given order. Answers with a not found status (404) if order does
|
||||||
|
not exist or if there are no shipmments attached to this order.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
order_id (str):
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
CwsErrorDTO | list[Shipment]
|
||||||
|
"""
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
order_id=order_id,
|
||||||
|
client=client,
|
||||||
|
authorization=authorization,
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
order_id: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
) -> Response[CwsErrorDTO | list[Shipment]]:
|
||||||
|
"""Get Shipments for an Order
|
||||||
|
|
||||||
|
Searches shipments attached to an given order. Answers with a not found status (404) if order does
|
||||||
|
not exist or if there are no shipmments attached to this order.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
order_id (str):
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[CwsErrorDTO | list[Shipment]]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
order_id=order_id,
|
||||||
|
authorization=authorization,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = await client.get_async_httpx_client().request(**kwargs)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio(
|
||||||
|
order_id: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
) -> CwsErrorDTO | list[Shipment] | None:
|
||||||
|
"""Get Shipments for an Order
|
||||||
|
|
||||||
|
Searches shipments attached to an given order. Answers with a not found status (404) if order does
|
||||||
|
not exist or if there are no shipmments attached to this order.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
order_id (str):
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
CwsErrorDTO | list[Shipment]
|
||||||
|
"""
|
||||||
|
|
||||||
|
return (
|
||||||
|
await asyncio_detailed(
|
||||||
|
order_id=order_id,
|
||||||
|
client=client,
|
||||||
|
authorization=authorization,
|
||||||
|
)
|
||||||
|
).parsed
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
"""Contains endpoint functions for accessing the API"""
|
||||||
@@ -0,0 +1,198 @@
|
|||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any, cast
|
||||||
|
from urllib.parse import quote
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ... import errors
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...models.cws_error_dto import CwsErrorDTO
|
||||||
|
from ...types import Response
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
awb: str,
|
||||||
|
*,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
headers: dict[str, Any] = {}
|
||||||
|
headers["Authorization"] = authorization
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "get",
|
||||||
|
"url": "/dpi/shipping/v1/shipments/{awb}/awblabels".format(
|
||||||
|
awb=quote(str(awb), safe=""),
|
||||||
|
),
|
||||||
|
}
|
||||||
|
|
||||||
|
_kwargs["headers"] = headers
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | CwsErrorDTO | None:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = cast(Any, None)
|
||||||
|
return response_200
|
||||||
|
|
||||||
|
if response.status_code == 403:
|
||||||
|
response_403 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_403
|
||||||
|
|
||||||
|
if response.status_code == 404:
|
||||||
|
response_404 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_404
|
||||||
|
|
||||||
|
if response.status_code == 500:
|
||||||
|
response_500 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_500
|
||||||
|
|
||||||
|
if client.raise_on_unexpected_status:
|
||||||
|
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any | CwsErrorDTO]:
|
||||||
|
return Response(
|
||||||
|
status_code=HTTPStatus(response.status_code),
|
||||||
|
content=response.content,
|
||||||
|
headers=response.headers,
|
||||||
|
parsed=_parse_response(client=client, response=response),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def sync_detailed(
|
||||||
|
awb: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
) -> Response[Any | CwsErrorDTO]:
|
||||||
|
"""Get AWB Label
|
||||||
|
|
||||||
|
For a given shipment awb an awb labels is generated or retrieved from the cache and send to the
|
||||||
|
requestor as a bytestream response.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
awb (str):
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[Any | CwsErrorDTO]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
awb=awb,
|
||||||
|
authorization=authorization,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
def sync(
|
||||||
|
awb: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
) -> Any | CwsErrorDTO | None:
|
||||||
|
"""Get AWB Label
|
||||||
|
|
||||||
|
For a given shipment awb an awb labels is generated or retrieved from the cache and send to the
|
||||||
|
requestor as a bytestream response.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
awb (str):
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Any | CwsErrorDTO
|
||||||
|
"""
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
awb=awb,
|
||||||
|
client=client,
|
||||||
|
authorization=authorization,
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
awb: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
) -> Response[Any | CwsErrorDTO]:
|
||||||
|
"""Get AWB Label
|
||||||
|
|
||||||
|
For a given shipment awb an awb labels is generated or retrieved from the cache and send to the
|
||||||
|
requestor as a bytestream response.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
awb (str):
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[Any | CwsErrorDTO]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
awb=awb,
|
||||||
|
authorization=authorization,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = await client.get_async_httpx_client().request(**kwargs)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio(
|
||||||
|
awb: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
) -> Any | CwsErrorDTO | None:
|
||||||
|
"""Get AWB Label
|
||||||
|
|
||||||
|
For a given shipment awb an awb labels is generated or retrieved from the cache and send to the
|
||||||
|
requestor as a bytestream response.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
awb (str):
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Any | CwsErrorDTO
|
||||||
|
"""
|
||||||
|
|
||||||
|
return (
|
||||||
|
await asyncio_detailed(
|
||||||
|
awb=awb,
|
||||||
|
client=client,
|
||||||
|
authorization=authorization,
|
||||||
|
)
|
||||||
|
).parsed
|
||||||
@@ -0,0 +1,214 @@
|
|||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any, cast
|
||||||
|
from urllib.parse import quote
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ... import errors
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...models.cws_error_dto import CwsErrorDTO
|
||||||
|
from ...models.get_item_labels_accept import GetItemLabelsAccept
|
||||||
|
from ...types import Response
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
awb: str,
|
||||||
|
*,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
accept: GetItemLabelsAccept,
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
headers: dict[str, Any] = {}
|
||||||
|
headers["Authorization"] = authorization
|
||||||
|
|
||||||
|
headers["accept"] = str(accept)
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "get",
|
||||||
|
"url": "/dpi/shipping/v1/shipments/{awb}/itemlabels".format(
|
||||||
|
awb=quote(str(awb), safe=""),
|
||||||
|
),
|
||||||
|
}
|
||||||
|
|
||||||
|
_kwargs["headers"] = headers
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> CwsErrorDTO | str | None:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = cast(str, response.json())
|
||||||
|
return response_200
|
||||||
|
|
||||||
|
if response.status_code == 403:
|
||||||
|
response_403 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_403
|
||||||
|
|
||||||
|
if response.status_code == 404:
|
||||||
|
response_404 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_404
|
||||||
|
|
||||||
|
if response.status_code == 500:
|
||||||
|
response_500 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_500
|
||||||
|
|
||||||
|
if client.raise_on_unexpected_status:
|
||||||
|
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[CwsErrorDTO | str]:
|
||||||
|
return Response(
|
||||||
|
status_code=HTTPStatus(response.status_code),
|
||||||
|
content=response.content,
|
||||||
|
headers=response.headers,
|
||||||
|
parsed=_parse_response(client=client, response=response),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def sync_detailed(
|
||||||
|
awb: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
accept: GetItemLabelsAccept,
|
||||||
|
) -> Response[CwsErrorDTO | str]:
|
||||||
|
"""Get Item Labels
|
||||||
|
|
||||||
|
For a given shipment awb all item labels will be generated or retrieved from the cache and send to
|
||||||
|
the requestor as a bytestream response.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
awb (str):
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
accept (GetItemLabelsAccept):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[CwsErrorDTO | str]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
awb=awb,
|
||||||
|
authorization=authorization,
|
||||||
|
accept=accept,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
def sync(
|
||||||
|
awb: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
accept: GetItemLabelsAccept,
|
||||||
|
) -> CwsErrorDTO | str | None:
|
||||||
|
"""Get Item Labels
|
||||||
|
|
||||||
|
For a given shipment awb all item labels will be generated or retrieved from the cache and send to
|
||||||
|
the requestor as a bytestream response.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
awb (str):
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
accept (GetItemLabelsAccept):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
CwsErrorDTO | str
|
||||||
|
"""
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
awb=awb,
|
||||||
|
client=client,
|
||||||
|
authorization=authorization,
|
||||||
|
accept=accept,
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
awb: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
accept: GetItemLabelsAccept,
|
||||||
|
) -> Response[CwsErrorDTO | str]:
|
||||||
|
"""Get Item Labels
|
||||||
|
|
||||||
|
For a given shipment awb all item labels will be generated or retrieved from the cache and send to
|
||||||
|
the requestor as a bytestream response.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
awb (str):
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
accept (GetItemLabelsAccept):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[CwsErrorDTO | str]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
awb=awb,
|
||||||
|
authorization=authorization,
|
||||||
|
accept=accept,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = await client.get_async_httpx_client().request(**kwargs)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio(
|
||||||
|
awb: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
accept: GetItemLabelsAccept,
|
||||||
|
) -> CwsErrorDTO | str | None:
|
||||||
|
"""Get Item Labels
|
||||||
|
|
||||||
|
For a given shipment awb all item labels will be generated or retrieved from the cache and send to
|
||||||
|
the requestor as a bytestream response.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
awb (str):
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
accept (GetItemLabelsAccept):
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
CwsErrorDTO | str
|
||||||
|
"""
|
||||||
|
|
||||||
|
return (
|
||||||
|
await asyncio_detailed(
|
||||||
|
awb=awb,
|
||||||
|
client=client,
|
||||||
|
authorization=authorization,
|
||||||
|
accept=accept,
|
||||||
|
)
|
||||||
|
).parsed
|
||||||
@@ -0,0 +1,198 @@
|
|||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any
|
||||||
|
from urllib.parse import quote
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ... import errors
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...models.cws_error_dto import CwsErrorDTO
|
||||||
|
from ...models.shipment import Shipment
|
||||||
|
from ...types import Response
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
awb: str,
|
||||||
|
*,
|
||||||
|
authorization: str = "Bearer [place access_token token here, without brackets]",
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
headers: dict[str, Any] = {}
|
||||||
|
headers["Authorization"] = authorization
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "get",
|
||||||
|
"url": "/dpi/shipping/v1/shipments/{awb}".format(
|
||||||
|
awb=quote(str(awb), safe=""),
|
||||||
|
),
|
||||||
|
}
|
||||||
|
|
||||||
|
_kwargs["headers"] = headers
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> CwsErrorDTO | Shipment | None:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = Shipment.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_200
|
||||||
|
|
||||||
|
if response.status_code == 403:
|
||||||
|
response_403 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_403
|
||||||
|
|
||||||
|
if response.status_code == 404:
|
||||||
|
response_404 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_404
|
||||||
|
|
||||||
|
if response.status_code == 500:
|
||||||
|
response_500 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_500
|
||||||
|
|
||||||
|
if client.raise_on_unexpected_status:
|
||||||
|
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def _build_response(
|
||||||
|
*, client: AuthenticatedClient | Client, response: httpx.Response
|
||||||
|
) -> Response[CwsErrorDTO | Shipment]:
|
||||||
|
return Response(
|
||||||
|
status_code=HTTPStatus(response.status_code),
|
||||||
|
content=response.content,
|
||||||
|
headers=response.headers,
|
||||||
|
parsed=_parse_response(client=client, response=response),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def sync_detailed(
|
||||||
|
awb: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
authorization: str = "Bearer [place access_token token here, without brackets]",
|
||||||
|
) -> Response[CwsErrorDTO | Shipment]:
|
||||||
|
"""Get Shipment Data for AWB
|
||||||
|
|
||||||
|
For a given shipment awb all available data will be send.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
awb (str):
|
||||||
|
authorization (str): Default: 'Bearer [place access_token token here, without
|
||||||
|
brackets]'.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[CwsErrorDTO | Shipment]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
awb=awb,
|
||||||
|
authorization=authorization,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
def sync(
|
||||||
|
awb: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
authorization: str = "Bearer [place access_token token here, without brackets]",
|
||||||
|
) -> CwsErrorDTO | Shipment | None:
|
||||||
|
"""Get Shipment Data for AWB
|
||||||
|
|
||||||
|
For a given shipment awb all available data will be send.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
awb (str):
|
||||||
|
authorization (str): Default: 'Bearer [place access_token token here, without
|
||||||
|
brackets]'.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
CwsErrorDTO | Shipment
|
||||||
|
"""
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
awb=awb,
|
||||||
|
client=client,
|
||||||
|
authorization=authorization,
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
awb: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
authorization: str = "Bearer [place access_token token here, without brackets]",
|
||||||
|
) -> Response[CwsErrorDTO | Shipment]:
|
||||||
|
"""Get Shipment Data for AWB
|
||||||
|
|
||||||
|
For a given shipment awb all available data will be send.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
awb (str):
|
||||||
|
authorization (str): Default: 'Bearer [place access_token token here, without
|
||||||
|
brackets]'.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[CwsErrorDTO | Shipment]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
awb=awb,
|
||||||
|
authorization=authorization,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = await client.get_async_httpx_client().request(**kwargs)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio(
|
||||||
|
awb: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
authorization: str = "Bearer [place access_token token here, without brackets]",
|
||||||
|
) -> CwsErrorDTO | Shipment | None:
|
||||||
|
"""Get Shipment Data for AWB
|
||||||
|
|
||||||
|
For a given shipment awb all available data will be send.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
awb (str):
|
||||||
|
authorization (str): Default: 'Bearer [place access_token token here, without
|
||||||
|
brackets]'.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
CwsErrorDTO | Shipment
|
||||||
|
"""
|
||||||
|
|
||||||
|
return (
|
||||||
|
await asyncio_detailed(
|
||||||
|
awb=awb,
|
||||||
|
client=client,
|
||||||
|
authorization=authorization,
|
||||||
|
)
|
||||||
|
).parsed
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
"""Contains endpoint functions for accessing the API"""
|
||||||
@@ -0,0 +1,205 @@
|
|||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any
|
||||||
|
from urllib.parse import quote
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ... import errors
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...models.cws_error_dto import CwsErrorDTO
|
||||||
|
from ...types import UNSET, Response, Unset
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
customer_bag_id: str,
|
||||||
|
*,
|
||||||
|
matching: bool | Unset = False,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
headers: dict[str, Any] = {}
|
||||||
|
headers["Authorization"] = authorization
|
||||||
|
|
||||||
|
params: dict[str, Any] = {}
|
||||||
|
|
||||||
|
params["matching"] = matching
|
||||||
|
|
||||||
|
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "get",
|
||||||
|
"url": "/dpi/tracking/v3/bag/{customer_bag_id}".format(
|
||||||
|
customer_bag_id=quote(str(customer_bag_id), safe=""),
|
||||||
|
),
|
||||||
|
"params": params,
|
||||||
|
}
|
||||||
|
|
||||||
|
_kwargs["headers"] = headers
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> CwsErrorDTO | None:
|
||||||
|
if response.status_code == 404:
|
||||||
|
response_404 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_404
|
||||||
|
|
||||||
|
if response.status_code == 500:
|
||||||
|
response_500 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_500
|
||||||
|
|
||||||
|
if client.raise_on_unexpected_status:
|
||||||
|
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[CwsErrorDTO]:
|
||||||
|
return Response(
|
||||||
|
status_code=HTTPStatus(response.status_code),
|
||||||
|
content=response.content,
|
||||||
|
headers=response.headers,
|
||||||
|
parsed=_parse_response(client=client, response=response),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def sync_detailed(
|
||||||
|
customer_bag_id: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
matching: bool | Unset = False,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
) -> Response[CwsErrorDTO]:
|
||||||
|
"""Get Trackings of bags V3
|
||||||
|
|
||||||
|
Get all tracking information of for the bag (identified by the given barcode).
|
||||||
|
|
||||||
|
Args:
|
||||||
|
customer_bag_id (str):
|
||||||
|
matching (bool | Unset): Default: False.
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[CwsErrorDTO]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
customer_bag_id=customer_bag_id,
|
||||||
|
matching=matching,
|
||||||
|
authorization=authorization,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
def sync(
|
||||||
|
customer_bag_id: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
matching: bool | Unset = False,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
) -> CwsErrorDTO | None:
|
||||||
|
"""Get Trackings of bags V3
|
||||||
|
|
||||||
|
Get all tracking information of for the bag (identified by the given barcode).
|
||||||
|
|
||||||
|
Args:
|
||||||
|
customer_bag_id (str):
|
||||||
|
matching (bool | Unset): Default: False.
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
CwsErrorDTO
|
||||||
|
"""
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
customer_bag_id=customer_bag_id,
|
||||||
|
client=client,
|
||||||
|
matching=matching,
|
||||||
|
authorization=authorization,
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
customer_bag_id: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
matching: bool | Unset = False,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
) -> Response[CwsErrorDTO]:
|
||||||
|
"""Get Trackings of bags V3
|
||||||
|
|
||||||
|
Get all tracking information of for the bag (identified by the given barcode).
|
||||||
|
|
||||||
|
Args:
|
||||||
|
customer_bag_id (str):
|
||||||
|
matching (bool | Unset): Default: False.
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[CwsErrorDTO]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
customer_bag_id=customer_bag_id,
|
||||||
|
matching=matching,
|
||||||
|
authorization=authorization,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = await client.get_async_httpx_client().request(**kwargs)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio(
|
||||||
|
customer_bag_id: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
matching: bool | Unset = False,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
) -> CwsErrorDTO | None:
|
||||||
|
"""Get Trackings of bags V3
|
||||||
|
|
||||||
|
Get all tracking information of for the bag (identified by the given barcode).
|
||||||
|
|
||||||
|
Args:
|
||||||
|
customer_bag_id (str):
|
||||||
|
matching (bool | Unset): Default: False.
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
CwsErrorDTO
|
||||||
|
"""
|
||||||
|
|
||||||
|
return (
|
||||||
|
await asyncio_detailed(
|
||||||
|
customer_bag_id=customer_bag_id,
|
||||||
|
client=client,
|
||||||
|
matching=matching,
|
||||||
|
authorization=authorization,
|
||||||
|
)
|
||||||
|
).parsed
|
||||||
@@ -0,0 +1,233 @@
|
|||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any
|
||||||
|
from urllib.parse import quote
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ... import errors
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...models.cws_error_dto import CwsErrorDTO
|
||||||
|
from ...types import UNSET, Response, Unset
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
awb: str,
|
||||||
|
*,
|
||||||
|
language: str | Unset = "en",
|
||||||
|
with_event_type: bool | Unset = False,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
headers: dict[str, Any] = {}
|
||||||
|
headers["Authorization"] = authorization
|
||||||
|
|
||||||
|
params: dict[str, Any] = {}
|
||||||
|
|
||||||
|
params["language"] = language
|
||||||
|
|
||||||
|
params["withEventType"] = with_event_type
|
||||||
|
|
||||||
|
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "get",
|
||||||
|
"url": "/dpi/tracking/v3/trackings/awb/{awb}".format(
|
||||||
|
awb=quote(str(awb), safe=""),
|
||||||
|
),
|
||||||
|
"params": params,
|
||||||
|
}
|
||||||
|
|
||||||
|
_kwargs["headers"] = headers
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> CwsErrorDTO | None:
|
||||||
|
if response.status_code == 403:
|
||||||
|
response_403 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_403
|
||||||
|
|
||||||
|
if response.status_code == 404:
|
||||||
|
response_404 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_404
|
||||||
|
|
||||||
|
if response.status_code == 500:
|
||||||
|
response_500 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_500
|
||||||
|
|
||||||
|
if client.raise_on_unexpected_status:
|
||||||
|
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[CwsErrorDTO]:
|
||||||
|
return Response(
|
||||||
|
status_code=HTTPStatus(response.status_code),
|
||||||
|
content=response.content,
|
||||||
|
headers=response.headers,
|
||||||
|
parsed=_parse_response(client=client, response=response),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def sync_detailed(
|
||||||
|
awb: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
language: str | Unset = "en",
|
||||||
|
with_event_type: bool | Unset = False,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
) -> Response[CwsErrorDTO]:
|
||||||
|
"""Get Tracking - Shipment V3
|
||||||
|
|
||||||
|
Get tracking information of all items of a shipment (identified by the given awb). More detailed
|
||||||
|
breakdown of track events compared to v1 but possibly more inconsisteny, duplicity and wrong
|
||||||
|
tracking order
|
||||||
|
|
||||||
|
Args:
|
||||||
|
awb (str):
|
||||||
|
language (str | Unset): Default: 'en'.
|
||||||
|
with_event_type (bool | Unset): Default: False.
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[CwsErrorDTO]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
awb=awb,
|
||||||
|
language=language,
|
||||||
|
with_event_type=with_event_type,
|
||||||
|
authorization=authorization,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
def sync(
|
||||||
|
awb: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
language: str | Unset = "en",
|
||||||
|
with_event_type: bool | Unset = False,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
) -> CwsErrorDTO | None:
|
||||||
|
"""Get Tracking - Shipment V3
|
||||||
|
|
||||||
|
Get tracking information of all items of a shipment (identified by the given awb). More detailed
|
||||||
|
breakdown of track events compared to v1 but possibly more inconsisteny, duplicity and wrong
|
||||||
|
tracking order
|
||||||
|
|
||||||
|
Args:
|
||||||
|
awb (str):
|
||||||
|
language (str | Unset): Default: 'en'.
|
||||||
|
with_event_type (bool | Unset): Default: False.
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
CwsErrorDTO
|
||||||
|
"""
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
awb=awb,
|
||||||
|
client=client,
|
||||||
|
language=language,
|
||||||
|
with_event_type=with_event_type,
|
||||||
|
authorization=authorization,
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
awb: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
language: str | Unset = "en",
|
||||||
|
with_event_type: bool | Unset = False,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
) -> Response[CwsErrorDTO]:
|
||||||
|
"""Get Tracking - Shipment V3
|
||||||
|
|
||||||
|
Get tracking information of all items of a shipment (identified by the given awb). More detailed
|
||||||
|
breakdown of track events compared to v1 but possibly more inconsisteny, duplicity and wrong
|
||||||
|
tracking order
|
||||||
|
|
||||||
|
Args:
|
||||||
|
awb (str):
|
||||||
|
language (str | Unset): Default: 'en'.
|
||||||
|
with_event_type (bool | Unset): Default: False.
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[CwsErrorDTO]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
awb=awb,
|
||||||
|
language=language,
|
||||||
|
with_event_type=with_event_type,
|
||||||
|
authorization=authorization,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = await client.get_async_httpx_client().request(**kwargs)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio(
|
||||||
|
awb: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
language: str | Unset = "en",
|
||||||
|
with_event_type: bool | Unset = False,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
) -> CwsErrorDTO | None:
|
||||||
|
"""Get Tracking - Shipment V3
|
||||||
|
|
||||||
|
Get tracking information of all items of a shipment (identified by the given awb). More detailed
|
||||||
|
breakdown of track events compared to v1 but possibly more inconsisteny, duplicity and wrong
|
||||||
|
tracking order
|
||||||
|
|
||||||
|
Args:
|
||||||
|
awb (str):
|
||||||
|
language (str | Unset): Default: 'en'.
|
||||||
|
with_event_type (bool | Unset): Default: False.
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
CwsErrorDTO
|
||||||
|
"""
|
||||||
|
|
||||||
|
return (
|
||||||
|
await asyncio_detailed(
|
||||||
|
awb=awb,
|
||||||
|
client=client,
|
||||||
|
language=language,
|
||||||
|
with_event_type=with_event_type,
|
||||||
|
authorization=authorization,
|
||||||
|
)
|
||||||
|
).parsed
|
||||||
@@ -0,0 +1,205 @@
|
|||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any
|
||||||
|
from urllib.parse import quote
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ... import errors
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...models.cws_error_dto import CwsErrorDTO
|
||||||
|
from ...models.tracking import Tracking
|
||||||
|
from ...types import Response
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
awb: str,
|
||||||
|
*,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
headers: dict[str, Any] = {}
|
||||||
|
headers["Authorization"] = authorization
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "get",
|
||||||
|
"url": "/dpi/tracking/v1/trackings/awb/{awb}".format(
|
||||||
|
awb=quote(str(awb), safe=""),
|
||||||
|
),
|
||||||
|
}
|
||||||
|
|
||||||
|
_kwargs["headers"] = headers
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(
|
||||||
|
*, client: AuthenticatedClient | Client, response: httpx.Response
|
||||||
|
) -> CwsErrorDTO | list[Tracking] | None:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = []
|
||||||
|
_response_200 = response.json()
|
||||||
|
for response_200_item_data in _response_200:
|
||||||
|
response_200_item = Tracking.from_dict(response_200_item_data)
|
||||||
|
|
||||||
|
response_200.append(response_200_item)
|
||||||
|
|
||||||
|
return response_200
|
||||||
|
|
||||||
|
if response.status_code == 403:
|
||||||
|
response_403 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_403
|
||||||
|
|
||||||
|
if response.status_code == 404:
|
||||||
|
response_404 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_404
|
||||||
|
|
||||||
|
if response.status_code == 500:
|
||||||
|
response_500 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_500
|
||||||
|
|
||||||
|
if client.raise_on_unexpected_status:
|
||||||
|
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def _build_response(
|
||||||
|
*, client: AuthenticatedClient | Client, response: httpx.Response
|
||||||
|
) -> Response[CwsErrorDTO | list[Tracking]]:
|
||||||
|
return Response(
|
||||||
|
status_code=HTTPStatus(response.status_code),
|
||||||
|
content=response.content,
|
||||||
|
headers=response.headers,
|
||||||
|
parsed=_parse_response(client=client, response=response),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def sync_detailed(
|
||||||
|
awb: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
) -> Response[CwsErrorDTO | list[Tracking]]:
|
||||||
|
"""Get Tracking - Shipment V1
|
||||||
|
|
||||||
|
Get tracking information of all items of a shipment (identified by the given awb).
|
||||||
|
|
||||||
|
Args:
|
||||||
|
awb (str):
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[CwsErrorDTO | list[Tracking]]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
awb=awb,
|
||||||
|
authorization=authorization,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
def sync(
|
||||||
|
awb: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
) -> CwsErrorDTO | list[Tracking] | None:
|
||||||
|
"""Get Tracking - Shipment V1
|
||||||
|
|
||||||
|
Get tracking information of all items of a shipment (identified by the given awb).
|
||||||
|
|
||||||
|
Args:
|
||||||
|
awb (str):
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
CwsErrorDTO | list[Tracking]
|
||||||
|
"""
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
awb=awb,
|
||||||
|
client=client,
|
||||||
|
authorization=authorization,
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
awb: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
) -> Response[CwsErrorDTO | list[Tracking]]:
|
||||||
|
"""Get Tracking - Shipment V1
|
||||||
|
|
||||||
|
Get tracking information of all items of a shipment (identified by the given awb).
|
||||||
|
|
||||||
|
Args:
|
||||||
|
awb (str):
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[CwsErrorDTO | list[Tracking]]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
awb=awb,
|
||||||
|
authorization=authorization,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = await client.get_async_httpx_client().request(**kwargs)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio(
|
||||||
|
awb: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
) -> CwsErrorDTO | list[Tracking] | None:
|
||||||
|
"""Get Tracking - Shipment V1
|
||||||
|
|
||||||
|
Get tracking information of all items of a shipment (identified by the given awb).
|
||||||
|
|
||||||
|
Args:
|
||||||
|
awb (str):
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
CwsErrorDTO | list[Tracking]
|
||||||
|
"""
|
||||||
|
|
||||||
|
return (
|
||||||
|
await asyncio_detailed(
|
||||||
|
awb=awb,
|
||||||
|
client=client,
|
||||||
|
authorization=authorization,
|
||||||
|
)
|
||||||
|
).parsed
|
||||||
@@ -0,0 +1,193 @@
|
|||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any
|
||||||
|
from urllib.parse import quote
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ... import errors
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...models.cws_error_dto import CwsErrorDTO
|
||||||
|
from ...models.tracking import Tracking
|
||||||
|
from ...types import Response
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
barcode: str,
|
||||||
|
*,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
headers: dict[str, Any] = {}
|
||||||
|
headers["Authorization"] = authorization
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "get",
|
||||||
|
"url": "/dpi/tracking/v1/trackings/{barcode}".format(
|
||||||
|
barcode=quote(str(barcode), safe=""),
|
||||||
|
),
|
||||||
|
}
|
||||||
|
|
||||||
|
_kwargs["headers"] = headers
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> CwsErrorDTO | Tracking | None:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = Tracking.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_200
|
||||||
|
|
||||||
|
if response.status_code == 404:
|
||||||
|
response_404 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_404
|
||||||
|
|
||||||
|
if response.status_code == 500:
|
||||||
|
response_500 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_500
|
||||||
|
|
||||||
|
if client.raise_on_unexpected_status:
|
||||||
|
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def _build_response(
|
||||||
|
*, client: AuthenticatedClient | Client, response: httpx.Response
|
||||||
|
) -> Response[CwsErrorDTO | Tracking]:
|
||||||
|
return Response(
|
||||||
|
status_code=HTTPStatus(response.status_code),
|
||||||
|
content=response.content,
|
||||||
|
headers=response.headers,
|
||||||
|
parsed=_parse_response(client=client, response=response),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def sync_detailed(
|
||||||
|
barcode: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
) -> Response[CwsErrorDTO | Tracking]:
|
||||||
|
"""Get Trackings V1
|
||||||
|
|
||||||
|
Get all tracking information of for the item (identified by the given barcode).
|
||||||
|
|
||||||
|
Args:
|
||||||
|
barcode (str):
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[CwsErrorDTO | Tracking]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
barcode=barcode,
|
||||||
|
authorization=authorization,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
def sync(
|
||||||
|
barcode: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
) -> CwsErrorDTO | Tracking | None:
|
||||||
|
"""Get Trackings V1
|
||||||
|
|
||||||
|
Get all tracking information of for the item (identified by the given barcode).
|
||||||
|
|
||||||
|
Args:
|
||||||
|
barcode (str):
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
CwsErrorDTO | Tracking
|
||||||
|
"""
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
barcode=barcode,
|
||||||
|
client=client,
|
||||||
|
authorization=authorization,
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
barcode: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
) -> Response[CwsErrorDTO | Tracking]:
|
||||||
|
"""Get Trackings V1
|
||||||
|
|
||||||
|
Get all tracking information of for the item (identified by the given barcode).
|
||||||
|
|
||||||
|
Args:
|
||||||
|
barcode (str):
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[CwsErrorDTO | Tracking]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
barcode=barcode,
|
||||||
|
authorization=authorization,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = await client.get_async_httpx_client().request(**kwargs)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio(
|
||||||
|
barcode: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
) -> CwsErrorDTO | Tracking | None:
|
||||||
|
"""Get Trackings V1
|
||||||
|
|
||||||
|
Get all tracking information of for the item (identified by the given barcode).
|
||||||
|
|
||||||
|
Args:
|
||||||
|
barcode (str):
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
CwsErrorDTO | Tracking
|
||||||
|
"""
|
||||||
|
|
||||||
|
return (
|
||||||
|
await asyncio_detailed(
|
||||||
|
barcode=barcode,
|
||||||
|
client=client,
|
||||||
|
authorization=authorization,
|
||||||
|
)
|
||||||
|
).parsed
|
||||||
@@ -0,0 +1,224 @@
|
|||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any
|
||||||
|
from urllib.parse import quote
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ... import errors
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...models.cws_error_dto import CwsErrorDTO
|
||||||
|
from ...types import UNSET, Response, Unset
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
barcode: str,
|
||||||
|
*,
|
||||||
|
language: str | Unset = "en",
|
||||||
|
with_event_type: bool | Unset = False,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
headers: dict[str, Any] = {}
|
||||||
|
headers["Authorization"] = authorization
|
||||||
|
|
||||||
|
params: dict[str, Any] = {}
|
||||||
|
|
||||||
|
params["language"] = language
|
||||||
|
|
||||||
|
params["withEventType"] = with_event_type
|
||||||
|
|
||||||
|
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "get",
|
||||||
|
"url": "/dpi/tracking/v3/trackings/{barcode}".format(
|
||||||
|
barcode=quote(str(barcode), safe=""),
|
||||||
|
),
|
||||||
|
"params": params,
|
||||||
|
}
|
||||||
|
|
||||||
|
_kwargs["headers"] = headers
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> CwsErrorDTO | None:
|
||||||
|
if response.status_code == 404:
|
||||||
|
response_404 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_404
|
||||||
|
|
||||||
|
if response.status_code == 500:
|
||||||
|
response_500 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_500
|
||||||
|
|
||||||
|
if client.raise_on_unexpected_status:
|
||||||
|
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[CwsErrorDTO]:
|
||||||
|
return Response(
|
||||||
|
status_code=HTTPStatus(response.status_code),
|
||||||
|
content=response.content,
|
||||||
|
headers=response.headers,
|
||||||
|
parsed=_parse_response(client=client, response=response),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def sync_detailed(
|
||||||
|
barcode: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
language: str | Unset = "en",
|
||||||
|
with_event_type: bool | Unset = False,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
) -> Response[CwsErrorDTO]:
|
||||||
|
"""Get Trackings V3
|
||||||
|
|
||||||
|
Get all tracking information for the item (identified by the given barcode). More detailed breakdown
|
||||||
|
of track events compared to v1 but possibly more inconsisteny, duplicity and wrong tracking order
|
||||||
|
|
||||||
|
Args:
|
||||||
|
barcode (str):
|
||||||
|
language (str | Unset): Default: 'en'.
|
||||||
|
with_event_type (bool | Unset): Default: False.
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[CwsErrorDTO]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
barcode=barcode,
|
||||||
|
language=language,
|
||||||
|
with_event_type=with_event_type,
|
||||||
|
authorization=authorization,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
def sync(
|
||||||
|
barcode: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
language: str | Unset = "en",
|
||||||
|
with_event_type: bool | Unset = False,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
) -> CwsErrorDTO | None:
|
||||||
|
"""Get Trackings V3
|
||||||
|
|
||||||
|
Get all tracking information for the item (identified by the given barcode). More detailed breakdown
|
||||||
|
of track events compared to v1 but possibly more inconsisteny, duplicity and wrong tracking order
|
||||||
|
|
||||||
|
Args:
|
||||||
|
barcode (str):
|
||||||
|
language (str | Unset): Default: 'en'.
|
||||||
|
with_event_type (bool | Unset): Default: False.
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
CwsErrorDTO
|
||||||
|
"""
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
barcode=barcode,
|
||||||
|
client=client,
|
||||||
|
language=language,
|
||||||
|
with_event_type=with_event_type,
|
||||||
|
authorization=authorization,
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
barcode: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
language: str | Unset = "en",
|
||||||
|
with_event_type: bool | Unset = False,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
) -> Response[CwsErrorDTO]:
|
||||||
|
"""Get Trackings V3
|
||||||
|
|
||||||
|
Get all tracking information for the item (identified by the given barcode). More detailed breakdown
|
||||||
|
of track events compared to v1 but possibly more inconsisteny, duplicity and wrong tracking order
|
||||||
|
|
||||||
|
Args:
|
||||||
|
barcode (str):
|
||||||
|
language (str | Unset): Default: 'en'.
|
||||||
|
with_event_type (bool | Unset): Default: False.
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[CwsErrorDTO]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
barcode=barcode,
|
||||||
|
language=language,
|
||||||
|
with_event_type=with_event_type,
|
||||||
|
authorization=authorization,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = await client.get_async_httpx_client().request(**kwargs)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio(
|
||||||
|
barcode: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
language: str | Unset = "en",
|
||||||
|
with_event_type: bool | Unset = False,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
) -> CwsErrorDTO | None:
|
||||||
|
"""Get Trackings V3
|
||||||
|
|
||||||
|
Get all tracking information for the item (identified by the given barcode). More detailed breakdown
|
||||||
|
of track events compared to v1 but possibly more inconsisteny, duplicity and wrong tracking order
|
||||||
|
|
||||||
|
Args:
|
||||||
|
barcode (str):
|
||||||
|
language (str | Unset): Default: 'en'.
|
||||||
|
with_event_type (bool | Unset): Default: False.
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
CwsErrorDTO
|
||||||
|
"""
|
||||||
|
|
||||||
|
return (
|
||||||
|
await asyncio_detailed(
|
||||||
|
barcode=barcode,
|
||||||
|
client=client,
|
||||||
|
language=language,
|
||||||
|
with_event_type=with_event_type,
|
||||||
|
authorization=authorization,
|
||||||
|
)
|
||||||
|
).parsed
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
"""Contains endpoint functions for accessing the API"""
|
||||||
@@ -0,0 +1,251 @@
|
|||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ... import errors
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...models.cws_error_dto import CwsErrorDTO
|
||||||
|
from ...models.validation import Validation
|
||||||
|
from ...types import UNSET, Response, Unset
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
*,
|
||||||
|
body: Validation,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
third_party_vendor_id: str | Unset = UNSET,
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
headers: dict[str, Any] = {}
|
||||||
|
headers["Authorization"] = authorization
|
||||||
|
|
||||||
|
if not isinstance(third_party_vendor_id, Unset):
|
||||||
|
headers["ThirdPartyVendor-ID"] = third_party_vendor_id
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "post",
|
||||||
|
"url": "/dpi/shipping/v1/validation",
|
||||||
|
}
|
||||||
|
|
||||||
|
_kwargs["json"] = body.to_dict()
|
||||||
|
|
||||||
|
headers["Content-Type"] = "application/json"
|
||||||
|
|
||||||
|
_kwargs["headers"] = headers
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(
|
||||||
|
*, client: AuthenticatedClient | Client, response: httpx.Response
|
||||||
|
) -> CwsErrorDTO | Validation | None:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = Validation.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_200
|
||||||
|
|
||||||
|
if response.status_code == 400:
|
||||||
|
response_400 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_400
|
||||||
|
|
||||||
|
if response.status_code == 401:
|
||||||
|
response_401 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_401
|
||||||
|
|
||||||
|
if response.status_code == 406:
|
||||||
|
response_406 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_406
|
||||||
|
|
||||||
|
if response.status_code == 422:
|
||||||
|
response_422 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_422
|
||||||
|
|
||||||
|
if response.status_code == 500:
|
||||||
|
response_500 = CwsErrorDTO.from_dict(response.json())
|
||||||
|
|
||||||
|
return response_500
|
||||||
|
|
||||||
|
if client.raise_on_unexpected_status:
|
||||||
|
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def _build_response(
|
||||||
|
*, client: AuthenticatedClient | Client, response: httpx.Response
|
||||||
|
) -> Response[CwsErrorDTO | Validation]:
|
||||||
|
return Response(
|
||||||
|
status_code=HTTPStatus(response.status_code),
|
||||||
|
content=response.content,
|
||||||
|
headers=response.headers,
|
||||||
|
parsed=_parse_response(client=client, response=response),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def sync_detailed(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
body: Validation,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
third_party_vendor_id: str | Unset = UNSET,
|
||||||
|
) -> Response[CwsErrorDTO | Validation]:
|
||||||
|
"""Validate Order Items
|
||||||
|
|
||||||
|
Validate OrderItems, required by efiliale
|
||||||
|
|
||||||
|
Args:
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
third_party_vendor_id (str | Unset):
|
||||||
|
body (Validation): Example: {'customerEkp': '9012345678', 'items': [{'product': 'GMP',
|
||||||
|
'serviceLevel': 'PRIORITY', 'custRef': '02 03 02 02 T005', 'recipient': 'Herschel
|
||||||
|
Krustofsky', 'recipientPhone': '', 'recipientFax': '', 'recipientEmail': '',
|
||||||
|
'addressLine1': 'Avenue des Champs-Élysées', 'addressLine2': '', 'addressLine3': '103',
|
||||||
|
'city': 'Paris', 'state': 'Île-de-France', 'postalCode': '75020', 'destinationCountry':
|
||||||
|
'FR', 'returnItemWanted': False, 'shipmentAmount': 0, 'shipmentCurrency': 'EUR',
|
||||||
|
'shipmentGrossWeight': 500}]}.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[CwsErrorDTO | Validation]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
body=body,
|
||||||
|
authorization=authorization,
|
||||||
|
third_party_vendor_id=third_party_vendor_id,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
def sync(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
body: Validation,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
third_party_vendor_id: str | Unset = UNSET,
|
||||||
|
) -> CwsErrorDTO | Validation | None:
|
||||||
|
"""Validate Order Items
|
||||||
|
|
||||||
|
Validate OrderItems, required by efiliale
|
||||||
|
|
||||||
|
Args:
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
third_party_vendor_id (str | Unset):
|
||||||
|
body (Validation): Example: {'customerEkp': '9012345678', 'items': [{'product': 'GMP',
|
||||||
|
'serviceLevel': 'PRIORITY', 'custRef': '02 03 02 02 T005', 'recipient': 'Herschel
|
||||||
|
Krustofsky', 'recipientPhone': '', 'recipientFax': '', 'recipientEmail': '',
|
||||||
|
'addressLine1': 'Avenue des Champs-Élysées', 'addressLine2': '', 'addressLine3': '103',
|
||||||
|
'city': 'Paris', 'state': 'Île-de-France', 'postalCode': '75020', 'destinationCountry':
|
||||||
|
'FR', 'returnItemWanted': False, 'shipmentAmount': 0, 'shipmentCurrency': 'EUR',
|
||||||
|
'shipmentGrossWeight': 500}]}.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
CwsErrorDTO | Validation
|
||||||
|
"""
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
client=client,
|
||||||
|
body=body,
|
||||||
|
authorization=authorization,
|
||||||
|
third_party_vendor_id=third_party_vendor_id,
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
body: Validation,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
third_party_vendor_id: str | Unset = UNSET,
|
||||||
|
) -> Response[CwsErrorDTO | Validation]:
|
||||||
|
"""Validate Order Items
|
||||||
|
|
||||||
|
Validate OrderItems, required by efiliale
|
||||||
|
|
||||||
|
Args:
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
third_party_vendor_id (str | Unset):
|
||||||
|
body (Validation): Example: {'customerEkp': '9012345678', 'items': [{'product': 'GMP',
|
||||||
|
'serviceLevel': 'PRIORITY', 'custRef': '02 03 02 02 T005', 'recipient': 'Herschel
|
||||||
|
Krustofsky', 'recipientPhone': '', 'recipientFax': '', 'recipientEmail': '',
|
||||||
|
'addressLine1': 'Avenue des Champs-Élysées', 'addressLine2': '', 'addressLine3': '103',
|
||||||
|
'city': 'Paris', 'state': 'Île-de-France', 'postalCode': '75020', 'destinationCountry':
|
||||||
|
'FR', 'returnItemWanted': False, 'shipmentAmount': 0, 'shipmentCurrency': 'EUR',
|
||||||
|
'shipmentGrossWeight': 500}]}.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Response[CwsErrorDTO | Validation]
|
||||||
|
"""
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
body=body,
|
||||||
|
authorization=authorization,
|
||||||
|
third_party_vendor_id=third_party_vendor_id,
|
||||||
|
)
|
||||||
|
|
||||||
|
response = await client.get_async_httpx_client().request(**kwargs)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient | Client,
|
||||||
|
body: Validation,
|
||||||
|
authorization: str = "Bearer [place OAuth access_token here, without brackets]",
|
||||||
|
third_party_vendor_id: str | Unset = UNSET,
|
||||||
|
) -> CwsErrorDTO | Validation | None:
|
||||||
|
"""Validate Order Items
|
||||||
|
|
||||||
|
Validate OrderItems, required by efiliale
|
||||||
|
|
||||||
|
Args:
|
||||||
|
authorization (str): Default: 'Bearer [place OAuth access_token here, without
|
||||||
|
brackets]'.
|
||||||
|
third_party_vendor_id (str | Unset):
|
||||||
|
body (Validation): Example: {'customerEkp': '9012345678', 'items': [{'product': 'GMP',
|
||||||
|
'serviceLevel': 'PRIORITY', 'custRef': '02 03 02 02 T005', 'recipient': 'Herschel
|
||||||
|
Krustofsky', 'recipientPhone': '', 'recipientFax': '', 'recipientEmail': '',
|
||||||
|
'addressLine1': 'Avenue des Champs-Élysées', 'addressLine2': '', 'addressLine3': '103',
|
||||||
|
'city': 'Paris', 'state': 'Île-de-France', 'postalCode': '75020', 'destinationCountry':
|
||||||
|
'FR', 'returnItemWanted': False, 'shipmentAmount': 0, 'shipmentCurrency': 'EUR',
|
||||||
|
'shipmentGrossWeight': 500}]}.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||||
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
CwsErrorDTO | Validation
|
||||||
|
"""
|
||||||
|
|
||||||
|
return (
|
||||||
|
await asyncio_detailed(
|
||||||
|
client=client,
|
||||||
|
body=body,
|
||||||
|
authorization=authorization,
|
||||||
|
third_party_vendor_id=third_party_vendor_id,
|
||||||
|
)
|
||||||
|
).parsed
|
||||||
268
backend/thirdparty/deutschepost/client/deutsche_post_international_shipping_api_client/client.py
vendored
Normal file
268
backend/thirdparty/deutschepost/client/deutsche_post_international_shipping_api_client/client.py
vendored
Normal file
@@ -0,0 +1,268 @@
|
|||||||
|
import ssl
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
from attrs import define, evolve, field
|
||||||
|
|
||||||
|
|
||||||
|
@define
|
||||||
|
class Client:
|
||||||
|
"""A class for keeping track of data related to the API
|
||||||
|
|
||||||
|
The following are accepted as keyword arguments and will be used to construct httpx Clients internally:
|
||||||
|
|
||||||
|
``base_url``: The base URL for the API, all requests are made to a relative path to this URL
|
||||||
|
|
||||||
|
``cookies``: A dictionary of cookies to be sent with every request
|
||||||
|
|
||||||
|
``headers``: A dictionary of headers to be sent with every request
|
||||||
|
|
||||||
|
``timeout``: The maximum amount of a time a request can take. API functions will raise
|
||||||
|
httpx.TimeoutException if this is exceeded.
|
||||||
|
|
||||||
|
``verify_ssl``: Whether or not to verify the SSL certificate of the API server. This should be True in production,
|
||||||
|
but can be set to False for testing purposes.
|
||||||
|
|
||||||
|
``follow_redirects``: Whether or not to follow redirects. Default value is False.
|
||||||
|
|
||||||
|
``httpx_args``: A dictionary of additional arguments to be passed to the ``httpx.Client`` and ``httpx.AsyncClient`` constructor.
|
||||||
|
|
||||||
|
|
||||||
|
Attributes:
|
||||||
|
raise_on_unexpected_status: Whether or not to raise an errors.UnexpectedStatus if the API returns a
|
||||||
|
status code that was not documented in the source OpenAPI document. Can also be provided as a keyword
|
||||||
|
argument to the constructor.
|
||||||
|
"""
|
||||||
|
|
||||||
|
raise_on_unexpected_status: bool = field(default=False, kw_only=True)
|
||||||
|
_base_url: str = field(alias="base_url")
|
||||||
|
_cookies: dict[str, str] = field(factory=dict, kw_only=True, alias="cookies")
|
||||||
|
_headers: dict[str, str] = field(factory=dict, kw_only=True, alias="headers")
|
||||||
|
_timeout: httpx.Timeout | None = field(default=None, kw_only=True, alias="timeout")
|
||||||
|
_verify_ssl: str | bool | ssl.SSLContext = field(default=True, kw_only=True, alias="verify_ssl")
|
||||||
|
_follow_redirects: bool = field(default=False, kw_only=True, alias="follow_redirects")
|
||||||
|
_httpx_args: dict[str, Any] = field(factory=dict, kw_only=True, alias="httpx_args")
|
||||||
|
_client: httpx.Client | None = field(default=None, init=False)
|
||||||
|
_async_client: httpx.AsyncClient | None = field(default=None, init=False)
|
||||||
|
|
||||||
|
def with_headers(self, headers: dict[str, str]) -> "Client":
|
||||||
|
"""Get a new client matching this one with additional headers"""
|
||||||
|
if self._client is not None:
|
||||||
|
self._client.headers.update(headers)
|
||||||
|
if self._async_client is not None:
|
||||||
|
self._async_client.headers.update(headers)
|
||||||
|
return evolve(self, headers={**self._headers, **headers})
|
||||||
|
|
||||||
|
def with_cookies(self, cookies: dict[str, str]) -> "Client":
|
||||||
|
"""Get a new client matching this one with additional cookies"""
|
||||||
|
if self._client is not None:
|
||||||
|
self._client.cookies.update(cookies)
|
||||||
|
if self._async_client is not None:
|
||||||
|
self._async_client.cookies.update(cookies)
|
||||||
|
return evolve(self, cookies={**self._cookies, **cookies})
|
||||||
|
|
||||||
|
def with_timeout(self, timeout: httpx.Timeout) -> "Client":
|
||||||
|
"""Get a new client matching this one with a new timeout configuration"""
|
||||||
|
if self._client is not None:
|
||||||
|
self._client.timeout = timeout
|
||||||
|
if self._async_client is not None:
|
||||||
|
self._async_client.timeout = timeout
|
||||||
|
return evolve(self, timeout=timeout)
|
||||||
|
|
||||||
|
def set_httpx_client(self, client: httpx.Client) -> "Client":
|
||||||
|
"""Manually set the underlying httpx.Client
|
||||||
|
|
||||||
|
**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
|
||||||
|
"""
|
||||||
|
self._client = client
|
||||||
|
return self
|
||||||
|
|
||||||
|
def get_httpx_client(self) -> httpx.Client:
|
||||||
|
"""Get the underlying httpx.Client, constructing a new one if not previously set"""
|
||||||
|
if self._client is None:
|
||||||
|
self._client = httpx.Client(
|
||||||
|
base_url=self._base_url,
|
||||||
|
cookies=self._cookies,
|
||||||
|
headers=self._headers,
|
||||||
|
timeout=self._timeout,
|
||||||
|
verify=self._verify_ssl,
|
||||||
|
follow_redirects=self._follow_redirects,
|
||||||
|
**self._httpx_args,
|
||||||
|
)
|
||||||
|
return self._client
|
||||||
|
|
||||||
|
def __enter__(self) -> "Client":
|
||||||
|
"""Enter a context manager for self.client—you cannot enter twice (see httpx docs)"""
|
||||||
|
self.get_httpx_client().__enter__()
|
||||||
|
return self
|
||||||
|
|
||||||
|
def __exit__(self, *args: Any, **kwargs: Any) -> None:
|
||||||
|
"""Exit a context manager for internal httpx.Client (see httpx docs)"""
|
||||||
|
self.get_httpx_client().__exit__(*args, **kwargs)
|
||||||
|
|
||||||
|
def set_async_httpx_client(self, async_client: httpx.AsyncClient) -> "Client":
|
||||||
|
"""Manually set the underlying httpx.AsyncClient
|
||||||
|
|
||||||
|
**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
|
||||||
|
"""
|
||||||
|
self._async_client = async_client
|
||||||
|
return self
|
||||||
|
|
||||||
|
def get_async_httpx_client(self) -> httpx.AsyncClient:
|
||||||
|
"""Get the underlying httpx.AsyncClient, constructing a new one if not previously set"""
|
||||||
|
if self._async_client is None:
|
||||||
|
self._async_client = httpx.AsyncClient(
|
||||||
|
base_url=self._base_url,
|
||||||
|
cookies=self._cookies,
|
||||||
|
headers=self._headers,
|
||||||
|
timeout=self._timeout,
|
||||||
|
verify=self._verify_ssl,
|
||||||
|
follow_redirects=self._follow_redirects,
|
||||||
|
**self._httpx_args,
|
||||||
|
)
|
||||||
|
return self._async_client
|
||||||
|
|
||||||
|
async def __aenter__(self) -> "Client":
|
||||||
|
"""Enter a context manager for underlying httpx.AsyncClient—you cannot enter twice (see httpx docs)"""
|
||||||
|
await self.get_async_httpx_client().__aenter__()
|
||||||
|
return self
|
||||||
|
|
||||||
|
async def __aexit__(self, *args: Any, **kwargs: Any) -> None:
|
||||||
|
"""Exit a context manager for underlying httpx.AsyncClient (see httpx docs)"""
|
||||||
|
await self.get_async_httpx_client().__aexit__(*args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
|
@define
|
||||||
|
class AuthenticatedClient:
|
||||||
|
"""A Client which has been authenticated for use on secured endpoints
|
||||||
|
|
||||||
|
The following are accepted as keyword arguments and will be used to construct httpx Clients internally:
|
||||||
|
|
||||||
|
``base_url``: The base URL for the API, all requests are made to a relative path to this URL
|
||||||
|
|
||||||
|
``cookies``: A dictionary of cookies to be sent with every request
|
||||||
|
|
||||||
|
``headers``: A dictionary of headers to be sent with every request
|
||||||
|
|
||||||
|
``timeout``: The maximum amount of a time a request can take. API functions will raise
|
||||||
|
httpx.TimeoutException if this is exceeded.
|
||||||
|
|
||||||
|
``verify_ssl``: Whether or not to verify the SSL certificate of the API server. This should be True in production,
|
||||||
|
but can be set to False for testing purposes.
|
||||||
|
|
||||||
|
``follow_redirects``: Whether or not to follow redirects. Default value is False.
|
||||||
|
|
||||||
|
``httpx_args``: A dictionary of additional arguments to be passed to the ``httpx.Client`` and ``httpx.AsyncClient`` constructor.
|
||||||
|
|
||||||
|
|
||||||
|
Attributes:
|
||||||
|
raise_on_unexpected_status: Whether or not to raise an errors.UnexpectedStatus if the API returns a
|
||||||
|
status code that was not documented in the source OpenAPI document. Can also be provided as a keyword
|
||||||
|
argument to the constructor.
|
||||||
|
token: The token to use for authentication
|
||||||
|
prefix: The prefix to use for the Authorization header
|
||||||
|
auth_header_name: The name of the Authorization header
|
||||||
|
"""
|
||||||
|
|
||||||
|
raise_on_unexpected_status: bool = field(default=False, kw_only=True)
|
||||||
|
_base_url: str = field(alias="base_url")
|
||||||
|
_cookies: dict[str, str] = field(factory=dict, kw_only=True, alias="cookies")
|
||||||
|
_headers: dict[str, str] = field(factory=dict, kw_only=True, alias="headers")
|
||||||
|
_timeout: httpx.Timeout | None = field(default=None, kw_only=True, alias="timeout")
|
||||||
|
_verify_ssl: str | bool | ssl.SSLContext = field(default=True, kw_only=True, alias="verify_ssl")
|
||||||
|
_follow_redirects: bool = field(default=False, kw_only=True, alias="follow_redirects")
|
||||||
|
_httpx_args: dict[str, Any] = field(factory=dict, kw_only=True, alias="httpx_args")
|
||||||
|
_client: httpx.Client | None = field(default=None, init=False)
|
||||||
|
_async_client: httpx.AsyncClient | None = field(default=None, init=False)
|
||||||
|
|
||||||
|
token: str
|
||||||
|
prefix: str = "Bearer"
|
||||||
|
auth_header_name: str = "Authorization"
|
||||||
|
|
||||||
|
def with_headers(self, headers: dict[str, str]) -> "AuthenticatedClient":
|
||||||
|
"""Get a new client matching this one with additional headers"""
|
||||||
|
if self._client is not None:
|
||||||
|
self._client.headers.update(headers)
|
||||||
|
if self._async_client is not None:
|
||||||
|
self._async_client.headers.update(headers)
|
||||||
|
return evolve(self, headers={**self._headers, **headers})
|
||||||
|
|
||||||
|
def with_cookies(self, cookies: dict[str, str]) -> "AuthenticatedClient":
|
||||||
|
"""Get a new client matching this one with additional cookies"""
|
||||||
|
if self._client is not None:
|
||||||
|
self._client.cookies.update(cookies)
|
||||||
|
if self._async_client is not None:
|
||||||
|
self._async_client.cookies.update(cookies)
|
||||||
|
return evolve(self, cookies={**self._cookies, **cookies})
|
||||||
|
|
||||||
|
def with_timeout(self, timeout: httpx.Timeout) -> "AuthenticatedClient":
|
||||||
|
"""Get a new client matching this one with a new timeout configuration"""
|
||||||
|
if self._client is not None:
|
||||||
|
self._client.timeout = timeout
|
||||||
|
if self._async_client is not None:
|
||||||
|
self._async_client.timeout = timeout
|
||||||
|
return evolve(self, timeout=timeout)
|
||||||
|
|
||||||
|
def set_httpx_client(self, client: httpx.Client) -> "AuthenticatedClient":
|
||||||
|
"""Manually set the underlying httpx.Client
|
||||||
|
|
||||||
|
**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
|
||||||
|
"""
|
||||||
|
self._client = client
|
||||||
|
return self
|
||||||
|
|
||||||
|
def get_httpx_client(self) -> httpx.Client:
|
||||||
|
"""Get the underlying httpx.Client, constructing a new one if not previously set"""
|
||||||
|
if self._client is None:
|
||||||
|
self._headers[self.auth_header_name] = f"{self.prefix} {self.token}" if self.prefix else self.token
|
||||||
|
self._client = httpx.Client(
|
||||||
|
base_url=self._base_url,
|
||||||
|
cookies=self._cookies,
|
||||||
|
headers=self._headers,
|
||||||
|
timeout=self._timeout,
|
||||||
|
verify=self._verify_ssl,
|
||||||
|
follow_redirects=self._follow_redirects,
|
||||||
|
**self._httpx_args,
|
||||||
|
)
|
||||||
|
return self._client
|
||||||
|
|
||||||
|
def __enter__(self) -> "AuthenticatedClient":
|
||||||
|
"""Enter a context manager for self.client—you cannot enter twice (see httpx docs)"""
|
||||||
|
self.get_httpx_client().__enter__()
|
||||||
|
return self
|
||||||
|
|
||||||
|
def __exit__(self, *args: Any, **kwargs: Any) -> None:
|
||||||
|
"""Exit a context manager for internal httpx.Client (see httpx docs)"""
|
||||||
|
self.get_httpx_client().__exit__(*args, **kwargs)
|
||||||
|
|
||||||
|
def set_async_httpx_client(self, async_client: httpx.AsyncClient) -> "AuthenticatedClient":
|
||||||
|
"""Manually set the underlying httpx.AsyncClient
|
||||||
|
|
||||||
|
**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
|
||||||
|
"""
|
||||||
|
self._async_client = async_client
|
||||||
|
return self
|
||||||
|
|
||||||
|
def get_async_httpx_client(self) -> httpx.AsyncClient:
|
||||||
|
"""Get the underlying httpx.AsyncClient, constructing a new one if not previously set"""
|
||||||
|
if self._async_client is None:
|
||||||
|
self._headers[self.auth_header_name] = f"{self.prefix} {self.token}" if self.prefix else self.token
|
||||||
|
self._async_client = httpx.AsyncClient(
|
||||||
|
base_url=self._base_url,
|
||||||
|
cookies=self._cookies,
|
||||||
|
headers=self._headers,
|
||||||
|
timeout=self._timeout,
|
||||||
|
verify=self._verify_ssl,
|
||||||
|
follow_redirects=self._follow_redirects,
|
||||||
|
**self._httpx_args,
|
||||||
|
)
|
||||||
|
return self._async_client
|
||||||
|
|
||||||
|
async def __aenter__(self) -> "AuthenticatedClient":
|
||||||
|
"""Enter a context manager for underlying httpx.AsyncClient—you cannot enter twice (see httpx docs)"""
|
||||||
|
await self.get_async_httpx_client().__aenter__()
|
||||||
|
return self
|
||||||
|
|
||||||
|
async def __aexit__(self, *args: Any, **kwargs: Any) -> None:
|
||||||
|
"""Exit a context manager for underlying httpx.AsyncClient (see httpx docs)"""
|
||||||
|
await self.get_async_httpx_client().__aexit__(*args, **kwargs)
|
||||||
16
backend/thirdparty/deutschepost/client/deutsche_post_international_shipping_api_client/errors.py
vendored
Normal file
16
backend/thirdparty/deutschepost/client/deutsche_post_international_shipping_api_client/errors.py
vendored
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
"""Contains shared errors types that can be raised from API functions"""
|
||||||
|
|
||||||
|
|
||||||
|
class UnexpectedStatus(Exception):
|
||||||
|
"""Raised by api functions when the response status an undocumented status and Client.raise_on_unexpected_status is True"""
|
||||||
|
|
||||||
|
def __init__(self, status_code: int, content: bytes):
|
||||||
|
self.status_code = status_code
|
||||||
|
self.content = content
|
||||||
|
|
||||||
|
super().__init__(
|
||||||
|
f"Unexpected status code: {status_code}\n\nResponse content:\n{content.decode(errors='ignore')}"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
__all__ = ["UnexpectedStatus"]
|
||||||
@@ -0,0 +1,127 @@
|
|||||||
|
"""Contains all the data models used in inputs/outputs"""
|
||||||
|
|
||||||
|
from .assemble_order import AssembleOrder
|
||||||
|
from .awb import Awb
|
||||||
|
from .awb_item_format import AwbItemFormat
|
||||||
|
from .awb_product import AwbProduct
|
||||||
|
from .awb_service_level import AwbServiceLevel
|
||||||
|
from .bag import Bag
|
||||||
|
from .bag_item_content_dto import BagItemContentDto
|
||||||
|
from .bag_item_dto import BagItemDto
|
||||||
|
from .bag_item_dto_format import BagItemDtoFormat
|
||||||
|
from .bag_item_dto_product import BagItemDtoProduct
|
||||||
|
from .bag_item_dto_product_type import BagItemDtoProductType
|
||||||
|
from .bag_item_dto_service_level import BagItemDtoServiceLevel
|
||||||
|
from .bag_order import BagOrder
|
||||||
|
from .bag_order_order_status import BagOrderOrderStatus
|
||||||
|
from .bag_paperwork import BagPaperwork
|
||||||
|
from .bag_paperwork_product import BagPaperworkProduct
|
||||||
|
from .bulk_bag_dto import BulkBagDto
|
||||||
|
from .bulk_bag_dto_packet_format import BulkBagDtoPacketFormat
|
||||||
|
from .bulk_bag_dto_validation_errors import BulkBagDtoValidationErrors
|
||||||
|
from .bulk_order_dto import BulkOrderDto
|
||||||
|
from .bulk_order_dto_bulk_order_type import BulkOrderDtoBulkOrderType
|
||||||
|
from .bulk_order_dto_order_classification import BulkOrderDtoOrderClassification
|
||||||
|
from .bulk_order_dto_product_type import BulkOrderDtoProductType
|
||||||
|
from .bulk_order_dto_status import BulkOrderDtoStatus
|
||||||
|
from .closed_bag import ClosedBag
|
||||||
|
from .closed_bag_service_level import ClosedBagServiceLevel
|
||||||
|
from .content import Content
|
||||||
|
from .country import Country
|
||||||
|
from .cws_error_dto import CwsErrorDTO
|
||||||
|
from .get_access_token_info_401_response import GetAccessTokenInfo401Response
|
||||||
|
from .get_access_token_info_response import GetAccessTokenInfoResponse
|
||||||
|
from .get_access_token_response import GetAccessTokenResponse
|
||||||
|
from .get_bag_tag_accept import GetBagTagAccept
|
||||||
|
from .get_bag_tag_label_accept import GetBagTagLabelAccept
|
||||||
|
from .get_customer_item_label_accept import GetCustomerItemLabelAccept
|
||||||
|
from .get_item_label_accept import GetItemLabelAccept
|
||||||
|
from .get_item_labels_accept import GetItemLabelsAccept
|
||||||
|
from .get_items_status import GetItemsStatus
|
||||||
|
from .item import Item
|
||||||
|
from .item_data import ItemData
|
||||||
|
from .item_data_service_level import ItemDataServiceLevel
|
||||||
|
from .item_data_shipment_naturetype import ItemDataShipmentNaturetype
|
||||||
|
from .item_response import ItemResponse
|
||||||
|
from .item_service_level import ItemServiceLevel
|
||||||
|
from .item_shipment_naturetype import ItemShipmentNaturetype
|
||||||
|
from .language import Language
|
||||||
|
from .mixed_bag_order_dto import MixedBagOrderDTO
|
||||||
|
from .order import Order
|
||||||
|
from .order_data import OrderData
|
||||||
|
from .order_data_order_status import OrderDataOrderStatus
|
||||||
|
from .order_order_status import OrderOrderStatus
|
||||||
|
from .order_response import OrderResponse
|
||||||
|
from .paperwork import Paperwork
|
||||||
|
from .paperwork_pickup_type import PaperworkPickupType
|
||||||
|
from .revoke_access_token_response import RevokeAccessTokenResponse
|
||||||
|
from .shipment import Shipment
|
||||||
|
from .tracking import Tracking
|
||||||
|
from .tracking_event import TrackingEvent
|
||||||
|
from .tracking_event_status import TrackingEventStatus
|
||||||
|
from .tracking_event_status_message import TrackingEventStatusMessage
|
||||||
|
from .validation import Validation
|
||||||
|
|
||||||
|
__all__ = (
|
||||||
|
"AssembleOrder",
|
||||||
|
"Awb",
|
||||||
|
"AwbItemFormat",
|
||||||
|
"AwbProduct",
|
||||||
|
"AwbServiceLevel",
|
||||||
|
"Bag",
|
||||||
|
"BagItemContentDto",
|
||||||
|
"BagItemDto",
|
||||||
|
"BagItemDtoFormat",
|
||||||
|
"BagItemDtoProduct",
|
||||||
|
"BagItemDtoProductType",
|
||||||
|
"BagItemDtoServiceLevel",
|
||||||
|
"BagOrder",
|
||||||
|
"BagOrderOrderStatus",
|
||||||
|
"BagPaperwork",
|
||||||
|
"BagPaperworkProduct",
|
||||||
|
"BulkBagDto",
|
||||||
|
"BulkBagDtoPacketFormat",
|
||||||
|
"BulkBagDtoValidationErrors",
|
||||||
|
"BulkOrderDto",
|
||||||
|
"BulkOrderDtoBulkOrderType",
|
||||||
|
"BulkOrderDtoOrderClassification",
|
||||||
|
"BulkOrderDtoProductType",
|
||||||
|
"BulkOrderDtoStatus",
|
||||||
|
"ClosedBag",
|
||||||
|
"ClosedBagServiceLevel",
|
||||||
|
"Content",
|
||||||
|
"Country",
|
||||||
|
"CwsErrorDTO",
|
||||||
|
"GetAccessTokenInfo401Response",
|
||||||
|
"GetAccessTokenInfoResponse",
|
||||||
|
"GetAccessTokenResponse",
|
||||||
|
"GetBagTagAccept",
|
||||||
|
"GetBagTagLabelAccept",
|
||||||
|
"GetCustomerItemLabelAccept",
|
||||||
|
"GetItemLabelAccept",
|
||||||
|
"GetItemLabelsAccept",
|
||||||
|
"GetItemsStatus",
|
||||||
|
"Item",
|
||||||
|
"ItemData",
|
||||||
|
"ItemDataServiceLevel",
|
||||||
|
"ItemDataShipmentNaturetype",
|
||||||
|
"ItemResponse",
|
||||||
|
"ItemServiceLevel",
|
||||||
|
"ItemShipmentNaturetype",
|
||||||
|
"Language",
|
||||||
|
"MixedBagOrderDTO",
|
||||||
|
"Order",
|
||||||
|
"OrderData",
|
||||||
|
"OrderDataOrderStatus",
|
||||||
|
"OrderOrderStatus",
|
||||||
|
"OrderResponse",
|
||||||
|
"Paperwork",
|
||||||
|
"PaperworkPickupType",
|
||||||
|
"RevokeAccessTokenResponse",
|
||||||
|
"Shipment",
|
||||||
|
"Tracking",
|
||||||
|
"TrackingEvent",
|
||||||
|
"TrackingEventStatus",
|
||||||
|
"TrackingEventStatusMessage",
|
||||||
|
"Validation",
|
||||||
|
)
|
||||||
@@ -0,0 +1,98 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from collections.abc import Mapping
|
||||||
|
from typing import TYPE_CHECKING, Any, TypeVar, cast
|
||||||
|
|
||||||
|
from attrs import define as _attrs_define
|
||||||
|
from attrs import field as _attrs_field
|
||||||
|
|
||||||
|
from ..types import UNSET, Unset
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from ..models.paperwork import Paperwork
|
||||||
|
|
||||||
|
|
||||||
|
T = TypeVar("T", bound="AssembleOrder")
|
||||||
|
|
||||||
|
|
||||||
|
@_attrs_define
|
||||||
|
class AssembleOrder:
|
||||||
|
"""This assembles the items or bags to a new order. EITHER bagIds OR itemBarcodes is REQUIRED
|
||||||
|
|
||||||
|
Example:
|
||||||
|
{'itemBarcodes': ['BC123456789DE', 'BC123456790DE', 'BC123456791DE'], 'paperwork': {'contactName': 'John Doe',
|
||||||
|
'awbCopyCount': 3}}
|
||||||
|
|
||||||
|
Attributes:
|
||||||
|
paperwork (Paperwork): Example: {'contactName': 'John Doe', 'awbCopyCount': 3, 'jobReference': 'Job ref',
|
||||||
|
'pickupType': 'CUSTOMER_DROP_OFF', 'telephoneNumber': '+4935120681234'}.
|
||||||
|
item_barcodes (list[str] | Unset): An array of barcodes.
|
||||||
|
bag_ids (list[str] | Unset): An array of bagIds. These identify the items that shall be assembled to bag new
|
||||||
|
orders.
|
||||||
|
"""
|
||||||
|
|
||||||
|
paperwork: Paperwork
|
||||||
|
item_barcodes: list[str] | Unset = UNSET
|
||||||
|
bag_ids: list[str] | Unset = UNSET
|
||||||
|
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||||
|
|
||||||
|
def to_dict(self) -> dict[str, Any]:
|
||||||
|
paperwork = self.paperwork.to_dict()
|
||||||
|
|
||||||
|
item_barcodes: list[str] | Unset = UNSET
|
||||||
|
if not isinstance(self.item_barcodes, Unset):
|
||||||
|
item_barcodes = self.item_barcodes
|
||||||
|
|
||||||
|
bag_ids: list[str] | Unset = UNSET
|
||||||
|
if not isinstance(self.bag_ids, Unset):
|
||||||
|
bag_ids = self.bag_ids
|
||||||
|
|
||||||
|
field_dict: dict[str, Any] = {}
|
||||||
|
field_dict.update(self.additional_properties)
|
||||||
|
field_dict.update(
|
||||||
|
{
|
||||||
|
"paperwork": paperwork,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
if item_barcodes is not UNSET:
|
||||||
|
field_dict["itemBarcodes"] = item_barcodes
|
||||||
|
if bag_ids is not UNSET:
|
||||||
|
field_dict["bagIds"] = bag_ids
|
||||||
|
|
||||||
|
return field_dict
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||||
|
from ..models.paperwork import Paperwork
|
||||||
|
|
||||||
|
d = dict(src_dict)
|
||||||
|
paperwork = Paperwork.from_dict(d.pop("paperwork"))
|
||||||
|
|
||||||
|
item_barcodes = cast(list[str], d.pop("itemBarcodes", UNSET))
|
||||||
|
|
||||||
|
bag_ids = cast(list[str], d.pop("bagIds", UNSET))
|
||||||
|
|
||||||
|
assemble_order = cls(
|
||||||
|
paperwork=paperwork,
|
||||||
|
item_barcodes=item_barcodes,
|
||||||
|
bag_ids=bag_ids,
|
||||||
|
)
|
||||||
|
|
||||||
|
assemble_order.additional_properties = d
|
||||||
|
return assemble_order
|
||||||
|
|
||||||
|
@property
|
||||||
|
def additional_keys(self) -> list[str]:
|
||||||
|
return list(self.additional_properties.keys())
|
||||||
|
|
||||||
|
def __getitem__(self, key: str) -> Any:
|
||||||
|
return self.additional_properties[key]
|
||||||
|
|
||||||
|
def __setitem__(self, key: str, value: Any) -> None:
|
||||||
|
self.additional_properties[key] = value
|
||||||
|
|
||||||
|
def __delitem__(self, key: str) -> None:
|
||||||
|
del self.additional_properties[key]
|
||||||
|
|
||||||
|
def __contains__(self, key: str) -> bool:
|
||||||
|
return key in self.additional_properties
|
||||||
145
backend/thirdparty/deutschepost/client/deutsche_post_international_shipping_api_client/models/awb.py
vendored
Normal file
145
backend/thirdparty/deutschepost/client/deutsche_post_international_shipping_api_client/models/awb.py
vendored
Normal file
@@ -0,0 +1,145 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from collections.abc import Mapping
|
||||||
|
from typing import Any, TypeVar
|
||||||
|
|
||||||
|
from attrs import define as _attrs_define
|
||||||
|
from attrs import field as _attrs_field
|
||||||
|
|
||||||
|
from ..models.awb_item_format import AwbItemFormat
|
||||||
|
from ..models.awb_product import AwbProduct
|
||||||
|
from ..models.awb_service_level import AwbServiceLevel
|
||||||
|
from ..types import UNSET, Unset
|
||||||
|
|
||||||
|
T = TypeVar("T", bound="Awb")
|
||||||
|
|
||||||
|
|
||||||
|
@_attrs_define
|
||||||
|
class Awb:
|
||||||
|
"""
|
||||||
|
Example:
|
||||||
|
{'customerEkp': '9012345678', 'contactName': 'Max Mustermann', 'awbCopyCount': 3, 'product': 'GMP',
|
||||||
|
'serviceLevel': 'PRIORITY', 'itemFormat': 'P', 'jobReference': 'Job ref', 'totalWeight': 5, 'telephoneNumber':
|
||||||
|
'+4935120681234'}
|
||||||
|
|
||||||
|
Attributes:
|
||||||
|
awb_copy_count (int): Copies of AWB labels. One AWB per final receptacle required. Number between 1 and 99.
|
||||||
|
Example: 3.
|
||||||
|
contact_name (str): Contact name for paperwork. Example: John Doe.
|
||||||
|
customer_ekp (str): Deutsche Post Customer Account number (EKP) of the customer who wants to create an single
|
||||||
|
awb. Example: 9012345678.
|
||||||
|
item_format (AwbItemFormat): The item format for this awb. Example: P.
|
||||||
|
product (AwbProduct): The product that is used for the shipment of this item. Available products are: GMP
|
||||||
|
[Packet Priority/Prio (goods)], GPT [Packet Tracked/Tracked], GMM [Business Mail Priority/Prio (documents)], GMR
|
||||||
|
[Business Mail Registered/Plus (documents)] Example: GMP.
|
||||||
|
service_level (AwbServiceLevel): The service level that is used for the shipment of this item. There are
|
||||||
|
restrictions for use of service level: Registered is only available with product GMR and SalesChannel DPI
|
||||||
|
Example: PRIORITY.
|
||||||
|
job_reference (str | Unset): Job reference for the whole shipment. Example: Internal ID 3/14.
|
||||||
|
telephone_number (str | Unset): Telephone number for paperwork. Mandatory for sales channel EXPRESS. Example:
|
||||||
|
+491234567890.
|
||||||
|
total_weight (float | Unset): Total weight of the awb (in kg). Example: 5.
|
||||||
|
"""
|
||||||
|
|
||||||
|
awb_copy_count: int
|
||||||
|
contact_name: str
|
||||||
|
customer_ekp: str
|
||||||
|
item_format: AwbItemFormat
|
||||||
|
product: AwbProduct
|
||||||
|
service_level: AwbServiceLevel
|
||||||
|
job_reference: str | Unset = UNSET
|
||||||
|
telephone_number: str | Unset = UNSET
|
||||||
|
total_weight: float | Unset = UNSET
|
||||||
|
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||||
|
|
||||||
|
def to_dict(self) -> dict[str, Any]:
|
||||||
|
awb_copy_count = self.awb_copy_count
|
||||||
|
|
||||||
|
contact_name = self.contact_name
|
||||||
|
|
||||||
|
customer_ekp = self.customer_ekp
|
||||||
|
|
||||||
|
item_format = self.item_format.value
|
||||||
|
|
||||||
|
product = self.product.value
|
||||||
|
|
||||||
|
service_level = self.service_level.value
|
||||||
|
|
||||||
|
job_reference = self.job_reference
|
||||||
|
|
||||||
|
telephone_number = self.telephone_number
|
||||||
|
|
||||||
|
total_weight = self.total_weight
|
||||||
|
|
||||||
|
field_dict: dict[str, Any] = {}
|
||||||
|
field_dict.update(self.additional_properties)
|
||||||
|
field_dict.update(
|
||||||
|
{
|
||||||
|
"awbCopyCount": awb_copy_count,
|
||||||
|
"contactName": contact_name,
|
||||||
|
"customerEkp": customer_ekp,
|
||||||
|
"itemFormat": item_format,
|
||||||
|
"product": product,
|
||||||
|
"serviceLevel": service_level,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
if job_reference is not UNSET:
|
||||||
|
field_dict["jobReference"] = job_reference
|
||||||
|
if telephone_number is not UNSET:
|
||||||
|
field_dict["telephoneNumber"] = telephone_number
|
||||||
|
if total_weight is not UNSET:
|
||||||
|
field_dict["totalWeight"] = total_weight
|
||||||
|
|
||||||
|
return field_dict
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||||
|
d = dict(src_dict)
|
||||||
|
awb_copy_count = d.pop("awbCopyCount")
|
||||||
|
|
||||||
|
contact_name = d.pop("contactName")
|
||||||
|
|
||||||
|
customer_ekp = d.pop("customerEkp")
|
||||||
|
|
||||||
|
item_format = AwbItemFormat(d.pop("itemFormat"))
|
||||||
|
|
||||||
|
product = AwbProduct(d.pop("product"))
|
||||||
|
|
||||||
|
service_level = AwbServiceLevel(d.pop("serviceLevel"))
|
||||||
|
|
||||||
|
job_reference = d.pop("jobReference", UNSET)
|
||||||
|
|
||||||
|
telephone_number = d.pop("telephoneNumber", UNSET)
|
||||||
|
|
||||||
|
total_weight = d.pop("totalWeight", UNSET)
|
||||||
|
|
||||||
|
awb = cls(
|
||||||
|
awb_copy_count=awb_copy_count,
|
||||||
|
contact_name=contact_name,
|
||||||
|
customer_ekp=customer_ekp,
|
||||||
|
item_format=item_format,
|
||||||
|
product=product,
|
||||||
|
service_level=service_level,
|
||||||
|
job_reference=job_reference,
|
||||||
|
telephone_number=telephone_number,
|
||||||
|
total_weight=total_weight,
|
||||||
|
)
|
||||||
|
|
||||||
|
awb.additional_properties = d
|
||||||
|
return awb
|
||||||
|
|
||||||
|
@property
|
||||||
|
def additional_keys(self) -> list[str]:
|
||||||
|
return list(self.additional_properties.keys())
|
||||||
|
|
||||||
|
def __getitem__(self, key: str) -> Any:
|
||||||
|
return self.additional_properties[key]
|
||||||
|
|
||||||
|
def __setitem__(self, key: str, value: Any) -> None:
|
||||||
|
self.additional_properties[key] = value
|
||||||
|
|
||||||
|
def __delitem__(self, key: str) -> None:
|
||||||
|
del self.additional_properties[key]
|
||||||
|
|
||||||
|
def __contains__(self, key: str) -> bool:
|
||||||
|
return key in self.additional_properties
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
from enum import Enum
|
||||||
|
|
||||||
|
|
||||||
|
class AwbItemFormat(str, Enum):
|
||||||
|
E = "E"
|
||||||
|
G = "G"
|
||||||
|
MIXED = "MIXED"
|
||||||
|
P = "P"
|
||||||
|
|
||||||
|
def __str__(self) -> str:
|
||||||
|
return str(self.value)
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
from enum import Enum
|
||||||
|
|
||||||
|
|
||||||
|
class AwbProduct(str, Enum):
|
||||||
|
GMM = "GMM"
|
||||||
|
GMP = "GMP"
|
||||||
|
GMR = "GMR"
|
||||||
|
GPT = "GPT"
|
||||||
|
|
||||||
|
def __str__(self) -> str:
|
||||||
|
return str(self.value)
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
from enum import Enum
|
||||||
|
|
||||||
|
|
||||||
|
class AwbServiceLevel(str, Enum):
|
||||||
|
PRIORITY = "PRIORITY"
|
||||||
|
REGISTERED = "REGISTERED"
|
||||||
|
|
||||||
|
def __str__(self) -> str:
|
||||||
|
return str(self.value)
|
||||||
113
backend/thirdparty/deutschepost/client/deutsche_post_international_shipping_api_client/models/bag.py
vendored
Normal file
113
backend/thirdparty/deutschepost/client/deutsche_post_international_shipping_api_client/models/bag.py
vendored
Normal file
@@ -0,0 +1,113 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from collections.abc import Mapping
|
||||||
|
from typing import Any, TypeVar
|
||||||
|
|
||||||
|
from attrs import define as _attrs_define
|
||||||
|
from attrs import field as _attrs_field
|
||||||
|
|
||||||
|
from ..types import UNSET, Unset
|
||||||
|
|
||||||
|
T = TypeVar("T", bound="Bag")
|
||||||
|
|
||||||
|
|
||||||
|
@_attrs_define
|
||||||
|
class Bag:
|
||||||
|
"""
|
||||||
|
Attributes:
|
||||||
|
bag_track (bool): False for bulk preadvice, True for bag tracking Default: False.
|
||||||
|
format_ (str): The format of the content of this bag. Example: P.
|
||||||
|
destination_country (str): The destination country code. Example: DE.
|
||||||
|
items_count (int): Number of items in bag. Minimum 1.
|
||||||
|
items_weight_in_kilogram (float): The weight in kilogram of the bag. Example: 100.
|
||||||
|
id (int | Unset): Internal id of the bag.
|
||||||
|
customer_reference (str | Unset): Customer reference Example: Customer reference.
|
||||||
|
"""
|
||||||
|
|
||||||
|
format_: str
|
||||||
|
destination_country: str
|
||||||
|
items_count: int
|
||||||
|
items_weight_in_kilogram: float
|
||||||
|
bag_track: bool = False
|
||||||
|
id: int | Unset = UNSET
|
||||||
|
customer_reference: str | Unset = UNSET
|
||||||
|
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||||
|
|
||||||
|
def to_dict(self) -> dict[str, Any]:
|
||||||
|
bag_track = self.bag_track
|
||||||
|
|
||||||
|
format_ = self.format_
|
||||||
|
|
||||||
|
destination_country = self.destination_country
|
||||||
|
|
||||||
|
items_count = self.items_count
|
||||||
|
|
||||||
|
items_weight_in_kilogram = self.items_weight_in_kilogram
|
||||||
|
|
||||||
|
id = self.id
|
||||||
|
|
||||||
|
customer_reference = self.customer_reference
|
||||||
|
|
||||||
|
field_dict: dict[str, Any] = {}
|
||||||
|
field_dict.update(self.additional_properties)
|
||||||
|
field_dict.update(
|
||||||
|
{
|
||||||
|
"bagTrack": bag_track,
|
||||||
|
"format": format_,
|
||||||
|
"destinationCountry": destination_country,
|
||||||
|
"itemsCount": items_count,
|
||||||
|
"itemsWeightInKilogram": items_weight_in_kilogram,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
if id is not UNSET:
|
||||||
|
field_dict["id"] = id
|
||||||
|
if customer_reference is not UNSET:
|
||||||
|
field_dict["customerReference"] = customer_reference
|
||||||
|
|
||||||
|
return field_dict
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||||
|
d = dict(src_dict)
|
||||||
|
bag_track = d.pop("bagTrack")
|
||||||
|
|
||||||
|
format_ = d.pop("format")
|
||||||
|
|
||||||
|
destination_country = d.pop("destinationCountry")
|
||||||
|
|
||||||
|
items_count = d.pop("itemsCount")
|
||||||
|
|
||||||
|
items_weight_in_kilogram = d.pop("itemsWeightInKilogram")
|
||||||
|
|
||||||
|
id = d.pop("id", UNSET)
|
||||||
|
|
||||||
|
customer_reference = d.pop("customerReference", UNSET)
|
||||||
|
|
||||||
|
bag = cls(
|
||||||
|
bag_track=bag_track,
|
||||||
|
format_=format_,
|
||||||
|
destination_country=destination_country,
|
||||||
|
items_count=items_count,
|
||||||
|
items_weight_in_kilogram=items_weight_in_kilogram,
|
||||||
|
id=id,
|
||||||
|
customer_reference=customer_reference,
|
||||||
|
)
|
||||||
|
|
||||||
|
bag.additional_properties = d
|
||||||
|
return bag
|
||||||
|
|
||||||
|
@property
|
||||||
|
def additional_keys(self) -> list[str]:
|
||||||
|
return list(self.additional_properties.keys())
|
||||||
|
|
||||||
|
def __getitem__(self, key: str) -> Any:
|
||||||
|
return self.additional_properties[key]
|
||||||
|
|
||||||
|
def __setitem__(self, key: str, value: Any) -> None:
|
||||||
|
self.additional_properties[key] = value
|
||||||
|
|
||||||
|
def __delitem__(self, key: str) -> None:
|
||||||
|
del self.additional_properties[key]
|
||||||
|
|
||||||
|
def __contains__(self, key: str) -> bool:
|
||||||
|
return key in self.additional_properties
|
||||||
@@ -0,0 +1,106 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from collections.abc import Mapping
|
||||||
|
from typing import Any, TypeVar
|
||||||
|
|
||||||
|
from attrs import define as _attrs_define
|
||||||
|
from attrs import field as _attrs_field
|
||||||
|
|
||||||
|
from ..types import UNSET, Unset
|
||||||
|
|
||||||
|
T = TypeVar("T", bound="BagItemContentDto")
|
||||||
|
|
||||||
|
|
||||||
|
@_attrs_define
|
||||||
|
class BagItemContentDto:
|
||||||
|
"""
|
||||||
|
Attributes:
|
||||||
|
amount (str | Unset):
|
||||||
|
description (str | Unset):
|
||||||
|
value (str | Unset):
|
||||||
|
hs_code (str | Unset):
|
||||||
|
net_weight (str | Unset):
|
||||||
|
origin_country (str | Unset):
|
||||||
|
"""
|
||||||
|
|
||||||
|
amount: str | Unset = UNSET
|
||||||
|
description: str | Unset = UNSET
|
||||||
|
value: str | Unset = UNSET
|
||||||
|
hs_code: str | Unset = UNSET
|
||||||
|
net_weight: str | Unset = UNSET
|
||||||
|
origin_country: str | Unset = UNSET
|
||||||
|
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||||
|
|
||||||
|
def to_dict(self) -> dict[str, Any]:
|
||||||
|
amount = self.amount
|
||||||
|
|
||||||
|
description = self.description
|
||||||
|
|
||||||
|
value = self.value
|
||||||
|
|
||||||
|
hs_code = self.hs_code
|
||||||
|
|
||||||
|
net_weight = self.net_weight
|
||||||
|
|
||||||
|
origin_country = self.origin_country
|
||||||
|
|
||||||
|
field_dict: dict[str, Any] = {}
|
||||||
|
field_dict.update(self.additional_properties)
|
||||||
|
field_dict.update({})
|
||||||
|
if amount is not UNSET:
|
||||||
|
field_dict["amount"] = amount
|
||||||
|
if description is not UNSET:
|
||||||
|
field_dict["description"] = description
|
||||||
|
if value is not UNSET:
|
||||||
|
field_dict["value"] = value
|
||||||
|
if hs_code is not UNSET:
|
||||||
|
field_dict["hsCode"] = hs_code
|
||||||
|
if net_weight is not UNSET:
|
||||||
|
field_dict["netWeight"] = net_weight
|
||||||
|
if origin_country is not UNSET:
|
||||||
|
field_dict["originCountry"] = origin_country
|
||||||
|
|
||||||
|
return field_dict
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||||
|
d = dict(src_dict)
|
||||||
|
amount = d.pop("amount", UNSET)
|
||||||
|
|
||||||
|
description = d.pop("description", UNSET)
|
||||||
|
|
||||||
|
value = d.pop("value", UNSET)
|
||||||
|
|
||||||
|
hs_code = d.pop("hsCode", UNSET)
|
||||||
|
|
||||||
|
net_weight = d.pop("netWeight", UNSET)
|
||||||
|
|
||||||
|
origin_country = d.pop("originCountry", UNSET)
|
||||||
|
|
||||||
|
bag_item_content_dto = cls(
|
||||||
|
amount=amount,
|
||||||
|
description=description,
|
||||||
|
value=value,
|
||||||
|
hs_code=hs_code,
|
||||||
|
net_weight=net_weight,
|
||||||
|
origin_country=origin_country,
|
||||||
|
)
|
||||||
|
|
||||||
|
bag_item_content_dto.additional_properties = d
|
||||||
|
return bag_item_content_dto
|
||||||
|
|
||||||
|
@property
|
||||||
|
def additional_keys(self) -> list[str]:
|
||||||
|
return list(self.additional_properties.keys())
|
||||||
|
|
||||||
|
def __getitem__(self, key: str) -> Any:
|
||||||
|
return self.additional_properties[key]
|
||||||
|
|
||||||
|
def __setitem__(self, key: str, value: Any) -> None:
|
||||||
|
self.additional_properties[key] = value
|
||||||
|
|
||||||
|
def __delitem__(self, key: str) -> None:
|
||||||
|
del self.additional_properties[key]
|
||||||
|
|
||||||
|
def __contains__(self, key: str) -> bool:
|
||||||
|
return key in self.additional_properties
|
||||||
@@ -0,0 +1,417 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from collections.abc import Mapping
|
||||||
|
from typing import TYPE_CHECKING, Any, TypeVar
|
||||||
|
|
||||||
|
from attrs import define as _attrs_define
|
||||||
|
from attrs import field as _attrs_field
|
||||||
|
|
||||||
|
from ..models.bag_item_dto_format import BagItemDtoFormat
|
||||||
|
from ..models.bag_item_dto_product import BagItemDtoProduct
|
||||||
|
from ..models.bag_item_dto_product_type import BagItemDtoProductType
|
||||||
|
from ..models.bag_item_dto_service_level import BagItemDtoServiceLevel
|
||||||
|
from ..types import UNSET, Unset
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from ..models.bag_item_content_dto import BagItemContentDto
|
||||||
|
from ..models.country import Country
|
||||||
|
|
||||||
|
|
||||||
|
T = TypeVar("T", bound="BagItemDto")
|
||||||
|
|
||||||
|
|
||||||
|
@_attrs_define
|
||||||
|
class BagItemDto:
|
||||||
|
"""
|
||||||
|
Attributes:
|
||||||
|
id (int | Unset):
|
||||||
|
barcode (str | Unset):
|
||||||
|
customer_ekp (str | Unset):
|
||||||
|
awb (str | Unset):
|
||||||
|
destination_country (Country | Unset):
|
||||||
|
destination_email (str | Unset):
|
||||||
|
destination_phone (str | Unset):
|
||||||
|
destination_phone_2 (str | Unset):
|
||||||
|
format_ (BagItemDtoFormat | Unset):
|
||||||
|
item_weight (int | Unset):
|
||||||
|
bag_id (str | Unset): In requests only applicable for customers using "prelabelled service"
|
||||||
|
product_type (BagItemDtoProductType | Unset):
|
||||||
|
product (BagItemDtoProduct | Unset):
|
||||||
|
service_level (BagItemDtoServiceLevel | Unset):
|
||||||
|
name (str | Unset):
|
||||||
|
customer_reference (str | Unset):
|
||||||
|
recipient_phone (str | Unset):
|
||||||
|
recipient_email (str | Unset):
|
||||||
|
address_line_1 (str | Unset):
|
||||||
|
address_line_2 (str | Unset):
|
||||||
|
address_line_3 (str | Unset):
|
||||||
|
city (str | Unset):
|
||||||
|
destination_state (str | Unset):
|
||||||
|
postal_code (str | Unset):
|
||||||
|
currency (str | Unset):
|
||||||
|
content_type (str | Unset):
|
||||||
|
declared_content_amount (int | Unset):
|
||||||
|
detailed_content_descriptions_1 (str | Unset):
|
||||||
|
total_value (int | Unset):
|
||||||
|
return_label (bool | Unset):
|
||||||
|
sender_customs_reference (str | Unset):
|
||||||
|
importer_customs_reference (str | Unset):
|
||||||
|
checked (bool | Unset):
|
||||||
|
bag_item_contents (list[BagItemContentDto] | Unset):
|
||||||
|
"""
|
||||||
|
|
||||||
|
id: int | Unset = UNSET
|
||||||
|
barcode: str | Unset = UNSET
|
||||||
|
customer_ekp: str | Unset = UNSET
|
||||||
|
awb: str | Unset = UNSET
|
||||||
|
destination_country: Country | Unset = UNSET
|
||||||
|
destination_email: str | Unset = UNSET
|
||||||
|
destination_phone: str | Unset = UNSET
|
||||||
|
destination_phone_2: str | Unset = UNSET
|
||||||
|
format_: BagItemDtoFormat | Unset = UNSET
|
||||||
|
item_weight: int | Unset = UNSET
|
||||||
|
bag_id: str | Unset = UNSET
|
||||||
|
product_type: BagItemDtoProductType | Unset = UNSET
|
||||||
|
product: BagItemDtoProduct | Unset = UNSET
|
||||||
|
service_level: BagItemDtoServiceLevel | Unset = UNSET
|
||||||
|
name: str | Unset = UNSET
|
||||||
|
customer_reference: str | Unset = UNSET
|
||||||
|
recipient_phone: str | Unset = UNSET
|
||||||
|
recipient_email: str | Unset = UNSET
|
||||||
|
address_line_1: str | Unset = UNSET
|
||||||
|
address_line_2: str | Unset = UNSET
|
||||||
|
address_line_3: str | Unset = UNSET
|
||||||
|
city: str | Unset = UNSET
|
||||||
|
destination_state: str | Unset = UNSET
|
||||||
|
postal_code: str | Unset = UNSET
|
||||||
|
currency: str | Unset = UNSET
|
||||||
|
content_type: str | Unset = UNSET
|
||||||
|
declared_content_amount: int | Unset = UNSET
|
||||||
|
detailed_content_descriptions_1: str | Unset = UNSET
|
||||||
|
total_value: int | Unset = UNSET
|
||||||
|
return_label: bool | Unset = UNSET
|
||||||
|
sender_customs_reference: str | Unset = UNSET
|
||||||
|
importer_customs_reference: str | Unset = UNSET
|
||||||
|
checked: bool | Unset = UNSET
|
||||||
|
bag_item_contents: list[BagItemContentDto] | Unset = UNSET
|
||||||
|
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||||
|
|
||||||
|
def to_dict(self) -> dict[str, Any]:
|
||||||
|
id = self.id
|
||||||
|
|
||||||
|
barcode = self.barcode
|
||||||
|
|
||||||
|
customer_ekp = self.customer_ekp
|
||||||
|
|
||||||
|
awb = self.awb
|
||||||
|
|
||||||
|
destination_country: dict[str, Any] | Unset = UNSET
|
||||||
|
if not isinstance(self.destination_country, Unset):
|
||||||
|
destination_country = self.destination_country.to_dict()
|
||||||
|
|
||||||
|
destination_email = self.destination_email
|
||||||
|
|
||||||
|
destination_phone = self.destination_phone
|
||||||
|
|
||||||
|
destination_phone_2 = self.destination_phone_2
|
||||||
|
|
||||||
|
format_: str | Unset = UNSET
|
||||||
|
if not isinstance(self.format_, Unset):
|
||||||
|
format_ = self.format_.value
|
||||||
|
|
||||||
|
item_weight = self.item_weight
|
||||||
|
|
||||||
|
bag_id = self.bag_id
|
||||||
|
|
||||||
|
product_type: str | Unset = UNSET
|
||||||
|
if not isinstance(self.product_type, Unset):
|
||||||
|
product_type = self.product_type.value
|
||||||
|
|
||||||
|
product: str | Unset = UNSET
|
||||||
|
if not isinstance(self.product, Unset):
|
||||||
|
product = self.product.value
|
||||||
|
|
||||||
|
service_level: str | Unset = UNSET
|
||||||
|
if not isinstance(self.service_level, Unset):
|
||||||
|
service_level = self.service_level.value
|
||||||
|
|
||||||
|
name = self.name
|
||||||
|
|
||||||
|
customer_reference = self.customer_reference
|
||||||
|
|
||||||
|
recipient_phone = self.recipient_phone
|
||||||
|
|
||||||
|
recipient_email = self.recipient_email
|
||||||
|
|
||||||
|
address_line_1 = self.address_line_1
|
||||||
|
|
||||||
|
address_line_2 = self.address_line_2
|
||||||
|
|
||||||
|
address_line_3 = self.address_line_3
|
||||||
|
|
||||||
|
city = self.city
|
||||||
|
|
||||||
|
destination_state = self.destination_state
|
||||||
|
|
||||||
|
postal_code = self.postal_code
|
||||||
|
|
||||||
|
currency = self.currency
|
||||||
|
|
||||||
|
content_type = self.content_type
|
||||||
|
|
||||||
|
declared_content_amount = self.declared_content_amount
|
||||||
|
|
||||||
|
detailed_content_descriptions_1 = self.detailed_content_descriptions_1
|
||||||
|
|
||||||
|
total_value = self.total_value
|
||||||
|
|
||||||
|
return_label = self.return_label
|
||||||
|
|
||||||
|
sender_customs_reference = self.sender_customs_reference
|
||||||
|
|
||||||
|
importer_customs_reference = self.importer_customs_reference
|
||||||
|
|
||||||
|
checked = self.checked
|
||||||
|
|
||||||
|
bag_item_contents: list[dict[str, Any]] | Unset = UNSET
|
||||||
|
if not isinstance(self.bag_item_contents, Unset):
|
||||||
|
bag_item_contents = []
|
||||||
|
for bag_item_contents_item_data in self.bag_item_contents:
|
||||||
|
bag_item_contents_item = bag_item_contents_item_data.to_dict()
|
||||||
|
bag_item_contents.append(bag_item_contents_item)
|
||||||
|
|
||||||
|
field_dict: dict[str, Any] = {}
|
||||||
|
field_dict.update(self.additional_properties)
|
||||||
|
field_dict.update({})
|
||||||
|
if id is not UNSET:
|
||||||
|
field_dict["id"] = id
|
||||||
|
if barcode is not UNSET:
|
||||||
|
field_dict["barcode"] = barcode
|
||||||
|
if customer_ekp is not UNSET:
|
||||||
|
field_dict["customerEkp"] = customer_ekp
|
||||||
|
if awb is not UNSET:
|
||||||
|
field_dict["awb"] = awb
|
||||||
|
if destination_country is not UNSET:
|
||||||
|
field_dict["destinationCountry"] = destination_country
|
||||||
|
if destination_email is not UNSET:
|
||||||
|
field_dict["destinationEmail"] = destination_email
|
||||||
|
if destination_phone is not UNSET:
|
||||||
|
field_dict["destinationPhone"] = destination_phone
|
||||||
|
if destination_phone_2 is not UNSET:
|
||||||
|
field_dict["destinationPhone2"] = destination_phone_2
|
||||||
|
if format_ is not UNSET:
|
||||||
|
field_dict["format"] = format_
|
||||||
|
if item_weight is not UNSET:
|
||||||
|
field_dict["itemWeight"] = item_weight
|
||||||
|
if bag_id is not UNSET:
|
||||||
|
field_dict["bagId"] = bag_id
|
||||||
|
if product_type is not UNSET:
|
||||||
|
field_dict["productType"] = product_type
|
||||||
|
if product is not UNSET:
|
||||||
|
field_dict["product"] = product
|
||||||
|
if service_level is not UNSET:
|
||||||
|
field_dict["serviceLevel"] = service_level
|
||||||
|
if name is not UNSET:
|
||||||
|
field_dict["name"] = name
|
||||||
|
if customer_reference is not UNSET:
|
||||||
|
field_dict["customerReference"] = customer_reference
|
||||||
|
if recipient_phone is not UNSET:
|
||||||
|
field_dict["recipientPhone"] = recipient_phone
|
||||||
|
if recipient_email is not UNSET:
|
||||||
|
field_dict["recipientEmail"] = recipient_email
|
||||||
|
if address_line_1 is not UNSET:
|
||||||
|
field_dict["addressLine1"] = address_line_1
|
||||||
|
if address_line_2 is not UNSET:
|
||||||
|
field_dict["addressLine2"] = address_line_2
|
||||||
|
if address_line_3 is not UNSET:
|
||||||
|
field_dict["addressLine3"] = address_line_3
|
||||||
|
if city is not UNSET:
|
||||||
|
field_dict["city"] = city
|
||||||
|
if destination_state is not UNSET:
|
||||||
|
field_dict["destinationState"] = destination_state
|
||||||
|
if postal_code is not UNSET:
|
||||||
|
field_dict["postalCode"] = postal_code
|
||||||
|
if currency is not UNSET:
|
||||||
|
field_dict["currency"] = currency
|
||||||
|
if content_type is not UNSET:
|
||||||
|
field_dict["contentType"] = content_type
|
||||||
|
if declared_content_amount is not UNSET:
|
||||||
|
field_dict["declaredContentAmount"] = declared_content_amount
|
||||||
|
if detailed_content_descriptions_1 is not UNSET:
|
||||||
|
field_dict["detailedContentDescriptions1"] = detailed_content_descriptions_1
|
||||||
|
if total_value is not UNSET:
|
||||||
|
field_dict["totalValue"] = total_value
|
||||||
|
if return_label is not UNSET:
|
||||||
|
field_dict["returnLabel"] = return_label
|
||||||
|
if sender_customs_reference is not UNSET:
|
||||||
|
field_dict["senderCustomsReference"] = sender_customs_reference
|
||||||
|
if importer_customs_reference is not UNSET:
|
||||||
|
field_dict["importerCustomsReference"] = importer_customs_reference
|
||||||
|
if checked is not UNSET:
|
||||||
|
field_dict["checked"] = checked
|
||||||
|
if bag_item_contents is not UNSET:
|
||||||
|
field_dict["bagItemContents"] = bag_item_contents
|
||||||
|
|
||||||
|
return field_dict
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||||
|
from ..models.bag_item_content_dto import BagItemContentDto
|
||||||
|
from ..models.country import Country
|
||||||
|
|
||||||
|
d = dict(src_dict)
|
||||||
|
id = d.pop("id", UNSET)
|
||||||
|
|
||||||
|
barcode = d.pop("barcode", UNSET)
|
||||||
|
|
||||||
|
customer_ekp = d.pop("customerEkp", UNSET)
|
||||||
|
|
||||||
|
awb = d.pop("awb", UNSET)
|
||||||
|
|
||||||
|
_destination_country = d.pop("destinationCountry", UNSET)
|
||||||
|
destination_country: Country | Unset
|
||||||
|
if isinstance(_destination_country, Unset):
|
||||||
|
destination_country = UNSET
|
||||||
|
else:
|
||||||
|
destination_country = Country.from_dict(_destination_country)
|
||||||
|
|
||||||
|
destination_email = d.pop("destinationEmail", UNSET)
|
||||||
|
|
||||||
|
destination_phone = d.pop("destinationPhone", UNSET)
|
||||||
|
|
||||||
|
destination_phone_2 = d.pop("destinationPhone2", UNSET)
|
||||||
|
|
||||||
|
_format_ = d.pop("format", UNSET)
|
||||||
|
format_: BagItemDtoFormat | Unset
|
||||||
|
if isinstance(_format_, Unset):
|
||||||
|
format_ = UNSET
|
||||||
|
else:
|
||||||
|
format_ = BagItemDtoFormat(_format_)
|
||||||
|
|
||||||
|
item_weight = d.pop("itemWeight", UNSET)
|
||||||
|
|
||||||
|
bag_id = d.pop("bagId", UNSET)
|
||||||
|
|
||||||
|
_product_type = d.pop("productType", UNSET)
|
||||||
|
product_type: BagItemDtoProductType | Unset
|
||||||
|
if isinstance(_product_type, Unset):
|
||||||
|
product_type = UNSET
|
||||||
|
else:
|
||||||
|
product_type = BagItemDtoProductType(_product_type)
|
||||||
|
|
||||||
|
_product = d.pop("product", UNSET)
|
||||||
|
product: BagItemDtoProduct | Unset
|
||||||
|
if isinstance(_product, Unset):
|
||||||
|
product = UNSET
|
||||||
|
else:
|
||||||
|
product = BagItemDtoProduct(_product)
|
||||||
|
|
||||||
|
_service_level = d.pop("serviceLevel", UNSET)
|
||||||
|
service_level: BagItemDtoServiceLevel | Unset
|
||||||
|
if isinstance(_service_level, Unset):
|
||||||
|
service_level = UNSET
|
||||||
|
else:
|
||||||
|
service_level = BagItemDtoServiceLevel(_service_level)
|
||||||
|
|
||||||
|
name = d.pop("name", UNSET)
|
||||||
|
|
||||||
|
customer_reference = d.pop("customerReference", UNSET)
|
||||||
|
|
||||||
|
recipient_phone = d.pop("recipientPhone", UNSET)
|
||||||
|
|
||||||
|
recipient_email = d.pop("recipientEmail", UNSET)
|
||||||
|
|
||||||
|
address_line_1 = d.pop("addressLine1", UNSET)
|
||||||
|
|
||||||
|
address_line_2 = d.pop("addressLine2", UNSET)
|
||||||
|
|
||||||
|
address_line_3 = d.pop("addressLine3", UNSET)
|
||||||
|
|
||||||
|
city = d.pop("city", UNSET)
|
||||||
|
|
||||||
|
destination_state = d.pop("destinationState", UNSET)
|
||||||
|
|
||||||
|
postal_code = d.pop("postalCode", UNSET)
|
||||||
|
|
||||||
|
currency = d.pop("currency", UNSET)
|
||||||
|
|
||||||
|
content_type = d.pop("contentType", UNSET)
|
||||||
|
|
||||||
|
declared_content_amount = d.pop("declaredContentAmount", UNSET)
|
||||||
|
|
||||||
|
detailed_content_descriptions_1 = d.pop("detailedContentDescriptions1", UNSET)
|
||||||
|
|
||||||
|
total_value = d.pop("totalValue", UNSET)
|
||||||
|
|
||||||
|
return_label = d.pop("returnLabel", UNSET)
|
||||||
|
|
||||||
|
sender_customs_reference = d.pop("senderCustomsReference", UNSET)
|
||||||
|
|
||||||
|
importer_customs_reference = d.pop("importerCustomsReference", UNSET)
|
||||||
|
|
||||||
|
checked = d.pop("checked", UNSET)
|
||||||
|
|
||||||
|
_bag_item_contents = d.pop("bagItemContents", UNSET)
|
||||||
|
bag_item_contents: list[BagItemContentDto] | Unset = UNSET
|
||||||
|
if _bag_item_contents is not UNSET:
|
||||||
|
bag_item_contents = []
|
||||||
|
for bag_item_contents_item_data in _bag_item_contents:
|
||||||
|
bag_item_contents_item = BagItemContentDto.from_dict(bag_item_contents_item_data)
|
||||||
|
|
||||||
|
bag_item_contents.append(bag_item_contents_item)
|
||||||
|
|
||||||
|
bag_item_dto = cls(
|
||||||
|
id=id,
|
||||||
|
barcode=barcode,
|
||||||
|
customer_ekp=customer_ekp,
|
||||||
|
awb=awb,
|
||||||
|
destination_country=destination_country,
|
||||||
|
destination_email=destination_email,
|
||||||
|
destination_phone=destination_phone,
|
||||||
|
destination_phone_2=destination_phone_2,
|
||||||
|
format_=format_,
|
||||||
|
item_weight=item_weight,
|
||||||
|
bag_id=bag_id,
|
||||||
|
product_type=product_type,
|
||||||
|
product=product,
|
||||||
|
service_level=service_level,
|
||||||
|
name=name,
|
||||||
|
customer_reference=customer_reference,
|
||||||
|
recipient_phone=recipient_phone,
|
||||||
|
recipient_email=recipient_email,
|
||||||
|
address_line_1=address_line_1,
|
||||||
|
address_line_2=address_line_2,
|
||||||
|
address_line_3=address_line_3,
|
||||||
|
city=city,
|
||||||
|
destination_state=destination_state,
|
||||||
|
postal_code=postal_code,
|
||||||
|
currency=currency,
|
||||||
|
content_type=content_type,
|
||||||
|
declared_content_amount=declared_content_amount,
|
||||||
|
detailed_content_descriptions_1=detailed_content_descriptions_1,
|
||||||
|
total_value=total_value,
|
||||||
|
return_label=return_label,
|
||||||
|
sender_customs_reference=sender_customs_reference,
|
||||||
|
importer_customs_reference=importer_customs_reference,
|
||||||
|
checked=checked,
|
||||||
|
bag_item_contents=bag_item_contents,
|
||||||
|
)
|
||||||
|
|
||||||
|
bag_item_dto.additional_properties = d
|
||||||
|
return bag_item_dto
|
||||||
|
|
||||||
|
@property
|
||||||
|
def additional_keys(self) -> list[str]:
|
||||||
|
return list(self.additional_properties.keys())
|
||||||
|
|
||||||
|
def __getitem__(self, key: str) -> Any:
|
||||||
|
return self.additional_properties[key]
|
||||||
|
|
||||||
|
def __setitem__(self, key: str, value: Any) -> None:
|
||||||
|
self.additional_properties[key] = value
|
||||||
|
|
||||||
|
def __delitem__(self, key: str) -> None:
|
||||||
|
del self.additional_properties[key]
|
||||||
|
|
||||||
|
def __contains__(self, key: str) -> bool:
|
||||||
|
return key in self.additional_properties
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
from enum import Enum
|
||||||
|
|
||||||
|
|
||||||
|
class BagItemDtoFormat(str, Enum):
|
||||||
|
E = "E"
|
||||||
|
E_BAG = "E_BAG"
|
||||||
|
E_PALLET = "E_PALLET"
|
||||||
|
G = "G"
|
||||||
|
G_BAG = "G_BAG"
|
||||||
|
G_PALLET = "G_PALLET"
|
||||||
|
MIXED = "MIXED"
|
||||||
|
P = "P"
|
||||||
|
P_BAG = "P_BAG"
|
||||||
|
P_PALLET = "P_PALLET"
|
||||||
|
|
||||||
|
def __str__(self) -> str:
|
||||||
|
return str(self.value)
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
from enum import Enum
|
||||||
|
|
||||||
|
|
||||||
|
class BagItemDtoProduct(str, Enum):
|
||||||
|
EXPRESS_LETTER_PLUS = "EXPRESS_LETTER_PLUS"
|
||||||
|
EXPRESS_LETTER_PRIO = "EXPRESS_LETTER_PRIO"
|
||||||
|
EXPRESS_PACKET_PLUS = "EXPRESS_PACKET_PLUS"
|
||||||
|
EXPRESS_PACKET_PRIO = "EXPRESS_PACKET_PRIO"
|
||||||
|
EXPRESS_PACKET_TRACKED = "EXPRESS_PACKET_TRACKED"
|
||||||
|
GM_MAIL = "GM_MAIL"
|
||||||
|
GM_PACKET = "GM_PACKET"
|
||||||
|
GM_PACKET_PLUS = "GM_PACKET_PLUS"
|
||||||
|
GM_PACKET_TRACKED = "GM_PACKET_TRACKED"
|
||||||
|
|
||||||
|
def __str__(self) -> str:
|
||||||
|
return str(self.value)
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
from enum import Enum
|
||||||
|
|
||||||
|
|
||||||
|
class BagItemDtoProductType(str, Enum):
|
||||||
|
EXPRESS_LETTER_PLUS = "EXPRESS_LETTER_PLUS"
|
||||||
|
EXPRESS_LETTER_PRIO = "EXPRESS_LETTER_PRIO"
|
||||||
|
EXPRESS_PACKET_PLUS = "EXPRESS_PACKET_PLUS"
|
||||||
|
EXPRESS_PACKET_PRIO = "EXPRESS_PACKET_PRIO"
|
||||||
|
EXPRESS_PACKET_TRACKED = "EXPRESS_PACKET_TRACKED"
|
||||||
|
GM_MAIL_PRIO = "GM_MAIL_PRIO"
|
||||||
|
GM_MAIL_REG = "GM_MAIL_REG"
|
||||||
|
GM_MAIL_STANDARD = "GM_MAIL_STANDARD"
|
||||||
|
GM_PACKET_PLUS = "GM_PACKET_PLUS"
|
||||||
|
GM_PACKET_PRIO = "GM_PACKET_PRIO"
|
||||||
|
GM_PACKET_STANDARD = "GM_PACKET_STANDARD"
|
||||||
|
GM_PACKET_TRACKED = "GM_PACKET_TRACKED"
|
||||||
|
|
||||||
|
def __str__(self) -> str:
|
||||||
|
return str(self.value)
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
from enum import Enum
|
||||||
|
|
||||||
|
|
||||||
|
class BagItemDtoServiceLevel(str, Enum):
|
||||||
|
PRIORITY = "PRIORITY"
|
||||||
|
REGISTERED = "REGISTERED"
|
||||||
|
STANDARD = "STANDARD"
|
||||||
|
|
||||||
|
def __str__(self) -> str:
|
||||||
|
return str(self.value)
|
||||||
@@ -0,0 +1,145 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from collections.abc import Mapping
|
||||||
|
from typing import TYPE_CHECKING, Any, TypeVar
|
||||||
|
|
||||||
|
from attrs import define as _attrs_define
|
||||||
|
from attrs import field as _attrs_field
|
||||||
|
|
||||||
|
from ..models.bag_order_order_status import BagOrderOrderStatus
|
||||||
|
from ..types import UNSET, Unset
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from ..models.bag import Bag
|
||||||
|
from ..models.bag_paperwork import BagPaperwork
|
||||||
|
|
||||||
|
|
||||||
|
T = TypeVar("T", bound="BagOrder")
|
||||||
|
|
||||||
|
|
||||||
|
@_attrs_define
|
||||||
|
class BagOrder:
|
||||||
|
"""
|
||||||
|
Attributes:
|
||||||
|
paperwork (BagPaperwork):
|
||||||
|
bags (list[Bag] | Unset): The bags associated with this order.
|
||||||
|
customer_ekp (int | Unset):
|
||||||
|
awb_id (int | Unset):
|
||||||
|
net_bulk_weight_in_kilogram (float | Unset): Example: 100.
|
||||||
|
order_id (int | Unset):
|
||||||
|
order_status (BagOrderOrderStatus | Unset):
|
||||||
|
"""
|
||||||
|
|
||||||
|
paperwork: BagPaperwork
|
||||||
|
bags: list[Bag] | Unset = UNSET
|
||||||
|
customer_ekp: int | Unset = UNSET
|
||||||
|
awb_id: int | Unset = UNSET
|
||||||
|
net_bulk_weight_in_kilogram: float | Unset = UNSET
|
||||||
|
order_id: int | Unset = UNSET
|
||||||
|
order_status: BagOrderOrderStatus | Unset = UNSET
|
||||||
|
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||||
|
|
||||||
|
def to_dict(self) -> dict[str, Any]:
|
||||||
|
paperwork = self.paperwork.to_dict()
|
||||||
|
|
||||||
|
bags: list[dict[str, Any]] | Unset = UNSET
|
||||||
|
if not isinstance(self.bags, Unset):
|
||||||
|
bags = []
|
||||||
|
for bags_item_data in self.bags:
|
||||||
|
bags_item = bags_item_data.to_dict()
|
||||||
|
bags.append(bags_item)
|
||||||
|
|
||||||
|
customer_ekp = self.customer_ekp
|
||||||
|
|
||||||
|
awb_id = self.awb_id
|
||||||
|
|
||||||
|
net_bulk_weight_in_kilogram = self.net_bulk_weight_in_kilogram
|
||||||
|
|
||||||
|
order_id = self.order_id
|
||||||
|
|
||||||
|
order_status: str | Unset = UNSET
|
||||||
|
if not isinstance(self.order_status, Unset):
|
||||||
|
order_status = self.order_status.value
|
||||||
|
|
||||||
|
field_dict: dict[str, Any] = {}
|
||||||
|
field_dict.update(self.additional_properties)
|
||||||
|
field_dict.update(
|
||||||
|
{
|
||||||
|
"paperwork": paperwork,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
if bags is not UNSET:
|
||||||
|
field_dict["bags"] = bags
|
||||||
|
if customer_ekp is not UNSET:
|
||||||
|
field_dict["customerEkp"] = customer_ekp
|
||||||
|
if awb_id is not UNSET:
|
||||||
|
field_dict["awbId"] = awb_id
|
||||||
|
if net_bulk_weight_in_kilogram is not UNSET:
|
||||||
|
field_dict["netBulkWeightInKilogram"] = net_bulk_weight_in_kilogram
|
||||||
|
if order_id is not UNSET:
|
||||||
|
field_dict["orderId"] = order_id
|
||||||
|
if order_status is not UNSET:
|
||||||
|
field_dict["orderStatus"] = order_status
|
||||||
|
|
||||||
|
return field_dict
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||||
|
from ..models.bag import Bag
|
||||||
|
from ..models.bag_paperwork import BagPaperwork
|
||||||
|
|
||||||
|
d = dict(src_dict)
|
||||||
|
paperwork = BagPaperwork.from_dict(d.pop("paperwork"))
|
||||||
|
|
||||||
|
_bags = d.pop("bags", UNSET)
|
||||||
|
bags: list[Bag] | Unset = UNSET
|
||||||
|
if _bags is not UNSET:
|
||||||
|
bags = []
|
||||||
|
for bags_item_data in _bags:
|
||||||
|
bags_item = Bag.from_dict(bags_item_data)
|
||||||
|
|
||||||
|
bags.append(bags_item)
|
||||||
|
|
||||||
|
customer_ekp = d.pop("customerEkp", UNSET)
|
||||||
|
|
||||||
|
awb_id = d.pop("awbId", UNSET)
|
||||||
|
|
||||||
|
net_bulk_weight_in_kilogram = d.pop("netBulkWeightInKilogram", UNSET)
|
||||||
|
|
||||||
|
order_id = d.pop("orderId", UNSET)
|
||||||
|
|
||||||
|
_order_status = d.pop("orderStatus", UNSET)
|
||||||
|
order_status: BagOrderOrderStatus | Unset
|
||||||
|
if isinstance(_order_status, Unset):
|
||||||
|
order_status = UNSET
|
||||||
|
else:
|
||||||
|
order_status = BagOrderOrderStatus(_order_status)
|
||||||
|
|
||||||
|
bag_order = cls(
|
||||||
|
paperwork=paperwork,
|
||||||
|
bags=bags,
|
||||||
|
customer_ekp=customer_ekp,
|
||||||
|
awb_id=awb_id,
|
||||||
|
net_bulk_weight_in_kilogram=net_bulk_weight_in_kilogram,
|
||||||
|
order_id=order_id,
|
||||||
|
order_status=order_status,
|
||||||
|
)
|
||||||
|
|
||||||
|
bag_order.additional_properties = d
|
||||||
|
return bag_order
|
||||||
|
|
||||||
|
@property
|
||||||
|
def additional_keys(self) -> list[str]:
|
||||||
|
return list(self.additional_properties.keys())
|
||||||
|
|
||||||
|
def __getitem__(self, key: str) -> Any:
|
||||||
|
return self.additional_properties[key]
|
||||||
|
|
||||||
|
def __setitem__(self, key: str, value: Any) -> None:
|
||||||
|
self.additional_properties[key] = value
|
||||||
|
|
||||||
|
def __delitem__(self, key: str) -> None:
|
||||||
|
del self.additional_properties[key]
|
||||||
|
|
||||||
|
def __contains__(self, key: str) -> bool:
|
||||||
|
return key in self.additional_properties
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
from enum import Enum
|
||||||
|
|
||||||
|
|
||||||
|
class BagOrderOrderStatus(str, Enum):
|
||||||
|
FINALIZE = "FINALIZE"
|
||||||
|
OPEN = "OPEN"
|
||||||
|
|
||||||
|
def __str__(self) -> str:
|
||||||
|
return str(self.value)
|
||||||
@@ -0,0 +1,107 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from collections.abc import Mapping
|
||||||
|
from typing import Any, TypeVar
|
||||||
|
|
||||||
|
from attrs import define as _attrs_define
|
||||||
|
from attrs import field as _attrs_field
|
||||||
|
|
||||||
|
from ..models.bag_paperwork_product import BagPaperworkProduct
|
||||||
|
from ..types import UNSET, Unset
|
||||||
|
|
||||||
|
T = TypeVar("T", bound="BagPaperwork")
|
||||||
|
|
||||||
|
|
||||||
|
@_attrs_define
|
||||||
|
class BagPaperwork:
|
||||||
|
"""
|
||||||
|
Attributes:
|
||||||
|
contact_name (str): Contact name for paperwork. Example: Max Mustermann.
|
||||||
|
product (BagPaperworkProduct): Product code. Example: GMM.
|
||||||
|
service_level (str): The service level of the order: PRIORITY Example: PRIORITY.
|
||||||
|
total_count_receptacles (int): Number of airway bills. Example: 3.
|
||||||
|
telephone_number (str | Unset): Telephone number for paperwork. Mandatory for sales channel EXPRESS. Example:
|
||||||
|
+491234567890.
|
||||||
|
job_reference (str | Unset): Job reference for paperwork. Example: Internal ID 03/14.
|
||||||
|
"""
|
||||||
|
|
||||||
|
contact_name: str
|
||||||
|
product: BagPaperworkProduct
|
||||||
|
service_level: str
|
||||||
|
total_count_receptacles: int
|
||||||
|
telephone_number: str | Unset = UNSET
|
||||||
|
job_reference: str | Unset = UNSET
|
||||||
|
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||||
|
|
||||||
|
def to_dict(self) -> dict[str, Any]:
|
||||||
|
contact_name = self.contact_name
|
||||||
|
|
||||||
|
product = self.product.value
|
||||||
|
|
||||||
|
service_level = self.service_level
|
||||||
|
|
||||||
|
total_count_receptacles = self.total_count_receptacles
|
||||||
|
|
||||||
|
telephone_number = self.telephone_number
|
||||||
|
|
||||||
|
job_reference = self.job_reference
|
||||||
|
|
||||||
|
field_dict: dict[str, Any] = {}
|
||||||
|
field_dict.update(self.additional_properties)
|
||||||
|
field_dict.update(
|
||||||
|
{
|
||||||
|
"contactName": contact_name,
|
||||||
|
"product": product,
|
||||||
|
"serviceLevel": service_level,
|
||||||
|
"totalCountReceptacles": total_count_receptacles,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
if telephone_number is not UNSET:
|
||||||
|
field_dict["telephoneNumber"] = telephone_number
|
||||||
|
if job_reference is not UNSET:
|
||||||
|
field_dict["jobReference"] = job_reference
|
||||||
|
|
||||||
|
return field_dict
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||||
|
d = dict(src_dict)
|
||||||
|
contact_name = d.pop("contactName")
|
||||||
|
|
||||||
|
product = BagPaperworkProduct(d.pop("product"))
|
||||||
|
|
||||||
|
service_level = d.pop("serviceLevel")
|
||||||
|
|
||||||
|
total_count_receptacles = d.pop("totalCountReceptacles")
|
||||||
|
|
||||||
|
telephone_number = d.pop("telephoneNumber", UNSET)
|
||||||
|
|
||||||
|
job_reference = d.pop("jobReference", UNSET)
|
||||||
|
|
||||||
|
bag_paperwork = cls(
|
||||||
|
contact_name=contact_name,
|
||||||
|
product=product,
|
||||||
|
service_level=service_level,
|
||||||
|
total_count_receptacles=total_count_receptacles,
|
||||||
|
telephone_number=telephone_number,
|
||||||
|
job_reference=job_reference,
|
||||||
|
)
|
||||||
|
|
||||||
|
bag_paperwork.additional_properties = d
|
||||||
|
return bag_paperwork
|
||||||
|
|
||||||
|
@property
|
||||||
|
def additional_keys(self) -> list[str]:
|
||||||
|
return list(self.additional_properties.keys())
|
||||||
|
|
||||||
|
def __getitem__(self, key: str) -> Any:
|
||||||
|
return self.additional_properties[key]
|
||||||
|
|
||||||
|
def __setitem__(self, key: str, value: Any) -> None:
|
||||||
|
self.additional_properties[key] = value
|
||||||
|
|
||||||
|
def __delitem__(self, key: str) -> None:
|
||||||
|
del self.additional_properties[key]
|
||||||
|
|
||||||
|
def __contains__(self, key: str) -> bool:
|
||||||
|
return key in self.additional_properties
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
from enum import Enum
|
||||||
|
|
||||||
|
|
||||||
|
class BagPaperworkProduct(str, Enum):
|
||||||
|
GMM = "GMM"
|
||||||
|
|
||||||
|
def __str__(self) -> str:
|
||||||
|
return str(self.value)
|
||||||
@@ -0,0 +1,240 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from collections.abc import Mapping
|
||||||
|
from typing import TYPE_CHECKING, Any, TypeVar
|
||||||
|
|
||||||
|
from attrs import define as _attrs_define
|
||||||
|
from attrs import field as _attrs_field
|
||||||
|
|
||||||
|
from ..models.bulk_bag_dto_packet_format import BulkBagDtoPacketFormat
|
||||||
|
from ..types import UNSET, Unset
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from ..models.bag_item_dto import BagItemDto
|
||||||
|
from ..models.bulk_bag_dto_validation_errors import BulkBagDtoValidationErrors
|
||||||
|
|
||||||
|
|
||||||
|
T = TypeVar("T", bound="BulkBagDto")
|
||||||
|
|
||||||
|
|
||||||
|
@_attrs_define
|
||||||
|
class BulkBagDto:
|
||||||
|
"""
|
||||||
|
Attributes:
|
||||||
|
id (int | Unset):
|
||||||
|
country_code (str | Unset):
|
||||||
|
customer_bag_id (str | Unset):
|
||||||
|
packet_format (BulkBagDtoPacketFormat | Unset):
|
||||||
|
item_count (int | Unset):
|
||||||
|
total_weight (float | Unset):
|
||||||
|
validation_errors (BulkBagDtoValidationErrors | Unset):
|
||||||
|
customer_reference (str | Unset):
|
||||||
|
shipment_type (str | Unset):
|
||||||
|
bag_tracking (bool | Unset):
|
||||||
|
auth_user (str | Unset):
|
||||||
|
printed (bool | Unset):
|
||||||
|
ui_row_selected (bool | Unset):
|
||||||
|
number (int | Unset):
|
||||||
|
items (list[BagItemDto] | Unset):
|
||||||
|
linked_item_count (int | Unset):
|
||||||
|
weight_per_item (float | Unset):
|
||||||
|
"""
|
||||||
|
|
||||||
|
id: int | Unset = UNSET
|
||||||
|
country_code: str | Unset = UNSET
|
||||||
|
customer_bag_id: str | Unset = UNSET
|
||||||
|
packet_format: BulkBagDtoPacketFormat | Unset = UNSET
|
||||||
|
item_count: int | Unset = UNSET
|
||||||
|
total_weight: float | Unset = UNSET
|
||||||
|
validation_errors: BulkBagDtoValidationErrors | Unset = UNSET
|
||||||
|
customer_reference: str | Unset = UNSET
|
||||||
|
shipment_type: str | Unset = UNSET
|
||||||
|
bag_tracking: bool | Unset = UNSET
|
||||||
|
auth_user: str | Unset = UNSET
|
||||||
|
printed: bool | Unset = UNSET
|
||||||
|
ui_row_selected: bool | Unset = UNSET
|
||||||
|
number: int | Unset = UNSET
|
||||||
|
items: list[BagItemDto] | Unset = UNSET
|
||||||
|
linked_item_count: int | Unset = UNSET
|
||||||
|
weight_per_item: float | Unset = UNSET
|
||||||
|
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||||
|
|
||||||
|
def to_dict(self) -> dict[str, Any]:
|
||||||
|
id = self.id
|
||||||
|
|
||||||
|
country_code = self.country_code
|
||||||
|
|
||||||
|
customer_bag_id = self.customer_bag_id
|
||||||
|
|
||||||
|
packet_format: str | Unset = UNSET
|
||||||
|
if not isinstance(self.packet_format, Unset):
|
||||||
|
packet_format = self.packet_format.value
|
||||||
|
|
||||||
|
item_count = self.item_count
|
||||||
|
|
||||||
|
total_weight = self.total_weight
|
||||||
|
|
||||||
|
validation_errors: dict[str, Any] | Unset = UNSET
|
||||||
|
if not isinstance(self.validation_errors, Unset):
|
||||||
|
validation_errors = self.validation_errors.to_dict()
|
||||||
|
|
||||||
|
customer_reference = self.customer_reference
|
||||||
|
|
||||||
|
shipment_type = self.shipment_type
|
||||||
|
|
||||||
|
bag_tracking = self.bag_tracking
|
||||||
|
|
||||||
|
auth_user = self.auth_user
|
||||||
|
|
||||||
|
printed = self.printed
|
||||||
|
|
||||||
|
ui_row_selected = self.ui_row_selected
|
||||||
|
|
||||||
|
number = self.number
|
||||||
|
|
||||||
|
items: list[dict[str, Any]] | Unset = UNSET
|
||||||
|
if not isinstance(self.items, Unset):
|
||||||
|
items = []
|
||||||
|
for items_item_data in self.items:
|
||||||
|
items_item = items_item_data.to_dict()
|
||||||
|
items.append(items_item)
|
||||||
|
|
||||||
|
linked_item_count = self.linked_item_count
|
||||||
|
|
||||||
|
weight_per_item = self.weight_per_item
|
||||||
|
|
||||||
|
field_dict: dict[str, Any] = {}
|
||||||
|
field_dict.update(self.additional_properties)
|
||||||
|
field_dict.update({})
|
||||||
|
if id is not UNSET:
|
||||||
|
field_dict["id"] = id
|
||||||
|
if country_code is not UNSET:
|
||||||
|
field_dict["countryCode"] = country_code
|
||||||
|
if customer_bag_id is not UNSET:
|
||||||
|
field_dict["customerBagId"] = customer_bag_id
|
||||||
|
if packet_format is not UNSET:
|
||||||
|
field_dict["packetFormat"] = packet_format
|
||||||
|
if item_count is not UNSET:
|
||||||
|
field_dict["itemCount"] = item_count
|
||||||
|
if total_weight is not UNSET:
|
||||||
|
field_dict["totalWeight"] = total_weight
|
||||||
|
if validation_errors is not UNSET:
|
||||||
|
field_dict["validationErrors"] = validation_errors
|
||||||
|
if customer_reference is not UNSET:
|
||||||
|
field_dict["customerReference"] = customer_reference
|
||||||
|
if shipment_type is not UNSET:
|
||||||
|
field_dict["shipmentType"] = shipment_type
|
||||||
|
if bag_tracking is not UNSET:
|
||||||
|
field_dict["bagTracking"] = bag_tracking
|
||||||
|
if auth_user is not UNSET:
|
||||||
|
field_dict["authUser"] = auth_user
|
||||||
|
if printed is not UNSET:
|
||||||
|
field_dict["printed"] = printed
|
||||||
|
if ui_row_selected is not UNSET:
|
||||||
|
field_dict["uiRowSelected"] = ui_row_selected
|
||||||
|
if number is not UNSET:
|
||||||
|
field_dict["number"] = number
|
||||||
|
if items is not UNSET:
|
||||||
|
field_dict["items"] = items
|
||||||
|
if linked_item_count is not UNSET:
|
||||||
|
field_dict["linkedItemCount"] = linked_item_count
|
||||||
|
if weight_per_item is not UNSET:
|
||||||
|
field_dict["weightPerItem"] = weight_per_item
|
||||||
|
|
||||||
|
return field_dict
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||||
|
from ..models.bag_item_dto import BagItemDto
|
||||||
|
from ..models.bulk_bag_dto_validation_errors import BulkBagDtoValidationErrors
|
||||||
|
|
||||||
|
d = dict(src_dict)
|
||||||
|
id = d.pop("id", UNSET)
|
||||||
|
|
||||||
|
country_code = d.pop("countryCode", UNSET)
|
||||||
|
|
||||||
|
customer_bag_id = d.pop("customerBagId", UNSET)
|
||||||
|
|
||||||
|
_packet_format = d.pop("packetFormat", UNSET)
|
||||||
|
packet_format: BulkBagDtoPacketFormat | Unset
|
||||||
|
if isinstance(_packet_format, Unset):
|
||||||
|
packet_format = UNSET
|
||||||
|
else:
|
||||||
|
packet_format = BulkBagDtoPacketFormat(_packet_format)
|
||||||
|
|
||||||
|
item_count = d.pop("itemCount", UNSET)
|
||||||
|
|
||||||
|
total_weight = d.pop("totalWeight", UNSET)
|
||||||
|
|
||||||
|
_validation_errors = d.pop("validationErrors", UNSET)
|
||||||
|
validation_errors: BulkBagDtoValidationErrors | Unset
|
||||||
|
if isinstance(_validation_errors, Unset):
|
||||||
|
validation_errors = UNSET
|
||||||
|
else:
|
||||||
|
validation_errors = BulkBagDtoValidationErrors.from_dict(_validation_errors)
|
||||||
|
|
||||||
|
customer_reference = d.pop("customerReference", UNSET)
|
||||||
|
|
||||||
|
shipment_type = d.pop("shipmentType", UNSET)
|
||||||
|
|
||||||
|
bag_tracking = d.pop("bagTracking", UNSET)
|
||||||
|
|
||||||
|
auth_user = d.pop("authUser", UNSET)
|
||||||
|
|
||||||
|
printed = d.pop("printed", UNSET)
|
||||||
|
|
||||||
|
ui_row_selected = d.pop("uiRowSelected", UNSET)
|
||||||
|
|
||||||
|
number = d.pop("number", UNSET)
|
||||||
|
|
||||||
|
_items = d.pop("items", UNSET)
|
||||||
|
items: list[BagItemDto] | Unset = UNSET
|
||||||
|
if _items is not UNSET:
|
||||||
|
items = []
|
||||||
|
for items_item_data in _items:
|
||||||
|
items_item = BagItemDto.from_dict(items_item_data)
|
||||||
|
|
||||||
|
items.append(items_item)
|
||||||
|
|
||||||
|
linked_item_count = d.pop("linkedItemCount", UNSET)
|
||||||
|
|
||||||
|
weight_per_item = d.pop("weightPerItem", UNSET)
|
||||||
|
|
||||||
|
bulk_bag_dto = cls(
|
||||||
|
id=id,
|
||||||
|
country_code=country_code,
|
||||||
|
customer_bag_id=customer_bag_id,
|
||||||
|
packet_format=packet_format,
|
||||||
|
item_count=item_count,
|
||||||
|
total_weight=total_weight,
|
||||||
|
validation_errors=validation_errors,
|
||||||
|
customer_reference=customer_reference,
|
||||||
|
shipment_type=shipment_type,
|
||||||
|
bag_tracking=bag_tracking,
|
||||||
|
auth_user=auth_user,
|
||||||
|
printed=printed,
|
||||||
|
ui_row_selected=ui_row_selected,
|
||||||
|
number=number,
|
||||||
|
items=items,
|
||||||
|
linked_item_count=linked_item_count,
|
||||||
|
weight_per_item=weight_per_item,
|
||||||
|
)
|
||||||
|
|
||||||
|
bulk_bag_dto.additional_properties = d
|
||||||
|
return bulk_bag_dto
|
||||||
|
|
||||||
|
@property
|
||||||
|
def additional_keys(self) -> list[str]:
|
||||||
|
return list(self.additional_properties.keys())
|
||||||
|
|
||||||
|
def __getitem__(self, key: str) -> Any:
|
||||||
|
return self.additional_properties[key]
|
||||||
|
|
||||||
|
def __setitem__(self, key: str, value: Any) -> None:
|
||||||
|
self.additional_properties[key] = value
|
||||||
|
|
||||||
|
def __delitem__(self, key: str) -> None:
|
||||||
|
del self.additional_properties[key]
|
||||||
|
|
||||||
|
def __contains__(self, key: str) -> bool:
|
||||||
|
return key in self.additional_properties
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
from enum import Enum
|
||||||
|
|
||||||
|
|
||||||
|
class BulkBagDtoPacketFormat(str, Enum):
|
||||||
|
E = "E"
|
||||||
|
E_BAG = "E_BAG"
|
||||||
|
E_PALLET = "E_PALLET"
|
||||||
|
G = "G"
|
||||||
|
G_BAG = "G_BAG"
|
||||||
|
G_PALLET = "G_PALLET"
|
||||||
|
MIXED = "MIXED"
|
||||||
|
P = "P"
|
||||||
|
P_BAG = "P_BAG"
|
||||||
|
P_PALLET = "P_PALLET"
|
||||||
|
|
||||||
|
def __str__(self) -> str:
|
||||||
|
return str(self.value)
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from collections.abc import Mapping
|
||||||
|
from typing import Any, TypeVar
|
||||||
|
|
||||||
|
from attrs import define as _attrs_define
|
||||||
|
from attrs import field as _attrs_field
|
||||||
|
|
||||||
|
T = TypeVar("T", bound="BulkBagDtoValidationErrors")
|
||||||
|
|
||||||
|
|
||||||
|
@_attrs_define
|
||||||
|
class BulkBagDtoValidationErrors:
|
||||||
|
""" """
|
||||||
|
|
||||||
|
additional_properties: dict[str, str] = _attrs_field(init=False, factory=dict)
|
||||||
|
|
||||||
|
def to_dict(self) -> dict[str, Any]:
|
||||||
|
field_dict: dict[str, Any] = {}
|
||||||
|
field_dict.update(self.additional_properties)
|
||||||
|
|
||||||
|
return field_dict
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||||
|
d = dict(src_dict)
|
||||||
|
bulk_bag_dto_validation_errors = cls()
|
||||||
|
|
||||||
|
bulk_bag_dto_validation_errors.additional_properties = d
|
||||||
|
return bulk_bag_dto_validation_errors
|
||||||
|
|
||||||
|
@property
|
||||||
|
def additional_keys(self) -> list[str]:
|
||||||
|
return list(self.additional_properties.keys())
|
||||||
|
|
||||||
|
def __getitem__(self, key: str) -> str:
|
||||||
|
return self.additional_properties[key]
|
||||||
|
|
||||||
|
def __setitem__(self, key: str, value: str) -> None:
|
||||||
|
self.additional_properties[key] = value
|
||||||
|
|
||||||
|
def __delitem__(self, key: str) -> None:
|
||||||
|
del self.additional_properties[key]
|
||||||
|
|
||||||
|
def __contains__(self, key: str) -> bool:
|
||||||
|
return key in self.additional_properties
|
||||||
@@ -0,0 +1,332 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import datetime
|
||||||
|
from collections.abc import Mapping
|
||||||
|
from typing import TYPE_CHECKING, Any, TypeVar
|
||||||
|
|
||||||
|
from attrs import define as _attrs_define
|
||||||
|
from attrs import field as _attrs_field
|
||||||
|
from dateutil.parser import isoparse
|
||||||
|
|
||||||
|
from ..models.bulk_order_dto_bulk_order_type import BulkOrderDtoBulkOrderType
|
||||||
|
from ..models.bulk_order_dto_order_classification import BulkOrderDtoOrderClassification
|
||||||
|
from ..models.bulk_order_dto_product_type import BulkOrderDtoProductType
|
||||||
|
from ..models.bulk_order_dto_status import BulkOrderDtoStatus
|
||||||
|
from ..types import UNSET, Unset
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from ..models.bulk_bag_dto import BulkBagDto
|
||||||
|
|
||||||
|
|
||||||
|
T = TypeVar("T", bound="BulkOrderDto")
|
||||||
|
|
||||||
|
|
||||||
|
@_attrs_define
|
||||||
|
class BulkOrderDto:
|
||||||
|
"""
|
||||||
|
Attributes:
|
||||||
|
id (int | Unset):
|
||||||
|
contact_name (str | Unset):
|
||||||
|
phone_number (str | Unset):
|
||||||
|
job_reference (str | Unset):
|
||||||
|
product_type (BulkOrderDtoProductType | Unset):
|
||||||
|
bulk_order_type (BulkOrderDtoBulkOrderType | Unset):
|
||||||
|
awb (str | Unset):
|
||||||
|
bulk_bags (list[BulkBagDto] | Unset):
|
||||||
|
status (BulkOrderDtoStatus | Unset):
|
||||||
|
validation_errors (bool | Unset): Default: False.
|
||||||
|
error_message (str | Unset):
|
||||||
|
number_of_copies (int | Unset):
|
||||||
|
download_token (str | Unset):
|
||||||
|
printable (bool | Unset):
|
||||||
|
order_classification (BulkOrderDtoOrderClassification | Unset):
|
||||||
|
created_at (datetime.datetime | Unset):
|
||||||
|
created_by (str | Unset):
|
||||||
|
auth_user (str | Unset):
|
||||||
|
send_date (datetime.datetime | Unset):
|
||||||
|
submitted_date (datetime.datetime | Unset):
|
||||||
|
preadvice_eligible (bool | Unset):
|
||||||
|
finalised (bool | Unset):
|
||||||
|
total_item_weight_sum (float | Unset):
|
||||||
|
"""
|
||||||
|
|
||||||
|
id: int | Unset = UNSET
|
||||||
|
contact_name: str | Unset = UNSET
|
||||||
|
phone_number: str | Unset = UNSET
|
||||||
|
job_reference: str | Unset = UNSET
|
||||||
|
product_type: BulkOrderDtoProductType | Unset = UNSET
|
||||||
|
bulk_order_type: BulkOrderDtoBulkOrderType | Unset = UNSET
|
||||||
|
awb: str | Unset = UNSET
|
||||||
|
bulk_bags: list[BulkBagDto] | Unset = UNSET
|
||||||
|
status: BulkOrderDtoStatus | Unset = UNSET
|
||||||
|
validation_errors: bool | Unset = False
|
||||||
|
error_message: str | Unset = UNSET
|
||||||
|
number_of_copies: int | Unset = UNSET
|
||||||
|
download_token: str | Unset = UNSET
|
||||||
|
printable: bool | Unset = UNSET
|
||||||
|
order_classification: BulkOrderDtoOrderClassification | Unset = UNSET
|
||||||
|
created_at: datetime.datetime | Unset = UNSET
|
||||||
|
created_by: str | Unset = UNSET
|
||||||
|
auth_user: str | Unset = UNSET
|
||||||
|
send_date: datetime.datetime | Unset = UNSET
|
||||||
|
submitted_date: datetime.datetime | Unset = UNSET
|
||||||
|
preadvice_eligible: bool | Unset = UNSET
|
||||||
|
finalised: bool | Unset = UNSET
|
||||||
|
total_item_weight_sum: float | Unset = UNSET
|
||||||
|
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||||
|
|
||||||
|
def to_dict(self) -> dict[str, Any]:
|
||||||
|
id = self.id
|
||||||
|
|
||||||
|
contact_name = self.contact_name
|
||||||
|
|
||||||
|
phone_number = self.phone_number
|
||||||
|
|
||||||
|
job_reference = self.job_reference
|
||||||
|
|
||||||
|
product_type: str | Unset = UNSET
|
||||||
|
if not isinstance(self.product_type, Unset):
|
||||||
|
product_type = self.product_type.value
|
||||||
|
|
||||||
|
bulk_order_type: str | Unset = UNSET
|
||||||
|
if not isinstance(self.bulk_order_type, Unset):
|
||||||
|
bulk_order_type = self.bulk_order_type.value
|
||||||
|
|
||||||
|
awb = self.awb
|
||||||
|
|
||||||
|
bulk_bags: list[dict[str, Any]] | Unset = UNSET
|
||||||
|
if not isinstance(self.bulk_bags, Unset):
|
||||||
|
bulk_bags = []
|
||||||
|
for bulk_bags_item_data in self.bulk_bags:
|
||||||
|
bulk_bags_item = bulk_bags_item_data.to_dict()
|
||||||
|
bulk_bags.append(bulk_bags_item)
|
||||||
|
|
||||||
|
status: str | Unset = UNSET
|
||||||
|
if not isinstance(self.status, Unset):
|
||||||
|
status = self.status.value
|
||||||
|
|
||||||
|
validation_errors = self.validation_errors
|
||||||
|
|
||||||
|
error_message = self.error_message
|
||||||
|
|
||||||
|
number_of_copies = self.number_of_copies
|
||||||
|
|
||||||
|
download_token = self.download_token
|
||||||
|
|
||||||
|
printable = self.printable
|
||||||
|
|
||||||
|
order_classification: str | Unset = UNSET
|
||||||
|
if not isinstance(self.order_classification, Unset):
|
||||||
|
order_classification = self.order_classification.value
|
||||||
|
|
||||||
|
created_at: str | Unset = UNSET
|
||||||
|
if not isinstance(self.created_at, Unset):
|
||||||
|
created_at = self.created_at.isoformat()
|
||||||
|
|
||||||
|
created_by = self.created_by
|
||||||
|
|
||||||
|
auth_user = self.auth_user
|
||||||
|
|
||||||
|
send_date: str | Unset = UNSET
|
||||||
|
if not isinstance(self.send_date, Unset):
|
||||||
|
send_date = self.send_date.isoformat()
|
||||||
|
|
||||||
|
submitted_date: str | Unset = UNSET
|
||||||
|
if not isinstance(self.submitted_date, Unset):
|
||||||
|
submitted_date = self.submitted_date.isoformat()
|
||||||
|
|
||||||
|
preadvice_eligible = self.preadvice_eligible
|
||||||
|
|
||||||
|
finalised = self.finalised
|
||||||
|
|
||||||
|
total_item_weight_sum = self.total_item_weight_sum
|
||||||
|
|
||||||
|
field_dict: dict[str, Any] = {}
|
||||||
|
field_dict.update(self.additional_properties)
|
||||||
|
field_dict.update({})
|
||||||
|
if id is not UNSET:
|
||||||
|
field_dict["id"] = id
|
||||||
|
if contact_name is not UNSET:
|
||||||
|
field_dict["contactName"] = contact_name
|
||||||
|
if phone_number is not UNSET:
|
||||||
|
field_dict["phoneNumber"] = phone_number
|
||||||
|
if job_reference is not UNSET:
|
||||||
|
field_dict["jobReference"] = job_reference
|
||||||
|
if product_type is not UNSET:
|
||||||
|
field_dict["productType"] = product_type
|
||||||
|
if bulk_order_type is not UNSET:
|
||||||
|
field_dict["bulkOrderType"] = bulk_order_type
|
||||||
|
if awb is not UNSET:
|
||||||
|
field_dict["awb"] = awb
|
||||||
|
if bulk_bags is not UNSET:
|
||||||
|
field_dict["bulkBags"] = bulk_bags
|
||||||
|
if status is not UNSET:
|
||||||
|
field_dict["status"] = status
|
||||||
|
if validation_errors is not UNSET:
|
||||||
|
field_dict["validationErrors"] = validation_errors
|
||||||
|
if error_message is not UNSET:
|
||||||
|
field_dict["errorMessage"] = error_message
|
||||||
|
if number_of_copies is not UNSET:
|
||||||
|
field_dict["numberOfCopies"] = number_of_copies
|
||||||
|
if download_token is not UNSET:
|
||||||
|
field_dict["downloadToken"] = download_token
|
||||||
|
if printable is not UNSET:
|
||||||
|
field_dict["printable"] = printable
|
||||||
|
if order_classification is not UNSET:
|
||||||
|
field_dict["orderClassification"] = order_classification
|
||||||
|
if created_at is not UNSET:
|
||||||
|
field_dict["createdAt"] = created_at
|
||||||
|
if created_by is not UNSET:
|
||||||
|
field_dict["createdBy"] = created_by
|
||||||
|
if auth_user is not UNSET:
|
||||||
|
field_dict["authUser"] = auth_user
|
||||||
|
if send_date is not UNSET:
|
||||||
|
field_dict["sendDate"] = send_date
|
||||||
|
if submitted_date is not UNSET:
|
||||||
|
field_dict["submittedDate"] = submitted_date
|
||||||
|
if preadvice_eligible is not UNSET:
|
||||||
|
field_dict["preadviceEligible"] = preadvice_eligible
|
||||||
|
if finalised is not UNSET:
|
||||||
|
field_dict["finalised"] = finalised
|
||||||
|
if total_item_weight_sum is not UNSET:
|
||||||
|
field_dict["totalItemWeightSum"] = total_item_weight_sum
|
||||||
|
|
||||||
|
return field_dict
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||||
|
from ..models.bulk_bag_dto import BulkBagDto
|
||||||
|
|
||||||
|
d = dict(src_dict)
|
||||||
|
id = d.pop("id", UNSET)
|
||||||
|
|
||||||
|
contact_name = d.pop("contactName", UNSET)
|
||||||
|
|
||||||
|
phone_number = d.pop("phoneNumber", UNSET)
|
||||||
|
|
||||||
|
job_reference = d.pop("jobReference", UNSET)
|
||||||
|
|
||||||
|
_product_type = d.pop("productType", UNSET)
|
||||||
|
product_type: BulkOrderDtoProductType | Unset
|
||||||
|
if isinstance(_product_type, Unset):
|
||||||
|
product_type = UNSET
|
||||||
|
else:
|
||||||
|
product_type = BulkOrderDtoProductType(_product_type)
|
||||||
|
|
||||||
|
_bulk_order_type = d.pop("bulkOrderType", UNSET)
|
||||||
|
bulk_order_type: BulkOrderDtoBulkOrderType | Unset
|
||||||
|
if isinstance(_bulk_order_type, Unset):
|
||||||
|
bulk_order_type = UNSET
|
||||||
|
else:
|
||||||
|
bulk_order_type = BulkOrderDtoBulkOrderType(_bulk_order_type)
|
||||||
|
|
||||||
|
awb = d.pop("awb", UNSET)
|
||||||
|
|
||||||
|
_bulk_bags = d.pop("bulkBags", UNSET)
|
||||||
|
bulk_bags: list[BulkBagDto] | Unset = UNSET
|
||||||
|
if _bulk_bags is not UNSET:
|
||||||
|
bulk_bags = []
|
||||||
|
for bulk_bags_item_data in _bulk_bags:
|
||||||
|
bulk_bags_item = BulkBagDto.from_dict(bulk_bags_item_data)
|
||||||
|
|
||||||
|
bulk_bags.append(bulk_bags_item)
|
||||||
|
|
||||||
|
_status = d.pop("status", UNSET)
|
||||||
|
status: BulkOrderDtoStatus | Unset
|
||||||
|
if isinstance(_status, Unset):
|
||||||
|
status = UNSET
|
||||||
|
else:
|
||||||
|
status = BulkOrderDtoStatus(_status)
|
||||||
|
|
||||||
|
validation_errors = d.pop("validationErrors", UNSET)
|
||||||
|
|
||||||
|
error_message = d.pop("errorMessage", UNSET)
|
||||||
|
|
||||||
|
number_of_copies = d.pop("numberOfCopies", UNSET)
|
||||||
|
|
||||||
|
download_token = d.pop("downloadToken", UNSET)
|
||||||
|
|
||||||
|
printable = d.pop("printable", UNSET)
|
||||||
|
|
||||||
|
_order_classification = d.pop("orderClassification", UNSET)
|
||||||
|
order_classification: BulkOrderDtoOrderClassification | Unset
|
||||||
|
if isinstance(_order_classification, Unset):
|
||||||
|
order_classification = UNSET
|
||||||
|
else:
|
||||||
|
order_classification = BulkOrderDtoOrderClassification(_order_classification)
|
||||||
|
|
||||||
|
_created_at = d.pop("createdAt", UNSET)
|
||||||
|
created_at: datetime.datetime | Unset
|
||||||
|
if isinstance(_created_at, Unset):
|
||||||
|
created_at = UNSET
|
||||||
|
else:
|
||||||
|
created_at = isoparse(_created_at)
|
||||||
|
|
||||||
|
created_by = d.pop("createdBy", UNSET)
|
||||||
|
|
||||||
|
auth_user = d.pop("authUser", UNSET)
|
||||||
|
|
||||||
|
_send_date = d.pop("sendDate", UNSET)
|
||||||
|
send_date: datetime.datetime | Unset
|
||||||
|
if isinstance(_send_date, Unset):
|
||||||
|
send_date = UNSET
|
||||||
|
else:
|
||||||
|
send_date = isoparse(_send_date)
|
||||||
|
|
||||||
|
_submitted_date = d.pop("submittedDate", UNSET)
|
||||||
|
submitted_date: datetime.datetime | Unset
|
||||||
|
if isinstance(_submitted_date, Unset):
|
||||||
|
submitted_date = UNSET
|
||||||
|
else:
|
||||||
|
submitted_date = isoparse(_submitted_date)
|
||||||
|
|
||||||
|
preadvice_eligible = d.pop("preadviceEligible", UNSET)
|
||||||
|
|
||||||
|
finalised = d.pop("finalised", UNSET)
|
||||||
|
|
||||||
|
total_item_weight_sum = d.pop("totalItemWeightSum", UNSET)
|
||||||
|
|
||||||
|
bulk_order_dto = cls(
|
||||||
|
id=id,
|
||||||
|
contact_name=contact_name,
|
||||||
|
phone_number=phone_number,
|
||||||
|
job_reference=job_reference,
|
||||||
|
product_type=product_type,
|
||||||
|
bulk_order_type=bulk_order_type,
|
||||||
|
awb=awb,
|
||||||
|
bulk_bags=bulk_bags,
|
||||||
|
status=status,
|
||||||
|
validation_errors=validation_errors,
|
||||||
|
error_message=error_message,
|
||||||
|
number_of_copies=number_of_copies,
|
||||||
|
download_token=download_token,
|
||||||
|
printable=printable,
|
||||||
|
order_classification=order_classification,
|
||||||
|
created_at=created_at,
|
||||||
|
created_by=created_by,
|
||||||
|
auth_user=auth_user,
|
||||||
|
send_date=send_date,
|
||||||
|
submitted_date=submitted_date,
|
||||||
|
preadvice_eligible=preadvice_eligible,
|
||||||
|
finalised=finalised,
|
||||||
|
total_item_weight_sum=total_item_weight_sum,
|
||||||
|
)
|
||||||
|
|
||||||
|
bulk_order_dto.additional_properties = d
|
||||||
|
return bulk_order_dto
|
||||||
|
|
||||||
|
@property
|
||||||
|
def additional_keys(self) -> list[str]:
|
||||||
|
return list(self.additional_properties.keys())
|
||||||
|
|
||||||
|
def __getitem__(self, key: str) -> Any:
|
||||||
|
return self.additional_properties[key]
|
||||||
|
|
||||||
|
def __setitem__(self, key: str, value: Any) -> None:
|
||||||
|
self.additional_properties[key] = value
|
||||||
|
|
||||||
|
def __delitem__(self, key: str) -> None:
|
||||||
|
del self.additional_properties[key]
|
||||||
|
|
||||||
|
def __contains__(self, key: str) -> bool:
|
||||||
|
return key in self.additional_properties
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
from enum import Enum
|
||||||
|
|
||||||
|
|
||||||
|
class BulkOrderDtoBulkOrderType(str, Enum):
|
||||||
|
MIXED = "MIXED"
|
||||||
|
STANDARD = "STANDARD"
|
||||||
|
|
||||||
|
def __str__(self) -> str:
|
||||||
|
return str(self.value)
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
from enum import Enum
|
||||||
|
|
||||||
|
|
||||||
|
class BulkOrderDtoOrderClassification(str, Enum):
|
||||||
|
BAG = "BAG"
|
||||||
|
BAG_AND_BULK = "BAG_AND_BULK"
|
||||||
|
BULK = "BULK"
|
||||||
|
|
||||||
|
def __str__(self) -> str:
|
||||||
|
return str(self.value)
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
from enum import Enum
|
||||||
|
|
||||||
|
|
||||||
|
class BulkOrderDtoProductType(str, Enum):
|
||||||
|
EXPRESS_LETTER_PLUS = "EXPRESS_LETTER_PLUS"
|
||||||
|
EXPRESS_LETTER_PRIO = "EXPRESS_LETTER_PRIO"
|
||||||
|
EXPRESS_PACKET_PLUS = "EXPRESS_PACKET_PLUS"
|
||||||
|
EXPRESS_PACKET_PRIO = "EXPRESS_PACKET_PRIO"
|
||||||
|
EXPRESS_PACKET_TRACKED = "EXPRESS_PACKET_TRACKED"
|
||||||
|
GM_MAIL_PRIO = "GM_MAIL_PRIO"
|
||||||
|
GM_MAIL_REG = "GM_MAIL_REG"
|
||||||
|
GM_MAIL_STANDARD = "GM_MAIL_STANDARD"
|
||||||
|
GM_PACKET_PLUS = "GM_PACKET_PLUS"
|
||||||
|
GM_PACKET_PRIO = "GM_PACKET_PRIO"
|
||||||
|
GM_PACKET_STANDARD = "GM_PACKET_STANDARD"
|
||||||
|
GM_PACKET_TRACKED = "GM_PACKET_TRACKED"
|
||||||
|
|
||||||
|
def __str__(self) -> str:
|
||||||
|
return str(self.value)
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
from enum import Enum
|
||||||
|
|
||||||
|
|
||||||
|
class BulkOrderDtoStatus(str, Enum):
|
||||||
|
EDITING = "EDITING"
|
||||||
|
LOCKED = "LOCKED"
|
||||||
|
SAVED = "SAVED"
|
||||||
|
SUBMITTED = "SUBMITTED"
|
||||||
|
UNBAGGED = "UNBAGGED"
|
||||||
|
|
||||||
|
def __str__(self) -> str:
|
||||||
|
return str(self.value)
|
||||||
@@ -0,0 +1,136 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from collections.abc import Mapping
|
||||||
|
from typing import Any, TypeVar, cast
|
||||||
|
|
||||||
|
from attrs import define as _attrs_define
|
||||||
|
from attrs import field as _attrs_field
|
||||||
|
|
||||||
|
from ..models.closed_bag_service_level import ClosedBagServiceLevel
|
||||||
|
from ..types import UNSET, Unset
|
||||||
|
|
||||||
|
T = TypeVar("T", bound="ClosedBag")
|
||||||
|
|
||||||
|
|
||||||
|
@_attrs_define
|
||||||
|
class ClosedBag:
|
||||||
|
"""
|
||||||
|
Attributes:
|
||||||
|
product (str): The product that is used for the shipment of this item. Available products are: GMP (Packet), GMM
|
||||||
|
(Business Mail Standard). Example: GMM.
|
||||||
|
format_ (str): The format of the content of this bag.
|
||||||
|
service_level (ClosedBagServiceLevel): The service level that is used for the shipment of this item. There are
|
||||||
|
restrictions for use of service level: STANDARD is only available with products GMM and GMP, PRIORITY is only
|
||||||
|
available with products GMM and GMP. Example: PRIORITY.
|
||||||
|
destination_country (str): The destination country code.
|
||||||
|
item_barcodes (list[str]): The barcodes of the already created items.
|
||||||
|
bag_id (str | Unset): The BagId to track the bag. In requests only applicable for customers using "prelabelled
|
||||||
|
service"
|
||||||
|
item_count (int | Unset): The number of items. This value is only for the response.
|
||||||
|
net_bulk_weight_in_kilogram (float | Unset): The weight of items. This value is only for the response.
|
||||||
|
customer_ekp (str | Unset): The customer ekp. This value is only for the response.
|
||||||
|
"""
|
||||||
|
|
||||||
|
product: str
|
||||||
|
format_: str
|
||||||
|
service_level: ClosedBagServiceLevel
|
||||||
|
destination_country: str
|
||||||
|
item_barcodes: list[str]
|
||||||
|
bag_id: str | Unset = UNSET
|
||||||
|
item_count: int | Unset = UNSET
|
||||||
|
net_bulk_weight_in_kilogram: float | Unset = UNSET
|
||||||
|
customer_ekp: str | Unset = UNSET
|
||||||
|
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||||
|
|
||||||
|
def to_dict(self) -> dict[str, Any]:
|
||||||
|
product = self.product
|
||||||
|
|
||||||
|
format_ = self.format_
|
||||||
|
|
||||||
|
service_level = self.service_level.value
|
||||||
|
|
||||||
|
destination_country = self.destination_country
|
||||||
|
|
||||||
|
item_barcodes = self.item_barcodes
|
||||||
|
|
||||||
|
bag_id = self.bag_id
|
||||||
|
|
||||||
|
item_count = self.item_count
|
||||||
|
|
||||||
|
net_bulk_weight_in_kilogram = self.net_bulk_weight_in_kilogram
|
||||||
|
|
||||||
|
customer_ekp = self.customer_ekp
|
||||||
|
|
||||||
|
field_dict: dict[str, Any] = {}
|
||||||
|
field_dict.update(self.additional_properties)
|
||||||
|
field_dict.update(
|
||||||
|
{
|
||||||
|
"product": product,
|
||||||
|
"format": format_,
|
||||||
|
"serviceLevel": service_level,
|
||||||
|
"destinationCountry": destination_country,
|
||||||
|
"itemBarcodes": item_barcodes,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
if bag_id is not UNSET:
|
||||||
|
field_dict["bagId"] = bag_id
|
||||||
|
if item_count is not UNSET:
|
||||||
|
field_dict["itemCount"] = item_count
|
||||||
|
if net_bulk_weight_in_kilogram is not UNSET:
|
||||||
|
field_dict["netBulkWeightInKilogram"] = net_bulk_weight_in_kilogram
|
||||||
|
if customer_ekp is not UNSET:
|
||||||
|
field_dict["customerEkp"] = customer_ekp
|
||||||
|
|
||||||
|
return field_dict
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||||
|
d = dict(src_dict)
|
||||||
|
product = d.pop("product")
|
||||||
|
|
||||||
|
format_ = d.pop("format")
|
||||||
|
|
||||||
|
service_level = ClosedBagServiceLevel(d.pop("serviceLevel"))
|
||||||
|
|
||||||
|
destination_country = d.pop("destinationCountry")
|
||||||
|
|
||||||
|
item_barcodes = cast(list[str], d.pop("itemBarcodes"))
|
||||||
|
|
||||||
|
bag_id = d.pop("bagId", UNSET)
|
||||||
|
|
||||||
|
item_count = d.pop("itemCount", UNSET)
|
||||||
|
|
||||||
|
net_bulk_weight_in_kilogram = d.pop("netBulkWeightInKilogram", UNSET)
|
||||||
|
|
||||||
|
customer_ekp = d.pop("customerEkp", UNSET)
|
||||||
|
|
||||||
|
closed_bag = cls(
|
||||||
|
product=product,
|
||||||
|
format_=format_,
|
||||||
|
service_level=service_level,
|
||||||
|
destination_country=destination_country,
|
||||||
|
item_barcodes=item_barcodes,
|
||||||
|
bag_id=bag_id,
|
||||||
|
item_count=item_count,
|
||||||
|
net_bulk_weight_in_kilogram=net_bulk_weight_in_kilogram,
|
||||||
|
customer_ekp=customer_ekp,
|
||||||
|
)
|
||||||
|
|
||||||
|
closed_bag.additional_properties = d
|
||||||
|
return closed_bag
|
||||||
|
|
||||||
|
@property
|
||||||
|
def additional_keys(self) -> list[str]:
|
||||||
|
return list(self.additional_properties.keys())
|
||||||
|
|
||||||
|
def __getitem__(self, key: str) -> Any:
|
||||||
|
return self.additional_properties[key]
|
||||||
|
|
||||||
|
def __setitem__(self, key: str, value: Any) -> None:
|
||||||
|
self.additional_properties[key] = value
|
||||||
|
|
||||||
|
def __delitem__(self, key: str) -> None:
|
||||||
|
del self.additional_properties[key]
|
||||||
|
|
||||||
|
def __contains__(self, key: str) -> bool:
|
||||||
|
return key in self.additional_properties
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
from enum import Enum
|
||||||
|
|
||||||
|
|
||||||
|
class ClosedBagServiceLevel(str, Enum):
|
||||||
|
PRIORITY = "PRIORITY"
|
||||||
|
REGISTERED = "REGISTERED"
|
||||||
|
|
||||||
|
def __str__(self) -> str:
|
||||||
|
return str(self.value)
|
||||||
@@ -0,0 +1,121 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from collections.abc import Mapping
|
||||||
|
from typing import Any, TypeVar
|
||||||
|
|
||||||
|
from attrs import define as _attrs_define
|
||||||
|
from attrs import field as _attrs_field
|
||||||
|
|
||||||
|
from ..types import UNSET, Unset
|
||||||
|
|
||||||
|
T = TypeVar("T", bound="Content")
|
||||||
|
|
||||||
|
|
||||||
|
@_attrs_define
|
||||||
|
class Content:
|
||||||
|
"""
|
||||||
|
Example:
|
||||||
|
{'contentPieceHsCode': 1234567890, 'contentPieceDescription': 'Trousers', 'contentPieceValue': '120.50',
|
||||||
|
'contentPieceNetweight': 1200, 'contentPieceOrigin': 'DE', 'contentPieceAmount': 2}
|
||||||
|
|
||||||
|
Attributes:
|
||||||
|
content_piece_amount (int): Number of pieces. Example: 2.
|
||||||
|
content_piece_description (str): The (short) description of this content. Example: Trousers.
|
||||||
|
content_piece_netweight (int): The net weight of all pieces of this content type. Example: 1200.
|
||||||
|
content_piece_origin (str): Country of origin, based on ISO-3166-1. Example: DE.
|
||||||
|
content_piece_value (str): Overall value of the content pieces of one type. 1 to 4 digits before the decimal
|
||||||
|
point, 2 digits after the decimal point or 1 to 7 digits without decimal point Example: 120.50.
|
||||||
|
content_piece_hs_code (str | Unset): The HS code of this content. Only 6, 8 or 10 digits, with at most one
|
||||||
|
leading zero.
|
||||||
|
HS Code mandatory for all shipments requiring a CN22 customs declaration. Example: 1234567890.
|
||||||
|
content_piece_index_number (int | Unset): NOT RECOMMENDED, obsolete and should not be contained in requests
|
||||||
|
until further notice.
|
||||||
|
"""
|
||||||
|
|
||||||
|
content_piece_amount: int
|
||||||
|
content_piece_description: str
|
||||||
|
content_piece_netweight: int
|
||||||
|
content_piece_origin: str
|
||||||
|
content_piece_value: str
|
||||||
|
content_piece_hs_code: str | Unset = UNSET
|
||||||
|
content_piece_index_number: int | Unset = UNSET
|
||||||
|
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||||
|
|
||||||
|
def to_dict(self) -> dict[str, Any]:
|
||||||
|
content_piece_amount = self.content_piece_amount
|
||||||
|
|
||||||
|
content_piece_description = self.content_piece_description
|
||||||
|
|
||||||
|
content_piece_netweight = self.content_piece_netweight
|
||||||
|
|
||||||
|
content_piece_origin = self.content_piece_origin
|
||||||
|
|
||||||
|
content_piece_value = self.content_piece_value
|
||||||
|
|
||||||
|
content_piece_hs_code = self.content_piece_hs_code
|
||||||
|
|
||||||
|
content_piece_index_number = self.content_piece_index_number
|
||||||
|
|
||||||
|
field_dict: dict[str, Any] = {}
|
||||||
|
field_dict.update(self.additional_properties)
|
||||||
|
field_dict.update(
|
||||||
|
{
|
||||||
|
"contentPieceAmount": content_piece_amount,
|
||||||
|
"contentPieceDescription": content_piece_description,
|
||||||
|
"contentPieceNetweight": content_piece_netweight,
|
||||||
|
"contentPieceOrigin": content_piece_origin,
|
||||||
|
"contentPieceValue": content_piece_value,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
if content_piece_hs_code is not UNSET:
|
||||||
|
field_dict["contentPieceHsCode"] = content_piece_hs_code
|
||||||
|
if content_piece_index_number is not UNSET:
|
||||||
|
field_dict["contentPieceIndexNumber"] = content_piece_index_number
|
||||||
|
|
||||||
|
return field_dict
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||||
|
d = dict(src_dict)
|
||||||
|
content_piece_amount = d.pop("contentPieceAmount")
|
||||||
|
|
||||||
|
content_piece_description = d.pop("contentPieceDescription")
|
||||||
|
|
||||||
|
content_piece_netweight = d.pop("contentPieceNetweight")
|
||||||
|
|
||||||
|
content_piece_origin = d.pop("contentPieceOrigin")
|
||||||
|
|
||||||
|
content_piece_value = d.pop("contentPieceValue")
|
||||||
|
|
||||||
|
content_piece_hs_code = d.pop("contentPieceHsCode", UNSET)
|
||||||
|
|
||||||
|
content_piece_index_number = d.pop("contentPieceIndexNumber", UNSET)
|
||||||
|
|
||||||
|
content = cls(
|
||||||
|
content_piece_amount=content_piece_amount,
|
||||||
|
content_piece_description=content_piece_description,
|
||||||
|
content_piece_netweight=content_piece_netweight,
|
||||||
|
content_piece_origin=content_piece_origin,
|
||||||
|
content_piece_value=content_piece_value,
|
||||||
|
content_piece_hs_code=content_piece_hs_code,
|
||||||
|
content_piece_index_number=content_piece_index_number,
|
||||||
|
)
|
||||||
|
|
||||||
|
content.additional_properties = d
|
||||||
|
return content
|
||||||
|
|
||||||
|
@property
|
||||||
|
def additional_keys(self) -> list[str]:
|
||||||
|
return list(self.additional_properties.keys())
|
||||||
|
|
||||||
|
def __getitem__(self, key: str) -> Any:
|
||||||
|
return self.additional_properties[key]
|
||||||
|
|
||||||
|
def __setitem__(self, key: str, value: Any) -> None:
|
||||||
|
self.additional_properties[key] = value
|
||||||
|
|
||||||
|
def __delitem__(self, key: str) -> None:
|
||||||
|
del self.additional_properties[key]
|
||||||
|
|
||||||
|
def __contains__(self, key: str) -> bool:
|
||||||
|
return key in self.additional_properties
|
||||||
@@ -0,0 +1,90 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from collections.abc import Mapping
|
||||||
|
from typing import TYPE_CHECKING, Any, TypeVar
|
||||||
|
|
||||||
|
from attrs import define as _attrs_define
|
||||||
|
from attrs import field as _attrs_field
|
||||||
|
|
||||||
|
from ..types import UNSET, Unset
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from ..models.language import Language
|
||||||
|
|
||||||
|
|
||||||
|
T = TypeVar("T", bound="Country")
|
||||||
|
|
||||||
|
|
||||||
|
@_attrs_define
|
||||||
|
class Country:
|
||||||
|
"""
|
||||||
|
Attributes:
|
||||||
|
code (str):
|
||||||
|
languages (list[Language] | Unset):
|
||||||
|
"""
|
||||||
|
|
||||||
|
code: str
|
||||||
|
languages: list[Language] | Unset = UNSET
|
||||||
|
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||||
|
|
||||||
|
def to_dict(self) -> dict[str, Any]:
|
||||||
|
code = self.code
|
||||||
|
|
||||||
|
languages: list[dict[str, Any]] | Unset = UNSET
|
||||||
|
if not isinstance(self.languages, Unset):
|
||||||
|
languages = []
|
||||||
|
for languages_item_data in self.languages:
|
||||||
|
languages_item = languages_item_data.to_dict()
|
||||||
|
languages.append(languages_item)
|
||||||
|
|
||||||
|
field_dict: dict[str, Any] = {}
|
||||||
|
field_dict.update(self.additional_properties)
|
||||||
|
field_dict.update(
|
||||||
|
{
|
||||||
|
"code": code,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
if languages is not UNSET:
|
||||||
|
field_dict["languages"] = languages
|
||||||
|
|
||||||
|
return field_dict
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||||
|
from ..models.language import Language
|
||||||
|
|
||||||
|
d = dict(src_dict)
|
||||||
|
code = d.pop("code")
|
||||||
|
|
||||||
|
_languages = d.pop("languages", UNSET)
|
||||||
|
languages: list[Language] | Unset = UNSET
|
||||||
|
if _languages is not UNSET:
|
||||||
|
languages = []
|
||||||
|
for languages_item_data in _languages:
|
||||||
|
languages_item = Language.from_dict(languages_item_data)
|
||||||
|
|
||||||
|
languages.append(languages_item)
|
||||||
|
|
||||||
|
country = cls(
|
||||||
|
code=code,
|
||||||
|
languages=languages,
|
||||||
|
)
|
||||||
|
|
||||||
|
country.additional_properties = d
|
||||||
|
return country
|
||||||
|
|
||||||
|
@property
|
||||||
|
def additional_keys(self) -> list[str]:
|
||||||
|
return list(self.additional_properties.keys())
|
||||||
|
|
||||||
|
def __getitem__(self, key: str) -> Any:
|
||||||
|
return self.additional_properties[key]
|
||||||
|
|
||||||
|
def __setitem__(self, key: str, value: Any) -> None:
|
||||||
|
self.additional_properties[key] = value
|
||||||
|
|
||||||
|
def __delitem__(self, key: str) -> None:
|
||||||
|
del self.additional_properties[key]
|
||||||
|
|
||||||
|
def __contains__(self, key: str) -> bool:
|
||||||
|
return key in self.additional_properties
|
||||||
@@ -0,0 +1,73 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from collections.abc import Mapping
|
||||||
|
from typing import Any, TypeVar, cast
|
||||||
|
|
||||||
|
from attrs import define as _attrs_define
|
||||||
|
from attrs import field as _attrs_field
|
||||||
|
|
||||||
|
from ..types import UNSET, Unset
|
||||||
|
|
||||||
|
T = TypeVar("T", bound="CwsErrorDTO")
|
||||||
|
|
||||||
|
|
||||||
|
@_attrs_define
|
||||||
|
class CwsErrorDTO:
|
||||||
|
"""
|
||||||
|
Attributes:
|
||||||
|
correlation_id (str | Unset): The Correlation ID to track the request through all systems where it has been
|
||||||
|
processed. Example: b011a094-fade-11e7-8c3f-9a214cf093ae.
|
||||||
|
messages (list[str] | Unset): A list of messages. Any single error is described within a certain message.
|
||||||
|
"""
|
||||||
|
|
||||||
|
correlation_id: str | Unset = UNSET
|
||||||
|
messages: list[str] | Unset = UNSET
|
||||||
|
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||||
|
|
||||||
|
def to_dict(self) -> dict[str, Any]:
|
||||||
|
correlation_id = self.correlation_id
|
||||||
|
|
||||||
|
messages: list[str] | Unset = UNSET
|
||||||
|
if not isinstance(self.messages, Unset):
|
||||||
|
messages = self.messages
|
||||||
|
|
||||||
|
field_dict: dict[str, Any] = {}
|
||||||
|
field_dict.update(self.additional_properties)
|
||||||
|
field_dict.update({})
|
||||||
|
if correlation_id is not UNSET:
|
||||||
|
field_dict["correlationId"] = correlation_id
|
||||||
|
if messages is not UNSET:
|
||||||
|
field_dict["messages"] = messages
|
||||||
|
|
||||||
|
return field_dict
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||||
|
d = dict(src_dict)
|
||||||
|
correlation_id = d.pop("correlationId", UNSET)
|
||||||
|
|
||||||
|
messages = cast(list[str], d.pop("messages", UNSET))
|
||||||
|
|
||||||
|
cws_error_dto = cls(
|
||||||
|
correlation_id=correlation_id,
|
||||||
|
messages=messages,
|
||||||
|
)
|
||||||
|
|
||||||
|
cws_error_dto.additional_properties = d
|
||||||
|
return cws_error_dto
|
||||||
|
|
||||||
|
@property
|
||||||
|
def additional_keys(self) -> list[str]:
|
||||||
|
return list(self.additional_properties.keys())
|
||||||
|
|
||||||
|
def __getitem__(self, key: str) -> Any:
|
||||||
|
return self.additional_properties[key]
|
||||||
|
|
||||||
|
def __setitem__(self, key: str, value: Any) -> None:
|
||||||
|
self.additional_properties[key] = value
|
||||||
|
|
||||||
|
def __delitem__(self, key: str) -> None:
|
||||||
|
del self.additional_properties[key]
|
||||||
|
|
||||||
|
def __contains__(self, key: str) -> bool:
|
||||||
|
return key in self.additional_properties
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from collections.abc import Mapping
|
||||||
|
from typing import Any, TypeVar
|
||||||
|
|
||||||
|
from attrs import define as _attrs_define
|
||||||
|
from attrs import field as _attrs_field
|
||||||
|
|
||||||
|
T = TypeVar("T", bound="GetAccessTokenInfo401Response")
|
||||||
|
|
||||||
|
|
||||||
|
@_attrs_define
|
||||||
|
class GetAccessTokenInfo401Response:
|
||||||
|
"""
|
||||||
|
Example:
|
||||||
|
{'error': 'invalid_token', 'error_description': 'The presented token is invalid or expired.'}
|
||||||
|
|
||||||
|
Attributes:
|
||||||
|
error (str): Example: invalid_token.
|
||||||
|
error_description (str): Example: The presented token is invalid or expired..
|
||||||
|
"""
|
||||||
|
|
||||||
|
error: str
|
||||||
|
error_description: str
|
||||||
|
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||||
|
|
||||||
|
def to_dict(self) -> dict[str, Any]:
|
||||||
|
error = self.error
|
||||||
|
|
||||||
|
error_description = self.error_description
|
||||||
|
|
||||||
|
field_dict: dict[str, Any] = {}
|
||||||
|
field_dict.update(self.additional_properties)
|
||||||
|
field_dict.update(
|
||||||
|
{
|
||||||
|
"error": error,
|
||||||
|
"error_description": error_description,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
return field_dict
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||||
|
d = dict(src_dict)
|
||||||
|
error = d.pop("error")
|
||||||
|
|
||||||
|
error_description = d.pop("error_description")
|
||||||
|
|
||||||
|
get_access_token_info_401_response = cls(
|
||||||
|
error=error,
|
||||||
|
error_description=error_description,
|
||||||
|
)
|
||||||
|
|
||||||
|
get_access_token_info_401_response.additional_properties = d
|
||||||
|
return get_access_token_info_401_response
|
||||||
|
|
||||||
|
@property
|
||||||
|
def additional_keys(self) -> list[str]:
|
||||||
|
return list(self.additional_properties.keys())
|
||||||
|
|
||||||
|
def __getitem__(self, key: str) -> Any:
|
||||||
|
return self.additional_properties[key]
|
||||||
|
|
||||||
|
def __setitem__(self, key: str, value: Any) -> None:
|
||||||
|
self.additional_properties[key] = value
|
||||||
|
|
||||||
|
def __delitem__(self, key: str) -> None:
|
||||||
|
del self.additional_properties[key]
|
||||||
|
|
||||||
|
def __contains__(self, key: str) -> bool:
|
||||||
|
return key in self.additional_properties
|
||||||
@@ -0,0 +1,81 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from collections.abc import Mapping
|
||||||
|
from typing import Any, TypeVar
|
||||||
|
|
||||||
|
from attrs import define as _attrs_define
|
||||||
|
from attrs import field as _attrs_field
|
||||||
|
|
||||||
|
T = TypeVar("T", bound="GetAccessTokenInfoResponse")
|
||||||
|
|
||||||
|
|
||||||
|
@_attrs_define
|
||||||
|
class GetAccessTokenInfoResponse:
|
||||||
|
"""
|
||||||
|
Example:
|
||||||
|
{'audience': 'b0601394-d106-4bca-a825-af40b7422640', 'user_id': 'b0601394-d106-4bca-a825-af40b7422640',
|
||||||
|
'expires_in': 15951}
|
||||||
|
|
||||||
|
Attributes:
|
||||||
|
audience (str): Example: b0601394-d106-4bca-a825-af40b7422640.
|
||||||
|
user_id (str): Example: b0601394-d106-4bca-a825-af40b7422640.
|
||||||
|
expires_in (int): Example: 15951.
|
||||||
|
"""
|
||||||
|
|
||||||
|
audience: str
|
||||||
|
user_id: str
|
||||||
|
expires_in: int
|
||||||
|
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||||
|
|
||||||
|
def to_dict(self) -> dict[str, Any]:
|
||||||
|
audience = self.audience
|
||||||
|
|
||||||
|
user_id = self.user_id
|
||||||
|
|
||||||
|
expires_in = self.expires_in
|
||||||
|
|
||||||
|
field_dict: dict[str, Any] = {}
|
||||||
|
field_dict.update(self.additional_properties)
|
||||||
|
field_dict.update(
|
||||||
|
{
|
||||||
|
"audience": audience,
|
||||||
|
"user_id": user_id,
|
||||||
|
"expires_in": expires_in,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
return field_dict
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||||
|
d = dict(src_dict)
|
||||||
|
audience = d.pop("audience")
|
||||||
|
|
||||||
|
user_id = d.pop("user_id")
|
||||||
|
|
||||||
|
expires_in = d.pop("expires_in")
|
||||||
|
|
||||||
|
get_access_token_info_response = cls(
|
||||||
|
audience=audience,
|
||||||
|
user_id=user_id,
|
||||||
|
expires_in=expires_in,
|
||||||
|
)
|
||||||
|
|
||||||
|
get_access_token_info_response.additional_properties = d
|
||||||
|
return get_access_token_info_response
|
||||||
|
|
||||||
|
@property
|
||||||
|
def additional_keys(self) -> list[str]:
|
||||||
|
return list(self.additional_properties.keys())
|
||||||
|
|
||||||
|
def __getitem__(self, key: str) -> Any:
|
||||||
|
return self.additional_properties[key]
|
||||||
|
|
||||||
|
def __setitem__(self, key: str, value: Any) -> None:
|
||||||
|
self.additional_properties[key] = value
|
||||||
|
|
||||||
|
def __delitem__(self, key: str) -> None:
|
||||||
|
del self.additional_properties[key]
|
||||||
|
|
||||||
|
def __contains__(self, key: str) -> bool:
|
||||||
|
return key in self.additional_properties
|
||||||
@@ -0,0 +1,81 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from collections.abc import Mapping
|
||||||
|
from typing import Any, TypeVar
|
||||||
|
|
||||||
|
from attrs import define as _attrs_define
|
||||||
|
from attrs import field as _attrs_field
|
||||||
|
|
||||||
|
T = TypeVar("T", bound="GetAccessTokenResponse")
|
||||||
|
|
||||||
|
|
||||||
|
@_attrs_define
|
||||||
|
class GetAccessTokenResponse:
|
||||||
|
"""
|
||||||
|
Example:
|
||||||
|
{'access_token': 'vzoJsASlFm0rfz3HsZEWC69lgQcytQQqWJvk9eBL3cMF8j7W4ny4Dh', 'token_type': 'Bearer', 'expires_in':
|
||||||
|
18000}
|
||||||
|
|
||||||
|
Attributes:
|
||||||
|
access_token (str): Example: vzoJsASlFm0rfz3HsZEWC69lgQcytQQqWJvk9eBL3cMF8j7W4ny4Dh.
|
||||||
|
token_type (str): Example: Bearer.
|
||||||
|
expires_in (int): Example: 18000.
|
||||||
|
"""
|
||||||
|
|
||||||
|
access_token: str
|
||||||
|
token_type: str
|
||||||
|
expires_in: int
|
||||||
|
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||||
|
|
||||||
|
def to_dict(self) -> dict[str, Any]:
|
||||||
|
access_token = self.access_token
|
||||||
|
|
||||||
|
token_type = self.token_type
|
||||||
|
|
||||||
|
expires_in = self.expires_in
|
||||||
|
|
||||||
|
field_dict: dict[str, Any] = {}
|
||||||
|
field_dict.update(self.additional_properties)
|
||||||
|
field_dict.update(
|
||||||
|
{
|
||||||
|
"access_token": access_token,
|
||||||
|
"token_type": token_type,
|
||||||
|
"expires_in": expires_in,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
return field_dict
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||||
|
d = dict(src_dict)
|
||||||
|
access_token = d.pop("access_token")
|
||||||
|
|
||||||
|
token_type = d.pop("token_type")
|
||||||
|
|
||||||
|
expires_in = d.pop("expires_in")
|
||||||
|
|
||||||
|
get_access_token_response = cls(
|
||||||
|
access_token=access_token,
|
||||||
|
token_type=token_type,
|
||||||
|
expires_in=expires_in,
|
||||||
|
)
|
||||||
|
|
||||||
|
get_access_token_response.additional_properties = d
|
||||||
|
return get_access_token_response
|
||||||
|
|
||||||
|
@property
|
||||||
|
def additional_keys(self) -> list[str]:
|
||||||
|
return list(self.additional_properties.keys())
|
||||||
|
|
||||||
|
def __getitem__(self, key: str) -> Any:
|
||||||
|
return self.additional_properties[key]
|
||||||
|
|
||||||
|
def __setitem__(self, key: str, value: Any) -> None:
|
||||||
|
self.additional_properties[key] = value
|
||||||
|
|
||||||
|
def __delitem__(self, key: str) -> None:
|
||||||
|
del self.additional_properties[key]
|
||||||
|
|
||||||
|
def __contains__(self, key: str) -> bool:
|
||||||
|
return key in self.additional_properties
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
from enum import Enum
|
||||||
|
|
||||||
|
|
||||||
|
class GetBagTagAccept(str, Enum):
|
||||||
|
APPLICATIONPDF = "application/pdf"
|
||||||
|
APPLICATIONPDFSINGLEPAGE = "application/pdf+singlepage"
|
||||||
|
APPLICATIONPDFSINGLEPAGE6X4 = "application/pdf+singlepage+6x4"
|
||||||
|
APPLICATIONZPL = "application/zpl"
|
||||||
|
APPLICATIONZPL6X4 = "application/zpl+6x4"
|
||||||
|
APPLICATIONZPLROTATED = "application/zpl+rotated"
|
||||||
|
APPLICATIONZPLROTATED6X4 = "application/zpl+rotated+6x4"
|
||||||
|
IMAGEPNG = "image/png"
|
||||||
|
IMAGEPNG6X4 = "image/png+6x4"
|
||||||
|
|
||||||
|
def __str__(self) -> str:
|
||||||
|
return str(self.value)
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
from enum import Enum
|
||||||
|
|
||||||
|
|
||||||
|
class GetBagTagLabelAccept(str, Enum):
|
||||||
|
APPLICATIONPDF = "application/pdf"
|
||||||
|
APPLICATIONPDFSINGLEPAGE = "application/pdf+singlepage"
|
||||||
|
APPLICATIONPDFSINGLEPAGE6X4 = "application/pdf+singlepage+6x4"
|
||||||
|
APPLICATIONZPL = "application/zpl"
|
||||||
|
APPLICATIONZPL6X4 = "application/zpl+6x4"
|
||||||
|
APPLICATIONZPLROTATED = "application/zpl+rotated"
|
||||||
|
APPLICATIONZPLROTATED6X4 = "application/zpl+rotated+6x4"
|
||||||
|
IMAGEPNG = "image/png"
|
||||||
|
IMAGEPNG6X4 = "image/png+6x4"
|
||||||
|
|
||||||
|
def __str__(self) -> str:
|
||||||
|
return str(self.value)
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
from enum import Enum
|
||||||
|
|
||||||
|
|
||||||
|
class GetCustomerItemLabelAccept(str, Enum):
|
||||||
|
APPLICATIONPDF = "application/pdf"
|
||||||
|
APPLICATIONPDFSINGLEPAGE = "application/pdf+singlepage"
|
||||||
|
APPLICATIONPDFSINGLEPAGE6X4 = "application/pdf+singlepage+6x4"
|
||||||
|
APPLICATIONZPL = "application/zpl"
|
||||||
|
APPLICATIONZPL6X4 = "application/zpl+6x4"
|
||||||
|
APPLICATIONZPLROTATED = "application/zpl+rotated"
|
||||||
|
APPLICATIONZPLROTATED6X4 = "application/zpl+rotated+6x4"
|
||||||
|
IMAGEPNG = "image/png"
|
||||||
|
IMAGEPNG6X4 = "image/png+6x4"
|
||||||
|
|
||||||
|
def __str__(self) -> str:
|
||||||
|
return str(self.value)
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
from enum import Enum
|
||||||
|
|
||||||
|
|
||||||
|
class GetItemLabelAccept(str, Enum):
|
||||||
|
APPLICATIONPDF = "application/pdf"
|
||||||
|
APPLICATIONPDFSINGLEPAGE = "application/pdf+singlepage"
|
||||||
|
APPLICATIONPDFSINGLEPAGE6X4 = "application/pdf+singlepage+6x4"
|
||||||
|
APPLICATIONZPL = "application/zpl"
|
||||||
|
APPLICATIONZPL6X4 = "application/zpl+6x4"
|
||||||
|
APPLICATIONZPLROTATED = "application/zpl+rotated"
|
||||||
|
APPLICATIONZPLROTATED6X4 = "application/zpl+rotated+6x4"
|
||||||
|
IMAGEPNG = "image/png"
|
||||||
|
IMAGEPNG6X4 = "image/png+6x4"
|
||||||
|
|
||||||
|
def __str__(self) -> str:
|
||||||
|
return str(self.value)
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
from enum import Enum
|
||||||
|
|
||||||
|
|
||||||
|
class GetItemLabelsAccept(str, Enum):
|
||||||
|
APPLICATIONPDF = "application/pdf"
|
||||||
|
APPLICATIONPDFSINGLEPAGE = "application/pdf+singlepage"
|
||||||
|
APPLICATIONPDFSINGLEPAGE6X4 = "application/pdf+singlepage+6x4"
|
||||||
|
APPLICATIONZPL = "application/zpl"
|
||||||
|
APPLICATIONZPL6X4 = "application/zpl+6x4"
|
||||||
|
APPLICATIONZPLROTATED = "application/zpl+rotated"
|
||||||
|
APPLICATIONZPLROTATED6X4 = "application/zpl+rotated+6x4"
|
||||||
|
IMAGEPNG = "image/png"
|
||||||
|
IMAGEPNG6X4 = "image/png+6x4"
|
||||||
|
|
||||||
|
def __str__(self) -> str:
|
||||||
|
return str(self.value)
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
from enum import Enum
|
||||||
|
|
||||||
|
|
||||||
|
class GetItemsStatus(str, Enum):
|
||||||
|
NEW = "NEW"
|
||||||
|
ORDERED = "ORDERED"
|
||||||
|
|
||||||
|
def __str__(self) -> str:
|
||||||
|
return str(self.value)
|
||||||
@@ -0,0 +1,456 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from collections.abc import Mapping
|
||||||
|
from typing import TYPE_CHECKING, Any, TypeVar
|
||||||
|
|
||||||
|
from attrs import define as _attrs_define
|
||||||
|
from attrs import field as _attrs_field
|
||||||
|
|
||||||
|
from ..models.item_service_level import ItemServiceLevel
|
||||||
|
from ..models.item_shipment_naturetype import ItemShipmentNaturetype
|
||||||
|
from ..types import UNSET, Unset
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from ..models.content import Content
|
||||||
|
|
||||||
|
|
||||||
|
T = TypeVar("T", bound="Item")
|
||||||
|
|
||||||
|
|
||||||
|
@_attrs_define
|
||||||
|
class Item:
|
||||||
|
"""
|
||||||
|
Example:
|
||||||
|
{'product': 'GPT', 'serviceLevel': 'PRIORITY', 'recipient': 'Doris Bronson', 'addressLine1': 'Uptown street 10',
|
||||||
|
'addressLine2': '2nd floor', 'postalCode': 'SW1A 2AA', 'city': 'London', 'destinationCountry': 'GB', 'custRef':
|
||||||
|
'BRE-2021-XIT', 'recipientPhone': '+441234567890', 'recipientEmail': 'doris@somewhere.non.eu', 'senderTaxId':
|
||||||
|
'IOSS number', 'importerTaxId': 'IOSS number', 'shipmentAmount': 100, 'shipmentCurrency': 'EUR',
|
||||||
|
'shipmentGrossWeight': 1500, 'returnItemWanted': False, 'shipmentNaturetype': 'SALE_GOODS', 'contents':
|
||||||
|
[{'contentPieceHsCode': 1234567890, 'contentPieceDescription': 'Hairspray', 'contentPieceValue': '120.50',
|
||||||
|
'contentPieceNetweight': 1200, 'contentPieceOrigin': 'DE', 'contentPieceAmount': 2}]}
|
||||||
|
|
||||||
|
Attributes:
|
||||||
|
address_line_1 (str): First line of address information of the recipient.
|
||||||
|
No unicode replacement characters <20> or question mark is accepted. Example: Any Street 100.
|
||||||
|
city (str): City of the recipient address.
|
||||||
|
No unicode replacement characters <20> or question mark is accepted. Example: Any City.
|
||||||
|
destination_country (str): Destination country of the item, based on ISO-3166-1. Please check
|
||||||
|
https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 for further details. Example: DE.
|
||||||
|
product (str): The product that is used for the shipment of this item. Available products are: GMP [Packet
|
||||||
|
Priority/Prio (goods)], GPT [Packet Tracked/Tracked], GMM [Business Mail Priority/Prio (documents)], GMR
|
||||||
|
[Business Mail Registered/Plus (documents)] Example: GMP.
|
||||||
|
recipient (str): Name of the recipient.
|
||||||
|
No unicodereplacement characters <20> and max. one question mark is accepted. Example: John Doe.
|
||||||
|
service_level (ItemServiceLevel): The service level that is used for the shipment of this item. There are
|
||||||
|
restrictions for use of service level: Registered is only available with product GMR and SalesChannel DPI
|
||||||
|
Example: PRIORITY.
|
||||||
|
shipment_gross_weight (int): Gross weight of the item (in g). May not exceed 2000 g. Example: 1500.
|
||||||
|
address_line_2 (str | Unset): Second line of address information of the recipient.
|
||||||
|
No unicode replacement characters <20> or question mark is accepted. Example: Flat 2.
|
||||||
|
address_line_3 (str | Unset): Third line of address information of the recipient.
|
||||||
|
No unicode replacement characters <20> or question mark is accepted. Example: 1st floor.
|
||||||
|
barcode (str | Unset): The barcode of this item (if available). Example: BC123456789.
|
||||||
|
contents (list[Content] | Unset): The descriptions of the content pieces.
|
||||||
|
cust_ref (str | Unset): Reference to the customer. Example: REF-2361890-AB.
|
||||||
|
cust_ref_2 (str | Unset): NOT RECOMMENDED, obsolete and should not be contained in requests until further
|
||||||
|
notice.
|
||||||
|
cust_ref_3 (str | Unset): NOT RECOMMENDED, obsolete and should not be contained in requests until further
|
||||||
|
notice.
|
||||||
|
id (int | Unset): The id of the item Example: 1.
|
||||||
|
postal_code (str | Unset): Postal code of the recipient address. Consists of
|
||||||
|
numbers, upper case letters, and one space or dash between characters
|
||||||
|
No unicode replacement characters <20> or question mark is accepted. Example: 794.
|
||||||
|
importer_tax_id (str | Unset): Customs reference number of the recipient, if required and applicable e.g. EORI
|
||||||
|
number. Example: EORI: LU12345.
|
||||||
|
recipient_email (str | Unset): Email address of the recipient. Used for notification.
|
||||||
|
recipientEmail OR recipientPhone required for interconnect countries!
|
||||||
|
|
||||||
|
An e-mail address or phone number for the recipient must be provided. Many postal operators have implemented
|
||||||
|
electronic pick-up notifications by e-mail or SMS and the provision of this information is essential to ensure
|
||||||
|
the smooth delivery of your shipments. Example: john.doe@example.eu.
|
||||||
|
recipient_fax (str | Unset): Fax number of the recipient Example: +44123456789.
|
||||||
|
recipient_phone (str | Unset): Phone number of the recipient.
|
||||||
|
recipientEmail OR recipientPhone required for interconnect countries!
|
||||||
|
|
||||||
|
An e-mail address or phone number for the recipient must be provided. Many postal operators have implemented
|
||||||
|
electronic pick-up notifications by e-mail or SMS and the provision of this information is essential to ensure
|
||||||
|
the smooth delivery of your shipments. Example: +441234567890.
|
||||||
|
return_item_wanted (bool | Unset): Is Packet Return. Default: False.
|
||||||
|
p_ddp (bool | Unset): Is Item pddp? FOR FUTURE USE. Not yet relvant Default: False.
|
||||||
|
sender_address_line_1 (str | Unset): NOT RECOMMENDED, obsolete and should not be contained in requests until
|
||||||
|
further notice.
|
||||||
|
sender_address_line_2 (str | Unset): NOT RECOMMENDED, obsolete and should not be contained in requests until
|
||||||
|
further notice.
|
||||||
|
sender_city (str | Unset): NOT RECOMMENDED, obsolete and should not be contained in requests until further
|
||||||
|
notice.
|
||||||
|
sender_country (str | Unset): NOT RECOMMENDED, obsolete and should not be contained in requests until further
|
||||||
|
notice.
|
||||||
|
sender_email (str | Unset): NOT RECOMMENDED, obsolete and should not be contained in requests until further
|
||||||
|
notice.
|
||||||
|
sender_name (str | Unset): NOT RECOMMENDED, obsolete and should not be contained in requests until further
|
||||||
|
notice.
|
||||||
|
sender_phone (str | Unset): NOT RECOMMENDED, obsolete and should not be contained in requests until further
|
||||||
|
notice.
|
||||||
|
sender_postal_code (str | Unset): NOT RECOMMENDED, obsolete and should not be contained in requests until
|
||||||
|
further notice.
|
||||||
|
sender_tax_id (str | Unset): Customs reference number of the sender, if applicable e.g. IOSS or VOEC number.
|
||||||
|
Example: IOSS: ABC12345.
|
||||||
|
shipment_amount (float | Unset): Overall value of all content pieces of the item. Example: 100.
|
||||||
|
shipment_currency (str | Unset): Currency code of the value, based on ISO-4217. Please check
|
||||||
|
https://en.wikipedia.org/wiki/ISO_4217#Active_codes for further details. Example: EUR.
|
||||||
|
shipment_naturetype (ItemShipmentNaturetype | Unset): Nature of the pieces in this item. Mandatory for non-EU
|
||||||
|
shipments: SALE_GOODS, RETURN_GOODS, COMMERCIAL_SAMPLE, DOCUMENTS, MIXED_CONTENTS, OTHERS. Mandatory for non-EU
|
||||||
|
shipments. Example: SALE_GOODS.
|
||||||
|
state (str | Unset): State of the recipient address.
|
||||||
|
No unicode replacement characters <20> or question mark is accepted.
|
||||||
|
An empty string is still allowed Example: NC.
|
||||||
|
third_party_vendor_id (str | Unset): The ID of the 3PV/Third Party Vendor who created this item.
|
||||||
|
format_ (str | Unset): The format. Weight limits are P: 100g, G: 500g, E: 2000g Example: P|G|E.
|
||||||
|
"""
|
||||||
|
|
||||||
|
address_line_1: str
|
||||||
|
city: str
|
||||||
|
destination_country: str
|
||||||
|
product: str
|
||||||
|
recipient: str
|
||||||
|
service_level: ItemServiceLevel
|
||||||
|
shipment_gross_weight: int
|
||||||
|
address_line_2: str | Unset = UNSET
|
||||||
|
address_line_3: str | Unset = UNSET
|
||||||
|
barcode: str | Unset = UNSET
|
||||||
|
contents: list[Content] | Unset = UNSET
|
||||||
|
cust_ref: str | Unset = UNSET
|
||||||
|
cust_ref_2: str | Unset = UNSET
|
||||||
|
cust_ref_3: str | Unset = UNSET
|
||||||
|
id: int | Unset = UNSET
|
||||||
|
postal_code: str | Unset = UNSET
|
||||||
|
importer_tax_id: str | Unset = UNSET
|
||||||
|
recipient_email: str | Unset = UNSET
|
||||||
|
recipient_fax: str | Unset = UNSET
|
||||||
|
recipient_phone: str | Unset = UNSET
|
||||||
|
return_item_wanted: bool | Unset = False
|
||||||
|
p_ddp: bool | Unset = False
|
||||||
|
sender_address_line_1: str | Unset = UNSET
|
||||||
|
sender_address_line_2: str | Unset = UNSET
|
||||||
|
sender_city: str | Unset = UNSET
|
||||||
|
sender_country: str | Unset = UNSET
|
||||||
|
sender_email: str | Unset = UNSET
|
||||||
|
sender_name: str | Unset = UNSET
|
||||||
|
sender_phone: str | Unset = UNSET
|
||||||
|
sender_postal_code: str | Unset = UNSET
|
||||||
|
sender_tax_id: str | Unset = UNSET
|
||||||
|
shipment_amount: float | Unset = UNSET
|
||||||
|
shipment_currency: str | Unset = UNSET
|
||||||
|
shipment_naturetype: ItemShipmentNaturetype | Unset = UNSET
|
||||||
|
state: str | Unset = UNSET
|
||||||
|
third_party_vendor_id: str | Unset = UNSET
|
||||||
|
format_: str | Unset = UNSET
|
||||||
|
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||||
|
|
||||||
|
def to_dict(self) -> dict[str, Any]:
|
||||||
|
address_line_1 = self.address_line_1
|
||||||
|
|
||||||
|
city = self.city
|
||||||
|
|
||||||
|
destination_country = self.destination_country
|
||||||
|
|
||||||
|
product = self.product
|
||||||
|
|
||||||
|
recipient = self.recipient
|
||||||
|
|
||||||
|
service_level = self.service_level.value
|
||||||
|
|
||||||
|
shipment_gross_weight = self.shipment_gross_weight
|
||||||
|
|
||||||
|
address_line_2 = self.address_line_2
|
||||||
|
|
||||||
|
address_line_3 = self.address_line_3
|
||||||
|
|
||||||
|
barcode = self.barcode
|
||||||
|
|
||||||
|
contents: list[dict[str, Any]] | Unset = UNSET
|
||||||
|
if not isinstance(self.contents, Unset):
|
||||||
|
contents = []
|
||||||
|
for contents_item_data in self.contents:
|
||||||
|
contents_item = contents_item_data.to_dict()
|
||||||
|
contents.append(contents_item)
|
||||||
|
|
||||||
|
cust_ref = self.cust_ref
|
||||||
|
|
||||||
|
cust_ref_2 = self.cust_ref_2
|
||||||
|
|
||||||
|
cust_ref_3 = self.cust_ref_3
|
||||||
|
|
||||||
|
id = self.id
|
||||||
|
|
||||||
|
postal_code = self.postal_code
|
||||||
|
|
||||||
|
importer_tax_id = self.importer_tax_id
|
||||||
|
|
||||||
|
recipient_email = self.recipient_email
|
||||||
|
|
||||||
|
recipient_fax = self.recipient_fax
|
||||||
|
|
||||||
|
recipient_phone = self.recipient_phone
|
||||||
|
|
||||||
|
return_item_wanted = self.return_item_wanted
|
||||||
|
|
||||||
|
p_ddp = self.p_ddp
|
||||||
|
|
||||||
|
sender_address_line_1 = self.sender_address_line_1
|
||||||
|
|
||||||
|
sender_address_line_2 = self.sender_address_line_2
|
||||||
|
|
||||||
|
sender_city = self.sender_city
|
||||||
|
|
||||||
|
sender_country = self.sender_country
|
||||||
|
|
||||||
|
sender_email = self.sender_email
|
||||||
|
|
||||||
|
sender_name = self.sender_name
|
||||||
|
|
||||||
|
sender_phone = self.sender_phone
|
||||||
|
|
||||||
|
sender_postal_code = self.sender_postal_code
|
||||||
|
|
||||||
|
sender_tax_id = self.sender_tax_id
|
||||||
|
|
||||||
|
shipment_amount = self.shipment_amount
|
||||||
|
|
||||||
|
shipment_currency = self.shipment_currency
|
||||||
|
|
||||||
|
shipment_naturetype: str | Unset = UNSET
|
||||||
|
if not isinstance(self.shipment_naturetype, Unset):
|
||||||
|
shipment_naturetype = self.shipment_naturetype.value
|
||||||
|
|
||||||
|
state = self.state
|
||||||
|
|
||||||
|
third_party_vendor_id = self.third_party_vendor_id
|
||||||
|
|
||||||
|
format_ = self.format_
|
||||||
|
|
||||||
|
field_dict: dict[str, Any] = {}
|
||||||
|
field_dict.update(self.additional_properties)
|
||||||
|
field_dict.update(
|
||||||
|
{
|
||||||
|
"addressLine1": address_line_1,
|
||||||
|
"city": city,
|
||||||
|
"destinationCountry": destination_country,
|
||||||
|
"product": product,
|
||||||
|
"recipient": recipient,
|
||||||
|
"serviceLevel": service_level,
|
||||||
|
"shipmentGrossWeight": shipment_gross_weight,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
if address_line_2 is not UNSET:
|
||||||
|
field_dict["addressLine2"] = address_line_2
|
||||||
|
if address_line_3 is not UNSET:
|
||||||
|
field_dict["addressLine3"] = address_line_3
|
||||||
|
if barcode is not UNSET:
|
||||||
|
field_dict["barcode"] = barcode
|
||||||
|
if contents is not UNSET:
|
||||||
|
field_dict["contents"] = contents
|
||||||
|
if cust_ref is not UNSET:
|
||||||
|
field_dict["custRef"] = cust_ref
|
||||||
|
if cust_ref_2 is not UNSET:
|
||||||
|
field_dict["custRef2"] = cust_ref_2
|
||||||
|
if cust_ref_3 is not UNSET:
|
||||||
|
field_dict["custRef3"] = cust_ref_3
|
||||||
|
if id is not UNSET:
|
||||||
|
field_dict["id"] = id
|
||||||
|
if postal_code is not UNSET:
|
||||||
|
field_dict["postalCode"] = postal_code
|
||||||
|
if importer_tax_id is not UNSET:
|
||||||
|
field_dict["importerTaxId"] = importer_tax_id
|
||||||
|
if recipient_email is not UNSET:
|
||||||
|
field_dict["recipientEmail"] = recipient_email
|
||||||
|
if recipient_fax is not UNSET:
|
||||||
|
field_dict["recipientFax"] = recipient_fax
|
||||||
|
if recipient_phone is not UNSET:
|
||||||
|
field_dict["recipientPhone"] = recipient_phone
|
||||||
|
if return_item_wanted is not UNSET:
|
||||||
|
field_dict["returnItemWanted"] = return_item_wanted
|
||||||
|
if p_ddp is not UNSET:
|
||||||
|
field_dict["pDDP"] = p_ddp
|
||||||
|
if sender_address_line_1 is not UNSET:
|
||||||
|
field_dict["senderAddressLine1"] = sender_address_line_1
|
||||||
|
if sender_address_line_2 is not UNSET:
|
||||||
|
field_dict["senderAddressLine2"] = sender_address_line_2
|
||||||
|
if sender_city is not UNSET:
|
||||||
|
field_dict["senderCity"] = sender_city
|
||||||
|
if sender_country is not UNSET:
|
||||||
|
field_dict["senderCountry"] = sender_country
|
||||||
|
if sender_email is not UNSET:
|
||||||
|
field_dict["senderEmail"] = sender_email
|
||||||
|
if sender_name is not UNSET:
|
||||||
|
field_dict["senderName"] = sender_name
|
||||||
|
if sender_phone is not UNSET:
|
||||||
|
field_dict["senderPhone"] = sender_phone
|
||||||
|
if sender_postal_code is not UNSET:
|
||||||
|
field_dict["senderPostalCode"] = sender_postal_code
|
||||||
|
if sender_tax_id is not UNSET:
|
||||||
|
field_dict["senderTaxId"] = sender_tax_id
|
||||||
|
if shipment_amount is not UNSET:
|
||||||
|
field_dict["shipmentAmount"] = shipment_amount
|
||||||
|
if shipment_currency is not UNSET:
|
||||||
|
field_dict["shipmentCurrency"] = shipment_currency
|
||||||
|
if shipment_naturetype is not UNSET:
|
||||||
|
field_dict["shipmentNaturetype"] = shipment_naturetype
|
||||||
|
if state is not UNSET:
|
||||||
|
field_dict["state"] = state
|
||||||
|
if third_party_vendor_id is not UNSET:
|
||||||
|
field_dict["thirdPartyVendorId"] = third_party_vendor_id
|
||||||
|
if format_ is not UNSET:
|
||||||
|
field_dict["format"] = format_
|
||||||
|
|
||||||
|
return field_dict
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||||
|
from ..models.content import Content
|
||||||
|
|
||||||
|
d = dict(src_dict)
|
||||||
|
address_line_1 = d.pop("addressLine1")
|
||||||
|
|
||||||
|
city = d.pop("city")
|
||||||
|
|
||||||
|
destination_country = d.pop("destinationCountry")
|
||||||
|
|
||||||
|
product = d.pop("product")
|
||||||
|
|
||||||
|
recipient = d.pop("recipient")
|
||||||
|
|
||||||
|
service_level = ItemServiceLevel(d.pop("serviceLevel"))
|
||||||
|
|
||||||
|
shipment_gross_weight = d.pop("shipmentGrossWeight")
|
||||||
|
|
||||||
|
address_line_2 = d.pop("addressLine2", UNSET)
|
||||||
|
|
||||||
|
address_line_3 = d.pop("addressLine3", UNSET)
|
||||||
|
|
||||||
|
barcode = d.pop("barcode", UNSET)
|
||||||
|
|
||||||
|
_contents = d.pop("contents", UNSET)
|
||||||
|
contents: list[Content] | Unset = UNSET
|
||||||
|
if _contents is not UNSET:
|
||||||
|
contents = []
|
||||||
|
for contents_item_data in _contents:
|
||||||
|
contents_item = Content.from_dict(contents_item_data)
|
||||||
|
|
||||||
|
contents.append(contents_item)
|
||||||
|
|
||||||
|
cust_ref = d.pop("custRef", UNSET)
|
||||||
|
|
||||||
|
cust_ref_2 = d.pop("custRef2", UNSET)
|
||||||
|
|
||||||
|
cust_ref_3 = d.pop("custRef3", UNSET)
|
||||||
|
|
||||||
|
id = d.pop("id", UNSET)
|
||||||
|
|
||||||
|
postal_code = d.pop("postalCode", UNSET)
|
||||||
|
|
||||||
|
importer_tax_id = d.pop("importerTaxId", UNSET)
|
||||||
|
|
||||||
|
recipient_email = d.pop("recipientEmail", UNSET)
|
||||||
|
|
||||||
|
recipient_fax = d.pop("recipientFax", UNSET)
|
||||||
|
|
||||||
|
recipient_phone = d.pop("recipientPhone", UNSET)
|
||||||
|
|
||||||
|
return_item_wanted = d.pop("returnItemWanted", UNSET)
|
||||||
|
|
||||||
|
p_ddp = d.pop("pDDP", UNSET)
|
||||||
|
|
||||||
|
sender_address_line_1 = d.pop("senderAddressLine1", UNSET)
|
||||||
|
|
||||||
|
sender_address_line_2 = d.pop("senderAddressLine2", UNSET)
|
||||||
|
|
||||||
|
sender_city = d.pop("senderCity", UNSET)
|
||||||
|
|
||||||
|
sender_country = d.pop("senderCountry", UNSET)
|
||||||
|
|
||||||
|
sender_email = d.pop("senderEmail", UNSET)
|
||||||
|
|
||||||
|
sender_name = d.pop("senderName", UNSET)
|
||||||
|
|
||||||
|
sender_phone = d.pop("senderPhone", UNSET)
|
||||||
|
|
||||||
|
sender_postal_code = d.pop("senderPostalCode", UNSET)
|
||||||
|
|
||||||
|
sender_tax_id = d.pop("senderTaxId", UNSET)
|
||||||
|
|
||||||
|
shipment_amount = d.pop("shipmentAmount", UNSET)
|
||||||
|
|
||||||
|
shipment_currency = d.pop("shipmentCurrency", UNSET)
|
||||||
|
|
||||||
|
_shipment_naturetype = d.pop("shipmentNaturetype", UNSET)
|
||||||
|
shipment_naturetype: ItemShipmentNaturetype | Unset
|
||||||
|
if isinstance(_shipment_naturetype, Unset):
|
||||||
|
shipment_naturetype = UNSET
|
||||||
|
else:
|
||||||
|
shipment_naturetype = ItemShipmentNaturetype(_shipment_naturetype)
|
||||||
|
|
||||||
|
state = d.pop("state", UNSET)
|
||||||
|
|
||||||
|
third_party_vendor_id = d.pop("thirdPartyVendorId", UNSET)
|
||||||
|
|
||||||
|
format_ = d.pop("format", UNSET)
|
||||||
|
|
||||||
|
item = cls(
|
||||||
|
address_line_1=address_line_1,
|
||||||
|
city=city,
|
||||||
|
destination_country=destination_country,
|
||||||
|
product=product,
|
||||||
|
recipient=recipient,
|
||||||
|
service_level=service_level,
|
||||||
|
shipment_gross_weight=shipment_gross_weight,
|
||||||
|
address_line_2=address_line_2,
|
||||||
|
address_line_3=address_line_3,
|
||||||
|
barcode=barcode,
|
||||||
|
contents=contents,
|
||||||
|
cust_ref=cust_ref,
|
||||||
|
cust_ref_2=cust_ref_2,
|
||||||
|
cust_ref_3=cust_ref_3,
|
||||||
|
id=id,
|
||||||
|
postal_code=postal_code,
|
||||||
|
importer_tax_id=importer_tax_id,
|
||||||
|
recipient_email=recipient_email,
|
||||||
|
recipient_fax=recipient_fax,
|
||||||
|
recipient_phone=recipient_phone,
|
||||||
|
return_item_wanted=return_item_wanted,
|
||||||
|
p_ddp=p_ddp,
|
||||||
|
sender_address_line_1=sender_address_line_1,
|
||||||
|
sender_address_line_2=sender_address_line_2,
|
||||||
|
sender_city=sender_city,
|
||||||
|
sender_country=sender_country,
|
||||||
|
sender_email=sender_email,
|
||||||
|
sender_name=sender_name,
|
||||||
|
sender_phone=sender_phone,
|
||||||
|
sender_postal_code=sender_postal_code,
|
||||||
|
sender_tax_id=sender_tax_id,
|
||||||
|
shipment_amount=shipment_amount,
|
||||||
|
shipment_currency=shipment_currency,
|
||||||
|
shipment_naturetype=shipment_naturetype,
|
||||||
|
state=state,
|
||||||
|
third_party_vendor_id=third_party_vendor_id,
|
||||||
|
format_=format_,
|
||||||
|
)
|
||||||
|
|
||||||
|
item.additional_properties = d
|
||||||
|
return item
|
||||||
|
|
||||||
|
@property
|
||||||
|
def additional_keys(self) -> list[str]:
|
||||||
|
return list(self.additional_properties.keys())
|
||||||
|
|
||||||
|
def __getitem__(self, key: str) -> Any:
|
||||||
|
return self.additional_properties[key]
|
||||||
|
|
||||||
|
def __setitem__(self, key: str, value: Any) -> None:
|
||||||
|
self.additional_properties[key] = value
|
||||||
|
|
||||||
|
def __delitem__(self, key: str) -> None:
|
||||||
|
del self.additional_properties[key]
|
||||||
|
|
||||||
|
def __contains__(self, key: str) -> bool:
|
||||||
|
return key in self.additional_properties
|
||||||
@@ -0,0 +1,413 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from collections.abc import Mapping
|
||||||
|
from typing import TYPE_CHECKING, Any, TypeVar
|
||||||
|
|
||||||
|
from attrs import define as _attrs_define
|
||||||
|
from attrs import field as _attrs_field
|
||||||
|
|
||||||
|
from ..models.item_data_service_level import ItemDataServiceLevel
|
||||||
|
from ..models.item_data_shipment_naturetype import ItemDataShipmentNaturetype
|
||||||
|
from ..types import UNSET, Unset
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from ..models.content import Content
|
||||||
|
|
||||||
|
|
||||||
|
T = TypeVar("T", bound="ItemData")
|
||||||
|
|
||||||
|
|
||||||
|
@_attrs_define
|
||||||
|
class ItemData:
|
||||||
|
"""
|
||||||
|
Example:
|
||||||
|
{'id': 1, 'product': 'GMP', 'serviceLevel': 'PRIORITY', 'custRef': 'REF-2361890-AB', 'recipient': 'John Doe',
|
||||||
|
'recipientPhone': '+4935120681234', 'recipientFax': '+4935120681234', 'recipientEmail': 'john.doe@example.eu',
|
||||||
|
'addressLine1': 'Mustergasse 12', 'addressLine2': 'Hinterhaus', 'addressLine3': '1. Etage', 'city': 'Dresden',
|
||||||
|
'state': 'Sachsen', 'postalCode': '01432', 'destinationCountry': 'DE', 'shipmentAmount': 100,
|
||||||
|
'shipmentCurrency': 'EUR', 'shipmentGrossWeight': 1500, 'returnItemWanted': False, 'shipmentNaturetype':
|
||||||
|
'SALE_GOODS', 'contents': [{'contentPieceHsCode': 1234567890, 'contentPieceDescription': 'Trousers',
|
||||||
|
'contentPieceValue': '120.50', 'contentPieceNetweight': 1200, 'contentPieceOrigin': 'DE', 'contentPieceAmount':
|
||||||
|
2}]}
|
||||||
|
|
||||||
|
Attributes:
|
||||||
|
address_line_1 (str): First line of address information of the recipient.
|
||||||
|
No unicode replacement characters <20> or question mark is accepted. Example: Any Street 100.
|
||||||
|
city (str): City of the recipient address.
|
||||||
|
No unicode replacement characters <20> or question mark is accepted. Example: Any City.
|
||||||
|
destination_country (str): Destination country of the item, based on ISO-3166-1. Please check
|
||||||
|
https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 for further details. Example: DE.
|
||||||
|
product (str): The product that is used for the shipment of this item. Available products are: GMP [Packet
|
||||||
|
Priority/Prio (goods)], GPT [Packet Tracked/Tracked], GMM [Business Mail Priority/Prio (documents)], GMR
|
||||||
|
[Business Mail Registered/Plus (documents)] Example: GMP.
|
||||||
|
recipient (str): Name of the recipient.
|
||||||
|
No unicode replacement characters <20> and max. one question mark is accepted. Example: John Doe.
|
||||||
|
service_level (ItemDataServiceLevel): The service level that is used for the shipment of this item. There are
|
||||||
|
restrictions for use of service level: Registered is only available with product GMR and SalesChannel DPI
|
||||||
|
Example: PRIORITY.
|
||||||
|
shipment_gross_weight (int): Gross weight of the item (in g). May not exceed 2000 g. Example: 1500.
|
||||||
|
address_line_2 (str | Unset): Second line of address information of the recipient.
|
||||||
|
No unicode replacement characters <20> or question mark is accepted. Example: Flat 2.
|
||||||
|
address_line_3 (str | Unset): Third line of address information of the recipient.
|
||||||
|
No unicode replacement characters <20> or question mark is accepted. Example: 1st floor.
|
||||||
|
contents (list[Content] | Unset): The descriptions of the content pieces.
|
||||||
|
cust_ref (str | Unset): Reference text up to customer's choice Example: REF-2361890-AB.
|
||||||
|
cust_ref_2 (str | Unset): NOT RECOMMENDED, obsolete and should not be contained in requests until further
|
||||||
|
notice.
|
||||||
|
cust_ref_3 (str | Unset): NOT RECOMMENDED, obsolete and should not be contained in requests until further
|
||||||
|
notice.
|
||||||
|
postal_code (str | Unset): Postal code of the recipient address. Consists of
|
||||||
|
numbers, upper case letters, and one space or dash between characters
|
||||||
|
No unicode replacement characters <20> or question mark is accepted. Example: 794.
|
||||||
|
importer_tax_id (str | Unset): Customs reference number of the recipient, if required and applicable e.g. EORI
|
||||||
|
number. Example: EORI: LU12345.
|
||||||
|
recipient_email (str | Unset): Email address of the recipient. Used for notification.
|
||||||
|
recipientEmail OR recipientPhone required for interconnect countries!
|
||||||
|
|
||||||
|
An e-mail address or phone number for the recipient must be provided. Many postal operators have implemented
|
||||||
|
electronic pick-up notifications by e-mail or SMS and the provision of this information is essential to ensure
|
||||||
|
the smooth delivery of your shipments. Example: john.doe@example.eu.
|
||||||
|
recipient_fax (str | Unset): Fax number of the recipient Example: +441234567891.
|
||||||
|
recipient_phone (str | Unset): Phone number of the recipient
|
||||||
|
recipientEmail OR recipientPhone required for interconnect countries!
|
||||||
|
|
||||||
|
An e-mail address or phone number for the recipient must be provided. Many postal operators have implemented
|
||||||
|
electronic pick-up notifications by e-mail or SMS and the provision of this information is essential to ensure
|
||||||
|
the smooth delivery of your shipments. Example: +441234567891.
|
||||||
|
return_item_wanted (bool | Unset): States if a return label should be created additionally. Requires a contract
|
||||||
|
for Packet Return. Default: False.
|
||||||
|
sender_address_line_1 (str | Unset): NOT RECOMMENDED, obsolete and should not be contained in requests until
|
||||||
|
further notice.
|
||||||
|
sender_address_line_2 (str | Unset): NOT RECOMMENDED, obsolete and should not be contained in requests until
|
||||||
|
further notice.
|
||||||
|
sender_city (str | Unset): NOT RECOMMENDED, obsolete and should not be contained in requests until further
|
||||||
|
notice.
|
||||||
|
sender_country (str | Unset): NOT RECOMMENDED, obsolete and should not be contained in requests until further
|
||||||
|
notice.
|
||||||
|
sender_email (str | Unset): NOT RECOMMENDED, obsolete and should not be contained in requests until further
|
||||||
|
notice.
|
||||||
|
sender_name (str | Unset): NOT RECOMMENDED, obsolete and should not be contained in requests until further
|
||||||
|
notice.
|
||||||
|
sender_phone (str | Unset): NOT RECOMMENDED, obsolete and should not be contained in requests until further
|
||||||
|
notice.
|
||||||
|
sender_postal_code (str | Unset): NOT RECOMMENDED, obsolete and should not be contained in requests until
|
||||||
|
further notice.
|
||||||
|
sender_tax_id (str | Unset): Customs reference number of the sender, if applicable e.g. IOSS or VOEC number.
|
||||||
|
Example: IOSS: ABC12345.
|
||||||
|
shipment_amount (float | Unset): Overall value of all content pieces of the item. Example: 100.
|
||||||
|
shipment_currency (str | Unset): Currency code of the value, based on ISO-4217. Please check
|
||||||
|
https://en.wikipedia.org/wiki/ISO_4217#Active_codes for further details. Example: EUR.
|
||||||
|
shipment_naturetype (ItemDataShipmentNaturetype | Unset): Nature of the pieces in this item. Mandatory for non-
|
||||||
|
EU shipments: SALE_GOODS, RETURN_GOODS, COMMERCIAL_SAMPLE, DOCUMENTS, MIXED_CONTENTS, OTHERS. Mandatory for non-
|
||||||
|
EU shipments. Example: SALE_GOODS.
|
||||||
|
state (str | Unset): State of the recipient address.
|
||||||
|
No unicode replacement characters <20> or question mark is accepted.
|
||||||
|
An empty string is still allowed Example: NC.
|
||||||
|
"""
|
||||||
|
|
||||||
|
address_line_1: str
|
||||||
|
city: str
|
||||||
|
destination_country: str
|
||||||
|
product: str
|
||||||
|
recipient: str
|
||||||
|
service_level: ItemDataServiceLevel
|
||||||
|
shipment_gross_weight: int
|
||||||
|
address_line_2: str | Unset = UNSET
|
||||||
|
address_line_3: str | Unset = UNSET
|
||||||
|
contents: list[Content] | Unset = UNSET
|
||||||
|
cust_ref: str | Unset = UNSET
|
||||||
|
cust_ref_2: str | Unset = UNSET
|
||||||
|
cust_ref_3: str | Unset = UNSET
|
||||||
|
postal_code: str | Unset = UNSET
|
||||||
|
importer_tax_id: str | Unset = UNSET
|
||||||
|
recipient_email: str | Unset = UNSET
|
||||||
|
recipient_fax: str | Unset = UNSET
|
||||||
|
recipient_phone: str | Unset = UNSET
|
||||||
|
return_item_wanted: bool | Unset = False
|
||||||
|
sender_address_line_1: str | Unset = UNSET
|
||||||
|
sender_address_line_2: str | Unset = UNSET
|
||||||
|
sender_city: str | Unset = UNSET
|
||||||
|
sender_country: str | Unset = UNSET
|
||||||
|
sender_email: str | Unset = UNSET
|
||||||
|
sender_name: str | Unset = UNSET
|
||||||
|
sender_phone: str | Unset = UNSET
|
||||||
|
sender_postal_code: str | Unset = UNSET
|
||||||
|
sender_tax_id: str | Unset = UNSET
|
||||||
|
shipment_amount: float | Unset = UNSET
|
||||||
|
shipment_currency: str | Unset = UNSET
|
||||||
|
shipment_naturetype: ItemDataShipmentNaturetype | Unset = UNSET
|
||||||
|
state: str | Unset = UNSET
|
||||||
|
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||||
|
|
||||||
|
def to_dict(self) -> dict[str, Any]:
|
||||||
|
address_line_1 = self.address_line_1
|
||||||
|
|
||||||
|
city = self.city
|
||||||
|
|
||||||
|
destination_country = self.destination_country
|
||||||
|
|
||||||
|
product = self.product
|
||||||
|
|
||||||
|
recipient = self.recipient
|
||||||
|
|
||||||
|
service_level = self.service_level.value
|
||||||
|
|
||||||
|
shipment_gross_weight = self.shipment_gross_weight
|
||||||
|
|
||||||
|
address_line_2 = self.address_line_2
|
||||||
|
|
||||||
|
address_line_3 = self.address_line_3
|
||||||
|
|
||||||
|
contents: list[dict[str, Any]] | Unset = UNSET
|
||||||
|
if not isinstance(self.contents, Unset):
|
||||||
|
contents = []
|
||||||
|
for contents_item_data in self.contents:
|
||||||
|
contents_item = contents_item_data.to_dict()
|
||||||
|
contents.append(contents_item)
|
||||||
|
|
||||||
|
cust_ref = self.cust_ref
|
||||||
|
|
||||||
|
cust_ref_2 = self.cust_ref_2
|
||||||
|
|
||||||
|
cust_ref_3 = self.cust_ref_3
|
||||||
|
|
||||||
|
postal_code = self.postal_code
|
||||||
|
|
||||||
|
importer_tax_id = self.importer_tax_id
|
||||||
|
|
||||||
|
recipient_email = self.recipient_email
|
||||||
|
|
||||||
|
recipient_fax = self.recipient_fax
|
||||||
|
|
||||||
|
recipient_phone = self.recipient_phone
|
||||||
|
|
||||||
|
return_item_wanted = self.return_item_wanted
|
||||||
|
|
||||||
|
sender_address_line_1 = self.sender_address_line_1
|
||||||
|
|
||||||
|
sender_address_line_2 = self.sender_address_line_2
|
||||||
|
|
||||||
|
sender_city = self.sender_city
|
||||||
|
|
||||||
|
sender_country = self.sender_country
|
||||||
|
|
||||||
|
sender_email = self.sender_email
|
||||||
|
|
||||||
|
sender_name = self.sender_name
|
||||||
|
|
||||||
|
sender_phone = self.sender_phone
|
||||||
|
|
||||||
|
sender_postal_code = self.sender_postal_code
|
||||||
|
|
||||||
|
sender_tax_id = self.sender_tax_id
|
||||||
|
|
||||||
|
shipment_amount = self.shipment_amount
|
||||||
|
|
||||||
|
shipment_currency = self.shipment_currency
|
||||||
|
|
||||||
|
shipment_naturetype: str | Unset = UNSET
|
||||||
|
if not isinstance(self.shipment_naturetype, Unset):
|
||||||
|
shipment_naturetype = self.shipment_naturetype.value
|
||||||
|
|
||||||
|
state = self.state
|
||||||
|
|
||||||
|
field_dict: dict[str, Any] = {}
|
||||||
|
field_dict.update(self.additional_properties)
|
||||||
|
field_dict.update(
|
||||||
|
{
|
||||||
|
"addressLine1": address_line_1,
|
||||||
|
"city": city,
|
||||||
|
"destinationCountry": destination_country,
|
||||||
|
"product": product,
|
||||||
|
"recipient": recipient,
|
||||||
|
"serviceLevel": service_level,
|
||||||
|
"shipmentGrossWeight": shipment_gross_weight,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
if address_line_2 is not UNSET:
|
||||||
|
field_dict["addressLine2"] = address_line_2
|
||||||
|
if address_line_3 is not UNSET:
|
||||||
|
field_dict["addressLine3"] = address_line_3
|
||||||
|
if contents is not UNSET:
|
||||||
|
field_dict["contents"] = contents
|
||||||
|
if cust_ref is not UNSET:
|
||||||
|
field_dict["custRef"] = cust_ref
|
||||||
|
if cust_ref_2 is not UNSET:
|
||||||
|
field_dict["custRef2"] = cust_ref_2
|
||||||
|
if cust_ref_3 is not UNSET:
|
||||||
|
field_dict["custRef3"] = cust_ref_3
|
||||||
|
if postal_code is not UNSET:
|
||||||
|
field_dict["postalCode"] = postal_code
|
||||||
|
if importer_tax_id is not UNSET:
|
||||||
|
field_dict["importerTaxId"] = importer_tax_id
|
||||||
|
if recipient_email is not UNSET:
|
||||||
|
field_dict["recipientEmail"] = recipient_email
|
||||||
|
if recipient_fax is not UNSET:
|
||||||
|
field_dict["recipientFax"] = recipient_fax
|
||||||
|
if recipient_phone is not UNSET:
|
||||||
|
field_dict["recipientPhone"] = recipient_phone
|
||||||
|
if return_item_wanted is not UNSET:
|
||||||
|
field_dict["returnItemWanted"] = return_item_wanted
|
||||||
|
if sender_address_line_1 is not UNSET:
|
||||||
|
field_dict["senderAddressLine1"] = sender_address_line_1
|
||||||
|
if sender_address_line_2 is not UNSET:
|
||||||
|
field_dict["senderAddressLine2"] = sender_address_line_2
|
||||||
|
if sender_city is not UNSET:
|
||||||
|
field_dict["senderCity"] = sender_city
|
||||||
|
if sender_country is not UNSET:
|
||||||
|
field_dict["senderCountry"] = sender_country
|
||||||
|
if sender_email is not UNSET:
|
||||||
|
field_dict["senderEmail"] = sender_email
|
||||||
|
if sender_name is not UNSET:
|
||||||
|
field_dict["senderName"] = sender_name
|
||||||
|
if sender_phone is not UNSET:
|
||||||
|
field_dict["senderPhone"] = sender_phone
|
||||||
|
if sender_postal_code is not UNSET:
|
||||||
|
field_dict["senderPostalCode"] = sender_postal_code
|
||||||
|
if sender_tax_id is not UNSET:
|
||||||
|
field_dict["senderTaxId"] = sender_tax_id
|
||||||
|
if shipment_amount is not UNSET:
|
||||||
|
field_dict["shipmentAmount"] = shipment_amount
|
||||||
|
if shipment_currency is not UNSET:
|
||||||
|
field_dict["shipmentCurrency"] = shipment_currency
|
||||||
|
if shipment_naturetype is not UNSET:
|
||||||
|
field_dict["shipmentNaturetype"] = shipment_naturetype
|
||||||
|
if state is not UNSET:
|
||||||
|
field_dict["state"] = state
|
||||||
|
|
||||||
|
return field_dict
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||||
|
from ..models.content import Content
|
||||||
|
|
||||||
|
d = dict(src_dict)
|
||||||
|
address_line_1 = d.pop("addressLine1")
|
||||||
|
|
||||||
|
city = d.pop("city")
|
||||||
|
|
||||||
|
destination_country = d.pop("destinationCountry")
|
||||||
|
|
||||||
|
product = d.pop("product")
|
||||||
|
|
||||||
|
recipient = d.pop("recipient")
|
||||||
|
|
||||||
|
service_level = ItemDataServiceLevel(d.pop("serviceLevel"))
|
||||||
|
|
||||||
|
shipment_gross_weight = d.pop("shipmentGrossWeight")
|
||||||
|
|
||||||
|
address_line_2 = d.pop("addressLine2", UNSET)
|
||||||
|
|
||||||
|
address_line_3 = d.pop("addressLine3", UNSET)
|
||||||
|
|
||||||
|
_contents = d.pop("contents", UNSET)
|
||||||
|
contents: list[Content] | Unset = UNSET
|
||||||
|
if _contents is not UNSET:
|
||||||
|
contents = []
|
||||||
|
for contents_item_data in _contents:
|
||||||
|
contents_item = Content.from_dict(contents_item_data)
|
||||||
|
|
||||||
|
contents.append(contents_item)
|
||||||
|
|
||||||
|
cust_ref = d.pop("custRef", UNSET)
|
||||||
|
|
||||||
|
cust_ref_2 = d.pop("custRef2", UNSET)
|
||||||
|
|
||||||
|
cust_ref_3 = d.pop("custRef3", UNSET)
|
||||||
|
|
||||||
|
postal_code = d.pop("postalCode", UNSET)
|
||||||
|
|
||||||
|
importer_tax_id = d.pop("importerTaxId", UNSET)
|
||||||
|
|
||||||
|
recipient_email = d.pop("recipientEmail", UNSET)
|
||||||
|
|
||||||
|
recipient_fax = d.pop("recipientFax", UNSET)
|
||||||
|
|
||||||
|
recipient_phone = d.pop("recipientPhone", UNSET)
|
||||||
|
|
||||||
|
return_item_wanted = d.pop("returnItemWanted", UNSET)
|
||||||
|
|
||||||
|
sender_address_line_1 = d.pop("senderAddressLine1", UNSET)
|
||||||
|
|
||||||
|
sender_address_line_2 = d.pop("senderAddressLine2", UNSET)
|
||||||
|
|
||||||
|
sender_city = d.pop("senderCity", UNSET)
|
||||||
|
|
||||||
|
sender_country = d.pop("senderCountry", UNSET)
|
||||||
|
|
||||||
|
sender_email = d.pop("senderEmail", UNSET)
|
||||||
|
|
||||||
|
sender_name = d.pop("senderName", UNSET)
|
||||||
|
|
||||||
|
sender_phone = d.pop("senderPhone", UNSET)
|
||||||
|
|
||||||
|
sender_postal_code = d.pop("senderPostalCode", UNSET)
|
||||||
|
|
||||||
|
sender_tax_id = d.pop("senderTaxId", UNSET)
|
||||||
|
|
||||||
|
shipment_amount = d.pop("shipmentAmount", UNSET)
|
||||||
|
|
||||||
|
shipment_currency = d.pop("shipmentCurrency", UNSET)
|
||||||
|
|
||||||
|
_shipment_naturetype = d.pop("shipmentNaturetype", UNSET)
|
||||||
|
shipment_naturetype: ItemDataShipmentNaturetype | Unset
|
||||||
|
if isinstance(_shipment_naturetype, Unset):
|
||||||
|
shipment_naturetype = UNSET
|
||||||
|
else:
|
||||||
|
shipment_naturetype = ItemDataShipmentNaturetype(_shipment_naturetype)
|
||||||
|
|
||||||
|
state = d.pop("state", UNSET)
|
||||||
|
|
||||||
|
item_data = cls(
|
||||||
|
address_line_1=address_line_1,
|
||||||
|
city=city,
|
||||||
|
destination_country=destination_country,
|
||||||
|
product=product,
|
||||||
|
recipient=recipient,
|
||||||
|
service_level=service_level,
|
||||||
|
shipment_gross_weight=shipment_gross_weight,
|
||||||
|
address_line_2=address_line_2,
|
||||||
|
address_line_3=address_line_3,
|
||||||
|
contents=contents,
|
||||||
|
cust_ref=cust_ref,
|
||||||
|
cust_ref_2=cust_ref_2,
|
||||||
|
cust_ref_3=cust_ref_3,
|
||||||
|
postal_code=postal_code,
|
||||||
|
importer_tax_id=importer_tax_id,
|
||||||
|
recipient_email=recipient_email,
|
||||||
|
recipient_fax=recipient_fax,
|
||||||
|
recipient_phone=recipient_phone,
|
||||||
|
return_item_wanted=return_item_wanted,
|
||||||
|
sender_address_line_1=sender_address_line_1,
|
||||||
|
sender_address_line_2=sender_address_line_2,
|
||||||
|
sender_city=sender_city,
|
||||||
|
sender_country=sender_country,
|
||||||
|
sender_email=sender_email,
|
||||||
|
sender_name=sender_name,
|
||||||
|
sender_phone=sender_phone,
|
||||||
|
sender_postal_code=sender_postal_code,
|
||||||
|
sender_tax_id=sender_tax_id,
|
||||||
|
shipment_amount=shipment_amount,
|
||||||
|
shipment_currency=shipment_currency,
|
||||||
|
shipment_naturetype=shipment_naturetype,
|
||||||
|
state=state,
|
||||||
|
)
|
||||||
|
|
||||||
|
item_data.additional_properties = d
|
||||||
|
return item_data
|
||||||
|
|
||||||
|
@property
|
||||||
|
def additional_keys(self) -> list[str]:
|
||||||
|
return list(self.additional_properties.keys())
|
||||||
|
|
||||||
|
def __getitem__(self, key: str) -> Any:
|
||||||
|
return self.additional_properties[key]
|
||||||
|
|
||||||
|
def __setitem__(self, key: str, value: Any) -> None:
|
||||||
|
self.additional_properties[key] = value
|
||||||
|
|
||||||
|
def __delitem__(self, key: str) -> None:
|
||||||
|
del self.additional_properties[key]
|
||||||
|
|
||||||
|
def __contains__(self, key: str) -> bool:
|
||||||
|
return key in self.additional_properties
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
from enum import Enum
|
||||||
|
|
||||||
|
|
||||||
|
class ItemDataServiceLevel(str, Enum):
|
||||||
|
PRIORITY = "PRIORITY"
|
||||||
|
REGISTERED = "REGISTERED"
|
||||||
|
|
||||||
|
def __str__(self) -> str:
|
||||||
|
return str(self.value)
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
from enum import Enum
|
||||||
|
|
||||||
|
|
||||||
|
class ItemDataShipmentNaturetype(str, Enum):
|
||||||
|
COMMERCIAL_SAMPLE = "COMMERCIAL_SAMPLE"
|
||||||
|
DOCUMENTS = "DOCUMENTS"
|
||||||
|
MIXED_CONTENTS = "MIXED_CONTENTS"
|
||||||
|
OTHERS = "OTHERS"
|
||||||
|
RETURN_GOODS = "RETURN_GOODS"
|
||||||
|
SALE_GOODS = "SALE_GOODS"
|
||||||
|
|
||||||
|
def __str__(self) -> str:
|
||||||
|
return str(self.value)
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user