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,493 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
from json.decoder import JSONDecodeError
|
|
5
|
+
|
|
6
|
+
from ..core.api_error import ApiError
|
|
7
|
+
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
8
|
+
from ..core.http_response import AsyncHttpResponse, HttpResponse
|
|
9
|
+
from ..core.jsonable_encoder import encode_path_param
|
|
10
|
+
from ..core.parse_error import ParsingError
|
|
11
|
+
from ..core.pydantic_utilities import parse_obj_as
|
|
12
|
+
from ..core.request_options import RequestOptions
|
|
13
|
+
from ..errors.unauthorized_error import UnauthorizedError
|
|
14
|
+
from ..errors.unprocessable_entity_error import UnprocessableEntityError
|
|
15
|
+
from ..types.policy import Policy
|
|
16
|
+
from pydantic import ValidationError
|
|
17
|
+
|
|
18
|
+
# this is used as the default value for optional parameters
|
|
19
|
+
OMIT = typing.cast(typing.Any, ...)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class RawPoliciesClient:
|
|
23
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
24
|
+
self._client_wrapper = client_wrapper
|
|
25
|
+
|
|
26
|
+
def show_policy(
|
|
27
|
+
self, car_policy: int, *, request_options: typing.Optional[RequestOptions] = None
|
|
28
|
+
) -> HttpResponse[Policy]:
|
|
29
|
+
"""
|
|
30
|
+
Show a specific policy
|
|
31
|
+
|
|
32
|
+
Parameters
|
|
33
|
+
----------
|
|
34
|
+
car_policy : int
|
|
35
|
+
|
|
36
|
+
request_options : typing.Optional[RequestOptions]
|
|
37
|
+
Request-specific configuration.
|
|
38
|
+
|
|
39
|
+
Returns
|
|
40
|
+
-------
|
|
41
|
+
HttpResponse[Policy]
|
|
42
|
+
Success
|
|
43
|
+
"""
|
|
44
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
45
|
+
f"policies/{encode_path_param(car_policy)}",
|
|
46
|
+
method="GET",
|
|
47
|
+
request_options=request_options,
|
|
48
|
+
)
|
|
49
|
+
try:
|
|
50
|
+
if 200 <= _response.status_code < 300:
|
|
51
|
+
_data = typing.cast(
|
|
52
|
+
Policy,
|
|
53
|
+
parse_obj_as(
|
|
54
|
+
type_=Policy, # type: ignore
|
|
55
|
+
object_=_response.json(),
|
|
56
|
+
),
|
|
57
|
+
)
|
|
58
|
+
return HttpResponse(response=_response, data=_data)
|
|
59
|
+
_response_json = _response.json()
|
|
60
|
+
except JSONDecodeError:
|
|
61
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
62
|
+
except ValidationError as e:
|
|
63
|
+
raise ParsingError(
|
|
64
|
+
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
|
|
65
|
+
)
|
|
66
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
67
|
+
|
|
68
|
+
def list_policies(
|
|
69
|
+
self,
|
|
70
|
+
*,
|
|
71
|
+
quote_request_id: typing.Optional[int] = None,
|
|
72
|
+
quote_price_id: typing.Optional[str] = None,
|
|
73
|
+
provider_policy_id: typing.Optional[int] = None,
|
|
74
|
+
car_sequence_number: typing.Optional[str] = None,
|
|
75
|
+
new_owner_id: typing.Optional[str] = None,
|
|
76
|
+
previous_owner_id: typing.Optional[str] = None,
|
|
77
|
+
status: typing.Optional[int] = None,
|
|
78
|
+
min_price: typing.Optional[float] = None,
|
|
79
|
+
max_price: typing.Optional[float] = None,
|
|
80
|
+
per_page: typing.Optional[int] = None,
|
|
81
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
82
|
+
) -> HttpResponse[typing.List[Policy]]:
|
|
83
|
+
"""
|
|
84
|
+
Listing requested policies
|
|
85
|
+
|
|
86
|
+
Parameters
|
|
87
|
+
----------
|
|
88
|
+
quote_request_id : typing.Optional[int]
|
|
89
|
+
|
|
90
|
+
quote_price_id : typing.Optional[str]
|
|
91
|
+
|
|
92
|
+
provider_policy_id : typing.Optional[int]
|
|
93
|
+
|
|
94
|
+
car_sequence_number : typing.Optional[str]
|
|
95
|
+
|
|
96
|
+
new_owner_id : typing.Optional[str]
|
|
97
|
+
|
|
98
|
+
previous_owner_id : typing.Optional[str]
|
|
99
|
+
|
|
100
|
+
status : typing.Optional[int]
|
|
101
|
+
|
|
102
|
+
min_price : typing.Optional[float]
|
|
103
|
+
|
|
104
|
+
max_price : typing.Optional[float]
|
|
105
|
+
|
|
106
|
+
per_page : typing.Optional[int]
|
|
107
|
+
|
|
108
|
+
request_options : typing.Optional[RequestOptions]
|
|
109
|
+
Request-specific configuration.
|
|
110
|
+
|
|
111
|
+
Returns
|
|
112
|
+
-------
|
|
113
|
+
HttpResponse[typing.List[Policy]]
|
|
114
|
+
Success
|
|
115
|
+
"""
|
|
116
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
117
|
+
"policies",
|
|
118
|
+
method="GET",
|
|
119
|
+
params={
|
|
120
|
+
"quote_request_id": quote_request_id,
|
|
121
|
+
"quote_price_id": quote_price_id,
|
|
122
|
+
"provider_policy_id": provider_policy_id,
|
|
123
|
+
"car_sequence_number": car_sequence_number,
|
|
124
|
+
"new_owner_id": new_owner_id,
|
|
125
|
+
"previous_owner_id": previous_owner_id,
|
|
126
|
+
"status": status,
|
|
127
|
+
"min_price": min_price,
|
|
128
|
+
"max_price": max_price,
|
|
129
|
+
"per_page": per_page,
|
|
130
|
+
},
|
|
131
|
+
request_options=request_options,
|
|
132
|
+
)
|
|
133
|
+
try:
|
|
134
|
+
if 200 <= _response.status_code < 300:
|
|
135
|
+
_data = typing.cast(
|
|
136
|
+
typing.List[Policy],
|
|
137
|
+
parse_obj_as(
|
|
138
|
+
type_=typing.List[Policy], # type: ignore
|
|
139
|
+
object_=_response.json(),
|
|
140
|
+
),
|
|
141
|
+
)
|
|
142
|
+
return HttpResponse(response=_response, data=_data)
|
|
143
|
+
if _response.status_code == 401:
|
|
144
|
+
raise UnauthorizedError(
|
|
145
|
+
headers=dict(_response.headers),
|
|
146
|
+
body=typing.cast(
|
|
147
|
+
typing.Any,
|
|
148
|
+
parse_obj_as(
|
|
149
|
+
type_=typing.Any, # type: ignore
|
|
150
|
+
object_=_response.json(),
|
|
151
|
+
),
|
|
152
|
+
),
|
|
153
|
+
)
|
|
154
|
+
_response_json = _response.json()
|
|
155
|
+
except JSONDecodeError:
|
|
156
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
157
|
+
except ValidationError as e:
|
|
158
|
+
raise ParsingError(
|
|
159
|
+
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
|
|
160
|
+
)
|
|
161
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
162
|
+
|
|
163
|
+
def issue_policy(
|
|
164
|
+
self,
|
|
165
|
+
*,
|
|
166
|
+
quote_request_id: int,
|
|
167
|
+
quote_reference_id: str,
|
|
168
|
+
quote_price_id: str,
|
|
169
|
+
benefits: typing.Optional[typing.Sequence[str]] = OMIT,
|
|
170
|
+
extra_fields: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
|
|
171
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
172
|
+
) -> HttpResponse[Policy]:
|
|
173
|
+
"""
|
|
174
|
+
For issuing a new policy
|
|
175
|
+
|
|
176
|
+
Parameters
|
|
177
|
+
----------
|
|
178
|
+
quote_request_id : int
|
|
179
|
+
ID of the car quote request
|
|
180
|
+
|
|
181
|
+
quote_reference_id : str
|
|
182
|
+
Unique identifier for the quote reference ID (coming from POST /quote-requests)
|
|
183
|
+
|
|
184
|
+
quote_price_id : str
|
|
185
|
+
Unique identifier for the quote price ID that exists inside a quote item (coming from POST /quote-requests)
|
|
186
|
+
|
|
187
|
+
benefits : typing.Optional[typing.Sequence[str]]
|
|
188
|
+
List of benefit UUIDs
|
|
189
|
+
|
|
190
|
+
extra_fields : typing.Optional[typing.Dict[str, typing.Any]]
|
|
191
|
+
Optional free-form object with additional fields. Total JSON-encoded size must not exceed 255 characters.
|
|
192
|
+
|
|
193
|
+
request_options : typing.Optional[RequestOptions]
|
|
194
|
+
Request-specific configuration.
|
|
195
|
+
|
|
196
|
+
Returns
|
|
197
|
+
-------
|
|
198
|
+
HttpResponse[Policy]
|
|
199
|
+
Created
|
|
200
|
+
"""
|
|
201
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
202
|
+
"policies",
|
|
203
|
+
method="POST",
|
|
204
|
+
json={
|
|
205
|
+
"quote_request_id": quote_request_id,
|
|
206
|
+
"quote_reference_id": quote_reference_id,
|
|
207
|
+
"quote_price_id": quote_price_id,
|
|
208
|
+
"benefits": benefits,
|
|
209
|
+
"extra_fields": extra_fields,
|
|
210
|
+
},
|
|
211
|
+
headers={
|
|
212
|
+
"content-type": "application/json",
|
|
213
|
+
},
|
|
214
|
+
request_options=request_options,
|
|
215
|
+
omit=OMIT,
|
|
216
|
+
)
|
|
217
|
+
try:
|
|
218
|
+
if 200 <= _response.status_code < 300:
|
|
219
|
+
_data = typing.cast(
|
|
220
|
+
Policy,
|
|
221
|
+
parse_obj_as(
|
|
222
|
+
type_=Policy, # type: ignore
|
|
223
|
+
object_=_response.json(),
|
|
224
|
+
),
|
|
225
|
+
)
|
|
226
|
+
return HttpResponse(response=_response, data=_data)
|
|
227
|
+
if _response.status_code == 401:
|
|
228
|
+
raise UnauthorizedError(
|
|
229
|
+
headers=dict(_response.headers),
|
|
230
|
+
body=typing.cast(
|
|
231
|
+
typing.Any,
|
|
232
|
+
parse_obj_as(
|
|
233
|
+
type_=typing.Any, # type: ignore
|
|
234
|
+
object_=_response.json(),
|
|
235
|
+
),
|
|
236
|
+
),
|
|
237
|
+
)
|
|
238
|
+
if _response.status_code == 422:
|
|
239
|
+
raise UnprocessableEntityError(
|
|
240
|
+
headers=dict(_response.headers),
|
|
241
|
+
body=typing.cast(
|
|
242
|
+
typing.Dict[str, typing.Any],
|
|
243
|
+
parse_obj_as(
|
|
244
|
+
type_=typing.Dict[str, typing.Any], # type: ignore
|
|
245
|
+
object_=_response.json(),
|
|
246
|
+
),
|
|
247
|
+
),
|
|
248
|
+
)
|
|
249
|
+
_response_json = _response.json()
|
|
250
|
+
except JSONDecodeError:
|
|
251
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
252
|
+
except ValidationError as e:
|
|
253
|
+
raise ParsingError(
|
|
254
|
+
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
|
|
255
|
+
)
|
|
256
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
class AsyncRawPoliciesClient:
|
|
260
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
261
|
+
self._client_wrapper = client_wrapper
|
|
262
|
+
|
|
263
|
+
async def show_policy(
|
|
264
|
+
self, car_policy: int, *, request_options: typing.Optional[RequestOptions] = None
|
|
265
|
+
) -> AsyncHttpResponse[Policy]:
|
|
266
|
+
"""
|
|
267
|
+
Show a specific policy
|
|
268
|
+
|
|
269
|
+
Parameters
|
|
270
|
+
----------
|
|
271
|
+
car_policy : int
|
|
272
|
+
|
|
273
|
+
request_options : typing.Optional[RequestOptions]
|
|
274
|
+
Request-specific configuration.
|
|
275
|
+
|
|
276
|
+
Returns
|
|
277
|
+
-------
|
|
278
|
+
AsyncHttpResponse[Policy]
|
|
279
|
+
Success
|
|
280
|
+
"""
|
|
281
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
282
|
+
f"policies/{encode_path_param(car_policy)}",
|
|
283
|
+
method="GET",
|
|
284
|
+
request_options=request_options,
|
|
285
|
+
)
|
|
286
|
+
try:
|
|
287
|
+
if 200 <= _response.status_code < 300:
|
|
288
|
+
_data = typing.cast(
|
|
289
|
+
Policy,
|
|
290
|
+
parse_obj_as(
|
|
291
|
+
type_=Policy, # type: ignore
|
|
292
|
+
object_=_response.json(),
|
|
293
|
+
),
|
|
294
|
+
)
|
|
295
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
296
|
+
_response_json = _response.json()
|
|
297
|
+
except JSONDecodeError:
|
|
298
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
299
|
+
except ValidationError as e:
|
|
300
|
+
raise ParsingError(
|
|
301
|
+
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
|
|
302
|
+
)
|
|
303
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
304
|
+
|
|
305
|
+
async def list_policies(
|
|
306
|
+
self,
|
|
307
|
+
*,
|
|
308
|
+
quote_request_id: typing.Optional[int] = None,
|
|
309
|
+
quote_price_id: typing.Optional[str] = None,
|
|
310
|
+
provider_policy_id: typing.Optional[int] = None,
|
|
311
|
+
car_sequence_number: typing.Optional[str] = None,
|
|
312
|
+
new_owner_id: typing.Optional[str] = None,
|
|
313
|
+
previous_owner_id: typing.Optional[str] = None,
|
|
314
|
+
status: typing.Optional[int] = None,
|
|
315
|
+
min_price: typing.Optional[float] = None,
|
|
316
|
+
max_price: typing.Optional[float] = None,
|
|
317
|
+
per_page: typing.Optional[int] = None,
|
|
318
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
319
|
+
) -> AsyncHttpResponse[typing.List[Policy]]:
|
|
320
|
+
"""
|
|
321
|
+
Listing requested policies
|
|
322
|
+
|
|
323
|
+
Parameters
|
|
324
|
+
----------
|
|
325
|
+
quote_request_id : typing.Optional[int]
|
|
326
|
+
|
|
327
|
+
quote_price_id : typing.Optional[str]
|
|
328
|
+
|
|
329
|
+
provider_policy_id : typing.Optional[int]
|
|
330
|
+
|
|
331
|
+
car_sequence_number : typing.Optional[str]
|
|
332
|
+
|
|
333
|
+
new_owner_id : typing.Optional[str]
|
|
334
|
+
|
|
335
|
+
previous_owner_id : typing.Optional[str]
|
|
336
|
+
|
|
337
|
+
status : typing.Optional[int]
|
|
338
|
+
|
|
339
|
+
min_price : typing.Optional[float]
|
|
340
|
+
|
|
341
|
+
max_price : typing.Optional[float]
|
|
342
|
+
|
|
343
|
+
per_page : typing.Optional[int]
|
|
344
|
+
|
|
345
|
+
request_options : typing.Optional[RequestOptions]
|
|
346
|
+
Request-specific configuration.
|
|
347
|
+
|
|
348
|
+
Returns
|
|
349
|
+
-------
|
|
350
|
+
AsyncHttpResponse[typing.List[Policy]]
|
|
351
|
+
Success
|
|
352
|
+
"""
|
|
353
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
354
|
+
"policies",
|
|
355
|
+
method="GET",
|
|
356
|
+
params={
|
|
357
|
+
"quote_request_id": quote_request_id,
|
|
358
|
+
"quote_price_id": quote_price_id,
|
|
359
|
+
"provider_policy_id": provider_policy_id,
|
|
360
|
+
"car_sequence_number": car_sequence_number,
|
|
361
|
+
"new_owner_id": new_owner_id,
|
|
362
|
+
"previous_owner_id": previous_owner_id,
|
|
363
|
+
"status": status,
|
|
364
|
+
"min_price": min_price,
|
|
365
|
+
"max_price": max_price,
|
|
366
|
+
"per_page": per_page,
|
|
367
|
+
},
|
|
368
|
+
request_options=request_options,
|
|
369
|
+
)
|
|
370
|
+
try:
|
|
371
|
+
if 200 <= _response.status_code < 300:
|
|
372
|
+
_data = typing.cast(
|
|
373
|
+
typing.List[Policy],
|
|
374
|
+
parse_obj_as(
|
|
375
|
+
type_=typing.List[Policy], # type: ignore
|
|
376
|
+
object_=_response.json(),
|
|
377
|
+
),
|
|
378
|
+
)
|
|
379
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
380
|
+
if _response.status_code == 401:
|
|
381
|
+
raise UnauthorizedError(
|
|
382
|
+
headers=dict(_response.headers),
|
|
383
|
+
body=typing.cast(
|
|
384
|
+
typing.Any,
|
|
385
|
+
parse_obj_as(
|
|
386
|
+
type_=typing.Any, # type: ignore
|
|
387
|
+
object_=_response.json(),
|
|
388
|
+
),
|
|
389
|
+
),
|
|
390
|
+
)
|
|
391
|
+
_response_json = _response.json()
|
|
392
|
+
except JSONDecodeError:
|
|
393
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
394
|
+
except ValidationError as e:
|
|
395
|
+
raise ParsingError(
|
|
396
|
+
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
|
|
397
|
+
)
|
|
398
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
399
|
+
|
|
400
|
+
async def issue_policy(
|
|
401
|
+
self,
|
|
402
|
+
*,
|
|
403
|
+
quote_request_id: int,
|
|
404
|
+
quote_reference_id: str,
|
|
405
|
+
quote_price_id: str,
|
|
406
|
+
benefits: typing.Optional[typing.Sequence[str]] = OMIT,
|
|
407
|
+
extra_fields: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
|
|
408
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
409
|
+
) -> AsyncHttpResponse[Policy]:
|
|
410
|
+
"""
|
|
411
|
+
For issuing a new policy
|
|
412
|
+
|
|
413
|
+
Parameters
|
|
414
|
+
----------
|
|
415
|
+
quote_request_id : int
|
|
416
|
+
ID of the car quote request
|
|
417
|
+
|
|
418
|
+
quote_reference_id : str
|
|
419
|
+
Unique identifier for the quote reference ID (coming from POST /quote-requests)
|
|
420
|
+
|
|
421
|
+
quote_price_id : str
|
|
422
|
+
Unique identifier for the quote price ID that exists inside a quote item (coming from POST /quote-requests)
|
|
423
|
+
|
|
424
|
+
benefits : typing.Optional[typing.Sequence[str]]
|
|
425
|
+
List of benefit UUIDs
|
|
426
|
+
|
|
427
|
+
extra_fields : typing.Optional[typing.Dict[str, typing.Any]]
|
|
428
|
+
Optional free-form object with additional fields. Total JSON-encoded size must not exceed 255 characters.
|
|
429
|
+
|
|
430
|
+
request_options : typing.Optional[RequestOptions]
|
|
431
|
+
Request-specific configuration.
|
|
432
|
+
|
|
433
|
+
Returns
|
|
434
|
+
-------
|
|
435
|
+
AsyncHttpResponse[Policy]
|
|
436
|
+
Created
|
|
437
|
+
"""
|
|
438
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
439
|
+
"policies",
|
|
440
|
+
method="POST",
|
|
441
|
+
json={
|
|
442
|
+
"quote_request_id": quote_request_id,
|
|
443
|
+
"quote_reference_id": quote_reference_id,
|
|
444
|
+
"quote_price_id": quote_price_id,
|
|
445
|
+
"benefits": benefits,
|
|
446
|
+
"extra_fields": extra_fields,
|
|
447
|
+
},
|
|
448
|
+
headers={
|
|
449
|
+
"content-type": "application/json",
|
|
450
|
+
},
|
|
451
|
+
request_options=request_options,
|
|
452
|
+
omit=OMIT,
|
|
453
|
+
)
|
|
454
|
+
try:
|
|
455
|
+
if 200 <= _response.status_code < 300:
|
|
456
|
+
_data = typing.cast(
|
|
457
|
+
Policy,
|
|
458
|
+
parse_obj_as(
|
|
459
|
+
type_=Policy, # type: ignore
|
|
460
|
+
object_=_response.json(),
|
|
461
|
+
),
|
|
462
|
+
)
|
|
463
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
464
|
+
if _response.status_code == 401:
|
|
465
|
+
raise UnauthorizedError(
|
|
466
|
+
headers=dict(_response.headers),
|
|
467
|
+
body=typing.cast(
|
|
468
|
+
typing.Any,
|
|
469
|
+
parse_obj_as(
|
|
470
|
+
type_=typing.Any, # type: ignore
|
|
471
|
+
object_=_response.json(),
|
|
472
|
+
),
|
|
473
|
+
),
|
|
474
|
+
)
|
|
475
|
+
if _response.status_code == 422:
|
|
476
|
+
raise UnprocessableEntityError(
|
|
477
|
+
headers=dict(_response.headers),
|
|
478
|
+
body=typing.cast(
|
|
479
|
+
typing.Dict[str, typing.Any],
|
|
480
|
+
parse_obj_as(
|
|
481
|
+
type_=typing.Dict[str, typing.Any], # type: ignore
|
|
482
|
+
object_=_response.json(),
|
|
483
|
+
),
|
|
484
|
+
),
|
|
485
|
+
)
|
|
486
|
+
_response_json = _response.json()
|
|
487
|
+
except JSONDecodeError:
|
|
488
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
489
|
+
except ValidationError as e:
|
|
490
|
+
raise ParsingError(
|
|
491
|
+
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
|
|
492
|
+
)
|
|
493
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
yasminaai/py.typed
ADDED
|
File without changes
|
|
@@ -0,0 +1,49 @@
|
|
|
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 .types import (
|
|
10
|
+
DeleteQuoteRequestsIdResponse,
|
|
11
|
+
GetQuoteRequestsResponse,
|
|
12
|
+
GetQuoteRequestsResponseLinksItem,
|
|
13
|
+
PostQuoteRequestsRequestDriversItem,
|
|
14
|
+
)
|
|
15
|
+
_dynamic_imports: typing.Dict[str, str] = {
|
|
16
|
+
"DeleteQuoteRequestsIdResponse": ".types",
|
|
17
|
+
"GetQuoteRequestsResponse": ".types",
|
|
18
|
+
"GetQuoteRequestsResponseLinksItem": ".types",
|
|
19
|
+
"PostQuoteRequestsRequestDriversItem": ".types",
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def __getattr__(attr_name: str) -> typing.Any:
|
|
24
|
+
module_name = _dynamic_imports.get(attr_name)
|
|
25
|
+
if module_name is None:
|
|
26
|
+
raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}")
|
|
27
|
+
try:
|
|
28
|
+
module = import_module(module_name, __package__)
|
|
29
|
+
if module_name == f".{attr_name}":
|
|
30
|
+
return module
|
|
31
|
+
else:
|
|
32
|
+
return getattr(module, attr_name)
|
|
33
|
+
except ImportError as e:
|
|
34
|
+
raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e
|
|
35
|
+
except AttributeError as e:
|
|
36
|
+
raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def __dir__():
|
|
40
|
+
lazy_attrs = list(_dynamic_imports.keys())
|
|
41
|
+
return sorted(lazy_attrs)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
__all__ = [
|
|
45
|
+
"DeleteQuoteRequestsIdResponse",
|
|
46
|
+
"GetQuoteRequestsResponse",
|
|
47
|
+
"GetQuoteRequestsResponseLinksItem",
|
|
48
|
+
"PostQuoteRequestsRequestDriversItem",
|
|
49
|
+
]
|