tweetapi-sdk 0.1.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.
- tweetapi_sdk/__init__.py +8 -0
- tweetapi_sdk/api/__init__.py +1 -0
- tweetapi_sdk/api/account/__init__.py +1 -0
- tweetapi_sdk/api/account/get_me.py +134 -0
- tweetapi_sdk/api/billing/__init__.py +1 -0
- tweetapi_sdk/api/billing/create_checkout.py +187 -0
- tweetapi_sdk/api/billing/list_packs.py +126 -0
- tweetapi_sdk/api/tweets/__init__.py +1 -0
- tweetapi_sdk/api/tweets/get_likers.py +230 -0
- tweetapi_sdk/api/tweets/get_quotes.py +226 -0
- tweetapi_sdk/api/tweets/get_replies.py +215 -0
- tweetapi_sdk/api/tweets/get_retweeters.py +230 -0
- tweetapi_sdk/api/tweets/get_thread.py +211 -0
- tweetapi_sdk/api/tweets/get_tweet.py +198 -0
- tweetapi_sdk/api/tweets/get_tweets.py +208 -0
- tweetapi_sdk/api/tweets/search_tweets.py +267 -0
- tweetapi_sdk/api/users/__init__.py +1 -0
- tweetapi_sdk/api/users/get_followers.py +239 -0
- tweetapi_sdk/api/users/get_following.py +231 -0
- tweetapi_sdk/api/users/get_user.py +198 -0
- tweetapi_sdk/api/users/get_user_tweets.py +226 -0
- tweetapi_sdk/api/users/get_users.py +216 -0
- tweetapi_sdk/client.py +268 -0
- tweetapi_sdk/errors.py +16 -0
- tweetapi_sdk/models/__init__.py +61 -0
- tweetapi_sdk/models/batch_error.py +79 -0
- tweetapi_sdk/models/batch_error_code.py +15 -0
- tweetapi_sdk/models/batch_meta.py +126 -0
- tweetapi_sdk/models/batch_meta_cache.py +11 -0
- tweetapi_sdk/models/create_checkout_body.py +63 -0
- tweetapi_sdk/models/create_checkout_body_pack.py +11 -0
- tweetapi_sdk/models/create_checkout_response_200.py +97 -0
- tweetapi_sdk/models/error.py +75 -0
- tweetapi_sdk/models/error_error.py +71 -0
- tweetapi_sdk/models/error_error_code.py +22 -0
- tweetapi_sdk/models/get_me_response_200.py +88 -0
- tweetapi_sdk/models/get_tweets_body.py +61 -0
- tweetapi_sdk/models/get_users_body.py +61 -0
- tweetapi_sdk/models/list_packs_response_200.py +79 -0
- tweetapi_sdk/models/list_packs_response_200_data_item.py +97 -0
- tweetapi_sdk/models/media.py +96 -0
- tweetapi_sdk/models/media_type.py +10 -0
- tweetapi_sdk/models/meta.py +106 -0
- tweetapi_sdk/models/meta_cache.py +10 -0
- tweetapi_sdk/models/search_tweets_product.py +12 -0
- tweetapi_sdk/models/tweet.py +310 -0
- tweetapi_sdk/models/tweet_batch.py +150 -0
- tweetapi_sdk/models/tweet_page.py +133 -0
- tweetapi_sdk/models/tweet_response.py +128 -0
- tweetapi_sdk/models/user.py +204 -0
- tweetapi_sdk/models/user_batch.py +150 -0
- tweetapi_sdk/models/user_page.py +133 -0
- tweetapi_sdk/models/user_response.py +128 -0
- tweetapi_sdk/py.typed +1 -0
- tweetapi_sdk/types.py +54 -0
- tweetapi_sdk-0.1.0.dist-info/METADATA +138 -0
- tweetapi_sdk-0.1.0.dist-info/RECORD +58 -0
- tweetapi_sdk-0.1.0.dist-info/WHEEL +4 -0
tweetapi_sdk/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Contains methods for accessing the API"""
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Contains endpoint functions for accessing the API"""
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any
|
|
3
|
+
|
|
4
|
+
import httpx
|
|
5
|
+
|
|
6
|
+
from ... import errors
|
|
7
|
+
from ...client import AuthenticatedClient, Client
|
|
8
|
+
from ...models.error import Error
|
|
9
|
+
from ...models.get_me_response_200 import GetMeResponse200
|
|
10
|
+
from ...types import Response
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def _get_kwargs() -> dict[str, Any]:
|
|
14
|
+
|
|
15
|
+
_kwargs: dict[str, Any] = {
|
|
16
|
+
"method": "get",
|
|
17
|
+
"url": "/v1/me",
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return _kwargs
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def _parse_response(
|
|
24
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
25
|
+
) -> Error | GetMeResponse200 | None:
|
|
26
|
+
if response.status_code == 200:
|
|
27
|
+
response_200 = GetMeResponse200.from_dict(response.json())
|
|
28
|
+
|
|
29
|
+
return response_200
|
|
30
|
+
|
|
31
|
+
if response.status_code == 401:
|
|
32
|
+
response_401 = Error.from_dict(response.json())
|
|
33
|
+
|
|
34
|
+
return response_401
|
|
35
|
+
|
|
36
|
+
if client.raise_on_unexpected_status:
|
|
37
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
38
|
+
else:
|
|
39
|
+
return None
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def _build_response(
|
|
43
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
44
|
+
) -> Response[Error | GetMeResponse200]:
|
|
45
|
+
return Response(
|
|
46
|
+
status_code=HTTPStatus(response.status_code),
|
|
47
|
+
content=response.content,
|
|
48
|
+
headers=response.headers,
|
|
49
|
+
parsed=_parse_response(client=client, response=response),
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def sync_detailed(
|
|
54
|
+
*,
|
|
55
|
+
client: AuthenticatedClient | Client,
|
|
56
|
+
) -> Response[Error | GetMeResponse200]:
|
|
57
|
+
"""Key, balance and rate limit
|
|
58
|
+
|
|
59
|
+
Raises:
|
|
60
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
61
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
62
|
+
|
|
63
|
+
Returns:
|
|
64
|
+
Response[Error | GetMeResponse200]
|
|
65
|
+
"""
|
|
66
|
+
|
|
67
|
+
kwargs = _get_kwargs()
|
|
68
|
+
|
|
69
|
+
response = client.get_httpx_client().request(
|
|
70
|
+
**kwargs,
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
return _build_response(client=client, response=response)
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
def sync(
|
|
77
|
+
*,
|
|
78
|
+
client: AuthenticatedClient | Client,
|
|
79
|
+
) -> Error | GetMeResponse200 | None:
|
|
80
|
+
"""Key, balance and rate limit
|
|
81
|
+
|
|
82
|
+
Raises:
|
|
83
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
84
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
85
|
+
|
|
86
|
+
Returns:
|
|
87
|
+
Error | GetMeResponse200
|
|
88
|
+
"""
|
|
89
|
+
|
|
90
|
+
return sync_detailed(
|
|
91
|
+
client=client,
|
|
92
|
+
).parsed
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
async def asyncio_detailed(
|
|
96
|
+
*,
|
|
97
|
+
client: AuthenticatedClient | Client,
|
|
98
|
+
) -> Response[Error | GetMeResponse200]:
|
|
99
|
+
"""Key, balance and rate limit
|
|
100
|
+
|
|
101
|
+
Raises:
|
|
102
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
103
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
104
|
+
|
|
105
|
+
Returns:
|
|
106
|
+
Response[Error | GetMeResponse200]
|
|
107
|
+
"""
|
|
108
|
+
|
|
109
|
+
kwargs = _get_kwargs()
|
|
110
|
+
|
|
111
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
112
|
+
|
|
113
|
+
return _build_response(client=client, response=response)
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
async def asyncio(
|
|
117
|
+
*,
|
|
118
|
+
client: AuthenticatedClient | Client,
|
|
119
|
+
) -> Error | GetMeResponse200 | None:
|
|
120
|
+
"""Key, balance and rate limit
|
|
121
|
+
|
|
122
|
+
Raises:
|
|
123
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
124
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
125
|
+
|
|
126
|
+
Returns:
|
|
127
|
+
Error | GetMeResponse200
|
|
128
|
+
"""
|
|
129
|
+
|
|
130
|
+
return (
|
|
131
|
+
await asyncio_detailed(
|
|
132
|
+
client=client,
|
|
133
|
+
)
|
|
134
|
+
).parsed
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Contains endpoint functions for accessing the API"""
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any
|
|
3
|
+
|
|
4
|
+
import httpx
|
|
5
|
+
|
|
6
|
+
from ... import errors
|
|
7
|
+
from ...client import AuthenticatedClient, Client
|
|
8
|
+
from ...models.create_checkout_body import CreateCheckoutBody
|
|
9
|
+
from ...models.create_checkout_response_200 import CreateCheckoutResponse200
|
|
10
|
+
from ...models.error import Error
|
|
11
|
+
from ...types import Response
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def _get_kwargs(
|
|
15
|
+
*,
|
|
16
|
+
body: CreateCheckoutBody,
|
|
17
|
+
) -> dict[str, Any]:
|
|
18
|
+
headers: dict[str, Any] = {}
|
|
19
|
+
|
|
20
|
+
_kwargs: dict[str, Any] = {
|
|
21
|
+
"method": "post",
|
|
22
|
+
"url": "/v1/billing/checkout",
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
_kwargs["json"] = body.to_dict()
|
|
26
|
+
|
|
27
|
+
headers["Content-Type"] = "application/json"
|
|
28
|
+
|
|
29
|
+
_kwargs["headers"] = headers
|
|
30
|
+
return _kwargs
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def _parse_response(
|
|
34
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
35
|
+
) -> CreateCheckoutResponse200 | Error | None:
|
|
36
|
+
if response.status_code == 200:
|
|
37
|
+
response_200 = CreateCheckoutResponse200.from_dict(response.json())
|
|
38
|
+
|
|
39
|
+
return response_200
|
|
40
|
+
|
|
41
|
+
if response.status_code == 400:
|
|
42
|
+
response_400 = Error.from_dict(response.json())
|
|
43
|
+
|
|
44
|
+
return response_400
|
|
45
|
+
|
|
46
|
+
if response.status_code == 503:
|
|
47
|
+
response_503 = Error.from_dict(response.json())
|
|
48
|
+
|
|
49
|
+
return response_503
|
|
50
|
+
|
|
51
|
+
if client.raise_on_unexpected_status:
|
|
52
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
53
|
+
else:
|
|
54
|
+
return None
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def _build_response(
|
|
58
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
59
|
+
) -> Response[CreateCheckoutResponse200 | Error]:
|
|
60
|
+
return Response(
|
|
61
|
+
status_code=HTTPStatus(response.status_code),
|
|
62
|
+
content=response.content,
|
|
63
|
+
headers=response.headers,
|
|
64
|
+
parsed=_parse_response(client=client, response=response),
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def sync_detailed(
|
|
69
|
+
*,
|
|
70
|
+
client: AuthenticatedClient | Client,
|
|
71
|
+
body: CreateCheckoutBody,
|
|
72
|
+
) -> Response[CreateCheckoutResponse200 | Error]:
|
|
73
|
+
"""Buy a credit pack
|
|
74
|
+
|
|
75
|
+
Returns a Stripe Checkout URL. Open it in a browser; after payment the credits land in the wallet of
|
|
76
|
+
the
|
|
77
|
+
key's account within seconds and the rate limit rises to the pack's. Credits are valid 12 months.
|
|
78
|
+
|
|
79
|
+
Args:
|
|
80
|
+
body (CreateCheckoutBody):
|
|
81
|
+
|
|
82
|
+
Raises:
|
|
83
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
84
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
85
|
+
|
|
86
|
+
Returns:
|
|
87
|
+
Response[CreateCheckoutResponse200 | Error]
|
|
88
|
+
"""
|
|
89
|
+
|
|
90
|
+
kwargs = _get_kwargs(
|
|
91
|
+
body=body,
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
response = client.get_httpx_client().request(
|
|
95
|
+
**kwargs,
|
|
96
|
+
)
|
|
97
|
+
|
|
98
|
+
return _build_response(client=client, response=response)
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
def sync(
|
|
102
|
+
*,
|
|
103
|
+
client: AuthenticatedClient | Client,
|
|
104
|
+
body: CreateCheckoutBody,
|
|
105
|
+
) -> CreateCheckoutResponse200 | Error | None:
|
|
106
|
+
"""Buy a credit pack
|
|
107
|
+
|
|
108
|
+
Returns a Stripe Checkout URL. Open it in a browser; after payment the credits land in the wallet of
|
|
109
|
+
the
|
|
110
|
+
key's account within seconds and the rate limit rises to the pack's. Credits are valid 12 months.
|
|
111
|
+
|
|
112
|
+
Args:
|
|
113
|
+
body (CreateCheckoutBody):
|
|
114
|
+
|
|
115
|
+
Raises:
|
|
116
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
117
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
118
|
+
|
|
119
|
+
Returns:
|
|
120
|
+
CreateCheckoutResponse200 | Error
|
|
121
|
+
"""
|
|
122
|
+
|
|
123
|
+
return sync_detailed(
|
|
124
|
+
client=client,
|
|
125
|
+
body=body,
|
|
126
|
+
).parsed
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
async def asyncio_detailed(
|
|
130
|
+
*,
|
|
131
|
+
client: AuthenticatedClient | Client,
|
|
132
|
+
body: CreateCheckoutBody,
|
|
133
|
+
) -> Response[CreateCheckoutResponse200 | Error]:
|
|
134
|
+
"""Buy a credit pack
|
|
135
|
+
|
|
136
|
+
Returns a Stripe Checkout URL. Open it in a browser; after payment the credits land in the wallet of
|
|
137
|
+
the
|
|
138
|
+
key's account within seconds and the rate limit rises to the pack's. Credits are valid 12 months.
|
|
139
|
+
|
|
140
|
+
Args:
|
|
141
|
+
body (CreateCheckoutBody):
|
|
142
|
+
|
|
143
|
+
Raises:
|
|
144
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
145
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
146
|
+
|
|
147
|
+
Returns:
|
|
148
|
+
Response[CreateCheckoutResponse200 | Error]
|
|
149
|
+
"""
|
|
150
|
+
|
|
151
|
+
kwargs = _get_kwargs(
|
|
152
|
+
body=body,
|
|
153
|
+
)
|
|
154
|
+
|
|
155
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
156
|
+
|
|
157
|
+
return _build_response(client=client, response=response)
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
async def asyncio(
|
|
161
|
+
*,
|
|
162
|
+
client: AuthenticatedClient | Client,
|
|
163
|
+
body: CreateCheckoutBody,
|
|
164
|
+
) -> CreateCheckoutResponse200 | Error | None:
|
|
165
|
+
"""Buy a credit pack
|
|
166
|
+
|
|
167
|
+
Returns a Stripe Checkout URL. Open it in a browser; after payment the credits land in the wallet of
|
|
168
|
+
the
|
|
169
|
+
key's account within seconds and the rate limit rises to the pack's. Credits are valid 12 months.
|
|
170
|
+
|
|
171
|
+
Args:
|
|
172
|
+
body (CreateCheckoutBody):
|
|
173
|
+
|
|
174
|
+
Raises:
|
|
175
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
176
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
177
|
+
|
|
178
|
+
Returns:
|
|
179
|
+
CreateCheckoutResponse200 | Error
|
|
180
|
+
"""
|
|
181
|
+
|
|
182
|
+
return (
|
|
183
|
+
await asyncio_detailed(
|
|
184
|
+
client=client,
|
|
185
|
+
body=body,
|
|
186
|
+
)
|
|
187
|
+
).parsed
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any
|
|
3
|
+
|
|
4
|
+
import httpx
|
|
5
|
+
|
|
6
|
+
from ... import errors
|
|
7
|
+
from ...client import AuthenticatedClient, Client
|
|
8
|
+
from ...models.list_packs_response_200 import ListPacksResponse200
|
|
9
|
+
from ...types import Response
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def _get_kwargs() -> dict[str, Any]:
|
|
13
|
+
|
|
14
|
+
_kwargs: dict[str, Any] = {
|
|
15
|
+
"method": "get",
|
|
16
|
+
"url": "/v1/billing/packs",
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return _kwargs
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> ListPacksResponse200 | None:
|
|
23
|
+
if response.status_code == 200:
|
|
24
|
+
response_200 = ListPacksResponse200.from_dict(response.json())
|
|
25
|
+
|
|
26
|
+
return response_200
|
|
27
|
+
|
|
28
|
+
if client.raise_on_unexpected_status:
|
|
29
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
30
|
+
else:
|
|
31
|
+
return None
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def _build_response(
|
|
35
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
36
|
+
) -> Response[ListPacksResponse200]:
|
|
37
|
+
return Response(
|
|
38
|
+
status_code=HTTPStatus(response.status_code),
|
|
39
|
+
content=response.content,
|
|
40
|
+
headers=response.headers,
|
|
41
|
+
parsed=_parse_response(client=client, response=response),
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def sync_detailed(
|
|
46
|
+
*,
|
|
47
|
+
client: AuthenticatedClient | Client,
|
|
48
|
+
) -> Response[ListPacksResponse200]:
|
|
49
|
+
"""Credit packs on sale
|
|
50
|
+
|
|
51
|
+
Raises:
|
|
52
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
53
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
54
|
+
|
|
55
|
+
Returns:
|
|
56
|
+
Response[ListPacksResponse200]
|
|
57
|
+
"""
|
|
58
|
+
|
|
59
|
+
kwargs = _get_kwargs()
|
|
60
|
+
|
|
61
|
+
response = client.get_httpx_client().request(
|
|
62
|
+
**kwargs,
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
return _build_response(client=client, response=response)
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def sync(
|
|
69
|
+
*,
|
|
70
|
+
client: AuthenticatedClient | Client,
|
|
71
|
+
) -> ListPacksResponse200 | None:
|
|
72
|
+
"""Credit packs on sale
|
|
73
|
+
|
|
74
|
+
Raises:
|
|
75
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
76
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
77
|
+
|
|
78
|
+
Returns:
|
|
79
|
+
ListPacksResponse200
|
|
80
|
+
"""
|
|
81
|
+
|
|
82
|
+
return sync_detailed(
|
|
83
|
+
client=client,
|
|
84
|
+
).parsed
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
async def asyncio_detailed(
|
|
88
|
+
*,
|
|
89
|
+
client: AuthenticatedClient | Client,
|
|
90
|
+
) -> Response[ListPacksResponse200]:
|
|
91
|
+
"""Credit packs on sale
|
|
92
|
+
|
|
93
|
+
Raises:
|
|
94
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
95
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
96
|
+
|
|
97
|
+
Returns:
|
|
98
|
+
Response[ListPacksResponse200]
|
|
99
|
+
"""
|
|
100
|
+
|
|
101
|
+
kwargs = _get_kwargs()
|
|
102
|
+
|
|
103
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
104
|
+
|
|
105
|
+
return _build_response(client=client, response=response)
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
async def asyncio(
|
|
109
|
+
*,
|
|
110
|
+
client: AuthenticatedClient | Client,
|
|
111
|
+
) -> ListPacksResponse200 | None:
|
|
112
|
+
"""Credit packs on sale
|
|
113
|
+
|
|
114
|
+
Raises:
|
|
115
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
116
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
117
|
+
|
|
118
|
+
Returns:
|
|
119
|
+
ListPacksResponse200
|
|
120
|
+
"""
|
|
121
|
+
|
|
122
|
+
return (
|
|
123
|
+
await asyncio_detailed(
|
|
124
|
+
client=client,
|
|
125
|
+
)
|
|
126
|
+
).parsed
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Contains endpoint functions for accessing the API"""
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any
|
|
3
|
+
from urllib.parse import quote
|
|
4
|
+
|
|
5
|
+
import httpx
|
|
6
|
+
|
|
7
|
+
from ... import errors
|
|
8
|
+
from ...client import AuthenticatedClient, Client
|
|
9
|
+
from ...models.error import Error
|
|
10
|
+
from ...models.user_page import UserPage
|
|
11
|
+
from ...types import UNSET, Response, Unset
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def _get_kwargs(
|
|
15
|
+
id: str,
|
|
16
|
+
*,
|
|
17
|
+
count: int | Unset = 50,
|
|
18
|
+
cursor: str | Unset = UNSET,
|
|
19
|
+
fresh: bool | Unset = False,
|
|
20
|
+
) -> dict[str, Any]:
|
|
21
|
+
|
|
22
|
+
params: dict[str, Any] = {}
|
|
23
|
+
|
|
24
|
+
params["count"] = count
|
|
25
|
+
|
|
26
|
+
params["cursor"] = cursor
|
|
27
|
+
|
|
28
|
+
params["fresh"] = fresh
|
|
29
|
+
|
|
30
|
+
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
|
31
|
+
|
|
32
|
+
_kwargs: dict[str, Any] = {
|
|
33
|
+
"method": "get",
|
|
34
|
+
"url": "/v1/tweets/{id}/likers".format(
|
|
35
|
+
id=quote(str(id), safe=""),
|
|
36
|
+
),
|
|
37
|
+
"params": params,
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return _kwargs
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Error | UserPage | None:
|
|
44
|
+
if response.status_code == 200:
|
|
45
|
+
response_200 = UserPage.from_dict(response.json())
|
|
46
|
+
|
|
47
|
+
return response_200
|
|
48
|
+
|
|
49
|
+
if response.status_code == 402:
|
|
50
|
+
response_402 = Error.from_dict(response.json())
|
|
51
|
+
|
|
52
|
+
return response_402
|
|
53
|
+
|
|
54
|
+
if response.status_code == 403:
|
|
55
|
+
response_403 = Error.from_dict(response.json())
|
|
56
|
+
|
|
57
|
+
return response_403
|
|
58
|
+
|
|
59
|
+
if response.status_code == 503:
|
|
60
|
+
response_503 = Error.from_dict(response.json())
|
|
61
|
+
|
|
62
|
+
return response_503
|
|
63
|
+
|
|
64
|
+
if client.raise_on_unexpected_status:
|
|
65
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
66
|
+
else:
|
|
67
|
+
return None
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Error | UserPage]:
|
|
71
|
+
return Response(
|
|
72
|
+
status_code=HTTPStatus(response.status_code),
|
|
73
|
+
content=response.content,
|
|
74
|
+
headers=response.headers,
|
|
75
|
+
parsed=_parse_response(client=client, response=response),
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
def sync_detailed(
|
|
80
|
+
id: str,
|
|
81
|
+
*,
|
|
82
|
+
client: AuthenticatedClient | Client,
|
|
83
|
+
count: int | Unset = 50,
|
|
84
|
+
cursor: str | Unset = UNSET,
|
|
85
|
+
fresh: bool | Unset = False,
|
|
86
|
+
) -> Response[Error | UserPage]:
|
|
87
|
+
"""Accounts that liked a tweet
|
|
88
|
+
|
|
89
|
+
0.5 credit per profile. Up to 200 per page. Not every reading session at X may read this; then the
|
|
90
|
+
answer is 403 and free.
|
|
91
|
+
|
|
92
|
+
Args:
|
|
93
|
+
id (str):
|
|
94
|
+
count (int | Unset): Default: 50.
|
|
95
|
+
cursor (str | Unset):
|
|
96
|
+
fresh (bool | Unset): Default: False.
|
|
97
|
+
|
|
98
|
+
Raises:
|
|
99
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
100
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
101
|
+
|
|
102
|
+
Returns:
|
|
103
|
+
Response[Error | UserPage]
|
|
104
|
+
"""
|
|
105
|
+
|
|
106
|
+
kwargs = _get_kwargs(
|
|
107
|
+
id=id,
|
|
108
|
+
count=count,
|
|
109
|
+
cursor=cursor,
|
|
110
|
+
fresh=fresh,
|
|
111
|
+
)
|
|
112
|
+
|
|
113
|
+
response = client.get_httpx_client().request(
|
|
114
|
+
**kwargs,
|
|
115
|
+
)
|
|
116
|
+
|
|
117
|
+
return _build_response(client=client, response=response)
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
def sync(
|
|
121
|
+
id: str,
|
|
122
|
+
*,
|
|
123
|
+
client: AuthenticatedClient | Client,
|
|
124
|
+
count: int | Unset = 50,
|
|
125
|
+
cursor: str | Unset = UNSET,
|
|
126
|
+
fresh: bool | Unset = False,
|
|
127
|
+
) -> Error | UserPage | None:
|
|
128
|
+
"""Accounts that liked a tweet
|
|
129
|
+
|
|
130
|
+
0.5 credit per profile. Up to 200 per page. Not every reading session at X may read this; then the
|
|
131
|
+
answer is 403 and free.
|
|
132
|
+
|
|
133
|
+
Args:
|
|
134
|
+
id (str):
|
|
135
|
+
count (int | Unset): Default: 50.
|
|
136
|
+
cursor (str | Unset):
|
|
137
|
+
fresh (bool | Unset): Default: False.
|
|
138
|
+
|
|
139
|
+
Raises:
|
|
140
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
141
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
142
|
+
|
|
143
|
+
Returns:
|
|
144
|
+
Error | UserPage
|
|
145
|
+
"""
|
|
146
|
+
|
|
147
|
+
return sync_detailed(
|
|
148
|
+
id=id,
|
|
149
|
+
client=client,
|
|
150
|
+
count=count,
|
|
151
|
+
cursor=cursor,
|
|
152
|
+
fresh=fresh,
|
|
153
|
+
).parsed
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
async def asyncio_detailed(
|
|
157
|
+
id: str,
|
|
158
|
+
*,
|
|
159
|
+
client: AuthenticatedClient | Client,
|
|
160
|
+
count: int | Unset = 50,
|
|
161
|
+
cursor: str | Unset = UNSET,
|
|
162
|
+
fresh: bool | Unset = False,
|
|
163
|
+
) -> Response[Error | UserPage]:
|
|
164
|
+
"""Accounts that liked a tweet
|
|
165
|
+
|
|
166
|
+
0.5 credit per profile. Up to 200 per page. Not every reading session at X may read this; then the
|
|
167
|
+
answer is 403 and free.
|
|
168
|
+
|
|
169
|
+
Args:
|
|
170
|
+
id (str):
|
|
171
|
+
count (int | Unset): Default: 50.
|
|
172
|
+
cursor (str | Unset):
|
|
173
|
+
fresh (bool | Unset): Default: False.
|
|
174
|
+
|
|
175
|
+
Raises:
|
|
176
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
177
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
178
|
+
|
|
179
|
+
Returns:
|
|
180
|
+
Response[Error | UserPage]
|
|
181
|
+
"""
|
|
182
|
+
|
|
183
|
+
kwargs = _get_kwargs(
|
|
184
|
+
id=id,
|
|
185
|
+
count=count,
|
|
186
|
+
cursor=cursor,
|
|
187
|
+
fresh=fresh,
|
|
188
|
+
)
|
|
189
|
+
|
|
190
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
191
|
+
|
|
192
|
+
return _build_response(client=client, response=response)
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
async def asyncio(
|
|
196
|
+
id: str,
|
|
197
|
+
*,
|
|
198
|
+
client: AuthenticatedClient | Client,
|
|
199
|
+
count: int | Unset = 50,
|
|
200
|
+
cursor: str | Unset = UNSET,
|
|
201
|
+
fresh: bool | Unset = False,
|
|
202
|
+
) -> Error | UserPage | None:
|
|
203
|
+
"""Accounts that liked a tweet
|
|
204
|
+
|
|
205
|
+
0.5 credit per profile. Up to 200 per page. Not every reading session at X may read this; then the
|
|
206
|
+
answer is 403 and free.
|
|
207
|
+
|
|
208
|
+
Args:
|
|
209
|
+
id (str):
|
|
210
|
+
count (int | Unset): Default: 50.
|
|
211
|
+
cursor (str | Unset):
|
|
212
|
+
fresh (bool | Unset): Default: False.
|
|
213
|
+
|
|
214
|
+
Raises:
|
|
215
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
216
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
217
|
+
|
|
218
|
+
Returns:
|
|
219
|
+
Error | UserPage
|
|
220
|
+
"""
|
|
221
|
+
|
|
222
|
+
return (
|
|
223
|
+
await asyncio_detailed(
|
|
224
|
+
id=id,
|
|
225
|
+
client=client,
|
|
226
|
+
count=count,
|
|
227
|
+
cursor=cursor,
|
|
228
|
+
fresh=fresh,
|
|
229
|
+
)
|
|
230
|
+
).parsed
|