Interface NEAccountService

interface NEAccountService {
    addListener: (listener: NEAccountServiceListener) => void;
    generateSSOLoginWebURL: (schemaUrl: string) => Promise<NEResult<string>>;
    getAccountInfo: () => Promise<NEResult<NEAccountInfo>>;
    loginByDynamicToken: (
        userUuid: string,
        token: string,
        authType: string,
    ) => Promise<NEResult<void>>;
    loginByEmail: (
        email: string,
        password: string,
    ) => Promise<NEResult<NEAccountInfo>>;
    loginByPassword: (
        userUuid: string,
        password: string,
    ) => Promise<NEResult<NEAccountInfo>>;
    loginByPhoneNumber: (
        phoneNumber: string,
        password: string,
    ) => Promise<NEResult<NEAccountInfo>>;
    loginBySmsCode: (
        phoneNumber: string,
        smsCode: string,
    ) => Promise<NEResult<NEAccountInfo>>;
    loginBySSOUri: (ssoUri: string) => Promise<NEResult<NEAccountInfo>>;
    loginByToken: (
        userUuid: string,
        token: string,
    ) => Promise<NEResult<NEAccountInfo>>;
    logout: () => Promise<NEResult<void>>;
    removeListener: (listener: NEAccountServiceListener) => void;
    requestSmsCodeForGuest: (phoneNumber: string) => Promise<NEResult<void>>;
    requestSmsCodeForLogin: (phoneNumber: string) => Promise<NEResult<void>>;
    resetPassword: (
        userUuid: string,
        newPassword: string,
        oldPassword: string,
    ) => Promise<NEResult<void>>;
    tryAutoLogin: () => Promise<NEResult<NEAccountInfo>>;
    updateAvatar: (image: string | Blob) => Promise<NEResult<void>>;
    updateNickname: (nickname: string) => Promise<NEResult<void>>;
}

Properties

addListener: (listener: NEAccountServiceListener) => void

注册登录状态监听器

Type declaration

generateSSOLoginWebURL: (schemaUrl: string) => Promise<NEResult<string>>

生成SSO登录链接,调用方使用该链接通过浏览器去完成SSO登录。

Type declaration

    • (schemaUrl: string): Promise<NEResult<string>>
    • Parameters

      • schemaUrl: string

        SSO登录完成后的回调地址,web 环境下需要 encodeURIComponent 处理

      Returns Promise<NEResult<string>>

getAccountInfo: () => Promise<NEResult<NEAccountInfo>>

获取当前登录账号信息。成功时返回 NEAccountInfo

loginByDynamicToken: (
    userUuid: string,
    token: string,
    authType: string,
) => Promise<NEResult<void>>

访客动态token登录

Type declaration

loginByEmail: (
    email: string,
    password: string,
) => Promise<NEResult<NEAccountInfo>>

通过邮箱密码登录鉴权。成功时返回 NEAccountInfo

Type declaration

    • (email: string, password: string): Promise<NEResult<NEAccountInfo>>
    • Parameters

      • email: string

        登录邮箱

      • password: string

        登录密码

      Returns Promise<NEResult<NEAccountInfo>>

loginByPassword: (
    userUuid: string,
    password: string,
) => Promise<NEResult<NEAccountInfo>>

通过用户唯一ID和密码登录鉴权。成功时返回 NEAccountInfo

Type declaration

    • (userUuid: string, password: string): Promise<NEResult<NEAccountInfo>>
    • Parameters

      • userUuid: string

        用户唯一ID

      • password: string

        登录密码

      Returns Promise<NEResult<NEAccountInfo>>

loginByPhoneNumber: (
    phoneNumber: string,
    password: string,
) => Promise<NEResult<NEAccountInfo>>

通过手机号密码登录鉴权。成功时返回 NEAccountInfo

Type declaration

    • (phoneNumber: string, password: string): Promise<NEResult<NEAccountInfo>>
    • Parameters

      • phoneNumber: string

        登录手机号

      • password: string

        登录密码

      Returns Promise<NEResult<NEAccountInfo>>

loginBySmsCode: (
    phoneNumber: string,
    smsCode: string,
) => Promise<NEResult<NEAccountInfo>>

通过手机验证码登录鉴权。成功时返回 NEAccountInfo

Type declaration

    • (phoneNumber: string, smsCode: string): Promise<NEResult<NEAccountInfo>>
    • Parameters

      • phoneNumber: string

        手机号

      • smsCode: string

      Returns Promise<NEResult<NEAccountInfo>>

loginBySSOUri: (ssoUri: string) => Promise<NEResult<NEAccountInfo>>

通过SSO登录结果uri完成会议组件登录鉴权。成功时返回 NEAccountInfo

Type declaration

    • (ssoUri: string): Promise<NEResult<NEAccountInfo>>
    • Parameters

      • ssoUri: string

        SSO登录结果uri

      Returns Promise<NEResult<NEAccountInfo>>

loginByToken: (
    userUuid: string,
    token: string,
) => Promise<NEResult<NEAccountInfo>>

通过用户唯一ID和Token登录鉴权。成功时返回 NEAccountInfo

Type declaration

    • (userUuid: string, token: string): Promise<NEResult<NEAccountInfo>>
    • Parameters

      • userUuid: string

        用户唯一ID

      • token: string

        登录令牌

      Returns Promise<NEResult<NEAccountInfo>>

logout: () => Promise<NEResult<void>>

登出当前已登录的账号

removeListener: (listener: NEAccountServiceListener) => void

移除登录状态监听器

Type declaration

requestSmsCodeForGuest: (phoneNumber: string) => Promise<NEResult<void>>

请求访客认证手机验证码

Type declaration

    • (phoneNumber: string): Promise<NEResult<void>>
    • Parameters

      • phoneNumber: string

        手机号

      Returns Promise<NEResult<void>>

requestSmsCodeForLogin: (phoneNumber: string) => Promise<NEResult<void>>

请求登录手机验证码。

Type declaration

    • (phoneNumber: string): Promise<NEResult<void>>
    • Parameters

      • phoneNumber: string

        手机号

      Returns Promise<NEResult<void>>

resetPassword: (
    userUuid: string,
    newPassword: string,
    oldPassword: string,
) => Promise<NEResult<void>>

重置密码

Type declaration

    • (
          userUuid: string,
          newPassword: string,
          oldPassword: string,
      ): Promise<NEResult<void>>
    • Parameters

      • userUuid: string

        用户唯一ID

      • newPassword: string

        新密码

      • oldPassword: string

        旧密码

      Returns Promise<NEResult<void>>

tryAutoLogin: () => Promise<NEResult<NEAccountInfo>>

尝试自动登录鉴权。成功时返回 NEAccountInfo

updateAvatar: (image: string | Blob) => Promise<NEResult<void>>

修改当前登录账号头像

Type declaration

    • (image: string | Blob): Promise<NEResult<void>>
    • Parameters

      • image: string | Blob

        web使用Blob,ELectron环境使用string path。新头像图片内容

      Returns Promise<NEResult<void>>

updateNickname: (nickname: string) => Promise<NEResult<void>>

修改当前登录账号昵称

Type declaration

    • (nickname: string): Promise<NEResult<void>>
    • Parameters

      • nickname: string

        新昵称

      Returns Promise<NEResult<void>>