Ejemplo n.º 1
0
        protected TResponse Get <TRequest, TResponse>(TRequest request)
            where TRequest : APIRequestBodyBase <TRequest>
            where TResponse : APIResponseBodyBase <TResponse>
        {
            var result = _handler.Handle(() =>
            {
                _restfulClient = _restfulClient ?? new RestfulClient();
                return(_restfulClient.DoGet(request.Url,
                                            request.ToString(),
                                            request.Headers));
            });
            var response = APIResponseBodyBase <TResponse> .Deserialize(result);

            return(response);
        }
Ejemplo n.º 2
0
        protected async Task <TResponse> PostAsync <TRequest, TResponse>(TRequest request)
            where TRequest : APIRequestBodyBase <TRequest>
            where TResponse : APIResponseBodyBase <TResponse>
        {
            var result = await _handler.HandleAsync(() =>
            {
                _restfulClient = _restfulClient ?? new RestfulClient();
                return(_restfulClient.PostAsync(request.Url,
                                                request.ContentType,
                                                request.Headers,
                                                request.ToString(),
                                                request.SecurityProtocol,
                                                request.TimeOut,
                                                request.UseSecurity));
            });

            var response = APIResponseBodyBase <TResponse> .Deserialize(result);

            return(response);
        }
Ejemplo n.º 3
0
        protected TResponse Post <TRequest, TResponse>(TRequest request)
            where TRequest : APIRequestBodyBase <TRequest>
            where TResponse : APIResponseBodyBase <TResponse>
        {
            _log.DebugFormat("Request:{0}", request.ToString());
            var result = _handler.Handle(() =>
            {
                _restfulClient = _restfulClient ?? new RestfulClient();
                return(_restfulClient.DoPost(request.Url,
                                             request.ContentType,
                                             request.Headers,
                                             request.ToString(),
                                             request.SecurityProtocol,
                                             request.TimeOut,
                                             request.UseSecurity));
            });

            _log.DebugFormat("Response:{0}", result);
            var response = APIResponseBodyBase <TResponse> .Deserialize(result);

            return(response);
        }