Skip to content

Instantly share code, notes, and snippets.

@jfversluis
Last active March 24, 2017 11:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jfversluis/b2378a0af9e5805b130b3793e28fcbb9 to your computer and use it in GitHub Desktop.
Save jfversluis/b2378a0af9e5805b130b3793e28fcbb9 to your computer and use it in GitHub Desktop.
Implementing a POST method
// IRestClient.cs
[Post ("/posts")]
Task AddPost (Foo foo);
// RestClient.cs
public async Task AddPost (Foo foo)
{
await _restClient.AddPost (foo);
}
// Code-behind
private async void Handle_Clicked_Awesome_Post (object sender, System.EventArgs e)
{
var foo = new Foo {
id = 1337,
title = "Awesome!",
body = "Unicorns and rainbows",
userId = 1
};
await _restClient.AddPost (foo);
ResultLabel.Text = $"Added";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment