UNPKG

zwdd

Version:
24 lines (23 loc) 1.01 kB
import request, { AuthOptions, RequestInit } from './lib/request'; import { sign } from './lib/crypto'; import type * as Types from './types'; export * from './lib/request'; export * from './types'; declare type PartialOptional<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>> & Partial<Pick<T, K>>; export declare type Options = PartialOptional<AuthOptions, 'hostIp' | 'hostMac' | 'endpoint'>; export declare const DEFAULT_ENDPOINT = "https://openplatform.dg-work.cn"; export default class ZWDD { private readonly appKey; private readonly appSecret; private readonly endpoint; private readonly hostIp; private readonly hostMac; private accessToken?; private accessTokenExpiresAt; constructor(options: Options); request<T = any>(api: string, init?: Omit<RequestInit, keyof AuthOptions>): Promise<T>; getAccessToken(): Promise<string>; getAppUserInfo(authCode: string): Promise<Types.UserInfo>; getJSApiTicket(): Promise<string>; } export { request, sign, };