Exemple #1
0
        public static TResult DELETE <TResult>(this IRESTfulRequest obj, string securityToken = "")
            where TResult : IRESTfulResponse, new()
        {
            if (obj == null)
            {
                return(default(TResult));
            }
            TransactionValidator.RequestValidator(obj);

            var client  = new BaseClient(obj.Url, securityToken);
            var request = client.ObjectShredder(obj, Method.DELETE, DataFormat.Json);

            var result = client.Execute <TResult>(request);

            return(RESTfulResponseProcessor.ResponseProcessor <TResult>(result));
        }
Exemple #2
0
        public static TResult GET <TResult>(this IRESTfulRequest obj, string securityToken = "")
            where TResult : IRESTfulResponse, new()
        {
            if (obj == null)
            {
                return(default(TResult));
            }

            TransactionValidator.RequestValidator(obj);

            var acceptType = obj.AcceptType;


            var client  = new BaseClient(obj.Url, securityToken);
            var request = new RestRequest(obj.Url, Method.GET, DataFormat.Json);

            var headers = HeaderProvider.GetRestHeaders(obj.RequestHeaders.ToArray());

            request.Parameters.AddRange(headers);

            var result = client.Execute <TResult>(request);

            return(RESTfulResponseProcessor.ResponseProcessor <TResult>(result));
        }