Skip to content

Latest commit

 

History

History
299 lines (228 loc) · 18.9 KB

README.md

File metadata and controls

299 lines (228 loc) · 18.9 KB

UploadSessions

(fileStorage().uploadSessions())

Overview

Available Operations

  • create - Start Upload Session
  • get - Get Upload Session
  • delete - Abort Upload Session
  • finish - Finish 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

package hello.world;

import com.apideck.unify.Apideck;
import com.apideck.unify.models.components.CreateUploadSessionRequest;
import com.apideck.unify.models.components.ExtendPaths;
import com.apideck.unify.models.components.PassThroughBody;
import com.apideck.unify.models.errors.BadRequestResponse;
import com.apideck.unify.models.errors.NotFoundResponse;
import com.apideck.unify.models.errors.PaymentRequiredResponse;
import com.apideck.unify.models.errors.UnauthorizedResponse;
import com.apideck.unify.models.errors.UnprocessableResponse;
import com.apideck.unify.models.operations.FileStorageUploadSessionsAddRequest;
import com.apideck.unify.models.operations.FileStorageUploadSessionsAddResponse;
import java.lang.Exception;
import java.util.List;
import java.util.Map;

public class Application {

    public static void main(String[] args) throws BadRequestResponse, UnauthorizedResponse, PaymentRequiredResponse, NotFoundResponse, UnprocessableResponse, Exception {

        Apideck sdk = Apideck.builder()
                .apiKey("<YOUR_API_KEY_HERE>")
                .consumerId("test-consumer")
                .appId("dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX")
            .build();

        FileStorageUploadSessionsAddRequest req = FileStorageUploadSessionsAddRequest.builder()
                .createUploadSessionRequest(CreateUploadSessionRequest.builder()
                    .name("Documents")
                    .parentFolderId("1234")
                    .size(1810673L)
                    .driveId("1234")
                    .passThrough(List.of(
                        PassThroughBody.builder()
                            .serviceId("<id>")
                            .extendPaths(List.of(
                                ExtendPaths.builder()
                                    .path("$.nested.property")
                                    .value(Map.ofEntries(\n    Map.entry("TaxClassificationRef", Map.ofEntries(\n    Map.entry("value", "EUC-99990201-V1-00020000")))))
                                    .build()))
                            .build()))
                    .build())
                .serviceId("salesforce")
                .build();

        FileStorageUploadSessionsAddResponse res = sdk.fileStorage().uploadSessions().create()
                .request(req)
                .call();

        if (res.createUploadSessionResponse().isPresent()) {
            // handle response
        }
    }
}

Parameters

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

Response

FileStorageUploadSessionsAddResponse

Errors

Error Type Status Code Content Type
models/errors/BadRequestResponse 400 application/json
models/errors/UnauthorizedResponse 401 application/json
models/errors/PaymentRequiredResponse 402 application/json
models/errors/NotFoundResponse 404 application/json
models/errors/UnprocessableResponse 422 application/json
models/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

package hello.world;

import com.apideck.unify.Apideck;
import com.apideck.unify.models.errors.BadRequestResponse;
import com.apideck.unify.models.errors.NotFoundResponse;
import com.apideck.unify.models.errors.PaymentRequiredResponse;
import com.apideck.unify.models.errors.UnauthorizedResponse;
import com.apideck.unify.models.errors.UnprocessableResponse;
import com.apideck.unify.models.operations.FileStorageUploadSessionsOneRequest;
import com.apideck.unify.models.operations.FileStorageUploadSessionsOneResponse;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws BadRequestResponse, UnauthorizedResponse, PaymentRequiredResponse, NotFoundResponse, UnprocessableResponse, Exception {

        Apideck sdk = Apideck.builder()
                .apiKey("<YOUR_API_KEY_HERE>")
                .consumerId("test-consumer")
                .appId("dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX")
            .build();

        FileStorageUploadSessionsOneRequest req = FileStorageUploadSessionsOneRequest.builder()
                .id("<id>")
                .serviceId("salesforce")
                .fields("id,updated_at")
                .build();

        FileStorageUploadSessionsOneResponse res = sdk.fileStorage().uploadSessions().get()
                .request(req)
                .call();

        if (res.getUploadSessionResponse().isPresent()) {
            // handle response
        }
    }
}

Parameters

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

Response

FileStorageUploadSessionsOneResponse

Errors

Error Type Status Code Content Type
models/errors/BadRequestResponse 400 application/json
models/errors/UnauthorizedResponse 401 application/json
models/errors/PaymentRequiredResponse 402 application/json
models/errors/NotFoundResponse 404 application/json
models/errors/UnprocessableResponse 422 application/json
models/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

package hello.world;

import com.apideck.unify.Apideck;
import com.apideck.unify.models.errors.BadRequestResponse;
import com.apideck.unify.models.errors.NotFoundResponse;
import com.apideck.unify.models.errors.PaymentRequiredResponse;
import com.apideck.unify.models.errors.UnauthorizedResponse;
import com.apideck.unify.models.errors.UnprocessableResponse;
import com.apideck.unify.models.operations.FileStorageUploadSessionsDeleteRequest;
import com.apideck.unify.models.operations.FileStorageUploadSessionsDeleteResponse;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws BadRequestResponse, UnauthorizedResponse, PaymentRequiredResponse, NotFoundResponse, UnprocessableResponse, Exception {

        Apideck sdk = Apideck.builder()
                .apiKey("<YOUR_API_KEY_HERE>")
                .consumerId("test-consumer")
                .appId("dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX")
            .build();

        FileStorageUploadSessionsDeleteRequest req = FileStorageUploadSessionsDeleteRequest.builder()
                .id("<id>")
                .serviceId("salesforce")
                .build();

        FileStorageUploadSessionsDeleteResponse res = sdk.fileStorage().uploadSessions().delete()
                .request(req)
                .call();

        if (res.deleteUploadSessionResponse().isPresent()) {
            // handle response
        }
    }
}

Parameters

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

Response

FileStorageUploadSessionsDeleteResponse

Errors

Error Type Status Code Content Type
models/errors/BadRequestResponse 400 application/json
models/errors/UnauthorizedResponse 401 application/json
models/errors/PaymentRequiredResponse 402 application/json
models/errors/NotFoundResponse 404 application/json
models/errors/UnprocessableResponse 422 application/json
models/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

package hello.world;

import com.apideck.unify.Apideck;
import com.apideck.unify.models.errors.BadRequestResponse;
import com.apideck.unify.models.errors.NotFoundResponse;
import com.apideck.unify.models.errors.PaymentRequiredResponse;
import com.apideck.unify.models.errors.UnauthorizedResponse;
import com.apideck.unify.models.errors.UnprocessableResponse;
import com.apideck.unify.models.operations.FileStorageUploadSessionsFinishRequest;
import com.apideck.unify.models.operations.FileStorageUploadSessionsFinishResponse;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws BadRequestResponse, UnauthorizedResponse, PaymentRequiredResponse, NotFoundResponse, UnprocessableResponse, Exception {

        Apideck sdk = Apideck.builder()
                .apiKey("<YOUR_API_KEY_HERE>")
                .consumerId("test-consumer")
                .appId("dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX")
            .build();

        FileStorageUploadSessionsFinishRequest req = FileStorageUploadSessionsFinishRequest.builder()
                .id("<id>")
                .serviceId("salesforce")
                .digest("sha=fpRyg5eVQletdZqEKaFlqwBXJzM=")
                .build();

        FileStorageUploadSessionsFinishResponse res = sdk.fileStorage().uploadSessions().finish()
                .request(req)
                .call();

        if (res.getFileResponse().isPresent()) {
            // handle response
        }
    }
}

Parameters

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

Response

FileStorageUploadSessionsFinishResponse

Errors

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