forums.find()
This method allows you to find an existing forum by ID.
Definition
client.forums.find(id: string,options: ?Object):Promise<Group,Error>
Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | ID of the forum to find |
options | ?Object | Options (described below) |
Options
| Parameter | Type | Description |
|---|---|---|
ignoreNotFound | ?bool | When forum does not exist: If true, return null; if false (default) throw an error |
Returns
An error will be thrown if any of the arguments are invalid.
If the forum is not found, an error will be thrown with err.code equal to client.errors.NotFoundError.code.
If the current user does not have permission to fetch the forum, an error will be thrown with err.code equal to client.errors.PermissionDeniedError.code.
Otherwise, once the returned Promise is resolved, you will have access to the forum, which is a Group object.
Example
try {const forum = await client.forums.find('some-group-id');console.log('found forum:', forum.displayName);if (!forum.hasCurrentUser) {console.log('not a member of that forum but can fetch it');}} catch (err) {if (err.code === client.errors.NotFoundError.code) {console.log('Forum not found');} else if (err.code === client.errors.PermissionDeniedError.code) {console.log('Permission denied');} else {console.log('Error');}}