Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ninjasort/angular-openaura
Angular service to connect to OpenAura API
https://github.com/ninjasort/angular-openaura
Last synced: 1 day ago
JSON representation
Angular service to connect to OpenAura API
- Host: GitHub
- URL: https://github.com/ninjasort/angular-openaura
- Owner: ninjasort
- License: mit
- Created: 2014-11-11T13:31:45.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2015-01-09T15:41:51.000Z (almost 10 years ago)
- Last Synced: 2024-12-09T15:38:43.110Z (20 days ago)
- Language: JavaScript
- Size: 207 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# angular-openaura
Angular Service to connect to [OpenAura API](http://developer.openaura.com/docs/)
## Usage
Install angular-openaura via bower. Use the --save property to save into your bower.json file.
```shell
bower install angular-openaura --save
```Include spotify into your angular module
```javascript
var app = angular.module('app', ['openaura']);
```Configure your API key:
```javascript
app.config(function (OpenAuraProvider) {
OpenAuraProvider.setApiKey('');
});
```Inject OpenAura into a controller to gain access to all the functions available
```javascript
app.controller('MainCtrl', function (OpenAura) {});
```###/source
####getArtistSource - GET /source/artists/{id}
Get all source definitions for an artist by artist id.
```javascript
OpenAura.getArtistSource(id, idType);
```
id - (*Required*) {string} Artist Anchor IDidType - (*Optional*) {string} oa:anchor_id, oa:artist_id, or musicbrainz:gid. Defaults to OpenAura Anchor ID
Example:
```javascript
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.
```javascript
OpenAura.getArtistProviderSource(id, providerId, idType);
```
id - (*Required*) {string} Artist Anchor IDproviderId - (*Required*) {string} OpenAura Provider Id
idType - (*Optional*) {string} oa:anchor_id, oa:artist_id, or musicbrainz:gid. Defaults to OpenAura Anchor ID
Example:
```javascript
OpenAura.getArtistProviderSource('47', '1').then(function (data) {
console.log(data);
});
```####getSource - GET /source/sources/{id}
Get single source definition by source id.
```javascript
OpenAura.getSource(sourceId, idType);
```
sourceId - (*Required*) {string} Object id of sourceidType - (*Optional*) {string} oa:anchor_id, oa:artist_id, or musicbrainz:gid. Defaults to OpenAura Anchor ID
Example:
```javascript
OpenAura.getSource('145').then(function (data) {
console.log(data);
});
```##/classic
####getArtistClassic - GET /classic/artists/{id}
Info Classic for artist by id
```javascript
OpenAura.getArtistClassic(id, idType);
```
id - (*Required*) {string} Artist Anchor IDidType - (*Optional*) {string} oa:anchor_id, oa:artist_id, or musicbrainz:gid. Defaults to OpenAura Anchor ID
Example:
```javascript
OpenAura.getArtistClassic('47').then(function (data) {
console.log(data);
});
```####getArtistParticle - GET /particles/artists/{id}
Get particle collection by artist id
```javascript
OpenAura.getArtistParticle(id, params);
```
id - (*Required*) {string} Artist Anchor IDparams - (*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:
```javascript
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
```javascript
OpenAura.getParticle(id, idType);
```
id - (*Required*) {string} Object id of particleidType - (*Optional*) {string} oa:particle_id. Defaults to OpenAura Particle ID
Example:
```javascript
OpenAura.getParticle('545fd5ec83ba4dfebd12733b').then(function (data) {
console.log(data);
});
```####getSourceParticle - GET /particles/sources/{id}
Get particle collection by source id
```javascript
OpenAura.getSourceParticle(id, idType, options);
```
id - (*Required*) {string} Object id of particleidType - (*Optional*) {string} oa:source_id
options - (*Optional*) {object}
- offset - Offset from beginning of particle list
- limit - Maximum number of particles returnedExample:
```javascript
OpenAura.getSourceParticle('4998742').then(function (data) {
console.log(data);
});
```##/info
####getArtistInfo - GET /info/artists/{id}
Anchor info for artist by id
```javascript
OpenAura.getArtistInfo(id, params);
```
id - (*Required*) {string} Object id of particleparams - (*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 falseExample:
```javascript
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
```javascript
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 timeExample:
```javascript
OpenAura.getArtistDelta({
since_time: '2014-11-02'
}).then(function (data) {
console.log(data);
});
```##/search
####searchArtistParticles - GET /search/artists
Search OA artists with particles
```javascript
OpenAura.searchArtistParticles(q, params);
```
q - (*Required*) {string} Query stringparams - (*Optional*) {object}
- offset - Offset from beginning search results
- limit - Maximum number of search resultsExample:
```javascript
OpenAura.searchArtistParticles('Calvin Harris').then(function (data) {
console.log(data);
});
```####searchAllArtists - GET /search/artists_all
Search all OA artists
```javascript
OpenAura.searchAllArtists(q, params);
```
q - (*Required*) {string} Query stringparams - (*Optional*) {object}
- offset - Offset from beginning search results
- limit - Maximum number of search resultsExample:
```javascript
OpenAura.searchAllArtists('Calvin Harris').then(function (data) {
console.log(data);
});
```