anixartjs 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/LICENSE +674 -0
  2. package/README.md +187 -0
  3. package/dist/api/auth.d.ts +11 -0
  4. package/dist/api/auth.js +49 -0
  5. package/dist/api/channel.d.ts +42 -0
  6. package/dist/api/channel.js +111 -0
  7. package/dist/api/collection.d.ts +30 -0
  8. package/dist/api/collection.js +57 -0
  9. package/dist/api/discover.d.ts +11 -0
  10. package/dist/api/discover.js +24 -0
  11. package/dist/api/feed.d.ts +9 -0
  12. package/dist/api/feed.js +18 -0
  13. package/dist/api/index.d.ts +9 -0
  14. package/dist/api/index.js +25 -0
  15. package/dist/api/notification.d.ts +14 -0
  16. package/dist/api/notification.js +33 -0
  17. package/dist/api/profile.d.ts +26 -0
  18. package/dist/api/profile.js +59 -0
  19. package/dist/api/release.d.ts +40 -0
  20. package/dist/api/release.js +101 -0
  21. package/dist/api/settings.d.ts +30 -0
  22. package/dist/api/settings.js +81 -0
  23. package/dist/classes/Article.d.ts +18 -0
  24. package/dist/classes/Article.js +43 -0
  25. package/dist/classes/ArticleComment.d.ts +15 -0
  26. package/dist/classes/ArticleComment.js +36 -0
  27. package/dist/classes/BaseArticle.d.ts +21 -0
  28. package/dist/classes/BaseArticle.js +23 -0
  29. package/dist/classes/BaseComment.d.ts +22 -0
  30. package/dist/classes/BaseComment.js +25 -0
  31. package/dist/classes/BaseProfile.d.ts +25 -0
  32. package/dist/classes/BaseProfile.js +37 -0
  33. package/dist/classes/Channel.d.ts +47 -0
  34. package/dist/classes/Channel.js +103 -0
  35. package/dist/classes/Dubber.d.ts +19 -0
  36. package/dist/classes/Dubber.js +24 -0
  37. package/dist/classes/Episode.d.ts +20 -0
  38. package/dist/classes/Episode.js +30 -0
  39. package/dist/classes/FullProfile.d.ts +53 -0
  40. package/dist/classes/FullProfile.js +75 -0
  41. package/dist/classes/Release.d.ts +88 -0
  42. package/dist/classes/Release.js +140 -0
  43. package/dist/classes/ReleaseComment.d.ts +16 -0
  44. package/dist/classes/ReleaseComment.js +44 -0
  45. package/dist/classes/Source.d.ts +15 -0
  46. package/dist/classes/Source.js +20 -0
  47. package/dist/classes/SuggestionArticle.d.ts +14 -0
  48. package/dist/classes/SuggestionArticle.js +28 -0
  49. package/dist/client.d.ts +27 -0
  50. package/dist/client.js +121 -0
  51. package/dist/endpoints.d.ts +18 -0
  52. package/dist/endpoints.js +25 -0
  53. package/dist/index.d.ts +2 -0
  54. package/dist/index.js +20 -0
  55. package/dist/types/auth.d.ts +25 -0
  56. package/dist/types/auth.js +2 -0
  57. package/dist/types/channel.d.ts +178 -0
  58. package/dist/types/channel.js +2 -0
  59. package/dist/types/collection.d.ts +38 -0
  60. package/dist/types/collection.js +2 -0
  61. package/dist/types/index.d.ts +12 -0
  62. package/dist/types/index.js +25 -0
  63. package/dist/types/notification.d.ts +22 -0
  64. package/dist/types/notification.js +2 -0
  65. package/dist/types/profile.d.ts +141 -0
  66. package/dist/types/profile.js +21 -0
  67. package/dist/types/release.d.ts +240 -0
  68. package/dist/types/release.js +23 -0
  69. package/dist/types/request.d.ts +36 -0
  70. package/dist/types/request.js +2 -0
  71. package/dist/types/response.d.ts +51 -0
  72. package/dist/types/response.js +12 -0
  73. package/dist/types/settings.d.ts +61 -0
  74. package/dist/types/settings.js +14 -0
  75. package/dist/utils/ArticleBuilder.d.ts +36 -0
  76. package/dist/utils/ArticleBuilder.js +138 -0
  77. package/dist/utils/LinkParser.d.ts +110 -0
  78. package/dist/utils/LinkParser.js +119 -0
  79. package/dist/utils/Utils.d.ts +3 -0
  80. package/dist/utils/Utils.js +11 -0
  81. package/package.json +32 -0
@@ -0,0 +1,26 @@
1
+ import { Anixart } from "../client";
2
+ import { IProfileResponse, IBookmarkRequest, IFriendsRequest, IProfileShort, IFriendRequestResponse, IBaseApiParams, IBaseSearchRequest, IPageableResponse, IRelease, IProfile, IResponse, ISubsciptionCountResponse } from "../types";
3
+ /**
4
+ * Класс профиля
5
+ *
6
+ * TODO: changeAvatar
7
+ */
8
+ export declare class Profile {
9
+ private readonly client;
10
+ constructor(client: Anixart);
11
+ info(id: number, options?: IBaseApiParams): Promise<IProfileResponse>;
12
+ getBookmarks(data: IBookmarkRequest, options?: IBaseApiParams): Promise<IPageableResponse<IRelease>>;
13
+ addBookmark(id: number, type: number, options?: IBaseApiParams): Promise<IResponse>;
14
+ removeBookmark(id: number, type: number, options?: IBaseApiParams): Promise<IResponse>;
15
+ search(data: IBaseSearchRequest, options?: IBaseApiParams): Promise<IPageableResponse<IProfile>>;
16
+ getFriends(data: IFriendsRequest, options?: IBaseApiParams): Promise<IPageableResponse<IProfileShort>>;
17
+ getFriendRecomendation(options?: IBaseApiParams): Promise<IPageableResponse<IProfileShort>>;
18
+ getFriendRequests(type: "in" | "out", count: number, options?: IBaseApiParams): Promise<IPageableResponse<IProfileShort>>;
19
+ sendFriendRequest(id: number, options?: IBaseApiParams): Promise<IFriendRequestResponse>;
20
+ removeFriendRequest(id: number, options?: IBaseApiParams): Promise<IFriendRequestResponse>;
21
+ getAchivement(id: number, options?: IBaseApiParams): Promise<IResponse>;
22
+ getFavorites(data: IBookmarkRequest, options?: IBaseApiParams): Promise<IPageableResponse<IRelease>>;
23
+ getSubsciptions(page: number, options?: IBaseApiParams): Promise<IPageableResponse<any>>;
24
+ getSubscriptionCount(options?: IBaseApiParams): Promise<ISubsciptionCountResponse>;
25
+ getVotesReleases(id: number, page: number, sort?: number, options?: IBaseApiParams): Promise<IPageableResponse<IProfileShort>>;
26
+ }
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Profile = void 0;
4
+ /**
5
+ * Класс профиля
6
+ *
7
+ * TODO: changeAvatar
8
+ */
9
+ class Profile {
10
+ constructor(client) {
11
+ this.client = client;
12
+ }
13
+ async info(id, options) {
14
+ return this.client.call({ path: `/profile/${id}`, ...options });
15
+ }
16
+ async getBookmarks(data, options) {
17
+ return this.client.call({ path: `/profile/list/all/${data.id ? `${data.id}/` : ""}${data.type}/${data.page}`, queryParams: { sort: data.sort, filter: data.filter, filter_announce: data.filter_announce }, ...options });
18
+ }
19
+ async addBookmark(id, type, options) {
20
+ return this.client.call({ path: `/profile/list/add/${type}/${id}`, ...options });
21
+ }
22
+ async removeBookmark(id, type, options) {
23
+ return this.client.call({ path: `/profile/list/delete/${type}/${id}`, ...options });
24
+ }
25
+ async search(data, options) {
26
+ return this.client.call({ path: `/search/profiles/${data.page}`, json: { query: data.query, page: data.page }, ...options });
27
+ }
28
+ async getFriends(data, options) {
29
+ return await this.client.call({ path: `/profile/friend/all/${data.id}/${data.page}`, ...options });
30
+ }
31
+ async getFriendRecomendation(options) {
32
+ return await this.client.call({ path: `/profile/friend/recomendations`, ...options });
33
+ }
34
+ async getFriendRequests(type, count, options) {
35
+ return await this.client.call({ path: `/profile/friend/requests/${type}/last`, queryParams: { count }, ...options });
36
+ }
37
+ async sendFriendRequest(id, options) {
38
+ return await this.client.call({ path: `/profile/friend/request/send/${id}`, ...options });
39
+ }
40
+ async removeFriendRequest(id, options) {
41
+ return await this.client.call({ path: `/profile/friend/request/remove/${id}`, ...options });
42
+ }
43
+ async getAchivement(id, options) {
44
+ return await this.client.call({ path: `/achivement/get/${id}`, ...options });
45
+ }
46
+ async getFavorites(data, options) {
47
+ return await this.client.call({ path: `/favorite/all/${data.page}`, queryParams: { sort: data.sort, filter: data.filter, filter_announce: data.filter_announce }, ...options });
48
+ }
49
+ async getSubsciptions(page, options) {
50
+ return await this.client.call({ path: `/channel/subscription/all/${page}`, ...options });
51
+ }
52
+ async getSubscriptionCount(options) {
53
+ return await this.client.call({ path: `/channel/subscription/count`, ...options });
54
+ }
55
+ async getVotesReleases(id, page, sort = 1, options) {
56
+ return await this.client.call({ path: `/profile/vote/release/voted/${id}/${page}`, queryParams: { sort }, ...options });
57
+ }
58
+ }
59
+ exports.Profile = Profile;
@@ -0,0 +1,40 @@
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 } from "../types";
3
+ /**
4
+ * Класс релиза
5
+ *
6
+ * TODO: notification
7
+ */
8
+ export declare class Release {
9
+ private readonly client;
10
+ constructor(client: Anixart);
11
+ info(id: number, extended?: boolean, options?: IBaseApiParams): Promise<IReleaseResponse>;
12
+ addVote(id: number, vote: 1 | 2 | 3 | 4 | 5, options?: IBaseApiParams): Promise<IResponse>;
13
+ removeVote(id: number, options?: IBaseApiParams): Promise<IResponse>;
14
+ getComments(data: ICommentReleaseRequest, options?: IBaseApiParams): Promise<IPageableResponse<ICommentRelease>>;
15
+ addComment(id: number, data: IBaseCommentAddRequest, options?: IBaseApiParams): Promise<ICommentReleaseResponse>;
16
+ voteComment(id: number, vote: VoteType, options?: IBaseApiParams): Promise<IResponse>;
17
+ removeComment(id: number, options?: IBaseApiParams): Promise<IResponse>;
18
+ editComment(id: number, message: string, spoiler: boolean, options?: IBaseApiParams): Promise<IResponse>;
19
+ getCommentReplies(data: ICommentRepliesRequest, options?: IBaseApiParams): Promise<IPageableResponse<ICommentRelease>>;
20
+ getRelatedReleases(id: number, page: number, options?: IBaseApiParams): Promise<IPageableResponse<IRelease>>;
21
+ getVideos(id: number, options?: IBaseApiParams): Promise<IVideoResponse>;
22
+ getVideoInCategory(data: IVideoReleaseInCategoryRequest, options?: IBaseApiParams): Promise<IPageableResponse<IVideo>>;
23
+ search(data: IBaseSearchRequest, options?: IBaseApiParams): Promise<IPageableResponse<IRelease>>;
24
+ getDubbers(id: number, options?: IBaseApiParams): Promise<IDubbersResponse>;
25
+ getDubberSources(id: number, dubberId: number, options?: IBaseApiParams): Promise<ISourcesResponse>;
26
+ getEpisodes(id: number, dubberId: number, sourceId: number, sort?: number, options?: IBaseApiParams): Promise<IEpisodesResponse>;
27
+ getEpisode(id: number, sourceId: number, episodePosition: number, options?: IBaseApiParams): Promise<IEpisodeResponse>;
28
+ getRandomRelease(extended?: boolean, options?: IBaseApiParams): Promise<IReleaseResponse>;
29
+ markEpisodeAsWatched(id: number, sourceId: number, episodePosition: number, options?: IBaseApiParams): Promise<IResponse>;
30
+ unmarkEpisodeAsWatched(id: number, sourceId: number, episodePosition: number, options?: IBaseApiParams): Promise<IResponse>;
31
+ addToHistory(id: number, sourceId: number, episodePosition: number, options?: IBaseApiParams): Promise<IResponse>;
32
+ removeFromHistory(id: number, options?: IBaseApiParams): Promise<IResponse>;
33
+ getHistory(page: number, options?: IBaseApiParams): Promise<IPageableResponse<IRelease>>;
34
+ filter(page: number, data: IReleaseFilterRequest, extended?: boolean, options?: IBaseApiParams): Promise<IPageableResponse<IRelease>>;
35
+ addFavorite(id: number, options?: IBaseApiParams): Promise<IResponse>;
36
+ removeFavorite(id: number, options?: IBaseApiParams): Promise<IResponse>;
37
+ addToProfileList(id: number, type: number, options?: IBaseApiParams): Promise<IResponse>;
38
+ removeFromProfileList(id: number, type: number, options?: IBaseApiParams): Promise<IResponse>;
39
+ getCommentVotes(id: number, page: number, options?: IBaseApiParams): Promise<IPageableResponse<IProfileShort>>;
40
+ }
@@ -0,0 +1,101 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Release = void 0;
4
+ /**
5
+ * Класс релиза
6
+ *
7
+ * TODO: notification
8
+ */
9
+ class Release {
10
+ constructor(client) {
11
+ this.client = client;
12
+ }
13
+ async info(id, extended = true, options) {
14
+ return await this.client.call({ path: `/release/${id}`, queryParams: { extended_mode: extended }, ...options });
15
+ }
16
+ async addVote(id, vote, options) {
17
+ return await this.client.call({ path: `/release/vote/add/${id}/${vote}`, ...options });
18
+ }
19
+ async removeVote(id, options) {
20
+ return await this.client.call({ path: `/release/vote/delete/${id}`, ...options });
21
+ }
22
+ async getComments(data, options) {
23
+ return this.client.call({ path: `/release/comment/all/${data.id}/${data.page}`, queryParams: { sort: data.sort }, ...options });
24
+ }
25
+ async addComment(id, data, options) {
26
+ return await this.client.call({ path: `/release/comment/add/${id}`, json: data, ...options });
27
+ }
28
+ async voteComment(id, vote, options) {
29
+ return await this.client.call({ path: `/release/comment/vote/${id}/${vote}`, ...options });
30
+ }
31
+ async removeComment(id, options) {
32
+ return await this.client.call({ path: `/release/comment/delete/${id}`, ...options });
33
+ }
34
+ async editComment(id, message, spoiler, options) {
35
+ return await this.client.call({ path: `/release/comment/edit/${id}`, json: { message, spoiler }, ...options });
36
+ }
37
+ async getCommentReplies(data, options) {
38
+ return await this.client.call({ path: `/release/comment/replies/${data.id}/${data.page}`, queryParams: { sort: data.sort }, ...options });
39
+ }
40
+ async getRelatedReleases(id, page, options) {
41
+ return await this.client.call({ path: `/related/${id}/${page}`, apiV2: true, ...options });
42
+ }
43
+ async getVideos(id, options) {
44
+ return await this.client.call({ path: `/video/release/${id}`, ...options });
45
+ }
46
+ async getVideoInCategory(data, options) {
47
+ return await this.client.call({ path: `/video/release/${data.id}/category/${data.categoryId}/${data.page}`, ...options });
48
+ }
49
+ async search(data, options) {
50
+ return await this.client.call({ path: `/search/releases/${data.page}`, json: { query: data.query, page: data.page }, apiV2: true, ...options });
51
+ }
52
+ async getDubbers(id, options) {
53
+ return await this.client.call({ path: `/episode/${id}`, ...options });
54
+ }
55
+ async getDubberSources(id, dubberId, options) {
56
+ return await this.client.call({ path: `/episode/${id}/${dubberId}`, ...options });
57
+ }
58
+ async getEpisodes(id, dubberId, sourceId, sort = 1, options) {
59
+ return await this.client.call({ path: `/episode/${id}/${dubberId}/${sourceId}`, queryParams: { sort }, ...options });
60
+ }
61
+ async getEpisode(id, sourceId, episodePosition, options) {
62
+ return await this.client.call({ path: `/episode/target/${id}/${sourceId}/${episodePosition}`, ...options });
63
+ }
64
+ async getRandomRelease(extended, options) {
65
+ return await this.client.call({ path: `/release/random`, queryParams: { extended_mode: extended !== null && extended !== void 0 ? extended : true }, ...options });
66
+ }
67
+ async markEpisodeAsWatched(id, sourceId, episodePosition, options) {
68
+ return await this.client.call({ path: `/episode/watch/${id}/${sourceId}/${episodePosition}`, ...options });
69
+ }
70
+ async unmarkEpisodeAsWatched(id, sourceId, episodePosition, options) {
71
+ return await this.client.call({ path: `/episode/unwatch/${id}/${sourceId}/${episodePosition}`, ...options });
72
+ }
73
+ async addToHistory(id, sourceId, episodePosition, options) {
74
+ return await this.client.call({ path: `/history/add/${id}/${sourceId}/${episodePosition}`, ...options });
75
+ }
76
+ async removeFromHistory(id, options) {
77
+ return await this.client.call({ path: `/history/delete/${id}`, ...options });
78
+ }
79
+ async getHistory(page, options) {
80
+ return await this.client.call({ path: `/history/${page}`, ...options });
81
+ }
82
+ async filter(page, data, extended, options) {
83
+ return await this.client.call({ path: `/filter/${page}`, queryParams: { extended_mode: extended !== null && extended !== void 0 ? extended : true }, json: data, ...options });
84
+ }
85
+ async addFavorite(id, options) {
86
+ return await this.client.call({ path: `/favorite/add/${id}`, ...options });
87
+ }
88
+ async removeFavorite(id, options) {
89
+ return await this.client.call({ path: `/favorite/delete/${id}`, ...options });
90
+ }
91
+ async addToProfileList(id, type, options) {
92
+ return await this.client.call({ path: `/profile/list/add/${type}/${id}`, ...options });
93
+ }
94
+ async removeFromProfileList(id, type, options) {
95
+ return await this.client.call({ path: `/profile/list/delete/${type}/${id}`, ...options });
96
+ }
97
+ async getCommentVotes(id, page, options) {
98
+ return await this.client.call({ path: `/release/comment/votes/${id}/${page}`, ...options });
99
+ }
100
+ }
101
+ exports.Release = Release;
@@ -0,0 +1,30 @@
1
+ import { Anixart } from "../client";
2
+ import { IBadgesResponse, IEmailChangeConfirmResponse, IEmailChangeRequest, ILoginInfoResponse, INewLogin, IProfileSettingsResponse, PrivacyFriendRequestState, PrivacyState, IProfileShort, ISocialResponse, IBaseApiParams, IPageableResponse, IResponse, IPasswordChangeResponse } from "../types";
3
+ export declare class Settings {
4
+ private readonly client;
5
+ constructor(client: Anixart);
6
+ getCurrentProfileSettings(options?: IBaseApiParams): Promise<IProfileSettingsResponse>;
7
+ getBadges(page: number, options?: IBaseApiParams): Promise<IBadgesResponse>;
8
+ setStatus(status: string, options?: IBaseApiParams): Promise<IResponse>;
9
+ getBlocklist(page: number, options?: IBaseApiParams): Promise<IPageableResponse<IProfileShort>>;
10
+ getSocial(options?: IBaseApiParams): Promise<ISocialResponse>;
11
+ setSocial(data: ISocialResponse, options?: IBaseApiParams): Promise<IResponse>;
12
+ confirmChangeEmail(currentPassword: string, options?: IBaseApiParams): Promise<IEmailChangeConfirmResponse>;
13
+ changeEmail(data: IEmailChangeRequest, options?: IBaseApiParams): Promise<IResponse>;
14
+ changePassword(currentPassword: string, newPassword: string, options?: IBaseApiParams): Promise<IPasswordChangeResponse>;
15
+ addBlocklist(id: number, options?: IBaseApiParams): Promise<IResponse>;
16
+ removeBlocklist(id: number, options?: IBaseApiParams): Promise<IResponse>;
17
+ getLoginInfo(options?: IBaseApiParams): Promise<ILoginInfoResponse>;
18
+ getLoginHistory(id: number, page: number, options?: IBaseApiParams): Promise<IPageableResponse<INewLogin>>;
19
+ changeLogin(newLogin: string, options?: IBaseApiParams): Promise<IResponse>;
20
+ setCommentNotification(options?: IBaseApiParams): Promise<IResponse>;
21
+ setCollectionCommentNotification(options?: IBaseApiParams): Promise<IResponse>;
22
+ setReportProgressNotification(options?: IBaseApiParams): Promise<IResponse>;
23
+ setRelatedReleaseNotification(options?: IBaseApiParams): Promise<IResponse>;
24
+ setEpisodeNotification(options?: IBaseApiParams): Promise<IResponse>;
25
+ setStatusNotification(options?: IBaseApiParams): Promise<IResponse>;
26
+ setPrivacyStats(state: PrivacyState, options?: IBaseApiParams): Promise<IResponse>;
27
+ setPrivacyCounts(state: PrivacyState, options?: IBaseApiParams): Promise<IResponse>;
28
+ setPrivacySocial(state: PrivacyState, options?: IBaseApiParams): Promise<IResponse>;
29
+ setPrivacyFriendRequests(state: PrivacyFriendRequestState, options?: IBaseApiParams): Promise<IResponse>;
30
+ }
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Settings = void 0;
4
+ class Settings {
5
+ constructor(client) {
6
+ this.client = client;
7
+ }
8
+ async getCurrentProfileSettings(options) {
9
+ return await this.client.call({ path: `/profile/preference/my`, ...options });
10
+ }
11
+ async getBadges(page, options) {
12
+ return await this.client.call({ path: `/profile/preference/badges/${page}`, ...options });
13
+ }
14
+ async setStatus(status, options) {
15
+ return await this.client.call({ path: `/profile/preference/status/edit`, json: { status }, ...options });
16
+ }
17
+ async getBlocklist(page, options) {
18
+ return await this.client.call({ path: `/profile/preference/blocklist/${page}`, ...options });
19
+ }
20
+ async getSocial(options) {
21
+ return await this.client.call({ path: `/profile/preference/social`, ...options });
22
+ }
23
+ async setSocial(data, options) {
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
+ }
26
+ async confirmChangeEmail(currentPassword, options) {
27
+ return await this.client.call({ path: `/profile/preference/email/confirm`, queryParams: { current: currentPassword }, ...options });
28
+ }
29
+ changeEmail(data, options) {
30
+ return this.client.call({ path: `/profile/preference/email/edit`, queryParams: { current_password: data.password, current: data.oldEmail, new: data.newEmail }, ...options });
31
+ }
32
+ async changePassword(currentPassword, newPassword, options) {
33
+ return await this.client.call({ path: `/profile/preference/password/edit`, queryParams: { current: currentPassword, new: newPassword }, ...options });
34
+ }
35
+ async addBlocklist(id, options) {
36
+ return await this.client.call({ path: `/profile/blocklist/add/${id}`, ...options });
37
+ }
38
+ async removeBlocklist(id, options) {
39
+ return await this.client.call({ path: `/profile/blocklist/remove/${id}`, ...options });
40
+ }
41
+ async getLoginInfo(options) {
42
+ return await this.client.call({ path: `/profile/preference/login/info`, ...options });
43
+ }
44
+ async getLoginHistory(id, page, options) {
45
+ return await this.client.call({ path: `/profile/login/history/all/${id}/${page}`, ...options });
46
+ }
47
+ async changeLogin(newLogin, options) {
48
+ return await this.client.call({ path: `/profile/preference/login/change`, queryParams: { login: newLogin }, ...options });
49
+ }
50
+ async setCommentNotification(options) {
51
+ return await this.client.call({ path: `/profile/preference/notification/comment/edit`, ...options });
52
+ }
53
+ async setCollectionCommentNotification(options) {
54
+ return await this.client.call({ path: `/profile/preference/notification/my/collection/comment/edit`, ...options });
55
+ }
56
+ async setReportProgressNotification(options) {
57
+ return await this.client.call({ path: `/profile/preference/notification/report/process/edit`, ...options });
58
+ }
59
+ async setRelatedReleaseNotification(options) {
60
+ return await this.client.call({ path: `/profile/preference/notification/related/release/edit`, ...options });
61
+ }
62
+ async setEpisodeNotification(options) {
63
+ return await this.client.call({ path: `/profile/preference/notification/episode/edit`, ...options });
64
+ }
65
+ async setStatusNotification(options) {
66
+ return await this.client.call({ path: `/profile/preference/notification/status/edit`, ...options });
67
+ }
68
+ async setPrivacyStats(state, options) {
69
+ return await this.client.call({ path: `/profile/preference/privacy/stats/edit`, json: { permission: state }, ...options });
70
+ }
71
+ async setPrivacyCounts(state, options) {
72
+ return await this.client.call({ path: `/profile/preference/privacy/counts/edit`, json: { permission: state }, ...options });
73
+ }
74
+ async setPrivacySocial(state, options) {
75
+ return await this.client.call({ path: `/profile/preference/privacy/social/edit`, json: { permission: state }, ...options });
76
+ }
77
+ async setPrivacyFriendRequests(state, options) {
78
+ return await this.client.call({ path: `/profile/preference/privacy/friendRequests/edit`, json: { permission: state }, ...options });
79
+ }
80
+ }
81
+ exports.Settings = Settings;
@@ -0,0 +1,18 @@
1
+ import { Channel } from "./Channel";
2
+ import { Anixart } from "../client";
3
+ import { IArticle, ResponseCode, IBaseCommentAddRequest, VoteType } from "../types";
4
+ import { ArticleComment } from "./ArticleComment";
5
+ import { ArticleBuilder } from "../utils/ArticleBuilder";
6
+ import { BaseArticle } from "./BaseArticle";
7
+ export declare class Article extends BaseArticle {
8
+ readonly client: Anixart;
9
+ readonly repostArticle: Article | null;
10
+ readonly channel: Channel;
11
+ constructor(client: Anixart, articleResponce: IArticle, channel?: Channel);
12
+ private writeProperties;
13
+ getComments(page?: number, sort?: number): Promise<ArticleComment[]>;
14
+ addComment(data: IBaseCommentAddRequest): Promise<ArticleComment | null>;
15
+ setVote(type: VoteType): Promise<ResponseCode>;
16
+ edit(data: ArticleBuilder): Promise<Article>;
17
+ delete(): Promise<ResponseCode>;
18
+ }
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Article = void 0;
4
+ const Channel_1 = require("./Channel");
5
+ const ArticleComment_1 = require("./ArticleComment");
6
+ const BaseArticle_1 = require("./BaseArticle");
7
+ class Article extends BaseArticle_1.BaseArticle {
8
+ constructor(client, articleResponce, channel) {
9
+ super(client, articleResponce, channel);
10
+ this.client = client;
11
+ this.channel = channel !== null && channel !== void 0 ? channel : new Channel_1.Channel(this.client, articleResponce.channel);
12
+ this.repostArticle = articleResponce.repost_article
13
+ ? new Article(client, articleResponce.repost_article, channel)
14
+ : null;
15
+ }
16
+ writeProperties(prop, value) {
17
+ this[prop] = value;
18
+ }
19
+ async getComments(page, sort) {
20
+ const request = await this.client.endpoints.channel.getComments(this.id, page !== null && page !== void 0 ? page : 0, sort !== null && sort !== void 0 ? sort : 2);
21
+ return request.content.map(comment => new ArticleComment_1.ArticleComment(this.client, comment));
22
+ }
23
+ async addComment(data) {
24
+ const request = await this.client.endpoints.channel.addArticleComment(this.id, data);
25
+ return request.code == 0 && request.comment ? new ArticleComment_1.ArticleComment(this.client, request === null || request === void 0 ? void 0 : request.comment) : null;
26
+ }
27
+ async setVote(type) {
28
+ const request = await this.client.endpoints.channel.voteArticle(this.id, type);
29
+ if (request.code == 0) {
30
+ this.writeProperties("vote", type == this.vote ? 0 : type);
31
+ }
32
+ return request.code;
33
+ }
34
+ async edit(data) {
35
+ const request = await this.client.endpoints.channel.editArticle(this.id, data.returnBuildAricle());
36
+ return new Article(this.client, request.article, this.channel);
37
+ }
38
+ async delete() {
39
+ const request = await this.client.endpoints.channel.removeArticle(this.id);
40
+ return request.code;
41
+ }
42
+ }
43
+ exports.Article = Article;
@@ -0,0 +1,15 @@
1
+ import { Anixart } from "../client";
2
+ import { BaseComment } from "./BaseComment";
3
+ import { IArticleComment, ResponseCode, VoteType } from "../types";
4
+ import { Article } from "./Article";
5
+ import { BaseProfile } from "./BaseProfile";
6
+ export declare class ArticleComment extends BaseComment {
7
+ readonly client: Anixart;
8
+ readonly article: Article;
9
+ constructor(client: Anixart, comment: IArticleComment);
10
+ private writeProperties;
11
+ getVotes(page?: number, sort?: number): Promise<BaseProfile[]>;
12
+ getReplies(page?: number, sort?: number): Promise<ArticleComment[]>;
13
+ delete(): Promise<ResponseCode>;
14
+ setVote(type: VoteType): Promise<ResponseCode>;
15
+ }
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ArticleComment = void 0;
4
+ const BaseComment_1 = require("./BaseComment");
5
+ const Article_1 = require("./Article");
6
+ const BaseProfile_1 = require("./BaseProfile");
7
+ class ArticleComment extends BaseComment_1.BaseComment {
8
+ constructor(client, comment) {
9
+ super(client, comment);
10
+ this.client = client;
11
+ this.article = new Article_1.Article(client, comment.article);
12
+ }
13
+ writeProperties(prop, value) {
14
+ this[prop] = value;
15
+ }
16
+ async getVotes(page, sort) {
17
+ const request = await this.client.endpoints.channel.getVotes(this.id, page !== null && page !== void 0 ? page : 0, sort !== null && sort !== void 0 ? sort : 2);
18
+ return request.content.map(profile => new BaseProfile_1.BaseProfile(this.client, profile));
19
+ }
20
+ async getReplies(page, sort) {
21
+ const request = await this.client.endpoints.channel.getCommentReplies(this.id, page !== null && page !== void 0 ? page : 0, sort !== null && sort !== void 0 ? sort : 2);
22
+ return request.content.map(comment => new ArticleComment(this.client, comment));
23
+ }
24
+ async delete() {
25
+ const request = await this.client.endpoints.channel.removeArticleComment(this.id);
26
+ return request.code;
27
+ }
28
+ async setVote(type) {
29
+ const request = await this.client.endpoints.channel.voteCommentArticle(this.id, type);
30
+ if (request.code == 0) {
31
+ this.writeProperties("vote", type == this.vote ? 0 : type);
32
+ }
33
+ return request.code;
34
+ }
35
+ }
36
+ exports.ArticleComment = ArticleComment;
@@ -0,0 +1,21 @@
1
+ import { Channel } from "./Channel";
2
+ import { Anixart } from "../client";
3
+ import { IArticle, IArticlePayloadBlock } from "../types";
4
+ import { FullProfile } from "./FullProfile";
5
+ export declare class BaseArticle {
6
+ readonly client: Anixart;
7
+ readonly id: number;
8
+ readonly payloadTime: Date;
9
+ readonly payloadBlocks: IArticlePayloadBlock[];
10
+ readonly vote: number;
11
+ readonly isDeleted: boolean;
12
+ readonly commentCount: number;
13
+ readonly repostCount: number;
14
+ readonly voteCount: number;
15
+ readonly creationDate: Date;
16
+ readonly lastUpdateDate: Date;
17
+ readonly underModerationReason: string;
18
+ readonly isUnderModeration: boolean;
19
+ readonly author: FullProfile | null;
20
+ constructor(client: Anixart, articleResponce: IArticle, channel?: Channel);
21
+ }
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BaseArticle = void 0;
4
+ const FullProfile_1 = require("./FullProfile");
5
+ class BaseArticle {
6
+ constructor(client, articleResponce, channel) {
7
+ this.client = client;
8
+ this.id = articleResponce.id;
9
+ this.payloadTime = new Date(articleResponce.payload.time);
10
+ this.author = articleResponce.author ? new FullProfile_1.FullProfile(this.client, articleResponce.author) : null;
11
+ this.payloadBlocks = articleResponce.payload.blocks;
12
+ this.vote = articleResponce.vote;
13
+ this.commentCount = articleResponce.comment_count;
14
+ this.repostCount = articleResponce.repost_count;
15
+ this.voteCount = articleResponce.vote_count;
16
+ this.creationDate = new Date(articleResponce.creation_date * 1000);
17
+ this.lastUpdateDate = new Date(articleResponce.last_update_date * 1000);
18
+ this.underModerationReason = articleResponce.under_moderation_reason;
19
+ this.isUnderModeration = articleResponce.is_under_moderation;
20
+ this.isDeleted = articleResponce.is_deleted;
21
+ }
22
+ }
23
+ exports.BaseArticle = BaseArticle;
@@ -0,0 +1,22 @@
1
+ import { Anixart } from "../client";
2
+ import { IBaseComment } from "../types";
3
+ import { BaseProfile } from "./BaseProfile";
4
+ export declare class BaseComment {
5
+ protected readonly client: Anixart;
6
+ readonly id: number;
7
+ readonly profile: BaseProfile;
8
+ readonly message: string;
9
+ readonly timestamp: Date;
10
+ readonly type: number;
11
+ readonly vote: number;
12
+ readonly parentCommentId: number;
13
+ readonly voteCount: number;
14
+ readonly likesCount: number;
15
+ readonly isSpoiler: boolean;
16
+ readonly isEdited: boolean;
17
+ readonly isDeleted: boolean;
18
+ readonly isReply: boolean;
19
+ readonly replyCount: number;
20
+ readonly canLike: boolean;
21
+ constructor(client: Anixart, comment: IBaseComment);
22
+ }
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BaseComment = void 0;
4
+ const BaseProfile_1 = require("./BaseProfile");
5
+ class BaseComment {
6
+ constructor(client, comment) {
7
+ this.client = client;
8
+ this.id = comment.id;
9
+ this.profile = new BaseProfile_1.BaseProfile(this.client, comment.profile);
10
+ this.message = comment.message;
11
+ this.timestamp = new Date(comment.timestamp * 1000);
12
+ this.type = comment.type;
13
+ this.vote = comment.vote;
14
+ this.parentCommentId = comment.parent_comment_id;
15
+ this.voteCount = comment.vote_count;
16
+ this.likesCount = comment.likes_count;
17
+ this.isSpoiler = comment.is_spoiler;
18
+ this.isEdited = comment.is_edited;
19
+ this.isDeleted = comment.is_deleted;
20
+ this.isReply = comment.is_reply;
21
+ this.replyCount = comment.reply_count;
22
+ this.canLike = comment.can_like;
23
+ }
24
+ }
25
+ exports.BaseComment = BaseComment;
@@ -0,0 +1,25 @@
1
+ import { Anixart } from "../client";
2
+ import { IFriendRequestResponse, IProfileShort } from "../types";
3
+ export declare class BaseProfile {
4
+ protected readonly client: Anixart;
5
+ readonly id: number;
6
+ readonly login: string;
7
+ readonly avatar: string;
8
+ readonly banExpires: Date;
9
+ readonly banReason: string;
10
+ readonly privilegeLevel: number;
11
+ readonly badgeId: number | null;
12
+ readonly badgeName: string | null;
13
+ readonly badgeType: number | null;
14
+ readonly badgeUrl: string | null;
15
+ readonly isBanned: boolean;
16
+ readonly isSponsor: boolean;
17
+ readonly isVerified: boolean;
18
+ readonly isOnline: boolean;
19
+ readonly friendStatus: number;
20
+ readonly friendCount: number;
21
+ constructor(client: Anixart, profile: IProfileShort);
22
+ getFriends(page?: number): Promise<BaseProfile[]>;
23
+ sendFriendRequest(): Promise<IFriendRequestResponse>;
24
+ removeFriendRequest(): Promise<IFriendRequestResponse>;
25
+ }
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BaseProfile = void 0;
4
+ class BaseProfile {
5
+ constructor(client, profile) {
6
+ this.client = client;
7
+ this.id = profile.id;
8
+ this.login = profile.login;
9
+ this.avatar = profile.avatar;
10
+ this.banExpires = new Date(profile.ban_expires * 1000);
11
+ this.banReason = profile.ban_reason;
12
+ this.privilegeLevel = profile.privilege_level;
13
+ this.badgeId = profile.badge_id;
14
+ this.badgeName = profile.badge_name;
15
+ this.badgeType = profile.badge_type;
16
+ this.badgeUrl = profile.badge_url;
17
+ this.isBanned = profile.is_banned;
18
+ this.isSponsor = profile.is_sponsor;
19
+ this.isVerified = profile.is_verified;
20
+ this.isOnline = profile.is_online;
21
+ this.friendStatus = profile.friend_status;
22
+ this.friendCount = profile.friend_count;
23
+ }
24
+ async getFriends(page) {
25
+ const request = await this.client.endpoints.profile.getFriends({ id: this.id, page: page !== null && page !== void 0 ? page : 0 });
26
+ return request.content.map(profile => new BaseProfile(this.client, profile));
27
+ }
28
+ async sendFriendRequest() {
29
+ const request = await this.client.endpoints.profile.sendFriendRequest(this.id);
30
+ return request;
31
+ }
32
+ async removeFriendRequest() {
33
+ const request = await this.client.endpoints.profile.removeFriendRequest(this.id);
34
+ return request;
35
+ }
36
+ }
37
+ exports.BaseProfile = BaseProfile;