@kwikpik/server-libs
Version:
Kwikpik-Server-Libs ===================================================================================================================================================================================================
79 lines (78 loc) • 1.99 kB
TypeScript
export interface AuthorizeAccountResponse {
accountId: string;
apiInfo: {
storageApi: {
absoluteMinimumPartSize: number;
apiUrl: string;
allowed: {
buckets: {
id: string;
name: string | null;
}[];
capabilities: string[];
namePrefix: string | null;
};
downloadUrl: string;
recommendedPartSize: number;
s3ApiUrl: string;
};
groupsApi: {
capabilities: string[];
groupsApiUrl: string;
infoType: string;
};
};
applicationKeyExpirationTimestamp: number | null;
authorizationToken: string;
}
export interface GetUploadURLResponse {
bucketId: string;
uploadUrl: string;
authorizationToken: string;
}
export interface CreateBucketResponse {
accountId: string;
bucketId: string;
bucketName: string;
bucketType: "allPublic" | "allPrivate";
}
export interface UploadFileResponse {
accountId: string;
bucketId: string;
fileId: string;
fileName: string;
}
export interface BackblazeConfig {
/**
* Application key ID for API access
*/
applicationKeyId: string;
/**
* Application key for API access (standard or master)
*/
applicationKey: string;
/**
* Backblaze main URL
*/
mainUrl?: string;
}
declare class LocalBackblazeInstance {
private $httpInstance;
constructor(opts: BackblazeConfig);
static construct(config: BackblazeConfig): LocalBackblazeInstance;
private authorizeAccount;
private getUploadURL;
createBucket(
accountId: string,
bucketName: string,
bucketType?: "allPublic" | "allPrivate"
): Promise<CreateBucketResponse>;
uploadFile(bucketId: string, fileContent: Buffer, fileName?: string): Promise<UploadFileResponse>;
}
/**
*
* @param opts Backblaze configuration. {@link BackblazeConfig | See implementation}.
*/
export declare const initializeBackblazeInstance: (opts: BackblazeConfig) => LocalBackblazeInstance;
export {};
//# sourceMappingURL=backblaze.d.ts.map