0.0.5 • Published 6 years ago

mindbrain v0.0.5

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

Mindbrain API client

Client for the Mindbrain HTTP API

Documentation: https://api.mindbrainmusic.com

Installation

yarn add mindbrain

Usage

Import the Mindbrain client from the mindbrain package, load in your artist name configuration, and you can start using the get() method right away:

import Mindbrain from 'mindbrain'
import config from './package.json'

const mindbrain = new Mindbrain(config)

mindbrain.get('releases').then(releases => console.log(releases))

This will make an HTTP GET request to https://api.mindbrainmusic.com/artists/your-artist-name/releases.json, which retrieves all of the releases for a given artist. The get() method performs an HTTP GET request on the given resource passed in, and returns a Promise object that you can either tack on additional methods to, or use the async / await syntax like so:

import React from 'react'
import Mindbrain from 'mindbrain'

class App extends React.Component {
  this.mindbrain = new Mindbrain({ name: 'wonderbars' })

  async componentWillMount() {
    let releases = await this.mindbrain.get('releases')
    this.setState({ releases })
  }

  // ...
}
0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago