UNPKG

@larksuiteoapi/api

Version:
53 lines 1.77 kB
import { Request } from "./core/request/request"; import { Config, Context } from "@larksuiteoapi/core"; import { Response } from "./core/response/response"; export declare const send: <T>(ctx: Context, conf: Config, req: Request<T>) => Promise<any>; export declare const sendRequest: <T>(conf: Config, req: Request<T>) => Promise<Response<T>>; export declare class ReqCallDone<T> { ctx: Context; reqCall: ReqCaller<T>; result: T; err: any; constructor(reqCall: ReqCaller<T>); } export interface ReqCaller<T> { ctx: Context; do(): Promise<T> | T; } export declare class ReqCall<T> implements ReqCaller<T> { ctx: Context; conf: Config; req: Request<T>; constructor(ctx: Context, conf: Config, req: Request<T>); do(): Promise<any>; } export declare type ErrorCallback = (reqCall: ReqCaller<any>, err: any) => Promise<void> | void; export declare class BatchReqCall { private readonly reqCalls; private readonly errorCallback; readonly reqCallDos: ReqCallDone<any>[]; constructor(errorCallback: ErrorCallback, ...reqCalls: ReqCaller<any>[]); do: () => Promise<this>; } export declare class APIReqCallResult<T> { reqCall: IReqCall<T>; response: Response<T>; err: any; constructor(reqCall: IReqCall<T>); } export interface IReqCall<T> { do(): Promise<Response<T>>; } export declare class APIReqCall<T> implements IReqCall<T> { conf: Config; req: Request<T>; constructor(conf: Config, req: Request<T>); do(): Promise<Response<T>>; } export declare class BatchAPIReqCall<T> { private readonly reqCalls; readonly reqCallResults: APIReqCallResult<T>[]; constructor(...reqCalls: ReqCaller<any>[]); do: () => Promise<this>; } //# sourceMappingURL=api.d.ts.map