Skip to content

Commit 2c8579d

Browse files
feat(api): api update (#56)
1 parent 46df4c0 commit 2c8579d

File tree

9 files changed

+46
-38
lines changed

9 files changed

+46
-38
lines changed

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
configured_endpoints: 82
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-4bee800ad604492e6ee5776c10e1668037755aeaae6ff6faa2d09a0c3763eeee.yml
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-9cb2534e1d18be02424ad6c8b5843957658c9cf1a42ced4ba6fc177c9843df50.yml

src/asktable/resources/datasources/datasources.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ def with_streaming_response(self) -> DatasourcesResourceWithStreamingResponse:
9494
def create(
9595
self,
9696
*,
97-
engine: Literal["mysql", "tidb", "postgresql", "oceanbase", "clickhouse", "csv", "excel", "starrocks"],
97+
engine: Literal["mysql", "tidb", "postgresql", "oceanbase", "clickhouse", "csv", "excel", "starrocks", "hive"],
9898
async_process_meta: bool | NotGiven = NOT_GIVEN,
9999
value_index: bool | NotGiven = NOT_GIVEN,
100100
access_config: Optional[datasource_create_params.AccessConfig] | NotGiven = NOT_GIVEN,
@@ -428,7 +428,7 @@ def with_streaming_response(self) -> AsyncDatasourcesResourceWithStreamingRespon
428428
async def create(
429429
self,
430430
*,
431-
engine: Literal["mysql", "tidb", "postgresql", "oceanbase", "clickhouse", "csv", "excel", "starrocks"],
431+
engine: Literal["mysql", "tidb", "postgresql", "oceanbase", "clickhouse", "csv", "excel", "starrocks", "hive"],
432432
async_process_meta: bool | NotGiven = NOT_GIVEN,
433433
value_index: bool | NotGiven = NOT_GIVEN,
434434
access_config: Optional[datasource_create_params.AccessConfig] | NotGiven = NOT_GIVEN,

src/asktable/resources/securetunnels.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def with_streaming_response(self) -> SecuretunnelsResourceWithStreamingResponse:
5656
def create(
5757
self,
5858
*,
59-
name: Optional[str] | NotGiven = NOT_GIVEN,
59+
name: str,
6060
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
6161
# The extra values given here take precedence over values defined on the client or passed to this method.
6262
extra_headers: Headers | None = None,
@@ -124,8 +124,8 @@ def update(
124124
self,
125125
securetunnel_id: str,
126126
*,
127+
name: str,
127128
client_info: Optional[object] | NotGiven = NOT_GIVEN,
128-
name: Optional[str] | NotGiven = NOT_GIVEN,
129129
unique_key: Optional[str] | NotGiven = NOT_GIVEN,
130130
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
131131
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -138,10 +138,10 @@ def update(
138138
更新某个 ATST
139139
140140
Args:
141-
client_info: 客户端信息
142-
143141
name: SecureTunnel 名称,不超过 20 个字符
144142
143+
client_info: 客户端信息
144+
145145
unique_key: 唯一标识,用于更新客户端信息(容器 ID)
146146
147147
extra_headers: Send extra headers
@@ -158,8 +158,8 @@ def update(
158158
f"/securetunnels/{securetunnel_id}",
159159
body=maybe_transform(
160160
{
161-
"client_info": client_info,
162161
"name": name,
162+
"client_info": client_info,
163163
"unique_key": unique_key,
164164
},
165165
securetunnel_update_params.SecuretunnelUpdateParams,
@@ -325,7 +325,7 @@ def with_streaming_response(self) -> AsyncSecuretunnelsResourceWithStreamingResp
325325
async def create(
326326
self,
327327
*,
328-
name: Optional[str] | NotGiven = NOT_GIVEN,
328+
name: str,
329329
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
330330
# The extra values given here take precedence over values defined on the client or passed to this method.
331331
extra_headers: Headers | None = None,
@@ -393,8 +393,8 @@ async def update(
393393
self,
394394
securetunnel_id: str,
395395
*,
396+
name: str,
396397
client_info: Optional[object] | NotGiven = NOT_GIVEN,
397-
name: Optional[str] | NotGiven = NOT_GIVEN,
398398
unique_key: Optional[str] | NotGiven = NOT_GIVEN,
399399
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
400400
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -407,10 +407,10 @@ async def update(
407407
更新某个 ATST
408408
409409
Args:
410-
client_info: 客户端信息
411-
412410
name: SecureTunnel 名称,不超过 20 个字符
413411
412+
client_info: 客户端信息
413+
414414
unique_key: 唯一标识,用于更新客户端信息(容器 ID)
415415
416416
extra_headers: Send extra headers
@@ -427,8 +427,8 @@ async def update(
427427
f"/securetunnels/{securetunnel_id}",
428428
body=await async_maybe_transform(
429429
{
430-
"client_info": client_info,
431430
"name": name,
431+
"client_info": client_info,
432432
"unique_key": unique_key,
433433
},
434434
securetunnel_update_params.SecuretunnelUpdateParams,

src/asktable/types/datasource.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class Datasource(BaseModel):
4848
created_at: datetime
4949
"""创建时间"""
5050

51-
engine: Literal["mysql", "tidb", "postgresql", "oceanbase", "clickhouse", "csv", "excel", "starrocks"]
51+
engine: Literal["mysql", "tidb", "postgresql", "oceanbase", "clickhouse", "csv", "excel", "starrocks", "hive"]
5252
"""数据源引擎"""
5353

5454
meta_status: Literal["processing", "failed", "success", "unprocessed"]

src/asktable/types/datasource_create_params.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99

1010

1111
class DatasourceCreateParams(TypedDict, total=False):
12-
engine: Required[Literal["mysql", "tidb", "postgresql", "oceanbase", "clickhouse", "csv", "excel", "starrocks"]]
12+
engine: Required[
13+
Literal["mysql", "tidb", "postgresql", "oceanbase", "clickhouse", "csv", "excel", "starrocks", "hive"]
14+
]
1315
"""数据源引擎"""
1416

1517
async_process_meta: bool

src/asktable/types/secure_tunnel.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ class SecureTunnel(BaseModel):
1616
modified_at: datetime
1717

1818
name: str
19+
"""SecureTunnel 名称,不超过 20 个字符"""
1920

2021
project_id: str
2122

src/asktable/types/securetunnel_create_params.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@
22

33
from __future__ import annotations
44

5-
from typing import Optional
6-
from typing_extensions import TypedDict
5+
from typing_extensions import Required, TypedDict
76

87
__all__ = ["SecuretunnelCreateParams"]
98

109

1110
class SecuretunnelCreateParams(TypedDict, total=False):
12-
name: Optional[str]
11+
name: Required[str]
1312
"""SecureTunnel 名称,不超过 20 个字符"""

src/asktable/types/securetunnel_update_params.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@
33
from __future__ import annotations
44

55
from typing import Optional
6-
from typing_extensions import TypedDict
6+
from typing_extensions import Required, TypedDict
77

88
__all__ = ["SecuretunnelUpdateParams"]
99

1010

1111
class SecuretunnelUpdateParams(TypedDict, total=False):
12+
name: Required[str]
13+
"""SecureTunnel 名称,不超过 20 个字符"""
14+
1215
client_info: Optional[object]
1316
"""客户端信息"""
1417

15-
name: Optional[str]
16-
"""SecureTunnel 名称,不超过 20 个字符"""
17-
1818
unique_key: Optional[str]
1919
"""唯一标识,用于更新客户端信息(容器 ID)"""

tests/api_resources/test_securetunnels.py

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,16 @@ class TestSecuretunnels:
2323

2424
@parametrize
2525
def test_method_create(self, client: Asktable) -> None:
26-
securetunnel = client.securetunnels.create()
27-
assert_matches_type(SecureTunnel, securetunnel, path=["response"])
28-
29-
@parametrize
30-
def test_method_create_with_all_params(self, client: Asktable) -> None:
3126
securetunnel = client.securetunnels.create(
3227
name="我的测试机",
3328
)
3429
assert_matches_type(SecureTunnel, securetunnel, path=["response"])
3530

3631
@parametrize
3732
def test_raw_response_create(self, client: Asktable) -> None:
38-
response = client.securetunnels.with_raw_response.create()
33+
response = client.securetunnels.with_raw_response.create(
34+
name="我的测试机",
35+
)
3936

4037
assert response.is_closed is True
4138
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
@@ -44,7 +41,9 @@ def test_raw_response_create(self, client: Asktable) -> None:
4441

4542
@parametrize
4643
def test_streaming_response_create(self, client: Asktable) -> None:
47-
with client.securetunnels.with_streaming_response.create() as response:
44+
with client.securetunnels.with_streaming_response.create(
45+
name="我的测试机",
46+
) as response:
4847
assert not response.is_closed
4948
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
5049

@@ -95,15 +94,16 @@ def test_path_params_retrieve(self, client: Asktable) -> None:
9594
def test_method_update(self, client: Asktable) -> None:
9695
securetunnel = client.securetunnels.update(
9796
securetunnel_id="securetunnel_id",
97+
name="我的测试机",
9898
)
9999
assert_matches_type(SecureTunnel, securetunnel, path=["response"])
100100

101101
@parametrize
102102
def test_method_update_with_all_params(self, client: Asktable) -> None:
103103
securetunnel = client.securetunnels.update(
104104
securetunnel_id="securetunnel_id",
105-
client_info={},
106105
name="我的测试机",
106+
client_info={},
107107
unique_key="unique_key",
108108
)
109109
assert_matches_type(SecureTunnel, securetunnel, path=["response"])
@@ -112,6 +112,7 @@ def test_method_update_with_all_params(self, client: Asktable) -> None:
112112
def test_raw_response_update(self, client: Asktable) -> None:
113113
response = client.securetunnels.with_raw_response.update(
114114
securetunnel_id="securetunnel_id",
115+
name="我的测试机",
115116
)
116117

117118
assert response.is_closed is True
@@ -123,6 +124,7 @@ def test_raw_response_update(self, client: Asktable) -> None:
123124
def test_streaming_response_update(self, client: Asktable) -> None:
124125
with client.securetunnels.with_streaming_response.update(
125126
securetunnel_id="securetunnel_id",
127+
name="我的测试机",
126128
) as response:
127129
assert not response.is_closed
128130
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
@@ -137,6 +139,7 @@ def test_path_params_update(self, client: Asktable) -> None:
137139
with pytest.raises(ValueError, match=r"Expected a non-empty value for `securetunnel_id` but received ''"):
138140
client.securetunnels.with_raw_response.update(
139141
securetunnel_id="",
142+
name="我的测试机",
140143
)
141144

142145
@parametrize
@@ -263,19 +266,16 @@ class TestAsyncSecuretunnels:
263266

264267
@parametrize
265268
async def test_method_create(self, async_client: AsyncAsktable) -> None:
266-
securetunnel = await async_client.securetunnels.create()
267-
assert_matches_type(SecureTunnel, securetunnel, path=["response"])
268-
269-
@parametrize
270-
async def test_method_create_with_all_params(self, async_client: AsyncAsktable) -> None:
271269
securetunnel = await async_client.securetunnels.create(
272270
name="我的测试机",
273271
)
274272
assert_matches_type(SecureTunnel, securetunnel, path=["response"])
275273

276274
@parametrize
277275
async def test_raw_response_create(self, async_client: AsyncAsktable) -> None:
278-
response = await async_client.securetunnels.with_raw_response.create()
276+
response = await async_client.securetunnels.with_raw_response.create(
277+
name="我的测试机",
278+
)
279279

280280
assert response.is_closed is True
281281
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
@@ -284,7 +284,9 @@ async def test_raw_response_create(self, async_client: AsyncAsktable) -> None:
284284

285285
@parametrize
286286
async def test_streaming_response_create(self, async_client: AsyncAsktable) -> None:
287-
async with async_client.securetunnels.with_streaming_response.create() as response:
287+
async with async_client.securetunnels.with_streaming_response.create(
288+
name="我的测试机",
289+
) as response:
288290
assert not response.is_closed
289291
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
290292

@@ -335,15 +337,16 @@ async def test_path_params_retrieve(self, async_client: AsyncAsktable) -> None:
335337
async def test_method_update(self, async_client: AsyncAsktable) -> None:
336338
securetunnel = await async_client.securetunnels.update(
337339
securetunnel_id="securetunnel_id",
340+
name="我的测试机",
338341
)
339342
assert_matches_type(SecureTunnel, securetunnel, path=["response"])
340343

341344
@parametrize
342345
async def test_method_update_with_all_params(self, async_client: AsyncAsktable) -> None:
343346
securetunnel = await async_client.securetunnels.update(
344347
securetunnel_id="securetunnel_id",
345-
client_info={},
346348
name="我的测试机",
349+
client_info={},
347350
unique_key="unique_key",
348351
)
349352
assert_matches_type(SecureTunnel, securetunnel, path=["response"])
@@ -352,6 +355,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncAsktable)
352355
async def test_raw_response_update(self, async_client: AsyncAsktable) -> None:
353356
response = await async_client.securetunnels.with_raw_response.update(
354357
securetunnel_id="securetunnel_id",
358+
name="我的测试机",
355359
)
356360

357361
assert response.is_closed is True
@@ -363,6 +367,7 @@ async def test_raw_response_update(self, async_client: AsyncAsktable) -> None:
363367
async def test_streaming_response_update(self, async_client: AsyncAsktable) -> None:
364368
async with async_client.securetunnels.with_streaming_response.update(
365369
securetunnel_id="securetunnel_id",
370+
name="我的测试机",
366371
) as response:
367372
assert not response.is_closed
368373
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
@@ -377,6 +382,7 @@ async def test_path_params_update(self, async_client: AsyncAsktable) -> None:
377382
with pytest.raises(ValueError, match=r"Expected a non-empty value for `securetunnel_id` but received ''"):
378383
await async_client.securetunnels.with_raw_response.update(
379384
securetunnel_id="",
385+
name="我的测试机",
380386
)
381387

382388
@parametrize

0 commit comments

Comments
 (0)