Home Reference Source
import Gab from 'gab-api-wrapper/lib/Gab.js'
public class | source

Gab

Constructor Summary

Public Constructor
public

constructor(options: *)

Create a new Gab client.

Member Summary

Public Members
public

options: *

Method Summary

Public Methods
public

Creates a media attachment.

public

createPost(options: *): Promise<object, string>

Create a new post.

public

downvote(postId: *): Promise<object, string>

Downvote a post.

public

follow(userId: *): Promise<object, string>

Follow a user.

public

followers(username: *, before: *): Promise<object, string>

Returns a user's followers. Requires 'read' scope.

public

following(username: *, before: *): Promise<object, string>

Returns a user's followed. Requires 'read' scope.

public

Returns a group's details. Requires the 'read' scope.

public

Returns a group's moderation logs. Requires the 'read' scope.

public

groupUsers(groupId: *, before: *): Promise<object, string>

Returns a group's users. Requires the 'read' scope.

public

mainFeed(before: string): *

public

me(): *

Returns the user's account information. Requires 'read' scope.

public

Returns a user's notifications. Requires 'notifications' scope.

public

Returns the popular feed.

public

Returns popular groups.

public

Returns popular users.

public

Returns a post's details. Requires the 'engage-post' scope.

public

Remove a downvote for a post.

public

Remove a repost.

public

Remove an upvote for a post.

public

repost(postId: *): Promise<object, string>

Repost a post.

public

unfollow(userId: *): Promise<object, string>

Unfollow a user.

public

upvote(postId: *): Promise<object, string>

Upvote a post.

public

user(username: *): Promise<object, string>

Returns a user's profile. Requires 'read' scope.

public

userFeed(username: *, before: *): Promise<object, string>

Returns a user's feed. Requires the 'read' scope.

Public Constructors

public constructor(options: *) source

Create a new Gab client.

Params:

NameTypeAttributeDescription
options *
options.authToken *

User's auth token.

options.stringify *

(Optional) If true, will return stringified JSON.

options.timeout *

(Optional) Specify a custom timeout. Default 5000 milliseconds.

Public Members

public options: * source

Public Methods

public createMediaAttachment(file: *): Promise<object, string> source

Creates a media attachment. Requires the 'write-posts' scope.

Params:

NameTypeAttributeDescription
file *

Return:

Promise<object, string>

public createPost(options: *): Promise<object, string> source

Create a new post.

Params:

NameTypeAttributeDescription
options *
options.media_attachments[] *

Media attachment ID created using createMediaAttachment. Up to four attachments.

options.gif *

Giphy gif ID

options.body *

Post body

options.reply_to *

Id of the post to reply to.

options.is_quote *

1 if you want to create this as a quote.

options.nsfw *

1 if post is NSFW.

options.premium_min_tier *

Used to mark a premium post. Amount, in cents, that user's should pay monthly for this post to be visible.

options.group *

ID of group to post to.

options.topic *

Topic for the post.

options.poll *

1 if you want to add a poll. Requires poll_option_1 and poll_option_2. poll_option_3 and poll_option_4 are optional.

options.poll_option_1 *

Poll option

options.poll_option_2 *

Poll option

options.poll_option_3 *

Poll option

options.poll_option_4 *

Poll option

Return:

Promise<object, string>

public downvote(postId: *): Promise<object, string> source

Downvote a post. Requires the 'engage-post' scope.

Params:

NameTypeAttributeDescription
postId *

Return:

Promise<object, string>

public follow(userId: *): Promise<object, string> source

Follow a user. Requires the 'engage-user' scope.

Params:

NameTypeAttributeDescription
userId *

Return:

Promise<object, string>

public followers(username: *, before: *): Promise<object, string> source

Returns a user's followers. Requires 'read' scope.

Params:

NameTypeAttributeDescription
username *
before *

Return:

Promise<object, string>

public following(username: *, before: *): Promise<object, string> source

Returns a user's followed. Requires 'read' scope.

Params:

NameTypeAttributeDescription
username *
before *

Return:

Promise<object, string>

public groupDetails(groupId: *): Promise<object, string> source

Returns a group's details. Requires the 'read' scope.

Params:

NameTypeAttributeDescription
groupId *

Return:

Promise<object, string>

public groupModerationLogs(groupId: *): Promise<object, string> source

Returns a group's moderation logs. Requires the 'read' scope.

Params:

NameTypeAttributeDescription
groupId *

Return:

Promise<object, string>

public groupUsers(groupId: *, before: *): Promise<object, string> source

Returns a group's users. Requires the 'read' scope.

Params:

NameTypeAttributeDescription
groupId *
before *

Return:

Promise<object, string>

public mainFeed(before: string): * source

Params:

NameTypeAttributeDescription
before string
  • optional
  • default:

Return:

*

public me(): * source

Returns the user's account information. Requires 'read' scope.

Return:

*

public notifications(before: *): Promise<object, string> source

Returns a user's notifications. Requires 'notifications' scope.

Params:

NameTypeAttributeDescription
before *

Return:

Promise<object, string>

public popularFeed(): Promise<object, string> source

Returns the popular feed. Requires the 'read' scope.

Return:

Promise<object, string>

public popularGroups(): Promise<object, string> source

Returns popular groups. Requires the 'read' scope.

Return:

Promise<object, string>

public popularUsers(): Promise<object, string> source

Returns popular users. Requires the 'read' scope.

Return:

Promise<object, string>

public postDetails(postId: *): Promise<object, string> source

Returns a post's details. Requires the 'engage-post' scope.

Params:

NameTypeAttributeDescription
postId *

Return:

Promise<object, string>

public removeDownvote(postId: *): Promise<object, string> source

Remove a downvote for a post. Requires the 'engage-post' scope.

Params:

NameTypeAttributeDescription
postId *

Return:

Promise<object, string>

public removeRepost(postId: *): Promise<object, string> source

Remove a repost. Requires the 'engage-post' scope.

Params:

NameTypeAttributeDescription
postId *

Return:

Promise<object, string>

public removeUpvote(postId: *): Promise<object, string> source

Remove an upvote for a post. Requires the 'engage-post' scope.

Params:

NameTypeAttributeDescription
postId *

Return:

Promise<object, string>

public repost(postId: *): Promise<object, string> source

Repost a post. Requires the 'engage-post' scope.

Params:

NameTypeAttributeDescription
postId *

Return:

Promise<object, string>

public unfollow(userId: *): Promise<object, string> source

Unfollow a user. Requires the 'engage-user' scope.

Params:

NameTypeAttributeDescription
userId *

Return:

Promise<object, string>

public upvote(postId: *): Promise<object, string> source

Upvote a post. Requires the 'engage-post' scope.

Params:

NameTypeAttributeDescription
postId *

Return:

Promise<object, string>

public user(username: *): Promise<object, string> source

Returns a user's profile. Requires 'read' scope.

Params:

NameTypeAttributeDescription
username *

Return:

Promise<object, string>

public userFeed(username: *, before: *): Promise<object, string> source

Returns a user's feed. Requires the 'read' scope.

Params:

NameTypeAttributeDescription
username *
before *

Return:

Promise<object, string>