anixapi 0.2.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 (164) hide show
  1. package/LICENSE +339 -0
  2. package/README.md +165 -0
  3. package/dist/api/auth.d.ts +129 -0
  4. package/dist/api/auth.js +156 -0
  5. package/dist/api/bookmarks/export.d.ts +19 -0
  6. package/dist/api/bookmarks/export.js +24 -0
  7. package/dist/api/bookmarks/import.d.ts +29 -0
  8. package/dist/api/bookmarks/import.js +36 -0
  9. package/dist/api/bookmarks/index.d.ts +2 -0
  10. package/dist/api/bookmarks/index.js +18 -0
  11. package/dist/api/channel/article.d.ts +119 -0
  12. package/dist/api/channel/article.js +144 -0
  13. package/dist/api/channel/articleComment.d.ts +119 -0
  14. package/dist/api/channel/articleComment.js +144 -0
  15. package/dist/api/channel/articleSuggestion.d.ts +69 -0
  16. package/dist/api/channel/articleSuggestion.js +84 -0
  17. package/dist/api/channel/channel.d.ts +249 -0
  18. package/dist/api/channel/channel.js +300 -0
  19. package/dist/api/channel/index.d.ts +4 -0
  20. package/dist/api/channel/index.js +20 -0
  21. package/dist/api/collection/collection.d.ts +59 -0
  22. package/dist/api/collection/collection.js +72 -0
  23. package/dist/api/collection/collectionComment.d.ts +109 -0
  24. package/dist/api/collection/collectionComment.js +132 -0
  25. package/dist/api/collection/collectionFavorite.d.ts +39 -0
  26. package/dist/api/collection/collectionFavorite.js +48 -0
  27. package/dist/api/collection/collectionMy.d.ts +69 -0
  28. package/dist/api/collection/collectionMy.js +84 -0
  29. package/dist/api/collection/index.d.ts +4 -0
  30. package/dist/api/collection/index.js +20 -0
  31. package/dist/api/config.d.ts +29 -0
  32. package/dist/api/config.js +36 -0
  33. package/dist/api/discover.d.ts +59 -0
  34. package/dist/api/discover.js +72 -0
  35. package/dist/api/feed.d.ts +39 -0
  36. package/dist/api/feed.js +48 -0
  37. package/dist/api/index.d.ts +12 -0
  38. package/dist/api/index.js +28 -0
  39. package/dist/api/notification/index.d.ts +2 -0
  40. package/dist/api/notification/index.js +18 -0
  41. package/dist/api/notification/notification.d.ts +199 -0
  42. package/dist/api/notification/notification.js +240 -0
  43. package/dist/api/notification/notificationPreference.d.ts +159 -0
  44. package/dist/api/notification/notificationPreference.js +192 -0
  45. package/dist/api/profile/index.d.ts +10 -0
  46. package/dist/api/profile/index.js +26 -0
  47. package/dist/api/profile/profile.d.ts +65 -0
  48. package/dist/api/profile/profile.js +80 -0
  49. package/dist/api/profile/profileBadge.d.ts +39 -0
  50. package/dist/api/profile/profileBadge.js +48 -0
  51. package/dist/api/profile/profileBlockList.d.ts +39 -0
  52. package/dist/api/profile/profileBlockList.js +48 -0
  53. package/dist/api/profile/profileDeletion.d.ts +39 -0
  54. package/dist/api/profile/profileDeletion.js +48 -0
  55. package/dist/api/profile/profileFriend.d.ts +99 -0
  56. package/dist/api/profile/profileFriend.js +120 -0
  57. package/dist/api/profile/profileHealth.d.ts +59 -0
  58. package/dist/api/profile/profileHealth.js +72 -0
  59. package/dist/api/profile/profileList.d.ts +49 -0
  60. package/dist/api/profile/profileList.js +60 -0
  61. package/dist/api/profile/profilePreference.d.ts +239 -0
  62. package/dist/api/profile/profilePreference.js +288 -0
  63. package/dist/api/profile/profileReleaseVote.d.ts +39 -0
  64. package/dist/api/profile/profileReleaseVote.js +48 -0
  65. package/dist/api/profile/profileRoleList.d.ts +19 -0
  66. package/dist/api/profile/profileRoleList.js +24 -0
  67. package/dist/api/release/episode.d.ts +99 -0
  68. package/dist/api/release/episode.js +120 -0
  69. package/dist/api/release/favorite.d.ts +39 -0
  70. package/dist/api/release/favorite.js +48 -0
  71. package/dist/api/release/filter.d.ts +19 -0
  72. package/dist/api/release/filter.js +24 -0
  73. package/dist/api/release/history.d.ts +39 -0
  74. package/dist/api/release/history.js +48 -0
  75. package/dist/api/release/index.d.ts +13 -0
  76. package/dist/api/release/index.js +29 -0
  77. package/dist/api/release/related.d.ts +19 -0
  78. package/dist/api/release/related.js +24 -0
  79. package/dist/api/release/release.d.ts +79 -0
  80. package/dist/api/release/release.js +96 -0
  81. package/dist/api/release/releaseComment.d.ts +109 -0
  82. package/dist/api/release/releaseComment.js +132 -0
  83. package/dist/api/release/releaseStreamingPlatform.d.ts +19 -0
  84. package/dist/api/release/releaseStreamingPlatform.js +24 -0
  85. package/dist/api/release/releaseVideo.d.ts +59 -0
  86. package/dist/api/release/releaseVideo.js +72 -0
  87. package/dist/api/release/releaseVideoAppeal.d.ts +49 -0
  88. package/dist/api/release/releaseVideoAppeal.js +60 -0
  89. package/dist/api/release/releaseVideoFavorite.d.ts +39 -0
  90. package/dist/api/release/releaseVideoFavorite.js +48 -0
  91. package/dist/api/release/schedule.d.ts +19 -0
  92. package/dist/api/release/schedule.js +24 -0
  93. package/dist/api/release/type.d.ts +39 -0
  94. package/dist/api/release/type.js +48 -0
  95. package/dist/api/report.d.ts +189 -0
  96. package/dist/api/report.js +228 -0
  97. package/dist/api/search.d.ts +129 -0
  98. package/dist/api/search.js +156 -0
  99. package/dist/classes/Article.d.ts +18 -0
  100. package/dist/classes/Article.js +44 -0
  101. package/dist/classes/ArticleComment.d.ts +15 -0
  102. package/dist/classes/ArticleComment.js +37 -0
  103. package/dist/classes/BaseArticle.d.ts +21 -0
  104. package/dist/classes/BaseArticle.js +23 -0
  105. package/dist/classes/BaseComment.d.ts +22 -0
  106. package/dist/classes/BaseComment.js +25 -0
  107. package/dist/classes/BaseProfile.d.ts +29 -0
  108. package/dist/classes/BaseProfile.js +52 -0
  109. package/dist/classes/Channel.d.ts +47 -0
  110. package/dist/classes/Channel.js +108 -0
  111. package/dist/classes/Collection.d.ts +29 -0
  112. package/dist/classes/Collection.js +58 -0
  113. package/dist/classes/Dubber.d.ts +19 -0
  114. package/dist/classes/Dubber.js +24 -0
  115. package/dist/classes/Episode.d.ts +20 -0
  116. package/dist/classes/Episode.js +30 -0
  117. package/dist/classes/FullProfile.d.ts +70 -0
  118. package/dist/classes/FullProfile.js +92 -0
  119. package/dist/classes/Release.d.ts +91 -0
  120. package/dist/classes/Release.js +150 -0
  121. package/dist/classes/ReleaseComment.d.ts +16 -0
  122. package/dist/classes/ReleaseComment.js +45 -0
  123. package/dist/classes/Source.d.ts +15 -0
  124. package/dist/classes/Source.js +20 -0
  125. package/dist/classes/SuggestionArticle.d.ts +14 -0
  126. package/dist/classes/SuggestionArticle.js +30 -0
  127. package/dist/client.d.ts +49 -0
  128. package/dist/client.js +183 -0
  129. package/dist/endpoints.d.ts +63 -0
  130. package/dist/endpoints.js +67 -0
  131. package/dist/errors.d.ts +37 -0
  132. package/dist/errors.js +122 -0
  133. package/dist/index.d.ts +5 -0
  134. package/dist/index.js +23 -0
  135. package/dist/types/auth.d.ts +127 -0
  136. package/dist/types/auth.js +47 -0
  137. package/dist/types/channel.d.ts +350 -0
  138. package/dist/types/channel.js +104 -0
  139. package/dist/types/collection.d.ts +105 -0
  140. package/dist/types/collection.js +44 -0
  141. package/dist/types/config.d.ts +41 -0
  142. package/dist/types/config.js +4 -0
  143. package/dist/types/index.d.ts +13 -0
  144. package/dist/types/index.js +26 -0
  145. package/dist/types/notification.d.ts +81 -0
  146. package/dist/types/notification.js +2 -0
  147. package/dist/types/profile.d.ts +339 -0
  148. package/dist/types/profile.js +46 -0
  149. package/dist/types/release.d.ts +467 -0
  150. package/dist/types/release.js +39 -0
  151. package/dist/types/request.d.ts +138 -0
  152. package/dist/types/request.js +2 -0
  153. package/dist/types/response.d.ts +104 -0
  154. package/dist/types/response.js +35 -0
  155. package/dist/types/settings.d.ts +119 -0
  156. package/dist/types/settings.js +48 -0
  157. package/dist/utils/ArticleBuilder.d.ts +38 -0
  158. package/dist/utils/ArticleBuilder.js +144 -0
  159. package/dist/utils/LinkParser.d.ts +253 -0
  160. package/dist/utils/LinkParser.js +253 -0
  161. package/dist/utils/Utils.d.ts +3 -0
  162. package/dist/utils/Utils.js +11 -0
  163. package/docs/DOCUMENTATION.md +290 -0
  164. package/package.json +55 -0
@@ -0,0 +1,129 @@
1
+ import { Anixart } from "../client";
2
+ import { IArticle, IArticleSearchRequest, IBaseApiParams, IBaseSearchRequest, IChannel, IChannelProfile, IChannelSearchRequest, ICollection, IFeedSearchResponse, IPageableResponse, IProfile, IRelease } from "../types";
3
+ /**
4
+ * Класс с эндпоинтами поиска
5
+ */
6
+ export declare class Search {
7
+ private readonly client;
8
+ constructor(client: Anixart);
9
+ /**
10
+ * POST search/articles/{page}
11
+ *
12
+ * Возможные коды ответа: {@link DefaultResult}
13
+ * @returns {@link IPageableResponse}
14
+ *
15
+ * @example
16
+ * const result = await client.endpoints.search.articleSearch(1, ...);
17
+ */
18
+ articleSearch(page: number, body: IArticleSearchRequest, options?: IBaseApiParams): Promise<IPageableResponse<IArticle>>;
19
+ /**
20
+ * POST search/channels/{page}
21
+ *
22
+ * Возможные коды ответа: {@link DefaultResult}
23
+ * @returns {@link IPageableResponse}
24
+ *
25
+ * @example
26
+ * const result = await client.endpoints.search.channelSearch(1, ...);
27
+ */
28
+ channelSearch(page: number, body: IChannelSearchRequest, options?: IBaseApiParams): Promise<IPageableResponse<IChannel>>;
29
+ /**
30
+ * POST search/channel/{c_id}/subscribers/{page}
31
+ *
32
+ * Возможные коды ответа: {@link DefaultResult}
33
+ * @returns {@link IPageableResponse}
34
+ *
35
+ * @example
36
+ * const result = await client.endpoints.search.channelSubscribersSearch(1, 1, ...);
37
+ */
38
+ channelSubscribersSearch(channelId: number, page: number, body: IBaseSearchRequest, options?: IBaseApiParams): Promise<IPageableResponse<IChannelProfile>>;
39
+ /**
40
+ * POST search/collections/{page}
41
+ *
42
+ * Возможные коды ответа: {@link DefaultResult}
43
+ * @returns {@link IPageableResponse}
44
+ *
45
+ * @example
46
+ * const result = await client.endpoints.search.collectionSearch(1, ...);
47
+ */
48
+ collectionSearch(page: number, body: IBaseSearchRequest, options?: IBaseApiParams): Promise<IPageableResponse<ICollection>>;
49
+ /**
50
+ * POST search/favoriteCollections/{page}
51
+ *
52
+ * Возможные коды ответа: {@link DefaultResult}
53
+ * @returns {@link IPageableResponse}
54
+ *
55
+ * @example
56
+ * const result = await client.endpoints.search.favoriteCollectionsSearch(1, ...);
57
+ */
58
+ favoriteCollectionsSearch(page: number, body: IBaseSearchRequest, options?: IBaseApiParams): Promise<IPageableResponse<ICollection>>;
59
+ /**
60
+ * POST search/favorites/{page}
61
+ *
62
+ * Возможные коды ответа: {@link DefaultResult}
63
+ * @returns {@link IPageableResponse}
64
+ *
65
+ * @example
66
+ * const result = await client.endpoints.search.favoritesSearch(1, ...);
67
+ */
68
+ favoritesSearch(page: number, body: IBaseSearchRequest, options?: IBaseApiParams): Promise<IPageableResponse<IRelease>>;
69
+ /**
70
+ * POST search/feed/{page}
71
+ *
72
+ * Возможные коды ответа: {@link DefaultResult}
73
+ * @returns {@link IFeedSearchResponse}
74
+ *
75
+ * @example
76
+ * const result = await client.endpoints.search.feedSearch(1, ...);
77
+ */
78
+ feedSearch(page: number, body: IBaseSearchRequest, options?: IBaseApiParams): Promise<IFeedSearchResponse>;
79
+ /**
80
+ * POST search/history/{page}
81
+ *
82
+ * Возможные коды ответа: {@link DefaultResult}
83
+ * @returns {@link IPageableResponse}
84
+ *
85
+ * @example
86
+ * const result = await client.endpoints.search.historySearch(1, ...);
87
+ */
88
+ historySearch(page: number, body: IBaseSearchRequest, options?: IBaseApiParams): Promise<IPageableResponse<IRelease>>;
89
+ /**
90
+ * POST search/profileCollections/{p_id}/{page}
91
+ *
92
+ * Возможные коды ответа: {@link DefaultResult}
93
+ * @returns {@link IPageableResponse}
94
+ *
95
+ * @example
96
+ * const result = await client.endpoints.search.profileCollectionSearch(1, 1, ...);
97
+ */
98
+ profileCollectionSearch(profileId: number, page: number, body: IBaseSearchRequest, query?: Record<string, string | number | boolean | undefined>, options?: IBaseApiParams): Promise<IPageableResponse<ICollection>>;
99
+ /**
100
+ * POST search/profile/list/{status}/{page}
101
+ *
102
+ * Возможные коды ответа: {@link DefaultResult}
103
+ * @returns {@link IPageableResponse}
104
+ *
105
+ * @example
106
+ * const result = await client.endpoints.search.profileListSearch(1, 1, ...);
107
+ */
108
+ profileListSearch(status: number, page: number, body: IBaseSearchRequest, options?: IBaseApiParams): Promise<IPageableResponse<IRelease>>;
109
+ /**
110
+ * POST search/profiles/{page}
111
+ *
112
+ * Возможные коды ответа: {@link DefaultResult}
113
+ * @returns {@link IPageableResponse}
114
+ *
115
+ * @example
116
+ * const result = await client.endpoints.search.profileSearch(1, ...);
117
+ */
118
+ profileSearch(page: number, body: IBaseSearchRequest, options?: IBaseApiParams): Promise<IPageableResponse<IProfile>>;
119
+ /**
120
+ * POST search/releases/{page}
121
+ *
122
+ * Возможные коды ответа: {@link DefaultResult}
123
+ * @returns {@link IPageableResponse}
124
+ *
125
+ * @example
126
+ * const result = await client.endpoints.search.releaseSearch(1, ...);
127
+ */
128
+ releaseSearch(page: number, body: IBaseSearchRequest, options?: IBaseApiParams): Promise<IPageableResponse<IRelease>>;
129
+ }
@@ -0,0 +1,156 @@
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
+ * POST search/articles/{page}
13
+ *
14
+ * Возможные коды ответа: {@link DefaultResult}
15
+ * @returns {@link IPageableResponse}
16
+ *
17
+ * @example
18
+ * const result = await client.endpoints.search.articleSearch(1, ...);
19
+ */
20
+ async articleSearch(page, body, options) {
21
+ return await this.client.call({ path: `/search/articles/${page}`, method: 'POST', json: body, ...options });
22
+ }
23
+ /**
24
+ * POST search/channels/{page}
25
+ *
26
+ * Возможные коды ответа: {@link DefaultResult}
27
+ * @returns {@link IPageableResponse}
28
+ *
29
+ * @example
30
+ * const result = await client.endpoints.search.channelSearch(1, ...);
31
+ */
32
+ async channelSearch(page, body, options) {
33
+ return await this.client.call({ path: `/search/channels/${page}`, method: 'POST', json: body, ...options });
34
+ }
35
+ /**
36
+ * POST search/channel/{c_id}/subscribers/{page}
37
+ *
38
+ * Возможные коды ответа: {@link DefaultResult}
39
+ * @returns {@link IPageableResponse}
40
+ *
41
+ * @example
42
+ * const result = await client.endpoints.search.channelSubscribersSearch(1, 1, ...);
43
+ */
44
+ async channelSubscribersSearch(channelId, page, body, options) {
45
+ return await this.client.call({ path: `/search/channel/${channelId}/subscribers/${page}`, method: 'POST', json: body, ...options });
46
+ }
47
+ /**
48
+ * POST search/collections/{page}
49
+ *
50
+ * Возможные коды ответа: {@link DefaultResult}
51
+ * @returns {@link IPageableResponse}
52
+ *
53
+ * @example
54
+ * const result = await client.endpoints.search.collectionSearch(1, ...);
55
+ */
56
+ async collectionSearch(page, body, options) {
57
+ return await this.client.call({ path: `/search/collections/${page}`, method: 'POST', json: body, ...options });
58
+ }
59
+ /**
60
+ * POST search/favoriteCollections/{page}
61
+ *
62
+ * Возможные коды ответа: {@link DefaultResult}
63
+ * @returns {@link IPageableResponse}
64
+ *
65
+ * @example
66
+ * const result = await client.endpoints.search.favoriteCollectionsSearch(1, ...);
67
+ */
68
+ async favoriteCollectionsSearch(page, body, options) {
69
+ return await this.client.call({ path: `/search/favoriteCollections/${page}`, method: 'POST', json: body, ...options });
70
+ }
71
+ /**
72
+ * POST search/favorites/{page}
73
+ *
74
+ * Возможные коды ответа: {@link DefaultResult}
75
+ * @returns {@link IPageableResponse}
76
+ *
77
+ * @example
78
+ * const result = await client.endpoints.search.favoritesSearch(1, ...);
79
+ */
80
+ async favoritesSearch(page, body, options) {
81
+ return await this.client.call({ path: `/search/favorites/${page}`, method: 'POST', json: body, ...options });
82
+ }
83
+ /**
84
+ * POST search/feed/{page}
85
+ *
86
+ * Возможные коды ответа: {@link DefaultResult}
87
+ * @returns {@link IFeedSearchResponse}
88
+ *
89
+ * @example
90
+ * const result = await client.endpoints.search.feedSearch(1, ...);
91
+ */
92
+ async feedSearch(page, body, options) {
93
+ return await this.client.call({ path: `/search/feed/${page}`, method: 'POST', json: body, ...options });
94
+ }
95
+ /**
96
+ * POST search/history/{page}
97
+ *
98
+ * Возможные коды ответа: {@link DefaultResult}
99
+ * @returns {@link IPageableResponse}
100
+ *
101
+ * @example
102
+ * const result = await client.endpoints.search.historySearch(1, ...);
103
+ */
104
+ async historySearch(page, body, options) {
105
+ return await this.client.call({ path: `/search/history/${page}`, method: 'POST', json: body, ...options });
106
+ }
107
+ /**
108
+ * POST search/profileCollections/{p_id}/{page}
109
+ *
110
+ * Возможные коды ответа: {@link DefaultResult}
111
+ * @returns {@link IPageableResponse}
112
+ *
113
+ * @example
114
+ * const result = await client.endpoints.search.profileCollectionSearch(1, 1, ...);
115
+ */
116
+ async profileCollectionSearch(profileId, page, body, query, options) {
117
+ return await this.client.call({ path: `/search/profileCollections/${profileId}/${page}`, method: 'POST', queryParams: query, json: body, ...options });
118
+ }
119
+ /**
120
+ * POST search/profile/list/{status}/{page}
121
+ *
122
+ * Возможные коды ответа: {@link DefaultResult}
123
+ * @returns {@link IPageableResponse}
124
+ *
125
+ * @example
126
+ * const result = await client.endpoints.search.profileListSearch(1, 1, ...);
127
+ */
128
+ async profileListSearch(status, page, body, options) {
129
+ return await this.client.call({ path: `/search/profile/list/${status}/${page}`, method: 'POST', json: body, ...options });
130
+ }
131
+ /**
132
+ * POST search/profiles/{page}
133
+ *
134
+ * Возможные коды ответа: {@link DefaultResult}
135
+ * @returns {@link IPageableResponse}
136
+ *
137
+ * @example
138
+ * const result = await client.endpoints.search.profileSearch(1, ...);
139
+ */
140
+ async profileSearch(page, body, options) {
141
+ return await this.client.call({ path: `/search/profiles/${page}`, method: 'POST', json: body, ...options });
142
+ }
143
+ /**
144
+ * POST search/releases/{page}
145
+ *
146
+ * Возможные коды ответа: {@link DefaultResult}
147
+ * @returns {@link IPageableResponse}
148
+ *
149
+ * @example
150
+ * const result = await client.endpoints.search.releaseSearch(1, ...);
151
+ */
152
+ async releaseSearch(page, body, options) {
153
+ return await this.client.call({ path: `/search/releases/${page}`, method: 'POST', json: body, apiV2: true, ...options });
154
+ }
155
+ }
156
+ exports.Search = Search;
@@ -0,0 +1,18 @@
1
+ import { Channel } from "./Channel";
2
+ import { Anixart } from "../client";
3
+ import { IArticle, DefaultResult, IBaseCommentAddRequest, VoteType, ArticleDeleteResult } from "../types";
4
+ import { ArticleComment } from "./ArticleComment";
5
+ import { ArticleBuilder } from "../utils/ArticleBuilder";
6
+ import { BaseArticle } from "./BaseArticle";
7
+ export declare class Article extends BaseArticle {
8
+ readonly client: Anixart;
9
+ readonly repostArticle: Article | null;
10
+ readonly channel: Channel;
11
+ constructor(client: Anixart, articleResponce: IArticle, channel?: Channel);
12
+ private writeProperties;
13
+ getComments(page?: number, sort?: number): Promise<ArticleComment[]>;
14
+ addComment(data: IBaseCommentAddRequest): Promise<ArticleComment | null>;
15
+ setVote(type: VoteType): Promise<DefaultResult>;
16
+ edit(data: ArticleBuilder): Promise<Article>;
17
+ delete(): Promise<DefaultResult | ArticleDeleteResult>;
18
+ }
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Article = void 0;
4
+ const Channel_1 = require("./Channel");
5
+ const types_1 = require("../types");
6
+ const ArticleComment_1 = require("./ArticleComment");
7
+ const BaseArticle_1 = require("./BaseArticle");
8
+ class Article extends BaseArticle_1.BaseArticle {
9
+ constructor(client, articleResponce, channel) {
10
+ super(client, articleResponce, channel);
11
+ this.client = client;
12
+ this.channel = channel !== null && channel !== void 0 ? channel : new Channel_1.Channel(this.client, articleResponce.channel);
13
+ this.repostArticle = articleResponce.repost_article
14
+ ? new Article(client, articleResponce.repost_article, channel)
15
+ : null;
16
+ }
17
+ writeProperties(prop, value) {
18
+ this[prop] = value;
19
+ }
20
+ async getComments(page, sort) {
21
+ const request = await this.client.endpoints.articleComment.comments(this.id, page !== null && page !== void 0 ? page : 0, { sort: sort !== null && sort !== void 0 ? sort : 2 });
22
+ return request.content.map(comment => new ArticleComment_1.ArticleComment(this.client, comment));
23
+ }
24
+ async addComment(data) {
25
+ const request = await this.client.endpoints.articleComment.add(this.id, data);
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;
27
+ }
28
+ async setVote(type) {
29
+ const request = await this.client.endpoints.article.vote(this.id, type);
30
+ if (request.code == types_1.DefaultResult.Ok) {
31
+ this.writeProperties("vote", type == this.vote ? 0 : type);
32
+ }
33
+ return request.code;
34
+ }
35
+ async edit(data) {
36
+ const request = await this.client.endpoints.article.edit(this.id, data.returnBuildAricle());
37
+ return new Article(this.client, request.article, this.channel);
38
+ }
39
+ async delete() {
40
+ const request = await this.client.endpoints.article.delete(this.id);
41
+ return request.code;
42
+ }
43
+ }
44
+ exports.Article = Article;
@@ -0,0 +1,15 @@
1
+ import { Anixart } from "../client";
2
+ import { BaseComment } from "./BaseComment";
3
+ import { IArticleComment, DefaultResult, VoteType, CommentDeleteResult } from "../types";
4
+ import { Article } from "./Article";
5
+ import { BaseProfile } from "./BaseProfile";
6
+ export declare class ArticleComment extends BaseComment {
7
+ readonly client: Anixart;
8
+ readonly article: Article;
9
+ constructor(client: Anixart, comment: IArticleComment);
10
+ private writeProperties;
11
+ getVotes(page?: number, sort?: number): Promise<BaseProfile[]>;
12
+ getReplies(page?: number, sort?: number): Promise<ArticleComment[]>;
13
+ delete(): Promise<DefaultResult | CommentDeleteResult>;
14
+ setVote(type: VoteType): Promise<DefaultResult>;
15
+ }
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ArticleComment = void 0;
4
+ const BaseComment_1 = require("./BaseComment");
5
+ const types_1 = require("../types");
6
+ const Article_1 = require("./Article");
7
+ const BaseProfile_1 = require("./BaseProfile");
8
+ class ArticleComment extends BaseComment_1.BaseComment {
9
+ constructor(client, comment) {
10
+ super(client, comment);
11
+ this.client = client;
12
+ this.article = new Article_1.Article(client, comment.article);
13
+ }
14
+ writeProperties(prop, value) {
15
+ this[prop] = value;
16
+ }
17
+ async getVotes(page, sort) {
18
+ const request = await this.client.endpoints.articleComment.votes(this.id, page !== null && page !== void 0 ? page : 0, { sort: sort !== null && sort !== void 0 ? sort : 2 });
19
+ return request.content.map(profile => new BaseProfile_1.BaseProfile(this.client, profile));
20
+ }
21
+ async getReplies(page, sort) {
22
+ const request = await this.client.endpoints.articleComment.replies(this.id, page !== null && page !== void 0 ? page : 0, { sort: sort !== null && sort !== void 0 ? sort : 2 });
23
+ return request.content.map(comment => new ArticleComment(this.client, comment));
24
+ }
25
+ async delete() {
26
+ const request = await this.client.endpoints.articleComment.delete(this.id);
27
+ return request.code;
28
+ }
29
+ async setVote(type) {
30
+ const request = await this.client.endpoints.articleComment.vote(this.id, type);
31
+ if (request.code == types_1.DefaultResult.Ok) {
32
+ this.writeProperties("vote", type == this.vote ? 0 : type);
33
+ }
34
+ return request.code;
35
+ }
36
+ }
37
+ exports.ArticleComment = ArticleComment;
@@ -0,0 +1,21 @@
1
+ import { Channel } from "./Channel";
2
+ import { Anixart } from "../client";
3
+ import { IArticle, IArticlePayloadBlock } from "../types";
4
+ import { FullProfile } from "./FullProfile";
5
+ export declare class BaseArticle {
6
+ readonly client: Anixart;
7
+ readonly id: number;
8
+ readonly payloadTime: Date;
9
+ readonly payloadBlocks: IArticlePayloadBlock[];
10
+ readonly vote: number;
11
+ readonly isDeleted: boolean;
12
+ readonly commentCount: number;
13
+ readonly repostCount: number;
14
+ readonly voteCount: number;
15
+ readonly creationDate: Date;
16
+ readonly lastUpdateDate: Date;
17
+ readonly underModerationReason: string | null;
18
+ readonly isUnderModeration: boolean;
19
+ readonly author: FullProfile | null;
20
+ constructor(client: Anixart, articleResponce: IArticle, channel?: Channel);
21
+ }
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BaseArticle = void 0;
4
+ const FullProfile_1 = require("./FullProfile");
5
+ class BaseArticle {
6
+ constructor(client, articleResponce, channel) {
7
+ this.client = client;
8
+ this.id = articleResponce.id;
9
+ this.payloadTime = new Date(articleResponce.payload.time);
10
+ this.author = articleResponce.author ? new FullProfile_1.FullProfile(this.client, articleResponce.author) : null;
11
+ this.payloadBlocks = articleResponce.payload.blocks;
12
+ this.vote = articleResponce.vote;
13
+ this.commentCount = articleResponce.comment_count;
14
+ this.repostCount = articleResponce.repost_count;
15
+ this.voteCount = articleResponce.vote_count;
16
+ this.creationDate = new Date(articleResponce.creation_date * 1000);
17
+ this.lastUpdateDate = new Date(articleResponce.last_update_date * 1000);
18
+ this.underModerationReason = articleResponce.under_moderation_reason;
19
+ this.isUnderModeration = articleResponce.is_under_moderation;
20
+ this.isDeleted = articleResponce.is_deleted;
21
+ }
22
+ }
23
+ exports.BaseArticle = BaseArticle;
@@ -0,0 +1,22 @@
1
+ import { Anixart } from "../client";
2
+ import { IBaseComment } from "../types";
3
+ import { BaseProfile } from "./BaseProfile";
4
+ export declare class BaseComment {
5
+ protected readonly client: Anixart;
6
+ readonly id: number;
7
+ readonly profile: BaseProfile;
8
+ readonly message: string;
9
+ readonly timestamp: Date;
10
+ readonly type: number;
11
+ readonly vote: number;
12
+ readonly parentCommentId: number;
13
+ readonly voteCount: number;
14
+ readonly likesCount: number;
15
+ readonly isSpoiler: boolean;
16
+ readonly isEdited: boolean;
17
+ readonly isDeleted: boolean;
18
+ readonly isReply: boolean;
19
+ readonly replyCount: number;
20
+ readonly canLike: boolean;
21
+ constructor(client: Anixart, comment: IBaseComment);
22
+ }
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BaseComment = void 0;
4
+ const BaseProfile_1 = require("./BaseProfile");
5
+ class BaseComment {
6
+ constructor(client, comment) {
7
+ this.client = client;
8
+ this.id = comment.id;
9
+ this.profile = new BaseProfile_1.BaseProfile(this.client, comment.profile);
10
+ this.message = comment.message;
11
+ this.timestamp = new Date(comment.timestamp * 1000);
12
+ this.type = comment.type;
13
+ this.vote = comment.vote;
14
+ this.parentCommentId = comment.parent_comment_id;
15
+ this.voteCount = comment.vote_count;
16
+ this.likesCount = comment.likes_count;
17
+ this.isSpoiler = comment.is_spoiler;
18
+ this.isEdited = comment.is_edited;
19
+ this.isDeleted = comment.is_deleted;
20
+ this.isReply = comment.is_reply;
21
+ this.replyCount = comment.reply_count;
22
+ this.canLike = comment.can_like;
23
+ }
24
+ }
25
+ exports.BaseComment = BaseComment;
@@ -0,0 +1,29 @@
1
+ import { Anixart } from "../client";
2
+ import { IFriendRequestResponse, IPageableResponse, IProfileShort, IRelease, IVoteRelease } from "../types";
3
+ import { Collection } from "./Collection";
4
+ export declare class BaseProfile {
5
+ protected readonly client: Anixart;
6
+ readonly id: number;
7
+ readonly login: string;
8
+ readonly avatar: string;
9
+ readonly banExpires: Date;
10
+ readonly banReason: string;
11
+ readonly privilegeLevel: number;
12
+ readonly badgeId: number | null;
13
+ readonly badgeName: string | null;
14
+ readonly badgeType: number | null;
15
+ readonly badgeUrl: string | null;
16
+ readonly isBanned: boolean;
17
+ readonly isSponsor: boolean;
18
+ readonly isVerified: boolean;
19
+ readonly isOnline: boolean;
20
+ readonly friendStatus: number | null;
21
+ readonly friendCount: number;
22
+ constructor(client: Anixart, profile: IProfileShort);
23
+ getFriends(page?: number): Promise<BaseProfile[]>;
24
+ sendFriendRequest(): Promise<IFriendRequestResponse>;
25
+ removeFriendRequest(): Promise<IFriendRequestResponse>;
26
+ getVotedReleases(page?: number, sort?: number): Promise<IPageableResponse<IVoteRelease>>;
27
+ getUnvotedReleases(page?: number | "last"): Promise<IPageableResponse<IRelease>>;
28
+ getCollections(page?: number): Promise<Collection[]>;
29
+ }
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BaseProfile = void 0;
4
+ const Collection_1 = require("./Collection");
5
+ class BaseProfile {
6
+ constructor(client, profile) {
7
+ this.client = client;
8
+ this.id = profile.id;
9
+ this.login = profile.login;
10
+ this.avatar = profile.avatar;
11
+ this.banExpires = new Date(profile.ban_expires * 1000);
12
+ this.banReason = profile.ban_reason;
13
+ this.privilegeLevel = profile.privilege_level;
14
+ this.badgeId = profile.badge_id;
15
+ this.badgeName = profile.badge_name;
16
+ this.badgeType = profile.badge_type;
17
+ this.badgeUrl = profile.badge_url;
18
+ this.isBanned = profile.is_banned;
19
+ this.isSponsor = profile.is_sponsor;
20
+ this.isVerified = profile.is_verified;
21
+ this.isOnline = profile.is_online;
22
+ this.friendStatus = profile.friend_status;
23
+ this.friendCount = profile.friend_count;
24
+ }
25
+ async getFriends(page) {
26
+ const request = await this.client.endpoints.profileFriend.friends(this.id, page !== null && page !== void 0 ? page : 0);
27
+ return request.content.map((profile) => new BaseProfile(this.client, profile));
28
+ }
29
+ async sendFriendRequest() {
30
+ const request = await this.client.endpoints.profileFriend.requestSend(this.id);
31
+ return request;
32
+ }
33
+ async removeFriendRequest() {
34
+ const request = await this.client.endpoints.profileFriend.requestRemove(this.id);
35
+ return request;
36
+ }
37
+ async getVotedReleases(page, sort) {
38
+ const request = await this.client.endpoints.profileReleaseVote.allReleaseVoted(this.id, page !== null && page !== void 0 ? page : 0, { sort: sort !== null && sort !== void 0 ? sort : 1 });
39
+ return request;
40
+ }
41
+ async getUnvotedReleases(page) {
42
+ const request = typeof page === "number"
43
+ ? await this.client.endpoints.profileReleaseVote.allReleaseUnvoted(page)
44
+ : await this.client.endpoints.profileReleaseVote.lastReleaseUnvoted();
45
+ return request;
46
+ }
47
+ async getCollections(page) {
48
+ const request = await this.client.endpoints.collection.profileCollections(this.id, page !== null && page !== void 0 ? page : 0);
49
+ return request.content.map(x => new Collection_1.Collection(this.client, x));
50
+ }
51
+ }
52
+ exports.BaseProfile = BaseProfile;
@@ -0,0 +1,47 @@
1
+ import { Anixart } from "../client";
2
+ import { IChannel, IChannelBlockInfo, IChannelBlockManageRequest, IChannelCreateRequest, DefaultResult, ChannelSubscribeResult, ChannelUnsubscribeResult, ChannelBlockResult } from "../types";
3
+ import { ArticleBuilder } from "../utils/ArticleBuilder";
4
+ import { SuggestionArticle } from "./SuggestionArticle";
5
+ import { Article } from "./Article";
6
+ import { BaseProfile } from "./BaseProfile";
7
+ import { FullProfile } from "./FullProfile";
8
+ export declare class Channel {
9
+ private readonly client;
10
+ readonly id: number;
11
+ readonly title: string;
12
+ readonly description: string;
13
+ readonly channelAvatar: string;
14
+ readonly channelCover: string;
15
+ readonly clientPermission: number;
16
+ readonly articleCount: number;
17
+ readonly subscriberCount: number;
18
+ readonly creationDate: Date;
19
+ readonly lastUpdateDate: Date;
20
+ readonly isBlog: boolean;
21
+ readonly isCommentingEnabled: boolean;
22
+ readonly isArticleSuggestionEnabled: boolean;
23
+ readonly isVerified: boolean;
24
+ readonly isDeleted: boolean;
25
+ readonly blogProfileId: number;
26
+ readonly isSubscribed: boolean;
27
+ readonly isBlocked: boolean;
28
+ readonly blockReason: string;
29
+ readonly blockExpiredDate: Date;
30
+ readonly isPermBlocked: boolean;
31
+ readonly isAdministratorOrHigher: boolean;
32
+ constructor(client: Anixart, channelResponce: IChannel);
33
+ private writeProperties;
34
+ getArticles(page: number, _date?: number): Promise<(Article | undefined)[]>;
35
+ getArticleById(id: number): Promise<Article | null>;
36
+ createArticle(data: ArticleBuilder): Promise<Article | null>;
37
+ subscribe(): Promise<DefaultResult | ChannelSubscribeResult>;
38
+ unsubscribe(): Promise<DefaultResult | ChannelUnsubscribeResult>;
39
+ setAvatar(file: Buffer): Promise<this>;
40
+ setCover(file: Buffer): Promise<this>;
41
+ getMediaToken(isSuggestionMode?: boolean, isEditMode?: boolean): Promise<string | null>;
42
+ edit(data: IChannelCreateRequest): Promise<Channel | null>;
43
+ getArticleSuggestions(page: number): Promise<(SuggestionArticle[] | null)>;
44
+ createArticleSuggestion(data: ArticleBuilder): Promise<SuggestionArticle | null>;
45
+ manageBlocklist(profile: BaseProfile | FullProfile | number, data: Omit<IChannelBlockManageRequest, "target_profile_id">): Promise<DefaultResult | ChannelBlockResult>;
46
+ getBlocklist(profile: BaseProfile | FullProfile | number): Promise<IChannelBlockInfo | null>;
47
+ }