add advertising client
This commit is contained in:
parent
c9b18e8d3a
commit
ebffc9db61
178 changed files with 23402 additions and 0 deletions
103
utils/advertising_client.py
Normal file
103
utils/advertising_client.py
Normal file
|
|
@ -0,0 +1,103 @@
|
|||
import time
|
||||
|
||||
import requests
|
||||
from django.conf import settings
|
||||
from django.core.cache import cache
|
||||
from httpx import Request
|
||||
|
||||
from utils.clients.gooyal_advertising_client import AuthenticatedClient
|
||||
from utils.clients.gooyal_advertising_client.api.crm.crm_tickets_list import sync as crm_tickets_list_sync
|
||||
from utils.clients.gooyal_advertising_client.api.crm.crm_application_tickets_list import sync as crm_application_tickets_list_sync
|
||||
from utils.clients.gooyal_advertising_client.api.suggestions.suggestions_suggest_list import sync as suggestions_suggest_list_sync
|
||||
from utils.clients.gooyal_advertising_client.models.paginated_ticket_list import PaginatedTicketList
|
||||
from utils.clients.gooyal_advertising_client.models.paginated_suggestion_list import PaginatedSuggestionList
|
||||
|
||||
|
||||
def login_as_client_credentials():
|
||||
access_token = cache.get('advertising_access_token')
|
||||
if access_token:
|
||||
print('already in cache')
|
||||
return access_token
|
||||
|
||||
print('not in cache')
|
||||
|
||||
data = {
|
||||
'grant_type': 'client_credentials',
|
||||
'scope': settings.OAUTH2_PROVIDER_SCOPES,
|
||||
}
|
||||
auth = (settings.OAUTH2_PROVIDER_CLIENT_ID, settings.OAUTH2_PROVIDER_CLIENT_SECRET)
|
||||
|
||||
response = requests.post(
|
||||
f'{settings.OAUTH2_PROVIDER_BASE_PUBLIC_URL}/token/',
|
||||
data=data,
|
||||
auth=auth,
|
||||
)
|
||||
print(response.content)
|
||||
|
||||
auth_data = response.json()
|
||||
if 'access_token' in auth_data:
|
||||
auth_data['created_at'] = time.time()
|
||||
cache.set('advertising_access_token', auth_data, timeout=auth_data.get('expires_in') - 5)
|
||||
|
||||
return auth_data
|
||||
|
||||
|
||||
def log_request(request: Request):
|
||||
print(request.headers.get('authorization'))
|
||||
print(
|
||||
f'Request event hook: {request.method} {request.url} {request.headers} - Waiting for response'
|
||||
)
|
||||
|
||||
|
||||
def log_response(response):
|
||||
request = response.request
|
||||
print(f'Response event hook: {request.method} {request.url} - Status {response.status_code}')
|
||||
|
||||
|
||||
def get_client():
|
||||
access_token = login_as_client_credentials()['access_token']
|
||||
client = AuthenticatedClient(
|
||||
base_url=settings.ADVERTISING_BASE_PUBLIC_URL,
|
||||
token=access_token,
|
||||
httpx_args={
|
||||
'event_hooks': {
|
||||
'request': [log_request],
|
||||
'response': [log_response],
|
||||
}
|
||||
},
|
||||
)
|
||||
return client
|
||||
|
||||
|
||||
def get_suggestions(limit=None, offset=None):
|
||||
client = get_client()
|
||||
response: PaginatedSuggestionList = suggestions_suggest_list_sync(
|
||||
client=client,
|
||||
limit=limit,
|
||||
offset=offset,
|
||||
)
|
||||
print(response)
|
||||
return response
|
||||
|
||||
|
||||
def get_crm_tickets(limit=None, offset=None):
|
||||
client = get_client()
|
||||
response: PaginatedTicketList = crm_tickets_list_sync(
|
||||
client=client,
|
||||
limit=limit,
|
||||
offset=offset,
|
||||
)
|
||||
print(response)
|
||||
return response
|
||||
|
||||
|
||||
def get_crm_application_tickets(limit=None, offset=None):
|
||||
client = get_client()
|
||||
response: PaginatedTicketList = crm_application_tickets_list_sync(
|
||||
client=client,
|
||||
limit=limit,
|
||||
offset=offset,
|
||||
)
|
||||
print(response)
|
||||
return response
|
||||
|
||||
8
utils/clients/gooyal_advertising_client/__init__.py
Normal file
8
utils/clients/gooyal_advertising_client/__init__.py
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
"""A client library for accessing merchants"""
|
||||
|
||||
from .client import AuthenticatedClient, Client
|
||||
|
||||
__all__ = (
|
||||
"AuthenticatedClient",
|
||||
"Client",
|
||||
)
|
||||
1
utils/clients/gooyal_advertising_client/api/__init__.py
Normal file
1
utils/clients/gooyal_advertising_client/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,170 @@
|
|||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.paginated_config_list import PaginatedConfigList
|
||||
from ...types import UNSET, Response, Unset
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
limit: Union[Unset, int] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
) -> dict[str, Any]:
|
||||
params: dict[str, Any] = {}
|
||||
|
||||
params["limit"] = limit
|
||||
|
||||
params["offset"] = offset
|
||||
|
||||
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": "/api/config/",
|
||||
"params": params,
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[PaginatedConfigList]:
|
||||
if response.status_code == 200:
|
||||
response_200 = PaginatedConfigList.from_dict(response.json())
|
||||
|
||||
return response_200
|
||||
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[PaginatedConfigList]:
|
||||
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, int] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
) -> Response[PaginatedConfigList]:
|
||||
"""
|
||||
Args:
|
||||
limit (Union[Unset, int]):
|
||||
offset (Union[Unset, int]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[PaginatedConfigList]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
limit=limit,
|
||||
offset=offset,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
limit: Union[Unset, int] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
) -> Optional[PaginatedConfigList]:
|
||||
"""
|
||||
Args:
|
||||
limit (Union[Unset, int]):
|
||||
offset (Union[Unset, int]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
PaginatedConfigList
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
limit=limit,
|
||||
offset=offset,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
limit: Union[Unset, int] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
) -> Response[PaginatedConfigList]:
|
||||
"""
|
||||
Args:
|
||||
limit (Union[Unset, int]):
|
||||
offset (Union[Unset, int]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[PaginatedConfigList]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
limit=limit,
|
||||
offset=offset,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
limit: Union[Unset, int] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
) -> Optional[PaginatedConfigList]:
|
||||
"""
|
||||
Args:
|
||||
limit (Union[Unset, int]):
|
||||
offset (Union[Unset, int]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
PaginatedConfigList
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
client=client,
|
||||
limit=limit,
|
||||
offset=offset,
|
||||
)
|
||||
).parsed
|
||||
|
|
@ -0,0 +1,78 @@
|
|||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs() -> dict[str, Any]:
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "get",
|
||||
"url": "/api/status",
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
|
||||
if response.status_code == 200:
|
||||
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(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Response[Any]:
|
||||
"""
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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()
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Response[Any]:
|
||||
"""
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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()
|
||||
|
||||
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,151 @@
|
|||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.ticket import Ticket
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
body: Ticket,
|
||||
) -> dict[str, Any]:
|
||||
headers: dict[str, Any] = {}
|
||||
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "post",
|
||||
"url": "/crm/application/tickets/",
|
||||
}
|
||||
|
||||
_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[Ticket]:
|
||||
if response.status_code == 201:
|
||||
response_201 = Ticket.from_dict(response.json())
|
||||
|
||||
return response_201
|
||||
|
||||
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[Ticket]:
|
||||
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: Ticket,
|
||||
) -> Response[Ticket]:
|
||||
"""
|
||||
Args:
|
||||
body (Ticket):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[Ticket]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
body=body,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: Ticket,
|
||||
) -> Optional[Ticket]:
|
||||
"""
|
||||
Args:
|
||||
body (Ticket):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Ticket
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
body=body,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: Ticket,
|
||||
) -> Response[Ticket]:
|
||||
"""
|
||||
Args:
|
||||
body (Ticket):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[Ticket]
|
||||
"""
|
||||
|
||||
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: Ticket,
|
||||
) -> Optional[Ticket]:
|
||||
"""
|
||||
Args:
|
||||
body (Ticket):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Ticket
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
client=client,
|
||||
body=body,
|
||||
)
|
||||
).parsed
|
||||
|
|
@ -0,0 +1,92 @@
|
|||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
id: str,
|
||||
) -> dict[str, Any]:
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "delete",
|
||||
"url": f"/crm/application/tickets/{id}/",
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
|
||||
if response.status_code == 204:
|
||||
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(
|
||||
id: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Response[Any]:
|
||||
"""
|
||||
Args:
|
||||
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(
|
||||
id=id,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
id: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Response[Any]:
|
||||
"""
|
||||
Args:
|
||||
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(
|
||||
id=id,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
|
@ -0,0 +1,170 @@
|
|||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.paginated_ticket_list import PaginatedTicketList
|
||||
from ...types import UNSET, Response, Unset
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
limit: Union[Unset, int] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
) -> dict[str, Any]:
|
||||
params: dict[str, Any] = {}
|
||||
|
||||
params["limit"] = limit
|
||||
|
||||
params["offset"] = offset
|
||||
|
||||
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": "/crm/application/tickets/",
|
||||
"params": params,
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[PaginatedTicketList]:
|
||||
if response.status_code == 200:
|
||||
response_200 = PaginatedTicketList.from_dict(response.json())
|
||||
|
||||
return response_200
|
||||
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[PaginatedTicketList]:
|
||||
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, int] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
) -> Response[PaginatedTicketList]:
|
||||
"""
|
||||
Args:
|
||||
limit (Union[Unset, int]):
|
||||
offset (Union[Unset, int]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[PaginatedTicketList]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
limit=limit,
|
||||
offset=offset,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
limit: Union[Unset, int] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
) -> Optional[PaginatedTicketList]:
|
||||
"""
|
||||
Args:
|
||||
limit (Union[Unset, int]):
|
||||
offset (Union[Unset, int]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
PaginatedTicketList
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
limit=limit,
|
||||
offset=offset,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
limit: Union[Unset, int] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
) -> Response[PaginatedTicketList]:
|
||||
"""
|
||||
Args:
|
||||
limit (Union[Unset, int]):
|
||||
offset (Union[Unset, int]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[PaginatedTicketList]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
limit=limit,
|
||||
offset=offset,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
limit: Union[Unset, int] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
) -> Optional[PaginatedTicketList]:
|
||||
"""
|
||||
Args:
|
||||
limit (Union[Unset, int]):
|
||||
offset (Union[Unset, int]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
PaginatedTicketList
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
client=client,
|
||||
limit=limit,
|
||||
offset=offset,
|
||||
)
|
||||
).parsed
|
||||
|
|
@ -0,0 +1,165 @@
|
|||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.patched_ticket import PatchedTicket
|
||||
from ...models.ticket import Ticket
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
id: str,
|
||||
*,
|
||||
body: PatchedTicket,
|
||||
) -> dict[str, Any]:
|
||||
headers: dict[str, Any] = {}
|
||||
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "patch",
|
||||
"url": f"/crm/application/tickets/{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[Ticket]:
|
||||
if response.status_code == 200:
|
||||
response_200 = Ticket.from_dict(response.json())
|
||||
|
||||
return response_200
|
||||
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Ticket]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
id: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: PatchedTicket,
|
||||
) -> Response[Ticket]:
|
||||
"""
|
||||
Args:
|
||||
id (str):
|
||||
body (PatchedTicket):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[Ticket]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
body=body,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
id: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: PatchedTicket,
|
||||
) -> Optional[Ticket]:
|
||||
"""
|
||||
Args:
|
||||
id (str):
|
||||
body (PatchedTicket):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Ticket
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
body=body,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
id: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: PatchedTicket,
|
||||
) -> Response[Ticket]:
|
||||
"""
|
||||
Args:
|
||||
id (str):
|
||||
body (PatchedTicket):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[Ticket]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
body=body,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
id: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: PatchedTicket,
|
||||
) -> Optional[Ticket]:
|
||||
"""
|
||||
Args:
|
||||
id (str):
|
||||
body (PatchedTicket):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Ticket
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
body=body,
|
||||
)
|
||||
).parsed
|
||||
|
|
@ -0,0 +1,143 @@
|
|||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.ticket import Ticket
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
id: str,
|
||||
) -> dict[str, Any]:
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "get",
|
||||
"url": f"/crm/application/tickets/{id}/",
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Ticket]:
|
||||
if response.status_code == 200:
|
||||
response_200 = Ticket.from_dict(response.json())
|
||||
|
||||
return response_200
|
||||
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Ticket]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
id: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Response[Ticket]:
|
||||
"""
|
||||
Args:
|
||||
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[Ticket]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
id: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Optional[Ticket]:
|
||||
"""
|
||||
Args:
|
||||
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:
|
||||
Ticket
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
id: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Response[Ticket]:
|
||||
"""
|
||||
Args:
|
||||
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[Ticket]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
id: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Optional[Ticket]:
|
||||
"""
|
||||
Args:
|
||||
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:
|
||||
Ticket
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
||||
|
|
@ -0,0 +1,164 @@
|
|||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.ticket import Ticket
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
id: str,
|
||||
*,
|
||||
body: Ticket,
|
||||
) -> dict[str, Any]:
|
||||
headers: dict[str, Any] = {}
|
||||
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "put",
|
||||
"url": f"/crm/application/tickets/{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[Ticket]:
|
||||
if response.status_code == 200:
|
||||
response_200 = Ticket.from_dict(response.json())
|
||||
|
||||
return response_200
|
||||
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Ticket]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
id: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: Ticket,
|
||||
) -> Response[Ticket]:
|
||||
"""
|
||||
Args:
|
||||
id (str):
|
||||
body (Ticket):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[Ticket]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
body=body,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
id: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: Ticket,
|
||||
) -> Optional[Ticket]:
|
||||
"""
|
||||
Args:
|
||||
id (str):
|
||||
body (Ticket):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Ticket
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
body=body,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
id: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: Ticket,
|
||||
) -> Response[Ticket]:
|
||||
"""
|
||||
Args:
|
||||
id (str):
|
||||
body (Ticket):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[Ticket]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
body=body,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
id: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: Ticket,
|
||||
) -> Optional[Ticket]:
|
||||
"""
|
||||
Args:
|
||||
id (str):
|
||||
body (Ticket):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Ticket
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
body=body,
|
||||
)
|
||||
).parsed
|
||||
|
|
@ -0,0 +1,151 @@
|
|||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.ticket import Ticket
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
body: Ticket,
|
||||
) -> dict[str, Any]:
|
||||
headers: dict[str, Any] = {}
|
||||
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "post",
|
||||
"url": "/crm/tickets/",
|
||||
}
|
||||
|
||||
_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[Ticket]:
|
||||
if response.status_code == 201:
|
||||
response_201 = Ticket.from_dict(response.json())
|
||||
|
||||
return response_201
|
||||
|
||||
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[Ticket]:
|
||||
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: Ticket,
|
||||
) -> Response[Ticket]:
|
||||
"""
|
||||
Args:
|
||||
body (Ticket):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[Ticket]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
body=body,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: Ticket,
|
||||
) -> Optional[Ticket]:
|
||||
"""
|
||||
Args:
|
||||
body (Ticket):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Ticket
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
body=body,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: Ticket,
|
||||
) -> Response[Ticket]:
|
||||
"""
|
||||
Args:
|
||||
body (Ticket):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[Ticket]
|
||||
"""
|
||||
|
||||
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: Ticket,
|
||||
) -> Optional[Ticket]:
|
||||
"""
|
||||
Args:
|
||||
body (Ticket):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Ticket
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
client=client,
|
||||
body=body,
|
||||
)
|
||||
).parsed
|
||||
|
|
@ -0,0 +1,92 @@
|
|||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
id: str,
|
||||
) -> dict[str, Any]:
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "delete",
|
||||
"url": f"/crm/tickets/{id}/",
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
|
||||
if response.status_code == 204:
|
||||
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(
|
||||
id: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Response[Any]:
|
||||
"""
|
||||
Args:
|
||||
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(
|
||||
id=id,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
id: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Response[Any]:
|
||||
"""
|
||||
Args:
|
||||
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(
|
||||
id=id,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
|
@ -0,0 +1,170 @@
|
|||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.paginated_ticket_list import PaginatedTicketList
|
||||
from ...types import UNSET, Response, Unset
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
limit: Union[Unset, int] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
) -> dict[str, Any]:
|
||||
params: dict[str, Any] = {}
|
||||
|
||||
params["limit"] = limit
|
||||
|
||||
params["offset"] = offset
|
||||
|
||||
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": "/crm/tickets/",
|
||||
"params": params,
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[PaginatedTicketList]:
|
||||
if response.status_code == 200:
|
||||
response_200 = PaginatedTicketList.from_dict(response.json())
|
||||
|
||||
return response_200
|
||||
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[PaginatedTicketList]:
|
||||
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, int] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
) -> Response[PaginatedTicketList]:
|
||||
"""
|
||||
Args:
|
||||
limit (Union[Unset, int]):
|
||||
offset (Union[Unset, int]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[PaginatedTicketList]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
limit=limit,
|
||||
offset=offset,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
limit: Union[Unset, int] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
) -> Optional[PaginatedTicketList]:
|
||||
"""
|
||||
Args:
|
||||
limit (Union[Unset, int]):
|
||||
offset (Union[Unset, int]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
PaginatedTicketList
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
limit=limit,
|
||||
offset=offset,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
limit: Union[Unset, int] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
) -> Response[PaginatedTicketList]:
|
||||
"""
|
||||
Args:
|
||||
limit (Union[Unset, int]):
|
||||
offset (Union[Unset, int]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[PaginatedTicketList]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
limit=limit,
|
||||
offset=offset,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
limit: Union[Unset, int] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
) -> Optional[PaginatedTicketList]:
|
||||
"""
|
||||
Args:
|
||||
limit (Union[Unset, int]):
|
||||
offset (Union[Unset, int]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
PaginatedTicketList
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
client=client,
|
||||
limit=limit,
|
||||
offset=offset,
|
||||
)
|
||||
).parsed
|
||||
|
|
@ -0,0 +1,165 @@
|
|||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.patched_ticket import PatchedTicket
|
||||
from ...models.ticket import Ticket
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
id: str,
|
||||
*,
|
||||
body: PatchedTicket,
|
||||
) -> dict[str, Any]:
|
||||
headers: dict[str, Any] = {}
|
||||
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "patch",
|
||||
"url": f"/crm/tickets/{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[Ticket]:
|
||||
if response.status_code == 200:
|
||||
response_200 = Ticket.from_dict(response.json())
|
||||
|
||||
return response_200
|
||||
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Ticket]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
id: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: PatchedTicket,
|
||||
) -> Response[Ticket]:
|
||||
"""
|
||||
Args:
|
||||
id (str):
|
||||
body (PatchedTicket):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[Ticket]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
body=body,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
id: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: PatchedTicket,
|
||||
) -> Optional[Ticket]:
|
||||
"""
|
||||
Args:
|
||||
id (str):
|
||||
body (PatchedTicket):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Ticket
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
body=body,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
id: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: PatchedTicket,
|
||||
) -> Response[Ticket]:
|
||||
"""
|
||||
Args:
|
||||
id (str):
|
||||
body (PatchedTicket):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[Ticket]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
body=body,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
id: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: PatchedTicket,
|
||||
) -> Optional[Ticket]:
|
||||
"""
|
||||
Args:
|
||||
id (str):
|
||||
body (PatchedTicket):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Ticket
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
body=body,
|
||||
)
|
||||
).parsed
|
||||
|
|
@ -0,0 +1,143 @@
|
|||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.ticket import Ticket
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
id: str,
|
||||
) -> dict[str, Any]:
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "get",
|
||||
"url": f"/crm/tickets/{id}/",
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Ticket]:
|
||||
if response.status_code == 200:
|
||||
response_200 = Ticket.from_dict(response.json())
|
||||
|
||||
return response_200
|
||||
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Ticket]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
id: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Response[Ticket]:
|
||||
"""
|
||||
Args:
|
||||
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[Ticket]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
id: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Optional[Ticket]:
|
||||
"""
|
||||
Args:
|
||||
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:
|
||||
Ticket
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
id: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Response[Ticket]:
|
||||
"""
|
||||
Args:
|
||||
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[Ticket]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
id: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Optional[Ticket]:
|
||||
"""
|
||||
Args:
|
||||
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:
|
||||
Ticket
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
||||
|
|
@ -0,0 +1,164 @@
|
|||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.ticket import Ticket
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
id: str,
|
||||
*,
|
||||
body: Ticket,
|
||||
) -> dict[str, Any]:
|
||||
headers: dict[str, Any] = {}
|
||||
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "put",
|
||||
"url": f"/crm/tickets/{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[Ticket]:
|
||||
if response.status_code == 200:
|
||||
response_200 = Ticket.from_dict(response.json())
|
||||
|
||||
return response_200
|
||||
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Ticket]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
id: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: Ticket,
|
||||
) -> Response[Ticket]:
|
||||
"""
|
||||
Args:
|
||||
id (str):
|
||||
body (Ticket):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[Ticket]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
body=body,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
id: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: Ticket,
|
||||
) -> Optional[Ticket]:
|
||||
"""
|
||||
Args:
|
||||
id (str):
|
||||
body (Ticket):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Ticket
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
body=body,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
id: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: Ticket,
|
||||
) -> Response[Ticket]:
|
||||
"""
|
||||
Args:
|
||||
id (str):
|
||||
body (Ticket):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[Ticket]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
body=body,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
id: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: Ticket,
|
||||
) -> Optional[Ticket]:
|
||||
"""
|
||||
Args:
|
||||
id (str):
|
||||
body (Ticket):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Ticket
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
body=body,
|
||||
)
|
||||
).parsed
|
||||
|
|
@ -0,0 +1 @@
|
|||
"""Contains endpoint functions for accessing the API"""
|
||||
|
|
@ -0,0 +1,445 @@
|
|||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.paginated_ad_with_visit_list import PaginatedAdWithVisitList
|
||||
from ...models.stores_ads_bookmarked_list_ordering_item import StoresAdsBookmarkedListOrderingItem
|
||||
from ...types import UNSET, Response, Unset
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
bookmark: Union[Unset, bool] = UNSET,
|
||||
favorite: Union[Unset, bool] = UNSET,
|
||||
limit: Union[Unset, int] = UNSET,
|
||||
location_dst: Union[Unset, str] = UNSET,
|
||||
location_lat: Union[Unset, str] = UNSET,
|
||||
location_lon: Union[Unset, str] = UNSET,
|
||||
max_lat: Union[Unset, str] = UNSET,
|
||||
max_lon: Union[Unset, str] = UNSET,
|
||||
min_lat: Union[Unset, str] = UNSET,
|
||||
min_lon: Union[Unset, str] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
ordering: Union[Unset, list[StoresAdsBookmarkedListOrderingItem]] = UNSET,
|
||||
payment_state_in: Union[Unset, list[int]] = UNSET,
|
||||
search: Union[Unset, str] = UNSET,
|
||||
state_in: Union[Unset, list[int]] = UNSET,
|
||||
tags: Union[Unset, str] = UNSET,
|
||||
title_icontains: Union[Unset, str] = UNSET,
|
||||
type_in: Union[Unset, list[int]] = UNSET,
|
||||
visited: Union[Unset, bool] = UNSET,
|
||||
) -> dict[str, Any]:
|
||||
params: dict[str, Any] = {}
|
||||
|
||||
params["bookmark"] = bookmark
|
||||
|
||||
params["favorite"] = favorite
|
||||
|
||||
params["limit"] = limit
|
||||
|
||||
params["location_dst"] = location_dst
|
||||
|
||||
params["location_lat"] = location_lat
|
||||
|
||||
params["location_lon"] = location_lon
|
||||
|
||||
params["max_lat"] = max_lat
|
||||
|
||||
params["max_lon"] = max_lon
|
||||
|
||||
params["min_lat"] = min_lat
|
||||
|
||||
params["min_lon"] = min_lon
|
||||
|
||||
params["offset"] = offset
|
||||
|
||||
json_ordering: Union[Unset, list[str]] = UNSET
|
||||
if not isinstance(ordering, Unset):
|
||||
json_ordering = []
|
||||
for ordering_item_data in ordering:
|
||||
ordering_item = ordering_item_data.value
|
||||
json_ordering.append(ordering_item)
|
||||
|
||||
params["ordering"] = json_ordering
|
||||
|
||||
json_payment_state_in: Union[Unset, list[int]] = UNSET
|
||||
if not isinstance(payment_state_in, Unset):
|
||||
json_payment_state_in = payment_state_in
|
||||
|
||||
params["payment_state__in"] = json_payment_state_in
|
||||
|
||||
params["search"] = search
|
||||
|
||||
json_state_in: Union[Unset, list[int]] = UNSET
|
||||
if not isinstance(state_in, Unset):
|
||||
json_state_in = state_in
|
||||
|
||||
params["state__in"] = json_state_in
|
||||
|
||||
params["tags"] = tags
|
||||
|
||||
params["title__icontains"] = title_icontains
|
||||
|
||||
json_type_in: Union[Unset, list[int]] = UNSET
|
||||
if not isinstance(type_in, Unset):
|
||||
json_type_in = type_in
|
||||
|
||||
params["type__in"] = json_type_in
|
||||
|
||||
params["visited"] = visited
|
||||
|
||||
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": "/stores/ads/bookmarked/",
|
||||
"params": params,
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[PaginatedAdWithVisitList]:
|
||||
if response.status_code == 200:
|
||||
response_200 = PaginatedAdWithVisitList.from_dict(response.json())
|
||||
|
||||
return response_200
|
||||
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[PaginatedAdWithVisitList]:
|
||||
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,
|
||||
bookmark: Union[Unset, bool] = UNSET,
|
||||
favorite: Union[Unset, bool] = UNSET,
|
||||
limit: Union[Unset, int] = UNSET,
|
||||
location_dst: Union[Unset, str] = UNSET,
|
||||
location_lat: Union[Unset, str] = UNSET,
|
||||
location_lon: Union[Unset, str] = UNSET,
|
||||
max_lat: Union[Unset, str] = UNSET,
|
||||
max_lon: Union[Unset, str] = UNSET,
|
||||
min_lat: Union[Unset, str] = UNSET,
|
||||
min_lon: Union[Unset, str] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
ordering: Union[Unset, list[StoresAdsBookmarkedListOrderingItem]] = UNSET,
|
||||
payment_state_in: Union[Unset, list[int]] = UNSET,
|
||||
search: Union[Unset, str] = UNSET,
|
||||
state_in: Union[Unset, list[int]] = UNSET,
|
||||
tags: Union[Unset, str] = UNSET,
|
||||
title_icontains: Union[Unset, str] = UNSET,
|
||||
type_in: Union[Unset, list[int]] = UNSET,
|
||||
visited: Union[Unset, bool] = UNSET,
|
||||
) -> Response[PaginatedAdWithVisitList]:
|
||||
"""
|
||||
Args:
|
||||
bookmark (Union[Unset, bool]):
|
||||
favorite (Union[Unset, bool]):
|
||||
limit (Union[Unset, int]):
|
||||
location_dst (Union[Unset, str]):
|
||||
location_lat (Union[Unset, str]):
|
||||
location_lon (Union[Unset, str]):
|
||||
max_lat (Union[Unset, str]):
|
||||
max_lon (Union[Unset, str]):
|
||||
min_lat (Union[Unset, str]):
|
||||
min_lon (Union[Unset, str]):
|
||||
offset (Union[Unset, int]):
|
||||
ordering (Union[Unset, list[StoresAdsBookmarkedListOrderingItem]]):
|
||||
payment_state_in (Union[Unset, list[int]]):
|
||||
search (Union[Unset, str]):
|
||||
state_in (Union[Unset, list[int]]):
|
||||
tags (Union[Unset, str]):
|
||||
title_icontains (Union[Unset, str]):
|
||||
type_in (Union[Unset, list[int]]):
|
||||
visited (Union[Unset, bool]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[PaginatedAdWithVisitList]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
bookmark=bookmark,
|
||||
favorite=favorite,
|
||||
limit=limit,
|
||||
location_dst=location_dst,
|
||||
location_lat=location_lat,
|
||||
location_lon=location_lon,
|
||||
max_lat=max_lat,
|
||||
max_lon=max_lon,
|
||||
min_lat=min_lat,
|
||||
min_lon=min_lon,
|
||||
offset=offset,
|
||||
ordering=ordering,
|
||||
payment_state_in=payment_state_in,
|
||||
search=search,
|
||||
state_in=state_in,
|
||||
tags=tags,
|
||||
title_icontains=title_icontains,
|
||||
type_in=type_in,
|
||||
visited=visited,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
bookmark: Union[Unset, bool] = UNSET,
|
||||
favorite: Union[Unset, bool] = UNSET,
|
||||
limit: Union[Unset, int] = UNSET,
|
||||
location_dst: Union[Unset, str] = UNSET,
|
||||
location_lat: Union[Unset, str] = UNSET,
|
||||
location_lon: Union[Unset, str] = UNSET,
|
||||
max_lat: Union[Unset, str] = UNSET,
|
||||
max_lon: Union[Unset, str] = UNSET,
|
||||
min_lat: Union[Unset, str] = UNSET,
|
||||
min_lon: Union[Unset, str] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
ordering: Union[Unset, list[StoresAdsBookmarkedListOrderingItem]] = UNSET,
|
||||
payment_state_in: Union[Unset, list[int]] = UNSET,
|
||||
search: Union[Unset, str] = UNSET,
|
||||
state_in: Union[Unset, list[int]] = UNSET,
|
||||
tags: Union[Unset, str] = UNSET,
|
||||
title_icontains: Union[Unset, str] = UNSET,
|
||||
type_in: Union[Unset, list[int]] = UNSET,
|
||||
visited: Union[Unset, bool] = UNSET,
|
||||
) -> Optional[PaginatedAdWithVisitList]:
|
||||
"""
|
||||
Args:
|
||||
bookmark (Union[Unset, bool]):
|
||||
favorite (Union[Unset, bool]):
|
||||
limit (Union[Unset, int]):
|
||||
location_dst (Union[Unset, str]):
|
||||
location_lat (Union[Unset, str]):
|
||||
location_lon (Union[Unset, str]):
|
||||
max_lat (Union[Unset, str]):
|
||||
max_lon (Union[Unset, str]):
|
||||
min_lat (Union[Unset, str]):
|
||||
min_lon (Union[Unset, str]):
|
||||
offset (Union[Unset, int]):
|
||||
ordering (Union[Unset, list[StoresAdsBookmarkedListOrderingItem]]):
|
||||
payment_state_in (Union[Unset, list[int]]):
|
||||
search (Union[Unset, str]):
|
||||
state_in (Union[Unset, list[int]]):
|
||||
tags (Union[Unset, str]):
|
||||
title_icontains (Union[Unset, str]):
|
||||
type_in (Union[Unset, list[int]]):
|
||||
visited (Union[Unset, bool]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
PaginatedAdWithVisitList
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
bookmark=bookmark,
|
||||
favorite=favorite,
|
||||
limit=limit,
|
||||
location_dst=location_dst,
|
||||
location_lat=location_lat,
|
||||
location_lon=location_lon,
|
||||
max_lat=max_lat,
|
||||
max_lon=max_lon,
|
||||
min_lat=min_lat,
|
||||
min_lon=min_lon,
|
||||
offset=offset,
|
||||
ordering=ordering,
|
||||
payment_state_in=payment_state_in,
|
||||
search=search,
|
||||
state_in=state_in,
|
||||
tags=tags,
|
||||
title_icontains=title_icontains,
|
||||
type_in=type_in,
|
||||
visited=visited,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
bookmark: Union[Unset, bool] = UNSET,
|
||||
favorite: Union[Unset, bool] = UNSET,
|
||||
limit: Union[Unset, int] = UNSET,
|
||||
location_dst: Union[Unset, str] = UNSET,
|
||||
location_lat: Union[Unset, str] = UNSET,
|
||||
location_lon: Union[Unset, str] = UNSET,
|
||||
max_lat: Union[Unset, str] = UNSET,
|
||||
max_lon: Union[Unset, str] = UNSET,
|
||||
min_lat: Union[Unset, str] = UNSET,
|
||||
min_lon: Union[Unset, str] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
ordering: Union[Unset, list[StoresAdsBookmarkedListOrderingItem]] = UNSET,
|
||||
payment_state_in: Union[Unset, list[int]] = UNSET,
|
||||
search: Union[Unset, str] = UNSET,
|
||||
state_in: Union[Unset, list[int]] = UNSET,
|
||||
tags: Union[Unset, str] = UNSET,
|
||||
title_icontains: Union[Unset, str] = UNSET,
|
||||
type_in: Union[Unset, list[int]] = UNSET,
|
||||
visited: Union[Unset, bool] = UNSET,
|
||||
) -> Response[PaginatedAdWithVisitList]:
|
||||
"""
|
||||
Args:
|
||||
bookmark (Union[Unset, bool]):
|
||||
favorite (Union[Unset, bool]):
|
||||
limit (Union[Unset, int]):
|
||||
location_dst (Union[Unset, str]):
|
||||
location_lat (Union[Unset, str]):
|
||||
location_lon (Union[Unset, str]):
|
||||
max_lat (Union[Unset, str]):
|
||||
max_lon (Union[Unset, str]):
|
||||
min_lat (Union[Unset, str]):
|
||||
min_lon (Union[Unset, str]):
|
||||
offset (Union[Unset, int]):
|
||||
ordering (Union[Unset, list[StoresAdsBookmarkedListOrderingItem]]):
|
||||
payment_state_in (Union[Unset, list[int]]):
|
||||
search (Union[Unset, str]):
|
||||
state_in (Union[Unset, list[int]]):
|
||||
tags (Union[Unset, str]):
|
||||
title_icontains (Union[Unset, str]):
|
||||
type_in (Union[Unset, list[int]]):
|
||||
visited (Union[Unset, bool]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[PaginatedAdWithVisitList]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
bookmark=bookmark,
|
||||
favorite=favorite,
|
||||
limit=limit,
|
||||
location_dst=location_dst,
|
||||
location_lat=location_lat,
|
||||
location_lon=location_lon,
|
||||
max_lat=max_lat,
|
||||
max_lon=max_lon,
|
||||
min_lat=min_lat,
|
||||
min_lon=min_lon,
|
||||
offset=offset,
|
||||
ordering=ordering,
|
||||
payment_state_in=payment_state_in,
|
||||
search=search,
|
||||
state_in=state_in,
|
||||
tags=tags,
|
||||
title_icontains=title_icontains,
|
||||
type_in=type_in,
|
||||
visited=visited,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
bookmark: Union[Unset, bool] = UNSET,
|
||||
favorite: Union[Unset, bool] = UNSET,
|
||||
limit: Union[Unset, int] = UNSET,
|
||||
location_dst: Union[Unset, str] = UNSET,
|
||||
location_lat: Union[Unset, str] = UNSET,
|
||||
location_lon: Union[Unset, str] = UNSET,
|
||||
max_lat: Union[Unset, str] = UNSET,
|
||||
max_lon: Union[Unset, str] = UNSET,
|
||||
min_lat: Union[Unset, str] = UNSET,
|
||||
min_lon: Union[Unset, str] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
ordering: Union[Unset, list[StoresAdsBookmarkedListOrderingItem]] = UNSET,
|
||||
payment_state_in: Union[Unset, list[int]] = UNSET,
|
||||
search: Union[Unset, str] = UNSET,
|
||||
state_in: Union[Unset, list[int]] = UNSET,
|
||||
tags: Union[Unset, str] = UNSET,
|
||||
title_icontains: Union[Unset, str] = UNSET,
|
||||
type_in: Union[Unset, list[int]] = UNSET,
|
||||
visited: Union[Unset, bool] = UNSET,
|
||||
) -> Optional[PaginatedAdWithVisitList]:
|
||||
"""
|
||||
Args:
|
||||
bookmark (Union[Unset, bool]):
|
||||
favorite (Union[Unset, bool]):
|
||||
limit (Union[Unset, int]):
|
||||
location_dst (Union[Unset, str]):
|
||||
location_lat (Union[Unset, str]):
|
||||
location_lon (Union[Unset, str]):
|
||||
max_lat (Union[Unset, str]):
|
||||
max_lon (Union[Unset, str]):
|
||||
min_lat (Union[Unset, str]):
|
||||
min_lon (Union[Unset, str]):
|
||||
offset (Union[Unset, int]):
|
||||
ordering (Union[Unset, list[StoresAdsBookmarkedListOrderingItem]]):
|
||||
payment_state_in (Union[Unset, list[int]]):
|
||||
search (Union[Unset, str]):
|
||||
state_in (Union[Unset, list[int]]):
|
||||
tags (Union[Unset, str]):
|
||||
title_icontains (Union[Unset, str]):
|
||||
type_in (Union[Unset, list[int]]):
|
||||
visited (Union[Unset, bool]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
PaginatedAdWithVisitList
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
client=client,
|
||||
bookmark=bookmark,
|
||||
favorite=favorite,
|
||||
limit=limit,
|
||||
location_dst=location_dst,
|
||||
location_lat=location_lat,
|
||||
location_lon=location_lon,
|
||||
max_lat=max_lat,
|
||||
max_lon=max_lon,
|
||||
min_lat=min_lat,
|
||||
min_lon=min_lon,
|
||||
offset=offset,
|
||||
ordering=ordering,
|
||||
payment_state_in=payment_state_in,
|
||||
search=search,
|
||||
state_in=state_in,
|
||||
tags=tags,
|
||||
title_icontains=title_icontains,
|
||||
type_in=type_in,
|
||||
visited=visited,
|
||||
)
|
||||
).parsed
|
||||
|
|
@ -0,0 +1,420 @@
|
|||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.cluster import Cluster
|
||||
from ...models.stores_ads_clusterized_list_ordering_item import StoresAdsClusterizedListOrderingItem
|
||||
from ...types import UNSET, Response, Unset
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
bookmark: Union[Unset, bool] = UNSET,
|
||||
favorite: Union[Unset, bool] = UNSET,
|
||||
location_dst: Union[Unset, str] = UNSET,
|
||||
location_lat: Union[Unset, str] = UNSET,
|
||||
location_lon: Union[Unset, str] = UNSET,
|
||||
max_lat: Union[Unset, str] = UNSET,
|
||||
max_lon: Union[Unset, str] = UNSET,
|
||||
min_lat: Union[Unset, str] = UNSET,
|
||||
min_lon: Union[Unset, str] = UNSET,
|
||||
ordering: Union[Unset, list[StoresAdsClusterizedListOrderingItem]] = UNSET,
|
||||
payment_state_in: Union[Unset, list[int]] = UNSET,
|
||||
search: Union[Unset, str] = UNSET,
|
||||
state_in: Union[Unset, list[int]] = UNSET,
|
||||
tags: Union[Unset, str] = UNSET,
|
||||
title_icontains: Union[Unset, str] = UNSET,
|
||||
type_in: Union[Unset, list[int]] = UNSET,
|
||||
visited: Union[Unset, bool] = UNSET,
|
||||
) -> dict[str, Any]:
|
||||
params: dict[str, Any] = {}
|
||||
|
||||
params["bookmark"] = bookmark
|
||||
|
||||
params["favorite"] = favorite
|
||||
|
||||
params["location_dst"] = location_dst
|
||||
|
||||
params["location_lat"] = location_lat
|
||||
|
||||
params["location_lon"] = location_lon
|
||||
|
||||
params["max_lat"] = max_lat
|
||||
|
||||
params["max_lon"] = max_lon
|
||||
|
||||
params["min_lat"] = min_lat
|
||||
|
||||
params["min_lon"] = min_lon
|
||||
|
||||
json_ordering: Union[Unset, list[str]] = UNSET
|
||||
if not isinstance(ordering, Unset):
|
||||
json_ordering = []
|
||||
for ordering_item_data in ordering:
|
||||
ordering_item = ordering_item_data.value
|
||||
json_ordering.append(ordering_item)
|
||||
|
||||
params["ordering"] = json_ordering
|
||||
|
||||
json_payment_state_in: Union[Unset, list[int]] = UNSET
|
||||
if not isinstance(payment_state_in, Unset):
|
||||
json_payment_state_in = payment_state_in
|
||||
|
||||
params["payment_state__in"] = json_payment_state_in
|
||||
|
||||
params["search"] = search
|
||||
|
||||
json_state_in: Union[Unset, list[int]] = UNSET
|
||||
if not isinstance(state_in, Unset):
|
||||
json_state_in = state_in
|
||||
|
||||
params["state__in"] = json_state_in
|
||||
|
||||
params["tags"] = tags
|
||||
|
||||
params["title__icontains"] = title_icontains
|
||||
|
||||
json_type_in: Union[Unset, list[int]] = UNSET
|
||||
if not isinstance(type_in, Unset):
|
||||
json_type_in = type_in
|
||||
|
||||
params["type__in"] = json_type_in
|
||||
|
||||
params["visited"] = visited
|
||||
|
||||
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": "/stores/ads/clusterized/",
|
||||
"params": params,
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[list["Cluster"]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = []
|
||||
_response_200 = response.json()
|
||||
for response_200_item_data in _response_200:
|
||||
response_200_item = Cluster.from_dict(response_200_item_data)
|
||||
|
||||
response_200.append(response_200_item)
|
||||
|
||||
return response_200
|
||||
|
||||
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[list["Cluster"]]:
|
||||
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,
|
||||
bookmark: Union[Unset, bool] = UNSET,
|
||||
favorite: Union[Unset, bool] = UNSET,
|
||||
location_dst: Union[Unset, str] = UNSET,
|
||||
location_lat: Union[Unset, str] = UNSET,
|
||||
location_lon: Union[Unset, str] = UNSET,
|
||||
max_lat: Union[Unset, str] = UNSET,
|
||||
max_lon: Union[Unset, str] = UNSET,
|
||||
min_lat: Union[Unset, str] = UNSET,
|
||||
min_lon: Union[Unset, str] = UNSET,
|
||||
ordering: Union[Unset, list[StoresAdsClusterizedListOrderingItem]] = UNSET,
|
||||
payment_state_in: Union[Unset, list[int]] = UNSET,
|
||||
search: Union[Unset, str] = UNSET,
|
||||
state_in: Union[Unset, list[int]] = UNSET,
|
||||
tags: Union[Unset, str] = UNSET,
|
||||
title_icontains: Union[Unset, str] = UNSET,
|
||||
type_in: Union[Unset, list[int]] = UNSET,
|
||||
visited: Union[Unset, bool] = UNSET,
|
||||
) -> Response[list["Cluster"]]:
|
||||
"""
|
||||
Args:
|
||||
bookmark (Union[Unset, bool]):
|
||||
favorite (Union[Unset, bool]):
|
||||
location_dst (Union[Unset, str]):
|
||||
location_lat (Union[Unset, str]):
|
||||
location_lon (Union[Unset, str]):
|
||||
max_lat (Union[Unset, str]):
|
||||
max_lon (Union[Unset, str]):
|
||||
min_lat (Union[Unset, str]):
|
||||
min_lon (Union[Unset, str]):
|
||||
ordering (Union[Unset, list[StoresAdsClusterizedListOrderingItem]]):
|
||||
payment_state_in (Union[Unset, list[int]]):
|
||||
search (Union[Unset, str]):
|
||||
state_in (Union[Unset, list[int]]):
|
||||
tags (Union[Unset, str]):
|
||||
title_icontains (Union[Unset, str]):
|
||||
type_in (Union[Unset, list[int]]):
|
||||
visited (Union[Unset, bool]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[list['Cluster']]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
bookmark=bookmark,
|
||||
favorite=favorite,
|
||||
location_dst=location_dst,
|
||||
location_lat=location_lat,
|
||||
location_lon=location_lon,
|
||||
max_lat=max_lat,
|
||||
max_lon=max_lon,
|
||||
min_lat=min_lat,
|
||||
min_lon=min_lon,
|
||||
ordering=ordering,
|
||||
payment_state_in=payment_state_in,
|
||||
search=search,
|
||||
state_in=state_in,
|
||||
tags=tags,
|
||||
title_icontains=title_icontains,
|
||||
type_in=type_in,
|
||||
visited=visited,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
bookmark: Union[Unset, bool] = UNSET,
|
||||
favorite: Union[Unset, bool] = UNSET,
|
||||
location_dst: Union[Unset, str] = UNSET,
|
||||
location_lat: Union[Unset, str] = UNSET,
|
||||
location_lon: Union[Unset, str] = UNSET,
|
||||
max_lat: Union[Unset, str] = UNSET,
|
||||
max_lon: Union[Unset, str] = UNSET,
|
||||
min_lat: Union[Unset, str] = UNSET,
|
||||
min_lon: Union[Unset, str] = UNSET,
|
||||
ordering: Union[Unset, list[StoresAdsClusterizedListOrderingItem]] = UNSET,
|
||||
payment_state_in: Union[Unset, list[int]] = UNSET,
|
||||
search: Union[Unset, str] = UNSET,
|
||||
state_in: Union[Unset, list[int]] = UNSET,
|
||||
tags: Union[Unset, str] = UNSET,
|
||||
title_icontains: Union[Unset, str] = UNSET,
|
||||
type_in: Union[Unset, list[int]] = UNSET,
|
||||
visited: Union[Unset, bool] = UNSET,
|
||||
) -> Optional[list["Cluster"]]:
|
||||
"""
|
||||
Args:
|
||||
bookmark (Union[Unset, bool]):
|
||||
favorite (Union[Unset, bool]):
|
||||
location_dst (Union[Unset, str]):
|
||||
location_lat (Union[Unset, str]):
|
||||
location_lon (Union[Unset, str]):
|
||||
max_lat (Union[Unset, str]):
|
||||
max_lon (Union[Unset, str]):
|
||||
min_lat (Union[Unset, str]):
|
||||
min_lon (Union[Unset, str]):
|
||||
ordering (Union[Unset, list[StoresAdsClusterizedListOrderingItem]]):
|
||||
payment_state_in (Union[Unset, list[int]]):
|
||||
search (Union[Unset, str]):
|
||||
state_in (Union[Unset, list[int]]):
|
||||
tags (Union[Unset, str]):
|
||||
title_icontains (Union[Unset, str]):
|
||||
type_in (Union[Unset, list[int]]):
|
||||
visited (Union[Unset, bool]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
list['Cluster']
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
bookmark=bookmark,
|
||||
favorite=favorite,
|
||||
location_dst=location_dst,
|
||||
location_lat=location_lat,
|
||||
location_lon=location_lon,
|
||||
max_lat=max_lat,
|
||||
max_lon=max_lon,
|
||||
min_lat=min_lat,
|
||||
min_lon=min_lon,
|
||||
ordering=ordering,
|
||||
payment_state_in=payment_state_in,
|
||||
search=search,
|
||||
state_in=state_in,
|
||||
tags=tags,
|
||||
title_icontains=title_icontains,
|
||||
type_in=type_in,
|
||||
visited=visited,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
bookmark: Union[Unset, bool] = UNSET,
|
||||
favorite: Union[Unset, bool] = UNSET,
|
||||
location_dst: Union[Unset, str] = UNSET,
|
||||
location_lat: Union[Unset, str] = UNSET,
|
||||
location_lon: Union[Unset, str] = UNSET,
|
||||
max_lat: Union[Unset, str] = UNSET,
|
||||
max_lon: Union[Unset, str] = UNSET,
|
||||
min_lat: Union[Unset, str] = UNSET,
|
||||
min_lon: Union[Unset, str] = UNSET,
|
||||
ordering: Union[Unset, list[StoresAdsClusterizedListOrderingItem]] = UNSET,
|
||||
payment_state_in: Union[Unset, list[int]] = UNSET,
|
||||
search: Union[Unset, str] = UNSET,
|
||||
state_in: Union[Unset, list[int]] = UNSET,
|
||||
tags: Union[Unset, str] = UNSET,
|
||||
title_icontains: Union[Unset, str] = UNSET,
|
||||
type_in: Union[Unset, list[int]] = UNSET,
|
||||
visited: Union[Unset, bool] = UNSET,
|
||||
) -> Response[list["Cluster"]]:
|
||||
"""
|
||||
Args:
|
||||
bookmark (Union[Unset, bool]):
|
||||
favorite (Union[Unset, bool]):
|
||||
location_dst (Union[Unset, str]):
|
||||
location_lat (Union[Unset, str]):
|
||||
location_lon (Union[Unset, str]):
|
||||
max_lat (Union[Unset, str]):
|
||||
max_lon (Union[Unset, str]):
|
||||
min_lat (Union[Unset, str]):
|
||||
min_lon (Union[Unset, str]):
|
||||
ordering (Union[Unset, list[StoresAdsClusterizedListOrderingItem]]):
|
||||
payment_state_in (Union[Unset, list[int]]):
|
||||
search (Union[Unset, str]):
|
||||
state_in (Union[Unset, list[int]]):
|
||||
tags (Union[Unset, str]):
|
||||
title_icontains (Union[Unset, str]):
|
||||
type_in (Union[Unset, list[int]]):
|
||||
visited (Union[Unset, bool]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[list['Cluster']]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
bookmark=bookmark,
|
||||
favorite=favorite,
|
||||
location_dst=location_dst,
|
||||
location_lat=location_lat,
|
||||
location_lon=location_lon,
|
||||
max_lat=max_lat,
|
||||
max_lon=max_lon,
|
||||
min_lat=min_lat,
|
||||
min_lon=min_lon,
|
||||
ordering=ordering,
|
||||
payment_state_in=payment_state_in,
|
||||
search=search,
|
||||
state_in=state_in,
|
||||
tags=tags,
|
||||
title_icontains=title_icontains,
|
||||
type_in=type_in,
|
||||
visited=visited,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
bookmark: Union[Unset, bool] = UNSET,
|
||||
favorite: Union[Unset, bool] = UNSET,
|
||||
location_dst: Union[Unset, str] = UNSET,
|
||||
location_lat: Union[Unset, str] = UNSET,
|
||||
location_lon: Union[Unset, str] = UNSET,
|
||||
max_lat: Union[Unset, str] = UNSET,
|
||||
max_lon: Union[Unset, str] = UNSET,
|
||||
min_lat: Union[Unset, str] = UNSET,
|
||||
min_lon: Union[Unset, str] = UNSET,
|
||||
ordering: Union[Unset, list[StoresAdsClusterizedListOrderingItem]] = UNSET,
|
||||
payment_state_in: Union[Unset, list[int]] = UNSET,
|
||||
search: Union[Unset, str] = UNSET,
|
||||
state_in: Union[Unset, list[int]] = UNSET,
|
||||
tags: Union[Unset, str] = UNSET,
|
||||
title_icontains: Union[Unset, str] = UNSET,
|
||||
type_in: Union[Unset, list[int]] = UNSET,
|
||||
visited: Union[Unset, bool] = UNSET,
|
||||
) -> Optional[list["Cluster"]]:
|
||||
"""
|
||||
Args:
|
||||
bookmark (Union[Unset, bool]):
|
||||
favorite (Union[Unset, bool]):
|
||||
location_dst (Union[Unset, str]):
|
||||
location_lat (Union[Unset, str]):
|
||||
location_lon (Union[Unset, str]):
|
||||
max_lat (Union[Unset, str]):
|
||||
max_lon (Union[Unset, str]):
|
||||
min_lat (Union[Unset, str]):
|
||||
min_lon (Union[Unset, str]):
|
||||
ordering (Union[Unset, list[StoresAdsClusterizedListOrderingItem]]):
|
||||
payment_state_in (Union[Unset, list[int]]):
|
||||
search (Union[Unset, str]):
|
||||
state_in (Union[Unset, list[int]]):
|
||||
tags (Union[Unset, str]):
|
||||
title_icontains (Union[Unset, str]):
|
||||
type_in (Union[Unset, list[int]]):
|
||||
visited (Union[Unset, bool]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
list['Cluster']
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
client=client,
|
||||
bookmark=bookmark,
|
||||
favorite=favorite,
|
||||
location_dst=location_dst,
|
||||
location_lat=location_lat,
|
||||
location_lon=location_lon,
|
||||
max_lat=max_lat,
|
||||
max_lon=max_lon,
|
||||
min_lat=min_lat,
|
||||
min_lon=min_lon,
|
||||
ordering=ordering,
|
||||
payment_state_in=payment_state_in,
|
||||
search=search,
|
||||
state_in=state_in,
|
||||
tags=tags,
|
||||
title_icontains=title_icontains,
|
||||
type_in=type_in,
|
||||
visited=visited,
|
||||
)
|
||||
).parsed
|
||||
|
|
@ -0,0 +1,445 @@
|
|||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.paginated_ad_list import PaginatedAdList
|
||||
from ...models.stores_ads_list_ordering_item import StoresAdsListOrderingItem
|
||||
from ...types import UNSET, Response, Unset
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
bookmark: Union[Unset, bool] = UNSET,
|
||||
favorite: Union[Unset, bool] = UNSET,
|
||||
limit: Union[Unset, int] = UNSET,
|
||||
location_dst: Union[Unset, str] = UNSET,
|
||||
location_lat: Union[Unset, str] = UNSET,
|
||||
location_lon: Union[Unset, str] = UNSET,
|
||||
max_lat: Union[Unset, str] = UNSET,
|
||||
max_lon: Union[Unset, str] = UNSET,
|
||||
min_lat: Union[Unset, str] = UNSET,
|
||||
min_lon: Union[Unset, str] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
ordering: Union[Unset, list[StoresAdsListOrderingItem]] = UNSET,
|
||||
payment_state_in: Union[Unset, list[int]] = UNSET,
|
||||
search: Union[Unset, str] = UNSET,
|
||||
state_in: Union[Unset, list[int]] = UNSET,
|
||||
tags: Union[Unset, str] = UNSET,
|
||||
title_icontains: Union[Unset, str] = UNSET,
|
||||
type_in: Union[Unset, list[int]] = UNSET,
|
||||
visited: Union[Unset, bool] = UNSET,
|
||||
) -> dict[str, Any]:
|
||||
params: dict[str, Any] = {}
|
||||
|
||||
params["bookmark"] = bookmark
|
||||
|
||||
params["favorite"] = favorite
|
||||
|
||||
params["limit"] = limit
|
||||
|
||||
params["location_dst"] = location_dst
|
||||
|
||||
params["location_lat"] = location_lat
|
||||
|
||||
params["location_lon"] = location_lon
|
||||
|
||||
params["max_lat"] = max_lat
|
||||
|
||||
params["max_lon"] = max_lon
|
||||
|
||||
params["min_lat"] = min_lat
|
||||
|
||||
params["min_lon"] = min_lon
|
||||
|
||||
params["offset"] = offset
|
||||
|
||||
json_ordering: Union[Unset, list[str]] = UNSET
|
||||
if not isinstance(ordering, Unset):
|
||||
json_ordering = []
|
||||
for ordering_item_data in ordering:
|
||||
ordering_item = ordering_item_data.value
|
||||
json_ordering.append(ordering_item)
|
||||
|
||||
params["ordering"] = json_ordering
|
||||
|
||||
json_payment_state_in: Union[Unset, list[int]] = UNSET
|
||||
if not isinstance(payment_state_in, Unset):
|
||||
json_payment_state_in = payment_state_in
|
||||
|
||||
params["payment_state__in"] = json_payment_state_in
|
||||
|
||||
params["search"] = search
|
||||
|
||||
json_state_in: Union[Unset, list[int]] = UNSET
|
||||
if not isinstance(state_in, Unset):
|
||||
json_state_in = state_in
|
||||
|
||||
params["state__in"] = json_state_in
|
||||
|
||||
params["tags"] = tags
|
||||
|
||||
params["title__icontains"] = title_icontains
|
||||
|
||||
json_type_in: Union[Unset, list[int]] = UNSET
|
||||
if not isinstance(type_in, Unset):
|
||||
json_type_in = type_in
|
||||
|
||||
params["type__in"] = json_type_in
|
||||
|
||||
params["visited"] = visited
|
||||
|
||||
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": "/stores/ads/",
|
||||
"params": params,
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[PaginatedAdList]:
|
||||
if response.status_code == 200:
|
||||
response_200 = PaginatedAdList.from_dict(response.json())
|
||||
|
||||
return response_200
|
||||
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[PaginatedAdList]:
|
||||
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,
|
||||
bookmark: Union[Unset, bool] = UNSET,
|
||||
favorite: Union[Unset, bool] = UNSET,
|
||||
limit: Union[Unset, int] = UNSET,
|
||||
location_dst: Union[Unset, str] = UNSET,
|
||||
location_lat: Union[Unset, str] = UNSET,
|
||||
location_lon: Union[Unset, str] = UNSET,
|
||||
max_lat: Union[Unset, str] = UNSET,
|
||||
max_lon: Union[Unset, str] = UNSET,
|
||||
min_lat: Union[Unset, str] = UNSET,
|
||||
min_lon: Union[Unset, str] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
ordering: Union[Unset, list[StoresAdsListOrderingItem]] = UNSET,
|
||||
payment_state_in: Union[Unset, list[int]] = UNSET,
|
||||
search: Union[Unset, str] = UNSET,
|
||||
state_in: Union[Unset, list[int]] = UNSET,
|
||||
tags: Union[Unset, str] = UNSET,
|
||||
title_icontains: Union[Unset, str] = UNSET,
|
||||
type_in: Union[Unset, list[int]] = UNSET,
|
||||
visited: Union[Unset, bool] = UNSET,
|
||||
) -> Response[PaginatedAdList]:
|
||||
"""
|
||||
Args:
|
||||
bookmark (Union[Unset, bool]):
|
||||
favorite (Union[Unset, bool]):
|
||||
limit (Union[Unset, int]):
|
||||
location_dst (Union[Unset, str]):
|
||||
location_lat (Union[Unset, str]):
|
||||
location_lon (Union[Unset, str]):
|
||||
max_lat (Union[Unset, str]):
|
||||
max_lon (Union[Unset, str]):
|
||||
min_lat (Union[Unset, str]):
|
||||
min_lon (Union[Unset, str]):
|
||||
offset (Union[Unset, int]):
|
||||
ordering (Union[Unset, list[StoresAdsListOrderingItem]]):
|
||||
payment_state_in (Union[Unset, list[int]]):
|
||||
search (Union[Unset, str]):
|
||||
state_in (Union[Unset, list[int]]):
|
||||
tags (Union[Unset, str]):
|
||||
title_icontains (Union[Unset, str]):
|
||||
type_in (Union[Unset, list[int]]):
|
||||
visited (Union[Unset, bool]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[PaginatedAdList]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
bookmark=bookmark,
|
||||
favorite=favorite,
|
||||
limit=limit,
|
||||
location_dst=location_dst,
|
||||
location_lat=location_lat,
|
||||
location_lon=location_lon,
|
||||
max_lat=max_lat,
|
||||
max_lon=max_lon,
|
||||
min_lat=min_lat,
|
||||
min_lon=min_lon,
|
||||
offset=offset,
|
||||
ordering=ordering,
|
||||
payment_state_in=payment_state_in,
|
||||
search=search,
|
||||
state_in=state_in,
|
||||
tags=tags,
|
||||
title_icontains=title_icontains,
|
||||
type_in=type_in,
|
||||
visited=visited,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
bookmark: Union[Unset, bool] = UNSET,
|
||||
favorite: Union[Unset, bool] = UNSET,
|
||||
limit: Union[Unset, int] = UNSET,
|
||||
location_dst: Union[Unset, str] = UNSET,
|
||||
location_lat: Union[Unset, str] = UNSET,
|
||||
location_lon: Union[Unset, str] = UNSET,
|
||||
max_lat: Union[Unset, str] = UNSET,
|
||||
max_lon: Union[Unset, str] = UNSET,
|
||||
min_lat: Union[Unset, str] = UNSET,
|
||||
min_lon: Union[Unset, str] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
ordering: Union[Unset, list[StoresAdsListOrderingItem]] = UNSET,
|
||||
payment_state_in: Union[Unset, list[int]] = UNSET,
|
||||
search: Union[Unset, str] = UNSET,
|
||||
state_in: Union[Unset, list[int]] = UNSET,
|
||||
tags: Union[Unset, str] = UNSET,
|
||||
title_icontains: Union[Unset, str] = UNSET,
|
||||
type_in: Union[Unset, list[int]] = UNSET,
|
||||
visited: Union[Unset, bool] = UNSET,
|
||||
) -> Optional[PaginatedAdList]:
|
||||
"""
|
||||
Args:
|
||||
bookmark (Union[Unset, bool]):
|
||||
favorite (Union[Unset, bool]):
|
||||
limit (Union[Unset, int]):
|
||||
location_dst (Union[Unset, str]):
|
||||
location_lat (Union[Unset, str]):
|
||||
location_lon (Union[Unset, str]):
|
||||
max_lat (Union[Unset, str]):
|
||||
max_lon (Union[Unset, str]):
|
||||
min_lat (Union[Unset, str]):
|
||||
min_lon (Union[Unset, str]):
|
||||
offset (Union[Unset, int]):
|
||||
ordering (Union[Unset, list[StoresAdsListOrderingItem]]):
|
||||
payment_state_in (Union[Unset, list[int]]):
|
||||
search (Union[Unset, str]):
|
||||
state_in (Union[Unset, list[int]]):
|
||||
tags (Union[Unset, str]):
|
||||
title_icontains (Union[Unset, str]):
|
||||
type_in (Union[Unset, list[int]]):
|
||||
visited (Union[Unset, bool]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
PaginatedAdList
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
bookmark=bookmark,
|
||||
favorite=favorite,
|
||||
limit=limit,
|
||||
location_dst=location_dst,
|
||||
location_lat=location_lat,
|
||||
location_lon=location_lon,
|
||||
max_lat=max_lat,
|
||||
max_lon=max_lon,
|
||||
min_lat=min_lat,
|
||||
min_lon=min_lon,
|
||||
offset=offset,
|
||||
ordering=ordering,
|
||||
payment_state_in=payment_state_in,
|
||||
search=search,
|
||||
state_in=state_in,
|
||||
tags=tags,
|
||||
title_icontains=title_icontains,
|
||||
type_in=type_in,
|
||||
visited=visited,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
bookmark: Union[Unset, bool] = UNSET,
|
||||
favorite: Union[Unset, bool] = UNSET,
|
||||
limit: Union[Unset, int] = UNSET,
|
||||
location_dst: Union[Unset, str] = UNSET,
|
||||
location_lat: Union[Unset, str] = UNSET,
|
||||
location_lon: Union[Unset, str] = UNSET,
|
||||
max_lat: Union[Unset, str] = UNSET,
|
||||
max_lon: Union[Unset, str] = UNSET,
|
||||
min_lat: Union[Unset, str] = UNSET,
|
||||
min_lon: Union[Unset, str] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
ordering: Union[Unset, list[StoresAdsListOrderingItem]] = UNSET,
|
||||
payment_state_in: Union[Unset, list[int]] = UNSET,
|
||||
search: Union[Unset, str] = UNSET,
|
||||
state_in: Union[Unset, list[int]] = UNSET,
|
||||
tags: Union[Unset, str] = UNSET,
|
||||
title_icontains: Union[Unset, str] = UNSET,
|
||||
type_in: Union[Unset, list[int]] = UNSET,
|
||||
visited: Union[Unset, bool] = UNSET,
|
||||
) -> Response[PaginatedAdList]:
|
||||
"""
|
||||
Args:
|
||||
bookmark (Union[Unset, bool]):
|
||||
favorite (Union[Unset, bool]):
|
||||
limit (Union[Unset, int]):
|
||||
location_dst (Union[Unset, str]):
|
||||
location_lat (Union[Unset, str]):
|
||||
location_lon (Union[Unset, str]):
|
||||
max_lat (Union[Unset, str]):
|
||||
max_lon (Union[Unset, str]):
|
||||
min_lat (Union[Unset, str]):
|
||||
min_lon (Union[Unset, str]):
|
||||
offset (Union[Unset, int]):
|
||||
ordering (Union[Unset, list[StoresAdsListOrderingItem]]):
|
||||
payment_state_in (Union[Unset, list[int]]):
|
||||
search (Union[Unset, str]):
|
||||
state_in (Union[Unset, list[int]]):
|
||||
tags (Union[Unset, str]):
|
||||
title_icontains (Union[Unset, str]):
|
||||
type_in (Union[Unset, list[int]]):
|
||||
visited (Union[Unset, bool]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[PaginatedAdList]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
bookmark=bookmark,
|
||||
favorite=favorite,
|
||||
limit=limit,
|
||||
location_dst=location_dst,
|
||||
location_lat=location_lat,
|
||||
location_lon=location_lon,
|
||||
max_lat=max_lat,
|
||||
max_lon=max_lon,
|
||||
min_lat=min_lat,
|
||||
min_lon=min_lon,
|
||||
offset=offset,
|
||||
ordering=ordering,
|
||||
payment_state_in=payment_state_in,
|
||||
search=search,
|
||||
state_in=state_in,
|
||||
tags=tags,
|
||||
title_icontains=title_icontains,
|
||||
type_in=type_in,
|
||||
visited=visited,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
bookmark: Union[Unset, bool] = UNSET,
|
||||
favorite: Union[Unset, bool] = UNSET,
|
||||
limit: Union[Unset, int] = UNSET,
|
||||
location_dst: Union[Unset, str] = UNSET,
|
||||
location_lat: Union[Unset, str] = UNSET,
|
||||
location_lon: Union[Unset, str] = UNSET,
|
||||
max_lat: Union[Unset, str] = UNSET,
|
||||
max_lon: Union[Unset, str] = UNSET,
|
||||
min_lat: Union[Unset, str] = UNSET,
|
||||
min_lon: Union[Unset, str] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
ordering: Union[Unset, list[StoresAdsListOrderingItem]] = UNSET,
|
||||
payment_state_in: Union[Unset, list[int]] = UNSET,
|
||||
search: Union[Unset, str] = UNSET,
|
||||
state_in: Union[Unset, list[int]] = UNSET,
|
||||
tags: Union[Unset, str] = UNSET,
|
||||
title_icontains: Union[Unset, str] = UNSET,
|
||||
type_in: Union[Unset, list[int]] = UNSET,
|
||||
visited: Union[Unset, bool] = UNSET,
|
||||
) -> Optional[PaginatedAdList]:
|
||||
"""
|
||||
Args:
|
||||
bookmark (Union[Unset, bool]):
|
||||
favorite (Union[Unset, bool]):
|
||||
limit (Union[Unset, int]):
|
||||
location_dst (Union[Unset, str]):
|
||||
location_lat (Union[Unset, str]):
|
||||
location_lon (Union[Unset, str]):
|
||||
max_lat (Union[Unset, str]):
|
||||
max_lon (Union[Unset, str]):
|
||||
min_lat (Union[Unset, str]):
|
||||
min_lon (Union[Unset, str]):
|
||||
offset (Union[Unset, int]):
|
||||
ordering (Union[Unset, list[StoresAdsListOrderingItem]]):
|
||||
payment_state_in (Union[Unset, list[int]]):
|
||||
search (Union[Unset, str]):
|
||||
state_in (Union[Unset, list[int]]):
|
||||
tags (Union[Unset, str]):
|
||||
title_icontains (Union[Unset, str]):
|
||||
type_in (Union[Unset, list[int]]):
|
||||
visited (Union[Unset, bool]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
PaginatedAdList
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
client=client,
|
||||
bookmark=bookmark,
|
||||
favorite=favorite,
|
||||
limit=limit,
|
||||
location_dst=location_dst,
|
||||
location_lat=location_lat,
|
||||
location_lon=location_lon,
|
||||
max_lat=max_lat,
|
||||
max_lon=max_lon,
|
||||
min_lat=min_lat,
|
||||
min_lon=min_lon,
|
||||
offset=offset,
|
||||
ordering=ordering,
|
||||
payment_state_in=payment_state_in,
|
||||
search=search,
|
||||
state_in=state_in,
|
||||
tags=tags,
|
||||
title_icontains=title_icontains,
|
||||
type_in=type_in,
|
||||
visited=visited,
|
||||
)
|
||||
).parsed
|
||||
|
|
@ -0,0 +1,420 @@
|
|||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.cluster import Cluster
|
||||
from ...models.stores_ads_public_clusterized_list_ordering_item import StoresAdsPublicClusterizedListOrderingItem
|
||||
from ...types import UNSET, Response, Unset
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
bookmark: Union[Unset, bool] = UNSET,
|
||||
favorite: Union[Unset, bool] = UNSET,
|
||||
location_dst: Union[Unset, str] = UNSET,
|
||||
location_lat: Union[Unset, str] = UNSET,
|
||||
location_lon: Union[Unset, str] = UNSET,
|
||||
max_lat: Union[Unset, str] = UNSET,
|
||||
max_lon: Union[Unset, str] = UNSET,
|
||||
min_lat: Union[Unset, str] = UNSET,
|
||||
min_lon: Union[Unset, str] = UNSET,
|
||||
ordering: Union[Unset, list[StoresAdsPublicClusterizedListOrderingItem]] = UNSET,
|
||||
payment_state_in: Union[Unset, list[int]] = UNSET,
|
||||
search: Union[Unset, str] = UNSET,
|
||||
state_in: Union[Unset, list[int]] = UNSET,
|
||||
tags: Union[Unset, str] = UNSET,
|
||||
title_icontains: Union[Unset, str] = UNSET,
|
||||
type_in: Union[Unset, list[int]] = UNSET,
|
||||
visited: Union[Unset, bool] = UNSET,
|
||||
) -> dict[str, Any]:
|
||||
params: dict[str, Any] = {}
|
||||
|
||||
params["bookmark"] = bookmark
|
||||
|
||||
params["favorite"] = favorite
|
||||
|
||||
params["location_dst"] = location_dst
|
||||
|
||||
params["location_lat"] = location_lat
|
||||
|
||||
params["location_lon"] = location_lon
|
||||
|
||||
params["max_lat"] = max_lat
|
||||
|
||||
params["max_lon"] = max_lon
|
||||
|
||||
params["min_lat"] = min_lat
|
||||
|
||||
params["min_lon"] = min_lon
|
||||
|
||||
json_ordering: Union[Unset, list[str]] = UNSET
|
||||
if not isinstance(ordering, Unset):
|
||||
json_ordering = []
|
||||
for ordering_item_data in ordering:
|
||||
ordering_item = ordering_item_data.value
|
||||
json_ordering.append(ordering_item)
|
||||
|
||||
params["ordering"] = json_ordering
|
||||
|
||||
json_payment_state_in: Union[Unset, list[int]] = UNSET
|
||||
if not isinstance(payment_state_in, Unset):
|
||||
json_payment_state_in = payment_state_in
|
||||
|
||||
params["payment_state__in"] = json_payment_state_in
|
||||
|
||||
params["search"] = search
|
||||
|
||||
json_state_in: Union[Unset, list[int]] = UNSET
|
||||
if not isinstance(state_in, Unset):
|
||||
json_state_in = state_in
|
||||
|
||||
params["state__in"] = json_state_in
|
||||
|
||||
params["tags"] = tags
|
||||
|
||||
params["title__icontains"] = title_icontains
|
||||
|
||||
json_type_in: Union[Unset, list[int]] = UNSET
|
||||
if not isinstance(type_in, Unset):
|
||||
json_type_in = type_in
|
||||
|
||||
params["type__in"] = json_type_in
|
||||
|
||||
params["visited"] = visited
|
||||
|
||||
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": "/stores/ads/public_clusterized/",
|
||||
"params": params,
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[list["Cluster"]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = []
|
||||
_response_200 = response.json()
|
||||
for response_200_item_data in _response_200:
|
||||
response_200_item = Cluster.from_dict(response_200_item_data)
|
||||
|
||||
response_200.append(response_200_item)
|
||||
|
||||
return response_200
|
||||
|
||||
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[list["Cluster"]]:
|
||||
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,
|
||||
bookmark: Union[Unset, bool] = UNSET,
|
||||
favorite: Union[Unset, bool] = UNSET,
|
||||
location_dst: Union[Unset, str] = UNSET,
|
||||
location_lat: Union[Unset, str] = UNSET,
|
||||
location_lon: Union[Unset, str] = UNSET,
|
||||
max_lat: Union[Unset, str] = UNSET,
|
||||
max_lon: Union[Unset, str] = UNSET,
|
||||
min_lat: Union[Unset, str] = UNSET,
|
||||
min_lon: Union[Unset, str] = UNSET,
|
||||
ordering: Union[Unset, list[StoresAdsPublicClusterizedListOrderingItem]] = UNSET,
|
||||
payment_state_in: Union[Unset, list[int]] = UNSET,
|
||||
search: Union[Unset, str] = UNSET,
|
||||
state_in: Union[Unset, list[int]] = UNSET,
|
||||
tags: Union[Unset, str] = UNSET,
|
||||
title_icontains: Union[Unset, str] = UNSET,
|
||||
type_in: Union[Unset, list[int]] = UNSET,
|
||||
visited: Union[Unset, bool] = UNSET,
|
||||
) -> Response[list["Cluster"]]:
|
||||
"""
|
||||
Args:
|
||||
bookmark (Union[Unset, bool]):
|
||||
favorite (Union[Unset, bool]):
|
||||
location_dst (Union[Unset, str]):
|
||||
location_lat (Union[Unset, str]):
|
||||
location_lon (Union[Unset, str]):
|
||||
max_lat (Union[Unset, str]):
|
||||
max_lon (Union[Unset, str]):
|
||||
min_lat (Union[Unset, str]):
|
||||
min_lon (Union[Unset, str]):
|
||||
ordering (Union[Unset, list[StoresAdsPublicClusterizedListOrderingItem]]):
|
||||
payment_state_in (Union[Unset, list[int]]):
|
||||
search (Union[Unset, str]):
|
||||
state_in (Union[Unset, list[int]]):
|
||||
tags (Union[Unset, str]):
|
||||
title_icontains (Union[Unset, str]):
|
||||
type_in (Union[Unset, list[int]]):
|
||||
visited (Union[Unset, bool]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[list['Cluster']]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
bookmark=bookmark,
|
||||
favorite=favorite,
|
||||
location_dst=location_dst,
|
||||
location_lat=location_lat,
|
||||
location_lon=location_lon,
|
||||
max_lat=max_lat,
|
||||
max_lon=max_lon,
|
||||
min_lat=min_lat,
|
||||
min_lon=min_lon,
|
||||
ordering=ordering,
|
||||
payment_state_in=payment_state_in,
|
||||
search=search,
|
||||
state_in=state_in,
|
||||
tags=tags,
|
||||
title_icontains=title_icontains,
|
||||
type_in=type_in,
|
||||
visited=visited,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
bookmark: Union[Unset, bool] = UNSET,
|
||||
favorite: Union[Unset, bool] = UNSET,
|
||||
location_dst: Union[Unset, str] = UNSET,
|
||||
location_lat: Union[Unset, str] = UNSET,
|
||||
location_lon: Union[Unset, str] = UNSET,
|
||||
max_lat: Union[Unset, str] = UNSET,
|
||||
max_lon: Union[Unset, str] = UNSET,
|
||||
min_lat: Union[Unset, str] = UNSET,
|
||||
min_lon: Union[Unset, str] = UNSET,
|
||||
ordering: Union[Unset, list[StoresAdsPublicClusterizedListOrderingItem]] = UNSET,
|
||||
payment_state_in: Union[Unset, list[int]] = UNSET,
|
||||
search: Union[Unset, str] = UNSET,
|
||||
state_in: Union[Unset, list[int]] = UNSET,
|
||||
tags: Union[Unset, str] = UNSET,
|
||||
title_icontains: Union[Unset, str] = UNSET,
|
||||
type_in: Union[Unset, list[int]] = UNSET,
|
||||
visited: Union[Unset, bool] = UNSET,
|
||||
) -> Optional[list["Cluster"]]:
|
||||
"""
|
||||
Args:
|
||||
bookmark (Union[Unset, bool]):
|
||||
favorite (Union[Unset, bool]):
|
||||
location_dst (Union[Unset, str]):
|
||||
location_lat (Union[Unset, str]):
|
||||
location_lon (Union[Unset, str]):
|
||||
max_lat (Union[Unset, str]):
|
||||
max_lon (Union[Unset, str]):
|
||||
min_lat (Union[Unset, str]):
|
||||
min_lon (Union[Unset, str]):
|
||||
ordering (Union[Unset, list[StoresAdsPublicClusterizedListOrderingItem]]):
|
||||
payment_state_in (Union[Unset, list[int]]):
|
||||
search (Union[Unset, str]):
|
||||
state_in (Union[Unset, list[int]]):
|
||||
tags (Union[Unset, str]):
|
||||
title_icontains (Union[Unset, str]):
|
||||
type_in (Union[Unset, list[int]]):
|
||||
visited (Union[Unset, bool]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
list['Cluster']
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
bookmark=bookmark,
|
||||
favorite=favorite,
|
||||
location_dst=location_dst,
|
||||
location_lat=location_lat,
|
||||
location_lon=location_lon,
|
||||
max_lat=max_lat,
|
||||
max_lon=max_lon,
|
||||
min_lat=min_lat,
|
||||
min_lon=min_lon,
|
||||
ordering=ordering,
|
||||
payment_state_in=payment_state_in,
|
||||
search=search,
|
||||
state_in=state_in,
|
||||
tags=tags,
|
||||
title_icontains=title_icontains,
|
||||
type_in=type_in,
|
||||
visited=visited,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
bookmark: Union[Unset, bool] = UNSET,
|
||||
favorite: Union[Unset, bool] = UNSET,
|
||||
location_dst: Union[Unset, str] = UNSET,
|
||||
location_lat: Union[Unset, str] = UNSET,
|
||||
location_lon: Union[Unset, str] = UNSET,
|
||||
max_lat: Union[Unset, str] = UNSET,
|
||||
max_lon: Union[Unset, str] = UNSET,
|
||||
min_lat: Union[Unset, str] = UNSET,
|
||||
min_lon: Union[Unset, str] = UNSET,
|
||||
ordering: Union[Unset, list[StoresAdsPublicClusterizedListOrderingItem]] = UNSET,
|
||||
payment_state_in: Union[Unset, list[int]] = UNSET,
|
||||
search: Union[Unset, str] = UNSET,
|
||||
state_in: Union[Unset, list[int]] = UNSET,
|
||||
tags: Union[Unset, str] = UNSET,
|
||||
title_icontains: Union[Unset, str] = UNSET,
|
||||
type_in: Union[Unset, list[int]] = UNSET,
|
||||
visited: Union[Unset, bool] = UNSET,
|
||||
) -> Response[list["Cluster"]]:
|
||||
"""
|
||||
Args:
|
||||
bookmark (Union[Unset, bool]):
|
||||
favorite (Union[Unset, bool]):
|
||||
location_dst (Union[Unset, str]):
|
||||
location_lat (Union[Unset, str]):
|
||||
location_lon (Union[Unset, str]):
|
||||
max_lat (Union[Unset, str]):
|
||||
max_lon (Union[Unset, str]):
|
||||
min_lat (Union[Unset, str]):
|
||||
min_lon (Union[Unset, str]):
|
||||
ordering (Union[Unset, list[StoresAdsPublicClusterizedListOrderingItem]]):
|
||||
payment_state_in (Union[Unset, list[int]]):
|
||||
search (Union[Unset, str]):
|
||||
state_in (Union[Unset, list[int]]):
|
||||
tags (Union[Unset, str]):
|
||||
title_icontains (Union[Unset, str]):
|
||||
type_in (Union[Unset, list[int]]):
|
||||
visited (Union[Unset, bool]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[list['Cluster']]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
bookmark=bookmark,
|
||||
favorite=favorite,
|
||||
location_dst=location_dst,
|
||||
location_lat=location_lat,
|
||||
location_lon=location_lon,
|
||||
max_lat=max_lat,
|
||||
max_lon=max_lon,
|
||||
min_lat=min_lat,
|
||||
min_lon=min_lon,
|
||||
ordering=ordering,
|
||||
payment_state_in=payment_state_in,
|
||||
search=search,
|
||||
state_in=state_in,
|
||||
tags=tags,
|
||||
title_icontains=title_icontains,
|
||||
type_in=type_in,
|
||||
visited=visited,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
bookmark: Union[Unset, bool] = UNSET,
|
||||
favorite: Union[Unset, bool] = UNSET,
|
||||
location_dst: Union[Unset, str] = UNSET,
|
||||
location_lat: Union[Unset, str] = UNSET,
|
||||
location_lon: Union[Unset, str] = UNSET,
|
||||
max_lat: Union[Unset, str] = UNSET,
|
||||
max_lon: Union[Unset, str] = UNSET,
|
||||
min_lat: Union[Unset, str] = UNSET,
|
||||
min_lon: Union[Unset, str] = UNSET,
|
||||
ordering: Union[Unset, list[StoresAdsPublicClusterizedListOrderingItem]] = UNSET,
|
||||
payment_state_in: Union[Unset, list[int]] = UNSET,
|
||||
search: Union[Unset, str] = UNSET,
|
||||
state_in: Union[Unset, list[int]] = UNSET,
|
||||
tags: Union[Unset, str] = UNSET,
|
||||
title_icontains: Union[Unset, str] = UNSET,
|
||||
type_in: Union[Unset, list[int]] = UNSET,
|
||||
visited: Union[Unset, bool] = UNSET,
|
||||
) -> Optional[list["Cluster"]]:
|
||||
"""
|
||||
Args:
|
||||
bookmark (Union[Unset, bool]):
|
||||
favorite (Union[Unset, bool]):
|
||||
location_dst (Union[Unset, str]):
|
||||
location_lat (Union[Unset, str]):
|
||||
location_lon (Union[Unset, str]):
|
||||
max_lat (Union[Unset, str]):
|
||||
max_lon (Union[Unset, str]):
|
||||
min_lat (Union[Unset, str]):
|
||||
min_lon (Union[Unset, str]):
|
||||
ordering (Union[Unset, list[StoresAdsPublicClusterizedListOrderingItem]]):
|
||||
payment_state_in (Union[Unset, list[int]]):
|
||||
search (Union[Unset, str]):
|
||||
state_in (Union[Unset, list[int]]):
|
||||
tags (Union[Unset, str]):
|
||||
title_icontains (Union[Unset, str]):
|
||||
type_in (Union[Unset, list[int]]):
|
||||
visited (Union[Unset, bool]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
list['Cluster']
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
client=client,
|
||||
bookmark=bookmark,
|
||||
favorite=favorite,
|
||||
location_dst=location_dst,
|
||||
location_lat=location_lat,
|
||||
location_lon=location_lon,
|
||||
max_lat=max_lat,
|
||||
max_lon=max_lon,
|
||||
min_lat=min_lat,
|
||||
min_lon=min_lon,
|
||||
ordering=ordering,
|
||||
payment_state_in=payment_state_in,
|
||||
search=search,
|
||||
state_in=state_in,
|
||||
tags=tags,
|
||||
title_icontains=title_icontains,
|
||||
type_in=type_in,
|
||||
visited=visited,
|
||||
)
|
||||
).parsed
|
||||
|
|
@ -0,0 +1,445 @@
|
|||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.paginated_ad_public_list import PaginatedAdPublicList
|
||||
from ...models.stores_ads_public_list_list_ordering_item import StoresAdsPublicListListOrderingItem
|
||||
from ...types import UNSET, Response, Unset
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
bookmark: Union[Unset, bool] = UNSET,
|
||||
favorite: Union[Unset, bool] = UNSET,
|
||||
limit: Union[Unset, int] = UNSET,
|
||||
location_dst: Union[Unset, str] = UNSET,
|
||||
location_lat: Union[Unset, str] = UNSET,
|
||||
location_lon: Union[Unset, str] = UNSET,
|
||||
max_lat: Union[Unset, str] = UNSET,
|
||||
max_lon: Union[Unset, str] = UNSET,
|
||||
min_lat: Union[Unset, str] = UNSET,
|
||||
min_lon: Union[Unset, str] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
ordering: Union[Unset, list[StoresAdsPublicListListOrderingItem]] = UNSET,
|
||||
payment_state_in: Union[Unset, list[int]] = UNSET,
|
||||
search: Union[Unset, str] = UNSET,
|
||||
state_in: Union[Unset, list[int]] = UNSET,
|
||||
tags: Union[Unset, str] = UNSET,
|
||||
title_icontains: Union[Unset, str] = UNSET,
|
||||
type_in: Union[Unset, list[int]] = UNSET,
|
||||
visited: Union[Unset, bool] = UNSET,
|
||||
) -> dict[str, Any]:
|
||||
params: dict[str, Any] = {}
|
||||
|
||||
params["bookmark"] = bookmark
|
||||
|
||||
params["favorite"] = favorite
|
||||
|
||||
params["limit"] = limit
|
||||
|
||||
params["location_dst"] = location_dst
|
||||
|
||||
params["location_lat"] = location_lat
|
||||
|
||||
params["location_lon"] = location_lon
|
||||
|
||||
params["max_lat"] = max_lat
|
||||
|
||||
params["max_lon"] = max_lon
|
||||
|
||||
params["min_lat"] = min_lat
|
||||
|
||||
params["min_lon"] = min_lon
|
||||
|
||||
params["offset"] = offset
|
||||
|
||||
json_ordering: Union[Unset, list[str]] = UNSET
|
||||
if not isinstance(ordering, Unset):
|
||||
json_ordering = []
|
||||
for ordering_item_data in ordering:
|
||||
ordering_item = ordering_item_data.value
|
||||
json_ordering.append(ordering_item)
|
||||
|
||||
params["ordering"] = json_ordering
|
||||
|
||||
json_payment_state_in: Union[Unset, list[int]] = UNSET
|
||||
if not isinstance(payment_state_in, Unset):
|
||||
json_payment_state_in = payment_state_in
|
||||
|
||||
params["payment_state__in"] = json_payment_state_in
|
||||
|
||||
params["search"] = search
|
||||
|
||||
json_state_in: Union[Unset, list[int]] = UNSET
|
||||
if not isinstance(state_in, Unset):
|
||||
json_state_in = state_in
|
||||
|
||||
params["state__in"] = json_state_in
|
||||
|
||||
params["tags"] = tags
|
||||
|
||||
params["title__icontains"] = title_icontains
|
||||
|
||||
json_type_in: Union[Unset, list[int]] = UNSET
|
||||
if not isinstance(type_in, Unset):
|
||||
json_type_in = type_in
|
||||
|
||||
params["type__in"] = json_type_in
|
||||
|
||||
params["visited"] = visited
|
||||
|
||||
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": "/stores/ads/public_list/",
|
||||
"params": params,
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[PaginatedAdPublicList]:
|
||||
if response.status_code == 200:
|
||||
response_200 = PaginatedAdPublicList.from_dict(response.json())
|
||||
|
||||
return response_200
|
||||
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[PaginatedAdPublicList]:
|
||||
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,
|
||||
bookmark: Union[Unset, bool] = UNSET,
|
||||
favorite: Union[Unset, bool] = UNSET,
|
||||
limit: Union[Unset, int] = UNSET,
|
||||
location_dst: Union[Unset, str] = UNSET,
|
||||
location_lat: Union[Unset, str] = UNSET,
|
||||
location_lon: Union[Unset, str] = UNSET,
|
||||
max_lat: Union[Unset, str] = UNSET,
|
||||
max_lon: Union[Unset, str] = UNSET,
|
||||
min_lat: Union[Unset, str] = UNSET,
|
||||
min_lon: Union[Unset, str] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
ordering: Union[Unset, list[StoresAdsPublicListListOrderingItem]] = UNSET,
|
||||
payment_state_in: Union[Unset, list[int]] = UNSET,
|
||||
search: Union[Unset, str] = UNSET,
|
||||
state_in: Union[Unset, list[int]] = UNSET,
|
||||
tags: Union[Unset, str] = UNSET,
|
||||
title_icontains: Union[Unset, str] = UNSET,
|
||||
type_in: Union[Unset, list[int]] = UNSET,
|
||||
visited: Union[Unset, bool] = UNSET,
|
||||
) -> Response[PaginatedAdPublicList]:
|
||||
"""
|
||||
Args:
|
||||
bookmark (Union[Unset, bool]):
|
||||
favorite (Union[Unset, bool]):
|
||||
limit (Union[Unset, int]):
|
||||
location_dst (Union[Unset, str]):
|
||||
location_lat (Union[Unset, str]):
|
||||
location_lon (Union[Unset, str]):
|
||||
max_lat (Union[Unset, str]):
|
||||
max_lon (Union[Unset, str]):
|
||||
min_lat (Union[Unset, str]):
|
||||
min_lon (Union[Unset, str]):
|
||||
offset (Union[Unset, int]):
|
||||
ordering (Union[Unset, list[StoresAdsPublicListListOrderingItem]]):
|
||||
payment_state_in (Union[Unset, list[int]]):
|
||||
search (Union[Unset, str]):
|
||||
state_in (Union[Unset, list[int]]):
|
||||
tags (Union[Unset, str]):
|
||||
title_icontains (Union[Unset, str]):
|
||||
type_in (Union[Unset, list[int]]):
|
||||
visited (Union[Unset, bool]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[PaginatedAdPublicList]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
bookmark=bookmark,
|
||||
favorite=favorite,
|
||||
limit=limit,
|
||||
location_dst=location_dst,
|
||||
location_lat=location_lat,
|
||||
location_lon=location_lon,
|
||||
max_lat=max_lat,
|
||||
max_lon=max_lon,
|
||||
min_lat=min_lat,
|
||||
min_lon=min_lon,
|
||||
offset=offset,
|
||||
ordering=ordering,
|
||||
payment_state_in=payment_state_in,
|
||||
search=search,
|
||||
state_in=state_in,
|
||||
tags=tags,
|
||||
title_icontains=title_icontains,
|
||||
type_in=type_in,
|
||||
visited=visited,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
bookmark: Union[Unset, bool] = UNSET,
|
||||
favorite: Union[Unset, bool] = UNSET,
|
||||
limit: Union[Unset, int] = UNSET,
|
||||
location_dst: Union[Unset, str] = UNSET,
|
||||
location_lat: Union[Unset, str] = UNSET,
|
||||
location_lon: Union[Unset, str] = UNSET,
|
||||
max_lat: Union[Unset, str] = UNSET,
|
||||
max_lon: Union[Unset, str] = UNSET,
|
||||
min_lat: Union[Unset, str] = UNSET,
|
||||
min_lon: Union[Unset, str] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
ordering: Union[Unset, list[StoresAdsPublicListListOrderingItem]] = UNSET,
|
||||
payment_state_in: Union[Unset, list[int]] = UNSET,
|
||||
search: Union[Unset, str] = UNSET,
|
||||
state_in: Union[Unset, list[int]] = UNSET,
|
||||
tags: Union[Unset, str] = UNSET,
|
||||
title_icontains: Union[Unset, str] = UNSET,
|
||||
type_in: Union[Unset, list[int]] = UNSET,
|
||||
visited: Union[Unset, bool] = UNSET,
|
||||
) -> Optional[PaginatedAdPublicList]:
|
||||
"""
|
||||
Args:
|
||||
bookmark (Union[Unset, bool]):
|
||||
favorite (Union[Unset, bool]):
|
||||
limit (Union[Unset, int]):
|
||||
location_dst (Union[Unset, str]):
|
||||
location_lat (Union[Unset, str]):
|
||||
location_lon (Union[Unset, str]):
|
||||
max_lat (Union[Unset, str]):
|
||||
max_lon (Union[Unset, str]):
|
||||
min_lat (Union[Unset, str]):
|
||||
min_lon (Union[Unset, str]):
|
||||
offset (Union[Unset, int]):
|
||||
ordering (Union[Unset, list[StoresAdsPublicListListOrderingItem]]):
|
||||
payment_state_in (Union[Unset, list[int]]):
|
||||
search (Union[Unset, str]):
|
||||
state_in (Union[Unset, list[int]]):
|
||||
tags (Union[Unset, str]):
|
||||
title_icontains (Union[Unset, str]):
|
||||
type_in (Union[Unset, list[int]]):
|
||||
visited (Union[Unset, bool]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
PaginatedAdPublicList
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
bookmark=bookmark,
|
||||
favorite=favorite,
|
||||
limit=limit,
|
||||
location_dst=location_dst,
|
||||
location_lat=location_lat,
|
||||
location_lon=location_lon,
|
||||
max_lat=max_lat,
|
||||
max_lon=max_lon,
|
||||
min_lat=min_lat,
|
||||
min_lon=min_lon,
|
||||
offset=offset,
|
||||
ordering=ordering,
|
||||
payment_state_in=payment_state_in,
|
||||
search=search,
|
||||
state_in=state_in,
|
||||
tags=tags,
|
||||
title_icontains=title_icontains,
|
||||
type_in=type_in,
|
||||
visited=visited,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
bookmark: Union[Unset, bool] = UNSET,
|
||||
favorite: Union[Unset, bool] = UNSET,
|
||||
limit: Union[Unset, int] = UNSET,
|
||||
location_dst: Union[Unset, str] = UNSET,
|
||||
location_lat: Union[Unset, str] = UNSET,
|
||||
location_lon: Union[Unset, str] = UNSET,
|
||||
max_lat: Union[Unset, str] = UNSET,
|
||||
max_lon: Union[Unset, str] = UNSET,
|
||||
min_lat: Union[Unset, str] = UNSET,
|
||||
min_lon: Union[Unset, str] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
ordering: Union[Unset, list[StoresAdsPublicListListOrderingItem]] = UNSET,
|
||||
payment_state_in: Union[Unset, list[int]] = UNSET,
|
||||
search: Union[Unset, str] = UNSET,
|
||||
state_in: Union[Unset, list[int]] = UNSET,
|
||||
tags: Union[Unset, str] = UNSET,
|
||||
title_icontains: Union[Unset, str] = UNSET,
|
||||
type_in: Union[Unset, list[int]] = UNSET,
|
||||
visited: Union[Unset, bool] = UNSET,
|
||||
) -> Response[PaginatedAdPublicList]:
|
||||
"""
|
||||
Args:
|
||||
bookmark (Union[Unset, bool]):
|
||||
favorite (Union[Unset, bool]):
|
||||
limit (Union[Unset, int]):
|
||||
location_dst (Union[Unset, str]):
|
||||
location_lat (Union[Unset, str]):
|
||||
location_lon (Union[Unset, str]):
|
||||
max_lat (Union[Unset, str]):
|
||||
max_lon (Union[Unset, str]):
|
||||
min_lat (Union[Unset, str]):
|
||||
min_lon (Union[Unset, str]):
|
||||
offset (Union[Unset, int]):
|
||||
ordering (Union[Unset, list[StoresAdsPublicListListOrderingItem]]):
|
||||
payment_state_in (Union[Unset, list[int]]):
|
||||
search (Union[Unset, str]):
|
||||
state_in (Union[Unset, list[int]]):
|
||||
tags (Union[Unset, str]):
|
||||
title_icontains (Union[Unset, str]):
|
||||
type_in (Union[Unset, list[int]]):
|
||||
visited (Union[Unset, bool]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[PaginatedAdPublicList]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
bookmark=bookmark,
|
||||
favorite=favorite,
|
||||
limit=limit,
|
||||
location_dst=location_dst,
|
||||
location_lat=location_lat,
|
||||
location_lon=location_lon,
|
||||
max_lat=max_lat,
|
||||
max_lon=max_lon,
|
||||
min_lat=min_lat,
|
||||
min_lon=min_lon,
|
||||
offset=offset,
|
||||
ordering=ordering,
|
||||
payment_state_in=payment_state_in,
|
||||
search=search,
|
||||
state_in=state_in,
|
||||
tags=tags,
|
||||
title_icontains=title_icontains,
|
||||
type_in=type_in,
|
||||
visited=visited,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
bookmark: Union[Unset, bool] = UNSET,
|
||||
favorite: Union[Unset, bool] = UNSET,
|
||||
limit: Union[Unset, int] = UNSET,
|
||||
location_dst: Union[Unset, str] = UNSET,
|
||||
location_lat: Union[Unset, str] = UNSET,
|
||||
location_lon: Union[Unset, str] = UNSET,
|
||||
max_lat: Union[Unset, str] = UNSET,
|
||||
max_lon: Union[Unset, str] = UNSET,
|
||||
min_lat: Union[Unset, str] = UNSET,
|
||||
min_lon: Union[Unset, str] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
ordering: Union[Unset, list[StoresAdsPublicListListOrderingItem]] = UNSET,
|
||||
payment_state_in: Union[Unset, list[int]] = UNSET,
|
||||
search: Union[Unset, str] = UNSET,
|
||||
state_in: Union[Unset, list[int]] = UNSET,
|
||||
tags: Union[Unset, str] = UNSET,
|
||||
title_icontains: Union[Unset, str] = UNSET,
|
||||
type_in: Union[Unset, list[int]] = UNSET,
|
||||
visited: Union[Unset, bool] = UNSET,
|
||||
) -> Optional[PaginatedAdPublicList]:
|
||||
"""
|
||||
Args:
|
||||
bookmark (Union[Unset, bool]):
|
||||
favorite (Union[Unset, bool]):
|
||||
limit (Union[Unset, int]):
|
||||
location_dst (Union[Unset, str]):
|
||||
location_lat (Union[Unset, str]):
|
||||
location_lon (Union[Unset, str]):
|
||||
max_lat (Union[Unset, str]):
|
||||
max_lon (Union[Unset, str]):
|
||||
min_lat (Union[Unset, str]):
|
||||
min_lon (Union[Unset, str]):
|
||||
offset (Union[Unset, int]):
|
||||
ordering (Union[Unset, list[StoresAdsPublicListListOrderingItem]]):
|
||||
payment_state_in (Union[Unset, list[int]]):
|
||||
search (Union[Unset, str]):
|
||||
state_in (Union[Unset, list[int]]):
|
||||
tags (Union[Unset, str]):
|
||||
title_icontains (Union[Unset, str]):
|
||||
type_in (Union[Unset, list[int]]):
|
||||
visited (Union[Unset, bool]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
PaginatedAdPublicList
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
client=client,
|
||||
bookmark=bookmark,
|
||||
favorite=favorite,
|
||||
limit=limit,
|
||||
location_dst=location_dst,
|
||||
location_lat=location_lat,
|
||||
location_lon=location_lon,
|
||||
max_lat=max_lat,
|
||||
max_lon=max_lon,
|
||||
min_lat=min_lat,
|
||||
min_lon=min_lon,
|
||||
offset=offset,
|
||||
ordering=ordering,
|
||||
payment_state_in=payment_state_in,
|
||||
search=search,
|
||||
state_in=state_in,
|
||||
tags=tags,
|
||||
title_icontains=title_icontains,
|
||||
type_in=type_in,
|
||||
visited=visited,
|
||||
)
|
||||
).parsed
|
||||
|
|
@ -0,0 +1,144 @@
|
|||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
from uuid import UUID
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.ad_public import AdPublic
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
uuid: UUID,
|
||||
) -> dict[str, Any]:
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "get",
|
||||
"url": f"/stores/ads/{uuid}/public_retrieve/",
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[AdPublic]:
|
||||
if response.status_code == 200:
|
||||
response_200 = AdPublic.from_dict(response.json())
|
||||
|
||||
return response_200
|
||||
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[AdPublic]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
uuid: UUID,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Response[AdPublic]:
|
||||
"""
|
||||
Args:
|
||||
uuid (UUID):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[AdPublic]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
uuid=uuid,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
uuid: UUID,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Optional[AdPublic]:
|
||||
"""
|
||||
Args:
|
||||
uuid (UUID):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
AdPublic
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
uuid=uuid,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
uuid: UUID,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Response[AdPublic]:
|
||||
"""
|
||||
Args:
|
||||
uuid (UUID):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[AdPublic]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
uuid=uuid,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
uuid: UUID,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Optional[AdPublic]:
|
||||
"""
|
||||
Args:
|
||||
uuid (UUID):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
AdPublic
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
uuid=uuid,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
||||
|
|
@ -0,0 +1,165 @@
|
|||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
from uuid import UUID
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.visit_reaction import VisitReaction
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
uuid: UUID,
|
||||
*,
|
||||
body: VisitReaction,
|
||||
) -> dict[str, Any]:
|
||||
headers: dict[str, Any] = {}
|
||||
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "post",
|
||||
"url": f"/stores/ads/{uuid}/react/",
|
||||
}
|
||||
|
||||
_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[VisitReaction]:
|
||||
if response.status_code == 200:
|
||||
response_200 = VisitReaction.from_dict(response.json())
|
||||
|
||||
return response_200
|
||||
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[VisitReaction]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
uuid: UUID,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: VisitReaction,
|
||||
) -> Response[VisitReaction]:
|
||||
"""
|
||||
Args:
|
||||
uuid (UUID):
|
||||
body (VisitReaction):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[VisitReaction]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
uuid=uuid,
|
||||
body=body,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
uuid: UUID,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: VisitReaction,
|
||||
) -> Optional[VisitReaction]:
|
||||
"""
|
||||
Args:
|
||||
uuid (UUID):
|
||||
body (VisitReaction):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
VisitReaction
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
uuid=uuid,
|
||||
client=client,
|
||||
body=body,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
uuid: UUID,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: VisitReaction,
|
||||
) -> Response[VisitReaction]:
|
||||
"""
|
||||
Args:
|
||||
uuid (UUID):
|
||||
body (VisitReaction):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[VisitReaction]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
uuid=uuid,
|
||||
body=body,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
uuid: UUID,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: VisitReaction,
|
||||
) -> Optional[VisitReaction]:
|
||||
"""
|
||||
Args:
|
||||
uuid (UUID):
|
||||
body (VisitReaction):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
VisitReaction
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
uuid=uuid,
|
||||
client=client,
|
||||
body=body,
|
||||
)
|
||||
).parsed
|
||||
|
|
@ -0,0 +1,165 @@
|
|||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
from uuid import UUID
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.ad_report import AdReport
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
uuid: UUID,
|
||||
*,
|
||||
body: AdReport,
|
||||
) -> dict[str, Any]:
|
||||
headers: dict[str, Any] = {}
|
||||
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "post",
|
||||
"url": f"/stores/ads/{uuid}/report/",
|
||||
}
|
||||
|
||||
_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[AdReport]:
|
||||
if response.status_code == 200:
|
||||
response_200 = AdReport.from_dict(response.json())
|
||||
|
||||
return response_200
|
||||
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[AdReport]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
uuid: UUID,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: AdReport,
|
||||
) -> Response[AdReport]:
|
||||
"""
|
||||
Args:
|
||||
uuid (UUID):
|
||||
body (AdReport):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[AdReport]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
uuid=uuid,
|
||||
body=body,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
uuid: UUID,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: AdReport,
|
||||
) -> Optional[AdReport]:
|
||||
"""
|
||||
Args:
|
||||
uuid (UUID):
|
||||
body (AdReport):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
AdReport
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
uuid=uuid,
|
||||
client=client,
|
||||
body=body,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
uuid: UUID,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: AdReport,
|
||||
) -> Response[AdReport]:
|
||||
"""
|
||||
Args:
|
||||
uuid (UUID):
|
||||
body (AdReport):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[AdReport]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
uuid=uuid,
|
||||
body=body,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
uuid: UUID,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: AdReport,
|
||||
) -> Optional[AdReport]:
|
||||
"""
|
||||
Args:
|
||||
uuid (UUID):
|
||||
body (AdReport):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
AdReport
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
uuid=uuid,
|
||||
client=client,
|
||||
body=body,
|
||||
)
|
||||
).parsed
|
||||
|
|
@ -0,0 +1,144 @@
|
|||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
from uuid import UUID
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.ad import Ad
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
uuid: UUID,
|
||||
) -> dict[str, Any]:
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "get",
|
||||
"url": f"/stores/ads/{uuid}/",
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Ad]:
|
||||
if response.status_code == 200:
|
||||
response_200 = Ad.from_dict(response.json())
|
||||
|
||||
return response_200
|
||||
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Ad]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
uuid: UUID,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Response[Ad]:
|
||||
"""
|
||||
Args:
|
||||
uuid (UUID):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[Ad]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
uuid=uuid,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
uuid: UUID,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Optional[Ad]:
|
||||
"""
|
||||
Args:
|
||||
uuid (UUID):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Ad
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
uuid=uuid,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
uuid: UUID,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Response[Ad]:
|
||||
"""
|
||||
Args:
|
||||
uuid (UUID):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[Ad]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
uuid=uuid,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
uuid: UUID,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Optional[Ad]:
|
||||
"""
|
||||
Args:
|
||||
uuid (UUID):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Ad
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
uuid=uuid,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
||||
|
|
@ -0,0 +1,445 @@
|
|||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.paginated_ad_with_visit_list import PaginatedAdWithVisitList
|
||||
from ...models.stores_ads_visited_list_ordering_item import StoresAdsVisitedListOrderingItem
|
||||
from ...types import UNSET, Response, Unset
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
bookmark: Union[Unset, bool] = UNSET,
|
||||
favorite: Union[Unset, bool] = UNSET,
|
||||
limit: Union[Unset, int] = UNSET,
|
||||
location_dst: Union[Unset, str] = UNSET,
|
||||
location_lat: Union[Unset, str] = UNSET,
|
||||
location_lon: Union[Unset, str] = UNSET,
|
||||
max_lat: Union[Unset, str] = UNSET,
|
||||
max_lon: Union[Unset, str] = UNSET,
|
||||
min_lat: Union[Unset, str] = UNSET,
|
||||
min_lon: Union[Unset, str] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
ordering: Union[Unset, list[StoresAdsVisitedListOrderingItem]] = UNSET,
|
||||
payment_state_in: Union[Unset, list[int]] = UNSET,
|
||||
search: Union[Unset, str] = UNSET,
|
||||
state_in: Union[Unset, list[int]] = UNSET,
|
||||
tags: Union[Unset, str] = UNSET,
|
||||
title_icontains: Union[Unset, str] = UNSET,
|
||||
type_in: Union[Unset, list[int]] = UNSET,
|
||||
visited: Union[Unset, bool] = UNSET,
|
||||
) -> dict[str, Any]:
|
||||
params: dict[str, Any] = {}
|
||||
|
||||
params["bookmark"] = bookmark
|
||||
|
||||
params["favorite"] = favorite
|
||||
|
||||
params["limit"] = limit
|
||||
|
||||
params["location_dst"] = location_dst
|
||||
|
||||
params["location_lat"] = location_lat
|
||||
|
||||
params["location_lon"] = location_lon
|
||||
|
||||
params["max_lat"] = max_lat
|
||||
|
||||
params["max_lon"] = max_lon
|
||||
|
||||
params["min_lat"] = min_lat
|
||||
|
||||
params["min_lon"] = min_lon
|
||||
|
||||
params["offset"] = offset
|
||||
|
||||
json_ordering: Union[Unset, list[str]] = UNSET
|
||||
if not isinstance(ordering, Unset):
|
||||
json_ordering = []
|
||||
for ordering_item_data in ordering:
|
||||
ordering_item = ordering_item_data.value
|
||||
json_ordering.append(ordering_item)
|
||||
|
||||
params["ordering"] = json_ordering
|
||||
|
||||
json_payment_state_in: Union[Unset, list[int]] = UNSET
|
||||
if not isinstance(payment_state_in, Unset):
|
||||
json_payment_state_in = payment_state_in
|
||||
|
||||
params["payment_state__in"] = json_payment_state_in
|
||||
|
||||
params["search"] = search
|
||||
|
||||
json_state_in: Union[Unset, list[int]] = UNSET
|
||||
if not isinstance(state_in, Unset):
|
||||
json_state_in = state_in
|
||||
|
||||
params["state__in"] = json_state_in
|
||||
|
||||
params["tags"] = tags
|
||||
|
||||
params["title__icontains"] = title_icontains
|
||||
|
||||
json_type_in: Union[Unset, list[int]] = UNSET
|
||||
if not isinstance(type_in, Unset):
|
||||
json_type_in = type_in
|
||||
|
||||
params["type__in"] = json_type_in
|
||||
|
||||
params["visited"] = visited
|
||||
|
||||
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": "/stores/ads/visited/",
|
||||
"params": params,
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[PaginatedAdWithVisitList]:
|
||||
if response.status_code == 200:
|
||||
response_200 = PaginatedAdWithVisitList.from_dict(response.json())
|
||||
|
||||
return response_200
|
||||
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[PaginatedAdWithVisitList]:
|
||||
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,
|
||||
bookmark: Union[Unset, bool] = UNSET,
|
||||
favorite: Union[Unset, bool] = UNSET,
|
||||
limit: Union[Unset, int] = UNSET,
|
||||
location_dst: Union[Unset, str] = UNSET,
|
||||
location_lat: Union[Unset, str] = UNSET,
|
||||
location_lon: Union[Unset, str] = UNSET,
|
||||
max_lat: Union[Unset, str] = UNSET,
|
||||
max_lon: Union[Unset, str] = UNSET,
|
||||
min_lat: Union[Unset, str] = UNSET,
|
||||
min_lon: Union[Unset, str] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
ordering: Union[Unset, list[StoresAdsVisitedListOrderingItem]] = UNSET,
|
||||
payment_state_in: Union[Unset, list[int]] = UNSET,
|
||||
search: Union[Unset, str] = UNSET,
|
||||
state_in: Union[Unset, list[int]] = UNSET,
|
||||
tags: Union[Unset, str] = UNSET,
|
||||
title_icontains: Union[Unset, str] = UNSET,
|
||||
type_in: Union[Unset, list[int]] = UNSET,
|
||||
visited: Union[Unset, bool] = UNSET,
|
||||
) -> Response[PaginatedAdWithVisitList]:
|
||||
"""
|
||||
Args:
|
||||
bookmark (Union[Unset, bool]):
|
||||
favorite (Union[Unset, bool]):
|
||||
limit (Union[Unset, int]):
|
||||
location_dst (Union[Unset, str]):
|
||||
location_lat (Union[Unset, str]):
|
||||
location_lon (Union[Unset, str]):
|
||||
max_lat (Union[Unset, str]):
|
||||
max_lon (Union[Unset, str]):
|
||||
min_lat (Union[Unset, str]):
|
||||
min_lon (Union[Unset, str]):
|
||||
offset (Union[Unset, int]):
|
||||
ordering (Union[Unset, list[StoresAdsVisitedListOrderingItem]]):
|
||||
payment_state_in (Union[Unset, list[int]]):
|
||||
search (Union[Unset, str]):
|
||||
state_in (Union[Unset, list[int]]):
|
||||
tags (Union[Unset, str]):
|
||||
title_icontains (Union[Unset, str]):
|
||||
type_in (Union[Unset, list[int]]):
|
||||
visited (Union[Unset, bool]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[PaginatedAdWithVisitList]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
bookmark=bookmark,
|
||||
favorite=favorite,
|
||||
limit=limit,
|
||||
location_dst=location_dst,
|
||||
location_lat=location_lat,
|
||||
location_lon=location_lon,
|
||||
max_lat=max_lat,
|
||||
max_lon=max_lon,
|
||||
min_lat=min_lat,
|
||||
min_lon=min_lon,
|
||||
offset=offset,
|
||||
ordering=ordering,
|
||||
payment_state_in=payment_state_in,
|
||||
search=search,
|
||||
state_in=state_in,
|
||||
tags=tags,
|
||||
title_icontains=title_icontains,
|
||||
type_in=type_in,
|
||||
visited=visited,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
bookmark: Union[Unset, bool] = UNSET,
|
||||
favorite: Union[Unset, bool] = UNSET,
|
||||
limit: Union[Unset, int] = UNSET,
|
||||
location_dst: Union[Unset, str] = UNSET,
|
||||
location_lat: Union[Unset, str] = UNSET,
|
||||
location_lon: Union[Unset, str] = UNSET,
|
||||
max_lat: Union[Unset, str] = UNSET,
|
||||
max_lon: Union[Unset, str] = UNSET,
|
||||
min_lat: Union[Unset, str] = UNSET,
|
||||
min_lon: Union[Unset, str] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
ordering: Union[Unset, list[StoresAdsVisitedListOrderingItem]] = UNSET,
|
||||
payment_state_in: Union[Unset, list[int]] = UNSET,
|
||||
search: Union[Unset, str] = UNSET,
|
||||
state_in: Union[Unset, list[int]] = UNSET,
|
||||
tags: Union[Unset, str] = UNSET,
|
||||
title_icontains: Union[Unset, str] = UNSET,
|
||||
type_in: Union[Unset, list[int]] = UNSET,
|
||||
visited: Union[Unset, bool] = UNSET,
|
||||
) -> Optional[PaginatedAdWithVisitList]:
|
||||
"""
|
||||
Args:
|
||||
bookmark (Union[Unset, bool]):
|
||||
favorite (Union[Unset, bool]):
|
||||
limit (Union[Unset, int]):
|
||||
location_dst (Union[Unset, str]):
|
||||
location_lat (Union[Unset, str]):
|
||||
location_lon (Union[Unset, str]):
|
||||
max_lat (Union[Unset, str]):
|
||||
max_lon (Union[Unset, str]):
|
||||
min_lat (Union[Unset, str]):
|
||||
min_lon (Union[Unset, str]):
|
||||
offset (Union[Unset, int]):
|
||||
ordering (Union[Unset, list[StoresAdsVisitedListOrderingItem]]):
|
||||
payment_state_in (Union[Unset, list[int]]):
|
||||
search (Union[Unset, str]):
|
||||
state_in (Union[Unset, list[int]]):
|
||||
tags (Union[Unset, str]):
|
||||
title_icontains (Union[Unset, str]):
|
||||
type_in (Union[Unset, list[int]]):
|
||||
visited (Union[Unset, bool]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
PaginatedAdWithVisitList
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
bookmark=bookmark,
|
||||
favorite=favorite,
|
||||
limit=limit,
|
||||
location_dst=location_dst,
|
||||
location_lat=location_lat,
|
||||
location_lon=location_lon,
|
||||
max_lat=max_lat,
|
||||
max_lon=max_lon,
|
||||
min_lat=min_lat,
|
||||
min_lon=min_lon,
|
||||
offset=offset,
|
||||
ordering=ordering,
|
||||
payment_state_in=payment_state_in,
|
||||
search=search,
|
||||
state_in=state_in,
|
||||
tags=tags,
|
||||
title_icontains=title_icontains,
|
||||
type_in=type_in,
|
||||
visited=visited,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
bookmark: Union[Unset, bool] = UNSET,
|
||||
favorite: Union[Unset, bool] = UNSET,
|
||||
limit: Union[Unset, int] = UNSET,
|
||||
location_dst: Union[Unset, str] = UNSET,
|
||||
location_lat: Union[Unset, str] = UNSET,
|
||||
location_lon: Union[Unset, str] = UNSET,
|
||||
max_lat: Union[Unset, str] = UNSET,
|
||||
max_lon: Union[Unset, str] = UNSET,
|
||||
min_lat: Union[Unset, str] = UNSET,
|
||||
min_lon: Union[Unset, str] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
ordering: Union[Unset, list[StoresAdsVisitedListOrderingItem]] = UNSET,
|
||||
payment_state_in: Union[Unset, list[int]] = UNSET,
|
||||
search: Union[Unset, str] = UNSET,
|
||||
state_in: Union[Unset, list[int]] = UNSET,
|
||||
tags: Union[Unset, str] = UNSET,
|
||||
title_icontains: Union[Unset, str] = UNSET,
|
||||
type_in: Union[Unset, list[int]] = UNSET,
|
||||
visited: Union[Unset, bool] = UNSET,
|
||||
) -> Response[PaginatedAdWithVisitList]:
|
||||
"""
|
||||
Args:
|
||||
bookmark (Union[Unset, bool]):
|
||||
favorite (Union[Unset, bool]):
|
||||
limit (Union[Unset, int]):
|
||||
location_dst (Union[Unset, str]):
|
||||
location_lat (Union[Unset, str]):
|
||||
location_lon (Union[Unset, str]):
|
||||
max_lat (Union[Unset, str]):
|
||||
max_lon (Union[Unset, str]):
|
||||
min_lat (Union[Unset, str]):
|
||||
min_lon (Union[Unset, str]):
|
||||
offset (Union[Unset, int]):
|
||||
ordering (Union[Unset, list[StoresAdsVisitedListOrderingItem]]):
|
||||
payment_state_in (Union[Unset, list[int]]):
|
||||
search (Union[Unset, str]):
|
||||
state_in (Union[Unset, list[int]]):
|
||||
tags (Union[Unset, str]):
|
||||
title_icontains (Union[Unset, str]):
|
||||
type_in (Union[Unset, list[int]]):
|
||||
visited (Union[Unset, bool]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[PaginatedAdWithVisitList]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
bookmark=bookmark,
|
||||
favorite=favorite,
|
||||
limit=limit,
|
||||
location_dst=location_dst,
|
||||
location_lat=location_lat,
|
||||
location_lon=location_lon,
|
||||
max_lat=max_lat,
|
||||
max_lon=max_lon,
|
||||
min_lat=min_lat,
|
||||
min_lon=min_lon,
|
||||
offset=offset,
|
||||
ordering=ordering,
|
||||
payment_state_in=payment_state_in,
|
||||
search=search,
|
||||
state_in=state_in,
|
||||
tags=tags,
|
||||
title_icontains=title_icontains,
|
||||
type_in=type_in,
|
||||
visited=visited,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
bookmark: Union[Unset, bool] = UNSET,
|
||||
favorite: Union[Unset, bool] = UNSET,
|
||||
limit: Union[Unset, int] = UNSET,
|
||||
location_dst: Union[Unset, str] = UNSET,
|
||||
location_lat: Union[Unset, str] = UNSET,
|
||||
location_lon: Union[Unset, str] = UNSET,
|
||||
max_lat: Union[Unset, str] = UNSET,
|
||||
max_lon: Union[Unset, str] = UNSET,
|
||||
min_lat: Union[Unset, str] = UNSET,
|
||||
min_lon: Union[Unset, str] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
ordering: Union[Unset, list[StoresAdsVisitedListOrderingItem]] = UNSET,
|
||||
payment_state_in: Union[Unset, list[int]] = UNSET,
|
||||
search: Union[Unset, str] = UNSET,
|
||||
state_in: Union[Unset, list[int]] = UNSET,
|
||||
tags: Union[Unset, str] = UNSET,
|
||||
title_icontains: Union[Unset, str] = UNSET,
|
||||
type_in: Union[Unset, list[int]] = UNSET,
|
||||
visited: Union[Unset, bool] = UNSET,
|
||||
) -> Optional[PaginatedAdWithVisitList]:
|
||||
"""
|
||||
Args:
|
||||
bookmark (Union[Unset, bool]):
|
||||
favorite (Union[Unset, bool]):
|
||||
limit (Union[Unset, int]):
|
||||
location_dst (Union[Unset, str]):
|
||||
location_lat (Union[Unset, str]):
|
||||
location_lon (Union[Unset, str]):
|
||||
max_lat (Union[Unset, str]):
|
||||
max_lon (Union[Unset, str]):
|
||||
min_lat (Union[Unset, str]):
|
||||
min_lon (Union[Unset, str]):
|
||||
offset (Union[Unset, int]):
|
||||
ordering (Union[Unset, list[StoresAdsVisitedListOrderingItem]]):
|
||||
payment_state_in (Union[Unset, list[int]]):
|
||||
search (Union[Unset, str]):
|
||||
state_in (Union[Unset, list[int]]):
|
||||
tags (Union[Unset, str]):
|
||||
title_icontains (Union[Unset, str]):
|
||||
type_in (Union[Unset, list[int]]):
|
||||
visited (Union[Unset, bool]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
PaginatedAdWithVisitList
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
client=client,
|
||||
bookmark=bookmark,
|
||||
favorite=favorite,
|
||||
limit=limit,
|
||||
location_dst=location_dst,
|
||||
location_lat=location_lat,
|
||||
location_lon=location_lon,
|
||||
max_lat=max_lat,
|
||||
max_lon=max_lon,
|
||||
min_lat=min_lat,
|
||||
min_lon=min_lon,
|
||||
offset=offset,
|
||||
ordering=ordering,
|
||||
payment_state_in=payment_state_in,
|
||||
search=search,
|
||||
state_in=state_in,
|
||||
tags=tags,
|
||||
title_icontains=title_icontains,
|
||||
type_in=type_in,
|
||||
visited=visited,
|
||||
)
|
||||
).parsed
|
||||
|
|
@ -0,0 +1,445 @@
|
|||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.paginated_ad_with_visit_list import PaginatedAdWithVisitList
|
||||
from ...models.stores_ads_with_visits_list_ordering_item import StoresAdsWithVisitsListOrderingItem
|
||||
from ...types import UNSET, Response, Unset
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
bookmark: Union[Unset, bool] = UNSET,
|
||||
favorite: Union[Unset, bool] = UNSET,
|
||||
limit: Union[Unset, int] = UNSET,
|
||||
location_dst: Union[Unset, str] = UNSET,
|
||||
location_lat: Union[Unset, str] = UNSET,
|
||||
location_lon: Union[Unset, str] = UNSET,
|
||||
max_lat: Union[Unset, str] = UNSET,
|
||||
max_lon: Union[Unset, str] = UNSET,
|
||||
min_lat: Union[Unset, str] = UNSET,
|
||||
min_lon: Union[Unset, str] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
ordering: Union[Unset, list[StoresAdsWithVisitsListOrderingItem]] = UNSET,
|
||||
payment_state_in: Union[Unset, list[int]] = UNSET,
|
||||
search: Union[Unset, str] = UNSET,
|
||||
state_in: Union[Unset, list[int]] = UNSET,
|
||||
tags: Union[Unset, str] = UNSET,
|
||||
title_icontains: Union[Unset, str] = UNSET,
|
||||
type_in: Union[Unset, list[int]] = UNSET,
|
||||
visited: Union[Unset, bool] = UNSET,
|
||||
) -> dict[str, Any]:
|
||||
params: dict[str, Any] = {}
|
||||
|
||||
params["bookmark"] = bookmark
|
||||
|
||||
params["favorite"] = favorite
|
||||
|
||||
params["limit"] = limit
|
||||
|
||||
params["location_dst"] = location_dst
|
||||
|
||||
params["location_lat"] = location_lat
|
||||
|
||||
params["location_lon"] = location_lon
|
||||
|
||||
params["max_lat"] = max_lat
|
||||
|
||||
params["max_lon"] = max_lon
|
||||
|
||||
params["min_lat"] = min_lat
|
||||
|
||||
params["min_lon"] = min_lon
|
||||
|
||||
params["offset"] = offset
|
||||
|
||||
json_ordering: Union[Unset, list[str]] = UNSET
|
||||
if not isinstance(ordering, Unset):
|
||||
json_ordering = []
|
||||
for ordering_item_data in ordering:
|
||||
ordering_item = ordering_item_data.value
|
||||
json_ordering.append(ordering_item)
|
||||
|
||||
params["ordering"] = json_ordering
|
||||
|
||||
json_payment_state_in: Union[Unset, list[int]] = UNSET
|
||||
if not isinstance(payment_state_in, Unset):
|
||||
json_payment_state_in = payment_state_in
|
||||
|
||||
params["payment_state__in"] = json_payment_state_in
|
||||
|
||||
params["search"] = search
|
||||
|
||||
json_state_in: Union[Unset, list[int]] = UNSET
|
||||
if not isinstance(state_in, Unset):
|
||||
json_state_in = state_in
|
||||
|
||||
params["state__in"] = json_state_in
|
||||
|
||||
params["tags"] = tags
|
||||
|
||||
params["title__icontains"] = title_icontains
|
||||
|
||||
json_type_in: Union[Unset, list[int]] = UNSET
|
||||
if not isinstance(type_in, Unset):
|
||||
json_type_in = type_in
|
||||
|
||||
params["type__in"] = json_type_in
|
||||
|
||||
params["visited"] = visited
|
||||
|
||||
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": "/stores/ads/with_visits/",
|
||||
"params": params,
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[PaginatedAdWithVisitList]:
|
||||
if response.status_code == 200:
|
||||
response_200 = PaginatedAdWithVisitList.from_dict(response.json())
|
||||
|
||||
return response_200
|
||||
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[PaginatedAdWithVisitList]:
|
||||
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,
|
||||
bookmark: Union[Unset, bool] = UNSET,
|
||||
favorite: Union[Unset, bool] = UNSET,
|
||||
limit: Union[Unset, int] = UNSET,
|
||||
location_dst: Union[Unset, str] = UNSET,
|
||||
location_lat: Union[Unset, str] = UNSET,
|
||||
location_lon: Union[Unset, str] = UNSET,
|
||||
max_lat: Union[Unset, str] = UNSET,
|
||||
max_lon: Union[Unset, str] = UNSET,
|
||||
min_lat: Union[Unset, str] = UNSET,
|
||||
min_lon: Union[Unset, str] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
ordering: Union[Unset, list[StoresAdsWithVisitsListOrderingItem]] = UNSET,
|
||||
payment_state_in: Union[Unset, list[int]] = UNSET,
|
||||
search: Union[Unset, str] = UNSET,
|
||||
state_in: Union[Unset, list[int]] = UNSET,
|
||||
tags: Union[Unset, str] = UNSET,
|
||||
title_icontains: Union[Unset, str] = UNSET,
|
||||
type_in: Union[Unset, list[int]] = UNSET,
|
||||
visited: Union[Unset, bool] = UNSET,
|
||||
) -> Response[PaginatedAdWithVisitList]:
|
||||
"""
|
||||
Args:
|
||||
bookmark (Union[Unset, bool]):
|
||||
favorite (Union[Unset, bool]):
|
||||
limit (Union[Unset, int]):
|
||||
location_dst (Union[Unset, str]):
|
||||
location_lat (Union[Unset, str]):
|
||||
location_lon (Union[Unset, str]):
|
||||
max_lat (Union[Unset, str]):
|
||||
max_lon (Union[Unset, str]):
|
||||
min_lat (Union[Unset, str]):
|
||||
min_lon (Union[Unset, str]):
|
||||
offset (Union[Unset, int]):
|
||||
ordering (Union[Unset, list[StoresAdsWithVisitsListOrderingItem]]):
|
||||
payment_state_in (Union[Unset, list[int]]):
|
||||
search (Union[Unset, str]):
|
||||
state_in (Union[Unset, list[int]]):
|
||||
tags (Union[Unset, str]):
|
||||
title_icontains (Union[Unset, str]):
|
||||
type_in (Union[Unset, list[int]]):
|
||||
visited (Union[Unset, bool]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[PaginatedAdWithVisitList]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
bookmark=bookmark,
|
||||
favorite=favorite,
|
||||
limit=limit,
|
||||
location_dst=location_dst,
|
||||
location_lat=location_lat,
|
||||
location_lon=location_lon,
|
||||
max_lat=max_lat,
|
||||
max_lon=max_lon,
|
||||
min_lat=min_lat,
|
||||
min_lon=min_lon,
|
||||
offset=offset,
|
||||
ordering=ordering,
|
||||
payment_state_in=payment_state_in,
|
||||
search=search,
|
||||
state_in=state_in,
|
||||
tags=tags,
|
||||
title_icontains=title_icontains,
|
||||
type_in=type_in,
|
||||
visited=visited,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
bookmark: Union[Unset, bool] = UNSET,
|
||||
favorite: Union[Unset, bool] = UNSET,
|
||||
limit: Union[Unset, int] = UNSET,
|
||||
location_dst: Union[Unset, str] = UNSET,
|
||||
location_lat: Union[Unset, str] = UNSET,
|
||||
location_lon: Union[Unset, str] = UNSET,
|
||||
max_lat: Union[Unset, str] = UNSET,
|
||||
max_lon: Union[Unset, str] = UNSET,
|
||||
min_lat: Union[Unset, str] = UNSET,
|
||||
min_lon: Union[Unset, str] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
ordering: Union[Unset, list[StoresAdsWithVisitsListOrderingItem]] = UNSET,
|
||||
payment_state_in: Union[Unset, list[int]] = UNSET,
|
||||
search: Union[Unset, str] = UNSET,
|
||||
state_in: Union[Unset, list[int]] = UNSET,
|
||||
tags: Union[Unset, str] = UNSET,
|
||||
title_icontains: Union[Unset, str] = UNSET,
|
||||
type_in: Union[Unset, list[int]] = UNSET,
|
||||
visited: Union[Unset, bool] = UNSET,
|
||||
) -> Optional[PaginatedAdWithVisitList]:
|
||||
"""
|
||||
Args:
|
||||
bookmark (Union[Unset, bool]):
|
||||
favorite (Union[Unset, bool]):
|
||||
limit (Union[Unset, int]):
|
||||
location_dst (Union[Unset, str]):
|
||||
location_lat (Union[Unset, str]):
|
||||
location_lon (Union[Unset, str]):
|
||||
max_lat (Union[Unset, str]):
|
||||
max_lon (Union[Unset, str]):
|
||||
min_lat (Union[Unset, str]):
|
||||
min_lon (Union[Unset, str]):
|
||||
offset (Union[Unset, int]):
|
||||
ordering (Union[Unset, list[StoresAdsWithVisitsListOrderingItem]]):
|
||||
payment_state_in (Union[Unset, list[int]]):
|
||||
search (Union[Unset, str]):
|
||||
state_in (Union[Unset, list[int]]):
|
||||
tags (Union[Unset, str]):
|
||||
title_icontains (Union[Unset, str]):
|
||||
type_in (Union[Unset, list[int]]):
|
||||
visited (Union[Unset, bool]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
PaginatedAdWithVisitList
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
bookmark=bookmark,
|
||||
favorite=favorite,
|
||||
limit=limit,
|
||||
location_dst=location_dst,
|
||||
location_lat=location_lat,
|
||||
location_lon=location_lon,
|
||||
max_lat=max_lat,
|
||||
max_lon=max_lon,
|
||||
min_lat=min_lat,
|
||||
min_lon=min_lon,
|
||||
offset=offset,
|
||||
ordering=ordering,
|
||||
payment_state_in=payment_state_in,
|
||||
search=search,
|
||||
state_in=state_in,
|
||||
tags=tags,
|
||||
title_icontains=title_icontains,
|
||||
type_in=type_in,
|
||||
visited=visited,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
bookmark: Union[Unset, bool] = UNSET,
|
||||
favorite: Union[Unset, bool] = UNSET,
|
||||
limit: Union[Unset, int] = UNSET,
|
||||
location_dst: Union[Unset, str] = UNSET,
|
||||
location_lat: Union[Unset, str] = UNSET,
|
||||
location_lon: Union[Unset, str] = UNSET,
|
||||
max_lat: Union[Unset, str] = UNSET,
|
||||
max_lon: Union[Unset, str] = UNSET,
|
||||
min_lat: Union[Unset, str] = UNSET,
|
||||
min_lon: Union[Unset, str] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
ordering: Union[Unset, list[StoresAdsWithVisitsListOrderingItem]] = UNSET,
|
||||
payment_state_in: Union[Unset, list[int]] = UNSET,
|
||||
search: Union[Unset, str] = UNSET,
|
||||
state_in: Union[Unset, list[int]] = UNSET,
|
||||
tags: Union[Unset, str] = UNSET,
|
||||
title_icontains: Union[Unset, str] = UNSET,
|
||||
type_in: Union[Unset, list[int]] = UNSET,
|
||||
visited: Union[Unset, bool] = UNSET,
|
||||
) -> Response[PaginatedAdWithVisitList]:
|
||||
"""
|
||||
Args:
|
||||
bookmark (Union[Unset, bool]):
|
||||
favorite (Union[Unset, bool]):
|
||||
limit (Union[Unset, int]):
|
||||
location_dst (Union[Unset, str]):
|
||||
location_lat (Union[Unset, str]):
|
||||
location_lon (Union[Unset, str]):
|
||||
max_lat (Union[Unset, str]):
|
||||
max_lon (Union[Unset, str]):
|
||||
min_lat (Union[Unset, str]):
|
||||
min_lon (Union[Unset, str]):
|
||||
offset (Union[Unset, int]):
|
||||
ordering (Union[Unset, list[StoresAdsWithVisitsListOrderingItem]]):
|
||||
payment_state_in (Union[Unset, list[int]]):
|
||||
search (Union[Unset, str]):
|
||||
state_in (Union[Unset, list[int]]):
|
||||
tags (Union[Unset, str]):
|
||||
title_icontains (Union[Unset, str]):
|
||||
type_in (Union[Unset, list[int]]):
|
||||
visited (Union[Unset, bool]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[PaginatedAdWithVisitList]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
bookmark=bookmark,
|
||||
favorite=favorite,
|
||||
limit=limit,
|
||||
location_dst=location_dst,
|
||||
location_lat=location_lat,
|
||||
location_lon=location_lon,
|
||||
max_lat=max_lat,
|
||||
max_lon=max_lon,
|
||||
min_lat=min_lat,
|
||||
min_lon=min_lon,
|
||||
offset=offset,
|
||||
ordering=ordering,
|
||||
payment_state_in=payment_state_in,
|
||||
search=search,
|
||||
state_in=state_in,
|
||||
tags=tags,
|
||||
title_icontains=title_icontains,
|
||||
type_in=type_in,
|
||||
visited=visited,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
bookmark: Union[Unset, bool] = UNSET,
|
||||
favorite: Union[Unset, bool] = UNSET,
|
||||
limit: Union[Unset, int] = UNSET,
|
||||
location_dst: Union[Unset, str] = UNSET,
|
||||
location_lat: Union[Unset, str] = UNSET,
|
||||
location_lon: Union[Unset, str] = UNSET,
|
||||
max_lat: Union[Unset, str] = UNSET,
|
||||
max_lon: Union[Unset, str] = UNSET,
|
||||
min_lat: Union[Unset, str] = UNSET,
|
||||
min_lon: Union[Unset, str] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
ordering: Union[Unset, list[StoresAdsWithVisitsListOrderingItem]] = UNSET,
|
||||
payment_state_in: Union[Unset, list[int]] = UNSET,
|
||||
search: Union[Unset, str] = UNSET,
|
||||
state_in: Union[Unset, list[int]] = UNSET,
|
||||
tags: Union[Unset, str] = UNSET,
|
||||
title_icontains: Union[Unset, str] = UNSET,
|
||||
type_in: Union[Unset, list[int]] = UNSET,
|
||||
visited: Union[Unset, bool] = UNSET,
|
||||
) -> Optional[PaginatedAdWithVisitList]:
|
||||
"""
|
||||
Args:
|
||||
bookmark (Union[Unset, bool]):
|
||||
favorite (Union[Unset, bool]):
|
||||
limit (Union[Unset, int]):
|
||||
location_dst (Union[Unset, str]):
|
||||
location_lat (Union[Unset, str]):
|
||||
location_lon (Union[Unset, str]):
|
||||
max_lat (Union[Unset, str]):
|
||||
max_lon (Union[Unset, str]):
|
||||
min_lat (Union[Unset, str]):
|
||||
min_lon (Union[Unset, str]):
|
||||
offset (Union[Unset, int]):
|
||||
ordering (Union[Unset, list[StoresAdsWithVisitsListOrderingItem]]):
|
||||
payment_state_in (Union[Unset, list[int]]):
|
||||
search (Union[Unset, str]):
|
||||
state_in (Union[Unset, list[int]]):
|
||||
tags (Union[Unset, str]):
|
||||
title_icontains (Union[Unset, str]):
|
||||
type_in (Union[Unset, list[int]]):
|
||||
visited (Union[Unset, bool]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
PaginatedAdWithVisitList
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
client=client,
|
||||
bookmark=bookmark,
|
||||
favorite=favorite,
|
||||
limit=limit,
|
||||
location_dst=location_dst,
|
||||
location_lat=location_lat,
|
||||
location_lon=location_lon,
|
||||
max_lat=max_lat,
|
||||
max_lon=max_lon,
|
||||
min_lat=min_lat,
|
||||
min_lon=min_lon,
|
||||
offset=offset,
|
||||
ordering=ordering,
|
||||
payment_state_in=payment_state_in,
|
||||
search=search,
|
||||
state_in=state_in,
|
||||
tags=tags,
|
||||
title_icontains=title_icontains,
|
||||
type_in=type_in,
|
||||
visited=visited,
|
||||
)
|
||||
).parsed
|
||||
|
|
@ -0,0 +1,151 @@
|
|||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.comment_create import CommentCreate
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
body: CommentCreate,
|
||||
) -> dict[str, Any]:
|
||||
headers: dict[str, Any] = {}
|
||||
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "post",
|
||||
"url": "/stores/comments/",
|
||||
}
|
||||
|
||||
_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[CommentCreate]:
|
||||
if response.status_code == 201:
|
||||
response_201 = CommentCreate.from_dict(response.json())
|
||||
|
||||
return response_201
|
||||
|
||||
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[CommentCreate]:
|
||||
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: CommentCreate,
|
||||
) -> Response[CommentCreate]:
|
||||
"""
|
||||
Args:
|
||||
body (CommentCreate):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[CommentCreate]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
body=body,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: CommentCreate,
|
||||
) -> Optional[CommentCreate]:
|
||||
"""
|
||||
Args:
|
||||
body (CommentCreate):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
CommentCreate
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
body=body,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: CommentCreate,
|
||||
) -> Response[CommentCreate]:
|
||||
"""
|
||||
Args:
|
||||
body (CommentCreate):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[CommentCreate]
|
||||
"""
|
||||
|
||||
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: CommentCreate,
|
||||
) -> Optional[CommentCreate]:
|
||||
"""
|
||||
Args:
|
||||
body (CommentCreate):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
CommentCreate
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
client=client,
|
||||
body=body,
|
||||
)
|
||||
).parsed
|
||||
|
|
@ -0,0 +1,207 @@
|
|||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
from uuid import UUID
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.paginated_comment_list import PaginatedCommentList
|
||||
from ...types import UNSET, Response, Unset
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
ad: Union[Unset, UUID] = UNSET,
|
||||
limit: Union[Unset, int] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
user: Union[Unset, UUID] = UNSET,
|
||||
) -> dict[str, Any]:
|
||||
params: dict[str, Any] = {}
|
||||
|
||||
json_ad: Union[Unset, str] = UNSET
|
||||
if not isinstance(ad, Unset):
|
||||
json_ad = str(ad)
|
||||
params["ad"] = json_ad
|
||||
|
||||
params["limit"] = limit
|
||||
|
||||
params["offset"] = offset
|
||||
|
||||
json_user: Union[Unset, str] = UNSET
|
||||
if not isinstance(user, Unset):
|
||||
json_user = str(user)
|
||||
params["user"] = json_user
|
||||
|
||||
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": "/stores/comments/",
|
||||
"params": params,
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[PaginatedCommentList]:
|
||||
if response.status_code == 200:
|
||||
response_200 = PaginatedCommentList.from_dict(response.json())
|
||||
|
||||
return response_200
|
||||
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[PaginatedCommentList]:
|
||||
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,
|
||||
ad: Union[Unset, UUID] = UNSET,
|
||||
limit: Union[Unset, int] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
user: Union[Unset, UUID] = UNSET,
|
||||
) -> Response[PaginatedCommentList]:
|
||||
"""
|
||||
Args:
|
||||
ad (Union[Unset, UUID]):
|
||||
limit (Union[Unset, int]):
|
||||
offset (Union[Unset, int]):
|
||||
user (Union[Unset, UUID]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[PaginatedCommentList]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
ad=ad,
|
||||
limit=limit,
|
||||
offset=offset,
|
||||
user=user,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
ad: Union[Unset, UUID] = UNSET,
|
||||
limit: Union[Unset, int] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
user: Union[Unset, UUID] = UNSET,
|
||||
) -> Optional[PaginatedCommentList]:
|
||||
"""
|
||||
Args:
|
||||
ad (Union[Unset, UUID]):
|
||||
limit (Union[Unset, int]):
|
||||
offset (Union[Unset, int]):
|
||||
user (Union[Unset, UUID]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
PaginatedCommentList
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
ad=ad,
|
||||
limit=limit,
|
||||
offset=offset,
|
||||
user=user,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
ad: Union[Unset, UUID] = UNSET,
|
||||
limit: Union[Unset, int] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
user: Union[Unset, UUID] = UNSET,
|
||||
) -> Response[PaginatedCommentList]:
|
||||
"""
|
||||
Args:
|
||||
ad (Union[Unset, UUID]):
|
||||
limit (Union[Unset, int]):
|
||||
offset (Union[Unset, int]):
|
||||
user (Union[Unset, UUID]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[PaginatedCommentList]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
ad=ad,
|
||||
limit=limit,
|
||||
offset=offset,
|
||||
user=user,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
ad: Union[Unset, UUID] = UNSET,
|
||||
limit: Union[Unset, int] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
user: Union[Unset, UUID] = UNSET,
|
||||
) -> Optional[PaginatedCommentList]:
|
||||
"""
|
||||
Args:
|
||||
ad (Union[Unset, UUID]):
|
||||
limit (Union[Unset, int]):
|
||||
offset (Union[Unset, int]):
|
||||
user (Union[Unset, UUID]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
PaginatedCommentList
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
client=client,
|
||||
ad=ad,
|
||||
limit=limit,
|
||||
offset=offset,
|
||||
user=user,
|
||||
)
|
||||
).parsed
|
||||
|
|
@ -0,0 +1,168 @@
|
|||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.reaction_toggle import ReactionToggle
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
uuid: str,
|
||||
*,
|
||||
body: ReactionToggle,
|
||||
) -> dict[str, Any]:
|
||||
headers: dict[str, Any] = {}
|
||||
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "post",
|
||||
"url": f"/stores/comments/{uuid}/react/",
|
||||
}
|
||||
|
||||
_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[ReactionToggle]:
|
||||
if response.status_code == 200:
|
||||
response_200 = ReactionToggle.from_dict(response.json())
|
||||
|
||||
return response_200
|
||||
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[ReactionToggle]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
uuid: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: ReactionToggle,
|
||||
) -> Response[ReactionToggle]:
|
||||
"""
|
||||
Args:
|
||||
uuid (str):
|
||||
body (ReactionToggle):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[ReactionToggle]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
uuid=uuid,
|
||||
body=body,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
uuid: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: ReactionToggle,
|
||||
) -> Optional[ReactionToggle]:
|
||||
"""
|
||||
Args:
|
||||
uuid (str):
|
||||
body (ReactionToggle):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
ReactionToggle
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
uuid=uuid,
|
||||
client=client,
|
||||
body=body,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
uuid: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: ReactionToggle,
|
||||
) -> Response[ReactionToggle]:
|
||||
"""
|
||||
Args:
|
||||
uuid (str):
|
||||
body (ReactionToggle):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[ReactionToggle]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
uuid=uuid,
|
||||
body=body,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
uuid: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: ReactionToggle,
|
||||
) -> Optional[ReactionToggle]:
|
||||
"""
|
||||
Args:
|
||||
uuid (str):
|
||||
body (ReactionToggle):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
ReactionToggle
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
uuid=uuid,
|
||||
client=client,
|
||||
body=body,
|
||||
)
|
||||
).parsed
|
||||
|
|
@ -0,0 +1,164 @@
|
|||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.comment_create import CommentCreate
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
uuid: str,
|
||||
*,
|
||||
body: CommentCreate,
|
||||
) -> dict[str, Any]:
|
||||
headers: dict[str, Any] = {}
|
||||
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "post",
|
||||
"url": f"/stores/comments/{uuid}/reply/",
|
||||
}
|
||||
|
||||
_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[CommentCreate]:
|
||||
if response.status_code == 201:
|
||||
response_201 = CommentCreate.from_dict(response.json())
|
||||
|
||||
return response_201
|
||||
|
||||
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[CommentCreate]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
uuid: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: CommentCreate,
|
||||
) -> Response[CommentCreate]:
|
||||
"""
|
||||
Args:
|
||||
uuid (str):
|
||||
body (CommentCreate):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[CommentCreate]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
uuid=uuid,
|
||||
body=body,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
uuid: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: CommentCreate,
|
||||
) -> Optional[CommentCreate]:
|
||||
"""
|
||||
Args:
|
||||
uuid (str):
|
||||
body (CommentCreate):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
CommentCreate
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
uuid=uuid,
|
||||
client=client,
|
||||
body=body,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
uuid: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: CommentCreate,
|
||||
) -> Response[CommentCreate]:
|
||||
"""
|
||||
Args:
|
||||
uuid (str):
|
||||
body (CommentCreate):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[CommentCreate]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
uuid=uuid,
|
||||
body=body,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
uuid: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: CommentCreate,
|
||||
) -> Optional[CommentCreate]:
|
||||
"""
|
||||
Args:
|
||||
uuid (str):
|
||||
body (CommentCreate):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
CommentCreate
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
uuid=uuid,
|
||||
client=client,
|
||||
body=body,
|
||||
)
|
||||
).parsed
|
||||
|
|
@ -0,0 +1,170 @@
|
|||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.paginated_config_list import PaginatedConfigList
|
||||
from ...types import UNSET, Response, Unset
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
limit: Union[Unset, int] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
) -> dict[str, Any]:
|
||||
params: dict[str, Any] = {}
|
||||
|
||||
params["limit"] = limit
|
||||
|
||||
params["offset"] = offset
|
||||
|
||||
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": "/stores/config/",
|
||||
"params": params,
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[PaginatedConfigList]:
|
||||
if response.status_code == 200:
|
||||
response_200 = PaginatedConfigList.from_dict(response.json())
|
||||
|
||||
return response_200
|
||||
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[PaginatedConfigList]:
|
||||
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, int] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
) -> Response[PaginatedConfigList]:
|
||||
"""
|
||||
Args:
|
||||
limit (Union[Unset, int]):
|
||||
offset (Union[Unset, int]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[PaginatedConfigList]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
limit=limit,
|
||||
offset=offset,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
limit: Union[Unset, int] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
) -> Optional[PaginatedConfigList]:
|
||||
"""
|
||||
Args:
|
||||
limit (Union[Unset, int]):
|
||||
offset (Union[Unset, int]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
PaginatedConfigList
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
limit=limit,
|
||||
offset=offset,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
limit: Union[Unset, int] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
) -> Response[PaginatedConfigList]:
|
||||
"""
|
||||
Args:
|
||||
limit (Union[Unset, int]):
|
||||
offset (Union[Unset, int]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[PaginatedConfigList]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
limit=limit,
|
||||
offset=offset,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
limit: Union[Unset, int] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
) -> Optional[PaginatedConfigList]:
|
||||
"""
|
||||
Args:
|
||||
limit (Union[Unset, int]):
|
||||
offset (Union[Unset, int]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
PaginatedConfigList
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
client=client,
|
||||
limit=limit,
|
||||
offset=offset,
|
||||
)
|
||||
).parsed
|
||||
|
|
@ -0,0 +1,165 @@
|
|||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
from uuid import UUID
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.capture import Capture
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
uuid: UUID,
|
||||
*,
|
||||
body: Capture,
|
||||
) -> dict[str, Any]:
|
||||
headers: dict[str, Any] = {}
|
||||
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "post",
|
||||
"url": f"/stores/my_ads/{uuid}/capture/",
|
||||
}
|
||||
|
||||
_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[Capture]:
|
||||
if response.status_code == 200:
|
||||
response_200 = Capture.from_dict(response.json())
|
||||
|
||||
return response_200
|
||||
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Capture]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
uuid: UUID,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: Capture,
|
||||
) -> Response[Capture]:
|
||||
"""
|
||||
Args:
|
||||
uuid (UUID):
|
||||
body (Capture):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[Capture]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
uuid=uuid,
|
||||
body=body,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
uuid: UUID,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: Capture,
|
||||
) -> Optional[Capture]:
|
||||
"""
|
||||
Args:
|
||||
uuid (UUID):
|
||||
body (Capture):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Capture
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
uuid=uuid,
|
||||
client=client,
|
||||
body=body,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
uuid: UUID,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: Capture,
|
||||
) -> Response[Capture]:
|
||||
"""
|
||||
Args:
|
||||
uuid (UUID):
|
||||
body (Capture):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[Capture]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
uuid=uuid,
|
||||
body=body,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
uuid: UUID,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: Capture,
|
||||
) -> Optional[Capture]:
|
||||
"""
|
||||
Args:
|
||||
uuid (UUID):
|
||||
body (Capture):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Capture
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
uuid=uuid,
|
||||
client=client,
|
||||
body=body,
|
||||
)
|
||||
).parsed
|
||||
|
|
@ -0,0 +1,144 @@
|
|||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
from uuid import UUID
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.capture import Capture
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
uuid: UUID,
|
||||
) -> dict[str, Any]:
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "get",
|
||||
"url": f"/stores/my_ads/{uuid}/capturing_detail/",
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Capture]:
|
||||
if response.status_code == 200:
|
||||
response_200 = Capture.from_dict(response.json())
|
||||
|
||||
return response_200
|
||||
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Capture]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
uuid: UUID,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Response[Capture]:
|
||||
"""
|
||||
Args:
|
||||
uuid (UUID):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[Capture]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
uuid=uuid,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
uuid: UUID,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Optional[Capture]:
|
||||
"""
|
||||
Args:
|
||||
uuid (UUID):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Capture
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
uuid=uuid,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
uuid: UUID,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Response[Capture]:
|
||||
"""
|
||||
Args:
|
||||
uuid (UUID):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[Capture]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
uuid=uuid,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
uuid: UUID,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Optional[Capture]:
|
||||
"""
|
||||
Args:
|
||||
uuid (UUID):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Capture
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
uuid=uuid,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
||||
|
|
@ -0,0 +1,165 @@
|
|||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
from uuid import UUID
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.ad_content import AdContent
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
ad: UUID,
|
||||
*,
|
||||
body: AdContent,
|
||||
) -> dict[str, Any]:
|
||||
headers: dict[str, Any] = {}
|
||||
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "post",
|
||||
"url": f"/stores/my_ads/{ad}/contents/",
|
||||
}
|
||||
|
||||
_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[AdContent]:
|
||||
if response.status_code == 201:
|
||||
response_201 = AdContent.from_dict(response.json())
|
||||
|
||||
return response_201
|
||||
|
||||
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[AdContent]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
ad: UUID,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: AdContent,
|
||||
) -> Response[AdContent]:
|
||||
"""
|
||||
Args:
|
||||
ad (UUID):
|
||||
body (AdContent):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[AdContent]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
ad=ad,
|
||||
body=body,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
ad: UUID,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: AdContent,
|
||||
) -> Optional[AdContent]:
|
||||
"""
|
||||
Args:
|
||||
ad (UUID):
|
||||
body (AdContent):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
AdContent
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
ad=ad,
|
||||
client=client,
|
||||
body=body,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
ad: UUID,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: AdContent,
|
||||
) -> Response[AdContent]:
|
||||
"""
|
||||
Args:
|
||||
ad (UUID):
|
||||
body (AdContent):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[AdContent]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
ad=ad,
|
||||
body=body,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
ad: UUID,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: AdContent,
|
||||
) -> Optional[AdContent]:
|
||||
"""
|
||||
Args:
|
||||
ad (UUID):
|
||||
body (AdContent):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
AdContent
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
ad=ad,
|
||||
client=client,
|
||||
body=body,
|
||||
)
|
||||
).parsed
|
||||
|
|
@ -0,0 +1,184 @@
|
|||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
from uuid import UUID
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.paginated_ad_content_list import PaginatedAdContentList
|
||||
from ...types import UNSET, Response, Unset
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
ad: UUID,
|
||||
*,
|
||||
limit: Union[Unset, int] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
) -> dict[str, Any]:
|
||||
params: dict[str, Any] = {}
|
||||
|
||||
params["limit"] = limit
|
||||
|
||||
params["offset"] = offset
|
||||
|
||||
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": f"/stores/my_ads/{ad}/contents/",
|
||||
"params": params,
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[PaginatedAdContentList]:
|
||||
if response.status_code == 200:
|
||||
response_200 = PaginatedAdContentList.from_dict(response.json())
|
||||
|
||||
return response_200
|
||||
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[PaginatedAdContentList]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
ad: UUID,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
limit: Union[Unset, int] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
) -> Response[PaginatedAdContentList]:
|
||||
"""
|
||||
Args:
|
||||
ad (UUID):
|
||||
limit (Union[Unset, int]):
|
||||
offset (Union[Unset, int]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[PaginatedAdContentList]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
ad=ad,
|
||||
limit=limit,
|
||||
offset=offset,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
ad: UUID,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
limit: Union[Unset, int] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
) -> Optional[PaginatedAdContentList]:
|
||||
"""
|
||||
Args:
|
||||
ad (UUID):
|
||||
limit (Union[Unset, int]):
|
||||
offset (Union[Unset, int]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
PaginatedAdContentList
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
ad=ad,
|
||||
client=client,
|
||||
limit=limit,
|
||||
offset=offset,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
ad: UUID,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
limit: Union[Unset, int] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
) -> Response[PaginatedAdContentList]:
|
||||
"""
|
||||
Args:
|
||||
ad (UUID):
|
||||
limit (Union[Unset, int]):
|
||||
offset (Union[Unset, int]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[PaginatedAdContentList]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
ad=ad,
|
||||
limit=limit,
|
||||
offset=offset,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
ad: UUID,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
limit: Union[Unset, int] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
) -> Optional[PaginatedAdContentList]:
|
||||
"""
|
||||
Args:
|
||||
ad (UUID):
|
||||
limit (Union[Unset, int]):
|
||||
offset (Union[Unset, int]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
PaginatedAdContentList
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
ad=ad,
|
||||
client=client,
|
||||
limit=limit,
|
||||
offset=offset,
|
||||
)
|
||||
).parsed
|
||||
|
|
@ -0,0 +1,151 @@
|
|||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.ad_create import AdCreate
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
body: AdCreate,
|
||||
) -> dict[str, Any]:
|
||||
headers: dict[str, Any] = {}
|
||||
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "post",
|
||||
"url": "/stores/my_ads/",
|
||||
}
|
||||
|
||||
_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[AdCreate]:
|
||||
if response.status_code == 201:
|
||||
response_201 = AdCreate.from_dict(response.json())
|
||||
|
||||
return response_201
|
||||
|
||||
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[AdCreate]:
|
||||
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: AdCreate,
|
||||
) -> Response[AdCreate]:
|
||||
"""
|
||||
Args:
|
||||
body (AdCreate):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[AdCreate]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
body=body,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: AdCreate,
|
||||
) -> Optional[AdCreate]:
|
||||
"""
|
||||
Args:
|
||||
body (AdCreate):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
AdCreate
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
body=body,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: AdCreate,
|
||||
) -> Response[AdCreate]:
|
||||
"""
|
||||
Args:
|
||||
body (AdCreate):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[AdCreate]
|
||||
"""
|
||||
|
||||
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: AdCreate,
|
||||
) -> Optional[AdCreate]:
|
||||
"""
|
||||
Args:
|
||||
body (AdCreate):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
AdCreate
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
client=client,
|
||||
body=body,
|
||||
)
|
||||
).parsed
|
||||
|
|
@ -0,0 +1,93 @@
|
|||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
from uuid import UUID
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
uuid: UUID,
|
||||
) -> dict[str, Any]:
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "delete",
|
||||
"url": f"/stores/my_ads/{uuid}/",
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
|
||||
if response.status_code == 204:
|
||||
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(
|
||||
uuid: UUID,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Response[Any]:
|
||||
"""
|
||||
Args:
|
||||
uuid (UUID):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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(
|
||||
uuid=uuid,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
uuid: UUID,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Response[Any]:
|
||||
"""
|
||||
Args:
|
||||
uuid (UUID):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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(
|
||||
uuid=uuid,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
|
@ -0,0 +1,373 @@
|
|||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.paginated_ad_owner_list import PaginatedAdOwnerList
|
||||
from ...types import UNSET, Response, Unset
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
limit: Union[Unset, int] = UNSET,
|
||||
location_dst: Union[Unset, str] = UNSET,
|
||||
location_lat: Union[Unset, str] = UNSET,
|
||||
location_lon: Union[Unset, str] = UNSET,
|
||||
max_lat: Union[Unset, str] = UNSET,
|
||||
max_lon: Union[Unset, str] = UNSET,
|
||||
min_lat: Union[Unset, str] = UNSET,
|
||||
min_lon: Union[Unset, str] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
ordering: Union[Unset, str] = UNSET,
|
||||
payment_state_in: Union[Unset, list[int]] = UNSET,
|
||||
state_in: Union[Unset, list[int]] = UNSET,
|
||||
state_ordering: Union[Unset, str] = UNSET,
|
||||
tags: Union[Unset, str] = UNSET,
|
||||
title_icontains: Union[Unset, str] = UNSET,
|
||||
) -> dict[str, Any]:
|
||||
params: dict[str, Any] = {}
|
||||
|
||||
params["limit"] = limit
|
||||
|
||||
params["location_dst"] = location_dst
|
||||
|
||||
params["location_lat"] = location_lat
|
||||
|
||||
params["location_lon"] = location_lon
|
||||
|
||||
params["max_lat"] = max_lat
|
||||
|
||||
params["max_lon"] = max_lon
|
||||
|
||||
params["min_lat"] = min_lat
|
||||
|
||||
params["min_lon"] = min_lon
|
||||
|
||||
params["offset"] = offset
|
||||
|
||||
params["ordering"] = ordering
|
||||
|
||||
json_payment_state_in: Union[Unset, list[int]] = UNSET
|
||||
if not isinstance(payment_state_in, Unset):
|
||||
json_payment_state_in = payment_state_in
|
||||
|
||||
params["payment_state__in"] = json_payment_state_in
|
||||
|
||||
json_state_in: Union[Unset, list[int]] = UNSET
|
||||
if not isinstance(state_in, Unset):
|
||||
json_state_in = state_in
|
||||
|
||||
params["state__in"] = json_state_in
|
||||
|
||||
params["state_ordering"] = state_ordering
|
||||
|
||||
params["tags"] = tags
|
||||
|
||||
params["title__icontains"] = title_icontains
|
||||
|
||||
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": "/stores/my_ads/",
|
||||
"params": params,
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[PaginatedAdOwnerList]:
|
||||
if response.status_code == 200:
|
||||
response_200 = PaginatedAdOwnerList.from_dict(response.json())
|
||||
|
||||
return response_200
|
||||
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[PaginatedAdOwnerList]:
|
||||
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, int] = UNSET,
|
||||
location_dst: Union[Unset, str] = UNSET,
|
||||
location_lat: Union[Unset, str] = UNSET,
|
||||
location_lon: Union[Unset, str] = UNSET,
|
||||
max_lat: Union[Unset, str] = UNSET,
|
||||
max_lon: Union[Unset, str] = UNSET,
|
||||
min_lat: Union[Unset, str] = UNSET,
|
||||
min_lon: Union[Unset, str] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
ordering: Union[Unset, str] = UNSET,
|
||||
payment_state_in: Union[Unset, list[int]] = UNSET,
|
||||
state_in: Union[Unset, list[int]] = UNSET,
|
||||
state_ordering: Union[Unset, str] = UNSET,
|
||||
tags: Union[Unset, str] = UNSET,
|
||||
title_icontains: Union[Unset, str] = UNSET,
|
||||
) -> Response[PaginatedAdOwnerList]:
|
||||
"""
|
||||
Args:
|
||||
limit (Union[Unset, int]):
|
||||
location_dst (Union[Unset, str]):
|
||||
location_lat (Union[Unset, str]):
|
||||
location_lon (Union[Unset, str]):
|
||||
max_lat (Union[Unset, str]):
|
||||
max_lon (Union[Unset, str]):
|
||||
min_lat (Union[Unset, str]):
|
||||
min_lon (Union[Unset, str]):
|
||||
offset (Union[Unset, int]):
|
||||
ordering (Union[Unset, str]):
|
||||
payment_state_in (Union[Unset, list[int]]):
|
||||
state_in (Union[Unset, list[int]]):
|
||||
state_ordering (Union[Unset, str]):
|
||||
tags (Union[Unset, str]):
|
||||
title_icontains (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[PaginatedAdOwnerList]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
limit=limit,
|
||||
location_dst=location_dst,
|
||||
location_lat=location_lat,
|
||||
location_lon=location_lon,
|
||||
max_lat=max_lat,
|
||||
max_lon=max_lon,
|
||||
min_lat=min_lat,
|
||||
min_lon=min_lon,
|
||||
offset=offset,
|
||||
ordering=ordering,
|
||||
payment_state_in=payment_state_in,
|
||||
state_in=state_in,
|
||||
state_ordering=state_ordering,
|
||||
tags=tags,
|
||||
title_icontains=title_icontains,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
limit: Union[Unset, int] = UNSET,
|
||||
location_dst: Union[Unset, str] = UNSET,
|
||||
location_lat: Union[Unset, str] = UNSET,
|
||||
location_lon: Union[Unset, str] = UNSET,
|
||||
max_lat: Union[Unset, str] = UNSET,
|
||||
max_lon: Union[Unset, str] = UNSET,
|
||||
min_lat: Union[Unset, str] = UNSET,
|
||||
min_lon: Union[Unset, str] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
ordering: Union[Unset, str] = UNSET,
|
||||
payment_state_in: Union[Unset, list[int]] = UNSET,
|
||||
state_in: Union[Unset, list[int]] = UNSET,
|
||||
state_ordering: Union[Unset, str] = UNSET,
|
||||
tags: Union[Unset, str] = UNSET,
|
||||
title_icontains: Union[Unset, str] = UNSET,
|
||||
) -> Optional[PaginatedAdOwnerList]:
|
||||
"""
|
||||
Args:
|
||||
limit (Union[Unset, int]):
|
||||
location_dst (Union[Unset, str]):
|
||||
location_lat (Union[Unset, str]):
|
||||
location_lon (Union[Unset, str]):
|
||||
max_lat (Union[Unset, str]):
|
||||
max_lon (Union[Unset, str]):
|
||||
min_lat (Union[Unset, str]):
|
||||
min_lon (Union[Unset, str]):
|
||||
offset (Union[Unset, int]):
|
||||
ordering (Union[Unset, str]):
|
||||
payment_state_in (Union[Unset, list[int]]):
|
||||
state_in (Union[Unset, list[int]]):
|
||||
state_ordering (Union[Unset, str]):
|
||||
tags (Union[Unset, str]):
|
||||
title_icontains (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:
|
||||
PaginatedAdOwnerList
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
limit=limit,
|
||||
location_dst=location_dst,
|
||||
location_lat=location_lat,
|
||||
location_lon=location_lon,
|
||||
max_lat=max_lat,
|
||||
max_lon=max_lon,
|
||||
min_lat=min_lat,
|
||||
min_lon=min_lon,
|
||||
offset=offset,
|
||||
ordering=ordering,
|
||||
payment_state_in=payment_state_in,
|
||||
state_in=state_in,
|
||||
state_ordering=state_ordering,
|
||||
tags=tags,
|
||||
title_icontains=title_icontains,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
limit: Union[Unset, int] = UNSET,
|
||||
location_dst: Union[Unset, str] = UNSET,
|
||||
location_lat: Union[Unset, str] = UNSET,
|
||||
location_lon: Union[Unset, str] = UNSET,
|
||||
max_lat: Union[Unset, str] = UNSET,
|
||||
max_lon: Union[Unset, str] = UNSET,
|
||||
min_lat: Union[Unset, str] = UNSET,
|
||||
min_lon: Union[Unset, str] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
ordering: Union[Unset, str] = UNSET,
|
||||
payment_state_in: Union[Unset, list[int]] = UNSET,
|
||||
state_in: Union[Unset, list[int]] = UNSET,
|
||||
state_ordering: Union[Unset, str] = UNSET,
|
||||
tags: Union[Unset, str] = UNSET,
|
||||
title_icontains: Union[Unset, str] = UNSET,
|
||||
) -> Response[PaginatedAdOwnerList]:
|
||||
"""
|
||||
Args:
|
||||
limit (Union[Unset, int]):
|
||||
location_dst (Union[Unset, str]):
|
||||
location_lat (Union[Unset, str]):
|
||||
location_lon (Union[Unset, str]):
|
||||
max_lat (Union[Unset, str]):
|
||||
max_lon (Union[Unset, str]):
|
||||
min_lat (Union[Unset, str]):
|
||||
min_lon (Union[Unset, str]):
|
||||
offset (Union[Unset, int]):
|
||||
ordering (Union[Unset, str]):
|
||||
payment_state_in (Union[Unset, list[int]]):
|
||||
state_in (Union[Unset, list[int]]):
|
||||
state_ordering (Union[Unset, str]):
|
||||
tags (Union[Unset, str]):
|
||||
title_icontains (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[PaginatedAdOwnerList]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
limit=limit,
|
||||
location_dst=location_dst,
|
||||
location_lat=location_lat,
|
||||
location_lon=location_lon,
|
||||
max_lat=max_lat,
|
||||
max_lon=max_lon,
|
||||
min_lat=min_lat,
|
||||
min_lon=min_lon,
|
||||
offset=offset,
|
||||
ordering=ordering,
|
||||
payment_state_in=payment_state_in,
|
||||
state_in=state_in,
|
||||
state_ordering=state_ordering,
|
||||
tags=tags,
|
||||
title_icontains=title_icontains,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
limit: Union[Unset, int] = UNSET,
|
||||
location_dst: Union[Unset, str] = UNSET,
|
||||
location_lat: Union[Unset, str] = UNSET,
|
||||
location_lon: Union[Unset, str] = UNSET,
|
||||
max_lat: Union[Unset, str] = UNSET,
|
||||
max_lon: Union[Unset, str] = UNSET,
|
||||
min_lat: Union[Unset, str] = UNSET,
|
||||
min_lon: Union[Unset, str] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
ordering: Union[Unset, str] = UNSET,
|
||||
payment_state_in: Union[Unset, list[int]] = UNSET,
|
||||
state_in: Union[Unset, list[int]] = UNSET,
|
||||
state_ordering: Union[Unset, str] = UNSET,
|
||||
tags: Union[Unset, str] = UNSET,
|
||||
title_icontains: Union[Unset, str] = UNSET,
|
||||
) -> Optional[PaginatedAdOwnerList]:
|
||||
"""
|
||||
Args:
|
||||
limit (Union[Unset, int]):
|
||||
location_dst (Union[Unset, str]):
|
||||
location_lat (Union[Unset, str]):
|
||||
location_lon (Union[Unset, str]):
|
||||
max_lat (Union[Unset, str]):
|
||||
max_lon (Union[Unset, str]):
|
||||
min_lat (Union[Unset, str]):
|
||||
min_lon (Union[Unset, str]):
|
||||
offset (Union[Unset, int]):
|
||||
ordering (Union[Unset, str]):
|
||||
payment_state_in (Union[Unset, list[int]]):
|
||||
state_in (Union[Unset, list[int]]):
|
||||
state_ordering (Union[Unset, str]):
|
||||
tags (Union[Unset, str]):
|
||||
title_icontains (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:
|
||||
PaginatedAdOwnerList
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
client=client,
|
||||
limit=limit,
|
||||
location_dst=location_dst,
|
||||
location_lat=location_lat,
|
||||
location_lon=location_lon,
|
||||
max_lat=max_lat,
|
||||
max_lon=max_lon,
|
||||
min_lat=min_lat,
|
||||
min_lon=min_lon,
|
||||
offset=offset,
|
||||
ordering=ordering,
|
||||
payment_state_in=payment_state_in,
|
||||
state_in=state_in,
|
||||
state_ordering=state_ordering,
|
||||
tags=tags,
|
||||
title_icontains=title_icontains,
|
||||
)
|
||||
).parsed
|
||||
|
|
@ -0,0 +1,166 @@
|
|||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
from uuid import UUID
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.ad_owner import AdOwner
|
||||
from ...models.patched_ad_owner import PatchedAdOwner
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
uuid: UUID,
|
||||
*,
|
||||
body: PatchedAdOwner,
|
||||
) -> dict[str, Any]:
|
||||
headers: dict[str, Any] = {}
|
||||
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "patch",
|
||||
"url": f"/stores/my_ads/{uuid}/",
|
||||
}
|
||||
|
||||
_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[AdOwner]:
|
||||
if response.status_code == 200:
|
||||
response_200 = AdOwner.from_dict(response.json())
|
||||
|
||||
return response_200
|
||||
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[AdOwner]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
uuid: UUID,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: PatchedAdOwner,
|
||||
) -> Response[AdOwner]:
|
||||
"""
|
||||
Args:
|
||||
uuid (UUID):
|
||||
body (PatchedAdOwner):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[AdOwner]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
uuid=uuid,
|
||||
body=body,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
uuid: UUID,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: PatchedAdOwner,
|
||||
) -> Optional[AdOwner]:
|
||||
"""
|
||||
Args:
|
||||
uuid (UUID):
|
||||
body (PatchedAdOwner):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
AdOwner
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
uuid=uuid,
|
||||
client=client,
|
||||
body=body,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
uuid: UUID,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: PatchedAdOwner,
|
||||
) -> Response[AdOwner]:
|
||||
"""
|
||||
Args:
|
||||
uuid (UUID):
|
||||
body (PatchedAdOwner):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[AdOwner]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
uuid=uuid,
|
||||
body=body,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
uuid: UUID,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: PatchedAdOwner,
|
||||
) -> Optional[AdOwner]:
|
||||
"""
|
||||
Args:
|
||||
uuid (UUID):
|
||||
body (PatchedAdOwner):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
AdOwner
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
uuid=uuid,
|
||||
client=client,
|
||||
body=body,
|
||||
)
|
||||
).parsed
|
||||
|
|
@ -0,0 +1,165 @@
|
|||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
from uuid import UUID
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.ad_owner import AdOwner
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
uuid: UUID,
|
||||
*,
|
||||
body: AdOwner,
|
||||
) -> dict[str, Any]:
|
||||
headers: dict[str, Any] = {}
|
||||
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "post",
|
||||
"url": f"/stores/my_ads/{uuid}/pay/",
|
||||
}
|
||||
|
||||
_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[AdOwner]:
|
||||
if response.status_code == 200:
|
||||
response_200 = AdOwner.from_dict(response.json())
|
||||
|
||||
return response_200
|
||||
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[AdOwner]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
uuid: UUID,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: AdOwner,
|
||||
) -> Response[AdOwner]:
|
||||
"""
|
||||
Args:
|
||||
uuid (UUID):
|
||||
body (AdOwner):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[AdOwner]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
uuid=uuid,
|
||||
body=body,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
uuid: UUID,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: AdOwner,
|
||||
) -> Optional[AdOwner]:
|
||||
"""
|
||||
Args:
|
||||
uuid (UUID):
|
||||
body (AdOwner):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
AdOwner
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
uuid=uuid,
|
||||
client=client,
|
||||
body=body,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
uuid: UUID,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: AdOwner,
|
||||
) -> Response[AdOwner]:
|
||||
"""
|
||||
Args:
|
||||
uuid (UUID):
|
||||
body (AdOwner):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[AdOwner]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
uuid=uuid,
|
||||
body=body,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
uuid: UUID,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: AdOwner,
|
||||
) -> Optional[AdOwner]:
|
||||
"""
|
||||
Args:
|
||||
uuid (UUID):
|
||||
body (AdOwner):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
AdOwner
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
uuid=uuid,
|
||||
client=client,
|
||||
body=body,
|
||||
)
|
||||
).parsed
|
||||
|
|
@ -0,0 +1,144 @@
|
|||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
from uuid import UUID
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.ad_owner import AdOwner
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
uuid: UUID,
|
||||
) -> dict[str, Any]:
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "get",
|
||||
"url": f"/stores/my_ads/{uuid}/pay/",
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[AdOwner]:
|
||||
if response.status_code == 200:
|
||||
response_200 = AdOwner.from_dict(response.json())
|
||||
|
||||
return response_200
|
||||
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[AdOwner]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
uuid: UUID,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Response[AdOwner]:
|
||||
"""
|
||||
Args:
|
||||
uuid (UUID):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[AdOwner]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
uuid=uuid,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
uuid: UUID,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Optional[AdOwner]:
|
||||
"""
|
||||
Args:
|
||||
uuid (UUID):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
AdOwner
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
uuid=uuid,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
uuid: UUID,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Response[AdOwner]:
|
||||
"""
|
||||
Args:
|
||||
uuid (UUID):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[AdOwner]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
uuid=uuid,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
uuid: UUID,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Optional[AdOwner]:
|
||||
"""
|
||||
Args:
|
||||
uuid (UUID):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
AdOwner
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
uuid=uuid,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
||||
|
|
@ -0,0 +1,100 @@
|
|||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
from uuid import UUID
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
ad: UUID,
|
||||
id: UUID,
|
||||
) -> dict[str, Any]:
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "delete",
|
||||
"url": f"/stores/my_ads/{ad}/refined_banner/{id}/",
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
|
||||
if response.status_code == 204:
|
||||
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(
|
||||
ad: UUID,
|
||||
id: UUID,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Response[Any]:
|
||||
"""
|
||||
Args:
|
||||
ad (UUID):
|
||||
id (UUID):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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(
|
||||
ad=ad,
|
||||
id=id,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
ad: UUID,
|
||||
id: UUID,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Response[Any]:
|
||||
"""
|
||||
Args:
|
||||
ad (UUID):
|
||||
id (UUID):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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(
|
||||
ad=ad,
|
||||
id=id,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
|
@ -0,0 +1,169 @@
|
|||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
from uuid import UUID
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.refined_ad_content import RefinedAdContent
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
ad: UUID,
|
||||
*,
|
||||
body: RefinedAdContent,
|
||||
) -> dict[str, Any]:
|
||||
headers: dict[str, Any] = {}
|
||||
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "post",
|
||||
"url": f"/stores/my_ads/{ad}/refined_contents/",
|
||||
}
|
||||
|
||||
_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[RefinedAdContent]:
|
||||
if response.status_code == 201:
|
||||
response_201 = RefinedAdContent.from_dict(response.json())
|
||||
|
||||
return response_201
|
||||
|
||||
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[RefinedAdContent]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
ad: UUID,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: RefinedAdContent,
|
||||
) -> Response[RefinedAdContent]:
|
||||
"""
|
||||
Args:
|
||||
ad (UUID):
|
||||
body (RefinedAdContent):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[RefinedAdContent]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
ad=ad,
|
||||
body=body,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
ad: UUID,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: RefinedAdContent,
|
||||
) -> Optional[RefinedAdContent]:
|
||||
"""
|
||||
Args:
|
||||
ad (UUID):
|
||||
body (RefinedAdContent):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
RefinedAdContent
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
ad=ad,
|
||||
client=client,
|
||||
body=body,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
ad: UUID,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: RefinedAdContent,
|
||||
) -> Response[RefinedAdContent]:
|
||||
"""
|
||||
Args:
|
||||
ad (UUID):
|
||||
body (RefinedAdContent):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[RefinedAdContent]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
ad=ad,
|
||||
body=body,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
ad: UUID,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: RefinedAdContent,
|
||||
) -> Optional[RefinedAdContent]:
|
||||
"""
|
||||
Args:
|
||||
ad (UUID):
|
||||
body (RefinedAdContent):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
RefinedAdContent
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
ad=ad,
|
||||
client=client,
|
||||
body=body,
|
||||
)
|
||||
).parsed
|
||||
|
|
@ -0,0 +1,100 @@
|
|||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
from uuid import UUID
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
ad: UUID,
|
||||
id: UUID,
|
||||
) -> dict[str, Any]:
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "delete",
|
||||
"url": f"/stores/my_ads/{ad}/refined_contents/{id}/",
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
|
||||
if response.status_code == 204:
|
||||
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(
|
||||
ad: UUID,
|
||||
id: UUID,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Response[Any]:
|
||||
"""
|
||||
Args:
|
||||
ad (UUID):
|
||||
id (UUID):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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(
|
||||
ad=ad,
|
||||
id=id,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
ad: UUID,
|
||||
id: UUID,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Response[Any]:
|
||||
"""
|
||||
Args:
|
||||
ad (UUID):
|
||||
id (UUID):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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(
|
||||
ad=ad,
|
||||
id=id,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
|
@ -0,0 +1,184 @@
|
|||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
from uuid import UUID
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.paginated_refined_ad_content_list import PaginatedRefinedAdContentList
|
||||
from ...types import UNSET, Response, Unset
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
ad: UUID,
|
||||
*,
|
||||
limit: Union[Unset, int] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
) -> dict[str, Any]:
|
||||
params: dict[str, Any] = {}
|
||||
|
||||
params["limit"] = limit
|
||||
|
||||
params["offset"] = offset
|
||||
|
||||
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": f"/stores/my_ads/{ad}/refined_contents/",
|
||||
"params": params,
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[PaginatedRefinedAdContentList]:
|
||||
if response.status_code == 200:
|
||||
response_200 = PaginatedRefinedAdContentList.from_dict(response.json())
|
||||
|
||||
return response_200
|
||||
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[PaginatedRefinedAdContentList]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
ad: UUID,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
limit: Union[Unset, int] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
) -> Response[PaginatedRefinedAdContentList]:
|
||||
"""
|
||||
Args:
|
||||
ad (UUID):
|
||||
limit (Union[Unset, int]):
|
||||
offset (Union[Unset, int]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[PaginatedRefinedAdContentList]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
ad=ad,
|
||||
limit=limit,
|
||||
offset=offset,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
ad: UUID,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
limit: Union[Unset, int] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
) -> Optional[PaginatedRefinedAdContentList]:
|
||||
"""
|
||||
Args:
|
||||
ad (UUID):
|
||||
limit (Union[Unset, int]):
|
||||
offset (Union[Unset, int]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
PaginatedRefinedAdContentList
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
ad=ad,
|
||||
client=client,
|
||||
limit=limit,
|
||||
offset=offset,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
ad: UUID,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
limit: Union[Unset, int] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
) -> Response[PaginatedRefinedAdContentList]:
|
||||
"""
|
||||
Args:
|
||||
ad (UUID):
|
||||
limit (Union[Unset, int]):
|
||||
offset (Union[Unset, int]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[PaginatedRefinedAdContentList]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
ad=ad,
|
||||
limit=limit,
|
||||
offset=offset,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
ad: UUID,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
limit: Union[Unset, int] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
) -> Optional[PaginatedRefinedAdContentList]:
|
||||
"""
|
||||
Args:
|
||||
ad (UUID):
|
||||
limit (Union[Unset, int]):
|
||||
offset (Union[Unset, int]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
PaginatedRefinedAdContentList
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
ad=ad,
|
||||
client=client,
|
||||
limit=limit,
|
||||
offset=offset,
|
||||
)
|
||||
).parsed
|
||||
|
|
@ -0,0 +1,144 @@
|
|||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
from uuid import UUID
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.ad_owner import AdOwner
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
uuid: UUID,
|
||||
) -> dict[str, Any]:
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "get",
|
||||
"url": f"/stores/my_ads/{uuid}/",
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[AdOwner]:
|
||||
if response.status_code == 200:
|
||||
response_200 = AdOwner.from_dict(response.json())
|
||||
|
||||
return response_200
|
||||
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[AdOwner]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
uuid: UUID,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Response[AdOwner]:
|
||||
"""
|
||||
Args:
|
||||
uuid (UUID):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[AdOwner]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
uuid=uuid,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
uuid: UUID,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Optional[AdOwner]:
|
||||
"""
|
||||
Args:
|
||||
uuid (UUID):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
AdOwner
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
uuid=uuid,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
uuid: UUID,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Response[AdOwner]:
|
||||
"""
|
||||
Args:
|
||||
uuid (UUID):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[AdOwner]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
uuid=uuid,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
uuid: UUID,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Optional[AdOwner]:
|
||||
"""
|
||||
Args:
|
||||
uuid (UUID):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
AdOwner
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
uuid=uuid,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
||||
|
|
@ -0,0 +1,144 @@
|
|||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
from uuid import UUID
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.ad_statistic import AdStatistic
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
uuid: UUID,
|
||||
) -> dict[str, Any]:
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "get",
|
||||
"url": f"/stores/my_ads/{uuid}/statistic/",
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[AdStatistic]:
|
||||
if response.status_code == 200:
|
||||
response_200 = AdStatistic.from_dict(response.json())
|
||||
|
||||
return response_200
|
||||
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[AdStatistic]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
uuid: UUID,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Response[AdStatistic]:
|
||||
"""
|
||||
Args:
|
||||
uuid (UUID):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[AdStatistic]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
uuid=uuid,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
uuid: UUID,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Optional[AdStatistic]:
|
||||
"""
|
||||
Args:
|
||||
uuid (UUID):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
AdStatistic
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
uuid=uuid,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
uuid: UUID,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Response[AdStatistic]:
|
||||
"""
|
||||
Args:
|
||||
uuid (UUID):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[AdStatistic]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
uuid=uuid,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
uuid: UUID,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Optional[AdStatistic]:
|
||||
"""
|
||||
Args:
|
||||
uuid (UUID):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
AdStatistic
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
uuid=uuid,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
||||
|
|
@ -0,0 +1,144 @@
|
|||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
from uuid import UUID
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.ad_owner import AdOwner
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
uuid: UUID,
|
||||
) -> dict[str, Any]:
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "get",
|
||||
"url": f"/stores/my_ads/{uuid}/stop/",
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[AdOwner]:
|
||||
if response.status_code == 200:
|
||||
response_200 = AdOwner.from_dict(response.json())
|
||||
|
||||
return response_200
|
||||
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[AdOwner]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
uuid: UUID,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Response[AdOwner]:
|
||||
"""
|
||||
Args:
|
||||
uuid (UUID):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[AdOwner]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
uuid=uuid,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
uuid: UUID,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Optional[AdOwner]:
|
||||
"""
|
||||
Args:
|
||||
uuid (UUID):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
AdOwner
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
uuid=uuid,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
uuid: UUID,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Response[AdOwner]:
|
||||
"""
|
||||
Args:
|
||||
uuid (UUID):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[AdOwner]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
uuid=uuid,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
uuid: UUID,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Optional[AdOwner]:
|
||||
"""
|
||||
Args:
|
||||
uuid (UUID):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
AdOwner
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
uuid=uuid,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
||||
|
|
@ -0,0 +1,165 @@
|
|||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
from uuid import UUID
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.ad_owner import AdOwner
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
uuid: UUID,
|
||||
*,
|
||||
body: AdOwner,
|
||||
) -> dict[str, Any]:
|
||||
headers: dict[str, Any] = {}
|
||||
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "put",
|
||||
"url": f"/stores/my_ads/{uuid}/",
|
||||
}
|
||||
|
||||
_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[AdOwner]:
|
||||
if response.status_code == 200:
|
||||
response_200 = AdOwner.from_dict(response.json())
|
||||
|
||||
return response_200
|
||||
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[AdOwner]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
uuid: UUID,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: AdOwner,
|
||||
) -> Response[AdOwner]:
|
||||
"""
|
||||
Args:
|
||||
uuid (UUID):
|
||||
body (AdOwner):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[AdOwner]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
uuid=uuid,
|
||||
body=body,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
uuid: UUID,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: AdOwner,
|
||||
) -> Optional[AdOwner]:
|
||||
"""
|
||||
Args:
|
||||
uuid (UUID):
|
||||
body (AdOwner):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
AdOwner
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
uuid=uuid,
|
||||
client=client,
|
||||
body=body,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
uuid: UUID,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: AdOwner,
|
||||
) -> Response[AdOwner]:
|
||||
"""
|
||||
Args:
|
||||
uuid (UUID):
|
||||
body (AdOwner):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[AdOwner]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
uuid=uuid,
|
||||
body=body,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
uuid: UUID,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: AdOwner,
|
||||
) -> Optional[AdOwner]:
|
||||
"""
|
||||
Args:
|
||||
uuid (UUID):
|
||||
body (AdOwner):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
AdOwner
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
uuid=uuid,
|
||||
client=client,
|
||||
body=body,
|
||||
)
|
||||
).parsed
|
||||
|
|
@ -0,0 +1,154 @@
|
|||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.statistic import Statistic
|
||||
from ...models.stores_statistic_retrieve_accept_language import StoresStatisticRetrieveAcceptLanguage
|
||||
from ...types import Response, Unset
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
accept_language: Union[Unset, StoresStatisticRetrieveAcceptLanguage] = StoresStatisticRetrieveAcceptLanguage.FA,
|
||||
) -> dict[str, Any]:
|
||||
headers: dict[str, Any] = {}
|
||||
if not isinstance(accept_language, Unset):
|
||||
headers["Accept-Language"] = str(accept_language)
|
||||
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "get",
|
||||
"url": "/stores/statistic/",
|
||||
}
|
||||
|
||||
_kwargs["headers"] = headers
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Statistic]:
|
||||
if response.status_code == 200:
|
||||
response_200 = Statistic.from_dict(response.json())
|
||||
|
||||
return response_200
|
||||
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Statistic]:
|
||||
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,
|
||||
accept_language: Union[Unset, StoresStatisticRetrieveAcceptLanguage] = StoresStatisticRetrieveAcceptLanguage.FA,
|
||||
) -> Response[Statistic]:
|
||||
"""
|
||||
Args:
|
||||
accept_language (Union[Unset, StoresStatisticRetrieveAcceptLanguage]): Default:
|
||||
StoresStatisticRetrieveAcceptLanguage.FA.
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[Statistic]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
accept_language=accept_language,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
accept_language: Union[Unset, StoresStatisticRetrieveAcceptLanguage] = StoresStatisticRetrieveAcceptLanguage.FA,
|
||||
) -> Optional[Statistic]:
|
||||
"""
|
||||
Args:
|
||||
accept_language (Union[Unset, StoresStatisticRetrieveAcceptLanguage]): Default:
|
||||
StoresStatisticRetrieveAcceptLanguage.FA.
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Statistic
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
accept_language=accept_language,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
accept_language: Union[Unset, StoresStatisticRetrieveAcceptLanguage] = StoresStatisticRetrieveAcceptLanguage.FA,
|
||||
) -> Response[Statistic]:
|
||||
"""
|
||||
Args:
|
||||
accept_language (Union[Unset, StoresStatisticRetrieveAcceptLanguage]): Default:
|
||||
StoresStatisticRetrieveAcceptLanguage.FA.
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[Statistic]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
accept_language=accept_language,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
accept_language: Union[Unset, StoresStatisticRetrieveAcceptLanguage] = StoresStatisticRetrieveAcceptLanguage.FA,
|
||||
) -> Optional[Statistic]:
|
||||
"""
|
||||
Args:
|
||||
accept_language (Union[Unset, StoresStatisticRetrieveAcceptLanguage]): Default:
|
||||
StoresStatisticRetrieveAcceptLanguage.FA.
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Statistic
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
client=client,
|
||||
accept_language=accept_language,
|
||||
)
|
||||
).parsed
|
||||
|
|
@ -0,0 +1,185 @@
|
|||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.paginated_tag_list import PaginatedTagList
|
||||
from ...types import UNSET, Response, Unset
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
limit: Union[Unset, int] = UNSET,
|
||||
name_icontains: Union[Unset, str] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
) -> dict[str, Any]:
|
||||
params: dict[str, Any] = {}
|
||||
|
||||
params["limit"] = limit
|
||||
|
||||
params["name__icontains"] = name_icontains
|
||||
|
||||
params["offset"] = offset
|
||||
|
||||
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": "/stores/tags/",
|
||||
"params": params,
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[PaginatedTagList]:
|
||||
if response.status_code == 200:
|
||||
response_200 = PaginatedTagList.from_dict(response.json())
|
||||
|
||||
return response_200
|
||||
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[PaginatedTagList]:
|
||||
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, int] = UNSET,
|
||||
name_icontains: Union[Unset, str] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
) -> Response[PaginatedTagList]:
|
||||
"""
|
||||
Args:
|
||||
limit (Union[Unset, int]):
|
||||
name_icontains (Union[Unset, str]):
|
||||
offset (Union[Unset, int]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[PaginatedTagList]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
limit=limit,
|
||||
name_icontains=name_icontains,
|
||||
offset=offset,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
limit: Union[Unset, int] = UNSET,
|
||||
name_icontains: Union[Unset, str] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
) -> Optional[PaginatedTagList]:
|
||||
"""
|
||||
Args:
|
||||
limit (Union[Unset, int]):
|
||||
name_icontains (Union[Unset, str]):
|
||||
offset (Union[Unset, int]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
PaginatedTagList
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
limit=limit,
|
||||
name_icontains=name_icontains,
|
||||
offset=offset,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
limit: Union[Unset, int] = UNSET,
|
||||
name_icontains: Union[Unset, str] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
) -> Response[PaginatedTagList]:
|
||||
"""
|
||||
Args:
|
||||
limit (Union[Unset, int]):
|
||||
name_icontains (Union[Unset, str]):
|
||||
offset (Union[Unset, int]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[PaginatedTagList]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
limit=limit,
|
||||
name_icontains=name_icontains,
|
||||
offset=offset,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
limit: Union[Unset, int] = UNSET,
|
||||
name_icontains: Union[Unset, str] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
) -> Optional[PaginatedTagList]:
|
||||
"""
|
||||
Args:
|
||||
limit (Union[Unset, int]):
|
||||
name_icontains (Union[Unset, str]):
|
||||
offset (Union[Unset, int]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
PaginatedTagList
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
client=client,
|
||||
limit=limit,
|
||||
name_icontains=name_icontains,
|
||||
offset=offset,
|
||||
)
|
||||
).parsed
|
||||
|
|
@ -0,0 +1,143 @@
|
|||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.tag import Tag
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
id: int,
|
||||
) -> dict[str, Any]:
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "get",
|
||||
"url": f"/stores/tags/{id}/",
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Tag]:
|
||||
if response.status_code == 200:
|
||||
response_200 = Tag.from_dict(response.json())
|
||||
|
||||
return response_200
|
||||
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Tag]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
id: int,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Response[Tag]:
|
||||
"""
|
||||
Args:
|
||||
id (int):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[Tag]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
id: int,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Optional[Tag]:
|
||||
"""
|
||||
Args:
|
||||
id (int):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Tag
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
id: int,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Response[Tag]:
|
||||
"""
|
||||
Args:
|
||||
id (int):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[Tag]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
id: int,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Optional[Tag]:
|
||||
"""
|
||||
Args:
|
||||
id (int):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Tag
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
||||
|
|
@ -0,0 +1,151 @@
|
|||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.sign_content import SignContent
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
body: SignContent,
|
||||
) -> dict[str, Any]:
|
||||
headers: dict[str, Any] = {}
|
||||
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "post",
|
||||
"url": "/stores/uploads/presign/",
|
||||
}
|
||||
|
||||
_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[SignContent]:
|
||||
if response.status_code == 201:
|
||||
response_201 = SignContent.from_dict(response.json())
|
||||
|
||||
return response_201
|
||||
|
||||
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[SignContent]:
|
||||
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: SignContent,
|
||||
) -> Response[SignContent]:
|
||||
"""
|
||||
Args:
|
||||
body (SignContent):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[SignContent]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
body=body,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: SignContent,
|
||||
) -> Optional[SignContent]:
|
||||
"""
|
||||
Args:
|
||||
body (SignContent):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
SignContent
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
body=body,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: SignContent,
|
||||
) -> Response[SignContent]:
|
||||
"""
|
||||
Args:
|
||||
body (SignContent):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[SignContent]
|
||||
"""
|
||||
|
||||
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: SignContent,
|
||||
) -> Optional[SignContent]:
|
||||
"""
|
||||
Args:
|
||||
body (SignContent):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
SignContent
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
client=client,
|
||||
body=body,
|
||||
)
|
||||
).parsed
|
||||
|
|
@ -0,0 +1,151 @@
|
|||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.visit import Visit
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
body: Visit,
|
||||
) -> dict[str, Any]:
|
||||
headers: dict[str, Any] = {}
|
||||
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "post",
|
||||
"url": "/stores/visits/",
|
||||
}
|
||||
|
||||
_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[Visit]:
|
||||
if response.status_code == 201:
|
||||
response_201 = Visit.from_dict(response.json())
|
||||
|
||||
return response_201
|
||||
|
||||
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[Visit]:
|
||||
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: Visit,
|
||||
) -> Response[Visit]:
|
||||
"""
|
||||
Args:
|
||||
body (Visit):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[Visit]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
body=body,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: Visit,
|
||||
) -> Optional[Visit]:
|
||||
"""
|
||||
Args:
|
||||
body (Visit):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Visit
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
body=body,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: Visit,
|
||||
) -> Response[Visit]:
|
||||
"""
|
||||
Args:
|
||||
body (Visit):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[Visit]
|
||||
"""
|
||||
|
||||
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: Visit,
|
||||
) -> Optional[Visit]:
|
||||
"""
|
||||
Args:
|
||||
body (Visit):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Visit
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
client=client,
|
||||
body=body,
|
||||
)
|
||||
).parsed
|
||||
|
|
@ -0,0 +1,164 @@
|
|||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.visit import Visit
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
id: str,
|
||||
*,
|
||||
body: Visit,
|
||||
) -> dict[str, Any]:
|
||||
headers: dict[str, Any] = {}
|
||||
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "post",
|
||||
"url": f"/stores/visits/{id}/finish/",
|
||||
}
|
||||
|
||||
_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[Visit]:
|
||||
if response.status_code == 200:
|
||||
response_200 = Visit.from_dict(response.json())
|
||||
|
||||
return response_200
|
||||
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Visit]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
id: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: Visit,
|
||||
) -> Response[Visit]:
|
||||
"""
|
||||
Args:
|
||||
id (str):
|
||||
body (Visit):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[Visit]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
body=body,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
id: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: Visit,
|
||||
) -> Optional[Visit]:
|
||||
"""
|
||||
Args:
|
||||
id (str):
|
||||
body (Visit):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Visit
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
body=body,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
id: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: Visit,
|
||||
) -> Response[Visit]:
|
||||
"""
|
||||
Args:
|
||||
id (str):
|
||||
body (Visit):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[Visit]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
body=body,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
id: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: Visit,
|
||||
) -> Optional[Visit]:
|
||||
"""
|
||||
Args:
|
||||
id (str):
|
||||
body (Visit):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Visit
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
body=body,
|
||||
)
|
||||
).parsed
|
||||
|
|
@ -0,0 +1,168 @@
|
|||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.visit_interaction import VisitInteraction
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
id: str,
|
||||
*,
|
||||
body: VisitInteraction,
|
||||
) -> dict[str, Any]:
|
||||
headers: dict[str, Any] = {}
|
||||
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "post",
|
||||
"url": f"/stores/visits/{id}/interact/",
|
||||
}
|
||||
|
||||
_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[VisitInteraction]:
|
||||
if response.status_code == 200:
|
||||
response_200 = VisitInteraction.from_dict(response.json())
|
||||
|
||||
return response_200
|
||||
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[VisitInteraction]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
id: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: VisitInteraction,
|
||||
) -> Response[VisitInteraction]:
|
||||
"""
|
||||
Args:
|
||||
id (str):
|
||||
body (VisitInteraction):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[VisitInteraction]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
body=body,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
id: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: VisitInteraction,
|
||||
) -> Optional[VisitInteraction]:
|
||||
"""
|
||||
Args:
|
||||
id (str):
|
||||
body (VisitInteraction):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
VisitInteraction
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
body=body,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
id: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: VisitInteraction,
|
||||
) -> Response[VisitInteraction]:
|
||||
"""
|
||||
Args:
|
||||
id (str):
|
||||
body (VisitInteraction):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[VisitInteraction]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
body=body,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
id: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: VisitInteraction,
|
||||
) -> Optional[VisitInteraction]:
|
||||
"""
|
||||
Args:
|
||||
id (str):
|
||||
body (VisitInteraction):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
VisitInteraction
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
body=body,
|
||||
)
|
||||
).parsed
|
||||
|
|
@ -0,0 +1,170 @@
|
|||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.paginated_visit_list import PaginatedVisitList
|
||||
from ...types import UNSET, Response, Unset
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
limit: Union[Unset, int] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
) -> dict[str, Any]:
|
||||
params: dict[str, Any] = {}
|
||||
|
||||
params["limit"] = limit
|
||||
|
||||
params["offset"] = offset
|
||||
|
||||
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": "/stores/visits/",
|
||||
"params": params,
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[PaginatedVisitList]:
|
||||
if response.status_code == 200:
|
||||
response_200 = PaginatedVisitList.from_dict(response.json())
|
||||
|
||||
return response_200
|
||||
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[PaginatedVisitList]:
|
||||
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, int] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
) -> Response[PaginatedVisitList]:
|
||||
"""
|
||||
Args:
|
||||
limit (Union[Unset, int]):
|
||||
offset (Union[Unset, int]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[PaginatedVisitList]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
limit=limit,
|
||||
offset=offset,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
limit: Union[Unset, int] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
) -> Optional[PaginatedVisitList]:
|
||||
"""
|
||||
Args:
|
||||
limit (Union[Unset, int]):
|
||||
offset (Union[Unset, int]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
PaginatedVisitList
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
limit=limit,
|
||||
offset=offset,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
limit: Union[Unset, int] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
) -> Response[PaginatedVisitList]:
|
||||
"""
|
||||
Args:
|
||||
limit (Union[Unset, int]):
|
||||
offset (Union[Unset, int]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[PaginatedVisitList]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
limit=limit,
|
||||
offset=offset,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
limit: Union[Unset, int] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
) -> Optional[PaginatedVisitList]:
|
||||
"""
|
||||
Args:
|
||||
limit (Union[Unset, int]):
|
||||
offset (Union[Unset, int]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
PaginatedVisitList
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
client=client,
|
||||
limit=limit,
|
||||
offset=offset,
|
||||
)
|
||||
).parsed
|
||||
|
|
@ -0,0 +1,164 @@
|
|||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.visit_reaction import VisitReaction
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
id: str,
|
||||
*,
|
||||
body: VisitReaction,
|
||||
) -> dict[str, Any]:
|
||||
headers: dict[str, Any] = {}
|
||||
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "post",
|
||||
"url": f"/stores/visits/{id}/react/",
|
||||
}
|
||||
|
||||
_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[VisitReaction]:
|
||||
if response.status_code == 200:
|
||||
response_200 = VisitReaction.from_dict(response.json())
|
||||
|
||||
return response_200
|
||||
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[VisitReaction]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
id: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: VisitReaction,
|
||||
) -> Response[VisitReaction]:
|
||||
"""
|
||||
Args:
|
||||
id (str):
|
||||
body (VisitReaction):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[VisitReaction]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
body=body,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
id: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: VisitReaction,
|
||||
) -> Optional[VisitReaction]:
|
||||
"""
|
||||
Args:
|
||||
id (str):
|
||||
body (VisitReaction):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
VisitReaction
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
body=body,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
id: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: VisitReaction,
|
||||
) -> Response[VisitReaction]:
|
||||
"""
|
||||
Args:
|
||||
id (str):
|
||||
body (VisitReaction):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[VisitReaction]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
body=body,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
id: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: VisitReaction,
|
||||
) -> Optional[VisitReaction]:
|
||||
"""
|
||||
Args:
|
||||
id (str):
|
||||
body (VisitReaction):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
VisitReaction
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
body=body,
|
||||
)
|
||||
).parsed
|
||||
|
|
@ -0,0 +1,143 @@
|
|||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.visit import Visit
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
id: str,
|
||||
) -> dict[str, Any]:
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "get",
|
||||
"url": f"/stores/visits/{id}/",
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Visit]:
|
||||
if response.status_code == 200:
|
||||
response_200 = Visit.from_dict(response.json())
|
||||
|
||||
return response_200
|
||||
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Visit]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
id: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Response[Visit]:
|
||||
"""
|
||||
Args:
|
||||
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[Visit]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
id: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Optional[Visit]:
|
||||
"""
|
||||
Args:
|
||||
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:
|
||||
Visit
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
id: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Response[Visit]:
|
||||
"""
|
||||
Args:
|
||||
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[Visit]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
id: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Optional[Visit]:
|
||||
"""
|
||||
Args:
|
||||
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:
|
||||
Visit
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
||||
|
|
@ -0,0 +1,151 @@
|
|||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.visit import Visit
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
body: Visit,
|
||||
) -> dict[str, Any]:
|
||||
headers: dict[str, Any] = {}
|
||||
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "post",
|
||||
"url": "/stores/visits/start/",
|
||||
}
|
||||
|
||||
_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[Visit]:
|
||||
if response.status_code == 200:
|
||||
response_200 = Visit.from_dict(response.json())
|
||||
|
||||
return response_200
|
||||
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Visit]:
|
||||
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: Visit,
|
||||
) -> Response[Visit]:
|
||||
"""
|
||||
Args:
|
||||
body (Visit):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[Visit]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
body=body,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: Visit,
|
||||
) -> Optional[Visit]:
|
||||
"""
|
||||
Args:
|
||||
body (Visit):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Visit
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
body=body,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: Visit,
|
||||
) -> Response[Visit]:
|
||||
"""
|
||||
Args:
|
||||
body (Visit):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[Visit]
|
||||
"""
|
||||
|
||||
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: Visit,
|
||||
) -> Optional[Visit]:
|
||||
"""
|
||||
Args:
|
||||
body (Visit):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Visit
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
client=client,
|
||||
body=body,
|
||||
)
|
||||
).parsed
|
||||
|
|
@ -0,0 +1,151 @@
|
|||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.check_in import CheckIn
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
body: CheckIn,
|
||||
) -> dict[str, Any]:
|
||||
headers: dict[str, Any] = {}
|
||||
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "post",
|
||||
"url": "/stores/zones/check_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[CheckIn]:
|
||||
if response.status_code == 200:
|
||||
response_200 = CheckIn.from_dict(response.json())
|
||||
|
||||
return response_200
|
||||
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[CheckIn]:
|
||||
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: CheckIn,
|
||||
) -> Response[CheckIn]:
|
||||
"""
|
||||
Args:
|
||||
body (CheckIn):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[CheckIn]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
body=body,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: CheckIn,
|
||||
) -> Optional[CheckIn]:
|
||||
"""
|
||||
Args:
|
||||
body (CheckIn):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
CheckIn
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
body=body,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: CheckIn,
|
||||
) -> Response[CheckIn]:
|
||||
"""
|
||||
Args:
|
||||
body (CheckIn):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[CheckIn]
|
||||
"""
|
||||
|
||||
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: CheckIn,
|
||||
) -> Optional[CheckIn]:
|
||||
"""
|
||||
Args:
|
||||
body (CheckIn):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
CheckIn
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
client=client,
|
||||
body=body,
|
||||
)
|
||||
).parsed
|
||||
|
|
@ -0,0 +1,151 @@
|
|||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.check_in import CheckIn
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
body: CheckIn,
|
||||
) -> dict[str, Any]:
|
||||
headers: dict[str, Any] = {}
|
||||
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "post",
|
||||
"url": "/stores/zones/is_checked_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[CheckIn]:
|
||||
if response.status_code == 200:
|
||||
response_200 = CheckIn.from_dict(response.json())
|
||||
|
||||
return response_200
|
||||
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[CheckIn]:
|
||||
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: CheckIn,
|
||||
) -> Response[CheckIn]:
|
||||
"""
|
||||
Args:
|
||||
body (CheckIn):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[CheckIn]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
body=body,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: CheckIn,
|
||||
) -> Optional[CheckIn]:
|
||||
"""
|
||||
Args:
|
||||
body (CheckIn):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
CheckIn
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
body=body,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: CheckIn,
|
||||
) -> Response[CheckIn]:
|
||||
"""
|
||||
Args:
|
||||
body (CheckIn):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[CheckIn]
|
||||
"""
|
||||
|
||||
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: CheckIn,
|
||||
) -> Optional[CheckIn]:
|
||||
"""
|
||||
Args:
|
||||
body (CheckIn):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
CheckIn
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
client=client,
|
||||
body=body,
|
||||
)
|
||||
).parsed
|
||||
|
|
@ -0,0 +1,230 @@
|
|||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.paginated_zone_list import PaginatedZoneList
|
||||
from ...types import UNSET, Response, Unset
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
limit: Union[Unset, int] = UNSET,
|
||||
location_dst: Union[Unset, str] = UNSET,
|
||||
location_lat: str,
|
||||
location_lon: str,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
search: Union[Unset, str] = UNSET,
|
||||
) -> dict[str, Any]:
|
||||
params: dict[str, Any] = {}
|
||||
|
||||
params["limit"] = limit
|
||||
|
||||
params["location_dst"] = location_dst
|
||||
|
||||
params["location_lat"] = location_lat
|
||||
|
||||
params["location_lon"] = location_lon
|
||||
|
||||
params["offset"] = offset
|
||||
|
||||
params["search"] = search
|
||||
|
||||
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": "/stores/zones/",
|
||||
"params": params,
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[PaginatedZoneList]:
|
||||
if response.status_code == 200:
|
||||
response_200 = PaginatedZoneList.from_dict(response.json())
|
||||
|
||||
return response_200
|
||||
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[PaginatedZoneList]:
|
||||
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, int] = UNSET,
|
||||
location_dst: Union[Unset, str] = UNSET,
|
||||
location_lat: str,
|
||||
location_lon: str,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
search: Union[Unset, str] = UNSET,
|
||||
) -> Response[PaginatedZoneList]:
|
||||
"""
|
||||
Args:
|
||||
limit (Union[Unset, int]):
|
||||
location_dst (Union[Unset, str]):
|
||||
location_lat (str):
|
||||
location_lon (str):
|
||||
offset (Union[Unset, int]):
|
||||
search (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[PaginatedZoneList]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
limit=limit,
|
||||
location_dst=location_dst,
|
||||
location_lat=location_lat,
|
||||
location_lon=location_lon,
|
||||
offset=offset,
|
||||
search=search,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
limit: Union[Unset, int] = UNSET,
|
||||
location_dst: Union[Unset, str] = UNSET,
|
||||
location_lat: str,
|
||||
location_lon: str,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
search: Union[Unset, str] = UNSET,
|
||||
) -> Optional[PaginatedZoneList]:
|
||||
"""
|
||||
Args:
|
||||
limit (Union[Unset, int]):
|
||||
location_dst (Union[Unset, str]):
|
||||
location_lat (str):
|
||||
location_lon (str):
|
||||
offset (Union[Unset, int]):
|
||||
search (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:
|
||||
PaginatedZoneList
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
limit=limit,
|
||||
location_dst=location_dst,
|
||||
location_lat=location_lat,
|
||||
location_lon=location_lon,
|
||||
offset=offset,
|
||||
search=search,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
limit: Union[Unset, int] = UNSET,
|
||||
location_dst: Union[Unset, str] = UNSET,
|
||||
location_lat: str,
|
||||
location_lon: str,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
search: Union[Unset, str] = UNSET,
|
||||
) -> Response[PaginatedZoneList]:
|
||||
"""
|
||||
Args:
|
||||
limit (Union[Unset, int]):
|
||||
location_dst (Union[Unset, str]):
|
||||
location_lat (str):
|
||||
location_lon (str):
|
||||
offset (Union[Unset, int]):
|
||||
search (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[PaginatedZoneList]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
limit=limit,
|
||||
location_dst=location_dst,
|
||||
location_lat=location_lat,
|
||||
location_lon=location_lon,
|
||||
offset=offset,
|
||||
search=search,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
limit: Union[Unset, int] = UNSET,
|
||||
location_dst: Union[Unset, str] = UNSET,
|
||||
location_lat: str,
|
||||
location_lon: str,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
search: Union[Unset, str] = UNSET,
|
||||
) -> Optional[PaginatedZoneList]:
|
||||
"""
|
||||
Args:
|
||||
limit (Union[Unset, int]):
|
||||
location_dst (Union[Unset, str]):
|
||||
location_lat (str):
|
||||
location_lon (str):
|
||||
offset (Union[Unset, int]):
|
||||
search (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:
|
||||
PaginatedZoneList
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
client=client,
|
||||
limit=limit,
|
||||
location_dst=location_dst,
|
||||
location_lat=location_lat,
|
||||
location_lon=location_lon,
|
||||
offset=offset,
|
||||
search=search,
|
||||
)
|
||||
).parsed
|
||||
|
|
@ -0,0 +1,151 @@
|
|||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.zone import Zone
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
body: Zone,
|
||||
) -> dict[str, Any]:
|
||||
headers: dict[str, Any] = {}
|
||||
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "post",
|
||||
"url": "/stores/zones/status/",
|
||||
}
|
||||
|
||||
_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[Zone]:
|
||||
if response.status_code == 200:
|
||||
response_200 = Zone.from_dict(response.json())
|
||||
|
||||
return response_200
|
||||
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Zone]:
|
||||
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: Zone,
|
||||
) -> Response[Zone]:
|
||||
"""
|
||||
Args:
|
||||
body (Zone):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[Zone]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
body=body,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: Zone,
|
||||
) -> Optional[Zone]:
|
||||
"""
|
||||
Args:
|
||||
body (Zone):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Zone
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
body=body,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: Zone,
|
||||
) -> Response[Zone]:
|
||||
"""
|
||||
Args:
|
||||
body (Zone):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[Zone]
|
||||
"""
|
||||
|
||||
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: Zone,
|
||||
) -> Optional[Zone]:
|
||||
"""
|
||||
Args:
|
||||
body (Zone):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Zone
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
client=client,
|
||||
body=body,
|
||||
)
|
||||
).parsed
|
||||
|
|
@ -0,0 +1 @@
|
|||
"""Contains endpoint functions for accessing the API"""
|
||||
|
|
@ -0,0 +1,170 @@
|
|||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.paginated_suggestion_list import PaginatedSuggestionList
|
||||
from ...types import UNSET, Response, Unset
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
limit: Union[Unset, int] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
) -> dict[str, Any]:
|
||||
params: dict[str, Any] = {}
|
||||
|
||||
params["limit"] = limit
|
||||
|
||||
params["offset"] = offset
|
||||
|
||||
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": "/suggestions/suggest/",
|
||||
"params": params,
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[PaginatedSuggestionList]:
|
||||
if response.status_code == 200:
|
||||
response_200 = PaginatedSuggestionList.from_dict(response.json())
|
||||
|
||||
return response_200
|
||||
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[PaginatedSuggestionList]:
|
||||
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, int] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
) -> Response[PaginatedSuggestionList]:
|
||||
"""
|
||||
Args:
|
||||
limit (Union[Unset, int]):
|
||||
offset (Union[Unset, int]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[PaginatedSuggestionList]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
limit=limit,
|
||||
offset=offset,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
limit: Union[Unset, int] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
) -> Optional[PaginatedSuggestionList]:
|
||||
"""
|
||||
Args:
|
||||
limit (Union[Unset, int]):
|
||||
offset (Union[Unset, int]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
PaginatedSuggestionList
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
limit=limit,
|
||||
offset=offset,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
limit: Union[Unset, int] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
) -> Response[PaginatedSuggestionList]:
|
||||
"""
|
||||
Args:
|
||||
limit (Union[Unset, int]):
|
||||
offset (Union[Unset, int]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[PaginatedSuggestionList]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
limit=limit,
|
||||
offset=offset,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
limit: Union[Unset, int] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
) -> Optional[PaginatedSuggestionList]:
|
||||
"""
|
||||
Args:
|
||||
limit (Union[Unset, int]):
|
||||
offset (Union[Unset, int]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
PaginatedSuggestionList
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
client=client,
|
||||
limit=limit,
|
||||
offset=offset,
|
||||
)
|
||||
).parsed
|
||||
|
|
@ -0,0 +1 @@
|
|||
"""Contains endpoint functions for accessing the API"""
|
||||
|
|
@ -0,0 +1,151 @@
|
|||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.ban import Ban
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
body: Ban,
|
||||
) -> dict[str, Any]:
|
||||
headers: dict[str, Any] = {}
|
||||
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "post",
|
||||
"url": "/users/users/ban/",
|
||||
}
|
||||
|
||||
_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[Ban]:
|
||||
if response.status_code == 200:
|
||||
response_200 = Ban.from_dict(response.json())
|
||||
|
||||
return response_200
|
||||
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Ban]:
|
||||
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: Ban,
|
||||
) -> Response[Ban]:
|
||||
"""
|
||||
Args:
|
||||
body (Ban):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[Ban]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
body=body,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: Ban,
|
||||
) -> Optional[Ban]:
|
||||
"""
|
||||
Args:
|
||||
body (Ban):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Ban
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
body=body,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: Ban,
|
||||
) -> Response[Ban]:
|
||||
"""
|
||||
Args:
|
||||
body (Ban):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[Ban]
|
||||
"""
|
||||
|
||||
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: Ban,
|
||||
) -> Optional[Ban]:
|
||||
"""
|
||||
Args:
|
||||
body (Ban):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Ban
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
client=client,
|
||||
body=body,
|
||||
)
|
||||
).parsed
|
||||
|
|
@ -0,0 +1,119 @@
|
|||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.ban import Ban
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs() -> dict[str, Any]:
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "get",
|
||||
"url": "/users/users/ban/",
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Ban]:
|
||||
if response.status_code == 200:
|
||||
response_200 = Ban.from_dict(response.json())
|
||||
|
||||
return response_200
|
||||
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Ban]:
|
||||
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[Ban]:
|
||||
"""
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[Ban]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs()
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Optional[Ban]:
|
||||
"""
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Ban
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Response[Ban]:
|
||||
"""
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server 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[Ban]
|
||||
"""
|
||||
|
||||
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[Ban]:
|
||||
"""
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Ban
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
||||
268
utils/clients/gooyal_advertising_client/client.py
Normal file
268
utils/clients/gooyal_advertising_client/client.py
Normal file
|
|
@ -0,0 +1,268 @@
|
|||
import ssl
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
import httpx
|
||||
from attrs import define, evolve, field
|
||||
|
||||
|
||||
@define
|
||||
class Client:
|
||||
"""A class for keeping track of data related to the API
|
||||
|
||||
The following are accepted as keyword arguments and will be used to construct httpx Clients internally:
|
||||
|
||||
``base_url``: The base URL for the API, all requests are made to a relative path to this URL
|
||||
|
||||
``cookies``: A dictionary of cookies to be sent with every request
|
||||
|
||||
``headers``: A dictionary of headers to be sent with every request
|
||||
|
||||
``timeout``: The maximum amount of a time a request can take. API functions will raise
|
||||
httpx.TimeoutException if this is exceeded.
|
||||
|
||||
``verify_ssl``: Whether or not to verify the SSL certificate of the API server. This should be True in production,
|
||||
but can be set to False for testing purposes.
|
||||
|
||||
``follow_redirects``: Whether or not to follow redirects. Default value is False.
|
||||
|
||||
``httpx_args``: A dictionary of additional arguments to be passed to the ``httpx.Client`` and ``httpx.AsyncClient`` constructor.
|
||||
|
||||
|
||||
Attributes:
|
||||
raise_on_unexpected_status: Whether or not to raise an errors.UnexpectedStatus if the API returns a
|
||||
status code that was not documented in the source OpenAPI document. Can also be provided as a keyword
|
||||
argument to the constructor.
|
||||
"""
|
||||
|
||||
raise_on_unexpected_status: bool = field(default=False, kw_only=True)
|
||||
_base_url: str = field(alias="base_url")
|
||||
_cookies: dict[str, str] = field(factory=dict, kw_only=True, alias="cookies")
|
||||
_headers: dict[str, str] = field(factory=dict, kw_only=True, alias="headers")
|
||||
_timeout: 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)
|
||||
16
utils/clients/gooyal_advertising_client/errors.py
Normal file
16
utils/clients/gooyal_advertising_client/errors.py
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
"""Contains shared errors types that can be raised from API functions"""
|
||||
|
||||
|
||||
class UnexpectedStatus(Exception):
|
||||
"""Raised by api functions when the response status an undocumented status and Client.raise_on_unexpected_status is True"""
|
||||
|
||||
def __init__(self, status_code: int, content: bytes):
|
||||
self.status_code = status_code
|
||||
self.content = content
|
||||
|
||||
super().__init__(
|
||||
f"Unexpected status code: {status_code}\n\nResponse content:\n{content.decode(errors='ignore')}"
|
||||
)
|
||||
|
||||
|
||||
__all__ = ["UnexpectedStatus"]
|
||||
203
utils/clients/gooyal_advertising_client/models/__init__.py
Normal file
203
utils/clients/gooyal_advertising_client/models/__init__.py
Normal file
|
|
@ -0,0 +1,203 @@
|
|||
"""Contains all the data models used in inputs/outputs"""
|
||||
|
||||
from .access_model_enum import AccessModelEnum
|
||||
from .ad import Ad
|
||||
from .ad_content import AdContent
|
||||
from .ad_create import AdCreate
|
||||
from .ad_create_location_type_0 import AdCreateLocationType0
|
||||
from .ad_create_location_type_0_type import AdCreateLocationType0Type
|
||||
from .ad_create_new_location import AdCreateNewLocation
|
||||
from .ad_create_new_location_type import AdCreateNewLocationType
|
||||
from .ad_create_type_enum import AdCreateTypeEnum
|
||||
from .ad_location_type_0 import AdLocationType0
|
||||
from .ad_location_type_0_type import AdLocationType0Type
|
||||
from .ad_owner import AdOwner
|
||||
from .ad_owner_location_type_0 import AdOwnerLocationType0
|
||||
from .ad_owner_location_type_0_type import AdOwnerLocationType0Type
|
||||
from .ad_owner_new_location_type_0 import AdOwnerNewLocationType0
|
||||
from .ad_owner_new_location_type_0_type import AdOwnerNewLocationType0Type
|
||||
from .ad_public import AdPublic
|
||||
from .ad_public_location_type_0 import AdPublicLocationType0
|
||||
from .ad_public_location_type_0_type import AdPublicLocationType0Type
|
||||
from .ad_report import AdReport
|
||||
from .ad_statistic import AdStatistic
|
||||
from .ad_visit_statistic import AdVisitStatistic
|
||||
from .ad_with_visit import AdWithVisit
|
||||
from .ad_with_visit_location_type_0 import AdWithVisitLocationType0
|
||||
from .ad_with_visit_location_type_0_type import AdWithVisitLocationType0Type
|
||||
from .attendance_type_enum import AttendanceTypeEnum
|
||||
from .ban import Ban
|
||||
from .ban_level_enum import BanLevelEnum
|
||||
from .capture import Capture
|
||||
from .capture_location_type_0 import CaptureLocationType0
|
||||
from .capture_location_type_0_type import CaptureLocationType0Type
|
||||
from .category_enum import CategoryEnum
|
||||
from .check_in import CheckIn
|
||||
from .check_in_location_type_0 import CheckInLocationType0
|
||||
from .check_in_location_type_0_type import CheckInLocationType0Type
|
||||
from .cluster import Cluster
|
||||
from .comment import Comment
|
||||
from .comment_create import CommentCreate
|
||||
from .config import Config
|
||||
from .content_type_enum import ContentTypeEnum
|
||||
from .new_content_type_enum import NewContentTypeEnum
|
||||
from .paginated_ad_content_list import PaginatedAdContentList
|
||||
from .paginated_ad_list import PaginatedAdList
|
||||
from .paginated_ad_owner_list import PaginatedAdOwnerList
|
||||
from .paginated_ad_public_list import PaginatedAdPublicList
|
||||
from .paginated_ad_with_visit_list import PaginatedAdWithVisitList
|
||||
from .paginated_comment_list import PaginatedCommentList
|
||||
from .paginated_config_list import PaginatedConfigList
|
||||
from .paginated_refined_ad_content_list import PaginatedRefinedAdContentList
|
||||
from .paginated_suggestion_list import PaginatedSuggestionList
|
||||
from .paginated_tag_list import PaginatedTagList
|
||||
from .paginated_ticket_list import PaginatedTicketList
|
||||
from .paginated_visit_list import PaginatedVisitList
|
||||
from .paginated_zone_list import PaginatedZoneList
|
||||
from .patched_ad_owner import PatchedAdOwner
|
||||
from .patched_ad_owner_location_type_0 import PatchedAdOwnerLocationType0
|
||||
from .patched_ad_owner_location_type_0_type import PatchedAdOwnerLocationType0Type
|
||||
from .patched_ad_owner_new_location_type_0 import PatchedAdOwnerNewLocationType0
|
||||
from .patched_ad_owner_new_location_type_0_type import PatchedAdOwnerNewLocationType0Type
|
||||
from .patched_ticket import PatchedTicket
|
||||
from .payment_state_enum import PaymentStateEnum
|
||||
from .price_model_enum import PriceModelEnum
|
||||
from .product_condition_enum import ProductConditionEnum
|
||||
from .reaction_toggle import ReactionToggle
|
||||
from .refined_ad_banner import RefinedAdBanner
|
||||
from .refined_ad_content import RefinedAdContent
|
||||
from .rejection_reason_enum import RejectionReasonEnum
|
||||
from .report_category_enum import ReportCategoryEnum
|
||||
from .role_enum import RoleEnum
|
||||
from .sign_content import SignContent
|
||||
from .state_634_enum import State634Enum
|
||||
from .statistic import Statistic
|
||||
from .stores_ads_bookmarked_list_ordering_item import StoresAdsBookmarkedListOrderingItem
|
||||
from .stores_ads_clusterized_list_ordering_item import StoresAdsClusterizedListOrderingItem
|
||||
from .stores_ads_list_ordering_item import StoresAdsListOrderingItem
|
||||
from .stores_ads_public_clusterized_list_ordering_item import StoresAdsPublicClusterizedListOrderingItem
|
||||
from .stores_ads_public_list_list_ordering_item import StoresAdsPublicListListOrderingItem
|
||||
from .stores_ads_visited_list_ordering_item import StoresAdsVisitedListOrderingItem
|
||||
from .stores_ads_with_visits_list_ordering_item import StoresAdsWithVisitsListOrderingItem
|
||||
from .stores_statistic_retrieve_accept_language import StoresStatisticRetrieveAcceptLanguage
|
||||
from .suggestion import Suggestion
|
||||
from .tag import Tag
|
||||
from .ticket import Ticket
|
||||
from .ticket_state_enum import TicketStateEnum
|
||||
from .transportation_cost_enum import TransportationCostEnum
|
||||
from .type_0d9_enum import Type0D9Enum
|
||||
from .value_type_enum import ValueTypeEnum
|
||||
from .visit import Visit
|
||||
from .visit_interaction import VisitInteraction
|
||||
from .visit_interaction_type_enum import VisitInteractionTypeEnum
|
||||
from .visit_location_type_0 import VisitLocationType0
|
||||
from .visit_location_type_0_type import VisitLocationType0Type
|
||||
from .visit_reaction import VisitReaction
|
||||
from .visit_state_enum import VisitStateEnum
|
||||
from .zone import Zone
|
||||
from .zone_area_type_0 import ZoneAreaType0
|
||||
from .zone_area_type_0_type import ZoneAreaType0Type
|
||||
from .zone_state_enum import ZoneStateEnum
|
||||
from .zone_type_enum import ZoneTypeEnum
|
||||
|
||||
__all__ = (
|
||||
"AccessModelEnum",
|
||||
"Ad",
|
||||
"AdContent",
|
||||
"AdCreate",
|
||||
"AdCreateLocationType0",
|
||||
"AdCreateLocationType0Type",
|
||||
"AdCreateNewLocation",
|
||||
"AdCreateNewLocationType",
|
||||
"AdCreateTypeEnum",
|
||||
"AdLocationType0",
|
||||
"AdLocationType0Type",
|
||||
"AdOwner",
|
||||
"AdOwnerLocationType0",
|
||||
"AdOwnerLocationType0Type",
|
||||
"AdOwnerNewLocationType0",
|
||||
"AdOwnerNewLocationType0Type",
|
||||
"AdPublic",
|
||||
"AdPublicLocationType0",
|
||||
"AdPublicLocationType0Type",
|
||||
"AdReport",
|
||||
"AdStatistic",
|
||||
"AdVisitStatistic",
|
||||
"AdWithVisit",
|
||||
"AdWithVisitLocationType0",
|
||||
"AdWithVisitLocationType0Type",
|
||||
"AttendanceTypeEnum",
|
||||
"Ban",
|
||||
"BanLevelEnum",
|
||||
"Capture",
|
||||
"CaptureLocationType0",
|
||||
"CaptureLocationType0Type",
|
||||
"CategoryEnum",
|
||||
"CheckIn",
|
||||
"CheckInLocationType0",
|
||||
"CheckInLocationType0Type",
|
||||
"Cluster",
|
||||
"Comment",
|
||||
"CommentCreate",
|
||||
"Config",
|
||||
"ContentTypeEnum",
|
||||
"NewContentTypeEnum",
|
||||
"PaginatedAdContentList",
|
||||
"PaginatedAdList",
|
||||
"PaginatedAdOwnerList",
|
||||
"PaginatedAdPublicList",
|
||||
"PaginatedAdWithVisitList",
|
||||
"PaginatedCommentList",
|
||||
"PaginatedConfigList",
|
||||
"PaginatedRefinedAdContentList",
|
||||
"PaginatedSuggestionList",
|
||||
"PaginatedTagList",
|
||||
"PaginatedTicketList",
|
||||
"PaginatedVisitList",
|
||||
"PaginatedZoneList",
|
||||
"PatchedAdOwner",
|
||||
"PatchedAdOwnerLocationType0",
|
||||
"PatchedAdOwnerLocationType0Type",
|
||||
"PatchedAdOwnerNewLocationType0",
|
||||
"PatchedAdOwnerNewLocationType0Type",
|
||||
"PatchedTicket",
|
||||
"PaymentStateEnum",
|
||||
"PriceModelEnum",
|
||||
"ProductConditionEnum",
|
||||
"ReactionToggle",
|
||||
"RefinedAdBanner",
|
||||
"RefinedAdContent",
|
||||
"RejectionReasonEnum",
|
||||
"ReportCategoryEnum",
|
||||
"RoleEnum",
|
||||
"SignContent",
|
||||
"State634Enum",
|
||||
"Statistic",
|
||||
"StoresAdsBookmarkedListOrderingItem",
|
||||
"StoresAdsClusterizedListOrderingItem",
|
||||
"StoresAdsListOrderingItem",
|
||||
"StoresAdsPublicClusterizedListOrderingItem",
|
||||
"StoresAdsPublicListListOrderingItem",
|
||||
"StoresAdsVisitedListOrderingItem",
|
||||
"StoresAdsWithVisitsListOrderingItem",
|
||||
"StoresStatisticRetrieveAcceptLanguage",
|
||||
"Suggestion",
|
||||
"Tag",
|
||||
"Ticket",
|
||||
"TicketStateEnum",
|
||||
"TransportationCostEnum",
|
||||
"Type0D9Enum",
|
||||
"ValueTypeEnum",
|
||||
"Visit",
|
||||
"VisitInteraction",
|
||||
"VisitInteractionTypeEnum",
|
||||
"VisitLocationType0",
|
||||
"VisitLocationType0Type",
|
||||
"VisitReaction",
|
||||
"VisitStateEnum",
|
||||
"Zone",
|
||||
"ZoneAreaType0",
|
||||
"ZoneAreaType0Type",
|
||||
"ZoneStateEnum",
|
||||
"ZoneTypeEnum",
|
||||
)
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
from enum import IntEnum
|
||||
|
||||
|
||||
class AccessModelEnum(IntEnum):
|
||||
VALUE_1 = 1
|
||||
VALUE_2 = 2
|
||||
VALUE_3 = 3
|
||||
VALUE_4 = 4
|
||||
|
||||
def __str__(self) -> str:
|
||||
return str(self.value)
|
||||
337
utils/clients/gooyal_advertising_client/models/ad.py
Normal file
337
utils/clients/gooyal_advertising_client/models/ad.py
Normal file
|
|
@ -0,0 +1,337 @@
|
|||
import datetime
|
||||
from collections.abc import Mapping
|
||||
from typing import TYPE_CHECKING, Any, TypeVar, Union, cast
|
||||
from uuid import UUID
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
from dateutil.parser import isoparse
|
||||
|
||||
from .type_0d9_enum import Type0D9Enum
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from .ad_content import AdContent
|
||||
from .ad_location_type_0 import AdLocationType0
|
||||
from .refined_ad_banner import RefinedAdBanner
|
||||
from .refined_ad_content import RefinedAdContent
|
||||
|
||||
|
||||
T = TypeVar("T", bound="Ad")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class Ad:
|
||||
"""
|
||||
Attributes:
|
||||
uuid (UUID):
|
||||
title (Union[None, str]):
|
||||
type_ (Type0D9Enum): * `1` - BILLBOARD
|
||||
* `2` - CAPTURED_BILLBOARD
|
||||
* `99` - PROMOTION
|
||||
* `100` - CONSTANT
|
||||
details (Any):
|
||||
content (str):
|
||||
contents (list['AdContent']):
|
||||
refined_contents (list['RefinedAdContent']):
|
||||
description (Union[None, str]):
|
||||
location (Union['AdLocationType0', None]):
|
||||
location_is_approximate (bool):
|
||||
banner (Union[None, str]):
|
||||
reward_amount (int):
|
||||
reward_count (int):
|
||||
address (Union[None, str]):
|
||||
url (Union[None, str]):
|
||||
tags (list[str]):
|
||||
created_at (datetime.datetime):
|
||||
updated_at (datetime.datetime):
|
||||
display_time (str):
|
||||
status (str):
|
||||
user_uuid (UUID):
|
||||
comments_count (str):
|
||||
likes_count (str):
|
||||
refined_banner (Union[Unset, RefinedAdBanner]):
|
||||
"""
|
||||
|
||||
uuid: UUID
|
||||
title: Union[None, str]
|
||||
type_: Type0D9Enum
|
||||
details: Any
|
||||
content: str
|
||||
contents: list["AdContent"]
|
||||
refined_contents: list["RefinedAdContent"]
|
||||
description: Union[None, str]
|
||||
location: Union["AdLocationType0", None]
|
||||
location_is_approximate: bool
|
||||
banner: Union[None, str]
|
||||
reward_amount: int
|
||||
reward_count: int
|
||||
address: Union[None, str]
|
||||
url: Union[None, str]
|
||||
tags: list[str]
|
||||
created_at: datetime.datetime
|
||||
updated_at: datetime.datetime
|
||||
display_time: str
|
||||
status: str
|
||||
user_uuid: UUID
|
||||
comments_count: str
|
||||
likes_count: str
|
||||
refined_banner: Union[Unset, "RefinedAdBanner"] = UNSET
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
from .ad_location_type_0 import AdLocationType0
|
||||
|
||||
uuid = str(self.uuid)
|
||||
|
||||
title: Union[None, str]
|
||||
title = self.title
|
||||
|
||||
type_ = self.type_.value
|
||||
|
||||
details = self.details
|
||||
|
||||
content = self.content
|
||||
|
||||
contents = []
|
||||
for contents_item_data in self.contents:
|
||||
contents_item = contents_item_data.to_dict()
|
||||
contents.append(contents_item)
|
||||
|
||||
refined_contents = []
|
||||
for refined_contents_item_data in self.refined_contents:
|
||||
refined_contents_item = refined_contents_item_data.to_dict()
|
||||
refined_contents.append(refined_contents_item)
|
||||
|
||||
description: Union[None, str]
|
||||
description = self.description
|
||||
|
||||
location: Union[None, dict[str, Any]]
|
||||
if isinstance(self.location, AdLocationType0):
|
||||
location = self.location.to_dict()
|
||||
else:
|
||||
location = self.location
|
||||
|
||||
location_is_approximate = self.location_is_approximate
|
||||
|
||||
banner: Union[None, str]
|
||||
banner = self.banner
|
||||
|
||||
reward_amount = self.reward_amount
|
||||
|
||||
reward_count = self.reward_count
|
||||
|
||||
address: Union[None, str]
|
||||
address = self.address
|
||||
|
||||
url: Union[None, str]
|
||||
url = self.url
|
||||
|
||||
tags = self.tags
|
||||
|
||||
created_at = self.created_at.isoformat()
|
||||
|
||||
updated_at = self.updated_at.isoformat()
|
||||
|
||||
display_time = self.display_time
|
||||
|
||||
status = self.status
|
||||
|
||||
user_uuid = str(self.user_uuid)
|
||||
|
||||
comments_count = self.comments_count
|
||||
|
||||
likes_count = self.likes_count
|
||||
|
||||
refined_banner: Union[Unset, dict[str, Any]] = UNSET
|
||||
if not isinstance(self.refined_banner, Unset):
|
||||
refined_banner = self.refined_banner.to_dict()
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update(
|
||||
{
|
||||
"uuid": uuid,
|
||||
"title": title,
|
||||
"type": type_,
|
||||
"details": details,
|
||||
"content": content,
|
||||
"contents": contents,
|
||||
"refined_contents": refined_contents,
|
||||
"description": description,
|
||||
"location": location,
|
||||
"location_is_approximate": location_is_approximate,
|
||||
"banner": banner,
|
||||
"reward_amount": reward_amount,
|
||||
"reward_count": reward_count,
|
||||
"address": address,
|
||||
"url": url,
|
||||
"tags": tags,
|
||||
"created_at": created_at,
|
||||
"updated_at": updated_at,
|
||||
"display_time": display_time,
|
||||
"status": status,
|
||||
"user_uuid": user_uuid,
|
||||
"comments_count": comments_count,
|
||||
"likes_count": likes_count,
|
||||
}
|
||||
)
|
||||
if refined_banner is not UNSET:
|
||||
field_dict["refined_banner"] = refined_banner
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
from .ad_content import AdContent
|
||||
from .ad_location_type_0 import AdLocationType0
|
||||
from .refined_ad_banner import RefinedAdBanner
|
||||
from .refined_ad_content import RefinedAdContent
|
||||
|
||||
d = dict(src_dict)
|
||||
uuid = UUID(d.pop("uuid"))
|
||||
|
||||
def _parse_title(data: object) -> Union[None, str]:
|
||||
if data is None:
|
||||
return data
|
||||
return cast(Union[None, str], data)
|
||||
|
||||
title = _parse_title(d.pop("title"))
|
||||
|
||||
type_ = Type0D9Enum(d.pop("type"))
|
||||
|
||||
details = d.pop("details")
|
||||
|
||||
content = d.pop("content")
|
||||
|
||||
contents = []
|
||||
_contents = d.pop("contents")
|
||||
for contents_item_data in _contents:
|
||||
contents_item = AdContent.from_dict(contents_item_data)
|
||||
|
||||
contents.append(contents_item)
|
||||
|
||||
refined_contents = []
|
||||
_refined_contents = d.pop("refined_contents")
|
||||
for refined_contents_item_data in _refined_contents:
|
||||
refined_contents_item = RefinedAdContent.from_dict(refined_contents_item_data)
|
||||
|
||||
refined_contents.append(refined_contents_item)
|
||||
|
||||
def _parse_description(data: object) -> Union[None, str]:
|
||||
if data is None:
|
||||
return data
|
||||
return cast(Union[None, str], data)
|
||||
|
||||
description = _parse_description(d.pop("description"))
|
||||
|
||||
def _parse_location(data: object) -> Union["AdLocationType0", None]:
|
||||
if data is None:
|
||||
return data
|
||||
try:
|
||||
if not isinstance(data, dict):
|
||||
raise TypeError()
|
||||
location_type_0 = AdLocationType0.from_dict(data)
|
||||
|
||||
return location_type_0
|
||||
except: # noqa: E722
|
||||
pass
|
||||
return cast(Union["AdLocationType0", None], data)
|
||||
|
||||
location = _parse_location(d.pop("location"))
|
||||
|
||||
location_is_approximate = d.pop("location_is_approximate")
|
||||
|
||||
def _parse_banner(data: object) -> Union[None, str]:
|
||||
if data is None:
|
||||
return data
|
||||
return cast(Union[None, str], data)
|
||||
|
||||
banner = _parse_banner(d.pop("banner"))
|
||||
|
||||
reward_amount = d.pop("reward_amount")
|
||||
|
||||
reward_count = d.pop("reward_count")
|
||||
|
||||
def _parse_address(data: object) -> Union[None, str]:
|
||||
if data is None:
|
||||
return data
|
||||
return cast(Union[None, str], data)
|
||||
|
||||
address = _parse_address(d.pop("address"))
|
||||
|
||||
def _parse_url(data: object) -> Union[None, str]:
|
||||
if data is None:
|
||||
return data
|
||||
return cast(Union[None, str], data)
|
||||
|
||||
url = _parse_url(d.pop("url"))
|
||||
|
||||
tags = cast(list[str], d.pop("tags"))
|
||||
|
||||
created_at = isoparse(d.pop("created_at"))
|
||||
|
||||
updated_at = isoparse(d.pop("updated_at"))
|
||||
|
||||
display_time = d.pop("display_time")
|
||||
|
||||
status = d.pop("status")
|
||||
|
||||
user_uuid = UUID(d.pop("user_uuid"))
|
||||
|
||||
comments_count = d.pop("comments_count")
|
||||
|
||||
likes_count = d.pop("likes_count")
|
||||
|
||||
_refined_banner = d.pop("refined_banner", UNSET)
|
||||
refined_banner: Union[Unset, RefinedAdBanner]
|
||||
if isinstance(_refined_banner, Unset):
|
||||
refined_banner = UNSET
|
||||
else:
|
||||
refined_banner = RefinedAdBanner.from_dict(_refined_banner)
|
||||
|
||||
ad = cls(
|
||||
uuid=uuid,
|
||||
title=title,
|
||||
type_=type_,
|
||||
details=details,
|
||||
content=content,
|
||||
contents=contents,
|
||||
refined_contents=refined_contents,
|
||||
description=description,
|
||||
location=location,
|
||||
location_is_approximate=location_is_approximate,
|
||||
banner=banner,
|
||||
reward_amount=reward_amount,
|
||||
reward_count=reward_count,
|
||||
address=address,
|
||||
url=url,
|
||||
tags=tags,
|
||||
created_at=created_at,
|
||||
updated_at=updated_at,
|
||||
display_time=display_time,
|
||||
status=status,
|
||||
user_uuid=user_uuid,
|
||||
comments_count=comments_count,
|
||||
likes_count=likes_count,
|
||||
refined_banner=refined_banner,
|
||||
)
|
||||
|
||||
ad.additional_properties = d
|
||||
return ad
|
||||
|
||||
@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
|
||||
138
utils/clients/gooyal_advertising_client/models/ad_content.py
Normal file
138
utils/clients/gooyal_advertising_client/models/ad_content.py
Normal file
|
|
@ -0,0 +1,138 @@
|
|||
from collections.abc import Mapping
|
||||
from typing import Any, TypeVar, Union, cast
|
||||
from uuid import UUID
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
from .content_type_enum import ContentTypeEnum
|
||||
from .state_634_enum import State634Enum
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
T = TypeVar("T", bound="AdContent")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class AdContent:
|
||||
"""
|
||||
Attributes:
|
||||
uuid (UUID):
|
||||
file (Union[None, Unset, str]):
|
||||
content_type (Union[Unset, ContentTypeEnum]): * `1` - image
|
||||
* `2` - voice
|
||||
* `3` - video
|
||||
* `4` - document
|
||||
order (Union[Unset, int]):
|
||||
state (Union[Unset, State634Enum]): * `0` - draft
|
||||
* `1` - ready_for_check
|
||||
* `2` - Checking
|
||||
* `9` - Rejected
|
||||
* `10` - Modified
|
||||
* `11` - modification_checking
|
||||
* `12` - modification_rejected
|
||||
* `18` - stoped
|
||||
* `19` - unpublished
|
||||
* `20` - published
|
||||
* `100` - deleted
|
||||
"""
|
||||
|
||||
uuid: UUID
|
||||
file: Union[None, Unset, str] = UNSET
|
||||
content_type: Union[Unset, ContentTypeEnum] = UNSET
|
||||
order: Union[Unset, int] = UNSET
|
||||
state: Union[Unset, State634Enum] = UNSET
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
uuid = str(self.uuid)
|
||||
|
||||
file: Union[None, Unset, str]
|
||||
if isinstance(self.file, Unset):
|
||||
file = UNSET
|
||||
else:
|
||||
file = self.file
|
||||
|
||||
content_type: Union[Unset, int] = UNSET
|
||||
if not isinstance(self.content_type, Unset):
|
||||
content_type = self.content_type.value
|
||||
|
||||
order = self.order
|
||||
|
||||
state: Union[Unset, int] = UNSET
|
||||
if not isinstance(self.state, Unset):
|
||||
state = self.state.value
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update(
|
||||
{
|
||||
"uuid": uuid,
|
||||
}
|
||||
)
|
||||
if file is not UNSET:
|
||||
field_dict["file"] = file
|
||||
if content_type is not UNSET:
|
||||
field_dict["content_type"] = content_type
|
||||
if order is not UNSET:
|
||||
field_dict["order"] = order
|
||||
if state is not UNSET:
|
||||
field_dict["state"] = state
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
d = dict(src_dict)
|
||||
uuid = UUID(d.pop("uuid"))
|
||||
|
||||
def _parse_file(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
file = _parse_file(d.pop("file", UNSET))
|
||||
|
||||
_content_type = d.pop("content_type", UNSET)
|
||||
content_type: Union[Unset, ContentTypeEnum]
|
||||
if isinstance(_content_type, Unset):
|
||||
content_type = UNSET
|
||||
else:
|
||||
content_type = ContentTypeEnum(_content_type)
|
||||
|
||||
order = d.pop("order", UNSET)
|
||||
|
||||
_state = d.pop("state", UNSET)
|
||||
state: Union[Unset, State634Enum]
|
||||
if isinstance(_state, Unset):
|
||||
state = UNSET
|
||||
else:
|
||||
state = State634Enum(_state)
|
||||
|
||||
ad_content = cls(
|
||||
uuid=uuid,
|
||||
file=file,
|
||||
content_type=content_type,
|
||||
order=order,
|
||||
state=state,
|
||||
)
|
||||
|
||||
ad_content.additional_properties = d
|
||||
return ad_content
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
1007
utils/clients/gooyal_advertising_client/models/ad_create.py
Normal file
1007
utils/clients/gooyal_advertising_client/models/ad_create.py
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,78 @@
|
|||
from collections.abc import Mapping
|
||||
from typing import Any, TypeVar, Union, cast
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
from .ad_create_location_type_0_type import AdCreateLocationType0Type
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
T = TypeVar("T", bound="AdCreateLocationType0")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class AdCreateLocationType0:
|
||||
"""
|
||||
Attributes:
|
||||
type_ (Union[Unset, AdCreateLocationType0Type]):
|
||||
coordinates (Union[Unset, list[float]]): Example: [12.9721, 77.5933].
|
||||
"""
|
||||
|
||||
type_: Union[Unset, AdCreateLocationType0Type] = UNSET
|
||||
coordinates: Union[Unset, list[float]] = UNSET
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
type_: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.type_, Unset):
|
||||
type_ = self.type_.value
|
||||
|
||||
coordinates: Union[Unset, list[float]] = UNSET
|
||||
if not isinstance(self.coordinates, Unset):
|
||||
coordinates = self.coordinates
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update({})
|
||||
if type_ is not UNSET:
|
||||
field_dict["type"] = type_
|
||||
if coordinates is not UNSET:
|
||||
field_dict["coordinates"] = coordinates
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
d = dict(src_dict)
|
||||
_type_ = d.pop("type", UNSET)
|
||||
type_: Union[Unset, AdCreateLocationType0Type]
|
||||
if isinstance(_type_, Unset):
|
||||
type_ = UNSET
|
||||
else:
|
||||
type_ = AdCreateLocationType0Type(_type_)
|
||||
|
||||
coordinates = cast(list[float], d.pop("coordinates", UNSET))
|
||||
|
||||
ad_create_location_type_0 = cls(
|
||||
type_=type_,
|
||||
coordinates=coordinates,
|
||||
)
|
||||
|
||||
ad_create_location_type_0.additional_properties = d
|
||||
return ad_create_location_type_0
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
from enum import Enum
|
||||
|
||||
|
||||
class AdCreateLocationType0Type(str, Enum):
|
||||
POINT = "Point"
|
||||
|
||||
def __str__(self) -> str:
|
||||
return str(self.value)
|
||||
|
|
@ -0,0 +1,78 @@
|
|||
from collections.abc import Mapping
|
||||
from typing import Any, TypeVar, Union, cast
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
from .ad_create_new_location_type import AdCreateNewLocationType
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
T = TypeVar("T", bound="AdCreateNewLocation")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class AdCreateNewLocation:
|
||||
"""
|
||||
Attributes:
|
||||
type_ (Union[Unset, AdCreateNewLocationType]):
|
||||
coordinates (Union[Unset, list[float]]): Example: [12.9721, 77.5933].
|
||||
"""
|
||||
|
||||
type_: Union[Unset, AdCreateNewLocationType] = UNSET
|
||||
coordinates: Union[Unset, list[float]] = UNSET
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
type_: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.type_, Unset):
|
||||
type_ = self.type_.value
|
||||
|
||||
coordinates: Union[Unset, list[float]] = UNSET
|
||||
if not isinstance(self.coordinates, Unset):
|
||||
coordinates = self.coordinates
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update({})
|
||||
if type_ is not UNSET:
|
||||
field_dict["type"] = type_
|
||||
if coordinates is not UNSET:
|
||||
field_dict["coordinates"] = coordinates
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
d = dict(src_dict)
|
||||
_type_ = d.pop("type", UNSET)
|
||||
type_: Union[Unset, AdCreateNewLocationType]
|
||||
if isinstance(_type_, Unset):
|
||||
type_ = UNSET
|
||||
else:
|
||||
type_ = AdCreateNewLocationType(_type_)
|
||||
|
||||
coordinates = cast(list[float], d.pop("coordinates", UNSET))
|
||||
|
||||
ad_create_new_location = cls(
|
||||
type_=type_,
|
||||
coordinates=coordinates,
|
||||
)
|
||||
|
||||
ad_create_new_location.additional_properties = d
|
||||
return ad_create_new_location
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
from enum import Enum
|
||||
|
||||
|
||||
class AdCreateNewLocationType(str, Enum):
|
||||
POINT = "Point"
|
||||
|
||||
def __str__(self) -> str:
|
||||
return str(self.value)
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
from enum import Enum
|
||||
|
||||
|
||||
class AdCreateTypeEnum(str, Enum):
|
||||
BILLBOARD = "BILLBOARD"
|
||||
CONSTANT = "CONSTANT"
|
||||
VALUE_0 = "1"
|
||||
VALUE_2 = "100"
|
||||
|
||||
def __str__(self) -> str:
|
||||
return str(self.value)
|
||||
|
|
@ -0,0 +1,78 @@
|
|||
from collections.abc import Mapping
|
||||
from typing import Any, TypeVar, Union, cast
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
from .ad_location_type_0_type import AdLocationType0Type
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
T = TypeVar("T", bound="AdLocationType0")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class AdLocationType0:
|
||||
"""
|
||||
Attributes:
|
||||
type_ (Union[Unset, AdLocationType0Type]):
|
||||
coordinates (Union[Unset, list[float]]): Example: [12.9721, 77.5933].
|
||||
"""
|
||||
|
||||
type_: Union[Unset, AdLocationType0Type] = UNSET
|
||||
coordinates: Union[Unset, list[float]] = UNSET
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
type_: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.type_, Unset):
|
||||
type_ = self.type_.value
|
||||
|
||||
coordinates: Union[Unset, list[float]] = UNSET
|
||||
if not isinstance(self.coordinates, Unset):
|
||||
coordinates = self.coordinates
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update({})
|
||||
if type_ is not UNSET:
|
||||
field_dict["type"] = type_
|
||||
if coordinates is not UNSET:
|
||||
field_dict["coordinates"] = coordinates
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
d = dict(src_dict)
|
||||
_type_ = d.pop("type", UNSET)
|
||||
type_: Union[Unset, AdLocationType0Type]
|
||||
if isinstance(_type_, Unset):
|
||||
type_ = UNSET
|
||||
else:
|
||||
type_ = AdLocationType0Type(_type_)
|
||||
|
||||
coordinates = cast(list[float], d.pop("coordinates", UNSET))
|
||||
|
||||
ad_location_type_0 = cls(
|
||||
type_=type_,
|
||||
coordinates=coordinates,
|
||||
)
|
||||
|
||||
ad_location_type_0.additional_properties = d
|
||||
return ad_location_type_0
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
from enum import Enum
|
||||
|
||||
|
||||
class AdLocationType0Type(str, Enum):
|
||||
POINT = "Point"
|
||||
|
||||
def __str__(self) -> str:
|
||||
return str(self.value)
|
||||
1022
utils/clients/gooyal_advertising_client/models/ad_owner.py
Normal file
1022
utils/clients/gooyal_advertising_client/models/ad_owner.py
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,78 @@
|
|||
from collections.abc import Mapping
|
||||
from typing import Any, TypeVar, Union, cast
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
from .ad_owner_location_type_0_type import AdOwnerLocationType0Type
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
T = TypeVar("T", bound="AdOwnerLocationType0")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class AdOwnerLocationType0:
|
||||
"""
|
||||
Attributes:
|
||||
type_ (Union[Unset, AdOwnerLocationType0Type]):
|
||||
coordinates (Union[Unset, list[float]]): Example: [12.9721, 77.5933].
|
||||
"""
|
||||
|
||||
type_: Union[Unset, AdOwnerLocationType0Type] = UNSET
|
||||
coordinates: Union[Unset, list[float]] = UNSET
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
type_: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.type_, Unset):
|
||||
type_ = self.type_.value
|
||||
|
||||
coordinates: Union[Unset, list[float]] = UNSET
|
||||
if not isinstance(self.coordinates, Unset):
|
||||
coordinates = self.coordinates
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update({})
|
||||
if type_ is not UNSET:
|
||||
field_dict["type"] = type_
|
||||
if coordinates is not UNSET:
|
||||
field_dict["coordinates"] = coordinates
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
d = dict(src_dict)
|
||||
_type_ = d.pop("type", UNSET)
|
||||
type_: Union[Unset, AdOwnerLocationType0Type]
|
||||
if isinstance(_type_, Unset):
|
||||
type_ = UNSET
|
||||
else:
|
||||
type_ = AdOwnerLocationType0Type(_type_)
|
||||
|
||||
coordinates = cast(list[float], d.pop("coordinates", UNSET))
|
||||
|
||||
ad_owner_location_type_0 = cls(
|
||||
type_=type_,
|
||||
coordinates=coordinates,
|
||||
)
|
||||
|
||||
ad_owner_location_type_0.additional_properties = d
|
||||
return ad_owner_location_type_0
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
from enum import Enum
|
||||
|
||||
|
||||
class AdOwnerLocationType0Type(str, Enum):
|
||||
POINT = "Point"
|
||||
|
||||
def __str__(self) -> str:
|
||||
return str(self.value)
|
||||
|
|
@ -0,0 +1,78 @@
|
|||
from collections.abc import Mapping
|
||||
from typing import Any, TypeVar, Union, cast
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
from .ad_owner_new_location_type_0_type import AdOwnerNewLocationType0Type
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
T = TypeVar("T", bound="AdOwnerNewLocationType0")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class AdOwnerNewLocationType0:
|
||||
"""
|
||||
Attributes:
|
||||
type_ (Union[Unset, AdOwnerNewLocationType0Type]):
|
||||
coordinates (Union[Unset, list[float]]): Example: [12.9721, 77.5933].
|
||||
"""
|
||||
|
||||
type_: Union[Unset, AdOwnerNewLocationType0Type] = UNSET
|
||||
coordinates: Union[Unset, list[float]] = UNSET
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
type_: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.type_, Unset):
|
||||
type_ = self.type_.value
|
||||
|
||||
coordinates: Union[Unset, list[float]] = UNSET
|
||||
if not isinstance(self.coordinates, Unset):
|
||||
coordinates = self.coordinates
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update({})
|
||||
if type_ is not UNSET:
|
||||
field_dict["type"] = type_
|
||||
if coordinates is not UNSET:
|
||||
field_dict["coordinates"] = coordinates
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
d = dict(src_dict)
|
||||
_type_ = d.pop("type", UNSET)
|
||||
type_: Union[Unset, AdOwnerNewLocationType0Type]
|
||||
if isinstance(_type_, Unset):
|
||||
type_ = UNSET
|
||||
else:
|
||||
type_ = AdOwnerNewLocationType0Type(_type_)
|
||||
|
||||
coordinates = cast(list[float], d.pop("coordinates", UNSET))
|
||||
|
||||
ad_owner_new_location_type_0 = cls(
|
||||
type_=type_,
|
||||
coordinates=coordinates,
|
||||
)
|
||||
|
||||
ad_owner_new_location_type_0.additional_properties = d
|
||||
return ad_owner_new_location_type_0
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
from enum import Enum
|
||||
|
||||
|
||||
class AdOwnerNewLocationType0Type(str, Enum):
|
||||
POINT = "Point"
|
||||
|
||||
def __str__(self) -> str:
|
||||
return str(self.value)
|
||||
271
utils/clients/gooyal_advertising_client/models/ad_public.py
Normal file
271
utils/clients/gooyal_advertising_client/models/ad_public.py
Normal file
|
|
@ -0,0 +1,271 @@
|
|||
from collections.abc import Mapping
|
||||
from typing import TYPE_CHECKING, Any, TypeVar, Union, cast
|
||||
from uuid import UUID
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
from .type_0d9_enum import Type0D9Enum
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from .ad_content import AdContent
|
||||
from .ad_public_location_type_0 import AdPublicLocationType0
|
||||
from .refined_ad_banner import RefinedAdBanner
|
||||
from .refined_ad_content import RefinedAdContent
|
||||
|
||||
|
||||
T = TypeVar("T", bound="AdPublic")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class AdPublic:
|
||||
"""
|
||||
Attributes:
|
||||
uuid (UUID):
|
||||
title (Union[None, str]):
|
||||
type_ (Type0D9Enum): * `1` - BILLBOARD
|
||||
* `2` - CAPTURED_BILLBOARD
|
||||
* `99` - PROMOTION
|
||||
* `100` - CONSTANT
|
||||
reward_amount (int):
|
||||
content (str):
|
||||
contents (list['AdContent']):
|
||||
refined_contents (list['RefinedAdContent']):
|
||||
description (Union[None, str]):
|
||||
location (Union['AdPublicLocationType0', None]):
|
||||
location_is_approximate (bool):
|
||||
banner (Union[None, str]):
|
||||
address (Union[None, str]):
|
||||
url (Union[None, str]):
|
||||
tags (list[str]):
|
||||
details (Any):
|
||||
refined_banner (Union[Unset, RefinedAdBanner]):
|
||||
"""
|
||||
|
||||
uuid: UUID
|
||||
title: Union[None, str]
|
||||
type_: Type0D9Enum
|
||||
reward_amount: int
|
||||
content: str
|
||||
contents: list["AdContent"]
|
||||
refined_contents: list["RefinedAdContent"]
|
||||
description: Union[None, str]
|
||||
location: Union["AdPublicLocationType0", None]
|
||||
location_is_approximate: bool
|
||||
banner: Union[None, str]
|
||||
address: Union[None, str]
|
||||
url: Union[None, str]
|
||||
tags: list[str]
|
||||
details: Any
|
||||
refined_banner: Union[Unset, "RefinedAdBanner"] = UNSET
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
from .ad_public_location_type_0 import AdPublicLocationType0
|
||||
|
||||
uuid = str(self.uuid)
|
||||
|
||||
title: Union[None, str]
|
||||
title = self.title
|
||||
|
||||
type_ = self.type_.value
|
||||
|
||||
reward_amount = self.reward_amount
|
||||
|
||||
content = self.content
|
||||
|
||||
contents = []
|
||||
for contents_item_data in self.contents:
|
||||
contents_item = contents_item_data.to_dict()
|
||||
contents.append(contents_item)
|
||||
|
||||
refined_contents = []
|
||||
for refined_contents_item_data in self.refined_contents:
|
||||
refined_contents_item = refined_contents_item_data.to_dict()
|
||||
refined_contents.append(refined_contents_item)
|
||||
|
||||
description: Union[None, str]
|
||||
description = self.description
|
||||
|
||||
location: Union[None, dict[str, Any]]
|
||||
if isinstance(self.location, AdPublicLocationType0):
|
||||
location = self.location.to_dict()
|
||||
else:
|
||||
location = self.location
|
||||
|
||||
location_is_approximate = self.location_is_approximate
|
||||
|
||||
banner: Union[None, str]
|
||||
banner = self.banner
|
||||
|
||||
address: Union[None, str]
|
||||
address = self.address
|
||||
|
||||
url: Union[None, str]
|
||||
url = self.url
|
||||
|
||||
tags = self.tags
|
||||
|
||||
details = self.details
|
||||
|
||||
refined_banner: Union[Unset, dict[str, Any]] = UNSET
|
||||
if not isinstance(self.refined_banner, Unset):
|
||||
refined_banner = self.refined_banner.to_dict()
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update(
|
||||
{
|
||||
"uuid": uuid,
|
||||
"title": title,
|
||||
"type": type_,
|
||||
"reward_amount": reward_amount,
|
||||
"content": content,
|
||||
"contents": contents,
|
||||
"refined_contents": refined_contents,
|
||||
"description": description,
|
||||
"location": location,
|
||||
"location_is_approximate": location_is_approximate,
|
||||
"banner": banner,
|
||||
"address": address,
|
||||
"url": url,
|
||||
"tags": tags,
|
||||
"details": details,
|
||||
}
|
||||
)
|
||||
if refined_banner is not UNSET:
|
||||
field_dict["refined_banner"] = refined_banner
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
from .ad_content import AdContent
|
||||
from .ad_public_location_type_0 import AdPublicLocationType0
|
||||
from .refined_ad_banner import RefinedAdBanner
|
||||
from .refined_ad_content import RefinedAdContent
|
||||
|
||||
d = dict(src_dict)
|
||||
uuid = UUID(d.pop("uuid"))
|
||||
|
||||
def _parse_title(data: object) -> Union[None, str]:
|
||||
if data is None:
|
||||
return data
|
||||
return cast(Union[None, str], data)
|
||||
|
||||
title = _parse_title(d.pop("title"))
|
||||
|
||||
type_ = Type0D9Enum(d.pop("type"))
|
||||
|
||||
reward_amount = d.pop("reward_amount")
|
||||
|
||||
content = d.pop("content")
|
||||
|
||||
contents = []
|
||||
_contents = d.pop("contents")
|
||||
for contents_item_data in _contents:
|
||||
contents_item = AdContent.from_dict(contents_item_data)
|
||||
|
||||
contents.append(contents_item)
|
||||
|
||||
refined_contents = []
|
||||
_refined_contents = d.pop("refined_contents")
|
||||
for refined_contents_item_data in _refined_contents:
|
||||
refined_contents_item = RefinedAdContent.from_dict(refined_contents_item_data)
|
||||
|
||||
refined_contents.append(refined_contents_item)
|
||||
|
||||
def _parse_description(data: object) -> Union[None, str]:
|
||||
if data is None:
|
||||
return data
|
||||
return cast(Union[None, str], data)
|
||||
|
||||
description = _parse_description(d.pop("description"))
|
||||
|
||||
def _parse_location(data: object) -> Union["AdPublicLocationType0", None]:
|
||||
if data is None:
|
||||
return data
|
||||
try:
|
||||
if not isinstance(data, dict):
|
||||
raise TypeError()
|
||||
location_type_0 = AdPublicLocationType0.from_dict(data)
|
||||
|
||||
return location_type_0
|
||||
except: # noqa: E722
|
||||
pass
|
||||
return cast(Union["AdPublicLocationType0", None], data)
|
||||
|
||||
location = _parse_location(d.pop("location"))
|
||||
|
||||
location_is_approximate = d.pop("location_is_approximate")
|
||||
|
||||
def _parse_banner(data: object) -> Union[None, str]:
|
||||
if data is None:
|
||||
return data
|
||||
return cast(Union[None, str], data)
|
||||
|
||||
banner = _parse_banner(d.pop("banner"))
|
||||
|
||||
def _parse_address(data: object) -> Union[None, str]:
|
||||
if data is None:
|
||||
return data
|
||||
return cast(Union[None, str], data)
|
||||
|
||||
address = _parse_address(d.pop("address"))
|
||||
|
||||
def _parse_url(data: object) -> Union[None, str]:
|
||||
if data is None:
|
||||
return data
|
||||
return cast(Union[None, str], data)
|
||||
|
||||
url = _parse_url(d.pop("url"))
|
||||
|
||||
tags = cast(list[str], d.pop("tags"))
|
||||
|
||||
details = d.pop("details")
|
||||
|
||||
_refined_banner = d.pop("refined_banner", UNSET)
|
||||
refined_banner: Union[Unset, RefinedAdBanner]
|
||||
if isinstance(_refined_banner, Unset):
|
||||
refined_banner = UNSET
|
||||
else:
|
||||
refined_banner = RefinedAdBanner.from_dict(_refined_banner)
|
||||
|
||||
ad_public = cls(
|
||||
uuid=uuid,
|
||||
title=title,
|
||||
type_=type_,
|
||||
reward_amount=reward_amount,
|
||||
content=content,
|
||||
contents=contents,
|
||||
refined_contents=refined_contents,
|
||||
description=description,
|
||||
location=location,
|
||||
location_is_approximate=location_is_approximate,
|
||||
banner=banner,
|
||||
address=address,
|
||||
url=url,
|
||||
tags=tags,
|
||||
details=details,
|
||||
refined_banner=refined_banner,
|
||||
)
|
||||
|
||||
ad_public.additional_properties = d
|
||||
return ad_public
|
||||
|
||||
@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,78 @@
|
|||
from collections.abc import Mapping
|
||||
from typing import Any, TypeVar, Union, cast
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
from .ad_public_location_type_0_type import AdPublicLocationType0Type
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
T = TypeVar("T", bound="AdPublicLocationType0")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class AdPublicLocationType0:
|
||||
"""
|
||||
Attributes:
|
||||
type_ (Union[Unset, AdPublicLocationType0Type]):
|
||||
coordinates (Union[Unset, list[float]]): Example: [12.9721, 77.5933].
|
||||
"""
|
||||
|
||||
type_: Union[Unset, AdPublicLocationType0Type] = UNSET
|
||||
coordinates: Union[Unset, list[float]] = UNSET
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
type_: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.type_, Unset):
|
||||
type_ = self.type_.value
|
||||
|
||||
coordinates: Union[Unset, list[float]] = UNSET
|
||||
if not isinstance(self.coordinates, Unset):
|
||||
coordinates = self.coordinates
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update({})
|
||||
if type_ is not UNSET:
|
||||
field_dict["type"] = type_
|
||||
if coordinates is not UNSET:
|
||||
field_dict["coordinates"] = coordinates
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
d = dict(src_dict)
|
||||
_type_ = d.pop("type", UNSET)
|
||||
type_: Union[Unset, AdPublicLocationType0Type]
|
||||
if isinstance(_type_, Unset):
|
||||
type_ = UNSET
|
||||
else:
|
||||
type_ = AdPublicLocationType0Type(_type_)
|
||||
|
||||
coordinates = cast(list[float], d.pop("coordinates", UNSET))
|
||||
|
||||
ad_public_location_type_0 = cls(
|
||||
type_=type_,
|
||||
coordinates=coordinates,
|
||||
)
|
||||
|
||||
ad_public_location_type_0.additional_properties = d
|
||||
return ad_public_location_type_0
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
from enum import Enum
|
||||
|
||||
|
||||
class AdPublicLocationType0Type(str, Enum):
|
||||
POINT = "Point"
|
||||
|
||||
def __str__(self) -> str:
|
||||
return str(self.value)
|
||||
113
utils/clients/gooyal_advertising_client/models/ad_report.py
Normal file
113
utils/clients/gooyal_advertising_client/models/ad_report.py
Normal file
|
|
@ -0,0 +1,113 @@
|
|||
from collections.abc import Mapping
|
||||
from typing import Any, TypeVar, Union, cast
|
||||
from uuid import UUID
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
from .report_category_enum import ReportCategoryEnum
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
T = TypeVar("T", bound="AdReport")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class AdReport:
|
||||
"""
|
||||
Attributes:
|
||||
visit_uuid (UUID):
|
||||
report_category (Union[None, ReportCategoryEnum, Unset]):
|
||||
report_reason (Union[None, Unset, str]):
|
||||
"""
|
||||
|
||||
visit_uuid: UUID
|
||||
report_category: Union[None, ReportCategoryEnum, Unset] = UNSET
|
||||
report_reason: Union[None, Unset, str] = UNSET
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
visit_uuid = str(self.visit_uuid)
|
||||
|
||||
report_category: Union[None, Unset, int]
|
||||
if isinstance(self.report_category, Unset):
|
||||
report_category = UNSET
|
||||
elif isinstance(self.report_category, ReportCategoryEnum):
|
||||
report_category = self.report_category.value
|
||||
else:
|
||||
report_category = self.report_category
|
||||
|
||||
report_reason: Union[None, Unset, str]
|
||||
if isinstance(self.report_reason, Unset):
|
||||
report_reason = UNSET
|
||||
else:
|
||||
report_reason = self.report_reason
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update(
|
||||
{
|
||||
"visit_uuid": visit_uuid,
|
||||
}
|
||||
)
|
||||
if report_category is not UNSET:
|
||||
field_dict["report_category"] = report_category
|
||||
if report_reason is not UNSET:
|
||||
field_dict["report_reason"] = report_reason
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
d = dict(src_dict)
|
||||
visit_uuid = UUID(d.pop("visit_uuid"))
|
||||
|
||||
def _parse_report_category(data: object) -> Union[None, ReportCategoryEnum, Unset]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
try:
|
||||
if not isinstance(data, int):
|
||||
raise TypeError()
|
||||
report_category_type_0 = ReportCategoryEnum(data)
|
||||
|
||||
return report_category_type_0
|
||||
except: # noqa: E722
|
||||
pass
|
||||
return cast(Union[None, ReportCategoryEnum, Unset], data)
|
||||
|
||||
report_category = _parse_report_category(d.pop("report_category", UNSET))
|
||||
|
||||
def _parse_report_reason(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
report_reason = _parse_report_reason(d.pop("report_reason", UNSET))
|
||||
|
||||
ad_report = cls(
|
||||
visit_uuid=visit_uuid,
|
||||
report_category=report_category,
|
||||
report_reason=report_reason,
|
||||
)
|
||||
|
||||
ad_report.additional_properties = d
|
||||
return ad_report
|
||||
|
||||
@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
|
||||
123
utils/clients/gooyal_advertising_client/models/ad_statistic.py
Normal file
123
utils/clients/gooyal_advertising_client/models/ad_statistic.py
Normal file
|
|
@ -0,0 +1,123 @@
|
|||
from collections.abc import Mapping
|
||||
from typing import Any, TypeVar
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
T = TypeVar("T", bound="AdStatistic")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class AdStatistic:
|
||||
"""
|
||||
Attributes:
|
||||
visit_with_reward_count (int):
|
||||
visit_without_reward_count (int):
|
||||
balance (int):
|
||||
total_amount (int):
|
||||
visit_like_count (int):
|
||||
reward_count (int):
|
||||
reward_amount (int):
|
||||
visit_link_click_count (int):
|
||||
status (int):
|
||||
"""
|
||||
|
||||
visit_with_reward_count: int
|
||||
visit_without_reward_count: int
|
||||
balance: int
|
||||
total_amount: int
|
||||
visit_like_count: int
|
||||
reward_count: int
|
||||
reward_amount: int
|
||||
visit_link_click_count: int
|
||||
status: int
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
visit_with_reward_count = self.visit_with_reward_count
|
||||
|
||||
visit_without_reward_count = self.visit_without_reward_count
|
||||
|
||||
balance = self.balance
|
||||
|
||||
total_amount = self.total_amount
|
||||
|
||||
visit_like_count = self.visit_like_count
|
||||
|
||||
reward_count = self.reward_count
|
||||
|
||||
reward_amount = self.reward_amount
|
||||
|
||||
visit_link_click_count = self.visit_link_click_count
|
||||
|
||||
status = self.status
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update(
|
||||
{
|
||||
"visit_with_reward_count": visit_with_reward_count,
|
||||
"visit_without_reward_count": visit_without_reward_count,
|
||||
"balance": balance,
|
||||
"total_amount": total_amount,
|
||||
"visit_like_count": visit_like_count,
|
||||
"reward_count": reward_count,
|
||||
"reward_amount": reward_amount,
|
||||
"visit_link_click_count": visit_link_click_count,
|
||||
"status": status,
|
||||
}
|
||||
)
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
d = dict(src_dict)
|
||||
visit_with_reward_count = d.pop("visit_with_reward_count")
|
||||
|
||||
visit_without_reward_count = d.pop("visit_without_reward_count")
|
||||
|
||||
balance = d.pop("balance")
|
||||
|
||||
total_amount = d.pop("total_amount")
|
||||
|
||||
visit_like_count = d.pop("visit_like_count")
|
||||
|
||||
reward_count = d.pop("reward_count")
|
||||
|
||||
reward_amount = d.pop("reward_amount")
|
||||
|
||||
visit_link_click_count = d.pop("visit_link_click_count")
|
||||
|
||||
status = d.pop("status")
|
||||
|
||||
ad_statistic = cls(
|
||||
visit_with_reward_count=visit_with_reward_count,
|
||||
visit_without_reward_count=visit_without_reward_count,
|
||||
balance=balance,
|
||||
total_amount=total_amount,
|
||||
visit_like_count=visit_like_count,
|
||||
reward_count=reward_count,
|
||||
reward_amount=reward_amount,
|
||||
visit_link_click_count=visit_link_click_count,
|
||||
status=status,
|
||||
)
|
||||
|
||||
ad_statistic.additional_properties = d
|
||||
return ad_statistic
|
||||
|
||||
@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,83 @@
|
|||
from collections.abc import Mapping
|
||||
from typing import Any, TypeVar
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
T = TypeVar("T", bound="AdVisitStatistic")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class AdVisitStatistic:
|
||||
"""
|
||||
Attributes:
|
||||
label (str):
|
||||
with_reward_count (int):
|
||||
without_reward_count (int):
|
||||
reward_amount (int):
|
||||
"""
|
||||
|
||||
label: str
|
||||
with_reward_count: int
|
||||
without_reward_count: int
|
||||
reward_amount: int
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
label = self.label
|
||||
|
||||
with_reward_count = self.with_reward_count
|
||||
|
||||
without_reward_count = self.without_reward_count
|
||||
|
||||
reward_amount = self.reward_amount
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update(
|
||||
{
|
||||
"label": label,
|
||||
"with_reward_count": with_reward_count,
|
||||
"without_reward_count": without_reward_count,
|
||||
"reward_amount": reward_amount,
|
||||
}
|
||||
)
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
d = dict(src_dict)
|
||||
label = d.pop("label")
|
||||
|
||||
with_reward_count = d.pop("with_reward_count")
|
||||
|
||||
without_reward_count = d.pop("without_reward_count")
|
||||
|
||||
reward_amount = d.pop("reward_amount")
|
||||
|
||||
ad_visit_statistic = cls(
|
||||
label=label,
|
||||
with_reward_count=with_reward_count,
|
||||
without_reward_count=without_reward_count,
|
||||
reward_amount=reward_amount,
|
||||
)
|
||||
|
||||
ad_visit_statistic.additional_properties = d
|
||||
return ad_visit_statistic
|
||||
|
||||
@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
|
||||
357
utils/clients/gooyal_advertising_client/models/ad_with_visit.py
Normal file
357
utils/clients/gooyal_advertising_client/models/ad_with_visit.py
Normal file
|
|
@ -0,0 +1,357 @@
|
|||
import datetime
|
||||
from collections.abc import Mapping
|
||||
from typing import TYPE_CHECKING, Any, TypeVar, Union, cast
|
||||
from uuid import UUID
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
from dateutil.parser import isoparse
|
||||
|
||||
from .role_enum import RoleEnum
|
||||
from .type_0d9_enum import Type0D9Enum
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from .ad_content import AdContent
|
||||
from .ad_with_visit_location_type_0 import AdWithVisitLocationType0
|
||||
from .refined_ad_banner import RefinedAdBanner
|
||||
from .refined_ad_content import RefinedAdContent
|
||||
from .visit import Visit
|
||||
|
||||
|
||||
T = TypeVar("T", bound="AdWithVisit")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class AdWithVisit:
|
||||
"""
|
||||
Attributes:
|
||||
uuid (UUID):
|
||||
title (Union[None, str]):
|
||||
type_ (Type0D9Enum): * `1` - BILLBOARD
|
||||
* `2` - CAPTURED_BILLBOARD
|
||||
* `99` - PROMOTION
|
||||
* `100` - CONSTANT
|
||||
role (RoleEnum): * `1` - provider
|
||||
* `2` - requester
|
||||
details (Any):
|
||||
content (str):
|
||||
contents (list['AdContent']):
|
||||
refined_contents (list['RefinedAdContent']):
|
||||
description (Union[None, str]):
|
||||
location (Union['AdWithVisitLocationType0', None]):
|
||||
location_is_approximate (bool):
|
||||
banner (Union[None, str]):
|
||||
reward_amount (int):
|
||||
reward_count (int):
|
||||
address (Union[None, str]):
|
||||
url (Union[None, str]):
|
||||
tags (list[str]):
|
||||
created_at (datetime.datetime):
|
||||
updated_at (datetime.datetime):
|
||||
display_time (str):
|
||||
status (str):
|
||||
user_uuid (UUID):
|
||||
comments_count (str):
|
||||
likes_count (str):
|
||||
visit (Visit):
|
||||
refined_banner (Union[Unset, RefinedAdBanner]):
|
||||
"""
|
||||
|
||||
uuid: UUID
|
||||
title: Union[None, str]
|
||||
type_: Type0D9Enum
|
||||
role: RoleEnum
|
||||
details: Any
|
||||
content: str
|
||||
contents: list["AdContent"]
|
||||
refined_contents: list["RefinedAdContent"]
|
||||
description: Union[None, str]
|
||||
location: Union["AdWithVisitLocationType0", None]
|
||||
location_is_approximate: bool
|
||||
banner: Union[None, str]
|
||||
reward_amount: int
|
||||
reward_count: int
|
||||
address: Union[None, str]
|
||||
url: Union[None, str]
|
||||
tags: list[str]
|
||||
created_at: datetime.datetime
|
||||
updated_at: datetime.datetime
|
||||
display_time: str
|
||||
status: str
|
||||
user_uuid: UUID
|
||||
comments_count: str
|
||||
likes_count: str
|
||||
visit: "Visit"
|
||||
refined_banner: Union[Unset, "RefinedAdBanner"] = UNSET
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
from .ad_with_visit_location_type_0 import AdWithVisitLocationType0
|
||||
|
||||
uuid = str(self.uuid)
|
||||
|
||||
title: Union[None, str]
|
||||
title = self.title
|
||||
|
||||
type_ = self.type_.value
|
||||
|
||||
role = self.role.value
|
||||
|
||||
details = self.details
|
||||
|
||||
content = self.content
|
||||
|
||||
contents = []
|
||||
for contents_item_data in self.contents:
|
||||
contents_item = contents_item_data.to_dict()
|
||||
contents.append(contents_item)
|
||||
|
||||
refined_contents = []
|
||||
for refined_contents_item_data in self.refined_contents:
|
||||
refined_contents_item = refined_contents_item_data.to_dict()
|
||||
refined_contents.append(refined_contents_item)
|
||||
|
||||
description: Union[None, str]
|
||||
description = self.description
|
||||
|
||||
location: Union[None, dict[str, Any]]
|
||||
if isinstance(self.location, AdWithVisitLocationType0):
|
||||
location = self.location.to_dict()
|
||||
else:
|
||||
location = self.location
|
||||
|
||||
location_is_approximate = self.location_is_approximate
|
||||
|
||||
banner: Union[None, str]
|
||||
banner = self.banner
|
||||
|
||||
reward_amount = self.reward_amount
|
||||
|
||||
reward_count = self.reward_count
|
||||
|
||||
address: Union[None, str]
|
||||
address = self.address
|
||||
|
||||
url: Union[None, str]
|
||||
url = self.url
|
||||
|
||||
tags = self.tags
|
||||
|
||||
created_at = self.created_at.isoformat()
|
||||
|
||||
updated_at = self.updated_at.isoformat()
|
||||
|
||||
display_time = self.display_time
|
||||
|
||||
status = self.status
|
||||
|
||||
user_uuid = str(self.user_uuid)
|
||||
|
||||
comments_count = self.comments_count
|
||||
|
||||
likes_count = self.likes_count
|
||||
|
||||
visit = self.visit.to_dict()
|
||||
|
||||
refined_banner: Union[Unset, dict[str, Any]] = UNSET
|
||||
if not isinstance(self.refined_banner, Unset):
|
||||
refined_banner = self.refined_banner.to_dict()
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update(
|
||||
{
|
||||
"uuid": uuid,
|
||||
"title": title,
|
||||
"type": type_,
|
||||
"role": role,
|
||||
"details": details,
|
||||
"content": content,
|
||||
"contents": contents,
|
||||
"refined_contents": refined_contents,
|
||||
"description": description,
|
||||
"location": location,
|
||||
"location_is_approximate": location_is_approximate,
|
||||
"banner": banner,
|
||||
"reward_amount": reward_amount,
|
||||
"reward_count": reward_count,
|
||||
"address": address,
|
||||
"url": url,
|
||||
"tags": tags,
|
||||
"created_at": created_at,
|
||||
"updated_at": updated_at,
|
||||
"display_time": display_time,
|
||||
"status": status,
|
||||
"user_uuid": user_uuid,
|
||||
"comments_count": comments_count,
|
||||
"likes_count": likes_count,
|
||||
"visit": visit,
|
||||
}
|
||||
)
|
||||
if refined_banner is not UNSET:
|
||||
field_dict["refined_banner"] = refined_banner
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
from .ad_content import AdContent
|
||||
from .ad_with_visit_location_type_0 import AdWithVisitLocationType0
|
||||
from .refined_ad_banner import RefinedAdBanner
|
||||
from .refined_ad_content import RefinedAdContent
|
||||
from .visit import Visit
|
||||
|
||||
d = dict(src_dict)
|
||||
uuid = UUID(d.pop("uuid"))
|
||||
|
||||
def _parse_title(data: object) -> Union[None, str]:
|
||||
if data is None:
|
||||
return data
|
||||
return cast(Union[None, str], data)
|
||||
|
||||
title = _parse_title(d.pop("title"))
|
||||
|
||||
type_ = Type0D9Enum(d.pop("type"))
|
||||
|
||||
role = RoleEnum(d.pop("role"))
|
||||
|
||||
details = d.pop("details")
|
||||
|
||||
content = d.pop("content")
|
||||
|
||||
contents = []
|
||||
_contents = d.pop("contents")
|
||||
for contents_item_data in _contents:
|
||||
contents_item = AdContent.from_dict(contents_item_data)
|
||||
|
||||
contents.append(contents_item)
|
||||
|
||||
refined_contents = []
|
||||
_refined_contents = d.pop("refined_contents")
|
||||
for refined_contents_item_data in _refined_contents:
|
||||
refined_contents_item = RefinedAdContent.from_dict(refined_contents_item_data)
|
||||
|
||||
refined_contents.append(refined_contents_item)
|
||||
|
||||
def _parse_description(data: object) -> Union[None, str]:
|
||||
if data is None:
|
||||
return data
|
||||
return cast(Union[None, str], data)
|
||||
|
||||
description = _parse_description(d.pop("description"))
|
||||
|
||||
def _parse_location(data: object) -> Union["AdWithVisitLocationType0", None]:
|
||||
if data is None:
|
||||
return data
|
||||
try:
|
||||
if not isinstance(data, dict):
|
||||
raise TypeError()
|
||||
location_type_0 = AdWithVisitLocationType0.from_dict(data)
|
||||
|
||||
return location_type_0
|
||||
except: # noqa: E722
|
||||
pass
|
||||
return cast(Union["AdWithVisitLocationType0", None], data)
|
||||
|
||||
location = _parse_location(d.pop("location"))
|
||||
|
||||
location_is_approximate = d.pop("location_is_approximate")
|
||||
|
||||
def _parse_banner(data: object) -> Union[None, str]:
|
||||
if data is None:
|
||||
return data
|
||||
return cast(Union[None, str], data)
|
||||
|
||||
banner = _parse_banner(d.pop("banner"))
|
||||
|
||||
reward_amount = d.pop("reward_amount")
|
||||
|
||||
reward_count = d.pop("reward_count")
|
||||
|
||||
def _parse_address(data: object) -> Union[None, str]:
|
||||
if data is None:
|
||||
return data
|
||||
return cast(Union[None, str], data)
|
||||
|
||||
address = _parse_address(d.pop("address"))
|
||||
|
||||
def _parse_url(data: object) -> Union[None, str]:
|
||||
if data is None:
|
||||
return data
|
||||
return cast(Union[None, str], data)
|
||||
|
||||
url = _parse_url(d.pop("url"))
|
||||
|
||||
tags = cast(list[str], d.pop("tags"))
|
||||
|
||||
created_at = isoparse(d.pop("created_at"))
|
||||
|
||||
updated_at = isoparse(d.pop("updated_at"))
|
||||
|
||||
display_time = d.pop("display_time")
|
||||
|
||||
status = d.pop("status")
|
||||
|
||||
user_uuid = UUID(d.pop("user_uuid"))
|
||||
|
||||
comments_count = d.pop("comments_count")
|
||||
|
||||
likes_count = d.pop("likes_count")
|
||||
|
||||
visit = Visit.from_dict(d.pop("visit"))
|
||||
|
||||
_refined_banner = d.pop("refined_banner", UNSET)
|
||||
refined_banner: Union[Unset, RefinedAdBanner]
|
||||
if isinstance(_refined_banner, Unset):
|
||||
refined_banner = UNSET
|
||||
else:
|
||||
refined_banner = RefinedAdBanner.from_dict(_refined_banner)
|
||||
|
||||
ad_with_visit = cls(
|
||||
uuid=uuid,
|
||||
title=title,
|
||||
type_=type_,
|
||||
role=role,
|
||||
details=details,
|
||||
content=content,
|
||||
contents=contents,
|
||||
refined_contents=refined_contents,
|
||||
description=description,
|
||||
location=location,
|
||||
location_is_approximate=location_is_approximate,
|
||||
banner=banner,
|
||||
reward_amount=reward_amount,
|
||||
reward_count=reward_count,
|
||||
address=address,
|
||||
url=url,
|
||||
tags=tags,
|
||||
created_at=created_at,
|
||||
updated_at=updated_at,
|
||||
display_time=display_time,
|
||||
status=status,
|
||||
user_uuid=user_uuid,
|
||||
comments_count=comments_count,
|
||||
likes_count=likes_count,
|
||||
visit=visit,
|
||||
refined_banner=refined_banner,
|
||||
)
|
||||
|
||||
ad_with_visit.additional_properties = d
|
||||
return ad_with_visit
|
||||
|
||||
@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
Reference in a new issue