authConfig.d.ts 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /**
  2. * 用于 JSAPI 鉴权 详见 [JSAPI鉴权](https://openplatform-portal.dg-work.cn/portal/#/helpdoc?docKey=kfzn&slug=qw0y0e)
  3. *
  4. * \ **API目录**:业务
  5. *
  6. * @apiName JSAPI鉴权
  7. *
  8. * @param ticket string 是 鉴权所需要的ticket,需要从后台获取
  9. * @param jsApiList string[] 是 需要鉴权的 API 列表
  10. *
  11. * @support
  12. * - IOS v1.2.0
  13. * - Android v1.2.0
  14. * - PC v1.2.0
  15. *
  16. * @returns
  17. * res[].name string 校验的JSAPI名称;
  18. * res[].validateResult boolean false表示鉴权没有通过,true表示鉴权通过
  19. *
  20. * @example
  21. * ```typescript
  22. * authConfig({
  23. * ticket: 'ticket-abc', // 从后台接口获取ticket
  24. * jsApiList: ['chooseContact', 'chooseContactWithComplexPicker'], // 需要鉴权的jsapi列表
  25. * })
  26. * .then(res => {
  27. * console.log(res);
  28. * //该数据代表具体jsApi校验结果,校验成功也会有结果
  29. * // [{
  30. * // "name":"chooseContact",
  31. * // "validateResult":false // false表示鉴权没有通过,true表示鉴权通过
  32. * // }]
  33. * })
  34. * .catch(err => {
  35. * console.log(err);
  36. * });
  37. * ```
  38. */
  39. export interface AuthConfigParams {
  40. ticket: string;
  41. jsApiList: string[];
  42. }
  43. export interface ValidateResult {
  44. name: string;
  45. validateResult: boolean;
  46. }
  47. declare function authConfig(args: AuthConfigParams): Promise<ValidateResult[]>;
  48. declare namespace authConfig {
  49. var version: {
  50. android: string;
  51. ios: string;
  52. pc: string;
  53. };
  54. }
  55. export default authConfig;