Angular service to connect to OpenAura API
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
dist
example
src
test
.bowerrc
.gitignore
.jshintrc
Gruntfile.js
LICENSE.md
README.md
bower.json
package.json

README.md

angular-openaura

Angular Service to connect to OpenAura API

Usage

Install angular-openaura via bower. Use the --save property to save into your bower.json file.

bower install angular-openaura --save

Include spotify into your angular module

var app = angular.module('app', ['openaura']);

Configure your API key:

app.config(function (OpenAuraProvider) {
  OpenAuraProvider.setApiKey('<API_KEY>');
});

Inject OpenAura into a controller to gain access to all the functions available

app.controller('MainCtrl', function (OpenAura) {

});

###/source ####getArtistSource - GET /source/artists/{id} Get all source definitions for an artist by artist id.

OpenAura.getArtistSource(id, idType);

id - (Required) {string} Artist Anchor ID

idType - (Optional) {string} oa:anchor_id, oa:artist_id, or musicbrainz:gid. Defaults to OpenAura Anchor ID

Example:

OpenAura.getArtistSource('47').then(function (data) {
  console.log(data);
});

####getArtistProviderSource - GET /source/artists/{id}/providers/{pid} Get all source definitions for an artist by artist id and provider id.

OpenAura.getArtistProviderSource(id, providerId, idType);

id - (Required) {string} Artist Anchor ID

providerId - (Required) {string} OpenAura Provider Id

idType - (Optional) {string} oa:anchor_id, oa:artist_id, or musicbrainz:gid. Defaults to OpenAura Anchor ID

Example:

OpenAura.getArtistProviderSource('47', '1').then(function (data) {
  console.log(data);
});

####getSource - GET /source/sources/{id} Get single source definition by source id.

OpenAura.getSource(sourceId, idType);

sourceId - (Required) {string} Object id of source

idType - (Optional) {string} oa:anchor_id, oa:artist_id, or musicbrainz:gid. Defaults to OpenAura Anchor ID

Example:

OpenAura.getSource('145').then(function (data) {
  console.log(data);
});

##/classic ####getArtistClassic - GET /classic/artists/{id} Info Classic for artist by id

OpenAura.getArtistClassic(id, idType);

id - (Required) {string} Artist Anchor ID

idType - (Optional) {string} oa:anchor_id, oa:artist_id, or musicbrainz:gid. Defaults to OpenAura Anchor ID

Example:

OpenAura.getArtistClassic('47').then(function (data) {
  console.log(data);
});

####getArtistParticle - GET /particles/artists/{id} Get particle collection by artist id

OpenAura.getArtistParticle(id, params);

id - (Required) {string} Artist Anchor ID

params - (Optional) {object}

  • offset - Offset from beginning of aura
  • limit - Maximum number of particles returned
  • sort - Sort order for particle list. Defaults to 'date' (date of post descending)

Example:

OpenAura.getArtistParticle('47', {
	offset: 2,
	limit: 1,
	sort: 'date'
}).then(function (data) {
  console.log(data);
});

####getParticle - GET /particles/particle/{id} Get particle collection of a single particle by particle id

OpenAura.getParticle(id, idType);

id - (Required) {string} Object id of particle

idType - (Optional) {string} oa:particle_id. Defaults to OpenAura Particle ID

Example:

OpenAura.getParticle('545fd5ec83ba4dfebd12733b').then(function (data) {
  console.log(data);
});

####getSourceParticle - GET /particles/sources/{id} Get particle collection by source id

OpenAura.getSourceParticle(id, idType, options);

id - (Required) {string} Object id of particle

idType - (Optional) {string} oa:source_id

options - (Optional) {object}

  • offset - Offset from beginning of particle list
  • limit - Maximum number of particles returned

Example:

OpenAura.getSourceParticle('4998742').then(function (data) {
  console.log(data);
});

##/info ####getArtistInfo - GET /info/artists/{id} Anchor info for artist by id

OpenAura.getArtistInfo(id, params);

id - (Required) {string} Object id of particle

params - (Optional) {object}

  • id__type - oa:anchor_id, oa:artist_id, or musicbrainz:gid. Defaults to OpenAura Anchor ID
  • with_sources - true if you want source data included in the info response. Defaults to false

Example:

OpenAura.getArtistInfo('47').then(function (data) {
  console.log(data);
});

##/delta ####getArtistDelta - GET /delta/artist_info Return oa:anchor_ids for artist info objects which have changed since time

OpenAura.getArtistDelta(options);

options - (Optional) {object}

  • since_time - An ISO 8601 formatted time stringDefaults to OpenAura Anchor ID
  • seconds_ago - An integer representing a time interval in seconds taken from the current time

Example:

OpenAura.getArtistDelta({
	since_time: '2014-11-02'
}).then(function (data) {
  console.log(data);
});

##/search ####searchArtistParticles - GET /search/artists Search OA artists with particles

OpenAura.searchArtistParticles(q, params);

q - (Required) {string} Query string

params - (Optional) {object}

  • offset - Offset from beginning search results
  • limit - Maximum number of search results

Example:

OpenAura.searchArtistParticles('Calvin Harris').then(function (data) {
  console.log(data);
});

####searchAllArtists - GET /search/artists_all Search all OA artists

OpenAura.searchAllArtists(q, params);

q - (Required) {string} Query string

params - (Optional) {object}

  • offset - Offset from beginning search results
  • limit - Maximum number of search results

Example:

OpenAura.searchAllArtists('Calvin Harris').then(function (data) {
  console.log(data);
});