anixartjs 0.0.9 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/auth.d.ts +4 -4
- package/dist/api/channel.d.ts +9 -9
- package/dist/api/collection.d.ts +7 -14
- package/dist/api/collection.js +0 -7
- package/dist/api/profile.d.ts +8 -4
- package/dist/api/profile.js +15 -1
- package/dist/api/release.d.ts +4 -3
- package/dist/api/release.js +3 -0
- package/dist/api/settings.d.ts +5 -5
- package/dist/classes/Article.d.ts +3 -3
- package/dist/classes/Article.js +3 -2
- package/dist/classes/ArticleComment.d.ts +3 -3
- package/dist/classes/ArticleComment.js +2 -1
- package/dist/classes/BaseProfile.d.ts +4 -3
- package/dist/classes/BaseProfile.js +6 -2
- package/dist/classes/Channel.d.ts +4 -4
- package/dist/classes/Channel.js +6 -5
- package/dist/classes/Collection.d.ts +5 -5
- package/dist/classes/Collection.js +2 -1
- package/dist/classes/Episode.d.ts +3 -3
- package/dist/classes/Release.d.ts +7 -7
- package/dist/classes/Release.js +9 -8
- package/dist/classes/ReleaseComment.d.ts +4 -4
- package/dist/classes/ReleaseComment.js +3 -2
- package/dist/classes/SuggestionArticle.d.ts +2 -2
- package/dist/classes/SuggestionArticle.js +2 -1
- package/dist/client.d.ts +3 -3
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/types/auth.d.ts +41 -2
- package/dist/types/auth.js +45 -0
- package/dist/types/channel.d.ts +88 -8
- package/dist/types/channel.js +95 -0
- package/dist/types/collection.d.ts +38 -4
- package/dist/types/collection.js +42 -0
- package/dist/types/profile.d.ts +20 -2
- package/dist/types/profile.js +22 -1
- package/dist/types/release.d.ts +30 -3
- package/dist/types/release.js +10 -1
- package/dist/types/response.d.ts +26 -6
- package/dist/types/response.js +33 -10
- package/dist/types/settings.d.ts +33 -2
- package/dist/types/settings.js +39 -1
- package/package.json +1 -1
package/dist/api/auth.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Anixart } from "../client";
|
|
2
|
-
import { ILoginResponse, ILoginRequest, IRegisterRequest, IRegisterResponse, IRegisterVerifyRequest, IBaseApiParams, IRestorePasswordRequest } from "../types";
|
|
2
|
+
import { ILoginResponse, ILoginRequest, IRegisterRequest, IRegisterResponse, IRegisterVerifyRequest, IBaseApiParams, IRestorePasswordRequest, RegisterVerifyResult, RestorePasswordResult, RestorePasswordVerifyResult } from "../types";
|
|
3
3
|
export declare class Auth {
|
|
4
4
|
private readonly client;
|
|
5
5
|
constructor(client: Anixart);
|
|
6
6
|
signIn(data: ILoginRequest, options?: IBaseApiParams): Promise<ILoginResponse>;
|
|
7
7
|
signUp(data: IRegisterRequest, options?: IBaseApiParams): Promise<IRegisterResponse>;
|
|
8
|
-
signUpVerify(data: IRegisterVerifyRequest, options?: IBaseApiParams): Promise<ILoginResponse
|
|
9
|
-
restore(login: string, options?: IBaseApiParams): Promise<IRegisterResponse
|
|
10
|
-
restoreVerify(data: IRestorePasswordRequest, options?: IBaseApiParams): Promise<ILoginResponse
|
|
8
|
+
signUpVerify(data: IRegisterVerifyRequest, options?: IBaseApiParams): Promise<ILoginResponse<RegisterVerifyResult>>;
|
|
9
|
+
restore(login: string, options?: IBaseApiParams): Promise<IRegisterResponse<RestorePasswordResult>>;
|
|
10
|
+
restoreVerify(data: IRestorePasswordRequest, options?: IBaseApiParams): Promise<ILoginResponse<RestorePasswordVerifyResult>>;
|
|
11
11
|
}
|
package/dist/api/channel.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Anixart } from "../client";
|
|
2
|
-
import { IPageableResponse, IResponse, IBaseApiParams, IChannelResponse, IChannel, IArticle, IChannelSearchRequest, IArticleCreateRequest, IArticleCreateResponse, IChannelCreateRequest, IProfileShort, IArticleCommentResponce, IArticleComment, IBaseCommentAddRequest, IChannelMediaTokenResponse, VoteType, IArticleUploadFileResponse, IUrlResponse, IEmbedData, IArticleResponse, IArticleSuggestionPublishResponse, IArticleSuggestionCreateRequest, IChannelBlockManageRequest, IChannelBlockInfoResponse } from "../types";
|
|
2
|
+
import { IPageableResponse, IResponse, IBaseApiParams, IChannelResponse, IChannel, IArticle, IChannelSearchRequest, IArticleCreateRequest, IArticleCreateResponse, IChannelCreateRequest, IProfileShort, IArticleCommentResponce, IArticleComment, IBaseCommentAddRequest, IChannelMediaTokenResponse, VoteType, IArticleUploadFileResponse, IUrlResponse, IEmbedData, IArticleResponse, IArticleSuggestionPublishResponse, IArticleSuggestionCreateRequest, IChannelBlockManageRequest, IChannelBlockInfoResponse, ArticleCreateEditResult, ChannelSubscribeResult, ChannelUnsubscribeResult, ChannelCreateEditResult, ArticleDeleteResult, CommentDeleteResult, ChannelBlockResult, ArticleSuggestionDeleteResult } from "../types";
|
|
3
3
|
/**
|
|
4
4
|
* Это из беты аниксарта 9.0
|
|
5
5
|
*
|
|
@@ -11,16 +11,16 @@ export declare class Channel {
|
|
|
11
11
|
info(id: number, options?: IBaseApiParams): Promise<IChannelResponse>;
|
|
12
12
|
all(page: number, options?: IBaseApiParams): Promise<IPageableResponse<IChannel>>;
|
|
13
13
|
getBlog(id: number, options?: IBaseApiParams): Promise<IChannelResponse>;
|
|
14
|
-
subscribe(id: number, options?: IBaseApiParams): Promise<IResponse
|
|
15
|
-
unsubscribe(id: number, options?: IBaseApiParams): Promise<IResponse
|
|
14
|
+
subscribe(id: number, options?: IBaseApiParams): Promise<IResponse<ChannelSubscribeResult>>;
|
|
15
|
+
unsubscribe(id: number, options?: IBaseApiParams): Promise<IResponse<ChannelUnsubscribeResult>>;
|
|
16
16
|
getArticles(id: number, page: number, date?: number, options?: IBaseApiParams): Promise<IPageableResponse<IArticle>>;
|
|
17
17
|
getArticle(id: number, options?: IBaseApiParams): Promise<IArticleResponse>;
|
|
18
18
|
createArticle(channelId: number, article: IArticleCreateRequest, options?: IBaseApiParams): Promise<IArticleCreateResponse>;
|
|
19
19
|
editArticle(id: number, article: IArticleCreateRequest, options?: IBaseApiParams): Promise<IArticleCreateResponse>;
|
|
20
20
|
search(data: IChannelSearchRequest, page: number, options?: IBaseApiParams): Promise<IPageableResponse<IChannel>>;
|
|
21
|
-
create(data: IChannelCreateRequest, options?: IBaseApiParams): Promise<IChannelResponse
|
|
22
|
-
removeArticleComment(id: number, options?: IBaseApiParams): Promise<IResponse
|
|
23
|
-
removeArticle(id: number, options?: IBaseApiParams): Promise<IResponse
|
|
21
|
+
create(data: IChannelCreateRequest, options?: IBaseApiParams): Promise<IChannelResponse<ChannelCreateEditResult>>;
|
|
22
|
+
removeArticleComment(id: number, options?: IBaseApiParams): Promise<IResponse<CommentDeleteResult>>;
|
|
23
|
+
removeArticle(id: number, options?: IBaseApiParams): Promise<IResponse<ArticleDeleteResult>>;
|
|
24
24
|
addArticleComment(id: number, data: IBaseCommentAddRequest, options?: IBaseApiParams): Promise<IArticleCommentResponce>;
|
|
25
25
|
getVotes(id: number, page: number, sort: number, options?: IBaseApiParams): Promise<IPageableResponse<IProfileShort>>;
|
|
26
26
|
getComments(id: number, page: number, sort: number, options?: IBaseApiParams): Promise<IPageableResponse<IArticleComment>>;
|
|
@@ -34,9 +34,9 @@ export declare class Channel {
|
|
|
34
34
|
uploadChannelCover(id: number, file: Buffer, options?: IBaseApiParams): Promise<IUrlResponse>;
|
|
35
35
|
editChannel(id: number, data: IChannelCreateRequest, options?: IBaseApiParams): Promise<IChannelResponse>;
|
|
36
36
|
getArticleSuggestions(id: number, page: number, options?: IBaseApiParams): Promise<IPageableResponse<IArticle>>;
|
|
37
|
-
removeArticleSuggestion(id: number, options?: IBaseApiParams): Promise<IResponse
|
|
37
|
+
removeArticleSuggestion(id: number, options?: IBaseApiParams): Promise<IResponse<ArticleSuggestionDeleteResult>>;
|
|
38
38
|
publishArticleSuggestion(id: number, options?: IBaseApiParams): Promise<IArticleSuggestionPublishResponse>;
|
|
39
|
-
createArticleSuggestion(id: number, data: IArticleSuggestionCreateRequest, options?: IBaseApiParams): Promise<IArticleResponse
|
|
40
|
-
manageChannelBlocklist(id: number, data: IChannelBlockManageRequest, options?: IBaseApiParams): Promise<IResponse
|
|
39
|
+
createArticleSuggestion(id: number, data: IArticleSuggestionCreateRequest, options?: IBaseApiParams): Promise<IArticleResponse<ArticleCreateEditResult>>;
|
|
40
|
+
manageChannelBlocklist(id: number, data: IChannelBlockManageRequest, options?: IBaseApiParams): Promise<IResponse<ChannelBlockResult>>;
|
|
41
41
|
getChannelBlock(id: number, profileId: number, options?: IBaseApiParams): Promise<IChannelBlockInfoResponse>;
|
|
42
42
|
}
|
package/dist/api/collection.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Anixart } from "../client";
|
|
2
|
-
import { IPageableResponse, IResponse, IBaseApiParams, ICollectionResponse, IRelease, ICollection, IReleaseInCollectionRequest, ICollectionCreateRequest, ICollectionComment } from "../types";
|
|
2
|
+
import { IPageableResponse, IResponse, IBaseApiParams, ICollectionResponse, IRelease, ICollection, IReleaseInCollectionRequest, ICollectionCreateRequest, ICollectionComment, FavoriteCollectionAddResult, FavoriteCollectionDeleteResult, CollectionCreateEditResult, ReleaseAddCollectionResult, CollectionDeleteResult } from "../types";
|
|
3
3
|
/**
|
|
4
4
|
* Класс коллекции
|
|
5
5
|
*
|
|
@@ -12,21 +12,14 @@ export declare class Collection {
|
|
|
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>>;
|
|
15
|
-
addCollectionFavorite(id: number, options?: IBaseApiParams): Promise<IResponse
|
|
16
|
-
removeCollectionFavorite(id: number, options?: IBaseApiParams): Promise<IResponse
|
|
15
|
+
addCollectionFavorite(id: number, options?: IBaseApiParams): Promise<IResponse<FavoriteCollectionAddResult>>;
|
|
16
|
+
removeCollectionFavorite(id: number, options?: IBaseApiParams): Promise<IResponse<FavoriteCollectionDeleteResult>>;
|
|
17
17
|
getReleaseInCollection(data: IReleaseInCollectionRequest, options?: IBaseApiParams): Promise<IPageableResponse<ICollection>>;
|
|
18
18
|
getUserCollections(id: number, page: number, options?: IBaseApiParams): Promise<IPageableResponse<ICollection>>;
|
|
19
|
-
createCollection(data: ICollectionCreateRequest, options?: IBaseApiParams): Promise<ICollectionResponse
|
|
20
|
-
editCollection(id: number, data: ICollectionCreateRequest, options?: IBaseApiParams): Promise<ICollectionResponse
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
"code": 0,
|
|
24
|
-
"collection": null
|
|
25
|
-
}
|
|
26
|
-
*
|
|
27
|
-
*/
|
|
28
|
-
addReleaseToCollection(collectionId: number, releaseId: number, options?: IBaseApiParams): Promise<IResponse>;
|
|
29
|
-
deleteCollection(id: number, options?: IBaseApiParams): Promise<IResponse>;
|
|
19
|
+
createCollection(data: ICollectionCreateRequest, options?: IBaseApiParams): Promise<ICollectionResponse<CollectionCreateEditResult>>;
|
|
20
|
+
editCollection(id: number, data: ICollectionCreateRequest, options?: IBaseApiParams): Promise<ICollectionResponse<CollectionCreateEditResult>>;
|
|
21
|
+
addReleaseToCollection(collectionId: number, releaseId: number, options?: IBaseApiParams): Promise<IResponse<ReleaseAddCollectionResult>>;
|
|
22
|
+
deleteCollection(id: number, options?: IBaseApiParams): Promise<IResponse<CollectionDeleteResult>>;
|
|
30
23
|
getComments(id: number, page: number, sort: number, options?: IBaseApiParams): Promise<IPageableResponse<ICollectionComment>>;
|
|
31
24
|
getComment(id: number, options?: IBaseApiParams): Promise<IResponse & ICollectionComment>;
|
|
32
25
|
getCommentReplies(id: number, page: number, sort: number, options?: IBaseApiParams): Promise<IPageableResponse<ICollectionComment>>;
|
package/dist/api/collection.js
CHANGED
|
@@ -40,13 +40,6 @@ class Collection {
|
|
|
40
40
|
async editCollection(id, data, options) {
|
|
41
41
|
return await this.client.call({ path: `/collectionMy/edit/${id}`, json: data, ...options });
|
|
42
42
|
}
|
|
43
|
-
/**
|
|
44
|
-
* {
|
|
45
|
-
"code": 0,
|
|
46
|
-
"collection": null
|
|
47
|
-
}
|
|
48
|
-
*
|
|
49
|
-
*/
|
|
50
43
|
async addReleaseToCollection(collectionId, releaseId, options) {
|
|
51
44
|
return await this.client.call({ path: `/collectionMy/release/add/${collectionId}`, queryParams: { release_id: releaseId }, ...options });
|
|
52
45
|
}
|
package/dist/api/profile.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Anixart } from "../client";
|
|
2
|
-
import { IProfileResponse, IBookmarkRequest, IFriendsRequest, IProfileShort, IFriendRequestResponse, IBaseApiParams, IBaseSearchRequest, IPageableResponse, IRelease, IProfile, IResponse, ISubsciptionCountResponse, IVoteRelease } from "../types";
|
|
2
|
+
import { IProfileResponse, IBookmarkRequest, IFriendsRequest, IProfileShort, IFriendRequestResponse, IBaseApiParams, IBaseSearchRequest, IPageableResponse, IRelease, IProfile, IResponse, ISubsciptionCountResponse, IVoteRelease, RemoveFriendRequestResult, AchivementResult, ISocialResponse, IExportBookmarksResponse } from "../types";
|
|
3
3
|
/**
|
|
4
4
|
* Класс профиля
|
|
5
5
|
*
|
|
@@ -17,11 +17,15 @@ export declare class Profile {
|
|
|
17
17
|
getFriendRecomendation(options?: IBaseApiParams): Promise<IPageableResponse<IProfileShort>>;
|
|
18
18
|
getFriendRequests(type: "in" | "out", count: number, options?: IBaseApiParams): Promise<IPageableResponse<IProfileShort>>;
|
|
19
19
|
sendFriendRequest(id: number, options?: IBaseApiParams): Promise<IFriendRequestResponse>;
|
|
20
|
-
removeFriendRequest(id: number, options?: IBaseApiParams): Promise<IFriendRequestResponse
|
|
20
|
+
removeFriendRequest(id: number, options?: IBaseApiParams): Promise<IFriendRequestResponse<RemoveFriendRequestResult>>;
|
|
21
21
|
hideFriendRequest(id: number, options?: IBaseApiParams): Promise<IResponse>;
|
|
22
|
-
getAchivement(id: number, options?: IBaseApiParams): Promise<IResponse
|
|
22
|
+
getAchivement(id: number, options?: IBaseApiParams): Promise<IResponse<AchivementResult>>;
|
|
23
23
|
getFavorites(data: IBookmarkRequest, options?: IBaseApiParams): Promise<IPageableResponse<IRelease>>;
|
|
24
24
|
getSubsciptions(page: number, options?: IBaseApiParams): Promise<IPageableResponse<any>>;
|
|
25
25
|
getSubscriptionCount(options?: IBaseApiParams): Promise<ISubsciptionCountResponse>;
|
|
26
|
-
|
|
26
|
+
getVotedReleases(id: number, page: number, sort?: number, options?: IBaseApiParams): Promise<IPageableResponse<IVoteRelease>>;
|
|
27
|
+
getSocials(id: number, options?: IBaseApiParams): Promise<ISocialResponse>;
|
|
28
|
+
getUnvotedReleases(page?: number | "last", options?: IBaseApiParams): Promise<IPageableResponse<IRelease>>;
|
|
29
|
+
getRoleProfiles(id: number, page: number, options?: IBaseApiParams): Promise<IPageableResponse<IProfileShort>>;
|
|
30
|
+
exportBookmarks(listIds: Array<number>, sort?: number, options?: IBaseApiParams): Promise<IExportBookmarksResponse>;
|
|
27
31
|
}
|
package/dist/api/profile.js
CHANGED
|
@@ -16,9 +16,11 @@ class Profile {
|
|
|
16
16
|
async getBookmarks(data, options) {
|
|
17
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
18
|
}
|
|
19
|
+
// Там вообще просто пустой класс ответа в приложении, так что будет просто дефолтные ответы
|
|
19
20
|
async addBookmark(id, type, options) {
|
|
20
21
|
return this.client.call({ path: `/profile/list/add/${type}/${id}`, ...options });
|
|
21
22
|
}
|
|
23
|
+
// Там вообще просто пустой класс ответа в приложении, так что будет просто дефолтные ответы
|
|
22
24
|
async removeBookmark(id, type, options) {
|
|
23
25
|
return this.client.call({ path: `/profile/list/delete/${type}/${id}`, ...options });
|
|
24
26
|
}
|
|
@@ -55,8 +57,20 @@ class Profile {
|
|
|
55
57
|
async getSubscriptionCount(options) {
|
|
56
58
|
return await this.client.call({ path: `/channel/subscription/count`, ...options });
|
|
57
59
|
}
|
|
58
|
-
async
|
|
60
|
+
async getVotedReleases(id, page, sort = 1, options) {
|
|
59
61
|
return await this.client.call({ path: `/profile/vote/release/voted/${id}/${page}`, queryParams: { sort }, ...options });
|
|
60
62
|
}
|
|
63
|
+
async getSocials(id, options) {
|
|
64
|
+
return await this.client.call({ path: `/profile/social/${id}`, ...options });
|
|
65
|
+
}
|
|
66
|
+
async getUnvotedReleases(page = "last", options) {
|
|
67
|
+
return await this.client.call({ path: `/profile/vote/release/unvoted/${page}`, ...options });
|
|
68
|
+
}
|
|
69
|
+
async getRoleProfiles(id, page, options) {
|
|
70
|
+
return await this.client.call({ path: `/role/all/${page}/${id}`, ...options });
|
|
71
|
+
}
|
|
72
|
+
async exportBookmarks(listIds, sort, options) {
|
|
73
|
+
return await this.client.call({ path: "/export/bookmarks", json: { bookmarksExportProfileLists: listIds }, queryParams: { sort }, ...options });
|
|
74
|
+
}
|
|
61
75
|
}
|
|
62
76
|
exports.Profile = Profile;
|
package/dist/api/release.d.ts
CHANGED
|
@@ -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, IVideoStreamingPlatform, CommentDeleteResult, CommentEditResult, ILastEpisodeUpdate } from "../types";
|
|
3
3
|
/**
|
|
4
4
|
* Класс релиза
|
|
5
5
|
*
|
|
@@ -14,8 +14,8 @@ export declare class Release {
|
|
|
14
14
|
getComments(data: ICommentReleaseRequest, options?: IBaseApiParams): Promise<IPageableResponse<ICommentRelease>>;
|
|
15
15
|
addComment(id: number, data: IBaseCommentAddRequest, options?: IBaseApiParams): Promise<ICommentReleaseResponse>;
|
|
16
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
|
|
17
|
+
removeComment(id: number, options?: IBaseApiParams): Promise<IResponse<CommentDeleteResult>>;
|
|
18
|
+
editComment(id: number, message: string, spoiler: boolean, options?: IBaseApiParams): Promise<IResponse<CommentEditResult>>;
|
|
19
19
|
getCommentReplies(data: ICommentRepliesRequest, options?: IBaseApiParams): Promise<IPageableResponse<ICommentRelease>>;
|
|
20
20
|
getRelatedReleases(id: number, page: number, options?: IBaseApiParams): Promise<IPageableResponse<IRelease>>;
|
|
21
21
|
getVideos(id: number, options?: IBaseApiParams): Promise<IVideoResponse>;
|
|
@@ -38,4 +38,5 @@ export declare class Release {
|
|
|
38
38
|
removeFromProfileList(id: number, type: number, options?: IBaseApiParams): Promise<IResponse>;
|
|
39
39
|
getStreaming(id: number, options?: IBaseApiParams): Promise<IPageableResponse<IVideoStreamingPlatform>>;
|
|
40
40
|
getCommentVotes(id: number, page: number, options?: IBaseApiParams): Promise<IPageableResponse<IProfileShort>>;
|
|
41
|
+
getEpisodeUpdates(id: number, page: number, options?: IBaseApiParams): Promise<IPageableResponse<ILastEpisodeUpdate>>;
|
|
41
42
|
}
|
package/dist/api/release.js
CHANGED
|
@@ -100,5 +100,8 @@ class Release {
|
|
|
100
100
|
async getCommentVotes(id, page, options) {
|
|
101
101
|
return await this.client.call({ path: `/release/comment/votes/${id}/${page}`, ...options });
|
|
102
102
|
}
|
|
103
|
+
async getEpisodeUpdates(id, page, options) {
|
|
104
|
+
return await this.client.call({ path: `/episode/updates/${id}/${page}`, ...options });
|
|
105
|
+
}
|
|
103
106
|
}
|
|
104
107
|
exports.Release = Release;
|
package/dist/api/settings.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Anixart } from "../client";
|
|
2
|
-
import { IBadgesResponse, IEmailChangeConfirmResponse, IEmailChangeRequest, ILoginInfoResponse, INewLogin, IProfileSettingsResponse, PrivacyFriendRequestState, PrivacyState, IProfileShort, ISocialResponse, IBaseApiParams, IPageableResponse, IResponse, IPasswordChangeResponse } from "../types";
|
|
2
|
+
import { IBadgesResponse, IEmailChangeConfirmResponse, IEmailChangeRequest, ILoginInfoResponse, INewLogin, IProfileSettingsResponse, PrivacyFriendRequestState, PrivacyState, IProfileShort, ISocialResponse, IBaseApiParams, IPageableResponse, IResponse, IPasswordChangeResponse, BlocklistAddResult, SocialEditResult, ChangeEmailResult, ChangeLoginResult } from "../types";
|
|
3
3
|
export declare class Settings {
|
|
4
4
|
private readonly client;
|
|
5
5
|
constructor(client: Anixart);
|
|
@@ -8,15 +8,15 @@ export declare class Settings {
|
|
|
8
8
|
setStatus(status: string, options?: IBaseApiParams): Promise<IResponse>;
|
|
9
9
|
getBlocklist(page: number, options?: IBaseApiParams): Promise<IPageableResponse<IProfileShort>>;
|
|
10
10
|
getSocial(options?: IBaseApiParams): Promise<ISocialResponse>;
|
|
11
|
-
setSocial(data: ISocialResponse, options?: IBaseApiParams): Promise<IResponse
|
|
11
|
+
setSocial(data: ISocialResponse, options?: IBaseApiParams): Promise<IResponse<SocialEditResult>>;
|
|
12
12
|
confirmChangeEmail(currentPassword: string, options?: IBaseApiParams): Promise<IEmailChangeConfirmResponse>;
|
|
13
|
-
changeEmail(data: IEmailChangeRequest, options?: IBaseApiParams): Promise<IResponse
|
|
13
|
+
changeEmail(data: IEmailChangeRequest, options?: IBaseApiParams): Promise<IResponse<ChangeEmailResult>>;
|
|
14
14
|
changePassword(currentPassword: string, newPassword: string, options?: IBaseApiParams): Promise<IPasswordChangeResponse>;
|
|
15
|
-
addBlocklist(id: number, options?: IBaseApiParams): Promise<IResponse
|
|
15
|
+
addBlocklist(id: number, options?: IBaseApiParams): Promise<IResponse<BlocklistAddResult>>;
|
|
16
16
|
removeBlocklist(id: number, options?: IBaseApiParams): Promise<IResponse>;
|
|
17
17
|
getLoginInfo(options?: IBaseApiParams): Promise<ILoginInfoResponse>;
|
|
18
18
|
getLoginHistory(id: number, page: number, options?: IBaseApiParams): Promise<IPageableResponse<INewLogin>>;
|
|
19
|
-
changeLogin(newLogin: string, options?: IBaseApiParams): Promise<IResponse
|
|
19
|
+
changeLogin(newLogin: string, options?: IBaseApiParams): Promise<IResponse<ChangeLoginResult>>;
|
|
20
20
|
setCommentNotification(options?: IBaseApiParams): Promise<IResponse>;
|
|
21
21
|
setCollectionCommentNotification(options?: IBaseApiParams): Promise<IResponse>;
|
|
22
22
|
setReportProgressNotification(options?: IBaseApiParams): Promise<IResponse>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Channel } from "./Channel";
|
|
2
2
|
import { Anixart } from "../client";
|
|
3
|
-
import { IArticle,
|
|
3
|
+
import { IArticle, DefaultResult, IBaseCommentAddRequest, VoteType, ArticleDeleteResult } from "../types";
|
|
4
4
|
import { ArticleComment } from "./ArticleComment";
|
|
5
5
|
import { ArticleBuilder } from "../utils/ArticleBuilder";
|
|
6
6
|
import { BaseArticle } from "./BaseArticle";
|
|
@@ -12,7 +12,7 @@ export declare class Article extends BaseArticle {
|
|
|
12
12
|
private writeProperties;
|
|
13
13
|
getComments(page?: number, sort?: number): Promise<ArticleComment[]>;
|
|
14
14
|
addComment(data: IBaseCommentAddRequest): Promise<ArticleComment | null>;
|
|
15
|
-
setVote(type: VoteType): Promise<
|
|
15
|
+
setVote(type: VoteType): Promise<DefaultResult>;
|
|
16
16
|
edit(data: ArticleBuilder): Promise<Article>;
|
|
17
|
-
delete(): Promise<
|
|
17
|
+
delete(): Promise<DefaultResult | ArticleDeleteResult>;
|
|
18
18
|
}
|
package/dist/classes/Article.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Article = void 0;
|
|
4
4
|
const Channel_1 = require("./Channel");
|
|
5
|
+
const types_1 = require("../types");
|
|
5
6
|
const ArticleComment_1 = require("./ArticleComment");
|
|
6
7
|
const BaseArticle_1 = require("./BaseArticle");
|
|
7
8
|
class Article extends BaseArticle_1.BaseArticle {
|
|
@@ -22,11 +23,11 @@ class Article extends BaseArticle_1.BaseArticle {
|
|
|
22
23
|
}
|
|
23
24
|
async addComment(data) {
|
|
24
25
|
const request = await this.client.endpoints.channel.addArticleComment(this.id, data);
|
|
25
|
-
return request.code ==
|
|
26
|
+
return request.code == types_1.DefaultResult.Ok && request.comment ? new ArticleComment_1.ArticleComment(this.client, request === null || request === void 0 ? void 0 : request.comment) : null;
|
|
26
27
|
}
|
|
27
28
|
async setVote(type) {
|
|
28
29
|
const request = await this.client.endpoints.channel.voteArticle(this.id, type);
|
|
29
|
-
if (request.code ==
|
|
30
|
+
if (request.code == types_1.DefaultResult.Ok) {
|
|
30
31
|
this.writeProperties("vote", type == this.vote ? 0 : type);
|
|
31
32
|
}
|
|
32
33
|
return request.code;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Anixart } from "../client";
|
|
2
2
|
import { BaseComment } from "./BaseComment";
|
|
3
|
-
import { IArticleComment,
|
|
3
|
+
import { IArticleComment, DefaultResult, VoteType, CommentDeleteResult } from "../types";
|
|
4
4
|
import { Article } from "./Article";
|
|
5
5
|
import { BaseProfile } from "./BaseProfile";
|
|
6
6
|
export declare class ArticleComment extends BaseComment {
|
|
@@ -10,6 +10,6 @@ export declare class ArticleComment extends BaseComment {
|
|
|
10
10
|
private writeProperties;
|
|
11
11
|
getVotes(page?: number, sort?: number): Promise<BaseProfile[]>;
|
|
12
12
|
getReplies(page?: number, sort?: number): Promise<ArticleComment[]>;
|
|
13
|
-
delete(): Promise<
|
|
14
|
-
setVote(type: VoteType): Promise<
|
|
13
|
+
delete(): Promise<DefaultResult | CommentDeleteResult>;
|
|
14
|
+
setVote(type: VoteType): Promise<DefaultResult>;
|
|
15
15
|
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ArticleComment = void 0;
|
|
4
4
|
const BaseComment_1 = require("./BaseComment");
|
|
5
|
+
const types_1 = require("../types");
|
|
5
6
|
const Article_1 = require("./Article");
|
|
6
7
|
const BaseProfile_1 = require("./BaseProfile");
|
|
7
8
|
class ArticleComment extends BaseComment_1.BaseComment {
|
|
@@ -27,7 +28,7 @@ class ArticleComment extends BaseComment_1.BaseComment {
|
|
|
27
28
|
}
|
|
28
29
|
async setVote(type) {
|
|
29
30
|
const request = await this.client.endpoints.channel.voteCommentArticle(this.id, type);
|
|
30
|
-
if (request.code ==
|
|
31
|
+
if (request.code == types_1.DefaultResult.Ok) {
|
|
31
32
|
this.writeProperties("vote", type == this.vote ? 0 : type);
|
|
32
33
|
}
|
|
33
34
|
return request.code;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Anixart } from "../client";
|
|
2
|
-
import { IFriendRequestResponse, IPageableResponse, IProfileShort, IVoteRelease } from "../types";
|
|
2
|
+
import { IFriendRequestResponse, IPageableResponse, IProfileShort, IRelease, IVoteRelease, RemoveFriendRequestResult } from "../types";
|
|
3
3
|
import { Collection } from "./Collection";
|
|
4
4
|
export declare class BaseProfile {
|
|
5
5
|
protected readonly client: Anixart;
|
|
@@ -22,7 +22,8 @@ export declare class BaseProfile {
|
|
|
22
22
|
constructor(client: Anixart, profile: IProfileShort);
|
|
23
23
|
getFriends(page?: number): Promise<BaseProfile[]>;
|
|
24
24
|
sendFriendRequest(): Promise<IFriendRequestResponse>;
|
|
25
|
-
removeFriendRequest(): Promise<IFriendRequestResponse
|
|
26
|
-
|
|
25
|
+
removeFriendRequest(): Promise<IFriendRequestResponse<RemoveFriendRequestResult>>;
|
|
26
|
+
getVotedReleases(page?: number, sort?: number): Promise<IPageableResponse<IVoteRelease>>;
|
|
27
|
+
getUnvotedReleases(page?: number): Promise<IPageableResponse<IRelease>>;
|
|
27
28
|
getCollections(page?: number): Promise<Collection[]>;
|
|
28
29
|
}
|
|
@@ -34,8 +34,12 @@ class BaseProfile {
|
|
|
34
34
|
const request = await this.client.endpoints.profile.removeFriendRequest(this.id);
|
|
35
35
|
return request;
|
|
36
36
|
}
|
|
37
|
-
async
|
|
38
|
-
const request = await this.client.endpoints.profile.
|
|
37
|
+
async getVotedReleases(page, sort) {
|
|
38
|
+
const request = await this.client.endpoints.profile.getVotedReleases(this.id, page !== null && page !== void 0 ? page : 0, sort !== null && sort !== void 0 ? sort : 1);
|
|
39
|
+
return request;
|
|
40
|
+
}
|
|
41
|
+
async getUnvotedReleases(page) {
|
|
42
|
+
const request = await this.client.endpoints.profile.getUnvotedReleases(page !== null && page !== void 0 ? page : "last");
|
|
39
43
|
return request;
|
|
40
44
|
}
|
|
41
45
|
async getCollections(page) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Anixart } from "../client";
|
|
2
|
-
import { IChannel, IChannelBlockInfo, IChannelBlockManageRequest, IChannelCreateRequest,
|
|
2
|
+
import { IChannel, IChannelBlockInfo, IChannelBlockManageRequest, IChannelCreateRequest, DefaultResult, ChannelSubscribeResult, ChannelUnsubscribeResult, ChannelBlockResult } from "../types";
|
|
3
3
|
import { ArticleBuilder } from "../utils/ArticleBuilder";
|
|
4
4
|
import { SuggestionArticle } from "./SuggestionArticle";
|
|
5
5
|
import { Article } from "./Article";
|
|
@@ -34,14 +34,14 @@ export declare class Channel {
|
|
|
34
34
|
getArticles(page: number, date?: number): Promise<(Article | undefined)[]>;
|
|
35
35
|
getArticleById(id: number): Promise<Article | null>;
|
|
36
36
|
createArticle(data: ArticleBuilder): Promise<Article | null>;
|
|
37
|
-
subscribe(): Promise<
|
|
38
|
-
unsubscribe(): Promise<
|
|
37
|
+
subscribe(): Promise<DefaultResult | ChannelSubscribeResult>;
|
|
38
|
+
unsubscribe(): Promise<DefaultResult | ChannelUnsubscribeResult>;
|
|
39
39
|
setAvatar(file: Buffer): Promise<this>;
|
|
40
40
|
setCover(file: Buffer): Promise<this>;
|
|
41
41
|
getMediaToken(isSuggestionMode?: boolean, isEditMode?: boolean): Promise<string | null>;
|
|
42
42
|
edit(data: IChannelCreateRequest): Promise<Channel | null>;
|
|
43
43
|
getArticleSuggestions(page: number): Promise<(SuggestionArticle[] | null)>;
|
|
44
44
|
createArticleSuggestion(data: ArticleBuilder): Promise<SuggestionArticle | null>;
|
|
45
|
-
manageBlocklist(profile: BaseProfile | FullProfile | number, data: Omit<IChannelBlockManageRequest, "target_profile_id">): Promise<
|
|
45
|
+
manageBlocklist(profile: BaseProfile | FullProfile | number, data: Omit<IChannelBlockManageRequest, "target_profile_id">): Promise<DefaultResult | ChannelBlockResult>;
|
|
46
46
|
getBlocklist(profile: BaseProfile | FullProfile | number): Promise<IChannelBlockInfo | null>;
|
|
47
47
|
}
|
package/dist/classes/Channel.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Channel = void 0;
|
|
4
|
+
const types_1 = require("../types");
|
|
4
5
|
const SuggestionArticle_1 = require("./SuggestionArticle");
|
|
5
6
|
const Article_1 = require("./Article");
|
|
6
7
|
class Channel {
|
|
@@ -46,28 +47,28 @@ class Channel {
|
|
|
46
47
|
}
|
|
47
48
|
async subscribe() {
|
|
48
49
|
const request = await this.client.endpoints.channel.subscribe(this.id);
|
|
49
|
-
if (request.code ==
|
|
50
|
+
if (request.code == types_1.DefaultResult.Ok) {
|
|
50
51
|
this.writeProperties("isSubscribed", true);
|
|
51
52
|
}
|
|
52
53
|
return request.code;
|
|
53
54
|
}
|
|
54
55
|
async unsubscribe() {
|
|
55
56
|
const request = await this.client.endpoints.channel.unsubscribe(this.id);
|
|
56
|
-
if (request.code ==
|
|
57
|
+
if (request.code == types_1.DefaultResult.Ok) {
|
|
57
58
|
this.writeProperties("isSubscribed", false);
|
|
58
59
|
}
|
|
59
60
|
return request.code;
|
|
60
61
|
}
|
|
61
62
|
async setAvatar(file) {
|
|
62
63
|
const request = await this.client.endpoints.channel.uploadChannelAvatar(this.id, file);
|
|
63
|
-
if (request.code ==
|
|
64
|
+
if (request.code == types_1.DefaultResult.Ok) {
|
|
64
65
|
this.writeProperties("channelAvatar", request.url);
|
|
65
66
|
}
|
|
66
67
|
return this;
|
|
67
68
|
}
|
|
68
69
|
async setCover(file) {
|
|
69
70
|
const request = await this.client.endpoints.channel.uploadChannelCover(this.id, file);
|
|
70
|
-
if (request.code ==
|
|
71
|
+
if (request.code == types_1.DefaultResult.Ok) {
|
|
71
72
|
this.writeProperties("channelCover", request.url);
|
|
72
73
|
}
|
|
73
74
|
return this;
|
|
@@ -86,7 +87,7 @@ class Channel {
|
|
|
86
87
|
}
|
|
87
88
|
async createArticleSuggestion(data) {
|
|
88
89
|
const request = await this.client.endpoints.channel.createArticleSuggestion(this.id, data.returnBuildAricle());
|
|
89
|
-
return request.code ==
|
|
90
|
+
return request.code == types_1.DefaultResult.Ok ? new SuggestionArticle_1.SuggestionArticle(this.client, request.article, this) : null;
|
|
90
91
|
}
|
|
91
92
|
async manageBlocklist(profile, data) {
|
|
92
93
|
const request = await this.client.endpoints.channel.manageChannelBlocklist(this.id, {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Anixart } from "../client";
|
|
2
|
-
import { ICollection,
|
|
2
|
+
import { ICollection, DefaultResult, FavoriteCollectionAddResult, FavoriteCollectionDeleteResult, ReleaseAddCollectionResult, CollectionDeleteResult } from "../types";
|
|
3
3
|
import { FullProfile } from "./FullProfile";
|
|
4
4
|
import { Release } from "./Release";
|
|
5
5
|
export declare class Collection {
|
|
@@ -21,9 +21,9 @@ export declare class Collection {
|
|
|
21
21
|
constructor(client: Anixart, collectionResponce: ICollection);
|
|
22
22
|
private writeProperties;
|
|
23
23
|
getReleases(page: number): Promise<Array<Release>>;
|
|
24
|
-
addToFavorite(): Promise<
|
|
25
|
-
removeInFavorite(): Promise<
|
|
26
|
-
addRelease(id: number): Promise<
|
|
27
|
-
delete(): Promise<
|
|
24
|
+
addToFavorite(): Promise<DefaultResult | FavoriteCollectionAddResult>;
|
|
25
|
+
removeInFavorite(): Promise<DefaultResult | FavoriteCollectionDeleteResult>;
|
|
26
|
+
addRelease(id: number): Promise<DefaultResult | ReleaseAddCollectionResult>;
|
|
27
|
+
delete(): Promise<DefaultResult | CollectionDeleteResult>;
|
|
28
28
|
edit(title: string, description: string, releases: Release[], isPrivate: boolean): Promise<Collection | null>;
|
|
29
29
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Collection = void 0;
|
|
4
|
+
const types_1 = require("../types");
|
|
4
5
|
const FullProfile_1 = require("./FullProfile");
|
|
5
6
|
const Release_1 = require("./Release");
|
|
6
7
|
class Collection {
|
|
@@ -51,7 +52,7 @@ class Collection {
|
|
|
51
52
|
releases: releases.map(x => x.id),
|
|
52
53
|
is_private: isPrivate
|
|
53
54
|
});
|
|
54
|
-
return request.code ==
|
|
55
|
+
return request.code == types_1.DefaultResult.Ok ? new Collection(this.client, request.collection) : null;
|
|
55
56
|
}
|
|
56
57
|
}
|
|
57
58
|
exports.Collection = Collection;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Anixart } from '../client';
|
|
2
|
-
import { IEpisode, IRelease, ISource,
|
|
2
|
+
import { IEpisode, IRelease, ISource, DefaultResult } from '../types';
|
|
3
3
|
import { Source } from './Source';
|
|
4
4
|
export declare class Episode {
|
|
5
5
|
private readonly client;
|
|
@@ -15,6 +15,6 @@ export declare class Episode {
|
|
|
15
15
|
readonly isFilter: boolean;
|
|
16
16
|
readonly isWatched: boolean;
|
|
17
17
|
constructor(client: Anixart, episode: IEpisode, source: Source);
|
|
18
|
-
setWatched(isWatched: boolean): Promise<
|
|
19
|
-
addToHistory(): Promise<
|
|
18
|
+
setWatched(isWatched: boolean): Promise<DefaultResult>;
|
|
19
|
+
addToHistory(): Promise<DefaultResult>;
|
|
20
20
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Anixart } from "../client";
|
|
2
|
-
import { BookmarkType, IBaseCommentAddRequest, ICommentRelease, IEpisodeLastUpdate, IRelated, IRelease, IReleaseCategory, IReleaseStatus, IVideoBanners,
|
|
2
|
+
import { BookmarkType, IBaseCommentAddRequest, ICommentRelease, IEpisodeLastUpdate, IRelated, IRelease, IReleaseCategory, IReleaseStatus, IVideoBanners, DefaultResult, ReleaseAddCollectionResult } from "../types";
|
|
3
3
|
import { Collection } from "./Collection";
|
|
4
4
|
import { Dubber } from "./Dubber";
|
|
5
5
|
import { ReleaseComment } from "./ReleaseComment";
|
|
@@ -78,14 +78,14 @@ export declare class Release {
|
|
|
78
78
|
constructor(client: Anixart, releaseResponse: IRelease);
|
|
79
79
|
private writeProperties;
|
|
80
80
|
getDubbers(): Promise<Dubber[]>;
|
|
81
|
-
removeFromHistory(): Promise<
|
|
82
|
-
setFavorite(favorite: boolean): Promise<
|
|
83
|
-
addToList(type: BookmarkType): Promise<
|
|
84
|
-
removeFromList(type?: BookmarkType): Promise<
|
|
81
|
+
removeFromHistory(): Promise<DefaultResult>;
|
|
82
|
+
setFavorite(favorite: boolean): Promise<DefaultResult>;
|
|
83
|
+
addToList(type: BookmarkType): Promise<DefaultResult>;
|
|
84
|
+
removeFromList(type?: BookmarkType): Promise<DefaultResult>;
|
|
85
85
|
getRelatedReleases(page?: number): Promise<Release[] | null>;
|
|
86
86
|
getComments(page?: number, sort?: number): Promise<ReleaseComment[] | null>;
|
|
87
87
|
addComment(data: IBaseCommentAddRequest): Promise<ReleaseComment | null>;
|
|
88
|
-
addVote(vote: 1 | 2 | 3 | 4 | 5): Promise<
|
|
88
|
+
addVote(vote: 1 | 2 | 3 | 4 | 5): Promise<DefaultResult>;
|
|
89
89
|
getCollections(page: number, sort?: number): Promise<Collection[]>;
|
|
90
|
-
addToCollection(id: number): Promise<
|
|
90
|
+
addToCollection(id: number): Promise<DefaultResult | ReleaseAddCollectionResult>;
|
|
91
91
|
}
|
package/dist/classes/Release.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Release = void 0;
|
|
4
|
+
const types_1 = require("../types");
|
|
4
5
|
const Collection_1 = require("./Collection");
|
|
5
6
|
const Dubber_1 = require("./Dubber");
|
|
6
7
|
const ReleaseComment_1 = require("./ReleaseComment");
|
|
@@ -94,44 +95,44 @@ class Release {
|
|
|
94
95
|
const request = favorite ?
|
|
95
96
|
await this.client.endpoints.release.addFavorite(this.id) :
|
|
96
97
|
await this.client.endpoints.release.removeFavorite(this.id);
|
|
97
|
-
if (request.code ==
|
|
98
|
+
if (request.code == types_1.DefaultResult.Ok) {
|
|
98
99
|
this.writeProperties("isFavorite", favorite);
|
|
99
100
|
}
|
|
100
101
|
return request.code;
|
|
101
102
|
}
|
|
102
103
|
async addToList(type) {
|
|
103
104
|
const request = await this.client.endpoints.release.addToProfileList(this.id, type);
|
|
104
|
-
if (request.code ==
|
|
105
|
+
if (request.code == types_1.DefaultResult.Ok) {
|
|
105
106
|
this.writeProperties("profileListStatus", type);
|
|
106
107
|
}
|
|
107
108
|
return request.code;
|
|
108
109
|
}
|
|
109
110
|
async removeFromList(type) {
|
|
110
111
|
const request = await this.client.endpoints.release.removeFromProfileList(this.id, type ? type : this.profileListStatus);
|
|
111
|
-
if (request.code ==
|
|
112
|
+
if (request.code == types_1.DefaultResult.Ok) {
|
|
112
113
|
this.writeProperties("profileListStatus", null);
|
|
113
114
|
}
|
|
114
115
|
return request.code;
|
|
115
116
|
}
|
|
116
117
|
async getRelatedReleases(page = 0) {
|
|
117
118
|
const request = await this.client.endpoints.release.getRelatedReleases(this.related.id, page);
|
|
118
|
-
return request.code ==
|
|
119
|
+
return request.code == types_1.DefaultResult.Ok ? request.content.map(release => new Release(this.client, release)) : null;
|
|
119
120
|
}
|
|
120
121
|
async getComments(page = 0, sort = 0) {
|
|
121
122
|
const request = await this.client.endpoints.release.getComments({ page, sort, id: this.id });
|
|
122
|
-
return request.code ==
|
|
123
|
+
return request.code == types_1.DefaultResult.Ok ? request.content.map(comment => new ReleaseComment_1.ReleaseComment(this.client, comment, this)) : null;
|
|
123
124
|
}
|
|
124
125
|
async addComment(data) {
|
|
125
126
|
const request = await this.client.endpoints.release.addComment(this.id, data);
|
|
126
|
-
if (request.code ==
|
|
127
|
+
if (request.code == types_1.DefaultResult.Ok) {
|
|
127
128
|
this.writeProperties("commentCount", this.commentCount + 1);
|
|
128
129
|
this.writeProperties("commentsCount", this.commentsCount + 1);
|
|
129
130
|
}
|
|
130
|
-
return request.code ==
|
|
131
|
+
return request.code == types_1.DefaultResult.Ok ? new ReleaseComment_1.ReleaseComment(this.client, request.comment, this) : null;
|
|
131
132
|
}
|
|
132
133
|
async addVote(vote) {
|
|
133
134
|
const request = await this.client.endpoints.release.addVote(this.id, vote);
|
|
134
|
-
if (request.code ==
|
|
135
|
+
if (request.code == types_1.DefaultResult.Ok) {
|
|
135
136
|
this.writeProperties("voteCount", this.voteCount + 1);
|
|
136
137
|
this.writeProperties("yourVote", vote);
|
|
137
138
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Anixart } from '../client';
|
|
2
|
-
import { ICommentRelease,
|
|
2
|
+
import { ICommentRelease, DefaultResult, VoteType, CommentDeleteResult, CommentEditResult } from '../types';
|
|
3
3
|
import { BaseComment } from './BaseComment';
|
|
4
4
|
import { BaseProfile } from './BaseProfile';
|
|
5
5
|
import { Release } from './Release';
|
|
@@ -10,7 +10,7 @@ export declare class ReleaseComment extends BaseComment {
|
|
|
10
10
|
private writeProperties;
|
|
11
11
|
getVotes(page?: number, sort?: number): Promise<BaseProfile[]>;
|
|
12
12
|
getReplies(page?: number, sort?: number): Promise<ReleaseComment[]>;
|
|
13
|
-
delete(): Promise<
|
|
14
|
-
setVote(type: VoteType): Promise<
|
|
15
|
-
edit(content: string, isSpoiler: boolean): Promise<
|
|
13
|
+
delete(): Promise<DefaultResult | CommentDeleteResult>;
|
|
14
|
+
setVote(type: VoteType): Promise<DefaultResult>;
|
|
15
|
+
edit(content: string, isSpoiler: boolean): Promise<DefaultResult | CommentEditResult>;
|
|
16
16
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ReleaseComment = void 0;
|
|
4
|
+
const types_1 = require("../types");
|
|
4
5
|
const BaseComment_1 = require("./BaseComment");
|
|
5
6
|
const BaseProfile_1 = require("./BaseProfile");
|
|
6
7
|
const Release_1 = require("./Release");
|
|
@@ -27,14 +28,14 @@ class ReleaseComment extends BaseComment_1.BaseComment {
|
|
|
27
28
|
}
|
|
28
29
|
async setVote(type) {
|
|
29
30
|
const request = await this.client.endpoints.release.voteComment(this.id, type);
|
|
30
|
-
if (request.code ==
|
|
31
|
+
if (request.code == types_1.DefaultResult.Ok) {
|
|
31
32
|
this.writeProperties("vote", type == this.vote ? 0 : type);
|
|
32
33
|
}
|
|
33
34
|
return request.code;
|
|
34
35
|
}
|
|
35
36
|
async edit(content, isSpoiler) {
|
|
36
37
|
const request = await this.client.endpoints.release.editComment(this.id, content, isSpoiler);
|
|
37
|
-
if (request.code ==
|
|
38
|
+
if (request.code == types_1.DefaultResult.Ok) {
|
|
38
39
|
this.writeProperties("message", content);
|
|
39
40
|
this.writeProperties("isSpoiler", isSpoiler);
|
|
40
41
|
}
|