discourse-js
Version:
A client-side javascript wrapper for the discourse API.
38 lines (37 loc) • 1 kB
TypeScript
import Discourse from '../index';
import { Post, PostActionType } from '../types/Posts';
export interface CreatePostBody {
[key: string]: any;
}
export interface PostActionBody {
id?: number;
message?: string;
flag_topc?: boolean;
post_action_type_id: PostActionType;
}
export interface IPosts {
create(inputs: CreatePostBody): Promise<Post>;
reply(params: {
topic_id: number;
raw: string;
reply_to_post_number: number;
}): Promise<Post>;
postAction(params: {
method: string;
body: PostActionBody;
id: number | null;
}): Promise<Post>;
like(params: {
id: number;
}): Promise<Post>;
unlike(params: {
id: number;
}): Promise<Post>;
flag(params: {
id: number;
post_action_type_id: number;
message: string;
flag_topic: boolean;
}): Promise<Post>;
}
export default function Posts(discourse: Discourse): void;