UNPKG

@nhost/hasura-storage-js

Version:

Hasura-storage client

56 lines (55 loc) 2.23 kB
import { ApiDeleteParams, ApiDeleteResponse, ApiGetPresignedUrlParams, ApiGetPresignedUrlResponse, StorageDownloadFileParams, StorageDownloadFileResponse, StorageUploadFileParams, StorageUploadFileResponse, StorageUploadFormDataParams, StorageUploadFormDataResponse } from './utils/types'; /** * @internal * This is an internal class. */ export declare class HasuraStorageApi { private url; private accessToken?; private adminSecret?; private headers; constructor({ url }: { url: string; }); uploadFormData({ formData, bucketId, headers: extraHeaders }: StorageUploadFormDataParams): Promise<StorageUploadFormDataResponse>; uploadFile({ file, bucketId, id, name, headers: extraHeaders }: StorageUploadFileParams): Promise<StorageUploadFileResponse>; downloadFile(params: StorageDownloadFileParams): Promise<StorageDownloadFileResponse>; getPresignedUrl(params: ApiGetPresignedUrlParams): Promise<ApiGetPresignedUrlResponse>; delete(params: ApiDeleteParams): Promise<ApiDeleteResponse>; /** * Set the access token to use for authentication. * * @param accessToken Access token * @returns Hasura Storage API instance */ setAccessToken(accessToken?: string): HasuraStorageApi; /** * Set the admin secret to use for authentication. * * @param adminSecret Hasura admin secret * @returns Hasura Storage API instance */ setAdminSecret(adminSecret?: string): HasuraStorageApi; /** * Get global headers sent with all requests. * * @returns Record<string, string> */ getHeaders(): Record<string, string>; /** * Set global headers to be sent with all requests. * * @param headers a key value pair headers object * @returns Hasura Storage API instance */ setHeaders(headers?: Record<string, string>): HasuraStorageApi; /** * Remove global headers sent with all requests, except for the role header to preserve * the role set by 'setRole' method. * * @returns {HasuraStorageApi} - Hasura Storage API instance. */ unsetHeaders(): HasuraStorageApi; private generateAuthHeaders; } //# sourceMappingURL=hasura-storage-api.d.ts.map