import fetch from 'node-fetch'; import { RequestInit } from 'node-fetch'; import { ClassValidator, ValidationError } from './common'; import { Application, Template, User, LogReadOpts, LogsResponse, CreateTicketResponse, TryTemplateResponse } from './interfaces'; export interface Options extends Pick { fetchImplementation?: typeof fetch; timeoutMs?: number; headers?: Record; } export declare class RequestError extends Error { /** * The original error causing this request to fail * Inherits Error in case of network or parse errors * In case of an invalid HTTP response it will contain an object with the body/trimmed text of the response */ readonly cause: any; readonly method: string; readonly options: any; readonly name = "RequestError"; constructor(message: string, /** * The original error causing this request to fail * Inherits Error in case of network or parse errors * In case of an invalid HTTP response it will contain an object with the body/trimmed text of the response */ cause: any, method: string, options: any); } export declare class TimeoutError extends Error { readonly method: string; readonly options: any; readonly name = "TimeoutError"; constructor(message: string, method: string, options: any); } export { ValidationError, }; export interface Lycan { createTicket(): Promise; claimTicket(ticket: string): Promise; listTemplates(): Promise>; tryTemplate(id: string): Promise; whoami(): Promise; listApps(): Promise>; getApp(id: string): Promise; deployInitial(env: string, name: string, digest: string, envVars: Array<[string, string]>): Promise; deploy(appId: string, env: string, digest: string, envVars: Array<[string, string]>): Promise; claimApp(token: string): Promise; getLogs(appId: string, env: string, opts: LogReadOpts): Promise; destroyApp(appId: string): Promise; } export declare class LycanClient { readonly serverUrl: string; protected readonly options: Options; static readonly methods: string[]; static readonly validators: ClassValidator; protected readonly props: { "createTicket": { "description": string; "type": string; "properties": { "params": { "type": string; "properties": {}; }; "returns": { "$ref": string; }; }; "propertyOrder": string[]; "required": string[]; }; "claimTicket": { "description": string; "type": string; "properties": { "params": { "type": string; "properties": { "ticket": { "type": string; }; }; "propertyOrder": string[]; "required": string[]; }; "throws": { "$ref": string; }; "returns": { "type": string; }; }; "propertyOrder": string[]; "required": string[]; }; "listTemplates": { "type": string; "properties": { "params": { "type": string; "properties": {}; }; "returns": { "type": string; "items": { "$ref": string; }; }; }; "propertyOrder": string[]; "required": string[]; }; "tryTemplate": { "description": string; "type": string; "properties": { "params": { "type": string; "properties": { "id": { "minLength": number; "type": string; }; }; "propertyOrder": string[]; "required": string[]; }; "throws": { "$ref": string; }; "returns": { "$ref": string; }; }; "propertyOrder": string[]; "required": string[]; }; "whoami": { "type": string; "properties": { "params": { "type": string; "properties": {}; }; "returns": { "$ref": string; }; "throws": { "$ref": string; }; }; "propertyOrder": string[]; "required": string[]; }; "listApps": { "type": string; "properties": { "params": { "type": string; "properties": {}; }; "throws": { "$ref": string; }; "returns": { "type": string; "items": { "$ref": string; }; }; }; "propertyOrder": string[]; "required": string[]; }; "getApp": { "type": string; "properties": { "params": { "type": string; "properties": { "id": { "minLength": number; "type": string; }; }; "propertyOrder": string[]; "required": string[]; }; "throws": { "$ref": string; }; "returns": { "$ref": string; }; }; "propertyOrder": string[]; "required": string[]; }; "deployInitial": { "type": string; "properties": { "params": { "type": string; "properties": { "env": { "pattern": string; "type": string; }; "name": { "minLength": number; "type": string; }; "digest": { "minLength": number; "type": string; }; "envVars": { "type": string; "items": { "type": string; "items": { "type": string; }[]; "minItems": number; "additionalItems": { "anyOf": { "type": string; }[]; }; }; }; }; "propertyOrder": string[]; "required": string[]; }; "throws": { "anyOf": { "$ref": string; }[]; }; "returns": { "$ref": string; }; }; "propertyOrder": string[]; "required": string[]; }; "deploy": { "type": string; "properties": { "params": { "type": string; "properties": { "appId": { "minLength": number; "type": string; }; "env": { "pattern": string; "type": string; }; "digest": { "minLength": number; "type": string; }; "envVars": { "type": string; "items": { "type": string; "items": { "type": string; }[]; "minItems": number; "additionalItems": { "anyOf": { "type": string; }[]; }; }; }; }; "propertyOrder": string[]; "required": string[]; }; "throws": { "anyOf": { "$ref": string; }[]; }; "returns": { "$ref": string; }; }; "propertyOrder": string[]; "required": string[]; }; "claimApp": { "description": string; "type": string; "properties": { "params": { "type": string; "properties": { "token": { "minLength": number; "type": string; }; }; "propertyOrder": string[]; "required": string[]; }; "throws": { "anyOf": { "$ref": string; }[]; }; "returns": { "$ref": string; }; }; "propertyOrder": string[]; "required": string[]; }; "getLogs": { "type": string; "properties": { "params": { "type": string; "properties": { "appId": { "minLength": number; "type": string; }; "env": { "pattern": string; "type": string; }; "opts": { "$ref": string; }; }; "propertyOrder": string[]; "required": string[]; }; "throws": { "anyOf": { "$ref": string; }[]; }; "returns": { "$ref": string; }; }; "propertyOrder": string[]; "required": string[]; }; "destroyApp": { "type": string; "properties": { "params": { "type": string; "properties": { "appId": { "minLength": number; "type": string; }; }; "propertyOrder": string[]; "required": string[]; }; "throws": { "anyOf": { "$ref": string; }[]; }; "returns": { "type": string; }; }; "propertyOrder": string[]; "required": string[]; }; }; readonly validators: ClassValidator; constructor(serverUrl: string, options?: Options); createTicket(options?: Options): Promise; claimTicket(ticket: string, options?: Options): Promise; listTemplates(options?: Options): Promise>; tryTemplate(id: string, options?: Options): Promise; whoami(options?: Options): Promise; listApps(options?: Options): Promise>; getApp(id: string, options?: Options): Promise; deployInitial(env: string, name: string, digest: string, envVars: Array<[string, string]>, options?: Options): Promise; deploy(appId: string, env: string, digest: string, envVars: Array<[string, string]>, options?: Options): Promise; claimApp(token: string, options?: Options): Promise; getLogs(appId: string, env: string, opts: LogReadOpts, options?: Options): Promise; destroyApp(appId: string, options?: Options): Promise; }