/** * 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/Mastering'], factory); } else if (typeof module === 'object' && module.exports) { // CommonJS-like environments that support module.exports, like Node. module.exports = factory(require('../ApiClient'), require('../model/Mastering')); } else { // Browser globals (root is window) if (!root.Aimastering) { root.Aimastering = {}; } root.Aimastering.MasteringApi = factory(root.Aimastering.ApiClient, root.Aimastering.Mastering); } }(this, function(ApiClient, Mastering) { 'use strict'; /** * Mastering service. * @module api/MasteringApi * @version 1.1.0 */ /** * Constructs a new MasteringApi. * @alias module:api/MasteringApi * @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 cancelMastering operation. * @callback module:api/MasteringApi~cancelMasteringCallback * @param {String} error Error message, if any. * @param {module:model/Mastering} data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * Cancel a mastering by id. * @param {Number} id Mastering id * @param {module:api/MasteringApi~cancelMasteringCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link module:model/Mastering} */ this.cancelMastering = 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 cancelMastering"); } var pathParams = { 'id': id }; var queryParams = { }; var collectionQueryParams = { }; var headerParams = { }; var formParams = { }; var authNames = ['bearer']; var contentTypes = []; var accepts = ['application/json']; var returnType = Mastering; return this.apiClient.callApi( '/masterings/{id}/cancel', 'PUT', pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback ); } /** * Callback function to receive the result of the createMastering operation. * @callback module:api/MasteringApi~createMasteringCallback * @param {String} error Error message, if any. * @param {module:model/Mastering} data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * Create a new mastering. * @param {Number} inputAudioId Input audio id * @param {Object} opts Optional parameters * @param {module:model/String} opts.mode Mode (default to default) * @param {Boolean} opts.bassPreservation This parameter represents if the bass preservation is enabled. (default to false) * @param {Boolean} opts.mastering This parameter represents if the mastering is enabled. This parameter is effective only when the mode is \"default\" or \"custom\". (default to false) * @param {module:model/String} opts.masteringAlgorithm (default to v2) * @param {Boolean} opts.noiseReduction This parameter represents if the nosie reduction is enabled. This parameter is effective only when the mode is \"custom\". (default to false) * @param {module:model/String} opts.preset This parameter is effective only when the mode is \"custom\". (default to general) * @param {Number} opts.targetLoudness This parameter represents the target loudness of the output audio in dB. This parameter is effective only when the mode is \"custom\". (default to -5) * @param {module:model/String} opts.targetLoudnessMode (default to loudness) * @param {Number} opts.masteringMatchingLevel This parameter represents the mastering reference matching level. This parameter is effective only when the mode is \"custom\" and the mastering is enabled. (default to 0.5) * @param {Boolean} opts.masteringReverb This parameter represents if the mastering reverb is enabled. This parameter is effective only when the mode is \"custom\" and the mastering is enabled. (default to false) * @param {Number} opts.masteringReverbGain This parameter represents the mastering reverb gain relative to the dry sound in dB. This parameter is effective only when the mode is \"custom\" and the mastering is \"true\" and the mastering_reverb is \"true\". (default to -36) * @param {Number} opts.referenceAudioId Reference audio id. This parameter is effective only when the mode is \"custom\" and the mastering is enabled. * @param {Number} opts.lowCutFreq This parameter represents the low cut freq of the output audio in Hz. This parameter is effective only when the mode is \"custom\". (default to 20) * @param {Number} opts.highCutFreq This parameter represents the high cut freq of the output audio in Hz. This parameter is effective only when the mode is \"custom\". (default to 20000) * @param {Number} opts.ceiling (default to 0) * @param {module:model/String} opts.ceilingMode (default to 0) * @param {Number} opts.oversample (default to 1) * @param {Number} opts.sampleRate This parameter represents the sample rate of the output audio in dB. This parameter is effective only when the mode is \"custom\". (default to 44100) * @param {Number} opts.bitDepth This parameter represents the bit depth of the output audio in dB. This parameter is effective only when the mode is \"custom\". (default to 16) * @param {module:model/String} opts.outputFormat This parameter represents the format of the output audio. This parameter is effective only when the mode is \"custom\". (default to wav) * @param {Boolean} opts.forPreview If this is true, the mastering is treated for preview purpose (ex. not purchasable, not publishable, short lifetime). (default to false) * @param {Number} opts.startAt Partial mastering start at. (default to 0) * @param {Number} opts.endAt Partial mastering end at. (default to -1) * @param {String} opts.videoTitle This parameter represents the title of output video. (default to ) * @param {module:api/MasteringApi~createMasteringCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link module:model/Mastering} */ this.createMastering = function(inputAudioId, opts, callback) { opts = opts || {}; var postBody = null; // verify the required parameter 'inputAudioId' is set if (inputAudioId === undefined || inputAudioId === null) { throw new Error("Missing the required parameter 'inputAudioId' when calling createMastering"); } var pathParams = { }; var queryParams = { }; var collectionQueryParams = { }; var headerParams = { }; var formParams = { 'mode': opts['mode'], 'input_audio_id': inputAudioId, 'bass_preservation': opts['bassPreservation'], 'mastering': opts['mastering'], 'mastering_algorithm': opts['masteringAlgorithm'], 'noise_reduction': opts['noiseReduction'], 'preset': opts['preset'], 'target_loudness': opts['targetLoudness'], 'target_loudness_mode': opts['targetLoudnessMode'], 'mastering_matching_level': opts['masteringMatchingLevel'], 'mastering_reverb': opts['masteringReverb'], 'mastering_reverb_gain': opts['masteringReverbGain'], 'reference_audio_id': opts['referenceAudioId'], 'low_cut_freq': opts['lowCutFreq'], 'high_cut_freq': opts['highCutFreq'], 'ceiling': opts['ceiling'], 'ceiling_mode': opts['ceilingMode'], 'oversample': opts['oversample'], 'sample_rate': opts['sampleRate'], 'bit_depth': opts['bitDepth'], 'output_format': opts['outputFormat'], 'for_preview': opts['forPreview'], 'start_at': opts['startAt'], 'end_at': opts['endAt'], 'video_title': opts['videoTitle'] }; var authNames = ['bearer']; var contentTypes = ['multipart/form-data']; var accepts = ['application/json']; var returnType = Mastering; return this.apiClient.callApi( '/masterings', 'POST', pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback ); } /** * Callback function to receive the result of the deleteMastering operation. * @callback module:api/MasteringApi~deleteMasteringCallback * @param {String} error Error message, if any. * @param {module:model/Mastering} data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * Delete mastering. * @param {Number} id Mastering id * @param {module:api/MasteringApi~deleteMasteringCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link module:model/Mastering} */ this.deleteMastering = 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 deleteMastering"); } var pathParams = { 'id': id }; var queryParams = { }; var collectionQueryParams = { }; var headerParams = { }; var formParams = { }; var authNames = ['bearer']; var contentTypes = []; var accepts = ['application/json']; var returnType = Mastering; return this.apiClient.callApi( '/masterings/{id}', 'DELETE', pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback ); } /** * Callback function to receive the result of the freeUnlockMastering operation. * @callback module:api/MasteringApi~freeUnlockMasteringCallback * @param {String} error Error message, if any. * @param {module:model/Mastering} data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * Free unlock a mastering by id. * @param {Number} id Mastering id * @param {module:api/MasteringApi~freeUnlockMasteringCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link module:model/Mastering} */ this.freeUnlockMastering = 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 freeUnlockMastering"); } var pathParams = { 'id': id }; var queryParams = { }; var collectionQueryParams = { }; var headerParams = { }; var formParams = { }; var authNames = ['bearer']; var contentTypes = []; var accepts = ['application/json']; var returnType = Mastering; return this.apiClient.callApi( '/masterings/{id}/free_unlock', 'PUT', pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback ); } /** * Callback function to receive the result of the getMastering operation. * @callback module:api/MasteringApi~getMasteringCallback * @param {String} error Error message, if any. * @param {module:model/Mastering} data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * Get a mastering by id. * @param {Number} id Mastering id * @param {module:api/MasteringApi~getMasteringCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link module:model/Mastering} */ this.getMastering = 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 getMastering"); } var pathParams = { 'id': id }; var queryParams = { }; var collectionQueryParams = { }; var headerParams = { }; var formParams = { }; var authNames = ['bearer']; var contentTypes = []; var accepts = ['application/json']; var returnType = Mastering; return this.apiClient.callApi( '/masterings/{id}', 'GET', pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback ); } /** * Callback function to receive the result of the getMasteringUnlockProduct operation. * @callback module:api/MasteringApi~getMasteringUnlockProductCallback * @param {String} error Error message, if any. * @param {module:model/Mastering} data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * Review a mastering by id. * @param {Number} id Mastering id * @param {module:api/MasteringApi~getMasteringUnlockProductCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link module:model/Mastering} */ this.getMasteringUnlockProduct = 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 getMasteringUnlockProduct"); } var pathParams = { 'id': id }; var queryParams = { }; var collectionQueryParams = { }; var headerParams = { }; var formParams = { }; var authNames = ['bearer']; var contentTypes = []; var accepts = ['application/json']; var returnType = Mastering; return this.apiClient.callApi( '/masterings/{id}/unlock_product', 'GET', pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback ); } /** * Callback function to receive the result of the listMasterings operation. * @callback module:api/MasteringApi~listMasteringsCallback * @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 accessable masterings. * @param {module:api/MasteringApi~listMasteringsCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link Array.} */ this.listMasterings = 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 = [Mastering]; return this.apiClient.callApi( '/masterings', 'GET', pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback ); } /** * Callback function to receive the result of the publishMastering operation. * @callback module:api/MasteringApi~publishMasteringCallback * @param {String} error Error message, if any. * @param {module:model/Mastering} data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * Publish a mastering by id. * @param {Number} id Mastering id * @param {String} accessToken This parameter represents if the access token of the publishment service API. * @param {String} message This parameter represents the publishment message. * @param {Object} opts Optional parameters * @param {module:model/String} opts.service This parameter represents the publishment service. * @param {String} opts.accessTokenSecret This parameter represents the access token secret of the publishment service API. This parameter is effective only when the service is \"twitter\". * @param {module:api/MasteringApi~publishMasteringCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link module:model/Mastering} */ this.publishMastering = function(id, accessToken, message, opts, callback) { opts = opts || {}; 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 publishMastering"); } // verify the required parameter 'accessToken' is set if (accessToken === undefined || accessToken === null) { throw new Error("Missing the required parameter 'accessToken' when calling publishMastering"); } // verify the required parameter 'message' is set if (message === undefined || message === null) { throw new Error("Missing the required parameter 'message' when calling publishMastering"); } var pathParams = { 'id': id }; var queryParams = { }; var collectionQueryParams = { }; var headerParams = { }; var formParams = { 'service': opts['service'], 'access_token': accessToken, 'access_token_secret': opts['accessTokenSecret'], 'message': message }; var authNames = ['bearer']; var contentTypes = ['multipart/form-data']; var accepts = ['application/json']; var returnType = Mastering; return this.apiClient.callApi( '/masterings/{id}/publish', 'POST', pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback ); } /** * Callback function to receive the result of the reviewMastering operation. * @callback module:api/MasteringApi~reviewMasteringCallback * @param {String} error Error message, if any. * @param {module:model/Mastering} data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * Review a mastering by id. * @param {Number} id Mastering id * @param {Object} opts Optional parameters * @param {String} opts.reviewComment This parameter represents the review comment. * @param {Number} opts.reviewScore This parameter represents the review score. * @param {module:api/MasteringApi~reviewMasteringCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link module:model/Mastering} */ this.reviewMastering = function(id, opts, callback) { opts = opts || {}; 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 reviewMastering"); } var pathParams = { 'id': id }; var queryParams = { }; var collectionQueryParams = { }; var headerParams = { }; var formParams = { 'review_comment': opts['reviewComment'], 'review_score': opts['reviewScore'] }; var authNames = ['bearer']; var contentTypes = ['multipart/form-data']; var accepts = ['application/json']; var returnType = Mastering; return this.apiClient.callApi( '/masterings/{id}/review', 'PUT', pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback ); } /** * Callback function to receive the result of the updateMastering operation. * @callback module:api/MasteringApi~updateMasteringCallback * @param {String} error Error message, if any. * @param {module:model/Mastering} data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * Update a mastering. * @param {Number} id Mastering id * @param {Object} opts Optional parameters * @param {Boolean} opts.preserved Disable auto delete. * @param {module:api/MasteringApi~updateMasteringCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link module:model/Mastering} */ this.updateMastering = function(id, opts, callback) { opts = opts || {}; 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 updateMastering"); } var pathParams = { 'id': id }; var queryParams = { }; var collectionQueryParams = { }; var headerParams = { }; var formParams = { 'preserved': opts['preserved'] }; var authNames = ['bearer']; var contentTypes = ['multipart/form-data']; var accepts = ['application/json']; var returnType = Mastering; return this.apiClient.callApi( '/masterings/{id}', 'PUT', pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback ); } }; return exports; }));