diff --git a/generator/.project b/generator/.project deleted file mode 100644 index 1c2a9dbb826..00000000000 --- a/generator/.project +++ /dev/null @@ -1,28 +0,0 @@ - - - generator - - - - - - org.python.pydev.PyDevBuilder - - - - - org.eclipse.wst.validation.validationbuilder - - - - - org.eclipse.dltk.core.scriptbuilder - - - - - - org.eclipse.php.core.PHPNature - org.python.pydev.pythonNature - - diff --git a/generator/sources/node/KalturaClientBase.js b/generator/sources/node/KalturaClientBase.js deleted file mode 100644 index fa0be09ec1c..00000000000 --- a/generator/sources/node/KalturaClientBase.js +++ /dev/null @@ -1,668 +0,0 @@ -/*jshint quotmark:true*/ -// =================================================================================================== -// _ __ _ _ -// | |/ /__ _| | |_ _ _ _ _ __ _ -// | ' . -// -// @ignore -// =================================================================================================== - -var crypto = require('crypto'); -var http = require('http'); -var path = require('path'); -var url = require('url'); -var fs = require('fs'); - -/** - * Generates a URL-encoded query string from the associative (or indexed) array provided. - * Ported from PHP. - * @param formdata May be an array or object containing properties. - * @param numeric_prefix If numeric indices are used in the base array and this parameter is provided, it will be prepended to the numeric index for elements in the base array only. - * @param arg_separator arg_separator.output is used to separate arguments, unless this parameter is specified, and is then used. - * @return Returns a URL-encoded string. - */ - - -function http_build_query (formdata, numeric_prefix, arg_separator) { - var value, tmp = []; - var _http_build_query_helper = function (key, val, arg_separator) { - var tmp = []; - if (val === true) { - val = "1"; - } else if (val === false) { - val = "0"; - } - if (val !== null && typeof(val) === "object") { - for (var k in val) { - if (val[k] !== null) { - tmp.push(_http_build_query_helper(key + "[" + k + "]", val[k], arg_separator)); - } - } - return tmp.join(arg_separator); - } else if (typeof(val) !== "function") { - return key + "=" + encodeURIComponent(val); - } else { - //throw new Error('There was an error processing for http_build_query().'); - return ""; - } - }; - - if (!arg_separator) { - arg_separator = "&"; - } - for (var key in formdata) { - value = formdata[key]; - if (numeric_prefix && !isNaN(key)) { - key = String(numeric_prefix) + key; - } - tmp.push(_http_build_query_helper(key, value, arg_separator)); - } - return tmp.join(arg_separator); -} - -/** - * Getting the name of the constructor if the constructor hasn't been modified, - * which if it has modified (and is therfor invalid to use), it falls back to using Object.prototype.toString - * to get the class though it won't return the name of the constructor function that created it then. - * If you absolutely need the constructor's name, pass true as the second argument, - * and it will reset the constructor if it has been modified, to get the real constructor. - * @param obj The object to get the constructor of. - * @param forceConstructor preform a deep lookup for the real constructor. - * @return The constructor of the given class. - */ -function getClass(obj, forceConstructor) { - if ( typeof obj == "undefined" ) { return "undefined"; } - if ( obj === null ) { return "null"; } - if ( forceConstructor === true && obj.hasOwnProperty("constructor") ) { delete obj.constructor; } // reset constructor - if ( forceConstructor !== false && !obj.hasOwnProperty("constructor") ) { return obj.constructor.name; } - return Object.prototype.toString.call(obj) - .match(/^\[object\s(.*)\]$/)[1]; -} - -/** - * validate a paramter's value is not null, if not null, add the parameter to the collection. - * @param params the collection of parameters to send in a service action request. - * @param paramName the new parameter name to add. - * @param paramValue the new parameter value to add. - */ -function addIfNotNull(obj, params, paramName, paramValue) -{ - if (paramValue !== null) { - if(paramValue instanceof KalturaObjectBase) { - params[paramName] = toParams(paramValue); - } else { - params[paramName] = paramValue; - } - } -} - -/** - * Serializes new object's parameters. - * @param obj The object who's members to serialize. - * @return a serialized object. - */ -var toParams = module.exports.toParams = function(obj) -{ - var params = {}; - params["objectType"] = getClass(obj); - for(var prop in obj) { - var val = obj[prop]; - addIfNotNull(obj, params, prop, val); - } - return params; -}; - -/** - * Sorts an array by key, maintaining key to data correlations. This is useful mainly for associative arrays. - * @param arr The array to sort. - * @return The sorted array. - */ -function ksort(arr) { - var sArr = []; - var tArr = []; - var n = 0; - for (var i in arr) { - tArr[n++] = i+"|"+arr[i]; - } - tArr = tArr.sort(); - for (var j=0; j 0){ - var crlf = '\r\n'; - var boundary = '---------------------------' + Math.random(); - var delimiter = crlf + '--' + boundary; - var postData = []; - - for ( var key in files) { - var filePath = files[key]; - var fileName = path.basename(filePath); - var data = fs.readFileSync(filePath); - var headers = [ 'Content-Disposition: form-data; name="' + key + '"; filename="' + fileName + '"' + crlf, 'Content-Type: application/octet-stream' + crlf ]; - - postData.push(new Buffer(delimiter + crlf + headers.join('') + crlf)); - postData.push(new Buffer(data)); - } - postData.push(new Buffer(delimiter + '--')); - var multipartBody = Buffer.concat(postData); - - options.headers['Content-Type'] = 'multipart/form-data; boundary=' + boundary; - options.headers['Content-Length'] = multipartBody.length; - - this.sendRequestHelper(options, multipartBody, requestIndex, callCompletedCallback, this.config.timeout); - - } else { - options.headers['Content-Type'] = 'application/x-www-form-urlencoded'; - options.headers['Content-Length'] = Buffer.byteLength(data); - - this.sendRequestHelper(options, data, requestIndex, callCompletedCallback); - } -}; - -/** - * getter for the referenced configuration object. - * @return KalturaConfiguration - */ -KalturaClientBase.prototype.getConfig = function() -{ - return this.config; -}; - -/** - * @param KalturaConfiguration config setter for the referenced configuration object. - */ -KalturaClientBase.prototype.setConfig = function(config){ - this.config = config; - - var logger = config.getLogger(); - if (logger) { - this.setLogger(logger); - } -}; - -/** - * Add parameter to array of parameters that is passed by reference - * @param array params array of parameters to pass to a call. - * @param string paramName the name of the new parameter to add. - * @param string paramValue the value of the new parameter to add. - */ -KalturaClientBase.prototype.addParam = function(params, paramName, paramValue){ - if (paramValue === null) { - return; - } - - // native - if(typeof(paramValue) != "object") { - params[paramName] = paramValue; - return; - } - - var subParamValue, subParamName = null; - - // object - if(isNaN(paramValue.length)){ - if(!paramValue.objectType){ - paramValue = toParams(paramValue); - } - for(subParamName in paramValue) { - subParamValue = paramValue[subParamName]; - this.addParam(params, paramName + ":" + subParamName, subParamValue); - } - return; - } - - // array - if(paramValue.length){ - for(subParamName in paramValue) { - subParamValue = paramValue[subParamName]; - this.addParam(params, paramName + ":" + subParamName, subParamValue); - } - } - else{ - this.addParam(params, paramName + ":-", ""); - } -}; - -/** - * set to true to indicate a multirequest is being defined. - */ -KalturaClientBase.prototype.startMultiRequest = function(){ - this.useMultiRequest = true; -}; - -/** - * execute a multirequest. - */ -KalturaClientBase.prototype.doMultiRequest = function(callback){ - return this.doQueue(callback); -}; - -/** - * indicate if current mode is constructing a multirequest or single requests. - */ -KalturaClientBase.prototype.isMultiRequest = function(){ - return this.useMultiRequest; -}; - -/** - * @param string msg client logging utility. - */ -KalturaClientBase.prototype.log = function(msg){ - if (this.logEnabled) { - this.logger.log(msg); - } -}; - -/** - * @param string msg client logging utility. - */ -KalturaClientBase.prototype.debug = function(msg){ - if (this.debugEnabled) { - this.logger.debug(msg); - } -}; - -/** - * @param string msg client logging utility. - */ -KalturaClientBase.prototype.error = function(msg){ - if (this.logEnabled) { - this.logger.error(msg); - } -}; - -/** - * @param key - name of the header you want to add to the client requests. - * @param value - value of the header you want to add to the client requests - * @param volatile - if true the header will be sent for the next request only, if false will be added to all requests by the client. - */ -KalturaClientBase.prototype.addCustomHeader = function(key, value, volatile) -{ - this.customHeaders[key] = { 'value': value, 'volatile': volatile }; -} - -/** - * @param key - name of the custom header to be removed. - */ -KalturaClientBase.prototype.removeCustomHeader = function(key) -{ - delete this.customHeaders[key]; -} - - -/** - * Abstract base class for all client objects - */ -var KalturaObjectBase = module.exports.KalturaObjectBase = function() {}; - -/** - * Abstract base class for all client services - * Initialize the service keeping reference to the KalturaClient - * @param KalturaClientm client - */ -var KalturaServiceBase = module.exports.KalturaServiceBase = function () {}; - -KalturaServiceBase.prototype.init = function(client){ - this.client = client; -}; -/** - * @param KalturaClient - */ -KalturaServiceBase.prototype.client = null; - -/** - * Constructs new Kaltura configuration object - */ -var KalturaConfiguration = module.exports.KalturaConfiguration = function (){ - this.serviceUrl = "http://www.kaltura.com"; - this.serviceBase = "/api_v3/service"; - this.format = KalturaClientBase.KALTURA_SERVICE_FORMAT_JSON; - this.timeout = 90000; - this.logger = null; -}; - -/** - * Set logger to get kaltura client debug logs. - * @param IKalturaLogger log - */ -KalturaConfiguration.prototype.setLogger = function(logger){ - this.logger = logger; -}; - -/** - * Gets the logger (Internal client use) - * @return IKalturaLogger - */ -KalturaConfiguration.prototype.getLogger = function(){ - return this.logger; -};