/**************************************************************
	DO NOT MODIFY THIS FILE
	File is create automatically by
	Hivext WSDL2JS XSL Transformation Utility
**************************************************************/

HNamespace.Define("Users", {

	AuthenticationService : HClass.Define("Users.AuthenticationService", { extend : HWebService.Provider, props : {

		construct : function() {},

		ConstructClient : function() {
			var oClient = new this.AuthenticationPortType;
			oClient.oServiceBind = new this.AuthenticationBinding;
			return oClient;
		},

		AuthenticationPort : HClass.Define("AuthenticationPort", { extend : HRest.Client, props : {
			sNamespace : "http://api.hivext.ru/1.0/users/authentication/cross/",
			sLocation : "http://api.hivext.ru/1.0/users/authentication/cross/",
			construct : function() {}
		}}),

		AuthenticationBinding : HClass.Define("AuthenticationBinding", { extend : AuthenticationPort, props : {
			aOperationLocation : {
				Signin : "signin",
				Signout : "signout",
				CheckSign : "checksign",
				ChangeSession : "changesession",
				GetDeviceSignature : "getdevicesignature"
			},

			construct : function() {}

		}}),

		AuthenticationPortType : HClass.Define("AuthenticationPortType", { props : {
			oServiceBind : null,

			construct : function() {},

			SigninInput : {
				appid : "string",
				login : "string",
				password : "string"
			},

			SigninOutput : {
				result : "int",
				error : "string",
				session : "string",
				uid : "int",
				name : "string"				
			},

			SignoutInput : {
				appid : "string",
				session : "string"
			},

			SignoutOutput : {
				result : "int",
				error : "string"
			},

			CheckSignInput : {
				appid : "string",
				session : "string"
			},

			CheckSignOutput : {
				result : "int",
				error : "string",
				uid : "int",
				name : "string"
			},

			ChangeSessionInput : {
				appid : "string",
				session : "string"
			},

			ChangeSessionOutput : {
				result : "int",
				error : "string",
				session : "string"
			},

			GetDeviceSignatureInput : {
				appid : "string"
			},

			GetDeviceSignatureOutput : {
				result : "int",
				error : "string",
				signature : "string"
			},

			ShareSessionInput : {
				appid : "string",
				session : "string",
				targetAppid : "string"
			},

			ShareSessionOutput : {
				result : "int",
				error : "string"
			},

			Signin : function() {
				var oServiceBind = this.oServiceBind;			
				if(!oServiceBind) { throw Error("Method name : Signin : binding not found"); }
				var sUrl = oServiceBind.ConstructUrl("Signin");
				var fnCallback = HWebService.Client.FindCallback(arguments);

				// Construct request.
				sUrl += "?" + oServiceBind.ConstructRequest(arguments, this.SigninInput);	

				// Send request.
				var SigninOutput = this.SigninOutput;
				(new HNet.ScriptRequest()).Get(sUrl, function(oResponse) {
					if(fnCallback) fnCallback(oResponse);
				});
			},

			Signout : function() {
				var oServiceBind = this.oServiceBind;
				if(!oServiceBind) { throw Error("Method name : Signout : binding not found"); }
				var sUrl = oServiceBind.ConstructUrl("Signout");
				var fnCallback = HWebService.Client.FindCallback(arguments);

				// Construct request.
				sUrl += "?" + oServiceBind.ConstructRequest(arguments, this.SignoutInput);

				// Send request.
				var SignoutOutput = this.SignoutOutput;
				(new HNet.ScriptRequest()).Get(sUrl, function(oResponse) {
					if(fnCallback) fnCallback(oResponse);
				});
			},

			CheckSign : function() {
				var oServiceBind = this.oServiceBind;
				if(!oServiceBind) { throw Error("Method name : CheckSign : binding not found"); }
				var sUrl = oServiceBind.ConstructUrl("CheckSign");
				var fnCallback = HWebService.Client.FindCallback(arguments);

				// Construct request.
				sUrl += "?" + oServiceBind.ConstructRequest(arguments, this.CheckSignInput);

				// Send request.
				var CheckSignOutput = this.CheckSignOutput;
				(new HNet.ScriptRequest()).Get(sUrl, function(oResponse) {
					if(fnCallback) fnCallback(oResponse);
				});
			},

			ChangeSession : function() {
				var oServiceBind = this.oServiceBind;
				if(!oServiceBind) { throw Error("Method name : ChangeSession : binding not found"); }
				var sUrl = oServiceBind.ConstructUrl("ChangeSession");
				var fnCallback = HWebService.Client.FindCallback(arguments);

				// Construct request.
				sUrl += "?" + oServiceBind.ConstructRequest(arguments, this.ChangeSessionInput);

				// Send request.
				var ChangeSessionOutput = this.ChangeSessionOutput;
				(new HNet.ScriptRequest()).Get(sUrl, function(oResponse) {
					if(fnCallback) fnCallback(oResponse);
				});
			},

			GetDeviceSignature : function() {
				var oServiceBind = this.oServiceBind;
				if(!oServiceBind) { throw Error("Method name : GetDeviceSignature : binding not found"); }
				var sUrl = oServiceBind.ConstructUrl("GetDeviceSignature");
				var fnCallback = HWebService.Client.FindCallback(arguments);

				// Construct request.
				sUrl += "?" + oServiceBind.ConstructRequest(arguments, this.GetDeviceSignatureInput);

				// Send request.
				var GetDeviceSignatureOutput = this.GetDeviceSignatureOutput;
				(new HNet.ScriptRequest()).Get(sUrl, function(oResponse) {
					if(fnCallback) fnCallback(oResponse);
				});
			},

			ShareSession : function() {
				var oServiceBind = this.oServiceBind;
				if(!oServiceBind) { throw Error("Method name : ShareSession : binding not found"); }
				var sUrl = oServiceBind.ConstructUrl("ShareSession");
				var fnCallback = HWebService.Client.FindCallback(arguments);

				// Construct request.
				sUrl += "?" + oServiceBind.ConstructRequest(arguments, this.ShareSessionInput);

				// Send request.
				var ShareSessionOutput = this.ShareSessionOutput;
				(new HNet.ScriptRequest()).Get(sUrl, function(oResponse) {
					if(fnCallback) fnCallback(oResponse);
				});
			}

		}})

	}})

});

// !!! STATIC LINK !!!
Users.Authentication = (new Users.AuthenticationService).ConstructClient();
// !!! STATIC LINK !!!
