Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

types: getUserProfile #8904

Merged
merged 2 commits into from
Mar 15, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions packages/taro/types/api/open-api/user-info.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,26 @@ declare namespace Taro {
errMsg: string
}
}

namespace getUserProfile {
interface Option {
/** 显示用户信息的语言 */
lang?: keyof UserInfo.language
/** 声明获取用户个人信息后的用途,不超过30个字符 */
desc: string
/** 接口调用成功的回调函数 */
success?: (result: SuccessCallbackResult) => void
/** 接口调用失败的回调函数 */
fail?: (res: General.CallbackResult) => void
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
complete?: (res: General.CallbackResult) => void
}

interface SuccessCallbackResult extends General.CallbackResult {
/** 用户信息对象 */
userInfo: UserInfo
}
}

/** 获取用户信息。
*
Expand Down Expand Up @@ -75,6 +95,11 @@ declare namespace Taro {
*/
function getUserInfo(option?: getUserInfo.Option): Promise<getUserInfo.SuccessCallbackResult>

/**
* 获取用户信息。每次请求都会弹出授权窗口,用户同意后返回 `userInfo`。
* @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/user-info/wx.getUserProfile.html
*/
function getUserProfile(option: getUserProfile.Option): Promise<getUserProfile.SuccessCallbackResult>


/** 用户信息
Expand Down