public static T Request(string endpoint, Method method = Method.GET, JObject jObjectBody = null, string token = null) { RestClient restClient = new RestClient(UrlProvider.BaseUrl()); RestRequest restRequest = new RestRequest(endpoint, method); if (method.Equals(Method.POST) || method.Equals(Method.PUT)) { restRequest.AddParameter("application/json", jObjectBody, ParameterType.RequestBody); } else { restRequest.AddParameter("application/json", ParameterType.RequestBody); } restRequest.AddHeader("Authorization", token); IRestResponse restResponse = restClient.Execute(restRequest); return(JsonConvert.DeserializeObject <T>(restResponse.Content)); }
public static string Users() { return(UrlProvider.BaseUrl() + "/usuarios"); }
public static string Products() { return(UrlProvider.BaseUrl() + "/produtos"); }
public static string Login() { return(UrlProvider.BaseUrl() + "/login"); }