@allthings/sdk
Version:
Allthings Node/Javascript SDK
43 lines (42 loc) • 1.35 kB
TypeScript
/// <reference types="node" />
/// <reference types="node" />
import { IAllthingsRestClient } from '../types';
export type FileResult = Promise<IFile>;
interface IFileUrl {
readonly height: number;
readonly size: number;
readonly url: string;
readonly width: number;
}
export interface IFile {
readonly category: string;
readonly deletedAt: string;
readonly description: string;
readonly extension: string;
readonly files: {
readonly big: IFileUrl;
readonly medium: IFileUrl;
readonly original: IFileUrl;
readonly small: IFileUrl;
readonly thumb: IFileUrl;
};
readonly id: string;
readonly name: string;
readonly originalFilename: string;
readonly path: string;
readonly size: number;
readonly type: string;
}
export type MethodFileCreate = (data: {
readonly file: Blob | Buffer | ReadableStream;
readonly name: string;
readonly path?: string;
}) => FileResult;
export declare function fileCreate(client: IAllthingsRestClient, data: {
readonly file: Blob | Buffer | ReadableStream;
readonly name: string;
readonly path?: string;
}): FileResult;
export type MethodFileDelete = (fileId: string) => Promise<boolean>;
export declare function fileDelete(client: IAllthingsRestClient, fileId: string): Promise<boolean>;
export {};