dodopayments 1.19.0__py3-none-any.whl → 1.20.0__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 (35) hide show
  1. dodopayments/_client.py +33 -24
  2. dodopayments/_version.py +1 -1
  3. dodopayments/resources/__init__.py +14 -0
  4. dodopayments/resources/addons.py +589 -0
  5. dodopayments/resources/payments.py +4 -301
  6. dodopayments/resources/products/products.py +11 -6
  7. dodopayments/resources/subscriptions.py +20 -307
  8. dodopayments/types/__init__.py +9 -0
  9. dodopayments/types/addon_cart_response_item.py +11 -0
  10. dodopayments/types/addon_create_params.py +30 -0
  11. dodopayments/types/addon_list_params.py +16 -0
  12. dodopayments/types/addon_response.py +44 -0
  13. dodopayments/types/addon_update_images_response.py +11 -0
  14. dodopayments/types/addon_update_params.py +33 -0
  15. dodopayments/types/currency.py +153 -0
  16. dodopayments/types/payment.py +3 -295
  17. dodopayments/types/payment_create_params.py +2 -149
  18. dodopayments/types/payment_list_response.py +2 -148
  19. dodopayments/types/payout_list_response.py +2 -147
  20. dodopayments/types/price.py +3 -294
  21. dodopayments/types/price_param.py +3 -298
  22. dodopayments/types/product.py +2 -2
  23. dodopayments/types/product_create_params.py +3 -2
  24. dodopayments/types/product_list_response.py +4 -151
  25. dodopayments/types/product_update_params.py +3 -2
  26. dodopayments/types/refund.py +2 -150
  27. dodopayments/types/subscription.py +7 -149
  28. dodopayments/types/subscription_create_params.py +13 -151
  29. dodopayments/types/subscription_create_response.py +5 -1
  30. dodopayments/types/subscription_list_response.py +77 -0
  31. dodopayments/types/tax_category.py +7 -0
  32. {dodopayments-1.19.0.dist-info → dodopayments-1.20.0.dist-info}/METADATA +6 -6
  33. {dodopayments-1.19.0.dist-info → dodopayments-1.20.0.dist-info}/RECORD +35 -25
  34. {dodopayments-1.19.0.dist-info → dodopayments-1.20.0.dist-info}/WHEEL +0 -0
  35. {dodopayments-1.19.0.dist-info → dodopayments-1.20.0.dist-info}/licenses/LICENSE +0 -0
dodopayments/_client.py CHANGED
@@ -23,6 +23,7 @@ from ._utils import is_given, get_async_library
23
23
  from ._version import __version__
24
24
  from .resources import (
25
25
  misc,
26
+ addons,
26
27
  payouts,
27
28
  refunds,
28
29
  disputes,
@@ -78,18 +79,19 @@ class DodoPayments(SyncAPIClient):
78
79
  products: products.ProductsResource
79
80
  misc: misc.MiscResource
80
81
  discounts: discounts.DiscountsResource
82
+ addons: addons.AddonsResource
81
83
  with_raw_response: DodoPaymentsWithRawResponse
82
84
  with_streaming_response: DodoPaymentsWithStreamedResponse
83
85
 
84
86
  # client options
85
- bearer_token: str
87
+ api_key: str
86
88
 
87
89
  _environment: Literal["live_mode", "test_mode"] | NotGiven
88
90
 
89
91
  def __init__(
90
92
  self,
91
93
  *,
92
- bearer_token: str | None = None,
94
+ api_key: str | None = None,
93
95
  environment: Literal["live_mode", "test_mode"] | NotGiven = NOT_GIVEN,
94
96
  base_url: str | httpx.URL | None | NotGiven = NOT_GIVEN,
95
97
  timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN,
@@ -112,15 +114,15 @@ class DodoPayments(SyncAPIClient):
112
114
  ) -> None:
113
115
  """Construct a new synchronous DodoPayments client instance.
114
116
 
115
- This automatically infers the `bearer_token` argument from the `DODO_PAYMENTS_API_KEY` environment variable if it is not provided.
117
+ This automatically infers the `api_key` argument from the `DODO_PAYMENTS_API_KEY` environment variable if it is not provided.
116
118
  """
117
- if bearer_token is None:
118
- bearer_token = os.environ.get("DODO_PAYMENTS_API_KEY")
119
- if bearer_token is None:
119
+ if api_key is None:
120
+ api_key = os.environ.get("DODO_PAYMENTS_API_KEY")
121
+ if api_key is None:
120
122
  raise DodoPaymentsError(
121
- "The bearer_token client option must be set either by passing bearer_token to the client or by setting the DODO_PAYMENTS_API_KEY environment variable"
123
+ "The api_key client option must be set either by passing api_key to the client or by setting the DODO_PAYMENTS_API_KEY environment variable"
122
124
  )
123
- self.bearer_token = bearer_token
125
+ self.api_key = api_key
124
126
 
125
127
  self._environment = environment
126
128
 
@@ -173,6 +175,7 @@ class DodoPayments(SyncAPIClient):
173
175
  self.products = products.ProductsResource(self)
174
176
  self.misc = misc.MiscResource(self)
175
177
  self.discounts = discounts.DiscountsResource(self)
178
+ self.addons = addons.AddonsResource(self)
176
179
  self.with_raw_response = DodoPaymentsWithRawResponse(self)
177
180
  self.with_streaming_response = DodoPaymentsWithStreamedResponse(self)
178
181
 
@@ -184,8 +187,8 @@ class DodoPayments(SyncAPIClient):
184
187
  @property
185
188
  @override
186
189
  def auth_headers(self) -> dict[str, str]:
187
- bearer_token = self.bearer_token
188
- return {"Authorization": f"Bearer {bearer_token}"}
190
+ api_key = self.api_key
191
+ return {"Authorization": f"Bearer {api_key}"}
189
192
 
190
193
  @property
191
194
  @override
@@ -199,7 +202,7 @@ class DodoPayments(SyncAPIClient):
199
202
  def copy(
200
203
  self,
201
204
  *,
202
- bearer_token: str | None = None,
205
+ api_key: str | None = None,
203
206
  environment: Literal["live_mode", "test_mode"] | None = None,
204
207
  base_url: str | httpx.URL | None = None,
205
208
  timeout: float | Timeout | None | NotGiven = NOT_GIVEN,
@@ -234,7 +237,7 @@ class DodoPayments(SyncAPIClient):
234
237
 
235
238
  http_client = http_client or self._client
236
239
  return self.__class__(
237
- bearer_token=bearer_token or self.bearer_token,
240
+ api_key=api_key or self.api_key,
238
241
  base_url=base_url or self.base_url,
239
242
  environment=environment or self._environment,
240
243
  timeout=self.timeout if isinstance(timeout, NotGiven) else timeout,
@@ -298,18 +301,19 @@ class AsyncDodoPayments(AsyncAPIClient):
298
301
  products: products.AsyncProductsResource
299
302
  misc: misc.AsyncMiscResource
300
303
  discounts: discounts.AsyncDiscountsResource
304
+ addons: addons.AsyncAddonsResource
301
305
  with_raw_response: AsyncDodoPaymentsWithRawResponse
302
306
  with_streaming_response: AsyncDodoPaymentsWithStreamedResponse
303
307
 
304
308
  # client options
305
- bearer_token: str
309
+ api_key: str
306
310
 
307
311
  _environment: Literal["live_mode", "test_mode"] | NotGiven
308
312
 
309
313
  def __init__(
310
314
  self,
311
315
  *,
312
- bearer_token: str | None = None,
316
+ api_key: str | None = None,
313
317
  environment: Literal["live_mode", "test_mode"] | NotGiven = NOT_GIVEN,
314
318
  base_url: str | httpx.URL | None | NotGiven = NOT_GIVEN,
315
319
  timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN,
@@ -332,15 +336,15 @@ class AsyncDodoPayments(AsyncAPIClient):
332
336
  ) -> None:
333
337
  """Construct a new async AsyncDodoPayments client instance.
334
338
 
335
- This automatically infers the `bearer_token` argument from the `DODO_PAYMENTS_API_KEY` environment variable if it is not provided.
339
+ This automatically infers the `api_key` argument from the `DODO_PAYMENTS_API_KEY` environment variable if it is not provided.
336
340
  """
337
- if bearer_token is None:
338
- bearer_token = os.environ.get("DODO_PAYMENTS_API_KEY")
339
- if bearer_token is None:
341
+ if api_key is None:
342
+ api_key = os.environ.get("DODO_PAYMENTS_API_KEY")
343
+ if api_key is None:
340
344
  raise DodoPaymentsError(
341
- "The bearer_token client option must be set either by passing bearer_token to the client or by setting the DODO_PAYMENTS_API_KEY environment variable"
345
+ "The api_key client option must be set either by passing api_key to the client or by setting the DODO_PAYMENTS_API_KEY environment variable"
342
346
  )
343
- self.bearer_token = bearer_token
347
+ self.api_key = api_key
344
348
 
345
349
  self._environment = environment
346
350
 
@@ -393,6 +397,7 @@ class AsyncDodoPayments(AsyncAPIClient):
393
397
  self.products = products.AsyncProductsResource(self)
394
398
  self.misc = misc.AsyncMiscResource(self)
395
399
  self.discounts = discounts.AsyncDiscountsResource(self)
400
+ self.addons = addons.AsyncAddonsResource(self)
396
401
  self.with_raw_response = AsyncDodoPaymentsWithRawResponse(self)
397
402
  self.with_streaming_response = AsyncDodoPaymentsWithStreamedResponse(self)
398
403
 
@@ -404,8 +409,8 @@ class AsyncDodoPayments(AsyncAPIClient):
404
409
  @property
405
410
  @override
406
411
  def auth_headers(self) -> dict[str, str]:
407
- bearer_token = self.bearer_token
408
- return {"Authorization": f"Bearer {bearer_token}"}
412
+ api_key = self.api_key
413
+ return {"Authorization": f"Bearer {api_key}"}
409
414
 
410
415
  @property
411
416
  @override
@@ -419,7 +424,7 @@ class AsyncDodoPayments(AsyncAPIClient):
419
424
  def copy(
420
425
  self,
421
426
  *,
422
- bearer_token: str | None = None,
427
+ api_key: str | None = None,
423
428
  environment: Literal["live_mode", "test_mode"] | None = None,
424
429
  base_url: str | httpx.URL | None = None,
425
430
  timeout: float | Timeout | None | NotGiven = NOT_GIVEN,
@@ -454,7 +459,7 @@ class AsyncDodoPayments(AsyncAPIClient):
454
459
 
455
460
  http_client = http_client or self._client
456
461
  return self.__class__(
457
- bearer_token=bearer_token or self.bearer_token,
462
+ api_key=api_key or self.api_key,
458
463
  base_url=base_url or self.base_url,
459
464
  environment=environment or self._environment,
460
465
  timeout=self.timeout if isinstance(timeout, NotGiven) else timeout,
@@ -521,6 +526,7 @@ class DodoPaymentsWithRawResponse:
521
526
  self.products = products.ProductsResourceWithRawResponse(client.products)
522
527
  self.misc = misc.MiscResourceWithRawResponse(client.misc)
523
528
  self.discounts = discounts.DiscountsResourceWithRawResponse(client.discounts)
529
+ self.addons = addons.AddonsResourceWithRawResponse(client.addons)
524
530
 
525
531
 
526
532
  class AsyncDodoPaymentsWithRawResponse:
@@ -541,6 +547,7 @@ class AsyncDodoPaymentsWithRawResponse:
541
547
  self.products = products.AsyncProductsResourceWithRawResponse(client.products)
542
548
  self.misc = misc.AsyncMiscResourceWithRawResponse(client.misc)
543
549
  self.discounts = discounts.AsyncDiscountsResourceWithRawResponse(client.discounts)
550
+ self.addons = addons.AsyncAddonsResourceWithRawResponse(client.addons)
544
551
 
545
552
 
546
553
  class DodoPaymentsWithStreamedResponse:
@@ -561,6 +568,7 @@ class DodoPaymentsWithStreamedResponse:
561
568
  self.products = products.ProductsResourceWithStreamingResponse(client.products)
562
569
  self.misc = misc.MiscResourceWithStreamingResponse(client.misc)
563
570
  self.discounts = discounts.DiscountsResourceWithStreamingResponse(client.discounts)
571
+ self.addons = addons.AddonsResourceWithStreamingResponse(client.addons)
564
572
 
565
573
 
566
574
  class AsyncDodoPaymentsWithStreamedResponse:
@@ -581,6 +589,7 @@ class AsyncDodoPaymentsWithStreamedResponse:
581
589
  self.products = products.AsyncProductsResourceWithStreamingResponse(client.products)
582
590
  self.misc = misc.AsyncMiscResourceWithStreamingResponse(client.misc)
583
591
  self.discounts = discounts.AsyncDiscountsResourceWithStreamingResponse(client.discounts)
592
+ self.addons = addons.AsyncAddonsResourceWithStreamingResponse(client.addons)
584
593
 
585
594
 
586
595
  Client = DodoPayments
dodopayments/_version.py CHANGED
@@ -1,4 +1,4 @@
1
1
  # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  __title__ = "dodopayments"
4
- __version__ = "1.19.0" # x-release-please-version
4
+ __version__ = "1.20.0" # x-release-please-version
@@ -8,6 +8,14 @@ from .misc import (
8
8
  MiscResourceWithStreamingResponse,
9
9
  AsyncMiscResourceWithStreamingResponse,
10
10
  )
11
+ from .addons import (
12
+ AddonsResource,
13
+ AsyncAddonsResource,
14
+ AddonsResourceWithRawResponse,
15
+ AsyncAddonsResourceWithRawResponse,
16
+ AddonsResourceWithStreamingResponse,
17
+ AsyncAddonsResourceWithStreamingResponse,
18
+ )
11
19
  from .payouts import (
12
20
  PayoutsResource,
13
21
  AsyncPayoutsResource,
@@ -198,4 +206,10 @@ __all__ = [
198
206
  "AsyncDiscountsResourceWithRawResponse",
199
207
  "DiscountsResourceWithStreamingResponse",
200
208
  "AsyncDiscountsResourceWithStreamingResponse",
209
+ "AddonsResource",
210
+ "AsyncAddonsResource",
211
+ "AddonsResourceWithRawResponse",
212
+ "AsyncAddonsResourceWithRawResponse",
213
+ "AddonsResourceWithStreamingResponse",
214
+ "AsyncAddonsResourceWithStreamingResponse",
201
215
  ]