piral-cli
Version:
The standard CLI for creating and building a Piral instance or a Pilet.
43 lines (42 loc) • 2.12 kB
TypeScript
import { Agent } from 'https';
import { FormData } from '../external';
import { PublishScheme } from '../types';
export declare function getAxiosOptions(url: string): {
headers: {
[x: string]: string;
};
auth?: undefined;
} | {
auth: {
username: string;
password: string;
};
headers?: undefined;
} | {
headers?: undefined;
auth?: undefined;
};
export declare function getCertificate(cert?: string): Promise<Buffer>;
export declare function getAuthorizationHeaders(scheme: PublishScheme, key: string): {
authorization: string;
} | {
authorization?: undefined;
};
export interface AgentOptions {
ca?: Buffer;
allowSelfSigned?: boolean;
}
export declare function getDefaultAgent(): Promise<Agent>;
export declare function getAgent({ allowSelfSigned, ca }: AgentOptions): Agent;
export declare function downloadFile(target: string, httpsAgent: Agent): Promise<Array<string>>;
export type FormDataObj = Record<string, string | number | boolean | [Buffer, string]>;
export declare function createAxiosForm(formData: FormDataObj): FormData;
export declare function handleAxiosError(error: any, interactive: boolean, httpsAgent: Agent, refetch: (mode: PublishScheme, key: string) => Promise<any>, onfail?: (status: number, statusText: string, response: string) => any): any;
export interface PostFormResult {
status: number;
success: boolean;
response?: object;
}
export declare function postData(target: string, scheme: PublishScheme, key: string, data: any, customHeaders?: Record<string, string>, httpsAgent?: Agent, isForm?: boolean, interactive?: boolean): Promise<PostFormResult>;
export declare function postForm(target: string, scheme: PublishScheme, key: string, formData: FormDataObj, customHeaders?: Record<string, string>, httpsAgent?: Agent, interactive?: boolean): Promise<PostFormResult>;
export declare function postFile(target: string, scheme: PublishScheme, key: string, file: Buffer, customFields?: Record<string, string>, customHeaders?: Record<string, string>, agent?: Agent, interactive?: boolean): Promise<PostFormResult>;