import Vnmf from '../../index' declare module '../../index' { namespace getUserInfo { 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 /** Language to display user information */ lang?: keyof UserInfo.Language /** Interface calls a successful echo function */ success?: (result: SuccessCallbackResult) => void /** Whether to bring login state information。♪ When withCredentials Yes. true Hour,I asked for a call before. Vnmf.login and login status not expired,The data returned at this time will contain encryptedData, iv Waiting for sensitive information.;♪ When withCredentials Yes. false Hour,Do not require login status,The returned data does not contain encryptedData, iv Waiting for sensitive information.。 */ withCredentials?: boolean } interface SuccessCallbackResult extends VnmfGeneral.CallbackResult { /** Clouds corresponding to sensitive data ID,Let's go, let's go.[Cloud development](https://developers.weixin.qq.com/miniprogram/dev/wxcloud/basis/getting-started.html)The applets will return.,Direct access to open data through cloud calls,See you later.[Cloud call direct access to open data](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html#method-cloud) */ cloudID?: string /** Encryption data for complete user information, including sensitive,Details [Signing authentication and decryption of user data](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html#%E5%8A%A0%E5%AF%86%E6%95%B0%E6%8D%AE%E8%A7%A3%E5%AF%86%E7%AE%97%E6%B3%95) */ encryptedData: string /** Initial vector of encryption algorithms,Details [Signing authentication and decryption of user data](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html#%E5%8A%A0%E5%AF%86%E6%95%B0%E6%8D%AE%E8%A7%A3%E5%AF%86%E7%AE%97%E6%B3%95) */ iv: string /** Original data string excluding sensitive information,Use to calculate signature */ rawData: string /** Use sha1( rawData + sessionkey ) Get String,Could not close temporary folder: %s,Details [Signing authentication and decryption of user data](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html) */ signature: string /** User Info Object,_Other Organiser openid Waiting for sensitive information. */ userInfo: UserInfo /** Call Results */ errMsg: string } } namespace getUserProfile { interface Option { /** Language to display user information */ lang?: keyof UserInfo.Language /** Declares the use of user 's personal information,No more than30Character */ desc: string /** Interface calls a successful echo function */ success?: (result: SuccessCallbackResult) => void /** Interface call failed echo function */ fail?: (res: VnmfGeneral.CallbackResult) => void /** Interface call to the end of echo function(Call successfully、Any failure will be enforced.) */ complete?: (res: VnmfGeneral.CallbackResult) => void } interface SuccessCallbackResult extends getUserInfo.SuccessCallbackResult { /** User Info Object */ userInfo: UserInfo /** Original data string excluding sensitive information,Use to calculate signature */ rawData: string /** Use sha1( rawData + sessionkey ) Get String,Could not close temporary folder: %s,Details [Signing authentication and decryption of user data](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html) */ signature: string /** Encryption data for complete user information, including sensitive,Details [Signing authentication and decryption of user data](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html#%E5%8A%A0%E5%AF%86%E6%95%B0%E6%8D%AE%E8%A7%A3%E5%AF%86%E7%AE%97%E6%B3%95) */ encryptedData: string /** Initial vector of encryption algorithms,Details [Signing authentication and decryption of user data](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html#%E5%8A%A0%E5%AF%86%E6%95%B0%E6%8D%AE%E8%A7%A3%E5%AF%86%E7%AE%97%E6%B3%95) */ iv: string /** Clouds corresponding to sensitive data ID,A small program to open the clouds will return.,Direct access to open data through cloud calls,Details [See clouds calling for direct access to open data](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html#method-cloud) */ cloudID: string } } /** User Information * @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/user-info/UserInfo.html */ interface UserInfo { /** nick of the user */ nickName: string /** The user image. URL。URL The last value represents the size of a rectangular header(Yes. 0、46、64、96、132 An optional value,0 Representative 640x640 A rectangled image.,46 Organisation 46x46 A rectangled image.,The remaining values are extrapolated by this。Default132),It's empty when the user has no head.。If the user changes image,,The original head. URL It's going to fail.。 */ avatarUrl: string /** Sex of user。Do not return,References [Relevant bulletins](https://developers.weixin.qq.com/community/develop/doc/00028edbe3c58081e7cc834705b801) */ gender?: keyof UserInfo.Gender /** Country of user。Do not return,References [Relevant bulletins](https://developers.weixin.qq.com/community/develop/doc/00028edbe3c58081e7cc834705b801) */ country: string /** The user's province.。Do not return,References [Relevant bulletins](https://developers.weixin.qq.com/community/develop/doc/00028edbe3c58081e7cc834705b801) */ province: string /** City of the user。Do not return,References [Relevant bulletins](https://developers.weixin.qq.com/community/develop/doc/00028edbe3c58081e7cc834705b801) */ city: string /** Display country,province,city Languages used。Force Return “zh_CN”,References [Relevant bulletins](https://developers.weixin.qq.com/community/develop/doc/00028edbe3c58081e7cc834705b801) */ language: keyof UserInfo.Language } namespace UserInfo { interface Language { en: 'English' zh_CN: 'CREDIT_FOR_TRANSLATORS' zh_TW: 'Chinese' } interface Gender { 0: 'Unknown' 1: 'Men' 2: 'Female' } } interface VnmfStatic { /** Access user information。 * * **Interface Adjustment Description** * Call this interface without a user ' s authorization,The authorized window will no longer appear.,It'll go straight in. fail Turn back.(Details[《Announcement》](https://developers.weixin.qq.com/community/develop/doc/0000a26e1aca6012e896a517556c01))。Call this interface as authorized by the user,Successful access to user information。 * @supported weapp, tt * @example * ```tsx * // It must be called when the user has authorized it. * * Vnmf.getUserInfo({ * success: function(res) { * var userInfo = res.userInfo * var nickName = userInfo.nickName * var avatarUrl = userInfo.avatarUrl * var gender = userInfo.gender //Gender 0:Unknown、1:Men、2:Women * var province = userInfo.province * var city = userInfo.city * var country = userInfo.country * } * }) * ``` * * There are two ways to get sensitive data.,- It's for use. [Encryption Data Decrypt algorithm](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html#%E5%8A%A0%E5%AF%86%E6%95%B0%E6%8D%AE%E8%A7%A3%E5%AF%86%E7%AE%97%E6%B3%95) 。 * Access to open data is as follows: json Structure: * * ```json * { * "openId": "OPENID", * "nickName": "NICKNAME", * "gender": GENDER, * "city": "CITY", * "province": "PROVINCE", * "country": "COUNTRY", * "avatarUrl": "AVATARURL", * "unionId": "UNIONID", * "watermark": { * "appid":"APPID", * "timestamp": TIMESTAMP * } * } * ``` * @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/user-info/wx.getUserInfo.html */ getUserInfo(option?: getUserInfo.Option): Promise /** * Access user information。Every request pops the authorization window.,Return with user 's consent `userInfo`。 * * If the developer needs to access user's personal information(The head.、Nickname、Gender and region),We can do it. Vnmf.getUserProfile Interface to access, * * We've got the interface from base. **2.10.4** Version Started Support,This interface returns only user's personal information,Cannot initialise Evolution's mail component.。_Other Organiser desc Properties(Declares the use of user 's personal information)The next thing you know, it'll be in the window.,Make sure the developers fill in carefully.。 * * Developer requires user confirmation for each ' s personal information accessed through the interface,The developers are requested to keep the user's nick quickly filled in.,Do not repeat the window.。 * * [Micro-Address Background & Description,Please refer to the document](https://developers.weixin.qq.com/community/develop/doc/000cacfa20ce88df04cb468bc52801) * @supported weapp, tt * @example * Recommended for use Vnmf.getUserProfile Access user information,Developer requires user confirmation for each ' s personal information accessed through the interface * * ```tsx * Vnmf.getUserProfile({ * desc: 'For the improvement of membership information', // Declares the use of user 's personal information,The next thing you know, it'll be in the window.,Please fill in carefully. * success: (res) => { * // Developer secures user 's quick-filled nick,Do not repeat the window. * this.setState({ * userInfo: res.userInfo, * hasUserInfo: true * }) * } * }) * ``` * @since 2.2.17+,3.0.29+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/user-info/wx.getUserProfile.html */ getUserProfile(option: getUserProfile.Option): Promise } }