anixapi 0.3.0 → 0.3.2
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 +45 -7
- package/dist/api/auth.d.ts +33 -13
- package/dist/api/auth.js +32 -8
- package/dist/api/profile/profilePreference.d.ts +32 -12
- package/dist/api/profile/profilePreference.js +40 -9
- package/dist/classes/Dubber.d.ts +1 -0
- package/dist/classes/Dubber.js +1 -0
- package/dist/classes/FullProfile.d.ts +2 -0
- package/dist/classes/FullProfile.js +3 -1
- package/dist/types/auth.d.ts +52 -1
- package/dist/types/auth.js +29 -1
- package/dist/types/config.d.ts +9 -1
- package/dist/types/config.js +2 -1
- package/dist/types/profile.d.ts +4 -0
- package/dist/types/release.d.ts +2 -0
- package/dist/types/settings.d.ts +59 -6
- package/dist/types/settings.js +28 -1
- package/docs/DOCUMENTATION.md +19 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
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
|
|
5
|
+
> **Миграция с [theDesConnet/AnixartJS](https://github.com/theDesConnet/AnixartJS).** Плавного перехода на AnixApi **не будет**. Изменились структура `src/api`, имена эндпоинтов, типы, обработка ошибок (`AnixApiError`) и покрытие API 9.0. При переносе с версии DesConnet закладывайте время на переписывание вызовов, импортов и проверку ответов. Подробности — в [документации](docs/DOCUMENTATION.md).
|
|
6
6
|
|
|
7
7
|
<h2 align="center">AnixApi</h2>
|
|
8
8
|
|
|
9
9
|
<p align="center">
|
|
10
10
|
TypeScript-обёртка над API Anixart 9.x для Node.js.<br>
|
|
11
|
-
|
|
11
|
+
286 эндпоинтов · OAuth (VK / Google / Telegram / Yandex) · типизация · доменные классы
|
|
12
12
|
</p>
|
|
13
13
|
|
|
14
14
|
<p align="center">
|
|
@@ -16,6 +16,10 @@
|
|
|
16
16
|
<a href="LICENSE">Лицензия GPL-2.0</a>
|
|
17
17
|
</p>
|
|
18
18
|
|
|
19
|
+
<p align="center">
|
|
20
|
+
<code>anixapi@0.3.1</code> · актуально под <strong>Anixart 9.0 BETA 21</strong> (build <code>26080522</code>)
|
|
21
|
+
</p>
|
|
22
|
+
|
|
19
23
|
---
|
|
20
24
|
|
|
21
25
|
## О проекте
|
|
@@ -30,7 +34,7 @@
|
|
|
30
34
|
|---|---|
|
|
31
35
|
| **Оригинальный репозиторий** | https://github.com/theDesConnet/AnixartJS |
|
|
32
36
|
| **Базовая архитектура API** | DesConnet |
|
|
33
|
-
| **Расширения** |
|
|
37
|
+
| **Расширения** | покрытие API 9.0 (до beta 21), реструктуризация `src/api`, типы, `AnixApiError`, OAuth-провайдеры, `typecheck` в сборке |
|
|
34
38
|
|
|
35
39
|
При публикации изменений обязательно сохраняйте указание на оригинальный проект и условия GPL-2.0.
|
|
36
40
|
|
|
@@ -54,14 +58,47 @@ if (code === DefaultResult.Ok) {
|
|
|
54
58
|
}
|
|
55
59
|
```
|
|
56
60
|
|
|
61
|
+
### OAuth (VK / Google / Telegram / Yandex)
|
|
62
|
+
|
|
63
|
+
```javascript
|
|
64
|
+
const { Anixart, DefaultResult, OAuthAuthResult } = require("anixapi");
|
|
65
|
+
|
|
66
|
+
const client = new Anixart();
|
|
67
|
+
|
|
68
|
+
// Вход: при code === 3 (NotRegistered) нужно signUpWith*
|
|
69
|
+
const res = await client.endpoints.auth.signInWithYandex({
|
|
70
|
+
yandexAccessToken: "...",
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
if (res.code === DefaultResult.Ok && res.profileToken) {
|
|
74
|
+
client.setToken(res.profileToken.token);
|
|
75
|
+
} else if (res.code === OAuthAuthResult.NotRegistered) {
|
|
76
|
+
await client.endpoints.auth.signUpWithYandex({
|
|
77
|
+
login: "newuser",
|
|
78
|
+
email: res.email || "user@example.com",
|
|
79
|
+
yandexAccessToken: "...",
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
| Провайдер | Sign-in | Поле токена |
|
|
85
|
+
|-----------|---------|-------------|
|
|
86
|
+
| VK | `signInWithVk` | `vkAccessToken` |
|
|
87
|
+
| Google | `signInWithGoogle` | `googleIdToken` |
|
|
88
|
+
| Telegram | `signInWithTelegram` | `telegramIdToken` |
|
|
89
|
+
| Yandex | `signInWithYandex` | `yandexAccessToken` |
|
|
90
|
+
|
|
91
|
+
Флаги доступности: `GET config/urls` → `vk_auth_available`, `google_auth_available`, `telegram_auth_available`, `yandex_auth_available`.
|
|
92
|
+
|
|
57
93
|
Подробные примеры, структура API и обработка ошибок — в **[документации](docs/DOCUMENTATION.md)**.
|
|
58
94
|
|
|
59
95
|
---
|
|
60
96
|
|
|
61
97
|
## Возможности
|
|
62
98
|
|
|
63
|
-
- **
|
|
64
|
-
- **
|
|
99
|
+
- **286 эндпоинтов** — `client.endpoints.*` (Anixart 9.0 BETA 21)
|
|
100
|
+
- **OAuth** — VK, Google, Telegram, Yandex (sign-in / sign-up / bind / unbind)
|
|
101
|
+
- **TypeScript** — типы запросов, ответов и enum-кодов (`LoginResult`, `OAuthAuthResult`, …)
|
|
65
102
|
- **Доменные классы** — `Article`, `Channel`, `Release`, `FullProfile`, `Collection`
|
|
66
103
|
- **Ошибки** — `AnixApiError`, `describeResultCode()`, опция `throwOnApiError`
|
|
67
104
|
|
|
@@ -69,8 +106,9 @@ if (code === DefaultResult.Ok) {
|
|
|
69
106
|
|
|
70
107
|
## TODO
|
|
71
108
|
|
|
72
|
-
- [x] Все эндпоинты API (
|
|
73
|
-
- [x]
|
|
109
|
+
- [x] Все эндпоинты API (286, beta 21)
|
|
110
|
+
- [x] OAuth: VK / Google / Telegram / Yandex
|
|
111
|
+
- [x] Типы и документация
|
|
74
112
|
- [x] Классы для коллекций
|
|
75
113
|
- [ ] Возможность использовать библиотеку в браузере полностью
|
|
76
114
|
|
package/dist/api/auth.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Anixart } from "../client";
|
|
2
|
-
import { IBaseApiParams, ICheckLoginRequest, ICheckLoginResponse, ILoginRequest, ILoginResponse, IOAuthGoogleSignInRequest, IOAuthGoogleSignUpRequest, IOAuthTelegramSignInRequest, IOAuthTelegramSignUpRequest, IOAuthVkSignInRequest, IOAuthVkSignUpRequest, IRegisterResponse, IResendRequest, IResponse, IRestoreEmailRequest, IRestoreResendRequest, IRestoreVerifyRequest, ISignUpRequest, ISignUpVerifyRequest, ITelegramAuthResponse } from "../types";
|
|
2
|
+
import { IBaseApiParams, ICheckLoginRequest, ICheckLoginResponse, IGoogleAuthResponse, ILoginRequest, ILoginResponse, IOAuthGoogleSignInRequest, IOAuthGoogleSignUpRequest, IOAuthTelegramSignInRequest, IOAuthTelegramSignUpRequest, IOAuthVkSignInRequest, IOAuthVkSignUpRequest, IOAuthYandexSignInRequest, IOAuthYandexSignUpRequest, IRegisterResponse, IResendRequest, IResponse, IRestoreEmailRequest, IRestoreResendRequest, IRestoreVerifyRequest, ISignUpRequest, ISignUpVerifyRequest, ITelegramAuthResponse, IVkAuthResponse, IYandexAuthResponse } from "../types";
|
|
3
3
|
/**
|
|
4
4
|
* Класс с эндпоинтами авторизации
|
|
5
5
|
*/
|
|
@@ -79,13 +79,13 @@ export declare class Auth {
|
|
|
79
79
|
/**
|
|
80
80
|
* POST auth/google
|
|
81
81
|
*
|
|
82
|
-
* Возможные коды ответа: {@link
|
|
83
|
-
* @returns {@link
|
|
82
|
+
* Возможные коды ответа: {@link GoogleAuthResult}
|
|
83
|
+
* @returns {@link IGoogleAuthResponse}
|
|
84
84
|
*
|
|
85
85
|
* @example
|
|
86
86
|
* const result = await client.endpoints.auth.signInWithGoogle(...);
|
|
87
87
|
*/
|
|
88
|
-
signInWithGoogle(data: IOAuthGoogleSignInRequest, options?: IBaseApiParams): Promise<
|
|
88
|
+
signInWithGoogle(data: IOAuthGoogleSignInRequest, options?: IBaseApiParams): Promise<IGoogleAuthResponse>;
|
|
89
89
|
/**
|
|
90
90
|
* POST auth/telegram
|
|
91
91
|
*
|
|
@@ -99,13 +99,23 @@ export declare class Auth {
|
|
|
99
99
|
/**
|
|
100
100
|
* POST auth/vk
|
|
101
101
|
*
|
|
102
|
-
* Возможные коды ответа: {@link
|
|
103
|
-
* @returns {@link
|
|
102
|
+
* Возможные коды ответа: {@link OAuthAuthResult}
|
|
103
|
+
* @returns {@link IVkAuthResponse}
|
|
104
104
|
*
|
|
105
105
|
* @example
|
|
106
106
|
* const result = await client.endpoints.auth.signInWithVk(...);
|
|
107
107
|
*/
|
|
108
|
-
signInWithVk(data: IOAuthVkSignInRequest, options?: IBaseApiParams): Promise<
|
|
108
|
+
signInWithVk(data: IOAuthVkSignInRequest, options?: IBaseApiParams): Promise<IVkAuthResponse>;
|
|
109
|
+
/**
|
|
110
|
+
* POST auth/yandex (с beta 21)
|
|
111
|
+
*
|
|
112
|
+
* Возможные коды ответа: {@link OAuthAuthResult}
|
|
113
|
+
* @returns {@link IYandexAuthResponse}
|
|
114
|
+
*
|
|
115
|
+
* @example
|
|
116
|
+
* const result = await client.endpoints.auth.signInWithYandex({ yandexAccessToken });
|
|
117
|
+
*/
|
|
118
|
+
signInWithYandex(data: IOAuthYandexSignInRequest, options?: IBaseApiParams): Promise<IYandexAuthResponse>;
|
|
109
119
|
/**
|
|
110
120
|
* POST auth/signUp
|
|
111
121
|
*
|
|
@@ -119,13 +129,13 @@ export declare class Auth {
|
|
|
119
129
|
/**
|
|
120
130
|
* POST auth/google
|
|
121
131
|
*
|
|
122
|
-
* Возможные коды ответа: {@link
|
|
123
|
-
* @returns {@link
|
|
132
|
+
* Возможные коды ответа: {@link GoogleAuthResult}
|
|
133
|
+
* @returns {@link IGoogleAuthResponse}
|
|
124
134
|
*
|
|
125
135
|
* @example
|
|
126
136
|
* const result = await client.endpoints.auth.signUpWithGoogle(...);
|
|
127
137
|
*/
|
|
128
|
-
signUpWithGoogle(data: IOAuthGoogleSignUpRequest, options?: IBaseApiParams): Promise<
|
|
138
|
+
signUpWithGoogle(data: IOAuthGoogleSignUpRequest, options?: IBaseApiParams): Promise<IGoogleAuthResponse>;
|
|
129
139
|
/**
|
|
130
140
|
* POST auth/telegram
|
|
131
141
|
*
|
|
@@ -139,13 +149,23 @@ export declare class Auth {
|
|
|
139
149
|
/**
|
|
140
150
|
* POST auth/vk
|
|
141
151
|
*
|
|
142
|
-
* Возможные коды ответа: {@link
|
|
143
|
-
* @returns {@link
|
|
152
|
+
* Возможные коды ответа: {@link OAuthAuthResult}
|
|
153
|
+
* @returns {@link IVkAuthResponse}
|
|
144
154
|
*
|
|
145
155
|
* @example
|
|
146
156
|
* const result = await client.endpoints.auth.signUpWithVk(...);
|
|
147
157
|
*/
|
|
148
|
-
signUpWithVk(data: IOAuthVkSignUpRequest, options?: IBaseApiParams): Promise<
|
|
158
|
+
signUpWithVk(data: IOAuthVkSignUpRequest, options?: IBaseApiParams): Promise<IVkAuthResponse>;
|
|
159
|
+
/**
|
|
160
|
+
* POST auth/yandex (с beta 21)
|
|
161
|
+
*
|
|
162
|
+
* Возможные коды ответа: {@link OAuthAuthResult}
|
|
163
|
+
* @returns {@link IYandexAuthResponse}
|
|
164
|
+
*
|
|
165
|
+
* @example
|
|
166
|
+
* const result = await client.endpoints.auth.signUpWithYandex({ login, email, yandexAccessToken });
|
|
167
|
+
*/
|
|
168
|
+
signUpWithYandex(data: IOAuthYandexSignUpRequest, options?: IBaseApiParams): Promise<IYandexAuthResponse>;
|
|
149
169
|
/**
|
|
150
170
|
* POST auth/verify
|
|
151
171
|
*
|
package/dist/api/auth.js
CHANGED
|
@@ -95,8 +95,8 @@ class Auth {
|
|
|
95
95
|
/**
|
|
96
96
|
* POST auth/google
|
|
97
97
|
*
|
|
98
|
-
* Возможные коды ответа: {@link
|
|
99
|
-
* @returns {@link
|
|
98
|
+
* Возможные коды ответа: {@link GoogleAuthResult}
|
|
99
|
+
* @returns {@link IGoogleAuthResponse}
|
|
100
100
|
*
|
|
101
101
|
* @example
|
|
102
102
|
* const result = await client.endpoints.auth.signInWithGoogle(...);
|
|
@@ -119,8 +119,8 @@ class Auth {
|
|
|
119
119
|
/**
|
|
120
120
|
* POST auth/vk
|
|
121
121
|
*
|
|
122
|
-
* Возможные коды ответа: {@link
|
|
123
|
-
* @returns {@link
|
|
122
|
+
* Возможные коды ответа: {@link OAuthAuthResult}
|
|
123
|
+
* @returns {@link IVkAuthResponse}
|
|
124
124
|
*
|
|
125
125
|
* @example
|
|
126
126
|
* const result = await client.endpoints.auth.signInWithVk(...);
|
|
@@ -128,6 +128,18 @@ class Auth {
|
|
|
128
128
|
async signInWithVk(data, options) {
|
|
129
129
|
return await this.client.call({ path: `/auth/vk`, method: 'POST', urlEncoded: data, ...options });
|
|
130
130
|
}
|
|
131
|
+
/**
|
|
132
|
+
* POST auth/yandex (с beta 21)
|
|
133
|
+
*
|
|
134
|
+
* Возможные коды ответа: {@link OAuthAuthResult}
|
|
135
|
+
* @returns {@link IYandexAuthResponse}
|
|
136
|
+
*
|
|
137
|
+
* @example
|
|
138
|
+
* const result = await client.endpoints.auth.signInWithYandex({ yandexAccessToken });
|
|
139
|
+
*/
|
|
140
|
+
async signInWithYandex(data, options) {
|
|
141
|
+
return await this.client.call({ path: `/auth/yandex`, method: 'POST', urlEncoded: data, ...options });
|
|
142
|
+
}
|
|
131
143
|
/**
|
|
132
144
|
* POST auth/signUp
|
|
133
145
|
*
|
|
@@ -143,8 +155,8 @@ class Auth {
|
|
|
143
155
|
/**
|
|
144
156
|
* POST auth/google
|
|
145
157
|
*
|
|
146
|
-
* Возможные коды ответа: {@link
|
|
147
|
-
* @returns {@link
|
|
158
|
+
* Возможные коды ответа: {@link GoogleAuthResult}
|
|
159
|
+
* @returns {@link IGoogleAuthResponse}
|
|
148
160
|
*
|
|
149
161
|
* @example
|
|
150
162
|
* const result = await client.endpoints.auth.signUpWithGoogle(...);
|
|
@@ -167,8 +179,8 @@ class Auth {
|
|
|
167
179
|
/**
|
|
168
180
|
* POST auth/vk
|
|
169
181
|
*
|
|
170
|
-
* Возможные коды ответа: {@link
|
|
171
|
-
* @returns {@link
|
|
182
|
+
* Возможные коды ответа: {@link OAuthAuthResult}
|
|
183
|
+
* @returns {@link IVkAuthResponse}
|
|
172
184
|
*
|
|
173
185
|
* @example
|
|
174
186
|
* const result = await client.endpoints.auth.signUpWithVk(...);
|
|
@@ -176,6 +188,18 @@ class Auth {
|
|
|
176
188
|
async signUpWithVk(data, options) {
|
|
177
189
|
return await this.client.call({ path: `/auth/vk`, method: 'POST', urlEncoded: data, ...options });
|
|
178
190
|
}
|
|
191
|
+
/**
|
|
192
|
+
* POST auth/yandex (с beta 21)
|
|
193
|
+
*
|
|
194
|
+
* Возможные коды ответа: {@link OAuthAuthResult}
|
|
195
|
+
* @returns {@link IYandexAuthResponse}
|
|
196
|
+
*
|
|
197
|
+
* @example
|
|
198
|
+
* const result = await client.endpoints.auth.signUpWithYandex({ login, email, yandexAccessToken });
|
|
199
|
+
*/
|
|
200
|
+
async signUpWithYandex(data, options) {
|
|
201
|
+
return await this.client.call({ path: `/auth/yandex`, method: 'POST', urlEncoded: data, ...options });
|
|
202
|
+
}
|
|
179
203
|
/**
|
|
180
204
|
* POST auth/verify
|
|
181
205
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Anixart } from "../../client";
|
|
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";
|
|
2
|
+
import { IBaseApiParams, IChangeEmailResendResponse, IChangeEmailResponse, IChangeEmailVerifyResponse, IChangeLoginInfoResponse, IChangeLoginResponse, IChangePasswordResponse, IEmailChangeRequest, IEmailChangeResendRequest, IGoogleBindRequest, IGoogleBindResponse, IGoogleUnbindResponse, IPasswordChangeRequest, IPrivacyEditRequest, IProfileSettingsResponse, IProfileSocialResponse, IResponse, ISelectPinnedSectionRequest, ISelectThemeRequest, ISelectThemeResponse, ISocialEditResponse, ISocialPagesEditRequest, IStatusEditRequest, ITelegramBindRequest, ITelegramBindResponse, ITelegramUnbindResponse, IVkBindRequest, IVkBindResponse, IVkUnbindResponse, IYandexBindRequest, IYandexBindResponse, IYandexUnbindResponse } from "../../types";
|
|
3
3
|
/**
|
|
4
4
|
* Класс с эндпоинтами настроек профиля
|
|
5
5
|
*/
|
|
@@ -99,21 +99,21 @@ export declare class ProfilePreference {
|
|
|
99
99
|
/**
|
|
100
100
|
* POST profile/preference/google/bind
|
|
101
101
|
*
|
|
102
|
-
* Возможные коды ответа: {@link
|
|
102
|
+
* Возможные коды ответа: {@link GoogleBindResult}
|
|
103
103
|
* @returns {@link IGoogleBindResponse}
|
|
104
104
|
*
|
|
105
105
|
* @example
|
|
106
|
-
* const result = await client.endpoints.profilePreference.googleBind(
|
|
106
|
+
* const result = await client.endpoints.profilePreference.googleBind({ idToken });
|
|
107
107
|
*/
|
|
108
|
-
googleBind(data
|
|
108
|
+
googleBind(data: IGoogleBindRequest, options?: IBaseApiParams): Promise<IGoogleBindResponse>;
|
|
109
109
|
/**
|
|
110
110
|
* POST profile/preference/google/unbind
|
|
111
111
|
*
|
|
112
|
-
* Возможные коды ответа: {@link
|
|
112
|
+
* Возможные коды ответа: {@link GoogleUnbindResult}
|
|
113
113
|
* @returns {@link IGoogleUnbindResponse}
|
|
114
114
|
*
|
|
115
115
|
* @example
|
|
116
|
-
* const result = await client.endpoints.profilePreference.googleUnbind(
|
|
116
|
+
* const result = await client.endpoints.profilePreference.googleUnbind();
|
|
117
117
|
*/
|
|
118
118
|
googleUnbind(options?: IBaseApiParams): Promise<IGoogleUnbindResponse>;
|
|
119
119
|
/**
|
|
@@ -195,7 +195,7 @@ export declare class ProfilePreference {
|
|
|
195
195
|
* @example
|
|
196
196
|
* const result = await client.endpoints.profilePreference.selectTheme(...);
|
|
197
197
|
*/
|
|
198
|
-
selectTheme(body: ISelectThemeRequest, options?: IBaseApiParams): Promise<
|
|
198
|
+
selectTheme(body: ISelectThemeRequest, options?: IBaseApiParams): Promise<ISelectThemeResponse>;
|
|
199
199
|
/**
|
|
200
200
|
* GET profile/preference/social
|
|
201
201
|
*
|
|
@@ -249,21 +249,41 @@ export declare class ProfilePreference {
|
|
|
249
249
|
/**
|
|
250
250
|
* POST profile/preference/vk/bind
|
|
251
251
|
*
|
|
252
|
-
* Возможные коды ответа: {@link
|
|
252
|
+
* Возможные коды ответа: {@link VkBindResult}
|
|
253
253
|
* @returns {@link IVkBindResponse}
|
|
254
254
|
*
|
|
255
255
|
* @example
|
|
256
|
-
* const result = await client.endpoints.profilePreference.vkBind(
|
|
256
|
+
* const result = await client.endpoints.profilePreference.vkBind({ accessToken });
|
|
257
257
|
*/
|
|
258
|
-
vkBind(data
|
|
258
|
+
vkBind(data: IVkBindRequest, options?: IBaseApiParams): Promise<IVkBindResponse>;
|
|
259
259
|
/**
|
|
260
260
|
* POST profile/preference/vk/unbind
|
|
261
261
|
*
|
|
262
|
-
* Возможные коды ответа: {@link
|
|
262
|
+
* Возможные коды ответа: {@link VkUnbindResult}
|
|
263
263
|
* @returns {@link IVkUnbindResponse}
|
|
264
264
|
*
|
|
265
265
|
* @example
|
|
266
|
-
* const result = await client.endpoints.profilePreference.vkUnbind(
|
|
266
|
+
* const result = await client.endpoints.profilePreference.vkUnbind();
|
|
267
267
|
*/
|
|
268
268
|
vkUnbind(options?: IBaseApiParams): Promise<IVkUnbindResponse>;
|
|
269
|
+
/**
|
|
270
|
+
* POST profile/preference/yandex/bind (с beta 21)
|
|
271
|
+
*
|
|
272
|
+
* Возможные коды ответа: {@link YandexBindResult}
|
|
273
|
+
* @returns {@link IYandexBindResponse}
|
|
274
|
+
*
|
|
275
|
+
* @example
|
|
276
|
+
* const result = await client.endpoints.profilePreference.yandexBind({ accessToken });
|
|
277
|
+
*/
|
|
278
|
+
yandexBind(data: IYandexBindRequest, options?: IBaseApiParams): Promise<IYandexBindResponse>;
|
|
279
|
+
/**
|
|
280
|
+
* POST profile/preference/yandex/unbind (с beta 21)
|
|
281
|
+
*
|
|
282
|
+
* Возможные коды ответа: {@link YandexUnbindResult}
|
|
283
|
+
* @returns {@link IYandexUnbindResponse}
|
|
284
|
+
*
|
|
285
|
+
* @example
|
|
286
|
+
* const result = await client.endpoints.profilePreference.yandexUnbind();
|
|
287
|
+
*/
|
|
288
|
+
yandexUnbind(options?: IBaseApiParams): Promise<IYandexUnbindResponse>;
|
|
269
289
|
}
|
|
@@ -119,11 +119,11 @@ class ProfilePreference {
|
|
|
119
119
|
/**
|
|
120
120
|
* POST profile/preference/google/bind
|
|
121
121
|
*
|
|
122
|
-
* Возможные коды ответа: {@link
|
|
122
|
+
* Возможные коды ответа: {@link GoogleBindResult}
|
|
123
123
|
* @returns {@link IGoogleBindResponse}
|
|
124
124
|
*
|
|
125
125
|
* @example
|
|
126
|
-
* const result = await client.endpoints.profilePreference.googleBind(
|
|
126
|
+
* const result = await client.endpoints.profilePreference.googleBind({ idToken });
|
|
127
127
|
*/
|
|
128
128
|
async googleBind(data, options) {
|
|
129
129
|
return await this.client.call({ path: `/profile/preference/google/bind`, method: 'POST', urlEncoded: data, ...options });
|
|
@@ -131,11 +131,11 @@ class ProfilePreference {
|
|
|
131
131
|
/**
|
|
132
132
|
* POST profile/preference/google/unbind
|
|
133
133
|
*
|
|
134
|
-
* Возможные коды ответа: {@link
|
|
134
|
+
* Возможные коды ответа: {@link GoogleUnbindResult}
|
|
135
135
|
* @returns {@link IGoogleUnbindResponse}
|
|
136
136
|
*
|
|
137
137
|
* @example
|
|
138
|
-
* const result = await client.endpoints.profilePreference.googleUnbind(
|
|
138
|
+
* const result = await client.endpoints.profilePreference.googleUnbind();
|
|
139
139
|
*/
|
|
140
140
|
async googleUnbind(options) {
|
|
141
141
|
return await this.client.call({ path: `/profile/preference/google/unbind`, method: 'POST', ...options });
|
|
@@ -234,7 +234,14 @@ class ProfilePreference {
|
|
|
234
234
|
* const result = await client.endpoints.profilePreference.selectTheme(...);
|
|
235
235
|
*/
|
|
236
236
|
async selectTheme(body, options) {
|
|
237
|
-
|
|
237
|
+
var _a;
|
|
238
|
+
const id = (_a = body.id) !== null && _a !== void 0 ? _a : body.theme;
|
|
239
|
+
return await this.client.call({
|
|
240
|
+
path: `/profile/preference/themes/edit`,
|
|
241
|
+
method: 'POST',
|
|
242
|
+
json: { id },
|
|
243
|
+
...options,
|
|
244
|
+
});
|
|
238
245
|
}
|
|
239
246
|
/**
|
|
240
247
|
* GET profile/preference/social
|
|
@@ -299,11 +306,11 @@ class ProfilePreference {
|
|
|
299
306
|
/**
|
|
300
307
|
* POST profile/preference/vk/bind
|
|
301
308
|
*
|
|
302
|
-
* Возможные коды ответа: {@link
|
|
309
|
+
* Возможные коды ответа: {@link VkBindResult}
|
|
303
310
|
* @returns {@link IVkBindResponse}
|
|
304
311
|
*
|
|
305
312
|
* @example
|
|
306
|
-
* const result = await client.endpoints.profilePreference.vkBind(
|
|
313
|
+
* const result = await client.endpoints.profilePreference.vkBind({ accessToken });
|
|
307
314
|
*/
|
|
308
315
|
async vkBind(data, options) {
|
|
309
316
|
return await this.client.call({ path: `/profile/preference/vk/bind`, method: 'POST', urlEncoded: data, ...options });
|
|
@@ -311,14 +318,38 @@ class ProfilePreference {
|
|
|
311
318
|
/**
|
|
312
319
|
* POST profile/preference/vk/unbind
|
|
313
320
|
*
|
|
314
|
-
* Возможные коды ответа: {@link
|
|
321
|
+
* Возможные коды ответа: {@link VkUnbindResult}
|
|
315
322
|
* @returns {@link IVkUnbindResponse}
|
|
316
323
|
*
|
|
317
324
|
* @example
|
|
318
|
-
* const result = await client.endpoints.profilePreference.vkUnbind(
|
|
325
|
+
* const result = await client.endpoints.profilePreference.vkUnbind();
|
|
319
326
|
*/
|
|
320
327
|
async vkUnbind(options) {
|
|
321
328
|
return await this.client.call({ path: `/profile/preference/vk/unbind`, method: 'POST', ...options });
|
|
322
329
|
}
|
|
330
|
+
/**
|
|
331
|
+
* POST profile/preference/yandex/bind (с beta 21)
|
|
332
|
+
*
|
|
333
|
+
* Возможные коды ответа: {@link YandexBindResult}
|
|
334
|
+
* @returns {@link IYandexBindResponse}
|
|
335
|
+
*
|
|
336
|
+
* @example
|
|
337
|
+
* const result = await client.endpoints.profilePreference.yandexBind({ accessToken });
|
|
338
|
+
*/
|
|
339
|
+
async yandexBind(data, options) {
|
|
340
|
+
return await this.client.call({ path: `/profile/preference/yandex/bind`, method: 'POST', urlEncoded: data, ...options });
|
|
341
|
+
}
|
|
342
|
+
/**
|
|
343
|
+
* POST profile/preference/yandex/unbind (с beta 21)
|
|
344
|
+
*
|
|
345
|
+
* Возможные коды ответа: {@link YandexUnbindResult}
|
|
346
|
+
* @returns {@link IYandexUnbindResponse}
|
|
347
|
+
*
|
|
348
|
+
* @example
|
|
349
|
+
* const result = await client.endpoints.profilePreference.yandexUnbind();
|
|
350
|
+
*/
|
|
351
|
+
async yandexUnbind(options) {
|
|
352
|
+
return await this.client.call({ path: `/profile/preference/yandex/unbind`, method: 'POST', ...options });
|
|
353
|
+
}
|
|
323
354
|
}
|
|
324
355
|
exports.ProfilePreference = ProfilePreference;
|
package/dist/classes/Dubber.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ export declare class Dubber {
|
|
|
14
14
|
readonly pinned: boolean;
|
|
15
15
|
readonly viewCount: number;
|
|
16
16
|
readonly workers: string;
|
|
17
|
+
readonly quality: number | null;
|
|
17
18
|
constructor(client: Anixart, dubberResponce: IDubber, release: Release);
|
|
18
19
|
getSources(): Promise<Source[]>;
|
|
19
20
|
}
|
package/dist/classes/Dubber.js
CHANGED
|
@@ -15,6 +15,7 @@ class Dubber {
|
|
|
15
15
|
this.pinned = dubberResponce.pinned,
|
|
16
16
|
this.viewCount = dubberResponce.view_count;
|
|
17
17
|
this.workers = dubberResponce.workers;
|
|
18
|
+
this.quality = typeof dubberResponce.quality === 'number' ? dubberResponce.quality : null;
|
|
18
19
|
}
|
|
19
20
|
async getSources() {
|
|
20
21
|
const request = await this.client.endpoints.episode.sources(this.release.id, this.id);
|
|
@@ -31,6 +31,8 @@ export declare class FullProfile extends BaseProfile {
|
|
|
31
31
|
readonly isBookmarksTransferred: boolean;
|
|
32
32
|
readonly isVkBound: boolean;
|
|
33
33
|
readonly isGoogleBound: boolean;
|
|
34
|
+
readonly isTelegramBound: boolean;
|
|
35
|
+
readonly isYandexBound: boolean;
|
|
34
36
|
readonly isReleaseTypeNotificationsEnabled: boolean;
|
|
35
37
|
readonly isEpisodeNotificationsEnabled: boolean;
|
|
36
38
|
readonly isFirstEpisodeNotificationEnabled: boolean;
|
|
@@ -5,7 +5,7 @@ const BaseProfile_1 = require("./BaseProfile");
|
|
|
5
5
|
const Release_1 = require("./Release");
|
|
6
6
|
class FullProfile extends BaseProfile_1.BaseProfile {
|
|
7
7
|
constructor(client, profile) {
|
|
8
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
8
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
9
9
|
super(client, {
|
|
10
10
|
id: profile.id,
|
|
11
11
|
login: profile.login,
|
|
@@ -52,6 +52,8 @@ class FullProfile extends BaseProfile_1.BaseProfile {
|
|
|
52
52
|
this.isBookmarksTransferred = profile.is_bookmarks_transferred;
|
|
53
53
|
this.isVkBound = profile.is_vk_bound;
|
|
54
54
|
this.isGoogleBound = profile.is_google_bound;
|
|
55
|
+
this.isTelegramBound = (_j = profile.is_telegram_bound) !== null && _j !== void 0 ? _j : false;
|
|
56
|
+
this.isYandexBound = (_k = profile.is_yandex_bound) !== null && _k !== void 0 ? _k : false;
|
|
55
57
|
this.isReleaseTypeNotificationsEnabled = profile.is_release_type_notifications_enabled;
|
|
56
58
|
this.isEpisodeNotificationsEnabled = profile.is_episode_notifications_enabled;
|
|
57
59
|
this.isFirstEpisodeNotificationEnabled = profile.is_first_episode_notification_enabled;
|
package/dist/types/auth.d.ts
CHANGED
|
@@ -76,6 +76,7 @@ export interface ISignUpVerifyRequest extends ISignUpRequest {
|
|
|
76
76
|
vkAccessToken?: string;
|
|
77
77
|
googleIdToken?: string;
|
|
78
78
|
telegramIdToken?: string;
|
|
79
|
+
yandexAccessToken?: string;
|
|
79
80
|
hash: string;
|
|
80
81
|
code: number;
|
|
81
82
|
}
|
|
@@ -100,6 +101,29 @@ export interface IOAuthTelegramSignUpRequest {
|
|
|
100
101
|
email: string;
|
|
101
102
|
telegramIdToken: string;
|
|
102
103
|
}
|
|
104
|
+
/** POST auth/yandex (sign-in) */
|
|
105
|
+
export interface IOAuthYandexSignInRequest {
|
|
106
|
+
yandexAccessToken: string;
|
|
107
|
+
}
|
|
108
|
+
/** POST auth/yandex (sign-up) */
|
|
109
|
+
export interface IOAuthYandexSignUpRequest {
|
|
110
|
+
login: string;
|
|
111
|
+
email: string;
|
|
112
|
+
yandexAccessToken: string;
|
|
113
|
+
}
|
|
114
|
+
/** Общие коды OAuth: VK / Telegram / Yandex (beta 21) */
|
|
115
|
+
export declare enum OAuthAuthResult {
|
|
116
|
+
InvalidRequest = 2,
|
|
117
|
+
NotRegistered = 3,
|
|
118
|
+
InvalidLogin = 4,
|
|
119
|
+
InvalidEmail = 5,
|
|
120
|
+
LoginAlreadyTaken = 6,
|
|
121
|
+
EmailAlreadyTaken = 7,
|
|
122
|
+
CodeAlreadySend = 8,
|
|
123
|
+
EmailServiceDisallowed = 9,
|
|
124
|
+
TooManyRegistrations = 10
|
|
125
|
+
}
|
|
126
|
+
/** @deprecated используйте {@link OAuthAuthResult} */
|
|
103
127
|
export declare enum TelegramAuthResult {
|
|
104
128
|
InvalidRequest = 2,
|
|
105
129
|
NotRegistered = 3,
|
|
@@ -111,13 +135,39 @@ export declare enum TelegramAuthResult {
|
|
|
111
135
|
EmailServiceDisallowed = 9,
|
|
112
136
|
TooManyRegistrations = 10
|
|
113
137
|
}
|
|
114
|
-
|
|
138
|
+
/** Коды Google OAuth (отличаются от VK/TG/Yandex) */
|
|
139
|
+
export declare enum GoogleAuthResult {
|
|
140
|
+
InvalidRequest = 2,
|
|
141
|
+
NotRegistered = 3,
|
|
142
|
+
InvalidLogin = 4,
|
|
143
|
+
InvalidEmail = 5,
|
|
144
|
+
LoginAlreadyTaken = 6,
|
|
145
|
+
EmailAlreadyTaken = 7,
|
|
146
|
+
EmailChanged = 8,
|
|
147
|
+
EmailChangedAndCodeAlreadySend = 9,
|
|
148
|
+
EmailServiceDisallowed = 10,
|
|
149
|
+
TooManyRegistrations = 11
|
|
150
|
+
}
|
|
151
|
+
export type VkAuthResult = OAuthAuthResult;
|
|
152
|
+
export type YandexAuthResult = OAuthAuthResult;
|
|
153
|
+
/** Базовый ответ OAuth sign-in / sign-up */
|
|
154
|
+
export interface IOAuthAuthResponse<T extends number = OAuthAuthResult> extends IResponse<T> {
|
|
115
155
|
profile?: IProfile;
|
|
116
156
|
profileToken?: IProfileToken;
|
|
117
157
|
hash?: string;
|
|
118
158
|
codeTimestampExpires?: number;
|
|
119
159
|
suggested_logins?: string[] | null;
|
|
120
160
|
}
|
|
161
|
+
export interface ITelegramAuthResponse extends IOAuthAuthResponse<TelegramAuthResult> {
|
|
162
|
+
}
|
|
163
|
+
export interface IVkAuthResponse extends IOAuthAuthResponse<OAuthAuthResult> {
|
|
164
|
+
}
|
|
165
|
+
export interface IGoogleAuthResponse extends IOAuthAuthResponse<GoogleAuthResult> {
|
|
166
|
+
}
|
|
167
|
+
/** Yandex дополнительно отдаёт email при регистрации */
|
|
168
|
+
export interface IYandexAuthResponse extends IOAuthAuthResponse<OAuthAuthResult> {
|
|
169
|
+
email?: string | null;
|
|
170
|
+
}
|
|
121
171
|
export interface ILoginRequest {
|
|
122
172
|
login: string;
|
|
123
173
|
password: string;
|
|
@@ -129,6 +179,7 @@ export interface IResendRequest {
|
|
|
129
179
|
vkAccessToken?: string;
|
|
130
180
|
googleIdToken?: string;
|
|
131
181
|
telegramIdToken?: string;
|
|
182
|
+
yandexAccessToken?: string;
|
|
132
183
|
hash: string;
|
|
133
184
|
}
|
|
134
185
|
export interface IRestoreResendRequest {
|
package/dist/types/auth.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TelegramAuthResult = exports.CheckLoginResult = exports.RestorePasswordVerifyResult = exports.RestorePasswordResult = exports.RegisterVerifyResult = exports.RegisterResult = exports.LoginResult = void 0;
|
|
3
|
+
exports.GoogleAuthResult = exports.TelegramAuthResult = exports.OAuthAuthResult = 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";
|
|
@@ -49,6 +49,20 @@ var CheckLoginResult;
|
|
|
49
49
|
(function (CheckLoginResult) {
|
|
50
50
|
CheckLoginResult[CheckLoginResult["InvalidLogin"] = 2] = "InvalidLogin";
|
|
51
51
|
})(CheckLoginResult || (exports.CheckLoginResult = CheckLoginResult = {}));
|
|
52
|
+
/** Общие коды OAuth: VK / Telegram / Yandex (beta 21) */
|
|
53
|
+
var OAuthAuthResult;
|
|
54
|
+
(function (OAuthAuthResult) {
|
|
55
|
+
OAuthAuthResult[OAuthAuthResult["InvalidRequest"] = 2] = "InvalidRequest";
|
|
56
|
+
OAuthAuthResult[OAuthAuthResult["NotRegistered"] = 3] = "NotRegistered";
|
|
57
|
+
OAuthAuthResult[OAuthAuthResult["InvalidLogin"] = 4] = "InvalidLogin";
|
|
58
|
+
OAuthAuthResult[OAuthAuthResult["InvalidEmail"] = 5] = "InvalidEmail";
|
|
59
|
+
OAuthAuthResult[OAuthAuthResult["LoginAlreadyTaken"] = 6] = "LoginAlreadyTaken";
|
|
60
|
+
OAuthAuthResult[OAuthAuthResult["EmailAlreadyTaken"] = 7] = "EmailAlreadyTaken";
|
|
61
|
+
OAuthAuthResult[OAuthAuthResult["CodeAlreadySend"] = 8] = "CodeAlreadySend";
|
|
62
|
+
OAuthAuthResult[OAuthAuthResult["EmailServiceDisallowed"] = 9] = "EmailServiceDisallowed";
|
|
63
|
+
OAuthAuthResult[OAuthAuthResult["TooManyRegistrations"] = 10] = "TooManyRegistrations";
|
|
64
|
+
})(OAuthAuthResult || (exports.OAuthAuthResult = OAuthAuthResult = {}));
|
|
65
|
+
/** @deprecated используйте {@link OAuthAuthResult} */
|
|
52
66
|
var TelegramAuthResult;
|
|
53
67
|
(function (TelegramAuthResult) {
|
|
54
68
|
TelegramAuthResult[TelegramAuthResult["InvalidRequest"] = 2] = "InvalidRequest";
|
|
@@ -61,3 +75,17 @@ var TelegramAuthResult;
|
|
|
61
75
|
TelegramAuthResult[TelegramAuthResult["EmailServiceDisallowed"] = 9] = "EmailServiceDisallowed";
|
|
62
76
|
TelegramAuthResult[TelegramAuthResult["TooManyRegistrations"] = 10] = "TooManyRegistrations";
|
|
63
77
|
})(TelegramAuthResult || (exports.TelegramAuthResult = TelegramAuthResult = {}));
|
|
78
|
+
/** Коды Google OAuth (отличаются от VK/TG/Yandex) */
|
|
79
|
+
var GoogleAuthResult;
|
|
80
|
+
(function (GoogleAuthResult) {
|
|
81
|
+
GoogleAuthResult[GoogleAuthResult["InvalidRequest"] = 2] = "InvalidRequest";
|
|
82
|
+
GoogleAuthResult[GoogleAuthResult["NotRegistered"] = 3] = "NotRegistered";
|
|
83
|
+
GoogleAuthResult[GoogleAuthResult["InvalidLogin"] = 4] = "InvalidLogin";
|
|
84
|
+
GoogleAuthResult[GoogleAuthResult["InvalidEmail"] = 5] = "InvalidEmail";
|
|
85
|
+
GoogleAuthResult[GoogleAuthResult["LoginAlreadyTaken"] = 6] = "LoginAlreadyTaken";
|
|
86
|
+
GoogleAuthResult[GoogleAuthResult["EmailAlreadyTaken"] = 7] = "EmailAlreadyTaken";
|
|
87
|
+
GoogleAuthResult[GoogleAuthResult["EmailChanged"] = 8] = "EmailChanged";
|
|
88
|
+
GoogleAuthResult[GoogleAuthResult["EmailChangedAndCodeAlreadySend"] = 9] = "EmailChangedAndCodeAlreadySend";
|
|
89
|
+
GoogleAuthResult[GoogleAuthResult["EmailServiceDisallowed"] = 10] = "EmailServiceDisallowed";
|
|
90
|
+
GoogleAuthResult[GoogleAuthResult["TooManyRegistrations"] = 11] = "TooManyRegistrations";
|
|
91
|
+
})(GoogleAuthResult || (exports.GoogleAuthResult = GoogleAuthResult = {}));
|
package/dist/types/config.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { IResponse } from "./response";
|
|
2
|
-
|
|
2
|
+
/** Anixart 9.0 BETA 21 */
|
|
3
|
+
export declare const DEFAULT_VERSION_CODE = 26080522;
|
|
3
4
|
export interface IConfigRequest {
|
|
4
5
|
versionCode?: number;
|
|
5
6
|
beta?: boolean;
|
|
@@ -10,6 +11,11 @@ export interface IConfigUrlsResponse extends IResponse {
|
|
|
10
11
|
editor_url?: string;
|
|
11
12
|
static_domain?: string;
|
|
12
13
|
should_use_mirror_urls: boolean;
|
|
14
|
+
google_auth_available?: boolean;
|
|
15
|
+
telegram_auth_available?: boolean;
|
|
16
|
+
vk_auth_available?: boolean;
|
|
17
|
+
yandex_auth_available?: boolean;
|
|
18
|
+
consent_required?: boolean;
|
|
13
19
|
}
|
|
14
20
|
export interface ITogglesResponse extends IResponse {
|
|
15
21
|
minVersionCode?: number;
|
|
@@ -34,6 +40,8 @@ export interface ITogglesResponse extends IResponse {
|
|
|
34
40
|
googleAuthAvailable?: boolean;
|
|
35
41
|
vkAuthAvailable?: boolean;
|
|
36
42
|
telegramAuthAvailable?: boolean;
|
|
43
|
+
yandexAuthAvailable?: boolean;
|
|
44
|
+
consentRequired?: boolean;
|
|
37
45
|
[key: string]: unknown;
|
|
38
46
|
}
|
|
39
47
|
export interface ILatestArticleResponse extends IResponse {
|
package/dist/types/config.js
CHANGED
package/dist/types/profile.d.ts
CHANGED
|
@@ -78,6 +78,8 @@ export interface IProfile {
|
|
|
78
78
|
is_sponsor_transferred: boolean;
|
|
79
79
|
is_vk_bound: boolean;
|
|
80
80
|
is_google_bound: boolean;
|
|
81
|
+
is_telegram_bound?: boolean;
|
|
82
|
+
is_yandex_bound?: boolean;
|
|
81
83
|
is_article_notifications_enabled: boolean;
|
|
82
84
|
is_release_type_notifications_enabled: boolean;
|
|
83
85
|
is_episode_notifications_enabled: boolean;
|
|
@@ -316,6 +318,7 @@ export interface IRoleDto {
|
|
|
316
318
|
id: number;
|
|
317
319
|
}
|
|
318
320
|
export interface ITheme {
|
|
321
|
+
id?: number;
|
|
319
322
|
name?: string;
|
|
320
323
|
theme_animation_enabled?: boolean;
|
|
321
324
|
theme_animation_speed?: string | null;
|
|
@@ -335,6 +338,7 @@ export interface ITheme {
|
|
|
335
338
|
}
|
|
336
339
|
export interface IAvailableTheme {
|
|
337
340
|
id: number;
|
|
341
|
+
name?: string;
|
|
338
342
|
}
|
|
339
343
|
export interface IUser {
|
|
340
344
|
id: number;
|
package/dist/types/release.d.ts
CHANGED
|
@@ -266,6 +266,7 @@ export interface IDubber {
|
|
|
266
266
|
episode_count: number;
|
|
267
267
|
view_count: number;
|
|
268
268
|
pinned: boolean;
|
|
269
|
+
quality?: number;
|
|
269
270
|
}
|
|
270
271
|
export interface IDubbersResponse extends IResponse {
|
|
271
272
|
types: IDubber[];
|
|
@@ -276,6 +277,7 @@ export interface ISource {
|
|
|
276
277
|
name: string;
|
|
277
278
|
type: IDubber | number;
|
|
278
279
|
episode_count: number;
|
|
280
|
+
quality?: number;
|
|
279
281
|
}
|
|
280
282
|
export interface ISourcesResponse extends IResponse {
|
|
281
283
|
sources: ISource[];
|
package/dist/types/settings.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IBadge, IProfile } from "./profile";
|
|
1
|
+
import { IBadge, IProfile, ITheme } from "./profile";
|
|
2
2
|
import { IPageableResponse, IResponse } from "./response";
|
|
3
3
|
export interface IProfileSettingsResponse extends IResponse {
|
|
4
4
|
avatar: string;
|
|
@@ -17,6 +17,8 @@ export interface IProfileSettingsResponse extends IResponse {
|
|
|
17
17
|
isGoogleBound: boolean;
|
|
18
18
|
is_telegram_bound?: boolean;
|
|
19
19
|
isTelegramBound?: boolean;
|
|
20
|
+
is_yandex_bound?: boolean;
|
|
21
|
+
isYandexBound?: boolean;
|
|
20
22
|
episode_channel_widgets_hidden?: boolean;
|
|
21
23
|
is_login_changed: boolean;
|
|
22
24
|
isLoginChanged: boolean;
|
|
@@ -25,6 +27,13 @@ export interface IProfileSettingsResponse extends IResponse {
|
|
|
25
27
|
is_change_avatar_banned: boolean;
|
|
26
28
|
ban_change_avatar_expires: number;
|
|
27
29
|
channel_id: number;
|
|
30
|
+
/** Темы витрины (из preference/my) */
|
|
31
|
+
available_themes?: {
|
|
32
|
+
id: number;
|
|
33
|
+
name: string;
|
|
34
|
+
}[];
|
|
35
|
+
selected_theme_id?: number;
|
|
36
|
+
badge?: IBadge | null;
|
|
28
37
|
}
|
|
29
38
|
export interface IBadgesResponse extends IPageableResponse<IBadge> {
|
|
30
39
|
profile: IProfile;
|
|
@@ -54,6 +63,18 @@ export interface IPasswordChangeRequest {
|
|
|
54
63
|
export interface ITelegramBindRequest {
|
|
55
64
|
idToken: string;
|
|
56
65
|
}
|
|
66
|
+
/** POST profile/preference/google/bind */
|
|
67
|
+
export interface IGoogleBindRequest {
|
|
68
|
+
idToken: string;
|
|
69
|
+
}
|
|
70
|
+
/** POST profile/preference/vk/bind | yandex/bind */
|
|
71
|
+
export interface IAccessTokenBindRequest {
|
|
72
|
+
accessToken: string;
|
|
73
|
+
}
|
|
74
|
+
/** @alias IAccessTokenBindRequest */
|
|
75
|
+
export type IVkBindRequest = IAccessTokenBindRequest;
|
|
76
|
+
/** @alias IAccessTokenBindRequest */
|
|
77
|
+
export type IYandexBindRequest = IAccessTokenBindRequest;
|
|
57
78
|
export interface ILoginInfoResponse extends IResponse {
|
|
58
79
|
login: string;
|
|
59
80
|
avatar: string;
|
|
@@ -100,6 +121,27 @@ export declare enum TelegramBindResult {
|
|
|
100
121
|
export declare enum TelegramUnbindResult {
|
|
101
122
|
TelegramNotBound = 2
|
|
102
123
|
}
|
|
124
|
+
export declare enum GoogleBindResult {
|
|
125
|
+
InvalidRequest = 2,
|
|
126
|
+
GoogleAlreadyBound = 3
|
|
127
|
+
}
|
|
128
|
+
export declare enum GoogleUnbindResult {
|
|
129
|
+
GoogleNotBound = 2
|
|
130
|
+
}
|
|
131
|
+
export declare enum VkBindResult {
|
|
132
|
+
InvalidRequest = 2,
|
|
133
|
+
VkAlreadyBound = 3
|
|
134
|
+
}
|
|
135
|
+
export declare enum VkUnbindResult {
|
|
136
|
+
VkNotBound = 2
|
|
137
|
+
}
|
|
138
|
+
export declare enum YandexBindResult {
|
|
139
|
+
InvalidRequest = 2,
|
|
140
|
+
YandexAlreadyBound = 3
|
|
141
|
+
}
|
|
142
|
+
export declare enum YandexUnbindResult {
|
|
143
|
+
YandexNotBound = 2
|
|
144
|
+
}
|
|
103
145
|
export declare enum ChangeEmailConfirmResult {
|
|
104
146
|
InvalidPassword = 2
|
|
105
147
|
}
|
|
@@ -124,7 +166,14 @@ export interface IPasswordChangeResponse extends IResponse<ChangePasswordResult>
|
|
|
124
166
|
token: string;
|
|
125
167
|
}
|
|
126
168
|
export interface ISelectThemeRequest {
|
|
127
|
-
|
|
169
|
+
/** APK SelectThemeRequest: поле `id` */
|
|
170
|
+
id: number;
|
|
171
|
+
/** @deprecated используйте `id` */
|
|
172
|
+
theme?: number;
|
|
173
|
+
}
|
|
174
|
+
/** Ответ POST profile/preference/themes/edit */
|
|
175
|
+
export interface ISelectThemeResponse extends IResponse {
|
|
176
|
+
theme?: ITheme | null;
|
|
128
177
|
}
|
|
129
178
|
export interface ISelectPinnedSectionRequest {
|
|
130
179
|
section: number;
|
|
@@ -148,17 +197,21 @@ export interface IChangeLoginResponse extends IResponse {
|
|
|
148
197
|
export interface IChangePasswordResponse extends IResponse<ChangePasswordResult> {
|
|
149
198
|
token?: string;
|
|
150
199
|
}
|
|
151
|
-
export interface IGoogleBindResponse extends IResponse {
|
|
200
|
+
export interface IGoogleBindResponse extends IResponse<GoogleBindResult> {
|
|
152
201
|
}
|
|
153
|
-
export interface IGoogleUnbindResponse extends IResponse {
|
|
202
|
+
export interface IGoogleUnbindResponse extends IResponse<GoogleUnbindResult> {
|
|
154
203
|
}
|
|
155
204
|
export interface ITelegramBindResponse extends IResponse<TelegramBindResult> {
|
|
156
205
|
}
|
|
157
206
|
export interface ITelegramUnbindResponse extends IResponse<TelegramUnbindResult> {
|
|
158
207
|
}
|
|
159
|
-
export interface IVkBindResponse extends IResponse {
|
|
208
|
+
export interface IVkBindResponse extends IResponse<VkBindResult> {
|
|
209
|
+
}
|
|
210
|
+
export interface IVkUnbindResponse extends IResponse<VkUnbindResult> {
|
|
211
|
+
}
|
|
212
|
+
export interface IYandexBindResponse extends IResponse<YandexBindResult> {
|
|
160
213
|
}
|
|
161
|
-
export interface
|
|
214
|
+
export interface IYandexUnbindResponse extends IResponse<YandexUnbindResult> {
|
|
162
215
|
}
|
|
163
216
|
export interface ISocialEditResponse extends IResponse {
|
|
164
217
|
}
|
package/dist/types/settings.js
CHANGED
|
@@ -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.TelegramUnbindResult = exports.TelegramBindResult = exports.ChangeEmailResendResult = exports.ChangeEmailResult = exports.ChangeLoginResult = exports.SocialEditResult = void 0;
|
|
3
|
+
exports.PrivacyFriendRequestState = exports.PrivacyState = exports.PasswordChangeResult = exports.ChangePasswordResult = exports.ChangeEmailConfirmResult = exports.YandexUnbindResult = exports.YandexBindResult = exports.VkUnbindResult = exports.VkBindResult = exports.GoogleUnbindResult = exports.GoogleBindResult = 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";
|
|
@@ -40,6 +40,33 @@ var TelegramUnbindResult;
|
|
|
40
40
|
(function (TelegramUnbindResult) {
|
|
41
41
|
TelegramUnbindResult[TelegramUnbindResult["TelegramNotBound"] = 2] = "TelegramNotBound";
|
|
42
42
|
})(TelegramUnbindResult || (exports.TelegramUnbindResult = TelegramUnbindResult = {}));
|
|
43
|
+
var GoogleBindResult;
|
|
44
|
+
(function (GoogleBindResult) {
|
|
45
|
+
GoogleBindResult[GoogleBindResult["InvalidRequest"] = 2] = "InvalidRequest";
|
|
46
|
+
GoogleBindResult[GoogleBindResult["GoogleAlreadyBound"] = 3] = "GoogleAlreadyBound";
|
|
47
|
+
})(GoogleBindResult || (exports.GoogleBindResult = GoogleBindResult = {}));
|
|
48
|
+
var GoogleUnbindResult;
|
|
49
|
+
(function (GoogleUnbindResult) {
|
|
50
|
+
GoogleUnbindResult[GoogleUnbindResult["GoogleNotBound"] = 2] = "GoogleNotBound";
|
|
51
|
+
})(GoogleUnbindResult || (exports.GoogleUnbindResult = GoogleUnbindResult = {}));
|
|
52
|
+
var VkBindResult;
|
|
53
|
+
(function (VkBindResult) {
|
|
54
|
+
VkBindResult[VkBindResult["InvalidRequest"] = 2] = "InvalidRequest";
|
|
55
|
+
VkBindResult[VkBindResult["VkAlreadyBound"] = 3] = "VkAlreadyBound";
|
|
56
|
+
})(VkBindResult || (exports.VkBindResult = VkBindResult = {}));
|
|
57
|
+
var VkUnbindResult;
|
|
58
|
+
(function (VkUnbindResult) {
|
|
59
|
+
VkUnbindResult[VkUnbindResult["VkNotBound"] = 2] = "VkNotBound";
|
|
60
|
+
})(VkUnbindResult || (exports.VkUnbindResult = VkUnbindResult = {}));
|
|
61
|
+
var YandexBindResult;
|
|
62
|
+
(function (YandexBindResult) {
|
|
63
|
+
YandexBindResult[YandexBindResult["InvalidRequest"] = 2] = "InvalidRequest";
|
|
64
|
+
YandexBindResult[YandexBindResult["YandexAlreadyBound"] = 3] = "YandexAlreadyBound";
|
|
65
|
+
})(YandexBindResult || (exports.YandexBindResult = YandexBindResult = {}));
|
|
66
|
+
var YandexUnbindResult;
|
|
67
|
+
(function (YandexUnbindResult) {
|
|
68
|
+
YandexUnbindResult[YandexUnbindResult["YandexNotBound"] = 2] = "YandexNotBound";
|
|
69
|
+
})(YandexUnbindResult || (exports.YandexUnbindResult = YandexUnbindResult = {}));
|
|
43
70
|
var ChangeEmailConfirmResult;
|
|
44
71
|
(function (ChangeEmailConfirmResult) {
|
|
45
72
|
ChangeEmailConfirmResult[ChangeEmailConfirmResult["InvalidPassword"] = 2] = "InvalidPassword";
|
package/docs/DOCUMENTATION.md
CHANGED
|
@@ -108,14 +108,30 @@ const client = new Anixart({ token: "existing-token" });
|
|
|
108
108
|
### OAuth и регистрация
|
|
109
109
|
|
|
110
110
|
```typescript
|
|
111
|
-
|
|
112
|
-
|
|
111
|
+
import { OAuthAuthResult, GoogleAuthResult } from "anixapi";
|
|
112
|
+
|
|
113
|
+
// Вход через VK / Google / Telegram / Yandex
|
|
114
|
+
const vk = await client.endpoints.auth.signInWithVk({ vkAccessToken: "..." });
|
|
115
|
+
const google = await client.endpoints.auth.signInWithGoogle({ googleIdToken: "..." });
|
|
116
|
+
const tg = await client.endpoints.auth.signInWithTelegram({ telegramIdToken: "..." });
|
|
117
|
+
const ya = await client.endpoints.auth.signInWithYandex({ yandexAccessToken: "..." });
|
|
118
|
+
|
|
119
|
+
// code === OAuthAuthResult.NotRegistered (3) → нужно signUpWith*
|
|
120
|
+
if (ya.code === OAuthAuthResult.NotRegistered) {
|
|
121
|
+
await client.endpoints.auth.signUpWithYandex({
|
|
122
|
+
login: "newuser",
|
|
123
|
+
email: ya.email ?? "user@example.com",
|
|
124
|
+
yandexAccessToken: "...",
|
|
125
|
+
});
|
|
126
|
+
}
|
|
113
127
|
|
|
114
|
-
// Регистрация
|
|
128
|
+
// Регистрация по email
|
|
115
129
|
await client.endpoints.auth.signUp({ login, email, password });
|
|
116
130
|
await client.endpoints.auth.verify({ login, email, password, code, hash });
|
|
117
131
|
```
|
|
118
132
|
|
|
133
|
+
Флаги доступности провайдеров: `GET config/urls` → `vk_auth_available`, `google_auth_available`, `telegram_auth_available`, `yandex_auth_available`.
|
|
134
|
+
|
|
119
135
|
Полный список методов: `client.endpoints.auth.*`
|
|
120
136
|
|
|
121
137
|
---
|