forked from little-snow-fox/react-native-wechat-lib
-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.d.ts
160 lines (157 loc) · 4.18 KB
/
index.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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
/*! @brief 请求发送场景
*
*/
enum WXScene {
WXSceneSession = 0, /**< 聊天界面 */
WXSceneTimeline = 1, /**< 朋友圈 */
WXSceneFavorite = 2, /**< 收藏 */
WXSceneSpecifiedSession = 3, /**< 指定联系人 */
};
declare module "react-native-wechat-lib" {
export function registerApp(appId: string, universalLink?: string): Promise<boolean>;
export function isWXAppInstalled(): Promise<boolean>;
export function isWXAppSupportApi(): Promise<boolean>;
export function getApiVersion(): Promise<string>;
export function openWXApp(): Promise<boolean>;
export interface AuthResponse {
errCode?: number;
errStr?: string;
openId?: string;
code?: string;
url?: string;
lang?: string;
country?: string;
}
export interface WeChatReq {
type?: string,
errStr?: string,
extMsg?: string,
country?: string,
state?: string,
returnKey?: string
}
export interface WeChatResp {
type?: string,
errStr?: string,
extMsg?: string,
country?: string,
state?: string,
returnKey?: string
}
export function sendAuthRequest(
scope: string | string[],
state?: string
): Promise<AuthResponse>;
export interface ShareMetadata {
type:
| "news"
| "text"
| "imageUrl"
| "imageFile"
| "imageResource"
| "video"
| "audio"
| "file";
thumbImage?: string;
description?: string;
webpageUrl?: string;
imageUrl?: string;
videoUrl?: string;
musicUrl?: string;
filePath?: string;
fileExtension?: string;
}
export interface ShareTextMetadata {
text: string,
scene?: WXScene
}
export interface ShareImageMetadata {
imageUrl: string,
scene?: WXScene
}
export interface ShareMusicMetadata {
musicUrl: string,
musicLowBandUrl?: string,
musicDataUrl?: string,
musicLowBandDataUrl?: string,
title?: string,
description?: string,
thumbImageUrl?: string,
scene?: WXScene
}
export interface ShareVideoMetadata {
videoUrl: string,
videoLowBandUrl?: string,
title?: string,
description?: string,
thumbImageUrl?: string,
scene?: WXScene
}
export interface ShareWebpageMetadata {
webpageUrl: string,
title?: string,
description?: string,
thumbImageUrl?: string,
scene?: WXScene
}
export interface ShareMiniProgramMetadata {
webpageUrl: string,
userName: string,
path?: string,
hdImageUrl?: string,
withShareTicket?: string,
miniProgramType?: number,
title?: string,
description?: string,
thumbImageUrl?: string,
scene?: WXScene
}
export interface LaunchMiniProgramMetadata {
userName: string,
miniProgramType?: number,
path?: string
}
export interface SubscribeMessageMetadata {
scene?: WXScene,
templateId: string,
reserved?: string
}
export function shareText(
message: ShareTextMetadata
): Promise<{ errCode?: number; errStr?: string }>;
export function shareImage(
message: ShareImageMetadata
): Promise<{ errCode?: number; errStr?: string }>;
export function shareLocalImage(
message: ShareImageMetadata
): Promise<{ errCode?: number; errStr?: string }>;
export function shareMusic(
message: ShareMusicMetadata
): Promise<{ errCode?: number; errStr?: string }>;
export function shareVideo(
message: ShareVideoMetadata
): Promise<{ errCode?: number; errStr?: string }>;
export function shareWebpage(
message: ShareWebpageMetadata
): Promise<{ errCode?: number; errStr?: string }>;
export function shareMiniProgram(
message: ShareMiniProgramMetadata
): Promise<{ errCode?: number; errStr?: string }>;
export function launchMiniProgram(
message: LaunchMiniProgramMetadata
): Promise<{ errCode?: number; errStr?: string }>;
export function subscribeMessage(
message: SubscribeMessageMetadata
): Promise<{ errCode?: number; errStr?: string }>;
export interface PaymentLoad {
partnerId: string;
prepayId: string;
nonceStr: string;
timeStamp: string;
package: string;
sign: string;
}
export function pay(
payload: PaymentLoad
): Promise<{ errCode?: number; errStr?: string }>;
}