Adding GetSiteMetadata

This commit is contained in:
Dessalines 2021-08-17 20:24:00 -04:00
parent 768d930592
commit 73d8664902
4 changed files with 30 additions and 0 deletions

View file

@ -39,6 +39,8 @@ import {
GetPostResponse,
GetPosts,
GetPostsResponse,
GetSiteMetadata,
GetSiteMetadataResponse,
LockPost,
PostResponse,
RemovePost,
@ -238,6 +240,12 @@ export class LemmyHttp {
return this.wrapper(HttpType.Put, '/post/save', form);
}
async getSiteMetadata(
form: GetSiteMetadata
): Promise<GetSiteMetadataResponse> {
return this.wrapper(HttpType.Get, '/post/site_metadata', form);
}
async createComment(form: CreateComment): Promise<CommentResponse> {
return this.wrapper(HttpType.Post, '/comment', form);
}

View file

@ -1,3 +1,4 @@
import { SiteMetadata } from '..';
import {
CommunityView,
CommentView,
@ -141,3 +142,11 @@ export interface ListPostReports {
export interface ListPostReportsResponse {
posts: PostReportView[];
}
export interface GetSiteMetadata {
url: string;
}
export interface GetSiteMetadataResponse {
metadata: SiteMetadata;
}

View file

@ -64,6 +64,7 @@ export enum UserOperation {
PostJoin,
CommunityJoin,
ChangePassword,
GetSiteMetadata,
}
export enum SortType {
@ -106,3 +107,10 @@ export interface WebSocketJsonResponse<ResponseType> {
error?: string;
reconnect?: boolean;
}
export interface SiteMetadata {
title?: string;
description?: string;
image?: string;
html?: string;
}

View file

@ -28,6 +28,7 @@ import {
EditPost,
GetPost,
GetPosts,
GetSiteMetadata,
LockPost,
RemovePost,
SavePost,
@ -201,6 +202,10 @@ export class LemmyWebsocket {
return wrapper(UserOperation.SavePost, form);
}
getSiteMetadata(form: GetSiteMetadata) {
return wrapper(UserOperation.GetSiteMetadata, form);
}
banFromCommunity(form: BanFromCommunity) {
return wrapper(UserOperation.BanFromCommunity, form);
}