anixartjs 0.0.9 → 0.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/dist/api/auth.d.ts +95 -4
- package/dist/api/auth.js +91 -0
- package/dist/api/channel.d.ts +16 -12
- package/dist/api/channel.js +16 -4
- package/dist/api/collection.d.ts +8 -14
- package/dist/api/collection.js +3 -7
- package/dist/api/discover.d.ts +67 -0
- package/dist/api/discover.js +67 -0
- package/dist/api/feed.d.ts +28 -1
- package/dist/api/feed.js +28 -3
- package/dist/api/index.d.ts +1 -0
- package/dist/api/index.js +1 -0
- package/dist/api/notification.d.ts +3 -1
- package/dist/api/notification.js +6 -0
- package/dist/api/profile.d.ts +372 -11
- package/dist/api/profile.js +381 -6
- package/dist/api/release.d.ts +4 -4
- package/dist/api/release.js +3 -3
- package/dist/api/search.d.ts +230 -0
- package/dist/api/search.js +257 -0
- package/dist/api/settings.d.ts +6 -7
- package/dist/api/settings.js +9 -12
- package/dist/classes/Article.d.ts +3 -3
- package/dist/classes/Article.js +3 -2
- package/dist/classes/ArticleComment.d.ts +3 -3
- package/dist/classes/ArticleComment.js +2 -1
- package/dist/classes/BaseProfile.d.ts +4 -3
- package/dist/classes/BaseProfile.js +6 -2
- package/dist/classes/Channel.d.ts +4 -4
- package/dist/classes/Channel.js +7 -6
- package/dist/classes/Collection.d.ts +5 -5
- package/dist/classes/Collection.js +2 -1
- package/dist/classes/Episode.d.ts +3 -3
- package/dist/classes/Release.d.ts +7 -7
- package/dist/classes/Release.js +9 -8
- package/dist/classes/ReleaseComment.d.ts +4 -4
- package/dist/classes/ReleaseComment.js +3 -2
- package/dist/classes/SuggestionArticle.d.ts +2 -2
- package/dist/classes/SuggestionArticle.js +2 -1
- package/dist/client.d.ts +11 -3
- package/dist/client.js +10 -1
- package/dist/endpoints.d.ts +10 -1
- package/dist/endpoints.js +9 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/types/auth.d.ts +41 -2
- package/dist/types/auth.js +45 -0
- package/dist/types/channel.d.ts +107 -10
- package/dist/types/channel.js +95 -0
- package/dist/types/collection.d.ts +38 -4
- package/dist/types/collection.js +42 -0
- package/dist/types/notification.d.ts +4 -0
- package/dist/types/profile.d.ts +41 -3
- package/dist/types/profile.js +26 -1
- package/dist/types/release.d.ts +35 -5
- package/dist/types/release.js +10 -1
- package/dist/types/response.d.ts +26 -6
- package/dist/types/response.js +33 -10
- package/dist/types/settings.d.ts +30 -2
- package/dist/types/settings.js +35 -1
- package/package.json +1 -1
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
import { Anixart } from "../client";
|
|
2
|
+
import { IBaseApiParams, IBaseSearchRequest, IPageableResponse, IProfile, IRelease, IChannel, IChannelSearchRequest, IArticleSearchRequest, IArticle, ICollection, IReleasesInBookmarksSearchRequest, IFeedSearchResponse, IProfileChannel, IChannelSubscribersSearchRequest } from "../types";
|
|
3
|
+
/**
|
|
4
|
+
* Класс поиска
|
|
5
|
+
*/
|
|
6
|
+
export declare class Search {
|
|
7
|
+
private client;
|
|
8
|
+
constructor(client: Anixart);
|
|
9
|
+
/**
|
|
10
|
+
* Поиск пользователей
|
|
11
|
+
*
|
|
12
|
+
* Возвращает результата поиска {@link IProfile} внутри {@link IPageableResponse}.
|
|
13
|
+
*
|
|
14
|
+
* Возможные ответы API в виде enum смотреть здесь {@link DefaultResult}
|
|
15
|
+
*
|
|
16
|
+
* @param data - Данные для поиска
|
|
17
|
+
* @param options - Дополнительные параметры
|
|
18
|
+
* @returns Результаты поиска
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* const result = await client.endpoints.search.profiles({
|
|
22
|
+
* query: "Mradxx", //Запрос
|
|
23
|
+
* page: 0 //Страница
|
|
24
|
+
* });
|
|
25
|
+
*/
|
|
26
|
+
profiles(data: IBaseSearchRequest, options?: IBaseApiParams): Promise<IPageableResponse<IProfile>>;
|
|
27
|
+
/**
|
|
28
|
+
* Поиск релизов
|
|
29
|
+
*
|
|
30
|
+
* Возвращает результата поиска {@link IRelease} внутри {@link IPageableResponse}.
|
|
31
|
+
*
|
|
32
|
+
* Возможные ответы API в виде enum смотреть здесь {@link DefaultResult}
|
|
33
|
+
*
|
|
34
|
+
* @param data - Данные для поиска
|
|
35
|
+
* @param options - Дополнительные параметры
|
|
36
|
+
* @returns Результаты поиска
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* const result = await client.endpoints.search.releases({
|
|
40
|
+
* query: "стоун", //Запрос
|
|
41
|
+
* page: 0 //Страница
|
|
42
|
+
* });
|
|
43
|
+
*/
|
|
44
|
+
releases(data: IBaseSearchRequest, options?: IBaseApiParams): Promise<IPageableResponse<IRelease>>;
|
|
45
|
+
/**
|
|
46
|
+
* Поиск каналов
|
|
47
|
+
*
|
|
48
|
+
* Возвращает результата поиска {@link IChannel} внутри {@link IPageableResponse}.
|
|
49
|
+
*
|
|
50
|
+
* Возможные ответы API в виде enum смотреть здесь {@link DefaultResult}
|
|
51
|
+
*
|
|
52
|
+
* @param data - Данные для поиска
|
|
53
|
+
* @param page - Номер страницы
|
|
54
|
+
* @param options - Дополнительные параметры
|
|
55
|
+
* @returns Результаты поиска
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* const result = await client.endpoints.search.channels({
|
|
59
|
+
* query: "новостная", //Запрос
|
|
60
|
+
* permission: 0, //Привилегии (Необязательно)
|
|
61
|
+
* is_blog: false, //Является ли канал блогом
|
|
62
|
+
* is_subscribed: false //Находится ли канал в подписках
|
|
63
|
+
* }, 0);
|
|
64
|
+
*/
|
|
65
|
+
channels(data: IChannelSearchRequest, page: number, options?: IBaseApiParams): Promise<IPageableResponse<IChannel>>;
|
|
66
|
+
/**
|
|
67
|
+
* Поиск постов
|
|
68
|
+
*
|
|
69
|
+
* Возвращает результата поиска {@link IArticle} внутри {@link IPageableResponse}.
|
|
70
|
+
*
|
|
71
|
+
* Возможные ответы API в виде enum смотреть здесь {@link DefaultResult}
|
|
72
|
+
*
|
|
73
|
+
* @param data - Данные для поиска
|
|
74
|
+
* @param options - Дополнительные параметры
|
|
75
|
+
* @returns Результаты поиска
|
|
76
|
+
*
|
|
77
|
+
* @example
|
|
78
|
+
* const result = await client.endpoints.search.articles({
|
|
79
|
+
* query: "интересный пост", //Запрос
|
|
80
|
+
* channel_id: 1 //ID канала
|
|
81
|
+
* page: 0 //Страница
|
|
82
|
+
* });
|
|
83
|
+
*/
|
|
84
|
+
articles(data: IArticleSearchRequest, options?: IBaseApiParams): Promise<IPageableResponse<IArticle>>;
|
|
85
|
+
/**
|
|
86
|
+
* Поиск коллекций
|
|
87
|
+
*
|
|
88
|
+
* Возвращает результата поиска {@link ICollection} внутри {@link IPageableResponse}.
|
|
89
|
+
*
|
|
90
|
+
* Возможные ответы API в виде enum смотреть здесь {@link DefaultResult}
|
|
91
|
+
*
|
|
92
|
+
* @param data - Данные для поиска
|
|
93
|
+
* @param options - Дополнительные параметры
|
|
94
|
+
* @returns Результаты поиска
|
|
95
|
+
*
|
|
96
|
+
* @example
|
|
97
|
+
* const result = await client.endpoints.search.collections({
|
|
98
|
+
* query: "коллекция", //Запрос
|
|
99
|
+
* page: 0 //Страница
|
|
100
|
+
* });
|
|
101
|
+
*/
|
|
102
|
+
collections(data: IBaseSearchRequest, options?: IBaseApiParams): Promise<IPageableResponse<ICollection>>;
|
|
103
|
+
/**
|
|
104
|
+
* Поиск коллекций из избранных в профиле
|
|
105
|
+
*
|
|
106
|
+
* Возвращает результата поиска {@link ICollection} внутри {@link IPageableResponse}.
|
|
107
|
+
*
|
|
108
|
+
* Возможные ответы API в виде enum смотреть здесь {@link DefaultResult}
|
|
109
|
+
*
|
|
110
|
+
* @param data - Данные для поиска
|
|
111
|
+
* @param options - Дополнительные параметры
|
|
112
|
+
* @returns Результаты поиска
|
|
113
|
+
*
|
|
114
|
+
* @example
|
|
115
|
+
* const result = await client.endpoints.search.favoriteCollections({
|
|
116
|
+
* query: "коллекция", //Запрос
|
|
117
|
+
* page: 0 //Страница
|
|
118
|
+
* });
|
|
119
|
+
*/
|
|
120
|
+
favoriteCollections(data: IBaseSearchRequest, options?: IBaseApiParams): Promise<IPageableResponse<ICollection>>;
|
|
121
|
+
/**
|
|
122
|
+
* Поиск релизов из избранных в профиле
|
|
123
|
+
*
|
|
124
|
+
* Возвращает результата поиска {@link IRelease} внутри {@link IPageableResponse}.
|
|
125
|
+
*
|
|
126
|
+
* Возможные ответы API в виде enum смотреть здесь {@link DefaultResult}
|
|
127
|
+
*
|
|
128
|
+
* @param data - Данные для поиска
|
|
129
|
+
* @param options - Дополнительные параметры
|
|
130
|
+
* @returns Результаты поиска
|
|
131
|
+
*
|
|
132
|
+
* @example
|
|
133
|
+
* const result = await client.endpoints.search.favorties({
|
|
134
|
+
* query: "стоун", //Запрос
|
|
135
|
+
* page: 0 //Страница
|
|
136
|
+
* });
|
|
137
|
+
*/
|
|
138
|
+
favorties(data: IBaseSearchRequest, options?: IBaseApiParams): Promise<IPageableResponse<IRelease>>;
|
|
139
|
+
/**
|
|
140
|
+
* Поиск релизов из истории просмотра в профиле
|
|
141
|
+
*
|
|
142
|
+
* Возвращает результата поиска {@link IRelease} внутри {@link IPageableResponse}.
|
|
143
|
+
*
|
|
144
|
+
* Возможные ответы API в виде enum смотреть здесь {@link DefaultResult}
|
|
145
|
+
*
|
|
146
|
+
* @param data - Данные для поиска
|
|
147
|
+
* @param options - Дополнительные параметры
|
|
148
|
+
* @returns Результаты поиска
|
|
149
|
+
*
|
|
150
|
+
* @example
|
|
151
|
+
* const result = await client.endpoints.search.history({
|
|
152
|
+
* query: "стоун", //Запрос
|
|
153
|
+
* page: 0 //Страница
|
|
154
|
+
* });
|
|
155
|
+
*/
|
|
156
|
+
history(data: IBaseSearchRequest, options?: IBaseApiParams): Promise<IPageableResponse<IRelease>>;
|
|
157
|
+
/**
|
|
158
|
+
* Поиск коллекций в профиле
|
|
159
|
+
*
|
|
160
|
+
* Возвращает результата поиска {@link ICollection} внутри {@link IPageableResponse}.
|
|
161
|
+
*
|
|
162
|
+
* Возможные ответы API в виде enum смотреть здесь {@link DefaultResult}
|
|
163
|
+
*
|
|
164
|
+
* @param data - Данные для поиска
|
|
165
|
+
* @param options - Дополнительные параметры
|
|
166
|
+
* @returns Результаты поиска
|
|
167
|
+
*
|
|
168
|
+
* @example
|
|
169
|
+
* const result = await client.endpoints.search.profileCollections({
|
|
170
|
+
* query: "коллекция", //Запрос
|
|
171
|
+
* page: 0 //Страница
|
|
172
|
+
* });
|
|
173
|
+
*/
|
|
174
|
+
profileCollections(data: IBaseSearchRequest, options?: IBaseApiParams): Promise<IPageableResponse<ICollection>>;
|
|
175
|
+
/**
|
|
176
|
+
* Поиск релизов из закладок в профиле
|
|
177
|
+
*
|
|
178
|
+
* Возвращает результата поиска {@link IRelease} внутри {@link IPageableResponse}.
|
|
179
|
+
*
|
|
180
|
+
* Возможные ответы API в виде enum смотреть здесь {@link DefaultResult}
|
|
181
|
+
*
|
|
182
|
+
* @param data - Данные для поиска
|
|
183
|
+
* @param options - Дополнительные параметры
|
|
184
|
+
* @returns Результаты поиска
|
|
185
|
+
*
|
|
186
|
+
* @example
|
|
187
|
+
* const result = await client.endpoints.search.releasesInBookmarks({
|
|
188
|
+
* query: "стоун", //Запрос
|
|
189
|
+
* page: 0 //Страница
|
|
190
|
+
* });
|
|
191
|
+
*/
|
|
192
|
+
releasesInBookmarks(data: IReleasesInBookmarksSearchRequest, options?: IBaseApiParams): Promise<IPageableResponse<IRelease>>;
|
|
193
|
+
/**
|
|
194
|
+
* Поиск по ленте новостей
|
|
195
|
+
*
|
|
196
|
+
* Возвращает результата поиска {@link IFeedSearchResponse}.
|
|
197
|
+
*
|
|
198
|
+
* Возможные ответы API в виде enum смотреть здесь {@link DefaultResult}
|
|
199
|
+
*
|
|
200
|
+
* @param data - Данные для поиска
|
|
201
|
+
* @param options - Дополнительные параметры
|
|
202
|
+
* @returns Результаты поиска
|
|
203
|
+
*
|
|
204
|
+
* @example
|
|
205
|
+
* const result = await client.endpoints.search.feed({
|
|
206
|
+
* query: "интересное что-то", //Запрос
|
|
207
|
+
* page: 0 //Страница
|
|
208
|
+
* });
|
|
209
|
+
*/
|
|
210
|
+
feed(data: IBaseSearchRequest, options?: IBaseApiParams): Promise<IFeedSearchResponse>;
|
|
211
|
+
/**
|
|
212
|
+
* Поиск подписчиков в канале
|
|
213
|
+
*
|
|
214
|
+
* Возвращает результата поиска {@link IProfileChannel} внутри {@link IPageableResponse}.
|
|
215
|
+
*
|
|
216
|
+
* Возможные ответы API в виде enum смотреть здесь {@link DefaultResult}
|
|
217
|
+
*
|
|
218
|
+
* @param data - Данные для поиска
|
|
219
|
+
* @param options - Дополнительные параметры
|
|
220
|
+
* @returns Результаты поиска
|
|
221
|
+
*
|
|
222
|
+
* @example
|
|
223
|
+
* const result = await client.endpoints.search.channelSubscribers({
|
|
224
|
+
* query: "Mradxx", //Запрос
|
|
225
|
+
* channel_id: 1, //ID канала
|
|
226
|
+
* page: 0 //Страница
|
|
227
|
+
* });
|
|
228
|
+
*/
|
|
229
|
+
channelSubscribers(data: IChannelSubscribersSearchRequest, options?: IBaseApiParams): Promise<IPageableResponse<IProfileChannel>>;
|
|
230
|
+
}
|
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Search = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Класс поиска
|
|
6
|
+
*/
|
|
7
|
+
class Search {
|
|
8
|
+
constructor(client) {
|
|
9
|
+
this.client = client;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Поиск пользователей
|
|
13
|
+
*
|
|
14
|
+
* Возвращает результата поиска {@link IProfile} внутри {@link IPageableResponse}.
|
|
15
|
+
*
|
|
16
|
+
* Возможные ответы API в виде enum смотреть здесь {@link DefaultResult}
|
|
17
|
+
*
|
|
18
|
+
* @param data - Данные для поиска
|
|
19
|
+
* @param options - Дополнительные параметры
|
|
20
|
+
* @returns Результаты поиска
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* const result = await client.endpoints.search.profiles({
|
|
24
|
+
* query: "Mradxx", //Запрос
|
|
25
|
+
* page: 0 //Страница
|
|
26
|
+
* });
|
|
27
|
+
*/
|
|
28
|
+
async profiles(data, options) {
|
|
29
|
+
return this.client.call({ path: `/search/profiles/${data.page}`, json: { query: data.query, searchBy: data.searchBy }, ...options });
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Поиск релизов
|
|
33
|
+
*
|
|
34
|
+
* Возвращает результата поиска {@link IRelease} внутри {@link IPageableResponse}.
|
|
35
|
+
*
|
|
36
|
+
* Возможные ответы API в виде enum смотреть здесь {@link DefaultResult}
|
|
37
|
+
*
|
|
38
|
+
* @param data - Данные для поиска
|
|
39
|
+
* @param options - Дополнительные параметры
|
|
40
|
+
* @returns Результаты поиска
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* const result = await client.endpoints.search.releases({
|
|
44
|
+
* query: "стоун", //Запрос
|
|
45
|
+
* page: 0 //Страница
|
|
46
|
+
* });
|
|
47
|
+
*/
|
|
48
|
+
async releases(data, options) {
|
|
49
|
+
return await this.client.call({ path: `/search/releases/${data.page}`, json: { query: data.query, searchBy: data.searchBy }, apiV2: true, ...options });
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Поиск каналов
|
|
53
|
+
*
|
|
54
|
+
* Возвращает результата поиска {@link IChannel} внутри {@link IPageableResponse}.
|
|
55
|
+
*
|
|
56
|
+
* Возможные ответы API в виде enum смотреть здесь {@link DefaultResult}
|
|
57
|
+
*
|
|
58
|
+
* @param data - Данные для поиска
|
|
59
|
+
* @param page - Номер страницы
|
|
60
|
+
* @param options - Дополнительные параметры
|
|
61
|
+
* @returns Результаты поиска
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* const result = await client.endpoints.search.channels({
|
|
65
|
+
* query: "новостная", //Запрос
|
|
66
|
+
* permission: 0, //Привилегии (Необязательно)
|
|
67
|
+
* is_blog: false, //Является ли канал блогом
|
|
68
|
+
* is_subscribed: false //Находится ли канал в подписках
|
|
69
|
+
* }, 0);
|
|
70
|
+
*/
|
|
71
|
+
async channels(data, page, options) {
|
|
72
|
+
return await this.client.call({ path: `/search/channels/${page}`, json: data, ...options });
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Поиск постов
|
|
76
|
+
*
|
|
77
|
+
* Возвращает результата поиска {@link IArticle} внутри {@link IPageableResponse}.
|
|
78
|
+
*
|
|
79
|
+
* Возможные ответы API в виде enum смотреть здесь {@link DefaultResult}
|
|
80
|
+
*
|
|
81
|
+
* @param data - Данные для поиска
|
|
82
|
+
* @param options - Дополнительные параметры
|
|
83
|
+
* @returns Результаты поиска
|
|
84
|
+
*
|
|
85
|
+
* @example
|
|
86
|
+
* const result = await client.endpoints.search.articles({
|
|
87
|
+
* query: "интересный пост", //Запрос
|
|
88
|
+
* channel_id: 1 //ID канала
|
|
89
|
+
* page: 0 //Страница
|
|
90
|
+
* });
|
|
91
|
+
*/
|
|
92
|
+
async articles(data, options) {
|
|
93
|
+
return await this.client.call({ path: `/search/articles/${data.page}`, json: { query: data.query, channel_id: data.channel_id }, ...options });
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Поиск коллекций
|
|
97
|
+
*
|
|
98
|
+
* Возвращает результата поиска {@link ICollection} внутри {@link IPageableResponse}.
|
|
99
|
+
*
|
|
100
|
+
* Возможные ответы API в виде enum смотреть здесь {@link DefaultResult}
|
|
101
|
+
*
|
|
102
|
+
* @param data - Данные для поиска
|
|
103
|
+
* @param options - Дополнительные параметры
|
|
104
|
+
* @returns Результаты поиска
|
|
105
|
+
*
|
|
106
|
+
* @example
|
|
107
|
+
* const result = await client.endpoints.search.collections({
|
|
108
|
+
* query: "коллекция", //Запрос
|
|
109
|
+
* page: 0 //Страница
|
|
110
|
+
* });
|
|
111
|
+
*/
|
|
112
|
+
async collections(data, options) {
|
|
113
|
+
return await this.client.call({ path: `/search/collections/${data.page}`, json: { query: data.query, searchBy: data.searchBy }, ...options });
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Поиск коллекций из избранных в профиле
|
|
117
|
+
*
|
|
118
|
+
* Возвращает результата поиска {@link ICollection} внутри {@link IPageableResponse}.
|
|
119
|
+
*
|
|
120
|
+
* Возможные ответы API в виде enum смотреть здесь {@link DefaultResult}
|
|
121
|
+
*
|
|
122
|
+
* @param data - Данные для поиска
|
|
123
|
+
* @param options - Дополнительные параметры
|
|
124
|
+
* @returns Результаты поиска
|
|
125
|
+
*
|
|
126
|
+
* @example
|
|
127
|
+
* const result = await client.endpoints.search.favoriteCollections({
|
|
128
|
+
* query: "коллекция", //Запрос
|
|
129
|
+
* page: 0 //Страница
|
|
130
|
+
* });
|
|
131
|
+
*/
|
|
132
|
+
async favoriteCollections(data, options) {
|
|
133
|
+
return await this.client.call({ path: `/search/favoriteCollections/${data.page}`, json: { query: data.query, searchBy: data.searchBy }, ...options });
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Поиск релизов из избранных в профиле
|
|
137
|
+
*
|
|
138
|
+
* Возвращает результата поиска {@link IRelease} внутри {@link IPageableResponse}.
|
|
139
|
+
*
|
|
140
|
+
* Возможные ответы API в виде enum смотреть здесь {@link DefaultResult}
|
|
141
|
+
*
|
|
142
|
+
* @param data - Данные для поиска
|
|
143
|
+
* @param options - Дополнительные параметры
|
|
144
|
+
* @returns Результаты поиска
|
|
145
|
+
*
|
|
146
|
+
* @example
|
|
147
|
+
* const result = await client.endpoints.search.favorties({
|
|
148
|
+
* query: "стоун", //Запрос
|
|
149
|
+
* page: 0 //Страница
|
|
150
|
+
* });
|
|
151
|
+
*/
|
|
152
|
+
async favorties(data, options) {
|
|
153
|
+
return await this.client.call({ path: `/search/favorites/${data.page}`, json: { query: data.query, searchBy: data.searchBy }, ...options });
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Поиск релизов из истории просмотра в профиле
|
|
157
|
+
*
|
|
158
|
+
* Возвращает результата поиска {@link IRelease} внутри {@link IPageableResponse}.
|
|
159
|
+
*
|
|
160
|
+
* Возможные ответы API в виде enum смотреть здесь {@link DefaultResult}
|
|
161
|
+
*
|
|
162
|
+
* @param data - Данные для поиска
|
|
163
|
+
* @param options - Дополнительные параметры
|
|
164
|
+
* @returns Результаты поиска
|
|
165
|
+
*
|
|
166
|
+
* @example
|
|
167
|
+
* const result = await client.endpoints.search.history({
|
|
168
|
+
* query: "стоун", //Запрос
|
|
169
|
+
* page: 0 //Страница
|
|
170
|
+
* });
|
|
171
|
+
*/
|
|
172
|
+
async history(data, options) {
|
|
173
|
+
return await this.client.call({ path: `/search/history/${data.page}`, json: { query: data.query, searchBy: data.searchBy }, ...options });
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Поиск коллекций в профиле
|
|
177
|
+
*
|
|
178
|
+
* Возвращает результата поиска {@link ICollection} внутри {@link IPageableResponse}.
|
|
179
|
+
*
|
|
180
|
+
* Возможные ответы API в виде enum смотреть здесь {@link DefaultResult}
|
|
181
|
+
*
|
|
182
|
+
* @param data - Данные для поиска
|
|
183
|
+
* @param options - Дополнительные параметры
|
|
184
|
+
* @returns Результаты поиска
|
|
185
|
+
*
|
|
186
|
+
* @example
|
|
187
|
+
* const result = await client.endpoints.search.profileCollections({
|
|
188
|
+
* query: "коллекция", //Запрос
|
|
189
|
+
* page: 0 //Страница
|
|
190
|
+
* });
|
|
191
|
+
*/
|
|
192
|
+
async profileCollections(data, options) {
|
|
193
|
+
return await this.client.call({ path: `/search/profileCollections/${data.page}`, json: { query: data.query, searchBy: data.searchBy }, ...options });
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Поиск релизов из закладок в профиле
|
|
197
|
+
*
|
|
198
|
+
* Возвращает результата поиска {@link IRelease} внутри {@link IPageableResponse}.
|
|
199
|
+
*
|
|
200
|
+
* Возможные ответы API в виде enum смотреть здесь {@link DefaultResult}
|
|
201
|
+
*
|
|
202
|
+
* @param data - Данные для поиска
|
|
203
|
+
* @param options - Дополнительные параметры
|
|
204
|
+
* @returns Результаты поиска
|
|
205
|
+
*
|
|
206
|
+
* @example
|
|
207
|
+
* const result = await client.endpoints.search.releasesInBookmarks({
|
|
208
|
+
* query: "стоун", //Запрос
|
|
209
|
+
* page: 0 //Страница
|
|
210
|
+
* });
|
|
211
|
+
*/
|
|
212
|
+
async releasesInBookmarks(data, options) {
|
|
213
|
+
return await this.client.call({ path: `/search/profile/list/${data.type}/${data.page}`, json: { query: data.query, searchBy: data.searchBy }, ...options });
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Поиск по ленте новостей
|
|
217
|
+
*
|
|
218
|
+
* Возвращает результата поиска {@link IFeedSearchResponse}.
|
|
219
|
+
*
|
|
220
|
+
* Возможные ответы API в виде enum смотреть здесь {@link DefaultResult}
|
|
221
|
+
*
|
|
222
|
+
* @param data - Данные для поиска
|
|
223
|
+
* @param options - Дополнительные параметры
|
|
224
|
+
* @returns Результаты поиска
|
|
225
|
+
*
|
|
226
|
+
* @example
|
|
227
|
+
* const result = await client.endpoints.search.feed({
|
|
228
|
+
* query: "интересное что-то", //Запрос
|
|
229
|
+
* page: 0 //Страница
|
|
230
|
+
* });
|
|
231
|
+
*/
|
|
232
|
+
async feed(data, options) {
|
|
233
|
+
return await this.client.call({ path: `/search/feed/${data.page}`, json: { query: data.query, searchBy: data.searchBy }, ...options });
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Поиск подписчиков в канале
|
|
237
|
+
*
|
|
238
|
+
* Возвращает результата поиска {@link IProfileChannel} внутри {@link IPageableResponse}.
|
|
239
|
+
*
|
|
240
|
+
* Возможные ответы API в виде enum смотреть здесь {@link DefaultResult}
|
|
241
|
+
*
|
|
242
|
+
* @param data - Данные для поиска
|
|
243
|
+
* @param options - Дополнительные параметры
|
|
244
|
+
* @returns Результаты поиска
|
|
245
|
+
*
|
|
246
|
+
* @example
|
|
247
|
+
* const result = await client.endpoints.search.channelSubscribers({
|
|
248
|
+
* query: "Mradxx", //Запрос
|
|
249
|
+
* channel_id: 1, //ID канала
|
|
250
|
+
* page: 0 //Страница
|
|
251
|
+
* });
|
|
252
|
+
*/
|
|
253
|
+
async channelSubscribers(data, options) {
|
|
254
|
+
return await this.client.call({ path: `/search/channel/${data.channel_id}/subscribers/${data.page}`, json: { query: data.query, searchBy: data.searchBy }, ...options });
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
exports.Search = Search;
|
package/dist/api/settings.d.ts
CHANGED
|
@@ -1,22 +1,21 @@
|
|
|
1
1
|
import { Anixart } from "../client";
|
|
2
|
-
import { IBadgesResponse, IEmailChangeConfirmResponse, IEmailChangeRequest, ILoginInfoResponse, INewLogin, IProfileSettingsResponse, PrivacyFriendRequestState, PrivacyState,
|
|
2
|
+
import { IBadgesResponse, IEmailChangeConfirmResponse, IEmailChangeRequest, ILoginInfoResponse, INewLogin, IProfileSettingsResponse, PrivacyFriendRequestState, PrivacyState, ISocialResponse, IBaseApiParams, IPageableResponse, IResponse, IPasswordChangeResponse, SocialEditResult, ChangeEmailResult, ChangeLoginResult } from "../types";
|
|
3
3
|
export declare class Settings {
|
|
4
4
|
private readonly client;
|
|
5
5
|
constructor(client: Anixart);
|
|
6
6
|
getCurrentProfileSettings(options?: IBaseApiParams): Promise<IProfileSettingsResponse>;
|
|
7
7
|
getBadges(page: number, options?: IBaseApiParams): Promise<IBadgesResponse>;
|
|
8
|
+
editBadge(id: number, options?: IBaseApiParams): Promise<IResponse>;
|
|
9
|
+
removeBadge(options?: IBaseApiParams): Promise<IResponse>;
|
|
8
10
|
setStatus(status: string, options?: IBaseApiParams): Promise<IResponse>;
|
|
9
|
-
getBlocklist(page: number, options?: IBaseApiParams): Promise<IPageableResponse<IProfileShort>>;
|
|
10
11
|
getSocial(options?: IBaseApiParams): Promise<ISocialResponse>;
|
|
11
|
-
setSocial(data: ISocialResponse, options?: IBaseApiParams): Promise<IResponse
|
|
12
|
+
setSocial(data: ISocialResponse, options?: IBaseApiParams): Promise<IResponse<SocialEditResult>>;
|
|
12
13
|
confirmChangeEmail(currentPassword: string, options?: IBaseApiParams): Promise<IEmailChangeConfirmResponse>;
|
|
13
|
-
changeEmail(data: IEmailChangeRequest, options?: IBaseApiParams): Promise<IResponse
|
|
14
|
+
changeEmail(data: IEmailChangeRequest, options?: IBaseApiParams): Promise<IResponse<ChangeEmailResult>>;
|
|
14
15
|
changePassword(currentPassword: string, newPassword: string, options?: IBaseApiParams): Promise<IPasswordChangeResponse>;
|
|
15
|
-
addBlocklist(id: number, options?: IBaseApiParams): Promise<IResponse>;
|
|
16
|
-
removeBlocklist(id: number, options?: IBaseApiParams): Promise<IResponse>;
|
|
17
16
|
getLoginInfo(options?: IBaseApiParams): Promise<ILoginInfoResponse>;
|
|
18
17
|
getLoginHistory(id: number, page: number, options?: IBaseApiParams): Promise<IPageableResponse<INewLogin>>;
|
|
19
|
-
changeLogin(newLogin: string, options?: IBaseApiParams): Promise<IResponse
|
|
18
|
+
changeLogin(newLogin: string, options?: IBaseApiParams): Promise<IResponse<ChangeLoginResult>>;
|
|
20
19
|
setCommentNotification(options?: IBaseApiParams): Promise<IResponse>;
|
|
21
20
|
setCollectionCommentNotification(options?: IBaseApiParams): Promise<IResponse>;
|
|
22
21
|
setReportProgressNotification(options?: IBaseApiParams): Promise<IResponse>;
|
package/dist/api/settings.js
CHANGED
|
@@ -9,14 +9,17 @@ class Settings {
|
|
|
9
9
|
return await this.client.call({ path: `/profile/preference/my`, ...options });
|
|
10
10
|
}
|
|
11
11
|
async getBadges(page, options) {
|
|
12
|
-
return await this.client.call({ path: `/profile/preference/
|
|
12
|
+
return await this.client.call({ path: `/profile/preference/badge/all/${page}`, ...options });
|
|
13
|
+
}
|
|
14
|
+
async editBadge(id, options) {
|
|
15
|
+
return await this.client.call({ path: `/profile/preference/badge/edit/${id}`, ...options });
|
|
16
|
+
}
|
|
17
|
+
async removeBadge(options) {
|
|
18
|
+
return await this.client.call({ path: `/profile/preference/badge/remove`, ...options });
|
|
13
19
|
}
|
|
14
20
|
async setStatus(status, options) {
|
|
15
21
|
return await this.client.call({ path: `/profile/preference/status/edit`, json: { status }, ...options });
|
|
16
22
|
}
|
|
17
|
-
async getBlocklist(page, options) {
|
|
18
|
-
return await this.client.call({ path: `/profile/preference/blocklist/${page}`, ...options });
|
|
19
|
-
}
|
|
20
23
|
async getSocial(options) {
|
|
21
24
|
return await this.client.call({ path: `/profile/preference/social`, ...options });
|
|
22
25
|
}
|
|
@@ -26,18 +29,12 @@ class Settings {
|
|
|
26
29
|
async confirmChangeEmail(currentPassword, options) {
|
|
27
30
|
return await this.client.call({ path: `/profile/preference/email/change/confirm`, queryParams: { current: currentPassword }, ...options });
|
|
28
31
|
}
|
|
29
|
-
changeEmail(data, options) {
|
|
30
|
-
return this.client.call({ path: `/profile/preference/email/change`, queryParams: { current_password: data.password, current: data.oldEmail, new: data.newEmail }, ...options });
|
|
32
|
+
async changeEmail(data, options) {
|
|
33
|
+
return await this.client.call({ path: `/profile/preference/email/change`, queryParams: { current_password: data.password, current: data.oldEmail, new: data.newEmail }, ...options });
|
|
31
34
|
}
|
|
32
35
|
async changePassword(currentPassword, newPassword, options) {
|
|
33
36
|
return await this.client.call({ path: `/profile/preference/password/change`, queryParams: { current: currentPassword, new: newPassword }, ...options });
|
|
34
37
|
}
|
|
35
|
-
async addBlocklist(id, options) {
|
|
36
|
-
return await this.client.call({ path: `/profile/blocklist/add/${id}`, ...options });
|
|
37
|
-
}
|
|
38
|
-
async removeBlocklist(id, options) {
|
|
39
|
-
return await this.client.call({ path: `/profile/blocklist/remove/${id}`, ...options });
|
|
40
|
-
}
|
|
41
38
|
async getLoginInfo(options) {
|
|
42
39
|
return await this.client.call({ path: `/profile/preference/login/info`, ...options });
|
|
43
40
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Channel } from "./Channel";
|
|
2
2
|
import { Anixart } from "../client";
|
|
3
|
-
import { IArticle,
|
|
3
|
+
import { IArticle, DefaultResult, IBaseCommentAddRequest, VoteType, ArticleDeleteResult } from "../types";
|
|
4
4
|
import { ArticleComment } from "./ArticleComment";
|
|
5
5
|
import { ArticleBuilder } from "../utils/ArticleBuilder";
|
|
6
6
|
import { BaseArticle } from "./BaseArticle";
|
|
@@ -12,7 +12,7 @@ export declare class Article extends BaseArticle {
|
|
|
12
12
|
private writeProperties;
|
|
13
13
|
getComments(page?: number, sort?: number): Promise<ArticleComment[]>;
|
|
14
14
|
addComment(data: IBaseCommentAddRequest): Promise<ArticleComment | null>;
|
|
15
|
-
setVote(type: VoteType): Promise<
|
|
15
|
+
setVote(type: VoteType): Promise<DefaultResult>;
|
|
16
16
|
edit(data: ArticleBuilder): Promise<Article>;
|
|
17
|
-
delete(): Promise<
|
|
17
|
+
delete(): Promise<DefaultResult | ArticleDeleteResult>;
|
|
18
18
|
}
|
package/dist/classes/Article.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Article = void 0;
|
|
4
4
|
const Channel_1 = require("./Channel");
|
|
5
|
+
const types_1 = require("../types");
|
|
5
6
|
const ArticleComment_1 = require("./ArticleComment");
|
|
6
7
|
const BaseArticle_1 = require("./BaseArticle");
|
|
7
8
|
class Article extends BaseArticle_1.BaseArticle {
|
|
@@ -22,11 +23,11 @@ class Article extends BaseArticle_1.BaseArticle {
|
|
|
22
23
|
}
|
|
23
24
|
async addComment(data) {
|
|
24
25
|
const request = await this.client.endpoints.channel.addArticleComment(this.id, data);
|
|
25
|
-
return request.code ==
|
|
26
|
+
return request.code == types_1.DefaultResult.Ok && request.comment ? new ArticleComment_1.ArticleComment(this.client, request === null || request === void 0 ? void 0 : request.comment) : null;
|
|
26
27
|
}
|
|
27
28
|
async setVote(type) {
|
|
28
29
|
const request = await this.client.endpoints.channel.voteArticle(this.id, type);
|
|
29
|
-
if (request.code ==
|
|
30
|
+
if (request.code == types_1.DefaultResult.Ok) {
|
|
30
31
|
this.writeProperties("vote", type == this.vote ? 0 : type);
|
|
31
32
|
}
|
|
32
33
|
return request.code;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Anixart } from "../client";
|
|
2
2
|
import { BaseComment } from "./BaseComment";
|
|
3
|
-
import { IArticleComment,
|
|
3
|
+
import { IArticleComment, DefaultResult, VoteType, CommentDeleteResult } from "../types";
|
|
4
4
|
import { Article } from "./Article";
|
|
5
5
|
import { BaseProfile } from "./BaseProfile";
|
|
6
6
|
export declare class ArticleComment extends BaseComment {
|
|
@@ -10,6 +10,6 @@ export declare class ArticleComment extends BaseComment {
|
|
|
10
10
|
private writeProperties;
|
|
11
11
|
getVotes(page?: number, sort?: number): Promise<BaseProfile[]>;
|
|
12
12
|
getReplies(page?: number, sort?: number): Promise<ArticleComment[]>;
|
|
13
|
-
delete(): Promise<
|
|
14
|
-
setVote(type: VoteType): Promise<
|
|
13
|
+
delete(): Promise<DefaultResult | CommentDeleteResult>;
|
|
14
|
+
setVote(type: VoteType): Promise<DefaultResult>;
|
|
15
15
|
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ArticleComment = void 0;
|
|
4
4
|
const BaseComment_1 = require("./BaseComment");
|
|
5
|
+
const types_1 = require("../types");
|
|
5
6
|
const Article_1 = require("./Article");
|
|
6
7
|
const BaseProfile_1 = require("./BaseProfile");
|
|
7
8
|
class ArticleComment extends BaseComment_1.BaseComment {
|
|
@@ -27,7 +28,7 @@ class ArticleComment extends BaseComment_1.BaseComment {
|
|
|
27
28
|
}
|
|
28
29
|
async setVote(type) {
|
|
29
30
|
const request = await this.client.endpoints.channel.voteCommentArticle(this.id, type);
|
|
30
|
-
if (request.code ==
|
|
31
|
+
if (request.code == types_1.DefaultResult.Ok) {
|
|
31
32
|
this.writeProperties("vote", type == this.vote ? 0 : type);
|
|
32
33
|
}
|
|
33
34
|
return request.code;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Anixart } from "../client";
|
|
2
|
-
import { IFriendRequestResponse, IPageableResponse, IProfileShort, IVoteRelease } from "../types";
|
|
2
|
+
import { IFriendRequestResponse, IPageableResponse, IProfileShort, IRelease, IVoteRelease, RemoveFriendRequestResult } from "../types";
|
|
3
3
|
import { Collection } from "./Collection";
|
|
4
4
|
export declare class BaseProfile {
|
|
5
5
|
protected readonly client: Anixart;
|
|
@@ -22,7 +22,8 @@ export declare class BaseProfile {
|
|
|
22
22
|
constructor(client: Anixart, profile: IProfileShort);
|
|
23
23
|
getFriends(page?: number): Promise<BaseProfile[]>;
|
|
24
24
|
sendFriendRequest(): Promise<IFriendRequestResponse>;
|
|
25
|
-
removeFriendRequest(): Promise<IFriendRequestResponse
|
|
26
|
-
|
|
25
|
+
removeFriendRequest(): Promise<IFriendRequestResponse<RemoveFriendRequestResult>>;
|
|
26
|
+
getVotedReleases(page?: number, sort?: number): Promise<IPageableResponse<IVoteRelease>>;
|
|
27
|
+
getUnvotedReleases(page?: number): Promise<IPageableResponse<IRelease>>;
|
|
27
28
|
getCollections(page?: number): Promise<Collection[]>;
|
|
28
29
|
}
|