Skip to content

Instantly share code, notes, and snippets.

@AlexArchive
Last active August 29, 2015 14:02
Show Gist options
  • Save AlexArchive/98eaa1c650adafeba789 to your computer and use it in GitHub Desktop.
Save AlexArchive/98eaa1c650adafeba789 to your computer and use it in GitHub Desktop.
{
"Gamertag": "lagkip",
"Tier": "Silver",
"Avatar": {
"Full": "http://avatar.xboxlive.com/avatar/lagkip/avatar-body.png",
"Small": "http://avatar.xboxlive.com/avatar/lagkip/avatarpic-s.png",
"Large": "http://avatar.xboxlive.com/avatar/lagkip/avatarpic-l.png",
"Tile": "http://avatar.xboxlive.com/avatar/Lagkip/avatarpic-l.png"
},
"Gamerscore": "395",
"Reputation": 60,
"Presence": "Offline",
"Online": false,
"Motto": "None",
"Name": "",
"Location": "",
"Biography": "",
"Friends": {
"Href": "http://localhost:7820/profile/lagkip/friends"
},
"Games": {
"Href": "http://localhost:7820/profile/lagkip/games"
}
}
public class ProfileModule : ModuleBase
{
public ProfileModule()
{
Get["/profile/{gamertag}"] = context =>
{
Profile profile = XboxClient.Profile.GetProfile(context.Gamertag);
if (profile == null)
return this.ErrorMessage(HttpStatusCode.BadRequest, "Profile does not exist.");
dynamic profileDto = profile.ToExpandoObject();
profileDto.Friends = new { Href = "http://localhost:7820/profile/" + context.Gamertag + "/friends"};
profileDto.Games = new { Href = "http://localhost:7820/profile/" + context.Gamertag + "/games" };
return profileDto;
};
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment