/* Autogenerated with Kurento Idl */
/*
* (C) Copyright 2013-2015 Kurento (https://kurento.openvidu.io/)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var inherits = require('inherits');
var kurentoClient = require('kurento-client');
var disguise = kurentoClient.disguise;
var checkType = kurentoClient.checkType;
var ChecktypeError = checkType.ChecktypeError;
var Transaction = kurentoClient.TransactionsManager.Transaction;
var SessionEndpoint = require('kurento-client-core').abstracts.SessionEndpoint;
function noop(error, result) {
if (error) console.trace(error);
return result
};
/**
* @classdesc
* Endpoint that enables Kurento to work as an HTTP server, allowing peer HTTP
* clients to access media.
*
* @abstract
* @extends module:core/abstracts.SessionEndpoint
*
* @constructor module:elements/abstracts.HttpEndpoint
*/
function HttpEndpoint(){
HttpEndpoint.super_.call(this);
};
inherits(HttpEndpoint, SessionEndpoint);
//
// Public methods
//
/**
* Obtains the URL associated to this endpoint
*
* @alias module:elements/abstracts.HttpEndpoint.getUrl
*
* @param {module:elements/abstracts.HttpEndpoint~getUrlCallback} [callback]
*
* @return {external:Promise}
*/
HttpEndpoint.prototype.getUrl = function(callback){
var transaction = (arguments[0] instanceof Transaction)
? Array.prototype.shift.apply(arguments)
: undefined;
var usePromise = false;
if (callback == undefined) {
usePromise = true;
}
if(!arguments.length) callback = undefined;
callback = (callback || noop).bind(this)
return disguise(this._invoke(transaction, 'getUrl', callback), this)
};
/**
* @callback module:elements/abstracts.HttpEndpoint~getUrlCallback
* @param {external:Error} error
* @param {external:String} result
* The url as a String
*/
/**
* @alias module:elements/abstracts.HttpEndpoint.constructorParams
*/
HttpEndpoint.constructorParams = {
};
/**
* @alias module:elements/abstracts.HttpEndpoint.events
*
* @extends module:core/abstracts.SessionEndpoint.events
*/
HttpEndpoint.events = SessionEndpoint.events;
/**
* Checker for {@link module:elements/abstracts.HttpEndpoint}
*
* @memberof module:elements/abstracts
*
* @param {external:String} key
* @param {module:elements/abstracts.HttpEndpoint} value
*/
function checkHttpEndpoint(key, value)
{
if(!(value instanceof HttpEndpoint))
throw ChecktypeError(key, HttpEndpoint, value);
};
module.exports = HttpEndpoint;
HttpEndpoint.check = checkHttpEndpoint;