Skip to content

Latest commit

 

History

History
230 lines (157 loc) · 11.5 KB

README.md

File metadata and controls

230 lines (157 loc) · 11.5 KB

Files

(files)

Overview

Available Operations

list

List files.

Example Usage

from polar_sdk import Polar

with Polar(
    access_token="<YOUR_BEARER_TOKEN_HERE>",
) as polar:

    res = polar.files.list()

    while res is not None:
        # Handle items

        res = res.next()

Parameters

Parameter Type Required Description
organization_id OptionalNullable[str] N/A
ids List[str] List of file IDs to get.
page Optional[int] Page number, defaults to 1.
limit Optional[int] Size of a page, defaults to 10. Maximum is 100.
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.FilesListResponse

Errors

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

create

Create a file.

Example Usage

from polar_sdk import Polar

with Polar(
    access_token="<YOUR_BEARER_TOKEN_HERE>",
) as polar:

    res = polar.files.create(request={
        "name": "<value>",
        "mime_type": "<value>",
        "size": 638424,
        "upload": {
            "parts": [
                {
                    "number": 417458,
                    "chunk_start": 134365,
                    "chunk_end": 69025,
                },
            ],
        },
        "service": "organization_avatar",
    })

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
request models.FileCreate ✔️ The request object to use for the request.
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.FileUpload

Errors

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

uploaded

Complete a file upload.

Example Usage

from polar_sdk import Polar

with Polar(
    access_token="<YOUR_BEARER_TOKEN_HERE>",
) as polar:

    res = polar.files.uploaded(id="<value>", file_upload_completed={
        "id": "<id>",
        "path": "/sys",
        "parts": [

        ],
    })

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
id str ✔️ The file ID.
file_upload_completed models.FileUploadCompleted ✔️ N/A
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.FilesUploadedResponseFilesUploaded

Errors

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

update

Update a file.

Example Usage

from polar_sdk import Polar

with Polar(
    access_token="<YOUR_BEARER_TOKEN_HERE>",
) as polar:

    res = polar.files.update(id="<value>", file_patch={})

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
id str ✔️ The file ID.
file_patch models.FilePatch ✔️ N/A
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.FilesUpdateResponseFilesUpdate

Errors

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

delete

Delete a file.

Example Usage

from polar_sdk import Polar

with Polar(
    access_token="<YOUR_BEARER_TOKEN_HERE>",
) as polar:

    polar.files.delete(id="<value>")

    # Use the SDK ...

Parameters

Parameter Type Required Description
id str ✔️ N/A
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Errors

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