export declare const enum TerminalType { WX_MINI = "WEIXIN_APPLET", TT_MINI = "BYTE_APPLET", WX_WEB = "WEIXIN_PUBLIC", WEB = "H5" } export interface HeaderOptions { terminal: TerminalType; Cookie?: string; } export interface AsObject { [key: string]: string | number; } export declare enum DATA_TYPE { json = "json", text = "text" } export interface LoginResponse { sessionId: string; 'CR-SESSION': string; phone: string; nickName: string; } export interface RequestOptions { url: string; headers?: AsObject; method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD'; data?: AsObject; timeout?: number; dataType?: DATA_TYPE; /** * 是否需要 cookie */ needLogin?: boolean; } export interface ResponseData { data: RequestResponse; headers?: AsObject; status?: number; } export interface CommonResponse { success: boolean; header: object; errorCode: string; message: string; ext: object; } export interface RequestResponse extends CommonResponse { result: LoginResponse | any; } export interface Session { data: SessionData; } export interface SessionData { /** * sessionId */ 'CR-SESSION': string; /** * 是否更新了用户信息,用来判断是否唤起用户信息授权 */ hasUpdateUserInfo: boolean; /** * 手机号 */ phone: string; /** * 头像 */ portrait: string; /** * sessionId */ sessionId: string; success: boolean; /** * 用户标识 */ userId: string; /** * 用户昵称 */ userName: string; } /** * 带有鉴权的请求库 * @param options * @returns */ declare const customRequest: (options: RequestOptions) => Promise; export declare const clearSession: () => void; export default customRequest;