UNPKG

@portive/client

Version:

Client to connect to and use Portive's cloud services for open source components

31 lines (30 loc) 1.41 kB
import { ClientFileInfo, UploadFileResponse } from "@portive/api-types"; import { UploadBeforeFetchEvent, UploadBeforeSendEvent, UploadErrorEvent, UploadEvent, UploadFinishEvent, UploadProgressEvent, UploadSuccessEvent } from "./types"; import { Client } from "../client"; export * from "./create-client-file"; export * from "../resize"; export * from "./types"; export declare function getUploadPolicyFromClientFileInfo({ client, clientFileInfo, }: { client: Client; clientFileInfo: ClientFileInfo; }): Promise<UploadFileResponse>; export declare function fetchUploadPolicy({ client, file, }: { client: Client; file: File; }): Promise<UploadFileResponse>; /** * This method can be used on its own for the entire upload process which * includes getting the upload policy and then sending the file to the * cloud servers on Amazon S3. */ export declare function uploadFile({ client, file, onBeforeFetch, onBeforeSend, onProgress, onError, onSuccess, onFinish, onUpdate, }: { client: Client; file: File; onBeforeFetch?: (e: UploadBeforeFetchEvent) => void; onBeforeSend?: (e: UploadBeforeSendEvent) => void; onProgress?: (e: UploadProgressEvent) => void; onError?: (e: UploadErrorEvent) => void; onSuccess?: (e: UploadSuccessEvent) => void; onFinish?: (e: UploadFinishEvent) => void; onUpdate?: (e: UploadEvent) => void; }): Promise<UploadFinishEvent>;