Pinterest Fields

Fields

When you make a call to the Pinterest API - eg. to get information about a user - the API will only respond with a few fields by default (Pinterest calls this a partial response).

With the Pinterest implementation in Skybrud.Social you can specify which fields that should returned through an instance of PinterestFieldsCollection. You can use this class in a few different ways, so here are some examples.

While the PinterestFieldsCollection class represents a collection of fields, each individual fields is represented by the PinterestField class. This class can again be initialized in a few different ways.

// Initialize an empty collection
PinterestFieldsCollection fields = new PinterestFieldsCollection();
    
// Add the "username" field directly from a string
fields.Add("username");
    
// Add the "first_name" field initialized from a string
fields.Add(new PinterestField("first_name"));
    
// Add the "last_name" field from a pre-defined constant
fields.Add(PinterestUserFields.LastName);

The PinterestFieldsCollection class uses operator overloading so that you for example can create a new instance directly from an instance of PinterestField.

The PinterestUserFields class shown in the examples is a static class with constants for the basic fields of a Pinterest user.

// Initialize a new collection from a single field
PinterestFieldsCollection fields = PinterestUserFields.FirstName;

Adding two instances of PinterestField (using the + operator), you also get a new instance of PinterestFieldsCollection.

// Initialize an from a number of fields
PinterestField field1 = PinterestUserFields.FirstName;
PinterestField field2 = PinterestUserFields.LastName;
PinterestFieldsCollection fields3 = fields1 + field2;

While constants for the most basic fields of a Pinterest user can be found in the PinterestUserFields, you can also initialize a new collection based from a string array with the names of the fields.

// Initialize an from a string array of fields
PinterestFieldsCollection fields = new [] {
    "first_name", "last_name"
};

User fields

Most fields of a Pinterest user can be found through the PinterestUserFields class. Currently the class has constants for the following fields:

Skybrud.Social Name
PinterestUserFields.AccountType account_type
PinterestUserFields.Bio bio
PinterestUserFields.Counts counts
PinterestUserFields.CreatedAt created_at
PinterestUserFields.FirstName first_name
PinterestUserFields.Id id
PinterestUserFields.Image image
PinterestUserFields.LastName last_name
PinterestUserFields.Url url
PinterestUserFields.Username username