コード例 #1
0
        public T GetHttpContent <T>(string url,
                                    string mediaType = "application/json",
                                    Dictionary <string, string> requestHeaders = null)
        {
            using (var httpClass = new HttpClass(url, SupportedHttpMethods.GET, mediaType, null, requestHeaders))
            {
                httpClass.Invoke();

                this.ProcessErrors(httpClass);

                string content = httpClass.GetResponseContent();
                return((T)this.serializer.DeSerialize <T>(content));
            }
        }
コード例 #2
0
        public string HttpInvoke(string url, SupportedHttpMethods httpMethod,
                                 string mediaType,
                                 string content = null,
                                 Dictionary <string, string> requestHeaders = null,
                                 Dictionary <string, string> contentHeaders = null)
        {
            using (var httpClass = new HttpClass(url, httpMethod, mediaType, content, requestHeaders, contentHeaders))
            {
                httpClass.Invoke();

                this.ProcessErrors(httpClass);

                return(httpClass.GetResponseContent());;
            }
        }
コード例 #3
0
        public string UploadFile(string url,
                                 string mediaType,
                                 string file = null,
                                 Dictionary <string, string> requestHeaders = null,
                                 Dictionary <string, string> contentHeaders = null)
        {
            using (var httpClass = new HttpClass(url, SupportedHttpMethods.POST, mediaType, null, requestHeaders, contentHeaders))
            {
                httpClass.file = file;
                httpClass.Invoke();

                this.ProcessErrors(httpClass);

                return(httpClass.GetResponseContent());;
            }
        }
コード例 #4
0
        public string GetHttpContent(string url,
                                     string mediaType = "application/json",
                                     Dictionary <string, string> requestHeaders = null)
        {
            string content;

            using (var httpClass = new HttpClass(url, SupportedHttpMethods.GET, mediaType, url, requestHeaders))
            {
                httpClass.Invoke();

                this.ProcessErrors(httpClass);

                content = httpClass.GetResponseContent();
            }

            return(content);
        }
コード例 #5
0
        public object GetHttpResponse(string url,
                                      Dictionary <string, string> requestHeaders = null)
        {
            string content;

            using (var httpClass = new HttpClass(url, SupportedHttpMethods.GET, "text/json", url, requestHeaders))
            {
                httpClass.Invoke();

                this.ProcessErrors(httpClass);

                content = httpClass.GetResponseContent();
            }

            JsonNetSerialization ser = new JsonNetSerialization();

            return(ser.DeSerialize(content));
        }