anixartjs 0.0.5-r2 → 0.0.5

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.
@@ -8,7 +8,7 @@ import { IPageableResponse, IResponse, IBaseApiParams, ICollectionResponse, IRel
8
8
  export declare class Collection {
9
9
  private readonly client;
10
10
  constructor(client: Anixart);
11
- all(page: number, sort?: number, options?: IBaseApiParams): Promise<IPageableResponse<ICollection>>;
11
+ all(page: number, options?: IBaseApiParams): Promise<IPageableResponse<ICollection>>;
12
12
  info(id: number, options?: IBaseApiParams): Promise<ICollectionResponse>;
13
13
  getCollectionReleases(id: number, page: number, options?: IBaseApiParams): Promise<IPageableResponse<IRelease>>;
14
14
  getCollectionFavorites(page: number, options?: IBaseApiParams): Promise<IPageableResponse<ICollection>>;
@@ -10,8 +10,8 @@ class Collection {
10
10
  constructor(client) {
11
11
  this.client = client;
12
12
  }
13
- async all(page, sort = 2, options) {
14
- return await this.client.call({ path: `/collection/all/${page}`, queryParams: { sort, previous_page: page - 1 }, ...options });
13
+ async all(page, options) {
14
+ return await this.client.call({ path: `/collection/all/${page}`, ...options });
15
15
  }
16
16
  async info(id, options) {
17
17
  return await this.client.call({ path: `/collection/${id}`, ...options });
@@ -18,7 +18,6 @@ export declare class Profile {
18
18
  getFriendRequests(type: "in" | "out", count: number, options?: IBaseApiParams): Promise<IPageableResponse<IProfileShort>>;
19
19
  sendFriendRequest(id: number, options?: IBaseApiParams): Promise<IFriendRequestResponse>;
20
20
  removeFriendRequest(id: number, options?: IBaseApiParams): Promise<IFriendRequestResponse>;
21
- hideFriendRequest(id: number, options?: IBaseApiParams): Promise<IResponse>;
22
21
  getAchivement(id: number, options?: IBaseApiParams): Promise<IResponse>;
23
22
  getFavorites(data: IBookmarkRequest, options?: IBaseApiParams): Promise<IPageableResponse<IRelease>>;
24
23
  getSubsciptions(page: number, options?: IBaseApiParams): Promise<IPageableResponse<any>>;
@@ -40,9 +40,6 @@ class Profile {
40
40
  async removeFriendRequest(id, options) {
41
41
  return await this.client.call({ path: `/profile/friend/request/remove/${id}`, ...options });
42
42
  }
43
- async hideFriendRequest(id, options) {
44
- return await this.client.call({ path: `/profile/friend/request/hide/${id}`, ...options });
45
- }
46
43
  async getAchivement(id, options) {
47
44
  return await this.client.call({ path: `/achivement/get/${id}`, ...options });
48
45
  }
@@ -1,5 +1,5 @@
1
1
  import { Anixart } from "../client";
2
- import { ICommentRelease, ICommentReleaseRequest, ICommentReleaseResponse, ICommentRepliesRequest, IDubbersResponse, IRelease, IReleaseResponse, ISourcesResponse, IVideo, IVideoReleaseInCategoryRequest, IVideoResponse, IEpisodesResponse, VoteType, IEpisodeResponse, IBaseApiParams, IBaseCommentAddRequest, IBaseSearchRequest, IPageableResponse, IResponse, IReleaseFilterRequest, IProfileShort, IVideoStreamingPlatform } from "../types";
2
+ import { ICommentRelease, ICommentReleaseRequest, ICommentReleaseResponse, ICommentRepliesRequest, IDubbersResponse, IRelease, IReleaseResponse, ISourcesResponse, IVideo, IVideoReleaseInCategoryRequest, IVideoResponse, IEpisodesResponse, VoteType, IEpisodeResponse, IBaseApiParams, IBaseCommentAddRequest, IBaseSearchRequest, IPageableResponse, IResponse, IReleaseFilterRequest, IProfileShort } from "../types";
3
3
  /**
4
4
  * Класс релиза
5
5
  *
@@ -36,6 +36,5 @@ export declare class Release {
36
36
  removeFavorite(id: number, options?: IBaseApiParams): Promise<IResponse>;
37
37
  addToProfileList(id: number, type: number, options?: IBaseApiParams): Promise<IResponse>;
38
38
  removeFromProfileList(id: number, type: number, options?: IBaseApiParams): Promise<IResponse>;
39
- getStreaming(id: number, options?: IBaseApiParams): Promise<IPageableResponse<IVideoStreamingPlatform>>;
40
39
  getCommentVotes(id: number, page: number, options?: IBaseApiParams): Promise<IPageableResponse<IProfileShort>>;
41
40
  }
@@ -94,9 +94,6 @@ class Release {
94
94
  async removeFromProfileList(id, type, options) {
95
95
  return await this.client.call({ path: `/profile/list/delete/${type}/${id}`, ...options });
96
96
  }
97
- async getStreaming(id, options) {
98
- return await this.client.call({ path: `/release/streaming/platform/${id}`, ...options });
99
- }
100
97
  async getCommentVotes(id, page, options) {
101
98
  return await this.client.call({ path: `/release/comment/votes/${id}/${page}`, ...options });
102
99
  }
@@ -24,13 +24,13 @@ class Settings {
24
24
  return await this.client.call({ path: `/profile/preference/social/edit`, json: { vkPage: data.vk_page, tgPage: data.tg_page, instPage: data.inst_page, ttPage: data.tt_page, discordPage: data.discord_page }, ...options });
25
25
  }
26
26
  async confirmChangeEmail(currentPassword, options) {
27
- return await this.client.call({ path: `/profile/preference/email/change/confirm`, queryParams: { current: currentPassword }, ...options });
27
+ return await this.client.call({ path: `/profile/preference/email/confirm`, queryParams: { current: currentPassword }, ...options });
28
28
  }
29
29
  changeEmail(data, options) {
30
- return this.client.call({ path: `/profile/preference/email/change`, queryParams: { current_password: data.password, current: data.oldEmail, new: data.newEmail }, ...options });
30
+ return this.client.call({ path: `/profile/preference/email/edit`, queryParams: { current_password: data.password, current: data.oldEmail, new: data.newEmail }, ...options });
31
31
  }
32
32
  async changePassword(currentPassword, newPassword, options) {
33
- return await this.client.call({ path: `/profile/preference/password/change`, queryParams: { current: currentPassword, new: newPassword }, ...options });
33
+ return await this.client.call({ path: `/profile/preference/password/edit`, queryParams: { current: currentPassword, new: newPassword }, ...options });
34
34
  }
35
35
  async addBlocklist(id, options) {
36
36
  return await this.client.call({ path: `/profile/blocklist/add/${id}`, ...options });
@@ -1,6 +1,5 @@
1
1
  import { Anixart } from "../client";
2
2
  import { IFriendRequestResponse, IPageableResponse, IProfileShort, IVoteRelease } from "../types";
3
- import { Collection } from "./Collection";
4
3
  export declare class BaseProfile {
5
4
  protected readonly client: Anixart;
6
5
  readonly id: number;
@@ -24,5 +23,4 @@ export declare class BaseProfile {
24
23
  sendFriendRequest(): Promise<IFriendRequestResponse>;
25
24
  removeFriendRequest(): Promise<IFriendRequestResponse>;
26
25
  getVotesReleases(page?: number, sort?: number): Promise<IPageableResponse<IVoteRelease>>;
27
- getCollections(page?: number): Promise<Collection[]>;
28
26
  }
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.BaseProfile = void 0;
4
- const Collection_1 = require("./Collection");
5
4
  class BaseProfile {
6
5
  constructor(client, profile) {
7
6
  this.client = client;
@@ -38,9 +37,5 @@ class BaseProfile {
38
37
  const request = await this.client.endpoints.profile.getVotesReleases(this.id, page !== null && page !== void 0 ? page : 0, sort !== null && sort !== void 0 ? sort : 1);
39
38
  return request;
40
39
  }
41
- async getCollections(page) {
42
- const request = await this.client.endpoints.collection.getUserCollections(this.id, page !== null && page !== void 0 ? page : 0);
43
- return request.content.map(x => new Collection_1.Collection(this.client, x));
44
- }
45
40
  }
46
41
  exports.BaseProfile = BaseProfile;
@@ -1,6 +1,5 @@
1
1
  import { Anixart } from "../client";
2
2
  import { BookmarkType, IBaseCommentAddRequest, ICommentRelease, IEpisodeLastUpdate, IRelated, IRelease, IReleaseCategory, IReleaseStatus, IVideoBanners, ResponseCode } from "../types";
3
- import { Collection } from "./Collection";
4
3
  import { Dubber } from "./Dubber";
5
4
  import { ReleaseComment } from "./ReleaseComment";
6
5
  export declare class Release {
@@ -86,6 +85,4 @@ export declare class Release {
86
85
  getComments(page?: number, sort?: number): Promise<ReleaseComment[] | null>;
87
86
  addComment(data: IBaseCommentAddRequest): Promise<ReleaseComment | null>;
88
87
  addVote(vote: 1 | 2 | 3 | 4 | 5): Promise<ResponseCode>;
89
- getCollections(page: number, sort?: number): Promise<Collection[]>;
90
- addToCollection(id: number): Promise<ResponseCode>;
91
88
  }
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Release = void 0;
4
- const Collection_1 = require("./Collection");
5
4
  const Dubber_1 = require("./Dubber");
6
5
  const ReleaseComment_1 = require("./ReleaseComment");
7
6
  class Release {
@@ -137,17 +136,5 @@ class Release {
137
136
  }
138
137
  return request.code;
139
138
  }
140
- async getCollections(page, sort = 0) {
141
- const request = await this.client.endpoints.collection.getReleaseInCollection({
142
- id: this.id,
143
- sort,
144
- page
145
- });
146
- return request.content.map(x => new Collection_1.Collection(this.client, x));
147
- }
148
- async addToCollection(id) {
149
- const request = await this.client.endpoints.collection.addReleaseToCollection(id, this.id);
150
- return request.code;
151
- }
152
139
  }
153
140
  exports.Release = Release;
package/dist/client.d.ts CHANGED
@@ -4,7 +4,6 @@ import { Channel } from "./classes/Channel";
4
4
  import { Article } from "./classes/Article";
5
5
  import { FullProfile } from "./classes/FullProfile";
6
6
  import { Release } from "./classes/Release";
7
- import { Collection } from "./classes/Collection";
8
7
  export interface IAnixartOptions {
9
8
  baseUrl?: string | URL;
10
9
  token?: string;
@@ -23,9 +22,6 @@ export declare class Anixart {
23
22
  getRandomRelease(extended?: boolean): Promise<Release>;
24
23
  getArticleById(id: number): Promise<Article | null>;
25
24
  getReleaseById(id: number, extended?: boolean): Promise<Release | null>;
26
- getCollectionById(id: number): Promise<Collection | null>;
27
- getFavoriteCollections(page: number): Promise<Collection[]>;
28
- getAllCollections(page: number, sort?: number): Promise<Collection[]>;
29
25
  login(username: string, password: string): Promise<ResponseCode>;
30
26
  call<T extends IResponse>(request: IBaseRequest): Promise<T>;
31
27
  }
package/dist/client.js CHANGED
@@ -10,9 +10,8 @@ const Article_1 = require("./classes/Article");
10
10
  const FullProfile_1 = require("./classes/FullProfile");
11
11
  const Release_1 = require("./classes/Release");
12
12
  const form_data_1 = __importDefault(require("form-data"));
13
- const Collection_1 = require("./classes/Collection");
14
13
  const DEFAULT_BASE_URL = 'https://api.anixart.tv';
15
- const USER_AGENT = "AnixartApp/9.0 BETA 3-25021818 (Android 9; SDK 28; x86_64; ROG ASUS AI2201_B; ru)";
14
+ const USER_AGENT = "AnixartApp/9.0 BETA 1-24121614 (Android 9; SDK 28; x86_64; ROG ASUS AI2201_B; ru)";
16
15
  /**
17
16
  * Класс для работы с API Anixart
18
17
  */
@@ -47,18 +46,6 @@ class Anixart {
47
46
  const request = await this.endpoints.release.info(id, extended);
48
47
  return request.release ? new Release_1.Release(this, request.release) : null;
49
48
  }
50
- async getCollectionById(id) {
51
- const request = await this.endpoints.collection.info(id);
52
- return request.collection ? new Collection_1.Collection(this, request.collection) : null;
53
- }
54
- async getFavoriteCollections(page) {
55
- const request = await this.endpoints.collection.getCollectionFavorites(page);
56
- return request.content.map(x => new Collection_1.Collection(this, x));
57
- }
58
- async getAllCollections(page, sort = 2) {
59
- const request = await this.endpoints.collection.all(page, sort);
60
- return request.content.map(x => new Collection_1.Collection(this, x));
61
- }
62
49
  async login(username, password) {
63
50
  const request = await this.endpoints.auth.signIn({
64
51
  login: username,
@@ -3,8 +3,8 @@ import { IRelease } from "./release";
3
3
  import { IResponse } from "./response";
4
4
  import { IBaseRequestPageable } from "./request";
5
5
  export interface ICollection {
6
- '@id': number;
7
- id: number;
6
+ '@id': string;
7
+ id: string;
8
8
  creator: IProfile;
9
9
  title: string;
10
10
  description: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "anixartjs",
3
- "version": "0.0.5-r2",
3
+ "version": "0.0.5",
4
4
  "description": "Anixart API Wrapper for NodeJS",
5
5
  "type": "commonjs",
6
6
  "main": "dist/index.js",
@@ -1,29 +0,0 @@
1
- import { Anixart } from "../client";
2
- import { ICollection, ResponseCode } from "../types";
3
- import { FullProfile } from "./FullProfile";
4
- import { Release } from "./Release";
5
- export declare class Collection {
6
- private readonly client;
7
- readonly localId: number;
8
- readonly id: number;
9
- readonly creator: FullProfile;
10
- readonly title: string;
11
- readonly description: string;
12
- readonly image: string;
13
- readonly creationDate: Date;
14
- readonly lastUpdateDate: Date;
15
- readonly commentCount: number;
16
- readonly favoritesCount: number;
17
- readonly isPrivate: boolean;
18
- readonly isDeleted: boolean;
19
- readonly isFavorite: boolean;
20
- readonly releases: Release[];
21
- constructor(client: Anixart, collectionResponce: ICollection);
22
- private writeProperties;
23
- getReleases(page: number): Promise<Array<Release>>;
24
- addToFavorite(): Promise<ResponseCode>;
25
- removeInFavorite(): Promise<ResponseCode>;
26
- addRelease(id: number): Promise<ResponseCode>;
27
- delete(): Promise<ResponseCode>;
28
- edit(title: string, description: string, releases: Release[], isPrivate: boolean): Promise<Collection | null>;
29
- }
@@ -1,57 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Collection = void 0;
4
- const FullProfile_1 = require("./FullProfile");
5
- const Release_1 = require("./Release");
6
- class Collection {
7
- constructor(client, collectionResponce) {
8
- this.client = client;
9
- this.localId = collectionResponce["@id"];
10
- this.id = collectionResponce.id;
11
- this.creator = new FullProfile_1.FullProfile(this.client, collectionResponce.creator);
12
- this.title = collectionResponce.title;
13
- this.description = collectionResponce.description;
14
- this.image = collectionResponce.image;
15
- this.creationDate = new Date(collectionResponce.creation_date * 1000);
16
- this.lastUpdateDate = new Date(collectionResponce.last_update_date * 1000);
17
- this.commentCount = collectionResponce.comment_count;
18
- this.favoritesCount = collectionResponce.favorites_count;
19
- this.isPrivate = collectionResponce.is_private;
20
- this.isDeleted = collectionResponce.is_deleted;
21
- this.isFavorite = collectionResponce.is_favorite;
22
- this.releases = collectionResponce.releases.map(r => new Release_1.Release(this.client, r));
23
- }
24
- writeProperties(prop, value) {
25
- this[prop] = value;
26
- }
27
- async getReleases(page) {
28
- const request = await this.client.endpoints.collection.getCollectionReleases(this.id, page);
29
- return request.content.map(x => new Release_1.Release(this.client, x));
30
- }
31
- async addToFavorite() {
32
- const request = await this.client.endpoints.collection.addCollectionFavorite(this.id);
33
- return request.code;
34
- }
35
- async removeInFavorite() {
36
- const request = await this.client.endpoints.collection.removeCollectionFavorite(this.id);
37
- return request.code;
38
- }
39
- async addRelease(id) {
40
- const request = await this.client.endpoints.collection.addReleaseToCollection(this.id, id);
41
- return request.code;
42
- }
43
- async delete() {
44
- const request = await this.client.endpoints.collection.deleteCollection(this.id);
45
- return request.code;
46
- }
47
- async edit(title, description, releases, isPrivate) {
48
- const request = await this.client.endpoints.collection.editCollection(this.id, {
49
- title,
50
- description,
51
- releases: releases.map(x => x.id),
52
- is_private: isPrivate
53
- });
54
- return request.code == 0 ? new Collection(this.client, request.collection) : null;
55
- }
56
- }
57
- exports.Collection = Collection;