motor-python-sdk 0.0.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- motor_python_sdk-0.0.2.dist-info/METADATA +230 -0
- motor_python_sdk-0.0.2.dist-info/RECORD +60 -0
- motor_python_sdk-0.0.2.dist-info/WHEEL +4 -0
- yasminaai/__init__.py +113 -0
- yasminaai/_default_clients.py +32 -0
- yasminaai/client.py +255 -0
- yasminaai/core/__init__.py +127 -0
- yasminaai/core/api_error.py +23 -0
- yasminaai/core/client_wrapper.py +119 -0
- yasminaai/core/datetime_utils.py +70 -0
- yasminaai/core/file.py +67 -0
- yasminaai/core/force_multipart.py +18 -0
- yasminaai/core/http_client.py +839 -0
- yasminaai/core/http_response.py +59 -0
- yasminaai/core/http_sse/__init__.py +42 -0
- yasminaai/core/http_sse/_api.py +170 -0
- yasminaai/core/http_sse/_decoders.py +61 -0
- yasminaai/core/http_sse/_exceptions.py +7 -0
- yasminaai/core/http_sse/_models.py +17 -0
- yasminaai/core/jsonable_encoder.py +120 -0
- yasminaai/core/logging.py +107 -0
- yasminaai/core/parse_error.py +36 -0
- yasminaai/core/pydantic_utilities.py +508 -0
- yasminaai/core/query_encoder.py +58 -0
- yasminaai/core/remove_none_from_dict.py +11 -0
- yasminaai/core/request_options.py +35 -0
- yasminaai/core/serialization.py +347 -0
- yasminaai/environment.py +7 -0
- yasminaai/errors/__init__.py +42 -0
- yasminaai/errors/bad_request_error.py +10 -0
- yasminaai/errors/not_found_error.py +10 -0
- yasminaai/errors/unauthorized_error.py +10 -0
- yasminaai/errors/unprocessable_entity_error.py +10 -0
- yasminaai/ot_ps/__init__.py +4 -0
- yasminaai/ot_ps/client.py +278 -0
- yasminaai/ot_ps/raw_client.py +355 -0
- yasminaai/policies/__init__.py +4 -0
- yasminaai/policies/client.py +393 -0
- yasminaai/policies/raw_client.py +493 -0
- yasminaai/py.typed +0 -0
- yasminaai/quotes/__init__.py +49 -0
- yasminaai/quotes/client.py +438 -0
- yasminaai/quotes/raw_client.py +548 -0
- yasminaai/quotes/types/__init__.py +47 -0
- yasminaai/quotes/types/delete_quote_requests_id_response.py +19 -0
- yasminaai/quotes/types/get_quote_requests_response.py +37 -0
- yasminaai/quotes/types/get_quote_requests_response_links_item.py +21 -0
- yasminaai/quotes/types/post_quote_requests_request_drivers_item.py +33 -0
- yasminaai/types/__init__.py +65 -0
- yasminaai/types/bad_request_error_body.py +20 -0
- yasminaai/types/benefit.py +24 -0
- yasminaai/types/company_quote.py +23 -0
- yasminaai/types/error.py +20 -0
- yasminaai/types/policy.py +33 -0
- yasminaai/types/quote_price.py +24 -0
- yasminaai/types/quote_response.py +90 -0
- yasminaai/types/quote_response_drivers_item.py +33 -0
- yasminaai/types/quote_response_quotes_item.py +30 -0
- yasminaai/types/unauthorized_error_body.py +20 -0
- yasminaai/version.py +3 -0
|
@@ -0,0 +1,438 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import datetime as dt
|
|
4
|
+
import typing
|
|
5
|
+
|
|
6
|
+
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
7
|
+
from ..core.request_options import RequestOptions
|
|
8
|
+
from ..types.quote_response import QuoteResponse
|
|
9
|
+
from .raw_client import AsyncRawQuotesClient, RawQuotesClient
|
|
10
|
+
from .types.delete_quote_requests_id_response import DeleteQuoteRequestsIdResponse
|
|
11
|
+
from .types.get_quote_requests_response import GetQuoteRequestsResponse
|
|
12
|
+
from .types.post_quote_requests_request_drivers_item import PostQuoteRequestsRequestDriversItem
|
|
13
|
+
|
|
14
|
+
# this is used as the default value for optional parameters
|
|
15
|
+
OMIT = typing.cast(typing.Any, ...)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class QuotesClient:
|
|
19
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
20
|
+
self._raw_client = RawQuotesClient(client_wrapper=client_wrapper)
|
|
21
|
+
|
|
22
|
+
@property
|
|
23
|
+
def with_raw_response(self) -> RawQuotesClient:
|
|
24
|
+
"""
|
|
25
|
+
Retrieves a raw implementation of this client that returns raw responses.
|
|
26
|
+
|
|
27
|
+
Returns
|
|
28
|
+
-------
|
|
29
|
+
RawQuotesClient
|
|
30
|
+
"""
|
|
31
|
+
return self._raw_client
|
|
32
|
+
|
|
33
|
+
def show_quote(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> QuoteResponse:
|
|
34
|
+
"""
|
|
35
|
+
Parameters
|
|
36
|
+
----------
|
|
37
|
+
id : int
|
|
38
|
+
|
|
39
|
+
request_options : typing.Optional[RequestOptions]
|
|
40
|
+
Request-specific configuration.
|
|
41
|
+
|
|
42
|
+
Returns
|
|
43
|
+
-------
|
|
44
|
+
QuoteResponse
|
|
45
|
+
Single quote details
|
|
46
|
+
|
|
47
|
+
Examples
|
|
48
|
+
--------
|
|
49
|
+
from yasminaai import YasminaaiApi
|
|
50
|
+
|
|
51
|
+
client = YasminaaiApi(
|
|
52
|
+
token="YOUR_TOKEN",
|
|
53
|
+
)
|
|
54
|
+
client.quotes.show_quote(
|
|
55
|
+
id=1,
|
|
56
|
+
)
|
|
57
|
+
"""
|
|
58
|
+
_response = self._raw_client.show_quote(id, request_options=request_options)
|
|
59
|
+
return _response.data
|
|
60
|
+
|
|
61
|
+
def delete_quote(
|
|
62
|
+
self, id: int, *, request_options: typing.Optional[RequestOptions] = None
|
|
63
|
+
) -> DeleteQuoteRequestsIdResponse:
|
|
64
|
+
"""
|
|
65
|
+
Parameters
|
|
66
|
+
----------
|
|
67
|
+
id : int
|
|
68
|
+
|
|
69
|
+
request_options : typing.Optional[RequestOptions]
|
|
70
|
+
Request-specific configuration.
|
|
71
|
+
|
|
72
|
+
Returns
|
|
73
|
+
-------
|
|
74
|
+
DeleteQuoteRequestsIdResponse
|
|
75
|
+
Quote deleted successfully
|
|
76
|
+
|
|
77
|
+
Examples
|
|
78
|
+
--------
|
|
79
|
+
from yasminaai import YasminaaiApi
|
|
80
|
+
|
|
81
|
+
client = YasminaaiApi(
|
|
82
|
+
token="YOUR_TOKEN",
|
|
83
|
+
)
|
|
84
|
+
client.quotes.delete_quote(
|
|
85
|
+
id=1,
|
|
86
|
+
)
|
|
87
|
+
"""
|
|
88
|
+
_response = self._raw_client.delete_quote(id, request_options=request_options)
|
|
89
|
+
return _response.data
|
|
90
|
+
|
|
91
|
+
def list_quotes(self, *, request_options: typing.Optional[RequestOptions] = None) -> GetQuoteRequestsResponse:
|
|
92
|
+
"""
|
|
93
|
+
Parameters
|
|
94
|
+
----------
|
|
95
|
+
request_options : typing.Optional[RequestOptions]
|
|
96
|
+
Request-specific configuration.
|
|
97
|
+
|
|
98
|
+
Returns
|
|
99
|
+
-------
|
|
100
|
+
GetQuoteRequestsResponse
|
|
101
|
+
Paginated list of quotes
|
|
102
|
+
|
|
103
|
+
Examples
|
|
104
|
+
--------
|
|
105
|
+
from yasminaai import YasminaaiApi
|
|
106
|
+
|
|
107
|
+
client = YasminaaiApi(
|
|
108
|
+
token="YOUR_TOKEN",
|
|
109
|
+
)
|
|
110
|
+
client.quotes.list_quotes()
|
|
111
|
+
"""
|
|
112
|
+
_response = self._raw_client.list_quotes(request_options=request_options)
|
|
113
|
+
return _response.data
|
|
114
|
+
|
|
115
|
+
def request_quotes(
|
|
116
|
+
self,
|
|
117
|
+
*,
|
|
118
|
+
owner_id: str,
|
|
119
|
+
phone: str,
|
|
120
|
+
birthdate: dt.date,
|
|
121
|
+
car_sequence_number: str,
|
|
122
|
+
car_estimated_cost: float,
|
|
123
|
+
email: typing.Optional[str] = OMIT,
|
|
124
|
+
is_ownership_transfer: typing.Optional[bool] = OMIT,
|
|
125
|
+
current_car_owner_id: typing.Optional[str] = OMIT,
|
|
126
|
+
car_model_year: typing.Optional[int] = OMIT,
|
|
127
|
+
start_date: typing.Optional[dt.date] = OMIT,
|
|
128
|
+
drivers: typing.Optional[typing.Sequence[PostQuoteRequestsRequestDriversItem]] = OMIT,
|
|
129
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
130
|
+
) -> QuoteResponse:
|
|
131
|
+
"""
|
|
132
|
+
For getting prices with benefits.
|
|
133
|
+
The Quote IDs can be used later to issue a policy
|
|
134
|
+
|
|
135
|
+
Parameters
|
|
136
|
+
----------
|
|
137
|
+
owner_id : str
|
|
138
|
+
Owner ID must be 10 digits starting with 1, 2, or 7
|
|
139
|
+
|
|
140
|
+
phone : str
|
|
141
|
+
Phone number must start with 05 and be 10 digits
|
|
142
|
+
|
|
143
|
+
birthdate : dt.date
|
|
144
|
+
Birthdate in YYYY-MM-DD format
|
|
145
|
+
|
|
146
|
+
car_sequence_number : str
|
|
147
|
+
Car sequence number must be 8 or 9 digits
|
|
148
|
+
|
|
149
|
+
car_estimated_cost : float
|
|
150
|
+
Estimated cost of the car
|
|
151
|
+
|
|
152
|
+
email : typing.Optional[str]
|
|
153
|
+
Email address must be valid and belongs to the customer
|
|
154
|
+
|
|
155
|
+
is_ownership_transfer : typing.Optional[bool]
|
|
156
|
+
Indicates if the ownership is being transferred
|
|
157
|
+
|
|
158
|
+
current_car_owner_id : typing.Optional[str]
|
|
159
|
+
Required if is_ownership_transfer is true; 10 digits starting with 1,2,7
|
|
160
|
+
|
|
161
|
+
car_model_year : typing.Optional[int]
|
|
162
|
+
Car model year between 1950 and next year
|
|
163
|
+
|
|
164
|
+
start_date : typing.Optional[dt.date]
|
|
165
|
+
Desired policy start date in YYYY-MM-DD. Must be between tomorrow and 28 days from today (inclusive). The platform validates this range server-side.
|
|
166
|
+
|
|
167
|
+
drivers : typing.Optional[typing.Sequence[PostQuoteRequestsRequestDriversItem]]
|
|
168
|
+
List of drivers for the vehicle. When provided, the sum of all driving_percentage values must equal 100, and the owner must be included among the drivers.
|
|
169
|
+
|
|
170
|
+
request_options : typing.Optional[RequestOptions]
|
|
171
|
+
Request-specific configuration.
|
|
172
|
+
|
|
173
|
+
Returns
|
|
174
|
+
-------
|
|
175
|
+
QuoteResponse
|
|
176
|
+
Insurance quote details
|
|
177
|
+
|
|
178
|
+
Examples
|
|
179
|
+
--------
|
|
180
|
+
import datetime
|
|
181
|
+
|
|
182
|
+
from yasminaai import YasminaaiApi
|
|
183
|
+
|
|
184
|
+
client = YasminaaiApi(
|
|
185
|
+
token="YOUR_TOKEN",
|
|
186
|
+
)
|
|
187
|
+
client.quotes.request_quotes(
|
|
188
|
+
owner_id="owner_id",
|
|
189
|
+
phone="phone",
|
|
190
|
+
birthdate=datetime.date.fromisoformat(
|
|
191
|
+
"2023-01-15",
|
|
192
|
+
),
|
|
193
|
+
car_sequence_number="car_sequence_number",
|
|
194
|
+
car_estimated_cost=1.1,
|
|
195
|
+
)
|
|
196
|
+
"""
|
|
197
|
+
_response = self._raw_client.request_quotes(
|
|
198
|
+
owner_id=owner_id,
|
|
199
|
+
phone=phone,
|
|
200
|
+
birthdate=birthdate,
|
|
201
|
+
car_sequence_number=car_sequence_number,
|
|
202
|
+
car_estimated_cost=car_estimated_cost,
|
|
203
|
+
email=email,
|
|
204
|
+
is_ownership_transfer=is_ownership_transfer,
|
|
205
|
+
current_car_owner_id=current_car_owner_id,
|
|
206
|
+
car_model_year=car_model_year,
|
|
207
|
+
start_date=start_date,
|
|
208
|
+
drivers=drivers,
|
|
209
|
+
request_options=request_options,
|
|
210
|
+
)
|
|
211
|
+
return _response.data
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
class AsyncQuotesClient:
|
|
215
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
216
|
+
self._raw_client = AsyncRawQuotesClient(client_wrapper=client_wrapper)
|
|
217
|
+
|
|
218
|
+
@property
|
|
219
|
+
def with_raw_response(self) -> AsyncRawQuotesClient:
|
|
220
|
+
"""
|
|
221
|
+
Retrieves a raw implementation of this client that returns raw responses.
|
|
222
|
+
|
|
223
|
+
Returns
|
|
224
|
+
-------
|
|
225
|
+
AsyncRawQuotesClient
|
|
226
|
+
"""
|
|
227
|
+
return self._raw_client
|
|
228
|
+
|
|
229
|
+
async def show_quote(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> QuoteResponse:
|
|
230
|
+
"""
|
|
231
|
+
Parameters
|
|
232
|
+
----------
|
|
233
|
+
id : int
|
|
234
|
+
|
|
235
|
+
request_options : typing.Optional[RequestOptions]
|
|
236
|
+
Request-specific configuration.
|
|
237
|
+
|
|
238
|
+
Returns
|
|
239
|
+
-------
|
|
240
|
+
QuoteResponse
|
|
241
|
+
Single quote details
|
|
242
|
+
|
|
243
|
+
Examples
|
|
244
|
+
--------
|
|
245
|
+
import asyncio
|
|
246
|
+
|
|
247
|
+
from yasminaai import AsyncYasminaaiApi
|
|
248
|
+
|
|
249
|
+
client = AsyncYasminaaiApi(
|
|
250
|
+
token="YOUR_TOKEN",
|
|
251
|
+
)
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
async def main() -> None:
|
|
255
|
+
await client.quotes.show_quote(
|
|
256
|
+
id=1,
|
|
257
|
+
)
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
asyncio.run(main())
|
|
261
|
+
"""
|
|
262
|
+
_response = await self._raw_client.show_quote(id, request_options=request_options)
|
|
263
|
+
return _response.data
|
|
264
|
+
|
|
265
|
+
async def delete_quote(
|
|
266
|
+
self, id: int, *, request_options: typing.Optional[RequestOptions] = None
|
|
267
|
+
) -> DeleteQuoteRequestsIdResponse:
|
|
268
|
+
"""
|
|
269
|
+
Parameters
|
|
270
|
+
----------
|
|
271
|
+
id : int
|
|
272
|
+
|
|
273
|
+
request_options : typing.Optional[RequestOptions]
|
|
274
|
+
Request-specific configuration.
|
|
275
|
+
|
|
276
|
+
Returns
|
|
277
|
+
-------
|
|
278
|
+
DeleteQuoteRequestsIdResponse
|
|
279
|
+
Quote deleted successfully
|
|
280
|
+
|
|
281
|
+
Examples
|
|
282
|
+
--------
|
|
283
|
+
import asyncio
|
|
284
|
+
|
|
285
|
+
from yasminaai import AsyncYasminaaiApi
|
|
286
|
+
|
|
287
|
+
client = AsyncYasminaaiApi(
|
|
288
|
+
token="YOUR_TOKEN",
|
|
289
|
+
)
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
async def main() -> None:
|
|
293
|
+
await client.quotes.delete_quote(
|
|
294
|
+
id=1,
|
|
295
|
+
)
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
asyncio.run(main())
|
|
299
|
+
"""
|
|
300
|
+
_response = await self._raw_client.delete_quote(id, request_options=request_options)
|
|
301
|
+
return _response.data
|
|
302
|
+
|
|
303
|
+
async def list_quotes(self, *, request_options: typing.Optional[RequestOptions] = None) -> GetQuoteRequestsResponse:
|
|
304
|
+
"""
|
|
305
|
+
Parameters
|
|
306
|
+
----------
|
|
307
|
+
request_options : typing.Optional[RequestOptions]
|
|
308
|
+
Request-specific configuration.
|
|
309
|
+
|
|
310
|
+
Returns
|
|
311
|
+
-------
|
|
312
|
+
GetQuoteRequestsResponse
|
|
313
|
+
Paginated list of quotes
|
|
314
|
+
|
|
315
|
+
Examples
|
|
316
|
+
--------
|
|
317
|
+
import asyncio
|
|
318
|
+
|
|
319
|
+
from yasminaai import AsyncYasminaaiApi
|
|
320
|
+
|
|
321
|
+
client = AsyncYasminaaiApi(
|
|
322
|
+
token="YOUR_TOKEN",
|
|
323
|
+
)
|
|
324
|
+
|
|
325
|
+
|
|
326
|
+
async def main() -> None:
|
|
327
|
+
await client.quotes.list_quotes()
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+
asyncio.run(main())
|
|
331
|
+
"""
|
|
332
|
+
_response = await self._raw_client.list_quotes(request_options=request_options)
|
|
333
|
+
return _response.data
|
|
334
|
+
|
|
335
|
+
async def request_quotes(
|
|
336
|
+
self,
|
|
337
|
+
*,
|
|
338
|
+
owner_id: str,
|
|
339
|
+
phone: str,
|
|
340
|
+
birthdate: dt.date,
|
|
341
|
+
car_sequence_number: str,
|
|
342
|
+
car_estimated_cost: float,
|
|
343
|
+
email: typing.Optional[str] = OMIT,
|
|
344
|
+
is_ownership_transfer: typing.Optional[bool] = OMIT,
|
|
345
|
+
current_car_owner_id: typing.Optional[str] = OMIT,
|
|
346
|
+
car_model_year: typing.Optional[int] = OMIT,
|
|
347
|
+
start_date: typing.Optional[dt.date] = OMIT,
|
|
348
|
+
drivers: typing.Optional[typing.Sequence[PostQuoteRequestsRequestDriversItem]] = OMIT,
|
|
349
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
350
|
+
) -> QuoteResponse:
|
|
351
|
+
"""
|
|
352
|
+
For getting prices with benefits.
|
|
353
|
+
The Quote IDs can be used later to issue a policy
|
|
354
|
+
|
|
355
|
+
Parameters
|
|
356
|
+
----------
|
|
357
|
+
owner_id : str
|
|
358
|
+
Owner ID must be 10 digits starting with 1, 2, or 7
|
|
359
|
+
|
|
360
|
+
phone : str
|
|
361
|
+
Phone number must start with 05 and be 10 digits
|
|
362
|
+
|
|
363
|
+
birthdate : dt.date
|
|
364
|
+
Birthdate in YYYY-MM-DD format
|
|
365
|
+
|
|
366
|
+
car_sequence_number : str
|
|
367
|
+
Car sequence number must be 8 or 9 digits
|
|
368
|
+
|
|
369
|
+
car_estimated_cost : float
|
|
370
|
+
Estimated cost of the car
|
|
371
|
+
|
|
372
|
+
email : typing.Optional[str]
|
|
373
|
+
Email address must be valid and belongs to the customer
|
|
374
|
+
|
|
375
|
+
is_ownership_transfer : typing.Optional[bool]
|
|
376
|
+
Indicates if the ownership is being transferred
|
|
377
|
+
|
|
378
|
+
current_car_owner_id : typing.Optional[str]
|
|
379
|
+
Required if is_ownership_transfer is true; 10 digits starting with 1,2,7
|
|
380
|
+
|
|
381
|
+
car_model_year : typing.Optional[int]
|
|
382
|
+
Car model year between 1950 and next year
|
|
383
|
+
|
|
384
|
+
start_date : typing.Optional[dt.date]
|
|
385
|
+
Desired policy start date in YYYY-MM-DD. Must be between tomorrow and 28 days from today (inclusive). The platform validates this range server-side.
|
|
386
|
+
|
|
387
|
+
drivers : typing.Optional[typing.Sequence[PostQuoteRequestsRequestDriversItem]]
|
|
388
|
+
List of drivers for the vehicle. When provided, the sum of all driving_percentage values must equal 100, and the owner must be included among the drivers.
|
|
389
|
+
|
|
390
|
+
request_options : typing.Optional[RequestOptions]
|
|
391
|
+
Request-specific configuration.
|
|
392
|
+
|
|
393
|
+
Returns
|
|
394
|
+
-------
|
|
395
|
+
QuoteResponse
|
|
396
|
+
Insurance quote details
|
|
397
|
+
|
|
398
|
+
Examples
|
|
399
|
+
--------
|
|
400
|
+
import asyncio
|
|
401
|
+
import datetime
|
|
402
|
+
|
|
403
|
+
from yasminaai import AsyncYasminaaiApi
|
|
404
|
+
|
|
405
|
+
client = AsyncYasminaaiApi(
|
|
406
|
+
token="YOUR_TOKEN",
|
|
407
|
+
)
|
|
408
|
+
|
|
409
|
+
|
|
410
|
+
async def main() -> None:
|
|
411
|
+
await client.quotes.request_quotes(
|
|
412
|
+
owner_id="owner_id",
|
|
413
|
+
phone="phone",
|
|
414
|
+
birthdate=datetime.date.fromisoformat(
|
|
415
|
+
"2023-01-15",
|
|
416
|
+
),
|
|
417
|
+
car_sequence_number="car_sequence_number",
|
|
418
|
+
car_estimated_cost=1.1,
|
|
419
|
+
)
|
|
420
|
+
|
|
421
|
+
|
|
422
|
+
asyncio.run(main())
|
|
423
|
+
"""
|
|
424
|
+
_response = await self._raw_client.request_quotes(
|
|
425
|
+
owner_id=owner_id,
|
|
426
|
+
phone=phone,
|
|
427
|
+
birthdate=birthdate,
|
|
428
|
+
car_sequence_number=car_sequence_number,
|
|
429
|
+
car_estimated_cost=car_estimated_cost,
|
|
430
|
+
email=email,
|
|
431
|
+
is_ownership_transfer=is_ownership_transfer,
|
|
432
|
+
current_car_owner_id=current_car_owner_id,
|
|
433
|
+
car_model_year=car_model_year,
|
|
434
|
+
start_date=start_date,
|
|
435
|
+
drivers=drivers,
|
|
436
|
+
request_options=request_options,
|
|
437
|
+
)
|
|
438
|
+
return _response.data
|