GetImageMetadataAsync(CafEEFluxParameters parameters)
        {
            // TODO: Error checking

            EEFluxRequest requestContent = getEEFluxRequest(parameters);

            StringContent content =
                new StringContent(JsonConvert.SerializeObject(requestContent));
            Uri uri = new Uri(baseAddress, "landsat");

            HttpResponseMessage response = await client.PostAsync(
                uri.ToString(),
                content);

            if (response.IsSuccessStatusCode)
            {
                string result = response.Content.ReadAsStringAsync().Result;

                Dictionary <int, EEFluxImageMetadata> imageMetadatas =
                    JsonConvert.DeserializeObject <Dictionary <int, EEFluxImageMetadata> >(result);

                return(imageMetadatas);
            }
            else
            {
                return(new Dictionary <int, EEFluxImageMetadata>());
            }
        }
        /// <summary>
        /// Gets an image URL by sending an HTTP POST to {baseAddress}/{imageType}
        /// </summary>
        /// <param name="parameters">Required parameters to be set: StartDate, EndDate, ImageId, Latitude, Longitude</param>
        /// <param name="imageId">ID of image</param>
        /// <param name="imageType">Type of image to be requested (NDVI, Actual ET, etc)</param>
        /// <returns></returns>
        public async Task <Dictionary <EEFluxImageTypes, EEFluxImage> > GetImageUriAsync(
            CafEEFluxParameters parameters,
            string imageId,
            EEFluxImageTypes imageType)
        {
            EEFluxRequest requestContent = getEEFluxRequest(
                parameters,
                imageId);
            StringContent content =
                new StringContent(JsonConvert.SerializeObject(requestContent));
            Uri uri =
                new Uri(baseAddress, this.imageTypeToUriMap[imageType]);

            HttpResponseMessage response = await client.PostAsync(
                uri.ToString(),
                content);

            if (response.IsSuccessStatusCode)
            {
                string result = response.Content.ReadAsStringAsync().Result;

                Dictionary <EEFluxImageTypes, EEFluxImage> imageUris =
                    JsonConvert.DeserializeObject <
                        Dictionary <EEFluxImageTypes, EEFluxImage> >(result);

                return(imageUris);
            }
            else
            {
                return(new Dictionary <EEFluxImageTypes, EEFluxImage>());
            }
        }
        /// <summary>
        /// Converts CafEEFluxParameters to EEFluxRequest
        /// </summary>
        /// <param name="parameters">CafEEFluxParameters, expects StartDate, EndDate, ImageId, Latitude, Longitude</param>
        /// <param name="imageId"></param>
        /// <returns></returns>
        private EEFluxRequest getEEFluxRequest(
            CafEEFluxParameters parameters,
            string imageId = "")
        {
            EEFluxRequest eefluxRequest = new EEFluxRequest()
            {
                Date =
                    $"{parameters.StartDate.ToString("yyyy-MM-dd")} to " +
                    $"{parameters.EndDate.ToString("yyyy-MM-dd")}",
                ImageId = imageId,
                Lat     = parameters.Latitude,
                Lon     = parameters.Longitude
            };

            return(eefluxRequest);
        }