Skip to content

Latest commit

 

History

History
261 lines (190 loc) · 15.4 KB

README.md

File metadata and controls

261 lines (190 loc) · 15.4 KB

UploadSessions

(fileStorage->uploadSessions)

Overview

Available Operations

  • create - Start Upload Session
  • delete - Abort Upload Session
  • finish - Finish Upload Session
  • get - Get Upload Session

create

Start an Upload Session. Upload sessions are used to upload large files, use the Upload File endpoint to upload smaller files (up to 100MB). Note that the base URL is upload.apideck.com instead of unify.apideck.com. For more information on uploads, refer to the file upload guide.

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use Apideck\Unify;
use Apideck\Unify\Models\Components;
use Apideck\Unify\Models\Operations;

$security = '<YOUR_BEARER_TOKEN_HERE>';

$sdk = Unify\Apideck::builder()
    ->setConsumerId('test-consumer')
    ->setAppId('dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX')
    ->setSecurity($security)->build();

$request = new Operations\FileStorageUploadSessionsAddRequest(
    createUploadSessionRequest: new Components\CreateUploadSessionRequest(
        name: 'Documents',
        parentFolderId: '1234',
        driveId: '1234',
        size: 1810673,
        passThrough: [
            new Components\PassThroughBody(
                serviceId: '<id>',
                extendPaths: [
                    new Components\ExtendPaths(
                        path: '$.nested.property',
                        value: [
                            'TaxClassificationRef' => [
                                'value' => 'EUC-99990201-V1-00020000',
                            ],
                        ],
                    ),
                ],
            ),
        ],
    ),
    serviceId: 'salesforce',
);

$response = $sdk->fileStorage->uploadSessions->create(
    request: $request
);

if ($response->createUploadSessionResponse !== null) {
    // handle response
}

Parameters

Parameter Type Required Description
$request Operations\FileStorageUploadSessionsAddRequest ✔️ The request object to use for the request.
$serverURL string An optional server URL to use.

Response

?Operations\FileStorageUploadSessionsAddResponse

Errors

Error Type Status Code Content Type
Errors\BadRequestResponse 400 application/json
Errors\UnauthorizedResponse 401 application/json
Errors\PaymentRequiredResponse 402 application/json
Errors\NotFoundResponse 404 application/json
Errors\UnprocessableResponse 422 application/json
Errors\APIException 4XX, 5XX */*

delete

Abort Upload Session. Note that the base URL is upload.apideck.com instead of unify.apideck.com. For more information on uploads, refer to the file upload guide.

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use Apideck\Unify;
use Apideck\Unify\Models\Operations;

$security = '<YOUR_BEARER_TOKEN_HERE>';

$sdk = Unify\Apideck::builder()
    ->setConsumerId('test-consumer')
    ->setAppId('dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX')
    ->setSecurity($security)->build();

$request = new Operations\FileStorageUploadSessionsDeleteRequest(
    id: '<id>',
    serviceId: 'salesforce',
);

$response = $sdk->fileStorage->uploadSessions->delete(
    request: $request
);

if ($response->deleteUploadSessionResponse !== null) {
    // handle response
}

Parameters

Parameter Type Required Description
$request Operations\FileStorageUploadSessionsDeleteRequest ✔️ The request object to use for the request.

Response

?Operations\FileStorageUploadSessionsDeleteResponse

Errors

Error Type Status Code Content Type
Errors\BadRequestResponse 400 application/json
Errors\UnauthorizedResponse 401 application/json
Errors\PaymentRequiredResponse 402 application/json
Errors\NotFoundResponse 404 application/json
Errors\UnprocessableResponse 422 application/json
Errors\APIException 4XX, 5XX */*

finish

Finish Upload Session. Only call this endpoint after all File parts have been uploaded to Upload part of File. Note that the base URL is upload.apideck.com instead of unify.apideck.com. For more information on uploads, refer to the file upload guide.

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use Apideck\Unify;
use Apideck\Unify\Models\Operations;

$security = '<YOUR_BEARER_TOKEN_HERE>';

$sdk = Unify\Apideck::builder()
    ->setConsumerId('test-consumer')
    ->setAppId('dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX')
    ->setSecurity($security)->build();

$request = new Operations\FileStorageUploadSessionsFinishRequest(
    id: '<id>',
    serviceId: 'salesforce',
    digest: 'sha=fpRyg5eVQletdZqEKaFlqwBXJzM=',
);

$response = $sdk->fileStorage->uploadSessions->finish(
    request: $request
);

if ($response->getFileResponse !== null) {
    // handle response
}

Parameters

Parameter Type Required Description
$request Operations\FileStorageUploadSessionsFinishRequest ✔️ The request object to use for the request.
$serverURL string An optional server URL to use.

Response

?Operations\FileStorageUploadSessionsFinishResponse

Errors

Error Type Status Code Content Type
Errors\BadRequestResponse 400 application/json
Errors\UnauthorizedResponse 401 application/json
Errors\PaymentRequiredResponse 402 application/json
Errors\NotFoundResponse 404 application/json
Errors\UnprocessableResponse 422 application/json
Errors\APIException 4XX, 5XX */*

get

Get Upload Session. Use the part_size to split your file into parts. Upload the parts to the Upload part of File endpoint. Note that the base URL is upload.apideck.com instead of unify.apideck.com. For more information on uploads, refer to the file upload guide.

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use Apideck\Unify;
use Apideck\Unify\Models\Operations;

$security = '<YOUR_BEARER_TOKEN_HERE>';

$sdk = Unify\Apideck::builder()
    ->setConsumerId('test-consumer')
    ->setAppId('dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX')
    ->setSecurity($security)->build();

$request = new Operations\FileStorageUploadSessionsOneRequest(
    id: '<id>',
    serviceId: 'salesforce',
    fields: 'id,updated_at',
);

$response = $sdk->fileStorage->uploadSessions->get(
    request: $request
);

if ($response->getUploadSessionResponse !== null) {
    // handle response
}

Parameters

Parameter Type Required Description
$request Operations\FileStorageUploadSessionsOneRequest ✔️ The request object to use for the request.
$serverURL string An optional server URL to use.

Response

?Operations\FileStorageUploadSessionsOneResponse

Errors

Error Type Status Code Content Type
Errors\BadRequestResponse 400 application/json
Errors\UnauthorizedResponse 401 application/json
Errors\PaymentRequiredResponse 402 application/json
Errors\NotFoundResponse 404 application/json
Errors\UnprocessableResponse 422 application/json
Errors\APIException 4XX, 5XX */*