Class

Tusk

Tusk(config)

Tusk class for interacting with the Mastodon API.

Constructor

# new Tusk(config)

Create a new Tusk instance.

Create a new Tusk instance.

Parameters:
Name Type Description
config Object

Configuration object.

View Source mastodon.js, line 11

Methods

# async delete(path, params) → {Promise.<Object>}

Make a DELETE request to the Mastodon API.

Make a DELETE request to the Mastodon API.

Parameters:
Name Type Description
path string

API endpoint path.

params Object

Request parameters.

View Source mastodon.js, line 69

  • The API response.
Promise.<Object>

# formEncodeParams(params) → {string}

URL-encode request parameters.

URL-encode request parameters.

Parameters:
Name Type Description
params Object

Request parameters.

View Source mastodon.js, line 202

  • URL-encoded parameters.
string

# async get(path, params) → {Promise.<Object>}

Make a GET request to the Mastodon API.

Make a GET request to the Mastodon API.

Parameters:
Name Type Description
path string

API endpoint path.

params Object

Request parameters.

View Source mastodon.js, line 39

  • The API response.
Promise.<Object>

# getAuth() → {Object}

Get the client's authentication tokens.

Get the client's authentication tokens.

View Source mastodon.js, line 93

  • The authentication tokens.
Object

# async patch(path, params) → {Promise.<Object>}

Make a PATCH request to the Mastodon API.

Make a PATCH request to the Mastodon API.

Parameters:
Name Type Description
path string

API endpoint path.

params Object

Request parameters.

View Source mastodon.js, line 59

  • The API response.
Promise.<Object>

# async post(path, params) → {Promise.<Object>}

Make a POST request to the Mastodon API.

Make a POST request to the Mastodon API.

Parameters:
Name Type Description
path string

API endpoint path.

params Object

Request parameters.

View Source mastodon.js, line 49

  • The API response.
Promise.<Object>

# async put(path, params) → {Promise.<Object>}

Make a PUT request to the Mastodon API.

Make a PUT request to the Mastodon API.

Parameters:
Name Type Description
path string

API endpoint path.

params Object

Request parameters.

View Source mastodon.js, line 29

  • The API response.
Promise.<Object>

# async request(method, path, params) → {Promise.<Object>}

Make a request to the Mastodon API.

Make a request to the Mastodon API.

Parameters:
Name Type Description
method string

HTTP method.

path string

API endpoint path.

params Object

Request parameters.

View Source mastodon.js, line 80

  • The API response.
Promise.<Object>

# setAuth(tokens)

Update the client's authentication tokens.

Update the client's authentication tokens.

Parameters:
Name Type Description
tokens Object

The new authentication tokens.

View Source mastodon.js, line 103