e621 2.2.4 → 3.0.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/LICENSE +21 -0
- package/README.md +15 -40
- package/dist/lib/Debug.d.ts +1 -0
- package/dist/lib/Debug.js +16 -0
- package/dist/lib/errors.d.ts +8 -0
- package/dist/lib/errors.js +37 -0
- package/dist/lib/generated/client/client.d.ts +2 -0
- package/dist/lib/generated/client/client.js +236 -0
- package/dist/lib/generated/client/index.d.ts +8 -0
- package/dist/lib/generated/client/index.js +7 -0
- package/dist/lib/generated/client/types.d.ts +117 -0
- package/dist/lib/generated/client/types.js +3 -0
- package/dist/lib/generated/client/utils.d.ts +33 -0
- package/dist/lib/generated/client/utils.js +229 -0
- package/dist/lib/generated/client.d.ts +12 -0
- package/dist/lib/generated/client.js +4 -0
- package/dist/lib/generated/core/auth.d.ts +18 -0
- package/dist/lib/generated/core/auth.js +15 -0
- package/dist/lib/generated/core/bodySerializer.d.ts +25 -0
- package/dist/lib/generated/core/bodySerializer.js +58 -0
- package/dist/lib/generated/core/params.d.ts +43 -0
- package/dist/lib/generated/core/params.js +101 -0
- package/dist/lib/generated/core/pathSerializer.d.ts +33 -0
- package/dist/lib/generated/core/pathSerializer.js +107 -0
- package/dist/lib/generated/core/queryKeySerializer.d.ts +18 -0
- package/dist/lib/generated/core/queryKeySerializer.js +93 -0
- package/dist/lib/generated/core/serverSentEvents.d.ts +71 -0
- package/dist/lib/generated/core/serverSentEvents.js +134 -0
- package/dist/lib/generated/core/types.d.ts +78 -0
- package/dist/lib/generated/core/types.js +3 -0
- package/dist/lib/generated/core/utils.d.ts +19 -0
- package/dist/lib/generated/core/utils.js +88 -0
- package/dist/lib/generated/schemas.d.ts +2908 -0
- package/dist/lib/generated/schemas.js +3911 -0
- package/dist/lib/generated/sdk.d.ts +1373 -0
- package/dist/lib/generated/sdk.js +2557 -0
- package/dist/lib/generated/source.json +19299 -0
- package/dist/lib/generated/types.d.ts +9663 -0
- package/dist/lib/generated/types.js +3 -0
- package/dist/lib/generated.d.ts +4 -0
- package/dist/lib/generated.js +5 -0
- package/dist/lib/index.d.ts +58 -0
- package/dist/lib/index.js +74 -0
- package/dist/lib/models/ApiKey.d.ts +14 -0
- package/dist/lib/models/ApiKey.js +17 -0
- package/dist/lib/models/Artist.d.ts +61 -0
- package/dist/lib/models/Artist.js +86 -0
- package/dist/lib/models/ArtistUrl.d.ts +14 -0
- package/dist/lib/models/ArtistUrl.js +17 -0
- package/dist/lib/models/ArtistVersion.d.ts +14 -0
- package/dist/lib/models/ArtistVersion.js +17 -0
- package/dist/lib/models/AvoidPosting.d.ts +63 -0
- package/dist/lib/models/AvoidPosting.js +97 -0
- package/dist/lib/models/AvoidPostingVersion.d.ts +14 -0
- package/dist/lib/models/AvoidPostingVersion.js +17 -0
- package/dist/lib/models/Ban.d.ts +14 -0
- package/dist/lib/models/Ban.js +17 -0
- package/dist/lib/models/Base.d.ts +11 -0
- package/dist/lib/models/Base.js +39 -0
- package/dist/lib/models/Blip.d.ts +79 -0
- package/dist/lib/models/Blip.js +120 -0
- package/dist/lib/models/BulkUpdateRequest.d.ts +49 -0
- package/dist/lib/models/BulkUpdateRequest.js +75 -0
- package/dist/lib/models/Comment.d.ts +100 -0
- package/dist/lib/models/Comment.js +157 -0
- package/dist/lib/models/CurrentUser.d.ts +14 -0
- package/dist/lib/models/CurrentUser.js +17 -0
- package/dist/lib/models/DMail.d.ts +46 -0
- package/dist/lib/models/DMail.js +73 -0
- package/dist/lib/models/EditHistory.d.ts +14 -0
- package/dist/lib/models/EditHistory.js +17 -0
- package/dist/lib/models/EmailBlacklist.d.ts +26 -0
- package/dist/lib/models/EmailBlacklist.js +37 -0
- package/dist/lib/models/ForumPost.d.ts +97 -0
- package/dist/lib/models/ForumPost.js +154 -0
- package/dist/lib/models/ForumPostVote.d.ts +24 -0
- package/dist/lib/models/ForumPostVote.js +35 -0
- package/dist/lib/models/ForumTopic.d.ts +81 -0
- package/dist/lib/models/ForumTopic.js +131 -0
- package/dist/lib/models/FullCurrentUser.d.ts +14 -0
- package/dist/lib/models/FullCurrentUser.js +17 -0
- package/dist/lib/models/FullUser.d.ts +14 -0
- package/dist/lib/models/FullUser.js +17 -0
- package/dist/lib/models/Help.d.ts +39 -0
- package/dist/lib/models/Help.js +57 -0
- package/dist/lib/models/IpBan.d.ts +28 -0
- package/dist/lib/models/IpBan.js +39 -0
- package/dist/lib/models/IqdbPost.d.ts +14 -0
- package/dist/lib/models/IqdbPost.js +17 -0
- package/dist/lib/models/Mascot.d.ts +39 -0
- package/dist/lib/models/Mascot.js +57 -0
- package/dist/lib/models/ModAction.d.ts +14 -0
- package/dist/lib/models/ModAction.js +17 -0
- package/dist/lib/models/NewsUpdate.d.ts +39 -0
- package/dist/lib/models/NewsUpdate.js +57 -0
- package/dist/lib/models/Note.d.ts +45 -0
- package/dist/lib/models/Note.js +71 -0
- package/dist/lib/models/NoteVersion.d.ts +24 -0
- package/dist/lib/models/NoteVersion.js +35 -0
- package/dist/lib/models/Pool.d.ts +67 -0
- package/dist/lib/models/Pool.js +109 -0
- package/dist/lib/models/PoolVersion.d.ts +24 -0
- package/dist/lib/models/PoolVersion.js +35 -0
- package/dist/lib/models/Post.d.ts +174 -0
- package/dist/lib/models/Post.js +287 -0
- package/dist/lib/models/PostApproval.d.ts +26 -0
- package/dist/lib/models/PostApproval.js +37 -0
- package/dist/lib/models/PostDisapproval.d.ts +14 -0
- package/dist/lib/models/PostDisapproval.js +17 -0
- package/dist/lib/models/PostEvent.d.ts +14 -0
- package/dist/lib/models/PostEvent.js +17 -0
- package/dist/lib/models/PostFlag.d.ts +38 -0
- package/dist/lib/models/PostFlag.js +57 -0
- package/dist/lib/models/PostReplacement.d.ts +75 -0
- package/dist/lib/models/PostReplacement.js +117 -0
- package/dist/lib/models/PostSet.d.ts +75 -0
- package/dist/lib/models/PostSet.js +117 -0
- package/dist/lib/models/PostVersion.d.ts +58 -0
- package/dist/lib/models/PostVersion.js +93 -0
- package/dist/lib/models/StaffNote.d.ts +53 -0
- package/dist/lib/models/StaffNote.js +79 -0
- package/dist/lib/models/Tag.d.ts +59 -0
- package/dist/lib/models/Tag.js +91 -0
- package/dist/lib/models/TagAlias.d.ts +51 -0
- package/dist/lib/models/TagAlias.js +77 -0
- package/dist/lib/models/TagCorrection.d.ts +15 -0
- package/dist/lib/models/TagCorrection.js +20 -0
- package/dist/lib/models/TagImplication.d.ts +51 -0
- package/dist/lib/models/TagImplication.js +77 -0
- package/dist/lib/models/TagPreview.d.ts +14 -0
- package/dist/lib/models/TagPreview.js +17 -0
- package/dist/lib/models/TagTypeVersion.d.ts +14 -0
- package/dist/lib/models/TagTypeVersion.js +17 -0
- package/dist/lib/models/Takedown.d.ts +87 -0
- package/dist/lib/models/Takedown.js +137 -0
- package/dist/lib/models/Ticket.d.ts +51 -0
- package/dist/lib/models/Ticket.js +77 -0
- package/dist/lib/models/Upload.d.ts +14 -0
- package/dist/lib/models/Upload.js +17 -0
- package/dist/lib/models/UploadWhitelist.d.ts +37 -0
- package/dist/lib/models/UploadWhitelist.js +55 -0
- package/dist/lib/models/User.d.ts +97 -0
- package/dist/lib/models/User.js +160 -0
- package/dist/lib/models/UserFeedback.d.ts +63 -0
- package/dist/lib/models/UserFeedback.js +97 -0
- package/dist/lib/models/UserNameChangeRequest.d.ts +26 -0
- package/dist/lib/models/UserNameChangeRequest.js +37 -0
- package/dist/lib/models/WikiPage.d.ts +49 -0
- package/dist/lib/models/WikiPage.js +75 -0
- package/dist/lib/models/WikiPageVersion.d.ts +24 -0
- package/dist/lib/models/WikiPageVersion.js +35 -0
- package/dist/lib/models/index.d.ts +53 -0
- package/dist/lib/models/index.js +54 -0
- package/dist/lib/modules/ArtistUrls.d.ts +18 -0
- package/dist/lib/modules/ArtistUrls.js +28 -0
- package/dist/lib/modules/ArtistVersions.d.ts +18 -0
- package/dist/lib/modules/ArtistVersions.js +28 -0
- package/dist/lib/modules/Artists.d.ts +90 -0
- package/dist/lib/modules/Artists.js +151 -0
- package/dist/lib/modules/AvoidPostingVersions.d.ts +18 -0
- package/dist/lib/modules/AvoidPostingVersions.js +28 -0
- package/dist/lib/modules/AvoidPostings.d.ts +112 -0
- package/dist/lib/modules/AvoidPostings.js +181 -0
- package/dist/lib/modules/Bans.d.ts +26 -0
- package/dist/lib/modules/Bans.js +47 -0
- package/dist/lib/modules/Base.d.ts +20 -0
- package/dist/lib/modules/Base.js +39 -0
- package/dist/lib/modules/Blips.d.ts +105 -0
- package/dist/lib/modules/Blips.js +188 -0
- package/dist/lib/modules/BulkUpdateRequests.d.ts +76 -0
- package/dist/lib/modules/BulkUpdateRequests.js +136 -0
- package/dist/lib/modules/CommentVotes.d.ts +30 -0
- package/dist/lib/modules/CommentVotes.js +56 -0
- package/dist/lib/modules/Comments.d.ts +112 -0
- package/dist/lib/modules/Comments.js +195 -0
- package/dist/lib/modules/DMails.d.ts +70 -0
- package/dist/lib/modules/DMails.js +134 -0
- package/dist/lib/modules/DText.d.ts +18 -0
- package/dist/lib/modules/DText.js +32 -0
- package/dist/lib/modules/EditHistories.d.ts +34 -0
- package/dist/lib/modules/EditHistories.js +56 -0
- package/dist/lib/modules/EmailBlacklists.d.ts +45 -0
- package/dist/lib/modules/EmailBlacklists.js +74 -0
- package/dist/lib/modules/Favorites.d.ts +38 -0
- package/dist/lib/modules/Favorites.js +73 -0
- package/dist/lib/modules/ForumPosts.d.ts +107 -0
- package/dist/lib/modules/ForumPosts.js +190 -0
- package/dist/lib/modules/ForumTopics.d.ts +125 -0
- package/dist/lib/modules/ForumTopics.js +237 -0
- package/dist/lib/modules/HelpPages.d.ts +67 -0
- package/dist/lib/modules/HelpPages.js +118 -0
- package/dist/lib/modules/IpBans.d.ts +47 -0
- package/dist/lib/modules/IpBans.js +76 -0
- package/dist/lib/modules/IqdbQueries.d.ts +36 -0
- package/dist/lib/modules/IqdbQueries.js +63 -0
- package/dist/lib/modules/Mascots.d.ts +60 -0
- package/dist/lib/modules/Mascots.js +98 -0
- package/dist/lib/modules/ModActions.d.ts +34 -0
- package/dist/lib/modules/ModActions.js +55 -0
- package/dist/lib/modules/NewsUpdates.d.ts +60 -0
- package/dist/lib/modules/NewsUpdates.js +98 -0
- package/dist/lib/modules/NoteVersions.d.ts +18 -0
- package/dist/lib/modules/NoteVersions.js +28 -0
- package/dist/lib/modules/Notes.d.ts +72 -0
- package/dist/lib/modules/Notes.js +133 -0
- package/dist/lib/modules/PoolVersions.d.ts +18 -0
- package/dist/lib/modules/PoolVersions.js +28 -0
- package/dist/lib/modules/Pools.d.ts +104 -0
- package/dist/lib/modules/Pools.js +197 -0
- package/dist/lib/modules/Popular.d.ts +18 -0
- package/dist/lib/modules/Popular.js +31 -0
- package/dist/lib/modules/PostApprovals.d.ts +42 -0
- package/dist/lib/modules/PostApprovals.js +77 -0
- package/dist/lib/modules/PostDisapprovals.d.ts +37 -0
- package/dist/lib/modules/PostDisapprovals.js +55 -0
- package/dist/lib/modules/PostEvents.d.ts +20 -0
- package/dist/lib/modules/PostEvents.js +30 -0
- package/dist/lib/modules/PostFlags.d.ts +53 -0
- package/dist/lib/modules/PostFlags.js +93 -0
- package/dist/lib/modules/PostReplacements.d.ts +94 -0
- package/dist/lib/modules/PostReplacements.js +167 -0
- package/dist/lib/modules/PostSets.d.ts +116 -0
- package/dist/lib/modules/PostSets.js +211 -0
- package/dist/lib/modules/PostVersions.d.ts +51 -0
- package/dist/lib/modules/PostVersions.js +94 -0
- package/dist/lib/modules/PostVotes.d.ts +28 -0
- package/dist/lib/modules/PostVotes.js +54 -0
- package/dist/lib/modules/Posts.d.ts +193 -0
- package/dist/lib/modules/Posts.js +395 -0
- package/dist/lib/modules/RelatedTags.d.ts +19 -0
- package/dist/lib/modules/RelatedTags.js +29 -0
- package/dist/lib/modules/StaffNotes.d.ts +80 -0
- package/dist/lib/modules/StaffNotes.js +140 -0
- package/dist/lib/modules/TagAliases.d.ts +80 -0
- package/dist/lib/modules/TagAliases.js +140 -0
- package/dist/lib/modules/TagCorrections.d.ts +25 -0
- package/dist/lib/modules/TagCorrections.js +52 -0
- package/dist/lib/modules/TagImplications.d.ts +80 -0
- package/dist/lib/modules/TagImplications.js +140 -0
- package/dist/lib/modules/TagTypeVersions.d.ts +18 -0
- package/dist/lib/modules/TagTypeVersions.js +28 -0
- package/dist/lib/modules/Tags.d.ts +64 -0
- package/dist/lib/modules/Tags.js +116 -0
- package/dist/lib/modules/Takedowns.d.ts +114 -0
- package/dist/lib/modules/Takedowns.js +211 -0
- package/dist/lib/modules/Tickets.d.ts +71 -0
- package/dist/lib/modules/Tickets.js +123 -0
- package/dist/lib/modules/UploadWhitelists.d.ts +68 -0
- package/dist/lib/modules/UploadWhitelists.js +117 -0
- package/dist/lib/modules/Uploads.d.ts +42 -0
- package/dist/lib/modules/Uploads.js +78 -0
- package/dist/lib/modules/UserFeedbacks.d.ts +94 -0
- package/dist/lib/modules/UserFeedbacks.js +165 -0
- package/dist/lib/modules/UserNameChangeRequests.d.ts +59 -0
- package/dist/lib/modules/UserNameChangeRequests.js +99 -0
- package/dist/lib/modules/Users.d.ts +132 -0
- package/dist/lib/modules/Users.js +263 -0
- package/dist/lib/modules/WikiPageVersions.d.ts +26 -0
- package/dist/lib/modules/WikiPageVersions.js +47 -0
- package/dist/lib/modules/WikiPages.d.ts +76 -0
- package/dist/lib/modules/WikiPages.js +137 -0
- package/dist/lib/modules/admin/Users.d.ts +45 -0
- package/dist/lib/modules/admin/Users.js +77 -0
- package/dist/lib/modules/comments/Votes.d.ts +26 -0
- package/dist/lib/modules/comments/Votes.js +51 -0
- package/dist/lib/modules/forum_posts/Votes.d.ts +26 -0
- package/dist/lib/modules/forum_posts/Votes.js +51 -0
- package/dist/lib/modules/index.d.ts +172 -0
- package/dist/lib/modules/index.js +114 -0
- package/dist/lib/modules/posts/Flag.d.ts +16 -0
- package/dist/lib/modules/posts/Flag.js +31 -0
- package/dist/lib/modules/posts/Votes.d.ts +26 -0
- package/dist/lib/modules/posts/Votes.js +51 -0
- package/dist/lib/modules/users/DMails.d.ts +29 -0
- package/dist/lib/modules/users/DMails.js +55 -0
- package/dist/lib/util.d.ts +48 -0
- package/dist/lib/util.js +49 -0
- package/dist/package.json +73 -0
- package/package.json +46 -20
- package/tsconfig.json +54 -0
- package/.mocharc.json +0 -6
- package/.ncurc.json +0 -3
- package/.node-version +0 -1
- package/Features/Artists.md +0 -39
- package/Features/Blips.md +0 -33
- package/Features/E621SearchInconsistencies.md +0 -54
- package/Features/FuturePlans.md +0 -50
- package/Features/Notes.md +0 -34
- package/Features/Pools.md +0 -38
- package/Features/PostFlags.md +0 -31
- package/Features/PostSets.md +0 -36
- package/Features/Posts.md +0 -46
- package/Features/README.md +0 -15
- package/Features/Tags.md +0 -34
- package/Features/Takedowns.md +0 -32
- package/Features/UserFeedback.md +0 -32
- package/Features/Users.md +0 -36
- package/Features/WikiPages.md +0 -36
- package/build/package.json +0 -45
- package/build/src/index.d.ts +0 -68
- package/build/src/index.js +0 -194
- package/build/src/modules/Artists.d.ts +0 -128
- package/build/src/modules/Artists.js +0 -295
- package/build/src/modules/Blips.d.ts +0 -79
- package/build/src/modules/Blips.js +0 -157
- package/build/src/modules/Notes.d.ts +0 -88
- package/build/src/modules/Notes.js +0 -189
- package/build/src/modules/Pools.d.ts +0 -130
- package/build/src/modules/Pools.js +0 -261
- package/build/src/modules/PostFlags.d.ts +0 -55
- package/build/src/modules/PostFlags.js +0 -126
- package/build/src/modules/PostSets.d.ts +0 -102
- package/build/src/modules/PostSets.js +0 -208
- package/build/src/modules/Posts.d.ts +0 -154
- package/build/src/modules/Posts.js +0 -390
- package/build/src/modules/Tags.d.ts +0 -78
- package/build/src/modules/Tags.js +0 -174
- package/build/src/modules/Takedowns.d.ts +0 -81
- package/build/src/modules/Takedowns.js +0 -195
- package/build/src/modules/UserFeedback.d.ts +0 -66
- package/build/src/modules/UserFeedback.js +0 -136
- package/build/src/modules/Users.d.ts +0 -117
- package/build/src/modules/Users.js +0 -261
- package/build/src/modules/WikiPages.d.ts +0 -107
- package/build/src/modules/WikiPages.js +0 -220
- package/build/src/structures/Artist.d.ts +0 -36
- package/build/src/structures/Artist.js +0 -51
- package/build/src/structures/ArtistHistory.d.ts +0 -39
- package/build/src/structures/ArtistHistory.js +0 -50
- package/build/src/structures/AuthenticatedUser.d.ts +0 -109
- package/build/src/structures/AuthenticatedUser.js +0 -128
- package/build/src/structures/Blip.d.ts +0 -66
- package/build/src/structures/Blip.js +0 -85
- package/build/src/structures/Note.d.ts +0 -32
- package/build/src/structures/Note.js +0 -41
- package/build/src/structures/NoteHistory.d.ts +0 -38
- package/build/src/structures/NoteHistory.js +0 -47
- package/build/src/structures/Pool.d.ts +0 -85
- package/build/src/structures/Pool.js +0 -112
- package/build/src/structures/PoolHistory.d.ts +0 -43
- package/build/src/structures/PoolHistory.js +0 -54
- package/build/src/structures/Post.d.ts +0 -157
- package/build/src/structures/Post.js +0 -170
- package/build/src/structures/PostApproval.d.ts +0 -25
- package/build/src/structures/PostApproval.js +0 -33
- package/build/src/structures/PostFlag.d.ts +0 -38
- package/build/src/structures/PostFlag.js +0 -47
- package/build/src/structures/PostHistory.d.ts +0 -52
- package/build/src/structures/PostHistory.js +0 -93
- package/build/src/structures/PostSet.d.ts +0 -71
- package/build/src/structures/PostSet.js +0 -93
- package/build/src/structures/Tag.d.ts +0 -61
- package/build/src/structures/Tag.js +0 -87
- package/build/src/structures/TagHistory.d.ts +0 -28
- package/build/src/structures/TagHistory.js +0 -36
- package/build/src/structures/Takedown.d.ts +0 -49
- package/build/src/structures/Takedown.js +0 -64
- package/build/src/structures/User.d.ts +0 -62
- package/build/src/structures/User.js +0 -80
- package/build/src/structures/WikiPage.d.ts +0 -17
- package/build/src/structures/WikiPage.js +0 -27
- package/build/src/structures/WikiPageHistory.d.ts +0 -38
- package/build/src/structures/WikiPageHistory.js +0 -49
- package/build/src/types/artists.d.ts +0 -82
- package/build/src/types/blips.d.ts +0 -37
- package/build/src/types/index.d.ts +0 -96
- package/build/src/types/notes.d.ts +0 -64
- package/build/src/types/pools.d.ts +0 -62
- package/build/src/types/post_flags.d.ts +0 -36
- package/build/src/types/post_sets.d.ts +0 -33
- package/build/src/types/posts.d.ts +0 -181
- package/build/src/types/tags.d.ts +0 -56
- package/build/src/types/takedowns.d.ts +0 -62
- package/build/src/types/user_feedback.d.ts +0 -27
- package/build/src/types/users.d.ts +0 -277
- package/build/src/types/wiki_pages.d.ts +0 -66
- package/build/src/util/Debug.d.ts +0 -1
- package/build/src/util/Debug.js +0 -16
- package/build/src/util/FormHelper.d.ts +0 -9
- package/build/src/util/FormHelper.js +0 -15
- package/build/src/util/MultipartData.d.ts +0 -7
- package/build/src/util/MultipartData.js +0 -39
- package/build/src/util/RequestHandler.d.ts +0 -38
- package/build/src/util/RequestHandler.js +0 -343
- package/build/src/util/Timer.d.ts +0 -6
- package/build/src/util/Timer.js +0 -71
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import type E621 from "..";
|
|
2
|
-
import type { SearchBlipsOptions, CreateBlipOptions, ModifyBlipOptions, BlipWarningType } from "../types";
|
|
3
|
-
import Blip from "../structures/Blip";
|
|
4
|
-
export default class Blips {
|
|
5
|
-
private readonly auth;
|
|
6
|
-
private readonly main;
|
|
7
|
-
constructor(main: E621);
|
|
8
|
-
/**
|
|
9
|
-
* Get a blip by its id
|
|
10
|
-
*
|
|
11
|
-
* @param {number} id - The id of the blip to get
|
|
12
|
-
* @returns {Promise<(Blip | null)>}
|
|
13
|
-
*/
|
|
14
|
-
get(id: number): Promise<Blip | null>;
|
|
15
|
-
/**
|
|
16
|
-
* Search for blips
|
|
17
|
-
*
|
|
18
|
-
* @param {object} [options]
|
|
19
|
-
* @param {string} [options.creator] - narrow the results by creator name
|
|
20
|
-
* @param {number} [options.creator_id] - narrow the results by creator id
|
|
21
|
-
* @param {string} [options.body] - narrow the results by body content
|
|
22
|
-
* @param {number} [options.response_to] - narrow the results by parent id
|
|
23
|
-
* @param {string} [options.ip_address] - narrow the results by ip address (requires moderator)
|
|
24
|
-
* @param {SearchBlipsOrder} [options.order] - the order of the results
|
|
25
|
-
* @param {(number |`${"" | "a" | "b"}${number}`)} [options.page] - page of results to get
|
|
26
|
-
* @param {number} [options.limit] - limit the maximum amount of results returned
|
|
27
|
-
* @returns {Promise<Array<Blip>>}
|
|
28
|
-
*/
|
|
29
|
-
search(options?: SearchBlipsOptions): Promise<Blip[]>;
|
|
30
|
-
/**
|
|
31
|
-
* Create a blip
|
|
32
|
-
*
|
|
33
|
-
* * Requires Authentication
|
|
34
|
-
*
|
|
35
|
-
* @param {object} options
|
|
36
|
-
* @param {string} options.body - the body content of the blip
|
|
37
|
-
* @param {number} [options.response_to] - the blip to respond to
|
|
38
|
-
* @returns {Promise<Blip>}
|
|
39
|
-
*/
|
|
40
|
-
create(options: CreateBlipOptions): Promise<Blip>;
|
|
41
|
-
/**
|
|
42
|
-
* modify a blip
|
|
43
|
-
*
|
|
44
|
-
* * Requires Authentication
|
|
45
|
-
*
|
|
46
|
-
* * Requires Moderator if not created by self
|
|
47
|
-
*
|
|
48
|
-
* * blips older than 5 minutes cannot be edited (does not apply if moderator)
|
|
49
|
-
*
|
|
50
|
-
* @param {number} id - the id of the blip to edit
|
|
51
|
-
* @param {object} options
|
|
52
|
-
* @param {string} options.body - the body content of the blip
|
|
53
|
-
* @returns {Promise<Blip>}
|
|
54
|
-
*/
|
|
55
|
-
modify(id: number, options: ModifyBlipOptions): Promise<Blip>;
|
|
56
|
-
/**
|
|
57
|
-
* Delete a blip
|
|
58
|
-
*
|
|
59
|
-
* * Requires Authentication
|
|
60
|
-
*
|
|
61
|
-
* * Requires Moderator
|
|
62
|
-
*
|
|
63
|
-
* @param {number} post_id - the id of blip to delete
|
|
64
|
-
* @returns {Promise<null>}
|
|
65
|
-
*/
|
|
66
|
-
delete(id: number): Promise<null>;
|
|
67
|
-
/**
|
|
68
|
-
* Add a warning to a blip
|
|
69
|
-
*
|
|
70
|
-
* * Requires Authentication
|
|
71
|
-
*
|
|
72
|
-
* * Requires Moderator
|
|
73
|
-
*
|
|
74
|
-
* @param {number} id - the id of the blip to add the warning to
|
|
75
|
-
* @param {BlipWarningType} type - the type of warning to
|
|
76
|
-
* @returns {Promise<Blip>}
|
|
77
|
-
*/
|
|
78
|
-
addWarning(id: number, type: BlipWarningType): Promise<Blip>;
|
|
79
|
-
}
|
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const FormHelper_1 = __importDefault(require("../util/FormHelper"));
|
|
7
|
-
const RequestHandler_1 = require("../util/RequestHandler");
|
|
8
|
-
const Blip_1 = __importDefault(require("../structures/Blip"));
|
|
9
|
-
class Blips {
|
|
10
|
-
auth;
|
|
11
|
-
main;
|
|
12
|
-
constructor(main) {
|
|
13
|
-
Object.defineProperties(this, {
|
|
14
|
-
auth: {
|
|
15
|
-
get() {
|
|
16
|
-
return !this.main.options.authUser || !this.main.options.authKey ? null : `Basic ${Buffer.from(`${this.main.options.authUser}:${this.main.options.authKey}`).toString("base64")}`;
|
|
17
|
-
},
|
|
18
|
-
configurable: false,
|
|
19
|
-
enumerable: false
|
|
20
|
-
},
|
|
21
|
-
main: {
|
|
22
|
-
value: main,
|
|
23
|
-
configurable: false,
|
|
24
|
-
enumerable: false,
|
|
25
|
-
writable: false
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Get a blip by its id
|
|
31
|
-
*
|
|
32
|
-
* @param {number} id - The id of the blip to get
|
|
33
|
-
* @returns {Promise<(Blip | null)>}
|
|
34
|
-
*/
|
|
35
|
-
async get(id) {
|
|
36
|
-
const res = await this.main.request.get(`/blips/${id}.json`).catch(err => {
|
|
37
|
-
if (err instanceof RequestHandler_1.APIError && err.statusCode === 404)
|
|
38
|
-
return null;
|
|
39
|
-
throw err;
|
|
40
|
-
});
|
|
41
|
-
return res === null ? null : new Blip_1.default(this.main, res);
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Search for blips
|
|
45
|
-
*
|
|
46
|
-
* @param {object} [options]
|
|
47
|
-
* @param {string} [options.creator] - narrow the results by creator name
|
|
48
|
-
* @param {number} [options.creator_id] - narrow the results by creator id
|
|
49
|
-
* @param {string} [options.body] - narrow the results by body content
|
|
50
|
-
* @param {number} [options.response_to] - narrow the results by parent id
|
|
51
|
-
* @param {string} [options.ip_address] - narrow the results by ip address (requires moderator)
|
|
52
|
-
* @param {SearchBlipsOrder} [options.order] - the order of the results
|
|
53
|
-
* @param {(number |`${"" | "a" | "b"}${number}`)} [options.page] - page of results to get
|
|
54
|
-
* @param {number} [options.limit] - limit the maximum amount of results returned
|
|
55
|
-
* @returns {Promise<Array<Blip>>}
|
|
56
|
-
*/
|
|
57
|
-
async search(options) {
|
|
58
|
-
options = options ?? {};
|
|
59
|
-
const qs = new FormHelper_1.default();
|
|
60
|
-
if (typeof options.creator === "string")
|
|
61
|
-
qs.add("search[creator_name]", options.creator);
|
|
62
|
-
if (typeof options.creator_id === "string")
|
|
63
|
-
qs.add("search[creator_id]", options.creator_id);
|
|
64
|
-
if (typeof options.body === "boolean")
|
|
65
|
-
qs.add("search[body_matches]", options.body);
|
|
66
|
-
if (typeof options.response_to === "number")
|
|
67
|
-
qs.add("search[response_to]", options.response_to);
|
|
68
|
-
if (typeof options.ip_address === "string")
|
|
69
|
-
qs.add("search[ip_addr]", options.ip_address);
|
|
70
|
-
if (typeof options.order === "string")
|
|
71
|
-
qs.add("search[order]", options.order);
|
|
72
|
-
if (typeof options.page !== "undefined")
|
|
73
|
-
qs.add("page", options.page);
|
|
74
|
-
if (typeof options.limit === "number")
|
|
75
|
-
qs.add("limit", options.limit);
|
|
76
|
-
const res = await this.main.request.get(`/blips.json?${qs.build()}`);
|
|
77
|
-
return res.map(info => new Blip_1.default(this.main, info));
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Create a blip
|
|
81
|
-
*
|
|
82
|
-
* * Requires Authentication
|
|
83
|
-
*
|
|
84
|
-
* @param {object} options
|
|
85
|
-
* @param {string} options.body - the body content of the blip
|
|
86
|
-
* @param {number} [options.response_to] - the blip to respond to
|
|
87
|
-
* @returns {Promise<Blip>}
|
|
88
|
-
*/
|
|
89
|
-
async create(options) {
|
|
90
|
-
this.main.request.authCheck.call(this, "PostFlag#create");
|
|
91
|
-
if (!options)
|
|
92
|
-
throw new Error("options is required in Blips#create");
|
|
93
|
-
const qs = new FormHelper_1.default()
|
|
94
|
-
.add("blip[body]", options.body);
|
|
95
|
-
if (typeof options.response_to === "number")
|
|
96
|
-
qs.add("blip[response_to]", options.response_to);
|
|
97
|
-
const res = await this.main.request.post("/blips.json", qs.build());
|
|
98
|
-
return new Blip_1.default(this.main, res);
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* modify a blip
|
|
102
|
-
*
|
|
103
|
-
* * Requires Authentication
|
|
104
|
-
*
|
|
105
|
-
* * Requires Moderator if not created by self
|
|
106
|
-
*
|
|
107
|
-
* * blips older than 5 minutes cannot be edited (does not apply if moderator)
|
|
108
|
-
*
|
|
109
|
-
* @param {number} id - the id of the blip to edit
|
|
110
|
-
* @param {object} options
|
|
111
|
-
* @param {string} options.body - the body content of the blip
|
|
112
|
-
* @returns {Promise<Blip>}
|
|
113
|
-
*/
|
|
114
|
-
async modify(id, options) {
|
|
115
|
-
this.main.request.authCheck.call(this, "Blips#modify");
|
|
116
|
-
if (!options)
|
|
117
|
-
throw new Error("options is required in Blips#modify");
|
|
118
|
-
const qs = new FormHelper_1.default()
|
|
119
|
-
.add("blip[body]", options.body);
|
|
120
|
-
const res = await this.main.request.patch(`/blips/${id}.json`, qs.build());
|
|
121
|
-
return new Blip_1.default(this.main, res);
|
|
122
|
-
}
|
|
123
|
-
/**
|
|
124
|
-
* Delete a blip
|
|
125
|
-
*
|
|
126
|
-
* * Requires Authentication
|
|
127
|
-
*
|
|
128
|
-
* * Requires Moderator
|
|
129
|
-
*
|
|
130
|
-
* @param {number} post_id - the id of blip to delete
|
|
131
|
-
* @returns {Promise<null>}
|
|
132
|
-
*/
|
|
133
|
-
async delete(id) {
|
|
134
|
-
this.main.request.authCheck.call(this, "Blips#delete");
|
|
135
|
-
return this.main.request.delete(`/blips/${id}.json`);
|
|
136
|
-
}
|
|
137
|
-
/**
|
|
138
|
-
* Add a warning to a blip
|
|
139
|
-
*
|
|
140
|
-
* * Requires Authentication
|
|
141
|
-
*
|
|
142
|
-
* * Requires Moderator
|
|
143
|
-
*
|
|
144
|
-
* @param {number} id - the id of the blip to add the warning to
|
|
145
|
-
* @param {BlipWarningType} type - the type of warning to
|
|
146
|
-
* @returns {Promise<Blip>}
|
|
147
|
-
*/
|
|
148
|
-
async addWarning(id, type) {
|
|
149
|
-
this.main.request.authCheck.call(this, "Blips#addWarning");
|
|
150
|
-
const qs = new FormHelper_1.default()
|
|
151
|
-
.add("blip[record_type]", type);
|
|
152
|
-
const res = await this.main.request.post(`/blips/${id}/warning.json`, qs.build());
|
|
153
|
-
return new Blip_1.default(this.main, res);
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
exports.default = Blips;
|
|
157
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiQmxpcHMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvbW9kdWxlcy9CbGlwcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7OztBQVNBLG9FQUE0QztBQUM1QywyREFBa0Q7QUFDbEQsOERBQXNDO0FBRXRDLE1BQXFCLEtBQUs7SUFDUixJQUFJLENBQWdCO0lBQ3BCLElBQUksQ0FBTztJQUM1QixZQUFZLElBQVU7UUFDckIsTUFBTSxDQUFDLGdCQUFnQixDQUFDLElBQUksR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7OztPQVNHO0lBQ0gsS0FBSyxDQUFDLE1BQU0sQ0FBQyxFQUFVO1FBQ3RCLElBQUksQ0FBQyxJQUFJLENBQUMsT0FBTyxDQUFDLFNBQVMsQ0FBQyxJQUFJLENBQUMsSUFBSSxFQUFFLGNBQWMsQ0FBQyxDQUFDO1FBQ3ZELE9BQU8sSUFBSSxDQUFDLElBQUksQ0FBQyxPQUFPLENBQUMsTUFBTSxDQUFPLFVBQVUsRUFBRSxPQUFPLENBQUMsQ0FBQztJQUM1RCxDQUFDO0lBRUQ7Ozs7Ozs7Ozs7T0FVRztJQUNILEtBQUssQ0FBQyxVQUFVLENBQUMsRUFBVSxFQUFFLElBQXFCO1FBQ2pELElBQUksQ0FBQyxJQUFJLENBQUMsT0FBTyxDQUFDLFNBQVMsQ0FBQyxJQUFJLENBQUMsSUFBSSxFQUFFLGtCQUFrQixDQUFDLENBQUM7UUFDM0QsTUFBTSxFQUFFLEdBQUcsSUFBSSxvQkFBVSxFQUFFO2FBQ3pCLEdBQUcsQ0FBQyxtQkFBbUIsRUFBRSxJQUFJLENBQUMsQ0FBQztRQUNqQyxNQUFNLEdBQUcsR0FBRyxNQUFNLElBQUksQ0FBQyxJQUFJLENBQUMsT0FBTyxDQUFDLElBQUksQ0FBaUIsVUFBVSxFQUFFLGVBQWUsRUFBRSxFQUFFLENBQUMsS0FBSyxFQUFFLENBQUMsQ0FBQztRQUNsRyxPQUFPLElBQUksY0FBSSxDQUFDLElBQUksQ0FBQyxJQUFJLEVBQUUsR0FBSSxDQUFDLENBQUM7SUFDbEMsQ0FBQztDQUNEO0FBNUlELHdCQTRJQyJ9
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import type E621 from "..";
|
|
2
|
-
import type { SearchNotesOptions, CreateNoteOptions, ModifyNoteOptions, SearchNoteHistoryOptions } from "../types";
|
|
3
|
-
import Note from "../structures/Note";
|
|
4
|
-
import NoteHistory from "../structures/NoteHistory";
|
|
5
|
-
export default class Notes {
|
|
6
|
-
private readonly auth;
|
|
7
|
-
private readonly main;
|
|
8
|
-
constructor(main: E621);
|
|
9
|
-
/**
|
|
10
|
-
* Get a note by its id
|
|
11
|
-
*
|
|
12
|
-
* @param {number} id - The id of the note to get
|
|
13
|
-
* @returns {Promise<(Note | null)>}
|
|
14
|
-
*/
|
|
15
|
-
get(id: number): Promise<Note | null>;
|
|
16
|
-
/**
|
|
17
|
-
* Search for notes
|
|
18
|
-
*
|
|
19
|
-
* @param {object} [options]
|
|
20
|
-
* @param {string} [options.body] - narrow the results by the body of the note
|
|
21
|
-
* @param {string} [options.author] - narrow the results by the (name of the) creator of the note
|
|
22
|
-
* @param {(string | Array<string>)} [options.tags] - narrow the results by the tags of the post the note is on
|
|
23
|
-
* @param {(number |`${"" | "a" | "b"}${number}`)} [options.page] - page of results to get
|
|
24
|
-
* @param {number} [options.limit] - limit the maximum amount of results returned
|
|
25
|
-
* @returns {Promise<Array<Note>>}
|
|
26
|
-
*/
|
|
27
|
-
search(options?: SearchNotesOptions): Promise<Note[]>;
|
|
28
|
-
/**
|
|
29
|
-
* Create a note
|
|
30
|
-
*
|
|
31
|
-
* * Requires Authentication
|
|
32
|
-
*
|
|
33
|
-
* @param {object} options
|
|
34
|
-
* @param {number} options.post_id - the id of the post to make the note on
|
|
35
|
-
* @param {number} options.x - the x location of the note
|
|
36
|
-
* @param {number} options.y - the y location of the note
|
|
37
|
-
* @param {number} options.width - the width of the note
|
|
38
|
-
* @param {number} options.height - the height of the note
|
|
39
|
-
* @param {string} options.body - the body of the note
|
|
40
|
-
* @returns {Promise<Note>}
|
|
41
|
-
*/
|
|
42
|
-
create(options: CreateNoteOptions): Promise<never[] | Note>;
|
|
43
|
-
/**
|
|
44
|
-
* modify a note
|
|
45
|
-
*
|
|
46
|
-
* * Requires Authentication
|
|
47
|
-
*
|
|
48
|
-
* @param {number} id - the id of the note to edit
|
|
49
|
-
* @param {object} options
|
|
50
|
-
* @param {number} [options.x] - the x location of the note
|
|
51
|
-
* @param {number} [options.y] - the y location of the note
|
|
52
|
-
* @param {number} [options.width] - the width of the note
|
|
53
|
-
* @param {number} [options.height] - the height of the note
|
|
54
|
-
* @param {string} [options.body] - the body of the note
|
|
55
|
-
* @returns {Promise<Note>}
|
|
56
|
-
*/
|
|
57
|
-
modify(id: number, options: ModifyNoteOptions): Promise<Note>;
|
|
58
|
-
/**
|
|
59
|
-
* Delete a note
|
|
60
|
-
*
|
|
61
|
-
* * Requires Authentication
|
|
62
|
-
*
|
|
63
|
-
* @param {number} id - the id of the note to delete
|
|
64
|
-
* @returns {Promise<null>}
|
|
65
|
-
*/
|
|
66
|
-
delete(id: number): Promise<null>;
|
|
67
|
-
/**
|
|
68
|
-
* Get a specific notes history
|
|
69
|
-
*
|
|
70
|
-
* @param {number} id - the id of the history to get
|
|
71
|
-
* @returns {Promise<NoteHistory | null>}
|
|
72
|
-
*/
|
|
73
|
-
getHistory(id: number): Promise<NoteHistory | null>;
|
|
74
|
-
/**
|
|
75
|
-
* Search the notes history
|
|
76
|
-
*
|
|
77
|
-
* @param {object} [options]
|
|
78
|
-
* @param {number} [options.id] - get a specific notes history entry
|
|
79
|
-
* @param {number} [options.note_id] - narrow the results by the note id
|
|
80
|
-
* @param {number} [options.post_id] - narrow the results by the id of the post the note is on
|
|
81
|
-
* @param {string} [options.body] - narrow the results by the content
|
|
82
|
-
* @param {(number |`${"" | "a" | "b"}${number}`)} [options.page] - page of results to get
|
|
83
|
-
* @param {number} [options.limit] - limit the maximum amount of results returned
|
|
84
|
-
* @param
|
|
85
|
-
* @returns {Promise<Array<NoteHistory>>}
|
|
86
|
-
*/
|
|
87
|
-
searchHistory(options?: SearchNoteHistoryOptions): Promise<NoteHistory[]>;
|
|
88
|
-
}
|
|
@@ -1,189 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const FormHelper_1 = __importDefault(require("../util/FormHelper"));
|
|
7
|
-
const RequestHandler_1 = require("../util/RequestHandler");
|
|
8
|
-
const Note_1 = __importDefault(require("../structures/Note"));
|
|
9
|
-
const NoteHistory_1 = __importDefault(require("../structures/NoteHistory"));
|
|
10
|
-
class Notes {
|
|
11
|
-
auth;
|
|
12
|
-
main;
|
|
13
|
-
constructor(main) {
|
|
14
|
-
Object.defineProperties(this, {
|
|
15
|
-
auth: {
|
|
16
|
-
get() {
|
|
17
|
-
return !this.main.options.authUser || !this.main.options.authKey ? null : `Basic ${Buffer.from(`${this.main.options.authUser}:${this.main.options.authKey}`).toString("base64")}`;
|
|
18
|
-
},
|
|
19
|
-
configurable: false,
|
|
20
|
-
enumerable: false
|
|
21
|
-
},
|
|
22
|
-
main: {
|
|
23
|
-
value: main,
|
|
24
|
-
configurable: false,
|
|
25
|
-
enumerable: false,
|
|
26
|
-
writable: false
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Get a note by its id
|
|
32
|
-
*
|
|
33
|
-
* @param {number} id - The id of the note to get
|
|
34
|
-
* @returns {Promise<(Note | null)>}
|
|
35
|
-
*/
|
|
36
|
-
async get(id) {
|
|
37
|
-
const res = await this.main.request.get(`/notes/${id}.json`).catch(err => {
|
|
38
|
-
if (err instanceof RequestHandler_1.APIError && err.statusCode === 404)
|
|
39
|
-
return null;
|
|
40
|
-
throw err;
|
|
41
|
-
});
|
|
42
|
-
return res === null ? null : new Note_1.default(this.main, res);
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Search for notes
|
|
46
|
-
*
|
|
47
|
-
* @param {object} [options]
|
|
48
|
-
* @param {string} [options.body] - narrow the results by the body of the note
|
|
49
|
-
* @param {string} [options.author] - narrow the results by the (name of the) creator of the note
|
|
50
|
-
* @param {(string | Array<string>)} [options.tags] - narrow the results by the tags of the post the note is on
|
|
51
|
-
* @param {(number |`${"" | "a" | "b"}${number}`)} [options.page] - page of results to get
|
|
52
|
-
* @param {number} [options.limit] - limit the maximum amount of results returned
|
|
53
|
-
* @returns {Promise<Array<Note>>}
|
|
54
|
-
*/
|
|
55
|
-
async search(options) {
|
|
56
|
-
options = options ?? {};
|
|
57
|
-
const qs = new FormHelper_1.default();
|
|
58
|
-
if (typeof options.body === "string")
|
|
59
|
-
qs.add("search[body_matches]", options.body);
|
|
60
|
-
if (typeof options.author === "string")
|
|
61
|
-
qs.add("search[creator_name]", options.author);
|
|
62
|
-
if (typeof options.tags === "string")
|
|
63
|
-
qs.add("search[post_tags_match]", options.tags);
|
|
64
|
-
if (Array.isArray(options.tags) && options.tags.length > 0)
|
|
65
|
-
qs.add("search[post_tags_match]", options.tags.join(" "));
|
|
66
|
-
if (typeof options.page !== "undefined")
|
|
67
|
-
qs.add("page", options.page);
|
|
68
|
-
if (typeof options.limit === "number")
|
|
69
|
-
qs.add("limit", options.limit);
|
|
70
|
-
const res = await this.main.request.get(`/notes.json?${qs.build()}`);
|
|
71
|
-
return res.map(info => new Note_1.default(this.main, info));
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* Create a note
|
|
75
|
-
*
|
|
76
|
-
* * Requires Authentication
|
|
77
|
-
*
|
|
78
|
-
* @param {object} options
|
|
79
|
-
* @param {number} options.post_id - the id of the post to make the note on
|
|
80
|
-
* @param {number} options.x - the x location of the note
|
|
81
|
-
* @param {number} options.y - the y location of the note
|
|
82
|
-
* @param {number} options.width - the width of the note
|
|
83
|
-
* @param {number} options.height - the height of the note
|
|
84
|
-
* @param {string} options.body - the body of the note
|
|
85
|
-
* @returns {Promise<Note>}
|
|
86
|
-
*/
|
|
87
|
-
async create(options) {
|
|
88
|
-
this.main.request.authCheck.call(this, "Notes#create");
|
|
89
|
-
if (!options)
|
|
90
|
-
throw new Error("options is required in Notes#create");
|
|
91
|
-
const qs = new FormHelper_1.default()
|
|
92
|
-
.add("note[post_id]", options.post_id)
|
|
93
|
-
.add("note[x]", options.x)
|
|
94
|
-
.add("note[y]", options.y)
|
|
95
|
-
.add("note[width]", options.width)
|
|
96
|
-
.add("note[height]", options.height)
|
|
97
|
-
.add("note[body]", options.body);
|
|
98
|
-
const res = await this.main.request.post("/notes.json", qs.build());
|
|
99
|
-
if (res && !Array.isArray(res) && "notes" in res)
|
|
100
|
-
return [];
|
|
101
|
-
return new Note_1.default(this.main, res);
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* modify a note
|
|
105
|
-
*
|
|
106
|
-
* * Requires Authentication
|
|
107
|
-
*
|
|
108
|
-
* @param {number} id - the id of the note to edit
|
|
109
|
-
* @param {object} options
|
|
110
|
-
* @param {number} [options.x] - the x location of the note
|
|
111
|
-
* @param {number} [options.y] - the y location of the note
|
|
112
|
-
* @param {number} [options.width] - the width of the note
|
|
113
|
-
* @param {number} [options.height] - the height of the note
|
|
114
|
-
* @param {string} [options.body] - the body of the note
|
|
115
|
-
* @returns {Promise<Note>}
|
|
116
|
-
*/
|
|
117
|
-
async modify(id, options) {
|
|
118
|
-
this.main.request.authCheck.call(this, "Notes#modify");
|
|
119
|
-
if (!options)
|
|
120
|
-
throw new Error("options is required in Notes#modify");
|
|
121
|
-
const qs = new FormHelper_1.default();
|
|
122
|
-
if (typeof options.x === "number")
|
|
123
|
-
qs.add("note[x]", options.x);
|
|
124
|
-
if (typeof options.y === "number")
|
|
125
|
-
qs.add("note[y]", options.y);
|
|
126
|
-
if (typeof options.width === "number")
|
|
127
|
-
qs.add("note[width]", options.width);
|
|
128
|
-
if (typeof options.height === "number")
|
|
129
|
-
qs.add("note[height]", options.height);
|
|
130
|
-
if (typeof options.body === "string")
|
|
131
|
-
qs.add("note[body]", options.body);
|
|
132
|
-
const res = await this.main.request.put(`/notes/${id}.json`, qs.build());
|
|
133
|
-
return new Note_1.default(this.main, res);
|
|
134
|
-
}
|
|
135
|
-
/**
|
|
136
|
-
* Delete a note
|
|
137
|
-
*
|
|
138
|
-
* * Requires Authentication
|
|
139
|
-
*
|
|
140
|
-
* @param {number} id - the id of the note to delete
|
|
141
|
-
* @returns {Promise<null>}
|
|
142
|
-
*/
|
|
143
|
-
async delete(id) {
|
|
144
|
-
this.main.request.authCheck.call(this, "Notes#delete");
|
|
145
|
-
return this.main.request.delete(`/notes/${id}.json`);
|
|
146
|
-
}
|
|
147
|
-
/**
|
|
148
|
-
* Get a specific notes history
|
|
149
|
-
*
|
|
150
|
-
* @param {number} id - the id of the history to get
|
|
151
|
-
* @returns {Promise<NoteHistory | null>}
|
|
152
|
-
*/
|
|
153
|
-
async getHistory(id) { return this.searchHistory({ id }).then(r => r.length === 0 ? null : r[0]); }
|
|
154
|
-
/**
|
|
155
|
-
* Search the notes history
|
|
156
|
-
*
|
|
157
|
-
* @param {object} [options]
|
|
158
|
-
* @param {number} [options.id] - get a specific notes history entry
|
|
159
|
-
* @param {number} [options.note_id] - narrow the results by the note id
|
|
160
|
-
* @param {number} [options.post_id] - narrow the results by the id of the post the note is on
|
|
161
|
-
* @param {string} [options.body] - narrow the results by the content
|
|
162
|
-
* @param {(number |`${"" | "a" | "b"}${number}`)} [options.page] - page of results to get
|
|
163
|
-
* @param {number} [options.limit] - limit the maximum amount of results returned
|
|
164
|
-
* @param
|
|
165
|
-
* @returns {Promise<Array<NoteHistory>>}
|
|
166
|
-
*/
|
|
167
|
-
async searchHistory(options) {
|
|
168
|
-
options = options ?? {};
|
|
169
|
-
const qs = new FormHelper_1.default();
|
|
170
|
-
if (typeof options.id === "number")
|
|
171
|
-
qs.add("search[id]", options.id);
|
|
172
|
-
if (typeof options.note_id === "number")
|
|
173
|
-
qs.add("search[note_id]", options.note_id);
|
|
174
|
-
if (typeof options.post_id === "number")
|
|
175
|
-
qs.add("search[post_id]", options.post_id);
|
|
176
|
-
if (typeof options.body === "string")
|
|
177
|
-
qs.add("search[body_matches]", options.body);
|
|
178
|
-
if (typeof options.page !== "undefined")
|
|
179
|
-
qs.add("page", options.page);
|
|
180
|
-
if (typeof options.limit === "number")
|
|
181
|
-
qs.add("limit", options.limit);
|
|
182
|
-
const res = await this.main.request.get(`/note_versions.json?${qs.build()}`);
|
|
183
|
-
if (res && !Array.isArray(res) && "note_versions" in res)
|
|
184
|
-
return [];
|
|
185
|
-
return res.map(info => new NoteHistory_1.default(this.main, info));
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
exports.default = Notes;
|
|
189
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiTm90ZXMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvbW9kdWxlcy9Ob3Rlcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7OztBQVNBLG9FQUE0QztBQUM1QywyREFBa0Q7QUFDbEQsOERBQXNDO0FBQ3RDLDRFQUFvRDtBQUVwRCxNQUFxQixLQUFLO0lBQ1IsSUFBSSxDQUFnQjtJQUNwQixJQUFJLENBQU87SUFDNUIsWUFBWSxJQUFVO1FBQ3JCLE1BQU0sQ0FBQyxnQkFBZ0IsQ0FBQyxJQUFJLEVBQUU7WUFDN0IsSUFBSSxFQUFFO2dCQUNMLEdBQUc7b0JBQ0YsT0FBTyxDQUFDLElBQUksQ0FBQyxJQUFJLENBQUMsT0FBTyxDQUFDLFFBQVEsSUFBSSxDQUFDLElBQUksQ0FBQyxJQUFJLENBQUMsT0FBTyxDQUFDLE9BQU8sQ0FBQyxDQUFDLENBQUMsSUFBSSxDQUFDLENBQUMsQ0FBQyxTQUFTLE1BQU0sQ0FBQyxJQUFJLENBQUMsR0FBRyxJQUFJLENBQUMsSUFBSSxDQUFDLE9BQU8sQ0FBQyxRQUFRLElBQUksSUFBSSxDQUFDLElBQUksQ0FBQyxPQUFPLENBQUMsT0FBTyxFQUFFLENBQUMsQ0FBQyxRQUFRLENBQUMsUUFBUSxDQUFDLEVBQUUsQ0FBQztnQkFDbkwsQ0FBQztnQkFDRC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LE9BQU8sQ0FBQyxHQUFHLENBQUMsSUFBSSxlQUFlLElBQUksR0FBRztZQUFFLE9BQU8sRUFBRSxDQUFDO1FBQ3BFLE9BQU8sR0FBSSxDQUFDLEdBQUcsQ0FBQyxJQUFJLENBQUMsRUFBRSxDQUFDLElBQUkscUJBQVcsQ0FBQyxJQUFJLENBQUMsSUFBSSxFQUFFLElBQUksQ0FBQyxDQUFDLENBQUM7SUFDM0QsQ0FBQztDQUNEO0FBbEtELHdCQWtLQyJ9
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
import type E621 from "..";
|
|
2
|
-
import Pool from "../structures/Pool";
|
|
3
|
-
import PoolHistory from "../structures/PoolHistory";
|
|
4
|
-
import type { SearchPoolsOptions, CreatePoolOptions, ModifyPoolOptions, SearchPoolHistoryOptions } from "../types";
|
|
5
|
-
export default class Pools {
|
|
6
|
-
private readonly auth;
|
|
7
|
-
private readonly main;
|
|
8
|
-
constructor(main: E621);
|
|
9
|
-
/**
|
|
10
|
-
* Get a pool by its id
|
|
11
|
-
*
|
|
12
|
-
* @param {number} id - The id of the pool to get
|
|
13
|
-
* @returns {Promise<(Pool | null)>}
|
|
14
|
-
*/
|
|
15
|
-
get(id: number): Promise<Pool | null>;
|
|
16
|
-
/**
|
|
17
|
-
* Get a pool by its name
|
|
18
|
-
*
|
|
19
|
-
* @param {string} name - The name of the pool to get
|
|
20
|
-
* @returns {Promise<(Pool | null)>}
|
|
21
|
-
*/
|
|
22
|
-
getByName(name: string): Promise<Pool | null>;
|
|
23
|
-
/**
|
|
24
|
-
* Search for pools
|
|
25
|
-
*
|
|
26
|
-
* @param {object} [options]
|
|
27
|
-
* @param {string} [options.name] - narrow the results by the name of the pool
|
|
28
|
-
* @param {string} [options.description] - narrow the results by the description of the pool
|
|
29
|
-
* @param {string} [options.creator] - narrow the results by the (name of the) creator of the pool
|
|
30
|
-
* @param {boolean} [options.active] - narrow the results by the pool being active or not
|
|
31
|
-
* @param {PoolCategory} [options.category] - narrow the results by the category of the pool
|
|
32
|
-
* @param {SearchPoolsOrder} [options.order] - the order of the results
|
|
33
|
-
* @param {number} [options.page] - page of results to get
|
|
34
|
-
* @param {number} [options.limit] - limit the maximum amount of results returned
|
|
35
|
-
* @returns {Promise<Array<Pool>>}
|
|
36
|
-
*/
|
|
37
|
-
search(options?: SearchPoolsOptions): Promise<Pool[]>;
|
|
38
|
-
/**
|
|
39
|
-
* Create a pool
|
|
40
|
-
*
|
|
41
|
-
* * Requires Authentication
|
|
42
|
-
*
|
|
43
|
-
* @param {object} options
|
|
44
|
-
* @param {string} options.name - the name of the pool
|
|
45
|
-
* @param {string} [options.description] - the description of the pool
|
|
46
|
-
* @param {Array<number>} [options.posts] - the posts to add to the pool
|
|
47
|
-
* @param {PoolCategory} options.category - the category of the pool
|
|
48
|
-
* @param {boolean} [options.active] - if the pool is active
|
|
49
|
-
* @returns {Promise<Pool>}
|
|
50
|
-
*/
|
|
51
|
-
create(options: CreatePoolOptions): Promise<Pool>;
|
|
52
|
-
/**
|
|
53
|
-
* modify a pool
|
|
54
|
-
*
|
|
55
|
-
* * Requires Authentication
|
|
56
|
-
*
|
|
57
|
-
* @param {number} id - the id of the pool to edit
|
|
58
|
-
* @param {object} options
|
|
59
|
-
* @param {string} [options.name] - the name of the pool
|
|
60
|
-
* @param {string} [options.description] - the description of the pool
|
|
61
|
-
* @param {Array<number>} [options.posts] - the posts to include in the pool (this will override all currently included posts)
|
|
62
|
-
* @param {boolean} [options.category] - the category of the pool
|
|
63
|
-
* @param {boolean} [options.active] - if the pool is active
|
|
64
|
-
* @returns {Promise<Pool>}
|
|
65
|
-
*/
|
|
66
|
-
modify(id: number, options: ModifyPoolOptions): Promise<Pool>;
|
|
67
|
-
/**
|
|
68
|
-
* Delete a pool
|
|
69
|
-
*
|
|
70
|
-
* * Requires Authentication
|
|
71
|
-
*
|
|
72
|
-
* * Requires Janitor
|
|
73
|
-
*
|
|
74
|
-
* @param {number} id - the id of the pool to delete
|
|
75
|
-
* @returns {Promise<null>}
|
|
76
|
-
*/
|
|
77
|
-
delete(id: number): Promise<null>;
|
|
78
|
-
/**
|
|
79
|
-
* Revert a pool to a previous version
|
|
80
|
-
*
|
|
81
|
-
* * Requires Authentication
|
|
82
|
-
*
|
|
83
|
-
* @param {number} id - the id of the pool to revert
|
|
84
|
-
* @param {number} versionID - the version id to revert to (see history)
|
|
85
|
-
*/
|
|
86
|
-
revert(id: number, versionID: number): Promise<null>;
|
|
87
|
-
/**
|
|
88
|
-
* Get a specific pools history
|
|
89
|
-
*
|
|
90
|
-
* @param {number} id - the id of the history to get
|
|
91
|
-
* @returns {Promise<PoolHistory | null>}
|
|
92
|
-
*/
|
|
93
|
-
getHistory(id: number): Promise<PoolHistory | null>;
|
|
94
|
-
/**
|
|
95
|
-
* Search the pool history
|
|
96
|
-
*
|
|
97
|
-
* * Requires Authentication
|
|
98
|
-
*
|
|
99
|
-
* @param {object} [options]
|
|
100
|
-
* @param {number} [options.id] - get a specific pools history entry
|
|
101
|
-
* @param {number} [options.pool] - narrow the results by the pool id
|
|
102
|
-
* @param {(number |`${"" | "a" | "b"}${number}`)} [options.page] - page of results to get
|
|
103
|
-
* @param {number} [options.limit] - limit the maximum amount of results returned
|
|
104
|
-
* @param
|
|
105
|
-
* @returns {Promise<Array<PoolHistory>>}
|
|
106
|
-
*/
|
|
107
|
-
searchHistory(options?: SearchPoolHistoryOptions): Promise<PoolHistory[]>;
|
|
108
|
-
/**
|
|
109
|
-
* Add a post to a pool
|
|
110
|
-
*
|
|
111
|
-
* * Requires Authentication
|
|
112
|
-
*
|
|
113
|
-
* @param {number} id - the id of the pool to add to
|
|
114
|
-
* @param {(Array<number> | number)} posts - the post id (or multiple) to add to the pool
|
|
115
|
-
* @returns {Promise<Pool>}
|
|
116
|
-
*/
|
|
117
|
-
addPost(id: number, posts: Array<number> | number): Promise<Pool>;
|
|
118
|
-
get addPosts(): (id: number, posts: number | number[]) => Promise<Pool>;
|
|
119
|
-
/**
|
|
120
|
-
* Remove a post from a pool
|
|
121
|
-
*
|
|
122
|
-
* * Requires Authentication
|
|
123
|
-
*
|
|
124
|
-
* @param {number} id - the id of the pool to remove from
|
|
125
|
-
* @param {(Array<number> | number)} posts - the post id (or multiple) to remove from the pool
|
|
126
|
-
* @returns {Promise<Pool>}
|
|
127
|
-
*/
|
|
128
|
-
removePost(id: number, posts: Array<number> | number): Promise<Pool>;
|
|
129
|
-
get removePosts(): (id: number, posts: number | number[]) => Promise<Pool>;
|
|
130
|
-
}
|