picgo
Version:
A tool for image uploading
41 lines (40 loc) • 1.45 kB
TypeScript
import type { AxiosRequestConfig } from 'axios';
import type { IPicGo } from '../../types';
type ICloudErrorData = {
success?: boolean;
code?: string;
message?: string;
[key: string]: unknown;
};
type ICloudRequestErrorResponse = {
status: number;
data: unknown;
};
type ICloudRequestError = Error & {
isAxiosError: true;
code?: string;
status?: number;
response?: ICloudRequestErrorResponse;
};
type ICloudServiceError = Error & {
apiCode?: string;
status?: number;
};
declare const getCloudErrorData: (error: unknown) => ICloudErrorData | undefined;
declare const getCloudErrorStatus: (error: unknown) => number | undefined;
declare const getCloudErrorCode: (error: unknown) => string | undefined;
declare const getCloudErrorMessage: (error: unknown, fallback?: string) => string;
declare const createCloudServiceError: (message: string, cause?: unknown) => ICloudServiceError;
/**
* Authenticated Request Client for PicGo Cloud API
*/
declare class AuthRequestClient {
private readonly ctx;
private readonly baseURL;
constructor(ctx: IPicGo, baseURL?: string);
private resolveUrl;
request<T = any>(config: AxiosRequestConfig, token?: string): Promise<T>;
}
export { AuthRequestClient };
export { createCloudServiceError, getCloudErrorData, getCloudErrorCode, getCloudErrorMessage, getCloudErrorStatus };
export type { ICloudErrorData, ICloudRequestError, ICloudServiceError };