Skip to content

Commit dfb4280

Browse files
feat(api): api update (#35)
1 parent 3fd9568 commit dfb4280

File tree

6 files changed

+25
-15
lines changed

6 files changed

+25
-15
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: 70
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-a4263ca5de8cc8a3299535d391d72b3d1fbe13b2e20e351c9d6eac94f2a6df17.yml
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-66a7fb2832b4895a6ee91a39040f6fcc3943bb1502c2a28e9788e1907942b60c.yml

src/asktable/resources/datasources/datasources.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ def update(
171171
datasource_id: str,
172172
*,
173173
access_config: Optional[datasource_update_params.AccessConfig] | NotGiven = NOT_GIVEN,
174+
desc: Optional[str] | NotGiven = NOT_GIVEN,
174175
field_count: Optional[int] | NotGiven = NOT_GIVEN,
175176
meta_error: Optional[str] | NotGiven = NOT_GIVEN,
176177
meta_status: Optional[Literal["processing", "failed", "warning", "success", "unprocessed"]]
@@ -192,6 +193,8 @@ def update(
192193
Args:
193194
access_config: 不同引擎有不同的配置
194195
196+
desc: 数据源描述
197+
195198
field_count: 字段数量
196199
197200
meta_error: 元数据处理错误
@@ -221,6 +224,7 @@ def update(
221224
body=maybe_transform(
222225
{
223226
"access_config": access_config,
227+
"desc": desc,
224228
"field_count": field_count,
225229
"meta_error": meta_error,
226230
"meta_status": meta_status,
@@ -321,9 +325,9 @@ def delete(
321325
def create_from_file(
322326
self,
323327
*,
324-
name: str,
325328
file: FileTypes,
326329
async_process_meta: bool | NotGiven = NOT_GIVEN,
330+
name: str | NotGiven = NOT_GIVEN,
327331
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
328332
# The extra values given here take precedence over values defined on the client or passed to this method.
329333
extra_headers: Headers | None = None,
@@ -360,8 +364,8 @@ def create_from_file(
360364
timeout=timeout,
361365
query=maybe_transform(
362366
{
363-
"name": name,
364367
"async_process_meta": async_process_meta,
368+
"name": name,
365369
},
366370
datasource_create_from_file_params.DatasourceCreateFromFileParams,
367371
),
@@ -490,6 +494,7 @@ async def update(
490494
datasource_id: str,
491495
*,
492496
access_config: Optional[datasource_update_params.AccessConfig] | NotGiven = NOT_GIVEN,
497+
desc: Optional[str] | NotGiven = NOT_GIVEN,
493498
field_count: Optional[int] | NotGiven = NOT_GIVEN,
494499
meta_error: Optional[str] | NotGiven = NOT_GIVEN,
495500
meta_status: Optional[Literal["processing", "failed", "warning", "success", "unprocessed"]]
@@ -511,6 +516,8 @@ async def update(
511516
Args:
512517
access_config: 不同引擎有不同的配置
513518
519+
desc: 数据源描述
520+
514521
field_count: 字段数量
515522
516523
meta_error: 元数据处理错误
@@ -540,6 +547,7 @@ async def update(
540547
body=await async_maybe_transform(
541548
{
542549
"access_config": access_config,
550+
"desc": desc,
543551
"field_count": field_count,
544552
"meta_error": meta_error,
545553
"meta_status": meta_status,
@@ -640,9 +648,9 @@ async def delete(
640648
async def create_from_file(
641649
self,
642650
*,
643-
name: str,
644651
file: FileTypes,
645652
async_process_meta: bool | NotGiven = NOT_GIVEN,
653+
name: str | NotGiven = NOT_GIVEN,
646654
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
647655
# The extra values given here take precedence over values defined on the client or passed to this method.
648656
extra_headers: Headers | None = None,
@@ -679,8 +687,8 @@ async def create_from_file(
679687
timeout=timeout,
680688
query=await async_maybe_transform(
681689
{
682-
"name": name,
683690
"async_process_meta": async_process_meta,
691+
"name": name,
684692
},
685693
datasource_create_from_file_params.DatasourceCreateFromFileParams,
686694
),

src/asktable/types/data_source.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ class DataSource(BaseModel):
6060
access_config: Optional[AccessConfig] = None
6161
"""访问数据源的配置信息"""
6262

63+
desc: Optional[str] = None
64+
"""数据源描述"""
65+
6366
field_count: Optional[int] = None
6467
"""字段数量"""
6568

src/asktable/types/datasource_create_from_file_params.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010

1111

1212
class DatasourceCreateFromFileParams(TypedDict, total=False):
13-
name: Required[str]
14-
1513
file: Required[FileTypes]
1614

1715
async_process_meta: bool
16+
17+
name: str

src/asktable/types/datasource_update_params.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ class DatasourceUpdateParams(TypedDict, total=False):
1212
access_config: Optional[AccessConfig]
1313
"""不同引擎有不同的配置"""
1414

15+
desc: Optional[str]
16+
"""数据源描述"""
17+
1518
field_count: Optional[int]
1619
"""字段数量"""
1720

tests/api_resources/test_datasources.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ def test_method_update_with_all_params(self, client: Asktable) -> None:
135135
"securetunnel_id": "atst_123456",
136136
"user": "root",
137137
},
138+
desc="数据源描述",
138139
field_count=1,
139140
meta_error="error message",
140141
meta_status="processing",
@@ -251,24 +252,22 @@ def test_path_params_delete(self, client: Asktable) -> None:
251252
@parametrize
252253
def test_method_create_from_file(self, client: Asktable) -> None:
253254
datasource = client.datasources.create_from_file(
254-
name="name",
255255
file=b"raw file contents",
256256
)
257257
assert_matches_type(DataSource, datasource, path=["response"])
258258

259259
@parametrize
260260
def test_method_create_from_file_with_all_params(self, client: Asktable) -> None:
261261
datasource = client.datasources.create_from_file(
262-
name="name",
263262
file=b"raw file contents",
264263
async_process_meta=True,
264+
name="name",
265265
)
266266
assert_matches_type(DataSource, datasource, path=["response"])
267267

268268
@parametrize
269269
def test_raw_response_create_from_file(self, client: Asktable) -> None:
270270
response = client.datasources.with_raw_response.create_from_file(
271-
name="name",
272271
file=b"raw file contents",
273272
)
274273

@@ -280,7 +279,6 @@ def test_raw_response_create_from_file(self, client: Asktable) -> None:
280279
@parametrize
281280
def test_streaming_response_create_from_file(self, client: Asktable) -> None:
282281
with client.datasources.with_streaming_response.create_from_file(
283-
name="name",
284282
file=b"raw file contents",
285283
) as response:
286284
assert not response.is_closed
@@ -410,6 +408,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncAsktable)
410408
"securetunnel_id": "atst_123456",
411409
"user": "root",
412410
},
411+
desc="数据源描述",
413412
field_count=1,
414413
meta_error="error message",
415414
meta_status="processing",
@@ -526,24 +525,22 @@ async def test_path_params_delete(self, async_client: AsyncAsktable) -> None:
526525
@parametrize
527526
async def test_method_create_from_file(self, async_client: AsyncAsktable) -> None:
528527
datasource = await async_client.datasources.create_from_file(
529-
name="name",
530528
file=b"raw file contents",
531529
)
532530
assert_matches_type(DataSource, datasource, path=["response"])
533531

534532
@parametrize
535533
async def test_method_create_from_file_with_all_params(self, async_client: AsyncAsktable) -> None:
536534
datasource = await async_client.datasources.create_from_file(
537-
name="name",
538535
file=b"raw file contents",
539536
async_process_meta=True,
537+
name="name",
540538
)
541539
assert_matches_type(DataSource, datasource, path=["response"])
542540

543541
@parametrize
544542
async def test_raw_response_create_from_file(self, async_client: AsyncAsktable) -> None:
545543
response = await async_client.datasources.with_raw_response.create_from_file(
546-
name="name",
547544
file=b"raw file contents",
548545
)
549546

@@ -555,7 +552,6 @@ async def test_raw_response_create_from_file(self, async_client: AsyncAsktable)
555552
@parametrize
556553
async def test_streaming_response_create_from_file(self, async_client: AsyncAsktable) -> None:
557554
async with async_client.datasources.with_streaming_response.create_from_file(
558-
name="name",
559555
file=b"raw file contents",
560556
) as response:
561557
assert not response.is_closed

0 commit comments

Comments
 (0)