-
Notifications
You must be signed in to change notification settings - Fork 0
/
service.wbaccount.d.ts
83 lines (77 loc) · 2.41 KB
/
service.wbaccount.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/// <reference path="./types.d.ts"/>
/**
* 微博账户 wbaccount
* @后台运行限制 禁止使用。后台运行详细用法参见后台运行 脚本。
* @see https://doc.quickapp.cn/features/service/wbaccount.html
*/
declare module '@service.wbaccount' {
interface Wbaccount {
/**
* 获取当前的微博登录方式
*/
getType(): any;
/**
* 进行微博授权
* @example
* ```js
* wbaccount.authorize({
* redirectUri: 'https://api.weibo.com/oauth2/default.html',
* scope: 'follow_app_official_microblog',
* success: function(data) {
* console.log('handling success. accessToken=' + data.accessToken)
* },
* fail: function(data, code) {
* console.log('handling fail, result data=' + data + ', code=' + code)
* },
* cancel: function() {
* console.log('handling cancel')
* }
* })
* ```
*/
authorize(OBJECT: AuthorizeOBJECT): any;
}
/**
*
* @param redirectUri 授权回调地址,与微博开放平台配置保持一致,默认可填写 https://api.weibo.com/oauth2/default.html
* @param scope 申请 scope 权限所需参数,可一次申请多个 scope 权限,用逗号分隔。示例:follow_app_official_microblog,可参考:http://open.weibo.com/wiki/Scope[可选]
* @param success 成功回调[可选]
* @param fail 失败回调[可选]
* @param cancel 取消回调[可选]
*/
interface AuthorizeOBJECT {
redirectUri: String;
scope?: String;
success?: AuthorizeOBJECTSuccessCB;
fail?: Function;
cancel?: Function;
}
/**
* 成功回调
*/
type AuthorizeOBJECTSuccessCB = (
successArg: AuthorizeSuccessSuccessArg
) => any;
/**
* 成功回调
* @param accessToken 授权 token[可选]
* @param expiresIn 过期时间[可选]
* @param uid 用户 uid[可选]
* @param refreshToken 刷新 token,可用于刷新授权 token 有效期[可选]
* @param phone 用户输入的手机号码[可选]
*/
interface AuthorizeSuccessSuccessArg {
accessToken?: String;
expiresIn?: Number;
uid?: String;
refreshToken?: String;
phone?: String;
}
/**
* 微博账户 wbaccount
* @后台运行限制 禁止使用。后台运行详细用法参见后台运行 脚本。
* @see https://doc.quickapp.cn/features/service/wbaccount.html
*/
const wbaccount: Wbaccount;
export default wbaccount;
}