paid-python 1.0.0a0__py3-none-any.whl → 1.0.0a2__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 (137) hide show
  1. paid/__init__.py +61 -122
  2. paid/client.py +16 -22
  3. paid/contacts/client.py +417 -133
  4. paid/contacts/raw_client.py +1048 -118
  5. paid/core/client_wrapper.py +8 -10
  6. paid/customers/__init__.py +0 -3
  7. paid/customers/client.py +394 -1112
  8. paid/customers/raw_client.py +656 -1054
  9. paid/environment.py +1 -1
  10. paid/errors/bad_request_error.py +2 -2
  11. paid/errors/forbidden_error.py +2 -2
  12. paid/errors/internal_server_error.py +2 -2
  13. paid/errors/not_found_error.py +2 -2
  14. paid/invoices/client.py +369 -0
  15. paid/{plans → invoices}/raw_client.py +312 -201
  16. paid/orders/__init__.py +0 -3
  17. paid/orders/client.py +281 -471
  18. paid/orders/raw_client.py +552 -537
  19. paid/products/__init__.py +0 -3
  20. paid/products/client.py +129 -265
  21. paid/products/raw_client.py +565 -233
  22. paid/signals/client.py +130 -0
  23. paid/signals/raw_client.py +190 -0
  24. paid/tracing/autoinstrumentation.py +12 -6
  25. paid/tracing/context_manager.py +2 -6
  26. paid/tracing/distributed_tracing.py +3 -3
  27. paid/tracing/signal.py +3 -3
  28. paid/tracing/wrappers/openai_agents/openaiAgentsHook.py +1 -1
  29. paid/types/__init__.py +58 -110
  30. paid/types/attribution.py +8 -0
  31. paid/types/{agent_attribute.py → bulk_signals_response.py} +4 -5
  32. paid/types/contact.py +12 -20
  33. paid/types/{address.py → contact_billing_address.py} +6 -7
  34. paid/types/{traces_response.py → contact_list_response.py} +5 -9
  35. paid/types/customer.py +15 -22
  36. paid/types/customer_attribution.py +8 -0
  37. paid/types/customer_billing_address.py +26 -0
  38. paid/types/{usage_summary_order.py → customer_by_external_id.py} +3 -5
  39. paid/types/{usage_summary_order_line.py → customer_by_id.py} +3 -5
  40. paid/types/customer_creation_state.py +5 -0
  41. paid/types/customer_list_response.py +22 -0
  42. paid/types/empty_response.py +17 -0
  43. paid/types/{error.py → error_response.py} +4 -7
  44. paid/types/invoice.py +33 -51
  45. paid/types/invoice_line.py +42 -0
  46. paid/types/invoice_line_payment_status.py +7 -0
  47. paid/types/invoice_lines_response.py +22 -0
  48. paid/types/invoice_list_response.py +22 -0
  49. paid/types/invoice_payment_status.py +5 -0
  50. paid/types/invoice_source.py +5 -0
  51. paid/types/invoice_status.py +3 -1
  52. paid/types/invoice_tax_status.py +7 -0
  53. paid/types/order.py +30 -29
  54. paid/types/order_creation_state.py +5 -0
  55. paid/types/order_line.py +6 -24
  56. paid/types/order_lines_response.py +22 -0
  57. paid/types/order_list_response.py +22 -0
  58. paid/types/pagination.py +24 -0
  59. paid/types/product.py +4 -29
  60. paid/types/{tier.py → product_by_external_id.py} +5 -4
  61. paid/types/{cost_amount.py → product_by_id.py} +5 -12
  62. paid/types/product_list_response.py +22 -0
  63. paid/types/signal.py +8 -34
  64. paid/types/{agent_update.py → update_contact_request.py} +10 -9
  65. paid/types/update_customer_request.py +38 -0
  66. paid/types/{product_update.py → update_product_request.py} +2 -12
  67. {paid_python-1.0.0a0.dist-info → paid_python-1.0.0a2.dist-info}/METADATA +23 -8
  68. paid_python-1.0.0a2.dist-info/RECORD +110 -0
  69. paid/agents/client.py +0 -880
  70. paid/agents/raw_client.py +0 -785
  71. paid/customers/types/__init__.py +0 -8
  72. paid/customers/types/customers_check_entitlement_request_view.py +0 -5
  73. paid/customers/types/customers_check_entitlement_response.py +0 -22
  74. paid/orders/lines/client.py +0 -144
  75. paid/orders/lines/raw_client.py +0 -129
  76. paid/plans/__init__.py +0 -4
  77. paid/plans/client.py +0 -403
  78. paid/products/types/__init__.py +0 -7
  79. paid/products/types/product_create_type.py +0 -5
  80. paid/traces/__init__.py +0 -4
  81. paid/traces/client.py +0 -218
  82. paid/traces/raw_client.py +0 -226
  83. paid/types/agent.py +0 -31
  84. paid/types/agent_price_point.py +0 -27
  85. paid/types/agent_price_point_tiers.py +0 -23
  86. paid/types/api_error.py +0 -29
  87. paid/types/billing_frequency.py +0 -5
  88. paid/types/cancel_renewal_response.py +0 -49
  89. paid/types/charge_type.py +0 -5
  90. paid/types/contact_create_for_customer.py +0 -37
  91. paid/types/cost_trace.py +0 -55
  92. paid/types/cost_traces_response.py +0 -26
  93. paid/types/creation_source.py +0 -5
  94. paid/types/creation_state.py +0 -5
  95. paid/types/customer_update.py +0 -40
  96. paid/types/entitlement_usage.py +0 -48
  97. paid/types/order_line_attribute.py +0 -27
  98. paid/types/order_line_attribute_create_one.py +0 -5
  99. paid/types/order_line_attribute_pricing.py +0 -33
  100. paid/types/order_line_create.py +0 -72
  101. paid/types/pagination_meta.py +0 -84
  102. paid/types/payment_method.py +0 -58
  103. paid/types/payment_method_card.py +0 -49
  104. paid/types/payment_method_type.py +0 -5
  105. paid/types/payment_method_us_bank_account.py +0 -36
  106. paid/types/payment_method_us_bank_account_account_type.py +0 -5
  107. paid/types/plan.py +0 -81
  108. paid/types/plan_group.py +0 -60
  109. paid/types/plan_plan_products_item.py +0 -41
  110. paid/types/plan_plan_products_item_plan_product_attribute_item.py +0 -34
  111. paid/types/plan_with_features.py +0 -69
  112. paid/types/plan_with_features_features_item.py +0 -34
  113. paid/types/price_point.py +0 -25
  114. paid/types/pricing.py +0 -31
  115. paid/types/pricing_model_type.py +0 -7
  116. paid/types/product_type.py +0 -5
  117. paid/types/product_update_type.py +0 -5
  118. paid/types/proration_attribute_update.py +0 -44
  119. paid/types/proration_detail.py +0 -49
  120. paid/types/proration_upgrade_response.py +0 -73
  121. paid/types/salutation.py +0 -5
  122. paid/types/signal_v_2.py +0 -56
  123. paid/types/tax_exempt_status.py +0 -5
  124. paid/types/trace.py +0 -69
  125. paid/types/usage_pagination_meta.py +0 -43
  126. paid/types/usage_summaries_response.py +0 -26
  127. paid/types/usage_summary.py +0 -121
  128. paid/usage/__init__.py +0 -7
  129. paid/usage/client.py +0 -321
  130. paid/usage/raw_client.py +0 -387
  131. paid/usage/types/__init__.py +0 -7
  132. paid/usage/types/usage_check_usage_response.py +0 -53
  133. paid_python-1.0.0a0.dist-info/RECORD +0 -152
  134. /paid/{agents → invoices}/__init__.py +0 -0
  135. /paid/{orders/lines → signals}/__init__.py +0 -0
  136. {paid_python-1.0.0a0.dist-info → paid_python-1.0.0a2.dist-info}/LICENSE +0 -0
  137. {paid_python-1.0.0a0.dist-info → paid_python-1.0.0a2.dist-info}/WHEEL +0 -0
paid/agents/raw_client.py DELETED
@@ -1,785 +0,0 @@
1
- # This file was auto-generated by Fern from our API Definition.
2
-
3
- import typing
4
- from json.decoder import JSONDecodeError
5
-
6
- from ..core.api_error import ApiError
7
- from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
8
- from ..core.http_response import AsyncHttpResponse, HttpResponse
9
- from ..core.jsonable_encoder import jsonable_encoder
10
- from ..core.pydantic_utilities import parse_obj_as
11
- from ..core.request_options import RequestOptions
12
- from ..core.serialization import convert_and_respect_annotation_metadata
13
- from ..types.agent import Agent
14
- from ..types.agent_attribute import AgentAttribute
15
-
16
- # this is used as the default value for optional parameters
17
- OMIT = typing.cast(typing.Any, ...)
18
-
19
-
20
- class RawAgentsClient:
21
- def __init__(self, *, client_wrapper: SyncClientWrapper):
22
- self._client_wrapper = client_wrapper
23
-
24
- def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[typing.List[Agent]]:
25
- """
26
- DEPRECATED: Use /products instead. Agents are now products with type='agent'.
27
-
28
- Parameters
29
- ----------
30
- request_options : typing.Optional[RequestOptions]
31
- Request-specific configuration.
32
-
33
- Returns
34
- -------
35
- HttpResponse[typing.List[Agent]]
36
- Success response
37
- """
38
- _response = self._client_wrapper.httpx_client.request(
39
- "agents",
40
- method="GET",
41
- request_options=request_options,
42
- )
43
- try:
44
- if 200 <= _response.status_code < 300:
45
- _data = typing.cast(
46
- typing.List[Agent],
47
- parse_obj_as(
48
- type_=typing.List[Agent], # type: ignore
49
- object_=_response.json(),
50
- ),
51
- )
52
- return HttpResponse(response=_response, data=_data)
53
- _response_json = _response.json()
54
- except JSONDecodeError:
55
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
56
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
57
-
58
- def create(
59
- self,
60
- *,
61
- name: str,
62
- description: str,
63
- agent_code: typing.Optional[str] = OMIT,
64
- external_id: typing.Optional[str] = OMIT,
65
- active: typing.Optional[bool] = OMIT,
66
- request_options: typing.Optional[RequestOptions] = None,
67
- ) -> HttpResponse[Agent]:
68
- """
69
- DEPRECATED: Use POST /products instead.
70
-
71
- Parameters
72
- ----------
73
- name : str
74
-
75
- description : str
76
-
77
- agent_code : typing.Optional[str]
78
-
79
- external_id : typing.Optional[str]
80
-
81
- active : typing.Optional[bool]
82
-
83
- request_options : typing.Optional[RequestOptions]
84
- Request-specific configuration.
85
-
86
- Returns
87
- -------
88
- HttpResponse[Agent]
89
- Success response
90
- """
91
- _response = self._client_wrapper.httpx_client.request(
92
- "agents",
93
- method="POST",
94
- json={
95
- "name": name,
96
- "description": description,
97
- "agentCode": agent_code,
98
- "externalId": external_id,
99
- "active": active,
100
- },
101
- headers={
102
- "content-type": "application/json",
103
- },
104
- request_options=request_options,
105
- omit=OMIT,
106
- )
107
- try:
108
- if 200 <= _response.status_code < 300:
109
- _data = typing.cast(
110
- Agent,
111
- parse_obj_as(
112
- type_=Agent, # type: ignore
113
- object_=_response.json(),
114
- ),
115
- )
116
- return HttpResponse(response=_response, data=_data)
117
- _response_json = _response.json()
118
- except JSONDecodeError:
119
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
120
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
121
-
122
- def get(self, agent_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[Agent]:
123
- """
124
- DEPRECATED: Use GET /products/{productId} instead.
125
-
126
- Parameters
127
- ----------
128
- agent_id : str
129
-
130
- request_options : typing.Optional[RequestOptions]
131
- Request-specific configuration.
132
-
133
- Returns
134
- -------
135
- HttpResponse[Agent]
136
- Success response
137
- """
138
- _response = self._client_wrapper.httpx_client.request(
139
- f"agents/{jsonable_encoder(agent_id)}",
140
- method="GET",
141
- request_options=request_options,
142
- )
143
- try:
144
- if 200 <= _response.status_code < 300:
145
- _data = typing.cast(
146
- Agent,
147
- parse_obj_as(
148
- type_=Agent, # type: ignore
149
- object_=_response.json(),
150
- ),
151
- )
152
- return HttpResponse(response=_response, data=_data)
153
- _response_json = _response.json()
154
- except JSONDecodeError:
155
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
156
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
157
-
158
- def update(
159
- self,
160
- agent_id: str,
161
- *,
162
- name: typing.Optional[str] = OMIT,
163
- description: typing.Optional[str] = OMIT,
164
- external_id: typing.Optional[str] = OMIT,
165
- active: typing.Optional[bool] = OMIT,
166
- agent_code: typing.Optional[str] = OMIT,
167
- agent_attributes: typing.Optional[typing.Sequence[AgentAttribute]] = OMIT,
168
- request_options: typing.Optional[RequestOptions] = None,
169
- ) -> HttpResponse[Agent]:
170
- """
171
- DEPRECATED: Use PUT /products/{productId} instead.
172
-
173
- Parameters
174
- ----------
175
- agent_id : str
176
-
177
- name : typing.Optional[str]
178
-
179
- description : typing.Optional[str]
180
-
181
- external_id : typing.Optional[str]
182
-
183
- active : typing.Optional[bool]
184
-
185
- agent_code : typing.Optional[str]
186
-
187
- agent_attributes : typing.Optional[typing.Sequence[AgentAttribute]]
188
-
189
- request_options : typing.Optional[RequestOptions]
190
- Request-specific configuration.
191
-
192
- Returns
193
- -------
194
- HttpResponse[Agent]
195
- Success response
196
- """
197
- _response = self._client_wrapper.httpx_client.request(
198
- f"agents/{jsonable_encoder(agent_id)}",
199
- method="PUT",
200
- json={
201
- "name": name,
202
- "description": description,
203
- "externalId": external_id,
204
- "active": active,
205
- "agentCode": agent_code,
206
- "agentAttributes": convert_and_respect_annotation_metadata(
207
- object_=agent_attributes, annotation=typing.Sequence[AgentAttribute], direction="write"
208
- ),
209
- },
210
- headers={
211
- "content-type": "application/json",
212
- },
213
- request_options=request_options,
214
- omit=OMIT,
215
- )
216
- try:
217
- if 200 <= _response.status_code < 300:
218
- _data = typing.cast(
219
- Agent,
220
- parse_obj_as(
221
- type_=Agent, # type: ignore
222
- object_=_response.json(),
223
- ),
224
- )
225
- return HttpResponse(response=_response, data=_data)
226
- _response_json = _response.json()
227
- except JSONDecodeError:
228
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
229
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
230
-
231
- def delete(self, agent_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[None]:
232
- """
233
- DEPRECATED: Use DELETE /products/{productId} instead.
234
-
235
- Parameters
236
- ----------
237
- agent_id : str
238
-
239
- request_options : typing.Optional[RequestOptions]
240
- Request-specific configuration.
241
-
242
- Returns
243
- -------
244
- HttpResponse[None]
245
- """
246
- _response = self._client_wrapper.httpx_client.request(
247
- f"agents/{jsonable_encoder(agent_id)}",
248
- method="DELETE",
249
- request_options=request_options,
250
- )
251
- try:
252
- if 200 <= _response.status_code < 300:
253
- return HttpResponse(response=_response, data=None)
254
- _response_json = _response.json()
255
- except JSONDecodeError:
256
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
257
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
258
-
259
- def get_by_external_id(
260
- self, external_id: str, *, request_options: typing.Optional[RequestOptions] = None
261
- ) -> HttpResponse[Agent]:
262
- """
263
- DEPRECATED: Use GET /products/external/{externalId} instead.
264
-
265
- Parameters
266
- ----------
267
- external_id : str
268
-
269
- request_options : typing.Optional[RequestOptions]
270
- Request-specific configuration.
271
-
272
- Returns
273
- -------
274
- HttpResponse[Agent]
275
- Success response
276
- """
277
- _response = self._client_wrapper.httpx_client.request(
278
- f"agents/external/{jsonable_encoder(external_id)}",
279
- method="GET",
280
- request_options=request_options,
281
- )
282
- try:
283
- if 200 <= _response.status_code < 300:
284
- _data = typing.cast(
285
- Agent,
286
- parse_obj_as(
287
- type_=Agent, # type: ignore
288
- object_=_response.json(),
289
- ),
290
- )
291
- return HttpResponse(response=_response, data=_data)
292
- _response_json = _response.json()
293
- except JSONDecodeError:
294
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
295
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
296
-
297
- def update_by_external_id(
298
- self,
299
- external_id_: str,
300
- *,
301
- name: typing.Optional[str] = OMIT,
302
- description: typing.Optional[str] = OMIT,
303
- external_id: typing.Optional[str] = OMIT,
304
- active: typing.Optional[bool] = OMIT,
305
- agent_code: typing.Optional[str] = OMIT,
306
- agent_attributes: typing.Optional[typing.Sequence[AgentAttribute]] = OMIT,
307
- request_options: typing.Optional[RequestOptions] = None,
308
- ) -> HttpResponse[Agent]:
309
- """
310
- DEPRECATED: Use PUT /products/external/{externalId} instead.
311
-
312
- Parameters
313
- ----------
314
- external_id_ : str
315
-
316
- name : typing.Optional[str]
317
-
318
- description : typing.Optional[str]
319
-
320
- external_id : typing.Optional[str]
321
-
322
- active : typing.Optional[bool]
323
-
324
- agent_code : typing.Optional[str]
325
-
326
- agent_attributes : typing.Optional[typing.Sequence[AgentAttribute]]
327
-
328
- request_options : typing.Optional[RequestOptions]
329
- Request-specific configuration.
330
-
331
- Returns
332
- -------
333
- HttpResponse[Agent]
334
- Success response
335
- """
336
- _response = self._client_wrapper.httpx_client.request(
337
- f"agents/external/{jsonable_encoder(external_id_)}",
338
- method="PUT",
339
- json={
340
- "name": name,
341
- "description": description,
342
- "externalId": external_id,
343
- "active": active,
344
- "agentCode": agent_code,
345
- "agentAttributes": convert_and_respect_annotation_metadata(
346
- object_=agent_attributes, annotation=typing.Sequence[AgentAttribute], direction="write"
347
- ),
348
- },
349
- headers={
350
- "content-type": "application/json",
351
- },
352
- request_options=request_options,
353
- omit=OMIT,
354
- )
355
- try:
356
- if 200 <= _response.status_code < 300:
357
- _data = typing.cast(
358
- Agent,
359
- parse_obj_as(
360
- type_=Agent, # type: ignore
361
- object_=_response.json(),
362
- ),
363
- )
364
- return HttpResponse(response=_response, data=_data)
365
- _response_json = _response.json()
366
- except JSONDecodeError:
367
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
368
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
369
-
370
- def delete_by_external_id(
371
- self, external_id: str, *, request_options: typing.Optional[RequestOptions] = None
372
- ) -> HttpResponse[None]:
373
- """
374
- DEPRECATED: Use DELETE /products/external/{externalId} instead.
375
-
376
- Parameters
377
- ----------
378
- external_id : str
379
-
380
- request_options : typing.Optional[RequestOptions]
381
- Request-specific configuration.
382
-
383
- Returns
384
- -------
385
- HttpResponse[None]
386
- """
387
- _response = self._client_wrapper.httpx_client.request(
388
- f"agents/external/{jsonable_encoder(external_id)}",
389
- method="DELETE",
390
- request_options=request_options,
391
- )
392
- try:
393
- if 200 <= _response.status_code < 300:
394
- return HttpResponse(response=_response, data=None)
395
- _response_json = _response.json()
396
- except JSONDecodeError:
397
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
398
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
399
-
400
-
401
- class AsyncRawAgentsClient:
402
- def __init__(self, *, client_wrapper: AsyncClientWrapper):
403
- self._client_wrapper = client_wrapper
404
-
405
- async def list(
406
- self, *, request_options: typing.Optional[RequestOptions] = None
407
- ) -> AsyncHttpResponse[typing.List[Agent]]:
408
- """
409
- DEPRECATED: Use /products instead. Agents are now products with type='agent'.
410
-
411
- Parameters
412
- ----------
413
- request_options : typing.Optional[RequestOptions]
414
- Request-specific configuration.
415
-
416
- Returns
417
- -------
418
- AsyncHttpResponse[typing.List[Agent]]
419
- Success response
420
- """
421
- _response = await self._client_wrapper.httpx_client.request(
422
- "agents",
423
- method="GET",
424
- request_options=request_options,
425
- )
426
- try:
427
- if 200 <= _response.status_code < 300:
428
- _data = typing.cast(
429
- typing.List[Agent],
430
- parse_obj_as(
431
- type_=typing.List[Agent], # type: ignore
432
- object_=_response.json(),
433
- ),
434
- )
435
- return AsyncHttpResponse(response=_response, data=_data)
436
- _response_json = _response.json()
437
- except JSONDecodeError:
438
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
439
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
440
-
441
- async def create(
442
- self,
443
- *,
444
- name: str,
445
- description: str,
446
- agent_code: typing.Optional[str] = OMIT,
447
- external_id: typing.Optional[str] = OMIT,
448
- active: typing.Optional[bool] = OMIT,
449
- request_options: typing.Optional[RequestOptions] = None,
450
- ) -> AsyncHttpResponse[Agent]:
451
- """
452
- DEPRECATED: Use POST /products instead.
453
-
454
- Parameters
455
- ----------
456
- name : str
457
-
458
- description : str
459
-
460
- agent_code : typing.Optional[str]
461
-
462
- external_id : typing.Optional[str]
463
-
464
- active : typing.Optional[bool]
465
-
466
- request_options : typing.Optional[RequestOptions]
467
- Request-specific configuration.
468
-
469
- Returns
470
- -------
471
- AsyncHttpResponse[Agent]
472
- Success response
473
- """
474
- _response = await self._client_wrapper.httpx_client.request(
475
- "agents",
476
- method="POST",
477
- json={
478
- "name": name,
479
- "description": description,
480
- "agentCode": agent_code,
481
- "externalId": external_id,
482
- "active": active,
483
- },
484
- headers={
485
- "content-type": "application/json",
486
- },
487
- request_options=request_options,
488
- omit=OMIT,
489
- )
490
- try:
491
- if 200 <= _response.status_code < 300:
492
- _data = typing.cast(
493
- Agent,
494
- parse_obj_as(
495
- type_=Agent, # type: ignore
496
- object_=_response.json(),
497
- ),
498
- )
499
- return AsyncHttpResponse(response=_response, data=_data)
500
- _response_json = _response.json()
501
- except JSONDecodeError:
502
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
503
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
504
-
505
- async def get(
506
- self, agent_id: str, *, request_options: typing.Optional[RequestOptions] = None
507
- ) -> AsyncHttpResponse[Agent]:
508
- """
509
- DEPRECATED: Use GET /products/{productId} instead.
510
-
511
- Parameters
512
- ----------
513
- agent_id : str
514
-
515
- request_options : typing.Optional[RequestOptions]
516
- Request-specific configuration.
517
-
518
- Returns
519
- -------
520
- AsyncHttpResponse[Agent]
521
- Success response
522
- """
523
- _response = await self._client_wrapper.httpx_client.request(
524
- f"agents/{jsonable_encoder(agent_id)}",
525
- method="GET",
526
- request_options=request_options,
527
- )
528
- try:
529
- if 200 <= _response.status_code < 300:
530
- _data = typing.cast(
531
- Agent,
532
- parse_obj_as(
533
- type_=Agent, # type: ignore
534
- object_=_response.json(),
535
- ),
536
- )
537
- return AsyncHttpResponse(response=_response, data=_data)
538
- _response_json = _response.json()
539
- except JSONDecodeError:
540
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
541
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
542
-
543
- async def update(
544
- self,
545
- agent_id: str,
546
- *,
547
- name: typing.Optional[str] = OMIT,
548
- description: typing.Optional[str] = OMIT,
549
- external_id: typing.Optional[str] = OMIT,
550
- active: typing.Optional[bool] = OMIT,
551
- agent_code: typing.Optional[str] = OMIT,
552
- agent_attributes: typing.Optional[typing.Sequence[AgentAttribute]] = OMIT,
553
- request_options: typing.Optional[RequestOptions] = None,
554
- ) -> AsyncHttpResponse[Agent]:
555
- """
556
- DEPRECATED: Use PUT /products/{productId} instead.
557
-
558
- Parameters
559
- ----------
560
- agent_id : str
561
-
562
- name : typing.Optional[str]
563
-
564
- description : typing.Optional[str]
565
-
566
- external_id : typing.Optional[str]
567
-
568
- active : typing.Optional[bool]
569
-
570
- agent_code : typing.Optional[str]
571
-
572
- agent_attributes : typing.Optional[typing.Sequence[AgentAttribute]]
573
-
574
- request_options : typing.Optional[RequestOptions]
575
- Request-specific configuration.
576
-
577
- Returns
578
- -------
579
- AsyncHttpResponse[Agent]
580
- Success response
581
- """
582
- _response = await self._client_wrapper.httpx_client.request(
583
- f"agents/{jsonable_encoder(agent_id)}",
584
- method="PUT",
585
- json={
586
- "name": name,
587
- "description": description,
588
- "externalId": external_id,
589
- "active": active,
590
- "agentCode": agent_code,
591
- "agentAttributes": convert_and_respect_annotation_metadata(
592
- object_=agent_attributes, annotation=typing.Sequence[AgentAttribute], direction="write"
593
- ),
594
- },
595
- headers={
596
- "content-type": "application/json",
597
- },
598
- request_options=request_options,
599
- omit=OMIT,
600
- )
601
- try:
602
- if 200 <= _response.status_code < 300:
603
- _data = typing.cast(
604
- Agent,
605
- parse_obj_as(
606
- type_=Agent, # type: ignore
607
- object_=_response.json(),
608
- ),
609
- )
610
- return AsyncHttpResponse(response=_response, data=_data)
611
- _response_json = _response.json()
612
- except JSONDecodeError:
613
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
614
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
615
-
616
- async def delete(
617
- self, agent_id: str, *, request_options: typing.Optional[RequestOptions] = None
618
- ) -> AsyncHttpResponse[None]:
619
- """
620
- DEPRECATED: Use DELETE /products/{productId} instead.
621
-
622
- Parameters
623
- ----------
624
- agent_id : str
625
-
626
- request_options : typing.Optional[RequestOptions]
627
- Request-specific configuration.
628
-
629
- Returns
630
- -------
631
- AsyncHttpResponse[None]
632
- """
633
- _response = await self._client_wrapper.httpx_client.request(
634
- f"agents/{jsonable_encoder(agent_id)}",
635
- method="DELETE",
636
- request_options=request_options,
637
- )
638
- try:
639
- if 200 <= _response.status_code < 300:
640
- return AsyncHttpResponse(response=_response, data=None)
641
- _response_json = _response.json()
642
- except JSONDecodeError:
643
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
644
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
645
-
646
- async def get_by_external_id(
647
- self, external_id: str, *, request_options: typing.Optional[RequestOptions] = None
648
- ) -> AsyncHttpResponse[Agent]:
649
- """
650
- DEPRECATED: Use GET /products/external/{externalId} instead.
651
-
652
- Parameters
653
- ----------
654
- external_id : str
655
-
656
- request_options : typing.Optional[RequestOptions]
657
- Request-specific configuration.
658
-
659
- Returns
660
- -------
661
- AsyncHttpResponse[Agent]
662
- Success response
663
- """
664
- _response = await self._client_wrapper.httpx_client.request(
665
- f"agents/external/{jsonable_encoder(external_id)}",
666
- method="GET",
667
- request_options=request_options,
668
- )
669
- try:
670
- if 200 <= _response.status_code < 300:
671
- _data = typing.cast(
672
- Agent,
673
- parse_obj_as(
674
- type_=Agent, # type: ignore
675
- object_=_response.json(),
676
- ),
677
- )
678
- return AsyncHttpResponse(response=_response, data=_data)
679
- _response_json = _response.json()
680
- except JSONDecodeError:
681
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
682
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
683
-
684
- async def update_by_external_id(
685
- self,
686
- external_id_: str,
687
- *,
688
- name: typing.Optional[str] = OMIT,
689
- description: typing.Optional[str] = OMIT,
690
- external_id: typing.Optional[str] = OMIT,
691
- active: typing.Optional[bool] = OMIT,
692
- agent_code: typing.Optional[str] = OMIT,
693
- agent_attributes: typing.Optional[typing.Sequence[AgentAttribute]] = OMIT,
694
- request_options: typing.Optional[RequestOptions] = None,
695
- ) -> AsyncHttpResponse[Agent]:
696
- """
697
- DEPRECATED: Use PUT /products/external/{externalId} instead.
698
-
699
- Parameters
700
- ----------
701
- external_id_ : str
702
-
703
- name : typing.Optional[str]
704
-
705
- description : typing.Optional[str]
706
-
707
- external_id : typing.Optional[str]
708
-
709
- active : typing.Optional[bool]
710
-
711
- agent_code : typing.Optional[str]
712
-
713
- agent_attributes : typing.Optional[typing.Sequence[AgentAttribute]]
714
-
715
- request_options : typing.Optional[RequestOptions]
716
- Request-specific configuration.
717
-
718
- Returns
719
- -------
720
- AsyncHttpResponse[Agent]
721
- Success response
722
- """
723
- _response = await self._client_wrapper.httpx_client.request(
724
- f"agents/external/{jsonable_encoder(external_id_)}",
725
- method="PUT",
726
- json={
727
- "name": name,
728
- "description": description,
729
- "externalId": external_id,
730
- "active": active,
731
- "agentCode": agent_code,
732
- "agentAttributes": convert_and_respect_annotation_metadata(
733
- object_=agent_attributes, annotation=typing.Sequence[AgentAttribute], direction="write"
734
- ),
735
- },
736
- headers={
737
- "content-type": "application/json",
738
- },
739
- request_options=request_options,
740
- omit=OMIT,
741
- )
742
- try:
743
- if 200 <= _response.status_code < 300:
744
- _data = typing.cast(
745
- Agent,
746
- parse_obj_as(
747
- type_=Agent, # type: ignore
748
- object_=_response.json(),
749
- ),
750
- )
751
- return AsyncHttpResponse(response=_response, data=_data)
752
- _response_json = _response.json()
753
- except JSONDecodeError:
754
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
755
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
756
-
757
- async def delete_by_external_id(
758
- self, external_id: str, *, request_options: typing.Optional[RequestOptions] = None
759
- ) -> AsyncHttpResponse[None]:
760
- """
761
- DEPRECATED: Use DELETE /products/external/{externalId} instead.
762
-
763
- Parameters
764
- ----------
765
- external_id : str
766
-
767
- request_options : typing.Optional[RequestOptions]
768
- Request-specific configuration.
769
-
770
- Returns
771
- -------
772
- AsyncHttpResponse[None]
773
- """
774
- _response = await self._client_wrapper.httpx_client.request(
775
- f"agents/external/{jsonable_encoder(external_id)}",
776
- method="DELETE",
777
- request_options=request_options,
778
- )
779
- try:
780
- if 200 <= _response.status_code < 300:
781
- return AsyncHttpResponse(response=_response, data=None)
782
- _response_json = _response.json()
783
- except JSONDecodeError:
784
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
785
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)