Skip to content

Latest commit

 

History

History
172 lines (117 loc) · 9.58 KB

File metadata and controls

172 lines (117 loc) · 9.58 KB

File

(file)

Overview

Available Operations

init_upload

Initiate file upload.

Example Usage

import os

from friendli import SyncFriendli

with SyncFriendli(
    token=os.getenv("FRIENDLI_TOKEN", ""),
) as friendli:
    res = friendli.file.init_upload(
        digest="<value>", name="<value>", project_id="<id>", size=830650
    )

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
digest str ✔️ Digest of the file.
name str ✔️ Name of the file.
project_id str ✔️ ID of the project the file belongs to.
size int ✔️ Size of the file in bytes.
x_friendli_team OptionalNullable[str] ID of team to run requests as (optional parameter).
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.FileInitUploadResponse

Errors

Error Type Status Code Content Type
models.HTTPValidationError 422 application/json
models.SDKError 4XX, 5XX */*

complete_upload

Complete file upload.

Example Usage

import os

from friendli import SyncFriendli

with SyncFriendli(
    token=os.getenv("FRIENDLI_TOKEN", ""),
) as friendli:
    res = friendli.file.complete_upload(file_id="<id>")

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
file_id str ✔️ File ID
x_friendli_team OptionalNullable[str] ID of team to run requests as (optional parameter).
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

Any

Errors

Error Type Status Code Content Type
models.HTTPValidationError 422 application/json
models.SDKError 4XX, 5XX */*

get_info

Get file info.

Example Usage

import os

from friendli import SyncFriendli

with SyncFriendli(
    token=os.getenv("FRIENDLI_TOKEN", ""),
) as friendli:
    res = friendli.file.get_info(file_id="<id>")

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
file_id str ✔️ File ID
x_friendli_team OptionalNullable[str] ID of team to run requests as (optional parameter).
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.FileInfo

Errors

Error Type Status Code Content Type
models.HTTPValidationError 422 application/json
models.SDKError 4XX, 5XX */*

get_download_url

Get file download URL.

Example Usage

import os

from friendli import SyncFriendli

with SyncFriendli(
    token=os.getenv("FRIENDLI_TOKEN", ""),
) as friendli:
    res = friendli.file.get_download_url(file_id="<id>")

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
file_id str ✔️ File ID
x_friendli_team OptionalNullable[str] ID of team to run requests as (optional parameter).
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.FileGetDownloadURLResponse

Errors

Error Type Status Code Content Type
models.HTTPValidationError 422 application/json
models.SDKError 4XX, 5XX */*