mindbrain

0.0.5 • Public • Published

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 })
  }
 
  // ...
}

/mindbrain/

    Package Sidebar

    Install

    npm i mindbrain

    Weekly Downloads

    1

    Version

    0.0.5

    License

    MIT

    Unpacked Size

    60.5 kB

    Total Files

    19

    Last publish

    Collaborators

    • tubbo