lemmy-js-client 0.19.3-alpha.5 → 0.19.4-alpha.2
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/http.d.ts +743 -0
- package/dist/http.js +929 -0
- package/dist/index.d.ts +247 -0
- package/dist/index.js +17 -0
- package/dist/other_types.d.ts +22 -0
- package/dist/other_types.js +4 -0
- package/dist/types/ActivityId.d.ts +1 -0
- package/dist/types/ActivityId.js +3 -0
- package/dist/types/AddAdmin.d.ts +5 -0
- package/dist/types/AddAdmin.js +2 -0
- package/dist/types/AddAdminResponse.d.ts +4 -0
- package/dist/types/AddAdminResponse.js +2 -0
- package/dist/types/AddModToCommunity.d.ts +7 -0
- package/dist/types/AddModToCommunity.js +2 -0
- package/dist/types/AddModToCommunityResponse.d.ts +4 -0
- package/dist/types/AddModToCommunityResponse.js +2 -0
- package/dist/types/AdminPurgeComment.d.ts +9 -0
- package/dist/types/AdminPurgeComment.js +2 -0
- package/dist/types/AdminPurgeCommentView.d.ts +8 -0
- package/dist/types/AdminPurgeCommentView.js +2 -0
- package/dist/types/AdminPurgeCommunity.d.ts +7 -0
- package/dist/types/AdminPurgeCommunity.js +2 -0
- package/dist/types/AdminPurgeCommunityView.d.ts +6 -0
- package/dist/types/AdminPurgeCommunityView.js +2 -0
- package/dist/types/AdminPurgePerson.d.ts +7 -0
- package/dist/types/AdminPurgePerson.js +2 -0
- package/dist/types/AdminPurgePersonView.d.ts +6 -0
- package/dist/types/AdminPurgePersonView.js +2 -0
- package/dist/types/AdminPurgePost.d.ts +9 -0
- package/dist/types/AdminPurgePost.js +2 -0
- package/dist/types/AdminPurgePostView.d.ts +8 -0
- package/dist/types/AdminPurgePostView.js +2 -0
- package/dist/types/ApproveRegistrationApplication.d.ts +5 -0
- package/dist/types/ApproveRegistrationApplication.js +3 -0
- package/dist/types/BanFromCommunity.d.ts +10 -0
- package/dist/types/BanFromCommunity.js +2 -0
- package/dist/types/BanFromCommunityResponse.d.ts +5 -0
- package/dist/types/BanFromCommunityResponse.js +2 -0
- package/dist/types/BanPerson.d.ts +8 -0
- package/dist/types/BanPerson.js +2 -0
- package/dist/types/BanPersonResponse.d.ts +5 -0
- package/dist/types/BanPersonResponse.js +2 -0
- package/dist/types/BannedPersonsResponse.d.ts +4 -0
- package/dist/types/BannedPersonsResponse.js +2 -0
- package/dist/types/BlockCommunity.d.ts +5 -0
- package/dist/types/BlockCommunity.js +2 -0
- package/dist/types/BlockCommunityResponse.d.ts +5 -0
- package/dist/types/BlockCommunityResponse.js +2 -0
- package/dist/types/BlockInstance.d.ts +5 -0
- package/dist/types/BlockInstance.js +2 -0
- package/dist/types/BlockInstanceResponse.d.ts +3 -0
- package/dist/types/BlockInstanceResponse.js +3 -0
- package/dist/types/BlockPerson.d.ts +5 -0
- package/dist/types/BlockPerson.js +2 -0
- package/dist/types/BlockPersonResponse.d.ts +5 -0
- package/dist/types/BlockPersonResponse.js +2 -0
- package/dist/types/CaptchaResponse.d.ts +5 -0
- package/dist/types/CaptchaResponse.js +3 -0
- package/dist/types/ChangePassword.d.ts +5 -0
- package/dist/types/ChangePassword.js +3 -0
- package/dist/types/Comment.d.ts +19 -0
- package/dist/types/Comment.js +2 -0
- package/dist/types/CommentAggregates.d.ts +9 -0
- package/dist/types/CommentAggregates.js +2 -0
- package/dist/types/CommentId.d.ts +1 -0
- package/dist/types/CommentId.js +3 -0
- package/dist/types/CommentReply.d.ts +10 -0
- package/dist/types/CommentReply.js +2 -0
- package/dist/types/CommentReplyId.d.ts +1 -0
- package/dist/types/CommentReplyId.js +3 -0
- package/dist/types/CommentReplyResponse.d.ts +4 -0
- package/dist/types/CommentReplyResponse.js +2 -0
- package/dist/types/CommentReplyView.d.ts +23 -0
- package/dist/types/CommentReplyView.js +2 -0
- package/dist/types/CommentReport.d.ts +14 -0
- package/dist/types/CommentReport.js +2 -0
- package/dist/types/CommentReportId.d.ts +1 -0
- package/dist/types/CommentReportId.js +3 -0
- package/dist/types/CommentReportResponse.d.ts +4 -0
- package/dist/types/CommentReportResponse.js +2 -0
- package/dist/types/CommentReportView.d.ts +18 -0
- package/dist/types/CommentReportView.js +2 -0
- package/dist/types/CommentResponse.d.ts +6 -0
- package/dist/types/CommentResponse.js +2 -0
- package/dist/types/CommentSortType.d.ts +1 -0
- package/dist/types/CommentSortType.js +3 -0
- package/dist/types/CommentView.d.ts +20 -0
- package/dist/types/CommentView.js +2 -0
- package/dist/types/Community.d.ts +22 -0
- package/dist/types/Community.js +2 -0
- package/dist/types/CommunityAggregates.d.ts +13 -0
- package/dist/types/CommunityAggregates.js +2 -0
- package/dist/types/CommunityBlockView.d.ts +6 -0
- package/dist/types/CommunityBlockView.js +2 -0
- package/dist/types/CommunityFollowerView.d.ts +6 -0
- package/dist/types/CommunityFollowerView.js +2 -0
- package/dist/types/CommunityId.d.ts +1 -0
- package/dist/types/CommunityId.js +3 -0
- package/dist/types/CommunityModeratorView.d.ts +6 -0
- package/dist/types/CommunityModeratorView.js +2 -0
- package/dist/types/CommunityResponse.d.ts +6 -0
- package/dist/types/CommunityResponse.js +2 -0
- package/dist/types/CommunityView.d.ts +9 -0
- package/dist/types/CommunityView.js +2 -0
- package/dist/types/CommunityVisibility.d.ts +1 -0
- package/dist/types/CommunityVisibility.js +3 -0
- package/dist/types/CreateComment.d.ts +9 -0
- package/dist/types/CreateComment.js +2 -0
- package/dist/types/CreateCommentLike.d.ts +5 -0
- package/dist/types/CreateCommentLike.js +2 -0
- package/dist/types/CreateCommentReport.d.ts +5 -0
- package/dist/types/CreateCommentReport.js +2 -0
- package/dist/types/CreateCommunity.d.ts +13 -0
- package/dist/types/CreateCommunity.js +2 -0
- package/dist/types/CreateCustomEmoji.d.ts +7 -0
- package/dist/types/CreateCustomEmoji.js +3 -0
- package/dist/types/CreatePost.d.ts +12 -0
- package/dist/types/CreatePost.js +2 -0
- package/dist/types/CreatePostLike.d.ts +5 -0
- package/dist/types/CreatePostLike.js +2 -0
- package/dist/types/CreatePostReport.d.ts +5 -0
- package/dist/types/CreatePostReport.js +2 -0
- package/dist/types/CreatePrivateMessage.d.ts +5 -0
- package/dist/types/CreatePrivateMessage.js +2 -0
- package/dist/types/CreatePrivateMessageReport.d.ts +5 -0
- package/dist/types/CreatePrivateMessageReport.js +2 -0
- package/dist/types/CreateSite.d.ts +49 -0
- package/dist/types/CreateSite.js +2 -0
- package/dist/types/CustomEmoji.d.ts +12 -0
- package/dist/types/CustomEmoji.js +2 -0
- package/dist/types/CustomEmojiId.d.ts +1 -0
- package/dist/types/CustomEmojiId.js +3 -0
- package/dist/types/CustomEmojiKeyword.d.ts +5 -0
- package/dist/types/CustomEmojiKeyword.js +2 -0
- package/dist/types/CustomEmojiResponse.d.ts +4 -0
- package/dist/types/CustomEmojiResponse.js +2 -0
- package/dist/types/CustomEmojiView.d.ts +6 -0
- package/dist/types/CustomEmojiView.js +2 -0
- package/dist/types/DeleteAccount.d.ts +4 -0
- package/dist/types/DeleteAccount.js +3 -0
- package/dist/types/DeleteComment.d.ts +5 -0
- package/dist/types/DeleteComment.js +2 -0
- package/dist/types/DeleteCommunity.d.ts +5 -0
- package/dist/types/DeleteCommunity.js +2 -0
- package/dist/types/DeleteCustomEmoji.d.ts +4 -0
- package/dist/types/DeleteCustomEmoji.js +2 -0
- package/dist/types/DeletePost.d.ts +5 -0
- package/dist/types/DeletePost.js +2 -0
- package/dist/types/DeletePrivateMessage.d.ts +5 -0
- package/dist/types/DeletePrivateMessage.js +2 -0
- package/dist/types/DistinguishComment.d.ts +5 -0
- package/dist/types/DistinguishComment.js +2 -0
- package/dist/types/EditComment.d.ts +7 -0
- package/dist/types/EditComment.js +2 -0
- package/dist/types/EditCommunity.d.ts +14 -0
- package/dist/types/EditCommunity.js +2 -0
- package/dist/types/EditCustomEmoji.d.ts +8 -0
- package/dist/types/EditCustomEmoji.js +2 -0
- package/dist/types/EditPost.d.ts +11 -0
- package/dist/types/EditPost.js +2 -0
- package/dist/types/EditPrivateMessage.d.ts +5 -0
- package/dist/types/EditPrivateMessage.js +2 -0
- package/dist/types/EditSite.d.ts +50 -0
- package/dist/types/EditSite.js +2 -0
- package/dist/types/FeaturePost.d.ts +7 -0
- package/dist/types/FeaturePost.js +2 -0
- package/dist/types/FederatedInstances.d.ts +6 -0
- package/dist/types/FederatedInstances.js +2 -0
- package/dist/types/FollowCommunity.d.ts +5 -0
- package/dist/types/FollowCommunity.js +2 -0
- package/dist/types/GenerateTotpSecretResponse.d.ts +3 -0
- package/dist/types/GenerateTotpSecretResponse.js +3 -0
- package/dist/types/GetCaptchaResponse.d.ts +4 -0
- package/dist/types/GetCaptchaResponse.js +2 -0
- package/dist/types/GetComment.d.ts +4 -0
- package/dist/types/GetComment.js +2 -0
- package/dist/types/GetComments.d.ts +19 -0
- package/dist/types/GetComments.js +2 -0
- package/dist/types/GetCommentsResponse.d.ts +4 -0
- package/dist/types/GetCommentsResponse.js +2 -0
- package/dist/types/GetCommunity.d.ts +5 -0
- package/dist/types/GetCommunity.js +2 -0
- package/dist/types/GetCommunityResponse.d.ts +10 -0
- package/dist/types/GetCommunityResponse.js +2 -0
- package/dist/types/GetFederatedInstancesResponse.d.ts +4 -0
- package/dist/types/GetFederatedInstancesResponse.js +2 -0
- package/dist/types/GetModlog.d.ts +11 -0
- package/dist/types/GetModlog.js +2 -0
- package/dist/types/GetModlogResponse.d.ts +32 -0
- package/dist/types/GetModlogResponse.js +2 -0
- package/dist/types/GetPersonDetails.d.ts +12 -0
- package/dist/types/GetPersonDetails.js +2 -0
- package/dist/types/GetPersonDetailsResponse.d.ts +12 -0
- package/dist/types/GetPersonDetailsResponse.js +2 -0
- package/dist/types/GetPersonMentions.d.ts +7 -0
- package/dist/types/GetPersonMentions.js +2 -0
- package/dist/types/GetPersonMentionsResponse.d.ts +4 -0
- package/dist/types/GetPersonMentionsResponse.js +2 -0
- package/dist/types/GetPost.d.ts +6 -0
- package/dist/types/GetPost.js +2 -0
- package/dist/types/GetPostResponse.d.ts +9 -0
- package/dist/types/GetPostResponse.js +2 -0
- package/dist/types/GetPosts.d.ts +16 -0
- package/dist/types/GetPosts.js +2 -0
- package/dist/types/GetPostsResponse.d.ts +6 -0
- package/dist/types/GetPostsResponse.js +2 -0
- package/dist/types/GetPrivateMessages.d.ts +7 -0
- package/dist/types/GetPrivateMessages.js +2 -0
- package/dist/types/GetReplies.d.ts +7 -0
- package/dist/types/GetReplies.js +2 -0
- package/dist/types/GetRepliesResponse.d.ts +4 -0
- package/dist/types/GetRepliesResponse.js +2 -0
- package/dist/types/GetReportCount.d.ts +4 -0
- package/dist/types/GetReportCount.js +2 -0
- package/dist/types/GetReportCountResponse.d.ts +7 -0
- package/dist/types/GetReportCountResponse.js +2 -0
- package/dist/types/GetSiteMetadata.d.ts +3 -0
- package/dist/types/GetSiteMetadata.js +3 -0
- package/dist/types/GetSiteMetadataResponse.d.ts +4 -0
- package/dist/types/GetSiteMetadataResponse.js +2 -0
- package/dist/types/GetSiteResponse.d.ts +17 -0
- package/dist/types/GetSiteResponse.js +2 -0
- package/dist/types/GetUnreadCountResponse.d.ts +5 -0
- package/dist/types/GetUnreadCountResponse.js +3 -0
- package/dist/types/GetUnreadRegistrationApplicationCountResponse.d.ts +3 -0
- package/dist/types/GetUnreadRegistrationApplicationCountResponse.js +3 -0
- package/dist/types/HideCommunity.d.ts +6 -0
- package/dist/types/HideCommunity.js +2 -0
- package/dist/types/Instance.d.ts +9 -0
- package/dist/types/Instance.js +2 -0
- package/dist/types/InstanceBlockView.d.ts +8 -0
- package/dist/types/InstanceBlockView.js +2 -0
- package/dist/types/InstanceId.d.ts +1 -0
- package/dist/types/InstanceId.js +3 -0
- package/dist/types/InstanceWithFederationState.d.ts +11 -0
- package/dist/types/InstanceWithFederationState.js +2 -0
- package/dist/types/Language.d.ts +6 -0
- package/dist/types/Language.js +2 -0
- package/dist/types/LanguageId.d.ts +1 -0
- package/dist/types/LanguageId.js +3 -0
- package/dist/types/LemmyErrorType.d.ts +310 -0
- package/dist/types/LemmyErrorType.js +3 -0
- package/dist/types/LinkMetadata.d.ts +7 -0
- package/dist/types/LinkMetadata.js +3 -0
- package/dist/types/ListCommentLikes.d.ts +6 -0
- package/dist/types/ListCommentLikes.js +2 -0
- package/dist/types/ListCommentLikesResponse.d.ts +4 -0
- package/dist/types/ListCommentLikesResponse.js +2 -0
- package/dist/types/ListCommentReports.d.ts +7 -0
- package/dist/types/ListCommentReports.js +2 -0
- package/dist/types/ListCommentReportsResponse.d.ts +4 -0
- package/dist/types/ListCommentReportsResponse.js +2 -0
- package/dist/types/ListCommunities.d.ts +9 -0
- package/dist/types/ListCommunities.js +2 -0
- package/dist/types/ListCommunitiesResponse.d.ts +4 -0
- package/dist/types/ListCommunitiesResponse.js +2 -0
- package/dist/types/ListPostLikes.d.ts +6 -0
- package/dist/types/ListPostLikes.js +2 -0
- package/dist/types/ListPostLikesResponse.d.ts +4 -0
- package/dist/types/ListPostLikesResponse.js +2 -0
- package/dist/types/ListPostReports.d.ts +7 -0
- package/dist/types/ListPostReports.js +2 -0
- package/dist/types/ListPostReportsResponse.d.ts +4 -0
- package/dist/types/ListPostReportsResponse.js +2 -0
- package/dist/types/ListPrivateMessageReports.d.ts +5 -0
- package/dist/types/ListPrivateMessageReports.js +3 -0
- package/dist/types/ListPrivateMessageReportsResponse.d.ts +4 -0
- package/dist/types/ListPrivateMessageReportsResponse.js +2 -0
- package/dist/types/ListRegistrationApplications.d.ts +5 -0
- package/dist/types/ListRegistrationApplications.js +3 -0
- package/dist/types/ListRegistrationApplicationsResponse.d.ts +4 -0
- package/dist/types/ListRegistrationApplicationsResponse.js +2 -0
- package/dist/types/ListingType.d.ts +1 -0
- package/dist/types/ListingType.js +3 -0
- package/dist/types/LocalSite.d.ts +34 -0
- package/dist/types/LocalSite.js +2 -0
- package/dist/types/LocalSiteId.d.ts +1 -0
- package/dist/types/LocalSiteId.js +3 -0
- package/dist/types/LocalSiteRateLimit.d.ts +20 -0
- package/dist/types/LocalSiteRateLimit.js +2 -0
- package/dist/types/LocalUser.d.ts +32 -0
- package/dist/types/LocalUser.js +2 -0
- package/dist/types/LocalUserId.d.ts +1 -0
- package/dist/types/LocalUserId.js +3 -0
- package/dist/types/LocalUserView.d.ts +8 -0
- package/dist/types/LocalUserView.js +2 -0
- package/dist/types/LockPost.d.ts +5 -0
- package/dist/types/LockPost.js +2 -0
- package/dist/types/Login.d.ts +5 -0
- package/dist/types/Login.js +3 -0
- package/dist/types/LoginResponse.d.ts +5 -0
- package/dist/types/LoginResponse.js +3 -0
- package/dist/types/LoginToken.d.ts +7 -0
- package/dist/types/LoginToken.js +2 -0
- package/dist/types/MarkCommentReplyAsRead.d.ts +5 -0
- package/dist/types/MarkCommentReplyAsRead.js +2 -0
- package/dist/types/MarkPersonMentionAsRead.d.ts +5 -0
- package/dist/types/MarkPersonMentionAsRead.js +2 -0
- package/dist/types/MarkPostAsRead.d.ts +6 -0
- package/dist/types/MarkPostAsRead.js +2 -0
- package/dist/types/MarkPrivateMessageAsRead.d.ts +5 -0
- package/dist/types/MarkPrivateMessageAsRead.js +2 -0
- package/dist/types/ModAdd.d.ts +8 -0
- package/dist/types/ModAdd.js +2 -0
- package/dist/types/ModAddCommunity.d.ts +10 -0
- package/dist/types/ModAddCommunity.js +2 -0
- package/dist/types/ModAddCommunityView.d.ts +9 -0
- package/dist/types/ModAddCommunityView.js +2 -0
- package/dist/types/ModAddView.d.ts +7 -0
- package/dist/types/ModAddView.js +2 -0
- package/dist/types/ModBan.d.ts +10 -0
- package/dist/types/ModBan.js +2 -0
- package/dist/types/ModBanFromCommunity.d.ts +12 -0
- package/dist/types/ModBanFromCommunity.js +2 -0
- package/dist/types/ModBanFromCommunityView.d.ts +9 -0
- package/dist/types/ModBanFromCommunityView.js +2 -0
- package/dist/types/ModBanView.d.ts +7 -0
- package/dist/types/ModBanView.js +2 -0
- package/dist/types/ModFeaturePost.d.ts +10 -0
- package/dist/types/ModFeaturePost.js +2 -0
- package/dist/types/ModFeaturePostView.d.ts +10 -0
- package/dist/types/ModFeaturePostView.js +2 -0
- package/dist/types/ModHideCommunity.d.ts +10 -0
- package/dist/types/ModHideCommunity.js +2 -0
- package/dist/types/ModHideCommunityView.d.ts +8 -0
- package/dist/types/ModHideCommunityView.js +2 -0
- package/dist/types/ModLockPost.d.ts +9 -0
- package/dist/types/ModLockPost.js +2 -0
- package/dist/types/ModLockPostView.d.ts +10 -0
- package/dist/types/ModLockPostView.js +2 -0
- package/dist/types/ModRemoveComment.d.ts +10 -0
- package/dist/types/ModRemoveComment.js +2 -0
- package/dist/types/ModRemoveCommentView.d.ts +13 -0
- package/dist/types/ModRemoveCommentView.js +2 -0
- package/dist/types/ModRemoveCommunity.d.ts +10 -0
- package/dist/types/ModRemoveCommunity.js +2 -0
- package/dist/types/ModRemoveCommunityView.d.ts +8 -0
- package/dist/types/ModRemoveCommunityView.js +2 -0
- package/dist/types/ModRemovePost.d.ts +10 -0
- package/dist/types/ModRemovePost.js +2 -0
- package/dist/types/ModRemovePostView.d.ts +10 -0
- package/dist/types/ModRemovePostView.js +2 -0
- package/dist/types/ModTransferCommunity.d.ts +9 -0
- package/dist/types/ModTransferCommunity.js +2 -0
- package/dist/types/ModTransferCommunityView.d.ts +9 -0
- package/dist/types/ModTransferCommunityView.js +2 -0
- package/dist/types/ModlogActionType.d.ts +1 -0
- package/dist/types/ModlogActionType.js +3 -0
- package/dist/types/ModlogListParams.d.ts +10 -0
- package/dist/types/ModlogListParams.js +2 -0
- package/dist/types/MyUserInfo.d.ts +16 -0
- package/dist/types/MyUserInfo.js +2 -0
- package/dist/types/OpenGraphData.d.ts +6 -0
- package/dist/types/OpenGraphData.js +3 -0
- package/dist/types/PaginationCursor.d.ts +1 -0
- package/dist/types/PaginationCursor.js +3 -0
- package/dist/types/PasswordChangeAfterReset.d.ts +5 -0
- package/dist/types/PasswordChangeAfterReset.js +3 -0
- package/dist/types/PasswordReset.d.ts +3 -0
- package/dist/types/PasswordReset.js +3 -0
- package/dist/types/Person.d.ts +20 -0
- package/dist/types/Person.js +2 -0
- package/dist/types/PersonAggregates.d.ts +6 -0
- package/dist/types/PersonAggregates.js +2 -0
- package/dist/types/PersonBlockId.d.ts +1 -0
- package/dist/types/PersonBlockId.js +3 -0
- package/dist/types/PersonBlockView.d.ts +5 -0
- package/dist/types/PersonBlockView.js +2 -0
- package/dist/types/PersonId.d.ts +1 -0
- package/dist/types/PersonId.js +3 -0
- package/dist/types/PersonMention.d.ts +10 -0
- package/dist/types/PersonMention.js +2 -0
- package/dist/types/PersonMentionId.d.ts +1 -0
- package/dist/types/PersonMentionId.js +3 -0
- package/dist/types/PersonMentionResponse.d.ts +4 -0
- package/dist/types/PersonMentionResponse.js +2 -0
- package/dist/types/PersonMentionView.d.ts +23 -0
- package/dist/types/PersonMentionView.js +2 -0
- package/dist/types/PersonView.d.ts +7 -0
- package/dist/types/PersonView.js +2 -0
- package/dist/types/Post.d.ts +28 -0
- package/dist/types/Post.js +2 -0
- package/dist/types/PostAggregates.d.ts +10 -0
- package/dist/types/PostAggregates.js +2 -0
- package/dist/types/PostFeatureType.d.ts +1 -0
- package/dist/types/PostFeatureType.js +3 -0
- package/dist/types/PostId.d.ts +1 -0
- package/dist/types/PostId.js +3 -0
- package/dist/types/PostListingMode.d.ts +1 -0
- package/dist/types/PostListingMode.js +3 -0
- package/dist/types/PostReport.d.ts +16 -0
- package/dist/types/PostReport.js +2 -0
- package/dist/types/PostReportId.d.ts +1 -0
- package/dist/types/PostReportId.js +3 -0
- package/dist/types/PostReportResponse.d.ts +4 -0
- package/dist/types/PostReportResponse.js +2 -0
- package/dist/types/PostReportView.d.ts +16 -0
- package/dist/types/PostReportView.js +2 -0
- package/dist/types/PostResponse.d.ts +4 -0
- package/dist/types/PostResponse.js +2 -0
- package/dist/types/PostView.d.ts +20 -0
- package/dist/types/PostView.js +2 -0
- package/dist/types/PrivateMessage.d.ts +14 -0
- package/dist/types/PrivateMessage.js +2 -0
- package/dist/types/PrivateMessageId.d.ts +1 -0
- package/dist/types/PrivateMessageId.js +3 -0
- package/dist/types/PrivateMessageReport.d.ts +14 -0
- package/dist/types/PrivateMessageReport.js +2 -0
- package/dist/types/PrivateMessageReportId.d.ts +1 -0
- package/dist/types/PrivateMessageReportId.js +3 -0
- package/dist/types/PrivateMessageReportResponse.d.ts +4 -0
- package/dist/types/PrivateMessageReportResponse.js +2 -0
- package/dist/types/PrivateMessageReportView.d.ts +10 -0
- package/dist/types/PrivateMessageReportView.js +2 -0
- package/dist/types/PrivateMessageResponse.d.ts +4 -0
- package/dist/types/PrivateMessageResponse.js +2 -0
- package/dist/types/PrivateMessageView.d.ts +7 -0
- package/dist/types/PrivateMessageView.js +2 -0
- package/dist/types/PrivateMessagesResponse.d.ts +4 -0
- package/dist/types/PrivateMessagesResponse.js +2 -0
- package/dist/types/PurgeComment.d.ts +5 -0
- package/dist/types/PurgeComment.js +2 -0
- package/dist/types/PurgeCommunity.d.ts +5 -0
- package/dist/types/PurgeCommunity.js +2 -0
- package/dist/types/PurgePerson.d.ts +5 -0
- package/dist/types/PurgePerson.js +2 -0
- package/dist/types/PurgePost.d.ts +5 -0
- package/dist/types/PurgePost.js +2 -0
- package/dist/types/ReadableFederationState.d.ts +10 -0
- package/dist/types/ReadableFederationState.js +2 -0
- package/dist/types/Register.d.ts +11 -0
- package/dist/types/Register.js +3 -0
- package/dist/types/RegistrationApplication.d.ts +10 -0
- package/dist/types/RegistrationApplication.js +2 -0
- package/dist/types/RegistrationApplicationResponse.d.ts +4 -0
- package/dist/types/RegistrationApplicationResponse.js +2 -0
- package/dist/types/RegistrationApplicationView.d.ts +9 -0
- package/dist/types/RegistrationApplicationView.js +2 -0
- package/dist/types/RegistrationMode.d.ts +1 -0
- package/dist/types/RegistrationMode.js +3 -0
- package/dist/types/RemoveComment.d.ts +6 -0
- package/dist/types/RemoveComment.js +2 -0
- package/dist/types/RemoveCommunity.d.ts +6 -0
- package/dist/types/RemoveCommunity.js +2 -0
- package/dist/types/RemovePost.d.ts +6 -0
- package/dist/types/RemovePost.js +2 -0
- package/dist/types/ResolveCommentReport.d.ts +5 -0
- package/dist/types/ResolveCommentReport.js +2 -0
- package/dist/types/ResolveObject.d.ts +3 -0
- package/dist/types/ResolveObject.js +3 -0
- package/dist/types/ResolveObjectResponse.d.ts +10 -0
- package/dist/types/ResolveObjectResponse.js +2 -0
- package/dist/types/ResolvePostReport.d.ts +5 -0
- package/dist/types/ResolvePostReport.js +2 -0
- package/dist/types/ResolvePrivateMessageReport.d.ts +5 -0
- package/dist/types/ResolvePrivateMessageReport.js +2 -0
- package/dist/types/SaveComment.d.ts +5 -0
- package/dist/types/SaveComment.js +2 -0
- package/dist/types/SavePost.d.ts +5 -0
- package/dist/types/SavePost.js +2 -0
- package/dist/types/SaveUserSettings.d.ts +32 -0
- package/dist/types/SaveUserSettings.js +2 -0
- package/dist/types/Search.d.ts +16 -0
- package/dist/types/Search.js +2 -0
- package/dist/types/SearchResponse.d.ts +12 -0
- package/dist/types/SearchResponse.js +2 -0
- package/dist/types/SearchType.d.ts +1 -0
- package/dist/types/SearchType.js +3 -0
- package/dist/types/Site.d.ts +19 -0
- package/dist/types/Site.js +2 -0
- package/dist/types/SiteAggregates.d.ts +12 -0
- package/dist/types/SiteAggregates.js +2 -0
- package/dist/types/SiteId.d.ts +1 -0
- package/dist/types/SiteId.js +3 -0
- package/dist/types/SiteResponse.d.ts +6 -0
- package/dist/types/SiteResponse.js +2 -0
- package/dist/types/SiteView.d.ts +10 -0
- package/dist/types/SiteView.js +2 -0
- package/dist/types/SortType.d.ts +1 -0
- package/dist/types/SortType.js +3 -0
- package/dist/types/SubscribedType.d.ts +1 -0
- package/dist/types/SubscribedType.js +3 -0
- package/dist/types/SuccessResponse.d.ts +3 -0
- package/dist/types/SuccessResponse.js +3 -0
- package/dist/types/Tagline.d.ts +8 -0
- package/dist/types/Tagline.js +2 -0
- package/dist/types/TransferCommunity.d.ts +6 -0
- package/dist/types/TransferCommunity.js +2 -0
- package/dist/types/UpdateTotp.d.ts +4 -0
- package/dist/types/UpdateTotp.js +3 -0
- package/dist/types/UpdateTotpResponse.d.ts +3 -0
- package/dist/types/UpdateTotpResponse.js +3 -0
- package/dist/types/VerifyEmail.d.ts +3 -0
- package/dist/types/VerifyEmail.js +3 -0
- package/dist/types/VoteView.d.ts +5 -0
- package/dist/types/VoteView.js +2 -0
- package/package.json +13 -10
package/dist/http.js
ADDED
@@ -0,0 +1,929 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
|
+
});
|
10
|
+
};
|
11
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
12
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
13
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
14
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
15
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
16
|
+
};
|
17
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
18
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
19
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
20
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
21
|
+
};
|
22
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
23
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
24
|
+
};
|
25
|
+
var _LemmyHttp_instances, _LemmyHttp_apiUrl, _LemmyHttp_headers, _LemmyHttp_pictrsUrl, _LemmyHttp_fetchFunction, _LemmyHttp_buildFullUrl, _LemmyHttp_wrapper;
|
26
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
27
|
+
exports.LemmyHttp = void 0;
|
28
|
+
const cross_fetch_1 = __importDefault(require("cross-fetch"));
|
29
|
+
const form_data_1 = __importDefault(require("form-data"));
|
30
|
+
const other_types_1 = require("./other_types");
|
31
|
+
var HttpType;
|
32
|
+
(function (HttpType) {
|
33
|
+
HttpType["Get"] = "GET";
|
34
|
+
HttpType["Post"] = "POST";
|
35
|
+
HttpType["Put"] = "PUT";
|
36
|
+
})(HttpType || (HttpType = {}));
|
37
|
+
/**
|
38
|
+
* Helps build lemmy HTTP requests.
|
39
|
+
*/
|
40
|
+
class LemmyHttp {
|
41
|
+
/**
|
42
|
+
* Generates a new instance of LemmyHttp.
|
43
|
+
* @param baseUrl the base url, without the vX version: https://lemmy.ml -> goes to https://lemmy.ml/api/vX
|
44
|
+
* @param headers optional headers. Should contain `x-real-ip` and `x-forwarded-for` .
|
45
|
+
*/
|
46
|
+
constructor(baseUrl, options) {
|
47
|
+
_LemmyHttp_instances.add(this);
|
48
|
+
_LemmyHttp_apiUrl.set(this, void 0);
|
49
|
+
_LemmyHttp_headers.set(this, {});
|
50
|
+
_LemmyHttp_pictrsUrl.set(this, void 0);
|
51
|
+
_LemmyHttp_fetchFunction.set(this, cross_fetch_1.default);
|
52
|
+
__classPrivateFieldSet(this, _LemmyHttp_apiUrl, `${baseUrl.replace(/\/+$/, "")}/api/${other_types_1.VERSION}`, "f");
|
53
|
+
__classPrivateFieldSet(this, _LemmyHttp_pictrsUrl, `${baseUrl}/pictrs/image`, "f");
|
54
|
+
if (options === null || options === void 0 ? void 0 : options.headers) {
|
55
|
+
__classPrivateFieldSet(this, _LemmyHttp_headers, options.headers, "f");
|
56
|
+
}
|
57
|
+
if (options === null || options === void 0 ? void 0 : options.fetchFunction) {
|
58
|
+
__classPrivateFieldSet(this, _LemmyHttp_fetchFunction, options.fetchFunction, "f");
|
59
|
+
}
|
60
|
+
}
|
61
|
+
/**
|
62
|
+
* Gets the site, and your user data.
|
63
|
+
*
|
64
|
+
* `HTTP.GET /site`
|
65
|
+
*/
|
66
|
+
getSite() {
|
67
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/site", {});
|
68
|
+
}
|
69
|
+
/**
|
70
|
+
* Create your site.
|
71
|
+
*
|
72
|
+
* `HTTP.POST /site`
|
73
|
+
*/
|
74
|
+
createSite(form) {
|
75
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/site", form);
|
76
|
+
}
|
77
|
+
/**
|
78
|
+
* Edit your site.
|
79
|
+
*
|
80
|
+
* `HTTP.PUT /site`
|
81
|
+
*/
|
82
|
+
editSite(form) {
|
83
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Put, "/site", form);
|
84
|
+
}
|
85
|
+
/**
|
86
|
+
* Leave the Site admins.
|
87
|
+
*
|
88
|
+
* `HTTP.POST /user/leave_admin`
|
89
|
+
*/
|
90
|
+
leaveAdmin() {
|
91
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/user/leave_admin", {});
|
92
|
+
}
|
93
|
+
/**
|
94
|
+
* Generate a TOTP / two-factor secret.
|
95
|
+
*
|
96
|
+
* Afterwards you need to call `/user/totp/update` with a valid token to enable it.
|
97
|
+
*
|
98
|
+
* `HTTP.POST /user/totp/generate`
|
99
|
+
*/
|
100
|
+
generateTotpSecret() {
|
101
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/user/totp/generate", {});
|
102
|
+
}
|
103
|
+
/**
|
104
|
+
* Export a backup of your user settings, including your saved content,
|
105
|
+
* followed communities, and blocks.
|
106
|
+
*
|
107
|
+
* `HTTP.GET /user/export_settings`
|
108
|
+
*/
|
109
|
+
exportSettings() {
|
110
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/user/export_settings", {});
|
111
|
+
}
|
112
|
+
/**
|
113
|
+
* Import a backup of your user settings.
|
114
|
+
*
|
115
|
+
* `HTTP.POST /user/import_settings`
|
116
|
+
*/
|
117
|
+
importSettings(form) {
|
118
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/user/import_settings", form);
|
119
|
+
}
|
120
|
+
/**
|
121
|
+
* List login tokens for your user
|
122
|
+
*
|
123
|
+
* `HTTP.GET /user/list_logins`
|
124
|
+
*/
|
125
|
+
listLogins() {
|
126
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/user/list_logins", {});
|
127
|
+
}
|
128
|
+
/**
|
129
|
+
* Returns an error message if your auth token is invalid
|
130
|
+
*
|
131
|
+
* `HTTP.GET /user/validate_auth`
|
132
|
+
*/
|
133
|
+
validateAuth() {
|
134
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/user/validate_auth", {});
|
135
|
+
}
|
136
|
+
/**
|
137
|
+
* Enable / Disable TOTP / two-factor authentication.
|
138
|
+
*
|
139
|
+
* To enable, you need to first call `/user/totp/generate` and then pass a valid token to this.
|
140
|
+
*
|
141
|
+
* Disabling is only possible if 2FA was previously enabled. Again it is necessary to pass a valid token.
|
142
|
+
*
|
143
|
+
* `HTTP.POST /user/totp/update`
|
144
|
+
*/
|
145
|
+
updateTotp(form) {
|
146
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/user/totp/update", form);
|
147
|
+
}
|
148
|
+
/**
|
149
|
+
* Get the modlog.
|
150
|
+
*
|
151
|
+
* `HTTP.GET /modlog`
|
152
|
+
*/
|
153
|
+
getModlog(form = {}) {
|
154
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/modlog", form);
|
155
|
+
}
|
156
|
+
/**
|
157
|
+
* Search lemmy.
|
158
|
+
*
|
159
|
+
* `HTTP.GET /search`
|
160
|
+
*/
|
161
|
+
search(form) {
|
162
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/search", form);
|
163
|
+
}
|
164
|
+
/**
|
165
|
+
* Fetch a non-local / federated object.
|
166
|
+
*
|
167
|
+
* `HTTP.GET /resolve_object`
|
168
|
+
*/
|
169
|
+
resolveObject(form) {
|
170
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/resolve_object", form);
|
171
|
+
}
|
172
|
+
/**
|
173
|
+
* Create a new community.
|
174
|
+
*
|
175
|
+
* `HTTP.POST /community`
|
176
|
+
*/
|
177
|
+
createCommunity(form) {
|
178
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/community", form);
|
179
|
+
}
|
180
|
+
/**
|
181
|
+
* Get / fetch a community.
|
182
|
+
*
|
183
|
+
* `HTTP.GET /community`
|
184
|
+
*/
|
185
|
+
getCommunity(form = {}) {
|
186
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/community", form);
|
187
|
+
}
|
188
|
+
/**
|
189
|
+
* Edit a community.
|
190
|
+
*
|
191
|
+
* `HTTP.PUT /community`
|
192
|
+
*/
|
193
|
+
editCommunity(form) {
|
194
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Put, "/community", form);
|
195
|
+
}
|
196
|
+
/**
|
197
|
+
* List communities, with various filters.
|
198
|
+
*
|
199
|
+
* `HTTP.GET /community/list`
|
200
|
+
*/
|
201
|
+
listCommunities(form = {}) {
|
202
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/community/list", form);
|
203
|
+
}
|
204
|
+
/**
|
205
|
+
* Follow / subscribe to a community.
|
206
|
+
*
|
207
|
+
* `HTTP.POST /community/follow`
|
208
|
+
*/
|
209
|
+
followCommunity(form) {
|
210
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/community/follow", form);
|
211
|
+
}
|
212
|
+
/**
|
213
|
+
* Block a community.
|
214
|
+
*
|
215
|
+
* `HTTP.POST /community/block`
|
216
|
+
*/
|
217
|
+
blockCommunity(form) {
|
218
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/community/block", form);
|
219
|
+
}
|
220
|
+
/**
|
221
|
+
* Delete a community.
|
222
|
+
*
|
223
|
+
* `HTTP.POST /community/delete`
|
224
|
+
*/
|
225
|
+
deleteCommunity(form) {
|
226
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/community/delete", form);
|
227
|
+
}
|
228
|
+
/**
|
229
|
+
* Hide a community from public / "All" view. Admins only.
|
230
|
+
*
|
231
|
+
* `HTTP.PUT /community/hide`
|
232
|
+
*/
|
233
|
+
hideCommunity(form) {
|
234
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Put, "/community/hide", form);
|
235
|
+
}
|
236
|
+
/**
|
237
|
+
* A moderator remove for a community.
|
238
|
+
*
|
239
|
+
* `HTTP.POST /community/remove`
|
240
|
+
*/
|
241
|
+
removeCommunity(form) {
|
242
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/community/remove", form);
|
243
|
+
}
|
244
|
+
/**
|
245
|
+
* Transfer your community to an existing moderator.
|
246
|
+
*
|
247
|
+
* `HTTP.POST /community/transfer`
|
248
|
+
*/
|
249
|
+
transferCommunity(form) {
|
250
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/community/transfer", form);
|
251
|
+
}
|
252
|
+
/**
|
253
|
+
* Ban a user from a community.
|
254
|
+
*
|
255
|
+
* `HTTP.POST /community/ban_user`
|
256
|
+
*/
|
257
|
+
banFromCommunity(form) {
|
258
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/community/ban_user", form);
|
259
|
+
}
|
260
|
+
/**
|
261
|
+
* Add a moderator to your community.
|
262
|
+
*
|
263
|
+
* `HTTP.POST /community/mod`
|
264
|
+
*/
|
265
|
+
addModToCommunity(form) {
|
266
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/community/mod", form);
|
267
|
+
}
|
268
|
+
/**
|
269
|
+
* Create a post.
|
270
|
+
*
|
271
|
+
* `HTTP.POST /post`
|
272
|
+
*/
|
273
|
+
createPost(form) {
|
274
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/post", form);
|
275
|
+
}
|
276
|
+
/**
|
277
|
+
* Get / fetch a post.
|
278
|
+
*
|
279
|
+
* `HTTP.GET /post`
|
280
|
+
*/
|
281
|
+
getPost(form = {}) {
|
282
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/post", form);
|
283
|
+
}
|
284
|
+
/**
|
285
|
+
* Edit a post.
|
286
|
+
*
|
287
|
+
* `HTTP.PUT /post`
|
288
|
+
*/
|
289
|
+
editPost(form) {
|
290
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Put, "/post", form);
|
291
|
+
}
|
292
|
+
/**
|
293
|
+
* Delete a post.
|
294
|
+
*
|
295
|
+
* `HTTP.POST /post/delete`
|
296
|
+
*/
|
297
|
+
deletePost(form) {
|
298
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/post/delete", form);
|
299
|
+
}
|
300
|
+
/**
|
301
|
+
* A moderator remove for a post.
|
302
|
+
*
|
303
|
+
* `HTTP.POST /post/remove`
|
304
|
+
*/
|
305
|
+
removePost(form) {
|
306
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/post/remove", form);
|
307
|
+
}
|
308
|
+
/**
|
309
|
+
* Mark a post as read.
|
310
|
+
*
|
311
|
+
* `HTTP.POST /post/mark_as_read`
|
312
|
+
*/
|
313
|
+
markPostAsRead(form) {
|
314
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/post/mark_as_read", form);
|
315
|
+
}
|
316
|
+
/**
|
317
|
+
* A moderator can lock a post ( IE disable new comments ).
|
318
|
+
*
|
319
|
+
* `HTTP.POST /post/lock`
|
320
|
+
*/
|
321
|
+
lockPost(form) {
|
322
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/post/lock", form);
|
323
|
+
}
|
324
|
+
/**
|
325
|
+
* A moderator can feature a community post ( IE stick it to the top of a community ).
|
326
|
+
*
|
327
|
+
* `HTTP.POST /post/feature`
|
328
|
+
*/
|
329
|
+
featurePost(form) {
|
330
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/post/feature", form);
|
331
|
+
}
|
332
|
+
/**
|
333
|
+
* Get / fetch posts, with various filters.
|
334
|
+
*
|
335
|
+
* `HTTP.GET /post/list`
|
336
|
+
*/
|
337
|
+
getPosts(form = {}) {
|
338
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/post/list", form);
|
339
|
+
}
|
340
|
+
/**
|
341
|
+
* Like / vote on a post.
|
342
|
+
*
|
343
|
+
* `HTTP.POST /post/like`
|
344
|
+
*/
|
345
|
+
likePost(form) {
|
346
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/post/like", form);
|
347
|
+
}
|
348
|
+
/**
|
349
|
+
* List a post's likes. Admin-only.
|
350
|
+
*
|
351
|
+
* `HTTP.GET /post/like/list`
|
352
|
+
*/
|
353
|
+
listPostLikes(form) {
|
354
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/post/like/list", form);
|
355
|
+
}
|
356
|
+
/**
|
357
|
+
* Save a post.
|
358
|
+
*
|
359
|
+
* `HTTP.PUT /post/save`
|
360
|
+
*/
|
361
|
+
savePost(form) {
|
362
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Put, "/post/save", form);
|
363
|
+
}
|
364
|
+
/**
|
365
|
+
* Report a post.
|
366
|
+
*
|
367
|
+
* `HTTP.POST /post/report`
|
368
|
+
*/
|
369
|
+
createPostReport(form) {
|
370
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/post/report", form);
|
371
|
+
}
|
372
|
+
/**
|
373
|
+
* Resolve a post report. Only a mod can do this.
|
374
|
+
*
|
375
|
+
* `HTTP.PUT /post/report/resolve`
|
376
|
+
*/
|
377
|
+
resolvePostReport(form) {
|
378
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Put, "/post/report/resolve", form);
|
379
|
+
}
|
380
|
+
/**
|
381
|
+
* List post reports.
|
382
|
+
*
|
383
|
+
* `HTTP.GET /post/report/list`
|
384
|
+
*/
|
385
|
+
listPostReports(form) {
|
386
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/post/report/list", form);
|
387
|
+
}
|
388
|
+
/**
|
389
|
+
* Fetch metadata for any given site.
|
390
|
+
*
|
391
|
+
* `HTTP.GET /post/site_metadata`
|
392
|
+
*/
|
393
|
+
getSiteMetadata(form) {
|
394
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/post/site_metadata", form);
|
395
|
+
}
|
396
|
+
/**
|
397
|
+
* Create a comment.
|
398
|
+
*
|
399
|
+
* `HTTP.POST /comment`
|
400
|
+
*/
|
401
|
+
createComment(form) {
|
402
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/comment", form);
|
403
|
+
}
|
404
|
+
/**
|
405
|
+
* Edit a comment.
|
406
|
+
*
|
407
|
+
* `HTTP.PUT /comment`
|
408
|
+
*/
|
409
|
+
editComment(form) {
|
410
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Put, "/comment", form);
|
411
|
+
}
|
412
|
+
/**
|
413
|
+
* Delete a comment.
|
414
|
+
*
|
415
|
+
* `HTTP.POST /comment/delete`
|
416
|
+
*/
|
417
|
+
deleteComment(form) {
|
418
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/comment/delete", form);
|
419
|
+
}
|
420
|
+
/**
|
421
|
+
* A moderator remove for a comment.
|
422
|
+
*
|
423
|
+
* `HTTP.POST /comment/remove`
|
424
|
+
*/
|
425
|
+
removeComment(form) {
|
426
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/comment/remove", form);
|
427
|
+
}
|
428
|
+
/**
|
429
|
+
* Mark a comment as read.
|
430
|
+
*
|
431
|
+
* `HTTP.POST /comment/mark_as_read`
|
432
|
+
*/
|
433
|
+
markCommentReplyAsRead(form) {
|
434
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/comment/mark_as_read", form);
|
435
|
+
}
|
436
|
+
/**
|
437
|
+
* Like / vote on a comment.
|
438
|
+
*
|
439
|
+
* `HTTP.POST /comment/like`
|
440
|
+
*/
|
441
|
+
likeComment(form) {
|
442
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/comment/like", form);
|
443
|
+
}
|
444
|
+
/**
|
445
|
+
* List a comment's likes. Admin-only.
|
446
|
+
*
|
447
|
+
* `HTTP.GET /comment/like/list`
|
448
|
+
*/
|
449
|
+
listCommentLikes(form) {
|
450
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/comment/like/list", form);
|
451
|
+
}
|
452
|
+
/**
|
453
|
+
* Save a comment.
|
454
|
+
*
|
455
|
+
* `HTTP.PUT /comment/save`
|
456
|
+
*/
|
457
|
+
saveComment(form) {
|
458
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Put, "/comment/save", form);
|
459
|
+
}
|
460
|
+
/**
|
461
|
+
* Distinguishes a comment (speak as moderator)
|
462
|
+
*
|
463
|
+
* `HTTP.POST /comment/distinguish`
|
464
|
+
*/
|
465
|
+
distinguishComment(form) {
|
466
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/comment/distinguish", form);
|
467
|
+
}
|
468
|
+
/**
|
469
|
+
* Get / fetch comments.
|
470
|
+
*
|
471
|
+
* `HTTP.GET /comment/list`
|
472
|
+
*/
|
473
|
+
getComments(form = {}) {
|
474
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/comment/list", form);
|
475
|
+
}
|
476
|
+
/**
|
477
|
+
* Get / fetch comment.
|
478
|
+
*
|
479
|
+
* `HTTP.GET /comment`
|
480
|
+
*/
|
481
|
+
getComment(form) {
|
482
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/comment", form);
|
483
|
+
}
|
484
|
+
/**
|
485
|
+
* Report a comment.
|
486
|
+
*
|
487
|
+
* `HTTP.POST /comment/report`
|
488
|
+
*/
|
489
|
+
createCommentReport(form) {
|
490
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/comment/report", form);
|
491
|
+
}
|
492
|
+
/**
|
493
|
+
* Resolve a comment report. Only a mod can do this.
|
494
|
+
*
|
495
|
+
* `HTTP.PUT /comment/report/resolve`
|
496
|
+
*/
|
497
|
+
resolveCommentReport(form) {
|
498
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Put, "/comment/report/resolve", form);
|
499
|
+
}
|
500
|
+
/**
|
501
|
+
* List comment reports.
|
502
|
+
*
|
503
|
+
* `HTTP.GET /comment/report/list`
|
504
|
+
*/
|
505
|
+
listCommentReports(form) {
|
506
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/comment/report/list", form);
|
507
|
+
}
|
508
|
+
/**
|
509
|
+
* Get / fetch private messages.
|
510
|
+
*
|
511
|
+
* `HTTP.GET /private_message/list`
|
512
|
+
*/
|
513
|
+
getPrivateMessages(form) {
|
514
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/private_message/list", form);
|
515
|
+
}
|
516
|
+
/**
|
517
|
+
* Create a private message.
|
518
|
+
*
|
519
|
+
* `HTTP.POST /private_message`
|
520
|
+
*/
|
521
|
+
createPrivateMessage(form) {
|
522
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/private_message", form);
|
523
|
+
}
|
524
|
+
/**
|
525
|
+
* Edit a private message.
|
526
|
+
*
|
527
|
+
* `HTTP.PUT /private_message`
|
528
|
+
*/
|
529
|
+
editPrivateMessage(form) {
|
530
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Put, "/private_message", form);
|
531
|
+
}
|
532
|
+
/**
|
533
|
+
* Delete a private message.
|
534
|
+
*
|
535
|
+
* `HTTP.POST /private_message/delete`
|
536
|
+
*/
|
537
|
+
deletePrivateMessage(form) {
|
538
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/private_message/delete", form);
|
539
|
+
}
|
540
|
+
/**
|
541
|
+
* Mark a private message as read.
|
542
|
+
*
|
543
|
+
* `HTTP.POST /private_message/mark_as_read`
|
544
|
+
*/
|
545
|
+
markPrivateMessageAsRead(form) {
|
546
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/private_message/mark_as_read", form);
|
547
|
+
}
|
548
|
+
/**
|
549
|
+
* Create a report for a private message.
|
550
|
+
*
|
551
|
+
* `HTTP.POST /private_message/report`
|
552
|
+
*/
|
553
|
+
createPrivateMessageReport(form) {
|
554
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/private_message/report", form);
|
555
|
+
}
|
556
|
+
/**
|
557
|
+
* Resolve a report for a private message.
|
558
|
+
*
|
559
|
+
* `HTTP.PUT /private_message/report/resolve`
|
560
|
+
*/
|
561
|
+
resolvePrivateMessageReport(form) {
|
562
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Put, "/private_message/report/resolve", form);
|
563
|
+
}
|
564
|
+
/**
|
565
|
+
* List private message reports.
|
566
|
+
*
|
567
|
+
* `HTTP.GET /private_message/report/list`
|
568
|
+
*/
|
569
|
+
listPrivateMessageReports(form) {
|
570
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/private_message/report/list", form);
|
571
|
+
}
|
572
|
+
/**
|
573
|
+
* Register a new user.
|
574
|
+
*
|
575
|
+
* `HTTP.POST /user/register`
|
576
|
+
*/
|
577
|
+
register(form) {
|
578
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/user/register", form);
|
579
|
+
}
|
580
|
+
/**
|
581
|
+
* Log into lemmy.
|
582
|
+
*
|
583
|
+
* `HTTP.POST /user/login`
|
584
|
+
*/
|
585
|
+
login(form) {
|
586
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/user/login", form);
|
587
|
+
}
|
588
|
+
logout() {
|
589
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/user/logout", {});
|
590
|
+
}
|
591
|
+
/**
|
592
|
+
* Get the details for a person.
|
593
|
+
*
|
594
|
+
* `HTTP.GET /user`
|
595
|
+
*/
|
596
|
+
getPersonDetails(form = {}) {
|
597
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/user", form);
|
598
|
+
}
|
599
|
+
/**
|
600
|
+
* Get mentions for your user.
|
601
|
+
*
|
602
|
+
* `HTTP.GET /user/mention`
|
603
|
+
*/
|
604
|
+
getPersonMentions(form) {
|
605
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/user/mention", form);
|
606
|
+
}
|
607
|
+
/**
|
608
|
+
* Mark a person mention as read.
|
609
|
+
*
|
610
|
+
* `HTTP.POST /user/mention/mark_as_read`
|
611
|
+
*/
|
612
|
+
markPersonMentionAsRead(form) {
|
613
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/user/mention/mark_as_read", form);
|
614
|
+
}
|
615
|
+
/**
|
616
|
+
* Get comment replies.
|
617
|
+
*
|
618
|
+
* `HTTP.GET /user/replies`
|
619
|
+
*/
|
620
|
+
getReplies(form) {
|
621
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/user/replies", form);
|
622
|
+
}
|
623
|
+
/**
|
624
|
+
* Ban a person from your site.
|
625
|
+
*
|
626
|
+
* `HTTP.POST /user/ban`
|
627
|
+
*/
|
628
|
+
banPerson(form) {
|
629
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/user/ban", form);
|
630
|
+
}
|
631
|
+
/**
|
632
|
+
* Get a list of banned users
|
633
|
+
*
|
634
|
+
* `HTTP.GET /user/banned`
|
635
|
+
*/
|
636
|
+
getBannedPersons() {
|
637
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/user/banned", {});
|
638
|
+
}
|
639
|
+
/**
|
640
|
+
* Block a person.
|
641
|
+
*
|
642
|
+
* `HTTP.POST /user/block`
|
643
|
+
*/
|
644
|
+
blockPerson(form) {
|
645
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/user/block", form);
|
646
|
+
}
|
647
|
+
/**
|
648
|
+
* Fetch a Captcha.
|
649
|
+
*
|
650
|
+
* `HTTP.GET /user/get_captcha`
|
651
|
+
*/
|
652
|
+
getCaptcha() {
|
653
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/user/get_captcha", {});
|
654
|
+
}
|
655
|
+
/**
|
656
|
+
* Delete your account.
|
657
|
+
*
|
658
|
+
* `HTTP.POST /user/delete_account`
|
659
|
+
*/
|
660
|
+
deleteAccount(form) {
|
661
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/user/delete_account", form);
|
662
|
+
}
|
663
|
+
/**
|
664
|
+
* Reset your password.
|
665
|
+
*
|
666
|
+
* `HTTP.POST /user/password_reset`
|
667
|
+
*/
|
668
|
+
passwordReset(form) {
|
669
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/user/password_reset", form);
|
670
|
+
}
|
671
|
+
/**
|
672
|
+
* Change your password from an email / token based reset.
|
673
|
+
*
|
674
|
+
* `HTTP.POST /user/password_change`
|
675
|
+
*/
|
676
|
+
passwordChangeAfterReset(form) {
|
677
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/user/password_change", form);
|
678
|
+
}
|
679
|
+
/**
|
680
|
+
* Mark all replies as read.
|
681
|
+
*
|
682
|
+
* `HTTP.POST /user/mark_all_as_read`
|
683
|
+
*/
|
684
|
+
markAllAsRead() {
|
685
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/user/mark_all_as_read", {});
|
686
|
+
}
|
687
|
+
/**
|
688
|
+
* Save your user settings.
|
689
|
+
*
|
690
|
+
* `HTTP.PUT /user/save_user_settings`
|
691
|
+
*/
|
692
|
+
saveUserSettings(form) {
|
693
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Put, "/user/save_user_settings", form);
|
694
|
+
}
|
695
|
+
/**
|
696
|
+
* Change your user password.
|
697
|
+
*
|
698
|
+
* `HTTP.PUT /user/change_password`
|
699
|
+
*/
|
700
|
+
changePassword(form) {
|
701
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Put, "/user/change_password", form);
|
702
|
+
}
|
703
|
+
/**
|
704
|
+
* Get counts for your reports
|
705
|
+
*
|
706
|
+
* `HTTP.GET /user/report_count`
|
707
|
+
*/
|
708
|
+
getReportCount(form) {
|
709
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/user/report_count", form);
|
710
|
+
}
|
711
|
+
/**
|
712
|
+
* Get your unread counts
|
713
|
+
*
|
714
|
+
* `HTTP.GET /user/unread_count`
|
715
|
+
*/
|
716
|
+
getUnreadCount() {
|
717
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/user/unread_count", {});
|
718
|
+
}
|
719
|
+
/**
|
720
|
+
* Verify your email
|
721
|
+
*
|
722
|
+
* `HTTP.POST /user/verify_email`
|
723
|
+
*/
|
724
|
+
verifyEmail(form) {
|
725
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/user/verify_email", form);
|
726
|
+
}
|
727
|
+
/**
|
728
|
+
* Add an admin to your site.
|
729
|
+
*
|
730
|
+
* `HTTP.POST /admin/add`
|
731
|
+
*/
|
732
|
+
addAdmin(form) {
|
733
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/admin/add", form);
|
734
|
+
}
|
735
|
+
/**
|
736
|
+
* Get the unread registration applications count.
|
737
|
+
*
|
738
|
+
* `HTTP.GET /admin/registration_application/count`
|
739
|
+
*/
|
740
|
+
getUnreadRegistrationApplicationCount() {
|
741
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/admin/registration_application/count", {});
|
742
|
+
}
|
743
|
+
/**
|
744
|
+
* List the registration applications.
|
745
|
+
*
|
746
|
+
* `HTTP.GET /admin/registration_application/list`
|
747
|
+
*/
|
748
|
+
listRegistrationApplications(form) {
|
749
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/admin/registration_application/list", form);
|
750
|
+
}
|
751
|
+
/**
|
752
|
+
* Approve a registration application
|
753
|
+
*
|
754
|
+
* `HTTP.PUT /admin/registration_application/approve`
|
755
|
+
*/
|
756
|
+
approveRegistrationApplication(form) {
|
757
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Put, "/admin/registration_application/approve", form);
|
758
|
+
}
|
759
|
+
/**
|
760
|
+
* Purge / Delete a person from the database.
|
761
|
+
*
|
762
|
+
* `HTTP.POST /admin/purge/person`
|
763
|
+
*/
|
764
|
+
purgePerson(form) {
|
765
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/admin/purge/person", form);
|
766
|
+
}
|
767
|
+
/**
|
768
|
+
* Purge / Delete a community from the database.
|
769
|
+
*
|
770
|
+
* `HTTP.POST /admin/purge/community`
|
771
|
+
*/
|
772
|
+
purgeCommunity(form) {
|
773
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/admin/purge/community", form);
|
774
|
+
}
|
775
|
+
/**
|
776
|
+
* Purge / Delete a post from the database.
|
777
|
+
*
|
778
|
+
* `HTTP.POST /admin/purge/post`
|
779
|
+
*/
|
780
|
+
purgePost(form) {
|
781
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/admin/purge/post", form);
|
782
|
+
}
|
783
|
+
/**
|
784
|
+
* Purge / Delete a comment from the database.
|
785
|
+
*
|
786
|
+
* `HTTP.POST /admin/purge/comment`
|
787
|
+
*/
|
788
|
+
purgeComment(form) {
|
789
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/admin/purge/comment", form);
|
790
|
+
}
|
791
|
+
/**
|
792
|
+
* Create a new custom emoji
|
793
|
+
*
|
794
|
+
* `HTTP.POST /custom_emoji`
|
795
|
+
*/
|
796
|
+
createCustomEmoji(form) {
|
797
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/custom_emoji", form);
|
798
|
+
}
|
799
|
+
/**
|
800
|
+
* Edit an existing custom emoji
|
801
|
+
*
|
802
|
+
* `HTTP.PUT /custom_emoji`
|
803
|
+
*/
|
804
|
+
editCustomEmoji(form) {
|
805
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Put, "/custom_emoji", form);
|
806
|
+
}
|
807
|
+
/**
|
808
|
+
* Delete a custom emoji
|
809
|
+
*
|
810
|
+
* `HTTP.Post /custom_emoji/delete`
|
811
|
+
*/
|
812
|
+
deleteCustomEmoji(form) {
|
813
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/custom_emoji/delete", form);
|
814
|
+
}
|
815
|
+
/**
|
816
|
+
* Fetch federated instances.
|
817
|
+
*
|
818
|
+
* `HTTP.Get /federated_instances`
|
819
|
+
*/
|
820
|
+
getFederatedInstances() {
|
821
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Get, "/federated_instances", {});
|
822
|
+
}
|
823
|
+
/**
|
824
|
+
* Block an instance.
|
825
|
+
*
|
826
|
+
* `HTTP.Post /site/block`
|
827
|
+
*/
|
828
|
+
blockInstance(form) {
|
829
|
+
return __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_wrapper).call(this, HttpType.Post, "/site/block", form);
|
830
|
+
}
|
831
|
+
/**
|
832
|
+
* Upload an image to the server.
|
833
|
+
*/
|
834
|
+
uploadImage({ image }) {
|
835
|
+
return __awaiter(this, void 0, void 0, function* () {
|
836
|
+
const formData = createFormData(image);
|
837
|
+
let url = undefined;
|
838
|
+
let delete_url = undefined;
|
839
|
+
const response = yield __classPrivateFieldGet(this, _LemmyHttp_fetchFunction, "f").call(this, __classPrivateFieldGet(this, _LemmyHttp_pictrsUrl, "f"), {
|
840
|
+
method: HttpType.Post,
|
841
|
+
body: formData,
|
842
|
+
headers: __classPrivateFieldGet(this, _LemmyHttp_headers, "f"),
|
843
|
+
});
|
844
|
+
if (response.status === 413) {
|
845
|
+
return { msg: "too_large" };
|
846
|
+
}
|
847
|
+
const responseJson = yield response.json();
|
848
|
+
if (responseJson.msg === "ok") {
|
849
|
+
const { file: hash, delete_token: deleteToken } = responseJson.files[0];
|
850
|
+
delete_url = `${__classPrivateFieldGet(this, _LemmyHttp_pictrsUrl, "f")}/delete/${deleteToken}/${hash}`;
|
851
|
+
url = `${__classPrivateFieldGet(this, _LemmyHttp_pictrsUrl, "f")}/${hash}`;
|
852
|
+
}
|
853
|
+
return Object.assign(Object.assign({}, responseJson), { url,
|
854
|
+
delete_url });
|
855
|
+
});
|
856
|
+
}
|
857
|
+
/**
|
858
|
+
* Delete a pictrs image
|
859
|
+
*/
|
860
|
+
deleteImage({ token, filename }) {
|
861
|
+
return __awaiter(this, void 0, void 0, function* () {
|
862
|
+
const deleteUrl = `${__classPrivateFieldGet(this, _LemmyHttp_pictrsUrl, "f")}/delete/${token}/${filename}`;
|
863
|
+
const response = yield __classPrivateFieldGet(this, _LemmyHttp_fetchFunction, "f").call(this, deleteUrl, {
|
864
|
+
method: HttpType.Get,
|
865
|
+
headers: __classPrivateFieldGet(this, _LemmyHttp_headers, "f"),
|
866
|
+
});
|
867
|
+
return response.status == 204;
|
868
|
+
});
|
869
|
+
}
|
870
|
+
/**
|
871
|
+
* Set the headers (can be used to set the auth header)
|
872
|
+
*/
|
873
|
+
setHeaders(headers) {
|
874
|
+
__classPrivateFieldSet(this, _LemmyHttp_headers, headers, "f");
|
875
|
+
}
|
876
|
+
}
|
877
|
+
exports.LemmyHttp = LemmyHttp;
|
878
|
+
_LemmyHttp_apiUrl = new WeakMap(), _LemmyHttp_headers = new WeakMap(), _LemmyHttp_pictrsUrl = new WeakMap(), _LemmyHttp_fetchFunction = new WeakMap(), _LemmyHttp_instances = new WeakSet(), _LemmyHttp_buildFullUrl = function _LemmyHttp_buildFullUrl(endpoint) {
|
879
|
+
return `${__classPrivateFieldGet(this, _LemmyHttp_apiUrl, "f")}${endpoint}`;
|
880
|
+
}, _LemmyHttp_wrapper = function _LemmyHttp_wrapper(type_, endpoint, form) {
|
881
|
+
var _a;
|
882
|
+
return __awaiter(this, void 0, void 0, function* () {
|
883
|
+
let response;
|
884
|
+
if (type_ === HttpType.Get) {
|
885
|
+
const getUrl = `${__classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_buildFullUrl).call(this, endpoint)}?${encodeGetParams(form)}`;
|
886
|
+
response = yield __classPrivateFieldGet(this, _LemmyHttp_fetchFunction, "f").call(this, getUrl, {
|
887
|
+
method: HttpType.Get,
|
888
|
+
headers: __classPrivateFieldGet(this, _LemmyHttp_headers, "f"),
|
889
|
+
});
|
890
|
+
}
|
891
|
+
else {
|
892
|
+
response = yield __classPrivateFieldGet(this, _LemmyHttp_fetchFunction, "f").call(this, __classPrivateFieldGet(this, _LemmyHttp_instances, "m", _LemmyHttp_buildFullUrl).call(this, endpoint), {
|
893
|
+
method: type_,
|
894
|
+
headers: Object.assign({ "Content-Type": "application/json" }, __classPrivateFieldGet(this, _LemmyHttp_headers, "f")),
|
895
|
+
body: JSON.stringify(form),
|
896
|
+
});
|
897
|
+
}
|
898
|
+
let json = undefined;
|
899
|
+
try {
|
900
|
+
json = yield response.json();
|
901
|
+
}
|
902
|
+
catch (error) {
|
903
|
+
throw new Error(response.statusText);
|
904
|
+
}
|
905
|
+
if (!response.ok) {
|
906
|
+
throw new Error((_a = json["error"]) !== null && _a !== void 0 ? _a : response.statusText);
|
907
|
+
}
|
908
|
+
else {
|
909
|
+
return json;
|
910
|
+
}
|
911
|
+
});
|
912
|
+
};
|
913
|
+
function encodeGetParams(p) {
|
914
|
+
return Object.entries(p)
|
915
|
+
.filter(kv => !!kv[1])
|
916
|
+
.map(kv => kv.map(encodeURIComponent).join("="))
|
917
|
+
.join("&");
|
918
|
+
}
|
919
|
+
function createFormData(image) {
|
920
|
+
let formData = new form_data_1.default();
|
921
|
+
if (image.constructor.name === "File") {
|
922
|
+
formData.append("images[]", image);
|
923
|
+
}
|
924
|
+
else {
|
925
|
+
// The filename doesn't affect the file type or file name that ends up in pictrs
|
926
|
+
formData.append("images[]", image, { filename: "image.jpg" });
|
927
|
+
}
|
928
|
+
return formData;
|
929
|
+
}
|