Exemple #1
0
 private void fill_query_params(ref RestRequest req, RequestQueryArgs args)
 {
     if (args == null)
     {
         return;
     }
     foreach (var arg in args)
     {
         req.AddQueryParameter(arg.Key, arg.Value);
     }
 }
Exemple #2
0
        // These method a name before their http methods and will prepare send and hanlder a request life
        // cycle using RestSharp.
        // Since Api response always have the same layout they return a BaseResponse object.

        public response.BaseResponse <T> get <T>(string endpoint, RequestQueryArgs args = null)
        {
            var req = new RestRequest(endpoint, Method.GET);

            fill_query_params(ref req, args);

            IRestResponse resp = client.Execute(req);

            check_response(resp);

            return(deserializeResponse <T>(resp.Content));
        }