e621 1.0.9 → 2.0.0-dev.11
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/.node-version +1 -0
- package/README.md +116 -187
- package/build/package.json +14 -11
- package/build/src/index.d.ts +28 -295
- package/build/src/index.js +83 -442
- package/build/src/modules/Pools.d.ts +120 -0
- package/build/src/modules/Pools.js +247 -0
- package/build/src/modules/PostSets.d.ts +88 -0
- package/build/src/modules/PostSets.js +182 -0
- package/build/src/modules/Posts.d.ts +124 -0
- package/build/src/modules/Posts.js +323 -0
- package/build/src/modules/UserFeedback.d.ts +66 -0
- package/build/src/modules/UserFeedback.js +134 -0
- package/build/src/modules/Users.d.ts +110 -0
- package/build/src/modules/Users.js +248 -0
- package/build/src/modules/WikiPages.d.ts +99 -0
- package/build/src/modules/WikiPages.js +208 -0
- package/build/src/structures/AuthenticatedUser.d.ts +109 -0
- package/build/src/structures/AuthenticatedUser.js +128 -0
- package/build/src/structures/Pool.d.ts +85 -0
- package/build/src/structures/Pool.js +110 -0
- package/build/src/structures/PoolHistory.d.ts +42 -0
- package/build/src/structures/PoolHistory.js +53 -0
- package/build/src/structures/Post.d.ts +147 -0
- package/build/src/structures/Post.js +155 -0
- package/build/src/structures/PostHistory.d.ts +52 -0
- package/build/src/structures/PostHistory.js +93 -0
- package/build/src/structures/PostSet.d.ts +71 -0
- package/build/src/structures/PostSet.js +91 -0
- package/build/src/structures/User.d.ts +62 -0
- package/build/src/structures/User.js +80 -0
- package/build/src/structures/WikiPage.d.ts +16 -0
- package/build/src/structures/WikiPage.js +26 -0
- package/build/src/structures/WikiPageHistory.d.ts +37 -0
- package/build/src/structures/WikiPageHistory.js +49 -0
- package/build/src/types/index.d.ts +92 -0
- package/build/src/types/pools.d.ts +60 -0
- package/build/src/types/post_sets.d.ts +33 -0
- package/build/src/types/posts.d.ts +165 -0
- package/build/src/types/user_feedback.d.ts +27 -0
- package/build/src/types/users.d.ts +277 -0
- package/build/src/types/wiki_pages.d.ts +65 -0
- package/build/src/util/FormHelper.d.ts +9 -0
- package/build/src/util/FormHelper.js +15 -0
- package/build/src/util/MultipartData.d.ts +7 -0
- package/build/src/util/MultipartData.js +39 -0
- package/build/src/util/RequestHandler.d.ts +37 -0
- package/build/src/util/RequestHandler.js +311 -0
- package/package.json +14 -11
- package/LICENSE +0 -21
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
class PostSet {
|
|
4
|
+
main;
|
|
5
|
+
id;
|
|
6
|
+
name;
|
|
7
|
+
shortname;
|
|
8
|
+
description;
|
|
9
|
+
is_public;
|
|
10
|
+
transfer_on_delete;
|
|
11
|
+
creator_id;
|
|
12
|
+
post_ids;
|
|
13
|
+
post_count;
|
|
14
|
+
created_at;
|
|
15
|
+
updated_at;
|
|
16
|
+
constructor(main, info) {
|
|
17
|
+
Object.assign(this, info);
|
|
18
|
+
Object.defineProperty(this, "main", {
|
|
19
|
+
value: main,
|
|
20
|
+
configurable: false,
|
|
21
|
+
enumerable: false,
|
|
22
|
+
writable: false
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Get the post objects for the posts in this set
|
|
27
|
+
*
|
|
28
|
+
* @returns {Promise<Array<Post>>}
|
|
29
|
+
*/
|
|
30
|
+
async getPosts() { return this.main.posts.search({ tags: this.post_ids.map(p => `id:${p}`) }); }
|
|
31
|
+
/**
|
|
32
|
+
* Get the user object of the creator of this set
|
|
33
|
+
*
|
|
34
|
+
* @returns {Promise<User | null>}
|
|
35
|
+
*/
|
|
36
|
+
async getCreator() { return this.main.users.get(this.creator_id); }
|
|
37
|
+
/**
|
|
38
|
+
* Add a post to this set
|
|
39
|
+
*
|
|
40
|
+
* * Requires Authentication
|
|
41
|
+
*
|
|
42
|
+
* @param {number} id - the id of the post to add
|
|
43
|
+
* @returns {Promise<PostSet>}
|
|
44
|
+
*/
|
|
45
|
+
async addPost(id) {
|
|
46
|
+
this.main.request.authCheck("PostSet#addPost");
|
|
47
|
+
return this.main.postSets.addPost(this.id, id);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Remove a post from this set
|
|
51
|
+
*
|
|
52
|
+
* * Requires Authentication
|
|
53
|
+
*
|
|
54
|
+
* @param {number} id - the id of the post to remove
|
|
55
|
+
* @returns {Promise<PostSet>}
|
|
56
|
+
*/
|
|
57
|
+
async removePost(id) {
|
|
58
|
+
this.main.request.authCheck("PostSet#removePost");
|
|
59
|
+
return this.main.postSets.removePost(this.id, id);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* modify this set
|
|
63
|
+
*
|
|
64
|
+
* * Requires Authentication
|
|
65
|
+
*
|
|
66
|
+
* @param {object} options
|
|
67
|
+
* @param {string} [options.name] - the name of the set
|
|
68
|
+
* @param {string} [options.shortname] - the short name of the set
|
|
69
|
+
* @param {string} [options.escription] - the description of the set
|
|
70
|
+
* @param {boolean} [options.active] - if the set is public
|
|
71
|
+
* @param {boolean} [options.transferOnDeletion] - if deleted posts should be replaced with parents
|
|
72
|
+
* @returns {Promise<PostSet>}
|
|
73
|
+
*/
|
|
74
|
+
async modify(options) {
|
|
75
|
+
this.main.request.authCheck("PostSet#modify");
|
|
76
|
+
return this.main.postSets.modify(this.id, options);
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Delete this set
|
|
80
|
+
*
|
|
81
|
+
* * Requires Authentication
|
|
82
|
+
*
|
|
83
|
+
* @returns {Promise<null>}
|
|
84
|
+
*/
|
|
85
|
+
async delete() {
|
|
86
|
+
this.main.request.authCheck("PostSet#delete");
|
|
87
|
+
return this.main.postSets.delete(this.id);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
exports.default = PostSet;
|
|
91
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiUG9zdFNldC5qcyIsInNvdXJjZVJvb3QiOi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JLENBQUMsUUFBUSxDQUFDLE1BQU0sQ0FBQyxJQUFJLENBQUMsRUFBRSxDQUFDLENBQUM7SUFDM0MsQ0FBQztDQUNEO0FBNUZELDBCQTRGQyJ9
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type Post from "./Post";
|
|
2
|
+
import type E621 from "..";
|
|
3
|
+
import type { UserProperties, SearchUserFeedbackOptions, CreateUserFeedbackOptions, UserFeedbackProperties } from "../types";
|
|
4
|
+
export default class User implements UserProperties {
|
|
5
|
+
protected readonly main: E621;
|
|
6
|
+
wiki_page_version_count: number;
|
|
7
|
+
artist_version_count: number;
|
|
8
|
+
pool_version_count: number;
|
|
9
|
+
forum_post_count: number;
|
|
10
|
+
comment_count: number;
|
|
11
|
+
appeal_count: number;
|
|
12
|
+
flag_count: number;
|
|
13
|
+
positive_feedback_count: number;
|
|
14
|
+
neutral_feedback_count: number;
|
|
15
|
+
negative_feedback_count: number;
|
|
16
|
+
upload_limit: number;
|
|
17
|
+
id: number;
|
|
18
|
+
created_at: string;
|
|
19
|
+
name: string;
|
|
20
|
+
level: number;
|
|
21
|
+
base_upload_limit: number;
|
|
22
|
+
post_upload_count: number;
|
|
23
|
+
post_update_count: number;
|
|
24
|
+
note_update_count: number;
|
|
25
|
+
is_banned: boolean;
|
|
26
|
+
can_approve_posts: boolean;
|
|
27
|
+
can_upload_free: boolean;
|
|
28
|
+
level_string: string;
|
|
29
|
+
avatar_id: number | null;
|
|
30
|
+
constructor(main: E621, info: UserProperties);
|
|
31
|
+
/**
|
|
32
|
+
* Get the feedback associated with this user
|
|
33
|
+
*
|
|
34
|
+
* @param {object} [options] - Options for narrowing the search
|
|
35
|
+
* @param {string} [options.creator] - the creator of the feedback
|
|
36
|
+
* @param {string} [options.body] - the body of the feedback
|
|
37
|
+
* @param {FeedbackCategories} [options.category] - the type of feedback
|
|
38
|
+
* @param {number} [options.limit] - the maximum amount of feedback to fetch
|
|
39
|
+
* @returns {Array<UserFeedbackProperties>}
|
|
40
|
+
*/
|
|
41
|
+
getFeedback(options: Omit<SearchUserFeedbackOptions, "username">): Promise<UserFeedbackProperties[]>;
|
|
42
|
+
/**
|
|
43
|
+
* Create a feedback for this user
|
|
44
|
+
*
|
|
45
|
+
* * Requires Authentication
|
|
46
|
+
*
|
|
47
|
+
* * Requires Moderator
|
|
48
|
+
*
|
|
49
|
+
* @param {object} options
|
|
50
|
+
* @param {FeedbackCategories} options.category - the type of feedback
|
|
51
|
+
* @param {string} options.body - the body of the feedback
|
|
52
|
+
* @returns
|
|
53
|
+
*/
|
|
54
|
+
createFeedback(options: Omit<CreateUserFeedbackOptions, "username">): Promise<UserFeedbackProperties>;
|
|
55
|
+
/**
|
|
56
|
+
* Get this users favorites
|
|
57
|
+
*
|
|
58
|
+
* @returns {Promise<Array<Post>>}
|
|
59
|
+
*/
|
|
60
|
+
getFavorites(): Promise<Post[]>;
|
|
61
|
+
asAuthenticatedUser(): Promise<import("./AuthenticatedUser").default>;
|
|
62
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
class User {
|
|
4
|
+
main;
|
|
5
|
+
wiki_page_version_count;
|
|
6
|
+
artist_version_count;
|
|
7
|
+
pool_version_count;
|
|
8
|
+
forum_post_count;
|
|
9
|
+
comment_count;
|
|
10
|
+
appeal_count;
|
|
11
|
+
flag_count;
|
|
12
|
+
positive_feedback_count;
|
|
13
|
+
neutral_feedback_count;
|
|
14
|
+
negative_feedback_count;
|
|
15
|
+
upload_limit;
|
|
16
|
+
id;
|
|
17
|
+
created_at;
|
|
18
|
+
name;
|
|
19
|
+
level;
|
|
20
|
+
base_upload_limit;
|
|
21
|
+
post_upload_count;
|
|
22
|
+
post_update_count;
|
|
23
|
+
note_update_count;
|
|
24
|
+
is_banned;
|
|
25
|
+
can_approve_posts;
|
|
26
|
+
can_upload_free;
|
|
27
|
+
level_string;
|
|
28
|
+
avatar_id;
|
|
29
|
+
constructor(main, info) {
|
|
30
|
+
Object.assign(this, info);
|
|
31
|
+
Object.defineProperty(this, "main", {
|
|
32
|
+
value: main,
|
|
33
|
+
configurable: false,
|
|
34
|
+
enumerable: false,
|
|
35
|
+
writable: false
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Get the feedback associated with this user
|
|
40
|
+
*
|
|
41
|
+
* @param {object} [options] - Options for narrowing the search
|
|
42
|
+
* @param {string} [options.creator] - the creator of the feedback
|
|
43
|
+
* @param {string} [options.body] - the body of the feedback
|
|
44
|
+
* @param {FeedbackCategories} [options.category] - the type of feedback
|
|
45
|
+
* @param {number} [options.limit] - the maximum amount of feedback to fetch
|
|
46
|
+
* @returns {Array<UserFeedbackProperties>}
|
|
47
|
+
*/
|
|
48
|
+
async getFeedback(options) { return this.main.userFeedback.search({ username: this.name, ...options }); }
|
|
49
|
+
/**
|
|
50
|
+
* Create a feedback for this user
|
|
51
|
+
*
|
|
52
|
+
* * Requires Authentication
|
|
53
|
+
*
|
|
54
|
+
* * Requires Moderator
|
|
55
|
+
*
|
|
56
|
+
* @param {object} options
|
|
57
|
+
* @param {FeedbackCategories} options.category - the type of feedback
|
|
58
|
+
* @param {string} options.body - the body of the feedback
|
|
59
|
+
* @returns
|
|
60
|
+
*/
|
|
61
|
+
async createFeedback(options) {
|
|
62
|
+
this.main.request.authCheck.call(this, "User#createFeedback");
|
|
63
|
+
return this.main.userFeedback.create({ username: this.name, ...options });
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Get this users favorites
|
|
67
|
+
*
|
|
68
|
+
* @returns {Promise<Array<Post>>}
|
|
69
|
+
*/
|
|
70
|
+
async getFavorites() { return this.main.users.getFavorites(this.id); }
|
|
71
|
+
async asAuthenticatedUser() {
|
|
72
|
+
this.main.request.authCheck.call(this, "User#asAuthenticatedUser");
|
|
73
|
+
const info = await this.main.users.getSelf();
|
|
74
|
+
if (info.id !== this.id)
|
|
75
|
+
throw new Error("User#asAuthenticatedUser called on a different user");
|
|
76
|
+
return info;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
exports.default = User;
|
|
80
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiVXNlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9zdHJ1Y3R1cmVzL1VzZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFVQSxNQUFxQixJQUFJO0lBQ0wsSUFBSSxDQUFPO0lBQzlCLHVCQUF1QixDQUFTO0lBQ2hDLG9CQUFvQixDQUFTO0lBQzdCLGtCQUFrQixDQUFTO0lBQzNCLGdCQUFnQixDQUFTO0lBQ3pCLGFBQWEsQ0FBUztJQUN0QixZQUFZLENBQVM7SUFDckIsVUFBVSxDQUFTO0lBQ25CLHVCQUF1QixDQUFTO0lBQ2hDLHNCQUFzQixDQUFTO0lBQy9CLHVCQUF1QixDQUFTO0lBQ2hDLFlBQVksQ0FBUztJQUNyQixFQUFFLENBQVM7SUFDWCxVQUFVLENBQVM7SUFDbkIsSUFBSSxDQUFTO0lBQ2IsS0FBSyxDQUFTO0lBQ2QsaUJBQWlCLENBQVM7SUFDMUIsaUJBQWlCLENBQVM7SUFDMUIsaUJBQWlCLENBQVM7SUFDMUIsaUJBQWlCLENBQVM7SUFDMUIsU0FBUyxDQUFVO0lBQ25CLGlCQUFpQixDQUFVO0lBQzNCLGVBQWUsQ0FBVTtJQUN6QixZQUFZLENBQVM7SUFDckIsU0FBUyxDQUFnQjtJQUN6QixZQUFZLElBQVUsRUFBRSxJQUFvQjtRQUMzQyxNQUFNLENBQUMsTUFBTSxDQUFDLElBQUksRUFBRSxJQUFJLENBQUMsQ0FBQztRQUMxQixNQUFNLENBQUMsY0FBYyxDQUFDLElBQUksRUFBRSxNQUFNLEVBQUU7WUFDbkMsS0FBSyxFQUFFLElBQUk7WUFDWCxZ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BQU8sRUFBRSxDQUFDO1FBQzdDLElBQUksSUFBSSxDQUFDLEVBQUUsS0FBSyxJQUFJLENBQUMsRUFBRTtZQUFFLE1BQU0sSUFBSSxLQUFLLENBQUMscURBQXFELENBQUMsQ0FBQztRQUNoRyxPQUFPLElBQUksQ0FBQztJQUNiLENBQUM7Q0FDRDtBQTdFRCx1QkE2RUMifQ==
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { WikiPageProperties } from "../types";
|
|
2
|
+
import type E621 from "..";
|
|
3
|
+
export default class Pool implements WikiPageProperties {
|
|
4
|
+
id: number;
|
|
5
|
+
creator_id: number;
|
|
6
|
+
creator_name: string;
|
|
7
|
+
category_name: number;
|
|
8
|
+
body: string;
|
|
9
|
+
is_locked: boolean;
|
|
10
|
+
created_at: string;
|
|
11
|
+
updated_at: string;
|
|
12
|
+
updater_id: number;
|
|
13
|
+
other_names: Array<string>;
|
|
14
|
+
is_deleted: boolean;
|
|
15
|
+
constructor(main: E621, info: WikiPageProperties);
|
|
16
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
class Pool {
|
|
4
|
+
id;
|
|
5
|
+
creator_id;
|
|
6
|
+
creator_name;
|
|
7
|
+
category_name;
|
|
8
|
+
body;
|
|
9
|
+
is_locked;
|
|
10
|
+
created_at;
|
|
11
|
+
updated_at;
|
|
12
|
+
updater_id;
|
|
13
|
+
other_names;
|
|
14
|
+
is_deleted;
|
|
15
|
+
constructor(main, info) {
|
|
16
|
+
Object.assign(this, info);
|
|
17
|
+
Object.defineProperty(this, "main", {
|
|
18
|
+
value: main,
|
|
19
|
+
configurable: false,
|
|
20
|
+
enumerable: false,
|
|
21
|
+
writable: false
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.default = Pool;
|
|
26
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiV2lraVBhZ2UuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvc3RydWN0dXJlcy9XaWtpUGFnZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUdBLE1BQXFCLElBQUk7SUFDeEIsRUFBRSxDQUFTO0lBQ1gsVUFBVSxDQUFTO0lBQ25CLFlBQVksQ0FBUztJQUNyQixhQUFhLENBQVM7SUFDdEIsSUFBSSxDQUFTO0lBQ2IsU0FBUyxDQUFVO0lBQ25CLFVBQVUsQ0FBUztJQUNuQixVQUFVLENBQVM7SUFDbkIsVUFBVSxDQUFTO0lBQ25CLFdBQVcsQ0FBZ0I7SUFDM0IsVUFBVSxDQUFVO0lBQ3BCLFlBQVksSUFBVSxFQUFFLElBQXdCO1FBQy9DLE1BQU0sQ0FBQyxNQUFNLENBQUMsSUFBSSxFQUFFLElBQUksQ0FBQyxDQUFDO1FBQzFCLE1BQU0sQ0FBQyxjQUFjLENBQUMsSUFBSSxFQUFFLE1BQU0sRUFBRTtZQUNuQyxLQUFLLEVBQUUsSUFBSTtZQUNYLFlBQVksRUFBRSxLQUFLO1lBQ25CLFVBQVUsRUFBRSxLQUFLO1lBQ2pCLFFBQVEsRUFBRSxLQUFLO1NBQ2YsQ0FBQyxDQUFDO0lBQ0osQ0FBQztDQUNEO0FBckJELHVCQXFCQyJ9
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type User from "./User";
|
|
2
|
+
import type { WikiPageHistoryProperties } from "../types";
|
|
3
|
+
import type E621 from "..";
|
|
4
|
+
export default class WikiPageHistory implements WikiPageHistoryProperties {
|
|
5
|
+
private main;
|
|
6
|
+
id: number;
|
|
7
|
+
wiki_page_id: number;
|
|
8
|
+
updater_id: number;
|
|
9
|
+
title: string;
|
|
10
|
+
body: string;
|
|
11
|
+
is_locked: boolean;
|
|
12
|
+
created_at: string;
|
|
13
|
+
updated_at: string;
|
|
14
|
+
other_names: Array<string>;
|
|
15
|
+
is_deleted: boolean;
|
|
16
|
+
reason: string;
|
|
17
|
+
constructor(main: E621, info: WikiPageHistoryProperties);
|
|
18
|
+
/**
|
|
19
|
+
* Get the updater for this history
|
|
20
|
+
*
|
|
21
|
+
* @returns {Promise<User | null>}
|
|
22
|
+
*/
|
|
23
|
+
getUpdater(): Promise<User | null>;
|
|
24
|
+
/**
|
|
25
|
+
* Get the wiki page object for this history
|
|
26
|
+
*
|
|
27
|
+
* @returns {Promise<WikiPage | null>}
|
|
28
|
+
*/
|
|
29
|
+
getWikiPage(): Promise<import("./Pool").default | null>;
|
|
30
|
+
/**
|
|
31
|
+
* Revert the wiki page to this version
|
|
32
|
+
*
|
|
33
|
+
* * Requires Authentication
|
|
34
|
+
*
|
|
35
|
+
*/
|
|
36
|
+
revertTo(): Promise<null>;
|
|
37
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
class WikiPageHistory {
|
|
4
|
+
main;
|
|
5
|
+
id;
|
|
6
|
+
wiki_page_id;
|
|
7
|
+
updater_id;
|
|
8
|
+
title;
|
|
9
|
+
body;
|
|
10
|
+
is_locked;
|
|
11
|
+
created_at;
|
|
12
|
+
updated_at;
|
|
13
|
+
other_names;
|
|
14
|
+
is_deleted;
|
|
15
|
+
reason;
|
|
16
|
+
constructor(main, info) {
|
|
17
|
+
Object.assign(this, info);
|
|
18
|
+
Object.defineProperty(this, "main", {
|
|
19
|
+
value: main,
|
|
20
|
+
configurable: false,
|
|
21
|
+
enumerable: false,
|
|
22
|
+
writable: false
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Get the updater for this history
|
|
27
|
+
*
|
|
28
|
+
* @returns {Promise<User | null>}
|
|
29
|
+
*/
|
|
30
|
+
async getUpdater() { return this.main.users.get(this.updater_id); }
|
|
31
|
+
/**
|
|
32
|
+
* Get the wiki page object for this history
|
|
33
|
+
*
|
|
34
|
+
* @returns {Promise<WikiPage | null>}
|
|
35
|
+
*/
|
|
36
|
+
async getWikiPage() { return this.main.pools.get(this.wiki_page_id); }
|
|
37
|
+
/**
|
|
38
|
+
* Revert the wiki page to this version
|
|
39
|
+
*
|
|
40
|
+
* * Requires Authentication
|
|
41
|
+
*
|
|
42
|
+
*/
|
|
43
|
+
async revertTo() {
|
|
44
|
+
this.main.request.authCheck("WikiPageHistory#revertTo");
|
|
45
|
+
return this.main.pools.revert(this.wiki_page_id, this.id);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
exports.default = WikiPageHistory;
|
|
49
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiV2lraVBhZ2VIaXN0b3J5LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL3N0cnVjdHVyZXMvV2lraVBhZ2VIaXN0b3J5LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBS0EsTUFBcUIsZUFBZTtJQUMzQixJQUFJLENBQU87SUFDbkIsRUFBRSxDQUFTO0lBQ1gsWUFBWSxDQUFTO0lBQ3JCLFVBQVUsQ0FBUztJQUNuQixLQUFLLENBQVM7SUFDZCxJQUFJLENBQVM7SUFDYixTQUFTLENBQVU7SUFDbkIsVUFBVSxDQUFTO0lBQ25CLFVBQVUsQ0FBUztJQUNuQixXQUFXLENBQWdCO0lBQzNCLFVBQVUsQ0FBVTtJQUNwQixNQUFNLENBQVM7SUFDZixZQUFZLElBQVUsRUFBRSxJQUErQjtRQUN0RCxNQUFNLENBQUMsTUFBTSxDQUFDLElBQUksRUFBRSxJQUFJLENBQUMsQ0FBQztRQUMxQixNQUFNLENBQUMsY0FBYyxDQUFDLElBQUksRUFBRSxNQUFNLEVBQUU7WUFDbkMsS0FBSyxFQUFFLElBQUk7WUFDWCxZQUFZLEVBQUUsS0FBSztZQUNuQixVQUFVLEVBQUUsS0FBSztZQUNqQixRQUFRLEVBQUUsS0FBSztTQUNmLENBQUMsQ0FBQztJQUNKLENBQUM7SUFFRDs7OztPQUlHO0lBQ0gsS0FBSyxDQUFDLFVBQVUsS0FBSyxPQUFPLElBQUksQ0FBQyxJQUFJLENBQUMsS0FBSyxDQUFDLEdBQUcsQ0FBQyxJQUFJLENBQUMsVUFBVSxDQUFDLENBQUMsQ0FBQyxDQUFDO0lBRW5FOzs7O09BSUc7SUFDSCxLQUFLLENBQUMsV0FBVyxLQUFLLE9BQU8sSUFBSSxDQUFDLElBQUksQ0FBQyxLQUFLLENBQUMsR0FBRyxDQUFDLElBQUksQ0FBQyxZQUFZLENBQUMsQ0FBQyxDQUFDLENBQUM7SUFHdEU7Ozs7O09BS0c7SUFDSCxLQUFLLENBQUMsUUFBUTtRQUNiLElBQUksQ0FBQyxJQUFJLENBQUMsT0FBTyxDQUFDLFNBQVMsQ0FBQywwQkFBMEIsQ0FBQyxDQUFDO1FBQ3hELE9BQU8sSUFBSSxDQUFDLElBQUksQ0FBQyxLQUFLLENBQUMsTUFBTSxDQUFDLElBQUksQ0FBQyxZQUFZLEVBQUUsSUFBSSxDQUFDLEVBQUUsQ0FBQyxDQUFDO0lBQzNELENBQUM7Q0FDRDtBQWhERCxrQ0FnREMifQ==
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
export interface Options {
|
|
2
|
+
/**
|
|
3
|
+
* If the instance you are targeting supports ssl
|
|
4
|
+
*
|
|
5
|
+
* Default: true if `instanceHost` is "e621.net", false otherwise
|
|
6
|
+
*/
|
|
7
|
+
instanceSSL?: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* The port of the instance you are targeting
|
|
10
|
+
*
|
|
11
|
+
* Default: 443 if `instanceSSL` is true, 80 otherwise
|
|
12
|
+
*/
|
|
13
|
+
instancePort?: number;
|
|
14
|
+
/**
|
|
15
|
+
* The host of the instance you are targeting
|
|
16
|
+
*
|
|
17
|
+
* Default: e621.net
|
|
18
|
+
*/
|
|
19
|
+
instanceHost?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Override our default url reconstruction when we see a null file url
|
|
22
|
+
*
|
|
23
|
+
* Default (e621.net): https://static1.e621.net/data/(preview/|sample/)MD5[0,2]/MD5[2,4]/MD5.EXT
|
|
24
|
+
*
|
|
25
|
+
* Default (yiff.rest): https://v3.yiff.media/(preview/|sample/)MD5[0,2]/MD5[2,4]/MD5.EXT
|
|
26
|
+
*
|
|
27
|
+
* Default (e621.local): http://e621.local/data/(preview/|sample/)MD5.EXT
|
|
28
|
+
*
|
|
29
|
+
* If you use a host that is not supported, and do not implement this, or set a construction type, an error will be thrown.
|
|
30
|
+
*
|
|
31
|
+
* @param {string} md5 - the md5 of the image
|
|
32
|
+
* @param {("original" | "preview" | "sample")} type - the type of url being constructed
|
|
33
|
+
* @param {string} ext - the extension of the file
|
|
34
|
+
*/
|
|
35
|
+
reconstructStaticURL?(this: void, md5: string, type: "original" | "preview" | "sample", ext: string): string;
|
|
36
|
+
/**
|
|
37
|
+
* The method to use for image reconstructon (if you are not using E621, YiffyAPI, or e621ng, you MUST override the reconstructStaticURL function, as the static urls are hardcoded for these)
|
|
38
|
+
*
|
|
39
|
+
* Default: based on `instanceHost` - e621.net = e621 | yiff.rest = yiffy | e621.local = dev | other = null
|
|
40
|
+
*/
|
|
41
|
+
imageReconstructionType?: "e621" | "yiffy" | "dev" | null;
|
|
42
|
+
/**
|
|
43
|
+
* The uername of the user you want to authenticate with
|
|
44
|
+
*
|
|
45
|
+
* Default: none
|
|
46
|
+
*/
|
|
47
|
+
authUser?: string;
|
|
48
|
+
/**
|
|
49
|
+
* The api key you want to authenticate with (Account -> Manage API Access)
|
|
50
|
+
*
|
|
51
|
+
* Default: none
|
|
52
|
+
*/
|
|
53
|
+
authKey?: string;
|
|
54
|
+
/**
|
|
55
|
+
* The user agent to use for requests
|
|
56
|
+
*
|
|
57
|
+
* Default (Without Auth): E621/VERSION (https://github.com/DonovanDMC/E621)
|
|
58
|
+
*
|
|
59
|
+
* Default (With Auth): E621/VERSION (https://github.com/DonovanDMC/E621; "{authUser}")
|
|
60
|
+
*/
|
|
61
|
+
userAgent?: string;
|
|
62
|
+
/**
|
|
63
|
+
* The number of seconds before a request times out
|
|
64
|
+
*
|
|
65
|
+
* Default: 30
|
|
66
|
+
*/
|
|
67
|
+
requestTimeout?: number;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export interface InstanceOptions {
|
|
71
|
+
instanceSSL: boolean;
|
|
72
|
+
instancePort: number;
|
|
73
|
+
instanceHost: string;
|
|
74
|
+
authUser: string | null;
|
|
75
|
+
authKey: string | null;
|
|
76
|
+
reconstructStaticURL: ((this: void, md5: string, type: "original" | "preview" | "sample", ext: string) => string) | null;
|
|
77
|
+
imageReconstructionType: "e621" | "yiffy" | "dev" | null;
|
|
78
|
+
userAgent: string;
|
|
79
|
+
requestTimeout: number;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export interface GenericSearchOptions {
|
|
83
|
+
limit?: number;
|
|
84
|
+
page?: number | `${"a" | "b" | ""}${number}`;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export * from "./pools";
|
|
88
|
+
export * from "./post_sets";
|
|
89
|
+
export * from "./posts";
|
|
90
|
+
export * from "./user_feedback";
|
|
91
|
+
export * from "./users";
|
|
92
|
+
export * from "./wiki_pages";
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { GenericSearchOptions } from ".";
|
|
2
|
+
|
|
3
|
+
export type PoolCategory = "collection" | "series";
|
|
4
|
+
export interface PoolProperties {
|
|
5
|
+
id: number;
|
|
6
|
+
name: string;
|
|
7
|
+
created_at: string;
|
|
8
|
+
updated_at: string;
|
|
9
|
+
creator_id: number;
|
|
10
|
+
creator_name: string;
|
|
11
|
+
is_active: boolean;
|
|
12
|
+
category: PoolCategory;
|
|
13
|
+
is_deleted: boolean;
|
|
14
|
+
post_ids: Array<number>;
|
|
15
|
+
post_count: number;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export type PoolOrder = "updated_at" | "name" | "created_at" | "post_count";
|
|
19
|
+
export interface SearchPoolsOptions extends GenericSearchOptions {
|
|
20
|
+
name?: string;
|
|
21
|
+
description?: string;
|
|
22
|
+
creator?: string;
|
|
23
|
+
active?: boolean;
|
|
24
|
+
category?: PoolCategory;
|
|
25
|
+
order?: PoolOrder;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// the api docs list is_locked, but it isn't a permitted parameter, and I can't find any references in the source code
|
|
29
|
+
// so it seems like it was removed and the docs are just out of date
|
|
30
|
+
export interface CreatePoolOptions {
|
|
31
|
+
name: string;
|
|
32
|
+
description?: string;
|
|
33
|
+
posts?: Array<number>;
|
|
34
|
+
category: PoolCategory;
|
|
35
|
+
active?: boolean;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export type ModifyPoolOptions = Partial<CreatePoolOptions>;
|
|
39
|
+
|
|
40
|
+
export interface PoolHistoryProperties {
|
|
41
|
+
id: number;
|
|
42
|
+
pool_id: number;
|
|
43
|
+
post_ids: Array<number>;
|
|
44
|
+
added_post_ids: Array<number>;
|
|
45
|
+
removed_post_ids: Array<number>;
|
|
46
|
+
updater_id: number;
|
|
47
|
+
description: string;
|
|
48
|
+
description_changed: boolean;
|
|
49
|
+
name: string;
|
|
50
|
+
created_at: string;
|
|
51
|
+
updated_at: string;
|
|
52
|
+
is_active: boolean;
|
|
53
|
+
is_deleted: boolean;
|
|
54
|
+
category: PoolCategory;
|
|
55
|
+
version: number;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface SearchPoolHistoryOptions extends GenericSearchOptions {
|
|
59
|
+
pool?: number;
|
|
60
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { GenericSearchOptions } from ".";
|
|
2
|
+
|
|
3
|
+
export interface PostSetProperties {
|
|
4
|
+
id: number;
|
|
5
|
+
name: string;
|
|
6
|
+
shortname: string;
|
|
7
|
+
description: string;
|
|
8
|
+
is_public: boolean;
|
|
9
|
+
transfer_on_delete: boolean;
|
|
10
|
+
creator_id: number;
|
|
11
|
+
post_ids: Array<number>;
|
|
12
|
+
post_count: number;
|
|
13
|
+
created_at: string;
|
|
14
|
+
updated_at: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export type PostSetOrder = "name" | "shortname" | "postcount" | "created_at" | "update";
|
|
18
|
+
export interface SearchPostSetsOptions extends GenericSearchOptions {
|
|
19
|
+
name?: string;
|
|
20
|
+
shortname?: string;
|
|
21
|
+
username?: string;
|
|
22
|
+
order?: PostSetOrder;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface CreatePostSetOptions {
|
|
26
|
+
name: string;
|
|
27
|
+
shortname: string;
|
|
28
|
+
description?: string;
|
|
29
|
+
public?: boolean;
|
|
30
|
+
transferOnDeletion?: boolean;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export type ModifyPostSetOptions = Partial<CreatePostSetOptions>;
|