Ejemplo n.º 1
0
        public static IEnumerator Post <R>(this IHttpClient client, string url, ResultCallback <R> callback)
        {
            IHttpRequest request = HttpRequestBuilder
                                   .CreatePost(url)
                                   .WithBearerAuth()
                                   .WithContentType(MediaType.ApplicationJson)
                                   .GetResult();

            return(client?.SendRequest(request, HttpClientExtension.CreateResponseHandler(callback)));
        }
Ejemplo n.º 2
0
        public static IEnumerator Post <T>(this IHttpClient client, string url, T body, ResultCallback callback)
        {
            IHttpRequest request = HttpRequestBuilder.CreatePost(url).WithBearerAuth().WithJsonBody(body).GetResult();

            return(client?.SendRequest(request, HttpClientExtension.CreateResponseHandler(callback)));
        }
Ejemplo n.º 3
0
        public static IEnumerator Get <T, R>(this IHttpClient client, string url, T queries, ResultCallback <R> callback)
        {
            IHttpRequest request = HttpRequestBuilder.CreateGet(url).WithBearerAuth().WithQueries(queries).GetResult();

            return(client?.SendRequest(request, HttpClientExtension.CreateResponseHandler(callback)));
        }
Ejemplo n.º 4
0
 public static IEnumerator Send(this IHttpClient client, IHttpRequest request, ResultCallback callback)
 {
     return(client?.SendRequest(request, HttpClientExtension.CreateResponseHandler(callback)));
 }