|
5 | 5 | from .. import core |
6 | 6 | from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper |
7 | 7 | from ..core.request_options import RequestOptions |
| 8 | +from ..types.upload_file_v_2_response import UploadFileV2Response |
8 | 9 | from ..types.v_1_batch_operation_response import V1BatchOperationResponse |
9 | 10 | from ..types.v_1_batch_record import V1BatchRecord |
10 | 11 | from ..types.v_1_bulk_delete_record_response import V1BulkDeleteRecordResponse |
@@ -700,6 +701,72 @@ def file_service_get_file_scan_status( |
700 | 701 | ) |
701 | 702 | return _response.data |
702 | 703 |
|
| 704 | + def upload_file_v_2( |
| 705 | + self, |
| 706 | + vault_id: str, |
| 707 | + *, |
| 708 | + table_name: str, |
| 709 | + column_name: str, |
| 710 | + file: core.File, |
| 711 | + skyflow_id: typing.Optional[str] = OMIT, |
| 712 | + return_file_metadata: typing.Optional[bool] = OMIT, |
| 713 | + request_options: typing.Optional[RequestOptions] = None, |
| 714 | + ) -> UploadFileV2Response: |
| 715 | + """ |
| 716 | + Uploads the specified file to a record. If an existing record isn't specified, creates a new record and uploads the file to that record. |
| 717 | +
|
| 718 | + Parameters |
| 719 | + ---------- |
| 720 | + vault_id : str |
| 721 | + ID of the vault. |
| 722 | +
|
| 723 | + table_name : str |
| 724 | + Name of the table to upload the file to. |
| 725 | +
|
| 726 | + column_name : str |
| 727 | + Name of the column to upload the file to. The column must have a `file` data type. |
| 728 | +
|
| 729 | + file : core.File |
| 730 | + See core.File for more documentation |
| 731 | +
|
| 732 | + skyflow_id : typing.Optional[str] |
| 733 | + Skyflow ID of the record to upload the file to. If `skyflowID` isn't specified, a new record will be created. |
| 734 | +
|
| 735 | + return_file_metadata : typing.Optional[bool] |
| 736 | + If `true`, returns metadata about the uploaded file. |
| 737 | +
|
| 738 | + request_options : typing.Optional[RequestOptions] |
| 739 | + Request-specific configuration. |
| 740 | +
|
| 741 | + Returns |
| 742 | + ------- |
| 743 | + UploadFileV2Response |
| 744 | + File uploaded successfully. |
| 745 | +
|
| 746 | + Examples |
| 747 | + -------- |
| 748 | + from skyflow import Skyflow |
| 749 | +
|
| 750 | + client = Skyflow( |
| 751 | + token="YOUR_TOKEN", |
| 752 | + ) |
| 753 | + client.records.upload_file_v_2( |
| 754 | + vault_id="d4410ea01d83473ca09a24c6b03096d4", |
| 755 | + table_name="tableName", |
| 756 | + column_name="columnName", |
| 757 | + ) |
| 758 | + """ |
| 759 | + _response = self._raw_client.upload_file_v_2( |
| 760 | + vault_id, |
| 761 | + table_name=table_name, |
| 762 | + column_name=column_name, |
| 763 | + file=file, |
| 764 | + skyflow_id=skyflow_id, |
| 765 | + return_file_metadata=return_file_metadata, |
| 766 | + request_options=request_options, |
| 767 | + ) |
| 768 | + return _response.data |
| 769 | + |
703 | 770 |
|
704 | 771 | class AsyncRecordsClient: |
705 | 772 | def __init__(self, *, client_wrapper: AsyncClientWrapper): |
@@ -1455,3 +1522,77 @@ async def main() -> None: |
1455 | 1522 | vault_id, table_name, id, column_name, request_options=request_options |
1456 | 1523 | ) |
1457 | 1524 | return _response.data |
| 1525 | + |
| 1526 | + async def upload_file_v_2( |
| 1527 | + self, |
| 1528 | + vault_id: str, |
| 1529 | + *, |
| 1530 | + table_name: str, |
| 1531 | + column_name: str, |
| 1532 | + file: core.File, |
| 1533 | + skyflow_id: typing.Optional[str] = OMIT, |
| 1534 | + return_file_metadata: typing.Optional[bool] = OMIT, |
| 1535 | + request_options: typing.Optional[RequestOptions] = None, |
| 1536 | + ) -> UploadFileV2Response: |
| 1537 | + """ |
| 1538 | + Uploads the specified file to a record. If an existing record isn't specified, creates a new record and uploads the file to that record. |
| 1539 | +
|
| 1540 | + Parameters |
| 1541 | + ---------- |
| 1542 | + vault_id : str |
| 1543 | + ID of the vault. |
| 1544 | +
|
| 1545 | + table_name : str |
| 1546 | + Name of the table to upload the file to. |
| 1547 | +
|
| 1548 | + column_name : str |
| 1549 | + Name of the column to upload the file to. The column must have a `file` data type. |
| 1550 | +
|
| 1551 | + file : core.File |
| 1552 | + See core.File for more documentation |
| 1553 | +
|
| 1554 | + skyflow_id : typing.Optional[str] |
| 1555 | + Skyflow ID of the record to upload the file to. If `skyflowID` isn't specified, a new record will be created. |
| 1556 | +
|
| 1557 | + return_file_metadata : typing.Optional[bool] |
| 1558 | + If `true`, returns metadata about the uploaded file. |
| 1559 | +
|
| 1560 | + request_options : typing.Optional[RequestOptions] |
| 1561 | + Request-specific configuration. |
| 1562 | +
|
| 1563 | + Returns |
| 1564 | + ------- |
| 1565 | + UploadFileV2Response |
| 1566 | + File uploaded successfully. |
| 1567 | +
|
| 1568 | + Examples |
| 1569 | + -------- |
| 1570 | + import asyncio |
| 1571 | +
|
| 1572 | + from skyflow import AsyncSkyflow |
| 1573 | +
|
| 1574 | + client = AsyncSkyflow( |
| 1575 | + token="YOUR_TOKEN", |
| 1576 | + ) |
| 1577 | +
|
| 1578 | +
|
| 1579 | + async def main() -> None: |
| 1580 | + await client.records.upload_file_v_2( |
| 1581 | + vault_id="d4410ea01d83473ca09a24c6b03096d4", |
| 1582 | + table_name="tableName", |
| 1583 | + column_name="columnName", |
| 1584 | + ) |
| 1585 | +
|
| 1586 | +
|
| 1587 | + asyncio.run(main()) |
| 1588 | + """ |
| 1589 | + _response = await self._raw_client.upload_file_v_2( |
| 1590 | + vault_id, |
| 1591 | + table_name=table_name, |
| 1592 | + column_name=column_name, |
| 1593 | + file=file, |
| 1594 | + skyflow_id=skyflow_id, |
| 1595 | + return_file_metadata=return_file_metadata, |
| 1596 | + request_options=request_options, |
| 1597 | + ) |
| 1598 | + return _response.data |
0 commit comments