xdataapi 0.3.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 (61) hide show
  1. xdataapi/__init__.py +8 -0
  2. xdataapi/api/__init__.py +1 -0
  3. xdataapi/api/account/__init__.py +1 -0
  4. xdataapi/api/account/get_me.py +144 -0
  5. xdataapi/api/billing/__init__.py +1 -0
  6. xdataapi/api/billing/create_checkout.py +206 -0
  7. xdataapi/api/billing/list_packs.py +144 -0
  8. xdataapi/api/tweets/__init__.py +1 -0
  9. xdataapi/api/tweets/get_quotes.py +241 -0
  10. xdataapi/api/tweets/get_replies.py +230 -0
  11. xdataapi/api/tweets/get_retweeters.py +245 -0
  12. xdataapi/api/tweets/get_thread.py +226 -0
  13. xdataapi/api/tweets/get_tweet.py +213 -0
  14. xdataapi/api/tweets/get_tweets.py +223 -0
  15. xdataapi/api/tweets/search_tweets.py +277 -0
  16. xdataapi/api/users/__init__.py +1 -0
  17. xdataapi/api/users/get_follower_ids.py +254 -0
  18. xdataapi/api/users/get_followers.py +254 -0
  19. xdataapi/api/users/get_following.py +246 -0
  20. xdataapi/api/users/get_user.py +213 -0
  21. xdataapi/api/users/get_user_tweets.py +241 -0
  22. xdataapi/api/users/get_users.py +231 -0
  23. xdataapi/client.py +268 -0
  24. xdataapi/errors.py +16 -0
  25. xdataapi/models/__init__.py +67 -0
  26. xdataapi/models/batch_error.py +79 -0
  27. xdataapi/models/batch_error_code.py +15 -0
  28. xdataapi/models/batch_meta.py +126 -0
  29. xdataapi/models/batch_meta_cache.py +11 -0
  30. xdataapi/models/create_checkout_body.py +63 -0
  31. xdataapi/models/create_checkout_body_pack.py +11 -0
  32. xdataapi/models/create_checkout_response_200.py +97 -0
  33. xdataapi/models/error.py +78 -0
  34. xdataapi/models/error_body.py +72 -0
  35. xdataapi/models/error_body_code.py +22 -0
  36. xdataapi/models/get_me_response_200.py +88 -0
  37. xdataapi/models/get_tweets_body.py +61 -0
  38. xdataapi/models/get_users_body.py +61 -0
  39. xdataapi/models/id_page.py +117 -0
  40. xdataapi/models/list_packs_response_200.py +105 -0
  41. xdataapi/models/list_packs_response_200_data_item.py +88 -0
  42. xdataapi/models/list_packs_response_200_rate_limits_item.py +70 -0
  43. xdataapi/models/media.py +96 -0
  44. xdataapi/models/media_type.py +10 -0
  45. xdataapi/models/meta.py +106 -0
  46. xdataapi/models/meta_cache.py +10 -0
  47. xdataapi/models/problem.py +131 -0
  48. xdataapi/models/search_tweets_product.py +12 -0
  49. xdataapi/models/tweet.py +310 -0
  50. xdataapi/models/tweet_batch.py +150 -0
  51. xdataapi/models/tweet_page.py +133 -0
  52. xdataapi/models/tweet_response.py +128 -0
  53. xdataapi/models/user.py +204 -0
  54. xdataapi/models/user_batch.py +150 -0
  55. xdataapi/models/user_page.py +133 -0
  56. xdataapi/models/user_response.py +128 -0
  57. xdataapi/py.typed +1 -0
  58. xdataapi/types.py +54 -0
  59. xdataapi-0.3.0.dist-info/METADATA +148 -0
  60. xdataapi-0.3.0.dist-info/RECORD +61 -0
  61. xdataapi-0.3.0.dist-info/WHEEL +4 -0
@@ -0,0 +1,97 @@
1
+ from __future__ import annotations
2
+
3
+ from collections.abc import Mapping
4
+ from typing import Any, TypeVar
5
+
6
+ from attrs import define as _attrs_define
7
+ from attrs import field as _attrs_field
8
+
9
+ from ..types import UNSET, Unset
10
+
11
+ T = TypeVar("T", bound="CreateCheckoutResponse200")
12
+
13
+
14
+ @_attrs_define
15
+ class CreateCheckoutResponse200:
16
+ """
17
+ Attributes:
18
+ url (str | Unset):
19
+ pack (str | Unset):
20
+ usd (int | Unset):
21
+ credits_ (int | Unset):
22
+ request_id (str | Unset):
23
+ """
24
+
25
+ url: str | Unset = UNSET
26
+ pack: str | Unset = UNSET
27
+ usd: int | Unset = UNSET
28
+ credits_: int | Unset = UNSET
29
+ request_id: str | Unset = UNSET
30
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
31
+
32
+ def to_dict(self) -> dict[str, Any]:
33
+ url = self.url
34
+
35
+ pack = self.pack
36
+
37
+ usd = self.usd
38
+
39
+ credits_ = self.credits_
40
+
41
+ request_id = self.request_id
42
+
43
+ field_dict: dict[str, Any] = {}
44
+ field_dict.update(self.additional_properties)
45
+ field_dict.update({})
46
+ if url is not UNSET:
47
+ field_dict["url"] = url
48
+ if pack is not UNSET:
49
+ field_dict["pack"] = pack
50
+ if usd is not UNSET:
51
+ field_dict["usd"] = usd
52
+ if credits_ is not UNSET:
53
+ field_dict["credits"] = credits_
54
+ if request_id is not UNSET:
55
+ field_dict["request_id"] = request_id
56
+
57
+ return field_dict
58
+
59
+ @classmethod
60
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
61
+ d = dict(src_dict)
62
+ url = d.pop("url", UNSET)
63
+
64
+ pack = d.pop("pack", UNSET)
65
+
66
+ usd = d.pop("usd", UNSET)
67
+
68
+ credits_ = d.pop("credits", UNSET)
69
+
70
+ request_id = d.pop("request_id", UNSET)
71
+
72
+ create_checkout_response_200 = cls(
73
+ url=url,
74
+ pack=pack,
75
+ usd=usd,
76
+ credits_=credits_,
77
+ request_id=request_id,
78
+ )
79
+
80
+ create_checkout_response_200.additional_properties = d
81
+ return create_checkout_response_200
82
+
83
+ @property
84
+ def additional_keys(self) -> list[str]:
85
+ return list(self.additional_properties.keys())
86
+
87
+ def __getitem__(self, key: str) -> Any:
88
+ return self.additional_properties[key]
89
+
90
+ def __setitem__(self, key: str, value: Any) -> None:
91
+ self.additional_properties[key] = value
92
+
93
+ def __delitem__(self, key: str) -> None:
94
+ del self.additional_properties[key]
95
+
96
+ def __contains__(self, key: str) -> bool:
97
+ return key in self.additional_properties
@@ -0,0 +1,78 @@
1
+ from __future__ import annotations
2
+
3
+ from collections.abc import Mapping
4
+ from typing import TYPE_CHECKING, Any, TypeVar
5
+
6
+ from attrs import define as _attrs_define
7
+ from attrs import field as _attrs_field
8
+
9
+ if TYPE_CHECKING:
10
+ from ..models.error_body import ErrorBody
11
+
12
+
13
+ T = TypeVar("T", bound="Error")
14
+
15
+
16
+ @_attrs_define
17
+ class Error:
18
+ """Every failure from this API, in one shape. Charged nothing, always carries a
19
+ `request_id`. The same failure is available as RFC 9457 `application/problem+json`
20
+ to callers that ask for it.
21
+
22
+ Attributes:
23
+ error (ErrorBody): The failure itself. `code` is stable; match on it, never on `message`.
24
+ request_id (str):
25
+ """
26
+
27
+ error: ErrorBody
28
+ request_id: str
29
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
30
+
31
+ def to_dict(self) -> dict[str, Any]:
32
+ error = self.error.to_dict()
33
+
34
+ request_id = self.request_id
35
+
36
+ field_dict: dict[str, Any] = {}
37
+ field_dict.update(self.additional_properties)
38
+ field_dict.update(
39
+ {
40
+ "error": error,
41
+ "request_id": request_id,
42
+ }
43
+ )
44
+
45
+ return field_dict
46
+
47
+ @classmethod
48
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
49
+ from ..models.error_body import ErrorBody # noqa: PLC0415
50
+
51
+ d = dict(src_dict)
52
+ error = ErrorBody.from_dict(d.pop("error"))
53
+
54
+ request_id = d.pop("request_id")
55
+
56
+ error = cls(
57
+ error=error,
58
+ request_id=request_id,
59
+ )
60
+
61
+ error.additional_properties = d
62
+ return error
63
+
64
+ @property
65
+ def additional_keys(self) -> list[str]:
66
+ return list(self.additional_properties.keys())
67
+
68
+ def __getitem__(self, key: str) -> Any:
69
+ return self.additional_properties[key]
70
+
71
+ def __setitem__(self, key: str, value: Any) -> None:
72
+ self.additional_properties[key] = value
73
+
74
+ def __delitem__(self, key: str) -> None:
75
+ del self.additional_properties[key]
76
+
77
+ def __contains__(self, key: str) -> bool:
78
+ return key in self.additional_properties
@@ -0,0 +1,72 @@
1
+ from __future__ import annotations
2
+
3
+ from collections.abc import Mapping
4
+ from typing import Any, TypeVar
5
+
6
+ from attrs import define as _attrs_define
7
+ from attrs import field as _attrs_field
8
+
9
+ from ..models.error_body_code import ErrorBodyCode
10
+
11
+ T = TypeVar("T", bound="ErrorBody")
12
+
13
+
14
+ @_attrs_define
15
+ class ErrorBody:
16
+ """The failure itself. `code` is stable; match on it, never on `message`.
17
+
18
+ Attributes:
19
+ code (ErrorBodyCode):
20
+ message (str):
21
+ """
22
+
23
+ code: ErrorBodyCode
24
+ message: str
25
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
26
+
27
+ def to_dict(self) -> dict[str, Any]:
28
+ code = self.code.value
29
+
30
+ message = self.message
31
+
32
+ field_dict: dict[str, Any] = {}
33
+ field_dict.update(self.additional_properties)
34
+ field_dict.update(
35
+ {
36
+ "code": code,
37
+ "message": message,
38
+ }
39
+ )
40
+
41
+ return field_dict
42
+
43
+ @classmethod
44
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
45
+ d = dict(src_dict)
46
+ code = ErrorBodyCode(d.pop("code"))
47
+
48
+ message = d.pop("message")
49
+
50
+ error_body = cls(
51
+ code=code,
52
+ message=message,
53
+ )
54
+
55
+ error_body.additional_properties = d
56
+ return error_body
57
+
58
+ @property
59
+ def additional_keys(self) -> list[str]:
60
+ return list(self.additional_properties.keys())
61
+
62
+ def __getitem__(self, key: str) -> Any:
63
+ return self.additional_properties[key]
64
+
65
+ def __setitem__(self, key: str, value: Any) -> None:
66
+ self.additional_properties[key] = value
67
+
68
+ def __delitem__(self, key: str) -> None:
69
+ del self.additional_properties[key]
70
+
71
+ def __contains__(self, key: str) -> bool:
72
+ return key in self.additional_properties
@@ -0,0 +1,22 @@
1
+ from enum import StrEnum
2
+
3
+
4
+ class ErrorBodyCode(StrEnum):
5
+ ACCESS_DENIED = "access_denied"
6
+ BAD_REQUEST = "bad_request"
7
+ BILLING_DISABLED = "billing_disabled"
8
+ INTERNAL = "internal"
9
+ INVALID_KEY = "invalid_key"
10
+ MISSING_KEY = "missing_key"
11
+ NOT_FOUND = "not_found"
12
+ NO_ACCOUNT = "no_account"
13
+ NO_CREDITS = "no_credits"
14
+ PRODUCT_UNAVAILABLE = "product_unavailable"
15
+ QUERY_ID_STALE = "query_id_stale"
16
+ RATE_LIMITED = "rate_limited"
17
+ REQUEST_REJECTED = "request_rejected"
18
+ UPSTREAM_ERROR = "upstream_error"
19
+ UPSTREAM_RATE_LIMITED = "upstream_rate_limited"
20
+
21
+ def __str__(self) -> str:
22
+ return str(self.value)
@@ -0,0 +1,88 @@
1
+ from __future__ import annotations
2
+
3
+ from collections.abc import Mapping
4
+ from typing import Any, TypeVar
5
+
6
+ from attrs import define as _attrs_define
7
+ from attrs import field as _attrs_field
8
+
9
+ from ..types import UNSET, Unset
10
+
11
+ T = TypeVar("T", bound="GetMeResponse200")
12
+
13
+
14
+ @_attrs_define
15
+ class GetMeResponse200:
16
+ """
17
+ Attributes:
18
+ customer_id (str | Unset):
19
+ key_prefix (str | Unset):
20
+ balance (float | Unset):
21
+ rate_limit_qps (int | Unset):
22
+ """
23
+
24
+ customer_id: str | Unset = UNSET
25
+ key_prefix: str | Unset = UNSET
26
+ balance: float | Unset = UNSET
27
+ rate_limit_qps: int | Unset = UNSET
28
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
29
+
30
+ def to_dict(self) -> dict[str, Any]:
31
+ customer_id = self.customer_id
32
+
33
+ key_prefix = self.key_prefix
34
+
35
+ balance = self.balance
36
+
37
+ rate_limit_qps = self.rate_limit_qps
38
+
39
+ field_dict: dict[str, Any] = {}
40
+ field_dict.update(self.additional_properties)
41
+ field_dict.update({})
42
+ if customer_id is not UNSET:
43
+ field_dict["customer_id"] = customer_id
44
+ if key_prefix is not UNSET:
45
+ field_dict["key_prefix"] = key_prefix
46
+ if balance is not UNSET:
47
+ field_dict["balance"] = balance
48
+ if rate_limit_qps is not UNSET:
49
+ field_dict["rate_limit_qps"] = rate_limit_qps
50
+
51
+ return field_dict
52
+
53
+ @classmethod
54
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
55
+ d = dict(src_dict)
56
+ customer_id = d.pop("customer_id", UNSET)
57
+
58
+ key_prefix = d.pop("key_prefix", UNSET)
59
+
60
+ balance = d.pop("balance", UNSET)
61
+
62
+ rate_limit_qps = d.pop("rate_limit_qps", UNSET)
63
+
64
+ get_me_response_200 = cls(
65
+ customer_id=customer_id,
66
+ key_prefix=key_prefix,
67
+ balance=balance,
68
+ rate_limit_qps=rate_limit_qps,
69
+ )
70
+
71
+ get_me_response_200.additional_properties = d
72
+ return get_me_response_200
73
+
74
+ @property
75
+ def additional_keys(self) -> list[str]:
76
+ return list(self.additional_properties.keys())
77
+
78
+ def __getitem__(self, key: str) -> Any:
79
+ return self.additional_properties[key]
80
+
81
+ def __setitem__(self, key: str, value: Any) -> None:
82
+ self.additional_properties[key] = value
83
+
84
+ def __delitem__(self, key: str) -> None:
85
+ del self.additional_properties[key]
86
+
87
+ def __contains__(self, key: str) -> bool:
88
+ return key in self.additional_properties
@@ -0,0 +1,61 @@
1
+ from __future__ import annotations
2
+
3
+ from collections.abc import Mapping
4
+ from typing import Any, TypeVar, cast
5
+
6
+ from attrs import define as _attrs_define
7
+ from attrs import field as _attrs_field
8
+
9
+ T = TypeVar("T", bound="GetTweetsBody")
10
+
11
+
12
+ @_attrs_define
13
+ class GetTweetsBody:
14
+ """
15
+ Attributes:
16
+ ids (list[str]): Example: ['20', '1968000000000000000'].
17
+ """
18
+
19
+ ids: list[str]
20
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
21
+
22
+ def to_dict(self) -> dict[str, Any]:
23
+ ids = self.ids
24
+
25
+ field_dict: dict[str, Any] = {}
26
+ field_dict.update(self.additional_properties)
27
+ field_dict.update(
28
+ {
29
+ "ids": ids,
30
+ }
31
+ )
32
+
33
+ return field_dict
34
+
35
+ @classmethod
36
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
37
+ d = dict(src_dict)
38
+ ids = cast(list[str], d.pop("ids"))
39
+
40
+ get_tweets_body = cls(
41
+ ids=ids,
42
+ )
43
+
44
+ get_tweets_body.additional_properties = d
45
+ return get_tweets_body
46
+
47
+ @property
48
+ def additional_keys(self) -> list[str]:
49
+ return list(self.additional_properties.keys())
50
+
51
+ def __getitem__(self, key: str) -> Any:
52
+ return self.additional_properties[key]
53
+
54
+ def __setitem__(self, key: str, value: Any) -> None:
55
+ self.additional_properties[key] = value
56
+
57
+ def __delitem__(self, key: str) -> None:
58
+ del self.additional_properties[key]
59
+
60
+ def __contains__(self, key: str) -> bool:
61
+ return key in self.additional_properties
@@ -0,0 +1,61 @@
1
+ from __future__ import annotations
2
+
3
+ from collections.abc import Mapping
4
+ from typing import Any, TypeVar, cast
5
+
6
+ from attrs import define as _attrs_define
7
+ from attrs import field as _attrs_field
8
+
9
+ T = TypeVar("T", bound="GetUsersBody")
10
+
11
+
12
+ @_attrs_define
13
+ class GetUsersBody:
14
+ """
15
+ Attributes:
16
+ handles (list[str]): Example: ['x', 'github', 'vercel'].
17
+ """
18
+
19
+ handles: list[str]
20
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
21
+
22
+ def to_dict(self) -> dict[str, Any]:
23
+ handles = self.handles
24
+
25
+ field_dict: dict[str, Any] = {}
26
+ field_dict.update(self.additional_properties)
27
+ field_dict.update(
28
+ {
29
+ "handles": handles,
30
+ }
31
+ )
32
+
33
+ return field_dict
34
+
35
+ @classmethod
36
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
37
+ d = dict(src_dict)
38
+ handles = cast(list[str], d.pop("handles"))
39
+
40
+ get_users_body = cls(
41
+ handles=handles,
42
+ )
43
+
44
+ get_users_body.additional_properties = d
45
+ return get_users_body
46
+
47
+ @property
48
+ def additional_keys(self) -> list[str]:
49
+ return list(self.additional_properties.keys())
50
+
51
+ def __getitem__(self, key: str) -> Any:
52
+ return self.additional_properties[key]
53
+
54
+ def __setitem__(self, key: str, value: Any) -> None:
55
+ self.additional_properties[key] = value
56
+
57
+ def __delitem__(self, key: str) -> None:
58
+ del self.additional_properties[key]
59
+
60
+ def __contains__(self, key: str) -> bool:
61
+ return key in self.additional_properties
@@ -0,0 +1,117 @@
1
+ from __future__ import annotations
2
+
3
+ from collections.abc import Mapping
4
+ from typing import Any, TypeVar, cast
5
+ from uuid import UUID
6
+
7
+ from attrs import define as _attrs_define
8
+ from attrs import field as _attrs_field
9
+
10
+ from ..models.meta_cache import MetaCache
11
+ from ..types import UNSET, Unset
12
+
13
+ T = TypeVar("T", bound="IdPage")
14
+
15
+
16
+ @_attrs_define
17
+ class IdPage:
18
+ """
19
+ Attributes:
20
+ items (int): Objects returned.
21
+ credits_charged (float): Example: 20.
22
+ balance_remaining (float): Example: 79980.
23
+ cache (MetaCache):
24
+ request_id (UUID):
25
+ next_cursor (str | Unset):
26
+ data (list[str] | Unset): Numeric user ids as strings.
27
+ """
28
+
29
+ items: int
30
+ credits_charged: float
31
+ balance_remaining: float
32
+ cache: MetaCache
33
+ request_id: UUID
34
+ next_cursor: str | Unset = UNSET
35
+ data: list[str] | Unset = UNSET
36
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
37
+
38
+ def to_dict(self) -> dict[str, Any]:
39
+ items = self.items
40
+
41
+ credits_charged = self.credits_charged
42
+
43
+ balance_remaining = self.balance_remaining
44
+
45
+ cache = self.cache.value
46
+
47
+ request_id = str(self.request_id)
48
+
49
+ next_cursor = self.next_cursor
50
+
51
+ data: list[str] | Unset = UNSET
52
+ if not isinstance(self.data, Unset):
53
+ data = self.data
54
+
55
+ field_dict: dict[str, Any] = {}
56
+ field_dict.update(self.additional_properties)
57
+ field_dict.update(
58
+ {
59
+ "items": items,
60
+ "credits_charged": credits_charged,
61
+ "balance_remaining": balance_remaining,
62
+ "cache": cache,
63
+ "request_id": request_id,
64
+ }
65
+ )
66
+ if next_cursor is not UNSET:
67
+ field_dict["next_cursor"] = next_cursor
68
+ if data is not UNSET:
69
+ field_dict["data"] = data
70
+
71
+ return field_dict
72
+
73
+ @classmethod
74
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
75
+ d = dict(src_dict)
76
+ items = d.pop("items")
77
+
78
+ credits_charged = d.pop("credits_charged")
79
+
80
+ balance_remaining = d.pop("balance_remaining")
81
+
82
+ cache = MetaCache(d.pop("cache"))
83
+
84
+ request_id = UUID(d.pop("request_id"))
85
+
86
+ next_cursor = d.pop("next_cursor", UNSET)
87
+
88
+ data = cast(list[str], d.pop("data", UNSET))
89
+
90
+ id_page = cls(
91
+ items=items,
92
+ credits_charged=credits_charged,
93
+ balance_remaining=balance_remaining,
94
+ cache=cache,
95
+ request_id=request_id,
96
+ next_cursor=next_cursor,
97
+ data=data,
98
+ )
99
+
100
+ id_page.additional_properties = d
101
+ return id_page
102
+
103
+ @property
104
+ def additional_keys(self) -> list[str]:
105
+ return list(self.additional_properties.keys())
106
+
107
+ def __getitem__(self, key: str) -> Any:
108
+ return self.additional_properties[key]
109
+
110
+ def __setitem__(self, key: str, value: Any) -> None:
111
+ self.additional_properties[key] = value
112
+
113
+ def __delitem__(self, key: str) -> None:
114
+ del self.additional_properties[key]
115
+
116
+ def __contains__(self, key: str) -> bool:
117
+ return key in self.additional_properties
@@ -0,0 +1,105 @@
1
+ from __future__ import annotations
2
+
3
+ from collections.abc import Mapping
4
+ from typing import TYPE_CHECKING, Any, TypeVar
5
+
6
+ from attrs import define as _attrs_define
7
+ from attrs import field as _attrs_field
8
+
9
+ from ..types import UNSET, Unset
10
+
11
+ if TYPE_CHECKING:
12
+ from ..models.list_packs_response_200_data_item import ListPacksResponse200DataItem
13
+ from ..models.list_packs_response_200_rate_limits_item import ListPacksResponse200RateLimitsItem
14
+
15
+
16
+ T = TypeVar("T", bound="ListPacksResponse200")
17
+
18
+
19
+ @_attrs_define
20
+ class ListPacksResponse200:
21
+ """
22
+ Attributes:
23
+ data (list[ListPacksResponse200DataItem] | Unset):
24
+ rate_limits (list[ListPacksResponse200RateLimitsItem] | Unset): Requests per second by the total paid over the
25
+ account's life. The limit only goes up.
26
+ """
27
+
28
+ data: list[ListPacksResponse200DataItem] | Unset = UNSET
29
+ rate_limits: list[ListPacksResponse200RateLimitsItem] | Unset = UNSET
30
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
31
+
32
+ def to_dict(self) -> dict[str, Any]:
33
+ data: list[dict[str, Any]] | Unset = UNSET
34
+ if not isinstance(self.data, Unset):
35
+ data = []
36
+ for data_item_data in self.data:
37
+ data_item = data_item_data.to_dict()
38
+ data.append(data_item)
39
+
40
+ rate_limits: list[dict[str, Any]] | Unset = UNSET
41
+ if not isinstance(self.rate_limits, Unset):
42
+ rate_limits = []
43
+ for rate_limits_item_data in self.rate_limits:
44
+ rate_limits_item = rate_limits_item_data.to_dict()
45
+ rate_limits.append(rate_limits_item)
46
+
47
+ field_dict: dict[str, Any] = {}
48
+ field_dict.update(self.additional_properties)
49
+ field_dict.update({})
50
+ if data is not UNSET:
51
+ field_dict["data"] = data
52
+ if rate_limits is not UNSET:
53
+ field_dict["rate_limits"] = rate_limits
54
+
55
+ return field_dict
56
+
57
+ @classmethod
58
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
59
+ from ..models.list_packs_response_200_data_item import ListPacksResponse200DataItem # noqa: PLC0415
60
+ from ..models.list_packs_response_200_rate_limits_item import (
61
+ ListPacksResponse200RateLimitsItem, # noqa: PLC0415
62
+ )
63
+
64
+ d = dict(src_dict)
65
+ _data = d.pop("data", UNSET)
66
+ data: list[ListPacksResponse200DataItem] | Unset = UNSET
67
+ if _data is not UNSET:
68
+ data = []
69
+ for data_item_data in _data:
70
+ data_item = ListPacksResponse200DataItem.from_dict(data_item_data)
71
+
72
+ data.append(data_item)
73
+
74
+ _rate_limits = d.pop("rate_limits", UNSET)
75
+ rate_limits: list[ListPacksResponse200RateLimitsItem] | Unset = UNSET
76
+ if _rate_limits is not UNSET:
77
+ rate_limits = []
78
+ for rate_limits_item_data in _rate_limits:
79
+ rate_limits_item = ListPacksResponse200RateLimitsItem.from_dict(rate_limits_item_data)
80
+
81
+ rate_limits.append(rate_limits_item)
82
+
83
+ list_packs_response_200 = cls(
84
+ data=data,
85
+ rate_limits=rate_limits,
86
+ )
87
+
88
+ list_packs_response_200.additional_properties = d
89
+ return list_packs_response_200
90
+
91
+ @property
92
+ def additional_keys(self) -> list[str]:
93
+ return list(self.additional_properties.keys())
94
+
95
+ def __getitem__(self, key: str) -> Any:
96
+ return self.additional_properties[key]
97
+
98
+ def __setitem__(self, key: str, value: Any) -> None:
99
+ self.additional_properties[key] = value
100
+
101
+ def __delitem__(self, key: str) -> None:
102
+ del self.additional_properties[key]
103
+
104
+ def __contains__(self, key: str) -> bool:
105
+ return key in self.additional_properties