Library
Installation
Browser
<script type="text/javascript" src="path/to/amper-tango.js"></script>
Node
const AmperTango = require('path/to/amper-tango.node');
NOTE: You must install the required dependencies by running npm install
or
yarn install
with the provided package.json
.
Usage
// instantiate
const amper_tango = new AmperTango({
api_key: '<api-key>'
});
Events
// instantiate
const amper_tango = new AmperTango();
// success
amper_tango.on('success', (err, {data, _headers}) => {
// fires on request success
});
// failure
amper_tango.on('failure', (err, {data, _headers}) => {
// fires on request failure
});
Methods
- get_access_tokens()
- get_access_token(access_token_id)
- post_access_token(opts)
- delete_access_token(access_token_id, ETag)
- post_user_access_token(user_id, opts)
- get_entity_band(band_id)
- get_entity_bands()
- get_entity_descriptor(descriptor_id)
- get_entity_descriptors()
- get_entity_hit(hit_id)
- get_entity_hits()
- get_entity_instrument(instrument_id)
- get_entity_instruments()
- get_entity_category(category_id)
- get_entity_categories()
- get_entity_label(label_id)
- get_entity_labels()
- get_entity_tag(tag_id)
- get_entity_tags()
- get_ping()
- get_simple_composition(simple_composition_id)
- post_simple_composition(opts)
- poll_simple_composition(simple_composition_id, opts)
- get_simple_render(simple_render_id)
- post_simple_render(opts)
- poll_simple_render(simple_render_id, opts)
get_access_tokens
Get list of access tokens
get_access_tokens()
Arguments
None
Example
const amper_tango = new AmperTango({
api_key: '...'
});
amper_tango
.get_access_tokens()
.then(({data: access_tokens}) => {
console.log(access_tokens);
})
.catch((err) => {
console.error(err);
});
get_access_token
Get access token
get_access_token(access_token_id)
Arguments
access_token_id
: String, required. Access token ID.
Example
const amper_tango = new AmperTango({
api_key: '...'
});
amper_tango
.get_access_token('1337')
.then(({data: access_token}) => {
console.log(access_token);
})
.catch((err) => {
console.error(err);
});
post_access_token
Post access token
post_access_token(opts)
Arguments
opts
: Object, required. Access token opts.display_name
: String, optional. Access token display name.
Example
const amper_tango = new AmperTango({
api_key: '...'
});
amper_tango
.post_access_token({
display_name: 'Foo'
})
.then(({data: access_token}) => {
console.log(access_token);
})
.catch((err) => {
console.error(err);
});
delete_access_token
Delete access token
delete_access_token(access_token_id, ETag)
Arguments
access_token_id
: String, required. Access token ID.ETag
: String, required. Access token ETag.
Example
const amper_tango = new AmperTango({
api_key: '...'
});
amper_tango
.delete_access_token('1337', 'xxxxx')
.then(({data: status}) => {
console.log(status);
})
.catch((err) => {
console.error(err);
});
post_user_access_token
Post user access token
post_user_access_token(user_id, opts)
Arguments
user_id
: String, required. User ID.opts
: Object, required. Access token opts.display_name
: String, optional. Access token display name.
Example
const amper_tango = new AmperTango({
api_key: '...'
});
amper_tango
.post_user_access_token('1337', {
display_name: 'Foo'
})
.then(({data: access_token}) => {
console.log(access_token);
})
.catch((err) => {
console.error(err);
});
get_entity_band
Get entity band
get_entity_band(band_id, callback)
Arguments
band_id
: String, required. Band ID.
Example
const amper_tango = new AmperTango({
api_key: '...'
});
amper_tango
.get_entity_band('1337')
.then(({data: band}) => {
console.log(band);
})
.catch((err) => {
console.error(err);
});
get_entity_bands
Get list of entity bands
get_entity_bands()
Arguments
None
Example
const amper_tango = new AmperTango({
api_key: '...'
});
amper_tango
.get_entity_bands()
.then(({data: bands}) => {
console.log(bands);
})
.catch((err) => {
console.error(err);
});
get_entity_descriptor
Get entity descriptor
get_entity_descriptor(descriptor_id)
Arguments
descriptor_id
: String, required. Descriptor ID.
Example
const amper_tango = new AmperTango({
api_key: '...'
});
amper_tango
.get_entity_descriptor('1337')
.then(({data: descriptor}) => {
console.log(descriptor);
})
.catch((err) => {
console.error(err);
});
get_entity_descriptors
Get list of entity descriptors
get_entity_descriptors()
Arguments
None
Example
const amper_tango = new AmperTango({
api_key: '...'
});
amper_tango
.get_entity_descriptors()
.then(({data: descriptors}) => {
console.log(descriptors);
})
.catch((err) => {
console.error(err);
});
get_entity_hit
Get entity hit
get_entity_hit(hit_id)
Arguments
hit_id
: String, required. Hit ID.
Example
const amper_tango = new AmperTango({
api_key: '...'
});
amper_tango
.get_entity_hit('1337')
.then(({data: hit}) => {
console.log(hit);
})
.catch((err) => {
console.error(err);
});
get_entity_hits
Get list of entity hits
get_entity_hits()
Arguments
None
Example
const amper_tango = new AmperTango({
api_key: '...'
});
amper_tango
.get_entity_hits()
.then(({data: hits}) => {
console.log(hits);
})
.catch((err) => {
console.error(err);
});
get_entity_instrument
Get entity instrument
get_entity_instrument(instrument_id)
Arguments
instrument_id
: String, required. Instrument ID.
Example
const amper_tango = new AmperTango({
api_key: '...'
});
amper_tango
.get_entity_instrument('1337')
.then(({data: instrument}) => {
console.log(instrument);
})
.catch((err) => {
console.error(err);
});
get_entity_instruments
Get list of entity instruments
get_entity_instruments()
Arguments
None
Example
const amper_tango = new AmperTango({
api_key: '...'
});
amper_tango
.get_entity_instruments()
.then(({data: instruments}) => {
console.log(instruments);
})
.catch((err) => {
console.error(err);
});
get_entity_category
Get entity category
get_entity_category(category_id)
Arguments
category_id
: String, required. Category ID.
Example
const amper_tango = new AmperTango({
api_key: '...'
});
amper_tango
.get_entity_category('1337')
.then(({data: category}) => {
console.log(category);
})
.catch((err) => {
console.error(err);
});
get_entity_categories
Get list of entity categories
get_entity_categories()
Arguments
None
Example
const amper_tango = new AmperTango({
api_key: '...'
});
amper_tango
.get_entity_categories()
.then(({data: categories}) => {
console.log(categories);
})
.catch((err) => {
console.error(err);
});
get_entity_label
Get entity label
get_entity_label(label_id)
Arguments
label_id
: String, required. Label ID.
Example
const amper_tango = new AmperTango({
api_key: '...'
});
amper_tango
.get_entity_label('1337')
.then(({data: label}) => {
console.log(label);
})
.catch((err) => {
console.error(err);
});
get_entity_labels
Get list of entity labels
get_entity_labels()
Arguments
None
Example
const amper_tango = new AmperTango({
api_key: '...'
});
amper_tango
.get_entity_labels()
.then(({data: labels}) => {
console.log(labels);
})
.catch((err) => {
console.error(err);
});
get_entity_tag
Get entity tag
get_entity_tag(tag_id)
Arguments
tag_id
: String, required. Tag ID.
Example
const amper_tango = new AmperTango({
api_key: '...'
});
amper_tango
.get_entity_tag('1337')
.then(({data: tag}) => {
console.log(tag);
})
.catch((err) => {
console.error(err);
});
get_entity_tags
Get list of entity tags
get_entity_tags()
Arguments
None
Example
const amper_tango = new AmperTango({
api_key: '...'
});
amper_tango
.get_entity_tags()
.then(({data: tags}) => {
console.log(tags);
})
.catch((err) => {
console.error(err);
});
get_ping
Get ping
get_ping()
Arguments
None
Example
const amper_tango = new AmperTango({
api_key: '...'
});
amper_tango
.get_ping()
.then(({data: ping}) => {
console.log(ping);
})
.catch((err) => {
console.error(err);
});
get_simple_composition
Get simple composition
get_simple_composition(simple_composition_id)
Arguments
simple_composition_id
: String, required. Simple composition ID.
Example
const amper_tango = new AmperTango({
api_key: '...'
});
amper_tango
.get_simple_composition('1337')
.then(({data: simple_composition}) => {
console.log(simple_composition);
})
.catch((err) => {
console.error(err);
});
post_simple_composition
Post simple composition
post_simple_composition(opts)
Arguments
opts
: String, required. Simple composition opts.timeline
: String, required. Timeline.
Example
const amper_tango = new AmperTango({
api_key: '...'
});
amper_tango
.post_simple_composition({
timeline: {...}
})
.then(({data: simple_composition}) => {
console.log(simple_composition);
})
.catch((err) => {
console.error(err);
});
poll_simple_composition
Poll simple composition
poll_simple_composition(simple_composition_id, opts)
Arguments
simple_composition_id
: String, required. Simple composition ID.opts
: Object, required. Simple composition opts.timeout
: Number, optional. Poll timeout.onPoll
: Function, optional. Poll callback.
Example
const amper_tango = new AmperTango({
api_key: '...'
});
amper_tango
.poll_simple_composition('1337', {
timeout: 1000,
onPoll: ({data: simple_composition}) => {
console.log(simple_composition)
}
})
.then(({data: simple_composition}) => {
console.log(simple_composition);
})
.catch((err) => {
console.error(err);
});
get_simple_render
Get simple render
get_simple_render(simple_render_id, callback)
Arguments
simple_render_id
: String, required. Simple render ID.
Example
const amper_tango = new AmperTango({
api_key: '...'
});
amper_tango
.get_simple_render('1337')
.then(({data: simple_render}) => {
console.log(simple_render);
})
.catch((err) => {
console.error(err);
});
post_simple_render
Post simple render
post_simple_render(opts)
Arguments
opts
: String, required. Simple render opts.timeline
: String, required. Timeline.make_timeline
: Boolean, optional. Should make timeline.preset
: String, required. Preset.attachment_filename
: String, optional. Attachment filename.
Example
const amper_tango = new AmperTango({
api_key: '...'
});
amper_tango
.post_simple_render({
timeline: {...},
preset: 'MASTER_WAV'
})
.then(({data: simple_render}) => {
console.log(simple_render);
})
.catch((err) => {
console.error(err);
});
poll_simple_render
Poll simple render
poll_simple_render(simple_render_id, opts)
Arguments
simple_render_id
: String, required. Simple render ID.opts
: Object, required. Simple render opts.timeout
: Number, optional. Poll timeout.onPoll
: Function, optional. Poll callback.
Example
const amper_tango = new AmperTango({
api_key: '...'
});
amper_tango
.poll_simple_render('1337', {
timeout: 1000,
onPoll: ({data: simple_render}) => {
console.log(simple_render)
}
})
.then(({data: simple_render}) => {
console.log(simple_render);
})
.catch((err) => {
console.error(err);
});