From 85bb07d7baccacf5aa12780f752f31056ef1cacf Mon Sep 17 00:00:00 2001 From: "Evgeny (Krymmy) Momotov" Date: Thu, 13 Nov 2025 13:23:56 +0300 Subject: [PATCH] [UP] v 0.1.4 --- pyproject.toml | 2 +- src/CallerApiManager/api_manager.py | 7 +- src/CallerApiManager/yandex_fleet_models.py | 75 +++++++++++++++++++++ 3 files changed, 80 insertions(+), 4 deletions(-) create mode 100644 src/CallerApiManager/yandex_fleet_models.py diff --git a/pyproject.toml b/pyproject.toml index e623c85..136e4aa 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "callerapimanager" -version = "0.1.3-1" +version = "0.1.4" description = "" authors = [ {name = "Evgeny (Krymmy) Momotov",email = "evgeny.momotov@gmail.com"} diff --git a/src/CallerApiManager/api_manager.py b/src/CallerApiManager/api_manager.py index 28f5ef8..48c7aec 100644 --- a/src/CallerApiManager/api_manager.py +++ b/src/CallerApiManager/api_manager.py @@ -6,6 +6,7 @@ from typing import List, Dict, Any, Optional import aiohttp from .data_models import * +from .yandex_fleet_models import * class CallerManagerClient: @@ -104,6 +105,6 @@ class CallerManagerClient: response = await self._request('GET', f'/prompts/{prompt_id}/openai_settings') return OpenAISettings(**response) - #async def get_yandex_fleet_driver_profile(self, driver_id: int) -> YandexFleetDriverProfile: - # response = await self._request('GET', f'/yandex_fleet/drivers/{driver_id}/profile') - # return YandexFleetDriverProfile(**response) \ No newline at end of file + async def get_yandex_fleet_driver_profile(self, driver_id: int) -> DriverProfile: + response = await self._request('GET', f'/yandex_fleet/drivers/{driver_id}/profile') + return DriverProfile(**response) \ No newline at end of file diff --git a/src/CallerApiManager/yandex_fleet_models.py b/src/CallerApiManager/yandex_fleet_models.py new file mode 100644 index 0000000..ca36b82 --- /dev/null +++ b/src/CallerApiManager/yandex_fleet_models.py @@ -0,0 +1,75 @@ +from enum import Enum +from typing import Optional +from pydantic import BaseModel, validator, Field + +class WorkStatus(Enum): + WORKING = "working" + NOT_WORKING = "not_working" + FIRED = "fired" + +class EmploymentType(str, Enum): + selfemployed = "selfemployed" + park_employee = "park_employee" + individual_entrepreneur = "individual_entrepreneur" + +class Account(BaseModel): + balance_limit: str = Field(..., description="Лимит по счету, например: 50") + block_orders_on_balance_below_limit: bool = Field( + False, description="Запрещены ли все заказы при балансе ниже лимита" + ) + payment_service_id: str = Field(..., description="ID для платежа, например: 12345") + work_rule_id: Optional[str] = Field(None, description="Идентификатор условия работы, например: bc43tre6ba054dfdb7143ckfgvcby63e") + + +class OrderProvider(BaseModel): + partner: bool = Field(..., description="Доступны ли заказы от партнера") + platform: bool = Field(..., description="Доступны ли заказы от платформы") + + +class Profile(BaseModel): + comment: Optional[str] = Field(None, description="Прочее, например: great driver") + feedback: Optional[str] = Field(None, description="Прочее (доступно сотрудникам парка), например: great driver") + fire_date: Optional[str] = Field(None, description="Дата увольнения из парка в формате ISO 8601 без временной зоны, например: 2020-10-28") + hire_date: Optional[str] = Field(None, description="Дата приема в парк в формате ISO 8601 без временной зоны, например: 2020-10-28") + work_status: WorkStatus = Field(..., description="Статус работы водителя: working, not_working, fired") + + +class FullName(BaseModel): + first_name: str = Field(..., description="Имя, например: Ivan") + last_name: str = Field(..., description="Фамилия, например: Ivanov") + middle_name: Optional[str] = Field(None, description="Отчество, например: Ivanovich") + + +class DriverLicenseExperience(BaseModel): + total_since_date: str = Field(..., description="Дата начала водительских обязанностей в формате ISO 8601 без временной зоны, например: 1970-01-01") + + +class DriverLicense(BaseModel): + birth_date: Optional[str] = Field(None, description="Дата рождения в формате ISO 8601 без временной зоны, например: 1975-10-28") + country: Optional[str] = Field(None, description="Страна выдачи водительского удостоверения (трехбуквенный код), например: rus") + expiry_date: Optional[str] = Field(None, description="Дата окончания действия в формате ISO 8601 без временной зоᔊы, например: 2050-10-28") + issue_date: Optional[str] = Field(None, description="Дата выдачи в формате ISO 8601 без временной зоны, например: 2020-10-28") + number: Optional[str] = Field(None, description="Серия и номер водительского удостоверения, например: 070236") + + +class ContactInfo(BaseModel): + address: Optional[str] = Field(None, description="Адрес, например: Moscow, Ivanovskaya Ul., bld. 40/2, appt. 63") + email: Optional[str] = Field(None, description="Э trueлронная почта, например: example-email@example.com") + phone: Optional[str] = Field(None, description="Номер телефона, например: +79999999999", pattern=r"^\+\d{1,15}$") + + +class Person(BaseModel): + contact_info: Optional[ContactInfo] = Field(None, description="Контактная информация водителя") + driver_license: Optional[DriverLicense] = Field(None, description="Информация о водительском уд揪тверении") + driver_license_experience: Optional[DriverLicenseExperience] = Field(None, description="Водительский стаж с даты") + employment_type: EmploymentType = Field(..., description="Тип занятости: selfemployed, park_employee, individual_entrepreneur") + full_name: Optional[FullName] = Field(None, description="Полное имя водителя") + tax_identification_number: str = Field(..., min_length=1, description="Идентификационный номер налогоплательщика, например: 7743013902") + + +class DriverProfile(BaseModel): + account: Optional[Account] = Field(None, description="Счет водителя") + profile: Optional[Profile] = Field(None, description="Профиль водителя") + person: Optional[Person] = Field(None, description="Персональная информация водителя") + order_provider: Optional[OrderProvider] = Field(None, description="Доступность заказов водителем") + car_id: str = Field(..., description="ID машины, например: 12345", min_length=1, max_length=100) \ No newline at end of file