@kaaiot/services
Version:
Type definitions for KaaIoT platform REST API service communication
51 lines (50 loc) • 2 kB
TypeScript
import { FetchResponse } from "../service-requester";
export declare type BlobResponseType = 'blob' | 'arraybuffer' | 'text';
export declare enum BinaryDataSource {
Blobs = "blobs",
Files = "files"
}
export interface BlobDescriptor {
createdDate: string;
id: string;
name: string;
url: string;
size: number;
}
export interface FileDescriptor extends BlobDescriptor {
updatedDate?: string;
}
export declare const isFileDescriptor: (descriptor: BlobDescriptor | FileDescriptor) => descriptor is FileDescriptor;
export declare type FileCreationRangeRange = {
to: string;
from: string;
};
export interface FilesListResponse {
content: FileDescriptor[];
totalElements: number;
}
export declare type BlobListResponse = Record<string, BlobDescriptor[] | null>[];
export interface BlobListDescriptor extends BlobDescriptor {
endpointId: string;
}
export interface BinaryDataListResponse {
content: BlobListDescriptor[];
totalElements: number;
}
export interface BinaryDataClient {
getBinaryData(applicationName: string, range: FileCreationRangeRange, sortDirection: string, endpointId?: string): Promise<FetchResponse<BlobListResponse>>;
getBinaryDataLastData(applicationName: string, endpointId: string): Promise<FetchResponse<any>>;
getBinaryDataList(applicationName: string, options: BinaryDataListOptions): Promise<FetchResponse<BinaryDataListResponse>>;
downloadBlob(applicationName: string, endpointId: string, blobId: string, responseType?: BlobResponseType): Promise<FetchResponse<any>>;
downloadLastBlob(applicationName: string, endpointId: string, responseType?: BlobResponseType): Promise<FetchResponse<any>>;
deleteBlob(applicationName: string, endpointId: string, blobId: string): Promise<FetchResponse<void>>;
}
export interface BinaryDataListOptions {
fromDate?: string;
toDate?: string;
offset?: number;
limit?: number;
name?: string;
sort?: 'ASC' | 'DESC';
endpointId?: string[];
}