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/environment.py CHANGED
@@ -4,4 +4,4 @@ import enum
4
4
 
5
5
 
6
6
  class PaidEnvironment(enum.Enum):
7
- PRODUCTION = "https://api.agentpaid.io/api/v1"
7
+ DEFAULT = "https://api.agentpaid.io/api/v2"
@@ -3,9 +3,9 @@
3
3
  import typing
4
4
 
5
5
  from ..core.api_error import ApiError
6
- from ..types.error import Error
6
+ from ..types.error_response import ErrorResponse
7
7
 
8
8
 
9
9
  class BadRequestError(ApiError):
10
- def __init__(self, body: Error, headers: typing.Optional[typing.Dict[str, str]] = None):
10
+ def __init__(self, body: ErrorResponse, headers: typing.Optional[typing.Dict[str, str]] = None):
11
11
  super().__init__(status_code=400, headers=headers, body=body)
@@ -3,9 +3,9 @@
3
3
  import typing
4
4
 
5
5
  from ..core.api_error import ApiError
6
- from ..types.error import Error
6
+ from ..types.error_response import ErrorResponse
7
7
 
8
8
 
9
9
  class ForbiddenError(ApiError):
10
- def __init__(self, body: Error, headers: typing.Optional[typing.Dict[str, str]] = None):
10
+ def __init__(self, body: ErrorResponse, headers: typing.Optional[typing.Dict[str, str]] = None):
11
11
  super().__init__(status_code=403, headers=headers, body=body)
@@ -3,9 +3,9 @@
3
3
  import typing
4
4
 
5
5
  from ..core.api_error import ApiError
6
- from ..types.error import Error
6
+ from ..types.error_response import ErrorResponse
7
7
 
8
8
 
9
9
  class InternalServerError(ApiError):
10
- def __init__(self, body: Error, headers: typing.Optional[typing.Dict[str, str]] = None):
10
+ def __init__(self, body: ErrorResponse, headers: typing.Optional[typing.Dict[str, str]] = None):
11
11
  super().__init__(status_code=500, headers=headers, body=body)
@@ -3,9 +3,9 @@
3
3
  import typing
4
4
 
5
5
  from ..core.api_error import ApiError
6
- from ..types.error import Error
6
+ from ..types.error_response import ErrorResponse
7
7
 
8
8
 
9
9
  class NotFoundError(ApiError):
10
- def __init__(self, body: Error, headers: typing.Optional[typing.Dict[str, str]] = None):
10
+ def __init__(self, body: ErrorResponse, headers: typing.Optional[typing.Dict[str, str]] = None):
11
11
  super().__init__(status_code=404, headers=headers, body=body)
@@ -0,0 +1,369 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
6
+ from ..core.request_options import RequestOptions
7
+ from ..types.invoice import Invoice
8
+ from ..types.invoice_lines_response import InvoiceLinesResponse
9
+ from ..types.invoice_list_response import InvoiceListResponse
10
+ from .raw_client import AsyncRawInvoicesClient, RawInvoicesClient
11
+
12
+ # this is used as the default value for optional parameters
13
+ OMIT = typing.cast(typing.Any, ...)
14
+
15
+
16
+ class InvoicesClient:
17
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
18
+ self._raw_client = RawInvoicesClient(client_wrapper=client_wrapper)
19
+
20
+ @property
21
+ def with_raw_response(self) -> RawInvoicesClient:
22
+ """
23
+ Retrieves a raw implementation of this client that returns raw responses.
24
+
25
+ Returns
26
+ -------
27
+ RawInvoicesClient
28
+ """
29
+ return self._raw_client
30
+
31
+ def list_invoices(
32
+ self,
33
+ *,
34
+ limit: typing.Optional[int] = None,
35
+ offset: typing.Optional[int] = None,
36
+ request_options: typing.Optional[RequestOptions] = None,
37
+ ) -> InvoiceListResponse:
38
+ """
39
+ Get a list of invoices for the organization
40
+
41
+ Parameters
42
+ ----------
43
+ limit : typing.Optional[int]
44
+
45
+ offset : typing.Optional[int]
46
+
47
+ request_options : typing.Optional[RequestOptions]
48
+ Request-specific configuration.
49
+
50
+ Returns
51
+ -------
52
+ InvoiceListResponse
53
+ 200
54
+
55
+ Examples
56
+ --------
57
+ from paid import Paid
58
+
59
+ client = Paid(
60
+ token="YOUR_TOKEN",
61
+ )
62
+ client.invoices.list_invoices()
63
+ """
64
+ _response = self._raw_client.list_invoices(limit=limit, offset=offset, request_options=request_options)
65
+ return _response.data
66
+
67
+ def get_invoice_by_id(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Invoice:
68
+ """
69
+ Get an invoice by ID
70
+
71
+ Parameters
72
+ ----------
73
+ id : str
74
+
75
+ request_options : typing.Optional[RequestOptions]
76
+ Request-specific configuration.
77
+
78
+ Returns
79
+ -------
80
+ Invoice
81
+ 200
82
+
83
+ Examples
84
+ --------
85
+ from paid import Paid
86
+
87
+ client = Paid(
88
+ token="YOUR_TOKEN",
89
+ )
90
+ client.invoices.get_invoice_by_id(
91
+ id="id",
92
+ )
93
+ """
94
+ _response = self._raw_client.get_invoice_by_id(id, request_options=request_options)
95
+ return _response.data
96
+
97
+ def update_invoice_by_id(
98
+ self,
99
+ id: str,
100
+ *,
101
+ metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
102
+ request_options: typing.Optional[RequestOptions] = None,
103
+ ) -> Invoice:
104
+ """
105
+ Update an invoice by ID
106
+
107
+ Parameters
108
+ ----------
109
+ id : str
110
+
111
+ metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
112
+
113
+ request_options : typing.Optional[RequestOptions]
114
+ Request-specific configuration.
115
+
116
+ Returns
117
+ -------
118
+ Invoice
119
+ 200
120
+
121
+ Examples
122
+ --------
123
+ from paid import Paid
124
+
125
+ client = Paid(
126
+ token="YOUR_TOKEN",
127
+ )
128
+ client.invoices.update_invoice_by_id(
129
+ id="id",
130
+ )
131
+ """
132
+ _response = self._raw_client.update_invoice_by_id(id, metadata=metadata, request_options=request_options)
133
+ return _response.data
134
+
135
+ def get_invoice_lines(
136
+ self,
137
+ id: str,
138
+ *,
139
+ limit: typing.Optional[int] = None,
140
+ offset: typing.Optional[int] = None,
141
+ request_options: typing.Optional[RequestOptions] = None,
142
+ ) -> InvoiceLinesResponse:
143
+ """
144
+ Get the invoice lines for an invoice by ID
145
+
146
+ Parameters
147
+ ----------
148
+ id : str
149
+
150
+ limit : typing.Optional[int]
151
+
152
+ offset : typing.Optional[int]
153
+
154
+ request_options : typing.Optional[RequestOptions]
155
+ Request-specific configuration.
156
+
157
+ Returns
158
+ -------
159
+ InvoiceLinesResponse
160
+ 200
161
+
162
+ Examples
163
+ --------
164
+ from paid import Paid
165
+
166
+ client = Paid(
167
+ token="YOUR_TOKEN",
168
+ )
169
+ client.invoices.get_invoice_lines(
170
+ id="id",
171
+ )
172
+ """
173
+ _response = self._raw_client.get_invoice_lines(id, limit=limit, offset=offset, request_options=request_options)
174
+ return _response.data
175
+
176
+
177
+ class AsyncInvoicesClient:
178
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
179
+ self._raw_client = AsyncRawInvoicesClient(client_wrapper=client_wrapper)
180
+
181
+ @property
182
+ def with_raw_response(self) -> AsyncRawInvoicesClient:
183
+ """
184
+ Retrieves a raw implementation of this client that returns raw responses.
185
+
186
+ Returns
187
+ -------
188
+ AsyncRawInvoicesClient
189
+ """
190
+ return self._raw_client
191
+
192
+ async def list_invoices(
193
+ self,
194
+ *,
195
+ limit: typing.Optional[int] = None,
196
+ offset: typing.Optional[int] = None,
197
+ request_options: typing.Optional[RequestOptions] = None,
198
+ ) -> InvoiceListResponse:
199
+ """
200
+ Get a list of invoices for the organization
201
+
202
+ Parameters
203
+ ----------
204
+ limit : typing.Optional[int]
205
+
206
+ offset : typing.Optional[int]
207
+
208
+ request_options : typing.Optional[RequestOptions]
209
+ Request-specific configuration.
210
+
211
+ Returns
212
+ -------
213
+ InvoiceListResponse
214
+ 200
215
+
216
+ Examples
217
+ --------
218
+ import asyncio
219
+
220
+ from paid import AsyncPaid
221
+
222
+ client = AsyncPaid(
223
+ token="YOUR_TOKEN",
224
+ )
225
+
226
+
227
+ async def main() -> None:
228
+ await client.invoices.list_invoices()
229
+
230
+
231
+ asyncio.run(main())
232
+ """
233
+ _response = await self._raw_client.list_invoices(limit=limit, offset=offset, request_options=request_options)
234
+ return _response.data
235
+
236
+ async def get_invoice_by_id(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Invoice:
237
+ """
238
+ Get an invoice by ID
239
+
240
+ Parameters
241
+ ----------
242
+ id : str
243
+
244
+ request_options : typing.Optional[RequestOptions]
245
+ Request-specific configuration.
246
+
247
+ Returns
248
+ -------
249
+ Invoice
250
+ 200
251
+
252
+ Examples
253
+ --------
254
+ import asyncio
255
+
256
+ from paid import AsyncPaid
257
+
258
+ client = AsyncPaid(
259
+ token="YOUR_TOKEN",
260
+ )
261
+
262
+
263
+ async def main() -> None:
264
+ await client.invoices.get_invoice_by_id(
265
+ id="id",
266
+ )
267
+
268
+
269
+ asyncio.run(main())
270
+ """
271
+ _response = await self._raw_client.get_invoice_by_id(id, request_options=request_options)
272
+ return _response.data
273
+
274
+ async def update_invoice_by_id(
275
+ self,
276
+ id: str,
277
+ *,
278
+ metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
279
+ request_options: typing.Optional[RequestOptions] = None,
280
+ ) -> Invoice:
281
+ """
282
+ Update an invoice by ID
283
+
284
+ Parameters
285
+ ----------
286
+ id : str
287
+
288
+ metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
289
+
290
+ request_options : typing.Optional[RequestOptions]
291
+ Request-specific configuration.
292
+
293
+ Returns
294
+ -------
295
+ Invoice
296
+ 200
297
+
298
+ Examples
299
+ --------
300
+ import asyncio
301
+
302
+ from paid import AsyncPaid
303
+
304
+ client = AsyncPaid(
305
+ token="YOUR_TOKEN",
306
+ )
307
+
308
+
309
+ async def main() -> None:
310
+ await client.invoices.update_invoice_by_id(
311
+ id="id",
312
+ )
313
+
314
+
315
+ asyncio.run(main())
316
+ """
317
+ _response = await self._raw_client.update_invoice_by_id(id, metadata=metadata, request_options=request_options)
318
+ return _response.data
319
+
320
+ async def get_invoice_lines(
321
+ self,
322
+ id: str,
323
+ *,
324
+ limit: typing.Optional[int] = None,
325
+ offset: typing.Optional[int] = None,
326
+ request_options: typing.Optional[RequestOptions] = None,
327
+ ) -> InvoiceLinesResponse:
328
+ """
329
+ Get the invoice lines for an invoice by ID
330
+
331
+ Parameters
332
+ ----------
333
+ id : str
334
+
335
+ limit : typing.Optional[int]
336
+
337
+ offset : typing.Optional[int]
338
+
339
+ request_options : typing.Optional[RequestOptions]
340
+ Request-specific configuration.
341
+
342
+ Returns
343
+ -------
344
+ InvoiceLinesResponse
345
+ 200
346
+
347
+ Examples
348
+ --------
349
+ import asyncio
350
+
351
+ from paid import AsyncPaid
352
+
353
+ client = AsyncPaid(
354
+ token="YOUR_TOKEN",
355
+ )
356
+
357
+
358
+ async def main() -> None:
359
+ await client.invoices.get_invoice_lines(
360
+ id="id",
361
+ )
362
+
363
+
364
+ asyncio.run(main())
365
+ """
366
+ _response = await self._raw_client.get_invoice_lines(
367
+ id, limit=limit, offset=offset, request_options=request_options
368
+ )
369
+ return _response.data