Skip to content

Latest commit

 

History

History
468 lines (360 loc) · 151 KB

README.md

File metadata and controls

468 lines (360 loc) · 151 KB

Files

(file_storage.files)

Overview

Available Operations

list

List Files

Example Usage

import apideck_unify
from apideck_unify import Apideck
import os

with Apideck(
    api_key=os.getenv("APIDECK_API_KEY", ""),
    consumer_id="test-consumer",
    app_id="dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
) as apideck:

    res = apideck.file_storage.files.list(service_id="salesforce", filter_={
        "drive_id": "1234",
        "folder_id": "root",
        "shared": True,
    }, sort={
        "by": apideck_unify.FilesSortBy.UPDATED_AT,
        "direction": apideck_unify.SortDirection.DESC,
    }, pass_through={
        "search": "San Francisco",
    }, fields="id,updated_at")

    while res is not None:
        # Handle items

        res = res.next()

Parameters

Parameter Type Required Description Example
raw Optional[bool] Include raw response. Mostly used for debugging purposes
service_id Optional[str] Provide the service id you want to call (e.g., pipedrive). Only needed when a consumer has activated multiple integrations for a Unified API. salesforce
cursor OptionalNullable[str] Cursor to start from. You can find cursors for next/previous pages in the meta.cursors property of the response.
limit Optional[int] Number of results to return. Minimum 1, Maximum 200, Default 20
filter_ Optional[models.FilesFilter] Apply filters
sort Optional[models.FilesSort] Apply sorting {
"by": "updated_at",
"direction": "desc"
}
pass_through Dict[str, Any] Optional unmapped key/values that will be passed through to downstream as query parameters. Ie: ?pass_through[search]=leads becomes ?search=leads {
"search": "San Francisco"
}
fields OptionalNullable[str] The 'fields' parameter allows API users to specify the fields they want to include in the API response. If this parameter is not present, the API will return all available fields. If this parameter is present, only the fields specified in the comma-separated string will be included in the response. Nested properties can also be requested by using a dot notation.

Example: fields=name,email,addresses.city

In the example above, the response will only include the fields "name", "email" and "addresses.city". If any other fields are available, they will be excluded.
id,updated_at
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.FileStorageFilesAllResponse

Errors

Error Type Status Code Content Type
models.BadRequestResponse 400 application/json
models.UnauthorizedResponse 401 application/json
models.PaymentRequiredResponse 402 application/json
models.NotFoundResponse 404 application/json
models.UnprocessableResponse 422 application/json
models.APIError 4XX, 5XX */*

search

Search Files

Example Usage

from apideck_unify import Apideck
import os

with Apideck(
    api_key=os.getenv("APIDECK_API_KEY", ""),
    consumer_id="test-consumer",
    app_id="dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
) as apideck:

    res = apideck.file_storage.files.search(query="logo jpg", service_id="salesforce", pass_through_param={
        "search": "San Francisco",
    }, fields="id,updated_at", filter_={
        "drive_id": "1234",
        "folder_id": "root",
        "shared": True,
    }, drive_id="1234", pass_through=[
        {
            "service_id": "<id>",
            "extend_paths": [
                {
                    "path": "$.nested.property",
                    "value": {
                        "TaxClassificationRef": {
                            "value": "EUC-99990201-V1-00020000",
                        },
                    },
                },
            ],
        },
    ])

    assert res.get_files_response is not None

    # Handle response
    print(res.get_files_response)

Parameters

Parameter Type Required Description Example
query str ✔️ The query to search for. May match across multiple fields. logo jpg
service_id Optional[str] Provide the service id you want to call (e.g., pipedrive). Only needed when a consumer has activated multiple integrations for a Unified API. salesforce
pass_through_param Dict[str, Any] Optional unmapped key/values that will be passed through to downstream as query parameters. Ie: ?pass_through[search]=leads becomes ?search=leads {
"search": "San Francisco"
}
fields OptionalNullable[str] The 'fields' parameter allows API users to specify the fields they want to include in the API response. If this parameter is not present, the API will return all available fields. If this parameter is present, only the fields specified in the comma-separated string will be included in the response. Nested properties can also be requested by using a dot notation.

Example: fields=name,email,addresses.city

In the example above, the response will only include the fields "name", "email" and "addresses.city". If any other fields are available, they will be excluded.
id,updated_at
cursor OptionalNullable[str] Cursor to start from. You can find cursors for next/previous pages in the meta.cursors property of the response.
limit Optional[int] Number of results to return. Minimum 1, Maximum 200, Default 20
filter_ Optional[models.FilesFilter] Apply filters
drive_id Optional[str] ID of the drive to filter on 1234
pass_through List[models.PassThroughBody] The pass_through property allows passing service-specific, custom data or structured modifications in request body when creating or updating resources.
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.FileStorageFilesSearchResponse

Errors

Error Type Status Code Content Type
models.BadRequestResponse 400 application/json
models.UnauthorizedResponse 401 application/json
models.PaymentRequiredResponse 402 application/json
models.NotFoundResponse 404 application/json
models.UnprocessableResponse 422 application/json
models.APIError 4XX, 5XX */*

get

Get File

Example Usage

from apideck_unify import Apideck
import os

with Apideck(
    api_key=os.getenv("APIDECK_API_KEY", ""),
    consumer_id="test-consumer",
    app_id="dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
) as apideck:

    res = apideck.file_storage.files.get(id="<id>", service_id="salesforce", fields="id,updated_at")

    assert res.get_file_response is not None

    # Handle response
    print(res.get_file_response)

Parameters

Parameter Type Required Description Example
id str ✔️ ID of the record you are acting upon.
service_id Optional[str] Provide the service id you want to call (e.g., pipedrive). Only needed when a consumer has activated multiple integrations for a Unified API. salesforce
raw Optional[bool] Include raw response. Mostly used for debugging purposes
fields OptionalNullable[str] The 'fields' parameter allows API users to specify the fields they want to include in the API response. If this parameter is not present, the API will return all available fields. If this parameter is present, only the fields specified in the comma-separated string will be included in the response. Nested properties can also be requested by using a dot notation.

Example: fields=name,email,addresses.city

In the example above, the response will only include the fields "name", "email" and "addresses.city". If any other fields are available, they will be excluded.
id,updated_at
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.FileStorageFilesOneResponse

Errors

Error Type Status Code Content Type
models.BadRequestResponse 400 application/json
models.UnauthorizedResponse 401 application/json
models.PaymentRequiredResponse 402 application/json
models.NotFoundResponse 404 application/json
models.UnprocessableResponse 422 application/json
models.APIError 4XX, 5XX */*

update

Rename or move File

Example Usage

from apideck_unify import Apideck
import os

with Apideck(
    api_key=os.getenv("APIDECK_API_KEY", ""),
    consumer_id="test-consumer",
    app_id="dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
) as apideck:

    res = apideck.file_storage.files.update(id="<id>", service_id="salesforce", name="New Name.pdf", description="Renamed PDF Document", parent_folder_id="1234", pass_through=[
        {
            "service_id": "<id>",
            "extend_paths": [
                {
                    "path": "$.nested.property",
                    "value": {
                        "TaxClassificationRef": {
                            "value": "EUC-99990201-V1-00020000",
                        },
                    },
                },
                {
                    "path": "$.nested.property",
                    "value": {
                        "TaxClassificationRef": {
                            "value": "EUC-99990201-V1-00020000",
                        },
                    },
                },
            ],
        },
        {
            "service_id": "<id>",
            "extend_paths": [
                {
                    "path": "$.nested.property",
                    "value": {
                        "TaxClassificationRef": {
                            "value": "EUC-99990201-V1-00020000",
                        },
                    },
                },
            ],
        },
        {
            "service_id": "<id>",
            "extend_paths": [
                {
                    "path": "$.nested.property",
                    "value": {
                        "TaxClassificationRef": {
                            "value": "EUC-99990201-V1-00020000",
                        },
                    },
                },
                {
                    "path": "$.nested.property",
                    "value": {
                        "TaxClassificationRef": {
                            "value": "EUC-99990201-V1-00020000",
                        },
                    },
                },
                {
                    "path": "$.nested.property",
                    "value": {
                        "TaxClassificationRef": {
                            "value": "EUC-99990201-V1-00020000",
                        },
                    },
                },
            ],
        },
    ])

    assert res.update_file_response is not None

    # Handle response
    print(res.update_file_response)

Parameters

Parameter Type Required Description Example
id str ✔️ ID of the record you are acting upon.
service_id Optional[str] Provide the service id you want to call (e.g., pipedrive). Only needed when a consumer has activated multiple integrations for a Unified API. salesforce
raw Optional[bool] Include raw response. Mostly used for debugging purposes
name Optional[str] The name of the file. New Name.pdf
description Optional[str] Optional description of the file. Renamed PDF Document
parent_folder_id Optional[str] The parent folder to create the new file within. This can be an ID or a path depending on the downstream folder. Please see the connector section below to see downstream specific gotchas. 1234
pass_through List[models.PassThroughBody] The pass_through property allows passing service-specific, custom data or structured modifications in request body when creating or updating resources.
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.FileStorageFilesUpdateResponse

Errors

Error Type Status Code Content Type
models.BadRequestResponse 400 application/json
models.UnauthorizedResponse 401 application/json
models.PaymentRequiredResponse 402 application/json
models.NotFoundResponse 404 application/json
models.UnprocessableResponse 422 application/json
models.APIError 4XX, 5XX */*

delete

Delete File

Example Usage

from apideck_unify import Apideck
import os

with Apideck(
    api_key=os.getenv("APIDECK_API_KEY", ""),
    consumer_id="test-consumer",
    app_id="dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
) as apideck:

    res = apideck.file_storage.files.delete(id="<id>", service_id="salesforce")

    assert res.delete_file_response is not None

    # Handle response
    print(res.delete_file_response)

Parameters

Parameter Type Required Description Example
id str ✔️ ID of the record you are acting upon.
service_id Optional[str] Provide the service id you want to call (e.g., pipedrive). Only needed when a consumer has activated multiple integrations for a Unified API. salesforce
raw Optional[bool] Include raw response. Mostly used for debugging purposes
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.FileStorageFilesDeleteResponse

Errors

Error Type Status Code Content Type
models.BadRequestResponse 400 application/json
models.UnauthorizedResponse 401 application/json
models.PaymentRequiredResponse 402 application/json
models.NotFoundResponse 404 application/json
models.UnprocessableResponse 422 application/json
models.APIError 4XX, 5XX */*

download

Download File

Example Usage

from apideck_unify import Apideck
import os

with Apideck(
    api_key=os.getenv("APIDECK_API_KEY", ""),
    consumer_id="test-consumer",
    app_id="dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
) as apideck:

    res = apideck.file_storage.files.download(id="<id>", service_id="salesforce", fields="id,updated_at")

    assert res.get_file_download_response is not None

    # Handle response
    print(res.get_file_download_response)

Parameters

Parameter Type Required Description Example
id str ✔️ ID of the record you are acting upon.
service_id Optional[str] Provide the service id you want to call (e.g., pipedrive). Only needed when a consumer has activated multiple integrations for a Unified API. salesforce
fields OptionalNullable[str] The 'fields' parameter allows API users to specify the fields they want to include in the API response. If this parameter is not present, the API will return all available fields. If this parameter is present, only the fields specified in the comma-separated string will be included in the response. Nested properties can also be requested by using a dot notation.

Example: fields=name,email,addresses.city

In the example above, the response will only include the fields "name", "email" and "addresses.city". If any other fields are available, they will be excluded.
id,updated_at
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.FileStorageFilesDownloadResponse

Errors

Error Type Status Code Content Type
models.BadRequestResponse 400 application/json
models.UnauthorizedResponse 401 application/json
models.PaymentRequiredResponse 402 application/json
models.NotFoundResponse 404 application/json
models.UnprocessableResponse 422 application/json
models.APIError 4XX, 5XX */*

export

Export File

Example Usage

from apideck_unify import Apideck
import os

with Apideck(
    api_key=os.getenv("APIDECK_API_KEY", ""),
    consumer_id="test-consumer",
    app_id="dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
) as apideck:

    res = apideck.file_storage.files.export(id="<id>", file_format="pdf", service_id="salesforce", fields="id,updated_at")

    assert res.get_file_download_response is not None

    # Handle response
    print(res.get_file_download_response)

Parameters

Parameter Type Required Description Example
id str ✔️ ID of the record you are acting upon.
file_format str ✔️ File format to export this file to. A list of available file formats for the current file is available as export_formats on the File resource. pdf
service_id Optional[str] Provide the service id you want to call (e.g., pipedrive). Only needed when a consumer has activated multiple integrations for a Unified API. salesforce
fields OptionalNullable[str] The 'fields' parameter allows API users to specify the fields they want to include in the API response. If this parameter is not present, the API will return all available fields. If this parameter is present, only the fields specified in the comma-separated string will be included in the response. Nested properties can also be requested by using a dot notation.

Example: fields=name,email,addresses.city

In the example above, the response will only include the fields "name", "email" and "addresses.city". If any other fields are available, they will be excluded.
id,updated_at
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.FileStorageFilesExportResponse

Errors

Error Type Status Code Content Type
models.BadRequestResponse 400 application/json
models.UnauthorizedResponse 401 application/json
models.PaymentRequiredResponse 402 application/json
models.NotFoundResponse 404 application/json
models.UnprocessableResponse 422 application/json
models.APIError 4XX, 5XX */*