Mini Kabibi Habibi
/*! $FileVersion=1.2.229 */ var transport_api_endpoint_fileVersion = "1.2.229";
function CreateAPIEndpointTransport(){function a(){this._url="";this._verb="PUT"}a.prototype=ModuleManager.create("rest_transport");a.prototype.constructor=a;a.prototype._setup=function(){this._url=this._config.url;if(!this._url){logError("APIEndpointTransport:: Initialize failed url not provided");return false}if(this._config.headers){var d=this._config.headers;for(var b in d){this._AddRequestHeader(b,d[b])}}if(this._config.verb){this._verb=this._config.verb}this._createRESTclientPlugin();if(this.GetVersion()&&(this.GetVersion()!="1")&&(this.GetVersion()!="2")){this._usingRESTclientPlugin=true;logInformation("Calling parent class to setup using the restful plugin");this._plugin.SetHttpMode(this._verb);var c=getSystemPlugin();this._plugin.SetAgentName("McAfee Mosaic API V1 transmitter_"+c.CreateGUID());this._plugin.Connect(this._url)}else{this._plugin=null}return true};a.prototype._sendUsingRestClient=function(d){try{var c=this._Send(d);var b=JSON.parse(c);if(!b){logError("APIEndpointTransport::_sendUsingRestClient: Unable to parse result from transmission");return null}return b.statusCode}catch(f){logError("APIEndpointTransport::_sendUsingRestClient: Exception caught with message: "+f.message)}};a.prototype._sendUsingXmlHttp=function(d){var c;try{var f=ModuleManager.create("xmlHttpComObj");if(!f.setup()){logError("APIEndpointTransport::_sendUsingXmlHttp: couldnt create a xmlHttpCom");return null}c=f.getSelectedObjName();logInformation("APIEndpointTransport::_sendUsingXmlHttp: Using "+c);f.open(this._verb,this._url,false);for(var h in this._requestHeaders){f.setRequestHeader(h,this._requestHeaders[h])}f.send(d);var j=f.getResponseHeader("x-amzn-ErrorType");var b=(j==null)||(j=="")?true:false;if(true===b){return"200"}var g="";try{g=f.getAllResponseHeaders();g=g.split("\r").join(" ");g=g.split("\n").join(" ")}catch(i){}this._reportExceptionTelemetry(c,"ResponseHeader:"+g,d);return null}catch(i){logError("APIEndpointTransport::_sendUsingXmlHttp: Using COM obj ("+c+"). Exception caught with message: "+i.message);this._reportExceptionTelemetry(c,"ErrorMsg: "+i.message,d);return null}};a.prototype._sendUsingCommonHttpClient=function(b){try{var c=sendRequestInJSRT(this._url,this._requestHeaders,b);if(c===200){return c}else{logError("APIEndpointTransport::_sendUsingCommonHttpClient: request failed with "+c+"status code");return null}}catch(d){logError("APIEndpointTransport::_sendUsingCommonHttpClient. Exception caught with message: "+d.message);return null}};a.prototype._reportExceptionTelemetry=function(d,c,b){try{}catch(f){logError("APIEndpointTransport::_reportExceptionTelemetry: Exception caught with message"+f.message)}};a.prototype.Send=function(f){try{logDebug("APIEndpointTransport::Send: Sending using uri ("+this._url+")");var c=false;var b=0;if(this._usingRESTclientPlugin){b=this._sendUsingRestClient(f)}else{if(enableAnalyticsSDKForUWP){b=this._sendUsingCommonHttpClient(f)}else{b=this._sendUsingXmlHttp(f)}}logInformation("sendStatusCode: "+b);return b}catch(d){logError("APIEndpointTransport::Send: Exception caught when sending to ("+this._url+") with message: "+d.message);return null}};var a=new a();return a}ModuleManager.registerFactory("transport_api_endpoint",CreateAPIEndpointTransport);
//3F0844FA67F07AC86F750649638FF0D569FC22359F444A47BB1B38F9D93BA9EF559CA73F933315234234E6DB30D1BB06114AFBBED80F5B8D226AC13B4A5273D8++