Skip to content

Commit d777564

Browse files
chore: update SDK to v0.4.4
1 parent d79b6dc commit d777564

File tree

88 files changed

+23020
-11900
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+23020
-11900
lines changed

conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
project = "X API SDK"
2222
copyright = "2024, X Developer Platform"
2323
author = "X Developer Platform"
24-
release = "0.4.3"
25-
version = "0.4.3"
24+
release = "0.4.4"
25+
version = "0.4.4"
2626

2727
# -- General configuration ----------------------------------------------------
2828

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ build-backend = "hatchling.build"
1414

1515
[project]
1616
name = "xdk"
17-
version = "0.4.3"
17+
version = "0.4.4"
1818
description = "Python SDK for the X API"
1919
authors = [
2020
{name = "X Developer Platform", email = "[email protected]"},

scripts/process-for-mintlify.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@
2424
MINTLIFY_CONFIG = {
2525
"outputDir": "mintlify-docs",
2626
"baseUrl": "https://docs.x.com",
27-
"title": "X API SDK v0.4.3",
27+
"title": "X API SDK v0.4.4",
2828
"description": "Python SDK for the X API with comprehensive pagination, authentication, and streaming support.",
29-
"version": "0.4.3",
29+
"version": "0.4.4",
3030
"githubUrl": "https://github.com/xdevplatform/xdk",
3131
}
3232

tests/account_activity/test_contracts.py

Lines changed: 368 additions & 169 deletions
Large diffs are not rendered by default.

tests/account_activity/test_generic.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,17 +73,28 @@ def test_error_responses_handling(self):
7373
method_name = client_methods[0]
7474
method = getattr(self.account_activity_client, method_name)
7575
# Try calling the method and expect an exception
76+
# For generator methods (paginated), we need to iterate to trigger the exception
77+
import types
7678
with pytest.raises(Exception):
7779
try:
7880
# Try with no args first
79-
method()
81+
result = method()
82+
# Check if it's a generator (paginated method)
83+
if isinstance(result, types.GeneratorType):
84+
# For generators, exception is raised when iterating
85+
next(result)
86+
# If not a generator, the exception should have been raised above
8087
except TypeError:
8188
# If it needs args, try with basic test args
8289
try:
83-
method("test_id")
90+
result = method("test_id")
91+
if isinstance(result, types.GeneratorType):
92+
next(result)
8493
except TypeError:
8594
# If it needs more specific args, try with kwargs
86-
method(id="test_id", query="test")
95+
result = method(id="test_id", query="test")
96+
if isinstance(result, types.GeneratorType):
97+
next(result)
8798

8899

89100
def test_client_has_expected_base_functionality(self):

tests/account_activity/test_structure.py

Lines changed: 53 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -122,33 +122,35 @@ def test_create_subscription_return_annotation(self):
122122
), f"Method create_subscription should have return type annotation"
123123

124124

125-
def test_get_subscriptions_exists(self):
126-
"""Test that get_subscriptions method exists with correct signature."""
125+
def test_create_replay_job_exists(self):
126+
"""Test that create_replay_job method exists with correct signature."""
127127
# Check method exists
128-
method = getattr(AccountActivityClient, "get_subscriptions", None)
128+
method = getattr(AccountActivityClient, "create_replay_job", None)
129129
assert (
130130
method is not None
131-
), f"Method get_subscriptions does not exist on AccountActivityClient"
131+
), f"Method create_replay_job does not exist on AccountActivityClient"
132132
# Check method is callable
133-
assert callable(method), f"get_subscriptions is not callable"
133+
assert callable(method), f"create_replay_job is not callable"
134134
# Check method signature
135135
sig = inspect.signature(method)
136136
params = list(sig.parameters.keys())
137137
# Should have 'self' as first parameter
138138
assert (
139139
len(params) >= 1
140-
), f"get_subscriptions should have at least 'self' parameter"
140+
), f"create_replay_job should have at least 'self' parameter"
141141
assert (
142142
params[0] == "self"
143143
), f"First parameter should be 'self', got '{params[0]}'"
144144
# Check required parameters exist (excluding 'self')
145145
required_params = [
146146
"webhook_id",
147+
"from_date",
148+
"to_date",
147149
]
148150
for required_param in required_params:
149151
assert (
150152
required_param in params
151-
), f"Required parameter '{required_param}' missing from get_subscriptions"
153+
), f"Required parameter '{required_param}' missing from create_replay_job"
152154
# Check optional parameters have defaults (excluding 'self')
153155
optional_params = []
154156
for optional_param in optional_params:
@@ -159,44 +161,43 @@ def test_get_subscriptions_exists(self):
159161
), f"Optional parameter '{optional_param}' should have a default value"
160162

161163

162-
def test_get_subscriptions_return_annotation(self):
163-
"""Test that get_subscriptions has proper return type annotation."""
164-
method = getattr(AccountActivityClient, "get_subscriptions")
164+
def test_create_replay_job_return_annotation(self):
165+
"""Test that create_replay_job has proper return type annotation."""
166+
method = getattr(AccountActivityClient, "create_replay_job")
165167
sig = inspect.signature(method)
166168
# Check return annotation exists
167169
assert (
168170
sig.return_annotation is not inspect.Signature.empty
169-
), f"Method get_subscriptions should have return type annotation"
171+
), f"Method create_replay_job should have return type annotation"
170172

171173

172-
def test_delete_subscription_exists(self):
173-
"""Test that delete_subscription method exists with correct signature."""
174+
def test_get_subscriptions_exists(self):
175+
"""Test that get_subscriptions method exists with correct signature."""
174176
# Check method exists
175-
method = getattr(AccountActivityClient, "delete_subscription", None)
177+
method = getattr(AccountActivityClient, "get_subscriptions", None)
176178
assert (
177179
method is not None
178-
), f"Method delete_subscription does not exist on AccountActivityClient"
180+
), f"Method get_subscriptions does not exist on AccountActivityClient"
179181
# Check method is callable
180-
assert callable(method), f"delete_subscription is not callable"
182+
assert callable(method), f"get_subscriptions is not callable"
181183
# Check method signature
182184
sig = inspect.signature(method)
183185
params = list(sig.parameters.keys())
184186
# Should have 'self' as first parameter
185187
assert (
186188
len(params) >= 1
187-
), f"delete_subscription should have at least 'self' parameter"
189+
), f"get_subscriptions should have at least 'self' parameter"
188190
assert (
189191
params[0] == "self"
190192
), f"First parameter should be 'self', got '{params[0]}'"
191193
# Check required parameters exist (excluding 'self')
192194
required_params = [
193195
"webhook_id",
194-
"user_id",
195196
]
196197
for required_param in required_params:
197198
assert (
198199
required_param in params
199-
), f"Required parameter '{required_param}' missing from delete_subscription"
200+
), f"Required parameter '{required_param}' missing from get_subscriptions"
200201
# Check optional parameters have defaults (excluding 'self')
201202
optional_params = []
202203
for optional_param in optional_params:
@@ -207,45 +208,41 @@ def test_delete_subscription_exists(self):
207208
), f"Optional parameter '{optional_param}' should have a default value"
208209

209210

210-
def test_delete_subscription_return_annotation(self):
211-
"""Test that delete_subscription has proper return type annotation."""
212-
method = getattr(AccountActivityClient, "delete_subscription")
211+
def test_get_subscriptions_return_annotation(self):
212+
"""Test that get_subscriptions has proper return type annotation."""
213+
method = getattr(AccountActivityClient, "get_subscriptions")
213214
sig = inspect.signature(method)
214215
# Check return annotation exists
215216
assert (
216217
sig.return_annotation is not inspect.Signature.empty
217-
), f"Method delete_subscription should have return type annotation"
218+
), f"Method get_subscriptions should have return type annotation"
218219

219220

220-
def test_create_replay_job_exists(self):
221-
"""Test that create_replay_job method exists with correct signature."""
221+
def test_get_subscription_count_exists(self):
222+
"""Test that get_subscription_count method exists with correct signature."""
222223
# Check method exists
223-
method = getattr(AccountActivityClient, "create_replay_job", None)
224+
method = getattr(AccountActivityClient, "get_subscription_count", None)
224225
assert (
225226
method is not None
226-
), f"Method create_replay_job does not exist on AccountActivityClient"
227+
), f"Method get_subscription_count does not exist on AccountActivityClient"
227228
# Check method is callable
228-
assert callable(method), f"create_replay_job is not callable"
229+
assert callable(method), f"get_subscription_count is not callable"
229230
# Check method signature
230231
sig = inspect.signature(method)
231232
params = list(sig.parameters.keys())
232233
# Should have 'self' as first parameter
233234
assert (
234235
len(params) >= 1
235-
), f"create_replay_job should have at least 'self' parameter"
236+
), f"get_subscription_count should have at least 'self' parameter"
236237
assert (
237238
params[0] == "self"
238239
), f"First parameter should be 'self', got '{params[0]}'"
239240
# Check required parameters exist (excluding 'self')
240-
required_params = [
241-
"webhook_id",
242-
"from_date",
243-
"to_date",
244-
]
241+
required_params = []
245242
for required_param in required_params:
246243
assert (
247244
required_param in params
248-
), f"Required parameter '{required_param}' missing from create_replay_job"
245+
), f"Required parameter '{required_param}' missing from get_subscription_count"
249246
# Check optional parameters have defaults (excluding 'self')
250247
optional_params = []
251248
for optional_param in optional_params:
@@ -256,41 +253,44 @@ def test_create_replay_job_exists(self):
256253
), f"Optional parameter '{optional_param}' should have a default value"
257254

258255

259-
def test_create_replay_job_return_annotation(self):
260-
"""Test that create_replay_job has proper return type annotation."""
261-
method = getattr(AccountActivityClient, "create_replay_job")
256+
def test_get_subscription_count_return_annotation(self):
257+
"""Test that get_subscription_count has proper return type annotation."""
258+
method = getattr(AccountActivityClient, "get_subscription_count")
262259
sig = inspect.signature(method)
263260
# Check return annotation exists
264261
assert (
265262
sig.return_annotation is not inspect.Signature.empty
266-
), f"Method create_replay_job should have return type annotation"
263+
), f"Method get_subscription_count should have return type annotation"
267264

268265

269-
def test_get_subscription_count_exists(self):
270-
"""Test that get_subscription_count method exists with correct signature."""
266+
def test_delete_subscription_exists(self):
267+
"""Test that delete_subscription method exists with correct signature."""
271268
# Check method exists
272-
method = getattr(AccountActivityClient, "get_subscription_count", None)
269+
method = getattr(AccountActivityClient, "delete_subscription", None)
273270
assert (
274271
method is not None
275-
), f"Method get_subscription_count does not exist on AccountActivityClient"
272+
), f"Method delete_subscription does not exist on AccountActivityClient"
276273
# Check method is callable
277-
assert callable(method), f"get_subscription_count is not callable"
274+
assert callable(method), f"delete_subscription is not callable"
278275
# Check method signature
279276
sig = inspect.signature(method)
280277
params = list(sig.parameters.keys())
281278
# Should have 'self' as first parameter
282279
assert (
283280
len(params) >= 1
284-
), f"get_subscription_count should have at least 'self' parameter"
281+
), f"delete_subscription should have at least 'self' parameter"
285282
assert (
286283
params[0] == "self"
287284
), f"First parameter should be 'self', got '{params[0]}'"
288285
# Check required parameters exist (excluding 'self')
289-
required_params = []
286+
required_params = [
287+
"webhook_id",
288+
"user_id",
289+
]
290290
for required_param in required_params:
291291
assert (
292292
required_param in params
293-
), f"Required parameter '{required_param}' missing from get_subscription_count"
293+
), f"Required parameter '{required_param}' missing from delete_subscription"
294294
# Check optional parameters have defaults (excluding 'self')
295295
optional_params = []
296296
for optional_param in optional_params:
@@ -301,25 +301,25 @@ def test_get_subscription_count_exists(self):
301301
), f"Optional parameter '{optional_param}' should have a default value"
302302

303303

304-
def test_get_subscription_count_return_annotation(self):
305-
"""Test that get_subscription_count has proper return type annotation."""
306-
method = getattr(AccountActivityClient, "get_subscription_count")
304+
def test_delete_subscription_return_annotation(self):
305+
"""Test that delete_subscription has proper return type annotation."""
306+
method = getattr(AccountActivityClient, "delete_subscription")
307307
sig = inspect.signature(method)
308308
# Check return annotation exists
309309
assert (
310310
sig.return_annotation is not inspect.Signature.empty
311-
), f"Method get_subscription_count should have return type annotation"
311+
), f"Method delete_subscription should have return type annotation"
312312

313313

314314
def test_all_expected_methods_exist(self):
315315
"""Test that all expected methods exist on the client."""
316316
expected_methods = [
317317
"validate_subscription",
318318
"create_subscription",
319-
"get_subscriptions",
320-
"delete_subscription",
321319
"create_replay_job",
320+
"get_subscriptions",
322321
"get_subscription_count",
322+
"delete_subscription",
323323
]
324324
for expected_method in expected_methods:
325325
assert hasattr(

0 commit comments

Comments
 (0)