예제 #1
0
        public RestResponse Get(RestResource resource)
        {
            HttpRequest request = new HttpRequest()
            {
                ContentType = "text/plain",
                ResourcePath = resource.ResourcePath,
                HttpMethod = HttpMethod.GET
            };

            HttpResponse response = HttpClient.Submit(request);

            if (response == null) return null;

            return new RestResponse()
            {
                StatusCode = response.StatusCode,
                Content = response.Content
            };
        }
예제 #2
0
        public RestResponse Delete(RestResource resource)
        {
            HttpRequest request = new HttpRequest()
            {
                ContentType = "text/plain",
                ResourcePath = resource.ResourcePath,
                HttpMethod = HttpMethod.DELETE
            };

            HttpResponse response = HttpClient.Submit(request);

            if (response == null) return null;

            return new RestResponse()
            {
                StatusCode = response.StatusCode,
                Content = response.Content
            };
        }
예제 #3
0
        public RestResponse Delete(RestResource resource)
        {
            var request = new HttpRequest
            {
                ContentType = "text/plain",
                ResourcePath = resource.ResourcePath,
                ResourceVersion = resource.ResourceVersion,
                HttpMethod = HttpMethod.DELETE
            };

            var response = HttpClient.Submit(request);

            if (response == null) return null;

            return new RestResponse
            {
                StatusCode = response.StatusCode,
                Content = response.Content
            };
        }
예제 #4
0
        public RestResponse Post(RestResource resource)
        {
            HttpRequest request = new HttpRequest()
            {
                Content = resource.Content,
                ContentType = "application/xml",
                ContentEncoding = Encoding.UTF8,
                ResourcePath = resource.ResourcePath,
                HttpMethod = HttpMethod.POST
            };

            HttpResponse response = HttpClient.Submit(request);

            if (response == null) return null;

            return new RestResponse()
            {
                StatusCode = response.StatusCode,
                Content = response.Content
            };
        }
예제 #5
0
        public RestResponse Put(RestResource resource)
        {
            HttpRequest request = new HttpRequest()
            {
                Content = resource.Content,
                ContentType = "application/xml",
                ContentEncoding = Encoding.UTF8,
                ResourcePath = resource.ResourcePath,
                HttpMethod = HttpMethod.PUT
            };

            HttpResponse response = HttpClient.Submit(request);

            if (response == null) return null;

            return new RestResponse()
            {
                StatusCode = response.StatusCode,
                Content = response.Content
            };
        }
예제 #6
0
        public RestResponse Put(RestResource resource)
        {
            var request = new HttpRequest
            {
                Content = resource.Content,
                ContentType = "application/xml",
                ContentEncoding = Encoding.UTF8,
                ResourcePath = resource.ResourcePath,
                ResourceVersion = resource.ResourceVersion,
                HttpMethod = HttpMethod.PUT
            };

            var response = HttpClient.Submit(request);

            if (response == null) return null;

            return new RestResponse
            {
                StatusCode = response.StatusCode,
                Content = response.Content
            };
        }
        public RestResponse Delete(RestResource resource)
        {
            var request = new HttpRequest
            {
                ContentType     = "text/plain",
                ResourcePath    = resource.ResourcePath,
                ResourceVersion = resource.ResourceVersion,
                HttpMethod      = HttpMethod.DELETE
            };

            var response = HttpClient.Submit(request);

            if (response == null)
            {
                return(null);
            }

            return(new RestResponse
            {
                StatusCode = response.StatusCode,
                Content = response.Content
            });
        }