@iotize/device-client.js
Version:
IoTize Device client for Javascript
31 lines (30 loc) • 1.43 kB
TypeScript
import { Response, Command, Client, BodyEncoder } from './import-adapter';
import { Observable } from 'rxjs';
import { ApiConfig } from '../config/api-config';
import { EncoderFct } from '../../core/converter/encoder.interface';
import { BodyDecoder } from '../../client/api/converter';
import { ApiRequest } from '../../client/impl';
export declare type ServiceCallMethodType = "GET" | "PUT" | "POST";
export declare type ServiceCallType<BodyType = any, ReturnType = any> = {
methodType: ServiceCallMethodType;
path: string;
pathParameters?: {
[key: string]: string | number;
};
body?: BodyType;
bodyEncoder?: string | BodyEncoder<BodyType> | EncoderFct<BodyType, Uint8Array>;
returnTypeConverter?: string | BodyDecoder<ReturnType>;
};
export declare abstract class AbstractService {
config: ApiConfig;
client: Client;
constructor(client: Client, apiConfig: ApiConfig);
_call(options: ServiceCallType): Promise<Response<any>>;
_callObservable(options: ServiceCallType): Observable<Response<any>>;
_convertToCommandArgs(options: ServiceCallType): [Command, BodyDecoder<any> | undefined];
static callToCommandArgs(options: ServiceCallType, config?: ApiConfig): [ApiRequest, BodyDecoder<any> | undefined];
/**
* Encode body accoding to options and configuration
*/
static encodeBody(options: ServiceCallType): Uint8Array;
}