Skip to content

Commit 61e368f

Browse files
SK-971 file upload support (#191)
* SK-971 file upload support
1 parent 1a640c8 commit 61e368f

27 files changed

+893
-49
lines changed

skyflow/generated/rest/__init__.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@
2828
EntityTypes,
2929
ErrorResponse,
3030
ErrorResponseError,
31-
ErrorString,
3231
GooglerpcStatus,
3332
ProtobufAny,
3433
RedactionEnumRedaction,
3534
ReidentifyFileResponse,
3635
ReidentifyFileResponseOutput,
36+
ReidentifyFileResponseOutputType,
3737
ReidentifyFileResponseStatus,
3838
ReidentifyStringResponse,
3939
RequestActionType,
@@ -46,6 +46,7 @@
4646
Transformations,
4747
TransformationsShiftDates,
4848
TransformationsShiftDatesEntityTypesItem,
49+
UploadFileV2Response,
4950
Uuid,
5051
V1AuditAfterOptions,
5152
V1AuditEventResponse,
@@ -175,7 +176,6 @@
175176
"EntityTypes",
176177
"ErrorResponse",
177178
"ErrorResponseError",
178-
"ErrorString",
179179
"GooglerpcStatus",
180180
"InternalServerError",
181181
"NotFoundError",
@@ -189,6 +189,7 @@
189189
"ReidentifyFileRequestFormat",
190190
"ReidentifyFileResponse",
191191
"ReidentifyFileResponseOutput",
192+
"ReidentifyFileResponseOutputType",
192193
"ReidentifyFileResponseStatus",
193194
"ReidentifyStringRequestFormat",
194195
"ReidentifyStringResponse",
@@ -205,6 +206,7 @@
205206
"TransformationsShiftDates",
206207
"TransformationsShiftDatesEntityTypesItem",
207208
"UnauthorizedError",
209+
"UploadFileV2Response",
208210
"Uuid",
209211
"V1AuditAfterOptions",
210212
"V1AuditEventResponse",

skyflow/generated/rest/core/client_wrapper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def get_headers(self) -> typing.Dict[str, str]:
2424
headers: typing.Dict[str, str] = {
2525
"X-Fern-Language": "Python",
2626
"X-Fern-SDK-Name": "skyflow_vault",
27-
"X-Fern-SDK-Version": "0.0.252",
27+
"X-Fern-SDK-Version": "0.0.323",
2828
**(self.get_custom_headers() or {}),
2929
}
3030
headers["Authorization"] = f"Bearer {self._get_token()}"

skyflow/generated/rest/files/client.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,8 @@ def deidentify_pdf(
200200
vault_id: VaultId,
201201
file: DeidentifyPdfRequestFile,
202202
configuration_id: typing.Optional[ConfigurationId] = OMIT,
203-
density: typing.Optional[int] = OMIT,
204-
max_resolution: typing.Optional[int] = OMIT,
203+
density: typing.Optional[float] = OMIT,
204+
max_resolution: typing.Optional[float] = OMIT,
205205
entity_types: typing.Optional[EntityTypes] = OMIT,
206206
token_type: typing.Optional[TokenTypeWithoutVault] = OMIT,
207207
allow_regex: typing.Optional[AllowRegex] = OMIT,
@@ -221,10 +221,10 @@ def deidentify_pdf(
221221
222222
configuration_id : typing.Optional[ConfigurationId]
223223
224-
density : typing.Optional[int]
224+
density : typing.Optional[float]
225225
Pixel density at which to process the PDF file.
226226
227-
max_resolution : typing.Optional[int]
227+
max_resolution : typing.Optional[float]
228228
Max resolution at which to process the PDF file.
229229
230230
entity_types : typing.Optional[EntityTypes]
@@ -1020,8 +1020,8 @@ async def deidentify_pdf(
10201020
vault_id: VaultId,
10211021
file: DeidentifyPdfRequestFile,
10221022
configuration_id: typing.Optional[ConfigurationId] = OMIT,
1023-
density: typing.Optional[int] = OMIT,
1024-
max_resolution: typing.Optional[int] = OMIT,
1023+
density: typing.Optional[float] = OMIT,
1024+
max_resolution: typing.Optional[float] = OMIT,
10251025
entity_types: typing.Optional[EntityTypes] = OMIT,
10261026
token_type: typing.Optional[TokenTypeWithoutVault] = OMIT,
10271027
allow_regex: typing.Optional[AllowRegex] = OMIT,
@@ -1041,10 +1041,10 @@ async def deidentify_pdf(
10411041
10421042
configuration_id : typing.Optional[ConfigurationId]
10431043
1044-
density : typing.Optional[int]
1044+
density : typing.Optional[float]
10451045
Pixel density at which to process the PDF file.
10461046
1047-
max_resolution : typing.Optional[int]
1047+
max_resolution : typing.Optional[float]
10481048
Max resolution at which to process the PDF file.
10491049
10501050
entity_types : typing.Optional[EntityTypes]

skyflow/generated/rest/files/raw_client.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -287,8 +287,8 @@ def deidentify_pdf(
287287
vault_id: VaultId,
288288
file: DeidentifyPdfRequestFile,
289289
configuration_id: typing.Optional[ConfigurationId] = OMIT,
290-
density: typing.Optional[int] = OMIT,
291-
max_resolution: typing.Optional[int] = OMIT,
290+
density: typing.Optional[float] = OMIT,
291+
max_resolution: typing.Optional[float] = OMIT,
292292
entity_types: typing.Optional[EntityTypes] = OMIT,
293293
token_type: typing.Optional[TokenTypeWithoutVault] = OMIT,
294294
allow_regex: typing.Optional[AllowRegex] = OMIT,
@@ -308,10 +308,10 @@ def deidentify_pdf(
308308
309309
configuration_id : typing.Optional[ConfigurationId]
310310
311-
density : typing.Optional[int]
311+
density : typing.Optional[float]
312312
Pixel density at which to process the PDF file.
313313
314-
max_resolution : typing.Optional[int]
314+
max_resolution : typing.Optional[float]
315315
Max resolution at which to process the PDF file.
316316
317317
entity_types : typing.Optional[EntityTypes]
@@ -1575,8 +1575,8 @@ async def deidentify_pdf(
15751575
vault_id: VaultId,
15761576
file: DeidentifyPdfRequestFile,
15771577
configuration_id: typing.Optional[ConfigurationId] = OMIT,
1578-
density: typing.Optional[int] = OMIT,
1579-
max_resolution: typing.Optional[int] = OMIT,
1578+
density: typing.Optional[float] = OMIT,
1579+
max_resolution: typing.Optional[float] = OMIT,
15801580
entity_types: typing.Optional[EntityTypes] = OMIT,
15811581
token_type: typing.Optional[TokenTypeWithoutVault] = OMIT,
15821582
allow_regex: typing.Optional[AllowRegex] = OMIT,
@@ -1596,10 +1596,10 @@ async def deidentify_pdf(
15961596
15971597
configuration_id : typing.Optional[ConfigurationId]
15981598
1599-
density : typing.Optional[int]
1599+
density : typing.Optional[float]
16001600
Pixel density at which to process the PDF file.
16011601
1602-
max_resolution : typing.Optional[int]
1602+
max_resolution : typing.Optional[float]
16031603
Max resolution at which to process the PDF file.
16041604
16051605
entity_types : typing.Optional[EntityTypes]

skyflow/generated/rest/files/types/deidentify_image_request_masking_method.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
import typing
44

5-
DeidentifyImageRequestMaskingMethod = typing.Union[typing.Literal["blackout", "blur"], typing.Any]
5+
DeidentifyImageRequestMaskingMethod = typing.Union[typing.Literal["blackbox", "blur"], typing.Any]

skyflow/generated/rest/guardrails/client.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,8 @@ def check_guardrails(
6868
token="YOUR_TOKEN",
6969
)
7070
client.guardrails.check_guardrails(
71-
vault_id="VAULT_ID",
72-
text="I love to play cricket.",
73-
check_toxicity=True,
74-
deny_topics=["sports"],
71+
vault_id="vault_id",
72+
text="text",
7573
)
7674
"""
7775
_response = self._raw_client.check_guardrails(
@@ -145,10 +143,8 @@ async def check_guardrails(
145143
146144
async def main() -> None:
147145
await client.guardrails.check_guardrails(
148-
vault_id="VAULT_ID",
149-
text="I love to play cricket.",
150-
check_toxicity=True,
151-
deny_topics=["sports"],
146+
vault_id="vault_id",
147+
text="text",
152148
)
153149
154150

skyflow/generated/rest/records/client.py

Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from .. import core
66
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
77
from ..core.request_options import RequestOptions
8+
from ..types.upload_file_v_2_response import UploadFileV2Response
89
from ..types.v_1_batch_operation_response import V1BatchOperationResponse
910
from ..types.v_1_batch_record import V1BatchRecord
1011
from ..types.v_1_bulk_delete_record_response import V1BulkDeleteRecordResponse
@@ -700,6 +701,72 @@ def file_service_get_file_scan_status(
700701
)
701702
return _response.data
702703

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+
703770

704771
class AsyncRecordsClient:
705772
def __init__(self, *, client_wrapper: AsyncClientWrapper):
@@ -1455,3 +1522,77 @@ async def main() -> None:
14551522
vault_id, table_name, id, column_name, request_options=request_options
14561523
)
14571524
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

Comments
 (0)