import Vnmf from '../../index' declare module '../../index' { namespace pluginLogin { interface Option { /** Interface call to the end of echo function(Call successfully、Any failure will be enforced.) */ complete?: (res: VnmfGeneral.CallbackResult) => void /** Interface call failed echo function */ fail?: (res: VnmfGeneral.CallbackResult) => void /** Interface calls a successful echo function */ success?: (result: SuccessCallbackResult) => void } interface SuccessCallbackResult extends VnmfGeneral.CallbackResult { /** It's for sale. openpid A certificate of proof.(It's valid for five minutes.)。Plugin Developer can use this code Call on the Developer server backstage [auth.getPluginOpenPId](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/user-info/auth.getPluginOpenPId.html) In exchange. openpid。 */ code: string } } namespace login { interface Option { /** Interface call to the end of echo function(Call successfully、Any failure will be enforced.) */ complete?: (res: VnmfGeneral.CallbackResult) => void /** Interface call failed echo function */ fail?: (res: VnmfGeneral.CallbackResult) => void /** Interface calls a successful echo function */ success?: (result: SuccessCallbackResult) => void /** Timeout,Unitsms */ timeout?: number } interface SuccessCallbackResult extends VnmfGeneral.CallbackResult { /** User login documents(It's valid for five minutes.)。Developer needs to call backstage on developer server [auth.code2Session](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/login/auth.code2Session.html),Use code In exchange. openid and session_key Cannot initialise Evolution's mail component. */ code: string /** Call Results */ errMsg: string } } namespace checkSession { interface Option { /** Interface call to the end of echo function(Call successfully、Any failure will be enforced.) */ complete?: (res: VnmfGeneral.CallbackResult) => void /** Interface call failed echo function */ fail?: (res: VnmfGeneral.CallbackResult) => void /** Interface calls a successful echo function */ success?: (res: VnmfGeneral.CallbackResult) => void } } interface VnmfStatic { /** **This interface can only be called in applet plugins**,Call interface to get plugin user IDs(code)。Plugins can exchange this document for a user identification. openpid。User Different、In case of different host applets or plugins,The markings are not the same.,That is, when and only the same user uses plugin in host applet,openpid It'll be the same. * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/login/wx.pluginLogin.html */ pluginLogin(option?: pluginLogin.Option): Promise /** Call interface to get login documents(code)。In exchange for user log-in state information by means of a certificate,Including the unique identification of user(openid)and the key to this login session(session_key)Wait.。The decryption of user data requires a session key to complete。More details on the methods of use [Applet Login](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/login.html)。 * @supported weapp * @example * ```tsx * Vnmf.login({ * success: function (res) { * if (res.code) { * //Launch network request * Vnmf.request({ * url: 'https://test.com/onLogin', * data: { * code: res.code * } * }) * } else { * console.log('Login failed!' + res.errMsg) * } * } * }) * ``` * @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/login/wx.login.html */ login(option?: login.Option): Promise /** Check login state for expiry。 * * Through Vnmf.login The user login state acquired by the interface has a certain timeliness。The longer the user does not use applet,The more likely the user login state is to fail。On the other hand, if user has been using applet,,User login status remains valid。The specific time logic is preserved by micro-letters.,Transparency to developers。The developers just need to call. Vnmf.checkSession Interface detects the validity of current user login state。 * * Developer can call again after the login state has expired Vnmf.login Retrieve new user login state。Call success indicates the current session_key Unexpired,Call Failed Description session_key Expired。More details on the methods of use [Applet Login](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/login.html)。 * @supported weapp * @example * ```tsx * Vnmf.checkSession({ * success: function () { * //session_key Unexpired,And it's going to work all the way through this life cycle. * }, * fail: function () { * // session_key It's not working.,Reexecuting login process is required * Vnmf.login() //Relog * } * }) * ``` * @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/login/wx.checkSession.html */ checkSession(option?: checkSession.Option): Promise } }