UNPKG

@ably/cli

Version:

Ably CLI for Pub/Sub, Chat and Spaces

245 lines (244 loc) 6.54 kB
export interface ControlApiOptions { accessToken: string; controlHost?: string; logErrors?: boolean; } export interface App { accountId: string; apnsUsesSandboxCert?: boolean; created: number; id: string; modified: number; name: string; status: string; tlsOnly: boolean; [key: string]: unknown; } export interface AppStats { appId?: string; entries: { [key: string]: number; }; intervalId: string; schema?: string; unit: string; } export type AccountStats = AppStats; export interface Key { appId: string; capability: unknown; created: number; id: string; key: string; modified: number; name: string; revocable: boolean; status: string; } export interface Namespace { appId: string; authenticated?: boolean; batchingEnabled?: boolean; batchingInterval?: number; conflationEnabled?: boolean; conflationInterval?: number; conflationKey?: string; created: number; exposeTimeSerial?: boolean; id: string; modified: number; persistLast?: boolean; persisted: boolean; populateChannelRegistry?: boolean; pushEnabled: boolean; tlsOnly?: boolean; } export interface Rule { _links?: { self: string; }; appId: string; created: number; id: string; modified: number; requestMode: string; ruleType: string; source: { channelFilter: string; type: string; }; target: unknown; version: string; } export interface RuleData { requestMode: string; ruleType: string; source: { channelFilter: string; type: string; }; status?: "disabled" | "enabled"; target: Record<string, unknown>; } export interface RuleUpdateData { requestMode?: string; ruleType?: string; source?: Partial<{ channelFilter: string; type: string; }>; status?: "disabled" | "enabled"; target?: Partial<Record<string, unknown>>; } export interface Queue { amqp: { queueName: string; uri: string; }; appId: string; deadletter: boolean; deadletterId: string; id: string; maxLength: number; messages: { ready: number; total: number; unacknowledged: number; }; name: string; region: string; state: string; stats: { acknowledgementRate: null | number; deliveryRate: null | number; publishRate: null | number; }; stomp: { destination: string; host: string; uri: string; }; ttl: number; } export interface HelpResponse { answer: string; links: { breadcrumbs: string[]; description: null | string; label: string; title: string; type: string; url: string; }[]; } export interface Conversation { messages: { content: string; role: "assistant" | "user"; }[]; } export interface MeResponse { account: { id: string; name: string; }; user: { email: string; }; } export declare class ControlApi { private accessToken; private controlHost; private logErrors; constructor(options: ControlApiOptions); askHelp(question: string, conversation?: Conversation): Promise<HelpResponse>; createApp(appData: { name: string; tlsOnly?: boolean; }): Promise<App>; createKey(appId: string, keyData: { capability?: Record<string, string[]>; name: string; }): Promise<Key>; createNamespace(appId: string, namespaceData: { authenticated?: boolean; batchingEnabled?: boolean; batchingInterval?: number; channelNamespace: string; conflationEnabled?: boolean; conflationInterval?: number; conflationKey?: string; exposeTimeSerial?: boolean; persistLast?: boolean; persisted?: boolean; populateChannelRegistry?: boolean; pushEnabled?: boolean; tlsOnly?: boolean; }): Promise<Namespace>; createQueue(appId: string, queueData: { maxLength?: number; name: string; region?: string; ttl?: number; }): Promise<Queue>; createRule(appId: string, ruleData: RuleData): Promise<Rule>; deleteApp(appId: string): Promise<void>; deleteNamespace(appId: string, namespaceId: string): Promise<void>; deleteQueue(appId: string, queueName: string): Promise<void>; deleteRule(appId: string, ruleId: string): Promise<void>; getAccountStats(options?: { by?: string; end?: number; limit?: number; start?: number; unit?: string; }): Promise<AccountStats[]>; getApp(appId: string): Promise<App>; getAppStats(appId: string, options?: { by?: string; end?: number; limit?: number; start?: number; unit?: string; }): Promise<AppStats[]>; getKey(appId: string, keyIdOrValue: string): Promise<Key>; getMe(): Promise<MeResponse>; getNamespace(appId: string, namespaceId: string): Promise<Namespace>; getRule(appId: string, ruleId: string): Promise<Rule>; listApps(): Promise<App[]>; listKeys(appId: string): Promise<Key[]>; listNamespaces(appId: string): Promise<Namespace[]>; listQueues(appId: string): Promise<Queue[]>; listRules(appId: string): Promise<Rule[]>; revokeKey(appId: string, keyId: string): Promise<void>; updateApp(appId: string, appData: { name?: string; tlsOnly?: boolean; }): Promise<App>; updateKey(appId: string, keyId: string, keyData: { capability?: Record<string, string[]>; name?: string; }): Promise<Key>; updateNamespace(appId: string, namespaceId: string, namespaceData: { authenticated?: boolean; batchingEnabled?: boolean; batchingInterval?: number; conflationEnabled?: boolean; conflationInterval?: number; conflationKey?: string; exposeTimeSerial?: boolean; persistLast?: boolean; persisted?: boolean; populateChannelRegistry?: boolean; pushEnabled?: boolean; tlsOnly?: boolean; }): Promise<Namespace>; updateRule(appId: string, ruleId: string, ruleData: RuleUpdateData): Promise<Rule>; uploadApnsP12(appId: string, certificateData: string, options?: { password?: string; useForSandbox?: boolean; }): Promise<{ id: string; }>; private request; }