public void Offline(WebClient agent)
        {
            Dictionary <object, object> parameters = new Dictionary <object, object>
            {
                { CloudServer.PARAM_STATION_ID, this.Id },
                { CloudServer.PARAM_SESSION_TOKEN, this.Token },
                { CloudServer.PARAM_API_KEY, CloudServer.APIKey }
            };

            StationHeartbeatResponse res =
                CloudServer.requestPath <StationHeartbeatResponse>(agent, "stations/offline", parameters);
        }
        public static void SignOff(WebClient agent, string stationId, string sessionToken, string userID)
        {
            Dictionary <object, object> parameters = new Dictionary <object, object>
            {
                { CloudServer.PARAM_STATION_ID, stationId },
                { CloudServer.PARAM_SESSION_TOKEN, sessionToken },
                { CloudServer.PARAM_API_KEY, CloudServer.APIKey },
                { CloudServer.PARAM_USER_ID, userID }
            };

            CloudServer.requestPath <CloudResponse>(agent, "stations/signoff", parameters);
        }
Example #3
0
        public void AttachmentUnsetLoc(WebClient agent, int loc, string object_id)
        {
            Dictionary <object, object> parameters = new Dictionary <object, object>
            {
                { "loc", loc },
                { "object_id", object_id },
                { CloudServer.PARAM_SESSION_TOKEN, this.userToken },
                { CloudServer.PARAM_API_KEY, CloudServer.PARAM_API_KEY }
            };

            CloudServer.requestPath <CloudResponse>(agent, "attachments/unsetloc", parameters);
        }
        public void Heartbeat(WebClient agent, StationDetail detail)
        {
            Dictionary <object, object> parameters = new Dictionary <object, object>
            {
                { CloudServer.PARAM_SESSION_TOKEN, this.Token },
                { CloudServer.PARAM_STATION_ID, this.Id },
                { CloudServer.PARAM_API_KEY, CloudServer.APIKey },
                { CloudServer.PARAM_DETAIL, detail.ToFastJSON() }
            };

            StationHeartbeatResponse res =
                CloudServer.requestPath <StationHeartbeatResponse>(agent, "stations/heartbeat", parameters);
        }
Example #5
0
        public StorageCheckResponse StorageCheck(WebClient agent, string type)
        {
            Dictionary <object, object> parameters = new Dictionary <object, object>
            {
                { "type", type },
                { CloudServer.PARAM_SESSION_TOKEN, this.userToken },
                { CloudServer.PARAM_API_KEY, CloudServer.APIKey }
            };

            StorageCheckResponse res = CloudServer.requestPath <StorageCheckResponse>(agent, "storages/check", parameters);

            return(res);
        }
        public StationLogOnResponse LogOn(WebClient agent, Dictionary <object, object> param)
        {
            Dictionary <object, object> parameters = new Dictionary <object, object>(param);

            parameters.Add(CloudServer.PARAM_SESSION_TOKEN, this.Token);
            parameters.Add(CloudServer.PARAM_STATION_ID, this.Id);
            parameters.Add(CloudServer.PARAM_API_KEY, CloudServer.APIKey);

            StationLogOnResponse res =
                CloudServer.requestPath <StationLogOnResponse>(agent, "stations/logOn", parameters);

            this.Token = res.session_token;

            return(res);
        }
        public static StationLogOnResponse LogOn(WebClient agent, string stationId, string email, string passwd, StationDetail detail)
        {
            Dictionary <object, object> param = new Dictionary <object, object>
            {
                { CloudServer.PARAM_EMAIL, email },
                { CloudServer.PARAM_PASSWORD, passwd },
                { CloudServer.PARAM_STATION_ID, stationId },
                { CloudServer.PARAM_API_KEY, CloudServer.APIKey },
                { CloudServer.PARAM_DETAIL, detail.ToFastJSON() }
            };

            StationLogOnResponse res = CloudServer.requestPath <StationLogOnResponse>(agent, "stations/logOn", param);

            return(res);
        }
        public static StationApi SignUp(WebClient agent, string stationId, string email, string passwd)
        {
            Dictionary <object, object> param = new Dictionary <object, object>
            {
                { CloudServer.PARAM_EMAIL, email },
                { CloudServer.PARAM_PASSWORD, passwd },
                { CloudServer.PARAM_STATION_ID, stationId },
                { CloudServer.PARAM_API_KEY, CloudServer.APIKey }
            };

            StationSignUpResponse res =
                CloudServer.requestPath <StationSignUpResponse>(agent, "stations/signup", param);

            return(new StationApi(stationId, res.session_token));
        }
        public StationLogOnResponse LogOn(WebClient agent, StationDetail detail)
        {
            Dictionary <object, object> parameters = new Dictionary <object, object>
            {
                { CloudServer.PARAM_SESSION_TOKEN, this.Token },
                { CloudServer.PARAM_STATION_ID, this.Id },
                { CloudServer.PARAM_API_KEY, CloudServer.APIKey },
                { CloudServer.PARAM_DETAIL, detail.ToFastJSON() }
            };

            StationLogOnResponse res =
                CloudServer.requestPath <StationLogOnResponse>(agent, "stations/logOn", parameters);

            this.Token = res.session_token;
            return(res);
        }
Example #10
0
        public static User LogIn(WebClient agent, string username, string passwd, string apiKey)
        {
            Dictionary <object, object> parameters = new Dictionary <object, object>();

            parameters.Add(CloudServer.PARAM_EMAIL, username);
            parameters.Add(CloudServer.PARAM_PASSWORD, passwd);
            parameters.Add(CloudServer.PARAM_API_KEY, apiKey);

            UserLogInResponse res = CloudServer.requestPath <UserLogInResponse>(
                agent, "auth/login", parameters);

            User user = new User(username, passwd);

            user.Token    = res.session_token;
            user.Groups   = res.groups;
            user.Id       = res.user.user_id;
            user.Stations = res.stations;
            return(user);
        }