mirror of
https://github.com/LemmyNet/lemmy-js-client.git
synced 2024-11-26 22:31:12 +00:00
Private community (#371)
* Private community * 0.20.0-private-community.1 * add missing files * 0.20.0-private-community.2 * update * 0.20.0-private-community.3 * rename * 0.20.0-private-community.4 * change * 0.20.0-private-community.5 * add file * 0.20.0-private-community.6 * update * 0.20.0-private-community.7 * 0.20.0-private-community.8 * lint * 0.20.0-private-community.9 * fix null * Updating types from main. --------- Co-authored-by: Dessalines <tyhou13@gmx.com>
This commit is contained in:
parent
c1545659b2
commit
22fbe7eaeb
13 changed files with 105 additions and 6 deletions
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "lemmy-js-client",
|
||||
"description": "A javascript / typescript client for Lemmy",
|
||||
"version": "0.20.0-alpha.17",
|
||||
"version": "0.20.0-private-community.9",
|
||||
"author": "Dessalines <tyhou13@gmx.com>",
|
||||
"license": "AGPL-3.0",
|
||||
"main": "./dist/index.js",
|
||||
|
|
39
src/http.ts
39
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 { ApproveCommunityPendingFollower } from "./types/ApproveCommunityPendingFollower";
|
||||
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",
|
||||
|
@ -482,6 +488,39 @@ export class LemmyHttp {
|
|||
);
|
||||
}
|
||||
|
||||
getCommunityPendingFollowsCount(
|
||||
community_id: CommunityId,
|
||||
options?: RequestOptions,
|
||||
) {
|
||||
const form: GetCommunityPendingFollowsCount = { community_id };
|
||||
return this.#wrapper<
|
||||
GetCommunityPendingFollowsCount,
|
||||
GetCommunityPendingFollowsCountResponse
|
||||
>(HttpType.Get, "/community/pending_follows/count", form, options);
|
||||
}
|
||||
|
||||
listCommunityPendingFollows(
|
||||
form: ListCommunityPendingFollows,
|
||||
options?: RequestOptions,
|
||||
) {
|
||||
return this.#wrapper<
|
||||
ListCommunityPendingFollows,
|
||||
ListCommunityPendingFollowsResponse
|
||||
>(HttpType.Get, "/community/pending_follows/list", form, options);
|
||||
}
|
||||
|
||||
approveCommunityPendingFollow(
|
||||
form: ApproveCommunityPendingFollower,
|
||||
options?: RequestOptions,
|
||||
) {
|
||||
return this.#wrapper<ApproveCommunityPendingFollower, SuccessResponse>(
|
||||
HttpType.Post,
|
||||
"/community/pending_follows/approve",
|
||||
form,
|
||||
options,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Block a community.
|
||||
*
|
||||
|
|
|
@ -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 { ApproveCommunityPendingFollower } from "./types/ApproveCommunityPendingFollower";
|
||||
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";
|
||||
|
@ -102,6 +104,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";
|
||||
|
@ -142,6 +146,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";
|
||||
|
@ -208,6 +214,7 @@ export { OpenGraphData } from "./types/OpenGraphData";
|
|||
export { PaginationCursor } from "./types/PaginationCursor";
|
||||
export { PasswordChangeAfterReset } from "./types/PasswordChangeAfterReset";
|
||||
export { PasswordReset } from "./types/PasswordReset";
|
||||
export { PendingFollow } from "./types/PendingFollow";
|
||||
export { Person } from "./types/Person";
|
||||
export { PersonAggregates } from "./types/PersonAggregates";
|
||||
export { PersonId } from "./types/PersonId";
|
||||
|
|
9
src/types/ApproveCommunityPendingFollower.ts
Normal file
9
src/types/ApproveCommunityPendingFollower.ts
Normal file
|
@ -0,0 +1,9 @@
|
|||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
import type { CommunityId } from "./CommunityId";
|
||||
import type { PersonId } from "./PersonId";
|
||||
|
||||
export type ApproveCommunityPendingFollower = {
|
||||
community_id: CommunityId;
|
||||
follower_id: PersonId;
|
||||
approve: boolean;
|
||||
};
|
6
src/types/CommunityFollowerState.ts
Normal file
6
src/types/CommunityFollowerState.ts
Normal file
|
@ -0,0 +1,6 @@
|
|||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
|
||||
export type CommunityFollowerState =
|
||||
| "Accepted"
|
||||
| "Pending"
|
||||
| "ApprovalRequired";
|
|
@ -2,7 +2,5 @@
|
|||
|
||||
/**
|
||||
* Defines who can browse and interact with content in a community.
|
||||
*
|
||||
* TODO: Also use this to define private communities
|
||||
*/
|
||||
export type CommunityVisibility = "Public" | "LocalOnly";
|
||||
export type CommunityVisibility = "Public" | "LocalOnly" | "Private";
|
||||
|
|
|
@ -24,4 +24,5 @@ export type FederationError =
|
|||
| "UrlWithoutDomain"
|
||||
| "InboxTimeout"
|
||||
| "CantDeleteSite"
|
||||
| "ObjectIsNotPublic";
|
||||
| "ObjectIsNotPublic"
|
||||
| "ObjectIsNotPrivate";
|
||||
|
|
4
src/types/GetCommunityPendingFollowsCount.ts
Normal file
4
src/types/GetCommunityPendingFollowsCount.ts
Normal file
|
@ -0,0 +1,4 @@
|
|||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
import type { CommunityId } from "./CommunityId";
|
||||
|
||||
export type GetCommunityPendingFollowsCount = { community_id: CommunityId };
|
3
src/types/GetCommunityPendingFollowsCountResponse.ts
Normal file
3
src/types/GetCommunityPendingFollowsCountResponse.ts
Normal file
|
@ -0,0 +1,3 @@
|
|||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
|
||||
export type GetCommunityPendingFollowsCountResponse = { count: number };
|
11
src/types/ListCommunityPendingFollows.ts
Normal file
11
src/types/ListCommunityPendingFollows.ts
Normal file
|
@ -0,0 +1,11 @@
|
|||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
|
||||
export type ListCommunityPendingFollows = {
|
||||
/**
|
||||
* Only shows the unapproved applications
|
||||
*/
|
||||
pending_only?: boolean;
|
||||
all_communities?: boolean;
|
||||
page?: number;
|
||||
limit?: number;
|
||||
};
|
6
src/types/ListCommunityPendingFollowsResponse.ts
Normal file
6
src/types/ListCommunityPendingFollowsResponse.ts
Normal file
|
@ -0,0 +1,6 @@
|
|||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
import type { PendingFollow } from "./PendingFollow";
|
||||
|
||||
export type ListCommunityPendingFollowsResponse = {
|
||||
items: Array<PendingFollow>;
|
||||
};
|
11
src/types/PendingFollow.ts
Normal file
11
src/types/PendingFollow.ts
Normal file
|
@ -0,0 +1,11 @@
|
|||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
import type { Community } from "./Community";
|
||||
import type { Person } from "./Person";
|
||||
import type { SubscribedType } from "./SubscribedType";
|
||||
|
||||
export type PendingFollow = {
|
||||
person: Person;
|
||||
community: Community;
|
||||
is_new_instance: boolean;
|
||||
subscribed: SubscribedType;
|
||||
};
|
|
@ -3,4 +3,8 @@
|
|||
/**
|
||||
* A type / status for a community subscribe.
|
||||
*/
|
||||
export type SubscribedType = "Subscribed" | "NotSubscribed" | "Pending";
|
||||
export type SubscribedType =
|
||||
| "Subscribed"
|
||||
| "NotSubscribed"
|
||||
| "Pending"
|
||||
| "ApprovalRequired";
|
||||
|
|
Loading…
Reference in a new issue