@kaaiot/services
Version:
Type definitions for KaaIoT platform REST API service communication
194 lines (193 loc) • 4.95 kB
TypeScript
import { AxiosError } from 'axios';
export interface CreateEndpointBody {
appVersion: {
name: string;
};
metadata?: Record<string, any>;
endpointToken?: string;
endpointId?: string;
relations?: EndpointRegistrationRelation[];
resourceGroupIds?: string[];
}
export declare enum EndpointRelationType {
Contains = "contains"
}
export declare enum EndpointRelationDirection {
To = "to",
From = "from"
}
export interface EndpointRegistrationRelation {
type: EndpointRelationType;
to?: string;
from?: string;
}
export declare type ResponseError<T> = AxiosError<T>;
export interface ApplicationMetadataKeysResponse {
[applicationVersionName: string]: string[];
}
interface PaginationParams {
limit?: number;
offset?: number;
}
export interface PaginatedResponse<T> {
content: T[];
totalElements: number;
}
export interface EndpointsQuery extends PaginationParams {
applicationName?: string;
endpointId?: string;
applicationVersionName?: string;
filterId?: string;
include?: 'metadata' | 'filters';
etag?: string;
regex?: string;
metadataFilter?: string;
multiFilter?: string;
}
export declare type EndpointsListResponse = PaginatedResponse<Endpoint>;
export interface Endpoint {
appName: string;
endpointId: string;
createdDate: Date;
appVersion: AppVersion;
filters: string[];
metadata?: Record<string, any>;
metadataUpdatedDate?: Date;
endpointToken?: string;
}
export interface AppVersion {
name: string;
registeredDate: Date;
}
export declare type TokenStatus = 'Active' | 'Inactive';
export interface CreateEndpointResponse {
token: string;
status: TokenStatus;
endpointId: string;
failedRelations?: FailedRelation[];
}
export interface FailedRelation {
type: RelationType;
to: string;
from: string;
message: string;
}
declare type RelationType = 'contains';
export declare type FiltersListResponse = PaginatedResponse<Filter>;
export interface Filter {
id: string;
createdDate: Date;
updatedDate: Date;
matchedEndpointsCount: number;
description: string;
name: string;
mongoQuery: Record<string, any>;
status: 'pending' | 'active';
}
export interface FiltersQuery extends PaginationParams {
applicationName: string;
name?: string;
}
export interface FilterQuery {
filterId: string;
applicationName: string;
}
export interface CreateFilterBody {
applicationName: string;
name: string;
description: string;
mongoQuery: string;
}
export interface GetMetadataParams {
etag?: string;
metadataKeys?: string[];
}
export interface GetMetadataResponse {
metadata: Record<string, any>;
}
export interface UpdateMetadataValuesParams {
etag?: string;
metadata: Record<string, any>;
}
export interface UpdateMetadataParams {
endpointId: string;
metadataKey: string;
value: any;
}
export interface BatchEndpoint {
endpointToken?: string;
endpointId?: string;
metadata: Record<string, any>;
}
export interface EndpointBatchRegistrationRequest {
appVersion: {
name: string;
};
endpoints: BatchEndpoint[];
}
export interface EndpointBatchRegistrationResponse {
taskId: string;
}
export interface FailedBatchEndpoint {
endpointToken: string;
metadata: string;
status: 'FAILED';
statusReason: string;
}
export interface CreatedBatchEndpoint {
endpointToken: string;
endpointId: string;
metadata?: Record<string, string>;
}
export interface EndpointBatchStatusResponse {
createdCount: number;
failedCount: number;
created: CreatedBatchEndpoint[];
failed: FailedBatchEndpoint[];
}
export interface CreateEndpointOptions {
group?: string;
}
export interface SingleEndpointOptions {
etag?: string;
lastModifiedDate?: Date;
include?: 'metadata' | 'filters';
}
export interface EndpointRelationsOptions {
relation: 'contains' | '!contains';
}
export interface EndpointRelationItem {
type: EndpointRelationType;
from?: string;
to?: string;
}
export declare type EndpointRelationPayload = EndpointRelationItem[];
export declare type EndpointRelationsResponse = string[];
export declare type LinkRelationsResponse = FailedRelation[];
export declare enum ConditionType {
Or = "or",
And = "and"
}
export declare enum MetadataFilterOperator {
In = "IN",
NotIn = "NOT_IN",
NotInRegex = "NOT_IN_REGEX",
InRegex = "IN_REGEX"
}
export interface MultiFilterEntry {
key: string;
operator: MetadataFilterOperator;
values: (string | number)[];
}
export declare type SortOrder = 'asc' | 'desc';
export interface EndpointSearchBody {
and?: MultiFilterEntry[];
or?: MultiFilterEntry[];
sort?: string;
sortOrder?: SortOrder;
}
export interface EndpointBatchDeletionBody {
and?: MultiFilterEntry[];
or?: MultiFilterEntry[];
}
export {};