Pinterest
Getting information about a given user
@using Skybrud.Social.Pinterest.Fields
@using Skybrud.Social.Pinterest.Objects.Users
@using Skybrud.Social.Pinterest.Responses.Users
@inherits System.Web.Mvc.WebViewPage<Skybrud.Social.Pinterest.PinterestService>
@{
// Collection of fields to be returned by the API
PinterestFieldsCollection fields = new PinterestFieldsCollection();
fields.Add(PinterestUserFields.Username);
fields.Add(PinterestUserFields.FirstName);
fields.Add(PinterestUserFields.LastName);
fields.Add(PinterestUserFields.Counts);
fields.Add(PinterestUserFields.Image);
// Make the call to the API
PinterestGetUserResponse response = Model.Users.GetUser("skybruddk", fields);
// Get the user object
PinterestUser user = response.Body.Data;
// Print some information about the user
<h3>Basic information</h3>
<p>Id: @user.Id</p>
<p>Username: @user.Username</p>
<p>First name: @user.FirstName</p>
<p>Last name: @user.LastName</p>
// Print some user statistics
if (user.HasCounts) {
<h3>Counts</h3>
<p>Followers: @user.Counts.Followers</p>
<p>Following: @user.Counts.Following</p>
<p>Pins: @user.Counts.Pins</p>
<p>Boards: @user.Counts.Boards</p>
<p>Likes: @user.Counts.Likes</p>
}
}