models

package
Version: v2.1.1+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 16, 2018 License: MIT Imports: 6 Imported by: 6

Documentation

Index

Constants

View Source
const BOARD_FIELDS = "id,url,reason,counts,created_at,creator,description,image,privacy,name"
View Source
const INTEREST_FIELDS = "id,name"
View Source
const PIN_FIELDS = "id,link,note,url,attribution,color,board,counts,created_at,creator,image,media,metadata,original_link"
View Source
const USER_FIELDS = "first_name,last_name,url,account_type,bio,counts,created_at,id,image,username"

Variables

This section is empty.

Functions

func GetLimit

func GetLimit(httpResp *http.Response, key string) int

func WrapPinterestError added in v1.1.0

func WrapPinterestError(httpResponse *http.Response, bodyResponse *Response, err error) error

WrapPinterestError takes a *http.Response and a Response and returns a PinterestError if one should be returned.

Types

type AccessToken added in v1.2.0

type AccessToken struct {
	AccessToken      string   `json:"access_token"`
	TokenType        string   `json:"token_type"`
	Scope            []string `json:"scope"`
	ErrorDescription string   `json:"error_description"`
	Error            string   `json:"error"`
}

AccessToken is a struct that represents a Access Token response from the Pinterest API.

type Article

type Article struct {
	PublishedAt iso8601.Time     `json:"published_at"`
	Description string           `json:"description"`
	Name        string           `json:"name"`
	Authors     []MetadataPerson `json:"authors"`
}

type Attribution

type Attribution struct {
	Title              string `json:"title"`
	Url                string `json:"url"`
	ProviderIconUrl    string `json:"provider_icon_url"`
	AuthorName         string `json:"author_name"`
	ProviderFaviconUrl string `json:"provider_favicon_url"`
	AuthorUrl          string `json:"author_url"`
	ProviderName       string `json:"provider_name"`
}

type Board

type Board struct {
	Id          string       `json:"id"`
	Name        string       `json:"name"`
	Url         string       `json:"url"`
	Description string       `json:"description"`
	Creator     Creator      `json:"creator"`
	CreatedAt   iso8601.Time `json:"created_at"`
	Counts      BoardCounts  `json:"counts"`
	Image       Images       `json:"image"`
	Privacy     string       `json:"privacy"`
}

Board is a struct that represents an individual board from the Pinterest API.

type BoardCounts

type BoardCounts struct {
	Pins          int32 `json:"pins"`
	Collaborators int32 `json:"collaborators"`
	Followers     int32 `json:"followers"`
}

type Creator

type Creator struct {
	Url       string `json:"url"`
	FirstName string `json:"first_name"`
	LastName  string `json:"last_name"`
	Id        string `json:"id"`
}

type Image

type Image struct {
	Url    string `json:"url"`
	Width  int32  `json:"width"`
	Height int32  `json:"height"`
}

type Images

type Images struct {
	Size_60x60 Image `json:"60x60"`
}

type Interest

type Interest struct {
	Id   string `json:"id"`
	Name string `json:"name"`
}

Interest is a struct that represents an individual interest from the Pinterest API.

type Link struct {
	Locale      string `json:"locale"`
	Title       string `json:"title"`
	SiteName    string `json:"site_name"`
	Description string `json:"description"`
	Favicon     string `json:"favicon"`
}

type Media

type Media struct {
	Type string `json:"type"`
}

type MetadataPerson

type MetadataPerson struct {
	Name string `json:"name"`
}

type Movie

type Movie struct {
	Rating      string           `json:"rating"`
	Directors   []MetadataPerson `json:"directors"`
	Actors      []MetadataPerson `json:"actors"`
	Name        string           `json:"name"`
	PublishedAt iso8601.Time     `json:"published_at"`
}

type Page

type Page struct {
	Cursor string `json:"cursor"`
	Next   string `json:"next"`
}

type Pin

type Pin struct {
	Id           string       `json:"id"`
	Link         string       `json:"link"`
	Url          string       `json:"url"`
	Creator      Creator      `json:"creator"`
	Board        Board        `json:"board"`
	CreatedAt    iso8601.Time `json:"created_at"`
	Note         string       `json:"note"`
	Color        string       `json:"color"`
	Counts       PinCounts    `json:"counts"`
	Media        Media        `json:"json:"media"`
	OriginalLink string       `json:"original_link"`
	Attribution  Attribution  `json:"attribution"`
	Image        PinImage     `json:"image"`
	Metadata     PinMetadata  `json:"metadata"`
}

type PinCounts

type PinCounts struct {
	Likes    int32 `json:"likes"`
	Comments int32 `json:"comments"`
	Repins   int32 `json:"repins"`
}

type PinImage

type PinImage struct {
	Original Image `json:"original"`
}

type PinMetadata

type PinMetadata struct {
	Article Article `json:"article"`
	Link    Link    `json:"link"`
	Place   Place   `json:"place"`
	Movie   Movie   `json:"movie"`
	Product Product `json:"product"`
}

type PinterestError

type PinterestError struct {
	StatusCode int    `json:"status_code"`
	Message    string `json:"message"`
	Limit      TypeRatelimit
}

PinterestError is a custom error that is passed for all non 200 responses from the API.

func (*PinterestError) Error

func (e *PinterestError) Error() string

type Place

type Place struct {
	Category   string  `json:"category"`
	Name       string  `json:"name"`
	Locality   string  `json:"locality"`
	Country    string  `json:"country"`
	Region     string  `json:"region"`
	Longitude  float32 `json:"longitude"`
	SourceUrl  string  `json:"source_url"`
	Street     string  `json:"street"`
	PostalCode string  `json:"postal_code"`
	Latitude   float32 `json:"latitude"`
}

type Product

type Product struct {
	Name  string       `json:"name"`
	Offer ProductOffer `json:"offer"`
}

type ProductOffer

type ProductOffer struct {
	Price   string `json:"price"`
	InStock bool   `json:"in_stock"`
}

type Recipe

type Recipe struct {
	Servings    RecipeServings   `json:"servings"`
	Name        string           `json:"name"`
	Ingredients []RecipeCategory `json:"ingredients"`
}

type RecipeCategory

type RecipeCategory struct {
	Category    string             `json:"category"`
	Ingredients []RecipeIngredient `json:"ingredients"`
}

type RecipeIngredient

type RecipeIngredient struct {
	Amount string `json:"amount"`
	Name   string `json:"name"`
}

type RecipeServings

type RecipeServings struct {
	Serves  string `json:"serves"`
	Summary string `json:"summary"`
}

type Response

type Response struct {
	Data    interface{} `json:"data"`
	Message string      `json:"message"`
	Type    string      `json:"type"`
	Page    Page        `json:"page"`
}

Response is the base struct for all responses that come back from the Pinterest API.

type TypeRatelimit

type TypeRatelimit struct {
	Remaining int
	Limit     int
	Refresh   int
}

func GetRatelimit

func GetRatelimit(httpResp *http.Response) TypeRatelimit

type User

type User struct {
	Id          string       `json:"id"`
	Username    string       `json:"username"`
	FirstName   string       `json:"first_name"`
	LastName    string       `json:"last_name"`
	Bio         string       `json:"bio"`
	AccountType string       `json:"account_type"`
	Url         string       `json:"account_type"`
	CreatedAt   iso8601.Time `json:"created_at"`
	Counts      UserCounts   `json:"counts"`
	Image       Images       `json:"image"`
}

User is a struct that represents an individual user from the Pinterest API.

type UserCounts

type UserCounts struct {
	Pins      int32 `json:"pins"`
	Following int32 `json:"following"`
	Followers int32 `json:"followers"`
	Boards    int32 `json:"boards"`
	Likes     int32 `json:"likes"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL