Skip to content

Commit f3e98d9

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

Some content is hidden

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

61 files changed

+7437
-7437
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.6-beta"
25-
version = "0.2.6-beta"
24+
release = "0.2.7-beta"
25+
version = "0.2.7-beta"
2626

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

pyproject.toml

Lines changed: 3 additions & 3 deletions
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.6-beta"
17+
version = "0.2.7-beta"
1818
description = "Python SDK for the X API"
1919
authors = [
2020
{name = "X Developer Platform", email = "[email protected]"},
@@ -39,8 +39,8 @@ dependencies = [
3939
]
4040

4141
[project.urls]
42-
Homepage = "https://github.com/xdevplatform/xdk"
43-
Repository = "https://github.com/xdevplatform/xdk/tree/main/xdk/python"
42+
Homepage = "https://github.com/xdevplatform/xdk-python"
43+
Repository = "https://github.com/xdevplatform/xdk-python"
4444

4545
[project.optional-dependencies]
4646
dev = [

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.6-beta",
27+
"title": "X API SDK v0.2.7-beta",
2828
"description": "Python SDK for the X API with comprehensive pagination, authentication, and streaming support.",
29-
"version": "0.2.6-beta",
29+
"version": "0.2.7-beta",
3030
"githubUrl": "https://github.com/xdevplatform/xdk",
3131
}
3232

tests/account_activity/test_contracts.py

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

tests/account_activity/test_structure.py

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

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_get_by_id_request_structure(self):
31-
"""Test get_by_id request structure."""
30+
def test_search_request_structure(self):
31+
"""Test search 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_get_by_id_request_structure(self):
4141
# Prepare test parameters
4242
kwargs = {}
4343
# Add required parameters
44-
kwargs["id"] = "test_value"
44+
kwargs["query"] = "test_query"
4545
# Add request body if required
4646
# Call the method
4747
try:
48-
method = getattr(self.communities_client, "get_by_id")
48+
method = getattr(self.communities_client, "search")
4949
result = method(**kwargs)
5050
# Check if this is a streaming operation (returns Generator)
5151
import types
@@ -80,7 +80,7 @@ def test_get_by_id_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/{id}"
83+
expected_path = "/2/communities/search"
8484
assert expected_path.replace("{", "").replace(
8585
"}", ""
8686
) in called_url or any(
@@ -96,12 +96,12 @@ def test_get_by_id_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 get_by_id: {e}")
99+
pytest.fail(f"Contract test failed for search: {e}")
100100

101101

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")
102+
def test_search_required_parameters(self):
103+
"""Test that search handles parameters correctly."""
104+
method = getattr(self.communities_client, "search")
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_get_by_id_required_parameters(self):
115115
method()
116116

117117

118-
def test_get_by_id_response_structure(self):
119-
"""Test get_by_id response structure validation."""
118+
def test_search_response_structure(self):
119+
"""Test search 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_get_by_id_response_structure(self):
129129
mock_session.get.return_value = mock_response
130130
# Prepare minimal valid parameters
131131
kwargs = {}
132-
kwargs["id"] = "test"
132+
kwargs["query"] = "test_value"
133133
# Add request body if required
134134
# Call method and verify response structure
135-
method = getattr(self.communities_client, "get_by_id")
135+
method = getattr(self.communities_client, "search")
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_get_by_id_response_structure(self):
144144
)
145145

146146

147-
def test_search_request_structure(self):
148-
"""Test search request structure."""
147+
def test_get_by_id_request_structure(self):
148+
"""Test get_by_id 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_search_request_structure(self):
158158
# Prepare test parameters
159159
kwargs = {}
160160
# Add required parameters
161-
kwargs["query"] = "test_query"
161+
kwargs["id"] = "test_value"
162162
# Add request body if required
163163
# Call the method
164164
try:
165-
method = getattr(self.communities_client, "search")
165+
method = getattr(self.communities_client, "get_by_id")
166166
result = method(**kwargs)
167167
# Check if this is a streaming operation (returns Generator)
168168
import types
@@ -197,7 +197,7 @@ def test_search_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/search"
200+
expected_path = "/2/communities/{id}"
201201
assert expected_path.replace("{", "").replace(
202202
"}", ""
203203
) in called_url or any(
@@ -213,12 +213,12 @@ def test_search_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 search: {e}")
216+
pytest.fail(f"Contract test failed for get_by_id: {e}")
217217

218218

219-
def test_search_required_parameters(self):
220-
"""Test that search handles parameters correctly."""
221-
method = getattr(self.communities_client, "search")
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")
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_search_required_parameters(self):
232232
method()
233233

234234

235-
def test_search_response_structure(self):
236-
"""Test search response structure validation."""
235+
def test_get_by_id_response_structure(self):
236+
"""Test get_by_id 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_search_response_structure(self):
246246
mock_session.get.return_value = mock_response
247247
# Prepare minimal valid parameters
248248
kwargs = {}
249-
kwargs["query"] = "test_value"
249+
kwargs["id"] = "test"
250250
# Add request body if required
251251
# Call method and verify response structure
252-
method = getattr(self.communities_client, "search")
252+
method = getattr(self.communities_client, "get_by_id")
253253
result = method(**kwargs)
254254
# Verify response object has expected attributes
255255
# Optional field - just check it doesn't cause errors if accessed

tests/communities/test_structure.py

Lines changed: 48 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -28,53 +28,6 @@ def setup_class(self):
2828
self.communities_client = getattr(self.client, "communities")
2929

3030

31-
def test_get_by_id_exists(self):
32-
"""Test that get_by_id method exists with correct signature."""
33-
# Check method exists
34-
method = getattr(CommunitiesClient, "get_by_id", None)
35-
assert (
36-
method is not None
37-
), f"Method get_by_id does not exist on CommunitiesClient"
38-
# Check method is callable
39-
assert callable(method), f"get_by_id 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 len(params) >= 1, f"get_by_id should have at least 'self' parameter"
45-
assert (
46-
params[0] == "self"
47-
), f"First parameter should be 'self', got '{params[0]}'"
48-
# Check required parameters exist (excluding 'self')
49-
required_params = [
50-
"id",
51-
]
52-
for required_param in required_params:
53-
assert (
54-
required_param in params
55-
), f"Required parameter '{required_param}' missing from get_by_id"
56-
# Check optional parameters have defaults (excluding 'self')
57-
optional_params = [
58-
"community.fields",
59-
]
60-
for optional_param in optional_params:
61-
if optional_param in params:
62-
param_obj = sig.parameters[optional_param]
63-
assert (
64-
param_obj.default is not inspect.Parameter.empty
65-
), f"Optional parameter '{optional_param}' should have a default value"
66-
67-
68-
def test_get_by_id_return_annotation(self):
69-
"""Test that get_by_id has proper return type annotation."""
70-
method = getattr(CommunitiesClient, "get_by_id")
71-
sig = inspect.signature(method)
72-
# Check return annotation exists
73-
assert (
74-
sig.return_annotation is not inspect.Signature.empty
75-
), f"Method get_by_id should have return type annotation"
76-
77-
7831
def test_search_exists(self):
7932
"""Test that search method exists with correct signature."""
8033
# Check method exists
@@ -142,11 +95,58 @@ def test_search_pagination_params(self):
14295
), f"Paginated method search should have pagination parameters"
14396

14497

98+
def test_get_by_id_exists(self):
99+
"""Test that get_by_id method exists with correct signature."""
100+
# Check method exists
101+
method = getattr(CommunitiesClient, "get_by_id", None)
102+
assert (
103+
method is not None
104+
), f"Method get_by_id does not exist on CommunitiesClient"
105+
# Check method is callable
106+
assert callable(method), f"get_by_id is not callable"
107+
# Check method signature
108+
sig = inspect.signature(method)
109+
params = list(sig.parameters.keys())
110+
# Should have 'self' as first parameter
111+
assert len(params) >= 1, f"get_by_id should have at least 'self' parameter"
112+
assert (
113+
params[0] == "self"
114+
), f"First parameter should be 'self', got '{params[0]}'"
115+
# Check required parameters exist (excluding 'self')
116+
required_params = [
117+
"id",
118+
]
119+
for required_param in required_params:
120+
assert (
121+
required_param in params
122+
), f"Required parameter '{required_param}' missing from get_by_id"
123+
# Check optional parameters have defaults (excluding 'self')
124+
optional_params = [
125+
"community.fields",
126+
]
127+
for optional_param in optional_params:
128+
if optional_param in params:
129+
param_obj = sig.parameters[optional_param]
130+
assert (
131+
param_obj.default is not inspect.Parameter.empty
132+
), f"Optional parameter '{optional_param}' should have a default value"
133+
134+
135+
def test_get_by_id_return_annotation(self):
136+
"""Test that get_by_id has proper return type annotation."""
137+
method = getattr(CommunitiesClient, "get_by_id")
138+
sig = inspect.signature(method)
139+
# Check return annotation exists
140+
assert (
141+
sig.return_annotation is not inspect.Signature.empty
142+
), f"Method get_by_id should have return type annotation"
143+
144+
145145
def test_all_expected_methods_exist(self):
146146
"""Test that all expected methods exist on the client."""
147147
expected_methods = [
148-
"get_by_id",
149148
"search",
149+
"get_by_id",
150150
]
151151
for expected_method in expected_methods:
152152
assert hasattr(

0 commit comments

Comments
 (0)