Compare commits
3 commits
c9b18e8d3a
...
2c715c614c
| Author | SHA1 | Date | |
|---|---|---|---|
| 2c715c614c | |||
| b293509e20 | |||
| ebffc9db61 |
192 changed files with 23715 additions and 362 deletions
|
|
@ -20,8 +20,9 @@ OAUTH2_PROVIDER_BASE_PUBLIC_URL=https://accounts-staging.gooyal.ir/oauth2
|
|||
OAUTH2_PROVIDER_BASE_PRIVATE_URL=https://accounts-staging.gooyal.ir/oauth2
|
||||
OAUTH2_PROVIDER_CLIENT_ID=sample
|
||||
OAUTH2_PROVIDER_CLIENT_SECRET=sample
|
||||
OAUTH2_PROVIDER_SCOPES=wallet.application.withdraw:rollback wallet.application.deposit:rollback wallet.application.withdraw:submit wallet.application.withdraw:verify wallet.application:get_user_balance accounts.profile:detailed_retrieve
|
||||
OAUTH2_PROVIDER_SCOPES=
|
||||
ACCOUNTS_BASE_PUBLIC_URL=https://accounts-staging.gooyal.ir
|
||||
WALLET_BASE_PUBLIC_URL=https://wallet-staging.gooyal.ir
|
||||
WALLET_RIAL=af7d967f-30c0-409b-9066-2549f2da5e5e
|
||||
WALLET_REWARD=e7c9d4d1-4d1f-43b2-96f7-4d4a168f480d
|
||||
ADVERTISING_BASE_PUBLIC_URL=https://advertising-staging.gooyal.ir
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
from drf_spectacular.utils import extend_schema
|
||||
from rest_framework.permissions import AllowAny
|
||||
from rest_framework.response import Response
|
||||
from rest_framework.views import APIView
|
||||
|
|
@ -7,5 +8,11 @@ class HealthCheckView(APIView):
|
|||
authentication_classes = []
|
||||
permission_classes = [AllowAny]
|
||||
|
||||
@extend_schema(
|
||||
tags=["Health"],
|
||||
summary="Health check",
|
||||
description="Returns service availability status.",
|
||||
responses={200: {"type": "object", "properties": {"status": {"type": "string"}}}},
|
||||
)
|
||||
def get(self, request):
|
||||
return Response({"status": "ok"})
|
||||
|
|
|
|||
|
|
@ -1,8 +0,0 @@
|
|||
from rest_framework import serializers
|
||||
|
||||
from apps.reports.services.orchestrator import ReportOrchestrator
|
||||
|
||||
|
||||
class ReportGenerateSerializer(serializers.Serializer):
|
||||
report_type = serializers.ChoiceField(choices=ReportOrchestrator.available_reports())
|
||||
filters = serializers.DictField(required=False, default=dict)
|
||||
|
|
@ -1,41 +1,46 @@
|
|||
from urllib.parse import urljoin
|
||||
import logging
|
||||
|
||||
import requests
|
||||
from django.conf import settings
|
||||
from utils.accounts_client import get_user_detailed_info
|
||||
from utils.advertising_client import get_crm_application_tickets
|
||||
|
||||
from apps.reports.services.oauth import OAuth2ClientCredentials
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class ReportDataSources:
|
||||
"""
|
||||
Keep downstream calls for report generation in one place.
|
||||
def fetch_application_tickets(self):
|
||||
tickets = []
|
||||
offset = 0
|
||||
limit = 1000
|
||||
|
||||
The concrete service endpoints are intentionally placeholders until the
|
||||
exact internal service URLs and response shapes are known.
|
||||
"""
|
||||
while True:
|
||||
response = get_crm_application_tickets(limit=limit, offset=offset)
|
||||
if not response or not response.results:
|
||||
break
|
||||
|
||||
def __init__(self, oauth_client=None):
|
||||
self.oauth_client = oauth_client or OAuth2ClientCredentials()
|
||||
tickets.extend(response.results)
|
||||
if response.next_ is None:
|
||||
break
|
||||
offset += limit
|
||||
|
||||
def fetch_users(self, filters):
|
||||
return []
|
||||
return tickets
|
||||
|
||||
def fetch_user_metrics(self, user_ids, filters):
|
||||
return {}
|
||||
def fetch_users_for_tickets(self, tickets):
|
||||
users = []
|
||||
seen = set()
|
||||
|
||||
def fetch_tickets(self, filters):
|
||||
return []
|
||||
for ticket in tickets:
|
||||
user_id = str(ticket.user)
|
||||
if user_id in seen:
|
||||
continue
|
||||
seen.add(user_id)
|
||||
|
||||
def fetch_ticket_metrics(self, ticket_ids, filters):
|
||||
return {}
|
||||
try:
|
||||
user = get_user_detailed_info(user_id)
|
||||
except Exception:
|
||||
logger.exception("Failed to fetch user %s", user_id)
|
||||
continue
|
||||
|
||||
def get_json(self, base_url, path, params=None):
|
||||
url = urljoin(f"{base_url.rstrip('/')}/", path.lstrip("/"))
|
||||
response = requests.get(
|
||||
url,
|
||||
params=params,
|
||||
headers=self.oauth_client.authorization_header(),
|
||||
timeout=settings.SERVICE_REQUEST_TIMEOUT,
|
||||
)
|
||||
response.raise_for_status()
|
||||
return response.json()
|
||||
if user is not None:
|
||||
users.append(user)
|
||||
|
||||
return users
|
||||
|
|
|
|||
|
|
@ -41,3 +41,13 @@ def build_report_workbook(title, columns, rows):
|
|||
output = BytesIO()
|
||||
workbook.save(output)
|
||||
return output.getvalue()
|
||||
|
||||
|
||||
def build_report_zip(files: dict[str, bytes]) -> bytes:
|
||||
from zipfile import ZipFile, ZIP_DEFLATED
|
||||
|
||||
output = BytesIO()
|
||||
with ZipFile(output, "w", ZIP_DEFLATED) as zip_file:
|
||||
for filename, content in files.items():
|
||||
zip_file.writestr(filename, content)
|
||||
return output.getvalue()
|
||||
|
|
|
|||
|
|
@ -1,69 +0,0 @@
|
|||
from dataclasses import dataclass
|
||||
from time import monotonic
|
||||
from urllib.parse import urljoin
|
||||
|
||||
import requests
|
||||
from django.conf import settings
|
||||
|
||||
|
||||
class OAuth2ConfigurationError(RuntimeError):
|
||||
pass
|
||||
|
||||
|
||||
@dataclass
|
||||
class OAuth2Token:
|
||||
access_token: str
|
||||
expires_at: float
|
||||
token_type: str = "Bearer"
|
||||
|
||||
def is_valid(self) -> bool:
|
||||
return bool(self.access_token) and monotonic() < self.expires_at
|
||||
|
||||
|
||||
class OAuth2ClientCredentials:
|
||||
def __init__(self):
|
||||
self._token = None
|
||||
|
||||
@property
|
||||
def token_url(self):
|
||||
provider_private_url = settings.OAUTH2_PROVIDER_PRIVATE_URL.rstrip("/")
|
||||
if not provider_private_url:
|
||||
raise OAuth2ConfigurationError("OAUTH2_PROVIDER_PRIVATE_URL is required.")
|
||||
return urljoin(f"{provider_private_url}/", "apis/applications/")
|
||||
|
||||
def get_access_token(self):
|
||||
if self._token and self._token.is_valid():
|
||||
return self._token.access_token
|
||||
|
||||
if not settings.OAUTH2_CLIENT_ID or not settings.OAUTH2_CLIENT_SECRET:
|
||||
raise OAuth2ConfigurationError(
|
||||
"OAUTH2_CLIENT_ID and OAUTH2_CLIENT_SECRET are required."
|
||||
)
|
||||
|
||||
response = requests.post(
|
||||
self.token_url,
|
||||
data={
|
||||
"grant_type": "client_credentials",
|
||||
"scope": settings.OAUTH2_SCOPES,
|
||||
},
|
||||
auth=(settings.OAUTH2_CLIENT_ID, settings.OAUTH2_CLIENT_SECRET),
|
||||
timeout=settings.SERVICE_REQUEST_TIMEOUT,
|
||||
)
|
||||
response.raise_for_status()
|
||||
payload = response.json()
|
||||
|
||||
access_token = payload.get("access_token")
|
||||
if not access_token:
|
||||
raise OAuth2ConfigurationError("OAuth2 response did not include access_token.")
|
||||
|
||||
expires_in = int(payload.get("expires_in", 3600))
|
||||
token_type = payload.get("token_type", "Bearer")
|
||||
self._token = OAuth2Token(
|
||||
access_token=access_token,
|
||||
expires_at=monotonic() + max(expires_in - 60, 1),
|
||||
token_type=token_type,
|
||||
)
|
||||
return self._token.access_token
|
||||
|
||||
def authorization_header(self):
|
||||
return {"Authorization": f"Bearer {self.get_access_token()}"}
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
from apps.reports.services.report_types import REPORT_TYPES
|
||||
|
||||
|
||||
class ReportOrchestrator:
|
||||
@classmethod
|
||||
def available_reports(cls):
|
||||
return [(report_type, report_type) for report_type in REPORT_TYPES.keys()]
|
||||
|
||||
def generate(self, payload):
|
||||
report = REPORT_TYPES[payload["report_type"]]()
|
||||
return report.generate(payload.get("filters") or {})
|
||||
78
apps/reports/services/report_builder.py
Normal file
78
apps/reports/services/report_builder.py
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
TICKET_STATE_LABELS = {
|
||||
1: "INIT",
|
||||
10: "CLOSED",
|
||||
}
|
||||
|
||||
USERS_COLUMNS = [
|
||||
{"key": "user_uuid", "label": "User UUID"},
|
||||
{"key": "username", "label": "Username"},
|
||||
{"key": "first_name", "label": "First Name"},
|
||||
{"key": "last_name", "label": "Last Name"},
|
||||
{"key": "email", "label": "Email"},
|
||||
{"key": "phone_number", "label": "Phone Number"},
|
||||
{"key": "address", "label": "Address"},
|
||||
]
|
||||
|
||||
TICKETS_COLUMNS = [
|
||||
{"key": "ticket_uuid", "label": "Ticket UUID"},
|
||||
{"key": "user_uuid", "label": "User UUID"},
|
||||
{"key": "title", "label": "Title"},
|
||||
{"key": "description", "label": "Description"},
|
||||
{"key": "state", "label": "State"},
|
||||
{"key": "created_at", "label": "Created At"},
|
||||
{"key": "updated_at", "label": "Updated At"},
|
||||
]
|
||||
|
||||
|
||||
def _format_value(value):
|
||||
if value is None:
|
||||
return ""
|
||||
if type(value).__name__ == "Unset":
|
||||
return ""
|
||||
if hasattr(value, "value") and not isinstance(value, (str, bytes)):
|
||||
value = value.value
|
||||
if value is None:
|
||||
return ""
|
||||
return value
|
||||
|
||||
|
||||
def _format_ticket_state(state):
|
||||
if not state:
|
||||
return ""
|
||||
return TICKET_STATE_LABELS.get(state.value, str(state.value))
|
||||
|
||||
|
||||
def build_user_rows(users):
|
||||
rows = []
|
||||
for user in users:
|
||||
if user is None:
|
||||
continue
|
||||
rows.append(
|
||||
{
|
||||
"user_uuid": str(user.uuid),
|
||||
"username": _format_value(user.username),
|
||||
"first_name": _format_value(user.first_name),
|
||||
"last_name": _format_value(user.last_name),
|
||||
"email": _format_value(user.email),
|
||||
"phone_number": _format_value(user.phone_number),
|
||||
"address": _format_value(user.address),
|
||||
}
|
||||
)
|
||||
return rows
|
||||
|
||||
|
||||
def build_ticket_rows(tickets):
|
||||
rows = []
|
||||
for ticket in tickets:
|
||||
rows.append(
|
||||
{
|
||||
"ticket_uuid": str(ticket.uuid),
|
||||
"user_uuid": str(ticket.user),
|
||||
"title": _format_value(ticket.title),
|
||||
"description": _format_value(ticket.description),
|
||||
"state": _format_ticket_state(ticket.state),
|
||||
"created_at": str(ticket.created_at) if ticket.created_at else "",
|
||||
"updated_at": str(ticket.updated_at) if ticket.updated_at else "",
|
||||
}
|
||||
)
|
||||
return rows
|
||||
|
|
@ -1,100 +0,0 @@
|
|||
from apps.reports.services.data_sources import ReportDataSources
|
||||
|
||||
|
||||
class BaseReport:
|
||||
report_type = None
|
||||
title = None
|
||||
filename = None
|
||||
columns = []
|
||||
|
||||
def __init__(self, data_sources=None):
|
||||
self.data_sources = data_sources or ReportDataSources()
|
||||
|
||||
def generate(self, filters):
|
||||
return {
|
||||
"title": self.title,
|
||||
"filename": self.filename,
|
||||
"columns": self.columns,
|
||||
"rows": self.build_rows(filters),
|
||||
}
|
||||
|
||||
def build_rows(self, filters):
|
||||
raise NotImplementedError
|
||||
|
||||
|
||||
class UserReport(BaseReport):
|
||||
report_type = "user"
|
||||
title = "User Report"
|
||||
filename = "user-report.xlsx"
|
||||
columns = [
|
||||
{"key": "user_id", "label": "User ID"},
|
||||
{"key": "full_name", "label": "Full Name"},
|
||||
{"key": "email", "label": "Email"},
|
||||
{"key": "status", "label": "Status"},
|
||||
{"key": "ticket_count", "label": "Ticket Count"},
|
||||
]
|
||||
|
||||
def build_rows(self, filters):
|
||||
users = self.data_sources.fetch_users(filters)
|
||||
user_ids = [user.get("id") for user in users if user.get("id")]
|
||||
metrics_by_user_id = self.data_sources.fetch_user_metrics(user_ids, filters)
|
||||
|
||||
rows = []
|
||||
for user in users:
|
||||
user_id = user.get("id")
|
||||
metrics = metrics_by_user_id.get(user_id, {})
|
||||
rows.append(
|
||||
{
|
||||
"user_id": user_id,
|
||||
"full_name": user.get("full_name") or user.get("name") or "",
|
||||
"email": user.get("email", ""),
|
||||
"status": user.get("status", ""),
|
||||
"ticket_count": metrics.get("ticket_count", 0),
|
||||
}
|
||||
)
|
||||
return rows
|
||||
|
||||
|
||||
class TicketsReport(BaseReport):
|
||||
report_type = "tickets"
|
||||
title = "Tickets Report"
|
||||
filename = "tickets-report.xlsx"
|
||||
columns = [
|
||||
{"key": "ticket_id", "label": "Ticket ID"},
|
||||
{"key": "title", "label": "Title"},
|
||||
{"key": "status", "label": "Status"},
|
||||
{"key": "priority", "label": "Priority"},
|
||||
{"key": "assignee", "label": "Assignee"},
|
||||
{"key": "created_at", "label": "Created At"},
|
||||
]
|
||||
|
||||
def build_rows(self, filters):
|
||||
tickets = self.data_sources.fetch_tickets(filters)
|
||||
ticket_ids = [ticket.get("id") for ticket in tickets if ticket.get("id")]
|
||||
metrics_by_ticket_id = self.data_sources.fetch_ticket_metrics(ticket_ids, filters)
|
||||
|
||||
rows = []
|
||||
for ticket in tickets:
|
||||
ticket_id = ticket.get("id")
|
||||
metrics = metrics_by_ticket_id.get(ticket_id, {})
|
||||
rows.append(
|
||||
{
|
||||
"ticket_id": ticket_id,
|
||||
"title": ticket.get("title", ""),
|
||||
"status": ticket.get("status", ""),
|
||||
"priority": ticket.get("priority", ""),
|
||||
"assignee": (
|
||||
ticket.get("assignee_name")
|
||||
or ticket.get("assignee", {}).get("name", "")
|
||||
),
|
||||
"created_at": ticket.get("created_at", ""),
|
||||
**metrics,
|
||||
}
|
||||
)
|
||||
return rows
|
||||
|
||||
|
||||
REPORT_TYPES = {
|
||||
UserReport.report_type: UserReport,
|
||||
TicketsReport.report_type: TicketsReport,
|
||||
}
|
||||
|
|
@ -1,151 +1,138 @@
|
|||
from datetime import datetime
|
||||
from io import BytesIO
|
||||
from unittest.mock import patch
|
||||
from unittest.mock import MagicMock, patch
|
||||
from uuid import uuid4
|
||||
from zipfile import ZipFile
|
||||
|
||||
from django.test import override_settings
|
||||
from openpyxl import load_workbook
|
||||
from rest_framework import status
|
||||
from rest_framework.test import APITestCase
|
||||
|
||||
from apps.reports.services.oauth import OAuth2ClientCredentials
|
||||
from utils.clients.gooyal_advertising_client.models.ticket_state_enum import TicketStateEnum
|
||||
|
||||
|
||||
class GenerateReportTests(APITestCase):
|
||||
@patch("apps.reports.services.data_sources.ReportDataSources.fetch_user_metrics")
|
||||
@patch("apps.reports.services.data_sources.ReportDataSources.fetch_users")
|
||||
def test_generate_user_report_is_public_and_returns_excel(
|
||||
self,
|
||||
mock_fetch_users,
|
||||
mock_fetch_user_metrics,
|
||||
):
|
||||
mock_fetch_users.return_value = [
|
||||
{
|
||||
"id": 1,
|
||||
"full_name": "Alice Doe",
|
||||
"email": "alice@example.com",
|
||||
"status": "active",
|
||||
}
|
||||
]
|
||||
mock_fetch_user_metrics.return_value = {
|
||||
1: {"ticket_count": 3},
|
||||
}
|
||||
def _build_ticket(self, user_uuid=None):
|
||||
ticket = MagicMock()
|
||||
ticket.uuid = uuid4()
|
||||
ticket.user = user_uuid or uuid4()
|
||||
ticket.title = "Login issue"
|
||||
ticket.description = "Cannot login"
|
||||
ticket.state = TicketStateEnum(10)
|
||||
ticket.created_at = datetime(2026, 5, 20, 10, 0)
|
||||
ticket.updated_at = datetime(2026, 5, 21, 10, 0)
|
||||
return ticket
|
||||
|
||||
response = self.client.post(
|
||||
"/api/reports/generate/",
|
||||
{
|
||||
"report_type": "user",
|
||||
"filters": {"status": "active"},
|
||||
},
|
||||
format="json",
|
||||
)
|
||||
def _build_user(self, user_uuid):
|
||||
user = MagicMock()
|
||||
user.uuid = user_uuid
|
||||
user.username = "alice"
|
||||
user.first_name = "Alice"
|
||||
user.last_name = "Doe"
|
||||
user.email = "alice@example.com"
|
||||
user.phone_number = "09120000000"
|
||||
user.address = "Tehran"
|
||||
return user
|
||||
|
||||
self.assertEqual(response.status_code, status.HTTP_200_OK)
|
||||
self.assertEqual(
|
||||
response["Content-Type"],
|
||||
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
||||
)
|
||||
self.assertEqual(
|
||||
response["Content-Disposition"],
|
||||
'attachment; filename="user-report.xlsx"',
|
||||
)
|
||||
|
||||
workbook = load_workbook(BytesIO(response.content))
|
||||
worksheet = workbook.active
|
||||
self.assertEqual(worksheet["A1"].value, "User Report")
|
||||
self.assertEqual(
|
||||
[cell.value for cell in worksheet[2]],
|
||||
["User ID", "Full Name", "Email", "Status", "Ticket Count"],
|
||||
)
|
||||
self.assertEqual(
|
||||
[cell.value for cell in worksheet[3]],
|
||||
[1, "Alice Doe", "alice@example.com", "active", 3],
|
||||
)
|
||||
mock_fetch_users.assert_called_once_with({"status": "active"})
|
||||
|
||||
@patch("apps.reports.services.data_sources.ReportDataSources.fetch_ticket_metrics")
|
||||
@patch("apps.reports.services.data_sources.ReportDataSources.fetch_tickets")
|
||||
def test_generate_tickets_report_uses_static_columns(
|
||||
@patch("apps.reports.services.data_sources.ReportDataSources.fetch_users_for_tickets")
|
||||
@patch("apps.reports.services.data_sources.ReportDataSources.fetch_application_tickets")
|
||||
def test_generate_report_returns_zip_with_two_excel_files(
|
||||
self,
|
||||
mock_fetch_tickets,
|
||||
mock_fetch_ticket_metrics,
|
||||
mock_fetch_users,
|
||||
):
|
||||
mock_fetch_tickets.return_value = [
|
||||
{
|
||||
"id": 11,
|
||||
"title": "Login issue",
|
||||
"status": "open",
|
||||
"priority": "high",
|
||||
"assignee": {"name": "Support Agent"},
|
||||
"created_at": "2026-05-20T10:00:00Z",
|
||||
}
|
||||
]
|
||||
mock_fetch_ticket_metrics.return_value = {}
|
||||
ticket = self._build_ticket()
|
||||
user = self._build_user(ticket.user)
|
||||
mock_fetch_tickets.return_value = [ticket]
|
||||
mock_fetch_users.return_value = [user]
|
||||
|
||||
response = self.client.post(
|
||||
"/api/reports/generate/",
|
||||
{"report_type": "tickets"},
|
||||
format="json",
|
||||
)
|
||||
response = self.client.post("/api/reports/generate/")
|
||||
|
||||
self.assertEqual(response.status_code, status.HTTP_200_OK)
|
||||
self.assertEqual(response["Content-Type"], "application/zip")
|
||||
self.assertEqual(
|
||||
response["Content-Disposition"],
|
||||
'attachment; filename="tickets-report.xlsx"',
|
||||
'attachment; filename="crm-reports.zip"',
|
||||
)
|
||||
|
||||
workbook = load_workbook(BytesIO(response.content))
|
||||
worksheet = workbook.active
|
||||
self.assertEqual(worksheet["A1"].value, "Tickets Report")
|
||||
self.assertEqual(
|
||||
[cell.value for cell in worksheet[2]],
|
||||
["Ticket ID", "Title", "Status", "Priority", "Assignee", "Created At"],
|
||||
)
|
||||
self.assertEqual(
|
||||
[cell.value for cell in worksheet[3]],
|
||||
[
|
||||
11,
|
||||
"Login issue",
|
||||
"open",
|
||||
"high",
|
||||
"Support Agent",
|
||||
"2026-05-20T10:00:00Z",
|
||||
],
|
||||
)
|
||||
with ZipFile(BytesIO(response.content)) as archive:
|
||||
self.assertEqual(
|
||||
set(archive.namelist()),
|
||||
{"users-report.xlsx", "tickets-report.xlsx"},
|
||||
)
|
||||
|
||||
def test_unknown_report_type_returns_validation_error(self):
|
||||
response = self.client.post(
|
||||
"/api/reports/generate/",
|
||||
{"report_type": "unknown"},
|
||||
format="json",
|
||||
)
|
||||
users_workbook = load_workbook(BytesIO(archive.read("users-report.xlsx")))
|
||||
users_sheet = users_workbook.active
|
||||
self.assertEqual(users_sheet["A1"].value, "Users Report")
|
||||
self.assertEqual(
|
||||
[cell.value for cell in users_sheet[2]],
|
||||
[
|
||||
"User UUID",
|
||||
"Username",
|
||||
"First Name",
|
||||
"Last Name",
|
||||
"Email",
|
||||
"Phone Number",
|
||||
"Address",
|
||||
],
|
||||
)
|
||||
self.assertEqual(
|
||||
[cell.value for cell in users_sheet[3]],
|
||||
[
|
||||
str(user.uuid),
|
||||
"alice",
|
||||
"Alice",
|
||||
"Doe",
|
||||
"alice@example.com",
|
||||
"09120000000",
|
||||
"Tehran",
|
||||
],
|
||||
)
|
||||
|
||||
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
|
||||
tickets_workbook = load_workbook(
|
||||
BytesIO(archive.read("tickets-report.xlsx"))
|
||||
)
|
||||
tickets_sheet = tickets_workbook.active
|
||||
self.assertEqual(tickets_sheet["A1"].value, "Tickets Report")
|
||||
self.assertEqual(
|
||||
[cell.value for cell in tickets_sheet[2]],
|
||||
[
|
||||
"Ticket UUID",
|
||||
"User UUID",
|
||||
"Title",
|
||||
"Description",
|
||||
"State",
|
||||
"Created At",
|
||||
"Updated At",
|
||||
],
|
||||
)
|
||||
self.assertEqual(
|
||||
[cell.value for cell in tickets_sheet[3]],
|
||||
[
|
||||
str(ticket.uuid),
|
||||
str(ticket.user),
|
||||
"Login issue",
|
||||
"Cannot login",
|
||||
"CLOSED",
|
||||
"2026-05-20 10:00:00",
|
||||
"2026-05-21 10:00:00",
|
||||
],
|
||||
)
|
||||
|
||||
@patch("apps.reports.services.data_sources.ReportDataSources.fetch_users_for_tickets")
|
||||
@patch("apps.reports.services.data_sources.ReportDataSources.fetch_application_tickets")
|
||||
def test_generate_report_skips_missing_users(
|
||||
self,
|
||||
mock_fetch_tickets,
|
||||
mock_fetch_users,
|
||||
):
|
||||
ticket = self._build_ticket()
|
||||
mock_fetch_tickets.return_value = [ticket]
|
||||
mock_fetch_users.return_value = [None]
|
||||
|
||||
class OAuth2ClientCredentialsTests(APITestCase):
|
||||
@override_settings(
|
||||
OAUTH2_PROVIDER_PRIVATE_URL="https://auth.internal",
|
||||
OAUTH2_CLIENT_ID="client-id",
|
||||
OAUTH2_CLIENT_SECRET="client-secret",
|
||||
OAUTH2_SCOPES="reports:read customers:read",
|
||||
SERVICE_REQUEST_TIMEOUT=10,
|
||||
)
|
||||
@patch("apps.reports.services.oauth.requests.post")
|
||||
def test_get_access_token_uses_client_credentials(self, mock_post):
|
||||
mock_post.return_value.json.return_value = {
|
||||
"access_token": "token-value",
|
||||
"expires_in": 3600,
|
||||
}
|
||||
mock_post.return_value.raise_for_status.return_value = None
|
||||
response = self.client.post("/api/reports/generate/")
|
||||
|
||||
token = OAuth2ClientCredentials().get_access_token()
|
||||
|
||||
self.assertEqual(token, "token-value")
|
||||
mock_post.assert_called_once_with(
|
||||
"https://auth.internal/oauth2/token",
|
||||
data={
|
||||
"grant_type": "client_credentials",
|
||||
"scope": "reports:read customers:read",
|
||||
},
|
||||
auth=("client-id", "client-secret"),
|
||||
timeout=10,
|
||||
)
|
||||
self.assertEqual(response.status_code, status.HTTP_200_OK)
|
||||
with ZipFile(BytesIO(response.content)) as archive:
|
||||
users_workbook = load_workbook(BytesIO(archive.read("users-report.xlsx")))
|
||||
self.assertIsNone(users_workbook.active["A3"].value)
|
||||
|
|
|
|||
|
|
@ -1,36 +1,60 @@
|
|||
from django.http import HttpResponse
|
||||
from drf_spectacular.types import OpenApiTypes
|
||||
from drf_spectacular.utils import OpenApiResponse, extend_schema
|
||||
from rest_framework import status
|
||||
from rest_framework.views import APIView
|
||||
|
||||
from apps.reports.serializers import ReportGenerateSerializer
|
||||
from apps.reports.services.excel import build_report_workbook
|
||||
from apps.reports.services.orchestrator import ReportOrchestrator
|
||||
from apps.reports.services.data_sources import ReportDataSources
|
||||
from apps.reports.services.excel import build_report_workbook, build_report_zip
|
||||
from apps.reports.services.report_builder import (
|
||||
TICKETS_COLUMNS,
|
||||
USERS_COLUMNS,
|
||||
build_ticket_rows,
|
||||
build_user_rows,
|
||||
)
|
||||
|
||||
|
||||
class GenerateReportView(APIView):
|
||||
authentication_classes = []
|
||||
permission_classes = []
|
||||
|
||||
@extend_schema(
|
||||
tags=["Reports"],
|
||||
summary="Generate CRM reports",
|
||||
description=(
|
||||
"Fetches application tickets and related user profiles, then returns a "
|
||||
"ZIP archive containing `users-report.xlsx` and `tickets-report.xlsx`."
|
||||
),
|
||||
request=None,
|
||||
responses={
|
||||
(200, "application/zip"): OpenApiResponse(
|
||||
response=OpenApiTypes.BINARY,
|
||||
description="ZIP archive with users and tickets Excel reports.",
|
||||
),
|
||||
},
|
||||
)
|
||||
def post(self, request):
|
||||
serializer = ReportGenerateSerializer(data=request.data)
|
||||
serializer.is_valid(raise_exception=True)
|
||||
data_sources = ReportDataSources()
|
||||
tickets = data_sources.fetch_application_tickets()
|
||||
users = data_sources.fetch_users_for_tickets(tickets)
|
||||
|
||||
orchestrator = ReportOrchestrator()
|
||||
report_data = orchestrator.generate(serializer.validated_data)
|
||||
workbook = build_report_workbook(
|
||||
title=report_data["title"],
|
||||
columns=report_data["columns"],
|
||||
rows=report_data["rows"],
|
||||
)
|
||||
files = {
|
||||
"users-report.xlsx": build_report_workbook(
|
||||
title="Users Report",
|
||||
columns=USERS_COLUMNS,
|
||||
rows=build_user_rows(users),
|
||||
),
|
||||
"tickets-report.xlsx": build_report_workbook(
|
||||
title="Tickets Report",
|
||||
columns=TICKETS_COLUMNS,
|
||||
rows=build_ticket_rows(tickets),
|
||||
),
|
||||
}
|
||||
|
||||
response = HttpResponse(
|
||||
workbook,
|
||||
content_type=(
|
||||
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
|
||||
),
|
||||
build_report_zip(files),
|
||||
content_type="application/zip",
|
||||
status=status.HTTP_200_OK,
|
||||
)
|
||||
response["Content-Disposition"] = (
|
||||
f'attachment; filename="{report_data["filename"]}"'
|
||||
)
|
||||
response["Content-Disposition"] = 'attachment; filename="crm-reports.zip"'
|
||||
return response
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ DJANGO_APPS = [
|
|||
THIRD_PARTY_APPS = [
|
||||
"corsheaders",
|
||||
"rest_framework",
|
||||
"drf_spectacular",
|
||||
]
|
||||
|
||||
LOCAL_APPS = [
|
||||
|
|
@ -123,6 +124,7 @@ CORS_ALLOW_CREDENTIALS = env.bool("CORS_ALLOW_CREDENTIALS", default=True)
|
|||
|
||||
|
||||
REST_FRAMEWORK = {
|
||||
"DEFAULT_SCHEMA_CLASS": "drf_spectacular.openapi.AutoSchema",
|
||||
"DEFAULT_RENDERER_CLASSES": [
|
||||
"rest_framework.renderers.JSONRenderer",
|
||||
],
|
||||
|
|
@ -148,10 +150,25 @@ REST_FRAMEWORK = {
|
|||
}
|
||||
|
||||
|
||||
SPECTACULAR_SETTINGS = {
|
||||
"TITLE": "CRM Backend API",
|
||||
"DESCRIPTION": "API for CRM report generation and health checks.",
|
||||
"VERSION": "1.0.0",
|
||||
"SERVE_INCLUDE_SCHEMA": False,
|
||||
}
|
||||
|
||||
|
||||
SERVICE_REQUEST_TIMEOUT = env.int("SERVICE_REQUEST_TIMEOUT", default=30)
|
||||
|
||||
OAUTH2_PROVIDER_PUBLIC_URL = env("OAUTH2_PROVIDER_PUBLIC_URL", default="")
|
||||
OAUTH2_PROVIDER_PRIVATE_URL = env("OAUTH2_PROVIDER_PRIVATE_URL", default="")
|
||||
OAUTH2_PROVIDER_BASE_PUBLIC_URL = env("OAUTH2_PROVIDER_BASE_PUBLIC_URL", default="")
|
||||
OAUTH2_PROVIDER_BASE_PRIVATE_URL = env("OAUTH2_PROVIDER_BASE_PRIVATE_URL", default="")
|
||||
OAUTH2_PROVIDER_CLIENT_ID = env("OAUTH2_PROVIDER_CLIENT_ID", default="")
|
||||
OAUTH2_PROVIDER_CLIENT_SECRET = env("OAUTH2_PROVIDER_CLIENT_SECRET", default="")
|
||||
OAUTH2_PROVIDER_SCOPES = env("OAUTH2_PROVIDER_SCOPES", default="")
|
||||
OAUTH2_CLIENT_ID = env("OAUTH2_CLIENT_ID", default="")
|
||||
OAUTH2_CLIENT_SECRET = env("OAUTH2_CLIENT_SECRET", default="")
|
||||
OAUTH2_SCOPES = env("OAUTH2_SCOPES", default="")
|
||||
ADVERTISING_BASE_PUBLIC_URL = env("ADVERTISING_BASE_PUBLIC_URL", default="")
|
||||
ACCOUNTS_BASE_PUBLIC_URL = env("ACCOUNTS_BASE_PUBLIC_URL", default="")
|
||||
|
|
|
|||
|
|
@ -1,9 +1,17 @@
|
|||
from django.contrib import admin
|
||||
from django.urls import include, path
|
||||
from drf_spectacular.views import (
|
||||
SpectacularAPIView,
|
||||
SpectacularRedocView,
|
||||
SpectacularSwaggerView,
|
||||
)
|
||||
|
||||
|
||||
urlpatterns = [
|
||||
path("admin/", admin.site.urls),
|
||||
path("api/schema/", SpectacularAPIView.as_view(), name="schema"),
|
||||
path("api/docs/", SpectacularSwaggerView.as_view(url_name="schema"), name="swagger-ui"),
|
||||
path("api/redoc/", SpectacularRedocView.as_view(url_name="schema"), name="redoc"),
|
||||
path("api/", include("apps.core.urls")),
|
||||
path("api/reports/", include("apps.reports.urls")),
|
||||
]
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
Django>=4.2,<5.0
|
||||
djangorestframework>=3.15,<4.0
|
||||
drf-spectacular>=0.27,<1.0
|
||||
django-environ>=0.11,<1.0
|
||||
django-cors-headers>=4.3,<5.0
|
||||
whitenoise>=6.6,<7.0
|
||||
|
|
@ -7,3 +8,4 @@ psycopg[binary]>=3.1,<4.0
|
|||
requests>=2.32,<3.0
|
||||
urllib3>=1.26,<2.0
|
||||
openpyxl>=3.1,<4.0
|
||||
openapi-python-client
|
||||
|
|
|
|||
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)
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue