implement forum search
							parent
							
								
									3ba31a794e
								
							
						
					
					
						commit
						520793ec38
					
				|  | @ -56,4 +56,14 @@ export class ForumModule extends Module { | |||
|             } | ||||
|         ); | ||||
|     } | ||||
| 
 | ||||
|     public async search(query: string) { | ||||
|         return await this.client._call( | ||||
|             TCResponse, | ||||
|             "forum.search", | ||||
|             { | ||||
|                 query, | ||||
|             } | ||||
|         ); | ||||
|     } | ||||
| } | ||||
|  |  | |||
|  | @ -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 { | ||||
|     readonly id: number; | ||||
|     readonly user: string; | ||||
|  | @ -32,3 +42,12 @@ export interface Thread { | |||
|     // TODO: add category
 | ||||
|     //readonly category
 | ||||
| } | ||||
| 
 | ||||
| export interface SearchResult { | ||||
|     readonly id: number; | ||||
|     readonly author: string; | ||||
|     readonly text: string; | ||||
|     readonly time: number; | ||||
|     readonly category: string; | ||||
|     readonly thread: number; | ||||
| } | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue