I really want the API to look like this:
var client = new RestClient("
http://localhost:10013/api");
var person = new Person("abcd");
var request = client
.CreateRequest("people/{id}", new { id = person.Id })
.Content(person);
var response = client.Post(request);
response.On(HttpStatusCode.BadRequest, (ValidationErrors e) =>
{
throw new Exception("omg validation errors");
});
var summary =
response.On(HttpStatusCode.Created).UnWrap<PersonSummary>();
@Cristovão: Your example requires the response to be json, what if
it's xml?
On Mar 22, 11:42 am, Andy Cutright <
r.d.c0...@gmail.com> wrote:
> Thanks Cristavão :)
>
> On Thu, Mar 22, 2012 at 8:38 AM, Cristovão Morgado <
>
>
>
>
>
>
>
>
cristovao.morg...@gmail.com> wrote:
> > JsonConvertDeserializeObject ... is already used by RestSharp :) being
> > part of
JSON.NET ;)
>