@iotize/tap
Version:
IoTize Device client for Javascript
37 lines (36 loc) • 1.41 kB
TypeScript
import { DecoderFct, EncoderFct } from '@iotize/common/converter/api';
import { BodyDecoder, BodyEncoder, TapRequestFrame } from '@iotize/tap/client/api';
export interface TapEvent<T extends string> {
type: T;
}
export declare type UnresolvedDecoderType<ReturnType> = string | BodyDecoder<ReturnType> | DecoderFct<Uint8Array, ReturnType>;
export declare type UnresolvedEncoderType<BodyType> = string | BodyEncoder<BodyType> | EncoderFct<BodyType, Uint8Array>;
export declare type ServiceCallMethodType = 'GET' | 'PUT' | 'POST';
/**
*
*/
export interface UnresolvedServiceCallType<BodyType = any, ReturnType = any> {
method: ServiceCallMethodType;
path: string;
pathParameters?: {
[key: string]: string | number;
};
body?: BodyType;
bodyEncoder?: UnresolvedEncoderType<BodyType>;
responseBodyDecoder?: UnresolvedDecoderType<ReturnType>;
}
export interface ServiceCallType<BodyType = any, ReturnType = any> {
method: TapRequestFrame.MethodType;
pathAlias?: string;
path: string;
pathParameters?: {
[key: string]: number;
};
body?: BodyType;
bodyEncoder?: BodyEncoder<BodyType> | EncoderFct<BodyType, Uint8Array>;
responseBodyDecoder?: BodyDecoder<ReturnType> | DecoderFct<Uint8Array, ReturnType>;
/**
* Wheter or not this endpoint supports append call
*/
append?: boolean;
}