Get topic
The forum.getTopic method on a Client instance makes a GET request to the forums/topics/{topic} endpoint and returns an object containing the cursor string, posts and the topic itself.
Example
const topic = await api.forum.getTopic(1715676);Parameters
| Parameter | Type | Optional | Description | 
|---|---|---|---|
| topic | number | ID of the topic to get its data and posts from | |
| options | GetTopicOptions | ✓ | 
options.query
| Parameter | Type | Optional | Description | 
|---|---|---|---|
| cursor_string | string | ✓ | Pagination cursor | 
| sort | ‘id_asc’ | ‘id_desc’ | ✓ | Posts sorting | 
| limit | number | ✓ | Max. number of posts to be returned (caps at 50) | 
| start | number | ✓ | First post ID to be returned with sortset toid_asc. This parameter is ignored ifcursor_stringis specified | 
| end | number | ✓ | First post ID to be returned with sortset toid_desc. This parameter is ignored ifcursor_stringis specified | 
Returns
Promise<{
  cursor_string: Cursor;
  posts: (ForumPost & {
    body: ForumPostBody;
  })[];
  topic: ForumTopic;
}>;Types
Possible Exceptions
See the error handling documentation for more information.
- invalid_json_syntax
- network_error
- unexpected_response
Notice that something is missing? Found a typo? Think something's incomplete? Or think that something can be explained better? Feel free to open a pull request or submit an issue on the library's Github repository .