implement forum search

master
John Montagu, the 4th Earl of Sandvich 2024-05-10 19:18:17 -07:00
parent 3ba31a794e
commit 520793ec38
Signed by: sandvich
GPG Key ID: 9A39BE37E602B22D
2 changed files with 29 additions and 0 deletions

View File

@ -56,4 +56,14 @@ export class ForumModule extends Module {
} }
); );
} }
public async search(query: string) {
return await this.client._call(
TCResponse,
"forum.search",
{
query,
}
);
}
} }

View File

@ -17,6 +17,16 @@ export class ViewPostsResponse extends TCResponse {
} }
} }
export class ForumSearchResponse extends TCResponse {
results: SearchResult[];
public constructor(response: TCResponseRaw) {
super(response);
this.results = response["results"];
}
}
export interface Post { export interface Post {
readonly id: number; readonly id: number;
readonly user: string; readonly user: string;
@ -32,3 +42,12 @@ export interface Thread {
// TODO: add category // TODO: add category
//readonly category //readonly category
} }
export interface SearchResult {
readonly id: number;
readonly author: string;
readonly text: string;
readonly time: number;
readonly category: string;
readonly thread: number;
}