anixartjs 0.0.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 (81) hide show
  1. package/LICENSE +674 -0
  2. package/README.md +187 -0
  3. package/dist/api/auth.d.ts +11 -0
  4. package/dist/api/auth.js +49 -0
  5. package/dist/api/channel.d.ts +42 -0
  6. package/dist/api/channel.js +111 -0
  7. package/dist/api/collection.d.ts +30 -0
  8. package/dist/api/collection.js +57 -0
  9. package/dist/api/discover.d.ts +11 -0
  10. package/dist/api/discover.js +24 -0
  11. package/dist/api/feed.d.ts +9 -0
  12. package/dist/api/feed.js +18 -0
  13. package/dist/api/index.d.ts +9 -0
  14. package/dist/api/index.js +25 -0
  15. package/dist/api/notification.d.ts +14 -0
  16. package/dist/api/notification.js +33 -0
  17. package/dist/api/profile.d.ts +26 -0
  18. package/dist/api/profile.js +59 -0
  19. package/dist/api/release.d.ts +40 -0
  20. package/dist/api/release.js +101 -0
  21. package/dist/api/settings.d.ts +30 -0
  22. package/dist/api/settings.js +81 -0
  23. package/dist/classes/Article.d.ts +18 -0
  24. package/dist/classes/Article.js +43 -0
  25. package/dist/classes/ArticleComment.d.ts +15 -0
  26. package/dist/classes/ArticleComment.js +36 -0
  27. package/dist/classes/BaseArticle.d.ts +21 -0
  28. package/dist/classes/BaseArticle.js +23 -0
  29. package/dist/classes/BaseComment.d.ts +22 -0
  30. package/dist/classes/BaseComment.js +25 -0
  31. package/dist/classes/BaseProfile.d.ts +25 -0
  32. package/dist/classes/BaseProfile.js +37 -0
  33. package/dist/classes/Channel.d.ts +47 -0
  34. package/dist/classes/Channel.js +103 -0
  35. package/dist/classes/Dubber.d.ts +19 -0
  36. package/dist/classes/Dubber.js +24 -0
  37. package/dist/classes/Episode.d.ts +20 -0
  38. package/dist/classes/Episode.js +30 -0
  39. package/dist/classes/FullProfile.d.ts +53 -0
  40. package/dist/classes/FullProfile.js +75 -0
  41. package/dist/classes/Release.d.ts +88 -0
  42. package/dist/classes/Release.js +140 -0
  43. package/dist/classes/ReleaseComment.d.ts +16 -0
  44. package/dist/classes/ReleaseComment.js +44 -0
  45. package/dist/classes/Source.d.ts +15 -0
  46. package/dist/classes/Source.js +20 -0
  47. package/dist/classes/SuggestionArticle.d.ts +14 -0
  48. package/dist/classes/SuggestionArticle.js +28 -0
  49. package/dist/client.d.ts +27 -0
  50. package/dist/client.js +121 -0
  51. package/dist/endpoints.d.ts +18 -0
  52. package/dist/endpoints.js +25 -0
  53. package/dist/index.d.ts +2 -0
  54. package/dist/index.js +20 -0
  55. package/dist/types/auth.d.ts +25 -0
  56. package/dist/types/auth.js +2 -0
  57. package/dist/types/channel.d.ts +178 -0
  58. package/dist/types/channel.js +2 -0
  59. package/dist/types/collection.d.ts +38 -0
  60. package/dist/types/collection.js +2 -0
  61. package/dist/types/index.d.ts +12 -0
  62. package/dist/types/index.js +25 -0
  63. package/dist/types/notification.d.ts +22 -0
  64. package/dist/types/notification.js +2 -0
  65. package/dist/types/profile.d.ts +141 -0
  66. package/dist/types/profile.js +21 -0
  67. package/dist/types/release.d.ts +240 -0
  68. package/dist/types/release.js +23 -0
  69. package/dist/types/request.d.ts +36 -0
  70. package/dist/types/request.js +2 -0
  71. package/dist/types/response.d.ts +51 -0
  72. package/dist/types/response.js +12 -0
  73. package/dist/types/settings.d.ts +61 -0
  74. package/dist/types/settings.js +14 -0
  75. package/dist/utils/ArticleBuilder.d.ts +36 -0
  76. package/dist/utils/ArticleBuilder.js +138 -0
  77. package/dist/utils/LinkParser.d.ts +110 -0
  78. package/dist/utils/LinkParser.js +119 -0
  79. package/dist/utils/Utils.d.ts +3 -0
  80. package/dist/utils/Utils.js +11 -0
  81. package/package.json +32 -0
package/README.md ADDED
@@ -0,0 +1,187 @@
1
+ <h2 align="center">AnixartJS</h2>
2
+
3
+ AnixartJS — это имплементация **API Anixart** на **TypeScript** для NodeJS, предоставляющая удобный и интуитивно понятный интерфейс для взаимодействия с приложением Anixart.
4
+
5
+
6
+ ## 📚 Содержание
7
+
8
+ 1. [Установка](#-установка)
9
+ 2. [Использование](#-использование)
10
+ - [Пример](#пример-использования-anixartjs)
11
+ - [Инициализация](#инициализация)
12
+ - [Аутентификация](#аутентификация)
13
+ - [Получение данных](#получение-данных)
14
+ 4. [Вклад в проект](#-вклад-в-проект)
15
+ 5. [Лицензия](#-лицензия)
16
+
17
+ ## 🛠 Установка
18
+
19
+ Установите AnixartJS с помощью npm:
20
+
21
+ ```bash
22
+ npm install anixartjs
23
+ ```
24
+
25
+ ## 🚀 Использование
26
+
27
+ ### Пример использования AnixartJS
28
+
29
+ В этом примере показано, как использовать библиотеку **AnixartJS** для взаимодействия с API Anixart. Вы можете использовать как готовые методы классов, так и прямой доступ к эндпоинтам.
30
+
31
+ #### Пример кода: `example.js`
32
+
33
+ ```javascript
34
+ const { Anixart } = require("anixartjs");
35
+
36
+ /**
37
+ * Авторизация может быть выполнена двумя способами:
38
+ *
39
+ * 1. Используя токен при создании экземпляра класса:
40
+ * new Anixart({ token: "your-token-here" })
41
+ *
42
+ * 2. Используя метод login():
43
+ * const anixartClient = new Anixart();
44
+ * anixartClient.login("username", "password"); // Возвращает ResponseCode
45
+ */
46
+ const anixartClient = new Anixart();
47
+
48
+ // Использование готовых методов классов
49
+ anixartClient.getArticleById(123).then(article => {
50
+ if (article) {
51
+ console.log("📚 Статья найдена:");
52
+ } else {
53
+ console.log("⚠️ Статья не найдена.");
54
+ }
55
+ }).catch(error => {
56
+ console.error("🚨 Ошибка при получении статьи:", error);
57
+ });
58
+
59
+ anixartClient.getProfileById(456).then(profile => {
60
+ console.log("👤 Профиль пользователя:");
61
+ console.log(`Имя пользователя: ${profile.login}`);
62
+ console.log(`ID: ${profile.id}`);
63
+ }).catch(error => {
64
+ console.error("🚨 Ошибка при получении профиля:", error);
65
+ });
66
+
67
+ // Использование эндпоинтов напрямую
68
+ anixartClient.endpoints.release.info(789, true).then(rawResponse => {
69
+ console.log("🎬 Информация о релизе (RAW):");
70
+ console.log(rawResponse);
71
+ }).catch(error => {
72
+ console.error("🚨 Ошибка при получении информации о релизе:", error);
73
+ });
74
+ ```
75
+
76
+ ### Инициализация
77
+
78
+ Чтобы начать использовать AnixartJS, создайте экземпляр класса `Anixart`. Вы можете указать пользовательский базовый URL или токен API при инициализации.
79
+
80
+ ```typescript
81
+ import { Anixart } from 'anixartjs'; //ESM or Typescript
82
+ const { Anixart } = require("anixartjs"); //CommonJS
83
+
84
+ const anixart = new Anixart({
85
+ baseUrl: 'base-url', // Опционально, по умолчанию https://api.anixart.tv
86
+ token: 'your-token' // Опционально, используется для авторизованных запросов
87
+ });
88
+ ```
89
+
90
+ ### 🔑 Аутентификация
91
+
92
+ Для входа в систему используйте метод `login`. После успешной аутентификации токен API будет автоматически сохранен в экземпляре для последующих запросов.
93
+
94
+ ```typescript
95
+ try {
96
+ const responseCode = await anixart.login('ваше-имя-пользователя', 'ваш-пароль');
97
+
98
+ if (responseCode === 0) {
99
+ console.log('🎉 Вход выполнен успешно!');
100
+ } else {
101
+ console.error('❌ Ошибка входа, код:', responseCode);
102
+ }
103
+ } catch (error) {
104
+ console.error('🚨 Ошибка при входе:', error);
105
+ }
106
+ ```
107
+
108
+ ### 📥 Получение данных
109
+
110
+ AnixartJS предоставляет методы для получения различных типов данных из API Anixart. Вот несколько примеров:
111
+
112
+ #### Получить канал по ID
113
+
114
+ ```typescript
115
+ const channel = await anixart.getChannelById(123);
116
+
117
+ if (channel) {
118
+ console.log(`📺 Название канала: ${channel.title}`);
119
+ } else {
120
+ console.log('⚠️ Канал не найден.');
121
+ }
122
+ ```
123
+
124
+ #### Получить профиль пользователя по ID
125
+
126
+ ```typescript
127
+ const profile = await anixart.getProfileById(456);
128
+ console.log(`👤 Имя пользователя: ${profile.login}`);
129
+ ```
130
+
131
+ #### Получить последние статьи ленты
132
+
133
+ ```typescript
134
+ const articles = await anixart.getLatestFeed(1); // Номер страницы как аргумент
135
+ articles.forEach(article => {
136
+ console.log(`📄 ID статьи: ${article.id}`);
137
+ });
138
+ ```
139
+
140
+ #### Получить случайный релиз
141
+
142
+ ```typescript
143
+ const release = await anixart.getRandomRelease(true); // Расширенные детали
144
+ console.log(`🎲 Заголовок случайного релиза: ${release.titleRu}`);
145
+ ```
146
+
147
+ #### Получить статью по ID
148
+
149
+ ```typescript
150
+ const article = await anixart.getArticleById(789);
151
+
152
+ if (article) {
153
+ console.log(`📄 ID статьи: ${article.id}`);
154
+ } else {
155
+ console.log('⚠️ Статья не найдена.');
156
+ }
157
+ ```
158
+
159
+ #### Получить релиз по ID
160
+
161
+ ```typescript
162
+ const release = await anixart.getReleaseById(101, true); // Расширенные детали
163
+
164
+ if (release) {
165
+ console.log(`🎬 Заголовок релиза: ${release.titleRu}`);
166
+ } else {
167
+ console.log('⚠️ Релиз не найден.');
168
+ }
169
+ ```
170
+ ## TODO
171
+ - [ ] Добавление всех эндпоинтов
172
+ - [ ] Добавление классов для коллекций
173
+ - [ ] Документация
174
+
175
+ ## 🤝 Вклад в проект
176
+
177
+ Я рад принимать вклады для улучшения AnixartJS!
178
+
179
+ Убедитесь, что ваш код соответствует стандартам проекта.
180
+
181
+ ## 📜 Лицензия
182
+
183
+ Этот проект лицензирован под **GPL-2.0**. Подробности см. в файле [LICENSE](LICENSE).
184
+
185
+ ---
186
+
187
+ Если у вас есть вопросы или проблемы, пожалуйста, откройте issue в [GitHub репозитории](https://github.com/theDesConnet/AnixartJS). Я буду рад помочь! 😊
@@ -0,0 +1,11 @@
1
+ import { Anixart } from "../client";
2
+ import { ILoginResponse, ILoginRequest, IRegisterRequest, IRegisterResponse, IRegisterVerifyRequest, IBaseApiParams, IRestorePasswordRequest } from "../types";
3
+ export declare class Auth {
4
+ private readonly client;
5
+ constructor(client: Anixart);
6
+ signIn(data: ILoginRequest, options?: IBaseApiParams): Promise<ILoginResponse>;
7
+ 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>;
11
+ }
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Auth = void 0;
4
+ class Auth {
5
+ constructor(client) {
6
+ this.client = client;
7
+ }
8
+ async signIn(data, options) {
9
+ return this.client.call({
10
+ path: '/auth/signIn',
11
+ urlEncoded: data,
12
+ ...options
13
+ });
14
+ }
15
+ async signUp(data, options) {
16
+ return this.client.call({
17
+ path: '/auth/signUp',
18
+ urlEncoded: data,
19
+ ...options
20
+ });
21
+ }
22
+ async signUpVerify(data, options) {
23
+ return this.client.call({
24
+ path: '/auth/verify',
25
+ urlEncoded: data,
26
+ ...options
27
+ });
28
+ }
29
+ async restore(login, options) {
30
+ return this.client.call({
31
+ path: '/auth/restore',
32
+ urlEncoded: { data: login },
33
+ ...options
34
+ });
35
+ }
36
+ async restoreVerify(data, options) {
37
+ return this.client.call({
38
+ path: '/auth/restore/verify',
39
+ urlEncoded: {
40
+ data: data.username,
41
+ password: data.password,
42
+ code: data.code,
43
+ hash: data.hash
44
+ },
45
+ ...options
46
+ });
47
+ }
48
+ }
49
+ exports.Auth = Auth;
@@ -0,0 +1,42 @@
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";
3
+ /**
4
+ * Это из беты аниксарта 9.0
5
+ *
6
+ * TODO: ...
7
+ */
8
+ export declare class Channel {
9
+ private readonly client;
10
+ constructor(client: Anixart);
11
+ info(id: number, options?: IBaseApiParams): Promise<IChannelResponse>;
12
+ all(page: number, options?: IBaseApiParams): Promise<IPageableResponse<IChannel>>;
13
+ getBlog(id: number, options?: IBaseApiParams): Promise<IChannelResponse>;
14
+ subscribe(id: number, options?: IBaseApiParams): Promise<IResponse>;
15
+ unsubscribe(id: number, options?: IBaseApiParams): Promise<IResponse>;
16
+ getArticles(id: number, page: number, date?: number, options?: IBaseApiParams): Promise<IPageableResponse<IArticle>>;
17
+ getArticle(id: number, options?: IBaseApiParams): Promise<IArticleResponse>;
18
+ createArticle(channelId: number, article: IArticleCreateRequest, options?: IBaseApiParams): Promise<IArticleCreateResponse>;
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>;
24
+ addArticleComment(id: number, data: IBaseCommentAddRequest, options?: IBaseApiParams): Promise<IArticleCommentResponce>;
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>>;
27
+ getCommentReplies(id: number, page: number, sort: number, options?: IBaseApiParams): Promise<IPageableResponse<IArticleComment>>;
28
+ getAvaliableEditor(id: number, isSuggestionMode?: boolean, isEditMode?: boolean, options?: IBaseApiParams): Promise<IChannelMediaTokenResponse>;
29
+ voteArticle(id: number, vote: VoteType, options?: IBaseApiParams): Promise<IResponse>;
30
+ voteCommentArticle(id: number, vote: VoteType, options?: IBaseApiParams): Promise<IResponse>;
31
+ uploadArticleImage(media_token: string, file: Buffer, options?: IBaseApiParams): Promise<IArticleUploadFileResponse>;
32
+ uploadChannelAvatar(id: number, file: Buffer, options?: IBaseApiParams): Promise<IUrlResponse>;
33
+ generateEmbedData(type: "youtube" | "vk" | "link", media_token: string, link: string, options?: IBaseApiParams): Promise<IEmbedData>;
34
+ uploadChannelCover(id: number, file: Buffer, options?: IBaseApiParams): Promise<IUrlResponse>;
35
+ editChannel(id: number, data: IChannelCreateRequest, options?: IBaseApiParams): Promise<IChannelResponse>;
36
+ getArticleSuggestions(id: number, page: number, options?: IBaseApiParams): Promise<IPageableResponse<IArticle>>;
37
+ removeArticleSuggestion(id: number, options?: IBaseApiParams): Promise<IResponse>;
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>;
42
+ }
@@ -0,0 +1,111 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Channel = void 0;
4
+ const Utils_1 = require("../utils/Utils");
5
+ /**
6
+ * Это из беты аниксарта 9.0
7
+ *
8
+ * TODO: ...
9
+ */
10
+ class Channel {
11
+ constructor(client) {
12
+ this.client = client;
13
+ }
14
+ async info(id, options) {
15
+ return await this.client.call({ path: `/channel/${id}`, ...options });
16
+ }
17
+ async all(page, options) {
18
+ return await this.client.call({ path: `/channel/all/${page}`, ...options });
19
+ }
20
+ async getBlog(id, options) {
21
+ return await this.client.call({ path: `/channel/blog/${id}`, ...options });
22
+ }
23
+ async subscribe(id, options) {
24
+ return await this.client.call({ path: `/channel/subscribe/${id}`, method: "POST", ...options });
25
+ }
26
+ async unsubscribe(id, options) {
27
+ return await this.client.call({ path: `/channel/unsubscribe/${id}`, method: "POST", ...options });
28
+ }
29
+ async getArticles(id, page, date, options) {
30
+ return await this.client.call({ path: `/article/all/${page}`, json: { channel_id: id, date: date !== null && date !== void 0 ? date : 0 }, ...options });
31
+ }
32
+ async getArticle(id, options) {
33
+ return await this.client.call({ path: `/article/${id}`, ...options });
34
+ }
35
+ async createArticle(channelId, article, options) {
36
+ return await this.client.call({ path: `/article/create/${channelId}`, method: "POST", json: article, ...options });
37
+ }
38
+ async editArticle(id, article, options) {
39
+ return await this.client.call({ path: `/article/edit/${id}`, method: "POST", json: article, ...options });
40
+ }
41
+ async search(data, page, options) {
42
+ return await this.client.call({ path: `/search/channels/${page}`, json: data, ...options });
43
+ }
44
+ async create(data, options) {
45
+ return await this.client.call({ path: `/channel/create`, method: "POST", json: data, ...options });
46
+ }
47
+ async removeArticleComment(id, options) {
48
+ return await this.client.call({ path: `/article/comment/delete/${id}`, ...options });
49
+ }
50
+ async removeArticle(id, options) {
51
+ return await this.client.call({ path: `/article/delete/${id}`, ...options });
52
+ }
53
+ async addArticleComment(id, data, options) {
54
+ return await this.client.call({ path: `/article/comment/add/${id}`, json: data, ...options });
55
+ }
56
+ async getVotes(id, page, sort, options) {
57
+ return await this.client.call({ path: `/article/votes/${id}/${page}`, queryParams: { sort }, method: "POST", ...options });
58
+ }
59
+ async getComments(id, page, sort, options) {
60
+ return await this.client.call({ path: `/article/comment/all/${id}/${page}`, queryParams: { sort }, ...options });
61
+ }
62
+ async getCommentReplies(id, page, sort, options) {
63
+ return await this.client.call({ path: `/article/comment/replies/${id}/${page}`, queryParams: { sort }, method: "POST", ...options });
64
+ }
65
+ async getAvaliableEditor(id, isSuggestionMode = false, isEditMode = false, options) {
66
+ return await this.client.call({ path: `/channel/${id}/editor/available`, queryParams: { is_suggestion: isSuggestionMode, is_edit_mode: isEditMode }, ...options });
67
+ }
68
+ async voteArticle(id, vote, options) {
69
+ return await this.client.call({ path: `/article/vote/${id}/${vote}`, ...options });
70
+ }
71
+ async voteCommentArticle(id, vote, options) {
72
+ return await this.client.call({ path: `/article/comment/vote/${id}/${vote}`, ...options });
73
+ }
74
+ async uploadArticleImage(media_token, file, options) {
75
+ return await this.client.call({ path: `/content/upload`, method: "POST", image: { stream: file, name: Utils_1.Utils.generateTempFileName(), type: "file" }, bearer: media_token, customBaseUrl: "https://editor.anixart.tv", ...options });
76
+ }
77
+ async uploadChannelAvatar(id, file, options) {
78
+ return await this.client.call({ path: `/channel/avatar/upload/${id}`, method: "POST", image: { stream: file, name: Utils_1.Utils.generateTempFileName(), type: "image" }, ...options });
79
+ }
80
+ async generateEmbedData(type, media_token, link, options) {
81
+ let request = await this.client.call({ path: `/embed/${type}`, customBaseUrl: "https://editor.anixart.tv", bearer: media_token, queryParams: { url: link }, ...options });
82
+ request.url = link;
83
+ return request;
84
+ }
85
+ async uploadChannelCover(id, file, options) {
86
+ return await this.client.call({ path: `/channel/cover/upload/${id}`, method: "POST", image: { stream: file, name: Utils_1.Utils.generateTempFileName(), type: "image" }, ...options });
87
+ }
88
+ ;
89
+ async editChannel(id, data, options) {
90
+ return await this.client.call({ path: `/channel/edit/${id}`, json: data, ...options });
91
+ }
92
+ async getArticleSuggestions(id, page, options) {
93
+ return await this.client.call({ path: `/article/suggestion/all/${page}`, json: { channel_id: id }, ...options });
94
+ }
95
+ async removeArticleSuggestion(id, options) {
96
+ return await this.client.call({ path: `/article/suggestion/delete/${id}`, ...options });
97
+ }
98
+ async publishArticleSuggestion(id, options) {
99
+ return await this.client.call({ path: `/article/suggestion/publish/${id}`, ...options });
100
+ }
101
+ async createArticleSuggestion(id, data, options) {
102
+ return await this.client.call({ path: `/article/suggestion/create/${id}`, json: data, ...options });
103
+ }
104
+ async manageChannelBlocklist(id, data, options) {
105
+ return await this.client.call({ path: `/channel/${id}/block/manage`, json: data, ...options });
106
+ }
107
+ async getChannelBlock(id, profileId, options) {
108
+ return await this.client.call({ path: `/channel/${id}/block/${profileId}`, ...options });
109
+ }
110
+ }
111
+ exports.Channel = Channel;
@@ -0,0 +1,30 @@
1
+ import { Anixart } from "../client";
2
+ import { IPageableResponse, IResponse, IBaseApiParams, ICollectionResponse, IRelease, ICollection, IReleaseInCollectionRequest, ICollectionCreateRequest } from "../types";
3
+ /**
4
+ * Класс коллекции
5
+ *
6
+ * TODO: editImage
7
+ */
8
+ export declare class Collection {
9
+ private readonly client;
10
+ constructor(client: Anixart);
11
+ all(page: number, options?: IBaseApiParams): Promise<IPageableResponse<ICollection>>;
12
+ info(id: number, options?: IBaseApiParams): Promise<ICollectionResponse>;
13
+ getCollectionReleases(id: number, page: number, options?: IBaseApiParams): Promise<IPageableResponse<IRelease>>;
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>;
17
+ getReleaseInCollection(data: IReleaseInCollectionRequest, options?: IBaseApiParams): Promise<IPageableResponse<ICollection>>;
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>;
30
+ }
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Collection = void 0;
4
+ /**
5
+ * Класс коллекции
6
+ *
7
+ * TODO: editImage
8
+ */
9
+ class Collection {
10
+ constructor(client) {
11
+ this.client = client;
12
+ }
13
+ async all(page, options) {
14
+ return await this.client.call({ path: `/collection/all/${page}`, ...options });
15
+ }
16
+ async info(id, options) {
17
+ return await this.client.call({ path: `/collection/${id}`, ...options });
18
+ }
19
+ async getCollectionReleases(id, page, options) {
20
+ return await this.client.call({ path: `/collection/${id}/releases/${page}`, ...options });
21
+ }
22
+ async getCollectionFavorites(page, options) {
23
+ return await this.client.call({ path: `/collectionFavorite/all/${page}`, ...options });
24
+ }
25
+ async addCollectionFavorite(id, options) {
26
+ return await this.client.call({ path: `/collectionFavorite/add/${id}`, ...options });
27
+ }
28
+ async removeCollectionFavorite(id, options) {
29
+ return await this.client.call({ path: `/collectionFavorite/delete/${id}`, ...options });
30
+ }
31
+ async getReleaseInCollection(data, options) {
32
+ return await this.client.call({ path: `/collection/all/release/${data.id}/${data.page}`, queryParams: { sort: data.sort }, ...options });
33
+ }
34
+ async getUserCollections(id, page, options) {
35
+ return await this.client.call({ path: `/collection/all/profile/${id}/${page}`, ...options });
36
+ }
37
+ async createCollection(data, options) {
38
+ return await this.client.call({ path: `/collectionMy/create`, json: data, ...options });
39
+ }
40
+ async editCollection(id, data, options) {
41
+ return await this.client.call({ path: `/collectionMy/edit/${id}`, json: data, ...options });
42
+ }
43
+ /**
44
+ * {
45
+ "code": 0,
46
+ "collection": null
47
+ }
48
+ *
49
+ */
50
+ async addReleaseToCollection(collectionId, releaseId, options) {
51
+ return await this.client.call({ path: `/collectionMy/release/add/${collectionId}`, queryParams: { release_id: releaseId }, ...options });
52
+ }
53
+ async deleteCollection(id, options) {
54
+ return await this.client.call({ path: `/collectionMy/delete/${id}`, ...options });
55
+ }
56
+ }
57
+ exports.Collection = Collection;
@@ -0,0 +1,11 @@
1
+ import { Anixart } from "../client";
2
+ import { IPageableResponse, IBaseApiParams, IRelease, ICommentRelease, IInterestingRelease } from "../types";
3
+ export declare class Discover {
4
+ private readonly client;
5
+ constructor(client: Anixart);
6
+ getWatching(page: number, options?: IBaseApiParams): Promise<IPageableResponse<IRelease>>;
7
+ getComments(options?: IBaseApiParams): Promise<IPageableResponse<ICommentRelease>>;
8
+ getDiscussing(options?: IBaseApiParams): Promise<IPageableResponse<IRelease>>;
9
+ getRecommendations(page: number, options?: IBaseApiParams): Promise<IPageableResponse<IRelease>>;
10
+ getInteresting(options?: IBaseApiParams): Promise<IPageableResponse<IInterestingRelease>>;
11
+ }
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Discover = void 0;
4
+ class Discover {
5
+ constructor(client) {
6
+ this.client = client;
7
+ }
8
+ async getWatching(page, options) {
9
+ return await this.client.call({ path: `/discover/watching/${page}`, ...options });
10
+ }
11
+ async getComments(options) {
12
+ return await this.client.call({ path: `/discover/comments`, ...options });
13
+ }
14
+ async getDiscussing(options) {
15
+ return await this.client.call({ path: `/discover/discussing`, ...options });
16
+ }
17
+ async getRecommendations(page, options) {
18
+ return await this.client.call({ path: `/discover/recommendations/${page}`, queryParams: { previous_page: page > 0 ? -1 : page - 1 }, ...options });
19
+ }
20
+ async getInteresting(options) {
21
+ return await this.client.call({ path: `/discover/interesting`, ...options });
22
+ }
23
+ }
24
+ exports.Discover = Discover;
@@ -0,0 +1,9 @@
1
+ import { Anixart } from "../client";
2
+ import { IPageableResponse, IBaseApiParams, IArticle } from "../types";
3
+ export declare class Feed {
4
+ private readonly client;
5
+ constructor(client: Anixart);
6
+ news(page: number, options?: IBaseApiParams): Promise<IPageableResponse<IArticle>>;
7
+ my(page: number, options?: IBaseApiParams): Promise<IPageableResponse<IArticle>>;
8
+ latest(page: number, options?: IBaseApiParams): Promise<IPageableResponse<IArticle>>;
9
+ }
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Feed = void 0;
4
+ class Feed {
5
+ constructor(client) {
6
+ this.client = client;
7
+ }
8
+ async news(page, options) {
9
+ return await this.client.call({ path: `/feed/news/all/${page}`, ...options });
10
+ }
11
+ async my(page, options) {
12
+ return await this.client.call({ path: `/feed/my/all/${page}`, ...options });
13
+ }
14
+ async latest(page, options) {
15
+ return await this.client.call({ path: `/article/latest/all/${page}`, method: "POST", ...options });
16
+ }
17
+ }
18
+ exports.Feed = Feed;
@@ -0,0 +1,9 @@
1
+ export * from "./auth";
2
+ export * from "./profile";
3
+ export * from "./release";
4
+ export * from "./settings";
5
+ export * from "./notification";
6
+ export * from "./collection";
7
+ export * from "./discover";
8
+ export * from "./channel";
9
+ export * from "./feed";
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./auth"), exports);
18
+ __exportStar(require("./profile"), exports);
19
+ __exportStar(require("./release"), exports);
20
+ __exportStar(require("./settings"), exports);
21
+ __exportStar(require("./notification"), exports);
22
+ __exportStar(require("./collection"), exports);
23
+ __exportStar(require("./discover"), exports);
24
+ __exportStar(require("./channel"), exports);
25
+ __exportStar(require("./feed"), exports);
@@ -0,0 +1,14 @@
1
+ import { Anixart } from "../client";
2
+ import { IPageableResponse, INotificationCountResponse, IFriendNotification, IRelatedReleaseNotification, IResponse, IBaseApiParams } from "../types";
3
+ export declare class Notification {
4
+ private readonly client;
5
+ constructor(client: Anixart);
6
+ countNotifications(options?: IBaseApiParams): Promise<INotificationCountResponse>;
7
+ getNotifications(page: number, options?: IBaseApiParams): Promise<IPageableResponse<IFriendNotification | IRelatedReleaseNotification>>;
8
+ getFriendsNotifications(page: number, options?: IBaseApiParams): Promise<IPageableResponse<IFriendNotification>>;
9
+ getRelatedReleaseNotifications(page: number, options?: IBaseApiParams): Promise<IPageableResponse<IRelatedReleaseNotification>>;
10
+ getEpisodeNotificaions(page: number, options?: IBaseApiParams): Promise<IPageableResponse<any>>;
11
+ getReleaseCommentNotifications(page: number, options?: IBaseApiParams): Promise<IPageableResponse<any>>;
12
+ getCollectionCommentNotifications(page: number, options?: IBaseApiParams): Promise<IPageableResponse<any>>;
13
+ removeNotifications(options?: IBaseApiParams): Promise<IResponse>;
14
+ }
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Notification = void 0;
4
+ class Notification {
5
+ constructor(client) {
6
+ this.client = client;
7
+ }
8
+ async countNotifications(options) {
9
+ return await this.client.call({ path: `/notification/count`, ...options });
10
+ }
11
+ async getNotifications(page, options) {
12
+ return await this.client.call({ path: `/notification/all/${page}`, ...options });
13
+ }
14
+ async getFriendsNotifications(page, options) {
15
+ return await this.client.call({ path: `/notification/friends/${page}`, ...options });
16
+ }
17
+ async getRelatedReleaseNotifications(page, options) {
18
+ return await this.client.call({ path: `/notification/related/release/${page}`, ...options });
19
+ }
20
+ async getEpisodeNotificaions(page, options) {
21
+ return await this.client.call({ path: `/notification/episodes/${page}`, ...options });
22
+ }
23
+ async getReleaseCommentNotifications(page, options) {
24
+ return await this.client.call({ path: `/notification/releaseComments/${page}`, ...options });
25
+ }
26
+ async getCollectionCommentNotifications(page, options) {
27
+ return await this.client.call({ path: `/notification/collectionComments/${page}`, ...options });
28
+ }
29
+ async removeNotifications(options) {
30
+ return await this.client.call({ path: `/notification/remove/all`, ...options });
31
+ }
32
+ }
33
+ exports.Notification = Notification;