@elastic.io/maester-client
Version:
The official object-storage client
37 lines (36 loc) • 1.46 kB
TypeScript
import { AxiosResponse } from 'axios';
import { Readable } from 'stream';
import { ReqWithBodyOptions, ReqOptions, searchObjectCriteria } from './interfaces';
export declare const getStreamWithContentType: (getStream: () => Promise<Readable>) => Promise<{
mime: any;
stream: any;
}>;
export declare class StorageClient {
private api;
private static httpAgent;
private static httpsAgent;
private readonly jwtSecret;
private readonly userAgent;
private readonly msgId;
constructor(config: {
uri: string;
jwtSecret?: string;
userAgent?: string;
msgId?: string;
});
private requestRetry;
private formHeaders;
private reqWithBody;
post(getFreshStream: () => Promise<Readable>, reqWithBodyOptions?: ReqWithBodyOptions): Promise<AxiosResponse<any, any>>;
put(objectId: string, getFreshStream: () => Promise<Readable>, reqWithBodyOptions?: ReqWithBodyOptions): Promise<AxiosResponse<any, any>>;
/**
* fetches object(s) from maester by id/params
* @param searchCriteria objectId/request-params
*/
get(searchCriteria: searchObjectCriteria, { jwtPayloadOrToken, retryOptions }: ReqOptions): Promise<any>;
/**
* delete object(s) from maester by id/params
* @param searchCriteria objectId/request-params
*/
delete(searchCriteria: searchObjectCriteria, { jwtPayloadOrToken, retryOptions }: ReqOptions): Promise<AxiosResponse<any, any>>;
}