Exemplo n.º 1
0
        private static RequestObj DoRequest(string addr, JObject data, string method)
        {
            var res = new RequestObj(addr, data, method);

            res.Process();
            return(res);
        }
Exemplo n.º 2
0
        private static RequestObj DoRequest(string addr, string method)
        {
            var res = new RequestObj(addr, null, method);

            res.Process();
            return(res);
        }
Exemplo n.º 3
0
        public virtual JObject CheckError(RequestObj r)
        {
            switch (r.StatusCode)
            {
            case 200 when r.Text == "":
                return(null);

            case 200:
                return(r.Json);

            case 204:
                return(null);

            case 403:
                Console.WriteLine(@"Error 400: Bad request! (" + IpAddress + @")");
                break;

            case 401:
                Console.WriteLine(@"Error 401: Not authorized! This is an invalid token for this Aurora (" + IpAddress + @")");
                break;

            case 404:
                Console.WriteLine(@"Error 404: Resource not found! (" + IpAddress + @")");
                break;

            case 422:
                Console.WriteLine(@"Error 422: Unprocessable Entity (" + IpAddress + @")");
                break;

            case 500:
                Console.WriteLine(@"Error 500: Internal Server Error (" + IpAddress + @")");
                break;

            default:
                Console.WriteLine(@"ERROR! UNKNOWN ERROR " + r.StatusCode + @". Please post an issue on the GitHub page: https://github.com/software-2/nanoleaf/issues");
                break;
            }

            return(null);
        }
Exemplo n.º 4
0
 public RequestResult(string addr, JObject data, string method)
 {
     Request = new RequestObj(addr, data, method);
 }