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,548 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import datetime as dt
|
|
4
|
+
import typing
|
|
5
|
+
from json.decoder import JSONDecodeError
|
|
6
|
+
|
|
7
|
+
from ..core.api_error import ApiError
|
|
8
|
+
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
9
|
+
from ..core.http_response import AsyncHttpResponse, HttpResponse
|
|
10
|
+
from ..core.jsonable_encoder import encode_path_param
|
|
11
|
+
from ..core.parse_error import ParsingError
|
|
12
|
+
from ..core.pydantic_utilities import parse_obj_as
|
|
13
|
+
from ..core.request_options import RequestOptions
|
|
14
|
+
from ..core.serialization import convert_and_respect_annotation_metadata
|
|
15
|
+
from ..errors.not_found_error import NotFoundError
|
|
16
|
+
from ..errors.unauthorized_error import UnauthorizedError
|
|
17
|
+
from ..types.quote_response import QuoteResponse
|
|
18
|
+
from .types.delete_quote_requests_id_response import DeleteQuoteRequestsIdResponse
|
|
19
|
+
from .types.get_quote_requests_response import GetQuoteRequestsResponse
|
|
20
|
+
from .types.post_quote_requests_request_drivers_item import PostQuoteRequestsRequestDriversItem
|
|
21
|
+
from pydantic import ValidationError
|
|
22
|
+
|
|
23
|
+
# this is used as the default value for optional parameters
|
|
24
|
+
OMIT = typing.cast(typing.Any, ...)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class RawQuotesClient:
|
|
28
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
29
|
+
self._client_wrapper = client_wrapper
|
|
30
|
+
|
|
31
|
+
def show_quote(
|
|
32
|
+
self, id: int, *, request_options: typing.Optional[RequestOptions] = None
|
|
33
|
+
) -> HttpResponse[QuoteResponse]:
|
|
34
|
+
"""
|
|
35
|
+
Parameters
|
|
36
|
+
----------
|
|
37
|
+
id : int
|
|
38
|
+
|
|
39
|
+
request_options : typing.Optional[RequestOptions]
|
|
40
|
+
Request-specific configuration.
|
|
41
|
+
|
|
42
|
+
Returns
|
|
43
|
+
-------
|
|
44
|
+
HttpResponse[QuoteResponse]
|
|
45
|
+
Single quote details
|
|
46
|
+
"""
|
|
47
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
48
|
+
f"quote-requests/{encode_path_param(id)}",
|
|
49
|
+
method="GET",
|
|
50
|
+
request_options=request_options,
|
|
51
|
+
)
|
|
52
|
+
try:
|
|
53
|
+
if 200 <= _response.status_code < 300:
|
|
54
|
+
_data = typing.cast(
|
|
55
|
+
QuoteResponse,
|
|
56
|
+
parse_obj_as(
|
|
57
|
+
type_=QuoteResponse, # type: ignore
|
|
58
|
+
object_=_response.json(),
|
|
59
|
+
),
|
|
60
|
+
)
|
|
61
|
+
return HttpResponse(response=_response, data=_data)
|
|
62
|
+
if _response.status_code == 404:
|
|
63
|
+
raise NotFoundError(
|
|
64
|
+
headers=dict(_response.headers),
|
|
65
|
+
body=typing.cast(
|
|
66
|
+
typing.Any,
|
|
67
|
+
parse_obj_as(
|
|
68
|
+
type_=typing.Any, # type: ignore
|
|
69
|
+
object_=_response.json(),
|
|
70
|
+
),
|
|
71
|
+
),
|
|
72
|
+
)
|
|
73
|
+
_response_json = _response.json()
|
|
74
|
+
except JSONDecodeError:
|
|
75
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
76
|
+
except ValidationError as e:
|
|
77
|
+
raise ParsingError(
|
|
78
|
+
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
|
|
79
|
+
)
|
|
80
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
81
|
+
|
|
82
|
+
def delete_quote(
|
|
83
|
+
self, id: int, *, request_options: typing.Optional[RequestOptions] = None
|
|
84
|
+
) -> HttpResponse[DeleteQuoteRequestsIdResponse]:
|
|
85
|
+
"""
|
|
86
|
+
Parameters
|
|
87
|
+
----------
|
|
88
|
+
id : int
|
|
89
|
+
|
|
90
|
+
request_options : typing.Optional[RequestOptions]
|
|
91
|
+
Request-specific configuration.
|
|
92
|
+
|
|
93
|
+
Returns
|
|
94
|
+
-------
|
|
95
|
+
HttpResponse[DeleteQuoteRequestsIdResponse]
|
|
96
|
+
Quote deleted successfully
|
|
97
|
+
"""
|
|
98
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
99
|
+
f"quote-requests/{encode_path_param(id)}",
|
|
100
|
+
method="DELETE",
|
|
101
|
+
request_options=request_options,
|
|
102
|
+
)
|
|
103
|
+
try:
|
|
104
|
+
if 200 <= _response.status_code < 300:
|
|
105
|
+
_data = typing.cast(
|
|
106
|
+
DeleteQuoteRequestsIdResponse,
|
|
107
|
+
parse_obj_as(
|
|
108
|
+
type_=DeleteQuoteRequestsIdResponse, # type: ignore
|
|
109
|
+
object_=_response.json(),
|
|
110
|
+
),
|
|
111
|
+
)
|
|
112
|
+
return HttpResponse(response=_response, data=_data)
|
|
113
|
+
if _response.status_code == 404:
|
|
114
|
+
raise NotFoundError(
|
|
115
|
+
headers=dict(_response.headers),
|
|
116
|
+
body=typing.cast(
|
|
117
|
+
typing.Any,
|
|
118
|
+
parse_obj_as(
|
|
119
|
+
type_=typing.Any, # type: ignore
|
|
120
|
+
object_=_response.json(),
|
|
121
|
+
),
|
|
122
|
+
),
|
|
123
|
+
)
|
|
124
|
+
_response_json = _response.json()
|
|
125
|
+
except JSONDecodeError:
|
|
126
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
127
|
+
except ValidationError as e:
|
|
128
|
+
raise ParsingError(
|
|
129
|
+
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
|
|
130
|
+
)
|
|
131
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
132
|
+
|
|
133
|
+
def list_quotes(
|
|
134
|
+
self, *, request_options: typing.Optional[RequestOptions] = None
|
|
135
|
+
) -> HttpResponse[GetQuoteRequestsResponse]:
|
|
136
|
+
"""
|
|
137
|
+
Parameters
|
|
138
|
+
----------
|
|
139
|
+
request_options : typing.Optional[RequestOptions]
|
|
140
|
+
Request-specific configuration.
|
|
141
|
+
|
|
142
|
+
Returns
|
|
143
|
+
-------
|
|
144
|
+
HttpResponse[GetQuoteRequestsResponse]
|
|
145
|
+
Paginated list of quotes
|
|
146
|
+
"""
|
|
147
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
148
|
+
"quote-requests",
|
|
149
|
+
method="GET",
|
|
150
|
+
request_options=request_options,
|
|
151
|
+
)
|
|
152
|
+
try:
|
|
153
|
+
if 200 <= _response.status_code < 300:
|
|
154
|
+
_data = typing.cast(
|
|
155
|
+
GetQuoteRequestsResponse,
|
|
156
|
+
parse_obj_as(
|
|
157
|
+
type_=GetQuoteRequestsResponse, # type: ignore
|
|
158
|
+
object_=_response.json(),
|
|
159
|
+
),
|
|
160
|
+
)
|
|
161
|
+
return HttpResponse(response=_response, data=_data)
|
|
162
|
+
_response_json = _response.json()
|
|
163
|
+
except JSONDecodeError:
|
|
164
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
165
|
+
except ValidationError as e:
|
|
166
|
+
raise ParsingError(
|
|
167
|
+
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
|
|
168
|
+
)
|
|
169
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
170
|
+
|
|
171
|
+
def request_quotes(
|
|
172
|
+
self,
|
|
173
|
+
*,
|
|
174
|
+
owner_id: str,
|
|
175
|
+
phone: str,
|
|
176
|
+
birthdate: dt.date,
|
|
177
|
+
car_sequence_number: str,
|
|
178
|
+
car_estimated_cost: float,
|
|
179
|
+
email: typing.Optional[str] = OMIT,
|
|
180
|
+
is_ownership_transfer: typing.Optional[bool] = OMIT,
|
|
181
|
+
current_car_owner_id: typing.Optional[str] = OMIT,
|
|
182
|
+
car_model_year: typing.Optional[int] = OMIT,
|
|
183
|
+
start_date: typing.Optional[dt.date] = OMIT,
|
|
184
|
+
drivers: typing.Optional[typing.Sequence[PostQuoteRequestsRequestDriversItem]] = OMIT,
|
|
185
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
186
|
+
) -> HttpResponse[QuoteResponse]:
|
|
187
|
+
"""
|
|
188
|
+
For getting prices with benefits.
|
|
189
|
+
The Quote IDs can be used later to issue a policy
|
|
190
|
+
|
|
191
|
+
Parameters
|
|
192
|
+
----------
|
|
193
|
+
owner_id : str
|
|
194
|
+
Owner ID must be 10 digits starting with 1, 2, or 7
|
|
195
|
+
|
|
196
|
+
phone : str
|
|
197
|
+
Phone number must start with 05 and be 10 digits
|
|
198
|
+
|
|
199
|
+
birthdate : dt.date
|
|
200
|
+
Birthdate in YYYY-MM-DD format
|
|
201
|
+
|
|
202
|
+
car_sequence_number : str
|
|
203
|
+
Car sequence number must be 8 or 9 digits
|
|
204
|
+
|
|
205
|
+
car_estimated_cost : float
|
|
206
|
+
Estimated cost of the car
|
|
207
|
+
|
|
208
|
+
email : typing.Optional[str]
|
|
209
|
+
Email address must be valid and belongs to the customer
|
|
210
|
+
|
|
211
|
+
is_ownership_transfer : typing.Optional[bool]
|
|
212
|
+
Indicates if the ownership is being transferred
|
|
213
|
+
|
|
214
|
+
current_car_owner_id : typing.Optional[str]
|
|
215
|
+
Required if is_ownership_transfer is true; 10 digits starting with 1,2,7
|
|
216
|
+
|
|
217
|
+
car_model_year : typing.Optional[int]
|
|
218
|
+
Car model year between 1950 and next year
|
|
219
|
+
|
|
220
|
+
start_date : typing.Optional[dt.date]
|
|
221
|
+
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.
|
|
222
|
+
|
|
223
|
+
drivers : typing.Optional[typing.Sequence[PostQuoteRequestsRequestDriversItem]]
|
|
224
|
+
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.
|
|
225
|
+
|
|
226
|
+
request_options : typing.Optional[RequestOptions]
|
|
227
|
+
Request-specific configuration.
|
|
228
|
+
|
|
229
|
+
Returns
|
|
230
|
+
-------
|
|
231
|
+
HttpResponse[QuoteResponse]
|
|
232
|
+
Insurance quote details
|
|
233
|
+
"""
|
|
234
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
235
|
+
"quote-requests",
|
|
236
|
+
method="POST",
|
|
237
|
+
json={
|
|
238
|
+
"owner_id": owner_id,
|
|
239
|
+
"email": email,
|
|
240
|
+
"phone": phone,
|
|
241
|
+
"birthdate": birthdate,
|
|
242
|
+
"car_sequence_number": car_sequence_number,
|
|
243
|
+
"is_ownership_transfer": is_ownership_transfer,
|
|
244
|
+
"current_car_owner_id": current_car_owner_id,
|
|
245
|
+
"car_estimated_cost": car_estimated_cost,
|
|
246
|
+
"car_model_year": car_model_year,
|
|
247
|
+
"start_date": start_date,
|
|
248
|
+
"drivers": convert_and_respect_annotation_metadata(
|
|
249
|
+
object_=drivers, annotation=typing.Sequence[PostQuoteRequestsRequestDriversItem], direction="write"
|
|
250
|
+
),
|
|
251
|
+
},
|
|
252
|
+
headers={
|
|
253
|
+
"content-type": "application/json",
|
|
254
|
+
},
|
|
255
|
+
request_options=request_options,
|
|
256
|
+
omit=OMIT,
|
|
257
|
+
)
|
|
258
|
+
try:
|
|
259
|
+
if 200 <= _response.status_code < 300:
|
|
260
|
+
_data = typing.cast(
|
|
261
|
+
QuoteResponse,
|
|
262
|
+
parse_obj_as(
|
|
263
|
+
type_=QuoteResponse, # type: ignore
|
|
264
|
+
object_=_response.json(),
|
|
265
|
+
),
|
|
266
|
+
)
|
|
267
|
+
return HttpResponse(response=_response, data=_data)
|
|
268
|
+
if _response.status_code == 401:
|
|
269
|
+
raise UnauthorizedError(
|
|
270
|
+
headers=dict(_response.headers),
|
|
271
|
+
body=typing.cast(
|
|
272
|
+
typing.Any,
|
|
273
|
+
parse_obj_as(
|
|
274
|
+
type_=typing.Any, # type: ignore
|
|
275
|
+
object_=_response.json(),
|
|
276
|
+
),
|
|
277
|
+
),
|
|
278
|
+
)
|
|
279
|
+
_response_json = _response.json()
|
|
280
|
+
except JSONDecodeError:
|
|
281
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
282
|
+
except ValidationError as e:
|
|
283
|
+
raise ParsingError(
|
|
284
|
+
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
|
|
285
|
+
)
|
|
286
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
287
|
+
|
|
288
|
+
|
|
289
|
+
class AsyncRawQuotesClient:
|
|
290
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
291
|
+
self._client_wrapper = client_wrapper
|
|
292
|
+
|
|
293
|
+
async def show_quote(
|
|
294
|
+
self, id: int, *, request_options: typing.Optional[RequestOptions] = None
|
|
295
|
+
) -> AsyncHttpResponse[QuoteResponse]:
|
|
296
|
+
"""
|
|
297
|
+
Parameters
|
|
298
|
+
----------
|
|
299
|
+
id : int
|
|
300
|
+
|
|
301
|
+
request_options : typing.Optional[RequestOptions]
|
|
302
|
+
Request-specific configuration.
|
|
303
|
+
|
|
304
|
+
Returns
|
|
305
|
+
-------
|
|
306
|
+
AsyncHttpResponse[QuoteResponse]
|
|
307
|
+
Single quote details
|
|
308
|
+
"""
|
|
309
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
310
|
+
f"quote-requests/{encode_path_param(id)}",
|
|
311
|
+
method="GET",
|
|
312
|
+
request_options=request_options,
|
|
313
|
+
)
|
|
314
|
+
try:
|
|
315
|
+
if 200 <= _response.status_code < 300:
|
|
316
|
+
_data = typing.cast(
|
|
317
|
+
QuoteResponse,
|
|
318
|
+
parse_obj_as(
|
|
319
|
+
type_=QuoteResponse, # type: ignore
|
|
320
|
+
object_=_response.json(),
|
|
321
|
+
),
|
|
322
|
+
)
|
|
323
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
324
|
+
if _response.status_code == 404:
|
|
325
|
+
raise NotFoundError(
|
|
326
|
+
headers=dict(_response.headers),
|
|
327
|
+
body=typing.cast(
|
|
328
|
+
typing.Any,
|
|
329
|
+
parse_obj_as(
|
|
330
|
+
type_=typing.Any, # type: ignore
|
|
331
|
+
object_=_response.json(),
|
|
332
|
+
),
|
|
333
|
+
),
|
|
334
|
+
)
|
|
335
|
+
_response_json = _response.json()
|
|
336
|
+
except JSONDecodeError:
|
|
337
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
338
|
+
except ValidationError as e:
|
|
339
|
+
raise ParsingError(
|
|
340
|
+
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
|
|
341
|
+
)
|
|
342
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
343
|
+
|
|
344
|
+
async def delete_quote(
|
|
345
|
+
self, id: int, *, request_options: typing.Optional[RequestOptions] = None
|
|
346
|
+
) -> AsyncHttpResponse[DeleteQuoteRequestsIdResponse]:
|
|
347
|
+
"""
|
|
348
|
+
Parameters
|
|
349
|
+
----------
|
|
350
|
+
id : int
|
|
351
|
+
|
|
352
|
+
request_options : typing.Optional[RequestOptions]
|
|
353
|
+
Request-specific configuration.
|
|
354
|
+
|
|
355
|
+
Returns
|
|
356
|
+
-------
|
|
357
|
+
AsyncHttpResponse[DeleteQuoteRequestsIdResponse]
|
|
358
|
+
Quote deleted successfully
|
|
359
|
+
"""
|
|
360
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
361
|
+
f"quote-requests/{encode_path_param(id)}",
|
|
362
|
+
method="DELETE",
|
|
363
|
+
request_options=request_options,
|
|
364
|
+
)
|
|
365
|
+
try:
|
|
366
|
+
if 200 <= _response.status_code < 300:
|
|
367
|
+
_data = typing.cast(
|
|
368
|
+
DeleteQuoteRequestsIdResponse,
|
|
369
|
+
parse_obj_as(
|
|
370
|
+
type_=DeleteQuoteRequestsIdResponse, # type: ignore
|
|
371
|
+
object_=_response.json(),
|
|
372
|
+
),
|
|
373
|
+
)
|
|
374
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
375
|
+
if _response.status_code == 404:
|
|
376
|
+
raise NotFoundError(
|
|
377
|
+
headers=dict(_response.headers),
|
|
378
|
+
body=typing.cast(
|
|
379
|
+
typing.Any,
|
|
380
|
+
parse_obj_as(
|
|
381
|
+
type_=typing.Any, # type: ignore
|
|
382
|
+
object_=_response.json(),
|
|
383
|
+
),
|
|
384
|
+
),
|
|
385
|
+
)
|
|
386
|
+
_response_json = _response.json()
|
|
387
|
+
except JSONDecodeError:
|
|
388
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
389
|
+
except ValidationError as e:
|
|
390
|
+
raise ParsingError(
|
|
391
|
+
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
|
|
392
|
+
)
|
|
393
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
394
|
+
|
|
395
|
+
async def list_quotes(
|
|
396
|
+
self, *, request_options: typing.Optional[RequestOptions] = None
|
|
397
|
+
) -> AsyncHttpResponse[GetQuoteRequestsResponse]:
|
|
398
|
+
"""
|
|
399
|
+
Parameters
|
|
400
|
+
----------
|
|
401
|
+
request_options : typing.Optional[RequestOptions]
|
|
402
|
+
Request-specific configuration.
|
|
403
|
+
|
|
404
|
+
Returns
|
|
405
|
+
-------
|
|
406
|
+
AsyncHttpResponse[GetQuoteRequestsResponse]
|
|
407
|
+
Paginated list of quotes
|
|
408
|
+
"""
|
|
409
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
410
|
+
"quote-requests",
|
|
411
|
+
method="GET",
|
|
412
|
+
request_options=request_options,
|
|
413
|
+
)
|
|
414
|
+
try:
|
|
415
|
+
if 200 <= _response.status_code < 300:
|
|
416
|
+
_data = typing.cast(
|
|
417
|
+
GetQuoteRequestsResponse,
|
|
418
|
+
parse_obj_as(
|
|
419
|
+
type_=GetQuoteRequestsResponse, # type: ignore
|
|
420
|
+
object_=_response.json(),
|
|
421
|
+
),
|
|
422
|
+
)
|
|
423
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
424
|
+
_response_json = _response.json()
|
|
425
|
+
except JSONDecodeError:
|
|
426
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
427
|
+
except ValidationError as e:
|
|
428
|
+
raise ParsingError(
|
|
429
|
+
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
|
|
430
|
+
)
|
|
431
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
432
|
+
|
|
433
|
+
async def request_quotes(
|
|
434
|
+
self,
|
|
435
|
+
*,
|
|
436
|
+
owner_id: str,
|
|
437
|
+
phone: str,
|
|
438
|
+
birthdate: dt.date,
|
|
439
|
+
car_sequence_number: str,
|
|
440
|
+
car_estimated_cost: float,
|
|
441
|
+
email: typing.Optional[str] = OMIT,
|
|
442
|
+
is_ownership_transfer: typing.Optional[bool] = OMIT,
|
|
443
|
+
current_car_owner_id: typing.Optional[str] = OMIT,
|
|
444
|
+
car_model_year: typing.Optional[int] = OMIT,
|
|
445
|
+
start_date: typing.Optional[dt.date] = OMIT,
|
|
446
|
+
drivers: typing.Optional[typing.Sequence[PostQuoteRequestsRequestDriversItem]] = OMIT,
|
|
447
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
448
|
+
) -> AsyncHttpResponse[QuoteResponse]:
|
|
449
|
+
"""
|
|
450
|
+
For getting prices with benefits.
|
|
451
|
+
The Quote IDs can be used later to issue a policy
|
|
452
|
+
|
|
453
|
+
Parameters
|
|
454
|
+
----------
|
|
455
|
+
owner_id : str
|
|
456
|
+
Owner ID must be 10 digits starting with 1, 2, or 7
|
|
457
|
+
|
|
458
|
+
phone : str
|
|
459
|
+
Phone number must start with 05 and be 10 digits
|
|
460
|
+
|
|
461
|
+
birthdate : dt.date
|
|
462
|
+
Birthdate in YYYY-MM-DD format
|
|
463
|
+
|
|
464
|
+
car_sequence_number : str
|
|
465
|
+
Car sequence number must be 8 or 9 digits
|
|
466
|
+
|
|
467
|
+
car_estimated_cost : float
|
|
468
|
+
Estimated cost of the car
|
|
469
|
+
|
|
470
|
+
email : typing.Optional[str]
|
|
471
|
+
Email address must be valid and belongs to the customer
|
|
472
|
+
|
|
473
|
+
is_ownership_transfer : typing.Optional[bool]
|
|
474
|
+
Indicates if the ownership is being transferred
|
|
475
|
+
|
|
476
|
+
current_car_owner_id : typing.Optional[str]
|
|
477
|
+
Required if is_ownership_transfer is true; 10 digits starting with 1,2,7
|
|
478
|
+
|
|
479
|
+
car_model_year : typing.Optional[int]
|
|
480
|
+
Car model year between 1950 and next year
|
|
481
|
+
|
|
482
|
+
start_date : typing.Optional[dt.date]
|
|
483
|
+
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.
|
|
484
|
+
|
|
485
|
+
drivers : typing.Optional[typing.Sequence[PostQuoteRequestsRequestDriversItem]]
|
|
486
|
+
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.
|
|
487
|
+
|
|
488
|
+
request_options : typing.Optional[RequestOptions]
|
|
489
|
+
Request-specific configuration.
|
|
490
|
+
|
|
491
|
+
Returns
|
|
492
|
+
-------
|
|
493
|
+
AsyncHttpResponse[QuoteResponse]
|
|
494
|
+
Insurance quote details
|
|
495
|
+
"""
|
|
496
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
497
|
+
"quote-requests",
|
|
498
|
+
method="POST",
|
|
499
|
+
json={
|
|
500
|
+
"owner_id": owner_id,
|
|
501
|
+
"email": email,
|
|
502
|
+
"phone": phone,
|
|
503
|
+
"birthdate": birthdate,
|
|
504
|
+
"car_sequence_number": car_sequence_number,
|
|
505
|
+
"is_ownership_transfer": is_ownership_transfer,
|
|
506
|
+
"current_car_owner_id": current_car_owner_id,
|
|
507
|
+
"car_estimated_cost": car_estimated_cost,
|
|
508
|
+
"car_model_year": car_model_year,
|
|
509
|
+
"start_date": start_date,
|
|
510
|
+
"drivers": convert_and_respect_annotation_metadata(
|
|
511
|
+
object_=drivers, annotation=typing.Sequence[PostQuoteRequestsRequestDriversItem], direction="write"
|
|
512
|
+
),
|
|
513
|
+
},
|
|
514
|
+
headers={
|
|
515
|
+
"content-type": "application/json",
|
|
516
|
+
},
|
|
517
|
+
request_options=request_options,
|
|
518
|
+
omit=OMIT,
|
|
519
|
+
)
|
|
520
|
+
try:
|
|
521
|
+
if 200 <= _response.status_code < 300:
|
|
522
|
+
_data = typing.cast(
|
|
523
|
+
QuoteResponse,
|
|
524
|
+
parse_obj_as(
|
|
525
|
+
type_=QuoteResponse, # type: ignore
|
|
526
|
+
object_=_response.json(),
|
|
527
|
+
),
|
|
528
|
+
)
|
|
529
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
530
|
+
if _response.status_code == 401:
|
|
531
|
+
raise UnauthorizedError(
|
|
532
|
+
headers=dict(_response.headers),
|
|
533
|
+
body=typing.cast(
|
|
534
|
+
typing.Any,
|
|
535
|
+
parse_obj_as(
|
|
536
|
+
type_=typing.Any, # type: ignore
|
|
537
|
+
object_=_response.json(),
|
|
538
|
+
),
|
|
539
|
+
),
|
|
540
|
+
)
|
|
541
|
+
_response_json = _response.json()
|
|
542
|
+
except JSONDecodeError:
|
|
543
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
544
|
+
except ValidationError as e:
|
|
545
|
+
raise ParsingError(
|
|
546
|
+
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
|
|
547
|
+
)
|
|
548
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
# isort: skip_file
|
|
4
|
+
|
|
5
|
+
import typing
|
|
6
|
+
from importlib import import_module
|
|
7
|
+
|
|
8
|
+
if typing.TYPE_CHECKING:
|
|
9
|
+
from .delete_quote_requests_id_response import DeleteQuoteRequestsIdResponse
|
|
10
|
+
from .get_quote_requests_response import GetQuoteRequestsResponse
|
|
11
|
+
from .get_quote_requests_response_links_item import GetQuoteRequestsResponseLinksItem
|
|
12
|
+
from .post_quote_requests_request_drivers_item import PostQuoteRequestsRequestDriversItem
|
|
13
|
+
_dynamic_imports: typing.Dict[str, str] = {
|
|
14
|
+
"DeleteQuoteRequestsIdResponse": ".delete_quote_requests_id_response",
|
|
15
|
+
"GetQuoteRequestsResponse": ".get_quote_requests_response",
|
|
16
|
+
"GetQuoteRequestsResponseLinksItem": ".get_quote_requests_response_links_item",
|
|
17
|
+
"PostQuoteRequestsRequestDriversItem": ".post_quote_requests_request_drivers_item",
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def __getattr__(attr_name: str) -> typing.Any:
|
|
22
|
+
module_name = _dynamic_imports.get(attr_name)
|
|
23
|
+
if module_name is None:
|
|
24
|
+
raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}")
|
|
25
|
+
try:
|
|
26
|
+
module = import_module(module_name, __package__)
|
|
27
|
+
if module_name == f".{attr_name}":
|
|
28
|
+
return module
|
|
29
|
+
else:
|
|
30
|
+
return getattr(module, attr_name)
|
|
31
|
+
except ImportError as e:
|
|
32
|
+
raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e
|
|
33
|
+
except AttributeError as e:
|
|
34
|
+
raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def __dir__():
|
|
38
|
+
lazy_attrs = list(_dynamic_imports.keys())
|
|
39
|
+
return sorted(lazy_attrs)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
__all__ = [
|
|
43
|
+
"DeleteQuoteRequestsIdResponse",
|
|
44
|
+
"GetQuoteRequestsResponse",
|
|
45
|
+
"GetQuoteRequestsResponseLinksItem",
|
|
46
|
+
"PostQuoteRequestsRequestDriversItem",
|
|
47
|
+
]
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
|
|
5
|
+
import pydantic
|
|
6
|
+
from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class DeleteQuoteRequestsIdResponse(UniversalBaseModel):
|
|
10
|
+
message: typing.Optional[str] = None
|
|
11
|
+
|
|
12
|
+
if IS_PYDANTIC_V2:
|
|
13
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
14
|
+
else:
|
|
15
|
+
|
|
16
|
+
class Config:
|
|
17
|
+
frozen = True
|
|
18
|
+
smart_union = True
|
|
19
|
+
extra = pydantic.Extra.allow
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
|
|
5
|
+
import pydantic
|
|
6
|
+
import typing_extensions
|
|
7
|
+
from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
|
|
8
|
+
from ...core.serialization import FieldMetadata
|
|
9
|
+
from ...types.quote_response import QuoteResponse
|
|
10
|
+
from .get_quote_requests_response_links_item import GetQuoteRequestsResponseLinksItem
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class GetQuoteRequestsResponse(UniversalBaseModel):
|
|
14
|
+
current_page: typing.Optional[int] = None
|
|
15
|
+
data: typing.Optional[typing.List[QuoteResponse]] = None
|
|
16
|
+
first_page_url: typing.Optional[str] = None
|
|
17
|
+
from_: typing_extensions.Annotated[
|
|
18
|
+
typing.Optional[int], FieldMetadata(alias="from"), pydantic.Field(alias="from")
|
|
19
|
+
] = None
|
|
20
|
+
last_page: typing.Optional[int] = None
|
|
21
|
+
last_page_url: typing.Optional[str] = None
|
|
22
|
+
links: typing.Optional[typing.List[GetQuoteRequestsResponseLinksItem]] = None
|
|
23
|
+
next_page_url: typing.Optional[str] = None
|
|
24
|
+
path: typing.Optional[str] = None
|
|
25
|
+
per_page: typing.Optional[int] = None
|
|
26
|
+
prev_page_url: typing.Optional[str] = None
|
|
27
|
+
to: typing.Optional[int] = None
|
|
28
|
+
total: typing.Optional[int] = None
|
|
29
|
+
|
|
30
|
+
if IS_PYDANTIC_V2:
|
|
31
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
32
|
+
else:
|
|
33
|
+
|
|
34
|
+
class Config:
|
|
35
|
+
frozen = True
|
|
36
|
+
smart_union = True
|
|
37
|
+
extra = pydantic.Extra.allow
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
|
|
5
|
+
import pydantic
|
|
6
|
+
from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class GetQuoteRequestsResponseLinksItem(UniversalBaseModel):
|
|
10
|
+
url: typing.Optional[str] = None
|
|
11
|
+
label: typing.Optional[str] = None
|
|
12
|
+
active: typing.Optional[bool] = None
|
|
13
|
+
|
|
14
|
+
if IS_PYDANTIC_V2:
|
|
15
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
16
|
+
else:
|
|
17
|
+
|
|
18
|
+
class Config:
|
|
19
|
+
frozen = True
|
|
20
|
+
smart_union = True
|
|
21
|
+
extra = pydantic.Extra.allow
|