base.d.ts 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  1. import { Output } from './interface-v2';
  2. export declare class Base {
  3. protected userAgent: string;
  4. constructor();
  5. /**
  6. * get 请求参数处理
  7. * @param object query 请求参数
  8. * @param exclude 需要排除的字段
  9. * @returns
  10. */
  11. protected objectToQueryString(object: Record<string, any>, exclude?: string[]): string;
  12. /**
  13. * post 请求
  14. * @param url 请求接口
  15. * @param params 请求参数
  16. */
  17. protected postRequest(url: string, params: Record<string, any>, authorization: string): Promise<Record<string, any>>;
  18. /**
  19. * post 请求 V2
  20. * @param url 请求接口
  21. * @param params 请求参数
  22. */
  23. protected postRequestV2(url: string, params: Record<string, any>, authorization: string, headers?: {}): Promise<Output>;
  24. /**
  25. * get 请求
  26. * @param url 请求接口
  27. * @param query 请求参数
  28. */
  29. protected getRequest(url: string, authorization: string, query?: Record<string, any>): Promise<Record<string, any>>;
  30. /**
  31. * get 请求 v2
  32. * @param url 请求接口
  33. * @param query 请求参数
  34. */
  35. protected getRequestV2(url: string, authorization: string, query?: Record<string, any>): Promise<Output>;
  36. }