mirror of
https://github.com/LemmyNet/lemmy-js-client.git
synced 2024-11-25 13:51:12 +00:00
Adding post and community join.
This commit is contained in:
parent
47cc65ad69
commit
e40a2e9d69
3 changed files with 43 additions and 1 deletions
12
src/http.ts
12
src/http.ts
|
@ -82,6 +82,10 @@ import {
|
|||
AddModToCommunityResponse,
|
||||
GetFollowedCommunitiesResponse,
|
||||
PasswordResetResponse,
|
||||
PostJoinForm,
|
||||
PostJoinResponse,
|
||||
CommunityJoinForm,
|
||||
CommunityJoinResponse,
|
||||
} from './interfaces';
|
||||
|
||||
enum HttpType {
|
||||
|
@ -323,6 +327,14 @@ export class LemmyHttp {
|
|||
return this.wrapper(HttpType.Post, '/user/join', form);
|
||||
}
|
||||
|
||||
async postJoin(form: PostJoinForm): Promise<PostJoinResponse> {
|
||||
return this.wrapper(HttpType.Post, '/post/join', form);
|
||||
}
|
||||
|
||||
async communityJoin(form: CommunityJoinForm): Promise<CommunityJoinResponse> {
|
||||
return this.wrapper(HttpType.Post, '/community/join', form);
|
||||
}
|
||||
|
||||
async banUser(form: BanUserForm): Promise<BanUserResponse> {
|
||||
return this.wrapper(HttpType.Post, '/user/ban', form);
|
||||
}
|
||||
|
|
|
@ -57,6 +57,8 @@ export enum UserOperation {
|
|||
GetComments,
|
||||
GetSiteConfig,
|
||||
SaveSiteConfig,
|
||||
PostJoin,
|
||||
CommunityJoin,
|
||||
}
|
||||
|
||||
export enum SortType {
|
||||
|
@ -961,7 +963,25 @@ export interface UserJoinForm {
|
|||
}
|
||||
|
||||
export interface UserJoinResponse {
|
||||
user_id: number;
|
||||
joined: boolean;
|
||||
}
|
||||
|
||||
export interface PostJoinForm {
|
||||
post_id: number;
|
||||
auth: string;
|
||||
}
|
||||
|
||||
export interface PostJoinResponse {
|
||||
joined: boolean;
|
||||
}
|
||||
|
||||
export interface CommunityJoinForm {
|
||||
community_id: number;
|
||||
auth: string;
|
||||
}
|
||||
|
||||
export interface CommunityJoinResponse {
|
||||
joined: boolean;
|
||||
}
|
||||
|
||||
export type MessageType =
|
||||
|
|
|
@ -53,6 +53,8 @@ import {
|
|||
GetSiteForm,
|
||||
SiteConfigForm,
|
||||
MarkAllAsReadForm,
|
||||
PostJoinForm,
|
||||
CommunityJoinForm,
|
||||
} from './interfaces';
|
||||
|
||||
export class LemmyWebsocket {
|
||||
|
@ -66,6 +68,14 @@ export class LemmyWebsocket {
|
|||
return wrapper(UserOperation.UserJoin, form);
|
||||
}
|
||||
|
||||
postJoin(form: PostJoinForm): string {
|
||||
return wrapper(UserOperation.PostJoin, form);
|
||||
}
|
||||
|
||||
communityJoin(form: CommunityJoinForm): string {
|
||||
return wrapper(UserOperation.CommunityJoin, form);
|
||||
}
|
||||
|
||||
register(registerForm: RegisterForm) {
|
||||
return wrapper(UserOperation.Register, registerForm);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue