anixapi 0.2.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
  > **Дисклеймер.** Проект создан в **ознакомительных и исследовательских целях**. Автор **не поддерживает и осуждает** использование библиотеки для авторегистрации, спам-ботов, накрутки, обхода ограничений сервиса и любого злоупотребления API Anixart. Вы используете библиотеку **на свой страх и риск** и несёте ответственность за соблюдение правил Anixart и применимого законодательства.
3
3
 
4
4
  > [!CAUTION]
5
- > **Миграция с [theDesConnet/AnixartJS](https://github.com/theDesConnet/AnixartJS).** Плавного перехода на AnixApi **не будет**. Изменились структура `src/api`, имена эндпоинтов, типы, обработка ошибок (`AnixApiError`) и покрытие API 9.0 beta 11. При переносе с версии DesConnet закладывайте время на переписывание вызовов, импортов и проверку ответов. Подробности - в [документации](docs/DOCUMENTATION.md).
5
+ > **Миграция с [theDesConnet/AnixartJS](https://github.com/theDesConnet/AnixartJS).** Плавного перехода на AnixApi **не будет**. Изменились структура `src/api`, имена эндпоинтов, типы, обработка ошибок (`AnixApiError`) и покрытие API 9.0 beta 11. При переносе с версии DesConnet закладывайте время на переписывание вызовов, импортов и проверку ответов. Подробности в [документации](docs/DOCUMENTATION.md).
6
6
 
7
7
  <h2 align="center">AnixApi</h2>
8
8
 
@@ -18,148 +18,79 @@
18
18
 
19
19
  ---
20
20
 
21
-
22
-
23
21
  ## О проекте
24
22
 
25
-
26
-
27
- **AnixApi** - неофициальная имплементация REST API приложения [Anixart](https://anixart.ru). Библиотека даёт типизированный доступ к эндпоинтам, высокоуровневые методы (`getReleaseById`, `getProfileById`, …) и классы-обёртки для статей, каналов, релизов и коллекций.
28
-
29
-
23
+ **AnixApi** — неофициальная имплементация REST API приложения [Anixart](https://anixart.ru). Библиотека даёт типизированный доступ к эндпоинтам, высокоуровневые методы (`getReleaseById`, `getProfileById`, …) и классы-обёртки для статей, каналов, релизов и коллекций.
30
24
 
31
25
  ### Форк и оригинал
32
26
 
33
-
34
-
35
27
  Проект развивается на базе **[theDesConnet/AnixartJS](https://github.com/theDesConnet/AnixartJS)** (автор Roman U. / DesConnet, лицензия GPL-2.0).
36
28
 
29
+ | | |
30
+ |---|---|
37
31
  | **Оригинальный репозиторий** | https://github.com/theDesConnet/AnixartJS |
38
-
39
32
  | **Базовая архитектура API** | DesConnet |
40
-
41
33
  | **Расширения** | полное покрытие API 9.0 beta 11, реструктуризация `src/api`, типы, `AnixApiError`, `typecheck` в сборке |
42
34
 
43
-
44
-
45
35
  При публикации изменений обязательно сохраняйте указание на оригинальный проект и условия GPL-2.0.
46
36
 
47
-
48
-
49
37
  ---
50
38
 
51
-
52
-
53
39
  ## Быстрый старт
54
40
 
55
-
56
-
57
41
  ```bash
58
-
59
42
  npm install anixapi
60
-
61
43
  ```
62
44
 
63
-
64
-
65
45
  ```javascript
66
-
67
46
  const { Anixart, DefaultResult } = require("anixapi");
68
47
 
69
-
70
-
71
48
  const client = new Anixart();
72
-
73
49
  const code = await client.login("username", "password");
74
50
 
75
-
76
-
77
51
  if (code === DefaultResult.Ok) {
78
-
79
52
  const release = await client.endpoints.release.info(789, true);
80
-
81
53
  console.log(release);
82
-
83
54
  }
84
-
85
55
  ```
86
56
 
87
-
88
-
89
- Подробные примеры, структура API и обработка ошибок - в **[документации](docs/DOCUMENTATION.md)**.
90
-
91
-
57
+ Подробные примеры, структура API и обработка ошибок — в **[документации](docs/DOCUMENTATION.md)**.
92
58
 
93
59
  ---
94
60
 
95
-
96
-
97
61
  ## Возможности
98
62
 
99
-
100
-
101
- - **275 эндпоинтов** - `client.endpoints.*`
102
-
103
- - **TypeScript** - типы запросов, ответов и enum-кодов (`LoginResult`, `CommentAddResult`, …)
104
-
105
- - **Доменные классы** - `Article`, `Channel`, `Release`, `FullProfile`, `Collection`
106
-
107
- - **Ошибки** - `AnixApiError`, `describeResultCode()`, опция `throwOnApiError`
108
-
109
-
63
+ - **275 эндпоинтов** — `client.endpoints.*`
64
+ - **TypeScript** — типы запросов, ответов и enum-кодов (`LoginResult`, `CommentAddResult`, …)
65
+ - **Доменные классы** `Article`, `Channel`, `Release`, `FullProfile`, `Collection`
66
+ - **Ошибки** — `AnixApiError`, `describeResultCode()`, опция `throwOnApiError`
110
67
 
111
68
  ---
112
69
 
113
-
114
-
115
70
  ## TODO
116
71
 
117
-
118
-
119
72
  - [x] Все эндпоинты API (275)
120
-
121
73
  - [x] Типы / схемы / Swagger-документация
122
-
123
74
  - [x] Классы для коллекций
124
-
125
75
  - [ ] Возможность использовать библиотеку в браузере полностью
126
76
 
127
-
128
-
129
77
  ---
130
78
 
131
-
132
79
  ## Проекты на базе библиотеки
133
80
 
134
-
135
-
136
- - [AniDesk](https://github.com/theDesConnet/AniDesk) - неофициальный десктоп-клиент Anixart
137
-
138
- - [AnixApp](https://github.com/Maks1mio/anixapp) - неофициальное приложение Anixart для ПК
139
-
140
-
81
+ - [AniDesk](https://github.com/theDesConnet/AniDesk) — неофициальный десктоп-клиент Anixart
82
+ - [AnixApp](https://github.com/Maks1mio/anixapp) — неофициальное приложение Anixart для ПК
141
83
 
142
84
  ---
143
85
 
144
-
145
-
146
86
  ## Лицензия
147
87
 
148
-
149
-
150
- Проект распространяется под **[GPL-2.0](LICENSE)** - как и [оригинальный AnixartJS](https://github.com/theDesConnet/AnixartJS).
151
-
152
-
88
+ Проект распространяется под **[GPL-2.0](LICENSE)** — как и [оригинальный AnixartJS](https://github.com/theDesConnet/AnixartJS).
153
89
 
154
90
  ---
155
91
 
156
-
157
-
158
92
  ## Связь
159
93
 
160
-
161
-
162
- Вопросы и баги - через Issues в [репозитории AnixApi](https://github.com/Maks1mio/AnixApi).
94
+ Вопросы и баги — через Issues в [репозитории AnixApi](https://github.com/Maks1mio/anixapi).
163
95
 
164
96
  Оригинальная библиотека: [theDesConnet/AnixartJS](https://github.com/theDesConnet/AnixartJS).
165
-
@@ -1,11 +1,21 @@
1
1
  import { Anixart } from "../client";
2
- import { IBaseApiParams, ILoginRequest, ILoginResponse, IOAuthGoogleSignInRequest, IOAuthGoogleSignUpRequest, IOAuthVkSignInRequest, IOAuthVkSignUpRequest, IRegisterResponse, IResendRequest, IResponse, IRestoreEmailRequest, IRestoreResendRequest, IRestoreVerifyRequest, ISignUpRequest, ISignUpVerifyRequest } from "../types";
2
+ import { IBaseApiParams, ICheckLoginRequest, ICheckLoginResponse, ILoginRequest, ILoginResponse, IOAuthGoogleSignInRequest, IOAuthGoogleSignUpRequest, IOAuthTelegramSignInRequest, IOAuthTelegramSignUpRequest, IOAuthVkSignInRequest, IOAuthVkSignUpRequest, IRegisterResponse, IResendRequest, IResponse, IRestoreEmailRequest, IRestoreResendRequest, IRestoreVerifyRequest, ISignUpRequest, ISignUpVerifyRequest, ITelegramAuthResponse } from "../types";
3
3
  /**
4
4
  * Класс с эндпоинтами авторизации
5
5
  */
6
6
  export declare class Auth {
7
7
  private readonly client;
8
8
  constructor(client: Anixart);
9
+ /**
10
+ * POST auth/checkLogin
11
+ *
12
+ * Возможные коды ответа: {@link CheckLoginResult}
13
+ * @returns {@link ICheckLoginResponse}
14
+ *
15
+ * @example
16
+ * const result = await client.endpoints.auth.checkLogin({ login: 'user' });
17
+ */
18
+ checkLogin(data: ICheckLoginRequest, options?: IBaseApiParams): Promise<ICheckLoginResponse>;
9
19
  /**
10
20
  * POST auth/firebase
11
21
  *
@@ -76,6 +86,16 @@ export declare class Auth {
76
86
  * const result = await client.endpoints.auth.signInWithGoogle(...);
77
87
  */
78
88
  signInWithGoogle(data: IOAuthGoogleSignInRequest, options?: IBaseApiParams): Promise<ILoginResponse>;
89
+ /**
90
+ * POST auth/telegram
91
+ *
92
+ * Возможные коды ответа: {@link TelegramAuthResult}
93
+ * @returns {@link ITelegramAuthResponse}
94
+ *
95
+ * @example
96
+ * const result = await client.endpoints.auth.signInWithTelegram(...);
97
+ */
98
+ signInWithTelegram(data: IOAuthTelegramSignInRequest, options?: IBaseApiParams): Promise<ITelegramAuthResponse>;
79
99
  /**
80
100
  * POST auth/vk
81
101
  *
@@ -106,6 +126,16 @@ export declare class Auth {
106
126
  * const result = await client.endpoints.auth.signUpWithGoogle(...);
107
127
  */
108
128
  signUpWithGoogle(data: IOAuthGoogleSignUpRequest, options?: IBaseApiParams): Promise<ILoginResponse>;
129
+ /**
130
+ * POST auth/telegram
131
+ *
132
+ * Возможные коды ответа: {@link TelegramAuthResult}
133
+ * @returns {@link ITelegramAuthResponse}
134
+ *
135
+ * @example
136
+ * const result = await client.endpoints.auth.signUpWithTelegram(...);
137
+ */
138
+ signUpWithTelegram(data: IOAuthTelegramSignUpRequest, options?: IBaseApiParams): Promise<ITelegramAuthResponse>;
109
139
  /**
110
140
  * POST auth/vk
111
141
  *
package/dist/api/auth.js CHANGED
@@ -8,6 +8,18 @@ class Auth {
8
8
  constructor(client) {
9
9
  this.client = client;
10
10
  }
11
+ /**
12
+ * POST auth/checkLogin
13
+ *
14
+ * Возможные коды ответа: {@link CheckLoginResult}
15
+ * @returns {@link ICheckLoginResponse}
16
+ *
17
+ * @example
18
+ * const result = await client.endpoints.auth.checkLogin({ login: 'user' });
19
+ */
20
+ async checkLogin(data, options) {
21
+ return await this.client.call({ path: `/auth/checkLogin`, method: 'POST', urlEncoded: data, ...options });
22
+ }
11
23
  /**
12
24
  * POST auth/firebase
13
25
  *
@@ -92,6 +104,18 @@ class Auth {
92
104
  async signInWithGoogle(data, options) {
93
105
  return await this.client.call({ path: `/auth/google`, method: 'POST', urlEncoded: data, ...options });
94
106
  }
107
+ /**
108
+ * POST auth/telegram
109
+ *
110
+ * Возможные коды ответа: {@link TelegramAuthResult}
111
+ * @returns {@link ITelegramAuthResponse}
112
+ *
113
+ * @example
114
+ * const result = await client.endpoints.auth.signInWithTelegram(...);
115
+ */
116
+ async signInWithTelegram(data, options) {
117
+ return await this.client.call({ path: `/auth/telegram`, method: 'POST', urlEncoded: data, ...options });
118
+ }
95
119
  /**
96
120
  * POST auth/vk
97
121
  *
@@ -128,6 +152,18 @@ class Auth {
128
152
  async signUpWithGoogle(data, options) {
129
153
  return await this.client.call({ path: `/auth/google`, method: 'POST', urlEncoded: data, ...options });
130
154
  }
155
+ /**
156
+ * POST auth/telegram
157
+ *
158
+ * Возможные коды ответа: {@link TelegramAuthResult}
159
+ * @returns {@link ITelegramAuthResponse}
160
+ *
161
+ * @example
162
+ * const result = await client.endpoints.auth.signUpWithTelegram(...);
163
+ */
164
+ async signUpWithTelegram(data, options) {
165
+ return await this.client.call({ path: `/auth/telegram`, method: 'POST', urlEncoded: data, ...options });
166
+ }
131
167
  /**
132
168
  * POST auth/vk
133
169
  *
@@ -1,5 +1,5 @@
1
1
  import { Anixart } from "../../client";
2
- import { IArticle, IArticleMuteResponse, IBaseApiParams, IChannel, IChannelBlockInfoResponse, IChannelBlockManageRequest, IChannelCreateRequest, IChannelMediaTokenResponse, IChannelPermissionManageRequest, IChannelPermissionManageResponse, IChannelPermissionsFilterRequest, IChannelProfile, IChannelResponse, IChannelSubscribeResponse, IChannelUnsubscribeResponse, IChannelUploadCoverAvatarResponse, IChannelsFilterRequest, IPageableResponse, ISubscriptionCountResponse } from "../../types";
2
+ import { IArticle, IArticleMuteResponse, IBaseApiParams, IChannel, IChannelBlockInfoResponse, IChannelBlockManageRequest, IChannelCreateRequest, IChannelMediaTokenResponse, IChannelPermissionManageRequest, IChannelPermissionManageResponse, IChannelPermissionsFilterRequest, IChannelProfile, IChannelResponse, IChannelSubscribeResponse, IChannelUnsubscribeResponse, IChannelUploadCoverAvatarResponse, IChannelsFilterRequest, IEditorChannelsResponse, IPageableResponse, ISubscriptionCountResponse } from "../../types";
3
3
  /**
4
4
  * Класс с эндпоинтами каналов
5
5
  */
@@ -146,6 +146,16 @@ export declare class Channel {
146
146
  * const result = await client.endpoints.channel.editorAvailable(1, ...);
147
147
  */
148
148
  editorAvailable(channelId: number, query?: Record<string, string | number | boolean | undefined>, options?: IBaseApiParams): Promise<IChannelMediaTokenResponse>;
149
+ /**
150
+ * GET channel/editor/available/all
151
+ *
152
+ * Возможные коды ответа: {@link DefaultResult}
153
+ * @returns {@link IEditorChannelsResponse}
154
+ *
155
+ * @example
156
+ * const result = await client.endpoints.channel.editorAvailableAll(...);
157
+ */
158
+ editorAvailableAll(options?: IBaseApiParams): Promise<IEditorChannelsResponse>;
149
159
  /**
150
160
  * POST channel/mute/{c_id}
151
161
  *
@@ -176,6 +176,18 @@ class Channel {
176
176
  async editorAvailable(channelId, query, options) {
177
177
  return await this.client.call({ path: `/channel/${channelId}/editor/available`, queryParams: query, ...options });
178
178
  }
179
+ /**
180
+ * GET channel/editor/available/all
181
+ *
182
+ * Возможные коды ответа: {@link DefaultResult}
183
+ * @returns {@link IEditorChannelsResponse}
184
+ *
185
+ * @example
186
+ * const result = await client.endpoints.channel.editorAvailableAll(...);
187
+ */
188
+ async editorAvailableAll(options) {
189
+ return await this.client.call({ path: `/channel/editor/available/all`, ...options });
190
+ }
179
191
  /**
180
192
  * POST channel/mute/{c_id}
181
193
  *
@@ -1,11 +1,21 @@
1
1
  import { Anixart } from "../client";
2
- import { IBaseApiParams, IConfigUrlsResponse, ITogglesResponse } from "../types";
2
+ import { IAnixPlayerConfigResponse, IBaseApiParams, IConfigUrlsResponse, ITogglesResponse } from "../types";
3
3
  /**
4
4
  * Класс с эндпоинтами конфигурации
5
5
  */
6
6
  export declare class Config {
7
7
  private readonly client;
8
8
  constructor(client: Anixart);
9
+ /**
10
+ * GET config/anixplayer
11
+ *
12
+ * Возможные коды ответа: {@link DefaultResult}
13
+ * @returns {@link IAnixPlayerConfigResponse}
14
+ *
15
+ * @example
16
+ * const result = await client.endpoints.config.anixplayer(...);
17
+ */
18
+ anixplayer(query?: Record<string, string | number | boolean | undefined>, options?: IBaseApiParams): Promise<IAnixPlayerConfigResponse>;
9
19
  /**
10
20
  * GET config/toggles
11
21
  *
@@ -8,6 +8,18 @@ class Config {
8
8
  constructor(client) {
9
9
  this.client = client;
10
10
  }
11
+ /**
12
+ * GET config/anixplayer
13
+ *
14
+ * Возможные коды ответа: {@link DefaultResult}
15
+ * @returns {@link IAnixPlayerConfigResponse}
16
+ *
17
+ * @example
18
+ * const result = await client.endpoints.config.anixplayer(...);
19
+ */
20
+ async anixplayer(query, options) {
21
+ return await this.client.call({ path: `/config/anixplayer`, queryParams: query, ...options });
22
+ }
11
23
  /**
12
24
  * GET config/toggles
13
25
  *
@@ -1,5 +1,5 @@
1
1
  import { Anixart } from "../../client";
2
- import { IBaseApiParams, IChangeEmailVerifyResponse, IChangeLoginInfoResponse, IChangeLoginResponse, IChangePasswordResponse, IGoogleBindResponse, IGoogleUnbindResponse, IPrivacyEditRequest, IProfileSettingsResponse, IProfileSocialResponse, IResponse, ISelectPinnedSectionRequest, ISelectThemeRequest, ISocialEditResponse, ISocialPagesEditRequest, IStatusEditRequest, IVkBindResponse, IVkUnbindResponse } from "../../types";
2
+ import { IBaseApiParams, IChangeEmailResendResponse, IChangeEmailResponse, IChangeEmailVerifyResponse, IChangeLoginInfoResponse, IChangeLoginResponse, IChangePasswordResponse, IEmailChangeRequest, IEmailChangeResendRequest, IGoogleBindResponse, IGoogleUnbindResponse, IPasswordChangeRequest, IPrivacyEditRequest, IProfileSettingsResponse, IProfileSocialResponse, IResponse, ISelectPinnedSectionRequest, ISelectThemeRequest, ISocialEditResponse, ISocialPagesEditRequest, IStatusEditRequest, ITelegramBindRequest, ITelegramBindResponse, ITelegramUnbindResponse, IVkBindResponse, IVkUnbindResponse } from "../../types";
3
3
  /**
4
4
  * Класс с эндпоинтами настроек профиля
5
5
  */
@@ -27,25 +27,25 @@ export declare class ProfilePreference {
27
27
  */
28
28
  avatarEdit(image?: Buffer, name?: string, options?: IBaseApiParams): Promise<IProfileSettingsResponse>;
29
29
  /**
30
- * GET profile/preference/email/change
30
+ * POST profile/preference/email/change
31
31
  *
32
- * Возможные коды ответа: {@link DefaultResult}
33
- * @returns {@link IResponse}
32
+ * Возможные коды ответа: {@link ChangeEmailResult}
33
+ * @returns {@link IChangeEmailResponse}
34
34
  *
35
35
  * @example
36
- * const result = await client.endpoints.profilePreference.changeEmail(...);
36
+ * const result = await client.endpoints.profilePreference.changeEmail({ current_email, current_password, new_email });
37
37
  */
38
- changeEmail(query?: Record<string, string | number | boolean | undefined>, options?: IBaseApiParams): Promise<IResponse>;
38
+ changeEmail(data: IEmailChangeRequest, options?: IBaseApiParams): Promise<IChangeEmailResponse>;
39
39
  /**
40
- * GET profile/preference/email/resend
40
+ * POST profile/preference/email/resend
41
41
  *
42
- * Возможные коды ответа: {@link DefaultResult}
43
- * @returns {@link IResponse}
42
+ * Возможные коды ответа: {@link ChangeEmailResendResult}
43
+ * @returns {@link IChangeEmailResendResponse}
44
44
  *
45
45
  * @example
46
- * const result = await client.endpoints.profilePreference.changeEmailResend(...);
46
+ * const result = await client.endpoints.profilePreference.changeEmailResend({ new_email, current_email, current_password, hash });
47
47
  */
48
- changeEmailResend(query?: Record<string, string | number | boolean | undefined>, options?: IBaseApiParams): Promise<IResponse>;
48
+ changeEmailResend(data: IEmailChangeResendRequest, options?: IBaseApiParams): Promise<IChangeEmailResendResponse>;
49
49
  /**
50
50
  * GET profile/preference/email/verify
51
51
  *
@@ -77,15 +77,25 @@ export declare class ProfilePreference {
77
77
  */
78
78
  changeLoginInfo(options?: IBaseApiParams): Promise<IChangeLoginInfoResponse>;
79
79
  /**
80
- * GET profile/preference/password/change
80
+ * POST profile/preference/password/change
81
81
  *
82
- * Возможные коды ответа: {@link DefaultResult}
82
+ * Возможные коды ответа: {@link ChangePasswordResult}
83
83
  * @returns {@link IChangePasswordResponse}
84
84
  *
85
85
  * @example
86
- * const result = await client.endpoints.profilePreference.changePassword(...);
86
+ * const result = await client.endpoints.profilePreference.changePassword({ current, new: newPassword });
87
+ */
88
+ changePassword(data: IPasswordChangeRequest, options?: IBaseApiParams): Promise<IChangePasswordResponse>;
89
+ /**
90
+ * POST profile/preference/episode-widget/edit
91
+ *
92
+ * Возможные коды ответа: {@link DefaultResult}
93
+ * @returns {@link IResponse}
94
+ *
95
+ * @example
96
+ * const result = await client.endpoints.profilePreference.episodeWidgetEdit(true);
87
97
  */
88
- changePassword(query?: Record<string, string | number | boolean | undefined>, options?: IBaseApiParams): Promise<IChangePasswordResponse>;
98
+ episodeWidgetEdit(hidden: boolean, options?: IBaseApiParams): Promise<IResponse>;
89
99
  /**
90
100
  * POST profile/preference/google/bind
91
101
  *
@@ -216,6 +226,26 @@ export declare class ProfilePreference {
216
226
  * const result = await client.endpoints.profilePreference.statusEdit(...);
217
227
  */
218
228
  statusEdit(body: IStatusEditRequest, options?: IBaseApiParams): Promise<IProfileSettingsResponse>;
229
+ /**
230
+ * POST profile/preference/telegram/bind
231
+ *
232
+ * Возможные коды ответа: {@link TelegramBindResult}
233
+ * @returns {@link ITelegramBindResponse}
234
+ *
235
+ * @example
236
+ * const result = await client.endpoints.profilePreference.telegramBind({ idToken });
237
+ */
238
+ telegramBind(data: ITelegramBindRequest, options?: IBaseApiParams): Promise<ITelegramBindResponse>;
239
+ /**
240
+ * POST profile/preference/telegram/unbind
241
+ *
242
+ * Возможные коды ответа: {@link TelegramUnbindResult}
243
+ * @returns {@link ITelegramUnbindResponse}
244
+ *
245
+ * @example
246
+ * const result = await client.endpoints.profilePreference.telegramUnbind();
247
+ */
248
+ telegramUnbind(options?: IBaseApiParams): Promise<ITelegramUnbindResponse>;
219
249
  /**
220
250
  * POST profile/preference/vk/bind
221
251
  *
@@ -33,28 +33,28 @@ class ProfilePreference {
33
33
  return await this.client.call({ path: `/profile/preference/avatar/edit`, method: 'POST', image: image ? { type: 'image', name: name !== null && name !== void 0 ? name : 'image.jpg', stream: image } : undefined, ...options });
34
34
  }
35
35
  /**
36
- * GET profile/preference/email/change
36
+ * POST profile/preference/email/change
37
37
  *
38
- * Возможные коды ответа: {@link DefaultResult}
39
- * @returns {@link IResponse}
38
+ * Возможные коды ответа: {@link ChangeEmailResult}
39
+ * @returns {@link IChangeEmailResponse}
40
40
  *
41
41
  * @example
42
- * const result = await client.endpoints.profilePreference.changeEmail(...);
42
+ * const result = await client.endpoints.profilePreference.changeEmail({ current_email, current_password, new_email });
43
43
  */
44
- async changeEmail(query, options) {
45
- return await this.client.call({ path: `/profile/preference/email/change`, queryParams: query, apiV2: true, ...options });
44
+ async changeEmail(data, options) {
45
+ return await this.client.call({ path: `/profile/preference/email/change`, method: 'POST', urlEncoded: data, apiV2: true, ...options });
46
46
  }
47
47
  /**
48
- * GET profile/preference/email/resend
48
+ * POST profile/preference/email/resend
49
49
  *
50
- * Возможные коды ответа: {@link DefaultResult}
51
- * @returns {@link IResponse}
50
+ * Возможные коды ответа: {@link ChangeEmailResendResult}
51
+ * @returns {@link IChangeEmailResendResponse}
52
52
  *
53
53
  * @example
54
- * const result = await client.endpoints.profilePreference.changeEmailResend(...);
54
+ * const result = await client.endpoints.profilePreference.changeEmailResend({ new_email, current_email, current_password, hash });
55
55
  */
56
- async changeEmailResend(query, options) {
57
- return await this.client.call({ path: `/profile/preference/email/resend`, queryParams: query, ...options });
56
+ async changeEmailResend(data, options) {
57
+ return await this.client.call({ path: `/profile/preference/email/resend`, method: 'POST', urlEncoded: data, ...options });
58
58
  }
59
59
  /**
60
60
  * GET profile/preference/email/verify
@@ -93,16 +93,28 @@ class ProfilePreference {
93
93
  return await this.client.call({ path: `/profile/preference/login/info`, method: 'POST', ...options });
94
94
  }
95
95
  /**
96
- * GET profile/preference/password/change
96
+ * POST profile/preference/password/change
97
97
  *
98
- * Возможные коды ответа: {@link DefaultResult}
98
+ * Возможные коды ответа: {@link ChangePasswordResult}
99
99
  * @returns {@link IChangePasswordResponse}
100
100
  *
101
101
  * @example
102
- * const result = await client.endpoints.profilePreference.changePassword(...);
102
+ * const result = await client.endpoints.profilePreference.changePassword({ current, new: newPassword });
103
+ */
104
+ async changePassword(data, options) {
105
+ return await this.client.call({ path: `/profile/preference/password/change`, method: 'POST', urlEncoded: data, ...options });
106
+ }
107
+ /**
108
+ * POST profile/preference/episode-widget/edit
109
+ *
110
+ * Возможные коды ответа: {@link DefaultResult}
111
+ * @returns {@link IResponse}
112
+ *
113
+ * @example
114
+ * const result = await client.endpoints.profilePreference.episodeWidgetEdit(true);
103
115
  */
104
- async changePassword(query, options) {
105
- return await this.client.call({ path: `/profile/preference/password/change`, queryParams: query, ...options });
116
+ async episodeWidgetEdit(hidden, options) {
117
+ return await this.client.call({ path: `/profile/preference/episode-widget/edit`, method: 'POST', queryParams: { hidden }, ...options });
106
118
  }
107
119
  /**
108
120
  * POST profile/preference/google/bind
@@ -260,6 +272,30 @@ class ProfilePreference {
260
272
  async statusEdit(body, options) {
261
273
  return await this.client.call({ path: `/profile/preference/status/edit`, method: 'POST', json: body, ...options });
262
274
  }
275
+ /**
276
+ * POST profile/preference/telegram/bind
277
+ *
278
+ * Возможные коды ответа: {@link TelegramBindResult}
279
+ * @returns {@link ITelegramBindResponse}
280
+ *
281
+ * @example
282
+ * const result = await client.endpoints.profilePreference.telegramBind({ idToken });
283
+ */
284
+ async telegramBind(data, options) {
285
+ return await this.client.call({ path: `/profile/preference/telegram/bind`, method: 'POST', urlEncoded: data, ...options });
286
+ }
287
+ /**
288
+ * POST profile/preference/telegram/unbind
289
+ *
290
+ * Возможные коды ответа: {@link TelegramUnbindResult}
291
+ * @returns {@link ITelegramUnbindResponse}
292
+ *
293
+ * @example
294
+ * const result = await client.endpoints.profilePreference.telegramUnbind();
295
+ */
296
+ async telegramUnbind(options) {
297
+ return await this.client.call({ path: `/profile/preference/telegram/unbind`, method: 'POST', ...options });
298
+ }
263
299
  /**
264
300
  * POST profile/preference/vk/bind
265
301
  *
@@ -1,11 +1,31 @@
1
1
  import { Anixart } from "../../client";
2
- import { IBaseApiParams, IResponse, ITypeResponse } from "../../types";
2
+ import { IBaseApiParams, IResponse, ITypeChannelResponse, ITypeResponse } from "../../types";
3
3
  /**
4
4
  * Класс с эндпоинтами типов озвучки
5
5
  */
6
6
  export declare class Type {
7
7
  private readonly client;
8
8
  constructor(client: Anixart);
9
+ /**
10
+ * GET type/{typeId}/channel
11
+ *
12
+ * Возможные коды ответа: {@link DefaultResult}
13
+ * @returns {@link ITypeChannelResponse}
14
+ *
15
+ * @example
16
+ * const result = await client.endpoints.type.channel(1, ...);
17
+ */
18
+ channel(typeId: number, options?: IBaseApiParams): Promise<ITypeChannelResponse>;
19
+ /**
20
+ * GET type/widget/hide/{typeId}
21
+ *
22
+ * Возможные коды ответа: {@link DefaultResult}
23
+ * @returns {@link IResponse}
24
+ *
25
+ * @example
26
+ * const result = await client.endpoints.type.hideWidget(1, true, ...);
27
+ */
28
+ hideWidget(typeId: number, permanent?: boolean, options?: IBaseApiParams): Promise<IResponse>;
9
29
  /**
10
30
  * GET type/pin/{releaseId}/{typeId}
11
31
  *
@@ -26,6 +46,16 @@ export declare class Type {
26
46
  * const result = await client.endpoints.type.types(...);
27
47
  */
28
48
  types(options?: IBaseApiParams): Promise<ITypeResponse>;
49
+ /**
50
+ * GET type/widget/unhide/{typeId}
51
+ *
52
+ * Возможные коды ответа: {@link DefaultResult}
53
+ * @returns {@link IResponse}
54
+ *
55
+ * @example
56
+ * const result = await client.endpoints.type.unhideWidget(1, ...);
57
+ */
58
+ unhideWidget(typeId: number, options?: IBaseApiParams): Promise<IResponse>;
29
59
  /**
30
60
  * GET type/unpin/{releaseId}/{typeId}
31
61
  *
@@ -8,6 +8,30 @@ class Type {
8
8
  constructor(client) {
9
9
  this.client = client;
10
10
  }
11
+ /**
12
+ * GET type/{typeId}/channel
13
+ *
14
+ * Возможные коды ответа: {@link DefaultResult}
15
+ * @returns {@link ITypeChannelResponse}
16
+ *
17
+ * @example
18
+ * const result = await client.endpoints.type.channel(1, ...);
19
+ */
20
+ async channel(typeId, options) {
21
+ return await this.client.call({ path: `/type/${typeId}/channel`, ...options });
22
+ }
23
+ /**
24
+ * GET type/widget/hide/{typeId}
25
+ *
26
+ * Возможные коды ответа: {@link DefaultResult}
27
+ * @returns {@link IResponse}
28
+ *
29
+ * @example
30
+ * const result = await client.endpoints.type.hideWidget(1, true, ...);
31
+ */
32
+ async hideWidget(typeId, permanent = false, options) {
33
+ return await this.client.call({ path: `/type/widget/hide/${typeId}`, queryParams: { permanent }, ...options });
34
+ }
11
35
  /**
12
36
  * GET type/pin/{releaseId}/{typeId}
13
37
  *
@@ -32,6 +56,18 @@ class Type {
32
56
  async types(options) {
33
57
  return await this.client.call({ path: `/type/all`, ...options });
34
58
  }
59
+ /**
60
+ * GET type/widget/unhide/{typeId}
61
+ *
62
+ * Возможные коды ответа: {@link DefaultResult}
63
+ * @returns {@link IResponse}
64
+ *
65
+ * @example
66
+ * const result = await client.endpoints.type.unhideWidget(1, ...);
67
+ */
68
+ async unhideWidget(typeId, options) {
69
+ return await this.client.call({ path: `/type/widget/unhide/${typeId}`, ...options });
70
+ }
35
71
  /**
36
72
  * GET type/unpin/{releaseId}/{typeId}
37
73
  *
package/dist/client.js CHANGED
@@ -22,7 +22,7 @@ const Release_1 = require("./classes/Release");
22
22
  const form_data_1 = __importDefault(require("form-data"));
23
23
  const Collection_1 = require("./classes/Collection");
24
24
  const DEFAULT_BASE_URL = 'https://api-s.anixsekai.com';
25
- const USER_AGENT = "AnixartApp/9.0 BETA 7-25082901 (Android 9; SDK 28; x86_64; ROG ASUS AI2201_B; ru)";
25
+ const USER_AGENT = "AnixartApp/9.0 BETA 19-26073118 (Android 9; SDK 28; x86_64; ROG ASUS AI2201_B; ru)";
26
26
  const API_ENDPOINTS_URL = 'https://raw.githubusercontent.com/AnixHelper/pages/refs/heads/main/urls.json';
27
27
  /**
28
28
  * Класс для работы с API Anixart
@@ -75,9 +75,49 @@ export interface ISignUpRequest {
75
75
  export interface ISignUpVerifyRequest extends ISignUpRequest {
76
76
  vkAccessToken?: string;
77
77
  googleIdToken?: string;
78
+ telegramIdToken?: string;
78
79
  hash: string;
79
80
  code: number;
80
81
  }
82
+ /** POST auth/checkLogin */
83
+ export interface ICheckLoginRequest {
84
+ login: string;
85
+ }
86
+ export declare enum CheckLoginResult {
87
+ InvalidLogin = 2
88
+ }
89
+ export interface ICheckLoginResponse extends IResponse<CheckLoginResult> {
90
+ available: boolean;
91
+ suggested_logins?: string[] | null;
92
+ }
93
+ /** POST auth/telegram (sign-in) */
94
+ export interface IOAuthTelegramSignInRequest {
95
+ telegramIdToken: string;
96
+ }
97
+ /** POST auth/telegram (sign-up) */
98
+ export interface IOAuthTelegramSignUpRequest {
99
+ login: string;
100
+ email: string;
101
+ telegramIdToken: string;
102
+ }
103
+ export declare enum TelegramAuthResult {
104
+ InvalidRequest = 2,
105
+ NotRegistered = 3,
106
+ InvalidLogin = 4,
107
+ InvalidEmail = 5,
108
+ LoginAlreadyTaken = 6,
109
+ EmailAlreadyTaken = 7,
110
+ CodeAlreadySend = 8,
111
+ EmailServiceDisallowed = 9,
112
+ TooManyRegistrations = 10
113
+ }
114
+ export interface ITelegramAuthResponse extends IResponse<TelegramAuthResult> {
115
+ profile?: IProfile;
116
+ profileToken?: IProfileToken;
117
+ hash?: string;
118
+ codeTimestampExpires?: number;
119
+ suggested_logins?: string[] | null;
120
+ }
81
121
  export interface ILoginRequest {
82
122
  login: string;
83
123
  password: string;
@@ -88,6 +128,7 @@ export interface IResendRequest {
88
128
  password?: string;
89
129
  vkAccessToken?: string;
90
130
  googleIdToken?: string;
131
+ telegramIdToken?: string;
91
132
  hash: string;
92
133
  }
93
134
  export interface IRestoreResendRequest {
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RestorePasswordVerifyResult = exports.RestorePasswordResult = exports.RegisterVerifyResult = exports.RegisterResult = exports.LoginResult = void 0;
3
+ exports.TelegramAuthResult = exports.CheckLoginResult = exports.RestorePasswordVerifyResult = exports.RestorePasswordResult = exports.RegisterVerifyResult = exports.RegisterResult = exports.LoginResult = void 0;
4
4
  var LoginResult;
5
5
  (function (LoginResult) {
6
6
  LoginResult[LoginResult["InvalidLogin"] = 2] = "InvalidLogin";
@@ -45,3 +45,19 @@ var RestorePasswordVerifyResult;
45
45
  RestorePasswordVerifyResult[RestorePasswordVerifyResult["CodeExpired"] = 5] = "CodeExpired";
46
46
  RestorePasswordVerifyResult[RestorePasswordVerifyResult["InvalidHash"] = 6] = "InvalidHash";
47
47
  })(RestorePasswordVerifyResult || (exports.RestorePasswordVerifyResult = RestorePasswordVerifyResult = {}));
48
+ var CheckLoginResult;
49
+ (function (CheckLoginResult) {
50
+ CheckLoginResult[CheckLoginResult["InvalidLogin"] = 2] = "InvalidLogin";
51
+ })(CheckLoginResult || (exports.CheckLoginResult = CheckLoginResult = {}));
52
+ var TelegramAuthResult;
53
+ (function (TelegramAuthResult) {
54
+ TelegramAuthResult[TelegramAuthResult["InvalidRequest"] = 2] = "InvalidRequest";
55
+ TelegramAuthResult[TelegramAuthResult["NotRegistered"] = 3] = "NotRegistered";
56
+ TelegramAuthResult[TelegramAuthResult["InvalidLogin"] = 4] = "InvalidLogin";
57
+ TelegramAuthResult[TelegramAuthResult["InvalidEmail"] = 5] = "InvalidEmail";
58
+ TelegramAuthResult[TelegramAuthResult["LoginAlreadyTaken"] = 6] = "LoginAlreadyTaken";
59
+ TelegramAuthResult[TelegramAuthResult["EmailAlreadyTaken"] = 7] = "EmailAlreadyTaken";
60
+ TelegramAuthResult[TelegramAuthResult["CodeAlreadySend"] = 8] = "CodeAlreadySend";
61
+ TelegramAuthResult[TelegramAuthResult["EmailServiceDisallowed"] = 9] = "EmailServiceDisallowed";
62
+ TelegramAuthResult[TelegramAuthResult["TooManyRegistrations"] = 10] = "TooManyRegistrations";
63
+ })(TelegramAuthResult || (exports.TelegramAuthResult = TelegramAuthResult = {}));
@@ -342,6 +342,25 @@ export interface IChannelCompact {
342
342
  permission?: number;
343
343
  title?: string;
344
344
  }
345
+ /** GET channel/editor/available/all */
346
+ export interface IEditorChannel {
347
+ id: number;
348
+ title: string;
349
+ avatar?: string | null;
350
+ subscriber_count: number;
351
+ is_blog: boolean;
352
+ }
353
+ export interface IEditorChannelsResponse extends IResponse {
354
+ channels: IEditorChannel[];
355
+ }
356
+ /** GET type/{typeId}/channel */
357
+ export interface ITypeChannelResponse extends IResponse {
358
+ channel?: IChannel | null;
359
+ articles: IArticle[];
360
+ is_hidden_by_user: boolean;
361
+ are_widgets_hidden_globally: boolean;
362
+ is_widget_eligible: boolean;
363
+ }
345
364
  export interface IArticleCommentCompact {
346
365
  article?: IArticle;
347
366
  embeddable_description?: string;
@@ -1,5 +1,5 @@
1
1
  import { IResponse } from "./response";
2
- export declare const DEFAULT_VERSION_CODE = 25082901;
2
+ export declare const DEFAULT_VERSION_CODE = 26073118;
3
3
  export interface IConfigRequest {
4
4
  versionCode?: number;
5
5
  beta?: boolean;
@@ -39,3 +39,9 @@ export interface ITogglesResponse extends IResponse {
39
39
  export interface ILatestArticleResponse extends IResponse {
40
40
  article_id?: number | null;
41
41
  }
42
+ /** GET config/anixplayer */
43
+ export interface IAnixPlayerConfigResponse extends IResponse {
44
+ last_version_code: number;
45
+ whats_new: string;
46
+ download_links: Record<string, string>;
47
+ }
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DEFAULT_VERSION_CODE = void 0;
4
- exports.DEFAULT_VERSION_CODE = 25082901;
4
+ exports.DEFAULT_VERSION_CODE = 26073118;
@@ -274,6 +274,8 @@ export declare enum BlocklistAddResult {
274
274
  }
275
275
  export interface IChangeLogin {
276
276
  id: number;
277
+ newLogin?: string;
278
+ new_login?: string;
277
279
  timestamp: number;
278
280
  }
279
281
  export interface IProfileSocialResponse extends IResponse {
@@ -15,6 +15,9 @@ export interface IProfileSettingsResponse extends IResponse {
15
15
  isVkBound: boolean;
16
16
  is_goolge_bound: boolean;
17
17
  isGoogleBound: boolean;
18
+ is_telegram_bound?: boolean;
19
+ isTelegramBound?: boolean;
20
+ episode_channel_widgets_hidden?: boolean;
18
21
  is_login_changed: boolean;
19
22
  isLoginChanged: boolean;
20
23
  is_change_login_banned: boolean;
@@ -29,10 +32,27 @@ export interface IBadgesResponse extends IPageableResponse<IBadge> {
29
32
  export interface IEmailChangeConfirmResponse extends IResponse<ChangeEmailConfirmResult> {
30
33
  emailHint: string;
31
34
  }
35
+ /** POST profile/preference/email/change */
32
36
  export interface IEmailChangeRequest {
33
- oldEmail: string;
34
- newEmail: string;
35
- password: string;
37
+ current_email: string;
38
+ current_password: string;
39
+ new_email: string;
40
+ }
41
+ /** POST profile/preference/email/resend */
42
+ export interface IEmailChangeResendRequest {
43
+ new_email: string;
44
+ current_email: string;
45
+ current_password: string;
46
+ hash: string;
47
+ }
48
+ /** POST profile/preference/password/change */
49
+ export interface IPasswordChangeRequest {
50
+ current: string;
51
+ new: string;
52
+ }
53
+ /** POST profile/preference/telegram/bind */
54
+ export interface ITelegramBindRequest {
55
+ idToken: string;
36
56
  }
37
57
  export interface ILoginInfoResponse extends IResponse {
38
58
  login: string;
@@ -60,9 +80,25 @@ export declare enum ChangeLoginResult {
60
80
  TimeLimit = 4
61
81
  }
62
82
  export declare enum ChangeEmailResult {
63
- InvalidEmail = 2,
64
- InvalidCurrentEmail = 3,
65
- EmailAlreadyTaken = 4
83
+ InvalidPassword = 2,
84
+ InvalidOldEmail = 3,
85
+ InvalidEmail = 4,
86
+ EmailAlreadyTaken = 5,
87
+ CodeAlreadySend = 6,
88
+ CodeCannotSend = 7
89
+ }
90
+ export declare enum ChangeEmailResendResult {
91
+ InvalidPassword = 2,
92
+ InvalidOldEmail = 3,
93
+ InvalidHash = 4,
94
+ CodeCannotSend = 5
95
+ }
96
+ export declare enum TelegramBindResult {
97
+ InvalidRequest = 2,
98
+ TelegramAlreadyBound = 3
99
+ }
100
+ export declare enum TelegramUnbindResult {
101
+ TelegramNotBound = 2
66
102
  }
67
103
  export declare enum ChangeEmailConfirmResult {
68
104
  InvalidPassword = 2
@@ -93,6 +129,13 @@ export interface ISelectThemeRequest {
93
129
  export interface ISelectPinnedSectionRequest {
94
130
  section: number;
95
131
  }
132
+ export interface IChangeEmailResponse extends IResponse<ChangeEmailResult> {
133
+ hash?: string;
134
+ timestamp_expires?: number;
135
+ }
136
+ export interface IChangeEmailResendResponse extends IResponse<ChangeEmailResendResult> {
137
+ timestamp_expires?: number;
138
+ }
96
139
  export interface IChangeEmailVerifyResponse extends IResponse {
97
140
  }
98
141
  export interface IChangeLoginInfoResponse extends IResponse {
@@ -102,13 +145,17 @@ export interface IChangeLoginInfoResponse extends IResponse {
102
145
  }
103
146
  export interface IChangeLoginResponse extends IResponse {
104
147
  }
105
- export interface IChangePasswordResponse extends IResponse {
148
+ export interface IChangePasswordResponse extends IResponse<ChangePasswordResult> {
106
149
  token?: string;
107
150
  }
108
151
  export interface IGoogleBindResponse extends IResponse {
109
152
  }
110
153
  export interface IGoogleUnbindResponse extends IResponse {
111
154
  }
155
+ export interface ITelegramBindResponse extends IResponse<TelegramBindResult> {
156
+ }
157
+ export interface ITelegramUnbindResponse extends IResponse<TelegramUnbindResult> {
158
+ }
112
159
  export interface IVkBindResponse extends IResponse {
113
160
  }
114
161
  export interface IVkUnbindResponse extends IResponse {
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PrivacyFriendRequestState = exports.PrivacyState = exports.PasswordChangeResult = exports.ChangePasswordResult = exports.ChangeEmailConfirmResult = exports.ChangeEmailResult = exports.ChangeLoginResult = exports.SocialEditResult = void 0;
3
+ exports.PrivacyFriendRequestState = exports.PrivacyState = exports.PasswordChangeResult = exports.ChangePasswordResult = exports.ChangeEmailConfirmResult = exports.TelegramUnbindResult = exports.TelegramBindResult = exports.ChangeEmailResendResult = exports.ChangeEmailResult = exports.ChangeLoginResult = exports.SocialEditResult = void 0;
4
4
  var SocialEditResult;
5
5
  (function (SocialEditResult) {
6
6
  SocialEditResult[SocialEditResult["InvalidVk"] = 2] = "InvalidVk";
@@ -17,10 +17,29 @@ var ChangeLoginResult;
17
17
  })(ChangeLoginResult || (exports.ChangeLoginResult = ChangeLoginResult = {}));
18
18
  var ChangeEmailResult;
19
19
  (function (ChangeEmailResult) {
20
- ChangeEmailResult[ChangeEmailResult["InvalidEmail"] = 2] = "InvalidEmail";
21
- ChangeEmailResult[ChangeEmailResult["InvalidCurrentEmail"] = 3] = "InvalidCurrentEmail";
22
- ChangeEmailResult[ChangeEmailResult["EmailAlreadyTaken"] = 4] = "EmailAlreadyTaken";
20
+ ChangeEmailResult[ChangeEmailResult["InvalidPassword"] = 2] = "InvalidPassword";
21
+ ChangeEmailResult[ChangeEmailResult["InvalidOldEmail"] = 3] = "InvalidOldEmail";
22
+ ChangeEmailResult[ChangeEmailResult["InvalidEmail"] = 4] = "InvalidEmail";
23
+ ChangeEmailResult[ChangeEmailResult["EmailAlreadyTaken"] = 5] = "EmailAlreadyTaken";
24
+ ChangeEmailResult[ChangeEmailResult["CodeAlreadySend"] = 6] = "CodeAlreadySend";
25
+ ChangeEmailResult[ChangeEmailResult["CodeCannotSend"] = 7] = "CodeCannotSend";
23
26
  })(ChangeEmailResult || (exports.ChangeEmailResult = ChangeEmailResult = {}));
27
+ var ChangeEmailResendResult;
28
+ (function (ChangeEmailResendResult) {
29
+ ChangeEmailResendResult[ChangeEmailResendResult["InvalidPassword"] = 2] = "InvalidPassword";
30
+ ChangeEmailResendResult[ChangeEmailResendResult["InvalidOldEmail"] = 3] = "InvalidOldEmail";
31
+ ChangeEmailResendResult[ChangeEmailResendResult["InvalidHash"] = 4] = "InvalidHash";
32
+ ChangeEmailResendResult[ChangeEmailResendResult["CodeCannotSend"] = 5] = "CodeCannotSend";
33
+ })(ChangeEmailResendResult || (exports.ChangeEmailResendResult = ChangeEmailResendResult = {}));
34
+ var TelegramBindResult;
35
+ (function (TelegramBindResult) {
36
+ TelegramBindResult[TelegramBindResult["InvalidRequest"] = 2] = "InvalidRequest";
37
+ TelegramBindResult[TelegramBindResult["TelegramAlreadyBound"] = 3] = "TelegramAlreadyBound";
38
+ })(TelegramBindResult || (exports.TelegramBindResult = TelegramBindResult = {}));
39
+ var TelegramUnbindResult;
40
+ (function (TelegramUnbindResult) {
41
+ TelegramUnbindResult[TelegramUnbindResult["TelegramNotBound"] = 2] = "TelegramNotBound";
42
+ })(TelegramUnbindResult || (exports.TelegramUnbindResult = TelegramUnbindResult = {}));
24
43
  var ChangeEmailConfirmResult;
25
44
  (function (ChangeEmailConfirmResult) {
26
45
  ChangeEmailConfirmResult[ChangeEmailConfirmResult["InvalidPassword"] = 2] = "InvalidPassword";
@@ -20,20 +20,18 @@ class KodikParser {
20
20
  return atob(latestEndpoint);
21
21
  }
22
22
  static async getDirectLinks(url, endpointPath = this._endpointUrl) {
23
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
23
+ var _a, _b, _c, _d, _e, _f;
24
24
  const urlResponse = await (await fetch(url)).text();
25
- const urlParams = JSON.parse((_c = (_b = (_a = urlResponse.match(/var\surlParams\s=\s'(?<params>.*?)';/is)) === null || _a === void 0 ? void 0 : _a.groups) === null || _b === void 0 ? void 0 : _b.params) !== null && _c !== void 0 ? _c : "{}");
26
- const videoInfoHash = (_e = (_d = urlResponse.match(/\w+.hash\s=\s'(?<hash>.*?)';/is)) === null || _d === void 0 ? void 0 : _d.groups) === null || _e === void 0 ? void 0 : _e.hash;
27
- const videoInfoId = (_g = (_f = urlResponse.match(/\w+.id\s=\s'(?<id>.*?)';/is)) === null || _f === void 0 ? void 0 : _f.groups) === null || _g === void 0 ? void 0 : _g.id;
28
- const videoInfoType = (_j = (_h = urlResponse.match(/\w+.type\s=\s'(?<type>.*?)';/)) === null || _h === void 0 ? void 0 : _h.groups) === null || _j === void 0 ? void 0 : _j.type;
25
+ const videoInfoHash = (_b = (_a = urlResponse.match(/\w+.hash\s=\s'(?<hash>.*?)';/is)) === null || _a === void 0 ? void 0 : _a.groups) === null || _b === void 0 ? void 0 : _b.hash;
26
+ const videoInfoId = (_d = (_c = urlResponse.match(/\w+.id\s=\s'(?<id>.*?)';/is)) === null || _c === void 0 ? void 0 : _c.groups) === null || _d === void 0 ? void 0 : _d.id;
27
+ const videoInfoType = (_f = (_e = urlResponse.match(/\w+.type\s=\s'(?<type>.*?)';/)) === null || _e === void 0 ? void 0 : _e.groups) === null || _f === void 0 ? void 0 : _f.type;
29
28
  const validKodikUrl = /\/\/(get|cloud)\.(kodik-storage|solodcdn)\.com\/useruploads\/.*?\/.*?\/(240|360|480|720|1080)\.mp4:hls:manifest.m3u8/s;
30
29
  if (!videoInfoHash || !videoInfoId || !videoInfoType)
31
30
  return null;
32
31
  const requestBody = {
33
- ...urlParams,
34
32
  type: videoInfoType,
35
33
  hash: videoInfoHash,
36
- id: videoInfoId
34
+ id: videoInfoId,
37
35
  };
38
36
  const directLinksResponse = await fetch(`https://${this._baseKodikDomain}${endpointPath}?${new URLSearchParams(requestBody).toString()}`, {
39
37
  referrer: '',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "anixapi",
3
- "version": "0.2.1",
3
+ "version": "0.3.0",
4
4
  "description": "Unofficial Anixart API wrapper for Node.js (TypeScript)",
5
5
  "type": "commonjs",
6
6
  "main": "dist/index.js",