mirror of
https://github.com/LemmyNet/lemmy-js-client.git
synced 2024-11-29 07:41: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,
|
AddModToCommunityResponse,
|
||||||
GetFollowedCommunitiesResponse,
|
GetFollowedCommunitiesResponse,
|
||||||
PasswordResetResponse,
|
PasswordResetResponse,
|
||||||
|
PostJoinForm,
|
||||||
|
PostJoinResponse,
|
||||||
|
CommunityJoinForm,
|
||||||
|
CommunityJoinResponse,
|
||||||
} from './interfaces';
|
} from './interfaces';
|
||||||
|
|
||||||
enum HttpType {
|
enum HttpType {
|
||||||
|
@ -323,6 +327,14 @@ export class LemmyHttp {
|
||||||
return this.wrapper(HttpType.Post, '/user/join', form);
|
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> {
|
async banUser(form: BanUserForm): Promise<BanUserResponse> {
|
||||||
return this.wrapper(HttpType.Post, '/user/ban', form);
|
return this.wrapper(HttpType.Post, '/user/ban', form);
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,6 +57,8 @@ export enum UserOperation {
|
||||||
GetComments,
|
GetComments,
|
||||||
GetSiteConfig,
|
GetSiteConfig,
|
||||||
SaveSiteConfig,
|
SaveSiteConfig,
|
||||||
|
PostJoin,
|
||||||
|
CommunityJoin,
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum SortType {
|
export enum SortType {
|
||||||
|
@ -961,7 +963,25 @@ export interface UserJoinForm {
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface UserJoinResponse {
|
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 =
|
export type MessageType =
|
||||||
|
|
|
@ -53,6 +53,8 @@ import {
|
||||||
GetSiteForm,
|
GetSiteForm,
|
||||||
SiteConfigForm,
|
SiteConfigForm,
|
||||||
MarkAllAsReadForm,
|
MarkAllAsReadForm,
|
||||||
|
PostJoinForm,
|
||||||
|
CommunityJoinForm,
|
||||||
} from './interfaces';
|
} from './interfaces';
|
||||||
|
|
||||||
export class LemmyWebsocket {
|
export class LemmyWebsocket {
|
||||||
|
@ -66,6 +68,14 @@ export class LemmyWebsocket {
|
||||||
return wrapper(UserOperation.UserJoin, form);
|
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) {
|
register(registerForm: RegisterForm) {
|
||||||
return wrapper(UserOperation.Register, registerForm);
|
return wrapper(UserOperation.Register, registerForm);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue