gmt-python-sdk 0.40.1__py3-none-any.whl → 0.42.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.
- gmt/_models.py +80 -0
- gmt/_version.py +1 -1
- gmt/types/purchase_create_response.py +3 -0
- gmt/types/purchase_list_response.py +3 -0
- gmt/types/purchase_refund_response.py +3 -0
- gmt/types/purchase_request_verification_code_response.py +3 -0
- gmt/types/purchase_retrieve_response.py +3 -0
- gmt/types/purchases_by_hash_request_verification_code_response.py +3 -0
- gmt/types/purchases_by_hash_retrieve_response.py +3 -0
- {gmt_python_sdk-0.40.1.dist-info → gmt_python_sdk-0.42.0.dist-info}/METADATA +1 -1
- {gmt_python_sdk-0.40.1.dist-info → gmt_python_sdk-0.42.0.dist-info}/RECORD +13 -13
- {gmt_python_sdk-0.40.1.dist-info → gmt_python_sdk-0.42.0.dist-info}/WHEEL +0 -0
- {gmt_python_sdk-0.40.1.dist-info → gmt_python_sdk-0.42.0.dist-info}/licenses/LICENSE +0 -0
gmt/_models.py
CHANGED
|
@@ -25,7 +25,9 @@ from typing_extensions import (
|
|
|
25
25
|
ClassVar,
|
|
26
26
|
Protocol,
|
|
27
27
|
Required,
|
|
28
|
+
Annotated,
|
|
28
29
|
ParamSpec,
|
|
30
|
+
TypeAlias,
|
|
29
31
|
TypedDict,
|
|
30
32
|
TypeGuard,
|
|
31
33
|
final,
|
|
@@ -79,7 +81,15 @@ from ._compat import (
|
|
|
79
81
|
from ._constants import RAW_RESPONSE_HEADER
|
|
80
82
|
|
|
81
83
|
if TYPE_CHECKING:
|
|
84
|
+
from pydantic import GetCoreSchemaHandler, ValidatorFunctionWrapHandler
|
|
85
|
+
from pydantic_core import CoreSchema, core_schema
|
|
82
86
|
from pydantic_core.core_schema import ModelField, ModelSchema, LiteralSchema, ModelFieldsSchema
|
|
87
|
+
else:
|
|
88
|
+
try:
|
|
89
|
+
from pydantic_core import CoreSchema, core_schema
|
|
90
|
+
except ImportError:
|
|
91
|
+
CoreSchema = None
|
|
92
|
+
core_schema = None
|
|
83
93
|
|
|
84
94
|
__all__ = ["BaseModel", "GenericModel"]
|
|
85
95
|
|
|
@@ -396,6 +406,76 @@ class BaseModel(pydantic.BaseModel):
|
|
|
396
406
|
)
|
|
397
407
|
|
|
398
408
|
|
|
409
|
+
class _EagerIterable(list[_T], Generic[_T]):
|
|
410
|
+
"""
|
|
411
|
+
Accepts any Iterable[T] input (including generators), consumes it
|
|
412
|
+
eagerly, and validates all items upfront.
|
|
413
|
+
|
|
414
|
+
Validation preserves the original container type where possible
|
|
415
|
+
(e.g. a set[T] stays a set[T]). Serialization (model_dump / JSON)
|
|
416
|
+
always emits a list — round-tripping through model_dump() will not
|
|
417
|
+
restore the original container type.
|
|
418
|
+
"""
|
|
419
|
+
|
|
420
|
+
@classmethod
|
|
421
|
+
def __get_pydantic_core_schema__(
|
|
422
|
+
cls,
|
|
423
|
+
source_type: Any,
|
|
424
|
+
handler: GetCoreSchemaHandler,
|
|
425
|
+
) -> CoreSchema:
|
|
426
|
+
(item_type,) = get_args(source_type) or (Any,)
|
|
427
|
+
item_schema: CoreSchema = handler.generate_schema(item_type)
|
|
428
|
+
list_of_items_schema: CoreSchema = core_schema.list_schema(item_schema)
|
|
429
|
+
|
|
430
|
+
return core_schema.no_info_wrap_validator_function(
|
|
431
|
+
cls._validate,
|
|
432
|
+
list_of_items_schema,
|
|
433
|
+
serialization=core_schema.plain_serializer_function_ser_schema(
|
|
434
|
+
cls._serialize,
|
|
435
|
+
info_arg=False,
|
|
436
|
+
),
|
|
437
|
+
)
|
|
438
|
+
|
|
439
|
+
@staticmethod
|
|
440
|
+
def _validate(v: Iterable[_T], handler: "ValidatorFunctionWrapHandler") -> Any:
|
|
441
|
+
original_type: type[Any] = type(v)
|
|
442
|
+
|
|
443
|
+
# Normalize to list so list_schema can validate each item
|
|
444
|
+
if isinstance(v, list):
|
|
445
|
+
items: list[_T] = v
|
|
446
|
+
else:
|
|
447
|
+
try:
|
|
448
|
+
items = list(v)
|
|
449
|
+
except TypeError as e:
|
|
450
|
+
raise TypeError("Value is not iterable") from e
|
|
451
|
+
|
|
452
|
+
# Validate items against the inner schema
|
|
453
|
+
validated: list[_T] = handler(items)
|
|
454
|
+
|
|
455
|
+
# Reconstruct original container type
|
|
456
|
+
if original_type is list:
|
|
457
|
+
return validated
|
|
458
|
+
# str(list) produces the list's repr, not a string built from items,
|
|
459
|
+
# so skip reconstruction for str and its subclasses.
|
|
460
|
+
if issubclass(original_type, str):
|
|
461
|
+
return validated
|
|
462
|
+
try:
|
|
463
|
+
return original_type(validated)
|
|
464
|
+
except (TypeError, ValueError):
|
|
465
|
+
# If the type cannot be reconstructed, just return the validated list
|
|
466
|
+
return validated
|
|
467
|
+
|
|
468
|
+
@staticmethod
|
|
469
|
+
def _serialize(v: Iterable[_T]) -> list[_T]:
|
|
470
|
+
"""Always serialize as a list so Pydantic's JSON encoder is happy."""
|
|
471
|
+
if isinstance(v, list):
|
|
472
|
+
return v
|
|
473
|
+
return list(v)
|
|
474
|
+
|
|
475
|
+
|
|
476
|
+
EagerIterable: TypeAlias = Annotated[Iterable[_T], _EagerIterable]
|
|
477
|
+
|
|
478
|
+
|
|
399
479
|
def _construct_field(value: object, field: FieldInfo, key: str) -> object:
|
|
400
480
|
if value is None:
|
|
401
481
|
return field_get_default(field)
|
gmt/_version.py
CHANGED
|
@@ -99,6 +99,9 @@ class PurchaseCreateResponse(BaseModel):
|
|
|
99
99
|
volume = bigger discounts.
|
|
100
100
|
"""
|
|
101
101
|
|
|
102
|
+
purchase_source: Literal["BOT", "WEB", "API"]
|
|
103
|
+
"""Purchase channel: BOT (Telegram), WEB (site JWT), API (x-api-key)"""
|
|
104
|
+
|
|
102
105
|
purchase_type: Literal["SINGLE", "BULK", "ADMIN"]
|
|
103
106
|
"""
|
|
104
107
|
Type of purchase: SINGLE (regular), BULK (batch purchase), ADMIN (admin
|
|
@@ -99,6 +99,9 @@ class PurchaseListResponse(BaseModel):
|
|
|
99
99
|
volume = bigger discounts.
|
|
100
100
|
"""
|
|
101
101
|
|
|
102
|
+
purchase_source: Literal["BOT", "WEB", "API"]
|
|
103
|
+
"""Purchase channel: BOT (Telegram), WEB (site JWT), API (x-api-key)"""
|
|
104
|
+
|
|
102
105
|
purchase_type: Literal["SINGLE", "BULK", "ADMIN"]
|
|
103
106
|
"""
|
|
104
107
|
Type of purchase: SINGLE (regular), BULK (batch purchase), ADMIN (admin
|
|
@@ -107,6 +107,9 @@ class Purchase(BaseModel):
|
|
|
107
107
|
volume = bigger discounts.
|
|
108
108
|
"""
|
|
109
109
|
|
|
110
|
+
purchase_source: Literal["BOT", "WEB", "API"]
|
|
111
|
+
"""Purchase channel: BOT (Telegram), WEB (site JWT), API (x-api-key)"""
|
|
112
|
+
|
|
110
113
|
purchase_type: Literal["SINGLE", "BULK", "ADMIN"]
|
|
111
114
|
"""
|
|
112
115
|
Type of purchase: SINGLE (regular), BULK (batch purchase), ADMIN (admin
|
|
@@ -123,6 +123,9 @@ class Purchase(BaseModel):
|
|
|
123
123
|
volume = bigger discounts.
|
|
124
124
|
"""
|
|
125
125
|
|
|
126
|
+
purchase_source: Literal["BOT", "WEB", "API"]
|
|
127
|
+
"""Purchase channel: BOT (Telegram), WEB (site JWT), API (x-api-key)"""
|
|
128
|
+
|
|
126
129
|
purchase_type: Literal["SINGLE", "BULK", "ADMIN"]
|
|
127
130
|
"""
|
|
128
131
|
Type of purchase: SINGLE (regular), BULK (batch purchase), ADMIN (admin
|
|
@@ -99,6 +99,9 @@ class PurchaseRetrieveResponse(BaseModel):
|
|
|
99
99
|
volume = bigger discounts.
|
|
100
100
|
"""
|
|
101
101
|
|
|
102
|
+
purchase_source: Literal["BOT", "WEB", "API"]
|
|
103
|
+
"""Purchase channel: BOT (Telegram), WEB (site JWT), API (x-api-key)"""
|
|
104
|
+
|
|
102
105
|
purchase_type: Literal["SINGLE", "BULK", "ADMIN"]
|
|
103
106
|
"""
|
|
104
107
|
Type of purchase: SINGLE (regular), BULK (batch purchase), ADMIN (admin
|
|
@@ -123,6 +123,9 @@ class Purchase(BaseModel):
|
|
|
123
123
|
volume = bigger discounts.
|
|
124
124
|
"""
|
|
125
125
|
|
|
126
|
+
purchase_source: Literal["BOT", "WEB", "API"]
|
|
127
|
+
"""Purchase channel: BOT (Telegram), WEB (site JWT), API (x-api-key)"""
|
|
128
|
+
|
|
126
129
|
purchase_type: Literal["SINGLE", "BULK", "ADMIN"]
|
|
127
130
|
"""
|
|
128
131
|
Type of purchase: SINGLE (regular), BULK (batch purchase), ADMIN (admin
|
|
@@ -99,6 +99,9 @@ class PurchasesByHashRetrieveResponse(BaseModel):
|
|
|
99
99
|
volume = bigger discounts.
|
|
100
100
|
"""
|
|
101
101
|
|
|
102
|
+
purchase_source: Literal["BOT", "WEB", "API"]
|
|
103
|
+
"""Purchase channel: BOT (Telegram), WEB (site JWT), API (x-api-key)"""
|
|
104
|
+
|
|
102
105
|
purchase_type: Literal["SINGLE", "BULK", "ADMIN"]
|
|
103
106
|
"""
|
|
104
107
|
Type of purchase: SINGLE (regular), BULK (batch purchase), ADMIN (admin
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: gmt-python-sdk
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.42.0
|
|
4
4
|
Summary: The official Python library for the gmt API
|
|
5
5
|
Project-URL: Homepage, https://github.com/cameo6/gmt-python-sdk
|
|
6
6
|
Project-URL: Repository, https://github.com/cameo6/gmt-python-sdk
|
|
@@ -5,13 +5,13 @@ gmt/_compat.py,sha256=_9guQfzYnL3DNtudX5W7T2cdSskx89B5AFfhPQDxMUk,6811
|
|
|
5
5
|
gmt/_constants.py,sha256=S14PFzyN9-I31wiV7SmIlL5Ga0MLHxdvegInGdXH7tM,462
|
|
6
6
|
gmt/_exceptions.py,sha256=A9TcUztaZueUJpHJSjIuihpeRfepRxqUUvCdkrVxIbI,3214
|
|
7
7
|
gmt/_files.py,sha256=SVYqNE1L-wYm1GciyF95BCJGC1gsWAqvXvSyos-_rNo,5453
|
|
8
|
-
gmt/_models.py,sha256=
|
|
8
|
+
gmt/_models.py,sha256=JQacajuhErlWYCpiDa7s_iK4rHVua36M-EkaGJ_PmrU,34855
|
|
9
9
|
gmt/_qs.py,sha256=ZSfQv6arGBBoWlcy60zK1zmPE2Ije0i8kzKdnoxWUjU,4833
|
|
10
10
|
gmt/_resource.py,sha256=tzQAGA7Ym566OzUQrWchaSWxd2T8rdFGwjbyi7HNr4k,1082
|
|
11
11
|
gmt/_response.py,sha256=fZv3RT9oYSzR5WLhYQS7bx-LIef3fxagqU2TTSQ7deg,28907
|
|
12
12
|
gmt/_streaming.py,sha256=yV5P8s3xhk-icmoinjIe2BwrHF50Y6o2EvflwNNW9ok,10538
|
|
13
13
|
gmt/_types.py,sha256=vHI2uhWcrCfpIF_xDAe8fTZUh6VILuduHCYf1Q1AF68,7699
|
|
14
|
-
gmt/_version.py,sha256=
|
|
14
|
+
gmt/_version.py,sha256=8EyTt6nZnLhInFftd8FKlzGxKnFdj1ftdCLTlKNa9hY,156
|
|
15
15
|
gmt/pagination.py,sha256=n809F911HoxSfQRx5Pc6zie3PPON1AxWN2Wx_ay8-ug,3336
|
|
16
16
|
gmt/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
17
17
|
gmt/_utils/__init__.py,sha256=nQq-iFa5YxTaWySaLigatew5rHgTR0M75FNYm4mrO1s,2313
|
|
@@ -61,16 +61,16 @@ gmt/types/profile_change_password_response.py,sha256=xwhTPPZSZ3HIajSApM_sjOGnDpU
|
|
|
61
61
|
gmt/types/profile_retrieve_response.py,sha256=ea84ZGXd3_uIZ4MlXh4zk3M_3jcM51jFTEVculbrYlw,1386
|
|
62
62
|
gmt/types/profile_unbind_telegram_response.py,sha256=CAIdGojlfMpb4XHGVVf9p9hu2nOIC4VCvzWZ6yAwitI,284
|
|
63
63
|
gmt/types/purchase_create_params.py,sha256=ljYx8_OkKefQnNg-2_otA1emeu7SpH0_cRhrhFoqync,338
|
|
64
|
-
gmt/types/purchase_create_response.py,sha256=
|
|
64
|
+
gmt/types/purchase_create_response.py,sha256=9gYg6ezVOg_HbN0QnwIldxzlH5v_P1-CZkg5aumCDRc,4246
|
|
65
65
|
gmt/types/purchase_list_params.py,sha256=k9ZyXgxoZMA8Jwtb-d7ujaqalSeu_9_Eeqp70JAclw8,1136
|
|
66
|
-
gmt/types/purchase_list_response.py,sha256=
|
|
67
|
-
gmt/types/purchase_refund_response.py,sha256=
|
|
66
|
+
gmt/types/purchase_list_response.py,sha256=uVKxKP5A3eWQ-NN0UFA2XdZf8gV4GfzOQAKC3IIS7ZM,4242
|
|
67
|
+
gmt/types/purchase_refund_response.py,sha256=BCjSSrisTppp05nDYlwIN70gI1cr0S-I1DmjNhR9K6M,4891
|
|
68
68
|
gmt/types/purchase_request_verification_code_params.py,sha256=Ew9tLWBubCCHxv91gCeBBFJ4z3Y2C9i_ztt9PwsHbk8,692
|
|
69
|
-
gmt/types/purchase_request_verification_code_response.py,sha256=
|
|
70
|
-
gmt/types/purchase_retrieve_response.py,sha256=
|
|
69
|
+
gmt/types/purchase_request_verification_code_response.py,sha256=gldIPyc5JdwnHJNfQnBOPNCBG5p_zSarFRv2Cnj_mUg,4953
|
|
70
|
+
gmt/types/purchase_retrieve_response.py,sha256=luliFiMlz3ctX9jCyBbDhWz72uEznD-cmZVW72EFE2U,4250
|
|
71
71
|
gmt/types/purchases_by_hash_request_verification_code_params.py,sha256=9eklMEiEs_3_LHmOVKjyAO5bQt6WE_4zUDu9Lxfm-MM,706
|
|
72
|
-
gmt/types/purchases_by_hash_request_verification_code_response.py,sha256=
|
|
73
|
-
gmt/types/purchases_by_hash_retrieve_response.py,sha256=
|
|
72
|
+
gmt/types/purchases_by_hash_request_verification_code_response.py,sha256=gbjsntxxnACa_HrVCncBhgqsN2k6H1FTIXxtW0Hc02Q,4967
|
|
73
|
+
gmt/types/purchases_by_hash_retrieve_response.py,sha256=t9I455YahTVdAL8OEhoNkU2ZSHFW8-bx9VMvvcqJzIs,4264
|
|
74
74
|
gmt/types/service_get_server_time_response.py,sha256=QGpTh026xwxbI6NIJzmPn1RdKNqQcrQdak6YA-4mk14,506
|
|
75
75
|
gmt/types/service_health_check_response.py,sha256=K2g4XTjetp3DXlHJwOdZiNTtuVn39T14gcy_wFZUNWA,867
|
|
76
76
|
gmt/types/telegram_get_premium_price_params.py,sha256=0KWhs-mbTtF9Sm5aaz1TCbENPCD8mtiWzUIHjzbqrlw,381
|
|
@@ -100,7 +100,7 @@ gmt/types/telegram/purchase_list_premium_params.py,sha256=oW08T456ETaCsOQitxGpZr
|
|
|
100
100
|
gmt/types/telegram/purchase_list_premium_response.py,sha256=M20qmhFRdyRctS2ZXfY4uhsdKs1r6tqVvry8ZWRLNkw,526
|
|
101
101
|
gmt/types/telegram/purchase_list_stars_params.py,sha256=snmpMERjCERI-3vla6JSuLD7xEDHRmJAkPKqbsi9MzM,382
|
|
102
102
|
gmt/types/telegram/purchase_list_stars_response.py,sha256=mct_Vt7O38kKPZd3y9rs0Zfn09gueGuIEanTZ7Vbb0A,502
|
|
103
|
-
gmt_python_sdk-0.
|
|
104
|
-
gmt_python_sdk-0.
|
|
105
|
-
gmt_python_sdk-0.
|
|
106
|
-
gmt_python_sdk-0.
|
|
103
|
+
gmt_python_sdk-0.42.0.dist-info/METADATA,sha256=OtpPB24zg5x01tXLlZAxndsWQMZYgdXSRA_JkkKUK8Q,14850
|
|
104
|
+
gmt_python_sdk-0.42.0.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
|
|
105
|
+
gmt_python_sdk-0.42.0.dist-info/licenses/LICENSE,sha256=WWPSicsDpqUVUEv9QtvRA2znGrMdkblc1ZSYzZPN6TQ,11333
|
|
106
|
+
gmt_python_sdk-0.42.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|