linkfire

2.0.0 • Public • Published

linkfire

A simple Node wrapper for Linkfire. Documentation available here.

Installation

npm install --save linkfire
yarn add linkfire # if you're hip 
var link = new Linkfire({ id: keys.id, 'secret': keys.secret })
 
link.get('settings/boards')
    .then((boards) => {
        var board = boards[0].id;
        var url = `campaigns/boards/${board}/links`;
        var options = {
            baseUrl: 'https://open.spotify.com/track/23EfDk0wWDyIAbeefgni89',
            mediaType: 'Music',
            title: 'Awful Sound'
        }
 
        link.post(url, options)
            .then((song) => {
                console.log(song.url) // => https://trmml.lnk.to/1yIQ6p
            })
    })
    .catch((err) => console.error(err))

Documentation

All instance methods are resolvable promises.

new Linkfire(keys)

Represents the Linkfire class constructor

Param Type Description
keys object Object containing id and secret

linkfire.get(path, options)

Authenticates and makes a get request to the provided path

Kind: instance method of Linkfire

Param Type Description
path string The requested endpoint
options object Additional optional query parameters
link.get('settings/boards')
    .then((boards) => {
        console.log(boards);
    })

linkfire.post(path, options)

Authenticates and makes a post request to the provided path

Kind: instance method of Linkfire

Param Type Description
path string The requested endpoint
options object Additional optional query parameters
var board = '2e388c9b-5cfc-4782-addc-012920f91351';
var url = `campaigns/boards/${board}/links`;
var options = {
    baseUrl: 'https://open.spotify.com/track/23EfDk0wWDyIAbeefgni89',
    mediaType: 'Music',
    title: 'Awful Sound'
}
 
link.post(url, options)
    .then((song) => {
        console.log(song);
    })

Contribution

✨ Thanks for contributing! ✨

To make a contribution, fork the repo, add your changes, and submit a pull request. Any type of contributions (ideas, bug fixes, fixing typos, etc.) will be appreciated!

Make sure to test before you submit for a pull request.

git clone https://github.com/trmml/linkfire && cd linkfire
yarn install # installs dependencies
echo "{ "id": "public key", "secret": "secret key" }" > keys.json
ava # test :)

License

LICENSE.

Linkfire's licensing is referenced here.

Readme

Keywords

none

Package Sidebar

Install

npm i linkfire

Weekly Downloads

0

Version

2.0.0

License

MIT

Last publish

Collaborators

  • probablyjosh