mirror of
https://github.com/LemmyNet/lemmy-js-client.git
synced 2024-11-25 13:51:12 +00:00
Adding hide post. (#243)
Co-authored-by: SleeplessOne1917 <28871516+SleeplessOne1917@users.noreply.github.com>
This commit is contained in:
parent
e24ef22b5a
commit
97a3b59e8a
7 changed files with 26 additions and 2 deletions
14
src/http.ts
14
src/http.ts
|
@ -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 ).
|
||||
*
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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
7
src/types/HidePost.ts
Normal 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;
|
||||
}
|
|
@ -113,6 +113,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" }
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue