1 | import { Interfaces } from '@oclif/core';
|
2 | import { CLIError } from '@oclif/core/lib/errors';
|
3 | import { HTTP, HTTPError, HTTPRequestOptions } from 'http-call';
|
4 | import { Login } from './login';
|
5 | import { Mutex } from './mutex';
|
6 | import { ParticleboardClient } from './particleboard-client';
|
7 | export declare namespace APIClient {
|
8 | interface Options extends HTTPRequestOptions {
|
9 | retryAuth?: boolean;
|
10 | }
|
11 | }
|
12 | export interface IOptions {
|
13 | required?: boolean;
|
14 | preauth?: boolean;
|
15 | debug?: boolean;
|
16 | debugHeaders?: boolean;
|
17 | }
|
18 | export interface IHerokuAPIErrorOptions {
|
19 | resource?: string;
|
20 | app?: {
|
21 | id: string;
|
22 | name: string;
|
23 | };
|
24 | id?: string;
|
25 | message?: string;
|
26 | url?: string;
|
27 | }
|
28 | export declare class HerokuAPIError extends CLIError {
|
29 | http: HTTPError;
|
30 | body: IHerokuAPIErrorOptions;
|
31 | constructor(httpError: HTTPError);
|
32 | }
|
33 | export declare class APIClient {
|
34 | protected config: Interfaces.Config;
|
35 | options: IOptions;
|
36 | preauthPromises: {
|
37 | [k: string]: Promise<HTTP<any>>;
|
38 | };
|
39 | authPromise?: Promise<HTTP<any>>;
|
40 | http: typeof HTTP;
|
41 | private readonly _login;
|
42 | private _twoFactorMutex;
|
43 | private _auth?;
|
44 | private _particleboard;
|
45 | constructor(config: Interfaces.Config, options?: IOptions);
|
46 | get particleboard(): ParticleboardClient;
|
47 | get twoFactorMutex(): Mutex<string>;
|
48 | get auth(): string | undefined;
|
49 | set auth(token: string | undefined);
|
50 | twoFactorPrompt(): Promise<string>;
|
51 | preauth(app: string, factor: string): Promise<HTTP<unknown>>;
|
52 | get<T>(url: string, options?: APIClient.Options): Promise<HTTP<T>>;
|
53 | post<T>(url: string, options?: APIClient.Options): Promise<HTTP<T>>;
|
54 | put<T>(url: string, options?: APIClient.Options): Promise<HTTP<T>>;
|
55 | patch<T>(url: string, options?: APIClient.Options): Promise<HTTP<T>>;
|
56 | delete<T>(url: string, options?: APIClient.Options): Promise<HTTP<T>>;
|
57 | stream(url: string, options?: APIClient.Options): Promise<HTTP<unknown>>;
|
58 | request<T>(url: string, options?: APIClient.Options): Promise<HTTP<T>>;
|
59 | login(opts?: Login.Options): Promise<void>;
|
60 | logout(): Promise<void>;
|
61 | get defaults(): typeof HTTP.defaults;
|
62 | }
|