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 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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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);
    });