@kaaiot/services
Version:
Type definitions for KaaIoT platform REST API service communication
102 lines (101 loc) • 2.84 kB
TypeScript
export interface CEXCommandTypeQueryParams {
awaitTimeout?: number;
commandTtl?: number;
filterId?: string;
}
export declare type CommandDescriptorStatus = 'EXECUTED' | 'PENDING' | 'EXPIRED';
export interface TimestampObject {
epochSecond: number;
nano: number;
}
export declare type CommandTimestamp = string | TimestampObject;
export declare type CommandPayload = null | number | string | boolean | Record<string, any>;
export interface CommandDescriptor {
commandId: number;
commandType: string;
endpointId: string;
status: CommandDescriptorStatus;
statusCode: number;
reasonPhrase: string;
requestPayload: CommandPayload;
responsePayload: CommandPayload;
createdAt: CommandTimestamp;
updatedAt: CommandTimestamp;
}
export interface CommandsHistoryResponsePayload {
endpointId: string;
commands: CommandDescriptor[];
}
export interface SendCommandUrlParams {
endpointId?: string;
commandType: string;
}
export interface LastExecutedCommandParams {
endpointId: string;
commandType: string;
}
export interface GetCommandParams extends LastExecutedCommandParams {
id: string;
}
export interface CommandResponce {
commandId: number;
commandType: string;
endpointId: string;
status: string;
updatedAt: string;
createdAt: string;
statusCode?: number;
reasonPhrase?: string;
requestPayload?: any;
responsePayload?: any;
}
export interface DeleteCommandUrlParams {
endpointId: string;
commandType: string;
commandId: number;
}
export interface SendCommandBatchByEndpointsPayload {
endpointIds: string[];
payload: string;
payloadContentType: 'application/json' | 'text/plain';
}
export interface EndpointsBatchRegistrationResponse {
taskId: string;
}
export interface EndpointsBatchStatusResponse {
executed: BatchEndpointInfo[];
expired: BatchEndpointInfo[];
pending: BatchEndpointInfo[];
}
export interface BatchEndpointInfo {
endpointId: string;
commandId: string | number;
}
export interface BatchCommandHistory {
taskId: number;
filterId: string;
commandType: string;
requestPayload: any;
createdAt: CommandTimestamp;
pendingCount: number;
executedCount: number;
expiredCount: number;
}
export interface BatchCommandHistoryResponse {
totalElements: number;
content: BatchCommandHistory[];
}
export interface BatchCommandHistoryRequestOptions {
appName: string;
commandType?: string;
filterId?: string;
sortBy?: 'commandType' | 'filterId' | 'createdAt' | 'taskId';
sortOrder?: 'ASC' | 'DESC';
offset?: number;
limit?: number;
}
export interface GetLastCommandsPayload {
endpointIds: string[];
commandTypes: string[];
}
export declare type EndpointLastCommands = CommandsHistoryResponsePayload;