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

ParameterTypeOptionalDescription
topicnumberID of the topic to get its data and posts from
optionsGetTopicOptions

options.query

ParameterTypeOptionalDescription
cursor_stringstringPagination cursor
sort‘id_asc’ | ‘id_desc’Posts sorting
limitnumberMax. number of posts to be returned (caps at 50)
startnumberFirst post ID to be returned with sort set to id_asc. This parameter is ignored if cursor_string is specified
endnumberFirst post ID to be returned with sort set to id_desc. This parameter is ignored if cursor_string is 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 .