From ebf8eb20c0e5838a4ac564243b2a695e1b9db150 Mon Sep 17 00:00:00 2001 From: Felix Ableitner Date: Tue, 8 Oct 2024 11:03:54 +0200 Subject: [PATCH] Private community --- src/http.ts | 29 +++++++++++++++++++++++++++++ src/index.ts | 6 ++++++ src/types/CommunityVisibility.ts | 2 +- 3 files changed, 36 insertions(+), 1 deletion(-) diff --git a/src/http.ts b/src/http.ts index d76e2f0..cb2abde 100644 --- a/src/http.ts +++ b/src/http.ts @@ -154,6 +154,12 @@ import { ListTaglinesResponse } from "./types/ListTaglinesResponse"; import { ListCustomEmojis } from "./types/ListCustomEmojis"; import { ListCustomEmojisResponse } from "./types/ListCustomEmojisResponse"; import { GetRandomCommunity } from "./types/GetRandomCommunity"; +import { ApproveCommunityPendingFollows } from "./types/ApproveCommunityPendingFollows"; +import { GetCommunityPendingFollowsCount } from "./types/GetCommunityPendingFollowsCount"; +import { GetCommunityPendingFollowsCountResponse } from "./types/GetCommunityPendingFollowsCountResponse"; +import { ListCommunityPendingFollowsResponse } from "./types/ListCommunityPendingFollowsResponse"; +import { ListCommunityPendingFollows } from "./types/ListCommunityPendingFollows"; +import { CommunityId } from "./types/CommunityId"; enum HttpType { Get = "GET", @@ -448,6 +454,29 @@ export class LemmyHttp { ); } + getCommunityPendingFollowsCount(community_id: CommunityId) { + const form: GetCommunityPendingFollowsCount = { community_id }; + return this.#wrapper< + GetCommunityPendingFollowsCount, + GetCommunityPendingFollowsCountResponse + >(HttpType.Get, "/community/pending_follows/count", form); + } + + listCommunityPendingFollows(form: ListCommunityPendingFollows) { + return this.#wrapper< + ListCommunityPendingFollows, + ListCommunityPendingFollowsResponse + >(HttpType.Get, "/community/pending_follows/list", form); + } + + approveCommunityPendingFollow(form: ApproveCommunityPendingFollows) { + return this.#wrapper( + HttpType.Post, + "/community/pending_follows/approve", + form, + ); + } + /** * Block a community. * diff --git a/src/index.ts b/src/index.ts index dc0fbb1..4ee0b3d 100644 --- a/src/index.ts +++ b/src/index.ts @@ -18,6 +18,7 @@ export { AdminPurgePerson } from "./types/AdminPurgePerson"; export { AdminPurgePersonView } from "./types/AdminPurgePersonView"; export { AdminPurgePost } from "./types/AdminPurgePost"; export { AdminPurgePostView } from "./types/AdminPurgePostView"; +export { ApproveCommunityPendingFollows } from "./types/ApproveCommunityPendingFollows"; export { ApproveRegistrationApplication } from "./types/ApproveRegistrationApplication"; export { AuthenticateWithOauth } from "./types/AuthenticateWithOauth"; export { BanFromCommunity } from "./types/BanFromCommunity"; @@ -49,6 +50,7 @@ export { CommentSortType } from "./types/CommentSortType"; export { CommentView } from "./types/CommentView"; export { Community } from "./types/Community"; export { CommunityAggregates } from "./types/CommunityAggregates"; +export { CommunityFollowerState } from "./types/CommunityFollowerState"; export { CommunityFollowerView } from "./types/CommunityFollowerView"; export { CommunityId } from "./types/CommunityId"; export { CommunityModeratorView } from "./types/CommunityModeratorView"; @@ -99,6 +101,8 @@ export { GetComment } from "./types/GetComment"; export { GetComments } from "./types/GetComments"; export { GetCommentsResponse } from "./types/GetCommentsResponse"; export { GetCommunity } from "./types/GetCommunity"; +export { GetCommunityPendingFollowsCount } from "./types/GetCommunityPendingFollowsCount"; +export { GetCommunityPendingFollowsCountResponse } from "./types/GetCommunityPendingFollowsCountResponse"; export { GetCommunityResponse } from "./types/GetCommunityResponse"; export { GetFederatedInstancesResponse } from "./types/GetFederatedInstancesResponse"; export { GetModlog } from "./types/GetModlog"; @@ -139,6 +143,8 @@ export { ListCommentReports } from "./types/ListCommentReports"; export { ListCommentReportsResponse } from "./types/ListCommentReportsResponse"; export { ListCommunities } from "./types/ListCommunities"; export { ListCommunitiesResponse } from "./types/ListCommunitiesResponse"; +export { ListCommunityPendingFollows } from "./types/ListCommunityPendingFollows"; +export { ListCommunityPendingFollowsResponse } from "./types/ListCommunityPendingFollowsResponse"; export { ListCustomEmojis } from "./types/ListCustomEmojis"; export { ListCustomEmojisResponse } from "./types/ListCustomEmojisResponse"; export { ListLoginsResponse } from "./types/ListLoginsResponse"; diff --git a/src/types/CommunityVisibility.ts b/src/types/CommunityVisibility.ts index f899643..f6591ce 100644 --- a/src/types/CommunityVisibility.ts +++ b/src/types/CommunityVisibility.ts @@ -1,3 +1,3 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type CommunityVisibility = "Public" | "LocalOnly"; +export type CommunityVisibility = "Public" | "LocalOnly" | "Private";