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.
Files changed (61) hide show
  1. package/dist/api/auth.d.ts +95 -4
  2. package/dist/api/auth.js +91 -0
  3. package/dist/api/channel.d.ts +16 -12
  4. package/dist/api/channel.js +16 -4
  5. package/dist/api/collection.d.ts +8 -14
  6. package/dist/api/collection.js +3 -7
  7. package/dist/api/discover.d.ts +67 -0
  8. package/dist/api/discover.js +67 -0
  9. package/dist/api/feed.d.ts +28 -1
  10. package/dist/api/feed.js +28 -3
  11. package/dist/api/index.d.ts +1 -0
  12. package/dist/api/index.js +1 -0
  13. package/dist/api/notification.d.ts +3 -1
  14. package/dist/api/notification.js +6 -0
  15. package/dist/api/profile.d.ts +372 -11
  16. package/dist/api/profile.js +381 -6
  17. package/dist/api/release.d.ts +4 -4
  18. package/dist/api/release.js +3 -3
  19. package/dist/api/search.d.ts +230 -0
  20. package/dist/api/search.js +257 -0
  21. package/dist/api/settings.d.ts +6 -7
  22. package/dist/api/settings.js +9 -12
  23. package/dist/classes/Article.d.ts +3 -3
  24. package/dist/classes/Article.js +3 -2
  25. package/dist/classes/ArticleComment.d.ts +3 -3
  26. package/dist/classes/ArticleComment.js +2 -1
  27. package/dist/classes/BaseProfile.d.ts +4 -3
  28. package/dist/classes/BaseProfile.js +6 -2
  29. package/dist/classes/Channel.d.ts +4 -4
  30. package/dist/classes/Channel.js +7 -6
  31. package/dist/classes/Collection.d.ts +5 -5
  32. package/dist/classes/Collection.js +2 -1
  33. package/dist/classes/Episode.d.ts +3 -3
  34. package/dist/classes/Release.d.ts +7 -7
  35. package/dist/classes/Release.js +9 -8
  36. package/dist/classes/ReleaseComment.d.ts +4 -4
  37. package/dist/classes/ReleaseComment.js +3 -2
  38. package/dist/classes/SuggestionArticle.d.ts +2 -2
  39. package/dist/classes/SuggestionArticle.js +2 -1
  40. package/dist/client.d.ts +11 -3
  41. package/dist/client.js +10 -1
  42. package/dist/endpoints.d.ts +10 -1
  43. package/dist/endpoints.js +9 -0
  44. package/dist/index.d.ts +1 -0
  45. package/dist/index.js +1 -0
  46. package/dist/types/auth.d.ts +41 -2
  47. package/dist/types/auth.js +45 -0
  48. package/dist/types/channel.d.ts +107 -10
  49. package/dist/types/channel.js +95 -0
  50. package/dist/types/collection.d.ts +38 -4
  51. package/dist/types/collection.js +42 -0
  52. package/dist/types/notification.d.ts +4 -0
  53. package/dist/types/profile.d.ts +41 -3
  54. package/dist/types/profile.js +26 -1
  55. package/dist/types/release.d.ts +35 -5
  56. package/dist/types/release.js +10 -1
  57. package/dist/types/response.d.ts +26 -6
  58. package/dist/types/response.js +33 -10
  59. package/dist/types/settings.d.ts +30 -2
  60. package/dist/types/settings.js +35 -1
  61. package/package.json +1 -1
@@ -1,11 +1,102 @@
1
1
  import { Anixart } from "../client";
2
- import { ILoginResponse, ILoginRequest, IRegisterRequest, IRegisterResponse, IRegisterVerifyRequest, IBaseApiParams, IRestorePasswordRequest } from "../types";
2
+ import { ILoginResponse, ILoginRequest, IRegisterRequest, IRegisterResponse, IRegisterVerifyRequest, IBaseApiParams, IRestorePasswordRequest, RegisterVerifyResult, RestorePasswordResult, RestorePasswordVerifyResult } from "../types";
3
+ /**
4
+ * Класс с эндпоинтами авторизации
5
+ */
3
6
  export declare class Auth {
4
7
  private readonly client;
5
8
  constructor(client: Anixart);
9
+ /**
10
+ * Авторизация в профиль
11
+ *
12
+ * Возвращает ответ {@link ILoginResponse}.
13
+ *
14
+ * Возможные ответы API в виде enum смотреть здесь {@link DefaultResult}, {@link LoginResult}
15
+ *
16
+ * @param data - Данные для авторизации
17
+ * @param options - Дополнительные параметры
18
+ * @returns Информацию о профиле и токен
19
+ *
20
+ * @example
21
+ * const result = await client.endpoints.auth.signIn({
22
+ * login: 'username', //Логин
23
+ * password: 'password' //Пароль
24
+ * });
25
+ */
6
26
  signIn(data: ILoginRequest, options?: IBaseApiParams): Promise<ILoginResponse>;
27
+ /**
28
+ * Регистрация в Anixart
29
+ *
30
+ * Возвращает ответ {@link IRegisterResponse}.
31
+ *
32
+ * Возможные ответы API в виде enum смотреть здесь {@link DefaultResult}, {@link RegisterResult}
33
+ *
34
+ * @param data - Данные для регистрации
35
+ * @param options - Дополнительные параметры
36
+ * @returns Хеш для подтверждения
37
+ *
38
+ * @example
39
+ * const result = await client.endpoints.auth.signUp({
40
+ * username: 'username', //Логин
41
+ * password: 'password', //Пароль
42
+ * email: 'email', //Почта
43
+ * });
44
+ */
7
45
  signUp(data: IRegisterRequest, options?: IBaseApiParams): Promise<IRegisterResponse>;
8
- signUpVerify(data: IRegisterVerifyRequest, options?: IBaseApiParams): Promise<ILoginResponse>;
9
- restore(login: string, options?: IBaseApiParams): Promise<IRegisterResponse>;
10
- restoreVerify(data: IRestorePasswordRequest, options?: IBaseApiParams): Promise<ILoginResponse>;
46
+ /**
47
+ * Подтверждение регистрации
48
+ *
49
+ * Возвращает ответ {@link ILoginResponse}.
50
+ *
51
+ * Возможные ответы API в виде enum смотреть здесь {@link DefaultResult}, {@link RegisterVerifyResult}
52
+ *
53
+ * @param data - Данные для подтверждения
54
+ * @param options - Дополнительные параметры
55
+ * @returns Информацию о профиле и токен
56
+ *
57
+ * @example
58
+ * const result = await client.endpoints.auth.signUpVerify({
59
+ * username: 'username', //Логин
60
+ * password: 'password', //Пароль
61
+ * email: 'email', //Почта
62
+ * hash: 'hash', //Хеш
63
+ * code: 0000, //Код
64
+ * });
65
+ */
66
+ signUpVerify(data: IRegisterVerifyRequest, options?: IBaseApiParams): Promise<ILoginResponse<RegisterVerifyResult>>;
67
+ /**
68
+ * Восстановление аккаунта по почте
69
+ *
70
+ * Возвращает ответ {@link IRegisterResponse}.
71
+ *
72
+ * Возможные ответы API в виде enum смотреть здесь {@link DefaultResult}, {@link RestorePasswordResult}
73
+ *
74
+ * @param login - Логин пользователя
75
+ * @param options - Дополнительные параметры
76
+ * @returns Хеш для подтверждения
77
+ *
78
+ * @example
79
+ * const result = await client.endpoints.auth.restore("login");
80
+ */
81
+ restore(login: string, options?: IBaseApiParams): Promise<IRegisterResponse<RestorePasswordResult>>;
82
+ /**
83
+ * Подтверждение восстановления
84
+ *
85
+ * Возвращает ответ {@link ILoginResponse}.
86
+ *
87
+ * Возможные ответы API в виде enum смотреть здесь {@link DefaultResult}, {@link RestorePasswordVerifyResult}
88
+ *
89
+ * @param data - Данные для подтверждения
90
+ * @param options - Дополнительные параметры
91
+ * @returns Информацию о профиле и токен
92
+ *
93
+ * @example
94
+ * const result = await client.endpoints.auth.restoreVerify({
95
+ * username: 'username', //Логин
96
+ * password: 'password', //Пароль
97
+ * hash: 'hash', //Хеш
98
+ * code: 0000, //Код
99
+ * });
100
+ */
101
+ restoreVerify(data: IRestorePasswordRequest, options?: IBaseApiParams): Promise<ILoginResponse<RestorePasswordVerifyResult>>;
11
102
  }
package/dist/api/auth.js CHANGED
@@ -1,10 +1,30 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Auth = void 0;
4
+ /**
5
+ * Класс с эндпоинтами авторизации
6
+ */
4
7
  class Auth {
5
8
  constructor(client) {
6
9
  this.client = client;
7
10
  }
11
+ /**
12
+ * Авторизация в профиль
13
+ *
14
+ * Возвращает ответ {@link ILoginResponse}.
15
+ *
16
+ * Возможные ответы API в виде enum смотреть здесь {@link DefaultResult}, {@link LoginResult}
17
+ *
18
+ * @param data - Данные для авторизации
19
+ * @param options - Дополнительные параметры
20
+ * @returns Информацию о профиле и токен
21
+ *
22
+ * @example
23
+ * const result = await client.endpoints.auth.signIn({
24
+ * login: 'username', //Логин
25
+ * password: 'password' //Пароль
26
+ * });
27
+ */
8
28
  async signIn(data, options) {
9
29
  return this.client.call({
10
30
  path: '/auth/signIn',
@@ -12,6 +32,24 @@ class Auth {
12
32
  ...options
13
33
  });
14
34
  }
35
+ /**
36
+ * Регистрация в Anixart
37
+ *
38
+ * Возвращает ответ {@link IRegisterResponse}.
39
+ *
40
+ * Возможные ответы API в виде enum смотреть здесь {@link DefaultResult}, {@link RegisterResult}
41
+ *
42
+ * @param data - Данные для регистрации
43
+ * @param options - Дополнительные параметры
44
+ * @returns Хеш для подтверждения
45
+ *
46
+ * @example
47
+ * const result = await client.endpoints.auth.signUp({
48
+ * username: 'username', //Логин
49
+ * password: 'password', //Пароль
50
+ * email: 'email', //Почта
51
+ * });
52
+ */
15
53
  async signUp(data, options) {
16
54
  return this.client.call({
17
55
  path: '/auth/signUp',
@@ -19,6 +57,26 @@ class Auth {
19
57
  ...options
20
58
  });
21
59
  }
60
+ /**
61
+ * Подтверждение регистрации
62
+ *
63
+ * Возвращает ответ {@link ILoginResponse}.
64
+ *
65
+ * Возможные ответы API в виде enum смотреть здесь {@link DefaultResult}, {@link RegisterVerifyResult}
66
+ *
67
+ * @param data - Данные для подтверждения
68
+ * @param options - Дополнительные параметры
69
+ * @returns Информацию о профиле и токен
70
+ *
71
+ * @example
72
+ * const result = await client.endpoints.auth.signUpVerify({
73
+ * username: 'username', //Логин
74
+ * password: 'password', //Пароль
75
+ * email: 'email', //Почта
76
+ * hash: 'hash', //Хеш
77
+ * code: 0000, //Код
78
+ * });
79
+ */
22
80
  async signUpVerify(data, options) {
23
81
  return this.client.call({
24
82
  path: '/auth/verify',
@@ -26,6 +84,20 @@ class Auth {
26
84
  ...options
27
85
  });
28
86
  }
87
+ /**
88
+ * Восстановление аккаунта по почте
89
+ *
90
+ * Возвращает ответ {@link IRegisterResponse}.
91
+ *
92
+ * Возможные ответы API в виде enum смотреть здесь {@link DefaultResult}, {@link RestorePasswordResult}
93
+ *
94
+ * @param login - Логин пользователя
95
+ * @param options - Дополнительные параметры
96
+ * @returns Хеш для подтверждения
97
+ *
98
+ * @example
99
+ * const result = await client.endpoints.auth.restore("login");
100
+ */
29
101
  async restore(login, options) {
30
102
  return this.client.call({
31
103
  path: '/auth/restore',
@@ -33,6 +105,25 @@ class Auth {
33
105
  ...options
34
106
  });
35
107
  }
108
+ /**
109
+ * Подтверждение восстановления
110
+ *
111
+ * Возвращает ответ {@link ILoginResponse}.
112
+ *
113
+ * Возможные ответы API в виде enum смотреть здесь {@link DefaultResult}, {@link RestorePasswordVerifyResult}
114
+ *
115
+ * @param data - Данные для подтверждения
116
+ * @param options - Дополнительные параметры
117
+ * @returns Информацию о профиле и токен
118
+ *
119
+ * @example
120
+ * const result = await client.endpoints.auth.restoreVerify({
121
+ * username: 'username', //Логин
122
+ * password: 'password', //Пароль
123
+ * hash: 'hash', //Хеш
124
+ * code: 0000, //Код
125
+ * });
126
+ */
36
127
  async restoreVerify(data, options) {
37
128
  return this.client.call({
38
129
  path: '/auth/restore/verify',
@@ -1,5 +1,5 @@
1
1
  import { Anixart } from "../client";
2
- import { IPageableResponse, IResponse, IBaseApiParams, IChannelResponse, IChannel, IArticle, IChannelSearchRequest, IArticleCreateRequest, IArticleCreateResponse, IChannelCreateRequest, IProfileShort, IArticleCommentResponce, IArticleComment, IBaseCommentAddRequest, IChannelMediaTokenResponse, VoteType, IArticleUploadFileResponse, IUrlResponse, IEmbedData, IArticleResponse, IArticleSuggestionPublishResponse, IArticleSuggestionCreateRequest, IChannelBlockManageRequest, IChannelBlockInfoResponse } from "../types";
2
+ import { IPageableResponse, IResponse, IBaseApiParams, IChannelResponse, IChannel, IArticle, IArticleCreateRequest, IArticleCreateResponse, IChannelCreateRequest, IProfileShort, IArticleCommentResponce, IArticleComment, IBaseCommentAddRequest, IChannelMediaTokenResponse, VoteType, IArticleUploadFileResponse, IUrlResponse, IEmbedData, IArticleResponse, IArticleSuggestionPublishResponse, IArticleSuggestionCreateRequest, IChannelBlockManageRequest, IChannelBlockInfoResponse, ArticleCreateEditResult, ChannelSubscribeResult, ChannelUnsubscribeResult, ChannelCreateEditResult, ArticleDeleteResult, CommentDeleteResult, ChannelBlockResult, ArticleSuggestionDeleteResult, IProfileChannel, BlogCreateResult, ChannelPermissionManageResult, IChannelPermissionManageRequest } from "../types";
3
3
  /**
4
4
  * Это из беты аниксарта 9.0
5
5
  *
@@ -11,19 +11,19 @@ export declare class Channel {
11
11
  info(id: number, options?: IBaseApiParams): Promise<IChannelResponse>;
12
12
  all(page: number, options?: IBaseApiParams): Promise<IPageableResponse<IChannel>>;
13
13
  getBlog(id: number, options?: IBaseApiParams): Promise<IChannelResponse>;
14
- subscribe(id: number, options?: IBaseApiParams): Promise<IResponse>;
15
- unsubscribe(id: number, options?: IBaseApiParams): Promise<IResponse>;
14
+ subscribe(id: number, options?: IBaseApiParams): Promise<IResponse<ChannelSubscribeResult>>;
15
+ unsubscribe(id: number, options?: IBaseApiParams): Promise<IResponse<ChannelUnsubscribeResult>>;
16
16
  getArticles(id: number, page: number, date?: number, options?: IBaseApiParams): Promise<IPageableResponse<IArticle>>;
17
17
  getArticle(id: number, options?: IBaseApiParams): Promise<IArticleResponse>;
18
18
  createArticle(channelId: number, article: IArticleCreateRequest, options?: IBaseApiParams): Promise<IArticleCreateResponse>;
19
19
  editArticle(id: number, article: IArticleCreateRequest, options?: IBaseApiParams): Promise<IArticleCreateResponse>;
20
- search(data: IChannelSearchRequest, page: number, options?: IBaseApiParams): Promise<IPageableResponse<IChannel>>;
21
- create(data: IChannelCreateRequest, options?: IBaseApiParams): Promise<IChannelResponse>;
22
- removeArticleComment(id: number, options?: IBaseApiParams): Promise<IResponse>;
23
- removeArticle(id: number, options?: IBaseApiParams): Promise<IResponse>;
20
+ create(data: IChannelCreateRequest, options?: IBaseApiParams): Promise<IChannelResponse<ChannelCreateEditResult>>;
21
+ createBlog(options?: IBaseApiParams): Promise<IChannelResponse<BlogCreateResult>>;
22
+ removeArticleComment(id: number, options?: IBaseApiParams): Promise<IResponse<CommentDeleteResult>>;
23
+ removeArticle(id: number, options?: IBaseApiParams): Promise<IResponse<ArticleDeleteResult>>;
24
24
  addArticleComment(id: number, data: IBaseCommentAddRequest, options?: IBaseApiParams): Promise<IArticleCommentResponce>;
25
25
  getVotes(id: number, page: number, sort: number, options?: IBaseApiParams): Promise<IPageableResponse<IProfileShort>>;
26
- getComments(id: number, page: number, sort: number, options?: IBaseApiParams): Promise<IPageableResponse<IArticleComment>>;
26
+ getComments(id: number, page: number | "popular", sort: number, options?: IBaseApiParams): Promise<IPageableResponse<IArticleComment>>;
27
27
  getCommentReplies(id: number, page: number, sort: number, options?: IBaseApiParams): Promise<IPageableResponse<IArticleComment>>;
28
28
  getAvaliableEditor(id: number, isSuggestionMode?: boolean, isEditMode?: boolean, options?: IBaseApiParams): Promise<IChannelMediaTokenResponse>;
29
29
  voteArticle(id: number, vote: VoteType, options?: IBaseApiParams): Promise<IResponse>;
@@ -34,9 +34,13 @@ export declare class Channel {
34
34
  uploadChannelCover(id: number, file: Buffer, options?: IBaseApiParams): Promise<IUrlResponse>;
35
35
  editChannel(id: number, data: IChannelCreateRequest, options?: IBaseApiParams): Promise<IChannelResponse>;
36
36
  getArticleSuggestions(id: number, page: number, options?: IBaseApiParams): Promise<IPageableResponse<IArticle>>;
37
- removeArticleSuggestion(id: number, options?: IBaseApiParams): Promise<IResponse>;
37
+ removeArticleSuggestion(id: number, options?: IBaseApiParams): Promise<IResponse<ArticleSuggestionDeleteResult>>;
38
38
  publishArticleSuggestion(id: number, options?: IBaseApiParams): Promise<IArticleSuggestionPublishResponse>;
39
- createArticleSuggestion(id: number, data: IArticleSuggestionCreateRequest, options?: IBaseApiParams): Promise<IArticleResponse>;
40
- manageChannelBlocklist(id: number, data: IChannelBlockManageRequest, options?: IBaseApiParams): Promise<IResponse>;
41
- getChannelBlock(id: number, profileId: number, options?: IBaseApiParams): Promise<IChannelBlockInfoResponse>;
39
+ createArticleSuggestion(id: number, data: IArticleSuggestionCreateRequest, options?: IBaseApiParams): Promise<IArticleResponse<ArticleCreateEditResult>>;
40
+ manageChannelBlocklist(id: number, data: IChannelBlockManageRequest, options?: IBaseApiParams): Promise<IResponse<ChannelBlockResult>>;
41
+ getChannelBlockProfile(id: number, profileId: number, options?: IBaseApiParams): Promise<IChannelBlockInfoResponse>;
42
+ getChannelBlocks(id: number, page: number, options?: IBaseApiParams): Promise<IPageableResponse<IProfileChannel>>;
43
+ getChannelRecommendations(page: number, options?: IBaseApiParams): Promise<IPageableResponse<IChannel>>;
44
+ managePermissionChannel(id: number, data: IChannelPermissionManageRequest, options?: IBaseApiParams): Promise<IResponse<ChannelPermissionManageResult>>;
45
+ getChannelPermissions(id: number, page: number, options?: IBaseApiParams): Promise<IPageableResponse<IProfileChannel>>;
42
46
  }
@@ -38,12 +38,12 @@ class Channel {
38
38
  async editArticle(id, article, options) {
39
39
  return await this.client.call({ path: `/article/edit/${id}`, method: "POST", json: article, ...options });
40
40
  }
41
- async search(data, page, options) {
42
- return await this.client.call({ path: `/search/channels/${page}`, json: data, ...options });
43
- }
44
41
  async create(data, options) {
45
42
  return await this.client.call({ path: `/channel/create`, method: "POST", json: data, ...options });
46
43
  }
44
+ async createBlog(options) {
45
+ return await this.client.call({ path: `/channel/blog/create`, method: "POST", ...options });
46
+ }
47
47
  async removeArticleComment(id, options) {
48
48
  return await this.client.call({ path: `/article/comment/delete/${id}`, ...options });
49
49
  }
@@ -104,8 +104,20 @@ class Channel {
104
104
  async manageChannelBlocklist(id, data, options) {
105
105
  return await this.client.call({ path: `/channel/${id}/block/manage`, json: data, ...options });
106
106
  }
107
- async getChannelBlock(id, profileId, options) {
107
+ async getChannelBlockProfile(id, profileId, options) {
108
108
  return await this.client.call({ path: `/channel/${id}/block/${profileId}`, ...options });
109
109
  }
110
+ async getChannelBlocks(id, page, options) {
111
+ return await this.client.call({ path: `/channel/${id}/block/all/${page}`, ...options });
112
+ }
113
+ async getChannelRecommendations(page, options) {
114
+ return await this.client.call({ path: `/channel/recommendation/${page}`, ...options });
115
+ }
116
+ async managePermissionChannel(id, data, options) {
117
+ return await this.client.call({ path: `/channel/${id}/permission/manage`, json: data, ...options });
118
+ }
119
+ async getChannelPermissions(id, page, options) {
120
+ return await this.client.call({ path: `/channel/${id}/permission/all/${page}`, ...options });
121
+ }
110
122
  }
111
123
  exports.Channel = Channel;
@@ -1,5 +1,5 @@
1
1
  import { Anixart } from "../client";
2
- import { IPageableResponse, IResponse, IBaseApiParams, ICollectionResponse, IRelease, ICollection, IReleaseInCollectionRequest, ICollectionCreateRequest, ICollectionComment } from "../types";
2
+ import { IPageableResponse, IResponse, IBaseApiParams, ICollectionResponse, IRelease, ICollection, IReleaseInCollectionRequest, ICollectionCreateRequest, ICollectionComment, FavoriteCollectionAddResult, FavoriteCollectionDeleteResult, CollectionCreateEditResult, ReleaseAddCollectionResult, CollectionDeleteResult, IReleaseResponse } from "../types";
3
3
  /**
4
4
  * Класс коллекции
5
5
  *
@@ -12,22 +12,16 @@ export declare class Collection {
12
12
  info(id: number, options?: IBaseApiParams): Promise<ICollectionResponse>;
13
13
  getCollectionReleases(id: number, page: number, options?: IBaseApiParams): Promise<IPageableResponse<IRelease>>;
14
14
  getCollectionFavorites(page: number, options?: IBaseApiParams): Promise<IPageableResponse<ICollection>>;
15
- addCollectionFavorite(id: number, options?: IBaseApiParams): Promise<IResponse>;
16
- removeCollectionFavorite(id: number, options?: IBaseApiParams): Promise<IResponse>;
15
+ addCollectionFavorite(id: number, options?: IBaseApiParams): Promise<IResponse<FavoriteCollectionAddResult>>;
16
+ removeCollectionFavorite(id: number, options?: IBaseApiParams): Promise<IResponse<FavoriteCollectionDeleteResult>>;
17
17
  getReleaseInCollection(data: IReleaseInCollectionRequest, options?: IBaseApiParams): Promise<IPageableResponse<ICollection>>;
18
18
  getUserCollections(id: number, page: number, options?: IBaseApiParams): Promise<IPageableResponse<ICollection>>;
19
- createCollection(data: ICollectionCreateRequest, options?: IBaseApiParams): Promise<ICollectionResponse>;
20
- editCollection(id: number, data: ICollectionCreateRequest, options?: IBaseApiParams): Promise<ICollectionResponse>;
21
- /**
22
- * {
23
- "code": 0,
24
- "collection": null
25
- }
26
- *
27
- */
28
- addReleaseToCollection(collectionId: number, releaseId: number, options?: IBaseApiParams): Promise<IResponse>;
29
- deleteCollection(id: number, options?: IBaseApiParams): Promise<IResponse>;
19
+ createCollection(data: ICollectionCreateRequest, options?: IBaseApiParams): Promise<ICollectionResponse<CollectionCreateEditResult>>;
20
+ editCollection(id: number, data: ICollectionCreateRequest, options?: IBaseApiParams): Promise<ICollectionResponse<CollectionCreateEditResult>>;
21
+ addReleaseToCollection(collectionId: number, releaseId: number, options?: IBaseApiParams): Promise<IResponse<ReleaseAddCollectionResult>>;
22
+ deleteCollection(id: number, options?: IBaseApiParams): Promise<IResponse<CollectionDeleteResult>>;
30
23
  getComments(id: number, page: number, sort: number, options?: IBaseApiParams): Promise<IPageableResponse<ICollectionComment>>;
31
24
  getComment(id: number, options?: IBaseApiParams): Promise<IResponse & ICollectionComment>;
32
25
  getCommentReplies(id: number, page: number, sort: number, options?: IBaseApiParams): Promise<IPageableResponse<ICollectionComment>>;
26
+ getRandomRelease(id: number, extended?: boolean, options?: IBaseApiParams): Promise<IReleaseResponse>;
33
27
  }
@@ -40,13 +40,6 @@ class Collection {
40
40
  async editCollection(id, data, options) {
41
41
  return await this.client.call({ path: `/collectionMy/edit/${id}`, json: data, ...options });
42
42
  }
43
- /**
44
- * {
45
- "code": 0,
46
- "collection": null
47
- }
48
- *
49
- */
50
43
  async addReleaseToCollection(collectionId, releaseId, options) {
51
44
  return await this.client.call({ path: `/collectionMy/release/add/${collectionId}`, queryParams: { release_id: releaseId }, ...options });
52
45
  }
@@ -62,5 +55,8 @@ class Collection {
62
55
  async getCommentReplies(id, page, sort, options) {
63
56
  return await this.client.call({ path: `/collection/comment/replies/${id}/${page}`, queryParams: { sort }, method: "POST", ...options });
64
57
  }
58
+ async getRandomRelease(id, extended = true, options) {
59
+ return await this.client.call({ path: `/release/collection/${id}/random`, queryParams: { extended_mode: extended }, ...options });
60
+ }
65
61
  }
66
62
  exports.Collection = Collection;
@@ -3,9 +3,76 @@ import { IPageableResponse, IBaseApiParams, IRelease, ICommentRelease, IInterest
3
3
  export declare class Discover {
4
4
  private readonly client;
5
5
  constructor(client: Anixart);
6
+ /**
7
+ * Получение списка релизов которые сейчас смотрят
8
+ *
9
+ * Возвращает список {@link IRelease} внутри {@link IPageableResponse}.
10
+ *
11
+ * Возможные ответы API в виде enum смотреть здесь {@link DefaultResult}
12
+ *
13
+ * @param page - Номер страницы
14
+ * @param options - Дополнительные параметры
15
+ * @returns Список релизов
16
+ *
17
+ * @example
18
+ * const result = await client.endpoints.discover.getWatching(0);
19
+ */
6
20
  getWatching(page: number, options?: IBaseApiParams): Promise<IPageableResponse<IRelease>>;
21
+ /**
22
+ * Получение популяных комментариев (10 штук)
23
+ *
24
+ * Возвращает список {@link ICommentRelease} внутри {@link IPageableResponse}.
25
+ *
26
+ * Возможные ответы API в виде enum смотреть здесь {@link DefaultResult}
27
+ *
28
+ * @param options - Дополнительные параметры
29
+ * @returns Список релизов
30
+ *
31
+ * @example
32
+ * const result = await client.endpoints.discover.getComments();
33
+ */
7
34
  getComments(options?: IBaseApiParams): Promise<IPageableResponse<ICommentRelease>>;
35
+ /**
36
+ * Получение самых обсуждаемых релизов (5 штук)
37
+ *
38
+ * Возвращает список {@link IRelease} внутри {@link IPageableResponse}.
39
+ *
40
+ * Возможные ответы API в виде enum смотреть здесь {@link DefaultResult}
41
+ *
42
+ * @param options - Дополнительные параметры
43
+ * @returns Список релизов
44
+ *
45
+ * @example
46
+ * const result = await client.endpoints.discover.getDiscussing();
47
+ */
8
48
  getDiscussing(options?: IBaseApiParams): Promise<IPageableResponse<IRelease>>;
49
+ /**
50
+ * Получение списка рекомендаций
51
+ *
52
+ * Возвращает список {@link IRelease} внутри {@link IPageableResponse}.
53
+ *
54
+ * Возможные ответы API в виде enum смотреть здесь {@link DefaultResult}
55
+ *
56
+ * @param page - Номер страницы
57
+ * @param options - Дополнительные параметры
58
+ * @returns Список релизов
59
+ *
60
+ * @example
61
+ * const result = await client.endpoints.discover.getRecommendations(0);
62
+ */
9
63
  getRecommendations(page: number, options?: IBaseApiParams): Promise<IPageableResponse<IRelease>>;
64
+ /**
65
+ * Получение списка интересных релизов
66
+ *
67
+ * Возвращает список {@link IInterestingRelease} внутри {@link IPageableResponse}.
68
+ *
69
+ * Возможные ответы API в виде enum смотреть здесь {@link DefaultResult}
70
+ *
71
+ * @param options - Дополнительные параметры
72
+ * @returns Список релизов
73
+ *
74
+ * @example
75
+ * const result = await client.endpoints.discover.getInteresting(0);
76
+ */
10
77
  getInteresting(options?: IBaseApiParams): Promise<IPageableResponse<IInterestingRelease>>;
11
78
  }
@@ -5,18 +5,85 @@ class Discover {
5
5
  constructor(client) {
6
6
  this.client = client;
7
7
  }
8
+ /**
9
+ * Получение списка релизов которые сейчас смотрят
10
+ *
11
+ * Возвращает список {@link IRelease} внутри {@link IPageableResponse}.
12
+ *
13
+ * Возможные ответы API в виде enum смотреть здесь {@link DefaultResult}
14
+ *
15
+ * @param page - Номер страницы
16
+ * @param options - Дополнительные параметры
17
+ * @returns Список релизов
18
+ *
19
+ * @example
20
+ * const result = await client.endpoints.discover.getWatching(0);
21
+ */
8
22
  async getWatching(page, options) {
9
23
  return await this.client.call({ path: `/discover/watching/${page}`, ...options });
10
24
  }
25
+ /**
26
+ * Получение популяных комментариев (10 штук)
27
+ *
28
+ * Возвращает список {@link ICommentRelease} внутри {@link IPageableResponse}.
29
+ *
30
+ * Возможные ответы API в виде enum смотреть здесь {@link DefaultResult}
31
+ *
32
+ * @param options - Дополнительные параметры
33
+ * @returns Список релизов
34
+ *
35
+ * @example
36
+ * const result = await client.endpoints.discover.getComments();
37
+ */
11
38
  async getComments(options) {
12
39
  return await this.client.call({ path: `/discover/comments`, ...options });
13
40
  }
41
+ /**
42
+ * Получение самых обсуждаемых релизов (5 штук)
43
+ *
44
+ * Возвращает список {@link IRelease} внутри {@link IPageableResponse}.
45
+ *
46
+ * Возможные ответы API в виде enum смотреть здесь {@link DefaultResult}
47
+ *
48
+ * @param options - Дополнительные параметры
49
+ * @returns Список релизов
50
+ *
51
+ * @example
52
+ * const result = await client.endpoints.discover.getDiscussing();
53
+ */
14
54
  async getDiscussing(options) {
15
55
  return await this.client.call({ path: `/discover/discussing`, ...options });
16
56
  }
57
+ /**
58
+ * Получение списка рекомендаций
59
+ *
60
+ * Возвращает список {@link IRelease} внутри {@link IPageableResponse}.
61
+ *
62
+ * Возможные ответы API в виде enum смотреть здесь {@link DefaultResult}
63
+ *
64
+ * @param page - Номер страницы
65
+ * @param options - Дополнительные параметры
66
+ * @returns Список релизов
67
+ *
68
+ * @example
69
+ * const result = await client.endpoints.discover.getRecommendations(0);
70
+ */
17
71
  async getRecommendations(page, options) {
18
72
  return await this.client.call({ path: `/discover/recommendations/${page}`, queryParams: { previous_page: page > 0 ? -1 : page - 1 }, ...options });
19
73
  }
74
+ /**
75
+ * Получение списка интересных релизов
76
+ *
77
+ * Возвращает список {@link IInterestingRelease} внутри {@link IPageableResponse}.
78
+ *
79
+ * Возможные ответы API в виде enum смотреть здесь {@link DefaultResult}
80
+ *
81
+ * @param options - Дополнительные параметры
82
+ * @returns Список релизов
83
+ *
84
+ * @example
85
+ * const result = await client.endpoints.discover.getInteresting(0);
86
+ */
20
87
  async getInteresting(options) {
21
88
  return await this.client.call({ path: `/discover/interesting`, ...options });
22
89
  }
@@ -3,7 +3,34 @@ import { IPageableResponse, IBaseApiParams, IArticle } from "../types";
3
3
  export declare class Feed {
4
4
  private readonly client;
5
5
  constructor(client: Anixart);
6
- news(page: number, options?: IBaseApiParams): Promise<IPageableResponse<IArticle>>;
6
+ /**
7
+ * Получение постов с каналов на которые подписан
8
+ *
9
+ * Возвращает список {@link IArticle} внутри {@link IPageableResponse}.
10
+ *
11
+ * Возможные ответы API в виде enum смотреть здесь {@link DefaultResult}
12
+ *
13
+ * @param page - Номер страницы
14
+ * @param options - Дополнительные параметры
15
+ * @returns Список постов
16
+ *
17
+ * @example
18
+ * const result = await client.endpoints.feed.my(0);
19
+ */
7
20
  my(page: number, options?: IBaseApiParams): Promise<IPageableResponse<IArticle>>;
21
+ /**
22
+ * Получение последних выложенных постов
23
+ *
24
+ * Возвращает список {@link IArticle} внутри {@link IPageableResponse}.
25
+ *
26
+ * Возможные ответы API в виде enum смотреть здесь {@link DefaultResult}
27
+ *
28
+ * @param page - Номер страницы
29
+ * @param options - Дополнительные параметры
30
+ * @returns Список постов
31
+ *
32
+ * @example
33
+ * const result = await client.endpoints.feed.latest(0);
34
+ */
8
35
  latest(page: number, options?: IBaseApiParams): Promise<IPageableResponse<IArticle>>;
9
36
  }
package/dist/api/feed.js CHANGED
@@ -5,12 +5,37 @@ class Feed {
5
5
  constructor(client) {
6
6
  this.client = client;
7
7
  }
8
- async news(page, options) {
9
- return await this.client.call({ path: `/feed/news/all/${page}`, ...options });
10
- }
8
+ /**
9
+ * Получение постов с каналов на которые подписан
10
+ *
11
+ * Возвращает список {@link IArticle} внутри {@link IPageableResponse}.
12
+ *
13
+ * Возможные ответы API в виде enum смотреть здесь {@link DefaultResult}
14
+ *
15
+ * @param page - Номер страницы
16
+ * @param options - Дополнительные параметры
17
+ * @returns Список постов
18
+ *
19
+ * @example
20
+ * const result = await client.endpoints.feed.my(0);
21
+ */
11
22
  async my(page, options) {
12
23
  return await this.client.call({ path: `/feed/my/all/${page}`, ...options });
13
24
  }
25
+ /**
26
+ * Получение последних выложенных постов
27
+ *
28
+ * Возвращает список {@link IArticle} внутри {@link IPageableResponse}.
29
+ *
30
+ * Возможные ответы API в виде enum смотреть здесь {@link DefaultResult}
31
+ *
32
+ * @param page - Номер страницы
33
+ * @param options - Дополнительные параметры
34
+ * @returns Список постов
35
+ *
36
+ * @example
37
+ * const result = await client.endpoints.feed.latest(0);
38
+ */
14
39
  async latest(page, options) {
15
40
  return await this.client.call({ path: `/article/latest/all/${page}`, method: "POST", ...options });
16
41
  }
@@ -7,3 +7,4 @@ export * from "./collection";
7
7
  export * from "./discover";
8
8
  export * from "./channel";
9
9
  export * from "./feed";
10
+ export * from "./search";
package/dist/api/index.js CHANGED
@@ -23,3 +23,4 @@ __exportStar(require("./collection"), exports);
23
23
  __exportStar(require("./discover"), exports);
24
24
  __exportStar(require("./channel"), exports);
25
25
  __exportStar(require("./feed"), exports);
26
+ __exportStar(require("./search"), exports);
@@ -1,5 +1,5 @@
1
1
  import { Anixart } from "../client";
2
- import { IPageableResponse, INotificationCountResponse, IFriendNotification, IRelatedReleaseNotification, IResponse, IBaseApiParams } from "../types";
2
+ import { IPageableResponse, INotificationCountResponse, IFriendNotification, IRelatedReleaseNotification, IResponse, IBaseApiParams, IArticleNotification } from "../types";
3
3
  export declare class Notification {
4
4
  private readonly client;
5
5
  constructor(client: Anixart);
@@ -10,5 +10,7 @@ export declare class Notification {
10
10
  getEpisodeNotificaions(page: number, options?: IBaseApiParams): Promise<IPageableResponse<any>>;
11
11
  getReleaseCommentNotifications(page: number, options?: IBaseApiParams): Promise<IPageableResponse<any>>;
12
12
  getCollectionCommentNotifications(page: number, options?: IBaseApiParams): Promise<IPageableResponse<any>>;
13
+ getArticleNotifications(page: number, options?: IBaseApiParams): Promise<IPageableResponse<IArticleNotification>>;
13
14
  removeAllNotifications(options?: IBaseApiParams): Promise<IResponse>;
15
+ readNotifications(options?: IBaseApiParams): Promise<IResponse>;
14
16
  }