Ejemplo n.º 1
0
        private static RestAPIResponse Core(DataSiftClient client, string command)
        {
            RestAPIResponse response = null;

            switch (command)
            {
            case "validate":
                response = client.Validate(_argsParser.GetParameter <string>("csdl"));
                break;

            case "compile":
                response = client.Compile(_argsParser.GetParameter <string>("csdl"));
                break;

            case "usage":
                UsagePeriod period;

                if (Enum.TryParse(_argsParser.GetParameter <string>("period"), out period))
                {
                    client.Usage(period);
                }
                else
                {
                    client.Usage();
                }

                break;

            case "balance":
                response = client.Balance();
                break;

            case "dpu":
                response = client.Compile(_argsParser.GetParameter <string>("hash"));
                break;

            default:
                throw new ApplicationException("Unrecognised command: " + command);
            }

            return(response);
        }