orq-ai-sdk 4.2.0rc49__py3-none-any.whl → 4.2.12__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.
Files changed (103) hide show
  1. orq_ai_sdk/_hooks/globalhook.py +0 -1
  2. orq_ai_sdk/_version.py +3 -3
  3. orq_ai_sdk/audio.py +30 -0
  4. orq_ai_sdk/chat.py +22 -0
  5. orq_ai_sdk/completions.py +438 -0
  6. orq_ai_sdk/contacts.py +43 -886
  7. orq_ai_sdk/deployments.py +61 -0
  8. orq_ai_sdk/edits.py +364 -0
  9. orq_ai_sdk/embeddings.py +344 -0
  10. orq_ai_sdk/generations.py +370 -0
  11. orq_ai_sdk/images.py +28 -0
  12. orq_ai_sdk/models/__init__.py +3839 -424
  13. orq_ai_sdk/models/conversationresponse.py +1 -1
  14. orq_ai_sdk/models/conversationwithmessagesresponse.py +1 -1
  15. orq_ai_sdk/models/createagentrequestop.py +768 -12
  16. orq_ai_sdk/models/createagentresponse.py +68 -2
  17. orq_ai_sdk/models/createchatcompletionop.py +538 -313
  18. orq_ai_sdk/models/createcompletionop.py +2078 -0
  19. orq_ai_sdk/models/createcontactop.py +5 -10
  20. orq_ai_sdk/models/createconversationop.py +1 -1
  21. orq_ai_sdk/models/createconversationresponseop.py +2 -2
  22. orq_ai_sdk/models/createdatasetitemop.py +4 -4
  23. orq_ai_sdk/models/createdatasetop.py +1 -1
  24. orq_ai_sdk/models/createdatasourceop.py +1 -1
  25. orq_ai_sdk/models/createembeddingop.py +579 -0
  26. orq_ai_sdk/models/createevalop.py +14 -14
  27. orq_ai_sdk/models/createidentityop.py +1 -1
  28. orq_ai_sdk/models/createimageeditop.py +715 -0
  29. orq_ai_sdk/models/createimageop.py +228 -82
  30. orq_ai_sdk/models/createimagevariationop.py +706 -0
  31. orq_ai_sdk/models/creatememoryop.py +4 -2
  32. orq_ai_sdk/models/createmoderationop.py +521 -0
  33. orq_ai_sdk/models/createpromptop.py +375 -6
  34. orq_ai_sdk/models/creatererankop.py +608 -0
  35. orq_ai_sdk/models/createresponseop.py +2567 -0
  36. orq_ai_sdk/models/createspeechop.py +466 -0
  37. orq_ai_sdk/models/createtoolop.py +6 -6
  38. orq_ai_sdk/models/createtranscriptionop.py +732 -0
  39. orq_ai_sdk/models/createtranslationop.py +702 -0
  40. orq_ai_sdk/models/deploymentgetconfigop.py +17 -7
  41. orq_ai_sdk/models/deploymentsop.py +1 -0
  42. orq_ai_sdk/models/deploymentstreamop.py +7 -0
  43. orq_ai_sdk/models/filegetop.py +1 -1
  44. orq_ai_sdk/models/filelistop.py +1 -1
  45. orq_ai_sdk/models/fileuploadop.py +1 -1
  46. orq_ai_sdk/models/generateconversationnameop.py +1 -1
  47. orq_ai_sdk/models/getallmemoriesop.py +4 -2
  48. orq_ai_sdk/models/getallpromptsop.py +188 -3
  49. orq_ai_sdk/models/getalltoolsop.py +6 -6
  50. orq_ai_sdk/models/getevalsop.py +17 -17
  51. orq_ai_sdk/models/getonepromptop.py +188 -3
  52. orq_ai_sdk/models/getpromptversionop.py +188 -3
  53. orq_ai_sdk/models/invokedeploymentrequest.py +11 -4
  54. orq_ai_sdk/models/listagentsop.py +372 -0
  55. orq_ai_sdk/models/listdatasetdatapointsop.py +4 -4
  56. orq_ai_sdk/models/listdatasetsop.py +1 -1
  57. orq_ai_sdk/models/listdatasourcesop.py +1 -1
  58. orq_ai_sdk/models/listidentitiesop.py +1 -1
  59. orq_ai_sdk/models/listmodelsop.py +1 -0
  60. orq_ai_sdk/models/listpromptversionsop.py +188 -3
  61. orq_ai_sdk/models/partdoneevent.py +1 -1
  62. orq_ai_sdk/models/post_v2_router_ocrop.py +408 -0
  63. orq_ai_sdk/models/publiccontact.py +9 -3
  64. orq_ai_sdk/models/publicidentity.py +62 -0
  65. orq_ai_sdk/models/reasoningpart.py +1 -1
  66. orq_ai_sdk/models/responsedoneevent.py +14 -11
  67. orq_ai_sdk/models/retrieveagentrequestop.py +382 -0
  68. orq_ai_sdk/models/retrievedatapointop.py +4 -4
  69. orq_ai_sdk/models/retrievedatasetop.py +1 -1
  70. orq_ai_sdk/models/retrievedatasourceop.py +1 -1
  71. orq_ai_sdk/models/retrieveidentityop.py +1 -1
  72. orq_ai_sdk/models/retrievememoryop.py +4 -2
  73. orq_ai_sdk/models/retrievetoolop.py +6 -6
  74. orq_ai_sdk/models/runagentop.py +379 -9
  75. orq_ai_sdk/models/streamrunagentop.py +385 -9
  76. orq_ai_sdk/models/updateagentop.py +770 -12
  77. orq_ai_sdk/models/updateconversationop.py +1 -1
  78. orq_ai_sdk/models/updatedatapointop.py +4 -4
  79. orq_ai_sdk/models/updatedatasetop.py +1 -1
  80. orq_ai_sdk/models/updatedatasourceop.py +1 -1
  81. orq_ai_sdk/models/updateevalop.py +14 -14
  82. orq_ai_sdk/models/updateidentityop.py +1 -1
  83. orq_ai_sdk/models/updatememoryop.py +4 -2
  84. orq_ai_sdk/models/updatepromptop.py +375 -6
  85. orq_ai_sdk/models/updatetoolop.py +7 -7
  86. orq_ai_sdk/moderations.py +218 -0
  87. orq_ai_sdk/orq_completions.py +666 -0
  88. orq_ai_sdk/orq_responses.py +398 -0
  89. orq_ai_sdk/rerank.py +330 -0
  90. orq_ai_sdk/router.py +89 -641
  91. orq_ai_sdk/speech.py +333 -0
  92. orq_ai_sdk/transcriptions.py +416 -0
  93. orq_ai_sdk/translations.py +384 -0
  94. orq_ai_sdk/variations.py +364 -0
  95. orq_ai_sdk-4.2.12.dist-info/METADATA +888 -0
  96. {orq_ai_sdk-4.2.0rc49.dist-info → orq_ai_sdk-4.2.12.dist-info}/RECORD +98 -75
  97. {orq_ai_sdk-4.2.0rc49.dist-info → orq_ai_sdk-4.2.12.dist-info}/WHEEL +1 -1
  98. orq_ai_sdk/models/deletecontactop.py +0 -44
  99. orq_ai_sdk/models/listcontactsop.py +0 -265
  100. orq_ai_sdk/models/retrievecontactop.py +0 -142
  101. orq_ai_sdk/models/updatecontactop.py +0 -233
  102. orq_ai_sdk-4.2.0rc49.dist-info/METADATA +0 -788
  103. {orq_ai_sdk-4.2.0rc49.dist-info → orq_ai_sdk-4.2.12.dist-info}/top_level.txt +0 -0
orq_ai_sdk/contacts.py CHANGED
@@ -3,641 +3,17 @@
3
3
  from .basesdk import BaseSDK
4
4
  from orq_ai_sdk import models, utils
5
5
  from orq_ai_sdk._hooks import HookContext
6
- from orq_ai_sdk.models import (
7
- createcontactop as models_createcontactop,
8
- listcontactsop as models_listcontactsop,
9
- )
10
- from orq_ai_sdk.types import BaseModel, OptionalNullable, UNSET
6
+ from orq_ai_sdk.types import OptionalNullable, UNSET
11
7
  from orq_ai_sdk.utils import get_security_from_env
12
8
  from orq_ai_sdk.utils.unmarshal_json_response import unmarshal_json_response
13
- from typing import Any, Dict, List, Mapping, Optional, Union, cast
14
- from typing_extensions import deprecated
9
+ from typing import Any, Dict, List, Mapping, Optional
15
10
 
16
11
 
17
12
  class Contacts(BaseSDK):
18
- @deprecated(
19
- "warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
20
- )
21
13
  def create(
22
14
  self,
23
15
  *,
24
- request: Optional[
25
- Union[
26
- models_createcontactop.CreateContactRequestBody,
27
- models_createcontactop.CreateContactRequestBodyTypedDict,
28
- ]
29
- ] = None,
30
- retries: OptionalNullable[utils.RetryConfig] = UNSET,
31
- server_url: Optional[str] = None,
32
- timeout_ms: Optional[int] = None,
33
- http_headers: Optional[Mapping[str, str]] = None,
34
- ) -> models.CreateContactResponseBody:
35
- r"""Create a contact
36
-
37
- Creates a new contact with a unique external_id. If a contact with the same external_id already exists, the operation will fail. Use this endpoint to add users from your system to orq.ai for tracking their usage and engagement.
38
-
39
- :param request: The request object to send.
40
- :param retries: Override the default retry configuration for this method
41
- :param server_url: Override the default server URL for this method
42
- :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
43
- :param http_headers: Additional headers to set or replace on requests.
44
- """
45
- base_url = None
46
- url_variables = None
47
- if timeout_ms is None:
48
- timeout_ms = self.sdk_configuration.timeout_ms
49
-
50
- if timeout_ms is None:
51
- timeout_ms = 600000
52
-
53
- if server_url is not None:
54
- base_url = server_url
55
- else:
56
- base_url = self._get_url(base_url, url_variables)
57
-
58
- if not isinstance(request, BaseModel):
59
- request = utils.unmarshal(
60
- request, Optional[models.CreateContactRequestBody]
61
- )
62
- request = cast(Optional[models.CreateContactRequestBody], request)
63
-
64
- req = self._build_request(
65
- method="POST",
66
- path="/v2/contacts",
67
- base_url=base_url,
68
- url_variables=url_variables,
69
- request=request,
70
- request_body_required=False,
71
- request_has_path_params=False,
72
- request_has_query_params=True,
73
- user_agent_header="user-agent",
74
- accept_header_value="application/json",
75
- http_headers=http_headers,
76
- security=self.sdk_configuration.security,
77
- get_serialized_body=lambda: utils.serialize_request_body(
78
- request, False, True, "json", Optional[models.CreateContactRequestBody]
79
- ),
80
- allow_empty_value=None,
81
- timeout_ms=timeout_ms,
82
- )
83
-
84
- if retries == UNSET:
85
- if self.sdk_configuration.retry_config is not UNSET:
86
- retries = self.sdk_configuration.retry_config
87
-
88
- retry_config = None
89
- if isinstance(retries, utils.RetryConfig):
90
- retry_config = (retries, ["429", "500", "502", "503", "504"])
91
-
92
- http_res = self.do_request(
93
- hook_ctx=HookContext(
94
- config=self.sdk_configuration,
95
- base_url=base_url or "",
96
- operation_id="CreateContact",
97
- oauth2_scopes=None,
98
- security_source=get_security_from_env(
99
- self.sdk_configuration.security, models.Security
100
- ),
101
- ),
102
- request=req,
103
- error_status_codes=["4XX", "5XX"],
104
- retry_config=retry_config,
105
- )
106
-
107
- if utils.match_response(http_res, "201", "application/json"):
108
- return unmarshal_json_response(models.CreateContactResponseBody, http_res)
109
- if utils.match_response(http_res, "4XX", "*"):
110
- http_res_text = utils.stream_to_text(http_res)
111
- raise models.APIError("API error occurred", http_res, http_res_text)
112
- if utils.match_response(http_res, "5XX", "*"):
113
- http_res_text = utils.stream_to_text(http_res)
114
- raise models.APIError("API error occurred", http_res, http_res_text)
115
-
116
- raise models.APIError("Unexpected response received", http_res)
117
-
118
- @deprecated(
119
- "warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
120
- )
121
- async def create_async(
122
- self,
123
- *,
124
- request: Optional[
125
- Union[
126
- models_createcontactop.CreateContactRequestBody,
127
- models_createcontactop.CreateContactRequestBodyTypedDict,
128
- ]
129
- ] = None,
130
- retries: OptionalNullable[utils.RetryConfig] = UNSET,
131
- server_url: Optional[str] = None,
132
- timeout_ms: Optional[int] = None,
133
- http_headers: Optional[Mapping[str, str]] = None,
134
- ) -> models.CreateContactResponseBody:
135
- r"""Create a contact
136
-
137
- Creates a new contact with a unique external_id. If a contact with the same external_id already exists, the operation will fail. Use this endpoint to add users from your system to orq.ai for tracking their usage and engagement.
138
-
139
- :param request: The request object to send.
140
- :param retries: Override the default retry configuration for this method
141
- :param server_url: Override the default server URL for this method
142
- :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
143
- :param http_headers: Additional headers to set or replace on requests.
144
- """
145
- base_url = None
146
- url_variables = None
147
- if timeout_ms is None:
148
- timeout_ms = self.sdk_configuration.timeout_ms
149
-
150
- if timeout_ms is None:
151
- timeout_ms = 600000
152
-
153
- if server_url is not None:
154
- base_url = server_url
155
- else:
156
- base_url = self._get_url(base_url, url_variables)
157
-
158
- if not isinstance(request, BaseModel):
159
- request = utils.unmarshal(
160
- request, Optional[models.CreateContactRequestBody]
161
- )
162
- request = cast(Optional[models.CreateContactRequestBody], request)
163
-
164
- req = self._build_request_async(
165
- method="POST",
166
- path="/v2/contacts",
167
- base_url=base_url,
168
- url_variables=url_variables,
169
- request=request,
170
- request_body_required=False,
171
- request_has_path_params=False,
172
- request_has_query_params=True,
173
- user_agent_header="user-agent",
174
- accept_header_value="application/json",
175
- http_headers=http_headers,
176
- security=self.sdk_configuration.security,
177
- get_serialized_body=lambda: utils.serialize_request_body(
178
- request, False, True, "json", Optional[models.CreateContactRequestBody]
179
- ),
180
- allow_empty_value=None,
181
- timeout_ms=timeout_ms,
182
- )
183
-
184
- if retries == UNSET:
185
- if self.sdk_configuration.retry_config is not UNSET:
186
- retries = self.sdk_configuration.retry_config
187
-
188
- retry_config = None
189
- if isinstance(retries, utils.RetryConfig):
190
- retry_config = (retries, ["429", "500", "502", "503", "504"])
191
-
192
- http_res = await self.do_request_async(
193
- hook_ctx=HookContext(
194
- config=self.sdk_configuration,
195
- base_url=base_url or "",
196
- operation_id="CreateContact",
197
- oauth2_scopes=None,
198
- security_source=get_security_from_env(
199
- self.sdk_configuration.security, models.Security
200
- ),
201
- ),
202
- request=req,
203
- error_status_codes=["4XX", "5XX"],
204
- retry_config=retry_config,
205
- )
206
-
207
- if utils.match_response(http_res, "201", "application/json"):
208
- return unmarshal_json_response(models.CreateContactResponseBody, http_res)
209
- if utils.match_response(http_res, "4XX", "*"):
210
- http_res_text = await utils.stream_to_text_async(http_res)
211
- raise models.APIError("API error occurred", http_res, http_res_text)
212
- if utils.match_response(http_res, "5XX", "*"):
213
- http_res_text = await utils.stream_to_text_async(http_res)
214
- raise models.APIError("API error occurred", http_res, http_res_text)
215
-
216
- raise models.APIError("Unexpected response received", http_res)
217
-
218
- @deprecated(
219
- "warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
220
- )
221
- def list(
222
- self,
223
- *,
224
- limit: Optional[float] = 10,
225
- starting_after: Optional[str] = None,
226
- ending_before: Optional[str] = None,
227
- search: Optional[str] = None,
228
- filter_by: Optional[
229
- Union[
230
- models_listcontactsop.ListContactsQueryParamFilterBy,
231
- models_listcontactsop.ListContactsQueryParamFilterByTypedDict,
232
- ]
233
- ] = None,
234
- include_metrics: OptionalNullable[bool] = False,
235
- retries: OptionalNullable[utils.RetryConfig] = UNSET,
236
- server_url: Optional[str] = None,
237
- timeout_ms: Optional[int] = None,
238
- http_headers: Optional[Mapping[str, str]] = None,
239
- ) -> models.ListContactsResponseBody:
240
- r"""List contacts
241
-
242
- Retrieves a paginated list of contacts in your workspace. Use pagination parameters to navigate through large contact lists efficiently.
243
-
244
- :param limit: A limit on the number of objects to be returned. Limit can range between 1 and 50, and the default is 10
245
- :param starting_after: A cursor for use in pagination. `starting_after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 20 objects, ending with `01JJ1HDHN79XAS7A01WB3HYSDB`, your subsequent call can include `after=01JJ1HDHN79XAS7A01WB3HYSDB` in order to fetch the next page of the list.
246
- :param ending_before: A cursor for use in pagination. `ending_before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 20 objects, starting with `01JJ1HDHN79XAS7A01WB3HYSDB`, your subsequent call can include `before=01JJ1HDHN79XAS7A01WB3HYSDB` in order to fetch the previous page of the list.
247
- :param search: Search contacts by display name or email address. Minimum 2 characters required.
248
- :param filter_by: Filter contacts by tags. Can be provided as JSON object {\"tags\": [\"premium\", \"beta-user\"]} or as query format \"tags=premium,beta-user\"
249
- :param include_metrics: Include usage metrics of the last 30 days for each contact.
250
- :param retries: Override the default retry configuration for this method
251
- :param server_url: Override the default server URL for this method
252
- :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
253
- :param http_headers: Additional headers to set or replace on requests.
254
- """
255
- base_url = None
256
- url_variables = None
257
- if timeout_ms is None:
258
- timeout_ms = self.sdk_configuration.timeout_ms
259
-
260
- if timeout_ms is None:
261
- timeout_ms = 600000
262
-
263
- if server_url is not None:
264
- base_url = server_url
265
- else:
266
- base_url = self._get_url(base_url, url_variables)
267
-
268
- request = models.ListContactsRequest(
269
- limit=limit,
270
- starting_after=starting_after,
271
- ending_before=ending_before,
272
- search=search,
273
- filter_by=utils.get_pydantic_model(
274
- filter_by, Optional[models.ListContactsQueryParamFilterBy]
275
- ),
276
- include_metrics=include_metrics,
277
- )
278
-
279
- req = self._build_request(
280
- method="GET",
281
- path="/v2/contacts",
282
- base_url=base_url,
283
- url_variables=url_variables,
284
- request=request,
285
- request_body_required=False,
286
- request_has_path_params=False,
287
- request_has_query_params=True,
288
- user_agent_header="user-agent",
289
- accept_header_value="application/json",
290
- http_headers=http_headers,
291
- security=self.sdk_configuration.security,
292
- allow_empty_value=None,
293
- timeout_ms=timeout_ms,
294
- )
295
-
296
- if retries == UNSET:
297
- if self.sdk_configuration.retry_config is not UNSET:
298
- retries = self.sdk_configuration.retry_config
299
-
300
- retry_config = None
301
- if isinstance(retries, utils.RetryConfig):
302
- retry_config = (retries, ["429", "500", "502", "503", "504"])
303
-
304
- http_res = self.do_request(
305
- hook_ctx=HookContext(
306
- config=self.sdk_configuration,
307
- base_url=base_url or "",
308
- operation_id="ListContacts",
309
- oauth2_scopes=None,
310
- security_source=get_security_from_env(
311
- self.sdk_configuration.security, models.Security
312
- ),
313
- ),
314
- request=req,
315
- error_status_codes=["4XX", "5XX"],
316
- retry_config=retry_config,
317
- )
318
-
319
- if utils.match_response(http_res, "200", "application/json"):
320
- return unmarshal_json_response(models.ListContactsResponseBody, http_res)
321
- if utils.match_response(http_res, "4XX", "*"):
322
- http_res_text = utils.stream_to_text(http_res)
323
- raise models.APIError("API error occurred", http_res, http_res_text)
324
- if utils.match_response(http_res, "5XX", "*"):
325
- http_res_text = utils.stream_to_text(http_res)
326
- raise models.APIError("API error occurred", http_res, http_res_text)
327
-
328
- raise models.APIError("Unexpected response received", http_res)
329
-
330
- @deprecated(
331
- "warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
332
- )
333
- async def list_async(
334
- self,
335
- *,
336
- limit: Optional[float] = 10,
337
- starting_after: Optional[str] = None,
338
- ending_before: Optional[str] = None,
339
- search: Optional[str] = None,
340
- filter_by: Optional[
341
- Union[
342
- models_listcontactsop.ListContactsQueryParamFilterBy,
343
- models_listcontactsop.ListContactsQueryParamFilterByTypedDict,
344
- ]
345
- ] = None,
346
- include_metrics: OptionalNullable[bool] = False,
347
- retries: OptionalNullable[utils.RetryConfig] = UNSET,
348
- server_url: Optional[str] = None,
349
- timeout_ms: Optional[int] = None,
350
- http_headers: Optional[Mapping[str, str]] = None,
351
- ) -> models.ListContactsResponseBody:
352
- r"""List contacts
353
-
354
- Retrieves a paginated list of contacts in your workspace. Use pagination parameters to navigate through large contact lists efficiently.
355
-
356
- :param limit: A limit on the number of objects to be returned. Limit can range between 1 and 50, and the default is 10
357
- :param starting_after: A cursor for use in pagination. `starting_after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 20 objects, ending with `01JJ1HDHN79XAS7A01WB3HYSDB`, your subsequent call can include `after=01JJ1HDHN79XAS7A01WB3HYSDB` in order to fetch the next page of the list.
358
- :param ending_before: A cursor for use in pagination. `ending_before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 20 objects, starting with `01JJ1HDHN79XAS7A01WB3HYSDB`, your subsequent call can include `before=01JJ1HDHN79XAS7A01WB3HYSDB` in order to fetch the previous page of the list.
359
- :param search: Search contacts by display name or email address. Minimum 2 characters required.
360
- :param filter_by: Filter contacts by tags. Can be provided as JSON object {\"tags\": [\"premium\", \"beta-user\"]} or as query format \"tags=premium,beta-user\"
361
- :param include_metrics: Include usage metrics of the last 30 days for each contact.
362
- :param retries: Override the default retry configuration for this method
363
- :param server_url: Override the default server URL for this method
364
- :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
365
- :param http_headers: Additional headers to set or replace on requests.
366
- """
367
- base_url = None
368
- url_variables = None
369
- if timeout_ms is None:
370
- timeout_ms = self.sdk_configuration.timeout_ms
371
-
372
- if timeout_ms is None:
373
- timeout_ms = 600000
374
-
375
- if server_url is not None:
376
- base_url = server_url
377
- else:
378
- base_url = self._get_url(base_url, url_variables)
379
-
380
- request = models.ListContactsRequest(
381
- limit=limit,
382
- starting_after=starting_after,
383
- ending_before=ending_before,
384
- search=search,
385
- filter_by=utils.get_pydantic_model(
386
- filter_by, Optional[models.ListContactsQueryParamFilterBy]
387
- ),
388
- include_metrics=include_metrics,
389
- )
390
-
391
- req = self._build_request_async(
392
- method="GET",
393
- path="/v2/contacts",
394
- base_url=base_url,
395
- url_variables=url_variables,
396
- request=request,
397
- request_body_required=False,
398
- request_has_path_params=False,
399
- request_has_query_params=True,
400
- user_agent_header="user-agent",
401
- accept_header_value="application/json",
402
- http_headers=http_headers,
403
- security=self.sdk_configuration.security,
404
- allow_empty_value=None,
405
- timeout_ms=timeout_ms,
406
- )
407
-
408
- if retries == UNSET:
409
- if self.sdk_configuration.retry_config is not UNSET:
410
- retries = self.sdk_configuration.retry_config
411
-
412
- retry_config = None
413
- if isinstance(retries, utils.RetryConfig):
414
- retry_config = (retries, ["429", "500", "502", "503", "504"])
415
-
416
- http_res = await self.do_request_async(
417
- hook_ctx=HookContext(
418
- config=self.sdk_configuration,
419
- base_url=base_url or "",
420
- operation_id="ListContacts",
421
- oauth2_scopes=None,
422
- security_source=get_security_from_env(
423
- self.sdk_configuration.security, models.Security
424
- ),
425
- ),
426
- request=req,
427
- error_status_codes=["4XX", "5XX"],
428
- retry_config=retry_config,
429
- )
430
-
431
- if utils.match_response(http_res, "200", "application/json"):
432
- return unmarshal_json_response(models.ListContactsResponseBody, http_res)
433
- if utils.match_response(http_res, "4XX", "*"):
434
- http_res_text = await utils.stream_to_text_async(http_res)
435
- raise models.APIError("API error occurred", http_res, http_res_text)
436
- if utils.match_response(http_res, "5XX", "*"):
437
- http_res_text = await utils.stream_to_text_async(http_res)
438
- raise models.APIError("API error occurred", http_res, http_res_text)
439
-
440
- raise models.APIError("Unexpected response received", http_res)
441
-
442
- @deprecated(
443
- "warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
444
- )
445
- def retrieve(
446
- self,
447
- *,
448
- id: str,
449
- retries: OptionalNullable[utils.RetryConfig] = UNSET,
450
- server_url: Optional[str] = None,
451
- timeout_ms: Optional[int] = None,
452
- http_headers: Optional[Mapping[str, str]] = None,
453
- ) -> models.RetrieveContactResponseBody:
454
- r"""Retrieve a contact
455
-
456
- Retrieves detailed information about a specific contact using their contact ID or external ID from your system.
457
-
458
- :param id: Unique contact id or external id
459
- :param retries: Override the default retry configuration for this method
460
- :param server_url: Override the default server URL for this method
461
- :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
462
- :param http_headers: Additional headers to set or replace on requests.
463
- """
464
- base_url = None
465
- url_variables = None
466
- if timeout_ms is None:
467
- timeout_ms = self.sdk_configuration.timeout_ms
468
-
469
- if timeout_ms is None:
470
- timeout_ms = 600000
471
-
472
- if server_url is not None:
473
- base_url = server_url
474
- else:
475
- base_url = self._get_url(base_url, url_variables)
476
-
477
- request = models.RetrieveContactRequest(
478
- id=id,
479
- )
480
-
481
- req = self._build_request(
482
- method="GET",
483
- path="/v2/contacts/{id}",
484
- base_url=base_url,
485
- url_variables=url_variables,
486
- request=request,
487
- request_body_required=False,
488
- request_has_path_params=True,
489
- request_has_query_params=True,
490
- user_agent_header="user-agent",
491
- accept_header_value="application/json",
492
- http_headers=http_headers,
493
- security=self.sdk_configuration.security,
494
- allow_empty_value=None,
495
- timeout_ms=timeout_ms,
496
- )
497
-
498
- if retries == UNSET:
499
- if self.sdk_configuration.retry_config is not UNSET:
500
- retries = self.sdk_configuration.retry_config
501
-
502
- retry_config = None
503
- if isinstance(retries, utils.RetryConfig):
504
- retry_config = (retries, ["429", "500", "502", "503", "504"])
505
-
506
- http_res = self.do_request(
507
- hook_ctx=HookContext(
508
- config=self.sdk_configuration,
509
- base_url=base_url or "",
510
- operation_id="RetrieveContact",
511
- oauth2_scopes=None,
512
- security_source=get_security_from_env(
513
- self.sdk_configuration.security, models.Security
514
- ),
515
- ),
516
- request=req,
517
- error_status_codes=["404", "4XX", "5XX"],
518
- retry_config=retry_config,
519
- )
520
-
521
- response_data: Any = None
522
- if utils.match_response(http_res, "200", "application/json"):
523
- return unmarshal_json_response(models.RetrieveContactResponseBody, http_res)
524
- if utils.match_response(http_res, "404", "application/json"):
525
- response_data = unmarshal_json_response(
526
- models.RetrieveContactContactsResponseBodyData, http_res
527
- )
528
- raise models.RetrieveContactContactsResponseBody(response_data, http_res)
529
- if utils.match_response(http_res, "4XX", "*"):
530
- http_res_text = utils.stream_to_text(http_res)
531
- raise models.APIError("API error occurred", http_res, http_res_text)
532
- if utils.match_response(http_res, "5XX", "*"):
533
- http_res_text = utils.stream_to_text(http_res)
534
- raise models.APIError("API error occurred", http_res, http_res_text)
535
-
536
- raise models.APIError("Unexpected response received", http_res)
537
-
538
- @deprecated(
539
- "warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
540
- )
541
- async def retrieve_async(
542
- self,
543
- *,
544
- id: str,
545
- retries: OptionalNullable[utils.RetryConfig] = UNSET,
546
- server_url: Optional[str] = None,
547
- timeout_ms: Optional[int] = None,
548
- http_headers: Optional[Mapping[str, str]] = None,
549
- ) -> models.RetrieveContactResponseBody:
550
- r"""Retrieve a contact
551
-
552
- Retrieves detailed information about a specific contact using their contact ID or external ID from your system.
553
-
554
- :param id: Unique contact id or external id
555
- :param retries: Override the default retry configuration for this method
556
- :param server_url: Override the default server URL for this method
557
- :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
558
- :param http_headers: Additional headers to set or replace on requests.
559
- """
560
- base_url = None
561
- url_variables = None
562
- if timeout_ms is None:
563
- timeout_ms = self.sdk_configuration.timeout_ms
564
-
565
- if timeout_ms is None:
566
- timeout_ms = 600000
567
-
568
- if server_url is not None:
569
- base_url = server_url
570
- else:
571
- base_url = self._get_url(base_url, url_variables)
572
-
573
- request = models.RetrieveContactRequest(
574
- id=id,
575
- )
576
-
577
- req = self._build_request_async(
578
- method="GET",
579
- path="/v2/contacts/{id}",
580
- base_url=base_url,
581
- url_variables=url_variables,
582
- request=request,
583
- request_body_required=False,
584
- request_has_path_params=True,
585
- request_has_query_params=True,
586
- user_agent_header="user-agent",
587
- accept_header_value="application/json",
588
- http_headers=http_headers,
589
- security=self.sdk_configuration.security,
590
- allow_empty_value=None,
591
- timeout_ms=timeout_ms,
592
- )
593
-
594
- if retries == UNSET:
595
- if self.sdk_configuration.retry_config is not UNSET:
596
- retries = self.sdk_configuration.retry_config
597
-
598
- retry_config = None
599
- if isinstance(retries, utils.RetryConfig):
600
- retry_config = (retries, ["429", "500", "502", "503", "504"])
601
-
602
- http_res = await self.do_request_async(
603
- hook_ctx=HookContext(
604
- config=self.sdk_configuration,
605
- base_url=base_url or "",
606
- operation_id="RetrieveContact",
607
- oauth2_scopes=None,
608
- security_source=get_security_from_env(
609
- self.sdk_configuration.security, models.Security
610
- ),
611
- ),
612
- request=req,
613
- error_status_codes=["404", "4XX", "5XX"],
614
- retry_config=retry_config,
615
- )
616
-
617
- response_data: Any = None
618
- if utils.match_response(http_res, "200", "application/json"):
619
- return unmarshal_json_response(models.RetrieveContactResponseBody, http_res)
620
- if utils.match_response(http_res, "404", "application/json"):
621
- response_data = unmarshal_json_response(
622
- models.RetrieveContactContactsResponseBodyData, http_res
623
- )
624
- raise models.RetrieveContactContactsResponseBody(response_data, http_res)
625
- if utils.match_response(http_res, "4XX", "*"):
626
- http_res_text = await utils.stream_to_text_async(http_res)
627
- raise models.APIError("API error occurred", http_res, http_res_text)
628
- if utils.match_response(http_res, "5XX", "*"):
629
- http_res_text = await utils.stream_to_text_async(http_res)
630
- raise models.APIError("API error occurred", http_res, http_res_text)
631
-
632
- raise models.APIError("Unexpected response received", http_res)
633
-
634
- @deprecated(
635
- "warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
636
- )
637
- def update(
638
- self,
639
- *,
640
- id: str,
16
+ external_id: str,
641
17
  display_name: OptionalNullable[str] = UNSET,
642
18
  email: OptionalNullable[str] = UNSET,
643
19
  avatar_url: OptionalNullable[str] = UNSET,
@@ -647,12 +23,12 @@ class Contacts(BaseSDK):
647
23
  server_url: Optional[str] = None,
648
24
  timeout_ms: Optional[int] = None,
649
25
  http_headers: Optional[Mapping[str, str]] = None,
650
- ) -> models.UpdateContactResponseBody:
651
- r"""Update a contact
26
+ ) -> models.CreateContactResponseBody:
27
+ r"""Update user information
652
28
 
653
- Updates specific fields of an existing contact. Only the fields provided in the request body will be updated.
29
+ Update or add user information to workspace
654
30
 
655
- :param id: Unique contact id or external id
31
+ :param external_id: Unique string value to identify the contact user in the customer's system. This should be the same ID you use in your system to reference this user.
656
32
  :param display_name: Display name or nickname of the contact user. This is typically shown in user interfaces.
657
33
  :param email: Email address of the contact user
658
34
  :param avatar_url: URL linking to the contact user's avatar image
@@ -676,36 +52,30 @@ class Contacts(BaseSDK):
676
52
  else:
677
53
  base_url = self._get_url(base_url, url_variables)
678
54
 
679
- request = models.UpdateContactRequest(
680
- id=id,
681
- request_body=models.UpdateContactRequestBody(
682
- display_name=display_name,
683
- email=email,
684
- avatar_url=avatar_url,
685
- tags=tags,
686
- metadata=metadata,
687
- ),
55
+ request = models.CreateContactRequestBody(
56
+ external_id=external_id,
57
+ display_name=display_name,
58
+ email=email,
59
+ avatar_url=avatar_url,
60
+ tags=tags,
61
+ metadata=metadata,
688
62
  )
689
63
 
690
64
  req = self._build_request(
691
- method="PATCH",
692
- path="/v2/contacts/{id}",
65
+ method="POST",
66
+ path="/v2/contacts",
693
67
  base_url=base_url,
694
68
  url_variables=url_variables,
695
69
  request=request,
696
- request_body_required=False,
697
- request_has_path_params=True,
70
+ request_body_required=True,
71
+ request_has_path_params=False,
698
72
  request_has_query_params=True,
699
73
  user_agent_header="user-agent",
700
74
  accept_header_value="application/json",
701
75
  http_headers=http_headers,
702
76
  security=self.sdk_configuration.security,
703
77
  get_serialized_body=lambda: utils.serialize_request_body(
704
- request.request_body,
705
- False,
706
- True,
707
- "json",
708
- Optional[models.UpdateContactRequestBody],
78
+ request, False, False, "json", models.CreateContactRequestBody
709
79
  ),
710
80
  allow_empty_value=None,
711
81
  timeout_ms=timeout_ms,
@@ -723,25 +93,19 @@ class Contacts(BaseSDK):
723
93
  hook_ctx=HookContext(
724
94
  config=self.sdk_configuration,
725
95
  base_url=base_url or "",
726
- operation_id="UpdateContact",
96
+ operation_id="CreateContact",
727
97
  oauth2_scopes=None,
728
98
  security_source=get_security_from_env(
729
99
  self.sdk_configuration.security, models.Security
730
100
  ),
731
101
  ),
732
102
  request=req,
733
- error_status_codes=["404", "4XX", "5XX"],
103
+ error_status_codes=["4XX", "5XX"],
734
104
  retry_config=retry_config,
735
105
  )
736
106
 
737
- response_data: Any = None
738
107
  if utils.match_response(http_res, "200", "application/json"):
739
- return unmarshal_json_response(models.UpdateContactResponseBody, http_res)
740
- if utils.match_response(http_res, "404", "application/json"):
741
- response_data = unmarshal_json_response(
742
- models.UpdateContactContactsResponseBodyData, http_res
743
- )
744
- raise models.UpdateContactContactsResponseBody(response_data, http_res)
108
+ return unmarshal_json_response(models.CreateContactResponseBody, http_res)
745
109
  if utils.match_response(http_res, "4XX", "*"):
746
110
  http_res_text = utils.stream_to_text(http_res)
747
111
  raise models.APIError("API error occurred", http_res, http_res_text)
@@ -751,13 +115,10 @@ class Contacts(BaseSDK):
751
115
 
752
116
  raise models.APIError("Unexpected response received", http_res)
753
117
 
754
- @deprecated(
755
- "warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
756
- )
757
- async def update_async(
118
+ async def create_async(
758
119
  self,
759
120
  *,
760
- id: str,
121
+ external_id: str,
761
122
  display_name: OptionalNullable[str] = UNSET,
762
123
  email: OptionalNullable[str] = UNSET,
763
124
  avatar_url: OptionalNullable[str] = UNSET,
@@ -767,12 +128,12 @@ class Contacts(BaseSDK):
767
128
  server_url: Optional[str] = None,
768
129
  timeout_ms: Optional[int] = None,
769
130
  http_headers: Optional[Mapping[str, str]] = None,
770
- ) -> models.UpdateContactResponseBody:
771
- r"""Update a contact
131
+ ) -> models.CreateContactResponseBody:
132
+ r"""Update user information
772
133
 
773
- Updates specific fields of an existing contact. Only the fields provided in the request body will be updated.
134
+ Update or add user information to workspace
774
135
 
775
- :param id: Unique contact id or external id
136
+ :param external_id: Unique string value to identify the contact user in the customer's system. This should be the same ID you use in your system to reference this user.
776
137
  :param display_name: Display name or nickname of the contact user. This is typically shown in user interfaces.
777
138
  :param email: Email address of the contact user
778
139
  :param avatar_url: URL linking to the contact user's avatar image
@@ -796,36 +157,30 @@ class Contacts(BaseSDK):
796
157
  else:
797
158
  base_url = self._get_url(base_url, url_variables)
798
159
 
799
- request = models.UpdateContactRequest(
800
- id=id,
801
- request_body=models.UpdateContactRequestBody(
802
- display_name=display_name,
803
- email=email,
804
- avatar_url=avatar_url,
805
- tags=tags,
806
- metadata=metadata,
807
- ),
160
+ request = models.CreateContactRequestBody(
161
+ external_id=external_id,
162
+ display_name=display_name,
163
+ email=email,
164
+ avatar_url=avatar_url,
165
+ tags=tags,
166
+ metadata=metadata,
808
167
  )
809
168
 
810
169
  req = self._build_request_async(
811
- method="PATCH",
812
- path="/v2/contacts/{id}",
170
+ method="POST",
171
+ path="/v2/contacts",
813
172
  base_url=base_url,
814
173
  url_variables=url_variables,
815
174
  request=request,
816
- request_body_required=False,
817
- request_has_path_params=True,
175
+ request_body_required=True,
176
+ request_has_path_params=False,
818
177
  request_has_query_params=True,
819
178
  user_agent_header="user-agent",
820
179
  accept_header_value="application/json",
821
180
  http_headers=http_headers,
822
181
  security=self.sdk_configuration.security,
823
182
  get_serialized_body=lambda: utils.serialize_request_body(
824
- request.request_body,
825
- False,
826
- True,
827
- "json",
828
- Optional[models.UpdateContactRequestBody],
183
+ request, False, False, "json", models.CreateContactRequestBody
829
184
  ),
830
185
  allow_empty_value=None,
831
186
  timeout_ms=timeout_ms,
@@ -843,217 +198,19 @@ class Contacts(BaseSDK):
843
198
  hook_ctx=HookContext(
844
199
  config=self.sdk_configuration,
845
200
  base_url=base_url or "",
846
- operation_id="UpdateContact",
201
+ operation_id="CreateContact",
847
202
  oauth2_scopes=None,
848
203
  security_source=get_security_from_env(
849
204
  self.sdk_configuration.security, models.Security
850
205
  ),
851
206
  ),
852
207
  request=req,
853
- error_status_codes=["404", "4XX", "5XX"],
208
+ error_status_codes=["4XX", "5XX"],
854
209
  retry_config=retry_config,
855
210
  )
856
211
 
857
- response_data: Any = None
858
212
  if utils.match_response(http_res, "200", "application/json"):
859
- return unmarshal_json_response(models.UpdateContactResponseBody, http_res)
860
- if utils.match_response(http_res, "404", "application/json"):
861
- response_data = unmarshal_json_response(
862
- models.UpdateContactContactsResponseBodyData, http_res
863
- )
864
- raise models.UpdateContactContactsResponseBody(response_data, http_res)
865
- if utils.match_response(http_res, "4XX", "*"):
866
- http_res_text = await utils.stream_to_text_async(http_res)
867
- raise models.APIError("API error occurred", http_res, http_res_text)
868
- if utils.match_response(http_res, "5XX", "*"):
869
- http_res_text = await utils.stream_to_text_async(http_res)
870
- raise models.APIError("API error occurred", http_res, http_res_text)
871
-
872
- raise models.APIError("Unexpected response received", http_res)
873
-
874
- @deprecated(
875
- "warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
876
- )
877
- def delete(
878
- self,
879
- *,
880
- id: str,
881
- retries: OptionalNullable[utils.RetryConfig] = UNSET,
882
- server_url: Optional[str] = None,
883
- timeout_ms: Optional[int] = None,
884
- http_headers: Optional[Mapping[str, str]] = None,
885
- ):
886
- r"""Delete a contact
887
-
888
- Permanently deletes a contact from your workspace and cleans up associated budget configurations. This action cannot be undone.
889
-
890
- :param id: Contact ID or External ID
891
- :param retries: Override the default retry configuration for this method
892
- :param server_url: Override the default server URL for this method
893
- :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
894
- :param http_headers: Additional headers to set or replace on requests.
895
- """
896
- base_url = None
897
- url_variables = None
898
- if timeout_ms is None:
899
- timeout_ms = self.sdk_configuration.timeout_ms
900
-
901
- if timeout_ms is None:
902
- timeout_ms = 600000
903
-
904
- if server_url is not None:
905
- base_url = server_url
906
- else:
907
- base_url = self._get_url(base_url, url_variables)
908
-
909
- request = models.DeleteContactRequest(
910
- id=id,
911
- )
912
-
913
- req = self._build_request(
914
- method="DELETE",
915
- path="/v2/contacts/{id}",
916
- base_url=base_url,
917
- url_variables=url_variables,
918
- request=request,
919
- request_body_required=False,
920
- request_has_path_params=True,
921
- request_has_query_params=True,
922
- user_agent_header="user-agent",
923
- accept_header_value="application/json",
924
- http_headers=http_headers,
925
- security=self.sdk_configuration.security,
926
- allow_empty_value=None,
927
- timeout_ms=timeout_ms,
928
- )
929
-
930
- if retries == UNSET:
931
- if self.sdk_configuration.retry_config is not UNSET:
932
- retries = self.sdk_configuration.retry_config
933
-
934
- retry_config = None
935
- if isinstance(retries, utils.RetryConfig):
936
- retry_config = (retries, ["429", "500", "502", "503", "504"])
937
-
938
- http_res = self.do_request(
939
- hook_ctx=HookContext(
940
- config=self.sdk_configuration,
941
- base_url=base_url or "",
942
- operation_id="DeleteContact",
943
- oauth2_scopes=None,
944
- security_source=get_security_from_env(
945
- self.sdk_configuration.security, models.Security
946
- ),
947
- ),
948
- request=req,
949
- error_status_codes=["404", "4XX", "5XX"],
950
- retry_config=retry_config,
951
- )
952
-
953
- response_data: Any = None
954
- if utils.match_response(http_res, "204", "*"):
955
- return
956
- if utils.match_response(http_res, "404", "application/json"):
957
- response_data = unmarshal_json_response(
958
- models.DeleteContactResponseBodyData, http_res
959
- )
960
- raise models.DeleteContactResponseBody(response_data, http_res)
961
- if utils.match_response(http_res, "4XX", "*"):
962
- http_res_text = utils.stream_to_text(http_res)
963
- raise models.APIError("API error occurred", http_res, http_res_text)
964
- if utils.match_response(http_res, "5XX", "*"):
965
- http_res_text = utils.stream_to_text(http_res)
966
- raise models.APIError("API error occurred", http_res, http_res_text)
967
-
968
- raise models.APIError("Unexpected response received", http_res)
969
-
970
- @deprecated(
971
- "warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
972
- )
973
- async def delete_async(
974
- self,
975
- *,
976
- id: str,
977
- retries: OptionalNullable[utils.RetryConfig] = UNSET,
978
- server_url: Optional[str] = None,
979
- timeout_ms: Optional[int] = None,
980
- http_headers: Optional[Mapping[str, str]] = None,
981
- ):
982
- r"""Delete a contact
983
-
984
- Permanently deletes a contact from your workspace and cleans up associated budget configurations. This action cannot be undone.
985
-
986
- :param id: Contact ID or External ID
987
- :param retries: Override the default retry configuration for this method
988
- :param server_url: Override the default server URL for this method
989
- :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
990
- :param http_headers: Additional headers to set or replace on requests.
991
- """
992
- base_url = None
993
- url_variables = None
994
- if timeout_ms is None:
995
- timeout_ms = self.sdk_configuration.timeout_ms
996
-
997
- if timeout_ms is None:
998
- timeout_ms = 600000
999
-
1000
- if server_url is not None:
1001
- base_url = server_url
1002
- else:
1003
- base_url = self._get_url(base_url, url_variables)
1004
-
1005
- request = models.DeleteContactRequest(
1006
- id=id,
1007
- )
1008
-
1009
- req = self._build_request_async(
1010
- method="DELETE",
1011
- path="/v2/contacts/{id}",
1012
- base_url=base_url,
1013
- url_variables=url_variables,
1014
- request=request,
1015
- request_body_required=False,
1016
- request_has_path_params=True,
1017
- request_has_query_params=True,
1018
- user_agent_header="user-agent",
1019
- accept_header_value="application/json",
1020
- http_headers=http_headers,
1021
- security=self.sdk_configuration.security,
1022
- allow_empty_value=None,
1023
- timeout_ms=timeout_ms,
1024
- )
1025
-
1026
- if retries == UNSET:
1027
- if self.sdk_configuration.retry_config is not UNSET:
1028
- retries = self.sdk_configuration.retry_config
1029
-
1030
- retry_config = None
1031
- if isinstance(retries, utils.RetryConfig):
1032
- retry_config = (retries, ["429", "500", "502", "503", "504"])
1033
-
1034
- http_res = await self.do_request_async(
1035
- hook_ctx=HookContext(
1036
- config=self.sdk_configuration,
1037
- base_url=base_url or "",
1038
- operation_id="DeleteContact",
1039
- oauth2_scopes=None,
1040
- security_source=get_security_from_env(
1041
- self.sdk_configuration.security, models.Security
1042
- ),
1043
- ),
1044
- request=req,
1045
- error_status_codes=["404", "4XX", "5XX"],
1046
- retry_config=retry_config,
1047
- )
1048
-
1049
- response_data: Any = None
1050
- if utils.match_response(http_res, "204", "*"):
1051
- return
1052
- if utils.match_response(http_res, "404", "application/json"):
1053
- response_data = unmarshal_json_response(
1054
- models.DeleteContactResponseBodyData, http_res
1055
- )
1056
- raise models.DeleteContactResponseBody(response_data, http_res)
213
+ return unmarshal_json_response(models.CreateContactResponseBody, http_res)
1057
214
  if utils.match_response(http_res, "4XX", "*"):
1058
215
  http_res_text = await utils.stream_to_text_async(http_res)
1059
216
  raise models.APIError("API error occurred", http_res, http_res_text)