-
-
Notifications
You must be signed in to change notification settings - Fork 633
/
index.d.ts
355 lines (318 loc) · 7.64 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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
// constants
export enum category {
APPLICATION = 'APPLICATION',
ANDROID_WEAR = 'ANDROID_WEAR',
ART_AND_DESIGN = 'ART_AND_DESIGN',
AUTO_AND_VEHICLES = 'AUTO_AND_VEHICLES',
BEAUTY = 'BEAUTY',
BOOKS_AND_REFERENCE = 'BOOKS_AND_REFERENCE',
BUSINESS = 'BUSINESS',
COMICS = 'COMICS',
COMMUNICATION = 'COMMUNICATION',
DATING = 'DATING',
EDUCATION = 'EDUCATION',
ENTERTAINMENT = 'ENTERTAINMENT',
EVENTS = 'EVENTS',
FINANCE = 'FINANCE',
FOOD_AND_DRINK = 'FOOD_AND_DRINK',
HEALTH_AND_FITNESS = 'HEALTH_AND_FITNESS',
HOUSE_AND_HOME = 'HOUSE_AND_HOME',
LIBRARIES_AND_DEMO = 'LIBRARIES_AND_DEMO',
LIFESTYLE = 'LIFESTYLE',
MAPS_AND_NAVIGATION = 'MAPS_AND_NAVIGATION',
MEDICAL = 'MEDICAL',
MUSIC_AND_AUDIO = 'MUSIC_AND_AUDIO',
NEWS_AND_MAGAZINES = 'NEWS_AND_MAGAZINES',
PARENTING = 'PARENTING',
PERSONALIZATION = 'PERSONALIZATION',
PHOTOGRAPHY = 'PHOTOGRAPHY',
PRODUCTIVITY = 'PRODUCTIVITY',
SHOPPING = 'SHOPPING',
SOCIAL = 'SOCIAL',
SPORTS = 'SPORTS',
TOOLS = 'TOOLS',
TRAVEL_AND_LOCAL = 'TRAVEL_AND_LOCAL',
VIDEO_PLAYERS = 'VIDEO_PLAYERS',
WATCH_FACE = 'WATCH_FACE',
WEATHER = 'WEATHER',
GAME = 'GAME',
GAME_ACTION = 'GAME_ACTION',
GAME_ADVENTURE = 'GAME_ADVENTURE',
GAME_ARCADE = 'GAME_ARCADE',
GAME_BOARD = 'GAME_BOARD',
GAME_CARD = 'GAME_CARD',
GAME_CASINO = 'GAME_CASINO',
GAME_CASUAL = 'GAME_CASUAL',
GAME_EDUCATIONAL = 'GAME_EDUCATIONAL',
GAME_MUSIC = 'GAME_MUSIC',
GAME_PUZZLE = 'GAME_PUZZLE',
GAME_RACING = 'GAME_RACING',
GAME_ROLE_PLAYING = 'GAME_ROLE_PLAYING',
GAME_SIMULATION = 'GAME_SIMULATION',
GAME_SPORTS = 'GAME_SPORTS',
GAME_STRATEGY = 'GAME_STRATEGY',
GAME_TRIVIA = 'GAME_TRIVIA',
GAME_WORD = 'GAME_WORD',
FAMILY = 'FAMILY'
}
export enum collection {
TOP_FREE = 'TOP_FREE',
TOP_PAID = 'TOP_PAID',
GROSSING = 'GROSSING',
}
export enum sort {
NEWEST = 2,
RATING = 3,
HELPFULNESS = 1
}
export enum age {
FIVE_UNDER = 'AGE_RANGE1',
SIX_EIGHT = 'AGE_RANGE2',
NINE_UP = 'AGE_RANGE3'
}
export enum permission {
COMMON = 0,
OTHER = 1
}
// entity
export interface IAppItem {
url: string
appId: string
title: string
summary: string
developer: string
developerId: string
icon: string
score: number
scoreText: string
priceText: string
free: boolean
}
export interface IAppItemFullDetail extends IAppItem {
appId: string
url: string
title: string
description: string
descriptionHTML: string
summary: string
installs: string
minInstalls: number
maxInstalls: number
score: number
scoreText: string
ratings: number
reviews: number
histogram: { '1': number, '2': number, '3': number, '4': number, '5': number }
price: number
originalPrice?: number
discountEndDate?: string
free: boolean
currency: string
priceText: string
available: boolean,
offersIAP: boolean,
IAPRange: string
size: string
androidVersion: string
androidVersionText: string
developer: string
developerId: string
developerInternalID: string
developerEmail: string
developerWebsite: string
developerAddress: string
developerLegalName: string
developerLegalEmail: string
developerLegalAddress: string
developerLegalPhoneNumber: string
genre: string
genreId: string
categories: Array<{
name: string
id: string|null
}>
icon: string
headerImage: string
screenshots: string[]
video: string
videoImage: string
contentRating: string
contentRatingDescription: string
adSupported: boolean
released: string
updated: number
version: string
recentChanges: string
comments: string[]
hasEarlyAccess: boolean
preregister: boolean
isAvailableInPlayPass: boolean
}
export interface IReviewsItem {
id: string
userName: string
userImage: string
date: string
score: number
scoreText: string
url: string
title: string
text: string
replyDate: string
replyText: string
version: string
thumbsUp: number
criterias: Array<{
criteria: string
rating: number
}>
}
export interface IPermissionItem {
permission: string
type: string
}
export interface IDataSafetyItem {
data : string
optional : string
purpose : string
type : string
}
// functions
interface IOptions {
throttle?: number
}
// -- app()
export interface IFnAppOptions extends IOptions {
appId: string
lang?: string
country?: string
}
export interface IFnApp {
(options: IFnAppOptions): Promise<IAppItemFullDetail>
}
// -- list()
export interface IFnListOptions extends IOptions {
collection?: collection
category?: category
age?: age
num?: number
lang?: string
country?: string
fullDetail?: boolean
}
export interface IFnList {
<T extends IFnListOptions>(options: T): T extends { fullDetail: true } ? Promise<IAppItemFullDetail[]> : Promise<IAppItem[]>
}
// -- search()
export interface IFnSearchOptions extends IOptions {
term: string
num?: number
lang?: string
country?: string
fullDetail?: boolean
price?: 'all' | 'free' | 'paid'
}
export interface IFnSearch {
<T extends IFnSearchOptions>(options: T): T extends { fullDetail: true } ? Promise<IAppItemFullDetail[]> : Promise<IAppItem[]>
}
// -- developer()
export interface IFnDeveloperOptions extends IOptions {
devId: string
lang?: string
country?: string
num?: number
fullDetail?: boolean
}
export interface IFnDeveloper {
<T extends IFnDeveloperOptions>(options: T): T extends { fullDetail: true } ? Promise<IAppItemFullDetail[]> : Promise<IAppItem[]>
}
// -- suggest()
export interface IFnSuggestOptions extends IOptions {
term: string
lang?: string
country?: string
}
export interface IFnSuggest {
(options: IFnSuggestOptions): Promise<string[]>
}
// -- reviews()
export interface IFnReviewsOptions extends IOptions {
appId: string
lang?: string
country?: string
sort?: sort
num?: number,
paginate?: boolean
nextPaginationToken?: string
}
export interface IReviewsResult {
data: IReviewsItem[]
nextPaginationToken?: string
}
export interface IFnReviews {
(options: IFnReviewsOptions): Promise<IReviewsResult>
}
// -- similar
export interface IFnSimilarOptions extends IOptions {
appId: string
lang?: string
country?: string
fullDetail?: boolean
}
export interface IFnSimilar {
<T extends IFnSimilarOptions>(options: T): T extends { fullDetail: true } ? Promise<IAppItemFullDetail[]> : Promise<IAppItem[]>
}
// -- permissions
export interface IFnPermissionsOptions extends IOptions {
appId: string
lang?: string
short?: string
}
export interface IFnPermissions {
(options: IFnPermissionsOptions): Promise<IPermissionItem[]>
}
// -- categories
export interface IFnCategoriesOptions extends IOptions {}
export interface IFnCategories {
(options?: IFnCategoriesOptions): Promise<string[]>
}
// datasafety
export interface IFnDatasafetyOptions extends IOptions {
appId: string
lang?: string
}
export interface IFnDataSafety {
(options?: IFnDatasafetyOptions): Promise<IDataSafetyItem[]>
}
// memoization
export interface IMemoizedResult {
category: category,
collection: collection,
sort: sort,
age: age,
permission: permission,
app: IFnApp
list: IFnList
search: IFnSearch
developer: IFnDeveloper
suggest: IFnSuggest
reviews: IFnReviews
similar: IFnSimilar
permissions: IFnPermissions
categories: IFnCategories
datasafety: IFnDataSafety
}
export interface IFnMemoized {
(options?: any): IMemoizedResult
}
export const app: IFnApp
export const list: IFnList
export const search: IFnSearch
export const developer: IFnDeveloper
export const suggest: IFnSuggest
export const reviews: IFnReviews
export const similar: IFnSimilar
export const permissions: IFnPermissions
export const categories: IFnCategories
export const datasafety : IFnDataSafety
export const memoized: IFnMemoized