# Aimastering.AudioApi
All URIs are relative to *https://api.bakuage.com:443*
Method | HTTP request | Description
------------- | ------------- | -------------
[**createAudio**](AudioApi.md#createAudio) | **POST** /audios | Create a new audio.
[**downloadAudio**](AudioApi.md#downloadAudio) | **GET** /audios/{id}/download | Download an audio data by id.
[**downloadAudioByToken**](AudioApi.md#downloadAudioByToken) | **GET** /audios/download_by_token | Download an audio data by audio_download_token.
[**getAudio**](AudioApi.md#getAudio) | **GET** /audios/{id} | Get an audio by id.
[**getAudioAnalysis**](AudioApi.md#getAudioAnalysis) | **GET** /audios/{id}/analysis | Get an audio analysis by id.
[**getAudioDownloadToken**](AudioApi.md#getAudioDownloadToken) | **GET** /audios/{id}/download_token | Get an audio download token by id.
[**listAudios**](AudioApi.md#listAudios) | **GET** /audios | Get all audios accessable.
# **createAudio**
> Audio createAudio(opts)
Create a new audio.
### Example
```javascript
var Aimastering = require('aimastering');
var defaultClient = Aimastering.ApiClient.instance;
// Configure API key authorization: bearer
var bearer = defaultClient.authentications['bearer'];
bearer.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//bearer.apiKeyPrefix = 'Token';
var apiInstance = new Aimastering.AudioApi();
var opts = {
'file': "/path/to/file.txt", // File | The file to upload.
'name': "name_example" // String | Audio name. If this is not specified, the name in file parameter is used.
};
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
apiInstance.createAudio(opts, callback);
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**file** | **File**| The file to upload. | [optional]
**name** | **String**| Audio name. If this is not specified, the name in file parameter is used. | [optional]
### Return type
[**Audio**](Audio.md)
### Authorization
[bearer](../README.md#bearer)
### HTTP request headers
- **Content-Type**: multipart/form-data
- **Accept**: application/json
# **downloadAudio**
> 'Blob' downloadAudio(id)
Download an audio data by id.
### Example
```javascript
var Aimastering = require('aimastering');
var defaultClient = Aimastering.ApiClient.instance;
// Configure API key authorization: bearer
var bearer = defaultClient.authentications['bearer'];
bearer.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//bearer.apiKeyPrefix = 'Token';
var apiInstance = new Aimastering.AudioApi();
var id = 56; // Number | Audio id
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
apiInstance.downloadAudio(id, callback);
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**id** | **Number**| Audio id |
### Return type
**'Blob'**
### Authorization
[bearer](../README.md#bearer)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/octet-stream
# **downloadAudioByToken**
> 'Blob' downloadAudioByToken(downloadToken)
Download an audio data by audio_download_token.
### Example
```javascript
var Aimastering = require('aimastering');
var defaultClient = Aimastering.ApiClient.instance;
// Configure API key authorization: bearer
var bearer = defaultClient.authentications['bearer'];
bearer.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//bearer.apiKeyPrefix = 'Token';
var apiInstance = new Aimastering.AudioApi();
var downloadToken = "downloadToken_example"; // String | Audio download token
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
apiInstance.downloadAudioByToken(downloadToken, callback);
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**downloadToken** | **String**| Audio download token |
### Return type
**'Blob'**
### Authorization
[bearer](../README.md#bearer)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/octet-stream
# **getAudio**
> Audio getAudio(id)
Get an audio by id.
### Example
```javascript
var Aimastering = require('aimastering');
var defaultClient = Aimastering.ApiClient.instance;
// Configure API key authorization: bearer
var bearer = defaultClient.authentications['bearer'];
bearer.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//bearer.apiKeyPrefix = 'Token';
var apiInstance = new Aimastering.AudioApi();
var id = 56; // Number | Audio id
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
apiInstance.getAudio(id, callback);
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**id** | **Number**| Audio id |
### Return type
[**Audio**](Audio.md)
### Authorization
[bearer](../README.md#bearer)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
# **getAudioAnalysis**
> AudioAnalysis getAudioAnalysis(id)
Get an audio analysis by id.
### Example
```javascript
var Aimastering = require('aimastering');
var defaultClient = Aimastering.ApiClient.instance;
// Configure API key authorization: bearer
var bearer = defaultClient.authentications['bearer'];
bearer.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//bearer.apiKeyPrefix = 'Token';
var apiInstance = new Aimastering.AudioApi();
var id = 56; // Number | Audio id
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
apiInstance.getAudioAnalysis(id, callback);
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**id** | **Number**| Audio id |
### Return type
[**AudioAnalysis**](AudioAnalysis.md)
### Authorization
[bearer](../README.md#bearer)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
# **getAudioDownloadToken**
> AudioDownloadToken getAudioDownloadToken(id)
Get an audio download token by id.
### Example
```javascript
var Aimastering = require('aimastering');
var defaultClient = Aimastering.ApiClient.instance;
// Configure API key authorization: bearer
var bearer = defaultClient.authentications['bearer'];
bearer.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//bearer.apiKeyPrefix = 'Token';
var apiInstance = new Aimastering.AudioApi();
var id = 56; // Number | Audio id
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
apiInstance.getAudioDownloadToken(id, callback);
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**id** | **Number**| Audio id |
### Return type
[**AudioDownloadToken**](AudioDownloadToken.md)
### Authorization
[bearer](../README.md#bearer)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
# **listAudios**
> [Audio] listAudios()
Get all audios accessable.
### Example
```javascript
var Aimastering = require('aimastering');
var defaultClient = Aimastering.ApiClient.instance;
// Configure API key authorization: bearer
var bearer = defaultClient.authentications['bearer'];
bearer.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//bearer.apiKeyPrefix = 'Token';
var apiInstance = new Aimastering.AudioApi();
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
apiInstance.listAudios(callback);
```
### Parameters
This endpoint does not need any parameter.
### Return type
[**[Audio]**](Audio.md)
### Authorization
[bearer](../README.md#bearer)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json