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,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="ListPacksResponse200DataItem")
12
+
13
+
14
+ @_attrs_define
15
+ class ListPacksResponse200DataItem:
16
+ """
17
+ Attributes:
18
+ name (str | Unset): Example: starter.
19
+ usd (int | Unset): Example: 10.
20
+ credits_ (int | Unset): Example: 80000.
21
+ buyable (bool | Unset):
22
+ """
23
+
24
+ name: str | Unset = UNSET
25
+ usd: int | Unset = UNSET
26
+ credits_: int | Unset = UNSET
27
+ buyable: bool | Unset = UNSET
28
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
29
+
30
+ def to_dict(self) -> dict[str, Any]:
31
+ name = self.name
32
+
33
+ usd = self.usd
34
+
35
+ credits_ = self.credits_
36
+
37
+ buyable = self.buyable
38
+
39
+ field_dict: dict[str, Any] = {}
40
+ field_dict.update(self.additional_properties)
41
+ field_dict.update({})
42
+ if name is not UNSET:
43
+ field_dict["name"] = name
44
+ if usd is not UNSET:
45
+ field_dict["usd"] = usd
46
+ if credits_ is not UNSET:
47
+ field_dict["credits"] = credits_
48
+ if buyable is not UNSET:
49
+ field_dict["buyable"] = buyable
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
+ name = d.pop("name", UNSET)
57
+
58
+ usd = d.pop("usd", UNSET)
59
+
60
+ credits_ = d.pop("credits", UNSET)
61
+
62
+ buyable = d.pop("buyable", UNSET)
63
+
64
+ list_packs_response_200_data_item = cls(
65
+ name=name,
66
+ usd=usd,
67
+ credits_=credits_,
68
+ buyable=buyable,
69
+ )
70
+
71
+ list_packs_response_200_data_item.additional_properties = d
72
+ return list_packs_response_200_data_item
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,70 @@
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="ListPacksResponse200RateLimitsItem")
12
+
13
+
14
+ @_attrs_define
15
+ class ListPacksResponse200RateLimitsItem:
16
+ """
17
+ Attributes:
18
+ paid_usd (int | Unset): Example: 10.
19
+ requests_per_second (int | Unset): Example: 20.
20
+ """
21
+
22
+ paid_usd: int | Unset = UNSET
23
+ requests_per_second: int | Unset = UNSET
24
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
25
+
26
+ def to_dict(self) -> dict[str, Any]:
27
+ paid_usd = self.paid_usd
28
+
29
+ requests_per_second = self.requests_per_second
30
+
31
+ field_dict: dict[str, Any] = {}
32
+ field_dict.update(self.additional_properties)
33
+ field_dict.update({})
34
+ if paid_usd is not UNSET:
35
+ field_dict["paid_usd"] = paid_usd
36
+ if requests_per_second is not UNSET:
37
+ field_dict["requests_per_second"] = requests_per_second
38
+
39
+ return field_dict
40
+
41
+ @classmethod
42
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
43
+ d = dict(src_dict)
44
+ paid_usd = d.pop("paid_usd", UNSET)
45
+
46
+ requests_per_second = d.pop("requests_per_second", UNSET)
47
+
48
+ list_packs_response_200_rate_limits_item = cls(
49
+ paid_usd=paid_usd,
50
+ requests_per_second=requests_per_second,
51
+ )
52
+
53
+ list_packs_response_200_rate_limits_item.additional_properties = d
54
+ return list_packs_response_200_rate_limits_item
55
+
56
+ @property
57
+ def additional_keys(self) -> list[str]:
58
+ return list(self.additional_properties.keys())
59
+
60
+ def __getitem__(self, key: str) -> Any:
61
+ return self.additional_properties[key]
62
+
63
+ def __setitem__(self, key: str, value: Any) -> None:
64
+ self.additional_properties[key] = value
65
+
66
+ def __delitem__(self, key: str) -> None:
67
+ del self.additional_properties[key]
68
+
69
+ def __contains__(self, key: str) -> bool:
70
+ return key in self.additional_properties
@@ -0,0 +1,96 @@
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.media_type import MediaType
10
+ from ..types import UNSET, Unset
11
+
12
+ T = TypeVar("T", bound="Media")
13
+
14
+
15
+ @_attrs_define
16
+ class Media:
17
+ """
18
+ Attributes:
19
+ type_ (MediaType | Unset):
20
+ url (str | Unset):
21
+ width (int | Unset):
22
+ height (int | Unset):
23
+ """
24
+
25
+ type_: MediaType | Unset = UNSET
26
+ url: str | Unset = UNSET
27
+ width: int | Unset = UNSET
28
+ height: int | Unset = UNSET
29
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
30
+
31
+ def to_dict(self) -> dict[str, Any]:
32
+ type_: str | Unset = UNSET
33
+ if not isinstance(self.type_, Unset):
34
+ type_ = self.type_.value
35
+
36
+ url = self.url
37
+
38
+ width = self.width
39
+
40
+ height = self.height
41
+
42
+ field_dict: dict[str, Any] = {}
43
+ field_dict.update(self.additional_properties)
44
+ field_dict.update({})
45
+ if type_ is not UNSET:
46
+ field_dict["type"] = type_
47
+ if url is not UNSET:
48
+ field_dict["url"] = url
49
+ if width is not UNSET:
50
+ field_dict["width"] = width
51
+ if height is not UNSET:
52
+ field_dict["height"] = height
53
+
54
+ return field_dict
55
+
56
+ @classmethod
57
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
58
+ d = dict(src_dict)
59
+ _type_ = d.pop("type", UNSET)
60
+ type_: MediaType | Unset
61
+ if isinstance(_type_, Unset):
62
+ type_ = UNSET
63
+ else:
64
+ type_ = MediaType(_type_)
65
+
66
+ url = d.pop("url", UNSET)
67
+
68
+ width = d.pop("width", UNSET)
69
+
70
+ height = d.pop("height", UNSET)
71
+
72
+ media = cls(
73
+ type_=type_,
74
+ url=url,
75
+ width=width,
76
+ height=height,
77
+ )
78
+
79
+ media.additional_properties = d
80
+ return media
81
+
82
+ @property
83
+ def additional_keys(self) -> list[str]:
84
+ return list(self.additional_properties.keys())
85
+
86
+ def __getitem__(self, key: str) -> Any:
87
+ return self.additional_properties[key]
88
+
89
+ def __setitem__(self, key: str, value: Any) -> None:
90
+ self.additional_properties[key] = value
91
+
92
+ def __delitem__(self, key: str) -> None:
93
+ del self.additional_properties[key]
94
+
95
+ def __contains__(self, key: str) -> bool:
96
+ return key in self.additional_properties
@@ -0,0 +1,10 @@
1
+ from enum import StrEnum
2
+
3
+
4
+ class MediaType(StrEnum):
5
+ ANIMATED_GIF = "animated_gif"
6
+ PHOTO = "photo"
7
+ VIDEO = "video"
8
+
9
+ def __str__(self) -> str:
10
+ return str(self.value)
@@ -0,0 +1,106 @@
1
+ from __future__ import annotations
2
+
3
+ from collections.abc import Mapping
4
+ from typing import Any, TypeVar
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="Meta")
14
+
15
+
16
+ @_attrs_define
17
+ class Meta:
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
+ """
27
+
28
+ items: int
29
+ credits_charged: float
30
+ balance_remaining: float
31
+ cache: MetaCache
32
+ request_id: UUID
33
+ next_cursor: str | Unset = UNSET
34
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
35
+
36
+ def to_dict(self) -> dict[str, Any]:
37
+ items = self.items
38
+
39
+ credits_charged = self.credits_charged
40
+
41
+ balance_remaining = self.balance_remaining
42
+
43
+ cache = self.cache.value
44
+
45
+ request_id = str(self.request_id)
46
+
47
+ next_cursor = self.next_cursor
48
+
49
+ field_dict: dict[str, Any] = {}
50
+ field_dict.update(self.additional_properties)
51
+ field_dict.update(
52
+ {
53
+ "items": items,
54
+ "credits_charged": credits_charged,
55
+ "balance_remaining": balance_remaining,
56
+ "cache": cache,
57
+ "request_id": request_id,
58
+ }
59
+ )
60
+ if next_cursor is not UNSET:
61
+ field_dict["next_cursor"] = next_cursor
62
+
63
+ return field_dict
64
+
65
+ @classmethod
66
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
67
+ d = dict(src_dict)
68
+ items = d.pop("items")
69
+
70
+ credits_charged = d.pop("credits_charged")
71
+
72
+ balance_remaining = d.pop("balance_remaining")
73
+
74
+ cache = MetaCache(d.pop("cache"))
75
+
76
+ request_id = UUID(d.pop("request_id"))
77
+
78
+ next_cursor = d.pop("next_cursor", UNSET)
79
+
80
+ meta = cls(
81
+ items=items,
82
+ credits_charged=credits_charged,
83
+ balance_remaining=balance_remaining,
84
+ cache=cache,
85
+ request_id=request_id,
86
+ next_cursor=next_cursor,
87
+ )
88
+
89
+ meta.additional_properties = d
90
+ return meta
91
+
92
+ @property
93
+ def additional_keys(self) -> list[str]:
94
+ return list(self.additional_properties.keys())
95
+
96
+ def __getitem__(self, key: str) -> Any:
97
+ return self.additional_properties[key]
98
+
99
+ def __setitem__(self, key: str, value: Any) -> None:
100
+ self.additional_properties[key] = value
101
+
102
+ def __delitem__(self, key: str) -> None:
103
+ del self.additional_properties[key]
104
+
105
+ def __contains__(self, key: str) -> bool:
106
+ return key in self.additional_properties
@@ -0,0 +1,10 @@
1
+ from enum import StrEnum
2
+
3
+
4
+ class MetaCache(StrEnum):
5
+ BYPASS = "bypass"
6
+ HIT = "hit"
7
+ MISS = "miss"
8
+
9
+ def __str__(self) -> str:
10
+ return str(self.value)
@@ -0,0 +1,131 @@
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.error_body import ErrorBody
13
+
14
+
15
+ T = TypeVar("T", bound="Problem")
16
+
17
+
18
+ @_attrs_define
19
+ class Problem:
20
+ """RFC 9457 view of the same failure, served when the caller sends
21
+ `Accept: application/problem+json`. Nothing new is reported — `type`, `title`,
22
+ `status` and `detail` are the registered names for what `error.code` and
23
+ `error.message` already said, so a generic client can read a failure it has no
24
+ specific handling for.
25
+
26
+ Attributes:
27
+ type_ (str): A page describing this error code. Example: https://xdataapi.io/docs/errors#no_credits.
28
+ title (str): Example: Balance is zero.
29
+ status (int): Example: 402.
30
+ code (str): The same value as `error.code`. Stable; match on this, not on the text.
31
+ request_id (str):
32
+ detail (str | Unset): The same text as `error.message`.
33
+ error (ErrorBody | Unset): The failure itself. `code` is stable; match on it, never on `message`.
34
+ """
35
+
36
+ type_: str
37
+ title: str
38
+ status: int
39
+ code: str
40
+ request_id: str
41
+ detail: str | Unset = UNSET
42
+ error: ErrorBody | Unset = UNSET
43
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
44
+
45
+ def to_dict(self) -> dict[str, Any]:
46
+ type_ = self.type_
47
+
48
+ title = self.title
49
+
50
+ status = self.status
51
+
52
+ code = self.code
53
+
54
+ request_id = self.request_id
55
+
56
+ detail = self.detail
57
+
58
+ error: dict[str, Any] | Unset = UNSET
59
+ if not isinstance(self.error, Unset):
60
+ error = self.error.to_dict()
61
+
62
+ field_dict: dict[str, Any] = {}
63
+ field_dict.update(self.additional_properties)
64
+ field_dict.update(
65
+ {
66
+ "type": type_,
67
+ "title": title,
68
+ "status": status,
69
+ "code": code,
70
+ "request_id": request_id,
71
+ }
72
+ )
73
+ if detail is not UNSET:
74
+ field_dict["detail"] = detail
75
+ if error is not UNSET:
76
+ field_dict["error"] = error
77
+
78
+ return field_dict
79
+
80
+ @classmethod
81
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
82
+ from ..models.error_body import ErrorBody # noqa: PLC0415
83
+
84
+ d = dict(src_dict)
85
+ type_ = d.pop("type")
86
+
87
+ title = d.pop("title")
88
+
89
+ status = d.pop("status")
90
+
91
+ code = d.pop("code")
92
+
93
+ request_id = d.pop("request_id")
94
+
95
+ detail = d.pop("detail", UNSET)
96
+
97
+ _error = d.pop("error", UNSET)
98
+ error: ErrorBody | Unset
99
+ if isinstance(_error, Unset):
100
+ error = UNSET
101
+ else:
102
+ error = ErrorBody.from_dict(_error)
103
+
104
+ problem = cls(
105
+ type_=type_,
106
+ title=title,
107
+ status=status,
108
+ code=code,
109
+ request_id=request_id,
110
+ detail=detail,
111
+ error=error,
112
+ )
113
+
114
+ problem.additional_properties = d
115
+ return problem
116
+
117
+ @property
118
+ def additional_keys(self) -> list[str]:
119
+ return list(self.additional_properties.keys())
120
+
121
+ def __getitem__(self, key: str) -> Any:
122
+ return self.additional_properties[key]
123
+
124
+ def __setitem__(self, key: str, value: Any) -> None:
125
+ self.additional_properties[key] = value
126
+
127
+ def __delitem__(self, key: str) -> None:
128
+ del self.additional_properties[key]
129
+
130
+ def __contains__(self, key: str) -> bool:
131
+ return key in self.additional_properties
@@ -0,0 +1,12 @@
1
+ from enum import StrEnum
2
+
3
+
4
+ class SearchTweetsProduct(StrEnum):
5
+ LATEST = "Latest"
6
+ PEOPLE = "People"
7
+ PHOTOS = "Photos"
8
+ TOP = "Top"
9
+ VIDEOS = "Videos"
10
+
11
+ def __str__(self) -> str:
12
+ return str(self.value)