UNPKG

@expo/xdl

Version:
40 lines (39 loc) 1.66 kB
/// <reference types="node" /> import { JSONObject, JSONValue } from '@expo/json-file'; import { AxiosRequestConfig } from 'axios'; import FormData from 'form-data'; export declare class TurtleApiError extends Error { readonly name = "TurtleApiError"; code: string; details?: JSONValue; serverStack?: string; readonly _isApiError = true; constructor(message: string, code?: string); } declare type RequestOptions = { httpMethod: 'get' | 'post' | 'put' | 'delete'; queryParameters?: QueryParameters; body?: JSONObject; }; declare type QueryParameters = { [key: string]: string | number | boolean | null | undefined; }; declare type TurtleApiClientOptions = { sessionSecret: string; }; export default class TurtleApiClient { sessionSecret: string; static clientForUser(sessionSecret: string): TurtleApiClient; constructor(options: TurtleApiClientOptions); getAsync(methodName: string, args?: QueryParameters, extraOptions?: Partial<RequestOptions>): Promise<any>; postAsync(methodName: string, data?: any, extraOptions?: Partial<RequestOptions>): Promise<any>; putAsync(methodName: string, data: JSONObject, extraOptions?: Partial<RequestOptions>): Promise<any>; deleteAsync(methodName: string, extraOptions?: Partial<RequestOptions>): Promise<any>; _requestAsync(methodName: string, options: RequestOptions, extraRequestOptions?: Partial<RequestOptions>): Promise<any>; uploadFile(tarPath: string): Promise<any>; handleRequest(reqOptions: AxiosRequestConfig): Promise<any>; convertFormDataToBuffer(formData: FormData): Promise<{ data: Buffer; }>; } export {};