Skip to content

Commit 0349eb8

Browse files
chore: update SDK to v0.2.6-beta
1 parent 6405676 commit 0349eb8

Some content is hidden

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

65 files changed

+8013
-8013
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.2.5-beta"
25-
version = "0.2.5-beta"
24+
release = "0.2.6-beta"
25+
version = "0.2.6-beta"
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.2.5-beta"
17+
version = "0.2.6-beta"
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.2.5-beta",
27+
"title": "X API SDK v0.2.6-beta",
2828
"description": "Python SDK for the X API with comprehensive pagination, authentication, and streaming support.",
29-
"version": "0.2.5-beta",
29+
"version": "0.2.6-beta",
3030
"githubUrl": "https://github.com/xdevplatform/xdk",
3131
}
3232

tests/account_activity/test_contracts.py

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

tests/account_activity/test_structure.py

Lines changed: 63 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -28,55 +28,6 @@ def setup_class(self):
2828
self.account_activity_client = getattr(self.client, "account_activity")
2929

3030

31-
def test_create_replay_job_exists(self):
32-
"""Test that create_replay_job method exists with correct signature."""
33-
# Check method exists
34-
method = getattr(AccountActivityClient, "create_replay_job", None)
35-
assert (
36-
method is not None
37-
), f"Method create_replay_job does not exist on AccountActivityClient"
38-
# Check method is callable
39-
assert callable(method), f"create_replay_job is not callable"
40-
# Check method signature
41-
sig = inspect.signature(method)
42-
params = list(sig.parameters.keys())
43-
# Should have 'self' as first parameter
44-
assert (
45-
len(params) >= 1
46-
), f"create_replay_job should have at least 'self' parameter"
47-
assert (
48-
params[0] == "self"
49-
), f"First parameter should be 'self', got '{params[0]}'"
50-
# Check required parameters exist (excluding 'self')
51-
required_params = [
52-
"webhook_id",
53-
"from_date",
54-
"to_date",
55-
]
56-
for required_param in required_params:
57-
assert (
58-
required_param in params
59-
), f"Required parameter '{required_param}' missing from create_replay_job"
60-
# Check optional parameters have defaults (excluding 'self')
61-
optional_params = []
62-
for optional_param in optional_params:
63-
if optional_param in params:
64-
param_obj = sig.parameters[optional_param]
65-
assert (
66-
param_obj.default is not inspect.Parameter.empty
67-
), f"Optional parameter '{optional_param}' should have a default value"
68-
69-
70-
def test_create_replay_job_return_annotation(self):
71-
"""Test that create_replay_job has proper return type annotation."""
72-
method = getattr(AccountActivityClient, "create_replay_job")
73-
sig = inspect.signature(method)
74-
# Check return annotation exists
75-
assert (
76-
sig.return_annotation is not inspect.Signature.empty
77-
), f"Method create_replay_job should have return type annotation"
78-
79-
8031
def test_validate_subscription_exists(self):
8132
"""Test that validate_subscription method exists with correct signature."""
8233
# Check method exists
@@ -219,31 +170,35 @@ def test_delete_subscription_return_annotation(self):
219170
), f"Method delete_subscription should have return type annotation"
220171

221172

222-
def test_get_subscription_count_exists(self):
223-
"""Test that get_subscription_count method exists with correct signature."""
173+
def test_create_replay_job_exists(self):
174+
"""Test that create_replay_job method exists with correct signature."""
224175
# Check method exists
225-
method = getattr(AccountActivityClient, "get_subscription_count", None)
176+
method = getattr(AccountActivityClient, "create_replay_job", None)
226177
assert (
227178
method is not None
228-
), f"Method get_subscription_count does not exist on AccountActivityClient"
179+
), f"Method create_replay_job does not exist on AccountActivityClient"
229180
# Check method is callable
230-
assert callable(method), f"get_subscription_count is not callable"
181+
assert callable(method), f"create_replay_job is not callable"
231182
# Check method signature
232183
sig = inspect.signature(method)
233184
params = list(sig.parameters.keys())
234185
# Should have 'self' as first parameter
235186
assert (
236187
len(params) >= 1
237-
), f"get_subscription_count should have at least 'self' parameter"
188+
), f"create_replay_job should have at least 'self' parameter"
238189
assert (
239190
params[0] == "self"
240191
), f"First parameter should be 'self', got '{params[0]}'"
241192
# Check required parameters exist (excluding 'self')
242-
required_params = []
193+
required_params = [
194+
"webhook_id",
195+
"from_date",
196+
"to_date",
197+
]
243198
for required_param in required_params:
244199
assert (
245200
required_param in params
246-
), f"Required parameter '{required_param}' missing from get_subscription_count"
201+
), f"Required parameter '{required_param}' missing from create_replay_job"
247202
# Check optional parameters have defaults (excluding 'self')
248203
optional_params = []
249204
for optional_param in optional_params:
@@ -254,14 +209,14 @@ def test_get_subscription_count_exists(self):
254209
), f"Optional parameter '{optional_param}' should have a default value"
255210

256211

257-
def test_get_subscription_count_return_annotation(self):
258-
"""Test that get_subscription_count has proper return type annotation."""
259-
method = getattr(AccountActivityClient, "get_subscription_count")
212+
def test_create_replay_job_return_annotation(self):
213+
"""Test that create_replay_job has proper return type annotation."""
214+
method = getattr(AccountActivityClient, "create_replay_job")
260215
sig = inspect.signature(method)
261216
# Check return annotation exists
262217
assert (
263218
sig.return_annotation is not inspect.Signature.empty
264-
), f"Method get_subscription_count should have return type annotation"
219+
), f"Method create_replay_job should have return type annotation"
265220

266221

267222
def test_get_subscriptions_exists(self):
@@ -311,15 +266,60 @@ def test_get_subscriptions_return_annotation(self):
311266
), f"Method get_subscriptions should have return type annotation"
312267

313268

269+
def test_get_subscription_count_exists(self):
270+
"""Test that get_subscription_count method exists with correct signature."""
271+
# Check method exists
272+
method = getattr(AccountActivityClient, "get_subscription_count", None)
273+
assert (
274+
method is not None
275+
), f"Method get_subscription_count does not exist on AccountActivityClient"
276+
# Check method is callable
277+
assert callable(method), f"get_subscription_count is not callable"
278+
# Check method signature
279+
sig = inspect.signature(method)
280+
params = list(sig.parameters.keys())
281+
# Should have 'self' as first parameter
282+
assert (
283+
len(params) >= 1
284+
), f"get_subscription_count should have at least 'self' parameter"
285+
assert (
286+
params[0] == "self"
287+
), f"First parameter should be 'self', got '{params[0]}'"
288+
# Check required parameters exist (excluding 'self')
289+
required_params = []
290+
for required_param in required_params:
291+
assert (
292+
required_param in params
293+
), f"Required parameter '{required_param}' missing from get_subscription_count"
294+
# Check optional parameters have defaults (excluding 'self')
295+
optional_params = []
296+
for optional_param in optional_params:
297+
if optional_param in params:
298+
param_obj = sig.parameters[optional_param]
299+
assert (
300+
param_obj.default is not inspect.Parameter.empty
301+
), f"Optional parameter '{optional_param}' should have a default value"
302+
303+
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")
307+
sig = inspect.signature(method)
308+
# Check return annotation exists
309+
assert (
310+
sig.return_annotation is not inspect.Signature.empty
311+
), f"Method get_subscription_count should have return type annotation"
312+
313+
314314
def test_all_expected_methods_exist(self):
315315
"""Test that all expected methods exist on the client."""
316316
expected_methods = [
317-
"create_replay_job",
318317
"validate_subscription",
319318
"create_subscription",
320319
"delete_subscription",
321-
"get_subscription_count",
320+
"create_replay_job",
322321
"get_subscriptions",
322+
"get_subscription_count",
323323
]
324324
for expected_method in expected_methods:
325325
assert hasattr(

tests/communities/test_contracts.py

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ def setup_class(self):
2727
self.communities_client = getattr(self.client, "communities")
2828

2929

30-
def test_search_request_structure(self):
31-
"""Test search request structure."""
30+
def test_get_by_id_request_structure(self):
31+
"""Test get_by_id request structure."""
3232
# Mock the session to capture request details
3333
with patch.object(self.client, "session") as mock_session:
3434
mock_response = Mock()
@@ -41,11 +41,11 @@ def test_search_request_structure(self):
4141
# Prepare test parameters
4242
kwargs = {}
4343
# Add required parameters
44-
kwargs["query"] = "test_query"
44+
kwargs["id"] = "test_value"
4545
# Add request body if required
4646
# Call the method
4747
try:
48-
method = getattr(self.communities_client, "search")
48+
method = getattr(self.communities_client, "get_by_id")
4949
result = method(**kwargs)
5050
# Check if this is a streaming operation (returns Generator)
5151
import types
@@ -80,7 +80,7 @@ def test_search_request_structure(self):
8080
called_url = (
8181
call_args[0][0] if call_args[0] else call_args[1].get("url", "")
8282
)
83-
expected_path = "/2/communities/search"
83+
expected_path = "/2/communities/{id}"
8484
assert expected_path.replace("{", "").replace(
8585
"}", ""
8686
) in called_url or any(
@@ -96,12 +96,12 @@ def test_search_request_structure(self):
9696
# For regular operations, verify we got a result
9797
assert result is not None, "Method should return a result"
9898
except Exception as e:
99-
pytest.fail(f"Contract test failed for search: {e}")
99+
pytest.fail(f"Contract test failed for get_by_id: {e}")
100100

101101

102-
def test_search_required_parameters(self):
103-
"""Test that search handles parameters correctly."""
104-
method = getattr(self.communities_client, "search")
102+
def test_get_by_id_required_parameters(self):
103+
"""Test that get_by_id handles parameters correctly."""
104+
method = getattr(self.communities_client, "get_by_id")
105105
# Test with missing required parameters - mock the request to avoid network calls
106106
with patch.object(self.client, "session") as mock_session:
107107
# Mock a 400 response (typical for missing required parameters)
@@ -115,8 +115,8 @@ def test_search_required_parameters(self):
115115
method()
116116

117117

118-
def test_search_response_structure(self):
119-
"""Test search response structure validation."""
118+
def test_get_by_id_response_structure(self):
119+
"""Test get_by_id response structure validation."""
120120
with patch.object(self.client, "session") as mock_session:
121121
# Create mock response with expected structure
122122
mock_response_data = {
@@ -129,10 +129,10 @@ def test_search_response_structure(self):
129129
mock_session.get.return_value = mock_response
130130
# Prepare minimal valid parameters
131131
kwargs = {}
132-
kwargs["query"] = "test_value"
132+
kwargs["id"] = "test"
133133
# Add request body if required
134134
# Call method and verify response structure
135-
method = getattr(self.communities_client, "search")
135+
method = getattr(self.communities_client, "get_by_id")
136136
result = method(**kwargs)
137137
# Verify response object has expected attributes
138138
# Optional field - just check it doesn't cause errors if accessed
@@ -144,8 +144,8 @@ def test_search_response_structure(self):
144144
)
145145

146146

147-
def test_get_by_id_request_structure(self):
148-
"""Test get_by_id request structure."""
147+
def test_search_request_structure(self):
148+
"""Test search request structure."""
149149
# Mock the session to capture request details
150150
with patch.object(self.client, "session") as mock_session:
151151
mock_response = Mock()
@@ -158,11 +158,11 @@ def test_get_by_id_request_structure(self):
158158
# Prepare test parameters
159159
kwargs = {}
160160
# Add required parameters
161-
kwargs["id"] = "test_value"
161+
kwargs["query"] = "test_query"
162162
# Add request body if required
163163
# Call the method
164164
try:
165-
method = getattr(self.communities_client, "get_by_id")
165+
method = getattr(self.communities_client, "search")
166166
result = method(**kwargs)
167167
# Check if this is a streaming operation (returns Generator)
168168
import types
@@ -197,7 +197,7 @@ def test_get_by_id_request_structure(self):
197197
called_url = (
198198
call_args[0][0] if call_args[0] else call_args[1].get("url", "")
199199
)
200-
expected_path = "/2/communities/{id}"
200+
expected_path = "/2/communities/search"
201201
assert expected_path.replace("{", "").replace(
202202
"}", ""
203203
) in called_url or any(
@@ -213,12 +213,12 @@ def test_get_by_id_request_structure(self):
213213
# For regular operations, verify we got a result
214214
assert result is not None, "Method should return a result"
215215
except Exception as e:
216-
pytest.fail(f"Contract test failed for get_by_id: {e}")
216+
pytest.fail(f"Contract test failed for search: {e}")
217217

218218

219-
def test_get_by_id_required_parameters(self):
220-
"""Test that get_by_id handles parameters correctly."""
221-
method = getattr(self.communities_client, "get_by_id")
219+
def test_search_required_parameters(self):
220+
"""Test that search handles parameters correctly."""
221+
method = getattr(self.communities_client, "search")
222222
# Test with missing required parameters - mock the request to avoid network calls
223223
with patch.object(self.client, "session") as mock_session:
224224
# Mock a 400 response (typical for missing required parameters)
@@ -232,8 +232,8 @@ def test_get_by_id_required_parameters(self):
232232
method()
233233

234234

235-
def test_get_by_id_response_structure(self):
236-
"""Test get_by_id response structure validation."""
235+
def test_search_response_structure(self):
236+
"""Test search response structure validation."""
237237
with patch.object(self.client, "session") as mock_session:
238238
# Create mock response with expected structure
239239
mock_response_data = {
@@ -246,10 +246,10 @@ def test_get_by_id_response_structure(self):
246246
mock_session.get.return_value = mock_response
247247
# Prepare minimal valid parameters
248248
kwargs = {}
249-
kwargs["id"] = "test"
249+
kwargs["query"] = "test_value"
250250
# Add request body if required
251251
# Call method and verify response structure
252-
method = getattr(self.communities_client, "get_by_id")
252+
method = getattr(self.communities_client, "search")
253253
result = method(**kwargs)
254254
# Verify response object has expected attributes
255255
# Optional field - just check it doesn't cause errors if accessed

0 commit comments

Comments
 (0)