예제 #1
0
        /// <summary>
        /// Fit items in box with specified properties.
        /// </summary>
        /// <param name="fitRequest">FitRequest.</param>
        /// <returns>FitResponse or null.</returns>
        public static FitResponse Fit(FitRequest fitRequest)
        {
            string postBody = JsonConvert.SerializeObject(fitRequest,
                new JsonSerializerSettings {DefaultValueHandling = DefaultValueHandling.Ignore});

            // https://api.postmaster.io/v1/packages/fit
            string url = "{0}/{1}/{2}";
            url = string.Format(url, Config.BaseUri, Config.Version, Resource);

            string response = Request.Post(url, postBody);

            return response != null ? JsonConvert.DeserializeObject<FitResponse>(response) : null;
        }
예제 #2
0
        /// <summary>
        /// Fit items in box with specified properties.
        /// </summary>
        /// <param name="fitRequest">FitRequest.</param>
        /// <returns>FitResponse or null.</returns>
        public static FitResponse Fit(FitRequest fitRequest)
        {
            string postBody = JsonConvert.SerializeObject(fitRequest,
                                                          new JsonSerializerSettings {
                DefaultValueHandling = DefaultValueHandling.Ignore
            });

            // https://api.postmaster.io/v1/packages/fit
            string url = "{0}/{1}/{2}";

            url = string.Format(url, Config.BaseUri, Config.Version, Resource);

            string response = Request.Post(url, postBody);

            return(response != null?JsonConvert.DeserializeObject <FitResponse>(response) : null);
        }