Add tests for OAuth client and webhook notification handling
- Implement tests for `EbayOAuthClient` to verify authorization URL generation with configured scopes and token reuse logic. - Add tests for `WebhookChallengeHandler` to ensure correct SHA256 response generation and for `WebhookSignatureParser` to validate extraction of known fields from signature strings.
This commit is contained in:
commit
389d72a136
519 changed files with 99006 additions and 0 deletions
40
.gitignore
vendored
Normal file
40
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,40 @@
|
||||||
|
# Byte-compiled / optimized / DLL files
|
||||||
|
__pycache__/
|
||||||
|
*.py[cod]
|
||||||
|
*$py.class
|
||||||
|
|
||||||
|
# Virtual environments
|
||||||
|
.venv/
|
||||||
|
venv/
|
||||||
|
env/
|
||||||
|
ENV/
|
||||||
|
|
||||||
|
# Distribution / packaging
|
||||||
|
build/
|
||||||
|
dist/
|
||||||
|
*.egg-info/
|
||||||
|
.eggs/
|
||||||
|
pip-wheel-metadata/
|
||||||
|
|
||||||
|
# Test and coverage output
|
||||||
|
.pytest_cache/
|
||||||
|
.coverage
|
||||||
|
.coverage.*
|
||||||
|
htmlcov/
|
||||||
|
|
||||||
|
# Type checker / linter caches
|
||||||
|
.mypy_cache/
|
||||||
|
.ruff_cache/
|
||||||
|
.pyre/
|
||||||
|
|
||||||
|
# Tooling caches
|
||||||
|
.tox/
|
||||||
|
.nox/
|
||||||
|
|
||||||
|
# IDE / editor files
|
||||||
|
.vscode/
|
||||||
|
.idea/
|
||||||
|
|
||||||
|
# OS files
|
||||||
|
.DS_Store
|
||||||
|
Thumbs.db
|
||||||
22
README.md
Normal file
22
README.md
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
# eBay REST Client
|
||||||
|
|
||||||
|
This workspace contains a Python-first eBay REST client foundation with:
|
||||||
|
|
||||||
|
- a shared OAuth 2.0 core
|
||||||
|
- a shared HTTP transport layer
|
||||||
|
- public API wrappers per eBay REST domain
|
||||||
|
- an isolated OpenAPI generation script for each contract in this folder
|
||||||
|
|
||||||
|
## Generate Low-Level Clients
|
||||||
|
|
||||||
|
Run the generator script from the project root:
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
& .\.venv\Scripts\python.exe .\scripts\generate_clients.py
|
||||||
|
```
|
||||||
|
|
||||||
|
To generate only one API package:
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
& .\.venv\Scripts\python.exe .\scripts\generate_clients.py --api notification
|
||||||
|
```
|
||||||
1851
commerce_notification_v1_oas3.yaml
Normal file
1851
commerce_notification_v1_oas3.yaml
Normal file
File diff suppressed because it is too large
Load diff
3
ebay_client/__init__.py
Normal file
3
ebay_client/__init__.py
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
from .client import EbayClient
|
||||||
|
|
||||||
|
__all__ = ["EbayClient"]
|
||||||
3
ebay_client/account/__init__.py
Normal file
3
ebay_client/account/__init__.py
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
from ebay_client.account.client import AccountClient
|
||||||
|
|
||||||
|
__all__ = ["AccountClient"]
|
||||||
51
ebay_client/account/client.py
Normal file
51
ebay_client/account/client.py
Normal file
|
|
@ -0,0 +1,51 @@
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
|
from ebay_client.core.http.transport import ApiTransport
|
||||||
|
|
||||||
|
ACCOUNT_SCOPE = "https://api.ebay.com/oauth/api_scope/sell.account"
|
||||||
|
ACCOUNT_READ_SCOPE = "https://api.ebay.com/oauth/api_scope/sell.account.readonly"
|
||||||
|
|
||||||
|
|
||||||
|
class AccountClient:
|
||||||
|
def __init__(self, transport: ApiTransport) -> None:
|
||||||
|
self.transport = transport
|
||||||
|
|
||||||
|
def get_fulfillment_policies(self, *, marketplace_id: str) -> dict[str, Any]:
|
||||||
|
return self.transport.request_json(
|
||||||
|
"GET",
|
||||||
|
"/sell/account/v1/fulfillment_policy",
|
||||||
|
scopes=[ACCOUNT_READ_SCOPE],
|
||||||
|
params={"marketplace_id": marketplace_id},
|
||||||
|
)
|
||||||
|
|
||||||
|
def get_payment_policies(self, *, marketplace_id: str) -> dict[str, Any]:
|
||||||
|
return self.transport.request_json(
|
||||||
|
"GET",
|
||||||
|
"/sell/account/v1/payment_policy",
|
||||||
|
scopes=[ACCOUNT_READ_SCOPE],
|
||||||
|
params={"marketplace_id": marketplace_id},
|
||||||
|
)
|
||||||
|
|
||||||
|
def get_return_policies(self, *, marketplace_id: str) -> dict[str, Any]:
|
||||||
|
return self.transport.request_json(
|
||||||
|
"GET",
|
||||||
|
"/sell/account/v1/return_policy",
|
||||||
|
scopes=[ACCOUNT_READ_SCOPE],
|
||||||
|
params={"marketplace_id": marketplace_id},
|
||||||
|
)
|
||||||
|
|
||||||
|
def get_privileges(self) -> dict[str, Any]:
|
||||||
|
return self.transport.request_json(
|
||||||
|
"GET",
|
||||||
|
"/sell/account/v1/privilege",
|
||||||
|
scopes=[ACCOUNT_SCOPE],
|
||||||
|
)
|
||||||
|
|
||||||
|
def get_opted_in_programs(self) -> dict[str, Any]:
|
||||||
|
return self.transport.request_json(
|
||||||
|
"GET",
|
||||||
|
"/sell/account/v1/program/get_opted_in_programs",
|
||||||
|
scopes=[ACCOUNT_READ_SCOPE],
|
||||||
|
)
|
||||||
33
ebay_client/client.py
Normal file
33
ebay_client/client.py
Normal file
|
|
@ -0,0 +1,33 @@
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from ebay_client.account.client import AccountClient
|
||||||
|
from ebay_client.core.auth.oauth import EbayOAuthClient, EbayOAuthConfig
|
||||||
|
from ebay_client.core.auth.store import InMemoryTokenStore, TokenStore
|
||||||
|
from ebay_client.core.http.transport import ApiTransport
|
||||||
|
from ebay_client.feed.client import FeedClient
|
||||||
|
from ebay_client.fulfillment.client import FulfillmentClient
|
||||||
|
from ebay_client.inventory.client import InventoryClient
|
||||||
|
from ebay_client.notification.client import NotificationClient
|
||||||
|
|
||||||
|
|
||||||
|
class EbayClient:
|
||||||
|
def __init__(
|
||||||
|
self,
|
||||||
|
oauth_config: EbayOAuthConfig,
|
||||||
|
*,
|
||||||
|
token_store: TokenStore | None = None,
|
||||||
|
base_url: str = "https://api.ebay.com",
|
||||||
|
timeout_seconds: float = 30.0,
|
||||||
|
) -> None:
|
||||||
|
store = token_store or InMemoryTokenStore()
|
||||||
|
oauth_client = EbayOAuthClient(oauth_config, token_store=store)
|
||||||
|
transport = ApiTransport(
|
||||||
|
base_url=base_url,
|
||||||
|
oauth_client=oauth_client,
|
||||||
|
timeout_seconds=timeout_seconds,
|
||||||
|
)
|
||||||
|
self.notification = NotificationClient(transport)
|
||||||
|
self.inventory = InventoryClient(transport)
|
||||||
|
self.fulfillment = FulfillmentClient(transport)
|
||||||
|
self.account = AccountClient(transport)
|
||||||
|
self.feed = FeedClient(transport)
|
||||||
3
ebay_client/core/__init__.py
Normal file
3
ebay_client/core/__init__.py
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
from ebay_client.core.errors import ApiError, EbayClientError, OAuthError, TransportError
|
||||||
|
|
||||||
|
__all__ = ["ApiError", "EbayClientError", "OAuthError", "TransportError"]
|
||||||
5
ebay_client/core/auth/__init__.py
Normal file
5
ebay_client/core/auth/__init__.py
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
from ebay_client.core.auth.models import EbayOAuthConfig, OAuthToken
|
||||||
|
from ebay_client.core.auth.oauth import EbayOAuthClient
|
||||||
|
from ebay_client.core.auth.store import InMemoryTokenStore, TokenStore
|
||||||
|
|
||||||
|
__all__ = ["EbayOAuthClient", "EbayOAuthConfig", "InMemoryTokenStore", "OAuthToken", "TokenStore"]
|
||||||
36
ebay_client/core/auth/models.py
Normal file
36
ebay_client/core/auth/models.py
Normal file
|
|
@ -0,0 +1,36 @@
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from datetime import UTC, datetime, timedelta
|
||||||
|
|
||||||
|
from pydantic import BaseModel, Field
|
||||||
|
|
||||||
|
|
||||||
|
class EbayOAuthConfig(BaseModel):
|
||||||
|
client_id: str
|
||||||
|
client_secret: str
|
||||||
|
redirect_uri: str | None = None
|
||||||
|
auth_base_url: str = "https://auth.ebay.com/oauth2/authorize"
|
||||||
|
token_url: str = "https://api.ebay.com/identity/v1/oauth2/token"
|
||||||
|
default_scopes: list[str] = Field(default_factory=list)
|
||||||
|
|
||||||
|
|
||||||
|
class OAuthToken(BaseModel):
|
||||||
|
access_token: str
|
||||||
|
token_type: str = "Bearer"
|
||||||
|
expires_in: int = 7200
|
||||||
|
scope: str | None = None
|
||||||
|
refresh_token: str | None = None
|
||||||
|
refresh_token_expires_in: int | None = None
|
||||||
|
obtained_at: datetime = Field(default_factory=lambda: datetime.now(UTC))
|
||||||
|
|
||||||
|
@property
|
||||||
|
def expires_at(self) -> datetime:
|
||||||
|
return self.obtained_at + timedelta(seconds=self.expires_in)
|
||||||
|
|
||||||
|
def is_expired(self, *, skew_seconds: int = 30) -> bool:
|
||||||
|
return datetime.now(UTC) >= self.expires_at - timedelta(seconds=skew_seconds)
|
||||||
|
|
||||||
|
def scopes(self) -> set[str]:
|
||||||
|
if not self.scope:
|
||||||
|
return set()
|
||||||
|
return {value for value in self.scope.split() if value}
|
||||||
118
ebay_client/core/auth/oauth.py
Normal file
118
ebay_client/core/auth/oauth.py
Normal file
|
|
@ -0,0 +1,118 @@
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import base64
|
||||||
|
from typing import Iterable
|
||||||
|
from urllib.parse import urlencode
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ebay_client.core.auth.models import EbayOAuthConfig, OAuthToken
|
||||||
|
from ebay_client.core.auth.store import InMemoryTokenStore, TokenStore
|
||||||
|
from ebay_client.core.errors import OAuthError
|
||||||
|
|
||||||
|
|
||||||
|
class EbayOAuthClient:
|
||||||
|
def __init__(
|
||||||
|
self,
|
||||||
|
config: EbayOAuthConfig,
|
||||||
|
*,
|
||||||
|
token_store: TokenStore | None = None,
|
||||||
|
timeout_seconds: float = 30.0,
|
||||||
|
) -> None:
|
||||||
|
self.config = config
|
||||||
|
self.token_store = token_store or InMemoryTokenStore()
|
||||||
|
self.timeout_seconds = timeout_seconds
|
||||||
|
|
||||||
|
def build_authorization_url(
|
||||||
|
self,
|
||||||
|
*,
|
||||||
|
scopes: Iterable[str] | None = None,
|
||||||
|
state: str | None = None,
|
||||||
|
prompt: str | None = None,
|
||||||
|
) -> str:
|
||||||
|
if not self.config.redirect_uri:
|
||||||
|
raise OAuthError("redirect_uri is required for authorization_code flow")
|
||||||
|
query = {
|
||||||
|
"client_id": self.config.client_id,
|
||||||
|
"redirect_uri": self.config.redirect_uri,
|
||||||
|
"response_type": "code",
|
||||||
|
"scope": " ".join(scopes or self.config.default_scopes),
|
||||||
|
}
|
||||||
|
if state:
|
||||||
|
query["state"] = state
|
||||||
|
if prompt:
|
||||||
|
query["prompt"] = prompt
|
||||||
|
return f"{self.config.auth_base_url}?{urlencode(query)}"
|
||||||
|
|
||||||
|
def get_valid_token(self, *, scopes: Iterable[str] | None = None) -> OAuthToken:
|
||||||
|
token = self.token_store.get_token()
|
||||||
|
if token is None or token.is_expired() or not self._has_required_scopes(token, scopes):
|
||||||
|
token = self.fetch_client_credentials_token(scopes=scopes)
|
||||||
|
return token
|
||||||
|
|
||||||
|
def fetch_client_credentials_token(self, *, scopes: Iterable[str] | None = None) -> OAuthToken:
|
||||||
|
requested_scopes = list(scopes or self.config.default_scopes)
|
||||||
|
payload = {
|
||||||
|
"grant_type": "client_credentials",
|
||||||
|
"scope": " ".join(requested_scopes),
|
||||||
|
}
|
||||||
|
token = self._request_token(payload)
|
||||||
|
self.token_store.set_token(token)
|
||||||
|
return token
|
||||||
|
|
||||||
|
def exchange_code(self, code: str, *, scopes: Iterable[str] | None = None) -> OAuthToken:
|
||||||
|
if not self.config.redirect_uri:
|
||||||
|
raise OAuthError("redirect_uri is required for authorization_code flow")
|
||||||
|
payload = {
|
||||||
|
"grant_type": "authorization_code",
|
||||||
|
"code": code,
|
||||||
|
"redirect_uri": self.config.redirect_uri,
|
||||||
|
}
|
||||||
|
requested_scopes = list(scopes or self.config.default_scopes)
|
||||||
|
if requested_scopes:
|
||||||
|
payload["scope"] = " ".join(requested_scopes)
|
||||||
|
token = self._request_token(payload)
|
||||||
|
self.token_store.set_token(token)
|
||||||
|
return token
|
||||||
|
|
||||||
|
def refresh_access_token(self, refresh_token: str, *, scopes: Iterable[str] | None = None) -> OAuthToken:
|
||||||
|
payload = {
|
||||||
|
"grant_type": "refresh_token",
|
||||||
|
"refresh_token": refresh_token,
|
||||||
|
}
|
||||||
|
requested_scopes = list(scopes or self.config.default_scopes)
|
||||||
|
if requested_scopes:
|
||||||
|
payload["scope"] = " ".join(requested_scopes)
|
||||||
|
token = self._request_token(payload)
|
||||||
|
self.token_store.set_token(token)
|
||||||
|
return token
|
||||||
|
|
||||||
|
def _request_token(self, form_data: dict[str, str]) -> OAuthToken:
|
||||||
|
headers = {
|
||||||
|
"Authorization": f"Basic {self._build_basic_token()}",
|
||||||
|
"Content-Type": "application/x-www-form-urlencoded",
|
||||||
|
}
|
||||||
|
try:
|
||||||
|
with httpx.Client(timeout=self.timeout_seconds) as client:
|
||||||
|
response = client.post(self.config.token_url, data=form_data, headers=headers)
|
||||||
|
response.raise_for_status()
|
||||||
|
except httpx.HTTPStatusError as exc:
|
||||||
|
raise OAuthError(f"OAuth token request failed with HTTP {exc.response.status_code}") from exc
|
||||||
|
except httpx.HTTPError as exc:
|
||||||
|
raise OAuthError("OAuth token request failed") from exc
|
||||||
|
|
||||||
|
try:
|
||||||
|
return OAuthToken.model_validate(response.json())
|
||||||
|
except Exception as exc:
|
||||||
|
raise OAuthError("OAuth token response could not be parsed") from exc
|
||||||
|
|
||||||
|
def _build_basic_token(self) -> str:
|
||||||
|
raw = f"{self.config.client_id}:{self.config.client_secret}".encode("utf-8")
|
||||||
|
return base64.b64encode(raw).decode("ascii")
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def _has_required_scopes(token: OAuthToken, scopes: Iterable[str] | None) -> bool:
|
||||||
|
requested = {scope for scope in (scopes or []) if scope}
|
||||||
|
if not requested:
|
||||||
|
return True
|
||||||
|
return requested.issubset(token.scopes())
|
||||||
30
ebay_client/core/auth/store.py
Normal file
30
ebay_client/core/auth/store.py
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from typing import Protocol
|
||||||
|
|
||||||
|
from ebay_client.core.auth.models import OAuthToken
|
||||||
|
|
||||||
|
|
||||||
|
class TokenStore(Protocol):
|
||||||
|
def get_token(self) -> OAuthToken | None:
|
||||||
|
...
|
||||||
|
|
||||||
|
def set_token(self, token: OAuthToken) -> None:
|
||||||
|
...
|
||||||
|
|
||||||
|
def clear(self) -> None:
|
||||||
|
...
|
||||||
|
|
||||||
|
|
||||||
|
class InMemoryTokenStore:
|
||||||
|
def __init__(self) -> None:
|
||||||
|
self._token: OAuthToken | None = None
|
||||||
|
|
||||||
|
def get_token(self) -> OAuthToken | None:
|
||||||
|
return self._token
|
||||||
|
|
||||||
|
def set_token(self, token: OAuthToken) -> None:
|
||||||
|
self._token = token
|
||||||
|
|
||||||
|
def clear(self) -> None:
|
||||||
|
self._token = None
|
||||||
51
ebay_client/core/errors.py
Normal file
51
ebay_client/core/errors.py
Normal file
|
|
@ -0,0 +1,51 @@
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
|
|
||||||
|
class EbayClientError(Exception):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class OAuthError(EbayClientError):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class TransportError(EbayClientError):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class ResponseDecodingError(TransportError):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class ApiError(TransportError):
|
||||||
|
def __init__(
|
||||||
|
self,
|
||||||
|
*,
|
||||||
|
status_code: int,
|
||||||
|
message: str,
|
||||||
|
errors: list[dict[str, Any]] | None = None,
|
||||||
|
response_body: Any | None = None,
|
||||||
|
) -> None:
|
||||||
|
super().__init__(f"HTTP {status_code}: {message}")
|
||||||
|
self.status_code = status_code
|
||||||
|
self.message = message
|
||||||
|
self.errors = errors or []
|
||||||
|
self.response_body = response_body
|
||||||
|
|
||||||
|
|
||||||
|
def build_api_error(status_code: int, payload: Any) -> ApiError:
|
||||||
|
if isinstance(payload, dict):
|
||||||
|
errors = payload.get("errors")
|
||||||
|
if isinstance(errors, list) and errors:
|
||||||
|
first = errors[0]
|
||||||
|
message = str(first.get("message") or first.get("longMessage") or "eBay API request failed")
|
||||||
|
normalized_errors = [item for item in errors if isinstance(item, dict)]
|
||||||
|
return ApiError(
|
||||||
|
status_code=status_code,
|
||||||
|
message=message,
|
||||||
|
errors=normalized_errors,
|
||||||
|
response_body=payload,
|
||||||
|
)
|
||||||
|
return ApiError(status_code=status_code, message="eBay API request failed", response_body=payload)
|
||||||
3
ebay_client/core/http/__init__.py
Normal file
3
ebay_client/core/http/__init__.py
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
from ebay_client.core.http.transport import ApiTransport
|
||||||
|
|
||||||
|
__all__ = ["ApiTransport"]
|
||||||
69
ebay_client/core/http/transport.py
Normal file
69
ebay_client/core/http/transport.py
Normal file
|
|
@ -0,0 +1,69 @@
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from typing import Any, Mapping
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ebay_client.core.auth.oauth import EbayOAuthClient
|
||||||
|
from ebay_client.core.errors import ResponseDecodingError, TransportError, build_api_error
|
||||||
|
|
||||||
|
|
||||||
|
class ApiTransport:
|
||||||
|
def __init__(
|
||||||
|
self,
|
||||||
|
*,
|
||||||
|
base_url: str,
|
||||||
|
oauth_client: EbayOAuthClient,
|
||||||
|
timeout_seconds: float = 30.0,
|
||||||
|
default_headers: Mapping[str, str] | None = None,
|
||||||
|
) -> None:
|
||||||
|
self.base_url = base_url.rstrip("/")
|
||||||
|
self.oauth_client = oauth_client
|
||||||
|
self.timeout_seconds = timeout_seconds
|
||||||
|
self.default_headers = dict(default_headers or {})
|
||||||
|
|
||||||
|
def request(
|
||||||
|
self,
|
||||||
|
method: str,
|
||||||
|
path: str,
|
||||||
|
*,
|
||||||
|
scopes: list[str] | None = None,
|
||||||
|
params: Mapping[str, Any] | None = None,
|
||||||
|
json_body: Any | None = None,
|
||||||
|
headers: Mapping[str, str] | None = None,
|
||||||
|
content: bytes | None = None,
|
||||||
|
) -> httpx.Response:
|
||||||
|
token = self.oauth_client.get_valid_token(scopes=scopes)
|
||||||
|
request_headers = dict(self.default_headers)
|
||||||
|
request_headers.update(headers or {})
|
||||||
|
request_headers["Authorization"] = f"Bearer {token.access_token}"
|
||||||
|
url = f"{self.base_url}{path}"
|
||||||
|
try:
|
||||||
|
with httpx.Client(timeout=self.timeout_seconds) as client:
|
||||||
|
response = client.request(
|
||||||
|
method,
|
||||||
|
url,
|
||||||
|
params=params,
|
||||||
|
json=json_body,
|
||||||
|
headers=request_headers,
|
||||||
|
content=content,
|
||||||
|
)
|
||||||
|
except httpx.HTTPError as exc:
|
||||||
|
raise TransportError(f"HTTP request failed for {method} {path}") from exc
|
||||||
|
|
||||||
|
if response.is_error:
|
||||||
|
try:
|
||||||
|
payload = response.json()
|
||||||
|
except ValueError:
|
||||||
|
payload = response.text
|
||||||
|
raise build_api_error(response.status_code, payload)
|
||||||
|
return response
|
||||||
|
|
||||||
|
def request_json(self, method: str, path: str, **kwargs: Any) -> Any:
|
||||||
|
response = self.request(method, path, **kwargs)
|
||||||
|
if response.status_code == 204:
|
||||||
|
return None
|
||||||
|
try:
|
||||||
|
return response.json()
|
||||||
|
except ValueError as exc:
|
||||||
|
raise ResponseDecodingError(f"Response for {method} {path} is not valid JSON") from exc
|
||||||
15
ebay_client/core/pagination.py
Normal file
15
ebay_client/core/pagination.py
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from dataclasses import dataclass
|
||||||
|
from typing import Generic, TypeVar
|
||||||
|
|
||||||
|
T = TypeVar("T")
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass(slots=True)
|
||||||
|
class ContinuationPage(Generic[T]):
|
||||||
|
items: list[T]
|
||||||
|
total: int | None = None
|
||||||
|
limit: int | None = None
|
||||||
|
next_token: str | None = None
|
||||||
|
href: str | None = None
|
||||||
3
ebay_client/feed/__init__.py
Normal file
3
ebay_client/feed/__init__.py
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
from ebay_client.feed.client import FeedClient
|
||||||
|
|
||||||
|
__all__ = ["FeedClient"]
|
||||||
42
ebay_client/feed/client.py
Normal file
42
ebay_client/feed/client.py
Normal file
|
|
@ -0,0 +1,42 @@
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
|
from ebay_client.core.http.transport import ApiTransport
|
||||||
|
|
||||||
|
FEED_INVENTORY_SCOPE = "https://api.ebay.com/oauth/api_scope/sell.inventory"
|
||||||
|
FEED_FULFILLMENT_SCOPE = "https://api.ebay.com/oauth/api_scope/sell.fulfillment"
|
||||||
|
|
||||||
|
|
||||||
|
class FeedClient:
|
||||||
|
def __init__(self, transport: ApiTransport) -> None:
|
||||||
|
self.transport = transport
|
||||||
|
|
||||||
|
def get_tasks(self, *, feed_type: str | None = None) -> dict[str, Any]:
|
||||||
|
return self.transport.request_json(
|
||||||
|
"GET",
|
||||||
|
"/sell/feed/v1/task",
|
||||||
|
scopes=[FEED_INVENTORY_SCOPE, FEED_FULFILLMENT_SCOPE],
|
||||||
|
params={"feed_type": feed_type},
|
||||||
|
)
|
||||||
|
|
||||||
|
def get_task(self, task_id: str) -> dict[str, Any]:
|
||||||
|
return self.transport.request_json(
|
||||||
|
"GET",
|
||||||
|
f"/sell/feed/v1/task/{task_id}",
|
||||||
|
scopes=[FEED_INVENTORY_SCOPE, FEED_FULFILLMENT_SCOPE],
|
||||||
|
)
|
||||||
|
|
||||||
|
def get_schedule_templates(self) -> dict[str, Any]:
|
||||||
|
return self.transport.request_json(
|
||||||
|
"GET",
|
||||||
|
"/sell/feed/v1/schedule_template",
|
||||||
|
scopes=[FEED_INVENTORY_SCOPE, FEED_FULFILLMENT_SCOPE],
|
||||||
|
)
|
||||||
|
|
||||||
|
def get_schedules(self) -> dict[str, Any]:
|
||||||
|
return self.transport.request_json(
|
||||||
|
"GET",
|
||||||
|
"/sell/feed/v1/schedule",
|
||||||
|
scopes=[FEED_INVENTORY_SCOPE, FEED_FULFILLMENT_SCOPE],
|
||||||
|
)
|
||||||
3
ebay_client/fulfillment/__init__.py
Normal file
3
ebay_client/fulfillment/__init__.py
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
from ebay_client.fulfillment.client import FulfillmentClient
|
||||||
|
|
||||||
|
__all__ = ["FulfillmentClient"]
|
||||||
41
ebay_client/fulfillment/client.py
Normal file
41
ebay_client/fulfillment/client.py
Normal file
|
|
@ -0,0 +1,41 @@
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
|
from ebay_client.core.http.transport import ApiTransport
|
||||||
|
|
||||||
|
FULFILLMENT_READ_SCOPE = "https://api.ebay.com/oauth/api_scope/sell.fulfillment.readonly"
|
||||||
|
|
||||||
|
|
||||||
|
class FulfillmentClient:
|
||||||
|
def __init__(self, transport: ApiTransport) -> None:
|
||||||
|
self.transport = transport
|
||||||
|
|
||||||
|
def get_order(self, order_id: str) -> dict[str, Any]:
|
||||||
|
return self.transport.request_json(
|
||||||
|
"GET",
|
||||||
|
f"/sell/fulfillment/v1/order/{order_id}",
|
||||||
|
scopes=[FULFILLMENT_READ_SCOPE],
|
||||||
|
)
|
||||||
|
|
||||||
|
def get_orders(self, *, limit: int | None = None, offset: int | None = None) -> dict[str, Any]:
|
||||||
|
return self.transport.request_json(
|
||||||
|
"GET",
|
||||||
|
"/sell/fulfillment/v1/order",
|
||||||
|
scopes=[FULFILLMENT_READ_SCOPE],
|
||||||
|
params={"limit": limit, "offset": offset},
|
||||||
|
)
|
||||||
|
|
||||||
|
def get_shipping_fulfillments(self, order_id: str) -> dict[str, Any]:
|
||||||
|
return self.transport.request_json(
|
||||||
|
"GET",
|
||||||
|
f"/sell/fulfillment/v1/order/{order_id}/shipping_fulfillment",
|
||||||
|
scopes=[FULFILLMENT_READ_SCOPE],
|
||||||
|
)
|
||||||
|
|
||||||
|
def get_shipping_fulfillment(self, order_id: str, fulfillment_id: str) -> dict[str, Any]:
|
||||||
|
return self.transport.request_json(
|
||||||
|
"GET",
|
||||||
|
f"/sell/fulfillment/v1/order/{order_id}/shipping_fulfillment/{fulfillment_id}",
|
||||||
|
scopes=[FULFILLMENT_READ_SCOPE],
|
||||||
|
)
|
||||||
1
ebay_client/generated/__init__.py
Normal file
1
ebay_client/generated/__init__.py
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
"""Generated low-level clients live under this package."""
|
||||||
8
ebay_client/generated/account/__init__.py
Normal file
8
ebay_client/generated/account/__init__.py
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
|
||||||
|
""" A client library for accessing Account v1 API """
|
||||||
|
from .client import AuthenticatedClient, Client
|
||||||
|
|
||||||
|
__all__ = (
|
||||||
|
"AuthenticatedClient",
|
||||||
|
"Client",
|
||||||
|
)
|
||||||
1
ebay_client/generated/account/api/__init__.py
Normal file
1
ebay_client/generated/account/api/__init__.py
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
""" Contains methods for accessing the API """
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
""" Contains endpoint functions for accessing the API """
|
||||||
|
|
@ -0,0 +1,201 @@
|
||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any, Optional, Union, cast
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...types import Response, UNSET
|
||||||
|
from ... import errors
|
||||||
|
|
||||||
|
from ...models.seller_eligibility_multi_program_response import SellerEligibilityMultiProgramResponse
|
||||||
|
from ...types import UNSET, Unset
|
||||||
|
from typing import cast
|
||||||
|
from typing import Union
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
*,
|
||||||
|
program_types: Union[Unset, str] = UNSET,
|
||||||
|
x_ebay_c_marketplace_id: str,
|
||||||
|
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
headers: dict[str, Any] = {}
|
||||||
|
headers["X-EBAY-C-MARKETPLACE-ID"] = x_ebay_c_marketplace_id
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
params: dict[str, Any] = {}
|
||||||
|
|
||||||
|
params["program_types"] = program_types
|
||||||
|
|
||||||
|
|
||||||
|
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": "/advertising_eligibility",
|
||||||
|
"params": params,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
_kwargs["headers"] = headers
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Union[Any, SellerEligibilityMultiProgramResponse]]:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = SellerEligibilityMultiProgramResponse.from_dict(response.json())
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return response_200
|
||||||
|
if response.status_code == 400:
|
||||||
|
response_400 = cast(Any, None)
|
||||||
|
return response_400
|
||||||
|
if response.status_code == 500:
|
||||||
|
response_500 = cast(Any, None)
|
||||||
|
return response_500
|
||||||
|
if client.raise_on_unexpected_status:
|
||||||
|
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Union[Any, SellerEligibilityMultiProgramResponse]]:
|
||||||
|
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,
|
||||||
|
program_types: Union[Unset, str] = UNSET,
|
||||||
|
x_ebay_c_marketplace_id: str,
|
||||||
|
|
||||||
|
) -> Response[Union[Any, SellerEligibilityMultiProgramResponse]]:
|
||||||
|
""" This method allows developers to check the seller eligibility status for eBay advertising programs.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
program_types (Union[Unset, str]):
|
||||||
|
x_ebay_c_marketplace_id (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[Union[Any, SellerEligibilityMultiProgramResponse]]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
program_types=program_types,
|
||||||
|
x_ebay_c_marketplace_id=x_ebay_c_marketplace_id,
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
def sync(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
program_types: Union[Unset, str] = UNSET,
|
||||||
|
x_ebay_c_marketplace_id: str,
|
||||||
|
|
||||||
|
) -> Optional[Union[Any, SellerEligibilityMultiProgramResponse]]:
|
||||||
|
""" This method allows developers to check the seller eligibility status for eBay advertising programs.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
program_types (Union[Unset, str]):
|
||||||
|
x_ebay_c_marketplace_id (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:
|
||||||
|
Union[Any, SellerEligibilityMultiProgramResponse]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
client=client,
|
||||||
|
program_types=program_types,
|
||||||
|
x_ebay_c_marketplace_id=x_ebay_c_marketplace_id,
|
||||||
|
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
program_types: Union[Unset, str] = UNSET,
|
||||||
|
x_ebay_c_marketplace_id: str,
|
||||||
|
|
||||||
|
) -> Response[Union[Any, SellerEligibilityMultiProgramResponse]]:
|
||||||
|
""" This method allows developers to check the seller eligibility status for eBay advertising programs.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
program_types (Union[Unset, str]):
|
||||||
|
x_ebay_c_marketplace_id (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[Union[Any, SellerEligibilityMultiProgramResponse]]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
program_types=program_types,
|
||||||
|
x_ebay_c_marketplace_id=x_ebay_c_marketplace_id,
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
response = await client.get_async_httpx_client().request(
|
||||||
|
**kwargs
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
async def asyncio(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
program_types: Union[Unset, str] = UNSET,
|
||||||
|
x_ebay_c_marketplace_id: str,
|
||||||
|
|
||||||
|
) -> Optional[Union[Any, SellerEligibilityMultiProgramResponse]]:
|
||||||
|
""" This method allows developers to check the seller eligibility status for eBay advertising programs.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
program_types (Union[Unset, str]):
|
||||||
|
x_ebay_c_marketplace_id (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:
|
||||||
|
Union[Any, SellerEligibilityMultiProgramResponse]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
return (await asyncio_detailed(
|
||||||
|
client=client,
|
||||||
|
program_types=program_types,
|
||||||
|
x_ebay_c_marketplace_id=x_ebay_c_marketplace_id,
|
||||||
|
|
||||||
|
)).parsed
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
""" Contains endpoint functions for accessing the API """
|
||||||
|
|
@ -0,0 +1,240 @@
|
||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any, Optional, Union, cast
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...types import Response, UNSET
|
||||||
|
from ... import errors
|
||||||
|
|
||||||
|
from ...models.create_custom_policy_response_201 import CreateCustomPolicyResponse201
|
||||||
|
from ...models.custom_policy_create_request import CustomPolicyCreateRequest
|
||||||
|
from typing import cast
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
*,
|
||||||
|
body: CustomPolicyCreateRequest,
|
||||||
|
content_type: str,
|
||||||
|
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
headers: dict[str, Any] = {}
|
||||||
|
headers["Content-Type"] = content_type
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "post",
|
||||||
|
"url": "/custom_policy/",
|
||||||
|
}
|
||||||
|
|
||||||
|
_kwargs["json"] = body.to_dict()
|
||||||
|
|
||||||
|
|
||||||
|
headers["Content-Type"] = "application/json"
|
||||||
|
|
||||||
|
_kwargs["headers"] = headers
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Union[Any, CreateCustomPolicyResponse201]]:
|
||||||
|
if response.status_code == 201:
|
||||||
|
response_201 = CreateCustomPolicyResponse201.from_dict(response.json())
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return response_201
|
||||||
|
if response.status_code == 400:
|
||||||
|
response_400 = cast(Any, None)
|
||||||
|
return response_400
|
||||||
|
if response.status_code == 500:
|
||||||
|
response_500 = cast(Any, None)
|
||||||
|
return response_500
|
||||||
|
if response.status_code == 409:
|
||||||
|
response_409 = cast(Any, None)
|
||||||
|
return response_409
|
||||||
|
if client.raise_on_unexpected_status:
|
||||||
|
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Union[Any, CreateCustomPolicyResponse201]]:
|
||||||
|
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,
|
||||||
|
body: CustomPolicyCreateRequest,
|
||||||
|
content_type: str,
|
||||||
|
|
||||||
|
) -> Response[Union[Any, CreateCustomPolicyResponse201]]:
|
||||||
|
r""" This method creates a new custom policy that specifies the seller's terms for complying with local
|
||||||
|
governmental regulations. Each Custom Policy targets a <b>policyType</b>. Multiple policies may be
|
||||||
|
created as using the following custom policy types:<ul><li>PRODUCT_COMPLIANCE: Product Compliance
|
||||||
|
policies disclose product information as required for regulatory compliance. <br/><br/><span
|
||||||
|
class=\"tablenote\"><strong>Note:</strong> A maximum of 60 Product Compliance policies per seller
|
||||||
|
may be created.</span></li><li>TAKE_BACK: Takeback policies describe the seller's legal obligation
|
||||||
|
to take back a previously purchased item when the buyer purchases a new one. <br/><br/><span
|
||||||
|
class=\"tablenote\"><strong>Note:</strong> A maximum of 18 Takeback policies per seller may be
|
||||||
|
created.</span></li></ul>A successful create policy call returns an HTTP status code of <b>201
|
||||||
|
Created</b> with the system-generated policy ID included in the Location response header.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
content_type (str):
|
||||||
|
body (CustomPolicyCreateRequest): This type is used by the request payload of the
|
||||||
|
createCustomPolicy method to define a new custom policy for a specific marketplace.
|
||||||
|
|
||||||
|
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[Union[Any, CreateCustomPolicyResponse201]]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
body=body,
|
||||||
|
content_type=content_type,
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
def sync(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
body: CustomPolicyCreateRequest,
|
||||||
|
content_type: str,
|
||||||
|
|
||||||
|
) -> Optional[Union[Any, CreateCustomPolicyResponse201]]:
|
||||||
|
r""" This method creates a new custom policy that specifies the seller's terms for complying with local
|
||||||
|
governmental regulations. Each Custom Policy targets a <b>policyType</b>. Multiple policies may be
|
||||||
|
created as using the following custom policy types:<ul><li>PRODUCT_COMPLIANCE: Product Compliance
|
||||||
|
policies disclose product information as required for regulatory compliance. <br/><br/><span
|
||||||
|
class=\"tablenote\"><strong>Note:</strong> A maximum of 60 Product Compliance policies per seller
|
||||||
|
may be created.</span></li><li>TAKE_BACK: Takeback policies describe the seller's legal obligation
|
||||||
|
to take back a previously purchased item when the buyer purchases a new one. <br/><br/><span
|
||||||
|
class=\"tablenote\"><strong>Note:</strong> A maximum of 18 Takeback policies per seller may be
|
||||||
|
created.</span></li></ul>A successful create policy call returns an HTTP status code of <b>201
|
||||||
|
Created</b> with the system-generated policy ID included in the Location response header.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
content_type (str):
|
||||||
|
body (CustomPolicyCreateRequest): This type is used by the request payload of the
|
||||||
|
createCustomPolicy method to define a new custom policy for a specific marketplace.
|
||||||
|
|
||||||
|
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:
|
||||||
|
Union[Any, CreateCustomPolicyResponse201]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
client=client,
|
||||||
|
body=body,
|
||||||
|
content_type=content_type,
|
||||||
|
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
body: CustomPolicyCreateRequest,
|
||||||
|
content_type: str,
|
||||||
|
|
||||||
|
) -> Response[Union[Any, CreateCustomPolicyResponse201]]:
|
||||||
|
r""" This method creates a new custom policy that specifies the seller's terms for complying with local
|
||||||
|
governmental regulations. Each Custom Policy targets a <b>policyType</b>. Multiple policies may be
|
||||||
|
created as using the following custom policy types:<ul><li>PRODUCT_COMPLIANCE: Product Compliance
|
||||||
|
policies disclose product information as required for regulatory compliance. <br/><br/><span
|
||||||
|
class=\"tablenote\"><strong>Note:</strong> A maximum of 60 Product Compliance policies per seller
|
||||||
|
may be created.</span></li><li>TAKE_BACK: Takeback policies describe the seller's legal obligation
|
||||||
|
to take back a previously purchased item when the buyer purchases a new one. <br/><br/><span
|
||||||
|
class=\"tablenote\"><strong>Note:</strong> A maximum of 18 Takeback policies per seller may be
|
||||||
|
created.</span></li></ul>A successful create policy call returns an HTTP status code of <b>201
|
||||||
|
Created</b> with the system-generated policy ID included in the Location response header.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
content_type (str):
|
||||||
|
body (CustomPolicyCreateRequest): This type is used by the request payload of the
|
||||||
|
createCustomPolicy method to define a new custom policy for a specific marketplace.
|
||||||
|
|
||||||
|
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[Union[Any, CreateCustomPolicyResponse201]]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
body=body,
|
||||||
|
content_type=content_type,
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
response = await client.get_async_httpx_client().request(
|
||||||
|
**kwargs
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
async def asyncio(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
body: CustomPolicyCreateRequest,
|
||||||
|
content_type: str,
|
||||||
|
|
||||||
|
) -> Optional[Union[Any, CreateCustomPolicyResponse201]]:
|
||||||
|
r""" This method creates a new custom policy that specifies the seller's terms for complying with local
|
||||||
|
governmental regulations. Each Custom Policy targets a <b>policyType</b>. Multiple policies may be
|
||||||
|
created as using the following custom policy types:<ul><li>PRODUCT_COMPLIANCE: Product Compliance
|
||||||
|
policies disclose product information as required for regulatory compliance. <br/><br/><span
|
||||||
|
class=\"tablenote\"><strong>Note:</strong> A maximum of 60 Product Compliance policies per seller
|
||||||
|
may be created.</span></li><li>TAKE_BACK: Takeback policies describe the seller's legal obligation
|
||||||
|
to take back a previously purchased item when the buyer purchases a new one. <br/><br/><span
|
||||||
|
class=\"tablenote\"><strong>Note:</strong> A maximum of 18 Takeback policies per seller may be
|
||||||
|
created.</span></li></ul>A successful create policy call returns an HTTP status code of <b>201
|
||||||
|
Created</b> with the system-generated policy ID included in the Location response header.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
content_type (str):
|
||||||
|
body (CustomPolicyCreateRequest): This type is used by the request payload of the
|
||||||
|
createCustomPolicy method to define a new custom policy for a specific marketplace.
|
||||||
|
|
||||||
|
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:
|
||||||
|
Union[Any, CreateCustomPolicyResponse201]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
return (await asyncio_detailed(
|
||||||
|
client=client,
|
||||||
|
body=body,
|
||||||
|
content_type=content_type,
|
||||||
|
|
||||||
|
)).parsed
|
||||||
|
|
@ -0,0 +1,188 @@
|
||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any, Optional, Union, cast
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...types import Response, UNSET
|
||||||
|
from ... import errors
|
||||||
|
|
||||||
|
from ...models.custom_policy_response import CustomPolicyResponse
|
||||||
|
from ...types import UNSET, Unset
|
||||||
|
from typing import cast
|
||||||
|
from typing import Union
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
*,
|
||||||
|
policy_types: Union[Unset, str] = UNSET,
|
||||||
|
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
params: dict[str, Any] = {}
|
||||||
|
|
||||||
|
params["policy_types"] = policy_types
|
||||||
|
|
||||||
|
|
||||||
|
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": "/custom_policy/",
|
||||||
|
"params": params,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Union[Any, CustomPolicyResponse]]:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = CustomPolicyResponse.from_dict(response.json())
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return response_200
|
||||||
|
if response.status_code == 400:
|
||||||
|
response_400 = cast(Any, None)
|
||||||
|
return response_400
|
||||||
|
if response.status_code == 500:
|
||||||
|
response_500 = cast(Any, None)
|
||||||
|
return response_500
|
||||||
|
if client.raise_on_unexpected_status:
|
||||||
|
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Union[Any, CustomPolicyResponse]]:
|
||||||
|
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,
|
||||||
|
policy_types: Union[Unset, str] = UNSET,
|
||||||
|
|
||||||
|
) -> Response[Union[Any, CustomPolicyResponse]]:
|
||||||
|
""" This method retrieves the list of custom policies defined for a seller's account. To limit the
|
||||||
|
returned custom policies, specify the <b>policy_types</b> query parameter.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
policy_types (Union[Unset, 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[Union[Any, CustomPolicyResponse]]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
policy_types=policy_types,
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
def sync(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
policy_types: Union[Unset, str] = UNSET,
|
||||||
|
|
||||||
|
) -> Optional[Union[Any, CustomPolicyResponse]]:
|
||||||
|
""" This method retrieves the list of custom policies defined for a seller's account. To limit the
|
||||||
|
returned custom policies, specify the <b>policy_types</b> query parameter.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
policy_types (Union[Unset, 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:
|
||||||
|
Union[Any, CustomPolicyResponse]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
client=client,
|
||||||
|
policy_types=policy_types,
|
||||||
|
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
policy_types: Union[Unset, str] = UNSET,
|
||||||
|
|
||||||
|
) -> Response[Union[Any, CustomPolicyResponse]]:
|
||||||
|
""" This method retrieves the list of custom policies defined for a seller's account. To limit the
|
||||||
|
returned custom policies, specify the <b>policy_types</b> query parameter.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
policy_types (Union[Unset, 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[Union[Any, CustomPolicyResponse]]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
policy_types=policy_types,
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
response = await client.get_async_httpx_client().request(
|
||||||
|
**kwargs
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
async def asyncio(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
policy_types: Union[Unset, str] = UNSET,
|
||||||
|
|
||||||
|
) -> Optional[Union[Any, CustomPolicyResponse]]:
|
||||||
|
""" This method retrieves the list of custom policies defined for a seller's account. To limit the
|
||||||
|
returned custom policies, specify the <b>policy_types</b> query parameter.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
policy_types (Union[Unset, 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:
|
||||||
|
Union[Any, CustomPolicyResponse]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
return (await asyncio_detailed(
|
||||||
|
client=client,
|
||||||
|
policy_types=policy_types,
|
||||||
|
|
||||||
|
)).parsed
|
||||||
|
|
@ -0,0 +1,177 @@
|
||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any, Optional, Union, cast
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...types import Response, UNSET
|
||||||
|
from ... import errors
|
||||||
|
|
||||||
|
from ...models.custom_policy import CustomPolicy
|
||||||
|
from typing import cast
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
custom_policy_id: str,
|
||||||
|
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "get",
|
||||||
|
"url": "/custom_policy/{custom_policy_id}".format(custom_policy_id=custom_policy_id,),
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Union[Any, CustomPolicy]]:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = CustomPolicy.from_dict(response.json())
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return response_200
|
||||||
|
if response.status_code == 400:
|
||||||
|
response_400 = cast(Any, None)
|
||||||
|
return response_400
|
||||||
|
if response.status_code == 500:
|
||||||
|
response_500 = cast(Any, None)
|
||||||
|
return response_500
|
||||||
|
if response.status_code == 404:
|
||||||
|
response_404 = cast(Any, None)
|
||||||
|
return response_404
|
||||||
|
if client.raise_on_unexpected_status:
|
||||||
|
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Union[Any, CustomPolicy]]:
|
||||||
|
return Response(
|
||||||
|
status_code=HTTPStatus(response.status_code),
|
||||||
|
content=response.content,
|
||||||
|
headers=response.headers,
|
||||||
|
parsed=_parse_response(client=client, response=response),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def sync_detailed(
|
||||||
|
custom_policy_id: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
|
||||||
|
) -> Response[Union[Any, CustomPolicy]]:
|
||||||
|
""" This method retrieves the custom policy specified by the <b>custom_policy_id</b> path parameter.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
custom_policy_id (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[Union[Any, CustomPolicy]]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
custom_policy_id=custom_policy_id,
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
def sync(
|
||||||
|
custom_policy_id: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
|
||||||
|
) -> Optional[Union[Any, CustomPolicy]]:
|
||||||
|
""" This method retrieves the custom policy specified by the <b>custom_policy_id</b> path parameter.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
custom_policy_id (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:
|
||||||
|
Union[Any, CustomPolicy]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
custom_policy_id=custom_policy_id,
|
||||||
|
client=client,
|
||||||
|
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
custom_policy_id: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
|
||||||
|
) -> Response[Union[Any, CustomPolicy]]:
|
||||||
|
""" This method retrieves the custom policy specified by the <b>custom_policy_id</b> path parameter.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
custom_policy_id (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[Union[Any, CustomPolicy]]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
custom_policy_id=custom_policy_id,
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
response = await client.get_async_httpx_client().request(
|
||||||
|
**kwargs
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
async def asyncio(
|
||||||
|
custom_policy_id: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
|
||||||
|
) -> Optional[Union[Any, CustomPolicy]]:
|
||||||
|
""" This method retrieves the custom policy specified by the <b>custom_policy_id</b> path parameter.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
custom_policy_id (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:
|
||||||
|
Union[Any, CustomPolicy]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
return (await asyncio_detailed(
|
||||||
|
custom_policy_id=custom_policy_id,
|
||||||
|
client=client,
|
||||||
|
|
||||||
|
)).parsed
|
||||||
|
|
@ -0,0 +1,159 @@
|
||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any, Optional, Union, cast
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...types import Response, UNSET
|
||||||
|
from ... import errors
|
||||||
|
|
||||||
|
from ...models.custom_policy_request import CustomPolicyRequest
|
||||||
|
from typing import cast
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
custom_policy_id: str,
|
||||||
|
*,
|
||||||
|
body: CustomPolicyRequest,
|
||||||
|
content_type: str,
|
||||||
|
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
headers: dict[str, Any] = {}
|
||||||
|
headers["Content-Type"] = content_type
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "put",
|
||||||
|
"url": "/custom_policy/{custom_policy_id}".format(custom_policy_id=custom_policy_id,),
|
||||||
|
}
|
||||||
|
|
||||||
|
_kwargs["json"] = body.to_dict()
|
||||||
|
|
||||||
|
|
||||||
|
headers["Content-Type"] = "application/json"
|
||||||
|
|
||||||
|
_kwargs["headers"] = headers
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
|
||||||
|
if response.status_code == 400:
|
||||||
|
return None
|
||||||
|
if response.status_code == 500:
|
||||||
|
return None
|
||||||
|
if response.status_code == 204:
|
||||||
|
return None
|
||||||
|
if response.status_code == 404:
|
||||||
|
return None
|
||||||
|
if response.status_code == 409:
|
||||||
|
return None
|
||||||
|
if client.raise_on_unexpected_status:
|
||||||
|
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
|
||||||
|
return Response(
|
||||||
|
status_code=HTTPStatus(response.status_code),
|
||||||
|
content=response.content,
|
||||||
|
headers=response.headers,
|
||||||
|
parsed=_parse_response(client=client, response=response),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def sync_detailed(
|
||||||
|
custom_policy_id: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
body: CustomPolicyRequest,
|
||||||
|
content_type: str,
|
||||||
|
|
||||||
|
) -> Response[Any]:
|
||||||
|
""" This method updates an existing custom policy specified by the <b>custom_policy_id</b> path
|
||||||
|
parameter. Since this method overwrites the policy's <b>name</b>, <b>label</b>, and
|
||||||
|
<b>description</b> fields, always include the complete and current text of all three policy fields
|
||||||
|
in the request payload, even if they are not being updated.<br/> <br/>For example, the value for the
|
||||||
|
<b>label</b> field is to be updated, but the <b>name</b> and <b>description</b> values will remain
|
||||||
|
unchanged. The existing <b>name</b> and <b>description</b> values, as they are defined in the
|
||||||
|
current policy, must also be passed in. <br/><br/>A successful policy update call returns an HTTP
|
||||||
|
status code of <b>204 No Content</b>.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
custom_policy_id (str):
|
||||||
|
content_type (str):
|
||||||
|
body (CustomPolicyRequest):
|
||||||
|
|
||||||
|
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]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
custom_policy_id=custom_policy_id,
|
||||||
|
body=body,
|
||||||
|
content_type=content_type,
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
custom_policy_id: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
body: CustomPolicyRequest,
|
||||||
|
content_type: str,
|
||||||
|
|
||||||
|
) -> Response[Any]:
|
||||||
|
""" This method updates an existing custom policy specified by the <b>custom_policy_id</b> path
|
||||||
|
parameter. Since this method overwrites the policy's <b>name</b>, <b>label</b>, and
|
||||||
|
<b>description</b> fields, always include the complete and current text of all three policy fields
|
||||||
|
in the request payload, even if they are not being updated.<br/> <br/>For example, the value for the
|
||||||
|
<b>label</b> field is to be updated, but the <b>name</b> and <b>description</b> values will remain
|
||||||
|
unchanged. The existing <b>name</b> and <b>description</b> values, as they are defined in the
|
||||||
|
current policy, must also be passed in. <br/><br/>A successful policy update call returns an HTTP
|
||||||
|
status code of <b>204 No Content</b>.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
custom_policy_id (str):
|
||||||
|
content_type (str):
|
||||||
|
body (CustomPolicyRequest):
|
||||||
|
|
||||||
|
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]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
custom_policy_id=custom_policy_id,
|
||||||
|
body=body,
|
||||||
|
content_type=content_type,
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
response = await client.get_async_httpx_client().request(
|
||||||
|
**kwargs
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
""" Contains endpoint functions for accessing the API """
|
||||||
|
|
@ -0,0 +1,229 @@
|
||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any, Optional, Union, cast
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...types import Response, UNSET
|
||||||
|
from ... import errors
|
||||||
|
|
||||||
|
from ...models.fulfillment_policy_request import FulfillmentPolicyRequest
|
||||||
|
from ...models.set_fulfillment_policy_response import SetFulfillmentPolicyResponse
|
||||||
|
from typing import cast
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
*,
|
||||||
|
body: FulfillmentPolicyRequest,
|
||||||
|
content_type: str,
|
||||||
|
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
headers: dict[str, Any] = {}
|
||||||
|
headers["Content-Type"] = content_type
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "post",
|
||||||
|
"url": "/fulfillment_policy/",
|
||||||
|
}
|
||||||
|
|
||||||
|
_kwargs["json"] = body.to_dict()
|
||||||
|
|
||||||
|
|
||||||
|
headers["Content-Type"] = "application/json"
|
||||||
|
|
||||||
|
_kwargs["headers"] = headers
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Union[Any, SetFulfillmentPolicyResponse]]:
|
||||||
|
if response.status_code == 201:
|
||||||
|
response_201 = SetFulfillmentPolicyResponse.from_dict(response.json())
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return response_201
|
||||||
|
if response.status_code == 400:
|
||||||
|
response_400 = cast(Any, None)
|
||||||
|
return response_400
|
||||||
|
if response.status_code == 500:
|
||||||
|
response_500 = cast(Any, None)
|
||||||
|
return response_500
|
||||||
|
if client.raise_on_unexpected_status:
|
||||||
|
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Union[Any, SetFulfillmentPolicyResponse]]:
|
||||||
|
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,
|
||||||
|
body: FulfillmentPolicyRequest,
|
||||||
|
content_type: str,
|
||||||
|
|
||||||
|
) -> Response[Union[Any, SetFulfillmentPolicyResponse]]:
|
||||||
|
r""" This method creates a new fulfillment policy for an eBay marketplace where the policy encapsulates
|
||||||
|
seller's terms for fulfilling item purchases. Fulfillment policies include the shipment options that
|
||||||
|
the seller offers to buyers. <br><br>A successful request returns the <b>getFulfillmentPolicy</b>
|
||||||
|
URI to the new policy in the <b>Location</b> response header and the ID for the new policy is
|
||||||
|
returned in the response payload. <p class=\"tablenote\"><b>Tip:</b> For details on creating and
|
||||||
|
using the business policies supported by the Account API, see <a href=\"/api-
|
||||||
|
docs/sell/static/seller-accounts/business-policies.html\">eBay business policies</a>.</p>
|
||||||
|
|
||||||
|
Args:
|
||||||
|
content_type (str):
|
||||||
|
body (FulfillmentPolicyRequest): This root container defines a seller's fulfillment policy
|
||||||
|
for a specific marketplace and category group. This type is used when creating or updating
|
||||||
|
a fulfillment business policy.
|
||||||
|
|
||||||
|
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[Union[Any, SetFulfillmentPolicyResponse]]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
body=body,
|
||||||
|
content_type=content_type,
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
def sync(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
body: FulfillmentPolicyRequest,
|
||||||
|
content_type: str,
|
||||||
|
|
||||||
|
) -> Optional[Union[Any, SetFulfillmentPolicyResponse]]:
|
||||||
|
r""" This method creates a new fulfillment policy for an eBay marketplace where the policy encapsulates
|
||||||
|
seller's terms for fulfilling item purchases. Fulfillment policies include the shipment options that
|
||||||
|
the seller offers to buyers. <br><br>A successful request returns the <b>getFulfillmentPolicy</b>
|
||||||
|
URI to the new policy in the <b>Location</b> response header and the ID for the new policy is
|
||||||
|
returned in the response payload. <p class=\"tablenote\"><b>Tip:</b> For details on creating and
|
||||||
|
using the business policies supported by the Account API, see <a href=\"/api-
|
||||||
|
docs/sell/static/seller-accounts/business-policies.html\">eBay business policies</a>.</p>
|
||||||
|
|
||||||
|
Args:
|
||||||
|
content_type (str):
|
||||||
|
body (FulfillmentPolicyRequest): This root container defines a seller's fulfillment policy
|
||||||
|
for a specific marketplace and category group. This type is used when creating or updating
|
||||||
|
a fulfillment business policy.
|
||||||
|
|
||||||
|
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:
|
||||||
|
Union[Any, SetFulfillmentPolicyResponse]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
client=client,
|
||||||
|
body=body,
|
||||||
|
content_type=content_type,
|
||||||
|
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
body: FulfillmentPolicyRequest,
|
||||||
|
content_type: str,
|
||||||
|
|
||||||
|
) -> Response[Union[Any, SetFulfillmentPolicyResponse]]:
|
||||||
|
r""" This method creates a new fulfillment policy for an eBay marketplace where the policy encapsulates
|
||||||
|
seller's terms for fulfilling item purchases. Fulfillment policies include the shipment options that
|
||||||
|
the seller offers to buyers. <br><br>A successful request returns the <b>getFulfillmentPolicy</b>
|
||||||
|
URI to the new policy in the <b>Location</b> response header and the ID for the new policy is
|
||||||
|
returned in the response payload. <p class=\"tablenote\"><b>Tip:</b> For details on creating and
|
||||||
|
using the business policies supported by the Account API, see <a href=\"/api-
|
||||||
|
docs/sell/static/seller-accounts/business-policies.html\">eBay business policies</a>.</p>
|
||||||
|
|
||||||
|
Args:
|
||||||
|
content_type (str):
|
||||||
|
body (FulfillmentPolicyRequest): This root container defines a seller's fulfillment policy
|
||||||
|
for a specific marketplace and category group. This type is used when creating or updating
|
||||||
|
a fulfillment business policy.
|
||||||
|
|
||||||
|
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[Union[Any, SetFulfillmentPolicyResponse]]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
body=body,
|
||||||
|
content_type=content_type,
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
response = await client.get_async_httpx_client().request(
|
||||||
|
**kwargs
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
async def asyncio(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
body: FulfillmentPolicyRequest,
|
||||||
|
content_type: str,
|
||||||
|
|
||||||
|
) -> Optional[Union[Any, SetFulfillmentPolicyResponse]]:
|
||||||
|
r""" This method creates a new fulfillment policy for an eBay marketplace where the policy encapsulates
|
||||||
|
seller's terms for fulfilling item purchases. Fulfillment policies include the shipment options that
|
||||||
|
the seller offers to buyers. <br><br>A successful request returns the <b>getFulfillmentPolicy</b>
|
||||||
|
URI to the new policy in the <b>Location</b> response header and the ID for the new policy is
|
||||||
|
returned in the response payload. <p class=\"tablenote\"><b>Tip:</b> For details on creating and
|
||||||
|
using the business policies supported by the Account API, see <a href=\"/api-
|
||||||
|
docs/sell/static/seller-accounts/business-policies.html\">eBay business policies</a>.</p>
|
||||||
|
|
||||||
|
Args:
|
||||||
|
content_type (str):
|
||||||
|
body (FulfillmentPolicyRequest): This root container defines a seller's fulfillment policy
|
||||||
|
for a specific marketplace and category group. This type is used when creating or updating
|
||||||
|
a fulfillment business policy.
|
||||||
|
|
||||||
|
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:
|
||||||
|
Union[Any, SetFulfillmentPolicyResponse]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
return (await asyncio_detailed(
|
||||||
|
client=client,
|
||||||
|
body=body,
|
||||||
|
content_type=content_type,
|
||||||
|
|
||||||
|
)).parsed
|
||||||
|
|
@ -0,0 +1,122 @@
|
||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any, Optional, Union, cast
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...types import Response, UNSET
|
||||||
|
from ... import errors
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
fulfillment_policy_id: str,
|
||||||
|
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "delete",
|
||||||
|
"url": "/fulfillment_policy/{fulfillment_policy_id}".format(fulfillment_policy_id=fulfillment_policy_id,),
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
|
||||||
|
if response.status_code == 400:
|
||||||
|
return None
|
||||||
|
if response.status_code == 500:
|
||||||
|
return None
|
||||||
|
if response.status_code == 204:
|
||||||
|
return None
|
||||||
|
if response.status_code == 404:
|
||||||
|
return None
|
||||||
|
if response.status_code == 409:
|
||||||
|
return None
|
||||||
|
if client.raise_on_unexpected_status:
|
||||||
|
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
|
||||||
|
return Response(
|
||||||
|
status_code=HTTPStatus(response.status_code),
|
||||||
|
content=response.content,
|
||||||
|
headers=response.headers,
|
||||||
|
parsed=_parse_response(client=client, response=response),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def sync_detailed(
|
||||||
|
fulfillment_policy_id: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
|
||||||
|
) -> Response[Any]:
|
||||||
|
""" This method deletes a fulfillment policy. Supply the ID of the policy you want to delete in the
|
||||||
|
<b>fulfillmentPolicyId</b> path parameter.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
fulfillment_policy_id (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[Any]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
fulfillment_policy_id=fulfillment_policy_id,
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
fulfillment_policy_id: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
|
||||||
|
) -> Response[Any]:
|
||||||
|
""" This method deletes a fulfillment policy. Supply the ID of the policy you want to delete in the
|
||||||
|
<b>fulfillmentPolicyId</b> path parameter.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
fulfillment_policy_id (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[Any]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
fulfillment_policy_id=fulfillment_policy_id,
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
response = await client.get_async_httpx_client().request(
|
||||||
|
**kwargs
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
@ -0,0 +1,206 @@
|
||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any, Optional, Union, cast
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...types import Response, UNSET
|
||||||
|
from ... import errors
|
||||||
|
|
||||||
|
from ...models.fulfillment_policy_response import FulfillmentPolicyResponse
|
||||||
|
from ...types import UNSET, Unset
|
||||||
|
from typing import cast
|
||||||
|
from typing import Union
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
*,
|
||||||
|
marketplace_id: str,
|
||||||
|
content_language: Union[Unset, str] = UNSET,
|
||||||
|
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
headers: dict[str, Any] = {}
|
||||||
|
if not isinstance(content_language, Unset):
|
||||||
|
headers["Content-Language"] = content_language
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
params: dict[str, Any] = {}
|
||||||
|
|
||||||
|
params["marketplace_id"] = marketplace_id
|
||||||
|
|
||||||
|
|
||||||
|
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": "/fulfillment_policy",
|
||||||
|
"params": params,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
_kwargs["headers"] = headers
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Union[Any, FulfillmentPolicyResponse]]:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = FulfillmentPolicyResponse.from_dict(response.json())
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return response_200
|
||||||
|
if response.status_code == 400:
|
||||||
|
response_400 = cast(Any, None)
|
||||||
|
return response_400
|
||||||
|
if response.status_code == 500:
|
||||||
|
response_500 = cast(Any, None)
|
||||||
|
return response_500
|
||||||
|
if client.raise_on_unexpected_status:
|
||||||
|
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Union[Any, FulfillmentPolicyResponse]]:
|
||||||
|
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,
|
||||||
|
marketplace_id: str,
|
||||||
|
content_language: Union[Unset, str] = UNSET,
|
||||||
|
|
||||||
|
) -> Response[Union[Any, FulfillmentPolicyResponse]]:
|
||||||
|
""" This method retrieves all the fulfillment policies configured for the marketplace you specify using
|
||||||
|
the <code>marketplace_id</code> query parameter.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
marketplace_id (str):
|
||||||
|
content_language (Union[Unset, 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[Union[Any, FulfillmentPolicyResponse]]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
marketplace_id=marketplace_id,
|
||||||
|
content_language=content_language,
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
def sync(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
marketplace_id: str,
|
||||||
|
content_language: Union[Unset, str] = UNSET,
|
||||||
|
|
||||||
|
) -> Optional[Union[Any, FulfillmentPolicyResponse]]:
|
||||||
|
""" This method retrieves all the fulfillment policies configured for the marketplace you specify using
|
||||||
|
the <code>marketplace_id</code> query parameter.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
marketplace_id (str):
|
||||||
|
content_language (Union[Unset, 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:
|
||||||
|
Union[Any, FulfillmentPolicyResponse]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
client=client,
|
||||||
|
marketplace_id=marketplace_id,
|
||||||
|
content_language=content_language,
|
||||||
|
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
marketplace_id: str,
|
||||||
|
content_language: Union[Unset, str] = UNSET,
|
||||||
|
|
||||||
|
) -> Response[Union[Any, FulfillmentPolicyResponse]]:
|
||||||
|
""" This method retrieves all the fulfillment policies configured for the marketplace you specify using
|
||||||
|
the <code>marketplace_id</code> query parameter.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
marketplace_id (str):
|
||||||
|
content_language (Union[Unset, 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[Union[Any, FulfillmentPolicyResponse]]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
marketplace_id=marketplace_id,
|
||||||
|
content_language=content_language,
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
response = await client.get_async_httpx_client().request(
|
||||||
|
**kwargs
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
async def asyncio(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
marketplace_id: str,
|
||||||
|
content_language: Union[Unset, str] = UNSET,
|
||||||
|
|
||||||
|
) -> Optional[Union[Any, FulfillmentPolicyResponse]]:
|
||||||
|
""" This method retrieves all the fulfillment policies configured for the marketplace you specify using
|
||||||
|
the <code>marketplace_id</code> query parameter.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
marketplace_id (str):
|
||||||
|
content_language (Union[Unset, 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:
|
||||||
|
Union[Any, FulfillmentPolicyResponse]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
return (await asyncio_detailed(
|
||||||
|
client=client,
|
||||||
|
marketplace_id=marketplace_id,
|
||||||
|
content_language=content_language,
|
||||||
|
|
||||||
|
)).parsed
|
||||||
|
|
@ -0,0 +1,181 @@
|
||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any, Optional, Union, cast
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...types import Response, UNSET
|
||||||
|
from ... import errors
|
||||||
|
|
||||||
|
from ...models.fulfillment_policy import FulfillmentPolicy
|
||||||
|
from typing import cast
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
fulfillment_policy_id: str,
|
||||||
|
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "get",
|
||||||
|
"url": "/fulfillment_policy/{fulfillment_policy_id}".format(fulfillment_policy_id=fulfillment_policy_id,),
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Union[Any, FulfillmentPolicy]]:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = FulfillmentPolicy.from_dict(response.json())
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return response_200
|
||||||
|
if response.status_code == 400:
|
||||||
|
response_400 = cast(Any, None)
|
||||||
|
return response_400
|
||||||
|
if response.status_code == 500:
|
||||||
|
response_500 = cast(Any, None)
|
||||||
|
return response_500
|
||||||
|
if response.status_code == 404:
|
||||||
|
response_404 = cast(Any, None)
|
||||||
|
return response_404
|
||||||
|
if client.raise_on_unexpected_status:
|
||||||
|
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Union[Any, FulfillmentPolicy]]:
|
||||||
|
return Response(
|
||||||
|
status_code=HTTPStatus(response.status_code),
|
||||||
|
content=response.content,
|
||||||
|
headers=response.headers,
|
||||||
|
parsed=_parse_response(client=client, response=response),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def sync_detailed(
|
||||||
|
fulfillment_policy_id: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
|
||||||
|
) -> Response[Union[Any, FulfillmentPolicy]]:
|
||||||
|
""" This method retrieves the complete details of a fulfillment policy. Supply the ID of the policy you
|
||||||
|
want to retrieve using the <b>fulfillmentPolicyId</b> path parameter.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
fulfillment_policy_id (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[Union[Any, FulfillmentPolicy]]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
fulfillment_policy_id=fulfillment_policy_id,
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
def sync(
|
||||||
|
fulfillment_policy_id: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
|
||||||
|
) -> Optional[Union[Any, FulfillmentPolicy]]:
|
||||||
|
""" This method retrieves the complete details of a fulfillment policy. Supply the ID of the policy you
|
||||||
|
want to retrieve using the <b>fulfillmentPolicyId</b> path parameter.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
fulfillment_policy_id (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:
|
||||||
|
Union[Any, FulfillmentPolicy]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
fulfillment_policy_id=fulfillment_policy_id,
|
||||||
|
client=client,
|
||||||
|
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
fulfillment_policy_id: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
|
||||||
|
) -> Response[Union[Any, FulfillmentPolicy]]:
|
||||||
|
""" This method retrieves the complete details of a fulfillment policy. Supply the ID of the policy you
|
||||||
|
want to retrieve using the <b>fulfillmentPolicyId</b> path parameter.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
fulfillment_policy_id (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[Union[Any, FulfillmentPolicy]]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
fulfillment_policy_id=fulfillment_policy_id,
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
response = await client.get_async_httpx_client().request(
|
||||||
|
**kwargs
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
async def asyncio(
|
||||||
|
fulfillment_policy_id: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
|
||||||
|
) -> Optional[Union[Any, FulfillmentPolicy]]:
|
||||||
|
""" This method retrieves the complete details of a fulfillment policy. Supply the ID of the policy you
|
||||||
|
want to retrieve using the <b>fulfillmentPolicyId</b> path parameter.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
fulfillment_policy_id (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:
|
||||||
|
Union[Any, FulfillmentPolicy]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
return (await asyncio_detailed(
|
||||||
|
fulfillment_policy_id=fulfillment_policy_id,
|
||||||
|
client=client,
|
||||||
|
|
||||||
|
)).parsed
|
||||||
|
|
@ -0,0 +1,221 @@
|
||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any, Optional, Union, cast
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...types import Response, UNSET
|
||||||
|
from ... import errors
|
||||||
|
|
||||||
|
from ...models.fulfillment_policy import FulfillmentPolicy
|
||||||
|
from ...types import UNSET, Unset
|
||||||
|
from typing import cast
|
||||||
|
from typing import Union
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
*,
|
||||||
|
marketplace_id: str,
|
||||||
|
name: str,
|
||||||
|
content_language: Union[Unset, str] = UNSET,
|
||||||
|
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
headers: dict[str, Any] = {}
|
||||||
|
if not isinstance(content_language, Unset):
|
||||||
|
headers["Content-Language"] = content_language
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
params: dict[str, Any] = {}
|
||||||
|
|
||||||
|
params["marketplace_id"] = marketplace_id
|
||||||
|
|
||||||
|
params["name"] = name
|
||||||
|
|
||||||
|
|
||||||
|
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": "/fulfillment_policy/get_by_policy_name",
|
||||||
|
"params": params,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
_kwargs["headers"] = headers
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Union[Any, FulfillmentPolicy]]:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = FulfillmentPolicy.from_dict(response.json())
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return response_200
|
||||||
|
if response.status_code == 400:
|
||||||
|
response_400 = cast(Any, None)
|
||||||
|
return response_400
|
||||||
|
if response.status_code == 500:
|
||||||
|
response_500 = cast(Any, None)
|
||||||
|
return response_500
|
||||||
|
if client.raise_on_unexpected_status:
|
||||||
|
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Union[Any, FulfillmentPolicy]]:
|
||||||
|
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,
|
||||||
|
marketplace_id: str,
|
||||||
|
name: str,
|
||||||
|
content_language: Union[Unset, str] = UNSET,
|
||||||
|
|
||||||
|
) -> Response[Union[Any, FulfillmentPolicy]]:
|
||||||
|
""" This method retrieves the details for a specific fulfillment policy. In the request, supply both the
|
||||||
|
policy <code>name</code> and its associated <code>marketplace_id</code> as query parameters.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
marketplace_id (str):
|
||||||
|
name (str):
|
||||||
|
content_language (Union[Unset, 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[Union[Any, FulfillmentPolicy]]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
marketplace_id=marketplace_id,
|
||||||
|
name=name,
|
||||||
|
content_language=content_language,
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
def sync(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
marketplace_id: str,
|
||||||
|
name: str,
|
||||||
|
content_language: Union[Unset, str] = UNSET,
|
||||||
|
|
||||||
|
) -> Optional[Union[Any, FulfillmentPolicy]]:
|
||||||
|
""" This method retrieves the details for a specific fulfillment policy. In the request, supply both the
|
||||||
|
policy <code>name</code> and its associated <code>marketplace_id</code> as query parameters.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
marketplace_id (str):
|
||||||
|
name (str):
|
||||||
|
content_language (Union[Unset, 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:
|
||||||
|
Union[Any, FulfillmentPolicy]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
client=client,
|
||||||
|
marketplace_id=marketplace_id,
|
||||||
|
name=name,
|
||||||
|
content_language=content_language,
|
||||||
|
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
marketplace_id: str,
|
||||||
|
name: str,
|
||||||
|
content_language: Union[Unset, str] = UNSET,
|
||||||
|
|
||||||
|
) -> Response[Union[Any, FulfillmentPolicy]]:
|
||||||
|
""" This method retrieves the details for a specific fulfillment policy. In the request, supply both the
|
||||||
|
policy <code>name</code> and its associated <code>marketplace_id</code> as query parameters.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
marketplace_id (str):
|
||||||
|
name (str):
|
||||||
|
content_language (Union[Unset, 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[Union[Any, FulfillmentPolicy]]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
marketplace_id=marketplace_id,
|
||||||
|
name=name,
|
||||||
|
content_language=content_language,
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
response = await client.get_async_httpx_client().request(
|
||||||
|
**kwargs
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
async def asyncio(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
marketplace_id: str,
|
||||||
|
name: str,
|
||||||
|
content_language: Union[Unset, str] = UNSET,
|
||||||
|
|
||||||
|
) -> Optional[Union[Any, FulfillmentPolicy]]:
|
||||||
|
""" This method retrieves the details for a specific fulfillment policy. In the request, supply both the
|
||||||
|
policy <code>name</code> and its associated <code>marketplace_id</code> as query parameters.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
marketplace_id (str):
|
||||||
|
name (str):
|
||||||
|
content_language (Union[Unset, 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:
|
||||||
|
Union[Any, FulfillmentPolicy]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
return (await asyncio_detailed(
|
||||||
|
client=client,
|
||||||
|
marketplace_id=marketplace_id,
|
||||||
|
name=name,
|
||||||
|
content_language=content_language,
|
||||||
|
|
||||||
|
)).parsed
|
||||||
|
|
@ -0,0 +1,233 @@
|
||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any, Optional, Union, cast
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...types import Response, UNSET
|
||||||
|
from ... import errors
|
||||||
|
|
||||||
|
from ...models.fulfillment_policy_request import FulfillmentPolicyRequest
|
||||||
|
from ...models.set_fulfillment_policy_response import SetFulfillmentPolicyResponse
|
||||||
|
from typing import cast
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
fulfillment_policy_id: str,
|
||||||
|
*,
|
||||||
|
body: FulfillmentPolicyRequest,
|
||||||
|
content_type: str,
|
||||||
|
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
headers: dict[str, Any] = {}
|
||||||
|
headers["Content-Type"] = content_type
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "put",
|
||||||
|
"url": "/fulfillment_policy/{fulfillment_policy_id}".format(fulfillment_policy_id=fulfillment_policy_id,),
|
||||||
|
}
|
||||||
|
|
||||||
|
_kwargs["json"] = body.to_dict()
|
||||||
|
|
||||||
|
|
||||||
|
headers["Content-Type"] = "application/json"
|
||||||
|
|
||||||
|
_kwargs["headers"] = headers
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Union[Any, SetFulfillmentPolicyResponse]]:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = SetFulfillmentPolicyResponse.from_dict(response.json())
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return response_200
|
||||||
|
if response.status_code == 400:
|
||||||
|
response_400 = cast(Any, None)
|
||||||
|
return response_400
|
||||||
|
if response.status_code == 500:
|
||||||
|
response_500 = cast(Any, None)
|
||||||
|
return response_500
|
||||||
|
if response.status_code == 404:
|
||||||
|
response_404 = cast(Any, None)
|
||||||
|
return response_404
|
||||||
|
if client.raise_on_unexpected_status:
|
||||||
|
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Union[Any, SetFulfillmentPolicyResponse]]:
|
||||||
|
return Response(
|
||||||
|
status_code=HTTPStatus(response.status_code),
|
||||||
|
content=response.content,
|
||||||
|
headers=response.headers,
|
||||||
|
parsed=_parse_response(client=client, response=response),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def sync_detailed(
|
||||||
|
fulfillment_policy_id: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
body: FulfillmentPolicyRequest,
|
||||||
|
content_type: str,
|
||||||
|
|
||||||
|
) -> Response[Union[Any, SetFulfillmentPolicyResponse]]:
|
||||||
|
""" This method updates an existing fulfillment policy. Specify the policy you want to update using the
|
||||||
|
<b>fulfillment_policy_id</b> path parameter. Supply a complete policy payload with the updates you
|
||||||
|
want to make; this call overwrites the existing policy with the new details specified in the
|
||||||
|
payload.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
fulfillment_policy_id (str):
|
||||||
|
content_type (str):
|
||||||
|
body (FulfillmentPolicyRequest): This root container defines a seller's fulfillment policy
|
||||||
|
for a specific marketplace and category group. This type is used when creating or updating
|
||||||
|
a fulfillment business policy.
|
||||||
|
|
||||||
|
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[Union[Any, SetFulfillmentPolicyResponse]]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
fulfillment_policy_id=fulfillment_policy_id,
|
||||||
|
body=body,
|
||||||
|
content_type=content_type,
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
def sync(
|
||||||
|
fulfillment_policy_id: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
body: FulfillmentPolicyRequest,
|
||||||
|
content_type: str,
|
||||||
|
|
||||||
|
) -> Optional[Union[Any, SetFulfillmentPolicyResponse]]:
|
||||||
|
""" This method updates an existing fulfillment policy. Specify the policy you want to update using the
|
||||||
|
<b>fulfillment_policy_id</b> path parameter. Supply a complete policy payload with the updates you
|
||||||
|
want to make; this call overwrites the existing policy with the new details specified in the
|
||||||
|
payload.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
fulfillment_policy_id (str):
|
||||||
|
content_type (str):
|
||||||
|
body (FulfillmentPolicyRequest): This root container defines a seller's fulfillment policy
|
||||||
|
for a specific marketplace and category group. This type is used when creating or updating
|
||||||
|
a fulfillment business policy.
|
||||||
|
|
||||||
|
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:
|
||||||
|
Union[Any, SetFulfillmentPolicyResponse]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
fulfillment_policy_id=fulfillment_policy_id,
|
||||||
|
client=client,
|
||||||
|
body=body,
|
||||||
|
content_type=content_type,
|
||||||
|
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
fulfillment_policy_id: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
body: FulfillmentPolicyRequest,
|
||||||
|
content_type: str,
|
||||||
|
|
||||||
|
) -> Response[Union[Any, SetFulfillmentPolicyResponse]]:
|
||||||
|
""" This method updates an existing fulfillment policy. Specify the policy you want to update using the
|
||||||
|
<b>fulfillment_policy_id</b> path parameter. Supply a complete policy payload with the updates you
|
||||||
|
want to make; this call overwrites the existing policy with the new details specified in the
|
||||||
|
payload.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
fulfillment_policy_id (str):
|
||||||
|
content_type (str):
|
||||||
|
body (FulfillmentPolicyRequest): This root container defines a seller's fulfillment policy
|
||||||
|
for a specific marketplace and category group. This type is used when creating or updating
|
||||||
|
a fulfillment business policy.
|
||||||
|
|
||||||
|
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[Union[Any, SetFulfillmentPolicyResponse]]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
fulfillment_policy_id=fulfillment_policy_id,
|
||||||
|
body=body,
|
||||||
|
content_type=content_type,
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
response = await client.get_async_httpx_client().request(
|
||||||
|
**kwargs
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
async def asyncio(
|
||||||
|
fulfillment_policy_id: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
body: FulfillmentPolicyRequest,
|
||||||
|
content_type: str,
|
||||||
|
|
||||||
|
) -> Optional[Union[Any, SetFulfillmentPolicyResponse]]:
|
||||||
|
""" This method updates an existing fulfillment policy. Specify the policy you want to update using the
|
||||||
|
<b>fulfillment_policy_id</b> path parameter. Supply a complete policy payload with the updates you
|
||||||
|
want to make; this call overwrites the existing policy with the new details specified in the
|
||||||
|
payload.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
fulfillment_policy_id (str):
|
||||||
|
content_type (str):
|
||||||
|
body (FulfillmentPolicyRequest): This root container defines a seller's fulfillment policy
|
||||||
|
for a specific marketplace and category group. This type is used when creating or updating
|
||||||
|
a fulfillment business policy.
|
||||||
|
|
||||||
|
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:
|
||||||
|
Union[Any, SetFulfillmentPolicyResponse]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
return (await asyncio_detailed(
|
||||||
|
fulfillment_policy_id=fulfillment_policy_id,
|
||||||
|
client=client,
|
||||||
|
body=body,
|
||||||
|
content_type=content_type,
|
||||||
|
|
||||||
|
)).parsed
|
||||||
1
ebay_client/generated/account/api/kyc/__init__.py
Normal file
1
ebay_client/generated/account/api/kyc/__init__.py
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
""" Contains endpoint functions for accessing the API """
|
||||||
168
ebay_client/generated/account/api/kyc/get_kyc.py
Normal file
168
ebay_client/generated/account/api/kyc/get_kyc.py
Normal file
|
|
@ -0,0 +1,168 @@
|
||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any, Optional, Union, cast
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...types import Response, UNSET
|
||||||
|
from ... import errors
|
||||||
|
|
||||||
|
from ...models.kyc_response import KycResponse
|
||||||
|
from typing import cast
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "get",
|
||||||
|
"url": "/kyc",
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Union[Any, KycResponse]]:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = KycResponse.from_dict(response.json())
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return response_200
|
||||||
|
if response.status_code == 400:
|
||||||
|
response_400 = cast(Any, None)
|
||||||
|
return response_400
|
||||||
|
if response.status_code == 500:
|
||||||
|
response_500 = cast(Any, None)
|
||||||
|
return response_500
|
||||||
|
if response.status_code == 204:
|
||||||
|
response_204 = cast(Any, None)
|
||||||
|
return response_204
|
||||||
|
if client.raise_on_unexpected_status:
|
||||||
|
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Union[Any, KycResponse]]:
|
||||||
|
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,
|
||||||
|
|
||||||
|
) -> Response[Union[Any, KycResponse]]:
|
||||||
|
r""" <span class=\"tablenote\"><b>Note:</b> This method was originally created to see which onboarding
|
||||||
|
requirements were still pending for sellers being onboarded for eBay managed payments, but now that
|
||||||
|
all seller accounts are onboarded globally, this method should now just return an empty payload with
|
||||||
|
a <code>204 No Content</code> HTTP status code. </span>
|
||||||
|
|
||||||
|
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[Union[Any, KycResponse]]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
def sync(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
|
||||||
|
) -> Optional[Union[Any, KycResponse]]:
|
||||||
|
r""" <span class=\"tablenote\"><b>Note:</b> This method was originally created to see which onboarding
|
||||||
|
requirements were still pending for sellers being onboarded for eBay managed payments, but now that
|
||||||
|
all seller accounts are onboarded globally, this method should now just return an empty payload with
|
||||||
|
a <code>204 No Content</code> HTTP status code. </span>
|
||||||
|
|
||||||
|
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:
|
||||||
|
Union[Any, KycResponse]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
client=client,
|
||||||
|
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
|
||||||
|
) -> Response[Union[Any, KycResponse]]:
|
||||||
|
r""" <span class=\"tablenote\"><b>Note:</b> This method was originally created to see which onboarding
|
||||||
|
requirements were still pending for sellers being onboarded for eBay managed payments, but now that
|
||||||
|
all seller accounts are onboarded globally, this method should now just return an empty payload with
|
||||||
|
a <code>204 No Content</code> HTTP status code. </span>
|
||||||
|
|
||||||
|
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[Union[Any, KycResponse]]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
response = await client.get_async_httpx_client().request(
|
||||||
|
**kwargs
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
async def asyncio(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
|
||||||
|
) -> Optional[Union[Any, KycResponse]]:
|
||||||
|
r""" <span class=\"tablenote\"><b>Note:</b> This method was originally created to see which onboarding
|
||||||
|
requirements were still pending for sellers being onboarded for eBay managed payments, but now that
|
||||||
|
all seller accounts are onboarded globally, this method should now just return an empty payload with
|
||||||
|
a <code>204 No Content</code> HTTP status code. </span>
|
||||||
|
|
||||||
|
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:
|
||||||
|
Union[Any, KycResponse]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
return (await asyncio_detailed(
|
||||||
|
client=client,
|
||||||
|
|
||||||
|
)).parsed
|
||||||
1
ebay_client/generated/account/api/onboarding/__init__.py
Normal file
1
ebay_client/generated/account/api/onboarding/__init__.py
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
""" Contains endpoint functions for accessing the API """
|
||||||
|
|
@ -0,0 +1,202 @@
|
||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any, Optional, Union, cast
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...types import Response, UNSET
|
||||||
|
from ... import errors
|
||||||
|
|
||||||
|
from ...models.payments_program_onboarding_response import PaymentsProgramOnboardingResponse
|
||||||
|
from typing import cast
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
marketplace_id: str,
|
||||||
|
payments_program_type: str,
|
||||||
|
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "get",
|
||||||
|
"url": "/payments_program/{marketplace_id}/{payments_program_type}/onboarding".format(marketplace_id=marketplace_id,payments_program_type=payments_program_type,),
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Union[Any, PaymentsProgramOnboardingResponse]]:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = PaymentsProgramOnboardingResponse.from_dict(response.json())
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return response_200
|
||||||
|
if response.status_code == 400:
|
||||||
|
response_400 = cast(Any, None)
|
||||||
|
return response_400
|
||||||
|
if response.status_code == 500:
|
||||||
|
response_500 = cast(Any, None)
|
||||||
|
return response_500
|
||||||
|
if response.status_code == 404:
|
||||||
|
response_404 = cast(Any, None)
|
||||||
|
return response_404
|
||||||
|
if client.raise_on_unexpected_status:
|
||||||
|
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Union[Any, PaymentsProgramOnboardingResponse]]:
|
||||||
|
return Response(
|
||||||
|
status_code=HTTPStatus(response.status_code),
|
||||||
|
content=response.content,
|
||||||
|
headers=response.headers,
|
||||||
|
parsed=_parse_response(client=client, response=response),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def sync_detailed(
|
||||||
|
marketplace_id: str,
|
||||||
|
payments_program_type: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
|
||||||
|
) -> Response[Union[Any, PaymentsProgramOnboardingResponse]]:
|
||||||
|
r""" <span class=\"tablenote\"><b>Note:</b> This method is no longer applicable, as all seller accounts
|
||||||
|
globally have been enabled for the new eBay payment and checkout flow.</span><br>This method
|
||||||
|
retrieves a seller's onboarding status for a payments program for a specified marketplace. The
|
||||||
|
overall onboarding status of the seller and the status of each onboarding step is returned.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
marketplace_id (str):
|
||||||
|
payments_program_type (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[Union[Any, PaymentsProgramOnboardingResponse]]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
marketplace_id=marketplace_id,
|
||||||
|
payments_program_type=payments_program_type,
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
def sync(
|
||||||
|
marketplace_id: str,
|
||||||
|
payments_program_type: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
|
||||||
|
) -> Optional[Union[Any, PaymentsProgramOnboardingResponse]]:
|
||||||
|
r""" <span class=\"tablenote\"><b>Note:</b> This method is no longer applicable, as all seller accounts
|
||||||
|
globally have been enabled for the new eBay payment and checkout flow.</span><br>This method
|
||||||
|
retrieves a seller's onboarding status for a payments program for a specified marketplace. The
|
||||||
|
overall onboarding status of the seller and the status of each onboarding step is returned.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
marketplace_id (str):
|
||||||
|
payments_program_type (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:
|
||||||
|
Union[Any, PaymentsProgramOnboardingResponse]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
marketplace_id=marketplace_id,
|
||||||
|
payments_program_type=payments_program_type,
|
||||||
|
client=client,
|
||||||
|
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
marketplace_id: str,
|
||||||
|
payments_program_type: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
|
||||||
|
) -> Response[Union[Any, PaymentsProgramOnboardingResponse]]:
|
||||||
|
r""" <span class=\"tablenote\"><b>Note:</b> This method is no longer applicable, as all seller accounts
|
||||||
|
globally have been enabled for the new eBay payment and checkout flow.</span><br>This method
|
||||||
|
retrieves a seller's onboarding status for a payments program for a specified marketplace. The
|
||||||
|
overall onboarding status of the seller and the status of each onboarding step is returned.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
marketplace_id (str):
|
||||||
|
payments_program_type (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[Union[Any, PaymentsProgramOnboardingResponse]]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
marketplace_id=marketplace_id,
|
||||||
|
payments_program_type=payments_program_type,
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
response = await client.get_async_httpx_client().request(
|
||||||
|
**kwargs
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
async def asyncio(
|
||||||
|
marketplace_id: str,
|
||||||
|
payments_program_type: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
|
||||||
|
) -> Optional[Union[Any, PaymentsProgramOnboardingResponse]]:
|
||||||
|
r""" <span class=\"tablenote\"><b>Note:</b> This method is no longer applicable, as all seller accounts
|
||||||
|
globally have been enabled for the new eBay payment and checkout flow.</span><br>This method
|
||||||
|
retrieves a seller's onboarding status for a payments program for a specified marketplace. The
|
||||||
|
overall onboarding status of the seller and the status of each onboarding step is returned.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
marketplace_id (str):
|
||||||
|
payments_program_type (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:
|
||||||
|
Union[Any, PaymentsProgramOnboardingResponse]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
return (await asyncio_detailed(
|
||||||
|
marketplace_id=marketplace_id,
|
||||||
|
payments_program_type=payments_program_type,
|
||||||
|
client=client,
|
||||||
|
|
||||||
|
)).parsed
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
""" Contains endpoint functions for accessing the API """
|
||||||
|
|
@ -0,0 +1,225 @@
|
||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any, Optional, Union, cast
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...types import Response, UNSET
|
||||||
|
from ... import errors
|
||||||
|
|
||||||
|
from ...models.payment_policy_request import PaymentPolicyRequest
|
||||||
|
from ...models.set_payment_policy_response import SetPaymentPolicyResponse
|
||||||
|
from typing import cast
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
*,
|
||||||
|
body: PaymentPolicyRequest,
|
||||||
|
content_type: str,
|
||||||
|
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
headers: dict[str, Any] = {}
|
||||||
|
headers["Content-Type"] = content_type
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "post",
|
||||||
|
"url": "/payment_policy",
|
||||||
|
}
|
||||||
|
|
||||||
|
_kwargs["json"] = body.to_dict()
|
||||||
|
|
||||||
|
|
||||||
|
headers["Content-Type"] = "application/json"
|
||||||
|
|
||||||
|
_kwargs["headers"] = headers
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Union[Any, SetPaymentPolicyResponse]]:
|
||||||
|
if response.status_code == 201:
|
||||||
|
response_201 = SetPaymentPolicyResponse.from_dict(response.json())
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return response_201
|
||||||
|
if response.status_code == 400:
|
||||||
|
response_400 = cast(Any, None)
|
||||||
|
return response_400
|
||||||
|
if response.status_code == 500:
|
||||||
|
response_500 = cast(Any, None)
|
||||||
|
return response_500
|
||||||
|
if client.raise_on_unexpected_status:
|
||||||
|
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Union[Any, SetPaymentPolicyResponse]]:
|
||||||
|
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,
|
||||||
|
body: PaymentPolicyRequest,
|
||||||
|
content_type: str,
|
||||||
|
|
||||||
|
) -> Response[Union[Any, SetPaymentPolicyResponse]]:
|
||||||
|
r""" This method creates a new payment policy where the policy encapsulates seller's terms for order
|
||||||
|
payments. <br><br>A successful request returns the <b>getPaymentPolicy</b> URI to the new policy in
|
||||||
|
the <b>Location</b> response header and the ID for the new policy is returned in the response
|
||||||
|
payload. <p class=\"tablenote\"><b>Tip:</b> For details on creating and using the business policies
|
||||||
|
supported by the Account API, see <a href=\"/api-docs/sell/static/seller-accounts/business-
|
||||||
|
policies.html\">eBay business policies</a>.</p>
|
||||||
|
|
||||||
|
Args:
|
||||||
|
content_type (str):
|
||||||
|
body (PaymentPolicyRequest): This root container defines a seller's payment business
|
||||||
|
policy for a specific marketplace and category group. This type is used when creating or
|
||||||
|
updating a payment business policy.
|
||||||
|
|
||||||
|
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[Union[Any, SetPaymentPolicyResponse]]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
body=body,
|
||||||
|
content_type=content_type,
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
def sync(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
body: PaymentPolicyRequest,
|
||||||
|
content_type: str,
|
||||||
|
|
||||||
|
) -> Optional[Union[Any, SetPaymentPolicyResponse]]:
|
||||||
|
r""" This method creates a new payment policy where the policy encapsulates seller's terms for order
|
||||||
|
payments. <br><br>A successful request returns the <b>getPaymentPolicy</b> URI to the new policy in
|
||||||
|
the <b>Location</b> response header and the ID for the new policy is returned in the response
|
||||||
|
payload. <p class=\"tablenote\"><b>Tip:</b> For details on creating and using the business policies
|
||||||
|
supported by the Account API, see <a href=\"/api-docs/sell/static/seller-accounts/business-
|
||||||
|
policies.html\">eBay business policies</a>.</p>
|
||||||
|
|
||||||
|
Args:
|
||||||
|
content_type (str):
|
||||||
|
body (PaymentPolicyRequest): This root container defines a seller's payment business
|
||||||
|
policy for a specific marketplace and category group. This type is used when creating or
|
||||||
|
updating a payment business policy.
|
||||||
|
|
||||||
|
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:
|
||||||
|
Union[Any, SetPaymentPolicyResponse]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
client=client,
|
||||||
|
body=body,
|
||||||
|
content_type=content_type,
|
||||||
|
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
body: PaymentPolicyRequest,
|
||||||
|
content_type: str,
|
||||||
|
|
||||||
|
) -> Response[Union[Any, SetPaymentPolicyResponse]]:
|
||||||
|
r""" This method creates a new payment policy where the policy encapsulates seller's terms for order
|
||||||
|
payments. <br><br>A successful request returns the <b>getPaymentPolicy</b> URI to the new policy in
|
||||||
|
the <b>Location</b> response header and the ID for the new policy is returned in the response
|
||||||
|
payload. <p class=\"tablenote\"><b>Tip:</b> For details on creating and using the business policies
|
||||||
|
supported by the Account API, see <a href=\"/api-docs/sell/static/seller-accounts/business-
|
||||||
|
policies.html\">eBay business policies</a>.</p>
|
||||||
|
|
||||||
|
Args:
|
||||||
|
content_type (str):
|
||||||
|
body (PaymentPolicyRequest): This root container defines a seller's payment business
|
||||||
|
policy for a specific marketplace and category group. This type is used when creating or
|
||||||
|
updating a payment business policy.
|
||||||
|
|
||||||
|
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[Union[Any, SetPaymentPolicyResponse]]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
body=body,
|
||||||
|
content_type=content_type,
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
response = await client.get_async_httpx_client().request(
|
||||||
|
**kwargs
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
async def asyncio(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
body: PaymentPolicyRequest,
|
||||||
|
content_type: str,
|
||||||
|
|
||||||
|
) -> Optional[Union[Any, SetPaymentPolicyResponse]]:
|
||||||
|
r""" This method creates a new payment policy where the policy encapsulates seller's terms for order
|
||||||
|
payments. <br><br>A successful request returns the <b>getPaymentPolicy</b> URI to the new policy in
|
||||||
|
the <b>Location</b> response header and the ID for the new policy is returned in the response
|
||||||
|
payload. <p class=\"tablenote\"><b>Tip:</b> For details on creating and using the business policies
|
||||||
|
supported by the Account API, see <a href=\"/api-docs/sell/static/seller-accounts/business-
|
||||||
|
policies.html\">eBay business policies</a>.</p>
|
||||||
|
|
||||||
|
Args:
|
||||||
|
content_type (str):
|
||||||
|
body (PaymentPolicyRequest): This root container defines a seller's payment business
|
||||||
|
policy for a specific marketplace and category group. This type is used when creating or
|
||||||
|
updating a payment business policy.
|
||||||
|
|
||||||
|
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:
|
||||||
|
Union[Any, SetPaymentPolicyResponse]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
return (await asyncio_detailed(
|
||||||
|
client=client,
|
||||||
|
body=body,
|
||||||
|
content_type=content_type,
|
||||||
|
|
||||||
|
)).parsed
|
||||||
|
|
@ -0,0 +1,122 @@
|
||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any, Optional, Union, cast
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...types import Response, UNSET
|
||||||
|
from ... import errors
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
payment_policy_id: str,
|
||||||
|
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "delete",
|
||||||
|
"url": "/payment_policy/{payment_policy_id}".format(payment_policy_id=payment_policy_id,),
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
|
||||||
|
if response.status_code == 400:
|
||||||
|
return None
|
||||||
|
if response.status_code == 500:
|
||||||
|
return None
|
||||||
|
if response.status_code == 204:
|
||||||
|
return None
|
||||||
|
if response.status_code == 404:
|
||||||
|
return None
|
||||||
|
if response.status_code == 409:
|
||||||
|
return None
|
||||||
|
if client.raise_on_unexpected_status:
|
||||||
|
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
|
||||||
|
return Response(
|
||||||
|
status_code=HTTPStatus(response.status_code),
|
||||||
|
content=response.content,
|
||||||
|
headers=response.headers,
|
||||||
|
parsed=_parse_response(client=client, response=response),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def sync_detailed(
|
||||||
|
payment_policy_id: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
|
||||||
|
) -> Response[Any]:
|
||||||
|
""" This method deletes a payment policy. Supply the ID of the policy you want to delete in the
|
||||||
|
<b>paymentPolicyId</b> path parameter.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
payment_policy_id (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[Any]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
payment_policy_id=payment_policy_id,
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
payment_policy_id: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
|
||||||
|
) -> Response[Any]:
|
||||||
|
""" This method deletes a payment policy. Supply the ID of the policy you want to delete in the
|
||||||
|
<b>paymentPolicyId</b> path parameter.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
payment_policy_id (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[Any]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
payment_policy_id=payment_policy_id,
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
response = await client.get_async_httpx_client().request(
|
||||||
|
**kwargs
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
@ -0,0 +1,206 @@
|
||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any, Optional, Union, cast
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...types import Response, UNSET
|
||||||
|
from ... import errors
|
||||||
|
|
||||||
|
from ...models.payment_policy_response import PaymentPolicyResponse
|
||||||
|
from ...types import UNSET, Unset
|
||||||
|
from typing import cast
|
||||||
|
from typing import Union
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
*,
|
||||||
|
marketplace_id: str,
|
||||||
|
content_language: Union[Unset, str] = UNSET,
|
||||||
|
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
headers: dict[str, Any] = {}
|
||||||
|
if not isinstance(content_language, Unset):
|
||||||
|
headers["Content-Language"] = content_language
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
params: dict[str, Any] = {}
|
||||||
|
|
||||||
|
params["marketplace_id"] = marketplace_id
|
||||||
|
|
||||||
|
|
||||||
|
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": "/payment_policy",
|
||||||
|
"params": params,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
_kwargs["headers"] = headers
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Union[Any, PaymentPolicyResponse]]:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = PaymentPolicyResponse.from_dict(response.json())
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return response_200
|
||||||
|
if response.status_code == 400:
|
||||||
|
response_400 = cast(Any, None)
|
||||||
|
return response_400
|
||||||
|
if response.status_code == 500:
|
||||||
|
response_500 = cast(Any, None)
|
||||||
|
return response_500
|
||||||
|
if client.raise_on_unexpected_status:
|
||||||
|
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Union[Any, PaymentPolicyResponse]]:
|
||||||
|
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,
|
||||||
|
marketplace_id: str,
|
||||||
|
content_language: Union[Unset, str] = UNSET,
|
||||||
|
|
||||||
|
) -> Response[Union[Any, PaymentPolicyResponse]]:
|
||||||
|
""" This method retrieves all the payment business policies configured for the marketplace you specify
|
||||||
|
using the <code>marketplace_id</code> query parameter.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
marketplace_id (str):
|
||||||
|
content_language (Union[Unset, 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[Union[Any, PaymentPolicyResponse]]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
marketplace_id=marketplace_id,
|
||||||
|
content_language=content_language,
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
def sync(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
marketplace_id: str,
|
||||||
|
content_language: Union[Unset, str] = UNSET,
|
||||||
|
|
||||||
|
) -> Optional[Union[Any, PaymentPolicyResponse]]:
|
||||||
|
""" This method retrieves all the payment business policies configured for the marketplace you specify
|
||||||
|
using the <code>marketplace_id</code> query parameter.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
marketplace_id (str):
|
||||||
|
content_language (Union[Unset, 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:
|
||||||
|
Union[Any, PaymentPolicyResponse]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
client=client,
|
||||||
|
marketplace_id=marketplace_id,
|
||||||
|
content_language=content_language,
|
||||||
|
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
marketplace_id: str,
|
||||||
|
content_language: Union[Unset, str] = UNSET,
|
||||||
|
|
||||||
|
) -> Response[Union[Any, PaymentPolicyResponse]]:
|
||||||
|
""" This method retrieves all the payment business policies configured for the marketplace you specify
|
||||||
|
using the <code>marketplace_id</code> query parameter.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
marketplace_id (str):
|
||||||
|
content_language (Union[Unset, 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[Union[Any, PaymentPolicyResponse]]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
marketplace_id=marketplace_id,
|
||||||
|
content_language=content_language,
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
response = await client.get_async_httpx_client().request(
|
||||||
|
**kwargs
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
async def asyncio(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
marketplace_id: str,
|
||||||
|
content_language: Union[Unset, str] = UNSET,
|
||||||
|
|
||||||
|
) -> Optional[Union[Any, PaymentPolicyResponse]]:
|
||||||
|
""" This method retrieves all the payment business policies configured for the marketplace you specify
|
||||||
|
using the <code>marketplace_id</code> query parameter.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
marketplace_id (str):
|
||||||
|
content_language (Union[Unset, 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:
|
||||||
|
Union[Any, PaymentPolicyResponse]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
return (await asyncio_detailed(
|
||||||
|
client=client,
|
||||||
|
marketplace_id=marketplace_id,
|
||||||
|
content_language=content_language,
|
||||||
|
|
||||||
|
)).parsed
|
||||||
|
|
@ -0,0 +1,181 @@
|
||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any, Optional, Union, cast
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...types import Response, UNSET
|
||||||
|
from ... import errors
|
||||||
|
|
||||||
|
from ...models.payment_policy import PaymentPolicy
|
||||||
|
from typing import cast
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
payment_policy_id: str,
|
||||||
|
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "get",
|
||||||
|
"url": "/payment_policy/{payment_policy_id}".format(payment_policy_id=payment_policy_id,),
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Union[Any, PaymentPolicy]]:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = PaymentPolicy.from_dict(response.json())
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return response_200
|
||||||
|
if response.status_code == 400:
|
||||||
|
response_400 = cast(Any, None)
|
||||||
|
return response_400
|
||||||
|
if response.status_code == 500:
|
||||||
|
response_500 = cast(Any, None)
|
||||||
|
return response_500
|
||||||
|
if response.status_code == 404:
|
||||||
|
response_404 = cast(Any, None)
|
||||||
|
return response_404
|
||||||
|
if client.raise_on_unexpected_status:
|
||||||
|
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Union[Any, PaymentPolicy]]:
|
||||||
|
return Response(
|
||||||
|
status_code=HTTPStatus(response.status_code),
|
||||||
|
content=response.content,
|
||||||
|
headers=response.headers,
|
||||||
|
parsed=_parse_response(client=client, response=response),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def sync_detailed(
|
||||||
|
payment_policy_id: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
|
||||||
|
) -> Response[Union[Any, PaymentPolicy]]:
|
||||||
|
""" This method retrieves the complete details of a payment policy. Supply the ID of the policy you want
|
||||||
|
to retrieve using the <b>paymentPolicyId</b> path parameter.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
payment_policy_id (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[Union[Any, PaymentPolicy]]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
payment_policy_id=payment_policy_id,
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
def sync(
|
||||||
|
payment_policy_id: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
|
||||||
|
) -> Optional[Union[Any, PaymentPolicy]]:
|
||||||
|
""" This method retrieves the complete details of a payment policy. Supply the ID of the policy you want
|
||||||
|
to retrieve using the <b>paymentPolicyId</b> path parameter.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
payment_policy_id (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:
|
||||||
|
Union[Any, PaymentPolicy]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
payment_policy_id=payment_policy_id,
|
||||||
|
client=client,
|
||||||
|
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
payment_policy_id: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
|
||||||
|
) -> Response[Union[Any, PaymentPolicy]]:
|
||||||
|
""" This method retrieves the complete details of a payment policy. Supply the ID of the policy you want
|
||||||
|
to retrieve using the <b>paymentPolicyId</b> path parameter.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
payment_policy_id (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[Union[Any, PaymentPolicy]]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
payment_policy_id=payment_policy_id,
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
response = await client.get_async_httpx_client().request(
|
||||||
|
**kwargs
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
async def asyncio(
|
||||||
|
payment_policy_id: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
|
||||||
|
) -> Optional[Union[Any, PaymentPolicy]]:
|
||||||
|
""" This method retrieves the complete details of a payment policy. Supply the ID of the policy you want
|
||||||
|
to retrieve using the <b>paymentPolicyId</b> path parameter.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
payment_policy_id (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:
|
||||||
|
Union[Any, PaymentPolicy]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
return (await asyncio_detailed(
|
||||||
|
payment_policy_id=payment_policy_id,
|
||||||
|
client=client,
|
||||||
|
|
||||||
|
)).parsed
|
||||||
|
|
@ -0,0 +1,221 @@
|
||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any, Optional, Union, cast
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...types import Response, UNSET
|
||||||
|
from ... import errors
|
||||||
|
|
||||||
|
from ...models.payment_policy import PaymentPolicy
|
||||||
|
from ...types import UNSET, Unset
|
||||||
|
from typing import cast
|
||||||
|
from typing import Union
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
*,
|
||||||
|
marketplace_id: str,
|
||||||
|
name: str,
|
||||||
|
content_language: Union[Unset, str] = UNSET,
|
||||||
|
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
headers: dict[str, Any] = {}
|
||||||
|
if not isinstance(content_language, Unset):
|
||||||
|
headers["Content-Language"] = content_language
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
params: dict[str, Any] = {}
|
||||||
|
|
||||||
|
params["marketplace_id"] = marketplace_id
|
||||||
|
|
||||||
|
params["name"] = name
|
||||||
|
|
||||||
|
|
||||||
|
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": "/payment_policy/get_by_policy_name",
|
||||||
|
"params": params,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
_kwargs["headers"] = headers
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Union[Any, PaymentPolicy]]:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = PaymentPolicy.from_dict(response.json())
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return response_200
|
||||||
|
if response.status_code == 400:
|
||||||
|
response_400 = cast(Any, None)
|
||||||
|
return response_400
|
||||||
|
if response.status_code == 500:
|
||||||
|
response_500 = cast(Any, None)
|
||||||
|
return response_500
|
||||||
|
if client.raise_on_unexpected_status:
|
||||||
|
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Union[Any, PaymentPolicy]]:
|
||||||
|
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,
|
||||||
|
marketplace_id: str,
|
||||||
|
name: str,
|
||||||
|
content_language: Union[Unset, str] = UNSET,
|
||||||
|
|
||||||
|
) -> Response[Union[Any, PaymentPolicy]]:
|
||||||
|
""" This method retrieves the details of a specific payment policy. Supply both the policy
|
||||||
|
<code>name</code> and its associated <code>marketplace_id</code> in the request query parameters.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
marketplace_id (str):
|
||||||
|
name (str):
|
||||||
|
content_language (Union[Unset, 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[Union[Any, PaymentPolicy]]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
marketplace_id=marketplace_id,
|
||||||
|
name=name,
|
||||||
|
content_language=content_language,
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
def sync(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
marketplace_id: str,
|
||||||
|
name: str,
|
||||||
|
content_language: Union[Unset, str] = UNSET,
|
||||||
|
|
||||||
|
) -> Optional[Union[Any, PaymentPolicy]]:
|
||||||
|
""" This method retrieves the details of a specific payment policy. Supply both the policy
|
||||||
|
<code>name</code> and its associated <code>marketplace_id</code> in the request query parameters.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
marketplace_id (str):
|
||||||
|
name (str):
|
||||||
|
content_language (Union[Unset, 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:
|
||||||
|
Union[Any, PaymentPolicy]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
client=client,
|
||||||
|
marketplace_id=marketplace_id,
|
||||||
|
name=name,
|
||||||
|
content_language=content_language,
|
||||||
|
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
marketplace_id: str,
|
||||||
|
name: str,
|
||||||
|
content_language: Union[Unset, str] = UNSET,
|
||||||
|
|
||||||
|
) -> Response[Union[Any, PaymentPolicy]]:
|
||||||
|
""" This method retrieves the details of a specific payment policy. Supply both the policy
|
||||||
|
<code>name</code> and its associated <code>marketplace_id</code> in the request query parameters.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
marketplace_id (str):
|
||||||
|
name (str):
|
||||||
|
content_language (Union[Unset, 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[Union[Any, PaymentPolicy]]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
marketplace_id=marketplace_id,
|
||||||
|
name=name,
|
||||||
|
content_language=content_language,
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
response = await client.get_async_httpx_client().request(
|
||||||
|
**kwargs
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
async def asyncio(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
marketplace_id: str,
|
||||||
|
name: str,
|
||||||
|
content_language: Union[Unset, str] = UNSET,
|
||||||
|
|
||||||
|
) -> Optional[Union[Any, PaymentPolicy]]:
|
||||||
|
""" This method retrieves the details of a specific payment policy. Supply both the policy
|
||||||
|
<code>name</code> and its associated <code>marketplace_id</code> in the request query parameters.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
marketplace_id (str):
|
||||||
|
name (str):
|
||||||
|
content_language (Union[Unset, 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:
|
||||||
|
Union[Any, PaymentPolicy]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
return (await asyncio_detailed(
|
||||||
|
client=client,
|
||||||
|
marketplace_id=marketplace_id,
|
||||||
|
name=name,
|
||||||
|
content_language=content_language,
|
||||||
|
|
||||||
|
)).parsed
|
||||||
|
|
@ -0,0 +1,229 @@
|
||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any, Optional, Union, cast
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...types import Response, UNSET
|
||||||
|
from ... import errors
|
||||||
|
|
||||||
|
from ...models.payment_policy_request import PaymentPolicyRequest
|
||||||
|
from ...models.set_payment_policy_response import SetPaymentPolicyResponse
|
||||||
|
from typing import cast
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
payment_policy_id: str,
|
||||||
|
*,
|
||||||
|
body: PaymentPolicyRequest,
|
||||||
|
content_type: str,
|
||||||
|
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
headers: dict[str, Any] = {}
|
||||||
|
headers["Content-Type"] = content_type
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "put",
|
||||||
|
"url": "/payment_policy/{payment_policy_id}".format(payment_policy_id=payment_policy_id,),
|
||||||
|
}
|
||||||
|
|
||||||
|
_kwargs["json"] = body.to_dict()
|
||||||
|
|
||||||
|
|
||||||
|
headers["Content-Type"] = "application/json"
|
||||||
|
|
||||||
|
_kwargs["headers"] = headers
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Union[Any, SetPaymentPolicyResponse]]:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = SetPaymentPolicyResponse.from_dict(response.json())
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return response_200
|
||||||
|
if response.status_code == 400:
|
||||||
|
response_400 = cast(Any, None)
|
||||||
|
return response_400
|
||||||
|
if response.status_code == 500:
|
||||||
|
response_500 = cast(Any, None)
|
||||||
|
return response_500
|
||||||
|
if response.status_code == 404:
|
||||||
|
response_404 = cast(Any, None)
|
||||||
|
return response_404
|
||||||
|
if client.raise_on_unexpected_status:
|
||||||
|
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Union[Any, SetPaymentPolicyResponse]]:
|
||||||
|
return Response(
|
||||||
|
status_code=HTTPStatus(response.status_code),
|
||||||
|
content=response.content,
|
||||||
|
headers=response.headers,
|
||||||
|
parsed=_parse_response(client=client, response=response),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def sync_detailed(
|
||||||
|
payment_policy_id: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
body: PaymentPolicyRequest,
|
||||||
|
content_type: str,
|
||||||
|
|
||||||
|
) -> Response[Union[Any, SetPaymentPolicyResponse]]:
|
||||||
|
""" This method updates an existing payment policy. Specify the policy you want to update using the
|
||||||
|
<b>payment_policy_id</b> path parameter. Supply a complete policy payload with the updates you want
|
||||||
|
to make; this call overwrites the existing policy with the new details specified in the payload.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
payment_policy_id (str):
|
||||||
|
content_type (str):
|
||||||
|
body (PaymentPolicyRequest): This root container defines a seller's payment business
|
||||||
|
policy for a specific marketplace and category group. This type is used when creating or
|
||||||
|
updating a payment business policy.
|
||||||
|
|
||||||
|
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[Union[Any, SetPaymentPolicyResponse]]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
payment_policy_id=payment_policy_id,
|
||||||
|
body=body,
|
||||||
|
content_type=content_type,
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
def sync(
|
||||||
|
payment_policy_id: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
body: PaymentPolicyRequest,
|
||||||
|
content_type: str,
|
||||||
|
|
||||||
|
) -> Optional[Union[Any, SetPaymentPolicyResponse]]:
|
||||||
|
""" This method updates an existing payment policy. Specify the policy you want to update using the
|
||||||
|
<b>payment_policy_id</b> path parameter. Supply a complete policy payload with the updates you want
|
||||||
|
to make; this call overwrites the existing policy with the new details specified in the payload.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
payment_policy_id (str):
|
||||||
|
content_type (str):
|
||||||
|
body (PaymentPolicyRequest): This root container defines a seller's payment business
|
||||||
|
policy for a specific marketplace and category group. This type is used when creating or
|
||||||
|
updating a payment business policy.
|
||||||
|
|
||||||
|
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:
|
||||||
|
Union[Any, SetPaymentPolicyResponse]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
payment_policy_id=payment_policy_id,
|
||||||
|
client=client,
|
||||||
|
body=body,
|
||||||
|
content_type=content_type,
|
||||||
|
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
payment_policy_id: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
body: PaymentPolicyRequest,
|
||||||
|
content_type: str,
|
||||||
|
|
||||||
|
) -> Response[Union[Any, SetPaymentPolicyResponse]]:
|
||||||
|
""" This method updates an existing payment policy. Specify the policy you want to update using the
|
||||||
|
<b>payment_policy_id</b> path parameter. Supply a complete policy payload with the updates you want
|
||||||
|
to make; this call overwrites the existing policy with the new details specified in the payload.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
payment_policy_id (str):
|
||||||
|
content_type (str):
|
||||||
|
body (PaymentPolicyRequest): This root container defines a seller's payment business
|
||||||
|
policy for a specific marketplace and category group. This type is used when creating or
|
||||||
|
updating a payment business policy.
|
||||||
|
|
||||||
|
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[Union[Any, SetPaymentPolicyResponse]]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
payment_policy_id=payment_policy_id,
|
||||||
|
body=body,
|
||||||
|
content_type=content_type,
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
response = await client.get_async_httpx_client().request(
|
||||||
|
**kwargs
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
async def asyncio(
|
||||||
|
payment_policy_id: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
body: PaymentPolicyRequest,
|
||||||
|
content_type: str,
|
||||||
|
|
||||||
|
) -> Optional[Union[Any, SetPaymentPolicyResponse]]:
|
||||||
|
""" This method updates an existing payment policy. Specify the policy you want to update using the
|
||||||
|
<b>payment_policy_id</b> path parameter. Supply a complete policy payload with the updates you want
|
||||||
|
to make; this call overwrites the existing policy with the new details specified in the payload.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
payment_policy_id (str):
|
||||||
|
content_type (str):
|
||||||
|
body (PaymentPolicyRequest): This root container defines a seller's payment business
|
||||||
|
policy for a specific marketplace and category group. This type is used when creating or
|
||||||
|
updating a payment business policy.
|
||||||
|
|
||||||
|
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:
|
||||||
|
Union[Any, SetPaymentPolicyResponse]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
return (await asyncio_detailed(
|
||||||
|
payment_policy_id=payment_policy_id,
|
||||||
|
client=client,
|
||||||
|
body=body,
|
||||||
|
content_type=content_type,
|
||||||
|
|
||||||
|
)).parsed
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
""" Contains endpoint functions for accessing the API """
|
||||||
|
|
@ -0,0 +1,206 @@
|
||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any, Optional, Union, cast
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...types import Response, UNSET
|
||||||
|
from ... import errors
|
||||||
|
|
||||||
|
from ...models.payments_program_response import PaymentsProgramResponse
|
||||||
|
from typing import cast
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
marketplace_id: str,
|
||||||
|
payments_program_type: str,
|
||||||
|
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "get",
|
||||||
|
"url": "/payments_program/{marketplace_id}/{payments_program_type}".format(marketplace_id=marketplace_id,payments_program_type=payments_program_type,),
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Union[Any, PaymentsProgramResponse]]:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = PaymentsProgramResponse.from_dict(response.json())
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return response_200
|
||||||
|
if response.status_code == 400:
|
||||||
|
response_400 = cast(Any, None)
|
||||||
|
return response_400
|
||||||
|
if response.status_code == 500:
|
||||||
|
response_500 = cast(Any, None)
|
||||||
|
return response_500
|
||||||
|
if response.status_code == 404:
|
||||||
|
response_404 = cast(Any, None)
|
||||||
|
return response_404
|
||||||
|
if client.raise_on_unexpected_status:
|
||||||
|
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Union[Any, PaymentsProgramResponse]]:
|
||||||
|
return Response(
|
||||||
|
status_code=HTTPStatus(response.status_code),
|
||||||
|
content=response.content,
|
||||||
|
headers=response.headers,
|
||||||
|
parsed=_parse_response(client=client, response=response),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def sync_detailed(
|
||||||
|
marketplace_id: str,
|
||||||
|
payments_program_type: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
|
||||||
|
) -> Response[Union[Any, PaymentsProgramResponse]]:
|
||||||
|
r""" <span class=\"tablenote\"><b>Note:</b> This method is no longer applicable, as all seller accounts
|
||||||
|
globally have been enabled for the new eBay payment and checkout flow.</span><br>This method returns
|
||||||
|
whether or not the user is opted-in to the specified payments program. Sellers opt-in to payments
|
||||||
|
programs by marketplace and you use the <b>marketplace_id</b> path parameter to specify the
|
||||||
|
marketplace of the status flag you want returned.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
marketplace_id (str):
|
||||||
|
payments_program_type (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[Union[Any, PaymentsProgramResponse]]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
marketplace_id=marketplace_id,
|
||||||
|
payments_program_type=payments_program_type,
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
def sync(
|
||||||
|
marketplace_id: str,
|
||||||
|
payments_program_type: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
|
||||||
|
) -> Optional[Union[Any, PaymentsProgramResponse]]:
|
||||||
|
r""" <span class=\"tablenote\"><b>Note:</b> This method is no longer applicable, as all seller accounts
|
||||||
|
globally have been enabled for the new eBay payment and checkout flow.</span><br>This method returns
|
||||||
|
whether or not the user is opted-in to the specified payments program. Sellers opt-in to payments
|
||||||
|
programs by marketplace and you use the <b>marketplace_id</b> path parameter to specify the
|
||||||
|
marketplace of the status flag you want returned.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
marketplace_id (str):
|
||||||
|
payments_program_type (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:
|
||||||
|
Union[Any, PaymentsProgramResponse]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
marketplace_id=marketplace_id,
|
||||||
|
payments_program_type=payments_program_type,
|
||||||
|
client=client,
|
||||||
|
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
marketplace_id: str,
|
||||||
|
payments_program_type: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
|
||||||
|
) -> Response[Union[Any, PaymentsProgramResponse]]:
|
||||||
|
r""" <span class=\"tablenote\"><b>Note:</b> This method is no longer applicable, as all seller accounts
|
||||||
|
globally have been enabled for the new eBay payment and checkout flow.</span><br>This method returns
|
||||||
|
whether or not the user is opted-in to the specified payments program. Sellers opt-in to payments
|
||||||
|
programs by marketplace and you use the <b>marketplace_id</b> path parameter to specify the
|
||||||
|
marketplace of the status flag you want returned.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
marketplace_id (str):
|
||||||
|
payments_program_type (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[Union[Any, PaymentsProgramResponse]]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
marketplace_id=marketplace_id,
|
||||||
|
payments_program_type=payments_program_type,
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
response = await client.get_async_httpx_client().request(
|
||||||
|
**kwargs
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
async def asyncio(
|
||||||
|
marketplace_id: str,
|
||||||
|
payments_program_type: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
|
||||||
|
) -> Optional[Union[Any, PaymentsProgramResponse]]:
|
||||||
|
r""" <span class=\"tablenote\"><b>Note:</b> This method is no longer applicable, as all seller accounts
|
||||||
|
globally have been enabled for the new eBay payment and checkout flow.</span><br>This method returns
|
||||||
|
whether or not the user is opted-in to the specified payments program. Sellers opt-in to payments
|
||||||
|
programs by marketplace and you use the <b>marketplace_id</b> path parameter to specify the
|
||||||
|
marketplace of the status flag you want returned.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
marketplace_id (str):
|
||||||
|
payments_program_type (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:
|
||||||
|
Union[Any, PaymentsProgramResponse]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
return (await asyncio_detailed(
|
||||||
|
marketplace_id=marketplace_id,
|
||||||
|
payments_program_type=payments_program_type,
|
||||||
|
client=client,
|
||||||
|
|
||||||
|
)).parsed
|
||||||
1
ebay_client/generated/account/api/privilege/__init__.py
Normal file
1
ebay_client/generated/account/api/privilege/__init__.py
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
""" Contains endpoint functions for accessing the API """
|
||||||
161
ebay_client/generated/account/api/privilege/get_privileges.py
Normal file
161
ebay_client/generated/account/api/privilege/get_privileges.py
Normal file
|
|
@ -0,0 +1,161 @@
|
||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any, Optional, Union, cast
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...types import Response, UNSET
|
||||||
|
from ... import errors
|
||||||
|
|
||||||
|
from ...models.selling_privileges import SellingPrivileges
|
||||||
|
from typing import cast
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "get",
|
||||||
|
"url": "/privilege",
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Union[Any, SellingPrivileges]]:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = SellingPrivileges.from_dict(response.json())
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return response_200
|
||||||
|
if response.status_code == 400:
|
||||||
|
response_400 = cast(Any, None)
|
||||||
|
return response_400
|
||||||
|
if response.status_code == 500:
|
||||||
|
response_500 = cast(Any, None)
|
||||||
|
return response_500
|
||||||
|
if client.raise_on_unexpected_status:
|
||||||
|
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Union[Any, SellingPrivileges]]:
|
||||||
|
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,
|
||||||
|
|
||||||
|
) -> Response[Union[Any, SellingPrivileges]]:
|
||||||
|
""" This method retrieves the seller's current set of privileges, including whether or not the seller's
|
||||||
|
eBay registration has been completed, as well as the details of their site-wide <b>sellingLimit</b>
|
||||||
|
(the amount and quantity they can sell on a given day).
|
||||||
|
|
||||||
|
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[Union[Any, SellingPrivileges]]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
def sync(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
|
||||||
|
) -> Optional[Union[Any, SellingPrivileges]]:
|
||||||
|
""" This method retrieves the seller's current set of privileges, including whether or not the seller's
|
||||||
|
eBay registration has been completed, as well as the details of their site-wide <b>sellingLimit</b>
|
||||||
|
(the amount and quantity they can sell on a given day).
|
||||||
|
|
||||||
|
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:
|
||||||
|
Union[Any, SellingPrivileges]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
client=client,
|
||||||
|
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
|
||||||
|
) -> Response[Union[Any, SellingPrivileges]]:
|
||||||
|
""" This method retrieves the seller's current set of privileges, including whether or not the seller's
|
||||||
|
eBay registration has been completed, as well as the details of their site-wide <b>sellingLimit</b>
|
||||||
|
(the amount and quantity they can sell on a given day).
|
||||||
|
|
||||||
|
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[Union[Any, SellingPrivileges]]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
response = await client.get_async_httpx_client().request(
|
||||||
|
**kwargs
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
async def asyncio(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
|
||||||
|
) -> Optional[Union[Any, SellingPrivileges]]:
|
||||||
|
""" This method retrieves the seller's current set of privileges, including whether or not the seller's
|
||||||
|
eBay registration has been completed, as well as the details of their site-wide <b>sellingLimit</b>
|
||||||
|
(the amount and quantity they can sell on a given day).
|
||||||
|
|
||||||
|
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:
|
||||||
|
Union[Any, SellingPrivileges]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
return (await asyncio_detailed(
|
||||||
|
client=client,
|
||||||
|
|
||||||
|
)).parsed
|
||||||
1
ebay_client/generated/account/api/program/__init__.py
Normal file
1
ebay_client/generated/account/api/program/__init__.py
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
""" Contains endpoint functions for accessing the API """
|
||||||
|
|
@ -0,0 +1,156 @@
|
||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any, Optional, Union, cast
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...types import Response, UNSET
|
||||||
|
from ... import errors
|
||||||
|
|
||||||
|
from ...models.programs import Programs
|
||||||
|
from typing import cast
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "get",
|
||||||
|
"url": "/program/get_opted_in_programs",
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Union[Any, Programs]]:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = Programs.from_dict(response.json())
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return response_200
|
||||||
|
if response.status_code == 400:
|
||||||
|
response_400 = cast(Any, None)
|
||||||
|
return response_400
|
||||||
|
if response.status_code == 500:
|
||||||
|
response_500 = cast(Any, None)
|
||||||
|
return response_500
|
||||||
|
if response.status_code == 404:
|
||||||
|
response_404 = cast(Any, None)
|
||||||
|
return response_404
|
||||||
|
if client.raise_on_unexpected_status:
|
||||||
|
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Union[Any, Programs]]:
|
||||||
|
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,
|
||||||
|
|
||||||
|
) -> Response[Union[Any, Programs]]:
|
||||||
|
""" This method gets a list of the seller programs that the seller has opted-in to.
|
||||||
|
|
||||||
|
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[Union[Any, Programs]]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
def sync(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
|
||||||
|
) -> Optional[Union[Any, Programs]]:
|
||||||
|
""" This method gets a list of the seller programs that the seller has opted-in to.
|
||||||
|
|
||||||
|
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:
|
||||||
|
Union[Any, Programs]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
client=client,
|
||||||
|
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
|
||||||
|
) -> Response[Union[Any, Programs]]:
|
||||||
|
""" This method gets a list of the seller programs that the seller has opted-in to.
|
||||||
|
|
||||||
|
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[Union[Any, Programs]]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
response = await client.get_async_httpx_client().request(
|
||||||
|
**kwargs
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
async def asyncio(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
|
||||||
|
) -> Optional[Union[Any, Programs]]:
|
||||||
|
""" This method gets a list of the seller programs that the seller has opted-in to.
|
||||||
|
|
||||||
|
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:
|
||||||
|
Union[Any, Programs]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
return (await asyncio_detailed(
|
||||||
|
client=client,
|
||||||
|
|
||||||
|
)).parsed
|
||||||
231
ebay_client/generated/account/api/program/opt_in_to_program.py
Normal file
231
ebay_client/generated/account/api/program/opt_in_to_program.py
Normal file
|
|
@ -0,0 +1,231 @@
|
||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any, Optional, Union, cast
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...types import Response, UNSET
|
||||||
|
from ... import errors
|
||||||
|
|
||||||
|
from ...models.opt_in_to_program_response_200 import OptInToProgramResponse200
|
||||||
|
from ...models.program import Program
|
||||||
|
from typing import cast
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
*,
|
||||||
|
body: Program,
|
||||||
|
content_type: str,
|
||||||
|
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
headers: dict[str, Any] = {}
|
||||||
|
headers["Content-Type"] = content_type
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "post",
|
||||||
|
"url": "/program/opt_in",
|
||||||
|
}
|
||||||
|
|
||||||
|
_kwargs["json"] = body.to_dict()
|
||||||
|
|
||||||
|
|
||||||
|
headers["Content-Type"] = "application/json"
|
||||||
|
|
||||||
|
_kwargs["headers"] = headers
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Union[Any, OptInToProgramResponse200]]:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = OptInToProgramResponse200.from_dict(response.json())
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return response_200
|
||||||
|
if response.status_code == 400:
|
||||||
|
response_400 = cast(Any, None)
|
||||||
|
return response_400
|
||||||
|
if response.status_code == 500:
|
||||||
|
response_500 = cast(Any, None)
|
||||||
|
return response_500
|
||||||
|
if response.status_code == 404:
|
||||||
|
response_404 = cast(Any, None)
|
||||||
|
return response_404
|
||||||
|
if response.status_code == 409:
|
||||||
|
response_409 = cast(Any, None)
|
||||||
|
return response_409
|
||||||
|
if client.raise_on_unexpected_status:
|
||||||
|
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Union[Any, OptInToProgramResponse200]]:
|
||||||
|
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,
|
||||||
|
body: Program,
|
||||||
|
content_type: str,
|
||||||
|
|
||||||
|
) -> Response[Union[Any, OptInToProgramResponse200]]:
|
||||||
|
r""" This method opts the seller in to an eBay seller program. Refer to the <a href=\"/api-
|
||||||
|
docs/sell/account/overview.html#opt-in\" target=\"_blank\">Account API overview</a> for information
|
||||||
|
about available eBay seller programs.<br><br><span class=\"tablenote\"><b>Note:</b> It can take up
|
||||||
|
to 24-hours for eBay to process your request to opt-in to a Seller Program. Use the <a href=\"/api-
|
||||||
|
docs/sell/account/resources/program/methods/getOptedInPrograms\"
|
||||||
|
target=\"_blank\">getOptedInPrograms</a> call to check the status of your request after the
|
||||||
|
processing period has passed.</span>
|
||||||
|
|
||||||
|
Args:
|
||||||
|
content_type (str):
|
||||||
|
body (Program): The seller program to opt in to when part of an <b>optInToProgram</b>
|
||||||
|
request, or out of when part of an <b>optOutOfProgram</b> request.
|
||||||
|
|
||||||
|
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[Union[Any, OptInToProgramResponse200]]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
body=body,
|
||||||
|
content_type=content_type,
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
def sync(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
body: Program,
|
||||||
|
content_type: str,
|
||||||
|
|
||||||
|
) -> Optional[Union[Any, OptInToProgramResponse200]]:
|
||||||
|
r""" This method opts the seller in to an eBay seller program. Refer to the <a href=\"/api-
|
||||||
|
docs/sell/account/overview.html#opt-in\" target=\"_blank\">Account API overview</a> for information
|
||||||
|
about available eBay seller programs.<br><br><span class=\"tablenote\"><b>Note:</b> It can take up
|
||||||
|
to 24-hours for eBay to process your request to opt-in to a Seller Program. Use the <a href=\"/api-
|
||||||
|
docs/sell/account/resources/program/methods/getOptedInPrograms\"
|
||||||
|
target=\"_blank\">getOptedInPrograms</a> call to check the status of your request after the
|
||||||
|
processing period has passed.</span>
|
||||||
|
|
||||||
|
Args:
|
||||||
|
content_type (str):
|
||||||
|
body (Program): The seller program to opt in to when part of an <b>optInToProgram</b>
|
||||||
|
request, or out of when part of an <b>optOutOfProgram</b> request.
|
||||||
|
|
||||||
|
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:
|
||||||
|
Union[Any, OptInToProgramResponse200]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
client=client,
|
||||||
|
body=body,
|
||||||
|
content_type=content_type,
|
||||||
|
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
body: Program,
|
||||||
|
content_type: str,
|
||||||
|
|
||||||
|
) -> Response[Union[Any, OptInToProgramResponse200]]:
|
||||||
|
r""" This method opts the seller in to an eBay seller program. Refer to the <a href=\"/api-
|
||||||
|
docs/sell/account/overview.html#opt-in\" target=\"_blank\">Account API overview</a> for information
|
||||||
|
about available eBay seller programs.<br><br><span class=\"tablenote\"><b>Note:</b> It can take up
|
||||||
|
to 24-hours for eBay to process your request to opt-in to a Seller Program. Use the <a href=\"/api-
|
||||||
|
docs/sell/account/resources/program/methods/getOptedInPrograms\"
|
||||||
|
target=\"_blank\">getOptedInPrograms</a> call to check the status of your request after the
|
||||||
|
processing period has passed.</span>
|
||||||
|
|
||||||
|
Args:
|
||||||
|
content_type (str):
|
||||||
|
body (Program): The seller program to opt in to when part of an <b>optInToProgram</b>
|
||||||
|
request, or out of when part of an <b>optOutOfProgram</b> request.
|
||||||
|
|
||||||
|
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[Union[Any, OptInToProgramResponse200]]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
body=body,
|
||||||
|
content_type=content_type,
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
response = await client.get_async_httpx_client().request(
|
||||||
|
**kwargs
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
async def asyncio(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
body: Program,
|
||||||
|
content_type: str,
|
||||||
|
|
||||||
|
) -> Optional[Union[Any, OptInToProgramResponse200]]:
|
||||||
|
r""" This method opts the seller in to an eBay seller program. Refer to the <a href=\"/api-
|
||||||
|
docs/sell/account/overview.html#opt-in\" target=\"_blank\">Account API overview</a> for information
|
||||||
|
about available eBay seller programs.<br><br><span class=\"tablenote\"><b>Note:</b> It can take up
|
||||||
|
to 24-hours for eBay to process your request to opt-in to a Seller Program. Use the <a href=\"/api-
|
||||||
|
docs/sell/account/resources/program/methods/getOptedInPrograms\"
|
||||||
|
target=\"_blank\">getOptedInPrograms</a> call to check the status of your request after the
|
||||||
|
processing period has passed.</span>
|
||||||
|
|
||||||
|
Args:
|
||||||
|
content_type (str):
|
||||||
|
body (Program): The seller program to opt in to when part of an <b>optInToProgram</b>
|
||||||
|
request, or out of when part of an <b>optOutOfProgram</b> request.
|
||||||
|
|
||||||
|
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:
|
||||||
|
Union[Any, OptInToProgramResponse200]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
return (await asyncio_detailed(
|
||||||
|
client=client,
|
||||||
|
body=body,
|
||||||
|
content_type=content_type,
|
||||||
|
|
||||||
|
)).parsed
|
||||||
215
ebay_client/generated/account/api/program/opt_out_of_program.py
Normal file
215
ebay_client/generated/account/api/program/opt_out_of_program.py
Normal file
|
|
@ -0,0 +1,215 @@
|
||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any, Optional, Union, cast
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...types import Response, UNSET
|
||||||
|
from ... import errors
|
||||||
|
|
||||||
|
from ...models.opt_out_of_program_response_200 import OptOutOfProgramResponse200
|
||||||
|
from ...models.program import Program
|
||||||
|
from typing import cast
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
*,
|
||||||
|
body: Program,
|
||||||
|
content_type: str,
|
||||||
|
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
headers: dict[str, Any] = {}
|
||||||
|
headers["Content-Type"] = content_type
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "post",
|
||||||
|
"url": "/program/opt_out",
|
||||||
|
}
|
||||||
|
|
||||||
|
_kwargs["json"] = body.to_dict()
|
||||||
|
|
||||||
|
|
||||||
|
headers["Content-Type"] = "application/json"
|
||||||
|
|
||||||
|
_kwargs["headers"] = headers
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Union[Any, OptOutOfProgramResponse200]]:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = OptOutOfProgramResponse200.from_dict(response.json())
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return response_200
|
||||||
|
if response.status_code == 400:
|
||||||
|
response_400 = cast(Any, None)
|
||||||
|
return response_400
|
||||||
|
if response.status_code == 500:
|
||||||
|
response_500 = cast(Any, None)
|
||||||
|
return response_500
|
||||||
|
if response.status_code == 404:
|
||||||
|
response_404 = cast(Any, None)
|
||||||
|
return response_404
|
||||||
|
if response.status_code == 409:
|
||||||
|
response_409 = cast(Any, None)
|
||||||
|
return response_409
|
||||||
|
if client.raise_on_unexpected_status:
|
||||||
|
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Union[Any, OptOutOfProgramResponse200]]:
|
||||||
|
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,
|
||||||
|
body: Program,
|
||||||
|
content_type: str,
|
||||||
|
|
||||||
|
) -> Response[Union[Any, OptOutOfProgramResponse200]]:
|
||||||
|
""" This method opts the seller out of a seller program in which they are currently opted in to. A
|
||||||
|
seller can retrieve a list of the seller programs they are opted-in to using the
|
||||||
|
<b>getOptedInPrograms</b> method.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
content_type (str):
|
||||||
|
body (Program): The seller program to opt in to when part of an <b>optInToProgram</b>
|
||||||
|
request, or out of when part of an <b>optOutOfProgram</b> request.
|
||||||
|
|
||||||
|
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[Union[Any, OptOutOfProgramResponse200]]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
body=body,
|
||||||
|
content_type=content_type,
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
def sync(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
body: Program,
|
||||||
|
content_type: str,
|
||||||
|
|
||||||
|
) -> Optional[Union[Any, OptOutOfProgramResponse200]]:
|
||||||
|
""" This method opts the seller out of a seller program in which they are currently opted in to. A
|
||||||
|
seller can retrieve a list of the seller programs they are opted-in to using the
|
||||||
|
<b>getOptedInPrograms</b> method.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
content_type (str):
|
||||||
|
body (Program): The seller program to opt in to when part of an <b>optInToProgram</b>
|
||||||
|
request, or out of when part of an <b>optOutOfProgram</b> request.
|
||||||
|
|
||||||
|
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:
|
||||||
|
Union[Any, OptOutOfProgramResponse200]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
client=client,
|
||||||
|
body=body,
|
||||||
|
content_type=content_type,
|
||||||
|
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
body: Program,
|
||||||
|
content_type: str,
|
||||||
|
|
||||||
|
) -> Response[Union[Any, OptOutOfProgramResponse200]]:
|
||||||
|
""" This method opts the seller out of a seller program in which they are currently opted in to. A
|
||||||
|
seller can retrieve a list of the seller programs they are opted-in to using the
|
||||||
|
<b>getOptedInPrograms</b> method.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
content_type (str):
|
||||||
|
body (Program): The seller program to opt in to when part of an <b>optInToProgram</b>
|
||||||
|
request, or out of when part of an <b>optOutOfProgram</b> request.
|
||||||
|
|
||||||
|
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[Union[Any, OptOutOfProgramResponse200]]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
body=body,
|
||||||
|
content_type=content_type,
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
response = await client.get_async_httpx_client().request(
|
||||||
|
**kwargs
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
async def asyncio(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
body: Program,
|
||||||
|
content_type: str,
|
||||||
|
|
||||||
|
) -> Optional[Union[Any, OptOutOfProgramResponse200]]:
|
||||||
|
""" This method opts the seller out of a seller program in which they are currently opted in to. A
|
||||||
|
seller can retrieve a list of the seller programs they are opted-in to using the
|
||||||
|
<b>getOptedInPrograms</b> method.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
content_type (str):
|
||||||
|
body (Program): The seller program to opt in to when part of an <b>optInToProgram</b>
|
||||||
|
request, or out of when part of an <b>optOutOfProgram</b> request.
|
||||||
|
|
||||||
|
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:
|
||||||
|
Union[Any, OptOutOfProgramResponse200]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
return (await asyncio_detailed(
|
||||||
|
client=client,
|
||||||
|
body=body,
|
||||||
|
content_type=content_type,
|
||||||
|
|
||||||
|
)).parsed
|
||||||
1
ebay_client/generated/account/api/rate_table/__init__.py
Normal file
1
ebay_client/generated/account/api/rate_table/__init__.py
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
""" Contains endpoint functions for accessing the API """
|
||||||
240
ebay_client/generated/account/api/rate_table/get_rate_tables.py
Normal file
240
ebay_client/generated/account/api/rate_table/get_rate_tables.py
Normal file
|
|
@ -0,0 +1,240 @@
|
||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any, Optional, Union, cast
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...types import Response, UNSET
|
||||||
|
from ... import errors
|
||||||
|
|
||||||
|
from ...models.rate_table_response import RateTableResponse
|
||||||
|
from ...types import UNSET, Unset
|
||||||
|
from typing import cast
|
||||||
|
from typing import Union
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
*,
|
||||||
|
country_code: Union[Unset, str] = UNSET,
|
||||||
|
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
params: dict[str, Any] = {}
|
||||||
|
|
||||||
|
params["country_code"] = country_code
|
||||||
|
|
||||||
|
|
||||||
|
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": "/rate_table",
|
||||||
|
"params": params,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Union[Any, RateTableResponse]]:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = RateTableResponse.from_dict(response.json())
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return response_200
|
||||||
|
if response.status_code == 400:
|
||||||
|
response_400 = cast(Any, None)
|
||||||
|
return response_400
|
||||||
|
if response.status_code == 500:
|
||||||
|
response_500 = cast(Any, None)
|
||||||
|
return response_500
|
||||||
|
if client.raise_on_unexpected_status:
|
||||||
|
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Union[Any, RateTableResponse]]:
|
||||||
|
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,
|
||||||
|
country_code: Union[Unset, str] = UNSET,
|
||||||
|
|
||||||
|
) -> Response[Union[Any, RateTableResponse]]:
|
||||||
|
r""" This method retrieves a seller's <i>shipping rate tables</i> for the country specified in the
|
||||||
|
<b>country_code</b> query parameter. If you call this method without specifying a country code, the
|
||||||
|
call returns all of the seller's shipping rate tables. <br><br>The method's response includes a
|
||||||
|
<b>rateTableId</b> for each table defined by the seller. This <b>rateTableId</b> value is used in
|
||||||
|
add/revise item call or in create/update fulfillment business policy call to specify the shipping
|
||||||
|
rate table to use for that policy's domestic or international shipping options. <br><br>This call
|
||||||
|
currently supports getting rate tables related to the following marketplaces: United States, Canada,
|
||||||
|
United Kingdom, Germany, Australia, France, Italy, and Spain. <span
|
||||||
|
class=\"tablenote\"><b>Note:</b> Rate tables created with the Trading API might not have been
|
||||||
|
assigned a <b>rateTableId</b> at the time of their creation. This method can assign and return
|
||||||
|
<b>rateTableId</b> values for rate tables with missing IDs if you make a request using the
|
||||||
|
<b>country_code</b> where the seller has defined rate tables.</span> <br><br>Sellers can define up
|
||||||
|
to 40 shipping rate tables for their account, which lets them set up different rate tables for each
|
||||||
|
of the marketplaces they sell into. Go to <a href=\"https://www.ebay.com/ship/rt \">Shipping rate
|
||||||
|
tables</a> in <b>My eBay</b> to create and update rate tables.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
country_code (Union[Unset, 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[Union[Any, RateTableResponse]]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
country_code=country_code,
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
def sync(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
country_code: Union[Unset, str] = UNSET,
|
||||||
|
|
||||||
|
) -> Optional[Union[Any, RateTableResponse]]:
|
||||||
|
r""" This method retrieves a seller's <i>shipping rate tables</i> for the country specified in the
|
||||||
|
<b>country_code</b> query parameter. If you call this method without specifying a country code, the
|
||||||
|
call returns all of the seller's shipping rate tables. <br><br>The method's response includes a
|
||||||
|
<b>rateTableId</b> for each table defined by the seller. This <b>rateTableId</b> value is used in
|
||||||
|
add/revise item call or in create/update fulfillment business policy call to specify the shipping
|
||||||
|
rate table to use for that policy's domestic or international shipping options. <br><br>This call
|
||||||
|
currently supports getting rate tables related to the following marketplaces: United States, Canada,
|
||||||
|
United Kingdom, Germany, Australia, France, Italy, and Spain. <span
|
||||||
|
class=\"tablenote\"><b>Note:</b> Rate tables created with the Trading API might not have been
|
||||||
|
assigned a <b>rateTableId</b> at the time of their creation. This method can assign and return
|
||||||
|
<b>rateTableId</b> values for rate tables with missing IDs if you make a request using the
|
||||||
|
<b>country_code</b> where the seller has defined rate tables.</span> <br><br>Sellers can define up
|
||||||
|
to 40 shipping rate tables for their account, which lets them set up different rate tables for each
|
||||||
|
of the marketplaces they sell into. Go to <a href=\"https://www.ebay.com/ship/rt \">Shipping rate
|
||||||
|
tables</a> in <b>My eBay</b> to create and update rate tables.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
country_code (Union[Unset, 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:
|
||||||
|
Union[Any, RateTableResponse]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
client=client,
|
||||||
|
country_code=country_code,
|
||||||
|
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
country_code: Union[Unset, str] = UNSET,
|
||||||
|
|
||||||
|
) -> Response[Union[Any, RateTableResponse]]:
|
||||||
|
r""" This method retrieves a seller's <i>shipping rate tables</i> for the country specified in the
|
||||||
|
<b>country_code</b> query parameter. If you call this method without specifying a country code, the
|
||||||
|
call returns all of the seller's shipping rate tables. <br><br>The method's response includes a
|
||||||
|
<b>rateTableId</b> for each table defined by the seller. This <b>rateTableId</b> value is used in
|
||||||
|
add/revise item call or in create/update fulfillment business policy call to specify the shipping
|
||||||
|
rate table to use for that policy's domestic or international shipping options. <br><br>This call
|
||||||
|
currently supports getting rate tables related to the following marketplaces: United States, Canada,
|
||||||
|
United Kingdom, Germany, Australia, France, Italy, and Spain. <span
|
||||||
|
class=\"tablenote\"><b>Note:</b> Rate tables created with the Trading API might not have been
|
||||||
|
assigned a <b>rateTableId</b> at the time of their creation. This method can assign and return
|
||||||
|
<b>rateTableId</b> values for rate tables with missing IDs if you make a request using the
|
||||||
|
<b>country_code</b> where the seller has defined rate tables.</span> <br><br>Sellers can define up
|
||||||
|
to 40 shipping rate tables for their account, which lets them set up different rate tables for each
|
||||||
|
of the marketplaces they sell into. Go to <a href=\"https://www.ebay.com/ship/rt \">Shipping rate
|
||||||
|
tables</a> in <b>My eBay</b> to create and update rate tables.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
country_code (Union[Unset, 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[Union[Any, RateTableResponse]]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
country_code=country_code,
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
response = await client.get_async_httpx_client().request(
|
||||||
|
**kwargs
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
async def asyncio(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
country_code: Union[Unset, str] = UNSET,
|
||||||
|
|
||||||
|
) -> Optional[Union[Any, RateTableResponse]]:
|
||||||
|
r""" This method retrieves a seller's <i>shipping rate tables</i> for the country specified in the
|
||||||
|
<b>country_code</b> query parameter. If you call this method without specifying a country code, the
|
||||||
|
call returns all of the seller's shipping rate tables. <br><br>The method's response includes a
|
||||||
|
<b>rateTableId</b> for each table defined by the seller. This <b>rateTableId</b> value is used in
|
||||||
|
add/revise item call or in create/update fulfillment business policy call to specify the shipping
|
||||||
|
rate table to use for that policy's domestic or international shipping options. <br><br>This call
|
||||||
|
currently supports getting rate tables related to the following marketplaces: United States, Canada,
|
||||||
|
United Kingdom, Germany, Australia, France, Italy, and Spain. <span
|
||||||
|
class=\"tablenote\"><b>Note:</b> Rate tables created with the Trading API might not have been
|
||||||
|
assigned a <b>rateTableId</b> at the time of their creation. This method can assign and return
|
||||||
|
<b>rateTableId</b> values for rate tables with missing IDs if you make a request using the
|
||||||
|
<b>country_code</b> where the seller has defined rate tables.</span> <br><br>Sellers can define up
|
||||||
|
to 40 shipping rate tables for their account, which lets them set up different rate tables for each
|
||||||
|
of the marketplaces they sell into. Go to <a href=\"https://www.ebay.com/ship/rt \">Shipping rate
|
||||||
|
tables</a> in <b>My eBay</b> to create and update rate tables.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
country_code (Union[Unset, 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:
|
||||||
|
Union[Any, RateTableResponse]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
return (await asyncio_detailed(
|
||||||
|
client=client,
|
||||||
|
country_code=country_code,
|
||||||
|
|
||||||
|
)).parsed
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
""" Contains endpoint functions for accessing the API """
|
||||||
|
|
@ -0,0 +1,233 @@
|
||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any, Optional, Union, cast
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...types import Response, UNSET
|
||||||
|
from ... import errors
|
||||||
|
|
||||||
|
from ...models.return_policy_request import ReturnPolicyRequest
|
||||||
|
from ...models.set_return_policy_response import SetReturnPolicyResponse
|
||||||
|
from typing import cast
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
*,
|
||||||
|
body: ReturnPolicyRequest,
|
||||||
|
content_type: str,
|
||||||
|
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
headers: dict[str, Any] = {}
|
||||||
|
headers["Content-Type"] = content_type
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "post",
|
||||||
|
"url": "/return_policy",
|
||||||
|
}
|
||||||
|
|
||||||
|
_kwargs["json"] = body.to_dict()
|
||||||
|
|
||||||
|
|
||||||
|
headers["Content-Type"] = "application/json"
|
||||||
|
|
||||||
|
_kwargs["headers"] = headers
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Union[Any, SetReturnPolicyResponse]]:
|
||||||
|
if response.status_code == 201:
|
||||||
|
response_201 = SetReturnPolicyResponse.from_dict(response.json())
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return response_201
|
||||||
|
if response.status_code == 400:
|
||||||
|
response_400 = cast(Any, None)
|
||||||
|
return response_400
|
||||||
|
if response.status_code == 500:
|
||||||
|
response_500 = cast(Any, None)
|
||||||
|
return response_500
|
||||||
|
if client.raise_on_unexpected_status:
|
||||||
|
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Union[Any, SetReturnPolicyResponse]]:
|
||||||
|
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,
|
||||||
|
body: ReturnPolicyRequest,
|
||||||
|
content_type: str,
|
||||||
|
|
||||||
|
) -> Response[Union[Any, SetReturnPolicyResponse]]:
|
||||||
|
r""" This method creates a new return policy where the policy encapsulates seller's terms for returning
|
||||||
|
items. <br><br>Each policy targets a specific marketplace, and you can create multiple policies for
|
||||||
|
each marketplace. Return policies are not applicable to motor-vehicle listings.<br><br>A successful
|
||||||
|
request returns the <b>getReturnPolicy</b> URI to the new policy in the <b>Location</b> response
|
||||||
|
header and the ID for the new policy is returned in the response payload. <p
|
||||||
|
class=\"tablenote\"><b>Tip:</b> For details on creating and using the business policies supported by
|
||||||
|
the Account API, see <a href=\"/api-docs/sell/static/seller-accounts/business-policies.html\">eBay
|
||||||
|
business policies</a>.</p>
|
||||||
|
|
||||||
|
Args:
|
||||||
|
content_type (str):
|
||||||
|
body (ReturnPolicyRequest): This root container defines a seller's return business policy
|
||||||
|
for a specific marketplace and category group. This type is used when creating or updating
|
||||||
|
a return business policy.
|
||||||
|
|
||||||
|
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[Union[Any, SetReturnPolicyResponse]]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
body=body,
|
||||||
|
content_type=content_type,
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
def sync(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
body: ReturnPolicyRequest,
|
||||||
|
content_type: str,
|
||||||
|
|
||||||
|
) -> Optional[Union[Any, SetReturnPolicyResponse]]:
|
||||||
|
r""" This method creates a new return policy where the policy encapsulates seller's terms for returning
|
||||||
|
items. <br><br>Each policy targets a specific marketplace, and you can create multiple policies for
|
||||||
|
each marketplace. Return policies are not applicable to motor-vehicle listings.<br><br>A successful
|
||||||
|
request returns the <b>getReturnPolicy</b> URI to the new policy in the <b>Location</b> response
|
||||||
|
header and the ID for the new policy is returned in the response payload. <p
|
||||||
|
class=\"tablenote\"><b>Tip:</b> For details on creating and using the business policies supported by
|
||||||
|
the Account API, see <a href=\"/api-docs/sell/static/seller-accounts/business-policies.html\">eBay
|
||||||
|
business policies</a>.</p>
|
||||||
|
|
||||||
|
Args:
|
||||||
|
content_type (str):
|
||||||
|
body (ReturnPolicyRequest): This root container defines a seller's return business policy
|
||||||
|
for a specific marketplace and category group. This type is used when creating or updating
|
||||||
|
a return business policy.
|
||||||
|
|
||||||
|
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:
|
||||||
|
Union[Any, SetReturnPolicyResponse]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
client=client,
|
||||||
|
body=body,
|
||||||
|
content_type=content_type,
|
||||||
|
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
body: ReturnPolicyRequest,
|
||||||
|
content_type: str,
|
||||||
|
|
||||||
|
) -> Response[Union[Any, SetReturnPolicyResponse]]:
|
||||||
|
r""" This method creates a new return policy where the policy encapsulates seller's terms for returning
|
||||||
|
items. <br><br>Each policy targets a specific marketplace, and you can create multiple policies for
|
||||||
|
each marketplace. Return policies are not applicable to motor-vehicle listings.<br><br>A successful
|
||||||
|
request returns the <b>getReturnPolicy</b> URI to the new policy in the <b>Location</b> response
|
||||||
|
header and the ID for the new policy is returned in the response payload. <p
|
||||||
|
class=\"tablenote\"><b>Tip:</b> For details on creating and using the business policies supported by
|
||||||
|
the Account API, see <a href=\"/api-docs/sell/static/seller-accounts/business-policies.html\">eBay
|
||||||
|
business policies</a>.</p>
|
||||||
|
|
||||||
|
Args:
|
||||||
|
content_type (str):
|
||||||
|
body (ReturnPolicyRequest): This root container defines a seller's return business policy
|
||||||
|
for a specific marketplace and category group. This type is used when creating or updating
|
||||||
|
a return business policy.
|
||||||
|
|
||||||
|
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[Union[Any, SetReturnPolicyResponse]]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
body=body,
|
||||||
|
content_type=content_type,
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
response = await client.get_async_httpx_client().request(
|
||||||
|
**kwargs
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
async def asyncio(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
body: ReturnPolicyRequest,
|
||||||
|
content_type: str,
|
||||||
|
|
||||||
|
) -> Optional[Union[Any, SetReturnPolicyResponse]]:
|
||||||
|
r""" This method creates a new return policy where the policy encapsulates seller's terms for returning
|
||||||
|
items. <br><br>Each policy targets a specific marketplace, and you can create multiple policies for
|
||||||
|
each marketplace. Return policies are not applicable to motor-vehicle listings.<br><br>A successful
|
||||||
|
request returns the <b>getReturnPolicy</b> URI to the new policy in the <b>Location</b> response
|
||||||
|
header and the ID for the new policy is returned in the response payload. <p
|
||||||
|
class=\"tablenote\"><b>Tip:</b> For details on creating and using the business policies supported by
|
||||||
|
the Account API, see <a href=\"/api-docs/sell/static/seller-accounts/business-policies.html\">eBay
|
||||||
|
business policies</a>.</p>
|
||||||
|
|
||||||
|
Args:
|
||||||
|
content_type (str):
|
||||||
|
body (ReturnPolicyRequest): This root container defines a seller's return business policy
|
||||||
|
for a specific marketplace and category group. This type is used when creating or updating
|
||||||
|
a return business policy.
|
||||||
|
|
||||||
|
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:
|
||||||
|
Union[Any, SetReturnPolicyResponse]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
return (await asyncio_detailed(
|
||||||
|
client=client,
|
||||||
|
body=body,
|
||||||
|
content_type=content_type,
|
||||||
|
|
||||||
|
)).parsed
|
||||||
|
|
@ -0,0 +1,122 @@
|
||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any, Optional, Union, cast
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...types import Response, UNSET
|
||||||
|
from ... import errors
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
return_policy_id: str,
|
||||||
|
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "delete",
|
||||||
|
"url": "/return_policy/{return_policy_id}".format(return_policy_id=return_policy_id,),
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
|
||||||
|
if response.status_code == 400:
|
||||||
|
return None
|
||||||
|
if response.status_code == 500:
|
||||||
|
return None
|
||||||
|
if response.status_code == 204:
|
||||||
|
return None
|
||||||
|
if response.status_code == 404:
|
||||||
|
return None
|
||||||
|
if response.status_code == 409:
|
||||||
|
return None
|
||||||
|
if client.raise_on_unexpected_status:
|
||||||
|
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
|
||||||
|
return Response(
|
||||||
|
status_code=HTTPStatus(response.status_code),
|
||||||
|
content=response.content,
|
||||||
|
headers=response.headers,
|
||||||
|
parsed=_parse_response(client=client, response=response),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def sync_detailed(
|
||||||
|
return_policy_id: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
|
||||||
|
) -> Response[Any]:
|
||||||
|
""" This method deletes a return policy. Supply the ID of the policy you want to delete in the
|
||||||
|
<b>returnPolicyId</b> path parameter.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
return_policy_id (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[Any]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
return_policy_id=return_policy_id,
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
return_policy_id: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
|
||||||
|
) -> Response[Any]:
|
||||||
|
""" This method deletes a return policy. Supply the ID of the policy you want to delete in the
|
||||||
|
<b>returnPolicyId</b> path parameter.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
return_policy_id (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[Any]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
return_policy_id=return_policy_id,
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
response = await client.get_async_httpx_client().request(
|
||||||
|
**kwargs
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
@ -0,0 +1,206 @@
|
||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any, Optional, Union, cast
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...types import Response, UNSET
|
||||||
|
from ... import errors
|
||||||
|
|
||||||
|
from ...models.return_policy_response import ReturnPolicyResponse
|
||||||
|
from ...types import UNSET, Unset
|
||||||
|
from typing import cast
|
||||||
|
from typing import Union
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
*,
|
||||||
|
marketplace_id: str,
|
||||||
|
content_language: Union[Unset, str] = UNSET,
|
||||||
|
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
headers: dict[str, Any] = {}
|
||||||
|
if not isinstance(content_language, Unset):
|
||||||
|
headers["Content-Language"] = content_language
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
params: dict[str, Any] = {}
|
||||||
|
|
||||||
|
params["marketplace_id"] = marketplace_id
|
||||||
|
|
||||||
|
|
||||||
|
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": "/return_policy",
|
||||||
|
"params": params,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
_kwargs["headers"] = headers
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Union[Any, ReturnPolicyResponse]]:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = ReturnPolicyResponse.from_dict(response.json())
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return response_200
|
||||||
|
if response.status_code == 400:
|
||||||
|
response_400 = cast(Any, None)
|
||||||
|
return response_400
|
||||||
|
if response.status_code == 500:
|
||||||
|
response_500 = cast(Any, None)
|
||||||
|
return response_500
|
||||||
|
if client.raise_on_unexpected_status:
|
||||||
|
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Union[Any, ReturnPolicyResponse]]:
|
||||||
|
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,
|
||||||
|
marketplace_id: str,
|
||||||
|
content_language: Union[Unset, str] = UNSET,
|
||||||
|
|
||||||
|
) -> Response[Union[Any, ReturnPolicyResponse]]:
|
||||||
|
""" This method retrieves all the return policies configured for the marketplace you specify using the
|
||||||
|
<code>marketplace_id</code> query parameter.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
marketplace_id (str):
|
||||||
|
content_language (Union[Unset, 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[Union[Any, ReturnPolicyResponse]]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
marketplace_id=marketplace_id,
|
||||||
|
content_language=content_language,
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
def sync(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
marketplace_id: str,
|
||||||
|
content_language: Union[Unset, str] = UNSET,
|
||||||
|
|
||||||
|
) -> Optional[Union[Any, ReturnPolicyResponse]]:
|
||||||
|
""" This method retrieves all the return policies configured for the marketplace you specify using the
|
||||||
|
<code>marketplace_id</code> query parameter.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
marketplace_id (str):
|
||||||
|
content_language (Union[Unset, 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:
|
||||||
|
Union[Any, ReturnPolicyResponse]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
client=client,
|
||||||
|
marketplace_id=marketplace_id,
|
||||||
|
content_language=content_language,
|
||||||
|
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
marketplace_id: str,
|
||||||
|
content_language: Union[Unset, str] = UNSET,
|
||||||
|
|
||||||
|
) -> Response[Union[Any, ReturnPolicyResponse]]:
|
||||||
|
""" This method retrieves all the return policies configured for the marketplace you specify using the
|
||||||
|
<code>marketplace_id</code> query parameter.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
marketplace_id (str):
|
||||||
|
content_language (Union[Unset, 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[Union[Any, ReturnPolicyResponse]]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
marketplace_id=marketplace_id,
|
||||||
|
content_language=content_language,
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
response = await client.get_async_httpx_client().request(
|
||||||
|
**kwargs
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
async def asyncio(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
marketplace_id: str,
|
||||||
|
content_language: Union[Unset, str] = UNSET,
|
||||||
|
|
||||||
|
) -> Optional[Union[Any, ReturnPolicyResponse]]:
|
||||||
|
""" This method retrieves all the return policies configured for the marketplace you specify using the
|
||||||
|
<code>marketplace_id</code> query parameter.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
marketplace_id (str):
|
||||||
|
content_language (Union[Unset, 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:
|
||||||
|
Union[Any, ReturnPolicyResponse]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
return (await asyncio_detailed(
|
||||||
|
client=client,
|
||||||
|
marketplace_id=marketplace_id,
|
||||||
|
content_language=content_language,
|
||||||
|
|
||||||
|
)).parsed
|
||||||
|
|
@ -0,0 +1,181 @@
|
||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any, Optional, Union, cast
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...types import Response, UNSET
|
||||||
|
from ... import errors
|
||||||
|
|
||||||
|
from ...models.return_policy import ReturnPolicy
|
||||||
|
from typing import cast
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
return_policy_id: str,
|
||||||
|
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "get",
|
||||||
|
"url": "/return_policy/{return_policy_id}".format(return_policy_id=return_policy_id,),
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Union[Any, ReturnPolicy]]:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = ReturnPolicy.from_dict(response.json())
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return response_200
|
||||||
|
if response.status_code == 400:
|
||||||
|
response_400 = cast(Any, None)
|
||||||
|
return response_400
|
||||||
|
if response.status_code == 500:
|
||||||
|
response_500 = cast(Any, None)
|
||||||
|
return response_500
|
||||||
|
if response.status_code == 404:
|
||||||
|
response_404 = cast(Any, None)
|
||||||
|
return response_404
|
||||||
|
if client.raise_on_unexpected_status:
|
||||||
|
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Union[Any, ReturnPolicy]]:
|
||||||
|
return Response(
|
||||||
|
status_code=HTTPStatus(response.status_code),
|
||||||
|
content=response.content,
|
||||||
|
headers=response.headers,
|
||||||
|
parsed=_parse_response(client=client, response=response),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def sync_detailed(
|
||||||
|
return_policy_id: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
|
||||||
|
) -> Response[Union[Any, ReturnPolicy]]:
|
||||||
|
""" This method retrieves the complete details of the return policy specified by the
|
||||||
|
<b>returnPolicyId</b> path parameter.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
return_policy_id (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[Union[Any, ReturnPolicy]]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
return_policy_id=return_policy_id,
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
def sync(
|
||||||
|
return_policy_id: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
|
||||||
|
) -> Optional[Union[Any, ReturnPolicy]]:
|
||||||
|
""" This method retrieves the complete details of the return policy specified by the
|
||||||
|
<b>returnPolicyId</b> path parameter.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
return_policy_id (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:
|
||||||
|
Union[Any, ReturnPolicy]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
return_policy_id=return_policy_id,
|
||||||
|
client=client,
|
||||||
|
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
return_policy_id: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
|
||||||
|
) -> Response[Union[Any, ReturnPolicy]]:
|
||||||
|
""" This method retrieves the complete details of the return policy specified by the
|
||||||
|
<b>returnPolicyId</b> path parameter.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
return_policy_id (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[Union[Any, ReturnPolicy]]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
return_policy_id=return_policy_id,
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
response = await client.get_async_httpx_client().request(
|
||||||
|
**kwargs
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
async def asyncio(
|
||||||
|
return_policy_id: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
|
||||||
|
) -> Optional[Union[Any, ReturnPolicy]]:
|
||||||
|
""" This method retrieves the complete details of the return policy specified by the
|
||||||
|
<b>returnPolicyId</b> path parameter.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
return_policy_id (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:
|
||||||
|
Union[Any, ReturnPolicy]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
return (await asyncio_detailed(
|
||||||
|
return_policy_id=return_policy_id,
|
||||||
|
client=client,
|
||||||
|
|
||||||
|
)).parsed
|
||||||
|
|
@ -0,0 +1,221 @@
|
||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any, Optional, Union, cast
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...types import Response, UNSET
|
||||||
|
from ... import errors
|
||||||
|
|
||||||
|
from ...models.return_policy import ReturnPolicy
|
||||||
|
from ...types import UNSET, Unset
|
||||||
|
from typing import cast
|
||||||
|
from typing import Union
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
*,
|
||||||
|
marketplace_id: str,
|
||||||
|
name: str,
|
||||||
|
content_language: Union[Unset, str] = UNSET,
|
||||||
|
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
headers: dict[str, Any] = {}
|
||||||
|
if not isinstance(content_language, Unset):
|
||||||
|
headers["Content-Language"] = content_language
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
params: dict[str, Any] = {}
|
||||||
|
|
||||||
|
params["marketplace_id"] = marketplace_id
|
||||||
|
|
||||||
|
params["name"] = name
|
||||||
|
|
||||||
|
|
||||||
|
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": "/return_policy/get_by_policy_name",
|
||||||
|
"params": params,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
_kwargs["headers"] = headers
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Union[Any, ReturnPolicy]]:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = ReturnPolicy.from_dict(response.json())
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return response_200
|
||||||
|
if response.status_code == 400:
|
||||||
|
response_400 = cast(Any, None)
|
||||||
|
return response_400
|
||||||
|
if response.status_code == 500:
|
||||||
|
response_500 = cast(Any, None)
|
||||||
|
return response_500
|
||||||
|
if client.raise_on_unexpected_status:
|
||||||
|
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Union[Any, ReturnPolicy]]:
|
||||||
|
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,
|
||||||
|
marketplace_id: str,
|
||||||
|
name: str,
|
||||||
|
content_language: Union[Unset, str] = UNSET,
|
||||||
|
|
||||||
|
) -> Response[Union[Any, ReturnPolicy]]:
|
||||||
|
""" This method retrieves the details of a specific return policy. Supply both the policy
|
||||||
|
<code>name</code> and its associated <code>marketplace_id</code> in the request query parameters.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
marketplace_id (str):
|
||||||
|
name (str):
|
||||||
|
content_language (Union[Unset, 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[Union[Any, ReturnPolicy]]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
marketplace_id=marketplace_id,
|
||||||
|
name=name,
|
||||||
|
content_language=content_language,
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
def sync(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
marketplace_id: str,
|
||||||
|
name: str,
|
||||||
|
content_language: Union[Unset, str] = UNSET,
|
||||||
|
|
||||||
|
) -> Optional[Union[Any, ReturnPolicy]]:
|
||||||
|
""" This method retrieves the details of a specific return policy. Supply both the policy
|
||||||
|
<code>name</code> and its associated <code>marketplace_id</code> in the request query parameters.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
marketplace_id (str):
|
||||||
|
name (str):
|
||||||
|
content_language (Union[Unset, 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:
|
||||||
|
Union[Any, ReturnPolicy]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
client=client,
|
||||||
|
marketplace_id=marketplace_id,
|
||||||
|
name=name,
|
||||||
|
content_language=content_language,
|
||||||
|
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
marketplace_id: str,
|
||||||
|
name: str,
|
||||||
|
content_language: Union[Unset, str] = UNSET,
|
||||||
|
|
||||||
|
) -> Response[Union[Any, ReturnPolicy]]:
|
||||||
|
""" This method retrieves the details of a specific return policy. Supply both the policy
|
||||||
|
<code>name</code> and its associated <code>marketplace_id</code> in the request query parameters.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
marketplace_id (str):
|
||||||
|
name (str):
|
||||||
|
content_language (Union[Unset, 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[Union[Any, ReturnPolicy]]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
marketplace_id=marketplace_id,
|
||||||
|
name=name,
|
||||||
|
content_language=content_language,
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
response = await client.get_async_httpx_client().request(
|
||||||
|
**kwargs
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
async def asyncio(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
marketplace_id: str,
|
||||||
|
name: str,
|
||||||
|
content_language: Union[Unset, str] = UNSET,
|
||||||
|
|
||||||
|
) -> Optional[Union[Any, ReturnPolicy]]:
|
||||||
|
""" This method retrieves the details of a specific return policy. Supply both the policy
|
||||||
|
<code>name</code> and its associated <code>marketplace_id</code> in the request query parameters.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
marketplace_id (str):
|
||||||
|
name (str):
|
||||||
|
content_language (Union[Unset, 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:
|
||||||
|
Union[Any, ReturnPolicy]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
return (await asyncio_detailed(
|
||||||
|
client=client,
|
||||||
|
marketplace_id=marketplace_id,
|
||||||
|
name=name,
|
||||||
|
content_language=content_language,
|
||||||
|
|
||||||
|
)).parsed
|
||||||
|
|
@ -0,0 +1,229 @@
|
||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any, Optional, Union, cast
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...types import Response, UNSET
|
||||||
|
from ... import errors
|
||||||
|
|
||||||
|
from ...models.return_policy_request import ReturnPolicyRequest
|
||||||
|
from ...models.set_return_policy_response import SetReturnPolicyResponse
|
||||||
|
from typing import cast
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
return_policy_id: str,
|
||||||
|
*,
|
||||||
|
body: ReturnPolicyRequest,
|
||||||
|
content_type: str,
|
||||||
|
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
headers: dict[str, Any] = {}
|
||||||
|
headers["Content-Type"] = content_type
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "put",
|
||||||
|
"url": "/return_policy/{return_policy_id}".format(return_policy_id=return_policy_id,),
|
||||||
|
}
|
||||||
|
|
||||||
|
_kwargs["json"] = body.to_dict()
|
||||||
|
|
||||||
|
|
||||||
|
headers["Content-Type"] = "application/json"
|
||||||
|
|
||||||
|
_kwargs["headers"] = headers
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Union[Any, SetReturnPolicyResponse]]:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = SetReturnPolicyResponse.from_dict(response.json())
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return response_200
|
||||||
|
if response.status_code == 400:
|
||||||
|
response_400 = cast(Any, None)
|
||||||
|
return response_400
|
||||||
|
if response.status_code == 500:
|
||||||
|
response_500 = cast(Any, None)
|
||||||
|
return response_500
|
||||||
|
if response.status_code == 404:
|
||||||
|
response_404 = cast(Any, None)
|
||||||
|
return response_404
|
||||||
|
if client.raise_on_unexpected_status:
|
||||||
|
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Union[Any, SetReturnPolicyResponse]]:
|
||||||
|
return Response(
|
||||||
|
status_code=HTTPStatus(response.status_code),
|
||||||
|
content=response.content,
|
||||||
|
headers=response.headers,
|
||||||
|
parsed=_parse_response(client=client, response=response),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def sync_detailed(
|
||||||
|
return_policy_id: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
body: ReturnPolicyRequest,
|
||||||
|
content_type: str,
|
||||||
|
|
||||||
|
) -> Response[Union[Any, SetReturnPolicyResponse]]:
|
||||||
|
""" This method updates an existing return policy. Specify the policy you want to update using the
|
||||||
|
<b>return_policy_id</b> path parameter. Supply a complete policy payload with the updates you want
|
||||||
|
to make; this call overwrites the existing policy with the new details specified in the payload.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
return_policy_id (str):
|
||||||
|
content_type (str):
|
||||||
|
body (ReturnPolicyRequest): This root container defines a seller's return business policy
|
||||||
|
for a specific marketplace and category group. This type is used when creating or updating
|
||||||
|
a return business policy.
|
||||||
|
|
||||||
|
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[Union[Any, SetReturnPolicyResponse]]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
return_policy_id=return_policy_id,
|
||||||
|
body=body,
|
||||||
|
content_type=content_type,
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
def sync(
|
||||||
|
return_policy_id: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
body: ReturnPolicyRequest,
|
||||||
|
content_type: str,
|
||||||
|
|
||||||
|
) -> Optional[Union[Any, SetReturnPolicyResponse]]:
|
||||||
|
""" This method updates an existing return policy. Specify the policy you want to update using the
|
||||||
|
<b>return_policy_id</b> path parameter. Supply a complete policy payload with the updates you want
|
||||||
|
to make; this call overwrites the existing policy with the new details specified in the payload.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
return_policy_id (str):
|
||||||
|
content_type (str):
|
||||||
|
body (ReturnPolicyRequest): This root container defines a seller's return business policy
|
||||||
|
for a specific marketplace and category group. This type is used when creating or updating
|
||||||
|
a return business policy.
|
||||||
|
|
||||||
|
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:
|
||||||
|
Union[Any, SetReturnPolicyResponse]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
return_policy_id=return_policy_id,
|
||||||
|
client=client,
|
||||||
|
body=body,
|
||||||
|
content_type=content_type,
|
||||||
|
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
return_policy_id: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
body: ReturnPolicyRequest,
|
||||||
|
content_type: str,
|
||||||
|
|
||||||
|
) -> Response[Union[Any, SetReturnPolicyResponse]]:
|
||||||
|
""" This method updates an existing return policy. Specify the policy you want to update using the
|
||||||
|
<b>return_policy_id</b> path parameter. Supply a complete policy payload with the updates you want
|
||||||
|
to make; this call overwrites the existing policy with the new details specified in the payload.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
return_policy_id (str):
|
||||||
|
content_type (str):
|
||||||
|
body (ReturnPolicyRequest): This root container defines a seller's return business policy
|
||||||
|
for a specific marketplace and category group. This type is used when creating or updating
|
||||||
|
a return business policy.
|
||||||
|
|
||||||
|
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[Union[Any, SetReturnPolicyResponse]]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
return_policy_id=return_policy_id,
|
||||||
|
body=body,
|
||||||
|
content_type=content_type,
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
response = await client.get_async_httpx_client().request(
|
||||||
|
**kwargs
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
async def asyncio(
|
||||||
|
return_policy_id: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
body: ReturnPolicyRequest,
|
||||||
|
content_type: str,
|
||||||
|
|
||||||
|
) -> Optional[Union[Any, SetReturnPolicyResponse]]:
|
||||||
|
""" This method updates an existing return policy. Specify the policy you want to update using the
|
||||||
|
<b>return_policy_id</b> path parameter. Supply a complete policy payload with the updates you want
|
||||||
|
to make; this call overwrites the existing policy with the new details specified in the payload.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
return_policy_id (str):
|
||||||
|
content_type (str):
|
||||||
|
body (ReturnPolicyRequest): This root container defines a seller's return business policy
|
||||||
|
for a specific marketplace and category group. This type is used when creating or updating
|
||||||
|
a return business policy.
|
||||||
|
|
||||||
|
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:
|
||||||
|
Union[Any, SetReturnPolicyResponse]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
return (await asyncio_detailed(
|
||||||
|
return_policy_id=return_policy_id,
|
||||||
|
client=client,
|
||||||
|
body=body,
|
||||||
|
content_type=content_type,
|
||||||
|
|
||||||
|
)).parsed
|
||||||
1
ebay_client/generated/account/api/sales_tax/__init__.py
Normal file
1
ebay_client/generated/account/api/sales_tax/__init__.py
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
""" Contains endpoint functions for accessing the API """
|
||||||
|
|
@ -0,0 +1,265 @@
|
||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any, Optional, Union, cast
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...types import Response, UNSET
|
||||||
|
from ... import errors
|
||||||
|
|
||||||
|
from ...models.bulk_sales_tax_input import BulkSalesTaxInput
|
||||||
|
from ...models.updated_sales_tax_response import UpdatedSalesTaxResponse
|
||||||
|
from typing import cast
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
*,
|
||||||
|
body: BulkSalesTaxInput,
|
||||||
|
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
headers: dict[str, Any] = {}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "post",
|
||||||
|
"url": "/bulk_create_or_replace_sales_tax",
|
||||||
|
}
|
||||||
|
|
||||||
|
_kwargs["json"] = body.to_dict()
|
||||||
|
|
||||||
|
|
||||||
|
headers["Content-Type"] = "application/json"
|
||||||
|
|
||||||
|
_kwargs["headers"] = headers
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Union[Any, UpdatedSalesTaxResponse]]:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = UpdatedSalesTaxResponse.from_dict(response.json())
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return response_200
|
||||||
|
if response.status_code == 400:
|
||||||
|
response_400 = cast(Any, None)
|
||||||
|
return response_400
|
||||||
|
if response.status_code == 500:
|
||||||
|
response_500 = cast(Any, None)
|
||||||
|
return response_500
|
||||||
|
if response.status_code == 207:
|
||||||
|
response_207 = cast(Any, None)
|
||||||
|
return response_207
|
||||||
|
if client.raise_on_unexpected_status:
|
||||||
|
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Union[Any, UpdatedSalesTaxResponse]]:
|
||||||
|
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,
|
||||||
|
body: BulkSalesTaxInput,
|
||||||
|
|
||||||
|
) -> Response[Union[Any, UpdatedSalesTaxResponse]]:
|
||||||
|
r""" This method creates or updates multiple sales-tax table entries.<br><br><i>Sales-tax tables</i> can
|
||||||
|
be set up for countries that support different <i>tax jurisdictions</i>.<br><br><span
|
||||||
|
class=\"tablenote\"><b>Note:</b> Sales-tax tables are only available for the US (EBAY_US) and Canada
|
||||||
|
(EBAY_CA) marketplaces.</span><br>Each sales-tax table entry comprises the following parameters:<ul>
|
||||||
|
<li><code>countryCode</code></li><li><code>jurisdictionId</code></li><li><code>salesTaxPercentage</c
|
||||||
|
ode></li><li><code>shippingAndHandlingTaxed</code></li></ul><br>Valid jurisdiction IDs are retrieved
|
||||||
|
using <b><a href=\"/api-docs/sell/metadata/resources/country/methods/getSalesTaxJurisdictions\"
|
||||||
|
target=\"_blank\">getSalesTaxJurisdictions</a></b> in the Metadata API.<br><br>For details about
|
||||||
|
using this call, refer to <a href=\"/api-docs/sell/static/seller-accounts/tax-
|
||||||
|
tables.html\">Establishing sales-tax tables</a>.<br><br><div class=\"msgbox_important\"><p
|
||||||
|
class=\"msgbox_importantInDiv\" data-mc-autonum=\"<b><span style="color:
|
||||||
|
#dd1e31;" class="mcFormatColor">Important! </span></b>\"><span
|
||||||
|
class=\"autonumber\"><span><b><span style=\"color: #dd1e31;\"
|
||||||
|
class=\"mcFormatColor\">Important!</span></b></span></span> In the US, eBay now calculates,
|
||||||
|
collects, and remits sales tax to the proper taxing authorities in all 50 states and Washington, DC.
|
||||||
|
Sellers can no longer specify sales-tax rates for these jurisdictions using a tax
|
||||||
|
table.<br><br>However, sellers may continue to use a sales-tax table to set rates for the following
|
||||||
|
US territories:<ul><li>American Samoa (AS)</li><li>Guam (GU)</li><li>Northern Mariana Islands
|
||||||
|
(MP)</li><li>Palau (PW)</li><li>US Virgin Islands (VI)</li></ul>For additional information, refer to
|
||||||
|
<a href=\"https://www.ebay.com/help/selling/fees-credits-invoices/taxes-import-charges?id=4121 \"
|
||||||
|
target=\"_blank\">Taxes and import charges</a>.</p></div>
|
||||||
|
|
||||||
|
Args:
|
||||||
|
body (BulkSalesTaxInput):
|
||||||
|
|
||||||
|
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[Union[Any, UpdatedSalesTaxResponse]]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
body=body,
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
def sync(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
body: BulkSalesTaxInput,
|
||||||
|
|
||||||
|
) -> Optional[Union[Any, UpdatedSalesTaxResponse]]:
|
||||||
|
r""" This method creates or updates multiple sales-tax table entries.<br><br><i>Sales-tax tables</i> can
|
||||||
|
be set up for countries that support different <i>tax jurisdictions</i>.<br><br><span
|
||||||
|
class=\"tablenote\"><b>Note:</b> Sales-tax tables are only available for the US (EBAY_US) and Canada
|
||||||
|
(EBAY_CA) marketplaces.</span><br>Each sales-tax table entry comprises the following parameters:<ul>
|
||||||
|
<li><code>countryCode</code></li><li><code>jurisdictionId</code></li><li><code>salesTaxPercentage</c
|
||||||
|
ode></li><li><code>shippingAndHandlingTaxed</code></li></ul><br>Valid jurisdiction IDs are retrieved
|
||||||
|
using <b><a href=\"/api-docs/sell/metadata/resources/country/methods/getSalesTaxJurisdictions\"
|
||||||
|
target=\"_blank\">getSalesTaxJurisdictions</a></b> in the Metadata API.<br><br>For details about
|
||||||
|
using this call, refer to <a href=\"/api-docs/sell/static/seller-accounts/tax-
|
||||||
|
tables.html\">Establishing sales-tax tables</a>.<br><br><div class=\"msgbox_important\"><p
|
||||||
|
class=\"msgbox_importantInDiv\" data-mc-autonum=\"<b><span style="color:
|
||||||
|
#dd1e31;" class="mcFormatColor">Important! </span></b>\"><span
|
||||||
|
class=\"autonumber\"><span><b><span style=\"color: #dd1e31;\"
|
||||||
|
class=\"mcFormatColor\">Important!</span></b></span></span> In the US, eBay now calculates,
|
||||||
|
collects, and remits sales tax to the proper taxing authorities in all 50 states and Washington, DC.
|
||||||
|
Sellers can no longer specify sales-tax rates for these jurisdictions using a tax
|
||||||
|
table.<br><br>However, sellers may continue to use a sales-tax table to set rates for the following
|
||||||
|
US territories:<ul><li>American Samoa (AS)</li><li>Guam (GU)</li><li>Northern Mariana Islands
|
||||||
|
(MP)</li><li>Palau (PW)</li><li>US Virgin Islands (VI)</li></ul>For additional information, refer to
|
||||||
|
<a href=\"https://www.ebay.com/help/selling/fees-credits-invoices/taxes-import-charges?id=4121 \"
|
||||||
|
target=\"_blank\">Taxes and import charges</a>.</p></div>
|
||||||
|
|
||||||
|
Args:
|
||||||
|
body (BulkSalesTaxInput):
|
||||||
|
|
||||||
|
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:
|
||||||
|
Union[Any, UpdatedSalesTaxResponse]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
client=client,
|
||||||
|
body=body,
|
||||||
|
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
body: BulkSalesTaxInput,
|
||||||
|
|
||||||
|
) -> Response[Union[Any, UpdatedSalesTaxResponse]]:
|
||||||
|
r""" This method creates or updates multiple sales-tax table entries.<br><br><i>Sales-tax tables</i> can
|
||||||
|
be set up for countries that support different <i>tax jurisdictions</i>.<br><br><span
|
||||||
|
class=\"tablenote\"><b>Note:</b> Sales-tax tables are only available for the US (EBAY_US) and Canada
|
||||||
|
(EBAY_CA) marketplaces.</span><br>Each sales-tax table entry comprises the following parameters:<ul>
|
||||||
|
<li><code>countryCode</code></li><li><code>jurisdictionId</code></li><li><code>salesTaxPercentage</c
|
||||||
|
ode></li><li><code>shippingAndHandlingTaxed</code></li></ul><br>Valid jurisdiction IDs are retrieved
|
||||||
|
using <b><a href=\"/api-docs/sell/metadata/resources/country/methods/getSalesTaxJurisdictions\"
|
||||||
|
target=\"_blank\">getSalesTaxJurisdictions</a></b> in the Metadata API.<br><br>For details about
|
||||||
|
using this call, refer to <a href=\"/api-docs/sell/static/seller-accounts/tax-
|
||||||
|
tables.html\">Establishing sales-tax tables</a>.<br><br><div class=\"msgbox_important\"><p
|
||||||
|
class=\"msgbox_importantInDiv\" data-mc-autonum=\"<b><span style="color:
|
||||||
|
#dd1e31;" class="mcFormatColor">Important! </span></b>\"><span
|
||||||
|
class=\"autonumber\"><span><b><span style=\"color: #dd1e31;\"
|
||||||
|
class=\"mcFormatColor\">Important!</span></b></span></span> In the US, eBay now calculates,
|
||||||
|
collects, and remits sales tax to the proper taxing authorities in all 50 states and Washington, DC.
|
||||||
|
Sellers can no longer specify sales-tax rates for these jurisdictions using a tax
|
||||||
|
table.<br><br>However, sellers may continue to use a sales-tax table to set rates for the following
|
||||||
|
US territories:<ul><li>American Samoa (AS)</li><li>Guam (GU)</li><li>Northern Mariana Islands
|
||||||
|
(MP)</li><li>Palau (PW)</li><li>US Virgin Islands (VI)</li></ul>For additional information, refer to
|
||||||
|
<a href=\"https://www.ebay.com/help/selling/fees-credits-invoices/taxes-import-charges?id=4121 \"
|
||||||
|
target=\"_blank\">Taxes and import charges</a>.</p></div>
|
||||||
|
|
||||||
|
Args:
|
||||||
|
body (BulkSalesTaxInput):
|
||||||
|
|
||||||
|
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[Union[Any, UpdatedSalesTaxResponse]]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
body=body,
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
response = await client.get_async_httpx_client().request(
|
||||||
|
**kwargs
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
async def asyncio(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
body: BulkSalesTaxInput,
|
||||||
|
|
||||||
|
) -> Optional[Union[Any, UpdatedSalesTaxResponse]]:
|
||||||
|
r""" This method creates or updates multiple sales-tax table entries.<br><br><i>Sales-tax tables</i> can
|
||||||
|
be set up for countries that support different <i>tax jurisdictions</i>.<br><br><span
|
||||||
|
class=\"tablenote\"><b>Note:</b> Sales-tax tables are only available for the US (EBAY_US) and Canada
|
||||||
|
(EBAY_CA) marketplaces.</span><br>Each sales-tax table entry comprises the following parameters:<ul>
|
||||||
|
<li><code>countryCode</code></li><li><code>jurisdictionId</code></li><li><code>salesTaxPercentage</c
|
||||||
|
ode></li><li><code>shippingAndHandlingTaxed</code></li></ul><br>Valid jurisdiction IDs are retrieved
|
||||||
|
using <b><a href=\"/api-docs/sell/metadata/resources/country/methods/getSalesTaxJurisdictions\"
|
||||||
|
target=\"_blank\">getSalesTaxJurisdictions</a></b> in the Metadata API.<br><br>For details about
|
||||||
|
using this call, refer to <a href=\"/api-docs/sell/static/seller-accounts/tax-
|
||||||
|
tables.html\">Establishing sales-tax tables</a>.<br><br><div class=\"msgbox_important\"><p
|
||||||
|
class=\"msgbox_importantInDiv\" data-mc-autonum=\"<b><span style="color:
|
||||||
|
#dd1e31;" class="mcFormatColor">Important! </span></b>\"><span
|
||||||
|
class=\"autonumber\"><span><b><span style=\"color: #dd1e31;\"
|
||||||
|
class=\"mcFormatColor\">Important!</span></b></span></span> In the US, eBay now calculates,
|
||||||
|
collects, and remits sales tax to the proper taxing authorities in all 50 states and Washington, DC.
|
||||||
|
Sellers can no longer specify sales-tax rates for these jurisdictions using a tax
|
||||||
|
table.<br><br>However, sellers may continue to use a sales-tax table to set rates for the following
|
||||||
|
US territories:<ul><li>American Samoa (AS)</li><li>Guam (GU)</li><li>Northern Mariana Islands
|
||||||
|
(MP)</li><li>Palau (PW)</li><li>US Virgin Islands (VI)</li></ul>For additional information, refer to
|
||||||
|
<a href=\"https://www.ebay.com/help/selling/fees-credits-invoices/taxes-import-charges?id=4121 \"
|
||||||
|
target=\"_blank\">Taxes and import charges</a>.</p></div>
|
||||||
|
|
||||||
|
Args:
|
||||||
|
body (BulkSalesTaxInput):
|
||||||
|
|
||||||
|
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:
|
||||||
|
Union[Any, UpdatedSalesTaxResponse]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
return (await asyncio_detailed(
|
||||||
|
client=client,
|
||||||
|
body=body,
|
||||||
|
|
||||||
|
)).parsed
|
||||||
|
|
@ -0,0 +1,196 @@
|
||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any, Optional, Union, cast
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...types import Response, UNSET
|
||||||
|
from ... import errors
|
||||||
|
|
||||||
|
from ...models.sales_tax_base import SalesTaxBase
|
||||||
|
from typing import cast
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
country_code: str,
|
||||||
|
jurisdiction_id: str,
|
||||||
|
*,
|
||||||
|
body: SalesTaxBase,
|
||||||
|
content_type: str,
|
||||||
|
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
headers: dict[str, Any] = {}
|
||||||
|
headers["Content-Type"] = content_type
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "put",
|
||||||
|
"url": "/sales_tax/{country_code}/{jurisdiction_id}".format(country_code=country_code,jurisdiction_id=jurisdiction_id,),
|
||||||
|
}
|
||||||
|
|
||||||
|
_kwargs["json"] = body.to_dict()
|
||||||
|
|
||||||
|
|
||||||
|
headers["Content-Type"] = "application/json"
|
||||||
|
|
||||||
|
_kwargs["headers"] = headers
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
|
||||||
|
if response.status_code == 400:
|
||||||
|
return None
|
||||||
|
if response.status_code == 500:
|
||||||
|
return None
|
||||||
|
if response.status_code == 204:
|
||||||
|
return None
|
||||||
|
if response.status_code == 404:
|
||||||
|
return None
|
||||||
|
if client.raise_on_unexpected_status:
|
||||||
|
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
|
||||||
|
return Response(
|
||||||
|
status_code=HTTPStatus(response.status_code),
|
||||||
|
content=response.content,
|
||||||
|
headers=response.headers,
|
||||||
|
parsed=_parse_response(client=client, response=response),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def sync_detailed(
|
||||||
|
country_code: str,
|
||||||
|
jurisdiction_id: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
body: SalesTaxBase,
|
||||||
|
content_type: str,
|
||||||
|
|
||||||
|
) -> Response[Any]:
|
||||||
|
r""" This method creates or updates a sales-tax table entry for a jurisdiction. Specify the tax table
|
||||||
|
entry you want to configure using the two path parameters: <b>countryCode</b> and
|
||||||
|
<b>jurisdictionId</b>. <br><br>A tax table entry for a jurisdiction is comprised of two fields: one
|
||||||
|
for the jurisdiction's sales-tax rate and another that's a boolean value indicating whether or not
|
||||||
|
shipping and handling are taxed in the jurisdiction.<br><br>You can set up <i>sales-tax tables</i>
|
||||||
|
for countries that support different <i>tax jurisdictions</i>.<br><br><span
|
||||||
|
class=\"tablenote\"><b>Note:</b> Sales-tax tables are only available for the US (EBAY_US) and Canada
|
||||||
|
(EBAY_CA) marketplaces.</span><br>Retrieve valid jurisdiction IDs using <b><a href=\"/api-
|
||||||
|
docs/sell/metadata/resources/country/methods/getSalesTaxJurisdictions\"
|
||||||
|
target=\"_blank\">getSalesTaxJurisdictions</a></b> in the Metadata API.<br><br>For details about
|
||||||
|
using this call, refer to <a href=\"/api-docs/sell/static/seller-accounts/tax-
|
||||||
|
tables.html\">Establishing sales-tax tables</a>.<br><br><div class=\"msgbox_important\"><p
|
||||||
|
class=\"msgbox_importantInDiv\" data-mc-autonum=\"<b><span style="color:
|
||||||
|
#dd1e31;" class="mcFormatColor">Important! </span></b>\"><span
|
||||||
|
class=\"autonumber\"><span><b><span style=\"color: #dd1e31;\"
|
||||||
|
class=\"mcFormatColor\">Important!</span></b></span></span> In the US, eBay now calculates,
|
||||||
|
collects, and remits sales tax to the proper taxing authorities in all 50 states and Washington, DC.
|
||||||
|
Sellers can no longer specify sales-tax rates for these jurisdictions using a tax
|
||||||
|
table.<br><br>However, sellers may continue to use a sales-tax table to set rates for the following
|
||||||
|
US territories:<ul><li>American Samoa (AS)</li><li>Guam (GU)</li><li>Northern Mariana Islands
|
||||||
|
(MP)</li><li>Palau (PW)</li><li>US Virgin Islands (VI)</li></ul>For additional information, refer to
|
||||||
|
<a href=\"https://www.ebay.com/help/selling/fees-credits-invoices/taxes-import-charges?id=4121 \"
|
||||||
|
target=\"_blank\">Taxes and import charges</a>.</p></div>
|
||||||
|
|
||||||
|
Args:
|
||||||
|
country_code (str):
|
||||||
|
jurisdiction_id (str):
|
||||||
|
content_type (str):
|
||||||
|
body (SalesTaxBase): This type is used by the base request of the
|
||||||
|
<b>createOrReplaceSalesTax</b>.
|
||||||
|
|
||||||
|
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]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
country_code=country_code,
|
||||||
|
jurisdiction_id=jurisdiction_id,
|
||||||
|
body=body,
|
||||||
|
content_type=content_type,
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
country_code: str,
|
||||||
|
jurisdiction_id: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
body: SalesTaxBase,
|
||||||
|
content_type: str,
|
||||||
|
|
||||||
|
) -> Response[Any]:
|
||||||
|
r""" This method creates or updates a sales-tax table entry for a jurisdiction. Specify the tax table
|
||||||
|
entry you want to configure using the two path parameters: <b>countryCode</b> and
|
||||||
|
<b>jurisdictionId</b>. <br><br>A tax table entry for a jurisdiction is comprised of two fields: one
|
||||||
|
for the jurisdiction's sales-tax rate and another that's a boolean value indicating whether or not
|
||||||
|
shipping and handling are taxed in the jurisdiction.<br><br>You can set up <i>sales-tax tables</i>
|
||||||
|
for countries that support different <i>tax jurisdictions</i>.<br><br><span
|
||||||
|
class=\"tablenote\"><b>Note:</b> Sales-tax tables are only available for the US (EBAY_US) and Canada
|
||||||
|
(EBAY_CA) marketplaces.</span><br>Retrieve valid jurisdiction IDs using <b><a href=\"/api-
|
||||||
|
docs/sell/metadata/resources/country/methods/getSalesTaxJurisdictions\"
|
||||||
|
target=\"_blank\">getSalesTaxJurisdictions</a></b> in the Metadata API.<br><br>For details about
|
||||||
|
using this call, refer to <a href=\"/api-docs/sell/static/seller-accounts/tax-
|
||||||
|
tables.html\">Establishing sales-tax tables</a>.<br><br><div class=\"msgbox_important\"><p
|
||||||
|
class=\"msgbox_importantInDiv\" data-mc-autonum=\"<b><span style="color:
|
||||||
|
#dd1e31;" class="mcFormatColor">Important! </span></b>\"><span
|
||||||
|
class=\"autonumber\"><span><b><span style=\"color: #dd1e31;\"
|
||||||
|
class=\"mcFormatColor\">Important!</span></b></span></span> In the US, eBay now calculates,
|
||||||
|
collects, and remits sales tax to the proper taxing authorities in all 50 states and Washington, DC.
|
||||||
|
Sellers can no longer specify sales-tax rates for these jurisdictions using a tax
|
||||||
|
table.<br><br>However, sellers may continue to use a sales-tax table to set rates for the following
|
||||||
|
US territories:<ul><li>American Samoa (AS)</li><li>Guam (GU)</li><li>Northern Mariana Islands
|
||||||
|
(MP)</li><li>Palau (PW)</li><li>US Virgin Islands (VI)</li></ul>For additional information, refer to
|
||||||
|
<a href=\"https://www.ebay.com/help/selling/fees-credits-invoices/taxes-import-charges?id=4121 \"
|
||||||
|
target=\"_blank\">Taxes and import charges</a>.</p></div>
|
||||||
|
|
||||||
|
Args:
|
||||||
|
country_code (str):
|
||||||
|
jurisdiction_id (str):
|
||||||
|
content_type (str):
|
||||||
|
body (SalesTaxBase): This type is used by the base request of the
|
||||||
|
<b>createOrReplaceSalesTax</b>.
|
||||||
|
|
||||||
|
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]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
country_code=country_code,
|
||||||
|
jurisdiction_id=jurisdiction_id,
|
||||||
|
body=body,
|
||||||
|
content_type=content_type,
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
response = await client.get_async_httpx_client().request(
|
||||||
|
**kwargs
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
131
ebay_client/generated/account/api/sales_tax/delete_sales_tax.py
Normal file
131
ebay_client/generated/account/api/sales_tax/delete_sales_tax.py
Normal file
|
|
@ -0,0 +1,131 @@
|
||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any, Optional, Union, cast
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...types import Response, UNSET
|
||||||
|
from ... import errors
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
country_code: str,
|
||||||
|
jurisdiction_id: str,
|
||||||
|
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "delete",
|
||||||
|
"url": "/sales_tax/{country_code}/{jurisdiction_id}".format(country_code=country_code,jurisdiction_id=jurisdiction_id,),
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
|
||||||
|
if response.status_code == 400:
|
||||||
|
return None
|
||||||
|
if response.status_code == 500:
|
||||||
|
return None
|
||||||
|
if response.status_code == 204:
|
||||||
|
return None
|
||||||
|
if response.status_code == 404:
|
||||||
|
return None
|
||||||
|
if client.raise_on_unexpected_status:
|
||||||
|
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
|
||||||
|
return Response(
|
||||||
|
status_code=HTTPStatus(response.status_code),
|
||||||
|
content=response.content,
|
||||||
|
headers=response.headers,
|
||||||
|
parsed=_parse_response(client=client, response=response),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def sync_detailed(
|
||||||
|
country_code: str,
|
||||||
|
jurisdiction_id: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
|
||||||
|
) -> Response[Any]:
|
||||||
|
r""" This call deletes a sales-tax table entry for a jurisdiction. Specify the jurisdiction to delete
|
||||||
|
using the <b>countryCode</b> and <b>jurisdictionId</b> path parameters.<br><br><span
|
||||||
|
class=\"tablenote\"><b>Note:</b> Sales-tax tables are only available for the US (EBAY_US) and Canada
|
||||||
|
(EBAY_CA) marketplaces.</span>
|
||||||
|
|
||||||
|
Args:
|
||||||
|
country_code (str):
|
||||||
|
jurisdiction_id (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[Any]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
country_code=country_code,
|
||||||
|
jurisdiction_id=jurisdiction_id,
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
country_code: str,
|
||||||
|
jurisdiction_id: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
|
||||||
|
) -> Response[Any]:
|
||||||
|
r""" This call deletes a sales-tax table entry for a jurisdiction. Specify the jurisdiction to delete
|
||||||
|
using the <b>countryCode</b> and <b>jurisdictionId</b> path parameters.<br><br><span
|
||||||
|
class=\"tablenote\"><b>Note:</b> Sales-tax tables are only available for the US (EBAY_US) and Canada
|
||||||
|
(EBAY_CA) marketplaces.</span>
|
||||||
|
|
||||||
|
Args:
|
||||||
|
country_code (str):
|
||||||
|
jurisdiction_id (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[Any]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
country_code=country_code,
|
||||||
|
jurisdiction_id=jurisdiction_id,
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
response = await client.get_async_httpx_client().request(
|
||||||
|
**kwargs
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
257
ebay_client/generated/account/api/sales_tax/get_sales_tax.py
Normal file
257
ebay_client/generated/account/api/sales_tax/get_sales_tax.py
Normal file
|
|
@ -0,0 +1,257 @@
|
||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any, Optional, Union, cast
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...types import Response, UNSET
|
||||||
|
from ... import errors
|
||||||
|
|
||||||
|
from ...models.sales_tax import SalesTax
|
||||||
|
from typing import cast
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
country_code: str,
|
||||||
|
jurisdiction_id: str,
|
||||||
|
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
_kwargs: dict[str, Any] = {
|
||||||
|
"method": "get",
|
||||||
|
"url": "/sales_tax/{country_code}/{jurisdiction_id}".format(country_code=country_code,jurisdiction_id=jurisdiction_id,),
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Union[Any, SalesTax]]:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = SalesTax.from_dict(response.json())
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return response_200
|
||||||
|
if response.status_code == 400:
|
||||||
|
response_400 = cast(Any, None)
|
||||||
|
return response_400
|
||||||
|
if response.status_code == 500:
|
||||||
|
response_500 = cast(Any, None)
|
||||||
|
return response_500
|
||||||
|
if response.status_code == 204:
|
||||||
|
response_204 = cast(Any, None)
|
||||||
|
return response_204
|
||||||
|
if response.status_code == 404:
|
||||||
|
response_404 = cast(Any, None)
|
||||||
|
return response_404
|
||||||
|
if client.raise_on_unexpected_status:
|
||||||
|
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Union[Any, SalesTax]]:
|
||||||
|
return Response(
|
||||||
|
status_code=HTTPStatus(response.status_code),
|
||||||
|
content=response.content,
|
||||||
|
headers=response.headers,
|
||||||
|
parsed=_parse_response(client=client, response=response),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def sync_detailed(
|
||||||
|
country_code: str,
|
||||||
|
jurisdiction_id: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
|
||||||
|
) -> Response[Union[Any, SalesTax]]:
|
||||||
|
r""" This call retrieves the current sales-tax table entry for a specific tax jurisdiction. Specify the
|
||||||
|
jurisdiction to retrieve using the <b>countryCode</b> and <b>jurisdictionId</b> path parameters. All
|
||||||
|
four response fields will be returned if a sales-tax entry exists for the tax jurisdiction.
|
||||||
|
Otherwise, the response will be returned as empty.<br><br><span class=\"tablenote\"><b>Note:</b>
|
||||||
|
Sales-tax tables are only available for the US (EBAY_US) and Canada (EBAY_CA)
|
||||||
|
marketplaces.</span><br><div class=\"msgbox_important\"><p class=\"msgbox_importantInDiv\" data-mc-
|
||||||
|
autonum=\"<b><span style="color: #dd1e31;"
|
||||||
|
class="mcFormatColor">Important! </span></b>\"><span
|
||||||
|
class=\"autonumber\"><span><b><span style=\"color: #dd1e31;\"
|
||||||
|
class=\"mcFormatColor\">Important!</span></b></span></span> In the US, eBay now calculates,
|
||||||
|
collects, and remits sales tax to the proper taxing authorities in all 50 states and Washington, DC.
|
||||||
|
Sellers can no longer specify sales-tax rates for these jurisdictions using a tax
|
||||||
|
table.<br><br>However, sellers may continue to use a sales-tax table to set rates for the following
|
||||||
|
US territories:<ul><li>American Samoa (AS)</li><li>Guam (GU)</li><li>Northern Mariana Islands
|
||||||
|
(MP)</li><li>Palau (PW)</li><li>US Virgin Islands (VI)</li></ul>For additional information, refer to
|
||||||
|
<a href=\"https://www.ebay.com/help/selling/fees-credits-invoices/taxes-import-charges?id=4121 \"
|
||||||
|
target=\"_blank\">Taxes and import charges</a>.</p></div>
|
||||||
|
|
||||||
|
Args:
|
||||||
|
country_code (str):
|
||||||
|
jurisdiction_id (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[Union[Any, SalesTax]]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
country_code=country_code,
|
||||||
|
jurisdiction_id=jurisdiction_id,
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
def sync(
|
||||||
|
country_code: str,
|
||||||
|
jurisdiction_id: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
|
||||||
|
) -> Optional[Union[Any, SalesTax]]:
|
||||||
|
r""" This call retrieves the current sales-tax table entry for a specific tax jurisdiction. Specify the
|
||||||
|
jurisdiction to retrieve using the <b>countryCode</b> and <b>jurisdictionId</b> path parameters. All
|
||||||
|
four response fields will be returned if a sales-tax entry exists for the tax jurisdiction.
|
||||||
|
Otherwise, the response will be returned as empty.<br><br><span class=\"tablenote\"><b>Note:</b>
|
||||||
|
Sales-tax tables are only available for the US (EBAY_US) and Canada (EBAY_CA)
|
||||||
|
marketplaces.</span><br><div class=\"msgbox_important\"><p class=\"msgbox_importantInDiv\" data-mc-
|
||||||
|
autonum=\"<b><span style="color: #dd1e31;"
|
||||||
|
class="mcFormatColor">Important! </span></b>\"><span
|
||||||
|
class=\"autonumber\"><span><b><span style=\"color: #dd1e31;\"
|
||||||
|
class=\"mcFormatColor\">Important!</span></b></span></span> In the US, eBay now calculates,
|
||||||
|
collects, and remits sales tax to the proper taxing authorities in all 50 states and Washington, DC.
|
||||||
|
Sellers can no longer specify sales-tax rates for these jurisdictions using a tax
|
||||||
|
table.<br><br>However, sellers may continue to use a sales-tax table to set rates for the following
|
||||||
|
US territories:<ul><li>American Samoa (AS)</li><li>Guam (GU)</li><li>Northern Mariana Islands
|
||||||
|
(MP)</li><li>Palau (PW)</li><li>US Virgin Islands (VI)</li></ul>For additional information, refer to
|
||||||
|
<a href=\"https://www.ebay.com/help/selling/fees-credits-invoices/taxes-import-charges?id=4121 \"
|
||||||
|
target=\"_blank\">Taxes and import charges</a>.</p></div>
|
||||||
|
|
||||||
|
Args:
|
||||||
|
country_code (str):
|
||||||
|
jurisdiction_id (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:
|
||||||
|
Union[Any, SalesTax]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
country_code=country_code,
|
||||||
|
jurisdiction_id=jurisdiction_id,
|
||||||
|
client=client,
|
||||||
|
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
country_code: str,
|
||||||
|
jurisdiction_id: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
|
||||||
|
) -> Response[Union[Any, SalesTax]]:
|
||||||
|
r""" This call retrieves the current sales-tax table entry for a specific tax jurisdiction. Specify the
|
||||||
|
jurisdiction to retrieve using the <b>countryCode</b> and <b>jurisdictionId</b> path parameters. All
|
||||||
|
four response fields will be returned if a sales-tax entry exists for the tax jurisdiction.
|
||||||
|
Otherwise, the response will be returned as empty.<br><br><span class=\"tablenote\"><b>Note:</b>
|
||||||
|
Sales-tax tables are only available for the US (EBAY_US) and Canada (EBAY_CA)
|
||||||
|
marketplaces.</span><br><div class=\"msgbox_important\"><p class=\"msgbox_importantInDiv\" data-mc-
|
||||||
|
autonum=\"<b><span style="color: #dd1e31;"
|
||||||
|
class="mcFormatColor">Important! </span></b>\"><span
|
||||||
|
class=\"autonumber\"><span><b><span style=\"color: #dd1e31;\"
|
||||||
|
class=\"mcFormatColor\">Important!</span></b></span></span> In the US, eBay now calculates,
|
||||||
|
collects, and remits sales tax to the proper taxing authorities in all 50 states and Washington, DC.
|
||||||
|
Sellers can no longer specify sales-tax rates for these jurisdictions using a tax
|
||||||
|
table.<br><br>However, sellers may continue to use a sales-tax table to set rates for the following
|
||||||
|
US territories:<ul><li>American Samoa (AS)</li><li>Guam (GU)</li><li>Northern Mariana Islands
|
||||||
|
(MP)</li><li>Palau (PW)</li><li>US Virgin Islands (VI)</li></ul>For additional information, refer to
|
||||||
|
<a href=\"https://www.ebay.com/help/selling/fees-credits-invoices/taxes-import-charges?id=4121 \"
|
||||||
|
target=\"_blank\">Taxes and import charges</a>.</p></div>
|
||||||
|
|
||||||
|
Args:
|
||||||
|
country_code (str):
|
||||||
|
jurisdiction_id (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[Union[Any, SalesTax]]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
country_code=country_code,
|
||||||
|
jurisdiction_id=jurisdiction_id,
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
response = await client.get_async_httpx_client().request(
|
||||||
|
**kwargs
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
async def asyncio(
|
||||||
|
country_code: str,
|
||||||
|
jurisdiction_id: str,
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
|
||||||
|
) -> Optional[Union[Any, SalesTax]]:
|
||||||
|
r""" This call retrieves the current sales-tax table entry for a specific tax jurisdiction. Specify the
|
||||||
|
jurisdiction to retrieve using the <b>countryCode</b> and <b>jurisdictionId</b> path parameters. All
|
||||||
|
four response fields will be returned if a sales-tax entry exists for the tax jurisdiction.
|
||||||
|
Otherwise, the response will be returned as empty.<br><br><span class=\"tablenote\"><b>Note:</b>
|
||||||
|
Sales-tax tables are only available for the US (EBAY_US) and Canada (EBAY_CA)
|
||||||
|
marketplaces.</span><br><div class=\"msgbox_important\"><p class=\"msgbox_importantInDiv\" data-mc-
|
||||||
|
autonum=\"<b><span style="color: #dd1e31;"
|
||||||
|
class="mcFormatColor">Important! </span></b>\"><span
|
||||||
|
class=\"autonumber\"><span><b><span style=\"color: #dd1e31;\"
|
||||||
|
class=\"mcFormatColor\">Important!</span></b></span></span> In the US, eBay now calculates,
|
||||||
|
collects, and remits sales tax to the proper taxing authorities in all 50 states and Washington, DC.
|
||||||
|
Sellers can no longer specify sales-tax rates for these jurisdictions using a tax
|
||||||
|
table.<br><br>However, sellers may continue to use a sales-tax table to set rates for the following
|
||||||
|
US territories:<ul><li>American Samoa (AS)</li><li>Guam (GU)</li><li>Northern Mariana Islands
|
||||||
|
(MP)</li><li>Palau (PW)</li><li>US Virgin Islands (VI)</li></ul>For additional information, refer to
|
||||||
|
<a href=\"https://www.ebay.com/help/selling/fees-credits-invoices/taxes-import-charges?id=4121 \"
|
||||||
|
target=\"_blank\">Taxes and import charges</a>.</p></div>
|
||||||
|
|
||||||
|
Args:
|
||||||
|
country_code (str):
|
||||||
|
jurisdiction_id (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:
|
||||||
|
Union[Any, SalesTax]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
return (await asyncio_detailed(
|
||||||
|
country_code=country_code,
|
||||||
|
jurisdiction_id=jurisdiction_id,
|
||||||
|
client=client,
|
||||||
|
|
||||||
|
)).parsed
|
||||||
242
ebay_client/generated/account/api/sales_tax/get_sales_taxes.py
Normal file
242
ebay_client/generated/account/api/sales_tax/get_sales_taxes.py
Normal file
|
|
@ -0,0 +1,242 @@
|
||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any, Optional, Union, cast
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...types import Response, UNSET
|
||||||
|
from ... import errors
|
||||||
|
|
||||||
|
from ...models.sales_taxes import SalesTaxes
|
||||||
|
from typing import cast
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
*,
|
||||||
|
country_code: str,
|
||||||
|
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
params: dict[str, Any] = {}
|
||||||
|
|
||||||
|
params["country_code"] = country_code
|
||||||
|
|
||||||
|
|
||||||
|
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": "/sales_tax",
|
||||||
|
"params": params,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Union[Any, SalesTaxes]]:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = SalesTaxes.from_dict(response.json())
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return response_200
|
||||||
|
if response.status_code == 400:
|
||||||
|
response_400 = cast(Any, None)
|
||||||
|
return response_400
|
||||||
|
if response.status_code == 500:
|
||||||
|
response_500 = cast(Any, None)
|
||||||
|
return response_500
|
||||||
|
if client.raise_on_unexpected_status:
|
||||||
|
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Union[Any, SalesTaxes]]:
|
||||||
|
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,
|
||||||
|
country_code: str,
|
||||||
|
|
||||||
|
) -> Response[Union[Any, SalesTaxes]]:
|
||||||
|
r""" Use this call to retrieve all sales tax table entries that the seller has defined for a specific
|
||||||
|
country. All four response fields will be returned for each tax jurisdiction that matches the search
|
||||||
|
criteria. If no sales tax rates are defined for the specified, a <code>204 No Content</code> status
|
||||||
|
code is returned with no response payload.<br><br><span class=\"tablenote\"><b>Note:</b> Sales-tax
|
||||||
|
tables are only available for the US (EBAY_US) and Canada (EBAY_CA) marketplaces.</span><br><div
|
||||||
|
class=\"msgbox_important\"><p class=\"msgbox_importantInDiv\" data-mc-autonum=\"<b><span
|
||||||
|
style="color: #dd1e31;" class="mcFormatColor">Important!
|
||||||
|
</span></b>\"><span class=\"autonumber\"><span><b><span style=\"color: #dd1e31;\"
|
||||||
|
class=\"mcFormatColor\">Important!</span></b></span></span> In the US, eBay now calculates,
|
||||||
|
collects, and remits sales tax to the proper taxing authorities in all 50 states and Washington, DC.
|
||||||
|
Sellers can no longer specify sales-tax rates for these jurisdictions using a tax
|
||||||
|
table.<br><br>However, sellers may continue to use a sales-tax table to set rates for the following
|
||||||
|
US territories:<ul><li>American Samoa (AS)</li><li>Guam (GU)</li><li>Northern Mariana Islands
|
||||||
|
(MP)</li><li>Palau (PW)</li><li>US Virgin Islands (VI)</li></ul>For additional information, refer to
|
||||||
|
<a href=\"https://www.ebay.com/help/selling/fees-credits-invoices/taxes-import-charges?id=4121 \"
|
||||||
|
target=\"_blank\">Taxes and import charges</a>.</p></div>
|
||||||
|
|
||||||
|
Args:
|
||||||
|
country_code (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[Union[Any, SalesTaxes]]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
country_code=country_code,
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
def sync(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
country_code: str,
|
||||||
|
|
||||||
|
) -> Optional[Union[Any, SalesTaxes]]:
|
||||||
|
r""" Use this call to retrieve all sales tax table entries that the seller has defined for a specific
|
||||||
|
country. All four response fields will be returned for each tax jurisdiction that matches the search
|
||||||
|
criteria. If no sales tax rates are defined for the specified, a <code>204 No Content</code> status
|
||||||
|
code is returned with no response payload.<br><br><span class=\"tablenote\"><b>Note:</b> Sales-tax
|
||||||
|
tables are only available for the US (EBAY_US) and Canada (EBAY_CA) marketplaces.</span><br><div
|
||||||
|
class=\"msgbox_important\"><p class=\"msgbox_importantInDiv\" data-mc-autonum=\"<b><span
|
||||||
|
style="color: #dd1e31;" class="mcFormatColor">Important!
|
||||||
|
</span></b>\"><span class=\"autonumber\"><span><b><span style=\"color: #dd1e31;\"
|
||||||
|
class=\"mcFormatColor\">Important!</span></b></span></span> In the US, eBay now calculates,
|
||||||
|
collects, and remits sales tax to the proper taxing authorities in all 50 states and Washington, DC.
|
||||||
|
Sellers can no longer specify sales-tax rates for these jurisdictions using a tax
|
||||||
|
table.<br><br>However, sellers may continue to use a sales-tax table to set rates for the following
|
||||||
|
US territories:<ul><li>American Samoa (AS)</li><li>Guam (GU)</li><li>Northern Mariana Islands
|
||||||
|
(MP)</li><li>Palau (PW)</li><li>US Virgin Islands (VI)</li></ul>For additional information, refer to
|
||||||
|
<a href=\"https://www.ebay.com/help/selling/fees-credits-invoices/taxes-import-charges?id=4121 \"
|
||||||
|
target=\"_blank\">Taxes and import charges</a>.</p></div>
|
||||||
|
|
||||||
|
Args:
|
||||||
|
country_code (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:
|
||||||
|
Union[Any, SalesTaxes]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
client=client,
|
||||||
|
country_code=country_code,
|
||||||
|
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
country_code: str,
|
||||||
|
|
||||||
|
) -> Response[Union[Any, SalesTaxes]]:
|
||||||
|
r""" Use this call to retrieve all sales tax table entries that the seller has defined for a specific
|
||||||
|
country. All four response fields will be returned for each tax jurisdiction that matches the search
|
||||||
|
criteria. If no sales tax rates are defined for the specified, a <code>204 No Content</code> status
|
||||||
|
code is returned with no response payload.<br><br><span class=\"tablenote\"><b>Note:</b> Sales-tax
|
||||||
|
tables are only available for the US (EBAY_US) and Canada (EBAY_CA) marketplaces.</span><br><div
|
||||||
|
class=\"msgbox_important\"><p class=\"msgbox_importantInDiv\" data-mc-autonum=\"<b><span
|
||||||
|
style="color: #dd1e31;" class="mcFormatColor">Important!
|
||||||
|
</span></b>\"><span class=\"autonumber\"><span><b><span style=\"color: #dd1e31;\"
|
||||||
|
class=\"mcFormatColor\">Important!</span></b></span></span> In the US, eBay now calculates,
|
||||||
|
collects, and remits sales tax to the proper taxing authorities in all 50 states and Washington, DC.
|
||||||
|
Sellers can no longer specify sales-tax rates for these jurisdictions using a tax
|
||||||
|
table.<br><br>However, sellers may continue to use a sales-tax table to set rates for the following
|
||||||
|
US territories:<ul><li>American Samoa (AS)</li><li>Guam (GU)</li><li>Northern Mariana Islands
|
||||||
|
(MP)</li><li>Palau (PW)</li><li>US Virgin Islands (VI)</li></ul>For additional information, refer to
|
||||||
|
<a href=\"https://www.ebay.com/help/selling/fees-credits-invoices/taxes-import-charges?id=4121 \"
|
||||||
|
target=\"_blank\">Taxes and import charges</a>.</p></div>
|
||||||
|
|
||||||
|
Args:
|
||||||
|
country_code (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[Union[Any, SalesTaxes]]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
country_code=country_code,
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
response = await client.get_async_httpx_client().request(
|
||||||
|
**kwargs
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
async def asyncio(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
country_code: str,
|
||||||
|
|
||||||
|
) -> Optional[Union[Any, SalesTaxes]]:
|
||||||
|
r""" Use this call to retrieve all sales tax table entries that the seller has defined for a specific
|
||||||
|
country. All four response fields will be returned for each tax jurisdiction that matches the search
|
||||||
|
criteria. If no sales tax rates are defined for the specified, a <code>204 No Content</code> status
|
||||||
|
code is returned with no response payload.<br><br><span class=\"tablenote\"><b>Note:</b> Sales-tax
|
||||||
|
tables are only available for the US (EBAY_US) and Canada (EBAY_CA) marketplaces.</span><br><div
|
||||||
|
class=\"msgbox_important\"><p class=\"msgbox_importantInDiv\" data-mc-autonum=\"<b><span
|
||||||
|
style="color: #dd1e31;" class="mcFormatColor">Important!
|
||||||
|
</span></b>\"><span class=\"autonumber\"><span><b><span style=\"color: #dd1e31;\"
|
||||||
|
class=\"mcFormatColor\">Important!</span></b></span></span> In the US, eBay now calculates,
|
||||||
|
collects, and remits sales tax to the proper taxing authorities in all 50 states and Washington, DC.
|
||||||
|
Sellers can no longer specify sales-tax rates for these jurisdictions using a tax
|
||||||
|
table.<br><br>However, sellers may continue to use a sales-tax table to set rates for the following
|
||||||
|
US territories:<ul><li>American Samoa (AS)</li><li>Guam (GU)</li><li>Northern Mariana Islands
|
||||||
|
(MP)</li><li>Palau (PW)</li><li>US Virgin Islands (VI)</li></ul>For additional information, refer to
|
||||||
|
<a href=\"https://www.ebay.com/help/selling/fees-credits-invoices/taxes-import-charges?id=4121 \"
|
||||||
|
target=\"_blank\">Taxes and import charges</a>.</p></div>
|
||||||
|
|
||||||
|
Args:
|
||||||
|
country_code (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:
|
||||||
|
Union[Any, SalesTaxes]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
return (await asyncio_detailed(
|
||||||
|
client=client,
|
||||||
|
country_code=country_code,
|
||||||
|
|
||||||
|
)).parsed
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
""" Contains endpoint functions for accessing the API """
|
||||||
|
|
@ -0,0 +1,199 @@
|
||||||
|
from http import HTTPStatus
|
||||||
|
from typing import Any, Optional, Union, cast
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from ...client import AuthenticatedClient, Client
|
||||||
|
from ...types import Response, UNSET
|
||||||
|
from ... import errors
|
||||||
|
|
||||||
|
from ...models.subscription_response import SubscriptionResponse
|
||||||
|
from ...types import UNSET, Unset
|
||||||
|
from typing import cast
|
||||||
|
from typing import Union
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwargs(
|
||||||
|
*,
|
||||||
|
limit: Union[Unset, str] = UNSET,
|
||||||
|
continuation_token: Union[Unset, str] = UNSET,
|
||||||
|
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
params: dict[str, Any] = {}
|
||||||
|
|
||||||
|
params["limit"] = limit
|
||||||
|
|
||||||
|
params["continuation_token"] = continuation_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": "/subscription",
|
||||||
|
"params": params,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return _kwargs
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Union[Any, SubscriptionResponse]]:
|
||||||
|
if response.status_code == 200:
|
||||||
|
response_200 = SubscriptionResponse.from_dict(response.json())
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return response_200
|
||||||
|
if response.status_code == 400:
|
||||||
|
response_400 = cast(Any, None)
|
||||||
|
return response_400
|
||||||
|
if response.status_code == 500:
|
||||||
|
response_500 = cast(Any, None)
|
||||||
|
return response_500
|
||||||
|
if client.raise_on_unexpected_status:
|
||||||
|
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Union[Any, SubscriptionResponse]]:
|
||||||
|
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,
|
||||||
|
limit: Union[Unset, str] = UNSET,
|
||||||
|
continuation_token: Union[Unset, str] = UNSET,
|
||||||
|
|
||||||
|
) -> Response[Union[Any, SubscriptionResponse]]:
|
||||||
|
""" This method retrieves a list of subscriptions associated with the seller account.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
limit (Union[Unset, str]):
|
||||||
|
continuation_token (Union[Unset, 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[Union[Any, SubscriptionResponse]]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
limit=limit,
|
||||||
|
continuation_token=continuation_token,
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.get_httpx_client().request(
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
def sync(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
limit: Union[Unset, str] = UNSET,
|
||||||
|
continuation_token: Union[Unset, str] = UNSET,
|
||||||
|
|
||||||
|
) -> Optional[Union[Any, SubscriptionResponse]]:
|
||||||
|
""" This method retrieves a list of subscriptions associated with the seller account.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
limit (Union[Unset, str]):
|
||||||
|
continuation_token (Union[Unset, 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:
|
||||||
|
Union[Any, SubscriptionResponse]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
return sync_detailed(
|
||||||
|
client=client,
|
||||||
|
limit=limit,
|
||||||
|
continuation_token=continuation_token,
|
||||||
|
|
||||||
|
).parsed
|
||||||
|
|
||||||
|
async def asyncio_detailed(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
limit: Union[Unset, str] = UNSET,
|
||||||
|
continuation_token: Union[Unset, str] = UNSET,
|
||||||
|
|
||||||
|
) -> Response[Union[Any, SubscriptionResponse]]:
|
||||||
|
""" This method retrieves a list of subscriptions associated with the seller account.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
limit (Union[Unset, str]):
|
||||||
|
continuation_token (Union[Unset, 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[Union[Any, SubscriptionResponse]]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
kwargs = _get_kwargs(
|
||||||
|
limit=limit,
|
||||||
|
continuation_token=continuation_token,
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
response = await client.get_async_httpx_client().request(
|
||||||
|
**kwargs
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_response(client=client, response=response)
|
||||||
|
|
||||||
|
async def asyncio(
|
||||||
|
*,
|
||||||
|
client: AuthenticatedClient,
|
||||||
|
limit: Union[Unset, str] = UNSET,
|
||||||
|
continuation_token: Union[Unset, str] = UNSET,
|
||||||
|
|
||||||
|
) -> Optional[Union[Any, SubscriptionResponse]]:
|
||||||
|
""" This method retrieves a list of subscriptions associated with the seller account.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
limit (Union[Unset, str]):
|
||||||
|
continuation_token (Union[Unset, 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:
|
||||||
|
Union[Any, SubscriptionResponse]
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
return (await asyncio_detailed(
|
||||||
|
client=client,
|
||||||
|
limit=limit,
|
||||||
|
continuation_token=continuation_token,
|
||||||
|
|
||||||
|
)).parsed
|
||||||
271
ebay_client/generated/account/client.py
Normal file
271
ebay_client/generated/account/client.py
Normal file
|
|
@ -0,0 +1,271 @@
|
||||||
|
import ssl
|
||||||
|
from typing import Any, Union, Optional
|
||||||
|
|
||||||
|
from attrs import define, field, evolve
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@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: Optional[httpx.Timeout] = field(default=None, kw_only=True, alias="timeout")
|
||||||
|
_verify_ssl: Union[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: Optional[httpx.Client] = field(default=None, init=False)
|
||||||
|
_async_client: Optional[httpx.AsyncClient] = 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 (in seconds)"""
|
||||||
|
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 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: Optional[httpx.Timeout] = field(default=None, kw_only=True, alias="timeout")
|
||||||
|
_verify_ssl: Union[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: Optional[httpx.Client] = field(default=None, init=False)
|
||||||
|
_async_client: Optional[httpx.AsyncClient] = 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 (in seconds)"""
|
||||||
|
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 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)
|
||||||
|
|
||||||
14
ebay_client/generated/account/errors.py
Normal file
14
ebay_client/generated/account/errors.py
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
""" 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"]
|
||||||
115
ebay_client/generated/account/models/__init__.py
Normal file
115
ebay_client/generated/account/models/__init__.py
Normal file
|
|
@ -0,0 +1,115 @@
|
||||||
|
""" Contains all the data models used in inputs/outputs """
|
||||||
|
|
||||||
|
from .amount import Amount
|
||||||
|
from .bulk_sales_tax_input import BulkSalesTaxInput
|
||||||
|
from .category_type import CategoryType
|
||||||
|
from .compact_custom_policy_response import CompactCustomPolicyResponse
|
||||||
|
from .create_custom_policy_response_201 import CreateCustomPolicyResponse201
|
||||||
|
from .custom_policy import CustomPolicy
|
||||||
|
from .custom_policy_create_request import CustomPolicyCreateRequest
|
||||||
|
from .custom_policy_request import CustomPolicyRequest
|
||||||
|
from .custom_policy_response import CustomPolicyResponse
|
||||||
|
from .deposit import Deposit
|
||||||
|
from .error import Error
|
||||||
|
from .error_parameter import ErrorParameter
|
||||||
|
from .fulfillment_policy import FulfillmentPolicy
|
||||||
|
from .fulfillment_policy_request import FulfillmentPolicyRequest
|
||||||
|
from .fulfillment_policy_response import FulfillmentPolicyResponse
|
||||||
|
from .international_return_override_type import InternationalReturnOverrideType
|
||||||
|
from .kyc_check import KycCheck
|
||||||
|
from .kyc_response import KycResponse
|
||||||
|
from .opt_in_to_program_response_200 import OptInToProgramResponse200
|
||||||
|
from .opt_out_of_program_response_200 import OptOutOfProgramResponse200
|
||||||
|
from .payment_method import PaymentMethod
|
||||||
|
from .payment_policy import PaymentPolicy
|
||||||
|
from .payment_policy_request import PaymentPolicyRequest
|
||||||
|
from .payment_policy_response import PaymentPolicyResponse
|
||||||
|
from .payments_program_onboarding_response import PaymentsProgramOnboardingResponse
|
||||||
|
from .payments_program_onboarding_steps import PaymentsProgramOnboardingSteps
|
||||||
|
from .payments_program_response import PaymentsProgramResponse
|
||||||
|
from .program import Program
|
||||||
|
from .programs import Programs
|
||||||
|
from .rate_table import RateTable
|
||||||
|
from .rate_table_response import RateTableResponse
|
||||||
|
from .recipient_account_reference import RecipientAccountReference
|
||||||
|
from .region import Region
|
||||||
|
from .region_set import RegionSet
|
||||||
|
from .return_policy import ReturnPolicy
|
||||||
|
from .return_policy_request import ReturnPolicyRequest
|
||||||
|
from .return_policy_response import ReturnPolicyResponse
|
||||||
|
from .sales_tax import SalesTax
|
||||||
|
from .sales_tax_base import SalesTaxBase
|
||||||
|
from .sales_tax_input import SalesTaxInput
|
||||||
|
from .sales_taxes import SalesTaxes
|
||||||
|
from .seller_eligibility_multi_program_response import SellerEligibilityMultiProgramResponse
|
||||||
|
from .seller_eligibility_response import SellerEligibilityResponse
|
||||||
|
from .selling_limit import SellingLimit
|
||||||
|
from .selling_privileges import SellingPrivileges
|
||||||
|
from .set_fulfillment_policy_response import SetFulfillmentPolicyResponse
|
||||||
|
from .set_payment_policy_response import SetPaymentPolicyResponse
|
||||||
|
from .set_return_policy_response import SetReturnPolicyResponse
|
||||||
|
from .shipping_option import ShippingOption
|
||||||
|
from .shipping_service import ShippingService
|
||||||
|
from .subscription import Subscription
|
||||||
|
from .subscription_response import SubscriptionResponse
|
||||||
|
from .time_duration import TimeDuration
|
||||||
|
from .updated_sales_tax_entry import UpdatedSalesTaxEntry
|
||||||
|
from .updated_sales_tax_response import UpdatedSalesTaxResponse
|
||||||
|
|
||||||
|
__all__ = (
|
||||||
|
"Amount",
|
||||||
|
"BulkSalesTaxInput",
|
||||||
|
"CategoryType",
|
||||||
|
"CompactCustomPolicyResponse",
|
||||||
|
"CreateCustomPolicyResponse201",
|
||||||
|
"CustomPolicy",
|
||||||
|
"CustomPolicyCreateRequest",
|
||||||
|
"CustomPolicyRequest",
|
||||||
|
"CustomPolicyResponse",
|
||||||
|
"Deposit",
|
||||||
|
"Error",
|
||||||
|
"ErrorParameter",
|
||||||
|
"FulfillmentPolicy",
|
||||||
|
"FulfillmentPolicyRequest",
|
||||||
|
"FulfillmentPolicyResponse",
|
||||||
|
"InternationalReturnOverrideType",
|
||||||
|
"KycCheck",
|
||||||
|
"KycResponse",
|
||||||
|
"OptInToProgramResponse200",
|
||||||
|
"OptOutOfProgramResponse200",
|
||||||
|
"PaymentMethod",
|
||||||
|
"PaymentPolicy",
|
||||||
|
"PaymentPolicyRequest",
|
||||||
|
"PaymentPolicyResponse",
|
||||||
|
"PaymentsProgramOnboardingResponse",
|
||||||
|
"PaymentsProgramOnboardingSteps",
|
||||||
|
"PaymentsProgramResponse",
|
||||||
|
"Program",
|
||||||
|
"Programs",
|
||||||
|
"RateTable",
|
||||||
|
"RateTableResponse",
|
||||||
|
"RecipientAccountReference",
|
||||||
|
"Region",
|
||||||
|
"RegionSet",
|
||||||
|
"ReturnPolicy",
|
||||||
|
"ReturnPolicyRequest",
|
||||||
|
"ReturnPolicyResponse",
|
||||||
|
"SalesTax",
|
||||||
|
"SalesTaxBase",
|
||||||
|
"SalesTaxes",
|
||||||
|
"SalesTaxInput",
|
||||||
|
"SellerEligibilityMultiProgramResponse",
|
||||||
|
"SellerEligibilityResponse",
|
||||||
|
"SellingLimit",
|
||||||
|
"SellingPrivileges",
|
||||||
|
"SetFulfillmentPolicyResponse",
|
||||||
|
"SetPaymentPolicyResponse",
|
||||||
|
"SetReturnPolicyResponse",
|
||||||
|
"ShippingOption",
|
||||||
|
"ShippingService",
|
||||||
|
"Subscription",
|
||||||
|
"SubscriptionResponse",
|
||||||
|
"TimeDuration",
|
||||||
|
"UpdatedSalesTaxEntry",
|
||||||
|
"UpdatedSalesTaxResponse",
|
||||||
|
)
|
||||||
94
ebay_client/generated/account/models/amount.py
Normal file
94
ebay_client/generated/account/models/amount.py
Normal file
|
|
@ -0,0 +1,94 @@
|
||||||
|
from collections.abc import Mapping
|
||||||
|
from typing import Any, TypeVar, Optional, BinaryIO, TextIO, TYPE_CHECKING, Generator
|
||||||
|
|
||||||
|
from attrs import define as _attrs_define
|
||||||
|
from attrs import field as _attrs_field
|
||||||
|
|
||||||
|
from ..types import UNSET, Unset
|
||||||
|
|
||||||
|
from ..types import UNSET, Unset
|
||||||
|
from typing import Union
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
T = TypeVar("T", bound="Amount")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@_attrs_define
|
||||||
|
class Amount:
|
||||||
|
""" A complex type that describes the value of a monetary amount as represented by a global currency. When passing in an
|
||||||
|
amount in a request payload, both <b>currency</b> and <b>value</b> fields are required, and both fields are also
|
||||||
|
always returned for an amount in a response field.
|
||||||
|
|
||||||
|
Attributes:
|
||||||
|
currency (Union[Unset, str]): The base currency applied to the <b>value</b> field to establish a monetary
|
||||||
|
amount. <br><br>The currency is represented as a 3-letter <a href="https://www.iso.org/iso-4217-currency-
|
||||||
|
codes.html " title="https://www.iso.org " target="_blank">ISO 4217</a> currency code. For example, the code for
|
||||||
|
the Canadian Dollar is <code>CAD</code>.<br><br><b>Default:</b> The default currency of the eBay marketplace
|
||||||
|
that hosts the listing. For implementation help, refer to <a href='https://developer.ebay.com/api-
|
||||||
|
docs/sell/account/types/ba:CurrencyCodeEnum'>eBay API documentation</a>
|
||||||
|
value (Union[Unset, str]): The monetary amount in the specified <b>currency</b>.
|
||||||
|
"""
|
||||||
|
|
||||||
|
currency: Union[Unset, str] = UNSET
|
||||||
|
value: Union[Unset, str] = UNSET
|
||||||
|
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def to_dict(self) -> dict[str, Any]:
|
||||||
|
currency = self.currency
|
||||||
|
|
||||||
|
value = self.value
|
||||||
|
|
||||||
|
|
||||||
|
field_dict: dict[str, Any] = {}
|
||||||
|
field_dict.update(self.additional_properties)
|
||||||
|
field_dict.update({
|
||||||
|
})
|
||||||
|
if currency is not UNSET:
|
||||||
|
field_dict["currency"] = currency
|
||||||
|
if value is not UNSET:
|
||||||
|
field_dict["value"] = value
|
||||||
|
|
||||||
|
return field_dict
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||||
|
d = dict(src_dict)
|
||||||
|
currency = d.pop("currency", UNSET)
|
||||||
|
|
||||||
|
value = d.pop("value", UNSET)
|
||||||
|
|
||||||
|
amount = cls(
|
||||||
|
currency=currency,
|
||||||
|
value=value,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
amount.additional_properties = d
|
||||||
|
return amount
|
||||||
|
|
||||||
|
@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
|
||||||
98
ebay_client/generated/account/models/bulk_sales_tax_input.py
Normal file
98
ebay_client/generated/account/models/bulk_sales_tax_input.py
Normal file
|
|
@ -0,0 +1,98 @@
|
||||||
|
from collections.abc import Mapping
|
||||||
|
from typing import Any, TypeVar, Optional, BinaryIO, TextIO, TYPE_CHECKING, Generator
|
||||||
|
|
||||||
|
from attrs import define as _attrs_define
|
||||||
|
from attrs import field as _attrs_field
|
||||||
|
|
||||||
|
from ..types import UNSET, Unset
|
||||||
|
|
||||||
|
from ..types import UNSET, Unset
|
||||||
|
from typing import cast
|
||||||
|
from typing import Union
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from ..models.sales_tax_input import SalesTaxInput
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
T = TypeVar("T", bound="BulkSalesTaxInput")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@_attrs_define
|
||||||
|
class BulkSalesTaxInput:
|
||||||
|
"""
|
||||||
|
Attributes:
|
||||||
|
sales_tax_input_list (Union[Unset, list['SalesTaxInput']]): The array of sales-tax table entries to be created
|
||||||
|
or updated.
|
||||||
|
"""
|
||||||
|
|
||||||
|
sales_tax_input_list: Union[Unset, list['SalesTaxInput']] = UNSET
|
||||||
|
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def to_dict(self) -> dict[str, Any]:
|
||||||
|
from ..models.sales_tax_input import SalesTaxInput
|
||||||
|
sales_tax_input_list: Union[Unset, list[dict[str, Any]]] = UNSET
|
||||||
|
if not isinstance(self.sales_tax_input_list, Unset):
|
||||||
|
sales_tax_input_list = []
|
||||||
|
for sales_tax_input_list_item_data in self.sales_tax_input_list:
|
||||||
|
sales_tax_input_list_item = sales_tax_input_list_item_data.to_dict()
|
||||||
|
sales_tax_input_list.append(sales_tax_input_list_item)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
field_dict: dict[str, Any] = {}
|
||||||
|
field_dict.update(self.additional_properties)
|
||||||
|
field_dict.update({
|
||||||
|
})
|
||||||
|
if sales_tax_input_list is not UNSET:
|
||||||
|
field_dict["salesTaxInputList"] = sales_tax_input_list
|
||||||
|
|
||||||
|
return field_dict
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||||
|
from ..models.sales_tax_input import SalesTaxInput
|
||||||
|
d = dict(src_dict)
|
||||||
|
sales_tax_input_list = []
|
||||||
|
_sales_tax_input_list = d.pop("salesTaxInputList", UNSET)
|
||||||
|
for sales_tax_input_list_item_data in (_sales_tax_input_list or []):
|
||||||
|
sales_tax_input_list_item = SalesTaxInput.from_dict(sales_tax_input_list_item_data)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
sales_tax_input_list.append(sales_tax_input_list_item)
|
||||||
|
|
||||||
|
|
||||||
|
bulk_sales_tax_input = cls(
|
||||||
|
sales_tax_input_list=sales_tax_input_list,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
bulk_sales_tax_input.additional_properties = d
|
||||||
|
return bulk_sales_tax_input
|
||||||
|
|
||||||
|
@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
|
||||||
96
ebay_client/generated/account/models/category_type.py
Normal file
96
ebay_client/generated/account/models/category_type.py
Normal file
|
|
@ -0,0 +1,96 @@
|
||||||
|
from collections.abc import Mapping
|
||||||
|
from typing import Any, TypeVar, Optional, BinaryIO, TextIO, TYPE_CHECKING, Generator
|
||||||
|
|
||||||
|
from attrs import define as _attrs_define
|
||||||
|
from attrs import field as _attrs_field
|
||||||
|
|
||||||
|
from ..types import UNSET, Unset
|
||||||
|
|
||||||
|
from ..types import UNSET, Unset
|
||||||
|
from typing import Union
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
T = TypeVar("T", bound="CategoryType")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@_attrs_define
|
||||||
|
class CategoryType:
|
||||||
|
""" The category type discerns whether the policy applies to motor vehicle listings, or to any other items except motor
|
||||||
|
vehicle listings. <br><br>Each business policy can be associated with either or both categories ('MOTORS_VEHICLES'
|
||||||
|
and 'ALL_EXCLUDING_MOTORS_VEHICLES'); however, return business policies are not applicable for motor vehicle
|
||||||
|
listings.
|
||||||
|
|
||||||
|
Attributes:
|
||||||
|
default (Union[Unset, bool]): <span class="tablenote"><strong>Note:</strong> This field has been deprecated and
|
||||||
|
is no longer used.<ul><li>Do not include this field in any <b>create</b> or <b>update</b> method.</li><li>This
|
||||||
|
field may be returned within the payload of a <b>get</b> method, but it can be ignored.</li></ul></span>
|
||||||
|
name (Union[Unset, str]): The category type to which the policy applies (motor vehicles or non-motor vehicles).
|
||||||
|
<br><br><span class="tablenote"><strong>Note:</strong> The <code>MOTORS_VEHICLES</code> category type is not
|
||||||
|
valid for return policies. eBay flows do not support the return of motor vehicles.</span> For implementation
|
||||||
|
help, refer to <a href='https://developer.ebay.com/api-docs/sell/account/types/api:CategoryTypeEnum'>eBay API
|
||||||
|
documentation</a>
|
||||||
|
"""
|
||||||
|
|
||||||
|
default: Union[Unset, bool] = UNSET
|
||||||
|
name: Union[Unset, str] = UNSET
|
||||||
|
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def to_dict(self) -> dict[str, Any]:
|
||||||
|
default = self.default
|
||||||
|
|
||||||
|
name = self.name
|
||||||
|
|
||||||
|
|
||||||
|
field_dict: dict[str, Any] = {}
|
||||||
|
field_dict.update(self.additional_properties)
|
||||||
|
field_dict.update({
|
||||||
|
})
|
||||||
|
if default is not UNSET:
|
||||||
|
field_dict["default"] = default
|
||||||
|
if name is not UNSET:
|
||||||
|
field_dict["name"] = name
|
||||||
|
|
||||||
|
return field_dict
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||||
|
d = dict(src_dict)
|
||||||
|
default = d.pop("default", UNSET)
|
||||||
|
|
||||||
|
name = d.pop("name", UNSET)
|
||||||
|
|
||||||
|
category_type = cls(
|
||||||
|
default=default,
|
||||||
|
name=name,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
category_type.additional_properties = d
|
||||||
|
return category_type
|
||||||
|
|
||||||
|
@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,113 @@
|
||||||
|
from collections.abc import Mapping
|
||||||
|
from typing import Any, TypeVar, Optional, BinaryIO, TextIO, TYPE_CHECKING, Generator
|
||||||
|
|
||||||
|
from attrs import define as _attrs_define
|
||||||
|
from attrs import field as _attrs_field
|
||||||
|
|
||||||
|
from ..types import UNSET, Unset
|
||||||
|
|
||||||
|
from ..types import UNSET, Unset
|
||||||
|
from typing import Union
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
T = TypeVar("T", bound="CompactCustomPolicyResponse")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@_attrs_define
|
||||||
|
class CompactCustomPolicyResponse:
|
||||||
|
""" The response payload for requests that return a list of custom policies.
|
||||||
|
|
||||||
|
Attributes:
|
||||||
|
custom_policy_id (Union[Unset, str]): The unique custom policy identifier for the policy being
|
||||||
|
returned.<br><br><span class="tablenote"><strong>Note:</strong> This value is automatically assigned by the
|
||||||
|
system when the policy is created.</span>
|
||||||
|
label (Union[Unset, str]): Customer-facing label shown on View Item pages for items to which the policy applies.
|
||||||
|
This seller-defined string is displayed as a system-generated hyperlink pointing to the seller's policy
|
||||||
|
information.<br><br><b>Max length:</b> 65
|
||||||
|
name (Union[Unset, str]): The seller-defined name for the custom policy. Names must be unique for policies
|
||||||
|
assigned to the same seller and policy type.<br><br><span class="tablenote"><strong>Note:</strong> This field is
|
||||||
|
visible only to the seller. </span><br><b>Max length:</b> 65
|
||||||
|
policy_type (Union[Unset, str]): Specifies the type of Custom Policy being returned. For implementation help,
|
||||||
|
refer to <a href='https://developer.ebay.com/api-docs/sell/account/types/api:CustomPolicyTypeEnum'>eBay API
|
||||||
|
documentation</a>
|
||||||
|
"""
|
||||||
|
|
||||||
|
custom_policy_id: Union[Unset, str] = UNSET
|
||||||
|
label: Union[Unset, str] = UNSET
|
||||||
|
name: Union[Unset, str] = UNSET
|
||||||
|
policy_type: Union[Unset, str] = UNSET
|
||||||
|
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def to_dict(self) -> dict[str, Any]:
|
||||||
|
custom_policy_id = self.custom_policy_id
|
||||||
|
|
||||||
|
label = self.label
|
||||||
|
|
||||||
|
name = self.name
|
||||||
|
|
||||||
|
policy_type = self.policy_type
|
||||||
|
|
||||||
|
|
||||||
|
field_dict: dict[str, Any] = {}
|
||||||
|
field_dict.update(self.additional_properties)
|
||||||
|
field_dict.update({
|
||||||
|
})
|
||||||
|
if custom_policy_id is not UNSET:
|
||||||
|
field_dict["customPolicyId"] = custom_policy_id
|
||||||
|
if label is not UNSET:
|
||||||
|
field_dict["label"] = label
|
||||||
|
if name is not UNSET:
|
||||||
|
field_dict["name"] = name
|
||||||
|
if policy_type is not UNSET:
|
||||||
|
field_dict["policyType"] = policy_type
|
||||||
|
|
||||||
|
return field_dict
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||||
|
d = dict(src_dict)
|
||||||
|
custom_policy_id = d.pop("customPolicyId", UNSET)
|
||||||
|
|
||||||
|
label = d.pop("label", UNSET)
|
||||||
|
|
||||||
|
name = d.pop("name", UNSET)
|
||||||
|
|
||||||
|
policy_type = d.pop("policyType", UNSET)
|
||||||
|
|
||||||
|
compact_custom_policy_response = cls(
|
||||||
|
custom_policy_id=custom_policy_id,
|
||||||
|
label=label,
|
||||||
|
name=name,
|
||||||
|
policy_type=policy_type,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
compact_custom_policy_response.additional_properties = d
|
||||||
|
return compact_custom_policy_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,63 @@
|
||||||
|
from collections.abc import Mapping
|
||||||
|
from typing import Any, TypeVar, Optional, BinaryIO, TextIO, TYPE_CHECKING, Generator
|
||||||
|
|
||||||
|
from attrs import define as _attrs_define
|
||||||
|
from attrs import field as _attrs_field
|
||||||
|
|
||||||
|
from ..types import UNSET, Unset
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
T = TypeVar("T", bound="CreateCustomPolicyResponse201")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@_attrs_define
|
||||||
|
class CreateCustomPolicyResponse201:
|
||||||
|
"""
|
||||||
|
"""
|
||||||
|
|
||||||
|
additional_properties: dict[str, Any] = _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)
|
||||||
|
create_custom_policy_response_201 = cls(
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
create_custom_policy_response_201.additional_properties = d
|
||||||
|
return create_custom_policy_response_201
|
||||||
|
|
||||||
|
@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
|
||||||
122
ebay_client/generated/account/models/custom_policy.py
Normal file
122
ebay_client/generated/account/models/custom_policy.py
Normal file
|
|
@ -0,0 +1,122 @@
|
||||||
|
from collections.abc import Mapping
|
||||||
|
from typing import Any, TypeVar, Optional, BinaryIO, TextIO, TYPE_CHECKING, Generator
|
||||||
|
|
||||||
|
from attrs import define as _attrs_define
|
||||||
|
from attrs import field as _attrs_field
|
||||||
|
|
||||||
|
from ..types import UNSET, Unset
|
||||||
|
|
||||||
|
from ..types import UNSET, Unset
|
||||||
|
from typing import Union
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
T = TypeVar("T", bound="CustomPolicy")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@_attrs_define
|
||||||
|
class CustomPolicy:
|
||||||
|
""" This container defines a seller's custom policy identified by policy ID for the selected eBay marketplace. A
|
||||||
|
successful call returns the requested policy information.
|
||||||
|
|
||||||
|
Attributes:
|
||||||
|
custom_policy_id (Union[Unset, str]): The unique custom policy identifier for a policy.
|
||||||
|
description (Union[Unset, str]): Contains the seller's policy and policy terms. Buyers access this information
|
||||||
|
from the View Item page for items to which the policy has been applied.<br><br><b>Max length:</b> 15,000
|
||||||
|
label (Union[Unset, str]): Customer-facing label shown on View Item pages for items to which the policy applies.
|
||||||
|
This seller-defined string is displayed as a system-generated hyperlink pointing to the seller's policy
|
||||||
|
information.<br><br><b>Max length:</b> 65
|
||||||
|
name (Union[Unset, str]): The seller-defined name for the custom policy. Names must be unique for policies
|
||||||
|
assigned to the same seller and policy type.<br><br><span class="tablenote"><strong>Note:</strong> This field is
|
||||||
|
visible only to the seller. </span><br><b>Max length:</b> 65
|
||||||
|
policy_type (Union[Unset, str]): Specifies the type of Custom Policy being returned. For implementation help,
|
||||||
|
refer to <a href='https://developer.ebay.com/api-docs/sell/account/types/api:CustomPolicyTypeEnum'>eBay API
|
||||||
|
documentation</a>
|
||||||
|
"""
|
||||||
|
|
||||||
|
custom_policy_id: Union[Unset, str] = UNSET
|
||||||
|
description: Union[Unset, str] = UNSET
|
||||||
|
label: Union[Unset, str] = UNSET
|
||||||
|
name: Union[Unset, str] = UNSET
|
||||||
|
policy_type: Union[Unset, str] = UNSET
|
||||||
|
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def to_dict(self) -> dict[str, Any]:
|
||||||
|
custom_policy_id = self.custom_policy_id
|
||||||
|
|
||||||
|
description = self.description
|
||||||
|
|
||||||
|
label = self.label
|
||||||
|
|
||||||
|
name = self.name
|
||||||
|
|
||||||
|
policy_type = self.policy_type
|
||||||
|
|
||||||
|
|
||||||
|
field_dict: dict[str, Any] = {}
|
||||||
|
field_dict.update(self.additional_properties)
|
||||||
|
field_dict.update({
|
||||||
|
})
|
||||||
|
if custom_policy_id is not UNSET:
|
||||||
|
field_dict["customPolicyId"] = custom_policy_id
|
||||||
|
if description is not UNSET:
|
||||||
|
field_dict["description"] = description
|
||||||
|
if label is not UNSET:
|
||||||
|
field_dict["label"] = label
|
||||||
|
if name is not UNSET:
|
||||||
|
field_dict["name"] = name
|
||||||
|
if policy_type is not UNSET:
|
||||||
|
field_dict["policyType"] = policy_type
|
||||||
|
|
||||||
|
return field_dict
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||||
|
d = dict(src_dict)
|
||||||
|
custom_policy_id = d.pop("customPolicyId", UNSET)
|
||||||
|
|
||||||
|
description = d.pop("description", UNSET)
|
||||||
|
|
||||||
|
label = d.pop("label", UNSET)
|
||||||
|
|
||||||
|
name = d.pop("name", UNSET)
|
||||||
|
|
||||||
|
policy_type = d.pop("policyType", UNSET)
|
||||||
|
|
||||||
|
custom_policy = cls(
|
||||||
|
custom_policy_id=custom_policy_id,
|
||||||
|
description=description,
|
||||||
|
label=label,
|
||||||
|
name=name,
|
||||||
|
policy_type=policy_type,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
custom_policy.additional_properties = d
|
||||||
|
return custom_policy
|
||||||
|
|
||||||
|
@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,113 @@
|
||||||
|
from collections.abc import Mapping
|
||||||
|
from typing import Any, TypeVar, Optional, BinaryIO, TextIO, TYPE_CHECKING, Generator
|
||||||
|
|
||||||
|
from attrs import define as _attrs_define
|
||||||
|
from attrs import field as _attrs_field
|
||||||
|
|
||||||
|
from ..types import UNSET, Unset
|
||||||
|
|
||||||
|
from ..types import UNSET, Unset
|
||||||
|
from typing import Union
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
T = TypeVar("T", bound="CustomPolicyCreateRequest")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@_attrs_define
|
||||||
|
class CustomPolicyCreateRequest:
|
||||||
|
""" This type is used by the request payload of the createCustomPolicy method to define a new custom policy for a
|
||||||
|
specific marketplace.
|
||||||
|
|
||||||
|
Attributes:
|
||||||
|
description (Union[Unset, str]): Contains the seller's policy and policy terms.<br><br><b>Max length:</b> 15,000
|
||||||
|
label (Union[Unset, str]): Customer-facing label shown on View Item pages for items to which the policy applies.
|
||||||
|
This seller-defined string is displayed as a system-generated hyperlink pointing to the seller's policy
|
||||||
|
information.<br><br><b>Max length:</b> 65
|
||||||
|
name (Union[Unset, str]): The seller-defined name for the custom policy. Names must be unique for policies
|
||||||
|
assigned to the same seller and policy type.<br><br><span class="tablenote"><strong>Note:</strong> This field is
|
||||||
|
visible only to the seller. </span><br><b>Max length:</b> 65
|
||||||
|
policy_type (Union[Unset, str]): Specifies the type of custom policy being created. <br><br>Two Custom Policy
|
||||||
|
types are supported: <ul><li>Product Compliance (PRODUCT_COMPLIANCE)</li> <li>Takeback (TAKE_BACK)</li></ul> For
|
||||||
|
implementation help, refer to <a href='https://developer.ebay.com/api-
|
||||||
|
docs/sell/account/types/api:CustomPolicyTypeEnum'>eBay API documentation</a>
|
||||||
|
"""
|
||||||
|
|
||||||
|
description: Union[Unset, str] = UNSET
|
||||||
|
label: Union[Unset, str] = UNSET
|
||||||
|
name: Union[Unset, str] = UNSET
|
||||||
|
policy_type: Union[Unset, str] = UNSET
|
||||||
|
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def to_dict(self) -> dict[str, Any]:
|
||||||
|
description = self.description
|
||||||
|
|
||||||
|
label = self.label
|
||||||
|
|
||||||
|
name = self.name
|
||||||
|
|
||||||
|
policy_type = self.policy_type
|
||||||
|
|
||||||
|
|
||||||
|
field_dict: dict[str, Any] = {}
|
||||||
|
field_dict.update(self.additional_properties)
|
||||||
|
field_dict.update({
|
||||||
|
})
|
||||||
|
if description is not UNSET:
|
||||||
|
field_dict["description"] = description
|
||||||
|
if label is not UNSET:
|
||||||
|
field_dict["label"] = label
|
||||||
|
if name is not UNSET:
|
||||||
|
field_dict["name"] = name
|
||||||
|
if policy_type is not UNSET:
|
||||||
|
field_dict["policyType"] = policy_type
|
||||||
|
|
||||||
|
return field_dict
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||||
|
d = dict(src_dict)
|
||||||
|
description = d.pop("description", UNSET)
|
||||||
|
|
||||||
|
label = d.pop("label", UNSET)
|
||||||
|
|
||||||
|
name = d.pop("name", UNSET)
|
||||||
|
|
||||||
|
policy_type = d.pop("policyType", UNSET)
|
||||||
|
|
||||||
|
custom_policy_create_request = cls(
|
||||||
|
description=description,
|
||||||
|
label=label,
|
||||||
|
name=name,
|
||||||
|
policy_type=policy_type,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
custom_policy_create_request.additional_properties = d
|
||||||
|
return custom_policy_create_request
|
||||||
|
|
||||||
|
@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
|
||||||
109
ebay_client/generated/account/models/custom_policy_request.py
Normal file
109
ebay_client/generated/account/models/custom_policy_request.py
Normal file
|
|
@ -0,0 +1,109 @@
|
||||||
|
from collections.abc import Mapping
|
||||||
|
from typing import Any, TypeVar, Optional, BinaryIO, TextIO, TYPE_CHECKING, Generator
|
||||||
|
|
||||||
|
from attrs import define as _attrs_define
|
||||||
|
from attrs import field as _attrs_field
|
||||||
|
|
||||||
|
from ..types import UNSET, Unset
|
||||||
|
|
||||||
|
from ..types import UNSET, Unset
|
||||||
|
from typing import Union
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
T = TypeVar("T", bound="CustomPolicyRequest")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@_attrs_define
|
||||||
|
class CustomPolicyRequest:
|
||||||
|
"""
|
||||||
|
Attributes:
|
||||||
|
description (Union[Unset, str]): Contains the seller specified policy and policy terms.<br><br><span
|
||||||
|
class="tablenote"><strong>Note:</strong> Always supply this field. If this field is not specified, any previous
|
||||||
|
value is removed. Call the <a href="/api-
|
||||||
|
docs/sell/account/resources/custom_policy/methods/getCustomPolicy">getCustomPolicy</a> method to return the
|
||||||
|
present field value for this policy.</span><br><b>Max length:</b> 15,000
|
||||||
|
label (Union[Unset, str]): Customer-facing label shown on View Item pages for items to which the policy applies.
|
||||||
|
This seller-defined string is displayed as a system-generated hyperlink pointing to seller specified policy
|
||||||
|
information.<br><br><span class="tablenote"><strong>Note:</strong> Always supply this field. If this field is
|
||||||
|
not specified, any previous value is removed. Call the <a href="/api-
|
||||||
|
docs/sell/account/resources/custom_policy/methods/getCustomPolicy">getCustomPolicy</a> method to return the
|
||||||
|
present field value for this policy.</span><br><b>Max length:</b> 65
|
||||||
|
name (Union[Unset, str]): The seller-defined name for the custom policy. Names must be unique for policies
|
||||||
|
assigned to the same seller and policy type.<br><br><span class="tablenote"><strong>Note:</strong> This field is
|
||||||
|
visible only to the seller. </span><br><br><span class="tablenote"><strong>Note:</strong> Always supply this
|
||||||
|
field. If this field is not specified, any previous value is removed. Call the <a href="/api-
|
||||||
|
docs/sell/account/resources/custom_policy/methods/getCustomPolicy">getCustomPolicy</a> method to return the
|
||||||
|
present field value for this policy.</span><br><b>Max length:</b> 65
|
||||||
|
"""
|
||||||
|
|
||||||
|
description: Union[Unset, str] = UNSET
|
||||||
|
label: Union[Unset, str] = UNSET
|
||||||
|
name: Union[Unset, str] = UNSET
|
||||||
|
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def to_dict(self) -> dict[str, Any]:
|
||||||
|
description = self.description
|
||||||
|
|
||||||
|
label = self.label
|
||||||
|
|
||||||
|
name = self.name
|
||||||
|
|
||||||
|
|
||||||
|
field_dict: dict[str, Any] = {}
|
||||||
|
field_dict.update(self.additional_properties)
|
||||||
|
field_dict.update({
|
||||||
|
})
|
||||||
|
if description is not UNSET:
|
||||||
|
field_dict["description"] = description
|
||||||
|
if label is not UNSET:
|
||||||
|
field_dict["label"] = label
|
||||||
|
if name is not UNSET:
|
||||||
|
field_dict["name"] = name
|
||||||
|
|
||||||
|
return field_dict
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||||
|
d = dict(src_dict)
|
||||||
|
description = d.pop("description", UNSET)
|
||||||
|
|
||||||
|
label = d.pop("label", UNSET)
|
||||||
|
|
||||||
|
name = d.pop("name", UNSET)
|
||||||
|
|
||||||
|
custom_policy_request = cls(
|
||||||
|
description=description,
|
||||||
|
label=label,
|
||||||
|
name=name,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
custom_policy_request.additional_properties = d
|
||||||
|
return custom_policy_request
|
||||||
|
|
||||||
|
@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
|
||||||
152
ebay_client/generated/account/models/custom_policy_response.py
Normal file
152
ebay_client/generated/account/models/custom_policy_response.py
Normal file
|
|
@ -0,0 +1,152 @@
|
||||||
|
from collections.abc import Mapping
|
||||||
|
from typing import Any, TypeVar, Optional, BinaryIO, TextIO, TYPE_CHECKING, Generator
|
||||||
|
|
||||||
|
from attrs import define as _attrs_define
|
||||||
|
from attrs import field as _attrs_field
|
||||||
|
|
||||||
|
from ..types import UNSET, Unset
|
||||||
|
|
||||||
|
from ..types import UNSET, Unset
|
||||||
|
from typing import cast
|
||||||
|
from typing import Union
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from ..models.compact_custom_policy_response import CompactCustomPolicyResponse
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
T = TypeVar("T", bound="CustomPolicyResponse")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@_attrs_define
|
||||||
|
class CustomPolicyResponse:
|
||||||
|
"""
|
||||||
|
Attributes:
|
||||||
|
custom_policies (Union[Unset, list['CompactCustomPolicyResponse']]): This array contains the custom policies
|
||||||
|
that match the input criteria.
|
||||||
|
href (Union[Unset, str]): <i>This field is for future use.</i>
|
||||||
|
limit (Union[Unset, int]): <i>This field is for future use.</i>
|
||||||
|
next_ (Union[Unset, str]): <i>This field is for future use.</i>
|
||||||
|
offset (Union[Unset, int]): <i>This field is for future use.</i>
|
||||||
|
prev (Union[Unset, str]): <i>This field is for future use.</i>
|
||||||
|
total (Union[Unset, int]): <i>This field is for future use.</i>
|
||||||
|
"""
|
||||||
|
|
||||||
|
custom_policies: Union[Unset, list['CompactCustomPolicyResponse']] = UNSET
|
||||||
|
href: Union[Unset, str] = UNSET
|
||||||
|
limit: Union[Unset, int] = UNSET
|
||||||
|
next_: Union[Unset, str] = UNSET
|
||||||
|
offset: Union[Unset, int] = UNSET
|
||||||
|
prev: Union[Unset, str] = UNSET
|
||||||
|
total: Union[Unset, int] = UNSET
|
||||||
|
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def to_dict(self) -> dict[str, Any]:
|
||||||
|
from ..models.compact_custom_policy_response import CompactCustomPolicyResponse
|
||||||
|
custom_policies: Union[Unset, list[dict[str, Any]]] = UNSET
|
||||||
|
if not isinstance(self.custom_policies, Unset):
|
||||||
|
custom_policies = []
|
||||||
|
for custom_policies_item_data in self.custom_policies:
|
||||||
|
custom_policies_item = custom_policies_item_data.to_dict()
|
||||||
|
custom_policies.append(custom_policies_item)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
href = self.href
|
||||||
|
|
||||||
|
limit = self.limit
|
||||||
|
|
||||||
|
next_ = self.next_
|
||||||
|
|
||||||
|
offset = self.offset
|
||||||
|
|
||||||
|
prev = self.prev
|
||||||
|
|
||||||
|
total = self.total
|
||||||
|
|
||||||
|
|
||||||
|
field_dict: dict[str, Any] = {}
|
||||||
|
field_dict.update(self.additional_properties)
|
||||||
|
field_dict.update({
|
||||||
|
})
|
||||||
|
if custom_policies is not UNSET:
|
||||||
|
field_dict["customPolicies"] = custom_policies
|
||||||
|
if href is not UNSET:
|
||||||
|
field_dict["href"] = href
|
||||||
|
if limit is not UNSET:
|
||||||
|
field_dict["limit"] = limit
|
||||||
|
if next_ is not UNSET:
|
||||||
|
field_dict["next"] = next_
|
||||||
|
if offset is not UNSET:
|
||||||
|
field_dict["offset"] = offset
|
||||||
|
if prev is not UNSET:
|
||||||
|
field_dict["prev"] = prev
|
||||||
|
if total is not UNSET:
|
||||||
|
field_dict["total"] = total
|
||||||
|
|
||||||
|
return field_dict
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||||
|
from ..models.compact_custom_policy_response import CompactCustomPolicyResponse
|
||||||
|
d = dict(src_dict)
|
||||||
|
custom_policies = []
|
||||||
|
_custom_policies = d.pop("customPolicies", UNSET)
|
||||||
|
for custom_policies_item_data in (_custom_policies or []):
|
||||||
|
custom_policies_item = CompactCustomPolicyResponse.from_dict(custom_policies_item_data)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
custom_policies.append(custom_policies_item)
|
||||||
|
|
||||||
|
|
||||||
|
href = d.pop("href", UNSET)
|
||||||
|
|
||||||
|
limit = d.pop("limit", UNSET)
|
||||||
|
|
||||||
|
next_ = d.pop("next", UNSET)
|
||||||
|
|
||||||
|
offset = d.pop("offset", UNSET)
|
||||||
|
|
||||||
|
prev = d.pop("prev", UNSET)
|
||||||
|
|
||||||
|
total = d.pop("total", UNSET)
|
||||||
|
|
||||||
|
custom_policy_response = cls(
|
||||||
|
custom_policies=custom_policies,
|
||||||
|
href=href,
|
||||||
|
limit=limit,
|
||||||
|
next_=next_,
|
||||||
|
offset=offset,
|
||||||
|
prev=prev,
|
||||||
|
total=total,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
custom_policy_response.additional_properties = d
|
||||||
|
return custom_policy_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
|
||||||
149
ebay_client/generated/account/models/deposit.py
Normal file
149
ebay_client/generated/account/models/deposit.py
Normal file
|
|
@ -0,0 +1,149 @@
|
||||||
|
from collections.abc import Mapping
|
||||||
|
from typing import Any, TypeVar, Optional, BinaryIO, TextIO, TYPE_CHECKING, Generator
|
||||||
|
|
||||||
|
from attrs import define as _attrs_define
|
||||||
|
from attrs import field as _attrs_field
|
||||||
|
|
||||||
|
from ..types import UNSET, Unset
|
||||||
|
|
||||||
|
from ..types import UNSET, Unset
|
||||||
|
from typing import cast
|
||||||
|
from typing import Union
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from ..models.payment_method import PaymentMethod
|
||||||
|
from ..models.amount import Amount
|
||||||
|
from ..models.time_duration import TimeDuration
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
T = TypeVar("T", bound="Deposit")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@_attrs_define
|
||||||
|
class Deposit:
|
||||||
|
""" This type is used to specify/indicate that an initial deposit is required for a motor vehicle listing.
|
||||||
|
|
||||||
|
Attributes:
|
||||||
|
amount (Union[Unset, Amount]): A complex type that describes the value of a monetary amount as represented by a
|
||||||
|
global currency. When passing in an amount in a request payload, both <b>currency</b> and <b>value</b> fields
|
||||||
|
are required, and both fields are also always returned for an amount in a response field.
|
||||||
|
due_in (Union[Unset, TimeDuration]): A type used to specify a period of time using a specified time-measurement
|
||||||
|
unit. Payment, return, and fulfillment business policies all use this type to specify time
|
||||||
|
windows.<br><br>Whenever a container that uses this type is used in a request, both of these fields are
|
||||||
|
required. Similarly, whenever a container that uses this type is returned in a response, both of these fields
|
||||||
|
are always returned.
|
||||||
|
payment_methods (Union[Unset, list['PaymentMethod']]): This array is no longer applicable and should not be used
|
||||||
|
since eBay now manages the electronic payment options available to buyers to pay the deposit.
|
||||||
|
"""
|
||||||
|
|
||||||
|
amount: Union[Unset, 'Amount'] = UNSET
|
||||||
|
due_in: Union[Unset, 'TimeDuration'] = UNSET
|
||||||
|
payment_methods: Union[Unset, list['PaymentMethod']] = UNSET
|
||||||
|
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def to_dict(self) -> dict[str, Any]:
|
||||||
|
from ..models.payment_method import PaymentMethod
|
||||||
|
from ..models.amount import Amount
|
||||||
|
from ..models.time_duration import TimeDuration
|
||||||
|
amount: Union[Unset, dict[str, Any]] = UNSET
|
||||||
|
if not isinstance(self.amount, Unset):
|
||||||
|
amount = self.amount.to_dict()
|
||||||
|
|
||||||
|
due_in: Union[Unset, dict[str, Any]] = UNSET
|
||||||
|
if not isinstance(self.due_in, Unset):
|
||||||
|
due_in = self.due_in.to_dict()
|
||||||
|
|
||||||
|
payment_methods: Union[Unset, list[dict[str, Any]]] = UNSET
|
||||||
|
if not isinstance(self.payment_methods, Unset):
|
||||||
|
payment_methods = []
|
||||||
|
for payment_methods_item_data in self.payment_methods:
|
||||||
|
payment_methods_item = payment_methods_item_data.to_dict()
|
||||||
|
payment_methods.append(payment_methods_item)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
field_dict: dict[str, Any] = {}
|
||||||
|
field_dict.update(self.additional_properties)
|
||||||
|
field_dict.update({
|
||||||
|
})
|
||||||
|
if amount is not UNSET:
|
||||||
|
field_dict["amount"] = amount
|
||||||
|
if due_in is not UNSET:
|
||||||
|
field_dict["dueIn"] = due_in
|
||||||
|
if payment_methods is not UNSET:
|
||||||
|
field_dict["paymentMethods"] = payment_methods
|
||||||
|
|
||||||
|
return field_dict
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||||
|
from ..models.payment_method import PaymentMethod
|
||||||
|
from ..models.amount import Amount
|
||||||
|
from ..models.time_duration import TimeDuration
|
||||||
|
d = dict(src_dict)
|
||||||
|
_amount = d.pop("amount", UNSET)
|
||||||
|
amount: Union[Unset, Amount]
|
||||||
|
if isinstance(_amount, Unset):
|
||||||
|
amount = UNSET
|
||||||
|
else:
|
||||||
|
amount = Amount.from_dict(_amount)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
_due_in = d.pop("dueIn", UNSET)
|
||||||
|
due_in: Union[Unset, TimeDuration]
|
||||||
|
if isinstance(_due_in, Unset):
|
||||||
|
due_in = UNSET
|
||||||
|
else:
|
||||||
|
due_in = TimeDuration.from_dict(_due_in)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
payment_methods = []
|
||||||
|
_payment_methods = d.pop("paymentMethods", UNSET)
|
||||||
|
for payment_methods_item_data in (_payment_methods or []):
|
||||||
|
payment_methods_item = PaymentMethod.from_dict(payment_methods_item_data)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
payment_methods.append(payment_methods_item)
|
||||||
|
|
||||||
|
|
||||||
|
deposit = cls(
|
||||||
|
amount=amount,
|
||||||
|
due_in=due_in,
|
||||||
|
payment_methods=payment_methods,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
deposit.additional_properties = d
|
||||||
|
return deposit
|
||||||
|
|
||||||
|
@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
|
||||||
198
ebay_client/generated/account/models/error.py
Normal file
198
ebay_client/generated/account/models/error.py
Normal file
|
|
@ -0,0 +1,198 @@
|
||||||
|
from collections.abc import Mapping
|
||||||
|
from typing import Any, TypeVar, Optional, BinaryIO, TextIO, TYPE_CHECKING, Generator
|
||||||
|
|
||||||
|
from attrs import define as _attrs_define
|
||||||
|
from attrs import field as _attrs_field
|
||||||
|
|
||||||
|
from ..types import UNSET, Unset
|
||||||
|
|
||||||
|
from ..types import UNSET, Unset
|
||||||
|
from typing import cast
|
||||||
|
from typing import Union
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from ..models.error_parameter import ErrorParameter
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
T = TypeVar("T", bound="Error")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@_attrs_define
|
||||||
|
class Error:
|
||||||
|
""" A container that defines the elements of error and warning messages.
|
||||||
|
|
||||||
|
Attributes:
|
||||||
|
category (Union[Unset, str]): The category type for this error or warning. It is a string that can have one of
|
||||||
|
three values:<ul><li><code>Application</code>: Indicates an exception or error occurred in the application code
|
||||||
|
or at runtime. Examples include catching an exception in a service's business logic, system failures, or request
|
||||||
|
errors from a dependency.</li><li><code>Business</code>: Used when your service or a dependent service refused
|
||||||
|
to continue processing on the resource because of a business rule violation such as "Seller does not ship item
|
||||||
|
to Antarctica" or "Buyer ineligible to purchase an alcoholic item". Business errors are not syntactical input
|
||||||
|
errors.</li><li><code>Request</code>: Used when there is anything wrong with the request, such as
|
||||||
|
authentication, syntactical errors, rate limiting or missing headers, bad HTTP header values, and so
|
||||||
|
on.</li></ul>
|
||||||
|
domain (Union[Unset, str]): Name of the domain ,or primary system, of the service or application where the error
|
||||||
|
occurred.
|
||||||
|
error_id (Union[Unset, int]): A positive integer that uniquely identifies the specific error condition that
|
||||||
|
occurred. Your application can use error codes as identifiers in your customized error-handling algorithms.
|
||||||
|
input_ref_ids (Union[Unset, list[str]]): Identifies specific request elements associated with the error, if any.
|
||||||
|
inputRefId's response is format specific. For JSON, use <i>JSONPath</i> notation.
|
||||||
|
long_message (Union[Unset, str]): A more detailed explanation of the error than given in the
|
||||||
|
<code>message</code> error field.
|
||||||
|
message (Union[Unset, str]): Information on how to correct the problem, in the end user's terms and language
|
||||||
|
where applicable. Its value is at most 50 characters long. If applicable, the value is localized in the end
|
||||||
|
user's requested locale.
|
||||||
|
output_ref_ids (Union[Unset, list[str]]): Identifies specific response elements associated with the error, if
|
||||||
|
any. Path format is the same as <code>inputRefId</code>.
|
||||||
|
parameters (Union[Unset, list['ErrorParameter']]): This optional list of name/value pairs that contain context-
|
||||||
|
specific <code>ErrorParameter</code> objects, with each item in the list being a parameter (or input field name)
|
||||||
|
that caused an error condition. Each <code>ErrorParameter</code> object consists of two fields, a
|
||||||
|
<code>name</code> and a <code>value</code>.
|
||||||
|
subdomain (Union[Unset, str]): If present, indicates the subsystem in which the error occurred.
|
||||||
|
"""
|
||||||
|
|
||||||
|
category: Union[Unset, str] = UNSET
|
||||||
|
domain: Union[Unset, str] = UNSET
|
||||||
|
error_id: Union[Unset, int] = UNSET
|
||||||
|
input_ref_ids: Union[Unset, list[str]] = UNSET
|
||||||
|
long_message: Union[Unset, str] = UNSET
|
||||||
|
message: Union[Unset, str] = UNSET
|
||||||
|
output_ref_ids: Union[Unset, list[str]] = UNSET
|
||||||
|
parameters: Union[Unset, list['ErrorParameter']] = UNSET
|
||||||
|
subdomain: Union[Unset, str] = UNSET
|
||||||
|
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def to_dict(self) -> dict[str, Any]:
|
||||||
|
from ..models.error_parameter import ErrorParameter
|
||||||
|
category = self.category
|
||||||
|
|
||||||
|
domain = self.domain
|
||||||
|
|
||||||
|
error_id = self.error_id
|
||||||
|
|
||||||
|
input_ref_ids: Union[Unset, list[str]] = UNSET
|
||||||
|
if not isinstance(self.input_ref_ids, Unset):
|
||||||
|
input_ref_ids = self.input_ref_ids
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
long_message = self.long_message
|
||||||
|
|
||||||
|
message = self.message
|
||||||
|
|
||||||
|
output_ref_ids: Union[Unset, list[str]] = UNSET
|
||||||
|
if not isinstance(self.output_ref_ids, Unset):
|
||||||
|
output_ref_ids = self.output_ref_ids
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
parameters: Union[Unset, list[dict[str, Any]]] = UNSET
|
||||||
|
if not isinstance(self.parameters, Unset):
|
||||||
|
parameters = []
|
||||||
|
for parameters_item_data in self.parameters:
|
||||||
|
parameters_item = parameters_item_data.to_dict()
|
||||||
|
parameters.append(parameters_item)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
subdomain = self.subdomain
|
||||||
|
|
||||||
|
|
||||||
|
field_dict: dict[str, Any] = {}
|
||||||
|
field_dict.update(self.additional_properties)
|
||||||
|
field_dict.update({
|
||||||
|
})
|
||||||
|
if category is not UNSET:
|
||||||
|
field_dict["category"] = category
|
||||||
|
if domain is not UNSET:
|
||||||
|
field_dict["domain"] = domain
|
||||||
|
if error_id is not UNSET:
|
||||||
|
field_dict["errorId"] = error_id
|
||||||
|
if input_ref_ids is not UNSET:
|
||||||
|
field_dict["inputRefIds"] = input_ref_ids
|
||||||
|
if long_message is not UNSET:
|
||||||
|
field_dict["longMessage"] = long_message
|
||||||
|
if message is not UNSET:
|
||||||
|
field_dict["message"] = message
|
||||||
|
if output_ref_ids is not UNSET:
|
||||||
|
field_dict["outputRefIds"] = output_ref_ids
|
||||||
|
if parameters is not UNSET:
|
||||||
|
field_dict["parameters"] = parameters
|
||||||
|
if subdomain is not UNSET:
|
||||||
|
field_dict["subdomain"] = subdomain
|
||||||
|
|
||||||
|
return field_dict
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||||
|
from ..models.error_parameter import ErrorParameter
|
||||||
|
d = dict(src_dict)
|
||||||
|
category = d.pop("category", UNSET)
|
||||||
|
|
||||||
|
domain = d.pop("domain", UNSET)
|
||||||
|
|
||||||
|
error_id = d.pop("errorId", UNSET)
|
||||||
|
|
||||||
|
input_ref_ids = cast(list[str], d.pop("inputRefIds", UNSET))
|
||||||
|
|
||||||
|
|
||||||
|
long_message = d.pop("longMessage", UNSET)
|
||||||
|
|
||||||
|
message = d.pop("message", UNSET)
|
||||||
|
|
||||||
|
output_ref_ids = cast(list[str], d.pop("outputRefIds", UNSET))
|
||||||
|
|
||||||
|
|
||||||
|
parameters = []
|
||||||
|
_parameters = d.pop("parameters", UNSET)
|
||||||
|
for parameters_item_data in (_parameters or []):
|
||||||
|
parameters_item = ErrorParameter.from_dict(parameters_item_data)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
parameters.append(parameters_item)
|
||||||
|
|
||||||
|
|
||||||
|
subdomain = d.pop("subdomain", UNSET)
|
||||||
|
|
||||||
|
error = cls(
|
||||||
|
category=category,
|
||||||
|
domain=domain,
|
||||||
|
error_id=error_id,
|
||||||
|
input_ref_ids=input_ref_ids,
|
||||||
|
long_message=long_message,
|
||||||
|
message=message,
|
||||||
|
output_ref_ids=output_ref_ids,
|
||||||
|
parameters=parameters,
|
||||||
|
subdomain=subdomain,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
error.additional_properties = d
|
||||||
|
return error
|
||||||
|
|
||||||
|
@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
|
||||||
88
ebay_client/generated/account/models/error_parameter.py
Normal file
88
ebay_client/generated/account/models/error_parameter.py
Normal file
|
|
@ -0,0 +1,88 @@
|
||||||
|
from collections.abc import Mapping
|
||||||
|
from typing import Any, TypeVar, Optional, BinaryIO, TextIO, TYPE_CHECKING, Generator
|
||||||
|
|
||||||
|
from attrs import define as _attrs_define
|
||||||
|
from attrs import field as _attrs_field
|
||||||
|
|
||||||
|
from ..types import UNSET, Unset
|
||||||
|
|
||||||
|
from ..types import UNSET, Unset
|
||||||
|
from typing import Union
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
T = TypeVar("T", bound="ErrorParameter")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@_attrs_define
|
||||||
|
class ErrorParameter:
|
||||||
|
""" A complex type that indicates a parameter that caused an error and the value of the parameter which caused the
|
||||||
|
error.
|
||||||
|
|
||||||
|
Attributes:
|
||||||
|
name (Union[Unset, str]): Name of the parameter that caused the error.
|
||||||
|
value (Union[Unset, str]): The value of the parameter that caused the error.
|
||||||
|
"""
|
||||||
|
|
||||||
|
name: Union[Unset, str] = UNSET
|
||||||
|
value: Union[Unset, str] = UNSET
|
||||||
|
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def to_dict(self) -> dict[str, Any]:
|
||||||
|
name = self.name
|
||||||
|
|
||||||
|
value = self.value
|
||||||
|
|
||||||
|
|
||||||
|
field_dict: dict[str, Any] = {}
|
||||||
|
field_dict.update(self.additional_properties)
|
||||||
|
field_dict.update({
|
||||||
|
})
|
||||||
|
if name is not UNSET:
|
||||||
|
field_dict["name"] = name
|
||||||
|
if value is not UNSET:
|
||||||
|
field_dict["value"] = value
|
||||||
|
|
||||||
|
return field_dict
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||||
|
d = dict(src_dict)
|
||||||
|
name = d.pop("name", UNSET)
|
||||||
|
|
||||||
|
value = d.pop("value", UNSET)
|
||||||
|
|
||||||
|
error_parameter = cls(
|
||||||
|
name=name,
|
||||||
|
value=value,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
error_parameter.additional_properties = d
|
||||||
|
return error_parameter
|
||||||
|
|
||||||
|
@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
|
||||||
270
ebay_client/generated/account/models/fulfillment_policy.py
Normal file
270
ebay_client/generated/account/models/fulfillment_policy.py
Normal file
|
|
@ -0,0 +1,270 @@
|
||||||
|
from collections.abc import Mapping
|
||||||
|
from typing import Any, TypeVar, Optional, BinaryIO, TextIO, TYPE_CHECKING, Generator
|
||||||
|
|
||||||
|
from attrs import define as _attrs_define
|
||||||
|
from attrs import field as _attrs_field
|
||||||
|
|
||||||
|
from ..types import UNSET, Unset
|
||||||
|
|
||||||
|
from ..types import UNSET, Unset
|
||||||
|
from typing import cast
|
||||||
|
from typing import Union
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from ..models.shipping_option import ShippingOption
|
||||||
|
from ..models.category_type import CategoryType
|
||||||
|
from ..models.time_duration import TimeDuration
|
||||||
|
from ..models.region_set import RegionSet
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
T = TypeVar("T", bound="FulfillmentPolicy")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@_attrs_define
|
||||||
|
class FulfillmentPolicy:
|
||||||
|
""" This type is used by the <b>fulfillmentPolicy</b> response container, a container which defines a seller's
|
||||||
|
fulfillment policy for a specific marketplace.
|
||||||
|
|
||||||
|
Attributes:
|
||||||
|
category_types (Union[Unset, list['CategoryType']]): This container indicates whether the fulfillment policy
|
||||||
|
applies to motor vehicle listings, or if it applies to non-motor vehicle listings.
|
||||||
|
description (Union[Unset, str]): A seller-defined description of the fulfillment policy. This description is
|
||||||
|
only for the seller's use, and is not exposed on any eBay pages. This field is returned if set for the policy.
|
||||||
|
<br><br><b>Max length</b>: 250
|
||||||
|
freight_shipping (Union[Unset, bool]): If returned as <code>true</code>, the seller offers freight shipping.
|
||||||
|
Freight shipping can be used for large items over 150 lbs.
|
||||||
|
fulfillment_policy_id (Union[Unset, str]): A unique eBay-assigned ID for the fulfillment policy. This ID is
|
||||||
|
generated when the policy is created.
|
||||||
|
global_shipping (Union[Unset, bool]): <span class="tablenote"><b>Note</b>: This field is only applicable for the
|
||||||
|
eBay United Kingdom marketplace (<code>EBAY_GB</code>).</span><br>If returned as <code>true</code>, eBay's
|
||||||
|
Global Shipping Program will be used by the seller to ship items to international locations.<br><br>eBay
|
||||||
|
International Shipping is an account level setting; no field needs to be set in a Fulfillment business policy to
|
||||||
|
enable eBay International Shipping. If a US seller's account is opted in to eBay International Shipping, this
|
||||||
|
shipping option will be enabled automatically for all listings where international shipping is available. A US
|
||||||
|
seller who is opted in to eBay International Shipping can also specify individual international shipping service
|
||||||
|
options for a Fulfillment business policy.
|
||||||
|
handling_time (Union[Unset, TimeDuration]): A type used to specify a period of time using a specified time-
|
||||||
|
measurement unit. Payment, return, and fulfillment business policies all use this type to specify time
|
||||||
|
windows.<br><br>Whenever a container that uses this type is used in a request, both of these fields are
|
||||||
|
required. Similarly, whenever a container that uses this type is returned in a response, both of these fields
|
||||||
|
are always returned.
|
||||||
|
local_pickup (Union[Unset, bool]): If returned as <code>true</code>, local pickup is available for this policy.
|
||||||
|
marketplace_id (Union[Unset, str]): The ID of the eBay marketplace to which this fulfillment policy applies. For
|
||||||
|
implementation help, refer to <a href='https://developer.ebay.com/api-
|
||||||
|
docs/sell/account/types/ba:MarketplaceIdEnum'>eBay API documentation</a>
|
||||||
|
name (Union[Unset, str]): A seller-defined name for this fulfillment policy. Names must be unique for policies
|
||||||
|
assigned to the same marketplace. <br><br><b>Max length</b>: 64
|
||||||
|
pickup_drop_off (Union[Unset, bool]): If returned as <code>true</code>, the seller offers the "Click and
|
||||||
|
Collect" option. <br><br>Currently, "Click and Collect" is available only to large retail merchants the eBay AU,
|
||||||
|
UK, DE, FR, and IT marketplaces.
|
||||||
|
shipping_options (Union[Unset, list['ShippingOption']]): This array is used to provide detailed information on
|
||||||
|
the domestic and international shipping options available for the policy. A separate <b>ShippingOption</b>
|
||||||
|
object covers domestic shipping service options and international shipping service options (if the seller ships
|
||||||
|
to international locations). <br><br>The <b>optionType</b> field indicates whether the <b>ShippingOption</b>
|
||||||
|
object applies to domestic or international shipping, and the <b>costType</b> field indicates whether flat-rate
|
||||||
|
shipping or calculated shipping will be used. <p>A separate <b>ShippingServices</b> object is used to specify
|
||||||
|
cost and other details for every available domestic and international shipping service option. </p>
|
||||||
|
ship_to_locations (Union[Unset, RegionSet]): This type consists of the <b>regionIncluded</b> and
|
||||||
|
<b>regionExcluded</b> arrays, which indicate the areas to where the seller does and doesn't ship.
|
||||||
|
"""
|
||||||
|
|
||||||
|
category_types: Union[Unset, list['CategoryType']] = UNSET
|
||||||
|
description: Union[Unset, str] = UNSET
|
||||||
|
freight_shipping: Union[Unset, bool] = UNSET
|
||||||
|
fulfillment_policy_id: Union[Unset, str] = UNSET
|
||||||
|
global_shipping: Union[Unset, bool] = UNSET
|
||||||
|
handling_time: Union[Unset, 'TimeDuration'] = UNSET
|
||||||
|
local_pickup: Union[Unset, bool] = UNSET
|
||||||
|
marketplace_id: Union[Unset, str] = UNSET
|
||||||
|
name: Union[Unset, str] = UNSET
|
||||||
|
pickup_drop_off: Union[Unset, bool] = UNSET
|
||||||
|
shipping_options: Union[Unset, list['ShippingOption']] = UNSET
|
||||||
|
ship_to_locations: Union[Unset, 'RegionSet'] = UNSET
|
||||||
|
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def to_dict(self) -> dict[str, Any]:
|
||||||
|
from ..models.shipping_option import ShippingOption
|
||||||
|
from ..models.category_type import CategoryType
|
||||||
|
from ..models.time_duration import TimeDuration
|
||||||
|
from ..models.region_set import RegionSet
|
||||||
|
category_types: Union[Unset, list[dict[str, Any]]] = UNSET
|
||||||
|
if not isinstance(self.category_types, Unset):
|
||||||
|
category_types = []
|
||||||
|
for category_types_item_data in self.category_types:
|
||||||
|
category_types_item = category_types_item_data.to_dict()
|
||||||
|
category_types.append(category_types_item)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
description = self.description
|
||||||
|
|
||||||
|
freight_shipping = self.freight_shipping
|
||||||
|
|
||||||
|
fulfillment_policy_id = self.fulfillment_policy_id
|
||||||
|
|
||||||
|
global_shipping = self.global_shipping
|
||||||
|
|
||||||
|
handling_time: Union[Unset, dict[str, Any]] = UNSET
|
||||||
|
if not isinstance(self.handling_time, Unset):
|
||||||
|
handling_time = self.handling_time.to_dict()
|
||||||
|
|
||||||
|
local_pickup = self.local_pickup
|
||||||
|
|
||||||
|
marketplace_id = self.marketplace_id
|
||||||
|
|
||||||
|
name = self.name
|
||||||
|
|
||||||
|
pickup_drop_off = self.pickup_drop_off
|
||||||
|
|
||||||
|
shipping_options: Union[Unset, list[dict[str, Any]]] = UNSET
|
||||||
|
if not isinstance(self.shipping_options, Unset):
|
||||||
|
shipping_options = []
|
||||||
|
for shipping_options_item_data in self.shipping_options:
|
||||||
|
shipping_options_item = shipping_options_item_data.to_dict()
|
||||||
|
shipping_options.append(shipping_options_item)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ship_to_locations: Union[Unset, dict[str, Any]] = UNSET
|
||||||
|
if not isinstance(self.ship_to_locations, Unset):
|
||||||
|
ship_to_locations = self.ship_to_locations.to_dict()
|
||||||
|
|
||||||
|
|
||||||
|
field_dict: dict[str, Any] = {}
|
||||||
|
field_dict.update(self.additional_properties)
|
||||||
|
field_dict.update({
|
||||||
|
})
|
||||||
|
if category_types is not UNSET:
|
||||||
|
field_dict["categoryTypes"] = category_types
|
||||||
|
if description is not UNSET:
|
||||||
|
field_dict["description"] = description
|
||||||
|
if freight_shipping is not UNSET:
|
||||||
|
field_dict["freightShipping"] = freight_shipping
|
||||||
|
if fulfillment_policy_id is not UNSET:
|
||||||
|
field_dict["fulfillmentPolicyId"] = fulfillment_policy_id
|
||||||
|
if global_shipping is not UNSET:
|
||||||
|
field_dict["globalShipping"] = global_shipping
|
||||||
|
if handling_time is not UNSET:
|
||||||
|
field_dict["handlingTime"] = handling_time
|
||||||
|
if local_pickup is not UNSET:
|
||||||
|
field_dict["localPickup"] = local_pickup
|
||||||
|
if marketplace_id is not UNSET:
|
||||||
|
field_dict["marketplaceId"] = marketplace_id
|
||||||
|
if name is not UNSET:
|
||||||
|
field_dict["name"] = name
|
||||||
|
if pickup_drop_off is not UNSET:
|
||||||
|
field_dict["pickupDropOff"] = pickup_drop_off
|
||||||
|
if shipping_options is not UNSET:
|
||||||
|
field_dict["shippingOptions"] = shipping_options
|
||||||
|
if ship_to_locations is not UNSET:
|
||||||
|
field_dict["shipToLocations"] = ship_to_locations
|
||||||
|
|
||||||
|
return field_dict
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||||
|
from ..models.shipping_option import ShippingOption
|
||||||
|
from ..models.category_type import CategoryType
|
||||||
|
from ..models.time_duration import TimeDuration
|
||||||
|
from ..models.region_set import RegionSet
|
||||||
|
d = dict(src_dict)
|
||||||
|
category_types = []
|
||||||
|
_category_types = d.pop("categoryTypes", UNSET)
|
||||||
|
for category_types_item_data in (_category_types or []):
|
||||||
|
category_types_item = CategoryType.from_dict(category_types_item_data)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
category_types.append(category_types_item)
|
||||||
|
|
||||||
|
|
||||||
|
description = d.pop("description", UNSET)
|
||||||
|
|
||||||
|
freight_shipping = d.pop("freightShipping", UNSET)
|
||||||
|
|
||||||
|
fulfillment_policy_id = d.pop("fulfillmentPolicyId", UNSET)
|
||||||
|
|
||||||
|
global_shipping = d.pop("globalShipping", UNSET)
|
||||||
|
|
||||||
|
_handling_time = d.pop("handlingTime", UNSET)
|
||||||
|
handling_time: Union[Unset, TimeDuration]
|
||||||
|
if isinstance(_handling_time, Unset):
|
||||||
|
handling_time = UNSET
|
||||||
|
else:
|
||||||
|
handling_time = TimeDuration.from_dict(_handling_time)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
local_pickup = d.pop("localPickup", UNSET)
|
||||||
|
|
||||||
|
marketplace_id = d.pop("marketplaceId", UNSET)
|
||||||
|
|
||||||
|
name = d.pop("name", UNSET)
|
||||||
|
|
||||||
|
pickup_drop_off = d.pop("pickupDropOff", UNSET)
|
||||||
|
|
||||||
|
shipping_options = []
|
||||||
|
_shipping_options = d.pop("shippingOptions", UNSET)
|
||||||
|
for shipping_options_item_data in (_shipping_options or []):
|
||||||
|
shipping_options_item = ShippingOption.from_dict(shipping_options_item_data)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
shipping_options.append(shipping_options_item)
|
||||||
|
|
||||||
|
|
||||||
|
_ship_to_locations = d.pop("shipToLocations", UNSET)
|
||||||
|
ship_to_locations: Union[Unset, RegionSet]
|
||||||
|
if isinstance(_ship_to_locations, Unset):
|
||||||
|
ship_to_locations = UNSET
|
||||||
|
else:
|
||||||
|
ship_to_locations = RegionSet.from_dict(_ship_to_locations)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
fulfillment_policy = cls(
|
||||||
|
category_types=category_types,
|
||||||
|
description=description,
|
||||||
|
freight_shipping=freight_shipping,
|
||||||
|
fulfillment_policy_id=fulfillment_policy_id,
|
||||||
|
global_shipping=global_shipping,
|
||||||
|
handling_time=handling_time,
|
||||||
|
local_pickup=local_pickup,
|
||||||
|
marketplace_id=marketplace_id,
|
||||||
|
name=name,
|
||||||
|
pickup_drop_off=pickup_drop_off,
|
||||||
|
shipping_options=shipping_options,
|
||||||
|
ship_to_locations=ship_to_locations,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
fulfillment_policy.additional_properties = d
|
||||||
|
return fulfillment_policy
|
||||||
|
|
||||||
|
@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,284 @@
|
||||||
|
from collections.abc import Mapping
|
||||||
|
from typing import Any, TypeVar, Optional, BinaryIO, TextIO, TYPE_CHECKING, Generator
|
||||||
|
|
||||||
|
from attrs import define as _attrs_define
|
||||||
|
from attrs import field as _attrs_field
|
||||||
|
|
||||||
|
from ..types import UNSET, Unset
|
||||||
|
|
||||||
|
from ..types import UNSET, Unset
|
||||||
|
from typing import cast
|
||||||
|
from typing import Union
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from ..models.shipping_option import ShippingOption
|
||||||
|
from ..models.category_type import CategoryType
|
||||||
|
from ..models.time_duration import TimeDuration
|
||||||
|
from ..models.region_set import RegionSet
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
T = TypeVar("T", bound="FulfillmentPolicyRequest")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@_attrs_define
|
||||||
|
class FulfillmentPolicyRequest:
|
||||||
|
""" This root container defines a seller's fulfillment policy for a specific marketplace and category group. This type
|
||||||
|
is used when creating or updating a fulfillment business policy.
|
||||||
|
|
||||||
|
Attributes:
|
||||||
|
category_types (Union[Unset, list['CategoryType']]): This container is used to specify whether the fulfillment
|
||||||
|
business policy applies to motor vehicle listings, or if it applies to non-motor vehicle listings.
|
||||||
|
description (Union[Unset, str]): A seller-defined description of the fulfillment policy. This description is
|
||||||
|
only for the seller's use, and is not exposed on any eBay pages. <br><br><b>Max length</b>: 250
|
||||||
|
freight_shipping (Union[Unset, bool]): This field is included and set to <code>true</code> if freight shipping
|
||||||
|
is available for the item. Freight shipping can be used for large items over 150 lbs.<br><br><b>Default</b>:
|
||||||
|
false
|
||||||
|
global_shipping (Union[Unset, bool]): <span class="tablenote"><b>Note</b>: This field is only applicable for the
|
||||||
|
eBay United Kingdom marketplace (<code>EBAY_GB</code>).</span><br>This field is included and set to
|
||||||
|
<code>true</code> if the seller wants to use the Global Shipping Program for international shipments. See the <a
|
||||||
|
href="https://pages.ebay.com/help/sell/shipping-globally.html ">Global Shipping Program</a> help topic for more
|
||||||
|
details and requirements on the Global Shipping Program.<br><br>A seller can use a combination of the Global
|
||||||
|
Shipping Program and other international shipping services. <br><br>If set to <code>false</code> or if the field
|
||||||
|
is omitted, the seller has to manually specifying individual international shipping services (if the seller
|
||||||
|
ships internationally), as described in <a href="https://developer.ebay.com/api-docs/sell/static/seller-
|
||||||
|
accounts/ht_shipping-worldwide.html ">Setting up worldwide shipping</a>. <br><br>Sellers opt in or out of the
|
||||||
|
Global Shipping Program through the Shipping preferences in My eBay.<br><br>eBay International Shipping is an
|
||||||
|
account level setting; no field needs to be set in a Fulfillment business policy to enable eBay International
|
||||||
|
Shipping. If a US seller's account is opted in to eBay International Shipping, this shipping option will be
|
||||||
|
enabled automatically for all listings where international shipping is available. A US seller who is opted in to
|
||||||
|
eBay International Shipping can also specify individual international shipping service options for a Fulfillment
|
||||||
|
business policy.<p><b>Default</b>: false</p>
|
||||||
|
handling_time (Union[Unset, TimeDuration]): A type used to specify a period of time using a specified time-
|
||||||
|
measurement unit. Payment, return, and fulfillment business policies all use this type to specify time
|
||||||
|
windows.<br><br>Whenever a container that uses this type is used in a request, both of these fields are
|
||||||
|
required. Similarly, whenever a container that uses this type is returned in a response, both of these fields
|
||||||
|
are always returned.
|
||||||
|
local_pickup (Union[Unset, bool]): This field should be included and set to <code>true</code> if local pickup is
|
||||||
|
one of the fulfillment options available to the buyer. It is possible for the seller to make local pickup and
|
||||||
|
some shipping service options available to the buyer.<br><br>With local pickup, the buyer and seller make
|
||||||
|
arrangements for pickup time and location.<br><br><b>Default</b>: <code>false</code>
|
||||||
|
marketplace_id (Union[Unset, str]): The ID of the eBay marketplace to which this fulfillment policy applies. For
|
||||||
|
implementation help, refer to <a href='https://developer.ebay.com/api-
|
||||||
|
docs/sell/account/types/ba:MarketplaceIdEnum'>eBay API documentation</a>
|
||||||
|
name (Union[Unset, str]): A seller-defined name for this fulfillment policy. Names must be unique for policies
|
||||||
|
assigned to the same marketplace. <br><br><b>Max length</b>: 64
|
||||||
|
pickup_drop_off (Union[Unset, bool]): This field should be included and set to <code>true</code> if the seller
|
||||||
|
offers the "Click and Collect" feature for an item. <p>To enable "Click and Collect" on a listing, a seller must
|
||||||
|
be eligible for Click and Collect. Currently, Click and Collect is available to only large retail merchants
|
||||||
|
selling in the eBay AU, UK, DE, FR, and IT marketplaces.</p> <p>In addition to setting this field to
|
||||||
|
<code>true</code>, the merchant must also do the following to enable the "Click and Collect" option on a
|
||||||
|
listing: <ul><li>Have inventory for the product at one or more physical stores tied to the merchant's account.
|
||||||
|
<p>Sellers can use the <b>createInventoryLocation</b> method in the Inventory API to associate physical stores
|
||||||
|
to their account and they can then add inventory to specific store locations.</p></li><li>Set an immediate
|
||||||
|
payment requirement on the item. The immediate payment feature requires the seller to: <ul><li>Set the
|
||||||
|
<b>immediatePay</b> flag in the payment policy to 'true'.</li><li>Have a valid store location with a complete
|
||||||
|
street address.</li></ul></li></ul><p>When a merchant successfully lists an item with Click and Collect,
|
||||||
|
prospective buyers within a reasonable distance from one of the merchant's stores (that has stock available)
|
||||||
|
will see the "Available for Click and Collect" option on the listing, along with information on the closest
|
||||||
|
store that has the item.</p><b>Default</b>: false
|
||||||
|
shipping_options (Union[Unset, list['ShippingOption']]): This array is used to provide detailed information on
|
||||||
|
the domestic and international shipping options available for the policy. <br><br>A separate
|
||||||
|
<b>ShippingOption</b> object is required for domestic shipping service options and for international shipping
|
||||||
|
service options (if the seller ships to international locations). <ul><li>The <b>optionType</b> field is used to
|
||||||
|
indicate whether the <b>ShippingOption</b> object applies to domestic or international shipping, and the
|
||||||
|
<b>costType</b> field is used to indicate whether flat-rate shipping or calculated shipping will be used.</li>
|
||||||
|
<li>The <b>rateTableId</b> field can be used to associate a defined shipping rate table to the policy, and the
|
||||||
|
<b>packageHandlingCost</b> container can be used to set a handling charge for the policy.</li></ul> <p>A
|
||||||
|
separate <b>ShippingServices</b> object will be used to specify cost and other details for every available
|
||||||
|
domestic and international shipping service option. </p>
|
||||||
|
ship_to_locations (Union[Unset, RegionSet]): This type consists of the <b>regionIncluded</b> and
|
||||||
|
<b>regionExcluded</b> arrays, which indicate the areas to where the seller does and doesn't ship.
|
||||||
|
"""
|
||||||
|
|
||||||
|
category_types: Union[Unset, list['CategoryType']] = UNSET
|
||||||
|
description: Union[Unset, str] = UNSET
|
||||||
|
freight_shipping: Union[Unset, bool] = UNSET
|
||||||
|
global_shipping: Union[Unset, bool] = UNSET
|
||||||
|
handling_time: Union[Unset, 'TimeDuration'] = UNSET
|
||||||
|
local_pickup: Union[Unset, bool] = UNSET
|
||||||
|
marketplace_id: Union[Unset, str] = UNSET
|
||||||
|
name: Union[Unset, str] = UNSET
|
||||||
|
pickup_drop_off: Union[Unset, bool] = UNSET
|
||||||
|
shipping_options: Union[Unset, list['ShippingOption']] = UNSET
|
||||||
|
ship_to_locations: Union[Unset, 'RegionSet'] = UNSET
|
||||||
|
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def to_dict(self) -> dict[str, Any]:
|
||||||
|
from ..models.shipping_option import ShippingOption
|
||||||
|
from ..models.category_type import CategoryType
|
||||||
|
from ..models.time_duration import TimeDuration
|
||||||
|
from ..models.region_set import RegionSet
|
||||||
|
category_types: Union[Unset, list[dict[str, Any]]] = UNSET
|
||||||
|
if not isinstance(self.category_types, Unset):
|
||||||
|
category_types = []
|
||||||
|
for category_types_item_data in self.category_types:
|
||||||
|
category_types_item = category_types_item_data.to_dict()
|
||||||
|
category_types.append(category_types_item)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
description = self.description
|
||||||
|
|
||||||
|
freight_shipping = self.freight_shipping
|
||||||
|
|
||||||
|
global_shipping = self.global_shipping
|
||||||
|
|
||||||
|
handling_time: Union[Unset, dict[str, Any]] = UNSET
|
||||||
|
if not isinstance(self.handling_time, Unset):
|
||||||
|
handling_time = self.handling_time.to_dict()
|
||||||
|
|
||||||
|
local_pickup = self.local_pickup
|
||||||
|
|
||||||
|
marketplace_id = self.marketplace_id
|
||||||
|
|
||||||
|
name = self.name
|
||||||
|
|
||||||
|
pickup_drop_off = self.pickup_drop_off
|
||||||
|
|
||||||
|
shipping_options: Union[Unset, list[dict[str, Any]]] = UNSET
|
||||||
|
if not isinstance(self.shipping_options, Unset):
|
||||||
|
shipping_options = []
|
||||||
|
for shipping_options_item_data in self.shipping_options:
|
||||||
|
shipping_options_item = shipping_options_item_data.to_dict()
|
||||||
|
shipping_options.append(shipping_options_item)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ship_to_locations: Union[Unset, dict[str, Any]] = UNSET
|
||||||
|
if not isinstance(self.ship_to_locations, Unset):
|
||||||
|
ship_to_locations = self.ship_to_locations.to_dict()
|
||||||
|
|
||||||
|
|
||||||
|
field_dict: dict[str, Any] = {}
|
||||||
|
field_dict.update(self.additional_properties)
|
||||||
|
field_dict.update({
|
||||||
|
})
|
||||||
|
if category_types is not UNSET:
|
||||||
|
field_dict["categoryTypes"] = category_types
|
||||||
|
if description is not UNSET:
|
||||||
|
field_dict["description"] = description
|
||||||
|
if freight_shipping is not UNSET:
|
||||||
|
field_dict["freightShipping"] = freight_shipping
|
||||||
|
if global_shipping is not UNSET:
|
||||||
|
field_dict["globalShipping"] = global_shipping
|
||||||
|
if handling_time is not UNSET:
|
||||||
|
field_dict["handlingTime"] = handling_time
|
||||||
|
if local_pickup is not UNSET:
|
||||||
|
field_dict["localPickup"] = local_pickup
|
||||||
|
if marketplace_id is not UNSET:
|
||||||
|
field_dict["marketplaceId"] = marketplace_id
|
||||||
|
if name is not UNSET:
|
||||||
|
field_dict["name"] = name
|
||||||
|
if pickup_drop_off is not UNSET:
|
||||||
|
field_dict["pickupDropOff"] = pickup_drop_off
|
||||||
|
if shipping_options is not UNSET:
|
||||||
|
field_dict["shippingOptions"] = shipping_options
|
||||||
|
if ship_to_locations is not UNSET:
|
||||||
|
field_dict["shipToLocations"] = ship_to_locations
|
||||||
|
|
||||||
|
return field_dict
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||||
|
from ..models.shipping_option import ShippingOption
|
||||||
|
from ..models.category_type import CategoryType
|
||||||
|
from ..models.time_duration import TimeDuration
|
||||||
|
from ..models.region_set import RegionSet
|
||||||
|
d = dict(src_dict)
|
||||||
|
category_types = []
|
||||||
|
_category_types = d.pop("categoryTypes", UNSET)
|
||||||
|
for category_types_item_data in (_category_types or []):
|
||||||
|
category_types_item = CategoryType.from_dict(category_types_item_data)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
category_types.append(category_types_item)
|
||||||
|
|
||||||
|
|
||||||
|
description = d.pop("description", UNSET)
|
||||||
|
|
||||||
|
freight_shipping = d.pop("freightShipping", UNSET)
|
||||||
|
|
||||||
|
global_shipping = d.pop("globalShipping", UNSET)
|
||||||
|
|
||||||
|
_handling_time = d.pop("handlingTime", UNSET)
|
||||||
|
handling_time: Union[Unset, TimeDuration]
|
||||||
|
if isinstance(_handling_time, Unset):
|
||||||
|
handling_time = UNSET
|
||||||
|
else:
|
||||||
|
handling_time = TimeDuration.from_dict(_handling_time)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
local_pickup = d.pop("localPickup", UNSET)
|
||||||
|
|
||||||
|
marketplace_id = d.pop("marketplaceId", UNSET)
|
||||||
|
|
||||||
|
name = d.pop("name", UNSET)
|
||||||
|
|
||||||
|
pickup_drop_off = d.pop("pickupDropOff", UNSET)
|
||||||
|
|
||||||
|
shipping_options = []
|
||||||
|
_shipping_options = d.pop("shippingOptions", UNSET)
|
||||||
|
for shipping_options_item_data in (_shipping_options or []):
|
||||||
|
shipping_options_item = ShippingOption.from_dict(shipping_options_item_data)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
shipping_options.append(shipping_options_item)
|
||||||
|
|
||||||
|
|
||||||
|
_ship_to_locations = d.pop("shipToLocations", UNSET)
|
||||||
|
ship_to_locations: Union[Unset, RegionSet]
|
||||||
|
if isinstance(_ship_to_locations, Unset):
|
||||||
|
ship_to_locations = UNSET
|
||||||
|
else:
|
||||||
|
ship_to_locations = RegionSet.from_dict(_ship_to_locations)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
fulfillment_policy_request = cls(
|
||||||
|
category_types=category_types,
|
||||||
|
description=description,
|
||||||
|
freight_shipping=freight_shipping,
|
||||||
|
global_shipping=global_shipping,
|
||||||
|
handling_time=handling_time,
|
||||||
|
local_pickup=local_pickup,
|
||||||
|
marketplace_id=marketplace_id,
|
||||||
|
name=name,
|
||||||
|
pickup_drop_off=pickup_drop_off,
|
||||||
|
shipping_options=shipping_options,
|
||||||
|
ship_to_locations=ship_to_locations,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
fulfillment_policy_request.additional_properties = d
|
||||||
|
return fulfillment_policy_request
|
||||||
|
|
||||||
|
@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,158 @@
|
||||||
|
from collections.abc import Mapping
|
||||||
|
from typing import Any, TypeVar, Optional, BinaryIO, TextIO, TYPE_CHECKING, Generator
|
||||||
|
|
||||||
|
from attrs import define as _attrs_define
|
||||||
|
from attrs import field as _attrs_field
|
||||||
|
|
||||||
|
from ..types import UNSET, Unset
|
||||||
|
|
||||||
|
from ..types import UNSET, Unset
|
||||||
|
from typing import cast
|
||||||
|
from typing import Union
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from ..models.fulfillment_policy import FulfillmentPolicy
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
T = TypeVar("T", bound="FulfillmentPolicyResponse")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@_attrs_define
|
||||||
|
class FulfillmentPolicyResponse:
|
||||||
|
""" The response payload for the <b>getFulfillmentPolicies</b> method.<br><br><span class="tablenote"><b>Note</b>:
|
||||||
|
Pagination has not yet been enabled for <b>getFulfillmentPolicies</b>, so all of the pagination-related fields are
|
||||||
|
for future use.</span>
|
||||||
|
|
||||||
|
Attributes:
|
||||||
|
fulfillment_policies (Union[Unset, list['FulfillmentPolicy']]): A list of all of the seller's fulfillment
|
||||||
|
policies defined for the specified marketplace. This array will be returned as empty if no fulfillment policies
|
||||||
|
are defined for the specified marketplace.
|
||||||
|
href (Union[Unset, str]): This field is for future use.
|
||||||
|
limit (Union[Unset, int]): This field is for future use.
|
||||||
|
next_ (Union[Unset, str]): This field is for future use.
|
||||||
|
offset (Union[Unset, int]): This field is for future use.
|
||||||
|
prev (Union[Unset, str]): This field is for future use.
|
||||||
|
total (Union[Unset, int]): The total number of fulfillment policies retrieved in the result set. <br><br>If no
|
||||||
|
fulfillment policies are defined for the specified marketplace, this field is returned with a value of
|
||||||
|
<code>0</code>.
|
||||||
|
"""
|
||||||
|
|
||||||
|
fulfillment_policies: Union[Unset, list['FulfillmentPolicy']] = UNSET
|
||||||
|
href: Union[Unset, str] = UNSET
|
||||||
|
limit: Union[Unset, int] = UNSET
|
||||||
|
next_: Union[Unset, str] = UNSET
|
||||||
|
offset: Union[Unset, int] = UNSET
|
||||||
|
prev: Union[Unset, str] = UNSET
|
||||||
|
total: Union[Unset, int] = UNSET
|
||||||
|
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def to_dict(self) -> dict[str, Any]:
|
||||||
|
from ..models.fulfillment_policy import FulfillmentPolicy
|
||||||
|
fulfillment_policies: Union[Unset, list[dict[str, Any]]] = UNSET
|
||||||
|
if not isinstance(self.fulfillment_policies, Unset):
|
||||||
|
fulfillment_policies = []
|
||||||
|
for fulfillment_policies_item_data in self.fulfillment_policies:
|
||||||
|
fulfillment_policies_item = fulfillment_policies_item_data.to_dict()
|
||||||
|
fulfillment_policies.append(fulfillment_policies_item)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
href = self.href
|
||||||
|
|
||||||
|
limit = self.limit
|
||||||
|
|
||||||
|
next_ = self.next_
|
||||||
|
|
||||||
|
offset = self.offset
|
||||||
|
|
||||||
|
prev = self.prev
|
||||||
|
|
||||||
|
total = self.total
|
||||||
|
|
||||||
|
|
||||||
|
field_dict: dict[str, Any] = {}
|
||||||
|
field_dict.update(self.additional_properties)
|
||||||
|
field_dict.update({
|
||||||
|
})
|
||||||
|
if fulfillment_policies is not UNSET:
|
||||||
|
field_dict["fulfillmentPolicies"] = fulfillment_policies
|
||||||
|
if href is not UNSET:
|
||||||
|
field_dict["href"] = href
|
||||||
|
if limit is not UNSET:
|
||||||
|
field_dict["limit"] = limit
|
||||||
|
if next_ is not UNSET:
|
||||||
|
field_dict["next"] = next_
|
||||||
|
if offset is not UNSET:
|
||||||
|
field_dict["offset"] = offset
|
||||||
|
if prev is not UNSET:
|
||||||
|
field_dict["prev"] = prev
|
||||||
|
if total is not UNSET:
|
||||||
|
field_dict["total"] = total
|
||||||
|
|
||||||
|
return field_dict
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||||
|
from ..models.fulfillment_policy import FulfillmentPolicy
|
||||||
|
d = dict(src_dict)
|
||||||
|
fulfillment_policies = []
|
||||||
|
_fulfillment_policies = d.pop("fulfillmentPolicies", UNSET)
|
||||||
|
for fulfillment_policies_item_data in (_fulfillment_policies or []):
|
||||||
|
fulfillment_policies_item = FulfillmentPolicy.from_dict(fulfillment_policies_item_data)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
fulfillment_policies.append(fulfillment_policies_item)
|
||||||
|
|
||||||
|
|
||||||
|
href = d.pop("href", UNSET)
|
||||||
|
|
||||||
|
limit = d.pop("limit", UNSET)
|
||||||
|
|
||||||
|
next_ = d.pop("next", UNSET)
|
||||||
|
|
||||||
|
offset = d.pop("offset", UNSET)
|
||||||
|
|
||||||
|
prev = d.pop("prev", UNSET)
|
||||||
|
|
||||||
|
total = d.pop("total", UNSET)
|
||||||
|
|
||||||
|
fulfillment_policy_response = cls(
|
||||||
|
fulfillment_policies=fulfillment_policies,
|
||||||
|
href=href,
|
||||||
|
limit=limit,
|
||||||
|
next_=next_,
|
||||||
|
offset=offset,
|
||||||
|
prev=prev,
|
||||||
|
total=total,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
fulfillment_policy_response.additional_properties = d
|
||||||
|
return fulfillment_policy_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,138 @@
|
||||||
|
from collections.abc import Mapping
|
||||||
|
from typing import Any, TypeVar, Optional, BinaryIO, TextIO, TYPE_CHECKING, Generator
|
||||||
|
|
||||||
|
from attrs import define as _attrs_define
|
||||||
|
from attrs import field as _attrs_field
|
||||||
|
|
||||||
|
from ..types import UNSET, Unset
|
||||||
|
|
||||||
|
from ..types import UNSET, Unset
|
||||||
|
from typing import cast
|
||||||
|
from typing import Union
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from ..models.time_duration import TimeDuration
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
T = TypeVar("T", bound="InternationalReturnOverrideType")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@_attrs_define
|
||||||
|
class InternationalReturnOverrideType:
|
||||||
|
""" This type defines the fields for a seller's international return policy. Sellers have the ability to set separate
|
||||||
|
domestic and international return policies, but if an international return policy is not set, the same return policy
|
||||||
|
settings specified for the domestic return policy are also used for returns for international buyers.
|
||||||
|
|
||||||
|
Attributes:
|
||||||
|
return_method (Union[Unset, str]): This field sets/indicates if the seller offers replacement items to the buyer
|
||||||
|
in the case of an international return. The buyer must be willing to accept a replacement item; otherwise, the
|
||||||
|
seller will need to issue a refund for a return. For implementation help, refer to <a
|
||||||
|
href='https://developer.ebay.com/api-docs/sell/account/types/api:ReturnMethodEnum'>eBay API documentation</a>
|
||||||
|
return_period (Union[Unset, TimeDuration]): A type used to specify a period of time using a specified time-
|
||||||
|
measurement unit. Payment, return, and fulfillment business policies all use this type to specify time
|
||||||
|
windows.<br><br>Whenever a container that uses this type is used in a request, both of these fields are
|
||||||
|
required. Similarly, whenever a container that uses this type is returned in a response, both of these fields
|
||||||
|
are always returned.
|
||||||
|
returns_accepted (Union[Unset, bool]): If set to <code>true</code>, the seller accepts international returns. If
|
||||||
|
set to <code>false</code>, the seller does not accept international returns. <br><br>This field is
|
||||||
|
conditionally required if the seller chooses to have a separate international return policy.
|
||||||
|
return_shipping_cost_payer (Union[Unset, str]): This field indicates who is responsible for paying for the
|
||||||
|
shipping charges for returned items. The field can be set to either <code>BUYER</code> or <code>SELLER</code>.
|
||||||
|
<br><br>Depending on the return policy and specifics of the return, either the buyer or the seller can be
|
||||||
|
responsible for the return shipping costs. Note that the seller is always responsible for return shipping costs
|
||||||
|
for 'significantly not as described' (SNAD) issues. <br><br>This field is conditionally required if the
|
||||||
|
<b>internationalOverride.returnsAccepted</b> field is set to <code>true</code>. For implementation help, refer
|
||||||
|
to <a href='https://developer.ebay.com/api-docs/sell/account/types/api:ReturnShippingCostPayerEnum'>eBay API
|
||||||
|
documentation</a>
|
||||||
|
"""
|
||||||
|
|
||||||
|
return_method: Union[Unset, str] = UNSET
|
||||||
|
return_period: Union[Unset, 'TimeDuration'] = UNSET
|
||||||
|
returns_accepted: Union[Unset, bool] = UNSET
|
||||||
|
return_shipping_cost_payer: Union[Unset, str] = UNSET
|
||||||
|
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def to_dict(self) -> dict[str, Any]:
|
||||||
|
from ..models.time_duration import TimeDuration
|
||||||
|
return_method = self.return_method
|
||||||
|
|
||||||
|
return_period: Union[Unset, dict[str, Any]] = UNSET
|
||||||
|
if not isinstance(self.return_period, Unset):
|
||||||
|
return_period = self.return_period.to_dict()
|
||||||
|
|
||||||
|
returns_accepted = self.returns_accepted
|
||||||
|
|
||||||
|
return_shipping_cost_payer = self.return_shipping_cost_payer
|
||||||
|
|
||||||
|
|
||||||
|
field_dict: dict[str, Any] = {}
|
||||||
|
field_dict.update(self.additional_properties)
|
||||||
|
field_dict.update({
|
||||||
|
})
|
||||||
|
if return_method is not UNSET:
|
||||||
|
field_dict["returnMethod"] = return_method
|
||||||
|
if return_period is not UNSET:
|
||||||
|
field_dict["returnPeriod"] = return_period
|
||||||
|
if returns_accepted is not UNSET:
|
||||||
|
field_dict["returnsAccepted"] = returns_accepted
|
||||||
|
if return_shipping_cost_payer is not UNSET:
|
||||||
|
field_dict["returnShippingCostPayer"] = return_shipping_cost_payer
|
||||||
|
|
||||||
|
return field_dict
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||||
|
from ..models.time_duration import TimeDuration
|
||||||
|
d = dict(src_dict)
|
||||||
|
return_method = d.pop("returnMethod", UNSET)
|
||||||
|
|
||||||
|
_return_period = d.pop("returnPeriod", UNSET)
|
||||||
|
return_period: Union[Unset, TimeDuration]
|
||||||
|
if isinstance(_return_period, Unset):
|
||||||
|
return_period = UNSET
|
||||||
|
else:
|
||||||
|
return_period = TimeDuration.from_dict(_return_period)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
returns_accepted = d.pop("returnsAccepted", UNSET)
|
||||||
|
|
||||||
|
return_shipping_cost_payer = d.pop("returnShippingCostPayer", UNSET)
|
||||||
|
|
||||||
|
international_return_override_type = cls(
|
||||||
|
return_method=return_method,
|
||||||
|
return_period=return_period,
|
||||||
|
returns_accepted=returns_accepted,
|
||||||
|
return_shipping_cost_payer=return_shipping_cost_payer,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
international_return_override_type.additional_properties = d
|
||||||
|
return international_return_override_type
|
||||||
|
|
||||||
|
@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
|
||||||
125
ebay_client/generated/account/models/kyc_check.py
Normal file
125
ebay_client/generated/account/models/kyc_check.py
Normal file
|
|
@ -0,0 +1,125 @@
|
||||||
|
from collections.abc import Mapping
|
||||||
|
from typing import Any, TypeVar, Optional, BinaryIO, TextIO, TYPE_CHECKING, Generator
|
||||||
|
|
||||||
|
from attrs import define as _attrs_define
|
||||||
|
from attrs import field as _attrs_field
|
||||||
|
|
||||||
|
from ..types import UNSET, Unset
|
||||||
|
|
||||||
|
from ..types import UNSET, Unset
|
||||||
|
from typing import Union
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
T = TypeVar("T", bound="KycCheck")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@_attrs_define
|
||||||
|
class KycCheck:
|
||||||
|
""" This type is used to provide details about any KYC check that is applicable to the managed payments seller.
|
||||||
|
|
||||||
|
Attributes:
|
||||||
|
data_required (Union[Unset, str]): The enumeration value returned in this field categorizes the type of details
|
||||||
|
needed for the KYC check. More information about the check is shown in the <b>detailMessage</b> and other
|
||||||
|
applicable, corresponding fields. For implementation help, refer to <a href='https://developer.ebay.com/api-
|
||||||
|
docs/sell/account/types/kyc:DetailsType'>eBay API documentation</a>
|
||||||
|
due_date (Union[Unset, str]): The timestamp in this field indicates the date by which the seller should resolve
|
||||||
|
the KYC requirement.<br><br>The timestamp in this field uses the UTC date and time format described in the <a
|
||||||
|
href="https://www.iso.org/iso-8601-date-and-time-format.html" target="_blank">ISO 8601 Standard</a>. See below
|
||||||
|
for this format and an example: <br><br><i>MM-DD-YYYY HH:MM:SS</i><br/><code>06-05-2020 10:34:18</code>
|
||||||
|
remedy_url (Union[Unset, str]): If applicable and available, a URL will be returned in this field, and the link
|
||||||
|
will take the seller to an eBay page where they can provide the requested information.
|
||||||
|
alert (Union[Unset, str]): This field gives a short summary of what is required from the seller. An example
|
||||||
|
might be, '<code>Upload bank document now.</code>'. The <b>detailMessage</b> field will often provide more
|
||||||
|
details on what is required of the seller.
|
||||||
|
detail_message (Union[Unset, str]): This field gives a detailed message about what is required from the seller.
|
||||||
|
An example might be, '<code>Please upload a bank document by 2020-08-01 to get your account back in good
|
||||||
|
standing.</code>'.
|
||||||
|
"""
|
||||||
|
|
||||||
|
data_required: Union[Unset, str] = UNSET
|
||||||
|
due_date: Union[Unset, str] = UNSET
|
||||||
|
remedy_url: Union[Unset, str] = UNSET
|
||||||
|
alert: Union[Unset, str] = UNSET
|
||||||
|
detail_message: Union[Unset, str] = UNSET
|
||||||
|
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def to_dict(self) -> dict[str, Any]:
|
||||||
|
data_required = self.data_required
|
||||||
|
|
||||||
|
due_date = self.due_date
|
||||||
|
|
||||||
|
remedy_url = self.remedy_url
|
||||||
|
|
||||||
|
alert = self.alert
|
||||||
|
|
||||||
|
detail_message = self.detail_message
|
||||||
|
|
||||||
|
|
||||||
|
field_dict: dict[str, Any] = {}
|
||||||
|
field_dict.update(self.additional_properties)
|
||||||
|
field_dict.update({
|
||||||
|
})
|
||||||
|
if data_required is not UNSET:
|
||||||
|
field_dict["dataRequired"] = data_required
|
||||||
|
if due_date is not UNSET:
|
||||||
|
field_dict["dueDate"] = due_date
|
||||||
|
if remedy_url is not UNSET:
|
||||||
|
field_dict["remedyUrl"] = remedy_url
|
||||||
|
if alert is not UNSET:
|
||||||
|
field_dict["alert"] = alert
|
||||||
|
if detail_message is not UNSET:
|
||||||
|
field_dict["detailMessage"] = detail_message
|
||||||
|
|
||||||
|
return field_dict
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||||
|
d = dict(src_dict)
|
||||||
|
data_required = d.pop("dataRequired", UNSET)
|
||||||
|
|
||||||
|
due_date = d.pop("dueDate", UNSET)
|
||||||
|
|
||||||
|
remedy_url = d.pop("remedyUrl", UNSET)
|
||||||
|
|
||||||
|
alert = d.pop("alert", UNSET)
|
||||||
|
|
||||||
|
detail_message = d.pop("detailMessage", UNSET)
|
||||||
|
|
||||||
|
kyc_check = cls(
|
||||||
|
data_required=data_required,
|
||||||
|
due_date=due_date,
|
||||||
|
remedy_url=remedy_url,
|
||||||
|
alert=alert,
|
||||||
|
detail_message=detail_message,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
kyc_check.additional_properties = d
|
||||||
|
return kyc_check
|
||||||
|
|
||||||
|
@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
|
||||||
102
ebay_client/generated/account/models/kyc_response.py
Normal file
102
ebay_client/generated/account/models/kyc_response.py
Normal file
|
|
@ -0,0 +1,102 @@
|
||||||
|
from collections.abc import Mapping
|
||||||
|
from typing import Any, TypeVar, Optional, BinaryIO, TextIO, TYPE_CHECKING, Generator
|
||||||
|
|
||||||
|
from attrs import define as _attrs_define
|
||||||
|
from attrs import field as _attrs_field
|
||||||
|
|
||||||
|
from ..types import UNSET, Unset
|
||||||
|
|
||||||
|
from ..types import UNSET, Unset
|
||||||
|
from typing import cast
|
||||||
|
from typing import Union
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from ..models.kyc_check import KycCheck
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
T = TypeVar("T", bound="KycResponse")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@_attrs_define
|
||||||
|
class KycResponse:
|
||||||
|
""" This is the base response type of the <b>getKYC</b> method.
|
||||||
|
|
||||||
|
Attributes:
|
||||||
|
kyc_checks (Union[Unset, list['KycCheck']]): This array contains one or more KYC checks required from a managed
|
||||||
|
payments seller. The seller may need to provide more documentation and/or information about themselves, their
|
||||||
|
company, or the bank account they are using for seller payouts.<br/><br/>If no KYC checks are currently required
|
||||||
|
from the seller, this array is not returned, and the seller only receives a <code>204 No Content</code> HTTP
|
||||||
|
status code.
|
||||||
|
"""
|
||||||
|
|
||||||
|
kyc_checks: Union[Unset, list['KycCheck']] = UNSET
|
||||||
|
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def to_dict(self) -> dict[str, Any]:
|
||||||
|
from ..models.kyc_check import KycCheck
|
||||||
|
kyc_checks: Union[Unset, list[dict[str, Any]]] = UNSET
|
||||||
|
if not isinstance(self.kyc_checks, Unset):
|
||||||
|
kyc_checks = []
|
||||||
|
for kyc_checks_item_data in self.kyc_checks:
|
||||||
|
kyc_checks_item = kyc_checks_item_data.to_dict()
|
||||||
|
kyc_checks.append(kyc_checks_item)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
field_dict: dict[str, Any] = {}
|
||||||
|
field_dict.update(self.additional_properties)
|
||||||
|
field_dict.update({
|
||||||
|
})
|
||||||
|
if kyc_checks is not UNSET:
|
||||||
|
field_dict["kycChecks"] = kyc_checks
|
||||||
|
|
||||||
|
return field_dict
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||||
|
from ..models.kyc_check import KycCheck
|
||||||
|
d = dict(src_dict)
|
||||||
|
kyc_checks = []
|
||||||
|
_kyc_checks = d.pop("kycChecks", UNSET)
|
||||||
|
for kyc_checks_item_data in (_kyc_checks or []):
|
||||||
|
kyc_checks_item = KycCheck.from_dict(kyc_checks_item_data)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
kyc_checks.append(kyc_checks_item)
|
||||||
|
|
||||||
|
|
||||||
|
kyc_response = cls(
|
||||||
|
kyc_checks=kyc_checks,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
kyc_response.additional_properties = d
|
||||||
|
return kyc_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,63 @@
|
||||||
|
from collections.abc import Mapping
|
||||||
|
from typing import Any, TypeVar, Optional, BinaryIO, TextIO, TYPE_CHECKING, Generator
|
||||||
|
|
||||||
|
from attrs import define as _attrs_define
|
||||||
|
from attrs import field as _attrs_field
|
||||||
|
|
||||||
|
from ..types import UNSET, Unset
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
T = TypeVar("T", bound="OptInToProgramResponse200")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@_attrs_define
|
||||||
|
class OptInToProgramResponse200:
|
||||||
|
"""
|
||||||
|
"""
|
||||||
|
|
||||||
|
additional_properties: dict[str, Any] = _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)
|
||||||
|
opt_in_to_program_response_200 = cls(
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
opt_in_to_program_response_200.additional_properties = d
|
||||||
|
return opt_in_to_program_response_200
|
||||||
|
|
||||||
|
@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,63 @@
|
||||||
|
from collections.abc import Mapping
|
||||||
|
from typing import Any, TypeVar, Optional, BinaryIO, TextIO, TYPE_CHECKING, Generator
|
||||||
|
|
||||||
|
from attrs import define as _attrs_define
|
||||||
|
from attrs import field as _attrs_field
|
||||||
|
|
||||||
|
from ..types import UNSET, Unset
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
T = TypeVar("T", bound="OptOutOfProgramResponse200")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@_attrs_define
|
||||||
|
class OptOutOfProgramResponse200:
|
||||||
|
"""
|
||||||
|
"""
|
||||||
|
|
||||||
|
additional_properties: dict[str, Any] = _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)
|
||||||
|
opt_out_of_program_response_200 = cls(
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
opt_out_of_program_response_200.additional_properties = d
|
||||||
|
return opt_out_of_program_response_200
|
||||||
|
|
||||||
|
@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
|
||||||
127
ebay_client/generated/account/models/payment_method.py
Normal file
127
ebay_client/generated/account/models/payment_method.py
Normal file
|
|
@ -0,0 +1,127 @@
|
||||||
|
from collections.abc import Mapping
|
||||||
|
from typing import Any, TypeVar, Optional, BinaryIO, TextIO, TYPE_CHECKING, Generator
|
||||||
|
|
||||||
|
from attrs import define as _attrs_define
|
||||||
|
from attrs import field as _attrs_field
|
||||||
|
|
||||||
|
from ..types import UNSET, Unset
|
||||||
|
|
||||||
|
from ..types import UNSET, Unset
|
||||||
|
from typing import cast
|
||||||
|
from typing import Union
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from ..models.recipient_account_reference import RecipientAccountReference
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
T = TypeVar("T", bound="PaymentMethod")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@_attrs_define
|
||||||
|
class PaymentMethod:
|
||||||
|
""" This type is used by the <b>paymentMethods</b> container, which is used by the seller to specify one or more offline
|
||||||
|
payment methods. <br><br> <span class="tablenote"><b>Note</b>: eBay now controls all electronic payment methods
|
||||||
|
available for a marketplace, so a seller will no longer use this type to specify any electronic payment
|
||||||
|
methods.</span>
|
||||||
|
|
||||||
|
Attributes:
|
||||||
|
brands (Union[Unset, list[str]]): <span class="tablenote"><b>Note</b>: This array is no longer applicable and
|
||||||
|
should not be used. eBay now controls all electronic payment methods available for a marketplace, and a seller
|
||||||
|
never has to specify any electronic payment methods, including any credit card brands accepted. </span>
|
||||||
|
payment_method_type (Union[Unset, str]): This array is only applicable for listings supporting offline payment
|
||||||
|
methods. See the <b>PaymentMethodTypeEnum</b> type for supported offline payment method enum values. If offline
|
||||||
|
payments are enabled for the policy, provide at least one offline payment method.</p> For implementation help,
|
||||||
|
refer to <a href='https://developer.ebay.com/api-docs/sell/account/types/api:PaymentMethodTypeEnum'>eBay API
|
||||||
|
documentation</a>
|
||||||
|
recipient_account_reference (Union[Unset, RecipientAccountReference]): <span class="tablenote"><b>Note</b>: This
|
||||||
|
type is no longer applicable. eBay now controls all electronic payment methods available for a marketplace, and
|
||||||
|
a seller never has to specify any electronic payment methods.</span>
|
||||||
|
"""
|
||||||
|
|
||||||
|
brands: Union[Unset, list[str]] = UNSET
|
||||||
|
payment_method_type: Union[Unset, str] = UNSET
|
||||||
|
recipient_account_reference: Union[Unset, 'RecipientAccountReference'] = UNSET
|
||||||
|
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def to_dict(self) -> dict[str, Any]:
|
||||||
|
from ..models.recipient_account_reference import RecipientAccountReference
|
||||||
|
brands: Union[Unset, list[str]] = UNSET
|
||||||
|
if not isinstance(self.brands, Unset):
|
||||||
|
brands = self.brands
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
payment_method_type = self.payment_method_type
|
||||||
|
|
||||||
|
recipient_account_reference: Union[Unset, dict[str, Any]] = UNSET
|
||||||
|
if not isinstance(self.recipient_account_reference, Unset):
|
||||||
|
recipient_account_reference = self.recipient_account_reference.to_dict()
|
||||||
|
|
||||||
|
|
||||||
|
field_dict: dict[str, Any] = {}
|
||||||
|
field_dict.update(self.additional_properties)
|
||||||
|
field_dict.update({
|
||||||
|
})
|
||||||
|
if brands is not UNSET:
|
||||||
|
field_dict["brands"] = brands
|
||||||
|
if payment_method_type is not UNSET:
|
||||||
|
field_dict["paymentMethodType"] = payment_method_type
|
||||||
|
if recipient_account_reference is not UNSET:
|
||||||
|
field_dict["recipientAccountReference"] = recipient_account_reference
|
||||||
|
|
||||||
|
return field_dict
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||||
|
from ..models.recipient_account_reference import RecipientAccountReference
|
||||||
|
d = dict(src_dict)
|
||||||
|
brands = cast(list[str], d.pop("brands", UNSET))
|
||||||
|
|
||||||
|
|
||||||
|
payment_method_type = d.pop("paymentMethodType", UNSET)
|
||||||
|
|
||||||
|
_recipient_account_reference = d.pop("recipientAccountReference", UNSET)
|
||||||
|
recipient_account_reference: Union[Unset, RecipientAccountReference]
|
||||||
|
if isinstance(_recipient_account_reference, Unset):
|
||||||
|
recipient_account_reference = UNSET
|
||||||
|
else:
|
||||||
|
recipient_account_reference = RecipientAccountReference.from_dict(_recipient_account_reference)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
payment_method = cls(
|
||||||
|
brands=brands,
|
||||||
|
payment_method_type=payment_method_type,
|
||||||
|
recipient_account_reference=recipient_account_reference,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
payment_method.additional_properties = d
|
||||||
|
return payment_method
|
||||||
|
|
||||||
|
@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
|
||||||
247
ebay_client/generated/account/models/payment_policy.py
Normal file
247
ebay_client/generated/account/models/payment_policy.py
Normal file
|
|
@ -0,0 +1,247 @@
|
||||||
|
from collections.abc import Mapping
|
||||||
|
from typing import Any, TypeVar, Optional, BinaryIO, TextIO, TYPE_CHECKING, Generator
|
||||||
|
|
||||||
|
from attrs import define as _attrs_define
|
||||||
|
from attrs import field as _attrs_field
|
||||||
|
|
||||||
|
from ..types import UNSET, Unset
|
||||||
|
|
||||||
|
from ..types import UNSET, Unset
|
||||||
|
from typing import cast
|
||||||
|
from typing import Union
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from ..models.payment_method import PaymentMethod
|
||||||
|
from ..models.category_type import CategoryType
|
||||||
|
from ..models.time_duration import TimeDuration
|
||||||
|
from ..models.deposit import Deposit
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
T = TypeVar("T", bound="PaymentPolicy")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@_attrs_define
|
||||||
|
class PaymentPolicy:
|
||||||
|
""" This type is used by the <b>paymentPolicy</b> response container, a container which defines a seller's payment
|
||||||
|
business policy for a specific marketplace.
|
||||||
|
|
||||||
|
Attributes:
|
||||||
|
category_types (Union[Unset, list['CategoryType']]): This container indicates whether the payment policy applies
|
||||||
|
to motor vehicle listings, or if it applies to non-motor vehicle listings.
|
||||||
|
deposit (Union[Unset, Deposit]): This type is used to specify/indicate that an initial deposit is required for a
|
||||||
|
motor vehicle listing.
|
||||||
|
description (Union[Unset, str]): A seller-defined description of the payment policy. This description is only
|
||||||
|
for the seller's use, and is not exposed on any eBay pages. <br><br><b>Max length</b>: 250
|
||||||
|
full_payment_due_in (Union[Unset, TimeDuration]): A type used to specify a period of time using a specified
|
||||||
|
time-measurement unit. Payment, return, and fulfillment business policies all use this type to specify time
|
||||||
|
windows.<br><br>Whenever a container that uses this type is used in a request, both of these fields are
|
||||||
|
required. Similarly, whenever a container that uses this type is returned in a response, both of these fields
|
||||||
|
are always returned.
|
||||||
|
immediate_pay (Union[Unset, bool]): If this field is returned as <code>true</code>, immediate payment is
|
||||||
|
required from the buyer for: <ul><li>A fixed-price item</li><li>An auction item where the buyer uses the 'Buy it
|
||||||
|
Now' option</li><li>A deposit for a motor vehicle listing</li></ul><br>It is possible for the seller to set this
|
||||||
|
field as <code>true</code> in the payment business policy, but it will not apply in some scenarios. For example,
|
||||||
|
immediate payment is not applicable for auction listings that have a winning bidder, for buyer purchases that
|
||||||
|
involve the Best Offer feature, or for transactions that happen offline between the buyer and seller.
|
||||||
|
marketplace_id (Union[Unset, str]): The ID of the eBay marketplace to which the payment business policy applies.
|
||||||
|
For implementation help, refer to <a href='https://developer.ebay.com/api-
|
||||||
|
docs/sell/account/types/ba:MarketplaceIdEnum'>eBay API documentation</a>
|
||||||
|
name (Union[Unset, str]): A seller-defined name for this payment policy. Names must be unique for policies
|
||||||
|
assigned to the same marketplace. <br><br><b>Max length</b>: 64
|
||||||
|
payment_instructions (Union[Unset, str]): Although this field may be returned for some older payment business
|
||||||
|
policies, payment instructions are no longer supported by payment business policies. If this field is returned,
|
||||||
|
it can be ignored and these payment instructions will not appear in any listings that use the corresponding
|
||||||
|
business policy. <br><br><b>Max length</b>: 1000
|
||||||
|
payment_methods (Union[Unset, list['PaymentMethod']]): This container is returned to show the payment methods
|
||||||
|
that are accepted for the payment business policy. <br><br>Sellers do not have to specify any electronic
|
||||||
|
payment methods for listings, so this array will often be returned empty unless the payment business policy is
|
||||||
|
intended for motor vehicle listings or other items in categories where offline payments are required or
|
||||||
|
supported.
|
||||||
|
payment_policy_id (Union[Unset, str]): A unique eBay-assigned ID for a payment business policy. This ID is
|
||||||
|
generated when the policy is created.
|
||||||
|
"""
|
||||||
|
|
||||||
|
category_types: Union[Unset, list['CategoryType']] = UNSET
|
||||||
|
deposit: Union[Unset, 'Deposit'] = UNSET
|
||||||
|
description: Union[Unset, str] = UNSET
|
||||||
|
full_payment_due_in: Union[Unset, 'TimeDuration'] = UNSET
|
||||||
|
immediate_pay: Union[Unset, bool] = UNSET
|
||||||
|
marketplace_id: Union[Unset, str] = UNSET
|
||||||
|
name: Union[Unset, str] = UNSET
|
||||||
|
payment_instructions: Union[Unset, str] = UNSET
|
||||||
|
payment_methods: Union[Unset, list['PaymentMethod']] = UNSET
|
||||||
|
payment_policy_id: Union[Unset, str] = UNSET
|
||||||
|
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def to_dict(self) -> dict[str, Any]:
|
||||||
|
from ..models.payment_method import PaymentMethod
|
||||||
|
from ..models.category_type import CategoryType
|
||||||
|
from ..models.time_duration import TimeDuration
|
||||||
|
from ..models.deposit import Deposit
|
||||||
|
category_types: Union[Unset, list[dict[str, Any]]] = UNSET
|
||||||
|
if not isinstance(self.category_types, Unset):
|
||||||
|
category_types = []
|
||||||
|
for category_types_item_data in self.category_types:
|
||||||
|
category_types_item = category_types_item_data.to_dict()
|
||||||
|
category_types.append(category_types_item)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
deposit: Union[Unset, dict[str, Any]] = UNSET
|
||||||
|
if not isinstance(self.deposit, Unset):
|
||||||
|
deposit = self.deposit.to_dict()
|
||||||
|
|
||||||
|
description = self.description
|
||||||
|
|
||||||
|
full_payment_due_in: Union[Unset, dict[str, Any]] = UNSET
|
||||||
|
if not isinstance(self.full_payment_due_in, Unset):
|
||||||
|
full_payment_due_in = self.full_payment_due_in.to_dict()
|
||||||
|
|
||||||
|
immediate_pay = self.immediate_pay
|
||||||
|
|
||||||
|
marketplace_id = self.marketplace_id
|
||||||
|
|
||||||
|
name = self.name
|
||||||
|
|
||||||
|
payment_instructions = self.payment_instructions
|
||||||
|
|
||||||
|
payment_methods: Union[Unset, list[dict[str, Any]]] = UNSET
|
||||||
|
if not isinstance(self.payment_methods, Unset):
|
||||||
|
payment_methods = []
|
||||||
|
for payment_methods_item_data in self.payment_methods:
|
||||||
|
payment_methods_item = payment_methods_item_data.to_dict()
|
||||||
|
payment_methods.append(payment_methods_item)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
payment_policy_id = self.payment_policy_id
|
||||||
|
|
||||||
|
|
||||||
|
field_dict: dict[str, Any] = {}
|
||||||
|
field_dict.update(self.additional_properties)
|
||||||
|
field_dict.update({
|
||||||
|
})
|
||||||
|
if category_types is not UNSET:
|
||||||
|
field_dict["categoryTypes"] = category_types
|
||||||
|
if deposit is not UNSET:
|
||||||
|
field_dict["deposit"] = deposit
|
||||||
|
if description is not UNSET:
|
||||||
|
field_dict["description"] = description
|
||||||
|
if full_payment_due_in is not UNSET:
|
||||||
|
field_dict["fullPaymentDueIn"] = full_payment_due_in
|
||||||
|
if immediate_pay is not UNSET:
|
||||||
|
field_dict["immediatePay"] = immediate_pay
|
||||||
|
if marketplace_id is not UNSET:
|
||||||
|
field_dict["marketplaceId"] = marketplace_id
|
||||||
|
if name is not UNSET:
|
||||||
|
field_dict["name"] = name
|
||||||
|
if payment_instructions is not UNSET:
|
||||||
|
field_dict["paymentInstructions"] = payment_instructions
|
||||||
|
if payment_methods is not UNSET:
|
||||||
|
field_dict["paymentMethods"] = payment_methods
|
||||||
|
if payment_policy_id is not UNSET:
|
||||||
|
field_dict["paymentPolicyId"] = payment_policy_id
|
||||||
|
|
||||||
|
return field_dict
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||||
|
from ..models.payment_method import PaymentMethod
|
||||||
|
from ..models.category_type import CategoryType
|
||||||
|
from ..models.time_duration import TimeDuration
|
||||||
|
from ..models.deposit import Deposit
|
||||||
|
d = dict(src_dict)
|
||||||
|
category_types = []
|
||||||
|
_category_types = d.pop("categoryTypes", UNSET)
|
||||||
|
for category_types_item_data in (_category_types or []):
|
||||||
|
category_types_item = CategoryType.from_dict(category_types_item_data)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
category_types.append(category_types_item)
|
||||||
|
|
||||||
|
|
||||||
|
_deposit = d.pop("deposit", UNSET)
|
||||||
|
deposit: Union[Unset, Deposit]
|
||||||
|
if isinstance(_deposit, Unset):
|
||||||
|
deposit = UNSET
|
||||||
|
else:
|
||||||
|
deposit = Deposit.from_dict(_deposit)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
description = d.pop("description", UNSET)
|
||||||
|
|
||||||
|
_full_payment_due_in = d.pop("fullPaymentDueIn", UNSET)
|
||||||
|
full_payment_due_in: Union[Unset, TimeDuration]
|
||||||
|
if isinstance(_full_payment_due_in, Unset):
|
||||||
|
full_payment_due_in = UNSET
|
||||||
|
else:
|
||||||
|
full_payment_due_in = TimeDuration.from_dict(_full_payment_due_in)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
immediate_pay = d.pop("immediatePay", UNSET)
|
||||||
|
|
||||||
|
marketplace_id = d.pop("marketplaceId", UNSET)
|
||||||
|
|
||||||
|
name = d.pop("name", UNSET)
|
||||||
|
|
||||||
|
payment_instructions = d.pop("paymentInstructions", UNSET)
|
||||||
|
|
||||||
|
payment_methods = []
|
||||||
|
_payment_methods = d.pop("paymentMethods", UNSET)
|
||||||
|
for payment_methods_item_data in (_payment_methods or []):
|
||||||
|
payment_methods_item = PaymentMethod.from_dict(payment_methods_item_data)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
payment_methods.append(payment_methods_item)
|
||||||
|
|
||||||
|
|
||||||
|
payment_policy_id = d.pop("paymentPolicyId", UNSET)
|
||||||
|
|
||||||
|
payment_policy = cls(
|
||||||
|
category_types=category_types,
|
||||||
|
deposit=deposit,
|
||||||
|
description=description,
|
||||||
|
full_payment_due_in=full_payment_due_in,
|
||||||
|
immediate_pay=immediate_pay,
|
||||||
|
marketplace_id=marketplace_id,
|
||||||
|
name=name,
|
||||||
|
payment_instructions=payment_instructions,
|
||||||
|
payment_methods=payment_methods,
|
||||||
|
payment_policy_id=payment_policy_id,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
payment_policy.additional_properties = d
|
||||||
|
return payment_policy
|
||||||
|
|
||||||
|
@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
|
||||||
233
ebay_client/generated/account/models/payment_policy_request.py
Normal file
233
ebay_client/generated/account/models/payment_policy_request.py
Normal file
|
|
@ -0,0 +1,233 @@
|
||||||
|
from collections.abc import Mapping
|
||||||
|
from typing import Any, TypeVar, Optional, BinaryIO, TextIO, TYPE_CHECKING, Generator
|
||||||
|
|
||||||
|
from attrs import define as _attrs_define
|
||||||
|
from attrs import field as _attrs_field
|
||||||
|
|
||||||
|
from ..types import UNSET, Unset
|
||||||
|
|
||||||
|
from ..types import UNSET, Unset
|
||||||
|
from typing import cast
|
||||||
|
from typing import Union
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from ..models.payment_method import PaymentMethod
|
||||||
|
from ..models.category_type import CategoryType
|
||||||
|
from ..models.time_duration import TimeDuration
|
||||||
|
from ..models.deposit import Deposit
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
T = TypeVar("T", bound="PaymentPolicyRequest")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@_attrs_define
|
||||||
|
class PaymentPolicyRequest:
|
||||||
|
""" This root container defines a seller's payment business policy for a specific marketplace and category group. This
|
||||||
|
type is used when creating or updating a payment business policy.
|
||||||
|
|
||||||
|
Attributes:
|
||||||
|
category_types (Union[Unset, list['CategoryType']]): This container is used to specify whether the payment
|
||||||
|
business policy applies to motor vehicle listings, or if it applies to non-motor vehicle listings.
|
||||||
|
deposit (Union[Unset, Deposit]): This type is used to specify/indicate that an initial deposit is required for a
|
||||||
|
motor vehicle listing.
|
||||||
|
description (Union[Unset, str]): A seller-defined description of the payment business policy. This description
|
||||||
|
is only for the seller's use, and is not exposed on any eBay pages. <br><br><b>Max length</b>: 250
|
||||||
|
full_payment_due_in (Union[Unset, TimeDuration]): A type used to specify a period of time using a specified
|
||||||
|
time-measurement unit. Payment, return, and fulfillment business policies all use this type to specify time
|
||||||
|
windows.<br><br>Whenever a container that uses this type is used in a request, both of these fields are
|
||||||
|
required. Similarly, whenever a container that uses this type is returned in a response, both of these fields
|
||||||
|
are always returned.
|
||||||
|
immediate_pay (Union[Unset, bool]): This field should be included and set to <code>true</code> if the seller
|
||||||
|
wants to require immediate payment from the buyer for: <ul><li>A fixed-price item</li><li>An auction item where
|
||||||
|
the buyer is using the 'Buy it Now' option</li><li>A deposit for a motor vehicle
|
||||||
|
listing</li></ul><br><b>Default:</b> False
|
||||||
|
marketplace_id (Union[Unset, str]): The ID of the eBay marketplace to which this payment business policy
|
||||||
|
applies. For implementation help, refer to <a href='https://developer.ebay.com/api-
|
||||||
|
docs/sell/account/types/ba:MarketplaceIdEnum'>eBay API documentation</a>
|
||||||
|
name (Union[Unset, str]): A seller-defined name for this payment business policy. Names must be unique for
|
||||||
|
policies assigned to the same marketplace.<br><br><b>Max length:</b> 64
|
||||||
|
payment_instructions (Union[Unset, str]): <p class="tablenote"><b>Note:</b> DO NOT USE THIS FIELD. Payment
|
||||||
|
instructions are no longer supported by payment business policies.</p>A free-form string field that allows
|
||||||
|
sellers to add detailed payment instructions to their listings.
|
||||||
|
payment_methods (Union[Unset, list['PaymentMethod']]): <p class="tablenote"><b>Note:</b> This field applies only
|
||||||
|
when the seller needs to specify one or more offline payment methods. eBay now manages the electronic payment
|
||||||
|
options available to buyers to pay for the item.</p>This array is used to specify one or more offline payment
|
||||||
|
methods that will be accepted for payment that occurs off of eBay's platform.
|
||||||
|
"""
|
||||||
|
|
||||||
|
category_types: Union[Unset, list['CategoryType']] = UNSET
|
||||||
|
deposit: Union[Unset, 'Deposit'] = UNSET
|
||||||
|
description: Union[Unset, str] = UNSET
|
||||||
|
full_payment_due_in: Union[Unset, 'TimeDuration'] = UNSET
|
||||||
|
immediate_pay: Union[Unset, bool] = UNSET
|
||||||
|
marketplace_id: Union[Unset, str] = UNSET
|
||||||
|
name: Union[Unset, str] = UNSET
|
||||||
|
payment_instructions: Union[Unset, str] = UNSET
|
||||||
|
payment_methods: Union[Unset, list['PaymentMethod']] = UNSET
|
||||||
|
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def to_dict(self) -> dict[str, Any]:
|
||||||
|
from ..models.payment_method import PaymentMethod
|
||||||
|
from ..models.category_type import CategoryType
|
||||||
|
from ..models.time_duration import TimeDuration
|
||||||
|
from ..models.deposit import Deposit
|
||||||
|
category_types: Union[Unset, list[dict[str, Any]]] = UNSET
|
||||||
|
if not isinstance(self.category_types, Unset):
|
||||||
|
category_types = []
|
||||||
|
for category_types_item_data in self.category_types:
|
||||||
|
category_types_item = category_types_item_data.to_dict()
|
||||||
|
category_types.append(category_types_item)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
deposit: Union[Unset, dict[str, Any]] = UNSET
|
||||||
|
if not isinstance(self.deposit, Unset):
|
||||||
|
deposit = self.deposit.to_dict()
|
||||||
|
|
||||||
|
description = self.description
|
||||||
|
|
||||||
|
full_payment_due_in: Union[Unset, dict[str, Any]] = UNSET
|
||||||
|
if not isinstance(self.full_payment_due_in, Unset):
|
||||||
|
full_payment_due_in = self.full_payment_due_in.to_dict()
|
||||||
|
|
||||||
|
immediate_pay = self.immediate_pay
|
||||||
|
|
||||||
|
marketplace_id = self.marketplace_id
|
||||||
|
|
||||||
|
name = self.name
|
||||||
|
|
||||||
|
payment_instructions = self.payment_instructions
|
||||||
|
|
||||||
|
payment_methods: Union[Unset, list[dict[str, Any]]] = UNSET
|
||||||
|
if not isinstance(self.payment_methods, Unset):
|
||||||
|
payment_methods = []
|
||||||
|
for payment_methods_item_data in self.payment_methods:
|
||||||
|
payment_methods_item = payment_methods_item_data.to_dict()
|
||||||
|
payment_methods.append(payment_methods_item)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
field_dict: dict[str, Any] = {}
|
||||||
|
field_dict.update(self.additional_properties)
|
||||||
|
field_dict.update({
|
||||||
|
})
|
||||||
|
if category_types is not UNSET:
|
||||||
|
field_dict["categoryTypes"] = category_types
|
||||||
|
if deposit is not UNSET:
|
||||||
|
field_dict["deposit"] = deposit
|
||||||
|
if description is not UNSET:
|
||||||
|
field_dict["description"] = description
|
||||||
|
if full_payment_due_in is not UNSET:
|
||||||
|
field_dict["fullPaymentDueIn"] = full_payment_due_in
|
||||||
|
if immediate_pay is not UNSET:
|
||||||
|
field_dict["immediatePay"] = immediate_pay
|
||||||
|
if marketplace_id is not UNSET:
|
||||||
|
field_dict["marketplaceId"] = marketplace_id
|
||||||
|
if name is not UNSET:
|
||||||
|
field_dict["name"] = name
|
||||||
|
if payment_instructions is not UNSET:
|
||||||
|
field_dict["paymentInstructions"] = payment_instructions
|
||||||
|
if payment_methods is not UNSET:
|
||||||
|
field_dict["paymentMethods"] = payment_methods
|
||||||
|
|
||||||
|
return field_dict
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||||
|
from ..models.payment_method import PaymentMethod
|
||||||
|
from ..models.category_type import CategoryType
|
||||||
|
from ..models.time_duration import TimeDuration
|
||||||
|
from ..models.deposit import Deposit
|
||||||
|
d = dict(src_dict)
|
||||||
|
category_types = []
|
||||||
|
_category_types = d.pop("categoryTypes", UNSET)
|
||||||
|
for category_types_item_data in (_category_types or []):
|
||||||
|
category_types_item = CategoryType.from_dict(category_types_item_data)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
category_types.append(category_types_item)
|
||||||
|
|
||||||
|
|
||||||
|
_deposit = d.pop("deposit", UNSET)
|
||||||
|
deposit: Union[Unset, Deposit]
|
||||||
|
if isinstance(_deposit, Unset):
|
||||||
|
deposit = UNSET
|
||||||
|
else:
|
||||||
|
deposit = Deposit.from_dict(_deposit)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
description = d.pop("description", UNSET)
|
||||||
|
|
||||||
|
_full_payment_due_in = d.pop("fullPaymentDueIn", UNSET)
|
||||||
|
full_payment_due_in: Union[Unset, TimeDuration]
|
||||||
|
if isinstance(_full_payment_due_in, Unset):
|
||||||
|
full_payment_due_in = UNSET
|
||||||
|
else:
|
||||||
|
full_payment_due_in = TimeDuration.from_dict(_full_payment_due_in)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
immediate_pay = d.pop("immediatePay", UNSET)
|
||||||
|
|
||||||
|
marketplace_id = d.pop("marketplaceId", UNSET)
|
||||||
|
|
||||||
|
name = d.pop("name", UNSET)
|
||||||
|
|
||||||
|
payment_instructions = d.pop("paymentInstructions", UNSET)
|
||||||
|
|
||||||
|
payment_methods = []
|
||||||
|
_payment_methods = d.pop("paymentMethods", UNSET)
|
||||||
|
for payment_methods_item_data in (_payment_methods or []):
|
||||||
|
payment_methods_item = PaymentMethod.from_dict(payment_methods_item_data)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
payment_methods.append(payment_methods_item)
|
||||||
|
|
||||||
|
|
||||||
|
payment_policy_request = cls(
|
||||||
|
category_types=category_types,
|
||||||
|
deposit=deposit,
|
||||||
|
description=description,
|
||||||
|
full_payment_due_in=full_payment_due_in,
|
||||||
|
immediate_pay=immediate_pay,
|
||||||
|
marketplace_id=marketplace_id,
|
||||||
|
name=name,
|
||||||
|
payment_instructions=payment_instructions,
|
||||||
|
payment_methods=payment_methods,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
payment_policy_request.additional_properties = d
|
||||||
|
return payment_policy_request
|
||||||
|
|
||||||
|
@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
|
||||||
158
ebay_client/generated/account/models/payment_policy_response.py
Normal file
158
ebay_client/generated/account/models/payment_policy_response.py
Normal file
|
|
@ -0,0 +1,158 @@
|
||||||
|
from collections.abc import Mapping
|
||||||
|
from typing import Any, TypeVar, Optional, BinaryIO, TextIO, TYPE_CHECKING, Generator
|
||||||
|
|
||||||
|
from attrs import define as _attrs_define
|
||||||
|
from attrs import field as _attrs_field
|
||||||
|
|
||||||
|
from ..types import UNSET, Unset
|
||||||
|
|
||||||
|
from ..types import UNSET, Unset
|
||||||
|
from typing import cast
|
||||||
|
from typing import Union
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from ..models.payment_policy import PaymentPolicy
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
T = TypeVar("T", bound="PaymentPolicyResponse")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@_attrs_define
|
||||||
|
class PaymentPolicyResponse:
|
||||||
|
""" The response payload for the <b>getPaymentPolicies</b> method. <br><br><span class="tablenote"><b>Note</b>:
|
||||||
|
Pagination has not yet been enabled for <b>getPaymentPolicies</b>, so all of the pagination-related fields are for
|
||||||
|
future use.</span>
|
||||||
|
|
||||||
|
Attributes:
|
||||||
|
href (Union[Unset, str]): This field is for future use.
|
||||||
|
limit (Union[Unset, int]): This field is for future use.
|
||||||
|
next_ (Union[Unset, str]): This field is for future use.
|
||||||
|
offset (Union[Unset, int]): This field is for future use.
|
||||||
|
payment_policies (Union[Unset, list['PaymentPolicy']]): A list of all of the seller's payment business policies
|
||||||
|
defined for the specified marketplace. This array will be returned as empty if no payment business policies are
|
||||||
|
defined for the specified marketplace.
|
||||||
|
prev (Union[Unset, str]): This field is for future use.
|
||||||
|
total (Union[Unset, int]): The total number of payment business policies retrieved in the result set.
|
||||||
|
<br><br>If no payment business policies are defined for the specified marketplace, this field is returned with a
|
||||||
|
value of <code>0</code>.
|
||||||
|
"""
|
||||||
|
|
||||||
|
href: Union[Unset, str] = UNSET
|
||||||
|
limit: Union[Unset, int] = UNSET
|
||||||
|
next_: Union[Unset, str] = UNSET
|
||||||
|
offset: Union[Unset, int] = UNSET
|
||||||
|
payment_policies: Union[Unset, list['PaymentPolicy']] = UNSET
|
||||||
|
prev: Union[Unset, str] = UNSET
|
||||||
|
total: Union[Unset, int] = UNSET
|
||||||
|
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def to_dict(self) -> dict[str, Any]:
|
||||||
|
from ..models.payment_policy import PaymentPolicy
|
||||||
|
href = self.href
|
||||||
|
|
||||||
|
limit = self.limit
|
||||||
|
|
||||||
|
next_ = self.next_
|
||||||
|
|
||||||
|
offset = self.offset
|
||||||
|
|
||||||
|
payment_policies: Union[Unset, list[dict[str, Any]]] = UNSET
|
||||||
|
if not isinstance(self.payment_policies, Unset):
|
||||||
|
payment_policies = []
|
||||||
|
for payment_policies_item_data in self.payment_policies:
|
||||||
|
payment_policies_item = payment_policies_item_data.to_dict()
|
||||||
|
payment_policies.append(payment_policies_item)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
prev = self.prev
|
||||||
|
|
||||||
|
total = self.total
|
||||||
|
|
||||||
|
|
||||||
|
field_dict: dict[str, Any] = {}
|
||||||
|
field_dict.update(self.additional_properties)
|
||||||
|
field_dict.update({
|
||||||
|
})
|
||||||
|
if href is not UNSET:
|
||||||
|
field_dict["href"] = href
|
||||||
|
if limit is not UNSET:
|
||||||
|
field_dict["limit"] = limit
|
||||||
|
if next_ is not UNSET:
|
||||||
|
field_dict["next"] = next_
|
||||||
|
if offset is not UNSET:
|
||||||
|
field_dict["offset"] = offset
|
||||||
|
if payment_policies is not UNSET:
|
||||||
|
field_dict["paymentPolicies"] = payment_policies
|
||||||
|
if prev is not UNSET:
|
||||||
|
field_dict["prev"] = prev
|
||||||
|
if total is not UNSET:
|
||||||
|
field_dict["total"] = total
|
||||||
|
|
||||||
|
return field_dict
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||||
|
from ..models.payment_policy import PaymentPolicy
|
||||||
|
d = dict(src_dict)
|
||||||
|
href = d.pop("href", UNSET)
|
||||||
|
|
||||||
|
limit = d.pop("limit", UNSET)
|
||||||
|
|
||||||
|
next_ = d.pop("next", UNSET)
|
||||||
|
|
||||||
|
offset = d.pop("offset", UNSET)
|
||||||
|
|
||||||
|
payment_policies = []
|
||||||
|
_payment_policies = d.pop("paymentPolicies", UNSET)
|
||||||
|
for payment_policies_item_data in (_payment_policies or []):
|
||||||
|
payment_policies_item = PaymentPolicy.from_dict(payment_policies_item_data)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
payment_policies.append(payment_policies_item)
|
||||||
|
|
||||||
|
|
||||||
|
prev = d.pop("prev", UNSET)
|
||||||
|
|
||||||
|
total = d.pop("total", UNSET)
|
||||||
|
|
||||||
|
payment_policy_response = cls(
|
||||||
|
href=href,
|
||||||
|
limit=limit,
|
||||||
|
next_=next_,
|
||||||
|
offset=offset,
|
||||||
|
payment_policies=payment_policies,
|
||||||
|
prev=prev,
|
||||||
|
total=total,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
payment_policy_response.additional_properties = d
|
||||||
|
return payment_policy_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
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue