/** * AI Mastering API * This is a AI Mastering API document. You can use the mastering feature of [AI Mastering](https://aimastering.com) through this API. * * OpenAPI spec version: 1.0.0 * Contact: info@bakuage.com * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * * Swagger Codegen version: 2.3.1 * * Do not edit the class manually. * */ (function(root, factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. define(['ApiClient', 'model/Audio', 'model/AudioAnalysis', 'model/AudioDownloadToken'], factory); } else if (typeof module === 'object' && module.exports) { // CommonJS-like environments that support module.exports, like Node. module.exports = factory(require('../ApiClient'), require('../model/Audio'), require('../model/AudioAnalysis'), require('../model/AudioDownloadToken')); } else { // Browser globals (root is window) if (!root.Aimastering) { root.Aimastering = {}; } root.Aimastering.AudioApi = factory(root.Aimastering.ApiClient, root.Aimastering.Audio, root.Aimastering.AudioAnalysis, root.Aimastering.AudioDownloadToken); } }(this, function(ApiClient, Audio, AudioAnalysis, AudioDownloadToken) { 'use strict'; /** * Audio service. * @module api/AudioApi * @version 1.1.0 */ /** * Constructs a new AudioApi. * @alias module:api/AudioApi * @class * @param {module:ApiClient} [apiClient] Optional API client implementation to use, * default to {@link module:ApiClient#instance} if unspecified. */ var exports = function(apiClient) { this.apiClient = apiClient || ApiClient.instance; /** * Callback function to receive the result of the createAudio operation. * @callback module:api/AudioApi~createAudioCallback * @param {String} error Error message, if any. * @param {module:model/Audio} data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * Create a new audio. * @param {Object} opts Optional parameters * @param {File} opts.file The file to upload. * @param {String} opts.name Audio name. If this is not specified, the name in file parameter is used. * @param {module:api/AudioApi~createAudioCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link module:model/Audio} */ this.createAudio = function(opts, callback) { opts = opts || {}; var postBody = null; var pathParams = { }; var queryParams = { }; var collectionQueryParams = { }; var headerParams = { }; var formParams = { 'file': opts['file'], 'name': opts['name'] }; var authNames = ['bearer']; var contentTypes = ['multipart/form-data']; var accepts = ['application/json']; var returnType = Audio; return this.apiClient.callApi( '/audios', 'POST', pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback ); } /** * Callback function to receive the result of the downloadAudio operation. * @callback module:api/AudioApi~downloadAudioCallback * @param {String} error Error message, if any. * @param {'Blob'} data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * Download an audio data by id. * @param {Number} id Audio id * @param {module:api/AudioApi~downloadAudioCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link 'Blob'} */ this.downloadAudio = function(id, callback) { var postBody = null; // verify the required parameter 'id' is set if (id === undefined || id === null) { throw new Error("Missing the required parameter 'id' when calling downloadAudio"); } var pathParams = { 'id': id }; var queryParams = { }; var collectionQueryParams = { }; var headerParams = { }; var formParams = { }; var authNames = ['bearer']; var contentTypes = []; var accepts = ['application/octet-stream']; var returnType = 'Blob'; return this.apiClient.callApi( '/audios/{id}/download', 'GET', pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback ); } /** * Callback function to receive the result of the downloadAudioByToken operation. * @callback module:api/AudioApi~downloadAudioByTokenCallback * @param {String} error Error message, if any. * @param {'Blob'} data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * Download an audio data by audio_download_token. * @param {String} downloadToken Audio download token * @param {module:api/AudioApi~downloadAudioByTokenCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link 'Blob'} */ this.downloadAudioByToken = function(downloadToken, callback) { var postBody = null; // verify the required parameter 'downloadToken' is set if (downloadToken === undefined || downloadToken === null) { throw new Error("Missing the required parameter 'downloadToken' when calling downloadAudioByToken"); } var pathParams = { }; var queryParams = { 'download_token': downloadToken, }; var collectionQueryParams = { }; var headerParams = { }; var formParams = { }; var authNames = ['bearer']; var contentTypes = []; var accepts = ['application/octet-stream']; var returnType = 'Blob'; return this.apiClient.callApi( '/audios/download_by_token', 'GET', pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback ); } /** * Callback function to receive the result of the getAudio operation. * @callback module:api/AudioApi~getAudioCallback * @param {String} error Error message, if any. * @param {module:model/Audio} data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * Get an audio by id. * @param {Number} id Audio id * @param {module:api/AudioApi~getAudioCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link module:model/Audio} */ this.getAudio = function(id, callback) { var postBody = null; // verify the required parameter 'id' is set if (id === undefined || id === null) { throw new Error("Missing the required parameter 'id' when calling getAudio"); } var pathParams = { 'id': id }; var queryParams = { }; var collectionQueryParams = { }; var headerParams = { }; var formParams = { }; var authNames = ['bearer']; var contentTypes = []; var accepts = ['application/json']; var returnType = Audio; return this.apiClient.callApi( '/audios/{id}', 'GET', pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback ); } /** * Callback function to receive the result of the getAudioAnalysis operation. * @callback module:api/AudioApi~getAudioAnalysisCallback * @param {String} error Error message, if any. * @param {module:model/AudioAnalysis} data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * Get an audio analysis by id. * @param {Number} id Audio id * @param {module:api/AudioApi~getAudioAnalysisCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link module:model/AudioAnalysis} */ this.getAudioAnalysis = function(id, callback) { var postBody = null; // verify the required parameter 'id' is set if (id === undefined || id === null) { throw new Error("Missing the required parameter 'id' when calling getAudioAnalysis"); } var pathParams = { 'id': id }; var queryParams = { }; var collectionQueryParams = { }; var headerParams = { }; var formParams = { }; var authNames = ['bearer']; var contentTypes = []; var accepts = ['application/json']; var returnType = AudioAnalysis; return this.apiClient.callApi( '/audios/{id}/analysis', 'GET', pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback ); } /** * Callback function to receive the result of the getAudioDownloadToken operation. * @callback module:api/AudioApi~getAudioDownloadTokenCallback * @param {String} error Error message, if any. * @param {module:model/AudioDownloadToken} data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * Get an audio download token by id. * @param {Number} id Audio id * @param {module:api/AudioApi~getAudioDownloadTokenCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link module:model/AudioDownloadToken} */ this.getAudioDownloadToken = function(id, callback) { var postBody = null; // verify the required parameter 'id' is set if (id === undefined || id === null) { throw new Error("Missing the required parameter 'id' when calling getAudioDownloadToken"); } var pathParams = { 'id': id }; var queryParams = { }; var collectionQueryParams = { }; var headerParams = { }; var formParams = { }; var authNames = ['bearer']; var contentTypes = []; var accepts = ['application/json']; var returnType = AudioDownloadToken; return this.apiClient.callApi( '/audios/{id}/download_token', 'GET', pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback ); } /** * Callback function to receive the result of the listAudios operation. * @callback module:api/AudioApi~listAudiosCallback * @param {String} error Error message, if any. * @param {Array.} data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * Get all audios accessable. * @param {module:api/AudioApi~listAudiosCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link Array.} */ this.listAudios = function(callback) { var postBody = null; var pathParams = { }; var queryParams = { }; var collectionQueryParams = { }; var headerParams = { }; var formParams = { }; var authNames = ['bearer']; var contentTypes = []; var accepts = ['application/json']; var returnType = [Audio]; return this.apiClient.callApi( '/audios', 'GET', pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback ); } }; return exports; }));