Esempio 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>(); })
                  ));
 }
 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)
                ));
 }
Esempio n. 3
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));
 }
Esempio n. 4
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));
 }
Esempio n. 5
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));
 }
Esempio n. 6
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));
 }
Esempio n. 7
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>(); }));
 }
Esempio n. 8
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>(); }));
 }
Esempio n. 9
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>(); }));
 }
 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)));
 }
 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)));
 }
 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)));
 }