gmt-python-sdk 0.44.0__py3-none-any.whl → 0.44.1__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 (72) hide show
  1. gmt/__init__.py +0 -2
  2. gmt/_base_client.py +9 -0
  3. gmt/_client.py +0 -2
  4. gmt/_constants.py +0 -2
  5. gmt/_exceptions.py +0 -2
  6. gmt/_operations.py +30 -0
  7. gmt/_resource.py +0 -2
  8. gmt/_version.py +1 -3
  9. gmt/pagination.py +0 -2
  10. gmt/resources/__init__.py +0 -2
  11. gmt/resources/accounts.py +7 -8
  12. gmt/resources/profile/__init__.py +0 -2
  13. gmt/resources/profile/discount.py +3 -4
  14. gmt/resources/profile/profile.py +11 -12
  15. gmt/resources/profile/referral/__init__.py +0 -2
  16. gmt/resources/profile/referral/referral.py +5 -6
  17. gmt/resources/profile/referral/transaction.py +3 -4
  18. gmt/resources/purchases/__init__.py +0 -2
  19. gmt/resources/purchases/bulk.py +36 -8
  20. gmt/resources/purchases/purchases.py +40 -12
  21. gmt/resources/purchases_by_hash.py +5 -6
  22. gmt/resources/service.py +5 -6
  23. gmt/resources/webhooks.py +3 -4
  24. gmt/types/__init__.py +0 -2
  25. gmt/types/account_list_countries_params.py +0 -2
  26. gmt/types/account_list_countries_response.py +0 -2
  27. gmt/types/account_list_params.py +0 -2
  28. gmt/types/account_list_response.py +0 -2
  29. gmt/types/account_retrieve_response.py +0 -2
  30. gmt/types/code_page.py +10 -0
  31. gmt/types/profile/__init__.py +0 -2
  32. gmt/types/profile/discount_retrieve_response.py +0 -2
  33. gmt/types/profile/referral/__init__.py +0 -2
  34. gmt/types/profile/referral/transaction_list_params.py +0 -2
  35. gmt/types/profile/referral/transaction_list_response.py +0 -2
  36. gmt/types/profile/referral_retrieve_response.py +0 -2
  37. gmt/types/profile/referral_transfer_balance_params.py +0 -2
  38. gmt/types/profile/referral_transfer_balance_response.py +0 -2
  39. gmt/types/profile_change_language_params.py +0 -2
  40. gmt/types/profile_change_language_response.py +0 -2
  41. gmt/types/profile_change_login_params.py +0 -2
  42. gmt/types/profile_change_login_response.py +0 -2
  43. gmt/types/profile_change_password_params.py +0 -2
  44. gmt/types/profile_change_password_response.py +0 -2
  45. gmt/types/profile_retrieve_response.py +0 -2
  46. gmt/types/profile_unbind_telegram_response.py +0 -2
  47. gmt/types/purchase_create_params.py +0 -2
  48. gmt/types/purchase_create_response.py +3 -2
  49. gmt/types/purchase_list_params.py +0 -2
  50. gmt/types/purchase_list_response.py +3 -2
  51. gmt/types/purchase_refund_response.py +3 -2
  52. gmt/types/purchase_request_verification_code_params.py +0 -2
  53. gmt/types/purchase_request_verification_code_response.py +3 -2
  54. gmt/types/purchase_retrieve_response.py +3 -2
  55. gmt/types/purchases/__init__.py +0 -2
  56. gmt/types/purchases/bulk_create_params.py +0 -2
  57. gmt/types/purchases/bulk_create_response.py +0 -2
  58. gmt/types/purchases/bulk_retrieve_response.py +1 -2
  59. gmt/types/purchases/list_responses.py +51 -0
  60. gmt/types/purchases_by_hash_request_verification_code_params.py +0 -2
  61. gmt/types/purchases_by_hash_request_verification_code_response.py +3 -2
  62. gmt/types/purchases_by_hash_retrieve_response.py +3 -2
  63. gmt/types/service_get_server_time_response.py +0 -2
  64. gmt/types/service_health_check_response.py +0 -2
  65. gmt/types/telegram/__init__.py +0 -2
  66. gmt/types/webhook_test_params.py +0 -2
  67. gmt/types/webhook_test_response.py +0 -2
  68. {gmt_python_sdk-0.44.0.dist-info → gmt_python_sdk-0.44.1.dist-info}/METADATA +5 -7
  69. gmt_python_sdk-0.44.1.dist-info/RECORD +94 -0
  70. gmt_python_sdk-0.44.0.dist-info/RECORD +0 -91
  71. {gmt_python_sdk-0.44.0.dist-info → gmt_python_sdk-0.44.1.dist-info}/WHEEL +0 -0
  72. {gmt_python_sdk-0.44.0.dist-info → gmt_python_sdk-0.44.1.dist-info}/licenses/LICENSE +0 -0
gmt/__init__.py CHANGED
@@ -1,5 +1,3 @@
1
- # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
-
3
1
  import typing as _t
4
2
 
5
3
  from . import types
gmt/_base_client.py CHANGED
@@ -40,6 +40,7 @@ from httpx import URL
40
40
  from pydantic import PrivateAttr
41
41
 
42
42
  from . import _exceptions
43
+ from ._operations import OPERATIONS
43
44
  from ._qs import Querystring
44
45
  from ._files import to_httpx_files, async_to_httpx_files
45
46
  from ._types import (
@@ -444,6 +445,14 @@ class BaseClient(Generic[_HttpxClientT, _DefaultStreamT]):
444
445
  if idempotency_header and options.idempotency_key and idempotency_header not in headers:
445
446
  headers[idempotency_header] = options.idempotency_key
446
447
 
448
+ if (
449
+ options.method.lower() == "post"
450
+ and options.url in (OPERATIONS["postV1Purchases"], OPERATIONS["postV1PurchasesBulk"])
451
+ and options.idempotency_key
452
+ and not headers.get("Idempotency-Key")
453
+ ):
454
+ headers["Idempotency-Key"] = options.idempotency_key
455
+
447
456
  # Don't set these headers if they were already set or removed by the caller. We check
448
457
  # `custom_headers`, which can contain `Omit()`, instead of `headers` to account for the removal case.
449
458
  lower_custom_headers = [header.lower() for header in custom_headers]
gmt/_client.py CHANGED
@@ -1,5 +1,3 @@
1
- # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
-
3
1
  from __future__ import annotations
4
2
 
5
3
  import os
gmt/_constants.py CHANGED
@@ -1,5 +1,3 @@
1
- # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
-
3
1
  import httpx
4
2
 
5
3
  RAW_RESPONSE_HEADER = "X-Stainless-Raw-Response"
gmt/_exceptions.py CHANGED
@@ -1,5 +1,3 @@
1
- # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
-
3
1
  from __future__ import annotations
4
2
 
5
3
  from typing_extensions import Literal
gmt/_operations.py ADDED
@@ -0,0 +1,30 @@
1
+ # Generated by scripts/sdk/generate.py.
2
+ OPERATIONS = {
3
+ "getV1Accounts": "/v1/accounts/",
4
+ "getV1AccountsByCountry_code": "/v1/accounts/{country_code}",
5
+ "getV1AccountsCountries": "/v1/accounts/countries",
6
+ "getV1Profile": "/v1/profile/",
7
+ "getV1ProfileDiscount": "/v1/profile/discount",
8
+ "getV1ProfileReferral": "/v1/profile/referral",
9
+ "getV1ProfileReferralTransaction": "/v1/profile/referral/transaction",
10
+ "getV1Purchases": "/v1/purchases/",
11
+ "getV1Purchases-by-hashByHash": "/v1/purchases-by-hash/{hash}",
12
+ "getV1PurchasesBulk": "/v1/purchases/bulk",
13
+ "getV1PurchasesBulkByPurchase_id": "/v1/purchases/bulk/{purchase_id}",
14
+ "getV1PurchasesBulkByPurchase_idDownload": "/v1/purchases/bulk/{purchase_id}/download",
15
+ "getV1PurchasesByPurchase_id": "/v1/purchases/{purchase_id}",
16
+ "getV1PurchasesHistory": "/v1/purchases/history",
17
+ "getV1ServiceHealth": "/v1/service/health",
18
+ "getV1ServiceTime": "/v1/service/time",
19
+ "patchV1ProfileChange-login": "/v1/profile/change-login",
20
+ "patchV1ProfileChange-password": "/v1/profile/change-password",
21
+ "patchV1ProfileLanguage": "/v1/profile/language",
22
+ "patchV1ProfileUnbind-telegram": "/v1/profile/unbind-telegram",
23
+ "postV1ProfileReferralTransfer-balance": "/v1/profile/referral/transfer-balance",
24
+ "postV1Purchases": "/v1/purchases/",
25
+ "postV1Purchases-by-hashByHashRequest-code": "/v1/purchases-by-hash/{hash}/request-code",
26
+ "postV1PurchasesBulk": "/v1/purchases/bulk",
27
+ "postV1PurchasesByPurchase_idRefund": "/v1/purchases/{purchase_id}/refund",
28
+ "postV1PurchasesByPurchase_idRequest-code": "/v1/purchases/{purchase_id}/request-code",
29
+ "postV1WebhooksTest": "/v1/webhooks/test",
30
+ }
gmt/_resource.py CHANGED
@@ -1,5 +1,3 @@
1
- # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
-
3
1
  from __future__ import annotations
4
2
 
5
3
  import time
gmt/_version.py CHANGED
@@ -1,4 +1,2 @@
1
- # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
-
3
1
  __title__ = "gmt"
4
- __version__ = "0.44.0" # x-release-please-version
2
+ __version__ = "0.44.1" # x-release-please-version
gmt/pagination.py CHANGED
@@ -1,5 +1,3 @@
1
- # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
-
3
1
  from typing import List, Generic, TypeVar, Optional
4
2
  from typing_extensions import override
5
3
 
gmt/resources/__init__.py CHANGED
@@ -1,5 +1,3 @@
1
- # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
-
3
1
  from .profile import (
4
2
  ProfileResource,
5
3
  AsyncProfileResource,
gmt/resources/accounts.py CHANGED
@@ -1,11 +1,10 @@
1
- # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
-
3
1
  from __future__ import annotations
4
2
 
5
3
  from typing_extensions import Literal
6
4
 
7
5
  import httpx
8
6
 
7
+ from .._operations import OPERATIONS
9
8
  from ..types import account_list_params, account_list_countries_params
10
9
  from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
11
10
  from .._utils import path_template, maybe_transform
@@ -100,7 +99,7 @@ class AccountsResource(SyncAPIResource):
100
99
  if not country_code:
101
100
  raise ValueError(f"Expected a non-empty value for `country_code` but received {country_code!r}")
102
101
  return self._get(
103
- path_template("/v1/accounts/{country_code}", country_code=country_code),
102
+ path_template(OPERATIONS["getV1AccountsByCountry_code"], country_code=country_code),
104
103
  options=make_request_options(
105
104
  extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
106
105
  ),
@@ -158,7 +157,7 @@ class AccountsResource(SyncAPIResource):
158
157
  timeout: Override the client-level default timeout for this request, in seconds
159
158
  """
160
159
  return self._get_api_list(
161
- "/v1/accounts/",
160
+ OPERATIONS["getV1Accounts"],
162
161
  page=SyncPageNumber[AccountListResponse],
163
162
  options=make_request_options(
164
163
  extra_headers=extra_headers,
@@ -227,7 +226,7 @@ class AccountsResource(SyncAPIResource):
227
226
  timeout: Override the client-level default timeout for this request, in seconds
228
227
  """
229
228
  return self._get_api_list(
230
- "/v1/accounts/countries",
229
+ OPERATIONS["getV1AccountsCountries"],
231
230
  page=SyncPageNumber[AccountListCountriesResponse],
232
231
  options=make_request_options(
233
232
  extra_headers=extra_headers,
@@ -322,7 +321,7 @@ class AsyncAccountsResource(AsyncAPIResource):
322
321
  if not country_code:
323
322
  raise ValueError(f"Expected a non-empty value for `country_code` but received {country_code!r}")
324
323
  return await self._get(
325
- path_template("/v1/accounts/{country_code}", country_code=country_code),
324
+ path_template(OPERATIONS["getV1AccountsByCountry_code"], country_code=country_code),
326
325
  options=make_request_options(
327
326
  extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
328
327
  ),
@@ -380,7 +379,7 @@ class AsyncAccountsResource(AsyncAPIResource):
380
379
  timeout: Override the client-level default timeout for this request, in seconds
381
380
  """
382
381
  return self._get_api_list(
383
- "/v1/accounts/",
382
+ OPERATIONS["getV1Accounts"],
384
383
  page=AsyncPageNumber[AccountListResponse],
385
384
  options=make_request_options(
386
385
  extra_headers=extra_headers,
@@ -449,7 +448,7 @@ class AsyncAccountsResource(AsyncAPIResource):
449
448
  timeout: Override the client-level default timeout for this request, in seconds
450
449
  """
451
450
  return self._get_api_list(
452
- "/v1/accounts/countries",
451
+ OPERATIONS["getV1AccountsCountries"],
453
452
  page=AsyncPageNumber[AccountListCountriesResponse],
454
453
  options=make_request_options(
455
454
  extra_headers=extra_headers,
@@ -1,5 +1,3 @@
1
- # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
-
3
1
  from .profile import (
4
2
  ProfileResource,
5
3
  AsyncProfileResource,
@@ -1,9 +1,8 @@
1
- # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
-
3
1
  from __future__ import annotations
4
2
 
5
3
  import httpx
6
4
 
5
+ from ..._operations import OPERATIONS
7
6
  from ..._types import Body, Query, Headers, NotGiven, not_given
8
7
  from ..._compat import cached_property
9
8
  from ..._resource import SyncAPIResource, AsyncAPIResource
@@ -56,7 +55,7 @@ class DiscountResource(SyncAPIResource):
56
55
  history.
57
56
  """
58
57
  return self._get(
59
- "/v1/profile/discount",
58
+ OPERATIONS["getV1ProfileDiscount"],
60
59
  options=make_request_options(
61
60
  extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
62
61
  ),
@@ -101,7 +100,7 @@ class AsyncDiscountResource(AsyncAPIResource):
101
100
  history.
102
101
  """
103
102
  return await self._get(
104
- "/v1/profile/discount",
103
+ OPERATIONS["getV1ProfileDiscount"],
105
104
  options=make_request_options(
106
105
  extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
107
106
  ),
@@ -1,11 +1,10 @@
1
- # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
-
3
1
  from __future__ import annotations
4
2
 
5
3
  from typing_extensions import Literal
6
4
 
7
5
  import httpx
8
6
 
7
+ from ..._operations import OPERATIONS
9
8
  from ...types import profile_change_login_params, profile_change_language_params, profile_change_password_params
10
9
  from ..._types import Body, Query, Headers, NotGiven, not_given
11
10
  from ..._utils import maybe_transform, async_maybe_transform
@@ -90,7 +89,7 @@ class ProfileResource(SyncAPIResource):
90
89
  program levels.
91
90
  """
92
91
  return self._get(
93
- "/v1/profile/",
92
+ OPERATIONS["getV1Profile"],
94
93
  options=make_request_options(
95
94
  extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
96
95
  ),
@@ -123,7 +122,7 @@ class ProfileResource(SyncAPIResource):
123
122
  timeout: Override the client-level default timeout for this request, in seconds
124
123
  """
125
124
  return self._patch(
126
- "/v1/profile/language",
125
+ OPERATIONS["patchV1ProfileLanguage"],
127
126
  body=maybe_transform({"language": language}, profile_change_language_params.ProfileChangeLanguageParams),
128
127
  options=make_request_options(
129
128
  extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
@@ -157,7 +156,7 @@ class ProfileResource(SyncAPIResource):
157
156
  timeout: Override the client-level default timeout for this request, in seconds
158
157
  """
159
158
  return self._patch(
160
- "/v1/profile/change-login",
159
+ OPERATIONS["patchV1ProfileChange-login"],
161
160
  body=maybe_transform({"new_login": new_login}, profile_change_login_params.ProfileChangeLoginParams),
162
161
  options=make_request_options(
163
162
  extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
@@ -192,7 +191,7 @@ class ProfileResource(SyncAPIResource):
192
191
  timeout: Override the client-level default timeout for this request, in seconds
193
192
  """
194
193
  return self._patch(
195
- "/v1/profile/change-password",
194
+ OPERATIONS["patchV1ProfileChange-password"],
196
195
  body=maybe_transform(
197
196
  {"new_password": new_password}, profile_change_password_params.ProfileChangePasswordParams
198
197
  ),
@@ -217,7 +216,7 @@ class ProfileResource(SyncAPIResource):
217
216
  remains on the web account.
218
217
  """
219
218
  return self._patch(
220
- "/v1/profile/unbind-telegram",
219
+ OPERATIONS["patchV1ProfileUnbind-telegram"],
221
220
  options=make_request_options(
222
221
  extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
223
222
  ),
@@ -272,7 +271,7 @@ class AsyncProfileResource(AsyncAPIResource):
272
271
  program levels.
273
272
  """
274
273
  return await self._get(
275
- "/v1/profile/",
274
+ OPERATIONS["getV1Profile"],
276
275
  options=make_request_options(
277
276
  extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
278
277
  ),
@@ -305,7 +304,7 @@ class AsyncProfileResource(AsyncAPIResource):
305
304
  timeout: Override the client-level default timeout for this request, in seconds
306
305
  """
307
306
  return await self._patch(
308
- "/v1/profile/language",
307
+ OPERATIONS["patchV1ProfileLanguage"],
309
308
  body=await async_maybe_transform(
310
309
  {"language": language}, profile_change_language_params.ProfileChangeLanguageParams
311
310
  ),
@@ -341,7 +340,7 @@ class AsyncProfileResource(AsyncAPIResource):
341
340
  timeout: Override the client-level default timeout for this request, in seconds
342
341
  """
343
342
  return await self._patch(
344
- "/v1/profile/change-login",
343
+ OPERATIONS["patchV1ProfileChange-login"],
345
344
  body=await async_maybe_transform(
346
345
  {"new_login": new_login}, profile_change_login_params.ProfileChangeLoginParams
347
346
  ),
@@ -378,7 +377,7 @@ class AsyncProfileResource(AsyncAPIResource):
378
377
  timeout: Override the client-level default timeout for this request, in seconds
379
378
  """
380
379
  return await self._patch(
381
- "/v1/profile/change-password",
380
+ OPERATIONS["patchV1ProfileChange-password"],
382
381
  body=await async_maybe_transform(
383
382
  {"new_password": new_password}, profile_change_password_params.ProfileChangePasswordParams
384
383
  ),
@@ -403,7 +402,7 @@ class AsyncProfileResource(AsyncAPIResource):
403
402
  remains on the web account.
404
403
  """
405
404
  return await self._patch(
406
- "/v1/profile/unbind-telegram",
405
+ OPERATIONS["patchV1ProfileUnbind-telegram"],
407
406
  options=make_request_options(
408
407
  extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
409
408
  ),
@@ -1,5 +1,3 @@
1
- # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
-
3
1
  from .referral import (
4
2
  ReferralResource,
5
3
  AsyncReferralResource,
@@ -1,9 +1,8 @@
1
- # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
-
3
1
  from __future__ import annotations
4
2
 
5
3
  import httpx
6
4
 
5
+ from ...._operations import OPERATIONS
7
6
  from ...._types import Body, Query, Headers, NotGiven, not_given
8
7
  from ...._utils import maybe_transform, async_maybe_transform
9
8
  from ...._compat import cached_property
@@ -72,7 +71,7 @@ class ReferralResource(SyncAPIResource):
72
71
  percentage, referral count, and earnings.
73
72
  """
74
73
  return self._get(
75
- "/v1/profile/referral",
74
+ OPERATIONS["getV1ProfileReferral"],
76
75
  options=make_request_options(
77
76
  extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
78
77
  ),
@@ -106,7 +105,7 @@ class ReferralResource(SyncAPIResource):
106
105
  timeout: Override the client-level default timeout for this request, in seconds
107
106
  """
108
107
  return self._post(
109
- "/v1/profile/referral/transfer-balance",
108
+ OPERATIONS["postV1ProfileReferralTransfer-balance"],
110
109
  body=maybe_transform({"amount": amount}, referral_transfer_balance_params.ReferralTransferBalanceParams),
111
110
  options=make_request_options(
112
111
  extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
@@ -157,7 +156,7 @@ class AsyncReferralResource(AsyncAPIResource):
157
156
  percentage, referral count, and earnings.
158
157
  """
159
158
  return await self._get(
160
- "/v1/profile/referral",
159
+ OPERATIONS["getV1ProfileReferral"],
161
160
  options=make_request_options(
162
161
  extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
163
162
  ),
@@ -191,7 +190,7 @@ class AsyncReferralResource(AsyncAPIResource):
191
190
  timeout: Override the client-level default timeout for this request, in seconds
192
191
  """
193
192
  return await self._post(
194
- "/v1/profile/referral/transfer-balance",
193
+ OPERATIONS["postV1ProfileReferralTransfer-balance"],
195
194
  body=await async_maybe_transform(
196
195
  {"amount": amount}, referral_transfer_balance_params.ReferralTransferBalanceParams
197
196
  ),
@@ -1,9 +1,8 @@
1
- # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
-
3
1
  from __future__ import annotations
4
2
 
5
3
  import httpx
6
4
 
5
+ from ...._operations import OPERATIONS
7
6
  from ...._types import Body, Query, Headers, NotGiven, not_given
8
7
  from ...._utils import maybe_transform
9
8
  from ...._compat import cached_property
@@ -74,7 +73,7 @@ class TransactionResource(SyncAPIResource):
74
73
  timeout: Override the client-level default timeout for this request, in seconds
75
74
  """
76
75
  return self._get_api_list(
77
- "/v1/profile/referral/transaction",
76
+ OPERATIONS["getV1ProfileReferralTransaction"],
78
77
  page=SyncPageNumber[TransactionListResponse],
79
78
  options=make_request_options(
80
79
  extra_headers=extra_headers,
@@ -145,7 +144,7 @@ class AsyncTransactionResource(AsyncAPIResource):
145
144
  timeout: Override the client-level default timeout for this request, in seconds
146
145
  """
147
146
  return self._get_api_list(
148
- "/v1/profile/referral/transaction",
147
+ OPERATIONS["getV1ProfileReferralTransaction"],
149
148
  page=AsyncPageNumber[TransactionListResponse],
150
149
  options=make_request_options(
151
150
  extra_headers=extra_headers,
@@ -1,5 +1,3 @@
1
- # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
-
3
1
  from .bulk import (
4
2
  BulkResource,
5
3
  AsyncBulkResource,
@@ -1,9 +1,9 @@
1
- # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
-
3
1
  from __future__ import annotations
4
2
 
5
3
  import httpx
6
4
 
5
+ from ..._operations import OPERATIONS
6
+ from ...types.purchases.list_responses import BulkListResponse, PurchaseSort, PurchaseStatus
7
7
  from ..._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given
8
8
  from ..._utils import path_template, maybe_transform, async_maybe_transform
9
9
  from ..._compat import cached_property
@@ -25,6 +25,20 @@ __all__ = ["BulkResource", "AsyncBulkResource"]
25
25
  class BulkResource(SyncAPIResource):
26
26
  """Purchase history and management."""
27
27
 
28
+ def list(
29
+ self, *, page: int | None = None, page_size: int | None = None,
30
+ sort: PurchaseSort | None = None, status: PurchaseStatus | None = None,
31
+ extra_headers: Headers | None = None,
32
+ ) -> BulkListResponse:
33
+ query = {"page": page, "page_size": page_size, "sort": sort, "status": status}
34
+ return self._get(
35
+ OPERATIONS["getV1PurchasesBulk"],
36
+ options=make_request_options(query={key: value for key, value in query.items() if value is not None},
37
+ extra_headers=extra_headers),
38
+ cast_to=BulkListResponse,
39
+ )
40
+
41
+
28
42
  @cached_property
29
43
  def with_raw_response(self) -> BulkResourceWithRawResponse:
30
44
  """
@@ -95,7 +109,7 @@ class BulkResource(SyncAPIResource):
95
109
  timeout: Override the client-level default timeout for this request, in seconds
96
110
  """
97
111
  return self._post(
98
- "/v1/purchases/bulk",
112
+ OPERATIONS["postV1PurchasesBulk"],
99
113
  body=maybe_transform(
100
114
  {
101
115
  "country_code": country_code,
@@ -137,7 +151,7 @@ class BulkResource(SyncAPIResource):
137
151
  timeout: Override the client-level default timeout for this request, in seconds
138
152
  """
139
153
  return self._get(
140
- path_template("/v1/purchases/bulk/{purchase_id}", purchase_id=purchase_id),
154
+ path_template(OPERATIONS["getV1PurchasesBulkByPurchase_id"], purchase_id=purchase_id),
141
155
  options=make_request_options(
142
156
  extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
143
157
  ),
@@ -172,7 +186,7 @@ class BulkResource(SyncAPIResource):
172
186
  """
173
187
  extra_headers = {"Accept": "*/*", **(extra_headers or {})}
174
188
  return self._get(
175
- path_template("/v1/purchases/bulk/{purchase_id}/download", purchase_id=purchase_id),
189
+ path_template(OPERATIONS["getV1PurchasesBulkByPurchase_idDownload"], purchase_id=purchase_id),
176
190
  options=make_request_options(
177
191
  extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
178
192
  ),
@@ -183,6 +197,20 @@ class BulkResource(SyncAPIResource):
183
197
  class AsyncBulkResource(AsyncAPIResource):
184
198
  """Purchase history and management."""
185
199
 
200
+ async def list(
201
+ self, *, page: int | None = None, page_size: int | None = None,
202
+ sort: PurchaseSort | None = None, status: PurchaseStatus | None = None,
203
+ extra_headers: Headers | None = None,
204
+ ) -> BulkListResponse:
205
+ query = {"page": page, "page_size": page_size, "sort": sort, "status": status}
206
+ return await self._get(
207
+ OPERATIONS["getV1PurchasesBulk"],
208
+ options=make_request_options(query={key: value for key, value in query.items() if value is not None},
209
+ extra_headers=extra_headers),
210
+ cast_to=BulkListResponse,
211
+ )
212
+
213
+
186
214
  @cached_property
187
215
  def with_raw_response(self) -> AsyncBulkResourceWithRawResponse:
188
216
  """
@@ -253,7 +281,7 @@ class AsyncBulkResource(AsyncAPIResource):
253
281
  timeout: Override the client-level default timeout for this request, in seconds
254
282
  """
255
283
  return await self._post(
256
- "/v1/purchases/bulk",
284
+ OPERATIONS["postV1PurchasesBulk"],
257
285
  body=await async_maybe_transform(
258
286
  {
259
287
  "country_code": country_code,
@@ -295,7 +323,7 @@ class AsyncBulkResource(AsyncAPIResource):
295
323
  timeout: Override the client-level default timeout for this request, in seconds
296
324
  """
297
325
  return await self._get(
298
- path_template("/v1/purchases/bulk/{purchase_id}", purchase_id=purchase_id),
326
+ path_template(OPERATIONS["getV1PurchasesBulkByPurchase_id"], purchase_id=purchase_id),
299
327
  options=make_request_options(
300
328
  extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
301
329
  ),
@@ -330,7 +358,7 @@ class AsyncBulkResource(AsyncAPIResource):
330
358
  """
331
359
  extra_headers = {"Accept": "*/*", **(extra_headers or {})}
332
360
  return await self._get(
333
- path_template("/v1/purchases/bulk/{purchase_id}/download", purchase_id=purchase_id),
361
+ path_template(OPERATIONS["getV1PurchasesBulkByPurchase_idDownload"], purchase_id=purchase_id),
334
362
  options=make_request_options(
335
363
  extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
336
364
  ),
@@ -1,11 +1,11 @@
1
- # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
-
3
1
  from __future__ import annotations
4
2
 
5
3
  from typing_extensions import Literal
6
4
 
7
5
  import httpx
8
6
 
7
+ from ..._operations import OPERATIONS
8
+ from ...types.purchases.list_responses import PurchaseHistoryResponse, PurchaseSort, PurchaseStatus
9
9
  from .bulk import (
10
10
  BulkResource,
11
11
  AsyncBulkResource,
@@ -39,6 +39,20 @@ __all__ = ["PurchasesResource", "AsyncPurchasesResource"]
39
39
  class PurchasesResource(SyncAPIResource):
40
40
  """Purchase history and management."""
41
41
 
42
+ def history(
43
+ self, *, page: int | None = None, page_size: int | None = None,
44
+ sort: PurchaseSort | None = None, status: PurchaseStatus | None = None, phone_number: str | None = None, search: str | None = None,
45
+ extra_headers: Headers | None = None,
46
+ ) -> PurchaseHistoryResponse:
47
+ query = {"page": page, "page_size": page_size, "sort": sort, "status": status, "phone_number": phone_number, "search": search}
48
+ return self._get(
49
+ OPERATIONS["getV1PurchasesHistory"],
50
+ options=make_request_options(query={key: value for key, value in query.items() if value is not None},
51
+ extra_headers=extra_headers),
52
+ cast_to=PurchaseHistoryResponse,
53
+ )
54
+
55
+
42
56
  @cached_property
43
57
  def bulk(self) -> BulkResource:
44
58
  """Purchase history and management."""
@@ -104,7 +118,7 @@ class PurchasesResource(SyncAPIResource):
104
118
  timeout: Override the client-level default timeout for this request, in seconds
105
119
  """
106
120
  return self._post(
107
- "/v1/purchases/",
121
+ OPERATIONS["postV1Purchases"],
108
122
  body=maybe_transform({"country_code": country_code}, purchase_create_params.PurchaseCreateParams),
109
123
  options=make_request_options(
110
124
  extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
@@ -141,7 +155,7 @@ class PurchasesResource(SyncAPIResource):
141
155
  timeout: Override the client-level default timeout for this request, in seconds
142
156
  """
143
157
  return self._get(
144
- path_template("/v1/purchases/{purchase_id}", purchase_id=purchase_id),
158
+ path_template(OPERATIONS["getV1PurchasesByPurchase_id"], purchase_id=purchase_id),
145
159
  options=make_request_options(
146
160
  extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
147
161
  ),
@@ -211,7 +225,7 @@ class PurchasesResource(SyncAPIResource):
211
225
  timeout: Override the client-level default timeout for this request, in seconds
212
226
  """
213
227
  return self._get_api_list(
214
- "/v1/purchases/",
228
+ OPERATIONS["getV1Purchases"],
215
229
  page=SyncPageNumber[PurchaseListResponse],
216
230
  options=make_request_options(
217
231
  extra_headers=extra_headers,
@@ -263,7 +277,7 @@ class PurchasesResource(SyncAPIResource):
263
277
  timeout: Override the client-level default timeout for this request, in seconds
264
278
  """
265
279
  return self._post(
266
- path_template("/v1/purchases/{purchase_id}/refund", purchase_id=purchase_id),
280
+ path_template(OPERATIONS["postV1PurchasesByPurchase_idRefund"], purchase_id=purchase_id),
267
281
  options=make_request_options(
268
282
  extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
269
283
  ),
@@ -323,7 +337,7 @@ class PurchasesResource(SyncAPIResource):
323
337
  timeout: Override the client-level default timeout for this request, in seconds
324
338
  """
325
339
  return self._post(
326
- path_template("/v1/purchases/{purchase_id}/request-code", purchase_id=purchase_id),
340
+ path_template(OPERATIONS["postV1PurchasesByPurchase_idRequest-code"], purchase_id=purchase_id),
327
341
  body=maybe_transform(
328
342
  {"callback_url": callback_url},
329
343
  purchase_request_verification_code_params.PurchaseRequestVerificationCodeParams,
@@ -338,6 +352,20 @@ class PurchasesResource(SyncAPIResource):
338
352
  class AsyncPurchasesResource(AsyncAPIResource):
339
353
  """Purchase history and management."""
340
354
 
355
+ async def history(
356
+ self, *, page: int | None = None, page_size: int | None = None,
357
+ sort: PurchaseSort | None = None, status: PurchaseStatus | None = None, phone_number: str | None = None, search: str | None = None,
358
+ extra_headers: Headers | None = None,
359
+ ) -> PurchaseHistoryResponse:
360
+ query = {"page": page, "page_size": page_size, "sort": sort, "status": status, "phone_number": phone_number, "search": search}
361
+ return await self._get(
362
+ OPERATIONS["getV1PurchasesHistory"],
363
+ options=make_request_options(query={key: value for key, value in query.items() if value is not None},
364
+ extra_headers=extra_headers),
365
+ cast_to=PurchaseHistoryResponse,
366
+ )
367
+
368
+
341
369
  @cached_property
342
370
  def bulk(self) -> AsyncBulkResource:
343
371
  """Purchase history and management."""
@@ -403,7 +431,7 @@ class AsyncPurchasesResource(AsyncAPIResource):
403
431
  timeout: Override the client-level default timeout for this request, in seconds
404
432
  """
405
433
  return await self._post(
406
- "/v1/purchases/",
434
+ OPERATIONS["postV1Purchases"],
407
435
  body=await async_maybe_transform(
408
436
  {"country_code": country_code}, purchase_create_params.PurchaseCreateParams
409
437
  ),
@@ -442,7 +470,7 @@ class AsyncPurchasesResource(AsyncAPIResource):
442
470
  timeout: Override the client-level default timeout for this request, in seconds
443
471
  """
444
472
  return await self._get(
445
- path_template("/v1/purchases/{purchase_id}", purchase_id=purchase_id),
473
+ path_template(OPERATIONS["getV1PurchasesByPurchase_id"], purchase_id=purchase_id),
446
474
  options=make_request_options(
447
475
  extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
448
476
  ),
@@ -512,7 +540,7 @@ class AsyncPurchasesResource(AsyncAPIResource):
512
540
  timeout: Override the client-level default timeout for this request, in seconds
513
541
  """
514
542
  return self._get_api_list(
515
- "/v1/purchases/",
543
+ OPERATIONS["getV1Purchases"],
516
544
  page=AsyncPageNumber[PurchaseListResponse],
517
545
  options=make_request_options(
518
546
  extra_headers=extra_headers,
@@ -564,7 +592,7 @@ class AsyncPurchasesResource(AsyncAPIResource):
564
592
  timeout: Override the client-level default timeout for this request, in seconds
565
593
  """
566
594
  return await self._post(
567
- path_template("/v1/purchases/{purchase_id}/refund", purchase_id=purchase_id),
595
+ path_template(OPERATIONS["postV1PurchasesByPurchase_idRefund"], purchase_id=purchase_id),
568
596
  options=make_request_options(
569
597
  extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
570
598
  ),
@@ -624,7 +652,7 @@ class AsyncPurchasesResource(AsyncAPIResource):
624
652
  timeout: Override the client-level default timeout for this request, in seconds
625
653
  """
626
654
  return await self._post(
627
- path_template("/v1/purchases/{purchase_id}/request-code", purchase_id=purchase_id),
655
+ path_template(OPERATIONS["postV1PurchasesByPurchase_idRequest-code"], purchase_id=purchase_id),
628
656
  body=await async_maybe_transform(
629
657
  {"callback_url": callback_url},
630
658
  purchase_request_verification_code_params.PurchaseRequestVerificationCodeParams,