Skip to content

Instantly share code, notes, and snippets.

@dalager
Created July 3, 2013 19:36
Show Gist options
  • Save dalager/5922013 to your computer and use it in GitHub Desktop.
Save dalager/5922013 to your computer and use it in GitHub Desktop.
/// <summary>
/// Get a specific user's profile
/// </summary>
/// <param name="encodedUserId"></param>
/// <param name="callback"></param>
/// <returns></returns>
public void GetUserProfile(string encodedUserId, Action<UserProfile, FitbitException> callback)
{
string apiCall;
if (string.IsNullOrEmpty(encodedUserId))
apiCall = "/1/user/-/profile.xml";
else
apiCall = string.Format("/1/user/{0}/profile.xml", encodedUserId);
var request = new RestRequest("/1/user/-/profile.xml") {RootElement = "user"};
restClient.ExecuteAsync<UserProfile>(request, response =>
{
try
{
HandleResponseCode(response.StatusCode);
callback(response.Data, null);
}
catch (FitbitException e)
{
callback(response.Data, e);
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment