Exemplo n.º 1
0
 public Response <TResponse> PutJson <TRequest, TResponse>(TRequest model, string url, HttpOptions options, params Header[] headers)
 {
     return(Json.Response.FromModel(model)
            .Bind(json =>
                  HypertextTransferProtocol.Send(json, url, "application/json", options, Http.AddJsonAccept(headers), "PUT")
                  .Match(x => Json.Response.ToModel <TResponse>(x), ex => { ex.LogValue(ex.ToString()); return new Response <TResponse>(); })
                  ));
 }
Exemplo n.º 2
0
 public Task <Response <TResponse> > PutJsonAsync <TRequest, TResponse>(TRequest model, string url, HttpOptions options, params Header[] headers)
 {
     return(Json.Response.FromModel(model)
            .BindAsync(json =>
                       HypertextTransferProtocol.SendAsync(json, url, "application/json", options, Http.AddJsonAccept(headers), HttpMethod.Put)
                       .ContinueWith(x => x.Result.Match(y => Json.Response.ToModel <TResponse>(y), ex => { ex.LogValue(ex.ToString()); return new Response <TResponse>(); }))
                       ));
 }
Exemplo n.º 3
0
 public Maybe <TResponse> PutJson <TRequest, TResponse>(TRequest model, string url, HttpOptions options, params Header[] headers)
 {
     return(Json.Maybe.FromModel(model).Match(
                json => HypertextTransferProtocol
                .Send(json, url, "application/json", options, Http.AddJsonAccept(headers), "PUT")
                .Match(x => Json.Maybe.ToModel <TResponse>(x).Match(y => new Maybe <TResponse>(y), ex => new Maybe <TResponse>(ex)), ex => new Maybe <TResponse>(ex)),
                ex => new Maybe <TResponse>(ex)
                ));
 }
Exemplo n.º 4
0
 public Task <Maybe <TResponse> > PutJsonAsync <TRequest, TResponse>(TRequest model, string url, HttpOptions options, params Header[] headers)
 {
     return(Json.Maybe.FromModel(model).MatchAsync(
                json => HypertextTransferProtocol
                .SendAsync(json, url, "application/json", options, Http.AddJsonAccept(headers), HttpMethod.Put)
                .ContinueWith(x => x.Result.Match(y => Json.Maybe.ToModel <TResponse>(y)
                                                  .Match(z => new Maybe <TResponse>(z), ex => new Maybe <TResponse>(ex)), ex => new Maybe <TResponse>(ex))),
                ex => new Maybe <TResponse>(ex)
                ));
 }
Exemplo n.º 5
0
 public Response <TResponse> DeleteJson <TResponse>(string url, HttpOptions options, params Header[] headers)
 {
     return(HypertextTransferProtocol.Send(string.Empty, url, string.Empty, options, Http.AddJsonAccept(headers), "DELETE").Match(x => Json.Response.ToModel <TResponse>(x), ex => { ex.LogValue(ex.ToString()); return new Response <TResponse>(); }));
 }
Exemplo n.º 6
0
 public Response <string> Delete(string url, HttpOptions options, params Header[] headers)
 {
     return(HypertextTransferProtocol.Send(string.Empty, url, string.Empty, options, headers, "DELETE").Match(x => Response.Create(x), ex => { ex.LogValue(ex.ToString()); return new Response <string>(); }));
 }
Exemplo n.º 7
0
 public static string Delete(string url, HttpOptions options, params Header[] headers)
 {
     return(HypertextTransferProtocol.Send(string.Empty, url, string.Empty, options, headers, "DELETE").Match(x => x, ex => throw ex));
 }
Exemplo n.º 8
0
 public static string Put(string body, string url, string contentType, HttpOptions options, params Header[] headers)
 {
     return(HypertextTransferProtocol.Send(body, url, contentType, options, headers, "PUT").Match(x => x, ex => throw ex));
 }
Exemplo n.º 9
0
 public static Task <string> DeleteAsync(string url, HttpOptions options, params Header[] headers)
 {
     return(HypertextTransferProtocol.SendAsync(string.Empty, url, string.Empty, options, headers, HttpMethod.Delete).ContinueWith(x => x.Result.Match(y => y, ex => throw ex)));
 }
Exemplo n.º 10
0
 public Task <Response <string> > PostAsync(string body, string url, string contentType, HttpOptions options, params Header[] headers)
 {
     return(HypertextTransferProtocol.SendAsync(body, url, contentType, options, headers, HttpMethod.Post).ContinueWith(x => x.Result.Match(y => Response.Create(y), ex => { ex.LogValue(ex.ToString()); return new Response <string>(); })));
 }
Exemplo n.º 11
0
 public Maybe <string, HttpException> Delete(string url, HttpOptions options, params Header[] headers)
 {
     return(HypertextTransferProtocol.Send(string.Empty, url, string.Empty, options, headers, "DELETE").Match(x => new Maybe <string, HttpException>(x), ex => new Maybe <string, HttpException>(ex)));
 }
Exemplo n.º 12
0
 public Maybe <TResponse> GetJson <TResponse>(string url, HttpOptions options, params Header[] headers)
 {
     return(HypertextTransferProtocol
            .Send(string.Empty, url, string.Empty, options, Http.AddJsonAccept(headers), "GET")
            .Match(x => Json.Maybe.ToModel <TResponse>(x).Match(y => new Maybe <TResponse>(y), ex => new Maybe <TResponse>(ex)), ex => new Maybe <TResponse>(ex)));
 }
Exemplo n.º 13
0
 public Maybe <string, HttpException> Put(string body, string url, string contentType, HttpOptions options, params Header[] headers)
 {
     return(HypertextTransferProtocol.Send(body, url, contentType, options, headers, "PUT").Match(x => new Maybe <string, HttpException>(x), ex => new Maybe <string, HttpException>(ex)));
 }
Exemplo n.º 14
0
 public Task <Maybe <string, HttpException> > DeleteAsync(string url, HttpOptions options, params Header[] headers)
 {
     return(HypertextTransferProtocol.SendAsync(string.Empty, url, string.Empty, options, headers, HttpMethod.Delete).ContinueWith(x => x.Result.Match(y => new Maybe <string, HttpException>(y), ex => new Maybe <string, HttpException>(ex))));
 }
Exemplo n.º 15
0
 public Task <Maybe <TResponse> > GetJsonAsync <TResponse>(string url, HttpOptions options, params Header[] headers)
 {
     return(HypertextTransferProtocol.SendAsync(string.Empty, url, string.Empty, options, Http.AddJsonAccept(headers), HttpMethod.Get).ContinueWith(x => x.Result.Match(y => Json.Maybe.ToModel <TResponse>(y).Match(z => new Maybe <TResponse>(z), ex => new Maybe <TResponse>(ex)), ex => new Maybe <TResponse>(ex))));
 }
Exemplo n.º 16
0
 public static Task <string> PutAsync(string body, string url, string contentType, HttpOptions options, params Header[] headers)
 {
     return(HypertextTransferProtocol.SendAsync(body, url, contentType, options, headers, HttpMethod.Put).ContinueWith(x => x.Result.Match(y => y, ex => throw ex)));
 }
Exemplo n.º 17
0
 public static Task <TResponse> PutJsonAsync <TRequest, TResponse>(TRequest model, string url, HttpOptions options, params Header[] headers)
 {
     return(HypertextTransferProtocol.SendAsync(Json.FromModel(model), url, "application/json", options, AddJsonAccept(headers), HttpMethod.Put).ContinueWith(x => x.Result.Match(y => Json.ToModel <TResponse>(y), ex => throw ex)));
 }
Exemplo n.º 18
0
 public Task <Response <string> > DeleteAsync(string url, HttpOptions options, params Header[] headers)
 {
     return(HypertextTransferProtocol.SendAsync(string.Empty, url, string.Empty, options, headers, HttpMethod.Delete).ContinueWith(x => x.Result.Match(y => Response.Create(y), ex => { ex.LogValue(ex.ToString()); return new Response <string>(); })));
 }
Exemplo n.º 19
0
 public static Task <TResponse> DeleteJsonAsync <TResponse>(string url, HttpOptions options, params Header[] headers)
 {
     return(HypertextTransferProtocol.SendAsync(string.Empty, url, string.Empty, options, AddJsonAccept(headers), HttpMethod.Delete).ContinueWith(x => x.Result.Match(y => Json.ToModel <TResponse>(y), ex => throw ex)));
 }
Exemplo n.º 20
0
 public Task <Response <TResponse> > DeleteAsync <TResponse>(string url, HttpOptions options, params Header[] headers)
 {
     return(HypertextTransferProtocol.SendAsync(string.Empty, url, string.Empty, options, Http.AddJsonAccept(headers), HttpMethod.Delete).ContinueWith(x => x.Result.Match(y => Json.Response.ToModel <TResponse>(y), ex => { ex.LogValue(ex.ToString()); return new Response <TResponse>(); })));
 }
Exemplo n.º 21
0
 public static TResponse PutJson <TRequest, TResponse>(TRequest model, string url, HttpOptions options, params Header[] headers)
 {
     return(HypertextTransferProtocol.Send(Json.FromModel(model), url, "application/json", options, AddJsonAccept(headers), "PUT").Match(x => Json.ToModel <TResponse>(x), ex => throw ex));
 }
Exemplo n.º 22
0
 public Response <string> Put(string body, string url, string contentType, HttpOptions options, params Header[] headers)
 {
     return(HypertextTransferProtocol.Send(body, url, contentType, options, headers, "PUT").Match(x => Response.Create(x), ex => { ex.LogValue(ex.ToString()); return new Response <string>(); }));
 }
Exemplo n.º 23
0
 public static TResponse DeleteJson <TResponse>(string url, HttpOptions options, params Header[] headers)
 {
     return(HypertextTransferProtocol.Send(string.Empty, url, string.Empty, options, AddJsonAccept(headers), "DELETE").Match(x => Json.ToModel <TResponse>(x), ex => throw ex));
 }
Exemplo n.º 24
0
 public Task <Maybe <string, HttpException> > PutAsync(string body, string url, string contentType, HttpOptions options, params Header[] headers)
 {
     return(HypertextTransferProtocol.SendAsync(body, url, contentType, options, headers, HttpMethod.Put).ContinueWith(x => x.Result.Match(y => new Maybe <string, HttpException>(y), ex => new Maybe <string, HttpException>(ex))));
 }