interface.uts 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /**
  2. * 登录参数
  3. */
  4. export type GoogleLoginOptions = {
  5. serverClientId:string
  6. success ?: (res : GoogleLoginSuccess) => void
  7. fail ?: (res : GoogleLoginFail) => void
  8. complete ?: (res : any) => void
  9. }
  10. /**
  11. * 登出参数
  12. */
  13. export type GoogleLogoutOptions = {
  14. success ?: (res : any) => void
  15. fail ?: (res : GoogleLoginFail) => void
  16. complete ?: (res : any) => void
  17. }
  18. export type GoogleLoginSuccess = {
  19. headimgurl : string|null,
  20. nickname : string|null,
  21. email : string|null,
  22. openId : string,
  23. idToken : string,
  24. }
  25. /**
  26. * 错误码
  27. * 根据uni错误码规范要求,建议错误码以90开头,以下是错误码示例:
  28. * - 9010001 不具备登录的系统环境,比如当前所在的activity状态异常
  29. * - 9010002 用户参数配置错误,重点检查serverClientId/包名/签名是否正确
  30. * - 9010003 暂不支持的登录凭证
  31. * - 9010004 签名错误
  32. * - 9010005 缺少系统组件,比如GMS
  33. * - 9010099 其他未知错误
  34. */
  35. export type GoogleLoginErrorCode = 9010001 | 9010002 | 9010003 | 9010004 | 9010005 | 9010099;
  36. /**
  37. * 登录过程中发生错误
  38. */
  39. export interface GoogleLoginFail extends IUniError {
  40. errCode : GoogleLoginErrorCode
  41. };
  42. /**
  43. * 实现登录
  44. */
  45. export type GoogleLogin = (options : GoogleLoginOptions) => void
  46. /**
  47. * 取消登录
  48. */
  49. export type GoogleLogout = (options : GoogleLogoutOptions) => void