Esempio n. 1
0
        private static Dictionary <string, string> convertParamsToDictionary(RequestClassParams inputParams)
        {
            Dictionary <string, string> parameters = new Dictionary <string, string>();

            parameters.Add("Action", inputParams.Actions);
            parameters.Add("SKIP_SLACK", inputParams.SkipSlack);
            parameters.Add("SIGNIFICANCE_THRESHOLD", inputParams.Threshold);

            return(parameters);
        }
Esempio n. 2
0
        public static async Task <HttpResponseMessage> Run([HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = null)] HttpRequestMessage req, TraceWriter log)
        {
            log.Info("C# HTTP trigger function processed a request.");

            // Get request body
            dynamic data = await req.Content.ReadAsAsync <object>();

            // Set name to query string or body data
            RequestClassSpots  inputSpots  = (RequestClassSpots)data?.spots.ToObject(typeof(RequestClassSpots));
            RequestClassParams inputParams = (RequestClassParams)data?.parameters.ToObject(typeof(RequestClassParams));

            List <Tuple <double, double, bool> > points = getPoints(inputSpots);
            Dictionary <string, string>          parametersDictionary = convertParamsToDictionary(inputParams);

            //testing
            foreach (Tuple <double, double, bool> entry in points)
            {
                log.Info(entry.ToString());
            }

            //testing
            foreach (string str in parametersDictionary.Keys)
            {
                log.Info(str);
            }

            //testing
            foreach (string str in parametersDictionary.Values)
            {
                log.Info(str);
            }


            List <ISpatialmHGResult> spatialmHGResults = getSpatialmHGResults(points, parametersDictionary);

            log.Info("test2!!!!");
            ResponseClass output = new ResponseClass(convertResultsToResponse(spatialmHGResults));

            return(inputSpots == null
                ? req.CreateResponse(HttpStatusCode.BadRequest, "Please pass a request body")
                : req.CreateResponse(HttpStatusCode.OK, output.ToString()));
        }