javascript-ampache 1.0.9 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +50 -47
- package/dist/albums/index.d.ts +7 -13
- package/dist/albums/types.d.ts +9 -4
- package/dist/artists/index.d.ts +8 -14
- package/dist/artists/types.d.ts +10 -5
- package/dist/auth/index.d.ts +1 -1
- package/dist/base.d.ts +5 -0
- package/dist/bookmarks/index.d.ts +20 -21
- package/dist/bookmarks/types.d.ts +7 -2
- package/dist/catalogs/index.d.ts +9 -11
- package/dist/catalogs/types.d.ts +8 -3
- package/dist/genres/index.d.ts +4 -6
- package/dist/genres/types.d.ts +6 -1
- package/dist/index.d.ts +19 -19
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.m.js +1 -1
- package/dist/index.m.js.map +1 -1
- package/dist/index.modern.mjs +1 -1
- package/dist/index.modern.mjs.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/dist/labels/index.d.ts +4 -6
- package/dist/labels/types.d.ts +6 -1
- package/dist/licenses/index.d.ts +4 -6
- package/dist/licenses/types.d.ts +6 -1
- package/dist/live-streams/index.d.ts +8 -10
- package/dist/live-streams/types.d.ts +6 -1
- package/dist/playlists/index.d.ts +15 -25
- package/dist/playlists/types.d.ts +7 -2
- package/dist/podcasts/index.d.ts +10 -16
- package/dist/podcasts/types.d.ts +20 -5
- package/dist/preferences/index.d.ts +8 -16
- package/dist/preferences/types.d.ts +6 -1
- package/dist/shares/index.d.ts +7 -9
- package/dist/shares/types.d.ts +6 -1
- package/dist/shouts/index.d.ts +4 -4
- package/dist/shouts/types.d.ts +1 -1
- package/dist/songs/index.d.ts +12 -28
- package/dist/songs/types.d.ts +12 -2
- package/dist/system/index.d.ts +24 -24
- package/dist/system/types.d.ts +9 -9
- package/dist/users/index.d.ts +10 -10
- package/dist/users/types.d.ts +7 -2
- package/dist/videos/index.d.ts +5 -9
- package/dist/videos/types.d.ts +12 -2
- package/package.json +38 -38
- package/src/albums/index.ts +86 -86
- package/src/albums/types.ts +38 -32
- package/src/artists/index.ts +88 -88
- package/src/artists/types.ts +38 -32
- package/src/auth/index.ts +103 -103
- package/src/auth/types.ts +25 -25
- package/src/base.ts +134 -119
- package/src/bookmarks/index.ts +116 -122
- package/src/bookmarks/types.ts +15 -9
- package/src/catalogs/index.ts +130 -119
- package/src/catalogs/types.ts +27 -15
- package/src/genres/index.ts +39 -40
- package/src/genres/types.ts +23 -17
- package/src/index.ts +63 -26
- package/src/labels/index.ts +43 -44
- package/src/labels/types.ts +20 -14
- package/src/licenses/index.ts +43 -44
- package/src/licenses/types.ts +14 -8
- package/src/live-streams/index.ts +104 -107
- package/src/live-streams/types.ts +16 -10
- package/src/playlists/index.ts +262 -269
- package/src/playlists/types.ts +20 -14
- package/src/podcasts/index.ts +174 -177
- package/src/podcasts/types.ts +85 -67
- package/src/preferences/index.ts +114 -116
- package/src/preferences/types.ts +18 -12
- package/src/shares/index.ts +100 -96
- package/src/shares/types.ts +25 -19
- package/src/shouts/index.ts +18 -22
- package/src/shouts/types.ts +9 -9
- package/src/songs/index.ts +208 -203
- package/src/songs/types.ts +77 -65
- package/src/system/index.ts +689 -572
- package/src/system/types.ts +33 -19
- package/src/users/index.ts +227 -245
- package/src/users/types.ts +38 -32
- package/src/utils.ts +25 -25
- package/src/videos/index.ts +49 -53
- package/src/videos/types.ts +42 -30
package/src/system/types.ts
CHANGED
|
@@ -1,19 +1,33 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { UID } from "../base";
|
|
9
|
-
|
|
10
|
-
export type IndexType =
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
1
|
+
import { SongResponse } from "../songs/types";
|
|
2
|
+
import { AlbumResponse } from "../albums/types";
|
|
3
|
+
import { ArtistResponse } from "../artists/types";
|
|
4
|
+
import { PlaylistResponse } from "../playlists/types";
|
|
5
|
+
import { PodcastResponse, PodcastEpisodeResponse } from "../podcasts/types";
|
|
6
|
+
import { LiveStreamResponse } from "../live-streams/types";
|
|
7
|
+
import { VideoResponse } from "../videos/types";
|
|
8
|
+
import { UID } from "../base";
|
|
9
|
+
|
|
10
|
+
export type IndexType =
|
|
11
|
+
| SongResponse
|
|
12
|
+
| AlbumResponse
|
|
13
|
+
| ArtistResponse
|
|
14
|
+
| PlaylistResponse
|
|
15
|
+
| PodcastResponse
|
|
16
|
+
| PodcastEpisodeResponse
|
|
17
|
+
| LiveStreamResponse;
|
|
18
|
+
|
|
19
|
+
export type StatsType =
|
|
20
|
+
| SongResponse
|
|
21
|
+
| AlbumResponse
|
|
22
|
+
| ArtistResponse
|
|
23
|
+
| VideoResponse
|
|
24
|
+
| PlaylistResponse
|
|
25
|
+
| PodcastResponse
|
|
26
|
+
| PodcastEpisodeResponse;
|
|
27
|
+
|
|
28
|
+
export type IndexEntry = {
|
|
29
|
+
id: UID;
|
|
30
|
+
name: string;
|
|
31
|
+
prefix: string;
|
|
32
|
+
basename: string;
|
|
33
|
+
};
|
package/src/users/index.ts
CHANGED
|
@@ -1,245 +1,227 @@
|
|
|
1
|
-
import qs from
|
|
2
|
-
import {
|
|
3
|
-
import {Base, BinaryBoolean, ExtendedPagination, Success} from
|
|
4
|
-
|
|
5
|
-
export class Users extends Base {
|
|
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
|
-
* This get current user friends timeline
|
|
231
|
-
* @remarks MINIMUM_API_VERSION=380001
|
|
232
|
-
* @param [params.limit] Max results to return
|
|
233
|
-
* @param [params.since] UNIXTIME
|
|
234
|
-
* @see {@link https://ampache.org/api/api-json-methods#friends_timeline}
|
|
235
|
-
*/
|
|
236
|
-
async friendsTimeline (params?: {
|
|
237
|
-
limit?: number,
|
|
238
|
-
since?: number,
|
|
239
|
-
}) {
|
|
240
|
-
let query = 'friends_timeline';
|
|
241
|
-
query += qs.stringify(params, '&');
|
|
242
|
-
let data = await this.request<{activity: Activity[]}>(query);
|
|
243
|
-
return (data.activity) ? data.activity : data;
|
|
244
|
-
}
|
|
245
|
-
}
|
|
1
|
+
import qs from "querystringify";
|
|
2
|
+
import { UserResponse, UserSummary, ActivityResponse } from "./types";
|
|
3
|
+
import { Base, BinaryBoolean, ExtendedPagination, Success } from "../base";
|
|
4
|
+
|
|
5
|
+
export class Users extends Base {
|
|
6
|
+
/**
|
|
7
|
+
* Get ids and usernames for your site
|
|
8
|
+
* @remarks MINIMUM_API_VERSION=5.0.0
|
|
9
|
+
* @see {@link https://ampache.org/api/api-json-methods#users}
|
|
10
|
+
*/
|
|
11
|
+
users() {
|
|
12
|
+
let query = "users";
|
|
13
|
+
return this.request<{ user: UserSummary[] }>(query);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* This get a user's public information (or current user if username is omitted)
|
|
18
|
+
* @remarks MINIMUM_API_VERSION=380001
|
|
19
|
+
* @param [params.username] UID to find
|
|
20
|
+
* @see {@link https://ampache.org/api/api-json-methods#user}
|
|
21
|
+
*/
|
|
22
|
+
user(params?: { username?: string }) {
|
|
23
|
+
let query = "user";
|
|
24
|
+
query += qs.stringify(params, "&");
|
|
25
|
+
return this.request<UserResponse>(query);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Create a new user
|
|
30
|
+
* ACCESS REQUIRED: 100 (Admin)
|
|
31
|
+
* @remarks MINIMUM_API_VERSION=400001
|
|
32
|
+
* @param params.username Username
|
|
33
|
+
* @param params.password SHA256 hashed password
|
|
34
|
+
* @param params.email Email
|
|
35
|
+
* @param [params.fullname] Full Name
|
|
36
|
+
* @param [params.disable] 0, 1
|
|
37
|
+
* @param [params.catalog_filter_group] Catalog filter group, default = 0
|
|
38
|
+
* @see {@link https://ampache.org/api/api-json-methods#user_create}
|
|
39
|
+
*/
|
|
40
|
+
userCreate(params: {
|
|
41
|
+
username: string;
|
|
42
|
+
password: string;
|
|
43
|
+
email: string;
|
|
44
|
+
fullname?: string;
|
|
45
|
+
disable?: BinaryBoolean;
|
|
46
|
+
catalog_filter_group?: number;
|
|
47
|
+
}) {
|
|
48
|
+
let query = "user_create";
|
|
49
|
+
query += qs.stringify(params, "&");
|
|
50
|
+
return this.request<Success>(query);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Register as a new user if allowed.
|
|
55
|
+
* @remarks MINIMUM_API_VERSION=6.0.0
|
|
56
|
+
* @param params.username Username
|
|
57
|
+
* @param params.password SHA256 hashed password
|
|
58
|
+
* @param params.email Email
|
|
59
|
+
* @param [params.fullname] Full Name
|
|
60
|
+
* @see {@link https://ampache.org/api/api-json-methods/#register}
|
|
61
|
+
*/
|
|
62
|
+
register(params: {
|
|
63
|
+
username: string;
|
|
64
|
+
password: string;
|
|
65
|
+
email: string;
|
|
66
|
+
fullname?: string;
|
|
67
|
+
}) {
|
|
68
|
+
let query = "register";
|
|
69
|
+
query += qs.stringify(params, "&");
|
|
70
|
+
return this.request<Success>(query);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Update an existing user
|
|
75
|
+
* ACCESS REQUIRED: 100 (Admin)
|
|
76
|
+
* @remarks MINIMUM_API_VERSION=400001
|
|
77
|
+
* @param params.username Username
|
|
78
|
+
* @param [params.password] Password
|
|
79
|
+
* @param [params.email] Email
|
|
80
|
+
* @param [params.fullname] Full Name
|
|
81
|
+
* @param [params.website] Website
|
|
82
|
+
* @param [params.state] State
|
|
83
|
+
* @param [params.city] City
|
|
84
|
+
* @param [params.disable] 0, 1
|
|
85
|
+
* @param [params.maxbitrate] Max bitrate for transcoding
|
|
86
|
+
* @see {@link https://ampache.org/api/api-json-methods#user_update}
|
|
87
|
+
* @deprecated Being removed in 7.0.0. Use `user_edit` instead.
|
|
88
|
+
*/
|
|
89
|
+
userUpdate(params: {
|
|
90
|
+
username: string;
|
|
91
|
+
password?: string;
|
|
92
|
+
email?: string;
|
|
93
|
+
fullname?: string;
|
|
94
|
+
website?: string;
|
|
95
|
+
state?: string;
|
|
96
|
+
city?: string;
|
|
97
|
+
disable?: BinaryBoolean;
|
|
98
|
+
maxbitrate?: string;
|
|
99
|
+
}) {
|
|
100
|
+
let query = "user_update";
|
|
101
|
+
query += qs.stringify(params, "&");
|
|
102
|
+
return this.request<Success>(query);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Update an existing user
|
|
107
|
+
* ACCESS REQUIRED: 100 (Admin)
|
|
108
|
+
* @remarks MINIMUM_API_VERSION=6.0.0
|
|
109
|
+
* @param params.username Username
|
|
110
|
+
* @param [params.password] Password
|
|
111
|
+
* @param [params.email] Email
|
|
112
|
+
* @param [params.fullname] Full Name
|
|
113
|
+
* @param [params.website] Website
|
|
114
|
+
* @param [params.state] State
|
|
115
|
+
* @param [params.city] City
|
|
116
|
+
* @param [params.disable] 0, 1
|
|
117
|
+
* @param [params.maxbitrate] Max bitrate for transcoding
|
|
118
|
+
* @param [params.group] Catalog filter group, default = 0
|
|
119
|
+
* @param [params.fullname_public] show fullname in public display
|
|
120
|
+
* @param [params.reset_apikey] reset user Api Key
|
|
121
|
+
* @param [params.reset_streamtoken] reset user Stream Token
|
|
122
|
+
* @param [params.clear_stats] reset all stats for this user
|
|
123
|
+
* @see {@link https://ampache.org/api/api-json-methods#user_edit}
|
|
124
|
+
*/
|
|
125
|
+
userEdit(params: {
|
|
126
|
+
username: string;
|
|
127
|
+
password?: string;
|
|
128
|
+
email?: string;
|
|
129
|
+
fullname?: string;
|
|
130
|
+
website?: string;
|
|
131
|
+
state?: string;
|
|
132
|
+
city?: string;
|
|
133
|
+
maxbitrate?: string;
|
|
134
|
+
group?: number;
|
|
135
|
+
disable?: BinaryBoolean;
|
|
136
|
+
fullname_public?: BinaryBoolean;
|
|
137
|
+
reset_apikey?: BinaryBoolean;
|
|
138
|
+
reset_streamtoken?: BinaryBoolean;
|
|
139
|
+
clear_stats?: BinaryBoolean;
|
|
140
|
+
}) {
|
|
141
|
+
let query = "user_edit";
|
|
142
|
+
query += qs.stringify(params, "&");
|
|
143
|
+
return this.request<Success>(query);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Delete an existing user.
|
|
148
|
+
* ACCESS REQUIRED: 100 (Admin)
|
|
149
|
+
* @remarks MINIMUM_API_VERSION=400001
|
|
150
|
+
* @param params.filter UID of user to delete
|
|
151
|
+
* @see {@link https://ampache.org/api/api-json-methods#user_delete}
|
|
152
|
+
*/
|
|
153
|
+
userDelete(params: { filter: string }) {
|
|
154
|
+
let query = "user_delete";
|
|
155
|
+
query += qs.stringify(params, "&");
|
|
156
|
+
return this.request<Success>(query);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* This gets the followers for the requested username
|
|
161
|
+
* @remarks MINIMUM_API_VERSION=380001
|
|
162
|
+
* @param params.username UID to find
|
|
163
|
+
* @param [params.offset]
|
|
164
|
+
* @param [params.limit]
|
|
165
|
+
* @param [params.cond]
|
|
166
|
+
* @param [params.sort]
|
|
167
|
+
* @see {@link https://ampache.org/api/api-json-methods#followers}
|
|
168
|
+
*/
|
|
169
|
+
followers(
|
|
170
|
+
params: {
|
|
171
|
+
username: string;
|
|
172
|
+
} & ExtendedPagination,
|
|
173
|
+
) {
|
|
174
|
+
let query = "followers";
|
|
175
|
+
query += qs.stringify(params, "&");
|
|
176
|
+
return this.request<{ user: UserSummary[] }>(query);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Get a list of people that this user follows
|
|
181
|
+
* @remarks MINIMUM_API_VERSION=380001
|
|
182
|
+
* @see {@link https://ampache.org/api/api-json-methods#following}
|
|
183
|
+
*/
|
|
184
|
+
following(params: { username: string }) {
|
|
185
|
+
let query = "following";
|
|
186
|
+
query += qs.stringify(params, "&");
|
|
187
|
+
return this.request<{ user: UserSummary[] }>(query);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* This will follow/unfollow a user
|
|
192
|
+
* @param params.username Username string to find
|
|
193
|
+
* @see {@link https://ampache.org/api/api-json-methods#toggle_follow}
|
|
194
|
+
*/
|
|
195
|
+
toggleFollow(params: { username: string }) {
|
|
196
|
+
let query = "toggle_follow";
|
|
197
|
+
query += qs.stringify(params, "&");
|
|
198
|
+
return this.request<Success>(query);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* This get a user timeline
|
|
203
|
+
* @remarks MINIMUM_API_VERSION=380001
|
|
204
|
+
* @param params.username Username to find
|
|
205
|
+
* @param [params.limit] Max results to return
|
|
206
|
+
* @param [params.since] UNIXTIME
|
|
207
|
+
* @see {@link https://ampache.org/api/api-json-methods#timeline}
|
|
208
|
+
*/
|
|
209
|
+
timeline(params: { username: string; limit?: number; since?: number }) {
|
|
210
|
+
let query = "timeline";
|
|
211
|
+
query += qs.stringify(params, "&");
|
|
212
|
+
return this.request<{ activity: ActivityResponse[] }>(query);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* This get current user friends timeline
|
|
217
|
+
* @remarks MINIMUM_API_VERSION=380001
|
|
218
|
+
* @param [params.limit] Max results to return
|
|
219
|
+
* @param [params.since] UNIXTIME
|
|
220
|
+
* @see {@link https://ampache.org/api/api-json-methods#friends_timeline}
|
|
221
|
+
*/
|
|
222
|
+
friendsTimeline(params?: { limit?: number; since?: number }) {
|
|
223
|
+
let query = "friends_timeline";
|
|
224
|
+
query += qs.stringify(params, "&");
|
|
225
|
+
return this.request<{ activity: ActivityResponse[] }>(query);
|
|
226
|
+
}
|
|
227
|
+
}
|
package/src/users/types.ts
CHANGED
|
@@ -1,32 +1,38 @@
|
|
|
1
|
-
import { UID } from "../base";
|
|
2
|
-
|
|
3
|
-
export type UserSummary = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export type
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export type
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
1
|
+
import { UID } from "../base";
|
|
2
|
+
|
|
3
|
+
export type UserSummary = {
|
|
4
|
+
id: UID;
|
|
5
|
+
username: string;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export type UserResponse = {
|
|
9
|
+
id: UID;
|
|
10
|
+
username: string;
|
|
11
|
+
auth: string;
|
|
12
|
+
email: string;
|
|
13
|
+
access: number;
|
|
14
|
+
streamtoken: string | null;
|
|
15
|
+
fullname_public: number;
|
|
16
|
+
validation: string | null;
|
|
17
|
+
disabled: boolean;
|
|
18
|
+
create_date: number;
|
|
19
|
+
last_seen: number;
|
|
20
|
+
website: string | null;
|
|
21
|
+
state: string | null;
|
|
22
|
+
city: string | null;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export type UsersResponse = {
|
|
26
|
+
total_count: number;
|
|
27
|
+
md5: string;
|
|
28
|
+
user: UserResponse[];
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export type ActivityResponse = {
|
|
32
|
+
id: UID;
|
|
33
|
+
date: number;
|
|
34
|
+
object_type: string;
|
|
35
|
+
object_id: UID;
|
|
36
|
+
action: string;
|
|
37
|
+
user: UserSummary;
|
|
38
|
+
};
|
package/src/utils.ts
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import JsSHA from "jssha/dist/sha256";
|
|
2
|
-
|
|
3
|
-
export function applyMixins(derivedCtor: any, baseCtors: any[]) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export function encryptPassword(password: string, time: number) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
1
|
+
import JsSHA from "jssha/dist/sha256";
|
|
2
|
+
|
|
3
|
+
export function applyMixins(derivedCtor: any, baseCtors: any[]) {
|
|
4
|
+
baseCtors.forEach((baseCtor) => {
|
|
5
|
+
Object.getOwnPropertyNames(baseCtor.prototype).forEach((name) => {
|
|
6
|
+
Object.defineProperty(
|
|
7
|
+
derivedCtor.prototype,
|
|
8
|
+
name,
|
|
9
|
+
Object.getOwnPropertyDescriptor(baseCtor.prototype, name),
|
|
10
|
+
);
|
|
11
|
+
});
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function encryptPassword(password: string, time: number) {
|
|
16
|
+
let key = getSHA256(password);
|
|
17
|
+
return getSHA256(time + key);
|
|
18
|
+
|
|
19
|
+
function getSHA256(text) {
|
|
20
|
+
let shaObj = new JsSHA("SHA-256", "TEXT", { encoding: "UTF8" });
|
|
21
|
+
shaObj.update(text);
|
|
22
|
+
|
|
23
|
+
return shaObj.getHash("HEX");
|
|
24
|
+
}
|
|
25
|
+
}
|