You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
2.1 KiB

/// <reference types="node" />
import { JSONObject, JSONValue } from '@expo/json-file';
import FormData from 'form-data';
import { ParsedUrlQueryInput } from 'querystring';
export declare class ApiV2Error extends Error {
readonly name = "ApiV2Error";
code: string;
details?: JSONValue;
serverStack?: string;
metadata?: object;
readonly _isApiError = true;
constructor(message: string, code?: string);
}
declare type RequestOptions = {
httpMethod: 'get' | 'post' | 'put' | 'patch' | 'delete';
queryParameters?: QueryParameters;
body?: JSONObject;
timeout?: number;
};
declare type UploadOptions = {
headers: any;
data: any;
};
declare type QueryParameters = ParsedUrlQueryInput;
declare type APIV2ClientOptions = {
sessionSecret?: string;
accessToken?: string;
};
export default class ApiV2Client {
static exponentClient: string;
sessionSecret: string | null;
accessToken: string | null;
static clientForUser(user?: APIV2ClientOptions | null): ApiV2Client;
static setClientName(name: string): void;
constructor(options?: APIV2ClientOptions);
getAsync(methodName: string, args?: QueryParameters, extraOptions?: Partial<RequestOptions>, returnEntireResponse?: boolean): Promise<any>;
postAsync(methodName: string, data?: JSONObject, extraOptions?: Partial<RequestOptions>, returnEntireResponse?: boolean): Promise<any>;
putAsync(methodName: string, data: JSONObject, extraOptions?: Partial<RequestOptions>, returnEntireResponse?: boolean): Promise<any>;
patchAsync(methodName: string, data: JSONObject, extraOptions?: Partial<RequestOptions>, returnEntireResponse?: boolean): Promise<any>;
deleteAsync(methodName: string, args?: QueryParameters, extraOptions?: Partial<RequestOptions>, returnEntireResponse?: boolean): Promise<any>;
uploadFormDataAsync(methodName: string, formData: FormData): Promise<any>;
_requestAsync(methodName: string, options: RequestOptions, extraRequestOptions?: Partial<RequestOptions>, returnEntireResponse?: boolean, uploadOptions?: UploadOptions): Promise<any>;
}
export {};