How to use the urijs.buildQuery function in urijs

To help you get started, we’ve selected a few urijs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github epsil / spotgen / lib / spotify.js View on Github external
SpotifyWebApi.prototype.getArtistAlbums = function (id, opts) {
  var uri = 'https://api.spotify.com/v1/artists/'
  uri += encodeURIComponent(id) + '/albums'
  opts = opts || {}
  opts.limit = opts.limit || 50
  uri += '?' + URI.buildQuery(opts)
  return this.request(uri).then(function (response) {
    if (response &&
        response.items) {
      return Promise.resolve({body: response})
    } else {
      return Promise.reject(response)
    }
  })
}
github epsil / spotgen / lib / spotify.js View on Github external
SpotifyWebApi.prototype.getPlaylistTracks = function (owner, id, opts) {
  var uri = 'https://api.spotify.com/v1/users/' +
      encodeURIComponent(owner) +
      '/playlists/' +
      encodeURIComponent(id) +
      '/tracks'
  opts = opts || {}
  opts = URI.buildQuery(opts)
  if (opts) {
    uri += '?' + opts
  }
  return this.request(uri).then(function (response) {
    if (response &&
        response.items) {
      return Promise.resolve({body: response})
    } else {
      return Promise.reject(response)
    }
  })
}