@heroku-cli/command
Version:
base class for Heroku CLI commands
64 lines (63 loc) • 2.29 kB
TypeScript
import { HTTP, HTTPError, HTTPRequestOptions } from '@heroku/http-call';
import { Errors, Interfaces } from '@oclif/core';
import { Login } from './login.js';
import { Mutex } from './mutex.js';
import { ParticleboardClient } from './particleboard-client.js';
export declare const ALLOWED_HEROKU_DOMAINS: readonly string[];
export declare const LOCALHOST_DOMAINS: readonly string[];
export declare namespace APIClient {
interface Options extends HTTPRequestOptions {
retryAuth?: boolean;
}
}
export interface IOptions {
debug?: boolean;
debugHeaders?: boolean;
preauth?: boolean;
required?: boolean;
}
export interface IHerokuAPIErrorOptions {
app?: {
id: string;
name: string;
};
id?: string;
message?: string;
resource?: string;
url?: string;
}
export declare class HerokuAPIError extends Errors.CLIError {
body: IHerokuAPIErrorOptions;
http: HTTPError;
constructor(httpError: HTTPError);
}
export declare class APIClient {
protected config: Interfaces.Config;
options: IOptions;
authPromise?: Promise<HTTP<any>>;
http: typeof HTTP;
preauthPromises: {
[k: string]: Promise<HTTP<any>>;
};
private _auth?;
private readonly _login;
private _particleboard;
private _twoFactorMutex;
constructor(config: Interfaces.Config, options?: IOptions);
get auth(): string | undefined;
set auth(token: string | undefined);
get defaults(): typeof HTTP.defaults;
get particleboard(): ParticleboardClient;
get twoFactorMutex(): Mutex<string>;
delete<T>(url: string, options?: APIClient.Options): Promise<HTTP<T>>;
get<T>(url: string, options?: APIClient.Options): Promise<HTTP<T>>;
login(opts?: Login.Options): Promise<void>;
logout(): Promise<void>;
patch<T>(url: string, options?: APIClient.Options): Promise<HTTP<T>>;
post<T>(url: string, options?: APIClient.Options): Promise<HTTP<T>>;
preauth(app: string, factor: string): Promise<HTTP<unknown>>;
put<T>(url: string, options?: APIClient.Options): Promise<HTTP<T>>;
request<T>(url: string, options?: APIClient.Options): Promise<HTTP<T>>;
stream(url: string, options?: APIClient.Options): Promise<HTTP<unknown>>;
twoFactorPrompt(): Promise<string>;
}