anixartjs 0.0.9 → 0.1.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.
- package/dist/api/auth.d.ts +95 -4
- package/dist/api/auth.js +91 -0
- package/dist/api/channel.d.ts +16 -12
- package/dist/api/channel.js +16 -4
- package/dist/api/collection.d.ts +8 -14
- package/dist/api/collection.js +3 -7
- package/dist/api/discover.d.ts +67 -0
- package/dist/api/discover.js +67 -0
- package/dist/api/feed.d.ts +28 -1
- package/dist/api/feed.js +28 -3
- package/dist/api/index.d.ts +1 -0
- package/dist/api/index.js +1 -0
- package/dist/api/notification.d.ts +3 -1
- package/dist/api/notification.js +6 -0
- package/dist/api/profile.d.ts +372 -11
- package/dist/api/profile.js +381 -6
- package/dist/api/release.d.ts +4 -4
- package/dist/api/release.js +3 -3
- package/dist/api/search.d.ts +230 -0
- package/dist/api/search.js +257 -0
- package/dist/api/settings.d.ts +6 -7
- package/dist/api/settings.js +9 -12
- 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 +7 -6
- 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 +11 -3
- package/dist/client.js +10 -1
- package/dist/endpoints.d.ts +10 -1
- package/dist/endpoints.js +9 -0
- 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 +107 -10
- 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/notification.d.ts +4 -0
- package/dist/types/profile.d.ts +41 -3
- package/dist/types/profile.js +26 -1
- package/dist/types/release.d.ts +35 -5
- 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 +30 -2
- package/dist/types/settings.js +35 -1
- package/package.json +1 -1
|
@@ -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, {
|
|
@@ -96,7 +97,7 @@ class Channel {
|
|
|
96
97
|
return request.code;
|
|
97
98
|
}
|
|
98
99
|
async getBlocklist(profile) {
|
|
99
|
-
const request = await this.client.endpoints.channel.
|
|
100
|
+
const request = await this.client.endpoints.channel.getChannelBlockProfile(this.id, typeof (profile) == "number" ? profile : profile.id);
|
|
100
101
|
return request.channel_block;
|
|
101
102
|
}
|
|
102
103
|
}
|
|
@@ -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
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Channel } from "./Channel";
|
|
2
2
|
import { Anixart } from "../client";
|
|
3
|
-
import { IArticle,
|
|
3
|
+
import { IArticle, DefaultResult, ArticleSuggestionDeleteResult } from "../types";
|
|
4
4
|
import { BaseArticle } from "./BaseArticle";
|
|
5
5
|
import { Article } from "./Article";
|
|
6
6
|
export declare class SuggestionArticle extends BaseArticle {
|
|
@@ -10,5 +10,5 @@ export declare class SuggestionArticle extends BaseArticle {
|
|
|
10
10
|
constructor(client: Anixart, articleResponce: IArticle, channel?: Channel);
|
|
11
11
|
private writeProperties;
|
|
12
12
|
publish(): Promise<number | null>;
|
|
13
|
-
delete(): Promise<
|
|
13
|
+
delete(): Promise<DefaultResult | ArticleSuggestionDeleteResult>;
|
|
14
14
|
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SuggestionArticle = void 0;
|
|
4
4
|
const Channel_1 = require("./Channel");
|
|
5
|
+
const types_1 = require("../types");
|
|
5
6
|
const BaseArticle_1 = require("./BaseArticle");
|
|
6
7
|
const Article_1 = require("./Article");
|
|
7
8
|
class SuggestionArticle extends BaseArticle_1.BaseArticle {
|
|
@@ -18,7 +19,7 @@ class SuggestionArticle extends BaseArticle_1.BaseArticle {
|
|
|
18
19
|
}
|
|
19
20
|
async publish() {
|
|
20
21
|
const request = await this.client.endpoints.channel.publishArticleSuggestion(this.id);
|
|
21
|
-
return request.code ==
|
|
22
|
+
return request.code == types_1.DefaultResult.Ok ? request.article_id : null;
|
|
22
23
|
}
|
|
23
24
|
async delete() {
|
|
24
25
|
const request = await this.client.endpoints.channel.removeArticleSuggestion(this.id);
|
package/dist/client.d.ts
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* ╔═══════════════════════════════════════════════════╗
|
|
3
|
+
* ║ AnixartJS ║
|
|
4
|
+
* ║ https://github.com/theDesConnet/AnixartJS ║
|
|
5
|
+
* ║ Licensed under GPL-2.0 License ║
|
|
6
|
+
* ║ by DesConnet ║
|
|
7
|
+
* ╚═══════════════════════════════════════════════════╝
|
|
8
|
+
*/
|
|
9
|
+
import { DefaultResult, IBaseRequest, IResponse, LoginResult } from "./types";
|
|
2
10
|
import { Endpoints } from "./endpoints";
|
|
3
11
|
import { Channel } from "./classes/Channel";
|
|
4
12
|
import { Article } from "./classes/Article";
|
|
@@ -33,6 +41,6 @@ export declare class Anixart {
|
|
|
33
41
|
getCollectionById(id: number): Promise<Collection | null>;
|
|
34
42
|
getFavoriteCollections(page: number): Promise<Collection[]>;
|
|
35
43
|
getAllCollections(page: number, sort?: number): Promise<Collection[]>;
|
|
36
|
-
login(username: string, password: string): Promise<
|
|
37
|
-
call<T extends IResponse
|
|
44
|
+
login(username: string, password: string): Promise<LoginResult | DefaultResult>;
|
|
45
|
+
call<TCode extends number, T extends IResponse<TCode>>(request: IBaseRequest): Promise<T>;
|
|
38
46
|
}
|
package/dist/client.js
CHANGED
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* ╔═══════════════════════════════════════════════════╗
|
|
4
|
+
* ║ AnixartJS ║
|
|
5
|
+
* ║ https://github.com/theDesConnet/AnixartJS ║
|
|
6
|
+
* ║ Licensed under GPL-2.0 License ║
|
|
7
|
+
* ║ by DesConnet ║
|
|
8
|
+
* ╚═══════════════════════════════════════════════════╝
|
|
9
|
+
*/
|
|
2
10
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
11
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
12
|
};
|
|
5
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
14
|
exports.Anixart = void 0;
|
|
15
|
+
const types_1 = require("./types");
|
|
7
16
|
const endpoints_1 = require("./endpoints");
|
|
8
17
|
const Channel_1 = require("./classes/Channel");
|
|
9
18
|
const Article_1 = require("./classes/Article");
|
|
@@ -68,7 +77,7 @@ class Anixart {
|
|
|
68
77
|
login: username,
|
|
69
78
|
password
|
|
70
79
|
});
|
|
71
|
-
if (request.code ==
|
|
80
|
+
if (request.code == types_1.DefaultResult.Ok)
|
|
72
81
|
this.token = request.profileToken.token;
|
|
73
82
|
return request.code;
|
|
74
83
|
}
|
package/dist/endpoints.d.ts
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* ╔═══════════════════════════════════════════════════╗
|
|
3
|
+
* ║ AnixartJS ║
|
|
4
|
+
* ║ https://github.com/theDesConnet/AnixartJS ║
|
|
5
|
+
* ║ Licensed under GPL-2.0 License ║
|
|
6
|
+
* ║ by DesConnet ║
|
|
7
|
+
* ╚═══════════════════════════════════════════════════╝
|
|
8
|
+
*/
|
|
9
|
+
import { Auth, Settings, Profile, Release, Notification, Collection, Discover, Channel, Feed, Search } from "./api";
|
|
2
10
|
import { IBaseApiParams, IScheduleResponse, ITypeResponse } from "./types";
|
|
3
11
|
import { Anixart } from "./client";
|
|
4
12
|
export declare class Endpoints {
|
|
@@ -12,6 +20,7 @@ export declare class Endpoints {
|
|
|
12
20
|
readonly discover: Discover;
|
|
13
21
|
readonly channel: Channel;
|
|
14
22
|
readonly feed: Feed;
|
|
23
|
+
readonly search: Search;
|
|
15
24
|
constructor(client: Anixart);
|
|
16
25
|
getSchedule(options?: IBaseApiParams): Promise<IScheduleResponse>;
|
|
17
26
|
getTypes(options?: IBaseApiParams): Promise<ITypeResponse>;
|
package/dist/endpoints.js
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* ╔═══════════════════════════════════════════════════╗
|
|
4
|
+
* ║ AnixartJS ║
|
|
5
|
+
* ║ https://github.com/theDesConnet/AnixartJS ║
|
|
6
|
+
* ║ Licensed under GPL-2.0 License ║
|
|
7
|
+
* ║ by DesConnet ║
|
|
8
|
+
* ╚═══════════════════════════════════════════════════╝
|
|
9
|
+
*/
|
|
2
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
11
|
exports.Endpoints = void 0;
|
|
4
12
|
const api_1 = require("./api");
|
|
@@ -14,6 +22,7 @@ class Endpoints {
|
|
|
14
22
|
this.discover = new api_1.Discover(client);
|
|
15
23
|
this.channel = new api_1.Channel(client);
|
|
16
24
|
this.feed = new api_1.Feed(client);
|
|
25
|
+
this.search = new api_1.Search(client);
|
|
17
26
|
}
|
|
18
27
|
async getSchedule(options) {
|
|
19
28
|
return await this.client.call({ path: '/schedule', ...options });
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -19,3 +19,4 @@ var client_1 = require("./client");
|
|
|
19
19
|
Object.defineProperty(exports, "Anixart", { enumerable: true, get: function () { return client_1.Anixart; } });
|
|
20
20
|
__exportStar(require("./utils/LinkParser"), exports);
|
|
21
21
|
__exportStar(require("./utils/ArticleBuilder"), exports);
|
|
22
|
+
__exportStar(require("./types"), exports);
|
package/dist/types/auth.d.ts
CHANGED
|
@@ -1,11 +1,50 @@
|
|
|
1
1
|
import { IResponse } from "./response";
|
|
2
2
|
import { IProfile, IProfileToken } from "./profile";
|
|
3
|
+
export declare enum LoginResult {
|
|
4
|
+
InvalidLogin = 2,
|
|
5
|
+
InvalidPassword = 3
|
|
6
|
+
}
|
|
7
|
+
export declare enum RegisterResult {
|
|
8
|
+
InvalidLogin = 2,
|
|
9
|
+
InvalidEmail = 3,
|
|
10
|
+
InvalidPassword = 4,
|
|
11
|
+
LoginAlreadyTaken = 5,
|
|
12
|
+
EmailAlreadyTaken = 6,
|
|
13
|
+
CodeAlreadySend = 7,
|
|
14
|
+
CodeCannotSend = 8,
|
|
15
|
+
EmailServiceDisallowed = 9,
|
|
16
|
+
TooManyRegistrations = 10
|
|
17
|
+
}
|
|
18
|
+
export declare enum RegisterVerifyResult {
|
|
19
|
+
InvalidLogin = 2,
|
|
20
|
+
InvalidEmail = 3,
|
|
21
|
+
InvalidPassword = 4,
|
|
22
|
+
LoginAlreadyTaken = 5,
|
|
23
|
+
EmailAlreadyTaken = 6,
|
|
24
|
+
CodeAlreadySend = 7,
|
|
25
|
+
CodeCannotSend = 8,
|
|
26
|
+
InvalidHash = 9,
|
|
27
|
+
EmailServiceDisallowed = 10,
|
|
28
|
+
TooManyRegistrations = 11
|
|
29
|
+
}
|
|
30
|
+
export declare enum RestorePasswordResult {
|
|
31
|
+
ProfileNotFound = 2,
|
|
32
|
+
CodeAlreadySend = 3,
|
|
33
|
+
CodeCannotSend = 4
|
|
34
|
+
}
|
|
35
|
+
export declare enum RestorePasswordVerifyResult {
|
|
36
|
+
ProfileNotFound = 2,
|
|
37
|
+
InvalidPassword = 3,
|
|
38
|
+
CodeInvalid = 4,
|
|
39
|
+
CodeExpired = 5,
|
|
40
|
+
InvalidHash = 6
|
|
41
|
+
}
|
|
3
42
|
export interface IRegisterRequest {
|
|
4
43
|
username: string;
|
|
5
44
|
password: string;
|
|
6
45
|
email: string;
|
|
7
46
|
}
|
|
8
|
-
export interface IRegisterResponse extends IResponse {
|
|
47
|
+
export interface IRegisterResponse<T extends number = RegisterResult> extends IResponse<T> {
|
|
9
48
|
hash: string;
|
|
10
49
|
codeTimestampExpires: number;
|
|
11
50
|
}
|
|
@@ -19,7 +58,7 @@ export interface ILoginRequest {
|
|
|
19
58
|
login: string;
|
|
20
59
|
password: string;
|
|
21
60
|
}
|
|
22
|
-
export interface ILoginResponse extends IResponse {
|
|
61
|
+
export interface ILoginResponse<T extends number = LoginResult> extends IResponse<T> {
|
|
23
62
|
profile: IProfile;
|
|
24
63
|
profileToken: IProfileToken;
|
|
25
64
|
}
|
package/dist/types/auth.js
CHANGED
|
@@ -1,2 +1,47 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RestorePasswordVerifyResult = exports.RestorePasswordResult = exports.RegisterVerifyResult = exports.RegisterResult = exports.LoginResult = void 0;
|
|
4
|
+
var LoginResult;
|
|
5
|
+
(function (LoginResult) {
|
|
6
|
+
LoginResult[LoginResult["InvalidLogin"] = 2] = "InvalidLogin";
|
|
7
|
+
LoginResult[LoginResult["InvalidPassword"] = 3] = "InvalidPassword";
|
|
8
|
+
})(LoginResult || (exports.LoginResult = LoginResult = {}));
|
|
9
|
+
var RegisterResult;
|
|
10
|
+
(function (RegisterResult) {
|
|
11
|
+
RegisterResult[RegisterResult["InvalidLogin"] = 2] = "InvalidLogin";
|
|
12
|
+
RegisterResult[RegisterResult["InvalidEmail"] = 3] = "InvalidEmail";
|
|
13
|
+
RegisterResult[RegisterResult["InvalidPassword"] = 4] = "InvalidPassword";
|
|
14
|
+
RegisterResult[RegisterResult["LoginAlreadyTaken"] = 5] = "LoginAlreadyTaken";
|
|
15
|
+
RegisterResult[RegisterResult["EmailAlreadyTaken"] = 6] = "EmailAlreadyTaken";
|
|
16
|
+
RegisterResult[RegisterResult["CodeAlreadySend"] = 7] = "CodeAlreadySend";
|
|
17
|
+
RegisterResult[RegisterResult["CodeCannotSend"] = 8] = "CodeCannotSend";
|
|
18
|
+
RegisterResult[RegisterResult["EmailServiceDisallowed"] = 9] = "EmailServiceDisallowed";
|
|
19
|
+
RegisterResult[RegisterResult["TooManyRegistrations"] = 10] = "TooManyRegistrations";
|
|
20
|
+
})(RegisterResult || (exports.RegisterResult = RegisterResult = {}));
|
|
21
|
+
var RegisterVerifyResult;
|
|
22
|
+
(function (RegisterVerifyResult) {
|
|
23
|
+
RegisterVerifyResult[RegisterVerifyResult["InvalidLogin"] = 2] = "InvalidLogin";
|
|
24
|
+
RegisterVerifyResult[RegisterVerifyResult["InvalidEmail"] = 3] = "InvalidEmail";
|
|
25
|
+
RegisterVerifyResult[RegisterVerifyResult["InvalidPassword"] = 4] = "InvalidPassword";
|
|
26
|
+
RegisterVerifyResult[RegisterVerifyResult["LoginAlreadyTaken"] = 5] = "LoginAlreadyTaken";
|
|
27
|
+
RegisterVerifyResult[RegisterVerifyResult["EmailAlreadyTaken"] = 6] = "EmailAlreadyTaken";
|
|
28
|
+
RegisterVerifyResult[RegisterVerifyResult["CodeAlreadySend"] = 7] = "CodeAlreadySend";
|
|
29
|
+
RegisterVerifyResult[RegisterVerifyResult["CodeCannotSend"] = 8] = "CodeCannotSend";
|
|
30
|
+
RegisterVerifyResult[RegisterVerifyResult["InvalidHash"] = 9] = "InvalidHash";
|
|
31
|
+
RegisterVerifyResult[RegisterVerifyResult["EmailServiceDisallowed"] = 10] = "EmailServiceDisallowed";
|
|
32
|
+
RegisterVerifyResult[RegisterVerifyResult["TooManyRegistrations"] = 11] = "TooManyRegistrations";
|
|
33
|
+
})(RegisterVerifyResult || (exports.RegisterVerifyResult = RegisterVerifyResult = {}));
|
|
34
|
+
var RestorePasswordResult;
|
|
35
|
+
(function (RestorePasswordResult) {
|
|
36
|
+
RestorePasswordResult[RestorePasswordResult["ProfileNotFound"] = 2] = "ProfileNotFound";
|
|
37
|
+
RestorePasswordResult[RestorePasswordResult["CodeAlreadySend"] = 3] = "CodeAlreadySend";
|
|
38
|
+
RestorePasswordResult[RestorePasswordResult["CodeCannotSend"] = 4] = "CodeCannotSend";
|
|
39
|
+
})(RestorePasswordResult || (exports.RestorePasswordResult = RestorePasswordResult = {}));
|
|
40
|
+
var RestorePasswordVerifyResult;
|
|
41
|
+
(function (RestorePasswordVerifyResult) {
|
|
42
|
+
RestorePasswordVerifyResult[RestorePasswordVerifyResult["ProfileNotFound"] = 2] = "ProfileNotFound";
|
|
43
|
+
RestorePasswordVerifyResult[RestorePasswordVerifyResult["InvalidPassword"] = 3] = "InvalidPassword";
|
|
44
|
+
RestorePasswordVerifyResult[RestorePasswordVerifyResult["CodeInvalid"] = 4] = "CodeInvalid";
|
|
45
|
+
RestorePasswordVerifyResult[RestorePasswordVerifyResult["CodeExpired"] = 5] = "CodeExpired";
|
|
46
|
+
RestorePasswordVerifyResult[RestorePasswordVerifyResult["InvalidHash"] = 6] = "InvalidHash";
|
|
47
|
+
})(RestorePasswordVerifyResult || (exports.RestorePasswordVerifyResult = RestorePasswordVerifyResult = {}));
|