Adding hide post.

This commit is contained in:
Dessalines 2024-02-29 10:13:22 -05:00
parent 902ddf6ac8
commit 57332bad99
7 changed files with 26 additions and 2 deletions

View file

@ -138,6 +138,7 @@ import { ListPostLikes } from "./types/ListPostLikes";
import { ListPostLikesResponse } from "./types/ListPostLikesResponse";
import { ListCommentLikes } from "./types/ListCommentLikes";
import { ListCommentLikesResponse } from "./types/ListCommentLikesResponse";
import { HidePost } from "./types/HidePost";
enum HttpType {
Get = "GET",
@ -567,6 +568,19 @@ export class LemmyHttp {
);
}
/**
* Hide a post from list views.
*
* `HTTP.POST /post/hide`
*/
hidePost(form: HidePost) {
return this.#wrapper<HidePost, SuccessResponse>(
HttpType.Post,
"/post/hide",
form,
);
}
/**
* A moderator can lock a post ( IE disable new comments ).
*

View file

@ -110,6 +110,7 @@ export { GetSiteResponse } from "./types/GetSiteResponse";
export { GetUnreadCountResponse } from "./types/GetUnreadCountResponse";
export { GetUnreadRegistrationApplicationCountResponse } from "./types/GetUnreadRegistrationApplicationCountResponse";
export { HideCommunity } from "./types/HideCommunity";
export { HidePost } from "./types/HidePost";
export { Instance } from "./types/Instance";
export { InstanceBlockView } from "./types/InstanceBlockView";
export { InstanceId } from "./types/InstanceId";

View file

@ -14,5 +14,6 @@ export interface GetPosts {
saved_only?: boolean;
liked_only?: boolean;
disliked_only?: boolean;
show_hidden?: boolean;
page_cursor?: PaginationCursor;
}

7
src/types/HidePost.ts Normal file
View file

@ -0,0 +1,7 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { PostId } from "./PostId";
export interface HidePost {
post_ids: Array<PostId>;
hide: boolean;
}

View file

@ -112,6 +112,7 @@ export type LemmyErrorType =
| { error: "couldnt_like_post" }
| { error: "couldnt_save_post" }
| { error: "couldnt_mark_post_as_read" }
| { error: "couldnt_hide_post" }
| { error: "couldnt_update_community" }
| { error: "couldnt_update_replies" }
| { error: "couldnt_update_person_mentions" }

View file

@ -2,7 +2,6 @@
import type { PostId } from "./PostId";
export interface MarkPostAsRead {
post_id?: PostId;
post_ids?: Array<PostId>;
post_ids: Array<PostId>;
read: boolean;
}

View file

@ -16,6 +16,7 @@ export interface PostView {
subscribed: SubscribedType;
saved: boolean;
read: boolean;
hidden: boolean;
creator_blocked: boolean;
my_vote?: number;
unread_comments: /* integer */ number;