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