new wallet system
This commit is contained in:
parent
68cea34add
commit
419fe24c57
97 changed files with 7508 additions and 1360 deletions
18
apps/promotions/migrations/0004_alter_promotion_state.py
Normal file
18
apps/promotions/migrations/0004_alter_promotion_state.py
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
# Generated by Django 5.1.7 on 2025-11-11 15:24
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('promotions', '0003_alter_recipient_promotion_type'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='promotion',
|
||||
name='state',
|
||||
field=models.IntegerField(choices=[(1, 'created'), (2, 'delayed'), (3, 'pending'), (4, 'incomplete'), (5, 'success'), (6, 'failed'), (7, 'expected_failure')], default=1),
|
||||
),
|
||||
]
|
||||
|
|
@ -19,6 +19,7 @@ from django.utils.translation import gettext_lazy as _
|
|||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class EventSaverQuerySet(models.QuerySet):
|
||||
pass
|
||||
|
||||
|
|
@ -204,7 +205,8 @@ class Recipient(BaseModel):
|
|||
|
||||
def promote(self, plan=None, event=None):
|
||||
recipient = self.get_recipient_uuid(plan, event)
|
||||
if recipient:
|
||||
promotion_amount = self.get_promotion_amount(plan=plan, event=event)
|
||||
if recipient and promotion_amount:
|
||||
with transaction.atomic():
|
||||
promotion_amount = self.get_promotion_amount(plan=plan, event=event)
|
||||
reserved = self.plan.reserve_promotion_amount(promotion_amount)
|
||||
|
|
@ -228,17 +230,22 @@ class Recipient(BaseModel):
|
|||
return None
|
||||
|
||||
|
||||
class PaymentStateChoices(models.IntegerChoices):
|
||||
CREATED = 1, _('created')
|
||||
DELAYED = 2, _('delayed') # delayed as user wish
|
||||
PENDING = 3, _('pending') # wait for external service response (or action)
|
||||
INCOMPLETE = 4, _('incomplete') # started and wait for internal progress to complete
|
||||
SUCCESS = 5, _('success')
|
||||
FAILED = 6, _('failed')
|
||||
EXPECTED_FAILURE = 7, _('expected_failure') # no exact data available but guessed to be failed
|
||||
|
||||
|
||||
class PromotionQuerySet(models.QuerySet):
|
||||
def used(self, user):
|
||||
return self.filter(user=user, state__in=[Promotion.StateChoices.CREATED])
|
||||
return self.filter(user=user, state__in=[Promotion.PaymentStateChoices.CREATED])
|
||||
|
||||
|
||||
class Promotion(BaseModel):
|
||||
class StateChoices(models.IntegerChoices):
|
||||
CREATED = 0, _('Created')
|
||||
ASSIGNED = 1, _('Assigned')
|
||||
PROMOTED = 2, _('Promoted')
|
||||
EXPIRED = 10, _('Expired')
|
||||
|
||||
user_uuid = models.UUIDField() # user_uuid
|
||||
application = models.ForeignKey(oauth2_settings.APPLICATION_MODEL, on_delete=models.PROTECT,
|
||||
|
|
@ -246,7 +253,7 @@ class Promotion(BaseModel):
|
|||
plan = models.ForeignKey(Plan, on_delete=models.PROTECT, related_name='promotions', null=True, blank=True)
|
||||
event = models.ForeignKey(Event, on_delete=models.PROTECT, related_name='promotions', null=True, blank=True)
|
||||
recipient = models.ForeignKey(Recipient, on_delete=models.PROTECT, related_name='promotions', null=True, blank=True)
|
||||
state = models.IntegerField(choices=StateChoices.choices, default=StateChoices.CREATED)
|
||||
state = models.IntegerField(choices=PaymentStateChoices.choices, default=PaymentStateChoices.CREATED)
|
||||
base_amount = models.IntegerField(null=True, blank=True)
|
||||
promotion_amount = models.IntegerField(null=True, blank=True)
|
||||
data = models.JSONField(null=True, blank=True)
|
||||
|
|
@ -275,42 +282,108 @@ class Promotion(BaseModel):
|
|||
raise Exception(error_message)
|
||||
|
||||
def promote(self, **kwargs):
|
||||
self.change_state(from_states=[Promotion.StateChoices.CREATED], to_state=Promotion.StateChoices.ASSIGNED,
|
||||
same_ok=False, raise_exception=True)
|
||||
plan_data = kwargs.get('plan_data', {})
|
||||
plan_data['updated_at'] = timezone.now()
|
||||
# plan_data = {"balance": 0}
|
||||
|
||||
payee_uuid = self.user_uuid
|
||||
logger.debug(f"start promotions: {self}")
|
||||
|
||||
if self.state not in [PaymentStateChoices.CREATED]:
|
||||
raise Exception(_('Cannot promote. not in correct state'))
|
||||
|
||||
if not self.promotion_amount:
|
||||
to_not_payed = self.change_state(
|
||||
from_states=[PaymentStateChoices.CREATED],
|
||||
to_state=PaymentStateChoices.SUCCESS,
|
||||
same_ok=False,
|
||||
raise_exception=True,
|
||||
error_message='Failed to update state',
|
||||
)
|
||||
return bool(to_not_payed)
|
||||
|
||||
to_pending = self.change_state(
|
||||
from_states=[self.state],
|
||||
to_state=PaymentStateChoices.PENDING,
|
||||
same_ok=False,
|
||||
raise_exception=True,
|
||||
error_message='Cannot promote. not in current state'
|
||||
)
|
||||
|
||||
payment_uuid = str(self.uuid)
|
||||
|
||||
data = {
|
||||
"uuid": str(self.uuid),
|
||||
"payee_id": str(payee_uuid),
|
||||
"uuid": payment_uuid,
|
||||
"payee": str(self.user_uuid),
|
||||
"payee_type": 1,
|
||||
"payee_wallet": settings.WALLET,
|
||||
"amount": self.promotion_amount,
|
||||
"details": {
|
||||
'description': _("for promotion"),
|
||||
'reference_id': str(self.uuid),
|
||||
'description': str(_("promotions")),
|
||||
'reference_id': str(self.pk),
|
||||
'application_details_url': ''
|
||||
},
|
||||
}
|
||||
|
||||
submit_response = deposit_to_user_wallet_submit(data)
|
||||
try:
|
||||
submit_response.uuid
|
||||
except Exception as e:
|
||||
logger.exception('Failed to submit payment')
|
||||
raise Exception('Failed to submit payment')
|
||||
submit_response = deposit_to_user_wallet_submit(settings.WALLET_REWARD, data)
|
||||
if not submit_response.uuid:
|
||||
raise Exception('Failed to submit promotion. 1')
|
||||
|
||||
except Exception as e:
|
||||
self.change_state(
|
||||
from_states=[self.state],
|
||||
to_state=PaymentStateChoices.FAILED,
|
||||
same_ok=False,
|
||||
raise_exception=True,
|
||||
error_message='Failed to update state promotions'
|
||||
)
|
||||
# return False
|
||||
raise Exception('Failed to submit promotion. 2')
|
||||
|
||||
verify_response = deposit_to_user_wallet_verify(str(self.uuid))
|
||||
logger.debug(f'verify response: {verify_response}')
|
||||
try:
|
||||
if verify_response.state == 5:
|
||||
self.change_state(from_states=[Promotion.StateChoices.ASSIGNED],
|
||||
to_state=Promotion.StateChoices.PROMOTED)
|
||||
verify_response = deposit_to_user_wallet_verify(settings.WALLET_REWARD, submit_response.uuid)
|
||||
if not verify_response.uuid:
|
||||
raise Exception('Failed to verify promotion. 1')
|
||||
|
||||
except Exception as e:
|
||||
self.change_state(
|
||||
from_states=[self.state],
|
||||
to_state=PaymentStateChoices.EXPECTED_FAILURE,
|
||||
same_ok=False,
|
||||
raise_exception=True,
|
||||
error_message='Failed to update state'
|
||||
)
|
||||
# return False
|
||||
raise Exception('Failed to verify promition. 2')
|
||||
|
||||
if verify_response.state != 5:
|
||||
to_pay_failed = self.change_state(
|
||||
from_states=[self.state],
|
||||
to_state=PaymentStateChoices.FAILED,
|
||||
same_ok=False,
|
||||
raise_exception=True,
|
||||
error_message='Failed to update state payment',
|
||||
)
|
||||
return False
|
||||
|
||||
with transaction.atomic():
|
||||
updated = Plan.objects.filter(pk=self.plan).update(balance=F('balance') - self.promotion_amount, **plan_data)
|
||||
if updated:
|
||||
to_pay_success = self.change_state(
|
||||
from_states=[self.state],
|
||||
to_state=PaymentStateChoices.SUCCESS,
|
||||
same_ok=False,
|
||||
raise_exception=True,
|
||||
error_message='Failed to update state refund',
|
||||
)
|
||||
return bool(to_pay_success)
|
||||
else:
|
||||
logger.debug('Failed to verify payment')
|
||||
raise Exception('Failed to verify payment')
|
||||
|
||||
except Exception as e:
|
||||
logger.exception('Failed to verify payment')
|
||||
raise Exception('Failed to verify payment')
|
||||
|
||||
|
||||
# TODO: is it possible?
|
||||
to_pay_failed = self.change_state(
|
||||
from_states=[self.state],
|
||||
to_state=PaymentStateChoices.EXPECTED_FAILURE,
|
||||
same_ok=False,
|
||||
raise_exception=True,
|
||||
error_message='Failed to update state payment',
|
||||
)
|
||||
return False
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ from utils.router import ProfileRouter
|
|||
from . import views
|
||||
from django.urls import NoReverseMatch, path, re_path, include
|
||||
|
||||
from .views import ApplicationPromoteUserApiView, ApplicationEventSubmitAPIView, ApplicationEventRetrieveAPIView, ApplicationPromotionRetrieveApiView
|
||||
from .views import ApplicationPromoteUserApiView, ApplicationEventSubmitAPIView, ApplicationEventRetrieveAPIView, ApplicationPromotionListApiView
|
||||
|
||||
app_name = 'promotions'
|
||||
|
||||
|
|
@ -18,7 +18,7 @@ router.register(r'plans', views.UserViewSet, basename='user')
|
|||
|
||||
urlpatterns = [
|
||||
path('api/v1/plans/<plan>/', ApplicationPromoteUserApiView.as_view(), name='promotion-create'),
|
||||
path('api/v1/plans/<plan>/promotins', ApplicationPromotionRetrieveApiView.as_view(), name='promotion-list'),
|
||||
path('api/v1/plans/<plan>/promotins', ApplicationPromotionListApiView.as_view(), name='promotion-list'),
|
||||
path('api/v1/events/submit', ApplicationEventSubmitAPIView.as_view(), name='event-create'),
|
||||
path('api/v1/events/get', ApplicationEventRetrieveAPIView.as_view(), name='event-retrieve'),
|
||||
path('api/v1/', include(router.urls), name='events'),
|
||||
|
|
|
|||
|
|
@ -178,7 +178,7 @@ class ApplicationPromoteUserApiView(CreateAPIView):
|
|||
headers = self.get_success_headers(serializer.data)
|
||||
return Response(serializer.data, status=status.HTTP_201_CREATED, headers=headers)
|
||||
|
||||
class ApplicationPromotionRetrieveApiView(RetrieveAPIView):
|
||||
class ApplicationPromotionListApiView(ListAPIView):
|
||||
model = Promotion
|
||||
serializer_class = PromotionSerializer
|
||||
|
||||
|
|
@ -187,11 +187,11 @@ class ApplicationPromotionRetrieveApiView(RetrieveAPIView):
|
|||
plan = get_object_or_404(Plan, uuid=plan_uuid)
|
||||
return plan
|
||||
|
||||
def get_object(self):
|
||||
def get_queryset(self):
|
||||
user = self.request.user
|
||||
plan = self.get_plan()
|
||||
qs = Promotion.objects.all()
|
||||
return get_object_or_404(qs, user_uuid=user.uuid, plan=plan)
|
||||
qs = Promotion.objects.filter(user_uuid=user.uuid, plan=plan)
|
||||
return qs
|
||||
|
||||
|
||||
# def create(self, request, *args, **kwargs):
|
||||
|
|
|
|||
|
|
@ -1,27 +0,0 @@
|
|||
"""Contains all the data models used in inputs/outputs"""
|
||||
|
||||
from .application_balance import ApplicationBalance
|
||||
from .application_deposit import ApplicationDeposit
|
||||
from .application_transaction import ApplicationTransaction
|
||||
from .application_withdraw import ApplicationWithdraw
|
||||
from .my_wallet import MyWallet
|
||||
from .paginated_application_transaction_list import PaginatedApplicationTransactionList
|
||||
from .paginated_user_transaction_list import PaginatedUserTransactionList
|
||||
from .payee_type_enum import PayeeTypeEnum
|
||||
from .payer_type_enum import PayerTypeEnum
|
||||
from .state_enum import StateEnum
|
||||
from .user_transaction import UserTransaction
|
||||
|
||||
__all__ = (
|
||||
"ApplicationBalance",
|
||||
"ApplicationDeposit",
|
||||
"ApplicationTransaction",
|
||||
"ApplicationWithdraw",
|
||||
"MyWallet",
|
||||
"PaginatedApplicationTransactionList",
|
||||
"PaginatedUserTransactionList",
|
||||
"PayeeTypeEnum",
|
||||
"PayerTypeEnum",
|
||||
"StateEnum",
|
||||
"UserTransaction",
|
||||
)
|
||||
|
|
@ -1,235 +0,0 @@
|
|||
import datetime
|
||||
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 dateutil.parser import isoparse
|
||||
|
||||
from ..models.payee_type_enum import PayeeTypeEnum
|
||||
from ..models.payer_type_enum import PayerTypeEnum
|
||||
from ..models.state_enum import StateEnum
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
T = TypeVar("T", bound="ApplicationDeposit")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class ApplicationDeposit:
|
||||
"""
|
||||
Attributes:
|
||||
uuid (UUID):
|
||||
payer_id (Union[None, UUID]):
|
||||
payer_type (Union[None, PayerTypeEnum]):
|
||||
payee_id (UUID):
|
||||
created_at (Union[None, datetime.datetime]):
|
||||
state (StateEnum): * `1` - created
|
||||
* `2` - delayed
|
||||
* `3` - pending
|
||||
* `4` - incomplete
|
||||
* `5` - success
|
||||
* `6` - failed
|
||||
* `7` - expected_failure
|
||||
amount (int):
|
||||
updated_at (Union[None, datetime.datetime]):
|
||||
payee_type (Union[None, PayeeTypeEnum, Unset]):
|
||||
details (Union[Unset, Any]):
|
||||
"""
|
||||
|
||||
uuid: UUID
|
||||
payer_id: Union[None, UUID]
|
||||
payer_type: Union[None, PayerTypeEnum]
|
||||
payee_id: UUID
|
||||
created_at: Union[None, datetime.datetime]
|
||||
state: StateEnum
|
||||
amount: int
|
||||
updated_at: Union[None, datetime.datetime]
|
||||
payee_type: Union[None, PayeeTypeEnum, Unset] = UNSET
|
||||
details: Union[Unset, Any] = UNSET
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
uuid = str(self.uuid)
|
||||
|
||||
payer_id: Union[None, str]
|
||||
if isinstance(self.payer_id, UUID):
|
||||
payer_id = str(self.payer_id)
|
||||
else:
|
||||
payer_id = self.payer_id
|
||||
|
||||
payer_type: Union[None, int]
|
||||
if isinstance(self.payer_type, PayerTypeEnum):
|
||||
payer_type = self.payer_type.value
|
||||
else:
|
||||
payer_type = self.payer_type
|
||||
|
||||
payee_id = str(self.payee_id)
|
||||
|
||||
created_at: Union[None, str]
|
||||
if isinstance(self.created_at, datetime.datetime):
|
||||
created_at = self.created_at.isoformat()
|
||||
else:
|
||||
created_at = self.created_at
|
||||
|
||||
state = self.state.value
|
||||
|
||||
amount = self.amount
|
||||
|
||||
updated_at: Union[None, str]
|
||||
if isinstance(self.updated_at, datetime.datetime):
|
||||
updated_at = self.updated_at.isoformat()
|
||||
else:
|
||||
updated_at = self.updated_at
|
||||
|
||||
payee_type: Union[None, Unset, int]
|
||||
if isinstance(self.payee_type, Unset):
|
||||
payee_type = UNSET
|
||||
elif isinstance(self.payee_type, PayeeTypeEnum):
|
||||
payee_type = self.payee_type.value
|
||||
else:
|
||||
payee_type = self.payee_type
|
||||
|
||||
details = self.details
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update(
|
||||
{
|
||||
"uuid": uuid,
|
||||
"payer_id": payer_id,
|
||||
"payer_type": payer_type,
|
||||
"payee_id": payee_id,
|
||||
"created_at": created_at,
|
||||
"state": state,
|
||||
"amount": amount,
|
||||
"updated_at": updated_at,
|
||||
}
|
||||
)
|
||||
if payee_type is not UNSET:
|
||||
field_dict["payee_type"] = payee_type
|
||||
if details is not UNSET:
|
||||
field_dict["details"] = details
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
|
||||
d = src_dict.copy()
|
||||
uuid = UUID(d.pop("uuid"))
|
||||
|
||||
def _parse_payer_id(data: object) -> Union[None, UUID]:
|
||||
if data is None:
|
||||
return data
|
||||
try:
|
||||
if not isinstance(data, str):
|
||||
raise TypeError()
|
||||
payer_id_type_0 = UUID(data)
|
||||
|
||||
return payer_id_type_0
|
||||
except: # noqa: E722
|
||||
pass
|
||||
return cast(Union[None, UUID], data)
|
||||
|
||||
payer_id = _parse_payer_id(d.pop("payer_id"))
|
||||
|
||||
def _parse_payer_type(data: object) -> Union[None, PayerTypeEnum]:
|
||||
if data is None:
|
||||
return data
|
||||
try:
|
||||
if not isinstance(data, int):
|
||||
raise TypeError()
|
||||
payer_type_type_0 = PayerTypeEnum(data)
|
||||
|
||||
return payer_type_type_0
|
||||
except: # noqa: E722
|
||||
pass
|
||||
return cast(Union[None, PayerTypeEnum], data)
|
||||
|
||||
payer_type = _parse_payer_type(d.pop("payer_type"))
|
||||
|
||||
payee_id = UUID(d.pop("payee_id"))
|
||||
|
||||
def _parse_created_at(data: object) -> Union[None, datetime.datetime]:
|
||||
if data is None:
|
||||
return data
|
||||
try:
|
||||
if not isinstance(data, str):
|
||||
raise TypeError()
|
||||
created_at_type_0 = isoparse(data)
|
||||
|
||||
return created_at_type_0
|
||||
except: # noqa: E722
|
||||
pass
|
||||
return cast(Union[None, datetime.datetime], data)
|
||||
|
||||
created_at = _parse_created_at(d.pop("created_at"))
|
||||
|
||||
state = StateEnum(d.pop("state"))
|
||||
|
||||
amount = d.pop("amount")
|
||||
|
||||
def _parse_updated_at(data: object) -> Union[None, datetime.datetime]:
|
||||
if data is None:
|
||||
return data
|
||||
try:
|
||||
if not isinstance(data, str):
|
||||
raise TypeError()
|
||||
updated_at_type_0 = isoparse(data)
|
||||
|
||||
return updated_at_type_0
|
||||
except: # noqa: E722
|
||||
pass
|
||||
return cast(Union[None, datetime.datetime], data)
|
||||
|
||||
updated_at = _parse_updated_at(d.pop("updated_at"))
|
||||
|
||||
def _parse_payee_type(data: object) -> Union[None, PayeeTypeEnum, Unset]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
try:
|
||||
if not isinstance(data, int):
|
||||
raise TypeError()
|
||||
payee_type_type_0 = PayeeTypeEnum(data)
|
||||
|
||||
return payee_type_type_0
|
||||
except: # noqa: E722
|
||||
pass
|
||||
return cast(Union[None, PayeeTypeEnum, Unset], data)
|
||||
|
||||
payee_type = _parse_payee_type(d.pop("payee_type", UNSET))
|
||||
|
||||
details = d.pop("details", UNSET)
|
||||
|
||||
application_deposit = cls(
|
||||
uuid=uuid,
|
||||
payer_id=payer_id,
|
||||
payer_type=payer_type,
|
||||
payee_id=payee_id,
|
||||
created_at=created_at,
|
||||
state=state,
|
||||
amount=amount,
|
||||
updated_at=updated_at,
|
||||
payee_type=payee_type,
|
||||
details=details,
|
||||
)
|
||||
|
||||
application_deposit.additional_properties = d
|
||||
return application_deposit
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
|
|
@ -1,238 +0,0 @@
|
|||
import datetime
|
||||
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 dateutil.parser import isoparse
|
||||
|
||||
from ..models.payer_type_enum import PayerTypeEnum
|
||||
from ..models.state_enum import StateEnum
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
T = TypeVar("T", bound="ApplicationTransaction")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class ApplicationTransaction:
|
||||
"""
|
||||
Attributes:
|
||||
uuid (UUID):
|
||||
payee_id (UUID):
|
||||
payee_type (UUID):
|
||||
created_at (Union[None, datetime.datetime]):
|
||||
state (StateEnum): * `1` - created
|
||||
* `2` - delayed
|
||||
* `3` - pending
|
||||
* `4` - incomplete
|
||||
* `5` - success
|
||||
* `6` - failed
|
||||
* `7` - expected_failure
|
||||
amount (int):
|
||||
updated_at (Union[None, datetime.datetime]):
|
||||
details (Any):
|
||||
role (str):
|
||||
payer_id (Union[None, UUID, Unset]):
|
||||
payer_type (Union[None, PayerTypeEnum, Unset]):
|
||||
delay (Union[Unset, int]):
|
||||
"""
|
||||
|
||||
uuid: UUID
|
||||
payee_id: UUID
|
||||
payee_type: UUID
|
||||
created_at: Union[None, datetime.datetime]
|
||||
state: StateEnum
|
||||
amount: int
|
||||
updated_at: Union[None, datetime.datetime]
|
||||
details: Any
|
||||
role: str
|
||||
payer_id: Union[None, UUID, Unset] = UNSET
|
||||
payer_type: Union[None, PayerTypeEnum, Unset] = UNSET
|
||||
delay: Union[Unset, int] = UNSET
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
uuid = str(self.uuid)
|
||||
|
||||
payee_id = str(self.payee_id)
|
||||
|
||||
payee_type = str(self.payee_type)
|
||||
|
||||
created_at: Union[None, str]
|
||||
if isinstance(self.created_at, datetime.datetime):
|
||||
created_at = self.created_at.isoformat()
|
||||
else:
|
||||
created_at = self.created_at
|
||||
|
||||
state = self.state.value
|
||||
|
||||
amount = self.amount
|
||||
|
||||
updated_at: Union[None, str]
|
||||
if isinstance(self.updated_at, datetime.datetime):
|
||||
updated_at = self.updated_at.isoformat()
|
||||
else:
|
||||
updated_at = self.updated_at
|
||||
|
||||
details = self.details
|
||||
|
||||
role = self.role
|
||||
|
||||
payer_id: Union[None, Unset, str]
|
||||
if isinstance(self.payer_id, Unset):
|
||||
payer_id = UNSET
|
||||
elif isinstance(self.payer_id, UUID):
|
||||
payer_id = str(self.payer_id)
|
||||
else:
|
||||
payer_id = self.payer_id
|
||||
|
||||
payer_type: Union[None, Unset, int]
|
||||
if isinstance(self.payer_type, Unset):
|
||||
payer_type = UNSET
|
||||
elif isinstance(self.payer_type, PayerTypeEnum):
|
||||
payer_type = self.payer_type.value
|
||||
else:
|
||||
payer_type = self.payer_type
|
||||
|
||||
delay = self.delay
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update(
|
||||
{
|
||||
"uuid": uuid,
|
||||
"payee_id": payee_id,
|
||||
"payee_type": payee_type,
|
||||
"created_at": created_at,
|
||||
"state": state,
|
||||
"amount": amount,
|
||||
"updated_at": updated_at,
|
||||
"details": details,
|
||||
"role": role,
|
||||
}
|
||||
)
|
||||
if payer_id is not UNSET:
|
||||
field_dict["payer_id"] = payer_id
|
||||
if payer_type is not UNSET:
|
||||
field_dict["payer_type"] = payer_type
|
||||
if delay is not UNSET:
|
||||
field_dict["delay"] = delay
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
|
||||
d = src_dict.copy()
|
||||
uuid = UUID(d.pop("uuid"))
|
||||
|
||||
payee_id = UUID(d.pop("payee_id"))
|
||||
|
||||
payee_type = UUID(d.pop("payee_type"))
|
||||
|
||||
def _parse_created_at(data: object) -> Union[None, datetime.datetime]:
|
||||
if data is None:
|
||||
return data
|
||||
try:
|
||||
if not isinstance(data, str):
|
||||
raise TypeError()
|
||||
created_at_type_0 = isoparse(data)
|
||||
|
||||
return created_at_type_0
|
||||
except: # noqa: E722
|
||||
pass
|
||||
return cast(Union[None, datetime.datetime], data)
|
||||
|
||||
created_at = _parse_created_at(d.pop("created_at"))
|
||||
|
||||
state = StateEnum(d.pop("state"))
|
||||
|
||||
amount = d.pop("amount")
|
||||
|
||||
def _parse_updated_at(data: object) -> Union[None, datetime.datetime]:
|
||||
if data is None:
|
||||
return data
|
||||
try:
|
||||
if not isinstance(data, str):
|
||||
raise TypeError()
|
||||
updated_at_type_0 = isoparse(data)
|
||||
|
||||
return updated_at_type_0
|
||||
except: # noqa: E722
|
||||
pass
|
||||
return cast(Union[None, datetime.datetime], data)
|
||||
|
||||
updated_at = _parse_updated_at(d.pop("updated_at"))
|
||||
|
||||
details = d.pop("details")
|
||||
|
||||
role = d.pop("role")
|
||||
|
||||
def _parse_payer_id(data: object) -> Union[None, UUID, Unset]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
try:
|
||||
if not isinstance(data, str):
|
||||
raise TypeError()
|
||||
payer_id_type_0 = UUID(data)
|
||||
|
||||
return payer_id_type_0
|
||||
except: # noqa: E722
|
||||
pass
|
||||
return cast(Union[None, UUID, Unset], data)
|
||||
|
||||
payer_id = _parse_payer_id(d.pop("payer_id", UNSET))
|
||||
|
||||
def _parse_payer_type(data: object) -> Union[None, PayerTypeEnum, Unset]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
try:
|
||||
if not isinstance(data, int):
|
||||
raise TypeError()
|
||||
payer_type_type_0 = PayerTypeEnum(data)
|
||||
|
||||
return payer_type_type_0
|
||||
except: # noqa: E722
|
||||
pass
|
||||
return cast(Union[None, PayerTypeEnum, Unset], data)
|
||||
|
||||
payer_type = _parse_payer_type(d.pop("payer_type", UNSET))
|
||||
|
||||
delay = d.pop("delay", UNSET)
|
||||
|
||||
application_transaction = cls(
|
||||
uuid=uuid,
|
||||
payee_id=payee_id,
|
||||
payee_type=payee_type,
|
||||
created_at=created_at,
|
||||
state=state,
|
||||
amount=amount,
|
||||
updated_at=updated_at,
|
||||
details=details,
|
||||
role=role,
|
||||
payer_id=payer_id,
|
||||
payer_type=payer_type,
|
||||
delay=delay,
|
||||
)
|
||||
|
||||
application_transaction.additional_properties = d
|
||||
return application_transaction
|
||||
|
||||
@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
|
||||
|
|
@ -1,239 +0,0 @@
|
|||
import datetime
|
||||
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 dateutil.parser import isoparse
|
||||
|
||||
from ..models.payee_type_enum import PayeeTypeEnum
|
||||
from ..models.payer_type_enum import PayerTypeEnum
|
||||
from ..models.state_enum import StateEnum
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
T = TypeVar("T", bound="ApplicationWithdraw")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class ApplicationWithdraw:
|
||||
"""
|
||||
Attributes:
|
||||
uuid (UUID):
|
||||
payee_id (UUID):
|
||||
payee_type (Union[None, PayeeTypeEnum]):
|
||||
created_at (Union[None, datetime.datetime]):
|
||||
state (StateEnum): * `1` - created
|
||||
* `2` - delayed
|
||||
* `3` - pending
|
||||
* `4` - incomplete
|
||||
* `5` - success
|
||||
* `6` - failed
|
||||
* `7` - expected_failure
|
||||
amount (int):
|
||||
updated_at (Union[None, datetime.datetime]):
|
||||
details (Any):
|
||||
payer_id (Union[None, UUID, Unset]):
|
||||
payer_type (Union[None, PayerTypeEnum, Unset]):
|
||||
"""
|
||||
|
||||
uuid: UUID
|
||||
payee_id: UUID
|
||||
payee_type: Union[None, PayeeTypeEnum]
|
||||
created_at: Union[None, datetime.datetime]
|
||||
state: StateEnum
|
||||
amount: int
|
||||
updated_at: Union[None, datetime.datetime]
|
||||
details: Any
|
||||
payer_id: Union[None, UUID, Unset] = UNSET
|
||||
payer_type: Union[None, PayerTypeEnum, Unset] = UNSET
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
uuid = str(self.uuid)
|
||||
|
||||
payee_id = str(self.payee_id)
|
||||
|
||||
payee_type: Union[None, int]
|
||||
if isinstance(self.payee_type, PayeeTypeEnum):
|
||||
payee_type = self.payee_type.value
|
||||
else:
|
||||
payee_type = self.payee_type
|
||||
|
||||
created_at: Union[None, str]
|
||||
if isinstance(self.created_at, datetime.datetime):
|
||||
created_at = self.created_at.isoformat()
|
||||
else:
|
||||
created_at = self.created_at
|
||||
|
||||
state = self.state.value
|
||||
|
||||
amount = self.amount
|
||||
|
||||
updated_at: Union[None, str]
|
||||
if isinstance(self.updated_at, datetime.datetime):
|
||||
updated_at = self.updated_at.isoformat()
|
||||
else:
|
||||
updated_at = self.updated_at
|
||||
|
||||
details = self.details
|
||||
|
||||
payer_id: Union[None, Unset, str]
|
||||
if isinstance(self.payer_id, Unset):
|
||||
payer_id = UNSET
|
||||
elif isinstance(self.payer_id, UUID):
|
||||
payer_id = str(self.payer_id)
|
||||
else:
|
||||
payer_id = self.payer_id
|
||||
|
||||
payer_type: Union[None, Unset, int]
|
||||
if isinstance(self.payer_type, Unset):
|
||||
payer_type = UNSET
|
||||
elif isinstance(self.payer_type, PayerTypeEnum):
|
||||
payer_type = self.payer_type.value
|
||||
else:
|
||||
payer_type = self.payer_type
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update(
|
||||
{
|
||||
"uuid": uuid,
|
||||
"payee_id": payee_id,
|
||||
"payee_type": payee_type,
|
||||
"created_at": created_at,
|
||||
"state": state,
|
||||
"amount": amount,
|
||||
"updated_at": updated_at,
|
||||
"details": details,
|
||||
}
|
||||
)
|
||||
if payer_id is not UNSET:
|
||||
field_dict["payer_id"] = payer_id
|
||||
if payer_type is not UNSET:
|
||||
field_dict["payer_type"] = payer_type
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
|
||||
d = src_dict.copy()
|
||||
uuid = UUID(d.pop("uuid"))
|
||||
|
||||
payee_id = UUID(d.pop("payee_id"))
|
||||
|
||||
def _parse_payee_type(data: object) -> Union[None, PayeeTypeEnum]:
|
||||
if data is None:
|
||||
return data
|
||||
try:
|
||||
if not isinstance(data, int):
|
||||
raise TypeError()
|
||||
payee_type_type_0 = PayeeTypeEnum(data)
|
||||
|
||||
return payee_type_type_0
|
||||
except: # noqa: E722
|
||||
pass
|
||||
return cast(Union[None, PayeeTypeEnum], data)
|
||||
|
||||
payee_type = _parse_payee_type(d.pop("payee_type"))
|
||||
|
||||
def _parse_created_at(data: object) -> Union[None, datetime.datetime]:
|
||||
if data is None:
|
||||
return data
|
||||
try:
|
||||
if not isinstance(data, str):
|
||||
raise TypeError()
|
||||
created_at_type_0 = isoparse(data)
|
||||
|
||||
return created_at_type_0
|
||||
except: # noqa: E722
|
||||
pass
|
||||
return cast(Union[None, datetime.datetime], data)
|
||||
|
||||
created_at = _parse_created_at(d.pop("created_at"))
|
||||
|
||||
state = StateEnum(d.pop("state"))
|
||||
|
||||
amount = d.pop("amount")
|
||||
|
||||
def _parse_updated_at(data: object) -> Union[None, datetime.datetime]:
|
||||
if data is None:
|
||||
return data
|
||||
try:
|
||||
if not isinstance(data, str):
|
||||
raise TypeError()
|
||||
updated_at_type_0 = isoparse(data)
|
||||
|
||||
return updated_at_type_0
|
||||
except: # noqa: E722
|
||||
pass
|
||||
return cast(Union[None, datetime.datetime], data)
|
||||
|
||||
updated_at = _parse_updated_at(d.pop("updated_at"))
|
||||
|
||||
details = d.pop("details")
|
||||
|
||||
def _parse_payer_id(data: object) -> Union[None, UUID, Unset]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
try:
|
||||
if not isinstance(data, str):
|
||||
raise TypeError()
|
||||
payer_id_type_0 = UUID(data)
|
||||
|
||||
return payer_id_type_0
|
||||
except: # noqa: E722
|
||||
pass
|
||||
return cast(Union[None, UUID, Unset], data)
|
||||
|
||||
payer_id = _parse_payer_id(d.pop("payer_id", UNSET))
|
||||
|
||||
def _parse_payer_type(data: object) -> Union[None, PayerTypeEnum, Unset]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
try:
|
||||
if not isinstance(data, int):
|
||||
raise TypeError()
|
||||
payer_type_type_0 = PayerTypeEnum(data)
|
||||
|
||||
return payer_type_type_0
|
||||
except: # noqa: E722
|
||||
pass
|
||||
return cast(Union[None, PayerTypeEnum, Unset], data)
|
||||
|
||||
payer_type = _parse_payer_type(d.pop("payer_type", UNSET))
|
||||
|
||||
application_withdraw = cls(
|
||||
uuid=uuid,
|
||||
payee_id=payee_id,
|
||||
payee_type=payee_type,
|
||||
created_at=created_at,
|
||||
state=state,
|
||||
amount=amount,
|
||||
updated_at=updated_at,
|
||||
details=details,
|
||||
payer_id=payer_id,
|
||||
payer_type=payer_type,
|
||||
)
|
||||
|
||||
application_withdraw.additional_properties = d
|
||||
return application_withdraw
|
||||
|
||||
@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
|
||||
|
|
@ -1,58 +0,0 @@
|
|||
from typing import Any, TypeVar, Union
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
T = TypeVar("T", bound="MyWallet")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class MyWallet:
|
||||
"""
|
||||
Attributes:
|
||||
balance (Union[Unset, int]):
|
||||
"""
|
||||
|
||||
balance: Union[Unset, int] = UNSET
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
balance = self.balance
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update({})
|
||||
if balance is not UNSET:
|
||||
field_dict["balance"] = balance
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
|
||||
d = src_dict.copy()
|
||||
balance = d.pop("balance", UNSET)
|
||||
|
||||
my_wallet = cls(
|
||||
balance=balance,
|
||||
)
|
||||
|
||||
my_wallet.additional_properties = d
|
||||
return my_wallet
|
||||
|
||||
@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
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
from enum import IntEnum
|
||||
|
||||
|
||||
class PayeeTypeEnum(IntEnum):
|
||||
VALUE_1 = 1
|
||||
VALUE_2 = 2
|
||||
|
||||
def __str__(self) -> str:
|
||||
return str(self.value)
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
from enum import IntEnum
|
||||
|
||||
|
||||
class PayerTypeEnum(IntEnum):
|
||||
VALUE_1 = 1
|
||||
VALUE_2 = 2
|
||||
|
||||
def __str__(self) -> str:
|
||||
return str(self.value)
|
||||
|
|
@ -1,238 +0,0 @@
|
|||
import datetime
|
||||
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 dateutil.parser import isoparse
|
||||
|
||||
from ..models.payer_type_enum import PayerTypeEnum
|
||||
from ..models.state_enum import StateEnum
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
T = TypeVar("T", bound="UserTransaction")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class UserTransaction:
|
||||
"""
|
||||
Attributes:
|
||||
uuid (UUID):
|
||||
payee_id (UUID):
|
||||
payee_type (UUID):
|
||||
created_at (Union[None, datetime.datetime]):
|
||||
state (StateEnum): * `1` - created
|
||||
* `2` - delayed
|
||||
* `3` - pending
|
||||
* `4` - incomplete
|
||||
* `5` - success
|
||||
* `6` - failed
|
||||
* `7` - expected_failure
|
||||
amount (int):
|
||||
updated_at (Union[None, datetime.datetime]):
|
||||
details (Any):
|
||||
role (int):
|
||||
payer_id (Union[None, UUID, Unset]):
|
||||
payer_type (Union[None, PayerTypeEnum, Unset]):
|
||||
delay (Union[Unset, int]):
|
||||
"""
|
||||
|
||||
uuid: UUID
|
||||
payee_id: UUID
|
||||
payee_type: UUID
|
||||
created_at: Union[None, datetime.datetime]
|
||||
state: StateEnum
|
||||
amount: int
|
||||
updated_at: Union[None, datetime.datetime]
|
||||
details: Any
|
||||
role: int
|
||||
payer_id: Union[None, UUID, Unset] = UNSET
|
||||
payer_type: Union[None, PayerTypeEnum, Unset] = UNSET
|
||||
delay: Union[Unset, int] = UNSET
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
uuid = str(self.uuid)
|
||||
|
||||
payee_id = str(self.payee_id)
|
||||
|
||||
payee_type = str(self.payee_type)
|
||||
|
||||
created_at: Union[None, str]
|
||||
if isinstance(self.created_at, datetime.datetime):
|
||||
created_at = self.created_at.isoformat()
|
||||
else:
|
||||
created_at = self.created_at
|
||||
|
||||
state = self.state.value
|
||||
|
||||
amount = self.amount
|
||||
|
||||
updated_at: Union[None, str]
|
||||
if isinstance(self.updated_at, datetime.datetime):
|
||||
updated_at = self.updated_at.isoformat()
|
||||
else:
|
||||
updated_at = self.updated_at
|
||||
|
||||
details = self.details
|
||||
|
||||
role = self.role
|
||||
|
||||
payer_id: Union[None, Unset, str]
|
||||
if isinstance(self.payer_id, Unset):
|
||||
payer_id = UNSET
|
||||
elif isinstance(self.payer_id, UUID):
|
||||
payer_id = str(self.payer_id)
|
||||
else:
|
||||
payer_id = self.payer_id
|
||||
|
||||
payer_type: Union[None, Unset, int]
|
||||
if isinstance(self.payer_type, Unset):
|
||||
payer_type = UNSET
|
||||
elif isinstance(self.payer_type, PayerTypeEnum):
|
||||
payer_type = self.payer_type.value
|
||||
else:
|
||||
payer_type = self.payer_type
|
||||
|
||||
delay = self.delay
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update(
|
||||
{
|
||||
"uuid": uuid,
|
||||
"payee_id": payee_id,
|
||||
"payee_type": payee_type,
|
||||
"created_at": created_at,
|
||||
"state": state,
|
||||
"amount": amount,
|
||||
"updated_at": updated_at,
|
||||
"details": details,
|
||||
"role": role,
|
||||
}
|
||||
)
|
||||
if payer_id is not UNSET:
|
||||
field_dict["payer_id"] = payer_id
|
||||
if payer_type is not UNSET:
|
||||
field_dict["payer_type"] = payer_type
|
||||
if delay is not UNSET:
|
||||
field_dict["delay"] = delay
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
|
||||
d = src_dict.copy()
|
||||
uuid = UUID(d.pop("uuid"))
|
||||
|
||||
payee_id = UUID(d.pop("payee_id"))
|
||||
|
||||
payee_type = UUID(d.pop("payee_type"))
|
||||
|
||||
def _parse_created_at(data: object) -> Union[None, datetime.datetime]:
|
||||
if data is None:
|
||||
return data
|
||||
try:
|
||||
if not isinstance(data, str):
|
||||
raise TypeError()
|
||||
created_at_type_0 = isoparse(data)
|
||||
|
||||
return created_at_type_0
|
||||
except: # noqa: E722
|
||||
pass
|
||||
return cast(Union[None, datetime.datetime], data)
|
||||
|
||||
created_at = _parse_created_at(d.pop("created_at"))
|
||||
|
||||
state = StateEnum(d.pop("state"))
|
||||
|
||||
amount = d.pop("amount")
|
||||
|
||||
def _parse_updated_at(data: object) -> Union[None, datetime.datetime]:
|
||||
if data is None:
|
||||
return data
|
||||
try:
|
||||
if not isinstance(data, str):
|
||||
raise TypeError()
|
||||
updated_at_type_0 = isoparse(data)
|
||||
|
||||
return updated_at_type_0
|
||||
except: # noqa: E722
|
||||
pass
|
||||
return cast(Union[None, datetime.datetime], data)
|
||||
|
||||
updated_at = _parse_updated_at(d.pop("updated_at"))
|
||||
|
||||
details = d.pop("details")
|
||||
|
||||
role = d.pop("role")
|
||||
|
||||
def _parse_payer_id(data: object) -> Union[None, UUID, Unset]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
try:
|
||||
if not isinstance(data, str):
|
||||
raise TypeError()
|
||||
payer_id_type_0 = UUID(data)
|
||||
|
||||
return payer_id_type_0
|
||||
except: # noqa: E722
|
||||
pass
|
||||
return cast(Union[None, UUID, Unset], data)
|
||||
|
||||
payer_id = _parse_payer_id(d.pop("payer_id", UNSET))
|
||||
|
||||
def _parse_payer_type(data: object) -> Union[None, PayerTypeEnum, Unset]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
try:
|
||||
if not isinstance(data, int):
|
||||
raise TypeError()
|
||||
payer_type_type_0 = PayerTypeEnum(data)
|
||||
|
||||
return payer_type_type_0
|
||||
except: # noqa: E722
|
||||
pass
|
||||
return cast(Union[None, PayerTypeEnum, Unset], data)
|
||||
|
||||
payer_type = _parse_payer_type(d.pop("payer_type", UNSET))
|
||||
|
||||
delay = d.pop("delay", UNSET)
|
||||
|
||||
user_transaction = cls(
|
||||
uuid=uuid,
|
||||
payee_id=payee_id,
|
||||
payee_type=payee_type,
|
||||
created_at=created_at,
|
||||
state=state,
|
||||
amount=amount,
|
||||
updated_at=updated_at,
|
||||
details=details,
|
||||
role=role,
|
||||
payer_id=payer_id,
|
||||
payer_type=payer_type,
|
||||
delay=delay,
|
||||
)
|
||||
|
||||
user_transaction.additional_properties = d
|
||||
return user_transaction
|
||||
|
||||
@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
|
||||
|
|
@ -372,5 +372,6 @@ CELERY_TASK_TIME_LIMIT = 30 * 60
|
|||
CELERY_BROKER_URL = REDIS_BASE_URL
|
||||
CELERY_RESULT_BACKEND = REDIS_BASE_URL
|
||||
|
||||
WALLET_SERVICE_CATEGORY_UUID = config('WALLET_SERVICE_CATEGORY_UUID', '') # TODO: better naming
|
||||
WALLET_PROMOTION_CATEGORY_UUID = config('WALLET_PROMOTION_CATEGORY_UUID', '') # TODO: may be configurable
|
||||
WALLET_BASE_PUBLIC_URL = config('WALLET_BASE_PUBLIC_URL', default=None, cast=str)
|
||||
WALLET_RIAL = config('WALLET_RIAL', cast=str)
|
||||
WALLET_REWARD = config('WALLET_REWARD', cast=str)
|
||||
|
|
|
|||
8
utils/clients/gooyal_accounts_client/__init__.py
Normal file
8
utils/clients/gooyal_accounts_client/__init__.py
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
"""A client library for accessing Gooyal Accounts"""
|
||||
|
||||
from .client import AuthenticatedClient, Client
|
||||
|
||||
__all__ = (
|
||||
"AuthenticatedClient",
|
||||
"Client",
|
||||
)
|
||||
|
|
@ -0,0 +1 @@
|
|||
"""Contains endpoint functions for accessing the API"""
|
||||
|
|
@ -0,0 +1,142 @@
|
|||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.application import Application
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
id: str,
|
||||
) -> dict[str, Any]:
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "get",
|
||||
"url": f"/oauth2/apis/applications/{id}/avatar/",
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Application]:
|
||||
if response.status_code == 200:
|
||||
response_200 = Application.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[Application]:
|
||||
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[Application]:
|
||||
"""
|
||||
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[Application]
|
||||
"""
|
||||
|
||||
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[Application]:
|
||||
"""
|
||||
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:
|
||||
Application
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
id: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Response[Application]:
|
||||
"""
|
||||
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[Application]
|
||||
"""
|
||||
|
||||
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[Application]:
|
||||
"""
|
||||
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:
|
||||
Application
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
||||
|
|
@ -5,7 +5,7 @@ import httpx
|
|||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.paginated_application_transaction_list import PaginatedApplicationTransactionList
|
||||
from ...models.paginated_application_list import PaginatedApplicationList
|
||||
from ...types import UNSET, Response, Unset
|
||||
|
||||
|
||||
|
|
@ -21,7 +21,7 @@ def _get_kwargs(
|
|||
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "get",
|
||||
"url": "/wallet/api/application/",
|
||||
"url": "/oauth2/apis/applications/",
|
||||
"params": params,
|
||||
}
|
||||
|
||||
|
|
@ -30,9 +30,9 @@ def _get_kwargs(
|
|||
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[PaginatedApplicationTransactionList]:
|
||||
) -> Optional[PaginatedApplicationList]:
|
||||
if response.status_code == 200:
|
||||
response_200 = PaginatedApplicationTransactionList.from_dict(response.json())
|
||||
response_200 = PaginatedApplicationList.from_dict(response.json())
|
||||
|
||||
return response_200
|
||||
if client.raise_on_unexpected_status:
|
||||
|
|
@ -43,7 +43,7 @@ def _parse_response(
|
|||
|
||||
def _build_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[PaginatedApplicationTransactionList]:
|
||||
) -> Response[PaginatedApplicationList]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
|
|
@ -56,7 +56,7 @@ def sync_detailed(
|
|||
*,
|
||||
client: AuthenticatedClient,
|
||||
page: Union[Unset, int] = UNSET,
|
||||
) -> Response[PaginatedApplicationTransactionList]:
|
||||
) -> Response[PaginatedApplicationList]:
|
||||
"""
|
||||
Args:
|
||||
page (Union[Unset, int]):
|
||||
|
|
@ -66,7 +66,7 @@ def sync_detailed(
|
|||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[PaginatedApplicationTransactionList]
|
||||
Response[PaginatedApplicationList]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
|
|
@ -84,7 +84,7 @@ def sync(
|
|||
*,
|
||||
client: AuthenticatedClient,
|
||||
page: Union[Unset, int] = UNSET,
|
||||
) -> Optional[PaginatedApplicationTransactionList]:
|
||||
) -> Optional[PaginatedApplicationList]:
|
||||
"""
|
||||
Args:
|
||||
page (Union[Unset, int]):
|
||||
|
|
@ -94,7 +94,7 @@ def sync(
|
|||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
PaginatedApplicationTransactionList
|
||||
PaginatedApplicationList
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
|
|
@ -107,7 +107,7 @@ async def asyncio_detailed(
|
|||
*,
|
||||
client: AuthenticatedClient,
|
||||
page: Union[Unset, int] = UNSET,
|
||||
) -> Response[PaginatedApplicationTransactionList]:
|
||||
) -> Response[PaginatedApplicationList]:
|
||||
"""
|
||||
Args:
|
||||
page (Union[Unset, int]):
|
||||
|
|
@ -117,7 +117,7 @@ async def asyncio_detailed(
|
|||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[PaginatedApplicationTransactionList]
|
||||
Response[PaginatedApplicationList]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
|
|
@ -133,7 +133,7 @@ async def asyncio(
|
|||
*,
|
||||
client: AuthenticatedClient,
|
||||
page: Union[Unset, int] = UNSET,
|
||||
) -> Optional[PaginatedApplicationTransactionList]:
|
||||
) -> Optional[PaginatedApplicationList]:
|
||||
"""
|
||||
Args:
|
||||
page (Union[Unset, int]):
|
||||
|
|
@ -143,7 +143,7 @@ async def asyncio(
|
|||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
PaginatedApplicationTransactionList
|
||||
PaginatedApplicationList
|
||||
"""
|
||||
|
||||
return (
|
||||
|
|
@ -0,0 +1,142 @@
|
|||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.application import Application
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
id: str,
|
||||
) -> dict[str, Any]:
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "get",
|
||||
"url": f"/oauth2/apis/applications/{id}/",
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Application]:
|
||||
if response.status_code == 200:
|
||||
response_200 = Application.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[Application]:
|
||||
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[Application]:
|
||||
"""
|
||||
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[Application]
|
||||
"""
|
||||
|
||||
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[Application]:
|
||||
"""
|
||||
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:
|
||||
Application
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
id: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Response[Application]:
|
||||
"""
|
||||
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[Application]
|
||||
"""
|
||||
|
||||
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[Application]:
|
||||
"""
|
||||
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:
|
||||
Application
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
||||
|
|
@ -0,0 +1 @@
|
|||
"""Contains endpoint functions for accessing the API"""
|
||||
|
|
@ -0,0 +1,152 @@
|
|||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.account import Account
|
||||
from ...models.patched_account import PatchedAccount
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
body: PatchedAccount,
|
||||
) -> dict[str, Any]:
|
||||
headers: dict[str, Any] = {}
|
||||
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "patch",
|
||||
"url": "/users/api/account/",
|
||||
}
|
||||
|
||||
_body = body.to_dict()
|
||||
|
||||
_kwargs["json"] = _body
|
||||
headers["Content-Type"] = "application/json"
|
||||
|
||||
_kwargs["headers"] = headers
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Account]:
|
||||
if response.status_code == 200:
|
||||
response_200 = Account.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[Account]:
|
||||
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: PatchedAccount,
|
||||
) -> Response[Account]:
|
||||
"""
|
||||
Args:
|
||||
body (PatchedAccount):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Account]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
body=body,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: PatchedAccount,
|
||||
) -> Optional[Account]:
|
||||
"""
|
||||
Args:
|
||||
body (PatchedAccount):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Account
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
body=body,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: PatchedAccount,
|
||||
) -> Response[Account]:
|
||||
"""
|
||||
Args:
|
||||
body (PatchedAccount):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Account]
|
||||
"""
|
||||
|
||||
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: PatchedAccount,
|
||||
) -> Optional[Account]:
|
||||
"""
|
||||
Args:
|
||||
body (PatchedAccount):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Account
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
client=client,
|
||||
body=body,
|
||||
)
|
||||
).parsed
|
||||
|
|
@ -5,24 +5,22 @@ import httpx
|
|||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.application_balance import ApplicationBalance
|
||||
from ...models.account import Account
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs() -> dict[str, Any]:
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "get",
|
||||
"url": "/wallet/api/application/balance",
|
||||
"url": "/users/api/account/",
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[ApplicationBalance]:
|
||||
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Account]:
|
||||
if response.status_code == 200:
|
||||
response_200 = ApplicationBalance.from_dict(response.json())
|
||||
response_200 = Account.from_dict(response.json())
|
||||
|
||||
return response_200
|
||||
if client.raise_on_unexpected_status:
|
||||
|
|
@ -31,9 +29,7 @@ def _parse_response(
|
|||
return None
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[ApplicationBalance]:
|
||||
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Account]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
|
|
@ -45,15 +41,14 @@ def _build_response(
|
|||
def sync_detailed(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Response[ApplicationBalance]:
|
||||
"""API for getting specified user or application balance.
|
||||
|
||||
) -> Response[Account]:
|
||||
"""
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[ApplicationBalance]
|
||||
Response[Account]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs()
|
||||
|
|
@ -68,15 +63,14 @@ def sync_detailed(
|
|||
def sync(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Optional[ApplicationBalance]:
|
||||
"""API for getting specified user or application balance.
|
||||
|
||||
) -> Optional[Account]:
|
||||
"""
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
ApplicationBalance
|
||||
Account
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
|
|
@ -87,15 +81,14 @@ def sync(
|
|||
async def asyncio_detailed(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Response[ApplicationBalance]:
|
||||
"""API for getting specified user or application balance.
|
||||
|
||||
) -> Response[Account]:
|
||||
"""
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[ApplicationBalance]
|
||||
Response[Account]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs()
|
||||
|
|
@ -108,15 +101,14 @@ async def asyncio_detailed(
|
|||
async def asyncio(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Optional[ApplicationBalance]:
|
||||
"""API for getting specified user or application balance.
|
||||
|
||||
) -> Optional[Account]:
|
||||
"""
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
ApplicationBalance
|
||||
Account
|
||||
"""
|
||||
|
||||
return (
|
||||
|
|
@ -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.account import Account
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
body: Account,
|
||||
) -> dict[str, Any]:
|
||||
headers: dict[str, Any] = {}
|
||||
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "put",
|
||||
"url": "/users/api/account/",
|
||||
}
|
||||
|
||||
_body = body.to_dict()
|
||||
|
||||
_kwargs["json"] = _body
|
||||
headers["Content-Type"] = "application/json"
|
||||
|
||||
_kwargs["headers"] = headers
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Account]:
|
||||
if response.status_code == 200:
|
||||
response_200 = Account.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[Account]:
|
||||
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: Account,
|
||||
) -> Response[Account]:
|
||||
"""
|
||||
Args:
|
||||
body (Account):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Account]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
body=body,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: Account,
|
||||
) -> Optional[Account]:
|
||||
"""
|
||||
Args:
|
||||
body (Account):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Account
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
body=body,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: Account,
|
||||
) -> Response[Account]:
|
||||
"""
|
||||
Args:
|
||||
body (Account):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Account]
|
||||
"""
|
||||
|
||||
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: Account,
|
||||
) -> Optional[Account]:
|
||||
"""
|
||||
Args:
|
||||
body (Account):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Account
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
client=client,
|
||||
body=body,
|
||||
)
|
||||
).parsed
|
||||
|
|
@ -0,0 +1,156 @@
|
|||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.change_password import ChangePassword
|
||||
from ...models.patched_change_password import PatchedChangePassword
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
body: PatchedChangePassword,
|
||||
) -> dict[str, Any]:
|
||||
headers: dict[str, Any] = {}
|
||||
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "patch",
|
||||
"url": "/users/api/change_password/",
|
||||
}
|
||||
|
||||
_body = body.to_dict()
|
||||
|
||||
_kwargs["json"] = _body
|
||||
headers["Content-Type"] = "application/json"
|
||||
|
||||
_kwargs["headers"] = headers
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[ChangePassword]:
|
||||
if response.status_code == 200:
|
||||
response_200 = ChangePassword.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[ChangePassword]:
|
||||
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: PatchedChangePassword,
|
||||
) -> Response[ChangePassword]:
|
||||
"""
|
||||
Args:
|
||||
body (PatchedChangePassword):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[ChangePassword]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
body=body,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: PatchedChangePassword,
|
||||
) -> Optional[ChangePassword]:
|
||||
"""
|
||||
Args:
|
||||
body (PatchedChangePassword):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
ChangePassword
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
body=body,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: PatchedChangePassword,
|
||||
) -> Response[ChangePassword]:
|
||||
"""
|
||||
Args:
|
||||
body (PatchedChangePassword):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[ChangePassword]
|
||||
"""
|
||||
|
||||
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: PatchedChangePassword,
|
||||
) -> Optional[ChangePassword]:
|
||||
"""
|
||||
Args:
|
||||
body (PatchedChangePassword):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
ChangePassword
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
client=client,
|
||||
body=body,
|
||||
)
|
||||
).parsed
|
||||
|
|
@ -0,0 +1,155 @@
|
|||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.change_password import ChangePassword
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
body: ChangePassword,
|
||||
) -> dict[str, Any]:
|
||||
headers: dict[str, Any] = {}
|
||||
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "put",
|
||||
"url": "/users/api/change_password/",
|
||||
}
|
||||
|
||||
_body = body.to_dict()
|
||||
|
||||
_kwargs["json"] = _body
|
||||
headers["Content-Type"] = "application/json"
|
||||
|
||||
_kwargs["headers"] = headers
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[ChangePassword]:
|
||||
if response.status_code == 200:
|
||||
response_200 = ChangePassword.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[ChangePassword]:
|
||||
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: ChangePassword,
|
||||
) -> Response[ChangePassword]:
|
||||
"""
|
||||
Args:
|
||||
body (ChangePassword):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[ChangePassword]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
body=body,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: ChangePassword,
|
||||
) -> Optional[ChangePassword]:
|
||||
"""
|
||||
Args:
|
||||
body (ChangePassword):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
ChangePassword
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
body=body,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: ChangePassword,
|
||||
) -> Response[ChangePassword]:
|
||||
"""
|
||||
Args:
|
||||
body (ChangePassword):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[ChangePassword]
|
||||
"""
|
||||
|
||||
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: ChangePassword,
|
||||
) -> Optional[ChangePassword]:
|
||||
"""
|
||||
Args:
|
||||
body (ChangePassword):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
ChangePassword
|
||||
"""
|
||||
|
||||
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.user_inquiry import UserInquiry
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
body: UserInquiry,
|
||||
) -> dict[str, Any]:
|
||||
headers: dict[str, Any] = {}
|
||||
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "post",
|
||||
"url": "/users/api/inquiry/",
|
||||
}
|
||||
|
||||
_body = body.to_dict()
|
||||
|
||||
_kwargs["json"] = _body
|
||||
headers["Content-Type"] = "application/json"
|
||||
|
||||
_kwargs["headers"] = headers
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[UserInquiry]:
|
||||
if response.status_code == 201:
|
||||
response_201 = UserInquiry.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[UserInquiry]:
|
||||
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: UserInquiry,
|
||||
) -> Response[UserInquiry]:
|
||||
"""
|
||||
Args:
|
||||
body (UserInquiry):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[UserInquiry]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
body=body,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: UserInquiry,
|
||||
) -> Optional[UserInquiry]:
|
||||
"""
|
||||
Args:
|
||||
body (UserInquiry):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
UserInquiry
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
body=body,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: UserInquiry,
|
||||
) -> Response[UserInquiry]:
|
||||
"""
|
||||
Args:
|
||||
body (UserInquiry):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[UserInquiry]
|
||||
"""
|
||||
|
||||
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: UserInquiry,
|
||||
) -> Optional[UserInquiry]:
|
||||
"""
|
||||
Args:
|
||||
body (UserInquiry):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
UserInquiry
|
||||
"""
|
||||
|
||||
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.request_otp import RequestOTP
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
body: RequestOTP,
|
||||
) -> dict[str, Any]:
|
||||
headers: dict[str, Any] = {}
|
||||
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "post",
|
||||
"url": "/users/api/request_otp/",
|
||||
}
|
||||
|
||||
_body = body.to_dict()
|
||||
|
||||
_kwargs["json"] = _body
|
||||
headers["Content-Type"] = "application/json"
|
||||
|
||||
_kwargs["headers"] = headers
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[RequestOTP]:
|
||||
if response.status_code == 201:
|
||||
response_201 = RequestOTP.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[RequestOTP]:
|
||||
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: RequestOTP,
|
||||
) -> Response[RequestOTP]:
|
||||
"""
|
||||
Args:
|
||||
body (RequestOTP):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[RequestOTP]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
body=body,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: RequestOTP,
|
||||
) -> Optional[RequestOTP]:
|
||||
"""
|
||||
Args:
|
||||
body (RequestOTP):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
RequestOTP
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
body=body,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: RequestOTP,
|
||||
) -> Response[RequestOTP]:
|
||||
"""
|
||||
Args:
|
||||
body (RequestOTP):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[RequestOTP]
|
||||
"""
|
||||
|
||||
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: RequestOTP,
|
||||
) -> Optional[RequestOTP]:
|
||||
"""
|
||||
Args:
|
||||
body (RequestOTP):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
RequestOTP
|
||||
"""
|
||||
|
||||
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.request_ott import RequestOTT
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
body: RequestOTT,
|
||||
) -> dict[str, Any]:
|
||||
headers: dict[str, Any] = {}
|
||||
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "post",
|
||||
"url": "/users/api/request_ott/",
|
||||
}
|
||||
|
||||
_body = body.to_dict()
|
||||
|
||||
_kwargs["json"] = _body
|
||||
headers["Content-Type"] = "application/json"
|
||||
|
||||
_kwargs["headers"] = headers
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[RequestOTT]:
|
||||
if response.status_code == 201:
|
||||
response_201 = RequestOTT.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[RequestOTT]:
|
||||
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: RequestOTT,
|
||||
) -> Response[RequestOTT]:
|
||||
"""
|
||||
Args:
|
||||
body (RequestOTT):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[RequestOTT]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
body=body,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: RequestOTT,
|
||||
) -> Optional[RequestOTT]:
|
||||
"""
|
||||
Args:
|
||||
body (RequestOTT):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
RequestOTT
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
body=body,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: RequestOTT,
|
||||
) -> Response[RequestOTT]:
|
||||
"""
|
||||
Args:
|
||||
body (RequestOTT):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[RequestOTT]
|
||||
"""
|
||||
|
||||
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: RequestOTT,
|
||||
) -> Optional[RequestOTT]:
|
||||
"""
|
||||
Args:
|
||||
body (RequestOTT):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
RequestOTT
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
client=client,
|
||||
body=body,
|
||||
)
|
||||
).parsed
|
||||
|
|
@ -0,0 +1,92 @@
|
|||
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": "get",
|
||||
"url": f"/users/api/users/{uuid}/avatar",
|
||||
}
|
||||
|
||||
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(
|
||||
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)
|
||||
|
|
@ -1,30 +1,29 @@
|
|||
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.application_transaction import ApplicationTransaction
|
||||
from ...models.account import Account
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
uuid: str,
|
||||
uuid: UUID,
|
||||
) -> dict[str, Any]:
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "get",
|
||||
"url": f"/wallet/api/application/{uuid}/",
|
||||
"url": f"/users/api/users/{uuid}/details",
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[ApplicationTransaction]:
|
||||
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Account]:
|
||||
if response.status_code == 200:
|
||||
response_200 = ApplicationTransaction.from_dict(response.json())
|
||||
response_200 = Account.from_dict(response.json())
|
||||
|
||||
return response_200
|
||||
if client.raise_on_unexpected_status:
|
||||
|
|
@ -33,9 +32,7 @@ def _parse_response(
|
|||
return None
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[ApplicationTransaction]:
|
||||
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Account]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
|
|
@ -45,20 +42,20 @@ def _build_response(
|
|||
|
||||
|
||||
def sync_detailed(
|
||||
uuid: str,
|
||||
uuid: UUID,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Response[ApplicationTransaction]:
|
||||
) -> Response[Account]:
|
||||
"""
|
||||
Args:
|
||||
uuid (str):
|
||||
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[ApplicationTransaction]
|
||||
Response[Account]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
|
|
@ -73,20 +70,20 @@ def sync_detailed(
|
|||
|
||||
|
||||
def sync(
|
||||
uuid: str,
|
||||
uuid: UUID,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Optional[ApplicationTransaction]:
|
||||
) -> Optional[Account]:
|
||||
"""
|
||||
Args:
|
||||
uuid (str):
|
||||
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:
|
||||
ApplicationTransaction
|
||||
Account
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
|
|
@ -96,20 +93,20 @@ def sync(
|
|||
|
||||
|
||||
async def asyncio_detailed(
|
||||
uuid: str,
|
||||
uuid: UUID,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Response[ApplicationTransaction]:
|
||||
) -> Response[Account]:
|
||||
"""
|
||||
Args:
|
||||
uuid (str):
|
||||
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[ApplicationTransaction]
|
||||
Response[Account]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
|
|
@ -122,20 +119,20 @@ async def asyncio_detailed(
|
|||
|
||||
|
||||
async def asyncio(
|
||||
uuid: str,
|
||||
uuid: UUID,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Optional[ApplicationTransaction]:
|
||||
) -> Optional[Account]:
|
||||
"""
|
||||
Args:
|
||||
uuid (str):
|
||||
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:
|
||||
ApplicationTransaction
|
||||
Account
|
||||
"""
|
||||
|
||||
return (
|
||||
|
|
@ -5,7 +5,7 @@ import httpx
|
|||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.paginated_user_transaction_list import PaginatedUserTransactionList
|
||||
from ...models.paginated_public_user_list import PaginatedPublicUserList
|
||||
from ...types import UNSET, Response, Unset
|
||||
|
||||
|
||||
|
|
@ -21,7 +21,7 @@ def _get_kwargs(
|
|||
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "get",
|
||||
"url": "/wallet/api/transactions/",
|
||||
"url": "/users/api/users/",
|
||||
"params": params,
|
||||
}
|
||||
|
||||
|
|
@ -30,9 +30,9 @@ def _get_kwargs(
|
|||
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[PaginatedUserTransactionList]:
|
||||
) -> Optional[PaginatedPublicUserList]:
|
||||
if response.status_code == 200:
|
||||
response_200 = PaginatedUserTransactionList.from_dict(response.json())
|
||||
response_200 = PaginatedPublicUserList.from_dict(response.json())
|
||||
|
||||
return response_200
|
||||
if client.raise_on_unexpected_status:
|
||||
|
|
@ -43,7 +43,7 @@ def _parse_response(
|
|||
|
||||
def _build_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[PaginatedUserTransactionList]:
|
||||
) -> Response[PaginatedPublicUserList]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
|
|
@ -56,13 +56,8 @@ def sync_detailed(
|
|||
*,
|
||||
client: AuthenticatedClient,
|
||||
page: Union[Unset, int] = UNSET,
|
||||
) -> Response[PaginatedUserTransactionList]:
|
||||
"""GET: API for getting list of transactions for authenticated user
|
||||
POST: API for creating transaction for transferring funds from authenticated user to application
|
||||
owner. (deprecated)
|
||||
args:
|
||||
- user: authenticated user
|
||||
|
||||
) -> Response[PaginatedPublicUserList]:
|
||||
"""
|
||||
Args:
|
||||
page (Union[Unset, int]):
|
||||
|
||||
|
|
@ -71,7 +66,7 @@ def sync_detailed(
|
|||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[PaginatedUserTransactionList]
|
||||
Response[PaginatedPublicUserList]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
|
|
@ -89,13 +84,8 @@ def sync(
|
|||
*,
|
||||
client: AuthenticatedClient,
|
||||
page: Union[Unset, int] = UNSET,
|
||||
) -> Optional[PaginatedUserTransactionList]:
|
||||
"""GET: API for getting list of transactions for authenticated user
|
||||
POST: API for creating transaction for transferring funds from authenticated user to application
|
||||
owner. (deprecated)
|
||||
args:
|
||||
- user: authenticated user
|
||||
|
||||
) -> Optional[PaginatedPublicUserList]:
|
||||
"""
|
||||
Args:
|
||||
page (Union[Unset, int]):
|
||||
|
||||
|
|
@ -104,7 +94,7 @@ def sync(
|
|||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
PaginatedUserTransactionList
|
||||
PaginatedPublicUserList
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
|
|
@ -117,13 +107,8 @@ async def asyncio_detailed(
|
|||
*,
|
||||
client: AuthenticatedClient,
|
||||
page: Union[Unset, int] = UNSET,
|
||||
) -> Response[PaginatedUserTransactionList]:
|
||||
"""GET: API for getting list of transactions for authenticated user
|
||||
POST: API for creating transaction for transferring funds from authenticated user to application
|
||||
owner. (deprecated)
|
||||
args:
|
||||
- user: authenticated user
|
||||
|
||||
) -> Response[PaginatedPublicUserList]:
|
||||
"""
|
||||
Args:
|
||||
page (Union[Unset, int]):
|
||||
|
||||
|
|
@ -132,7 +117,7 @@ async def asyncio_detailed(
|
|||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[PaginatedUserTransactionList]
|
||||
Response[PaginatedPublicUserList]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
|
|
@ -148,13 +133,8 @@ async def asyncio(
|
|||
*,
|
||||
client: AuthenticatedClient,
|
||||
page: Union[Unset, int] = UNSET,
|
||||
) -> Optional[PaginatedUserTransactionList]:
|
||||
"""GET: API for getting list of transactions for authenticated user
|
||||
POST: API for creating transaction for transferring funds from authenticated user to application
|
||||
owner. (deprecated)
|
||||
args:
|
||||
- user: authenticated user
|
||||
|
||||
) -> Optional[PaginatedPublicUserList]:
|
||||
"""
|
||||
Args:
|
||||
page (Union[Unset, int]):
|
||||
|
||||
|
|
@ -163,7 +143,7 @@ async def asyncio(
|
|||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
PaginatedUserTransactionList
|
||||
PaginatedPublicUserList
|
||||
"""
|
||||
|
||||
return (
|
||||
|
|
@ -0,0 +1,143 @@
|
|||
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.public_user import PublicUser
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
uuid: UUID,
|
||||
) -> dict[str, Any]:
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "get",
|
||||
"url": f"/users/api/users/{uuid}/",
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[PublicUser]:
|
||||
if response.status_code == 200:
|
||||
response_200 = PublicUser.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[PublicUser]:
|
||||
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[PublicUser]:
|
||||
"""
|
||||
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[PublicUser]
|
||||
"""
|
||||
|
||||
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[PublicUser]:
|
||||
"""
|
||||
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:
|
||||
PublicUser
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
uuid=uuid,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
uuid: UUID,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Response[PublicUser]:
|
||||
"""
|
||||
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[PublicUser]
|
||||
"""
|
||||
|
||||
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[PublicUser]:
|
||||
"""
|
||||
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:
|
||||
PublicUser
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
uuid=uuid,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
||||
33
utils/clients/gooyal_accounts_client/models/__init__.py
Normal file
33
utils/clients/gooyal_accounts_client/models/__init__.py
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
"""Contains all the data models used in inputs/outputs"""
|
||||
|
||||
from .account import Account
|
||||
from .application import Application
|
||||
from .blank_enum import BlankEnum
|
||||
from .change_password import ChangePassword
|
||||
from .education_degree_enum import EducationDegreeEnum
|
||||
from .gender_enum import GenderEnum
|
||||
from .paginated_application_list import PaginatedApplicationList
|
||||
from .paginated_public_user_list import PaginatedPublicUserList
|
||||
from .patched_account import PatchedAccount
|
||||
from .patched_change_password import PatchedChangePassword
|
||||
from .public_user import PublicUser
|
||||
from .request_otp import RequestOTP
|
||||
from .request_ott import RequestOTT
|
||||
from .user_inquiry import UserInquiry
|
||||
|
||||
__all__ = (
|
||||
"Account",
|
||||
"Application",
|
||||
"BlankEnum",
|
||||
"ChangePassword",
|
||||
"EducationDegreeEnum",
|
||||
"GenderEnum",
|
||||
"PaginatedApplicationList",
|
||||
"PaginatedPublicUserList",
|
||||
"PatchedAccount",
|
||||
"PatchedChangePassword",
|
||||
"PublicUser",
|
||||
"RequestOTP",
|
||||
"RequestOTT",
|
||||
"UserInquiry",
|
||||
)
|
||||
410
utils/clients/gooyal_accounts_client/models/account.py
Normal file
410
utils/clients/gooyal_accounts_client/models/account.py
Normal file
|
|
@ -0,0 +1,410 @@
|
|||
import datetime
|
||||
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 dateutil.parser import isoparse
|
||||
|
||||
from ..models.blank_enum import BlankEnum
|
||||
from ..models.education_degree_enum import EducationDegreeEnum
|
||||
from ..models.gender_enum import GenderEnum
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
T = TypeVar("T", bound="Account")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class Account:
|
||||
"""
|
||||
Attributes:
|
||||
uuid (UUID):
|
||||
email (str):
|
||||
phone_number (str):
|
||||
iban_verified (Union[None, bool]):
|
||||
province_name (str):
|
||||
city_name (str):
|
||||
username (Union[None, Unset, str]): Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.
|
||||
first_name (Union[Unset, str]):
|
||||
last_name (Union[Unset, str]):
|
||||
name (Union[Unset, str]):
|
||||
avatar (Union[None, Unset, str]):
|
||||
gender (Union[BlankEnum, GenderEnum, None, Unset]):
|
||||
education_degree (Union[BlankEnum, EducationDegreeEnum, None, Unset]):
|
||||
education_field (Union[None, Unset, str]):
|
||||
birthdate (Union[None, Unset, datetime.date]):
|
||||
iban (Union[None, Unset, str]):
|
||||
province (Union[None, Unset, int]):
|
||||
city (Union[None, Unset, int]):
|
||||
postal_code (Union[None, Unset, str]):
|
||||
address (Union[None, Unset, str]):
|
||||
"""
|
||||
|
||||
uuid: UUID
|
||||
email: str
|
||||
phone_number: str
|
||||
iban_verified: Union[None, bool]
|
||||
province_name: str
|
||||
city_name: str
|
||||
username: Union[None, Unset, str] = UNSET
|
||||
first_name: Union[Unset, str] = UNSET
|
||||
last_name: Union[Unset, str] = UNSET
|
||||
name: Union[Unset, str] = UNSET
|
||||
avatar: Union[None, Unset, str] = UNSET
|
||||
gender: Union[BlankEnum, GenderEnum, None, Unset] = UNSET
|
||||
education_degree: Union[BlankEnum, EducationDegreeEnum, None, Unset] = UNSET
|
||||
education_field: Union[None, Unset, str] = UNSET
|
||||
birthdate: Union[None, Unset, datetime.date] = UNSET
|
||||
iban: Union[None, Unset, str] = UNSET
|
||||
province: Union[None, Unset, int] = UNSET
|
||||
city: Union[None, Unset, int] = UNSET
|
||||
postal_code: Union[None, Unset, str] = UNSET
|
||||
address: Union[None, Unset, str] = UNSET
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
uuid = str(self.uuid)
|
||||
|
||||
email = self.email
|
||||
|
||||
phone_number = self.phone_number
|
||||
|
||||
iban_verified: Union[None, bool]
|
||||
iban_verified = self.iban_verified
|
||||
|
||||
province_name = self.province_name
|
||||
|
||||
city_name = self.city_name
|
||||
|
||||
username: Union[None, Unset, str]
|
||||
if isinstance(self.username, Unset):
|
||||
username = UNSET
|
||||
else:
|
||||
username = self.username
|
||||
|
||||
first_name = self.first_name
|
||||
|
||||
last_name = self.last_name
|
||||
|
||||
name = self.name
|
||||
|
||||
avatar: Union[None, Unset, str]
|
||||
if isinstance(self.avatar, Unset):
|
||||
avatar = UNSET
|
||||
else:
|
||||
avatar = self.avatar
|
||||
|
||||
gender: Union[None, Unset, str]
|
||||
if isinstance(self.gender, Unset):
|
||||
gender = UNSET
|
||||
elif isinstance(self.gender, GenderEnum):
|
||||
gender = self.gender.value
|
||||
elif isinstance(self.gender, BlankEnum):
|
||||
gender = self.gender.value
|
||||
else:
|
||||
gender = self.gender
|
||||
|
||||
education_degree: Union[None, Unset, str]
|
||||
if isinstance(self.education_degree, Unset):
|
||||
education_degree = UNSET
|
||||
elif isinstance(self.education_degree, EducationDegreeEnum):
|
||||
education_degree = self.education_degree.value
|
||||
elif isinstance(self.education_degree, BlankEnum):
|
||||
education_degree = self.education_degree.value
|
||||
else:
|
||||
education_degree = self.education_degree
|
||||
|
||||
education_field: Union[None, Unset, str]
|
||||
if isinstance(self.education_field, Unset):
|
||||
education_field = UNSET
|
||||
else:
|
||||
education_field = self.education_field
|
||||
|
||||
birthdate: Union[None, Unset, str]
|
||||
if isinstance(self.birthdate, Unset):
|
||||
birthdate = UNSET
|
||||
elif isinstance(self.birthdate, datetime.date):
|
||||
birthdate = self.birthdate.isoformat()
|
||||
else:
|
||||
birthdate = self.birthdate
|
||||
|
||||
iban: Union[None, Unset, str]
|
||||
if isinstance(self.iban, Unset):
|
||||
iban = UNSET
|
||||
else:
|
||||
iban = self.iban
|
||||
|
||||
province: Union[None, Unset, int]
|
||||
if isinstance(self.province, Unset):
|
||||
province = UNSET
|
||||
else:
|
||||
province = self.province
|
||||
|
||||
city: Union[None, Unset, int]
|
||||
if isinstance(self.city, Unset):
|
||||
city = UNSET
|
||||
else:
|
||||
city = self.city
|
||||
|
||||
postal_code: Union[None, Unset, str]
|
||||
if isinstance(self.postal_code, Unset):
|
||||
postal_code = UNSET
|
||||
else:
|
||||
postal_code = self.postal_code
|
||||
|
||||
address: Union[None, Unset, str]
|
||||
if isinstance(self.address, Unset):
|
||||
address = UNSET
|
||||
else:
|
||||
address = self.address
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update(
|
||||
{
|
||||
"uuid": uuid,
|
||||
"email": email,
|
||||
"phone_number": phone_number,
|
||||
"iban_verified": iban_verified,
|
||||
"province_name": province_name,
|
||||
"city_name": city_name,
|
||||
}
|
||||
)
|
||||
if username is not UNSET:
|
||||
field_dict["username"] = username
|
||||
if first_name is not UNSET:
|
||||
field_dict["first_name"] = first_name
|
||||
if last_name is not UNSET:
|
||||
field_dict["last_name"] = last_name
|
||||
if name is not UNSET:
|
||||
field_dict["name"] = name
|
||||
if avatar is not UNSET:
|
||||
field_dict["avatar"] = avatar
|
||||
if gender is not UNSET:
|
||||
field_dict["gender"] = gender
|
||||
if education_degree is not UNSET:
|
||||
field_dict["education_degree"] = education_degree
|
||||
if education_field is not UNSET:
|
||||
field_dict["education_field"] = education_field
|
||||
if birthdate is not UNSET:
|
||||
field_dict["birthdate"] = birthdate
|
||||
if iban is not UNSET:
|
||||
field_dict["iban"] = iban
|
||||
if province is not UNSET:
|
||||
field_dict["province"] = province
|
||||
if city is not UNSET:
|
||||
field_dict["city"] = city
|
||||
if postal_code is not UNSET:
|
||||
field_dict["postal_code"] = postal_code
|
||||
if address is not UNSET:
|
||||
field_dict["address"] = address
|
||||
|
||||
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"))
|
||||
|
||||
email = d.pop("email")
|
||||
|
||||
phone_number = d.pop("phone_number")
|
||||
|
||||
def _parse_iban_verified(data: object) -> Union[None, bool]:
|
||||
if data is None:
|
||||
return data
|
||||
return cast(Union[None, bool], data)
|
||||
|
||||
iban_verified = _parse_iban_verified(d.pop("iban_verified"))
|
||||
|
||||
province_name = d.pop("province_name")
|
||||
|
||||
city_name = d.pop("city_name")
|
||||
|
||||
def _parse_username(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)
|
||||
|
||||
username = _parse_username(d.pop("username", UNSET))
|
||||
|
||||
first_name = d.pop("first_name", UNSET)
|
||||
|
||||
last_name = d.pop("last_name", UNSET)
|
||||
|
||||
name = d.pop("name", UNSET)
|
||||
|
||||
def _parse_avatar(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)
|
||||
|
||||
avatar = _parse_avatar(d.pop("avatar", UNSET))
|
||||
|
||||
def _parse_gender(data: object) -> Union[BlankEnum, GenderEnum, None, Unset]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
try:
|
||||
if not isinstance(data, str):
|
||||
raise TypeError()
|
||||
gender_type_0 = GenderEnum(data)
|
||||
|
||||
return gender_type_0
|
||||
except: # noqa: E722
|
||||
pass
|
||||
try:
|
||||
if not isinstance(data, str):
|
||||
raise TypeError()
|
||||
gender_type_1 = BlankEnum(data)
|
||||
|
||||
return gender_type_1
|
||||
except: # noqa: E722
|
||||
pass
|
||||
return cast(Union[BlankEnum, GenderEnum, None, Unset], data)
|
||||
|
||||
gender = _parse_gender(d.pop("gender", UNSET))
|
||||
|
||||
def _parse_education_degree(data: object) -> Union[BlankEnum, EducationDegreeEnum, None, Unset]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
try:
|
||||
if not isinstance(data, str):
|
||||
raise TypeError()
|
||||
education_degree_type_0 = EducationDegreeEnum(data)
|
||||
|
||||
return education_degree_type_0
|
||||
except: # noqa: E722
|
||||
pass
|
||||
try:
|
||||
if not isinstance(data, str):
|
||||
raise TypeError()
|
||||
education_degree_type_1 = BlankEnum(data)
|
||||
|
||||
return education_degree_type_1
|
||||
except: # noqa: E722
|
||||
pass
|
||||
return cast(Union[BlankEnum, EducationDegreeEnum, None, Unset], data)
|
||||
|
||||
education_degree = _parse_education_degree(d.pop("education_degree", UNSET))
|
||||
|
||||
def _parse_education_field(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)
|
||||
|
||||
education_field = _parse_education_field(d.pop("education_field", UNSET))
|
||||
|
||||
def _parse_birthdate(data: object) -> Union[None, Unset, datetime.date]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
try:
|
||||
if not isinstance(data, str):
|
||||
raise TypeError()
|
||||
birthdate_type_0 = isoparse(data).date()
|
||||
|
||||
return birthdate_type_0
|
||||
except: # noqa: E722
|
||||
pass
|
||||
return cast(Union[None, Unset, datetime.date], data)
|
||||
|
||||
birthdate = _parse_birthdate(d.pop("birthdate", UNSET))
|
||||
|
||||
def _parse_iban(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)
|
||||
|
||||
iban = _parse_iban(d.pop("iban", UNSET))
|
||||
|
||||
def _parse_province(data: object) -> Union[None, Unset, int]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, int], data)
|
||||
|
||||
province = _parse_province(d.pop("province", UNSET))
|
||||
|
||||
def _parse_city(data: object) -> Union[None, Unset, int]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, int], data)
|
||||
|
||||
city = _parse_city(d.pop("city", UNSET))
|
||||
|
||||
def _parse_postal_code(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)
|
||||
|
||||
postal_code = _parse_postal_code(d.pop("postal_code", UNSET))
|
||||
|
||||
def _parse_address(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)
|
||||
|
||||
address = _parse_address(d.pop("address", UNSET))
|
||||
|
||||
account = cls(
|
||||
uuid=uuid,
|
||||
email=email,
|
||||
phone_number=phone_number,
|
||||
iban_verified=iban_verified,
|
||||
province_name=province_name,
|
||||
city_name=city_name,
|
||||
username=username,
|
||||
first_name=first_name,
|
||||
last_name=last_name,
|
||||
name=name,
|
||||
avatar=avatar,
|
||||
gender=gender,
|
||||
education_degree=education_degree,
|
||||
education_field=education_field,
|
||||
birthdate=birthdate,
|
||||
iban=iban,
|
||||
province=province,
|
||||
city=city,
|
||||
postal_code=postal_code,
|
||||
address=address,
|
||||
)
|
||||
|
||||
account.additional_properties = d
|
||||
return account
|
||||
|
||||
@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
|
||||
106
utils/clients/gooyal_accounts_client/models/application.py
Normal file
106
utils/clients/gooyal_accounts_client/models/application.py
Normal file
|
|
@ -0,0 +1,106 @@
|
|||
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
|
||||
|
||||
T = TypeVar("T", bound="Application")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class Application:
|
||||
"""
|
||||
Attributes:
|
||||
uuid (UUID):
|
||||
name (str):
|
||||
avatar (Union[None, str]):
|
||||
client_id (str):
|
||||
user (UUID):
|
||||
allowed_scope (str):
|
||||
"""
|
||||
|
||||
uuid: UUID
|
||||
name: str
|
||||
avatar: Union[None, str]
|
||||
client_id: str
|
||||
user: UUID
|
||||
allowed_scope: str
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
uuid = str(self.uuid)
|
||||
|
||||
name = self.name
|
||||
|
||||
avatar: Union[None, str]
|
||||
avatar = self.avatar
|
||||
|
||||
client_id = self.client_id
|
||||
|
||||
user = str(self.user)
|
||||
|
||||
allowed_scope = self.allowed_scope
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update(
|
||||
{
|
||||
"uuid": uuid,
|
||||
"name": name,
|
||||
"avatar": avatar,
|
||||
"client_id": client_id,
|
||||
"user": user,
|
||||
"allowed_scope": allowed_scope,
|
||||
}
|
||||
)
|
||||
|
||||
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"))
|
||||
|
||||
name = d.pop("name")
|
||||
|
||||
def _parse_avatar(data: object) -> Union[None, str]:
|
||||
if data is None:
|
||||
return data
|
||||
return cast(Union[None, str], data)
|
||||
|
||||
avatar = _parse_avatar(d.pop("avatar"))
|
||||
|
||||
client_id = d.pop("client_id")
|
||||
|
||||
user = UUID(d.pop("user"))
|
||||
|
||||
allowed_scope = d.pop("allowed_scope")
|
||||
|
||||
application = cls(
|
||||
uuid=uuid,
|
||||
name=name,
|
||||
avatar=avatar,
|
||||
client_id=client_id,
|
||||
user=user,
|
||||
allowed_scope=allowed_scope,
|
||||
)
|
||||
|
||||
application.additional_properties = d
|
||||
return application
|
||||
|
||||
@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 BlankEnum(str, Enum):
|
||||
VALUE_0 = ""
|
||||
|
||||
def __str__(self) -> str:
|
||||
return str(self.value)
|
||||
|
|
@ -0,0 +1,78 @@
|
|||
from collections.abc import Mapping
|
||||
from typing import Any, TypeVar, Union
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
T = TypeVar("T", bound="ChangePassword")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class ChangePassword:
|
||||
"""
|
||||
Attributes:
|
||||
old_password (str):
|
||||
new_password (str):
|
||||
old_password_field (Union[Unset, str]): Default: 'password'.
|
||||
"""
|
||||
|
||||
old_password: str
|
||||
new_password: str
|
||||
old_password_field: Union[Unset, str] = "password"
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
old_password = self.old_password
|
||||
|
||||
new_password = self.new_password
|
||||
|
||||
old_password_field = self.old_password_field
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update(
|
||||
{
|
||||
"old_password": old_password,
|
||||
"new_password": new_password,
|
||||
}
|
||||
)
|
||||
if old_password_field is not UNSET:
|
||||
field_dict["old_password_field"] = old_password_field
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
d = dict(src_dict)
|
||||
old_password = d.pop("old_password")
|
||||
|
||||
new_password = d.pop("new_password")
|
||||
|
||||
old_password_field = d.pop("old_password_field", UNSET)
|
||||
|
||||
change_password = cls(
|
||||
old_password=old_password,
|
||||
new_password=new_password,
|
||||
old_password_field=old_password_field,
|
||||
)
|
||||
|
||||
change_password.additional_properties = d
|
||||
return change_password
|
||||
|
||||
@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,14 @@
|
|||
from enum import Enum
|
||||
|
||||
|
||||
class EducationDegreeEnum(str, Enum):
|
||||
ASSOCIATE = "associate"
|
||||
BACHELORS = "bachelors"
|
||||
DOCTORATE = "doctorate"
|
||||
HIGH = "high"
|
||||
MASTERS = "masters"
|
||||
MIDDLE = "middle"
|
||||
PRIMARY = "primary"
|
||||
|
||||
def __str__(self) -> str:
|
||||
return str(self.value)
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
from enum import Enum
|
||||
|
||||
|
||||
class GenderEnum(str, Enum):
|
||||
F = "f"
|
||||
M = "m"
|
||||
|
||||
def __str__(self) -> str:
|
||||
return str(self.value)
|
||||
|
|
@ -1,3 +1,4 @@
|
|||
from collections.abc import Mapping
|
||||
from typing import TYPE_CHECKING, Any, TypeVar, Union, cast
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
|
|
@ -6,24 +7,24 @@ from attrs import field as _attrs_field
|
|||
from ..types import UNSET, Unset
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..models.user_transaction import UserTransaction
|
||||
from ..models.application import Application
|
||||
|
||||
|
||||
T = TypeVar("T", bound="PaginatedUserTransactionList")
|
||||
T = TypeVar("T", bound="PaginatedApplicationList")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class PaginatedUserTransactionList:
|
||||
class PaginatedApplicationList:
|
||||
"""
|
||||
Attributes:
|
||||
count (int): Example: 123.
|
||||
results (list['UserTransaction']):
|
||||
results (list['Application']):
|
||||
next_ (Union[None, Unset, str]): Example: http://api.example.org/accounts/?page=4.
|
||||
previous (Union[None, Unset, str]): Example: http://api.example.org/accounts/?page=2.
|
||||
"""
|
||||
|
||||
count: int
|
||||
results: list["UserTransaction"]
|
||||
results: list["Application"]
|
||||
next_: Union[None, Unset, str] = UNSET
|
||||
previous: Union[None, Unset, str] = UNSET
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
|
@ -64,16 +65,16 @@ class PaginatedUserTransactionList:
|
|||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
|
||||
from ..models.user_transaction import UserTransaction
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
from ..models.application import Application
|
||||
|
||||
d = src_dict.copy()
|
||||
d = dict(src_dict)
|
||||
count = d.pop("count")
|
||||
|
||||
results = []
|
||||
_results = d.pop("results")
|
||||
for results_item_data in _results:
|
||||
results_item = UserTransaction.from_dict(results_item_data)
|
||||
results_item = Application.from_dict(results_item_data)
|
||||
|
||||
results.append(results_item)
|
||||
|
||||
|
|
@ -95,15 +96,15 @@ class PaginatedUserTransactionList:
|
|||
|
||||
previous = _parse_previous(d.pop("previous", UNSET))
|
||||
|
||||
paginated_user_transaction_list = cls(
|
||||
paginated_application_list = cls(
|
||||
count=count,
|
||||
results=results,
|
||||
next_=next_,
|
||||
previous=previous,
|
||||
)
|
||||
|
||||
paginated_user_transaction_list.additional_properties = d
|
||||
return paginated_user_transaction_list
|
||||
paginated_application_list.additional_properties = d
|
||||
return paginated_application_list
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
|
|
@ -1,3 +1,4 @@
|
|||
from collections.abc import Mapping
|
||||
from typing import TYPE_CHECKING, Any, TypeVar, Union, cast
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
|
|
@ -6,24 +7,24 @@ from attrs import field as _attrs_field
|
|||
from ..types import UNSET, Unset
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..models.application_transaction import ApplicationTransaction
|
||||
from ..models.public_user import PublicUser
|
||||
|
||||
|
||||
T = TypeVar("T", bound="PaginatedApplicationTransactionList")
|
||||
T = TypeVar("T", bound="PaginatedPublicUserList")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class PaginatedApplicationTransactionList:
|
||||
class PaginatedPublicUserList:
|
||||
"""
|
||||
Attributes:
|
||||
count (int): Example: 123.
|
||||
results (list['ApplicationTransaction']):
|
||||
results (list['PublicUser']):
|
||||
next_ (Union[None, Unset, str]): Example: http://api.example.org/accounts/?page=4.
|
||||
previous (Union[None, Unset, str]): Example: http://api.example.org/accounts/?page=2.
|
||||
"""
|
||||
|
||||
count: int
|
||||
results: list["ApplicationTransaction"]
|
||||
results: list["PublicUser"]
|
||||
next_: Union[None, Unset, str] = UNSET
|
||||
previous: Union[None, Unset, str] = UNSET
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
|
@ -64,16 +65,16 @@ class PaginatedApplicationTransactionList:
|
|||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
|
||||
from ..models.application_transaction import ApplicationTransaction
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
from ..models.public_user import PublicUser
|
||||
|
||||
d = src_dict.copy()
|
||||
d = dict(src_dict)
|
||||
count = d.pop("count")
|
||||
|
||||
results = []
|
||||
_results = d.pop("results")
|
||||
for results_item_data in _results:
|
||||
results_item = ApplicationTransaction.from_dict(results_item_data)
|
||||
results_item = PublicUser.from_dict(results_item_data)
|
||||
|
||||
results.append(results_item)
|
||||
|
||||
|
|
@ -95,15 +96,15 @@ class PaginatedApplicationTransactionList:
|
|||
|
||||
previous = _parse_previous(d.pop("previous", UNSET))
|
||||
|
||||
paginated_application_transaction_list = cls(
|
||||
paginated_public_user_list = cls(
|
||||
count=count,
|
||||
results=results,
|
||||
next_=next_,
|
||||
previous=previous,
|
||||
)
|
||||
|
||||
paginated_application_transaction_list.additional_properties = d
|
||||
return paginated_application_transaction_list
|
||||
paginated_public_user_list.additional_properties = d
|
||||
return paginated_public_user_list
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
425
utils/clients/gooyal_accounts_client/models/patched_account.py
Normal file
425
utils/clients/gooyal_accounts_client/models/patched_account.py
Normal file
|
|
@ -0,0 +1,425 @@
|
|||
import datetime
|
||||
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 dateutil.parser import isoparse
|
||||
|
||||
from ..models.blank_enum import BlankEnum
|
||||
from ..models.education_degree_enum import EducationDegreeEnum
|
||||
from ..models.gender_enum import GenderEnum
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
T = TypeVar("T", bound="PatchedAccount")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class PatchedAccount:
|
||||
"""
|
||||
Attributes:
|
||||
uuid (Union[Unset, UUID]):
|
||||
username (Union[None, Unset, str]): Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.
|
||||
email (Union[Unset, str]):
|
||||
phone_number (Union[Unset, str]):
|
||||
first_name (Union[Unset, str]):
|
||||
last_name (Union[Unset, str]):
|
||||
name (Union[Unset, str]):
|
||||
avatar (Union[None, Unset, str]):
|
||||
gender (Union[BlankEnum, GenderEnum, None, Unset]):
|
||||
education_degree (Union[BlankEnum, EducationDegreeEnum, None, Unset]):
|
||||
education_field (Union[None, Unset, str]):
|
||||
birthdate (Union[None, Unset, datetime.date]):
|
||||
iban (Union[None, Unset, str]):
|
||||
iban_verified (Union[None, Unset, bool]):
|
||||
province (Union[None, Unset, int]):
|
||||
province_name (Union[Unset, str]):
|
||||
city (Union[None, Unset, int]):
|
||||
city_name (Union[Unset, str]):
|
||||
postal_code (Union[None, Unset, str]):
|
||||
address (Union[None, Unset, str]):
|
||||
"""
|
||||
|
||||
uuid: Union[Unset, UUID] = UNSET
|
||||
username: Union[None, Unset, str] = UNSET
|
||||
email: Union[Unset, str] = UNSET
|
||||
phone_number: Union[Unset, str] = UNSET
|
||||
first_name: Union[Unset, str] = UNSET
|
||||
last_name: Union[Unset, str] = UNSET
|
||||
name: Union[Unset, str] = UNSET
|
||||
avatar: Union[None, Unset, str] = UNSET
|
||||
gender: Union[BlankEnum, GenderEnum, None, Unset] = UNSET
|
||||
education_degree: Union[BlankEnum, EducationDegreeEnum, None, Unset] = UNSET
|
||||
education_field: Union[None, Unset, str] = UNSET
|
||||
birthdate: Union[None, Unset, datetime.date] = UNSET
|
||||
iban: Union[None, Unset, str] = UNSET
|
||||
iban_verified: Union[None, Unset, bool] = UNSET
|
||||
province: Union[None, Unset, int] = UNSET
|
||||
province_name: Union[Unset, str] = UNSET
|
||||
city: Union[None, Unset, int] = UNSET
|
||||
city_name: Union[Unset, str] = UNSET
|
||||
postal_code: Union[None, Unset, str] = UNSET
|
||||
address: Union[None, Unset, str] = UNSET
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
uuid: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.uuid, Unset):
|
||||
uuid = str(self.uuid)
|
||||
|
||||
username: Union[None, Unset, str]
|
||||
if isinstance(self.username, Unset):
|
||||
username = UNSET
|
||||
else:
|
||||
username = self.username
|
||||
|
||||
email = self.email
|
||||
|
||||
phone_number = self.phone_number
|
||||
|
||||
first_name = self.first_name
|
||||
|
||||
last_name = self.last_name
|
||||
|
||||
name = self.name
|
||||
|
||||
avatar: Union[None, Unset, str]
|
||||
if isinstance(self.avatar, Unset):
|
||||
avatar = UNSET
|
||||
else:
|
||||
avatar = self.avatar
|
||||
|
||||
gender: Union[None, Unset, str]
|
||||
if isinstance(self.gender, Unset):
|
||||
gender = UNSET
|
||||
elif isinstance(self.gender, GenderEnum):
|
||||
gender = self.gender.value
|
||||
elif isinstance(self.gender, BlankEnum):
|
||||
gender = self.gender.value
|
||||
else:
|
||||
gender = self.gender
|
||||
|
||||
education_degree: Union[None, Unset, str]
|
||||
if isinstance(self.education_degree, Unset):
|
||||
education_degree = UNSET
|
||||
elif isinstance(self.education_degree, EducationDegreeEnum):
|
||||
education_degree = self.education_degree.value
|
||||
elif isinstance(self.education_degree, BlankEnum):
|
||||
education_degree = self.education_degree.value
|
||||
else:
|
||||
education_degree = self.education_degree
|
||||
|
||||
education_field: Union[None, Unset, str]
|
||||
if isinstance(self.education_field, Unset):
|
||||
education_field = UNSET
|
||||
else:
|
||||
education_field = self.education_field
|
||||
|
||||
birthdate: Union[None, Unset, str]
|
||||
if isinstance(self.birthdate, Unset):
|
||||
birthdate = UNSET
|
||||
elif isinstance(self.birthdate, datetime.date):
|
||||
birthdate = self.birthdate.isoformat()
|
||||
else:
|
||||
birthdate = self.birthdate
|
||||
|
||||
iban: Union[None, Unset, str]
|
||||
if isinstance(self.iban, Unset):
|
||||
iban = UNSET
|
||||
else:
|
||||
iban = self.iban
|
||||
|
||||
iban_verified: Union[None, Unset, bool]
|
||||
if isinstance(self.iban_verified, Unset):
|
||||
iban_verified = UNSET
|
||||
else:
|
||||
iban_verified = self.iban_verified
|
||||
|
||||
province: Union[None, Unset, int]
|
||||
if isinstance(self.province, Unset):
|
||||
province = UNSET
|
||||
else:
|
||||
province = self.province
|
||||
|
||||
province_name = self.province_name
|
||||
|
||||
city: Union[None, Unset, int]
|
||||
if isinstance(self.city, Unset):
|
||||
city = UNSET
|
||||
else:
|
||||
city = self.city
|
||||
|
||||
city_name = self.city_name
|
||||
|
||||
postal_code: Union[None, Unset, str]
|
||||
if isinstance(self.postal_code, Unset):
|
||||
postal_code = UNSET
|
||||
else:
|
||||
postal_code = self.postal_code
|
||||
|
||||
address: Union[None, Unset, str]
|
||||
if isinstance(self.address, Unset):
|
||||
address = UNSET
|
||||
else:
|
||||
address = self.address
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update({})
|
||||
if uuid is not UNSET:
|
||||
field_dict["uuid"] = uuid
|
||||
if username is not UNSET:
|
||||
field_dict["username"] = username
|
||||
if email is not UNSET:
|
||||
field_dict["email"] = email
|
||||
if phone_number is not UNSET:
|
||||
field_dict["phone_number"] = phone_number
|
||||
if first_name is not UNSET:
|
||||
field_dict["first_name"] = first_name
|
||||
if last_name is not UNSET:
|
||||
field_dict["last_name"] = last_name
|
||||
if name is not UNSET:
|
||||
field_dict["name"] = name
|
||||
if avatar is not UNSET:
|
||||
field_dict["avatar"] = avatar
|
||||
if gender is not UNSET:
|
||||
field_dict["gender"] = gender
|
||||
if education_degree is not UNSET:
|
||||
field_dict["education_degree"] = education_degree
|
||||
if education_field is not UNSET:
|
||||
field_dict["education_field"] = education_field
|
||||
if birthdate is not UNSET:
|
||||
field_dict["birthdate"] = birthdate
|
||||
if iban is not UNSET:
|
||||
field_dict["iban"] = iban
|
||||
if iban_verified is not UNSET:
|
||||
field_dict["iban_verified"] = iban_verified
|
||||
if province is not UNSET:
|
||||
field_dict["province"] = province
|
||||
if province_name is not UNSET:
|
||||
field_dict["province_name"] = province_name
|
||||
if city is not UNSET:
|
||||
field_dict["city"] = city
|
||||
if city_name is not UNSET:
|
||||
field_dict["city_name"] = city_name
|
||||
if postal_code is not UNSET:
|
||||
field_dict["postal_code"] = postal_code
|
||||
if address is not UNSET:
|
||||
field_dict["address"] = address
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
d = dict(src_dict)
|
||||
_uuid = d.pop("uuid", UNSET)
|
||||
uuid: Union[Unset, UUID]
|
||||
if isinstance(_uuid, Unset):
|
||||
uuid = UNSET
|
||||
else:
|
||||
uuid = UUID(_uuid)
|
||||
|
||||
def _parse_username(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)
|
||||
|
||||
username = _parse_username(d.pop("username", UNSET))
|
||||
|
||||
email = d.pop("email", UNSET)
|
||||
|
||||
phone_number = d.pop("phone_number", UNSET)
|
||||
|
||||
first_name = d.pop("first_name", UNSET)
|
||||
|
||||
last_name = d.pop("last_name", UNSET)
|
||||
|
||||
name = d.pop("name", UNSET)
|
||||
|
||||
def _parse_avatar(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)
|
||||
|
||||
avatar = _parse_avatar(d.pop("avatar", UNSET))
|
||||
|
||||
def _parse_gender(data: object) -> Union[BlankEnum, GenderEnum, None, Unset]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
try:
|
||||
if not isinstance(data, str):
|
||||
raise TypeError()
|
||||
gender_type_0 = GenderEnum(data)
|
||||
|
||||
return gender_type_0
|
||||
except: # noqa: E722
|
||||
pass
|
||||
try:
|
||||
if not isinstance(data, str):
|
||||
raise TypeError()
|
||||
gender_type_1 = BlankEnum(data)
|
||||
|
||||
return gender_type_1
|
||||
except: # noqa: E722
|
||||
pass
|
||||
return cast(Union[BlankEnum, GenderEnum, None, Unset], data)
|
||||
|
||||
gender = _parse_gender(d.pop("gender", UNSET))
|
||||
|
||||
def _parse_education_degree(data: object) -> Union[BlankEnum, EducationDegreeEnum, None, Unset]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
try:
|
||||
if not isinstance(data, str):
|
||||
raise TypeError()
|
||||
education_degree_type_0 = EducationDegreeEnum(data)
|
||||
|
||||
return education_degree_type_0
|
||||
except: # noqa: E722
|
||||
pass
|
||||
try:
|
||||
if not isinstance(data, str):
|
||||
raise TypeError()
|
||||
education_degree_type_1 = BlankEnum(data)
|
||||
|
||||
return education_degree_type_1
|
||||
except: # noqa: E722
|
||||
pass
|
||||
return cast(Union[BlankEnum, EducationDegreeEnum, None, Unset], data)
|
||||
|
||||
education_degree = _parse_education_degree(d.pop("education_degree", UNSET))
|
||||
|
||||
def _parse_education_field(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)
|
||||
|
||||
education_field = _parse_education_field(d.pop("education_field", UNSET))
|
||||
|
||||
def _parse_birthdate(data: object) -> Union[None, Unset, datetime.date]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
try:
|
||||
if not isinstance(data, str):
|
||||
raise TypeError()
|
||||
birthdate_type_0 = isoparse(data).date()
|
||||
|
||||
return birthdate_type_0
|
||||
except: # noqa: E722
|
||||
pass
|
||||
return cast(Union[None, Unset, datetime.date], data)
|
||||
|
||||
birthdate = _parse_birthdate(d.pop("birthdate", UNSET))
|
||||
|
||||
def _parse_iban(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)
|
||||
|
||||
iban = _parse_iban(d.pop("iban", UNSET))
|
||||
|
||||
def _parse_iban_verified(data: object) -> Union[None, Unset, bool]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, bool], data)
|
||||
|
||||
iban_verified = _parse_iban_verified(d.pop("iban_verified", UNSET))
|
||||
|
||||
def _parse_province(data: object) -> Union[None, Unset, int]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, int], data)
|
||||
|
||||
province = _parse_province(d.pop("province", UNSET))
|
||||
|
||||
province_name = d.pop("province_name", UNSET)
|
||||
|
||||
def _parse_city(data: object) -> Union[None, Unset, int]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, int], data)
|
||||
|
||||
city = _parse_city(d.pop("city", UNSET))
|
||||
|
||||
city_name = d.pop("city_name", UNSET)
|
||||
|
||||
def _parse_postal_code(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)
|
||||
|
||||
postal_code = _parse_postal_code(d.pop("postal_code", UNSET))
|
||||
|
||||
def _parse_address(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)
|
||||
|
||||
address = _parse_address(d.pop("address", UNSET))
|
||||
|
||||
patched_account = cls(
|
||||
uuid=uuid,
|
||||
username=username,
|
||||
email=email,
|
||||
phone_number=phone_number,
|
||||
first_name=first_name,
|
||||
last_name=last_name,
|
||||
name=name,
|
||||
avatar=avatar,
|
||||
gender=gender,
|
||||
education_degree=education_degree,
|
||||
education_field=education_field,
|
||||
birthdate=birthdate,
|
||||
iban=iban,
|
||||
iban_verified=iban_verified,
|
||||
province=province,
|
||||
province_name=province_name,
|
||||
city=city,
|
||||
city_name=city_name,
|
||||
postal_code=postal_code,
|
||||
address=address,
|
||||
)
|
||||
|
||||
patched_account.additional_properties = d
|
||||
return patched_account
|
||||
|
||||
@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,77 @@
|
|||
from collections.abc import Mapping
|
||||
from typing import Any, TypeVar, Union
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
T = TypeVar("T", bound="PatchedChangePassword")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class PatchedChangePassword:
|
||||
"""
|
||||
Attributes:
|
||||
old_password (Union[Unset, str]):
|
||||
old_password_field (Union[Unset, str]): Default: 'password'.
|
||||
new_password (Union[Unset, str]):
|
||||
"""
|
||||
|
||||
old_password: Union[Unset, str] = UNSET
|
||||
old_password_field: Union[Unset, str] = "password"
|
||||
new_password: Union[Unset, str] = UNSET
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
old_password = self.old_password
|
||||
|
||||
old_password_field = self.old_password_field
|
||||
|
||||
new_password = self.new_password
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update({})
|
||||
if old_password is not UNSET:
|
||||
field_dict["old_password"] = old_password
|
||||
if old_password_field is not UNSET:
|
||||
field_dict["old_password_field"] = old_password_field
|
||||
if new_password is not UNSET:
|
||||
field_dict["new_password"] = new_password
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
d = dict(src_dict)
|
||||
old_password = d.pop("old_password", UNSET)
|
||||
|
||||
old_password_field = d.pop("old_password_field", UNSET)
|
||||
|
||||
new_password = d.pop("new_password", UNSET)
|
||||
|
||||
patched_change_password = cls(
|
||||
old_password=old_password,
|
||||
old_password_field=old_password_field,
|
||||
new_password=new_password,
|
||||
)
|
||||
|
||||
patched_change_password.additional_properties = d
|
||||
return patched_change_password
|
||||
|
||||
@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
|
||||
113
utils/clients/gooyal_accounts_client/models/public_user.py
Normal file
113
utils/clients/gooyal_accounts_client/models/public_user.py
Normal file
|
|
@ -0,0 +1,113 @@
|
|||
from collections.abc import Mapping
|
||||
from typing import Any, TypeVar, Union, cast
|
||||
from uuid import UUID
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
T = TypeVar("T", bound="PublicUser")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class PublicUser:
|
||||
"""
|
||||
Attributes:
|
||||
avatar (Union[None, str]):
|
||||
name (str):
|
||||
username (Union[None, str]): Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.
|
||||
first_name (str):
|
||||
last_name (str):
|
||||
uuid (UUID):
|
||||
"""
|
||||
|
||||
avatar: Union[None, str]
|
||||
name: str
|
||||
username: Union[None, str]
|
||||
first_name: str
|
||||
last_name: str
|
||||
uuid: UUID
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
avatar: Union[None, str]
|
||||
avatar = self.avatar
|
||||
|
||||
name = self.name
|
||||
|
||||
username: Union[None, str]
|
||||
username = self.username
|
||||
|
||||
first_name = self.first_name
|
||||
|
||||
last_name = self.last_name
|
||||
|
||||
uuid = str(self.uuid)
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update(
|
||||
{
|
||||
"avatar": avatar,
|
||||
"name": name,
|
||||
"username": username,
|
||||
"first_name": first_name,
|
||||
"last_name": last_name,
|
||||
"uuid": uuid,
|
||||
}
|
||||
)
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
d = dict(src_dict)
|
||||
|
||||
def _parse_avatar(data: object) -> Union[None, str]:
|
||||
if data is None:
|
||||
return data
|
||||
return cast(Union[None, str], data)
|
||||
|
||||
avatar = _parse_avatar(d.pop("avatar"))
|
||||
|
||||
name = d.pop("name")
|
||||
|
||||
def _parse_username(data: object) -> Union[None, str]:
|
||||
if data is None:
|
||||
return data
|
||||
return cast(Union[None, str], data)
|
||||
|
||||
username = _parse_username(d.pop("username"))
|
||||
|
||||
first_name = d.pop("first_name")
|
||||
|
||||
last_name = d.pop("last_name")
|
||||
|
||||
uuid = UUID(d.pop("uuid"))
|
||||
|
||||
public_user = cls(
|
||||
avatar=avatar,
|
||||
name=name,
|
||||
username=username,
|
||||
first_name=first_name,
|
||||
last_name=last_name,
|
||||
uuid=uuid,
|
||||
)
|
||||
|
||||
public_user.additional_properties = d
|
||||
return public_user
|
||||
|
||||
@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
|
||||
94
utils/clients/gooyal_accounts_client/models/request_otp.py
Normal file
94
utils/clients/gooyal_accounts_client/models/request_otp.py
Normal file
|
|
@ -0,0 +1,94 @@
|
|||
import datetime
|
||||
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 dateutil.parser import isoparse
|
||||
|
||||
T = TypeVar("T", bound="RequestOTP")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class RequestOTP:
|
||||
"""
|
||||
Attributes:
|
||||
phone_number (str):
|
||||
otp_expire (Union[None, datetime.datetime]):
|
||||
ttl (str):
|
||||
"""
|
||||
|
||||
phone_number: str
|
||||
otp_expire: Union[None, datetime.datetime]
|
||||
ttl: str
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
phone_number = self.phone_number
|
||||
|
||||
otp_expire: Union[None, str]
|
||||
if isinstance(self.otp_expire, datetime.datetime):
|
||||
otp_expire = self.otp_expire.isoformat()
|
||||
else:
|
||||
otp_expire = self.otp_expire
|
||||
|
||||
ttl = self.ttl
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update(
|
||||
{
|
||||
"phone_number": phone_number,
|
||||
"otp_expire": otp_expire,
|
||||
"ttl": ttl,
|
||||
}
|
||||
)
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
d = dict(src_dict)
|
||||
phone_number = d.pop("phone_number")
|
||||
|
||||
def _parse_otp_expire(data: object) -> Union[None, datetime.datetime]:
|
||||
if data is None:
|
||||
return data
|
||||
try:
|
||||
if not isinstance(data, str):
|
||||
raise TypeError()
|
||||
otp_expire_type_0 = isoparse(data)
|
||||
|
||||
return otp_expire_type_0
|
||||
except: # noqa: E722
|
||||
pass
|
||||
return cast(Union[None, datetime.datetime], data)
|
||||
|
||||
otp_expire = _parse_otp_expire(d.pop("otp_expire"))
|
||||
|
||||
ttl = d.pop("ttl")
|
||||
|
||||
request_otp = cls(
|
||||
phone_number=phone_number,
|
||||
otp_expire=otp_expire,
|
||||
ttl=ttl,
|
||||
)
|
||||
|
||||
request_otp.additional_properties = d
|
||||
return request_otp
|
||||
|
||||
@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
|
||||
100
utils/clients/gooyal_accounts_client/models/request_ott.py
Normal file
100
utils/clients/gooyal_accounts_client/models/request_ott.py
Normal file
|
|
@ -0,0 +1,100 @@
|
|||
import datetime
|
||||
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 dateutil.parser import isoparse
|
||||
|
||||
T = TypeVar("T", bound="RequestOTT")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class RequestOTT:
|
||||
"""
|
||||
Attributes:
|
||||
application (str):
|
||||
ott (Union[None, str]):
|
||||
ott_expire (Union[None, datetime.datetime]):
|
||||
"""
|
||||
|
||||
application: str
|
||||
ott: Union[None, str]
|
||||
ott_expire: Union[None, datetime.datetime]
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
application = self.application
|
||||
|
||||
ott: Union[None, str]
|
||||
ott = self.ott
|
||||
|
||||
ott_expire: Union[None, str]
|
||||
if isinstance(self.ott_expire, datetime.datetime):
|
||||
ott_expire = self.ott_expire.isoformat()
|
||||
else:
|
||||
ott_expire = self.ott_expire
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update(
|
||||
{
|
||||
"application": application,
|
||||
"ott": ott,
|
||||
"ott_expire": ott_expire,
|
||||
}
|
||||
)
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
d = dict(src_dict)
|
||||
application = d.pop("application")
|
||||
|
||||
def _parse_ott(data: object) -> Union[None, str]:
|
||||
if data is None:
|
||||
return data
|
||||
return cast(Union[None, str], data)
|
||||
|
||||
ott = _parse_ott(d.pop("ott"))
|
||||
|
||||
def _parse_ott_expire(data: object) -> Union[None, datetime.datetime]:
|
||||
if data is None:
|
||||
return data
|
||||
try:
|
||||
if not isinstance(data, str):
|
||||
raise TypeError()
|
||||
ott_expire_type_0 = isoparse(data)
|
||||
|
||||
return ott_expire_type_0
|
||||
except: # noqa: E722
|
||||
pass
|
||||
return cast(Union[None, datetime.datetime], data)
|
||||
|
||||
ott_expire = _parse_ott_expire(d.pop("ott_expire"))
|
||||
|
||||
request_ott = cls(
|
||||
application=application,
|
||||
ott=ott,
|
||||
ott_expire=ott_expire,
|
||||
)
|
||||
|
||||
request_ott.additional_properties = d
|
||||
return request_ott
|
||||
|
||||
@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
|
||||
|
|
@ -1,45 +1,55 @@
|
|||
from typing import Any, TypeVar, Union
|
||||
from collections.abc import Mapping
|
||||
from typing import Any, TypeVar
|
||||
from uuid import UUID
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
T = TypeVar("T", bound="ApplicationBalance")
|
||||
T = TypeVar("T", bound="UserInquiry")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class ApplicationBalance:
|
||||
class UserInquiry:
|
||||
"""
|
||||
Attributes:
|
||||
balance (Union[Unset, int]):
|
||||
uuid (UUID):
|
||||
phone_number (str):
|
||||
"""
|
||||
|
||||
balance: Union[Unset, int] = UNSET
|
||||
uuid: UUID
|
||||
phone_number: str
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
balance = self.balance
|
||||
uuid = str(self.uuid)
|
||||
|
||||
phone_number = self.phone_number
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update({})
|
||||
if balance is not UNSET:
|
||||
field_dict["balance"] = balance
|
||||
field_dict.update(
|
||||
{
|
||||
"uuid": uuid,
|
||||
"phone_number": phone_number,
|
||||
}
|
||||
)
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
|
||||
d = src_dict.copy()
|
||||
balance = d.pop("balance", UNSET)
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
d = dict(src_dict)
|
||||
uuid = UUID(d.pop("uuid"))
|
||||
|
||||
application_balance = cls(
|
||||
balance=balance,
|
||||
phone_number = d.pop("phone_number")
|
||||
|
||||
user_inquiry = cls(
|
||||
uuid=uuid,
|
||||
phone_number=phone_number,
|
||||
)
|
||||
|
||||
application_balance.additional_properties = d
|
||||
return application_balance
|
||||
user_inquiry.additional_properties = d
|
||||
return user_inquiry
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
1
utils/clients/gooyal_wallet_client/api/__init__.py
Normal file
1
utils/clients/gooyal_wallet_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"""
|
||||
|
|
@ -10,6 +10,7 @@ from ...types import Response
|
|||
|
||||
|
||||
def _get_kwargs(
|
||||
payer_wallet: str,
|
||||
*,
|
||||
body: ApplicationDeposit,
|
||||
) -> dict[str, Any]:
|
||||
|
|
@ -17,12 +18,11 @@ def _get_kwargs(
|
|||
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "post",
|
||||
"url": "/wallet/api/application/deposit/",
|
||||
"url": f"/wallet/api/application/{payer_wallet}/deposit/",
|
||||
}
|
||||
|
||||
_body = body.to_dict()
|
||||
_kwargs["json"] = body.to_dict()
|
||||
|
||||
_kwargs["json"] = _body
|
||||
headers["Content-Type"] = "application/json"
|
||||
|
||||
_kwargs["headers"] = headers
|
||||
|
|
@ -36,6 +36,7 @@ def _parse_response(
|
|||
response_201 = ApplicationDeposit.from_dict(response.json())
|
||||
|
||||
return response_201
|
||||
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
|
|
@ -54,12 +55,14 @@ def _build_response(
|
|||
|
||||
|
||||
def sync_detailed(
|
||||
payer_wallet: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: ApplicationDeposit,
|
||||
) -> Response[ApplicationDeposit]:
|
||||
"""
|
||||
Args:
|
||||
payer_wallet (str):
|
||||
body (ApplicationDeposit):
|
||||
|
||||
Raises:
|
||||
|
|
@ -71,6 +74,7 @@ def sync_detailed(
|
|||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
payer_wallet=payer_wallet,
|
||||
body=body,
|
||||
)
|
||||
|
||||
|
|
@ -82,12 +86,14 @@ def sync_detailed(
|
|||
|
||||
|
||||
def sync(
|
||||
payer_wallet: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: ApplicationDeposit,
|
||||
) -> Optional[ApplicationDeposit]:
|
||||
"""
|
||||
Args:
|
||||
payer_wallet (str):
|
||||
body (ApplicationDeposit):
|
||||
|
||||
Raises:
|
||||
|
|
@ -99,18 +105,21 @@ def sync(
|
|||
"""
|
||||
|
||||
return sync_detailed(
|
||||
payer_wallet=payer_wallet,
|
||||
client=client,
|
||||
body=body,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
payer_wallet: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: ApplicationDeposit,
|
||||
) -> Response[ApplicationDeposit]:
|
||||
"""
|
||||
Args:
|
||||
payer_wallet (str):
|
||||
body (ApplicationDeposit):
|
||||
|
||||
Raises:
|
||||
|
|
@ -122,6 +131,7 @@ async def asyncio_detailed(
|
|||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
payer_wallet=payer_wallet,
|
||||
body=body,
|
||||
)
|
||||
|
||||
|
|
@ -131,12 +141,14 @@ async def asyncio_detailed(
|
|||
|
||||
|
||||
async def asyncio(
|
||||
payer_wallet: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: ApplicationDeposit,
|
||||
) -> Optional[ApplicationDeposit]:
|
||||
"""
|
||||
Args:
|
||||
payer_wallet (str):
|
||||
body (ApplicationDeposit):
|
||||
|
||||
Raises:
|
||||
|
|
@ -149,6 +161,7 @@ async def asyncio(
|
|||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
payer_wallet=payer_wallet,
|
||||
client=client,
|
||||
body=body,
|
||||
)
|
||||
|
|
@ -10,11 +10,12 @@ from ...types import Response
|
|||
|
||||
|
||||
def _get_kwargs(
|
||||
payer_wallet: str,
|
||||
uuid: str,
|
||||
) -> dict[str, Any]:
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "get",
|
||||
"url": f"/wallet/api/application/deposit/{uuid}/verify",
|
||||
"url": f"/wallet/api/application/{payer_wallet}/deposit/{uuid}/verify",
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
|
@ -27,6 +28,7 @@ def _parse_response(
|
|||
response_200 = ApplicationDeposit.from_dict(response.json())
|
||||
|
||||
return response_200
|
||||
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
|
|
@ -45,12 +47,14 @@ def _build_response(
|
|||
|
||||
|
||||
def sync_detailed(
|
||||
payer_wallet: str,
|
||||
uuid: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Response[ApplicationDeposit]:
|
||||
"""
|
||||
Args:
|
||||
payer_wallet (str):
|
||||
uuid (str):
|
||||
|
||||
Raises:
|
||||
|
|
@ -62,6 +66,7 @@ def sync_detailed(
|
|||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
payer_wallet=payer_wallet,
|
||||
uuid=uuid,
|
||||
)
|
||||
|
||||
|
|
@ -73,12 +78,14 @@ def sync_detailed(
|
|||
|
||||
|
||||
def sync(
|
||||
payer_wallet: str,
|
||||
uuid: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Optional[ApplicationDeposit]:
|
||||
"""
|
||||
Args:
|
||||
payer_wallet (str):
|
||||
uuid (str):
|
||||
|
||||
Raises:
|
||||
|
|
@ -90,18 +97,21 @@ def sync(
|
|||
"""
|
||||
|
||||
return sync_detailed(
|
||||
payer_wallet=payer_wallet,
|
||||
uuid=uuid,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
payer_wallet: str,
|
||||
uuid: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Response[ApplicationDeposit]:
|
||||
"""
|
||||
Args:
|
||||
payer_wallet (str):
|
||||
uuid (str):
|
||||
|
||||
Raises:
|
||||
|
|
@ -113,6 +123,7 @@ async def asyncio_detailed(
|
|||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
payer_wallet=payer_wallet,
|
||||
uuid=uuid,
|
||||
)
|
||||
|
||||
|
|
@ -122,12 +133,14 @@ async def asyncio_detailed(
|
|||
|
||||
|
||||
async def asyncio(
|
||||
payer_wallet: str,
|
||||
uuid: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Optional[ApplicationDeposit]:
|
||||
"""
|
||||
Args:
|
||||
payer_wallet (str):
|
||||
uuid (str):
|
||||
|
||||
Raises:
|
||||
|
|
@ -140,6 +153,7 @@ async def asyncio(
|
|||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
payer_wallet=payer_wallet,
|
||||
uuid=uuid,
|
||||
client=client,
|
||||
)
|
||||
|
|
@ -0,0 +1,227 @@
|
|||
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_transaction_list import PaginatedTransactionList
|
||||
from ...types import UNSET, Response, Unset
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
limit: Union[Unset, int] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
payee: Union[Unset, UUID] = UNSET,
|
||||
payer: Union[Unset, UUID] = UNSET,
|
||||
wallets: list[UUID],
|
||||
) -> dict[str, Any]:
|
||||
params: dict[str, Any] = {}
|
||||
|
||||
params["limit"] = limit
|
||||
|
||||
params["offset"] = offset
|
||||
|
||||
json_payee: Union[Unset, str] = UNSET
|
||||
if not isinstance(payee, Unset):
|
||||
json_payee = str(payee)
|
||||
params["payee"] = json_payee
|
||||
|
||||
json_payer: Union[Unset, str] = UNSET
|
||||
if not isinstance(payer, Unset):
|
||||
json_payer = str(payer)
|
||||
params["payer"] = json_payer
|
||||
|
||||
json_wallets = []
|
||||
for wallets_item_data in wallets:
|
||||
wallets_item = str(wallets_item_data)
|
||||
json_wallets.append(wallets_item)
|
||||
|
||||
params["wallets"] = json_wallets
|
||||
|
||||
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": "/wallet/api/application/transactions/",
|
||||
"params": params,
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[PaginatedTransactionList]:
|
||||
if response.status_code == 200:
|
||||
response_200 = PaginatedTransactionList.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[PaginatedTransactionList]:
|
||||
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,
|
||||
payee: Union[Unset, UUID] = UNSET,
|
||||
payer: Union[Unset, UUID] = UNSET,
|
||||
wallets: list[UUID],
|
||||
) -> Response[PaginatedTransactionList]:
|
||||
"""
|
||||
Args:
|
||||
limit (Union[Unset, int]):
|
||||
offset (Union[Unset, int]):
|
||||
payee (Union[Unset, UUID]):
|
||||
payer (Union[Unset, UUID]):
|
||||
wallets (list[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[PaginatedTransactionList]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
limit=limit,
|
||||
offset=offset,
|
||||
payee=payee,
|
||||
payer=payer,
|
||||
wallets=wallets,
|
||||
)
|
||||
|
||||
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,
|
||||
payee: Union[Unset, UUID] = UNSET,
|
||||
payer: Union[Unset, UUID] = UNSET,
|
||||
wallets: list[UUID],
|
||||
) -> Optional[PaginatedTransactionList]:
|
||||
"""
|
||||
Args:
|
||||
limit (Union[Unset, int]):
|
||||
offset (Union[Unset, int]):
|
||||
payee (Union[Unset, UUID]):
|
||||
payer (Union[Unset, UUID]):
|
||||
wallets (list[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:
|
||||
PaginatedTransactionList
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
limit=limit,
|
||||
offset=offset,
|
||||
payee=payee,
|
||||
payer=payer,
|
||||
wallets=wallets,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
limit: Union[Unset, int] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
payee: Union[Unset, UUID] = UNSET,
|
||||
payer: Union[Unset, UUID] = UNSET,
|
||||
wallets: list[UUID],
|
||||
) -> Response[PaginatedTransactionList]:
|
||||
"""
|
||||
Args:
|
||||
limit (Union[Unset, int]):
|
||||
offset (Union[Unset, int]):
|
||||
payee (Union[Unset, UUID]):
|
||||
payer (Union[Unset, UUID]):
|
||||
wallets (list[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[PaginatedTransactionList]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
limit=limit,
|
||||
offset=offset,
|
||||
payee=payee,
|
||||
payer=payer,
|
||||
wallets=wallets,
|
||||
)
|
||||
|
||||
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,
|
||||
payee: Union[Unset, UUID] = UNSET,
|
||||
payer: Union[Unset, UUID] = UNSET,
|
||||
wallets: list[UUID],
|
||||
) -> Optional[PaginatedTransactionList]:
|
||||
"""
|
||||
Args:
|
||||
limit (Union[Unset, int]):
|
||||
offset (Union[Unset, int]):
|
||||
payee (Union[Unset, UUID]):
|
||||
payer (Union[Unset, UUID]):
|
||||
wallets (list[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:
|
||||
PaginatedTransactionList
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
client=client,
|
||||
limit=limit,
|
||||
offset=offset,
|
||||
payee=payee,
|
||||
payer=payer,
|
||||
wallets=wallets,
|
||||
)
|
||||
).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.transaction import Transaction
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
uuid: UUID,
|
||||
) -> dict[str, Any]:
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "get",
|
||||
"url": f"/wallet/api/application/transactions/{uuid}/",
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Transaction]:
|
||||
if response.status_code == 200:
|
||||
response_200 = Transaction.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[Transaction]:
|
||||
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[Transaction]:
|
||||
"""
|
||||
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[Transaction]
|
||||
"""
|
||||
|
||||
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[Transaction]:
|
||||
"""
|
||||
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:
|
||||
Transaction
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
uuid=uuid,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
uuid: UUID,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Response[Transaction]:
|
||||
"""
|
||||
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[Transaction]
|
||||
"""
|
||||
|
||||
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[Transaction]:
|
||||
"""
|
||||
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:
|
||||
Transaction
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
uuid=uuid,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
||||
|
|
@ -0,0 +1,208 @@
|
|||
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_account_list import PaginatedAccountList
|
||||
from ...types import UNSET, Response, Unset
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
owner: str,
|
||||
*,
|
||||
limit: Union[Unset, int] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
wallet: list[UUID],
|
||||
) -> dict[str, Any]:
|
||||
params: dict[str, Any] = {}
|
||||
|
||||
params["limit"] = limit
|
||||
|
||||
params["offset"] = offset
|
||||
|
||||
json_wallet = []
|
||||
for wallet_item_data in wallet:
|
||||
wallet_item = str(wallet_item_data)
|
||||
json_wallet.append(wallet_item)
|
||||
|
||||
params["wallet"] = json_wallet
|
||||
|
||||
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"/wallet/api/application/user/wallets/{owner}/",
|
||||
"params": params,
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[PaginatedAccountList]:
|
||||
if response.status_code == 200:
|
||||
response_200 = PaginatedAccountList.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[PaginatedAccountList]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
owner: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
limit: Union[Unset, int] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
wallet: list[UUID],
|
||||
) -> Response[PaginatedAccountList]:
|
||||
"""API for getting specified user wallet.
|
||||
|
||||
Args:
|
||||
owner (str):
|
||||
limit (Union[Unset, int]):
|
||||
offset (Union[Unset, int]):
|
||||
wallet (list[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[PaginatedAccountList]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
owner=owner,
|
||||
limit=limit,
|
||||
offset=offset,
|
||||
wallet=wallet,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
owner: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
limit: Union[Unset, int] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
wallet: list[UUID],
|
||||
) -> Optional[PaginatedAccountList]:
|
||||
"""API for getting specified user wallet.
|
||||
|
||||
Args:
|
||||
owner (str):
|
||||
limit (Union[Unset, int]):
|
||||
offset (Union[Unset, int]):
|
||||
wallet (list[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:
|
||||
PaginatedAccountList
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
owner=owner,
|
||||
client=client,
|
||||
limit=limit,
|
||||
offset=offset,
|
||||
wallet=wallet,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
owner: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
limit: Union[Unset, int] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
wallet: list[UUID],
|
||||
) -> Response[PaginatedAccountList]:
|
||||
"""API for getting specified user wallet.
|
||||
|
||||
Args:
|
||||
owner (str):
|
||||
limit (Union[Unset, int]):
|
||||
offset (Union[Unset, int]):
|
||||
wallet (list[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[PaginatedAccountList]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
owner=owner,
|
||||
limit=limit,
|
||||
offset=offset,
|
||||
wallet=wallet,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
owner: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
limit: Union[Unset, int] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
wallet: list[UUID],
|
||||
) -> Optional[PaginatedAccountList]:
|
||||
"""API for getting specified user wallet.
|
||||
|
||||
Args:
|
||||
owner (str):
|
||||
limit (Union[Unset, int]):
|
||||
offset (Union[Unset, int]):
|
||||
wallet (list[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:
|
||||
PaginatedAccountList
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
owner=owner,
|
||||
client=client,
|
||||
limit=limit,
|
||||
offset=offset,
|
||||
wallet=wallet,
|
||||
)
|
||||
).parsed
|
||||
|
|
@ -0,0 +1,174 @@
|
|||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.paginated_account_list import PaginatedAccountList
|
||||
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": "/wallet/api/application/wallets/",
|
||||
"params": params,
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[PaginatedAccountList]:
|
||||
if response.status_code == 200:
|
||||
response_200 = PaginatedAccountList.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[PaginatedAccountList]:
|
||||
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[PaginatedAccountList]:
|
||||
"""API for getting specified user or application balance.
|
||||
|
||||
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[PaginatedAccountList]
|
||||
"""
|
||||
|
||||
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[PaginatedAccountList]:
|
||||
"""API for getting specified user or application balance.
|
||||
|
||||
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:
|
||||
PaginatedAccountList
|
||||
"""
|
||||
|
||||
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[PaginatedAccountList]:
|
||||
"""API for getting specified user or application balance.
|
||||
|
||||
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[PaginatedAccountList]
|
||||
"""
|
||||
|
||||
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[PaginatedAccountList]:
|
||||
"""API for getting specified user or application balance.
|
||||
|
||||
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:
|
||||
PaginatedAccountList
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
client=client,
|
||||
limit=limit,
|
||||
offset=offset,
|
||||
)
|
||||
).parsed
|
||||
|
|
@ -10,6 +10,7 @@ from ...types import Response
|
|||
|
||||
|
||||
def _get_kwargs(
|
||||
payee_wallet: str,
|
||||
*,
|
||||
body: ApplicationWithdraw,
|
||||
) -> dict[str, Any]:
|
||||
|
|
@ -17,12 +18,11 @@ def _get_kwargs(
|
|||
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "post",
|
||||
"url": "/wallet/api/application/withdraw/",
|
||||
"url": f"/wallet/api/application/{payee_wallet}/withdraw/",
|
||||
}
|
||||
|
||||
_body = body.to_dict()
|
||||
_kwargs["json"] = body.to_dict()
|
||||
|
||||
_kwargs["json"] = _body
|
||||
headers["Content-Type"] = "application/json"
|
||||
|
||||
_kwargs["headers"] = headers
|
||||
|
|
@ -36,6 +36,7 @@ def _parse_response(
|
|||
response_201 = ApplicationWithdraw.from_dict(response.json())
|
||||
|
||||
return response_201
|
||||
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
|
|
@ -54,12 +55,14 @@ def _build_response(
|
|||
|
||||
|
||||
def sync_detailed(
|
||||
payee_wallet: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: ApplicationWithdraw,
|
||||
) -> Response[ApplicationWithdraw]:
|
||||
"""
|
||||
Args:
|
||||
payee_wallet (str):
|
||||
body (ApplicationWithdraw):
|
||||
|
||||
Raises:
|
||||
|
|
@ -71,6 +74,7 @@ def sync_detailed(
|
|||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
payee_wallet=payee_wallet,
|
||||
body=body,
|
||||
)
|
||||
|
||||
|
|
@ -82,12 +86,14 @@ def sync_detailed(
|
|||
|
||||
|
||||
def sync(
|
||||
payee_wallet: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: ApplicationWithdraw,
|
||||
) -> Optional[ApplicationWithdraw]:
|
||||
"""
|
||||
Args:
|
||||
payee_wallet (str):
|
||||
body (ApplicationWithdraw):
|
||||
|
||||
Raises:
|
||||
|
|
@ -99,18 +105,21 @@ def sync(
|
|||
"""
|
||||
|
||||
return sync_detailed(
|
||||
payee_wallet=payee_wallet,
|
||||
client=client,
|
||||
body=body,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
payee_wallet: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: ApplicationWithdraw,
|
||||
) -> Response[ApplicationWithdraw]:
|
||||
"""
|
||||
Args:
|
||||
payee_wallet (str):
|
||||
body (ApplicationWithdraw):
|
||||
|
||||
Raises:
|
||||
|
|
@ -122,6 +131,7 @@ async def asyncio_detailed(
|
|||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
payee_wallet=payee_wallet,
|
||||
body=body,
|
||||
)
|
||||
|
||||
|
|
@ -131,12 +141,14 @@ async def asyncio_detailed(
|
|||
|
||||
|
||||
async def asyncio(
|
||||
payee_wallet: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: ApplicationWithdraw,
|
||||
) -> Optional[ApplicationWithdraw]:
|
||||
"""
|
||||
Args:
|
||||
payee_wallet (str):
|
||||
body (ApplicationWithdraw):
|
||||
|
||||
Raises:
|
||||
|
|
@ -149,6 +161,7 @@ async def asyncio(
|
|||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
payee_wallet=payee_wallet,
|
||||
client=client,
|
||||
body=body,
|
||||
)
|
||||
|
|
@ -10,11 +10,12 @@ from ...types import Response
|
|||
|
||||
|
||||
def _get_kwargs(
|
||||
payee_wallet: str,
|
||||
uuid: str,
|
||||
) -> dict[str, Any]:
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "get",
|
||||
"url": f"/wallet/api/application/withdraw/{uuid}/verify",
|
||||
"url": f"/wallet/api/application/{payee_wallet}/withdraw/{uuid}/verify",
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
|
@ -27,6 +28,7 @@ def _parse_response(
|
|||
response_200 = ApplicationWithdraw.from_dict(response.json())
|
||||
|
||||
return response_200
|
||||
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
|
|
@ -45,12 +47,14 @@ def _build_response(
|
|||
|
||||
|
||||
def sync_detailed(
|
||||
payee_wallet: str,
|
||||
uuid: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Response[ApplicationWithdraw]:
|
||||
"""
|
||||
Args:
|
||||
payee_wallet (str):
|
||||
uuid (str):
|
||||
|
||||
Raises:
|
||||
|
|
@ -62,6 +66,7 @@ def sync_detailed(
|
|||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
payee_wallet=payee_wallet,
|
||||
uuid=uuid,
|
||||
)
|
||||
|
||||
|
|
@ -73,12 +78,14 @@ def sync_detailed(
|
|||
|
||||
|
||||
def sync(
|
||||
payee_wallet: str,
|
||||
uuid: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Optional[ApplicationWithdraw]:
|
||||
"""
|
||||
Args:
|
||||
payee_wallet (str):
|
||||
uuid (str):
|
||||
|
||||
Raises:
|
||||
|
|
@ -90,18 +97,21 @@ def sync(
|
|||
"""
|
||||
|
||||
return sync_detailed(
|
||||
payee_wallet=payee_wallet,
|
||||
uuid=uuid,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
payee_wallet: str,
|
||||
uuid: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Response[ApplicationWithdraw]:
|
||||
"""
|
||||
Args:
|
||||
payee_wallet (str):
|
||||
uuid (str):
|
||||
|
||||
Raises:
|
||||
|
|
@ -113,6 +123,7 @@ async def asyncio_detailed(
|
|||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
payee_wallet=payee_wallet,
|
||||
uuid=uuid,
|
||||
)
|
||||
|
||||
|
|
@ -122,12 +133,14 @@ async def asyncio_detailed(
|
|||
|
||||
|
||||
async def asyncio(
|
||||
payee_wallet: str,
|
||||
uuid: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Optional[ApplicationWithdraw]:
|
||||
"""
|
||||
Args:
|
||||
payee_wallet (str):
|
||||
uuid (str):
|
||||
|
||||
Raises:
|
||||
|
|
@ -140,6 +153,7 @@ async def asyncio(
|
|||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
payee_wallet=payee_wallet,
|
||||
uuid=uuid,
|
||||
client=client,
|
||||
)
|
||||
|
|
@ -0,0 +1,247 @@
|
|||
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_transaction_list import PaginatedTransactionList
|
||||
from ...types import UNSET, Response, Unset
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
limit: Union[Unset, int] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
payee: Union[Unset, UUID] = UNSET,
|
||||
payer: Union[Unset, UUID] = UNSET,
|
||||
wallets: list[UUID],
|
||||
) -> dict[str, Any]:
|
||||
params: dict[str, Any] = {}
|
||||
|
||||
params["limit"] = limit
|
||||
|
||||
params["offset"] = offset
|
||||
|
||||
json_payee: Union[Unset, str] = UNSET
|
||||
if not isinstance(payee, Unset):
|
||||
json_payee = str(payee)
|
||||
params["payee"] = json_payee
|
||||
|
||||
json_payer: Union[Unset, str] = UNSET
|
||||
if not isinstance(payer, Unset):
|
||||
json_payer = str(payer)
|
||||
params["payer"] = json_payer
|
||||
|
||||
json_wallets = []
|
||||
for wallets_item_data in wallets:
|
||||
wallets_item = str(wallets_item_data)
|
||||
json_wallets.append(wallets_item)
|
||||
|
||||
params["wallets"] = json_wallets
|
||||
|
||||
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": "/wallet/api/transactions/",
|
||||
"params": params,
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[PaginatedTransactionList]:
|
||||
if response.status_code == 200:
|
||||
response_200 = PaginatedTransactionList.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[PaginatedTransactionList]:
|
||||
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,
|
||||
payee: Union[Unset, UUID] = UNSET,
|
||||
payer: Union[Unset, UUID] = UNSET,
|
||||
wallets: list[UUID],
|
||||
) -> Response[PaginatedTransactionList]:
|
||||
"""GET: API for getting list of transactions for authenticated user
|
||||
POST: API for creating transaction for transferring funds from authenticated user to application
|
||||
owner. (deprecated)
|
||||
args:
|
||||
- user: authenticated user
|
||||
|
||||
Args:
|
||||
limit (Union[Unset, int]):
|
||||
offset (Union[Unset, int]):
|
||||
payee (Union[Unset, UUID]):
|
||||
payer (Union[Unset, UUID]):
|
||||
wallets (list[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[PaginatedTransactionList]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
limit=limit,
|
||||
offset=offset,
|
||||
payee=payee,
|
||||
payer=payer,
|
||||
wallets=wallets,
|
||||
)
|
||||
|
||||
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,
|
||||
payee: Union[Unset, UUID] = UNSET,
|
||||
payer: Union[Unset, UUID] = UNSET,
|
||||
wallets: list[UUID],
|
||||
) -> Optional[PaginatedTransactionList]:
|
||||
"""GET: API for getting list of transactions for authenticated user
|
||||
POST: API for creating transaction for transferring funds from authenticated user to application
|
||||
owner. (deprecated)
|
||||
args:
|
||||
- user: authenticated user
|
||||
|
||||
Args:
|
||||
limit (Union[Unset, int]):
|
||||
offset (Union[Unset, int]):
|
||||
payee (Union[Unset, UUID]):
|
||||
payer (Union[Unset, UUID]):
|
||||
wallets (list[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:
|
||||
PaginatedTransactionList
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
limit=limit,
|
||||
offset=offset,
|
||||
payee=payee,
|
||||
payer=payer,
|
||||
wallets=wallets,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
limit: Union[Unset, int] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
payee: Union[Unset, UUID] = UNSET,
|
||||
payer: Union[Unset, UUID] = UNSET,
|
||||
wallets: list[UUID],
|
||||
) -> Response[PaginatedTransactionList]:
|
||||
"""GET: API for getting list of transactions for authenticated user
|
||||
POST: API for creating transaction for transferring funds from authenticated user to application
|
||||
owner. (deprecated)
|
||||
args:
|
||||
- user: authenticated user
|
||||
|
||||
Args:
|
||||
limit (Union[Unset, int]):
|
||||
offset (Union[Unset, int]):
|
||||
payee (Union[Unset, UUID]):
|
||||
payer (Union[Unset, UUID]):
|
||||
wallets (list[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[PaginatedTransactionList]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
limit=limit,
|
||||
offset=offset,
|
||||
payee=payee,
|
||||
payer=payer,
|
||||
wallets=wallets,
|
||||
)
|
||||
|
||||
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,
|
||||
payee: Union[Unset, UUID] = UNSET,
|
||||
payer: Union[Unset, UUID] = UNSET,
|
||||
wallets: list[UUID],
|
||||
) -> Optional[PaginatedTransactionList]:
|
||||
"""GET: API for getting list of transactions for authenticated user
|
||||
POST: API for creating transaction for transferring funds from authenticated user to application
|
||||
owner. (deprecated)
|
||||
args:
|
||||
- user: authenticated user
|
||||
|
||||
Args:
|
||||
limit (Union[Unset, int]):
|
||||
offset (Union[Unset, int]):
|
||||
payee (Union[Unset, UUID]):
|
||||
payer (Union[Unset, UUID]):
|
||||
wallets (list[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:
|
||||
PaginatedTransactionList
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
client=client,
|
||||
limit=limit,
|
||||
offset=offset,
|
||||
payee=payee,
|
||||
payer=payer,
|
||||
wallets=wallets,
|
||||
)
|
||||
).parsed
|
||||
|
|
@ -0,0 +1,195 @@
|
|||
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_account_list import PaginatedAccountList
|
||||
from ...types import UNSET, Response, Unset
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
limit: Union[Unset, int] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
wallet: list[UUID],
|
||||
) -> dict[str, Any]:
|
||||
params: dict[str, Any] = {}
|
||||
|
||||
params["limit"] = limit
|
||||
|
||||
params["offset"] = offset
|
||||
|
||||
json_wallet = []
|
||||
for wallet_item_data in wallet:
|
||||
wallet_item = str(wallet_item_data)
|
||||
json_wallet.append(wallet_item)
|
||||
|
||||
params["wallet"] = json_wallet
|
||||
|
||||
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": "/wallet/api/wallets/",
|
||||
"params": params,
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[PaginatedAccountList]:
|
||||
if response.status_code == 200:
|
||||
response_200 = PaginatedAccountList.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[PaginatedAccountList]:
|
||||
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,
|
||||
wallet: list[UUID],
|
||||
) -> Response[PaginatedAccountList]:
|
||||
"""API for getting authenticated user balance.
|
||||
|
||||
Args:
|
||||
limit (Union[Unset, int]):
|
||||
offset (Union[Unset, int]):
|
||||
wallet (list[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[PaginatedAccountList]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
limit=limit,
|
||||
offset=offset,
|
||||
wallet=wallet,
|
||||
)
|
||||
|
||||
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,
|
||||
wallet: list[UUID],
|
||||
) -> Optional[PaginatedAccountList]:
|
||||
"""API for getting authenticated user balance.
|
||||
|
||||
Args:
|
||||
limit (Union[Unset, int]):
|
||||
offset (Union[Unset, int]):
|
||||
wallet (list[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:
|
||||
PaginatedAccountList
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
limit=limit,
|
||||
offset=offset,
|
||||
wallet=wallet,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
limit: Union[Unset, int] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
wallet: list[UUID],
|
||||
) -> Response[PaginatedAccountList]:
|
||||
"""API for getting authenticated user balance.
|
||||
|
||||
Args:
|
||||
limit (Union[Unset, int]):
|
||||
offset (Union[Unset, int]):
|
||||
wallet (list[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[PaginatedAccountList]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
limit=limit,
|
||||
offset=offset,
|
||||
wallet=wallet,
|
||||
)
|
||||
|
||||
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,
|
||||
wallet: list[UUID],
|
||||
) -> Optional[PaginatedAccountList]:
|
||||
"""API for getting authenticated user balance.
|
||||
|
||||
Args:
|
||||
limit (Union[Unset, int]):
|
||||
offset (Union[Unset, int]):
|
||||
wallet (list[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:
|
||||
PaginatedAccountList
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
client=client,
|
||||
limit=limit,
|
||||
offset=offset,
|
||||
wallet=wallet,
|
||||
)
|
||||
).parsed
|
||||
268
utils/clients/gooyal_wallet_client/client.py
Normal file
268
utils/clients/gooyal_wallet_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_wallet_client/errors.py
Normal file
16
utils/clients/gooyal_wallet_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"]
|
||||
19
utils/clients/gooyal_wallet_client/models/__init__.py
Normal file
19
utils/clients/gooyal_wallet_client/models/__init__.py
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
"""Contains all the data models used in inputs/outputs"""
|
||||
|
||||
from .account import Account
|
||||
from .application_deposit import ApplicationDeposit
|
||||
from .application_withdraw import ApplicationWithdraw
|
||||
from .paginated_account_list import PaginatedAccountList
|
||||
from .paginated_transaction_list import PaginatedTransactionList
|
||||
from .state_enum import StateEnum
|
||||
from .transaction import Transaction
|
||||
|
||||
__all__ = (
|
||||
"Account",
|
||||
"ApplicationDeposit",
|
||||
"ApplicationWithdraw",
|
||||
"PaginatedAccountList",
|
||||
"PaginatedTransactionList",
|
||||
"StateEnum",
|
||||
"Transaction",
|
||||
)
|
||||
90
utils/clients/gooyal_wallet_client/models/account.py
Normal file
90
utils/clients/gooyal_wallet_client/models/account.py
Normal file
|
|
@ -0,0 +1,90 @@
|
|||
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 ..types import UNSET, Unset
|
||||
|
||||
T = TypeVar("T", bound="Account")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class Account:
|
||||
"""
|
||||
Attributes:
|
||||
balance (Union[Unset, int]):
|
||||
wallet (Union[None, UUID, Unset]):
|
||||
"""
|
||||
|
||||
balance: Union[Unset, int] = UNSET
|
||||
wallet: Union[None, UUID, Unset] = UNSET
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
balance = self.balance
|
||||
|
||||
wallet: Union[None, Unset, str]
|
||||
if isinstance(self.wallet, Unset):
|
||||
wallet = UNSET
|
||||
elif isinstance(self.wallet, UUID):
|
||||
wallet = str(self.wallet)
|
||||
else:
|
||||
wallet = self.wallet
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update({})
|
||||
if balance is not UNSET:
|
||||
field_dict["balance"] = balance
|
||||
if wallet is not UNSET:
|
||||
field_dict["wallet"] = wallet
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
d = dict(src_dict)
|
||||
balance = d.pop("balance", UNSET)
|
||||
|
||||
def _parse_wallet(data: object) -> Union[None, UUID, Unset]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
try:
|
||||
if not isinstance(data, str):
|
||||
raise TypeError()
|
||||
wallet_type_0 = UUID(data)
|
||||
|
||||
return wallet_type_0
|
||||
except: # noqa: E722
|
||||
pass
|
||||
return cast(Union[None, UUID, Unset], data)
|
||||
|
||||
wallet = _parse_wallet(d.pop("wallet", UNSET))
|
||||
|
||||
account = cls(
|
||||
balance=balance,
|
||||
wallet=wallet,
|
||||
)
|
||||
|
||||
account.additional_properties = d
|
||||
return account
|
||||
|
||||
@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
|
||||
168
utils/clients/gooyal_wallet_client/models/application_deposit.py
Normal file
168
utils/clients/gooyal_wallet_client/models/application_deposit.py
Normal file
|
|
@ -0,0 +1,168 @@
|
|||
import datetime
|
||||
from collections.abc import Mapping
|
||||
from typing import Any, TypeVar, Union
|
||||
from uuid import UUID
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
from dateutil.parser import isoparse
|
||||
|
||||
from ..models.state_enum import StateEnum
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
T = TypeVar("T", bound="ApplicationDeposit")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class ApplicationDeposit:
|
||||
"""
|
||||
Attributes:
|
||||
payer (str):
|
||||
payer_type (str):
|
||||
payer_wallet (UUID):
|
||||
payee (UUID):
|
||||
payee_type (int):
|
||||
payee_wallet (UUID):
|
||||
created_at (datetime.datetime):
|
||||
state (StateEnum): * `1` - created
|
||||
* `2` - delayed
|
||||
* `3` - pending
|
||||
* `4` - incomplete
|
||||
* `5` - success
|
||||
* `6` - failed
|
||||
* `7` - expected_failure
|
||||
amount (int):
|
||||
updated_at (datetime.datetime):
|
||||
uuid (Union[Unset, UUID]):
|
||||
details (Union[Unset, Any]):
|
||||
"""
|
||||
|
||||
payer: str
|
||||
payer_type: str
|
||||
payer_wallet: UUID
|
||||
payee: UUID
|
||||
payee_type: int
|
||||
payee_wallet: UUID
|
||||
created_at: datetime.datetime
|
||||
state: StateEnum
|
||||
amount: int
|
||||
updated_at: datetime.datetime
|
||||
uuid: Union[Unset, UUID] = UNSET
|
||||
details: Union[Unset, Any] = UNSET
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
payer = self.payer
|
||||
|
||||
payer_type = self.payer_type
|
||||
|
||||
payer_wallet = str(self.payer_wallet)
|
||||
|
||||
payee = str(self.payee)
|
||||
|
||||
payee_type = self.payee_type
|
||||
|
||||
payee_wallet = str(self.payee_wallet)
|
||||
|
||||
created_at = self.created_at.isoformat()
|
||||
|
||||
state = self.state.value
|
||||
|
||||
amount = self.amount
|
||||
|
||||
updated_at = self.updated_at.isoformat()
|
||||
|
||||
uuid: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.uuid, Unset):
|
||||
uuid = str(self.uuid)
|
||||
|
||||
details = self.details
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update(
|
||||
{
|
||||
"payer": payer,
|
||||
"payer_type": payer_type,
|
||||
"payer_wallet": payer_wallet,
|
||||
"payee": payee,
|
||||
"payee_type": payee_type,
|
||||
"payee_wallet": payee_wallet,
|
||||
"created_at": created_at,
|
||||
"state": state,
|
||||
"amount": amount,
|
||||
"updated_at": updated_at,
|
||||
}
|
||||
)
|
||||
if uuid is not UNSET:
|
||||
field_dict["uuid"] = uuid
|
||||
if details is not UNSET:
|
||||
field_dict["details"] = details
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
d = dict(src_dict)
|
||||
payer = d.pop("payer")
|
||||
|
||||
payer_type = d.pop("payer_type")
|
||||
|
||||
payer_wallet = UUID(d.pop("payer_wallet"))
|
||||
|
||||
payee = UUID(d.pop("payee"))
|
||||
|
||||
payee_type = d.pop("payee_type")
|
||||
|
||||
payee_wallet = UUID(d.pop("payee_wallet"))
|
||||
|
||||
created_at = isoparse(d.pop("created_at"))
|
||||
|
||||
state = StateEnum(d.pop("state"))
|
||||
|
||||
amount = d.pop("amount")
|
||||
|
||||
updated_at = isoparse(d.pop("updated_at"))
|
||||
|
||||
_uuid = d.pop("uuid", UNSET)
|
||||
uuid: Union[Unset, UUID]
|
||||
if isinstance(_uuid, Unset):
|
||||
uuid = UNSET
|
||||
else:
|
||||
uuid = UUID(_uuid)
|
||||
|
||||
details = d.pop("details", UNSET)
|
||||
|
||||
application_deposit = cls(
|
||||
payer=payer,
|
||||
payer_type=payer_type,
|
||||
payer_wallet=payer_wallet,
|
||||
payee=payee,
|
||||
payee_type=payee_type,
|
||||
payee_wallet=payee_wallet,
|
||||
created_at=created_at,
|
||||
state=state,
|
||||
amount=amount,
|
||||
updated_at=updated_at,
|
||||
uuid=uuid,
|
||||
details=details,
|
||||
)
|
||||
|
||||
application_deposit.additional_properties = d
|
||||
return application_deposit
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
|
|
@ -0,0 +1,168 @@
|
|||
import datetime
|
||||
from collections.abc import Mapping
|
||||
from typing import Any, TypeVar, Union
|
||||
from uuid import UUID
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
from dateutil.parser import isoparse
|
||||
|
||||
from ..models.state_enum import StateEnum
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
T = TypeVar("T", bound="ApplicationWithdraw")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class ApplicationWithdraw:
|
||||
"""
|
||||
Attributes:
|
||||
payer (UUID):
|
||||
payer_type (int):
|
||||
payer_wallet (UUID):
|
||||
payee (str):
|
||||
payee_type (str):
|
||||
payee_wallet (UUID):
|
||||
created_at (datetime.datetime):
|
||||
state (StateEnum): * `1` - created
|
||||
* `2` - delayed
|
||||
* `3` - pending
|
||||
* `4` - incomplete
|
||||
* `5` - success
|
||||
* `6` - failed
|
||||
* `7` - expected_failure
|
||||
amount (int):
|
||||
updated_at (datetime.datetime):
|
||||
uuid (Union[Unset, UUID]):
|
||||
details (Union[Unset, Any]):
|
||||
"""
|
||||
|
||||
payer: UUID
|
||||
payer_type: int
|
||||
payer_wallet: UUID
|
||||
payee: str
|
||||
payee_type: str
|
||||
payee_wallet: UUID
|
||||
created_at: datetime.datetime
|
||||
state: StateEnum
|
||||
amount: int
|
||||
updated_at: datetime.datetime
|
||||
uuid: Union[Unset, UUID] = UNSET
|
||||
details: Union[Unset, Any] = UNSET
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
payer = str(self.payer)
|
||||
|
||||
payer_type = self.payer_type
|
||||
|
||||
payer_wallet = str(self.payer_wallet)
|
||||
|
||||
payee = self.payee
|
||||
|
||||
payee_type = self.payee_type
|
||||
|
||||
payee_wallet = str(self.payee_wallet)
|
||||
|
||||
created_at = self.created_at.isoformat()
|
||||
|
||||
state = self.state.value
|
||||
|
||||
amount = self.amount
|
||||
|
||||
updated_at = self.updated_at.isoformat()
|
||||
|
||||
uuid: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.uuid, Unset):
|
||||
uuid = str(self.uuid)
|
||||
|
||||
details = self.details
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update(
|
||||
{
|
||||
"payer": payer,
|
||||
"payer_type": payer_type,
|
||||
"payer_wallet": payer_wallet,
|
||||
"payee": payee,
|
||||
"payee_type": payee_type,
|
||||
"payee_wallet": payee_wallet,
|
||||
"created_at": created_at,
|
||||
"state": state,
|
||||
"amount": amount,
|
||||
"updated_at": updated_at,
|
||||
}
|
||||
)
|
||||
if uuid is not UNSET:
|
||||
field_dict["uuid"] = uuid
|
||||
if details is not UNSET:
|
||||
field_dict["details"] = details
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
d = dict(src_dict)
|
||||
payer = UUID(d.pop("payer"))
|
||||
|
||||
payer_type = d.pop("payer_type")
|
||||
|
||||
payer_wallet = UUID(d.pop("payer_wallet"))
|
||||
|
||||
payee = d.pop("payee")
|
||||
|
||||
payee_type = d.pop("payee_type")
|
||||
|
||||
payee_wallet = UUID(d.pop("payee_wallet"))
|
||||
|
||||
created_at = isoparse(d.pop("created_at"))
|
||||
|
||||
state = StateEnum(d.pop("state"))
|
||||
|
||||
amount = d.pop("amount")
|
||||
|
||||
updated_at = isoparse(d.pop("updated_at"))
|
||||
|
||||
_uuid = d.pop("uuid", UNSET)
|
||||
uuid: Union[Unset, UUID]
|
||||
if isinstance(_uuid, Unset):
|
||||
uuid = UNSET
|
||||
else:
|
||||
uuid = UUID(_uuid)
|
||||
|
||||
details = d.pop("details", UNSET)
|
||||
|
||||
application_withdraw = cls(
|
||||
payer=payer,
|
||||
payer_type=payer_type,
|
||||
payer_wallet=payer_wallet,
|
||||
payee=payee,
|
||||
payee_type=payee_type,
|
||||
payee_wallet=payee_wallet,
|
||||
created_at=created_at,
|
||||
state=state,
|
||||
amount=amount,
|
||||
updated_at=updated_at,
|
||||
uuid=uuid,
|
||||
details=details,
|
||||
)
|
||||
|
||||
application_withdraw.additional_properties = d
|
||||
return application_withdraw
|
||||
|
||||
@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,123 @@
|
|||
from collections.abc import Mapping
|
||||
from typing import TYPE_CHECKING, Any, TypeVar, Union, cast
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..models.account import Account
|
||||
|
||||
|
||||
T = TypeVar("T", bound="PaginatedAccountList")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class PaginatedAccountList:
|
||||
"""
|
||||
Attributes:
|
||||
count (int): Example: 123.
|
||||
results (list['Account']):
|
||||
next_ (Union[None, Unset, str]): Example: http://api.example.org/accounts/?offset=400&limit=100.
|
||||
previous (Union[None, Unset, str]): Example: http://api.example.org/accounts/?offset=200&limit=100.
|
||||
"""
|
||||
|
||||
count: int
|
||||
results: list["Account"]
|
||||
next_: Union[None, Unset, str] = UNSET
|
||||
previous: Union[None, Unset, str] = UNSET
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
count = self.count
|
||||
|
||||
results = []
|
||||
for results_item_data in self.results:
|
||||
results_item = results_item_data.to_dict()
|
||||
results.append(results_item)
|
||||
|
||||
next_: Union[None, Unset, str]
|
||||
if isinstance(self.next_, Unset):
|
||||
next_ = UNSET
|
||||
else:
|
||||
next_ = self.next_
|
||||
|
||||
previous: Union[None, Unset, str]
|
||||
if isinstance(self.previous, Unset):
|
||||
previous = UNSET
|
||||
else:
|
||||
previous = self.previous
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update(
|
||||
{
|
||||
"count": count,
|
||||
"results": results,
|
||||
}
|
||||
)
|
||||
if next_ is not UNSET:
|
||||
field_dict["next"] = next_
|
||||
if previous is not UNSET:
|
||||
field_dict["previous"] = previous
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
from ..models.account import Account
|
||||
|
||||
d = dict(src_dict)
|
||||
count = d.pop("count")
|
||||
|
||||
results = []
|
||||
_results = d.pop("results")
|
||||
for results_item_data in _results:
|
||||
results_item = Account.from_dict(results_item_data)
|
||||
|
||||
results.append(results_item)
|
||||
|
||||
def _parse_next_(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)
|
||||
|
||||
next_ = _parse_next_(d.pop("next", UNSET))
|
||||
|
||||
def _parse_previous(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)
|
||||
|
||||
previous = _parse_previous(d.pop("previous", UNSET))
|
||||
|
||||
paginated_account_list = cls(
|
||||
count=count,
|
||||
results=results,
|
||||
next_=next_,
|
||||
previous=previous,
|
||||
)
|
||||
|
||||
paginated_account_list.additional_properties = d
|
||||
return paginated_account_list
|
||||
|
||||
@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,123 @@
|
|||
from collections.abc import Mapping
|
||||
from typing import TYPE_CHECKING, Any, TypeVar, Union, cast
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..models.transaction import Transaction
|
||||
|
||||
|
||||
T = TypeVar("T", bound="PaginatedTransactionList")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class PaginatedTransactionList:
|
||||
"""
|
||||
Attributes:
|
||||
count (int): Example: 123.
|
||||
results (list['Transaction']):
|
||||
next_ (Union[None, Unset, str]): Example: http://api.example.org/accounts/?offset=400&limit=100.
|
||||
previous (Union[None, Unset, str]): Example: http://api.example.org/accounts/?offset=200&limit=100.
|
||||
"""
|
||||
|
||||
count: int
|
||||
results: list["Transaction"]
|
||||
next_: Union[None, Unset, str] = UNSET
|
||||
previous: Union[None, Unset, str] = UNSET
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
count = self.count
|
||||
|
||||
results = []
|
||||
for results_item_data in self.results:
|
||||
results_item = results_item_data.to_dict()
|
||||
results.append(results_item)
|
||||
|
||||
next_: Union[None, Unset, str]
|
||||
if isinstance(self.next_, Unset):
|
||||
next_ = UNSET
|
||||
else:
|
||||
next_ = self.next_
|
||||
|
||||
previous: Union[None, Unset, str]
|
||||
if isinstance(self.previous, Unset):
|
||||
previous = UNSET
|
||||
else:
|
||||
previous = self.previous
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update(
|
||||
{
|
||||
"count": count,
|
||||
"results": results,
|
||||
}
|
||||
)
|
||||
if next_ is not UNSET:
|
||||
field_dict["next"] = next_
|
||||
if previous is not UNSET:
|
||||
field_dict["previous"] = previous
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
from ..models.transaction import Transaction
|
||||
|
||||
d = dict(src_dict)
|
||||
count = d.pop("count")
|
||||
|
||||
results = []
|
||||
_results = d.pop("results")
|
||||
for results_item_data in _results:
|
||||
results_item = Transaction.from_dict(results_item_data)
|
||||
|
||||
results.append(results_item)
|
||||
|
||||
def _parse_next_(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)
|
||||
|
||||
next_ = _parse_next_(d.pop("next", UNSET))
|
||||
|
||||
def _parse_previous(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)
|
||||
|
||||
previous = _parse_previous(d.pop("previous", UNSET))
|
||||
|
||||
paginated_transaction_list = cls(
|
||||
count=count,
|
||||
results=results,
|
||||
next_=next_,
|
||||
previous=previous,
|
||||
)
|
||||
|
||||
paginated_transaction_list.additional_properties = d
|
||||
return paginated_transaction_list
|
||||
|
||||
@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
|
||||
176
utils/clients/gooyal_wallet_client/models/transaction.py
Normal file
176
utils/clients/gooyal_wallet_client/models/transaction.py
Normal file
|
|
@ -0,0 +1,176 @@
|
|||
import datetime
|
||||
from collections.abc import Mapping
|
||||
from typing import Any, TypeVar, Union
|
||||
from uuid import UUID
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
from dateutil.parser import isoparse
|
||||
|
||||
from ..models.state_enum import StateEnum
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
T = TypeVar("T", bound="Transaction")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class Transaction:
|
||||
"""
|
||||
Attributes:
|
||||
uuid (UUID):
|
||||
payer (str):
|
||||
payer_type (str):
|
||||
payer_wallet (str):
|
||||
payee (UUID):
|
||||
payee_type (int):
|
||||
payee_wallet (str):
|
||||
created_at (datetime.datetime):
|
||||
state (StateEnum): * `1` - created
|
||||
* `2` - delayed
|
||||
* `3` - pending
|
||||
* `4` - incomplete
|
||||
* `5` - success
|
||||
* `6` - failed
|
||||
* `7` - expected_failure
|
||||
amount (int):
|
||||
updated_at (datetime.datetime):
|
||||
details (Any):
|
||||
role (int):
|
||||
delay (Union[Unset, int]):
|
||||
"""
|
||||
|
||||
uuid: UUID
|
||||
payer: str
|
||||
payer_type: str
|
||||
payer_wallet: str
|
||||
payee: UUID
|
||||
payee_type: int
|
||||
payee_wallet: str
|
||||
created_at: datetime.datetime
|
||||
state: StateEnum
|
||||
amount: int
|
||||
updated_at: datetime.datetime
|
||||
details: Any
|
||||
role: int
|
||||
delay: Union[Unset, int] = UNSET
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
uuid = str(self.uuid)
|
||||
|
||||
payer = self.payer
|
||||
|
||||
payer_type = self.payer_type
|
||||
|
||||
payer_wallet = self.payer_wallet
|
||||
|
||||
payee = str(self.payee)
|
||||
|
||||
payee_type = self.payee_type
|
||||
|
||||
payee_wallet = self.payee_wallet
|
||||
|
||||
created_at = self.created_at.isoformat()
|
||||
|
||||
state = self.state.value
|
||||
|
||||
amount = self.amount
|
||||
|
||||
updated_at = self.updated_at.isoformat()
|
||||
|
||||
details = self.details
|
||||
|
||||
role = self.role
|
||||
|
||||
delay = self.delay
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update(
|
||||
{
|
||||
"uuid": uuid,
|
||||
"payer": payer,
|
||||
"payer_type": payer_type,
|
||||
"payer_wallet": payer_wallet,
|
||||
"payee": payee,
|
||||
"payee_type": payee_type,
|
||||
"payee_wallet": payee_wallet,
|
||||
"created_at": created_at,
|
||||
"state": state,
|
||||
"amount": amount,
|
||||
"updated_at": updated_at,
|
||||
"details": details,
|
||||
"role": role,
|
||||
}
|
||||
)
|
||||
if delay is not UNSET:
|
||||
field_dict["delay"] = delay
|
||||
|
||||
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"))
|
||||
|
||||
payer = d.pop("payer")
|
||||
|
||||
payer_type = d.pop("payer_type")
|
||||
|
||||
payer_wallet = d.pop("payer_wallet")
|
||||
|
||||
payee = UUID(d.pop("payee"))
|
||||
|
||||
payee_type = d.pop("payee_type")
|
||||
|
||||
payee_wallet = d.pop("payee_wallet")
|
||||
|
||||
created_at = isoparse(d.pop("created_at"))
|
||||
|
||||
state = StateEnum(d.pop("state"))
|
||||
|
||||
amount = d.pop("amount")
|
||||
|
||||
updated_at = isoparse(d.pop("updated_at"))
|
||||
|
||||
details = d.pop("details")
|
||||
|
||||
role = d.pop("role")
|
||||
|
||||
delay = d.pop("delay", UNSET)
|
||||
|
||||
transaction = cls(
|
||||
uuid=uuid,
|
||||
payer=payer,
|
||||
payer_type=payer_type,
|
||||
payer_wallet=payer_wallet,
|
||||
payee=payee,
|
||||
payee_type=payee_type,
|
||||
payee_wallet=payee_wallet,
|
||||
created_at=created_at,
|
||||
state=state,
|
||||
amount=amount,
|
||||
updated_at=updated_at,
|
||||
details=details,
|
||||
role=role,
|
||||
delay=delay,
|
||||
)
|
||||
|
||||
transaction.additional_properties = d
|
||||
return transaction
|
||||
|
||||
@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
|
||||
1
utils/clients/gooyal_wallet_client/py.typed
Normal file
1
utils/clients/gooyal_wallet_client/py.typed
Normal file
|
|
@ -0,0 +1 @@
|
|||
# Marker file for PEP 561
|
||||
54
utils/clients/gooyal_wallet_client/types.py
Normal file
54
utils/clients/gooyal_wallet_client/types.py
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
"""Contains some shared types for properties"""
|
||||
|
||||
from collections.abc import Mapping, MutableMapping
|
||||
from http import HTTPStatus
|
||||
from typing import IO, BinaryIO, Generic, Literal, Optional, TypeVar, Union
|
||||
|
||||
from attrs import define
|
||||
|
||||
|
||||
class Unset:
|
||||
def __bool__(self) -> Literal[False]:
|
||||
return False
|
||||
|
||||
|
||||
UNSET: Unset = Unset()
|
||||
|
||||
# The types that `httpx.Client(files=)` can accept, copied from that library.
|
||||
FileContent = Union[IO[bytes], bytes, str]
|
||||
FileTypes = Union[
|
||||
# (filename, file (or bytes), content_type)
|
||||
tuple[Optional[str], FileContent, Optional[str]],
|
||||
# (filename, file (or bytes), content_type, headers)
|
||||
tuple[Optional[str], FileContent, Optional[str], Mapping[str, str]],
|
||||
]
|
||||
RequestFiles = list[tuple[str, FileTypes]]
|
||||
|
||||
|
||||
@define
|
||||
class File:
|
||||
"""Contains information for file uploads"""
|
||||
|
||||
payload: BinaryIO
|
||||
file_name: Optional[str] = None
|
||||
mime_type: Optional[str] = None
|
||||
|
||||
def to_tuple(self) -> FileTypes:
|
||||
"""Return a tuple representation that httpx will accept for multipart/form-data"""
|
||||
return self.file_name, self.payload, self.mime_type
|
||||
|
||||
|
||||
T = TypeVar("T")
|
||||
|
||||
|
||||
@define
|
||||
class Response(Generic[T]):
|
||||
"""A response from an endpoint"""
|
||||
|
||||
status_code: HTTPStatus
|
||||
content: bytes
|
||||
headers: MutableMapping[str, str]
|
||||
parsed: Optional[T]
|
||||
|
||||
|
||||
__all__ = ["UNSET", "File", "FileTypes", "RequestFiles", "Response", "Unset"]
|
||||
8
utils/clients/notifications_client/__init__.py
Normal file
8
utils/clients/notifications_client/__init__.py
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
"""A client library for accessing Notifications"""
|
||||
|
||||
from .client import AuthenticatedClient, Client
|
||||
|
||||
__all__ = (
|
||||
"AuthenticatedClient",
|
||||
"Client",
|
||||
)
|
||||
1
utils/clients/notifications_client/api/__init__.py
Normal file
1
utils/clients/notifications_client/api/__init__.py
Normal file
|
|
@ -0,0 +1 @@
|
|||
"""Contains methods for accessing the API"""
|
||||
1
utils/clients/notifications_client/api/email/__init__.py
Normal file
1
utils/clients/notifications_client/api/email/__init__.py
Normal file
|
|
@ -0,0 +1 @@
|
|||
"""Contains endpoint functions for accessing the API"""
|
||||
|
|
@ -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.email import Email
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
user_uuid: str,
|
||||
*,
|
||||
body: Email,
|
||||
) -> dict[str, Any]:
|
||||
headers: dict[str, Any] = {}
|
||||
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "post",
|
||||
"url": f"/email/application/{user_uuid}/application/",
|
||||
}
|
||||
|
||||
_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[Email]:
|
||||
if response.status_code == 201:
|
||||
response_201 = Email.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[Email]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
user_uuid: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: Email,
|
||||
) -> Response[Email]:
|
||||
"""
|
||||
Args:
|
||||
user_uuid (str):
|
||||
body (Email):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Email]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
user_uuid=user_uuid,
|
||||
body=body,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
user_uuid: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: Email,
|
||||
) -> Optional[Email]:
|
||||
"""
|
||||
Args:
|
||||
user_uuid (str):
|
||||
body (Email):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Email
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
user_uuid=user_uuid,
|
||||
client=client,
|
||||
body=body,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
user_uuid: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: Email,
|
||||
) -> Response[Email]:
|
||||
"""
|
||||
Args:
|
||||
user_uuid (str):
|
||||
body (Email):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Email]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
user_uuid=user_uuid,
|
||||
body=body,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
user_uuid: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: Email,
|
||||
) -> Optional[Email]:
|
||||
"""
|
||||
Args:
|
||||
user_uuid (str):
|
||||
body (Email):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Email
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
user_uuid=user_uuid,
|
||||
client=client,
|
||||
body=body,
|
||||
)
|
||||
).parsed
|
||||
|
|
@ -0,0 +1,183 @@
|
|||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.paginated_email_list import PaginatedEmailList
|
||||
from ...types import UNSET, Response, Unset
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
user_uuid: str,
|
||||
*,
|
||||
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"/email/application/{user_uuid}/application/",
|
||||
"params": params,
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[PaginatedEmailList]:
|
||||
if response.status_code == 200:
|
||||
response_200 = PaginatedEmailList.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[PaginatedEmailList]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
user_uuid: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
limit: Union[Unset, int] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
) -> Response[PaginatedEmailList]:
|
||||
"""
|
||||
Args:
|
||||
user_uuid (str):
|
||||
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[PaginatedEmailList]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
user_uuid=user_uuid,
|
||||
limit=limit,
|
||||
offset=offset,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
user_uuid: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
limit: Union[Unset, int] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
) -> Optional[PaginatedEmailList]:
|
||||
"""
|
||||
Args:
|
||||
user_uuid (str):
|
||||
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:
|
||||
PaginatedEmailList
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
user_uuid=user_uuid,
|
||||
client=client,
|
||||
limit=limit,
|
||||
offset=offset,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
user_uuid: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
limit: Union[Unset, int] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
) -> Response[PaginatedEmailList]:
|
||||
"""
|
||||
Args:
|
||||
user_uuid (str):
|
||||
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[PaginatedEmailList]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
user_uuid=user_uuid,
|
||||
limit=limit,
|
||||
offset=offset,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
user_uuid: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
limit: Union[Unset, int] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
) -> Optional[PaginatedEmailList]:
|
||||
"""
|
||||
Args:
|
||||
user_uuid (str):
|
||||
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:
|
||||
PaginatedEmailList
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
user_uuid=user_uuid,
|
||||
client=client,
|
||||
limit=limit,
|
||||
offset=offset,
|
||||
)
|
||||
).parsed
|
||||
1
utils/clients/notifications_client/api/push/__init__.py
Normal file
1
utils/clients/notifications_client/api/push/__init__.py
Normal file
|
|
@ -0,0 +1 @@
|
|||
"""Contains endpoint functions for accessing the API"""
|
||||
|
|
@ -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.push_message import PushMessage
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
user_uuid: str,
|
||||
*,
|
||||
body: PushMessage,
|
||||
) -> dict[str, Any]:
|
||||
headers: dict[str, Any] = {}
|
||||
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "post",
|
||||
"url": f"/push/application/{user_uuid}/application/",
|
||||
}
|
||||
|
||||
_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[PushMessage]:
|
||||
if response.status_code == 201:
|
||||
response_201 = PushMessage.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[PushMessage]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
user_uuid: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: PushMessage,
|
||||
) -> Response[PushMessage]:
|
||||
"""
|
||||
Args:
|
||||
user_uuid (str):
|
||||
body (PushMessage):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[PushMessage]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
user_uuid=user_uuid,
|
||||
body=body,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
user_uuid: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: PushMessage,
|
||||
) -> Optional[PushMessage]:
|
||||
"""
|
||||
Args:
|
||||
user_uuid (str):
|
||||
body (PushMessage):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
PushMessage
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
user_uuid=user_uuid,
|
||||
client=client,
|
||||
body=body,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
user_uuid: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: PushMessage,
|
||||
) -> Response[PushMessage]:
|
||||
"""
|
||||
Args:
|
||||
user_uuid (str):
|
||||
body (PushMessage):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[PushMessage]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
user_uuid=user_uuid,
|
||||
body=body,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
user_uuid: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: PushMessage,
|
||||
) -> Optional[PushMessage]:
|
||||
"""
|
||||
Args:
|
||||
user_uuid (str):
|
||||
body (PushMessage):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
PushMessage
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
user_uuid=user_uuid,
|
||||
client=client,
|
||||
body=body,
|
||||
)
|
||||
).parsed
|
||||
|
|
@ -0,0 +1,183 @@
|
|||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.paginated_push_message_list import PaginatedPushMessageList
|
||||
from ...types import UNSET, Response, Unset
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
user_uuid: str,
|
||||
*,
|
||||
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"/push/application/{user_uuid}/application/",
|
||||
"params": params,
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[PaginatedPushMessageList]:
|
||||
if response.status_code == 200:
|
||||
response_200 = PaginatedPushMessageList.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[PaginatedPushMessageList]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
user_uuid: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
limit: Union[Unset, int] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
) -> Response[PaginatedPushMessageList]:
|
||||
"""
|
||||
Args:
|
||||
user_uuid (str):
|
||||
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[PaginatedPushMessageList]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
user_uuid=user_uuid,
|
||||
limit=limit,
|
||||
offset=offset,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
user_uuid: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
limit: Union[Unset, int] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
) -> Optional[PaginatedPushMessageList]:
|
||||
"""
|
||||
Args:
|
||||
user_uuid (str):
|
||||
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:
|
||||
PaginatedPushMessageList
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
user_uuid=user_uuid,
|
||||
client=client,
|
||||
limit=limit,
|
||||
offset=offset,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
user_uuid: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
limit: Union[Unset, int] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
) -> Response[PaginatedPushMessageList]:
|
||||
"""
|
||||
Args:
|
||||
user_uuid (str):
|
||||
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[PaginatedPushMessageList]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
user_uuid=user_uuid,
|
||||
limit=limit,
|
||||
offset=offset,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
user_uuid: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
limit: Union[Unset, int] = UNSET,
|
||||
offset: Union[Unset, int] = UNSET,
|
||||
) -> Optional[PaginatedPushMessageList]:
|
||||
"""
|
||||
Args:
|
||||
user_uuid (str):
|
||||
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:
|
||||
PaginatedPushMessageList
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
user_uuid=user_uuid,
|
||||
client=client,
|
||||
limit=limit,
|
||||
offset=offset,
|
||||
)
|
||||
).parsed
|
||||
|
|
@ -5,31 +5,32 @@ import httpx
|
|||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.my_wallet import MyWallet
|
||||
from ...models.push_user import PushUser
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs() -> dict[str, Any]:
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "get",
|
||||
"url": "/wallet/api/wallet/balance",
|
||||
"url": "/push/user/push_user/",
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[MyWallet]:
|
||||
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[PushUser]:
|
||||
if response.status_code == 200:
|
||||
response_200 = MyWallet.from_dict(response.json())
|
||||
response_200 = PushUser.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[MyWallet]:
|
||||
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[PushUser]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
|
|
@ -41,15 +42,14 @@ def _build_response(*, client: Union[AuthenticatedClient, Client], response: htt
|
|||
def sync_detailed(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Response[MyWallet]:
|
||||
"""API for getting authenticated user balance.
|
||||
|
||||
) -> Response[PushUser]:
|
||||
"""
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[MyWallet]
|
||||
Response[PushUser]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs()
|
||||
|
|
@ -64,15 +64,14 @@ def sync_detailed(
|
|||
def sync(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Optional[MyWallet]:
|
||||
"""API for getting authenticated user balance.
|
||||
|
||||
) -> Optional[PushUser]:
|
||||
"""
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
MyWallet
|
||||
PushUser
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
|
|
@ -83,15 +82,14 @@ def sync(
|
|||
async def asyncio_detailed(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Response[MyWallet]:
|
||||
"""API for getting authenticated user balance.
|
||||
|
||||
) -> Response[PushUser]:
|
||||
"""
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[MyWallet]
|
||||
Response[PushUser]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs()
|
||||
|
|
@ -104,15 +102,14 @@ async def asyncio_detailed(
|
|||
async def asyncio(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
) -> Optional[MyWallet]:
|
||||
"""API for getting authenticated user balance.
|
||||
|
||||
) -> Optional[PushUser]:
|
||||
"""
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
MyWallet
|
||||
PushUser
|
||||
"""
|
||||
|
||||
return (
|
||||
268
utils/clients/notifications_client/client.py
Normal file
268
utils/clients/notifications_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/notifications_client/errors.py
Normal file
16
utils/clients/notifications_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"]
|
||||
15
utils/clients/notifications_client/models/__init__.py
Normal file
15
utils/clients/notifications_client/models/__init__.py
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
"""Contains all the data models used in inputs/outputs"""
|
||||
|
||||
from .email import Email
|
||||
from .paginated_email_list import PaginatedEmailList
|
||||
from .paginated_push_message_list import PaginatedPushMessageList
|
||||
from .push_message import PushMessage
|
||||
from .push_user import PushUser
|
||||
|
||||
__all__ = (
|
||||
"Email",
|
||||
"PaginatedEmailList",
|
||||
"PaginatedPushMessageList",
|
||||
"PushMessage",
|
||||
"PushUser",
|
||||
)
|
||||
133
utils/clients/notifications_client/models/email.py
Normal file
133
utils/clients/notifications_client/models/email.py
Normal file
|
|
@ -0,0 +1,133 @@
|
|||
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 ..types import UNSET, Unset
|
||||
|
||||
T = TypeVar("T", bound="Email")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class Email:
|
||||
"""
|
||||
Attributes:
|
||||
title (str):
|
||||
message (str):
|
||||
user (UUID):
|
||||
application (Union[None, UUID]):
|
||||
queue (Union[None, UUID, Unset]):
|
||||
"""
|
||||
|
||||
title: str
|
||||
message: str
|
||||
user: UUID
|
||||
application: Union[None, UUID]
|
||||
queue: Union[None, UUID, Unset] = UNSET
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
title = self.title
|
||||
|
||||
message = self.message
|
||||
|
||||
user = str(self.user)
|
||||
|
||||
application: Union[None, str]
|
||||
if isinstance(self.application, UUID):
|
||||
application = str(self.application)
|
||||
else:
|
||||
application = self.application
|
||||
|
||||
queue: Union[None, Unset, str]
|
||||
if isinstance(self.queue, Unset):
|
||||
queue = UNSET
|
||||
elif isinstance(self.queue, UUID):
|
||||
queue = str(self.queue)
|
||||
else:
|
||||
queue = self.queue
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update(
|
||||
{
|
||||
"title": title,
|
||||
"message": message,
|
||||
"user": user,
|
||||
"application": application,
|
||||
}
|
||||
)
|
||||
if queue is not UNSET:
|
||||
field_dict["queue"] = queue
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
d = dict(src_dict)
|
||||
title = d.pop("title")
|
||||
|
||||
message = d.pop("message")
|
||||
|
||||
user = UUID(d.pop("user"))
|
||||
|
||||
def _parse_application(data: object) -> Union[None, UUID]:
|
||||
if data is None:
|
||||
return data
|
||||
try:
|
||||
if not isinstance(data, str):
|
||||
raise TypeError()
|
||||
application_type_0 = UUID(data)
|
||||
|
||||
return application_type_0
|
||||
except: # noqa: E722
|
||||
pass
|
||||
return cast(Union[None, UUID], data)
|
||||
|
||||
application = _parse_application(d.pop("application"))
|
||||
|
||||
def _parse_queue(data: object) -> Union[None, UUID, Unset]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
try:
|
||||
if not isinstance(data, str):
|
||||
raise TypeError()
|
||||
queue_type_0 = UUID(data)
|
||||
|
||||
return queue_type_0
|
||||
except: # noqa: E722
|
||||
pass
|
||||
return cast(Union[None, UUID, Unset], data)
|
||||
|
||||
queue = _parse_queue(d.pop("queue", UNSET))
|
||||
|
||||
email = cls(
|
||||
title=title,
|
||||
message=message,
|
||||
user=user,
|
||||
application=application,
|
||||
queue=queue,
|
||||
)
|
||||
|
||||
email.additional_properties = d
|
||||
return email
|
||||
|
||||
@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,123 @@
|
|||
from collections.abc import Mapping
|
||||
from typing import TYPE_CHECKING, Any, TypeVar, Union, cast
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..models.email import Email
|
||||
|
||||
|
||||
T = TypeVar("T", bound="PaginatedEmailList")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class PaginatedEmailList:
|
||||
"""
|
||||
Attributes:
|
||||
count (int): Example: 123.
|
||||
results (list['Email']):
|
||||
next_ (Union[None, Unset, str]): Example: http://api.example.org/accounts/?offset=400&limit=100.
|
||||
previous (Union[None, Unset, str]): Example: http://api.example.org/accounts/?offset=200&limit=100.
|
||||
"""
|
||||
|
||||
count: int
|
||||
results: list["Email"]
|
||||
next_: Union[None, Unset, str] = UNSET
|
||||
previous: Union[None, Unset, str] = UNSET
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
count = self.count
|
||||
|
||||
results = []
|
||||
for results_item_data in self.results:
|
||||
results_item = results_item_data.to_dict()
|
||||
results.append(results_item)
|
||||
|
||||
next_: Union[None, Unset, str]
|
||||
if isinstance(self.next_, Unset):
|
||||
next_ = UNSET
|
||||
else:
|
||||
next_ = self.next_
|
||||
|
||||
previous: Union[None, Unset, str]
|
||||
if isinstance(self.previous, Unset):
|
||||
previous = UNSET
|
||||
else:
|
||||
previous = self.previous
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update(
|
||||
{
|
||||
"count": count,
|
||||
"results": results,
|
||||
}
|
||||
)
|
||||
if next_ is not UNSET:
|
||||
field_dict["next"] = next_
|
||||
if previous is not UNSET:
|
||||
field_dict["previous"] = previous
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
from ..models.email import Email
|
||||
|
||||
d = dict(src_dict)
|
||||
count = d.pop("count")
|
||||
|
||||
results = []
|
||||
_results = d.pop("results")
|
||||
for results_item_data in _results:
|
||||
results_item = Email.from_dict(results_item_data)
|
||||
|
||||
results.append(results_item)
|
||||
|
||||
def _parse_next_(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)
|
||||
|
||||
next_ = _parse_next_(d.pop("next", UNSET))
|
||||
|
||||
def _parse_previous(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)
|
||||
|
||||
previous = _parse_previous(d.pop("previous", UNSET))
|
||||
|
||||
paginated_email_list = cls(
|
||||
count=count,
|
||||
results=results,
|
||||
next_=next_,
|
||||
previous=previous,
|
||||
)
|
||||
|
||||
paginated_email_list.additional_properties = d
|
||||
return paginated_email_list
|
||||
|
||||
@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,123 @@
|
|||
from collections.abc import Mapping
|
||||
from typing import TYPE_CHECKING, Any, TypeVar, Union, cast
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..models.push_message import PushMessage
|
||||
|
||||
|
||||
T = TypeVar("T", bound="PaginatedPushMessageList")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class PaginatedPushMessageList:
|
||||
"""
|
||||
Attributes:
|
||||
count (int): Example: 123.
|
||||
results (list['PushMessage']):
|
||||
next_ (Union[None, Unset, str]): Example: http://api.example.org/accounts/?offset=400&limit=100.
|
||||
previous (Union[None, Unset, str]): Example: http://api.example.org/accounts/?offset=200&limit=100.
|
||||
"""
|
||||
|
||||
count: int
|
||||
results: list["PushMessage"]
|
||||
next_: Union[None, Unset, str] = UNSET
|
||||
previous: Union[None, Unset, str] = UNSET
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
count = self.count
|
||||
|
||||
results = []
|
||||
for results_item_data in self.results:
|
||||
results_item = results_item_data.to_dict()
|
||||
results.append(results_item)
|
||||
|
||||
next_: Union[None, Unset, str]
|
||||
if isinstance(self.next_, Unset):
|
||||
next_ = UNSET
|
||||
else:
|
||||
next_ = self.next_
|
||||
|
||||
previous: Union[None, Unset, str]
|
||||
if isinstance(self.previous, Unset):
|
||||
previous = UNSET
|
||||
else:
|
||||
previous = self.previous
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update(
|
||||
{
|
||||
"count": count,
|
||||
"results": results,
|
||||
}
|
||||
)
|
||||
if next_ is not UNSET:
|
||||
field_dict["next"] = next_
|
||||
if previous is not UNSET:
|
||||
field_dict["previous"] = previous
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
from ..models.push_message import PushMessage
|
||||
|
||||
d = dict(src_dict)
|
||||
count = d.pop("count")
|
||||
|
||||
results = []
|
||||
_results = d.pop("results")
|
||||
for results_item_data in _results:
|
||||
results_item = PushMessage.from_dict(results_item_data)
|
||||
|
||||
results.append(results_item)
|
||||
|
||||
def _parse_next_(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)
|
||||
|
||||
next_ = _parse_next_(d.pop("next", UNSET))
|
||||
|
||||
def _parse_previous(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)
|
||||
|
||||
previous = _parse_previous(d.pop("previous", UNSET))
|
||||
|
||||
paginated_push_message_list = cls(
|
||||
count=count,
|
||||
results=results,
|
||||
next_=next_,
|
||||
previous=previous,
|
||||
)
|
||||
|
||||
paginated_push_message_list.additional_properties = d
|
||||
return paginated_push_message_list
|
||||
|
||||
@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
|
||||
121
utils/clients/notifications_client/models/push_message.py
Normal file
121
utils/clients/notifications_client/models/push_message.py
Normal file
|
|
@ -0,0 +1,121 @@
|
|||
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 ..types import UNSET, Unset
|
||||
|
||||
T = TypeVar("T", bound="PushMessage")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class PushMessage:
|
||||
"""
|
||||
Attributes:
|
||||
push_user (UUID):
|
||||
application (Union[None, UUID]):
|
||||
title (str):
|
||||
message (str):
|
||||
priority (Union[Unset, int]):
|
||||
extras (Union[Unset, Any]):
|
||||
"""
|
||||
|
||||
push_user: UUID
|
||||
application: Union[None, UUID]
|
||||
title: str
|
||||
message: str
|
||||
priority: Union[Unset, int] = UNSET
|
||||
extras: Union[Unset, Any] = UNSET
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
push_user = str(self.push_user)
|
||||
|
||||
application: Union[None, str]
|
||||
if isinstance(self.application, UUID):
|
||||
application = str(self.application)
|
||||
else:
|
||||
application = self.application
|
||||
|
||||
title = self.title
|
||||
|
||||
message = self.message
|
||||
|
||||
priority = self.priority
|
||||
|
||||
extras = self.extras
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update(
|
||||
{
|
||||
"push_user": push_user,
|
||||
"application": application,
|
||||
"title": title,
|
||||
"message": message,
|
||||
}
|
||||
)
|
||||
if priority is not UNSET:
|
||||
field_dict["priority"] = priority
|
||||
if extras is not UNSET:
|
||||
field_dict["extras"] = extras
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
d = dict(src_dict)
|
||||
push_user = UUID(d.pop("push_user"))
|
||||
|
||||
def _parse_application(data: object) -> Union[None, UUID]:
|
||||
if data is None:
|
||||
return data
|
||||
try:
|
||||
if not isinstance(data, str):
|
||||
raise TypeError()
|
||||
application_type_0 = UUID(data)
|
||||
|
||||
return application_type_0
|
||||
except: # noqa: E722
|
||||
pass
|
||||
return cast(Union[None, UUID], data)
|
||||
|
||||
application = _parse_application(d.pop("application"))
|
||||
|
||||
title = d.pop("title")
|
||||
|
||||
message = d.pop("message")
|
||||
|
||||
priority = d.pop("priority", UNSET)
|
||||
|
||||
extras = d.pop("extras", UNSET)
|
||||
|
||||
push_message = cls(
|
||||
push_user=push_user,
|
||||
application=application,
|
||||
title=title,
|
||||
message=message,
|
||||
priority=priority,
|
||||
extras=extras,
|
||||
)
|
||||
|
||||
push_message.additional_properties = d
|
||||
return push_message
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
102
utils/clients/notifications_client/models/push_user.py
Normal file
102
utils/clients/notifications_client/models/push_user.py
Normal file
|
|
@ -0,0 +1,102 @@
|
|||
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 ..types import UNSET, Unset
|
||||
|
||||
T = TypeVar("T", bound="PushUser")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class PushUser:
|
||||
"""
|
||||
Attributes:
|
||||
user (UUID):
|
||||
client_token (Union[None, Unset, str]):
|
||||
application_token (Union[None, Unset, str]):
|
||||
"""
|
||||
|
||||
user: UUID
|
||||
client_token: Union[None, Unset, str] = UNSET
|
||||
application_token: Union[None, Unset, str] = UNSET
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
user = str(self.user)
|
||||
|
||||
client_token: Union[None, Unset, str]
|
||||
if isinstance(self.client_token, Unset):
|
||||
client_token = UNSET
|
||||
else:
|
||||
client_token = self.client_token
|
||||
|
||||
application_token: Union[None, Unset, str]
|
||||
if isinstance(self.application_token, Unset):
|
||||
application_token = UNSET
|
||||
else:
|
||||
application_token = self.application_token
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update(
|
||||
{
|
||||
"user": user,
|
||||
}
|
||||
)
|
||||
if client_token is not UNSET:
|
||||
field_dict["client_token"] = client_token
|
||||
if application_token is not UNSET:
|
||||
field_dict["application_token"] = application_token
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
d = dict(src_dict)
|
||||
user = UUID(d.pop("user"))
|
||||
|
||||
def _parse_client_token(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)
|
||||
|
||||
client_token = _parse_client_token(d.pop("client_token", UNSET))
|
||||
|
||||
def _parse_application_token(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)
|
||||
|
||||
application_token = _parse_application_token(d.pop("application_token", UNSET))
|
||||
|
||||
push_user = cls(
|
||||
user=user,
|
||||
client_token=client_token,
|
||||
application_token=application_token,
|
||||
)
|
||||
|
||||
push_user.additional_properties = d
|
||||
return push_user
|
||||
|
||||
@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
|
||||
1
utils/clients/notifications_client/py.typed
Normal file
1
utils/clients/notifications_client/py.typed
Normal file
|
|
@ -0,0 +1 @@
|
|||
# Marker file for PEP 561
|
||||
54
utils/clients/notifications_client/types.py
Normal file
54
utils/clients/notifications_client/types.py
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
"""Contains some shared types for properties"""
|
||||
|
||||
from collections.abc import Mapping, MutableMapping
|
||||
from http import HTTPStatus
|
||||
from typing import IO, BinaryIO, Generic, Literal, Optional, TypeVar, Union
|
||||
|
||||
from attrs import define
|
||||
|
||||
|
||||
class Unset:
|
||||
def __bool__(self) -> Literal[False]:
|
||||
return False
|
||||
|
||||
|
||||
UNSET: Unset = Unset()
|
||||
|
||||
# The types that `httpx.Client(files=)` can accept, copied from that library.
|
||||
FileContent = Union[IO[bytes], bytes, str]
|
||||
FileTypes = Union[
|
||||
# (filename, file (or bytes), content_type)
|
||||
tuple[Optional[str], FileContent, Optional[str]],
|
||||
# (filename, file (or bytes), content_type, headers)
|
||||
tuple[Optional[str], FileContent, Optional[str], Mapping[str, str]],
|
||||
]
|
||||
RequestFiles = list[tuple[str, FileTypes]]
|
||||
|
||||
|
||||
@define
|
||||
class File:
|
||||
"""Contains information for file uploads"""
|
||||
|
||||
payload: BinaryIO
|
||||
file_name: Optional[str] = None
|
||||
mime_type: Optional[str] = None
|
||||
|
||||
def to_tuple(self) -> FileTypes:
|
||||
"""Return a tuple representation that httpx will accept for multipart/form-data"""
|
||||
return self.file_name, self.payload, self.mime_type
|
||||
|
||||
|
||||
T = TypeVar("T")
|
||||
|
||||
|
||||
@define
|
||||
class Response(Generic[T]):
|
||||
"""A response from an endpoint"""
|
||||
|
||||
status_code: HTTPStatus
|
||||
content: bytes
|
||||
headers: MutableMapping[str, str]
|
||||
parsed: Optional[T]
|
||||
|
||||
|
||||
__all__ = ["UNSET", "File", "FileTypes", "RequestFiles", "Response", "Unset"]
|
||||
|
|
@ -3,46 +3,31 @@ import time
|
|||
import requests
|
||||
from django.conf import settings
|
||||
from django.core.cache import cache
|
||||
from django.db import models
|
||||
from httpx import Request
|
||||
|
||||
from gooyal_wallet_client import AuthenticatedClient
|
||||
from gooyal_wallet_client.models import MyWallet, UserTransaction, ApplicationDeposit, ApplicationWithdraw
|
||||
from gooyal_wallet_client.api.wallet import (wallet_api_application_deposit_create,
|
||||
from utils.clients.gooyal_wallet_client import AuthenticatedClient
|
||||
from utils.clients.gooyal_wallet_client.models import Transaction, Account, ApplicationDeposit, ApplicationWithdraw, PaginatedAccountList
|
||||
from utils.clients.gooyal_wallet_client.api.wallet import (wallet_api_application_deposit_create,
|
||||
wallet_api_application_deposit_verify_retrieve,
|
||||
wallet_api_application_withdraw_create,
|
||||
wallet_api_application_withdraw_verify_retrieve)
|
||||
wallet_api_application_withdraw_verify_retrieve,
|
||||
wallet_api_application_user_wallets_list)
|
||||
|
||||
|
||||
|
||||
import logging
|
||||
# logging.basicConfig(
|
||||
# format="%(levelname)s [%(asctime)s] %(name)s - %(message)s",
|
||||
# datefmt="%Y-%m-%d %H:%M:%S",
|
||||
# level=logging.DEBUG
|
||||
# )
|
||||
logger = logging.getLogger('ads.utils.wallet_client')
|
||||
|
||||
|
||||
|
||||
class ContentTypeChoices(models.IntegerChoices):
|
||||
IMAGE = 1, 'image'
|
||||
VOICE = 2, 'voice'
|
||||
VIDEO = 3, 'video'
|
||||
|
||||
|
||||
def login_as_client_credentials():
|
||||
access_token = cache.get('ads_access_token')
|
||||
access_token = cache.get('settlement_access_token')
|
||||
# expires_in = self.auth_data.get('expires_in')
|
||||
# created_at = self.auth_data.get('created_at')
|
||||
#
|
||||
# if access_token and expires_in > time.time() - created_at:
|
||||
# return self.auth_data
|
||||
if access_token:
|
||||
logger.debug('token available in cache')
|
||||
print('already in cache')
|
||||
return access_token
|
||||
|
||||
logger.debug('no token available in cache')
|
||||
print('not in cache')
|
||||
|
||||
data = {
|
||||
"grant_type": 'client_credentials',
|
||||
|
|
@ -50,121 +35,86 @@ def login_as_client_credentials():
|
|||
}
|
||||
auth = (settings.CLIENT_ID, settings.CLIENT_SECRET)
|
||||
|
||||
response = requests.post(f'{settings.BASE_OAUTH2_PROVIDER_PRIVATE_URL}/token/',
|
||||
response = requests.post(f'{settings.BASE_OAUTH2_PROVIDER_PUBLIC_URL}/token/',
|
||||
data=data,
|
||||
auth=auth)
|
||||
logger.debug(response.content)
|
||||
print(response.content)
|
||||
|
||||
auth_data = response.json()
|
||||
if 'access_token' in auth_data:
|
||||
auth_data['created_at'] = time.time()
|
||||
cache.set('ads_access_token', auth_data, timeout=auth_data.get('expires_in') - 5)
|
||||
cache.set('settlement_access_token', auth_data, timeout=auth_data.get('expires_in') - 5)
|
||||
|
||||
return auth_data
|
||||
|
||||
|
||||
def log_request(request: Request):
|
||||
logger.debug(f'authorization: {request.headers["authorization"]}')
|
||||
logger.debug(
|
||||
print(request.headers['authorization'])
|
||||
print(
|
||||
f"Request event hook: {request.method} {request.url} {request.method} {request.headers} - Waiting for response")
|
||||
|
||||
|
||||
def log_response(response):
|
||||
request = response.request
|
||||
logger.debug(f"Response event hook: {request.method} {request.url} - Status {response.status_code}")
|
||||
# logger.debug(f"Response event hook: {response.read()}")
|
||||
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="https://wallet.gooyal.com", token=access_token,
|
||||
client = AuthenticatedClient(base_url=settings.WALLET_BASE_PUBLIC_URL, token=access_token,
|
||||
httpx_args={"event_hooks": {"request": [log_request], "response": [log_response]}},
|
||||
)
|
||||
return client
|
||||
|
||||
|
||||
def deposit_to_user_wallet_submit(data):
|
||||
def deposit_to_user_wallet_submit(payer_wallet, data):
|
||||
class Tmp():
|
||||
def to_dict(self):
|
||||
return data
|
||||
|
||||
deposit_data = Tmp()
|
||||
client = get_client()
|
||||
response: ApplicationDeposit = wallet_api_application_deposit_create.sync(client=client, body=deposit_data)
|
||||
|
||||
response: ApplicationDeposit = wallet_api_application_deposit_create.sync(payer_wallet=payer_wallet,
|
||||
client=client,
|
||||
body=deposit_data)
|
||||
print(response)
|
||||
return response
|
||||
|
||||
|
||||
def deposit_to_user_wallet_verify(uuid):
|
||||
def deposit_to_user_wallet_verify(payer_wallet, uuid):
|
||||
client = get_client()
|
||||
response: ApplicationDeposit = wallet_api_application_deposit_verify_retrieve.sync(uuid=uuid, client=client)
|
||||
|
||||
response: ApplicationDeposit = wallet_api_application_deposit_verify_retrieve.sync(payer_wallet=payer_wallet, uuid=uuid, client=client)
|
||||
print(response)
|
||||
return response
|
||||
|
||||
|
||||
def withdraw_from_user_wallet_submit(data):
|
||||
def withdraw_from_user_wallet_submit(payee_wallet, data):
|
||||
class Tmp():
|
||||
def to_dict(self):
|
||||
return data
|
||||
|
||||
withdraw_data = Tmp()
|
||||
client = get_client()
|
||||
response: ApplicationWithdraw = wallet_api_application_withdraw_create.sync(client=client, body=withdraw_data)
|
||||
|
||||
response: ApplicationWithdraw = wallet_api_application_withdraw_create.sync(payee_wallet=payee_wallet, client=client, body=withdraw_data)
|
||||
print(response)
|
||||
return response
|
||||
|
||||
|
||||
def withdraw_from_user_wallet_verify(uuid):
|
||||
def withdraw_from_user_wallet_verify(payee_wallet, uuid):
|
||||
client = get_client()
|
||||
response: ApplicationWithdraw = wallet_api_application_withdraw_verify_retrieve.sync(uuid=uuid, client=client)
|
||||
|
||||
response: ApplicationWithdraw = wallet_api_application_withdraw_verify_retrieve.sync(payee_wallet=payee_wallet, uuid=uuid, client=client)
|
||||
print(response)
|
||||
return response
|
||||
|
||||
|
||||
# def deposit_to_user_wallet_submit(data):
|
||||
# import uuid as sys_uuid
|
||||
# class Tmp():
|
||||
# uuid = sys_uuid.uuid4()
|
||||
#
|
||||
#
|
||||
# data = Tmp()
|
||||
#
|
||||
# return data
|
||||
#
|
||||
#
|
||||
# def deposit_to_user_wallet_verify(uuid):
|
||||
# import uuid as sys_uuid
|
||||
# class Tmp():
|
||||
# uuid = sys_uuid.uuid4()
|
||||
# state = 5
|
||||
#
|
||||
# data = Tmp()
|
||||
#
|
||||
# return data
|
||||
#
|
||||
#
|
||||
#
|
||||
# def withdraw_from_user_wallet_submit(data):
|
||||
# import uuid as sys_uuid
|
||||
# class Tmp():
|
||||
# uuid = sys_uuid.uuid4()
|
||||
#
|
||||
# data = Tmp()
|
||||
#
|
||||
# return data
|
||||
#
|
||||
#
|
||||
#
|
||||
# def withdraw_from_user_wallet_verify(uuid):
|
||||
# import uuid as sys_uuid
|
||||
# class Tmp():
|
||||
# uuid = sys_uuid.uuid4()
|
||||
# state = 5
|
||||
#
|
||||
# data = Tmp()
|
||||
#
|
||||
# return data
|
||||
#
|
||||
def get_user_wallets(owner, wallets):
|
||||
client = get_client()
|
||||
# by pass several wallet query params: [','.join([str(i) for i in wallets])]
|
||||
response: PaginatedAccountList = wallet_api_application_user_wallets_list.sync(owner=owner, wallet=[','.join([str(i) for i in wallets])], client=client)
|
||||
print(response)
|
||||
balances = dict(map(lambda result: (str(result.wallet), result.balance), response.results))
|
||||
return balances
|
||||
|
||||
|
||||
sample_data = {
|
||||
"uuid": "3fa85f64-5717-4562-b3fc-2c963f66afb1",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue