pinterest

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Baseurl    = "https://api.pinterest.com/v5"
	HttpGet    = resty.MethodGet
	HttpPost   = resty.MethodPost
	HttpPatch  = resty.MethodPatch
	HttpDelete = resty.MethodDelete

	OAuthState = "go-pinterest"
)

Variables

View Source
var Endpoint = oauth2.Endpoint{
	AuthURL:   "https://www.pinterest.com/oauth/",
	TokenURL:  "https://api.pinterest.com/v5/oauth/token",
	AuthStyle: oauth2.AuthStyleInHeader,
}

Endpoint url for pinterest oauth2

Functions

func Bool

func Bool(v bool) *bool

Bool is a helper routine that allocates a new bool value to store v and returns a pointer to it.

func Int

func Int(v int) *int

Int is a helper routine that allocates a new int value to store v and returns a pointer to it.

func Int64

func Int64(v int64) *int64

Int64 is a helper routine that allocates a new int64 value to store v and returns a pointer to it.

func String

func String(v string) *string

String is a helper routine that allocates a new string value to store v and returns a pointer to it.

func Stringify

func Stringify(message interface{}) string

Stringify attempts to create a reasonable string representation of types in the GitHub library. It does things like resolve pointers to their values and omits struct fields with nil values.

Types

type APIError

type APIError struct {
	Code         int    `json:"code"`
	Message      string `json:"message"`
	Status       string `json:"status,omitempty"`
	Data         string `json:"data,omitempty"`
	EndpointName string `json:"endpoint_name,omitempty"`
}

APIError represents the error response

func ParseDataResponse

func ParseDataResponse(response *resty.Response, d interface{}) *APIError

functions for http requests

func (APIError) Error

func (e APIError) Error() string

func (APIError) String

func (e APIError) String() string
type Ad struct {
	ID                                    *string       `json:"id"`
	Type                                  *string       `json:"type"`
	AdAccountID                           *string       `json:"ad_account_id"`
	AdGroupID                             *string       `json:"ad_group_id"`
	CampaignID                            *string       `json:"campaign_id"`
	PinID                                 *string       `json:"pin_id"`
	Name                                  *string       `json:"name"`
	Status                                *string       `json:"status"`
	AndroidDeepLink                       *string       `json:"android_deep_link"`
	IOSDeepLink                           *string       `json:"ios_deep_link"`
	CarouselAndroidDeepLinks              []*string     `json:"carousel_android_deep_links"`
	CarouselDestinationURLs               []*string     `json:"carousel_destination_urls"`
	CarouselIOSDeepLinks                  []*string     `json:"carousel_ios_deep_links"`
	ClickTrackingURL                      *string       `json:"click_tracking_url"`
	CreativeType                          *string       `json:"creative_type"`
	DestinationURL                        *string       `json:"destination_url"`
	IsPinDeleted                          *bool         `json:"is_pin_deleted"`
	IsRemovable                           *bool         `json:"is_removable"`
	TrackingURLs                          *TrackingURLs `json:"tracking_urls"`
	ViewTrackingURL                       *string       `json:"view_tracking_url"`
	CollectionItemsDestinationURLTemplate *string       `json:"collection_items_destination_url_template"`
	CreatedTime                           *int          `json:"created_time"`
	UpdatedTime                           *int          `json:"updated_time"`
	RejectedReasons                       []*string     `json:"rejected_reasons"`
	RejectionLabels                       []*string     `json:"rejection_labels"`
	ReviewStatus                          *string       `json:"review_status"`
	SummaryStatus                         *string       `json:"summary_status"`
}

Ad represents the ad info.

func (Ad) String

func (a Ad) String() string

type AdAccount

type AdAccount struct {
	ID       *string         `json:"id"`
	Name     *string         `json:"name"`
	Owner    *AdAccountOwner `json:"owner"`
	Country  *string         `json:"country"`
	Currency *string         `json:"currency"`
}

AdAccount represents the ad account info.

func (AdAccount) String

func (a AdAccount) String() string

type AdAccountOwner

type AdAccountOwner struct {
	Username *string `json:"username"`
}

type AdAccountResource

type AdAccountResource Resource

func (*AdAccountResource) GetAdAccountAnalytics

func (r *AdAccountResource) GetAdAccountAnalytics(adAccountID string, args GetAdAccountAnalyticsOpts) (AnalyticsResponse, *APIError)

GetAdAccountAnalytics Get analytics for the specified ad_account_id, filtered by the specified options. Refer: https://developers.pinterest.com/docs/api/v5/#operation/ad_account/analytics

func (*AdAccountResource) GetAdAnalytics

func (r *AdAccountResource) GetAdAnalytics(adAccountID string, args GetAdAnalyticsOpts) (AnalyticsResponse, *APIError)

GetAdAnalytics Get analytics for the specified ads in the specified ad_account_id, filtered by the specified options. Refer: https://developers.pinterest.com/docs/api/v5/#operation/ads/analytics

func (*AdAccountResource) GetAdGroupAnalytics

func (r *AdAccountResource) GetAdGroupAnalytics(adAccountID string, args GetAdGroupAnalyticsOpts) (AnalyticsResponse, *APIError)

GetAdGroupAnalytics Get analytics for the specified campaigns in the specified ad_account_id, filtered by the specified options. Refer: https://developers.pinterest.com/docs/api/v5/#operation/ad_groups/analytics

func (*AdAccountResource) GetCampaignAnalytics

func (r *AdAccountResource) GetCampaignAnalytics(adAccountID string, args GetCampaignAnalyticsOpts) (AnalyticsResponse, *APIError)

GetCampaignAnalytics Get analytics for the specified campaigns in the specified ad_account_id, filtered by the specified options. Refer: https://developers.pinterest.com/docs/api/v5/#operation/campaigns/analytics

func (*AdAccountResource) GetProductGroupAnalytics

func (r *AdAccountResource) GetProductGroupAnalytics(adAccountID string, args GetProductGroupAnalyticsOpts) (AnalyticsResponse, *APIError)

GetProductGroupAnalytics Get analytics for the specified product groups in the specified ad_account_id, filtered by the specified options. Refer: https://developers.pinterest.com/docs/api/v5/#operation/product_groups/analytics

func (*AdAccountResource) ListAdAccounts

func (r *AdAccountResource) ListAdAccounts(args ListAdAccountsOpts) (*AdAccountsResponse, *APIError)

ListAdAccounts Get a list of the ad_accounts that the "operation user_account" has access to. Refer: https://developers.pinterest.com/docs/api/v5/#operation/ad_accounts/list

func (*AdAccountResource) ListAdGroups

func (r *AdAccountResource) ListAdGroups(adAccountID string, args ListAdGroupsOpts) (*AdGroupsResponse, *APIError)

ListAdGroups Get a list of the ad groups in the specified ad_account_id, filtered by the specified options. Refer: https://developers.pinterest.com/docs/api/v5/#operation/ad_groups/list

func (*AdAccountResource) ListAds

func (r *AdAccountResource) ListAds(adAccountID string, args ListAdsOpts) (*AdsResponse, *APIError)

ListAds Get a list of the ads in the specified ad_account_id, filtered by the specified options. Refer: https://developers.pinterest.com/docs/api/v5/#operation/ads/list

func (*AdAccountResource) ListCampaigns

func (r *AdAccountResource) ListCampaigns(adAccountID string, args ListCampaignsOpts) (*CampaignsResponse, *APIError)

ListCampaigns Get a list of the campaigns in the specified ad_account_id, filtered by the specified options. Refer: https://developers.pinterest.com/docs/api/v5/#operation/campaigns/list

type AdAccountsResponse

type AdAccountsResponse struct {
	Items    []*AdAccount `json:"items"`
	Bookmark *string      `json:"bookmark"`
}

AdAccountsResponse represents the response for list ad accounts.

func (AdAccountsResponse) String

func (ar AdAccountsResponse) String() string

type AdGroup

type AdGroup struct {
	ID                         *string              `json:"id"`
	Type                       *string              `json:"type"`
	AdAccountID                *string              `json:"ad_account_id"`
	Name                       *string              `json:"name"`
	Status                     *string              `json:"status"`
	BudgetInMicroCurrency      *int                 `json:"budget_in_micro_currency"`
	BidInMicroCurrency         *int                 `json:"bid_in_micro_currency"`
	BudgetType                 *string              `json:"budget_type"`
	StartTime                  *int                 `json:"start_time"`
	EndTime                    *int                 `json:"end_time"`
	TargetingSpec              *map[string][]string `json:"targeting_spec"`
	LifetimeFrequencyCap       *int                 `json:"lifetime_frequency_cap"`
	TrackingURLs               *TrackingURLs        `json:"tracking_urls"`
	AutoTargetingEnabled       *bool                `json:"auto_targeting_enabled"`
	PlacementGroup             *string              `json:"placement_group"`
	PacingDeliveryType         *string              `json:"pacing_delivery_type"`
	ConversionLearningModeType *string              `json:"conversion_learning_mode_type"`
	SummaryStatus              *string              `json:"summary_status"`
	FeedProfileID              *string              `json:"feed_profile_id"`
	CampaignID                 *string              `json:"campaign_id"`
	BillableEvent              *string              `json:"billable_event"`
	CreatedTime                *int                 `json:"created_time"`
	UpdatedTime                *int                 `json:"updated_time"`
}

AdGroup represents the ad group info.

func (AdGroup) String

func (a AdGroup) String() string

type AdGroupsResponse

type AdGroupsResponse struct {
	Items    []*AdGroup `json:"items"`
	Bookmark *string    `json:"bookmark"`
}

AdGroupsResponse represents the response for list ad groups.

func (AdGroupsResponse) String

func (c AdGroupsResponse) String() string

type AdsResponse

type AdsResponse struct {
	Items    []*Ad   `json:"items"`
	Bookmark *string `json:"bookmark"`
}

AdsResponse represents the response for list ads.

func (AdsResponse) String

func (a AdsResponse) String() string

type AnalyticsResponse

type AnalyticsResponse []map[string]interface{}

AnalyticsResponse represents the analytics response.

type AuthorizationAPP

type AuthorizationAPP struct {
	ClientID     string         `json:"client_id"`
	ClientSecret string         `json:"client_secret"`
	RedirectURI  string         `json:"redirect_uri,omitempty"`
	Scope        string         `json:"scope,omitempty"`
	Token        *oauth2.Token  `json:"access_token,omitempty"`
	Config       *oauth2.Config `json:"config,omitempty"`
}

AuthorizationAPP Pinterest OAuth2 app config

func NewAuthorizationAPP

func NewAuthorizationAPP(app AuthorizationAPP) *AuthorizationAPP

NewAuthorizationAPP Return app for oauth2 authorization

func (*AuthorizationAPP) GenerateAccessToken

func (app *AuthorizationAPP) GenerateAccessToken(code string) (*oauth2.Token, error)

GenerateAccessToken Generate user access token for the app

func (*AuthorizationAPP) GetAuthorizationURL

func (app *AuthorizationAPP) GetAuthorizationURL() string

GetAuthorizationURL Return authorization url for user

func (*AuthorizationAPP) GetAuthorizedHttpClient

func (app *AuthorizationAPP) GetAuthorizedHttpClient() *http.Client

GetAuthorizedHttpClient Get user authorized http client

func (*AuthorizationAPP) GetUserClient

func (app *AuthorizationAPP) GetUserClient() *Client

GetUserClient get library client with user authorization

func (AuthorizationAPP) String

func (app AuthorizationAPP) String() string

type BCSuite

type BCSuite struct {
	suite.Suite
	Pin *Client
}

BCSuite For the tests with app context

func (*BCSuite) SetupSuite

func (bc *BCSuite) SetupSuite()

func (*BCSuite) SetupTest

func (bc *BCSuite) SetupTest()

func (*BCSuite) TearDownTest

func (bc *BCSuite) TearDownTest()

type Board

type Board struct {
	ID          *string     `json:"id"`
	Name        *string     `json:"name"`
	Description *string     `json:"description"`
	Owner       *BoardOwner `json:"owner"`
	Privacy     *string     `json:"privacy"`
}

Board represents the board info Refer: https://developers.pinterest.com/docs/api/v5/#operation/boards/get

func (Board) String

func (b Board) String() string

type BoardOwner

type BoardOwner struct {
	Username *string `json:"username"`
}

BoardOwner represents the owner for board

func (BoardOwner) String

func (b BoardOwner) String() string

type BoardResource

type BoardResource Resource

func (*BoardResource) CreateBoard

func (r *BoardResource) CreateBoard(args CreateBoardOpts) (*Board, *APIError)

CreateBoard Create a board owned by the "operation user_account". Refer: https://developers.pinterest.com/docs/api/v5/#operation/boards/create

func (*BoardResource) CreateBoardSection

func (r *BoardResource) CreateBoardSection(boardID string, args CreateBoardSectionOpts) (*BoardSection, *APIError)

CreateBoardSection Create a board section on a board owned by the "operation user_account" - or on a group board that has been shared with this account. Refer: https://developers.pinterest.com/docs/api/v5/#operation/board_sections/create

func (*BoardResource) DeleteBoard

func (r *BoardResource) DeleteBoard(boardID string) *APIError

DeleteBoard Delete a board owned by the "operation user_account". Refer: https://developers.pinterest.com/docs/api/v5/#operation/boards/delete

func (*BoardResource) DeleteBoardSection

func (r *BoardResource) DeleteBoardSection(boardID, sectionID string) *APIError

DeleteBoardSection Delete a board section on a board owned by the "operation user_account" - or on a group board that has been shared with this account. Refer: https://developers.pinterest.com/docs/api/v5/#operation/board_sections/delete

func (*BoardResource) GetBoard

func (r *BoardResource) GetBoard(boardID string) (*Board, *APIError)

GetBoard Get a board owned by the operation user_account - or a group board that has been shared with this account. Refer: https://developers.pinterest.com/docs/api/v5/#operation/boards/get

func (*BoardResource) ListBoardSections

func (r *BoardResource) ListBoardSections(boardID string, args ListOptions) (*BoardSectionsResponse, *APIError)

ListBoardSections Get a list of all board sections from a board owned by the "operation user_account" - or a group board that has been shared with this account. Refer: https://developers.pinterest.com/docs/api/v5/#operation/board_sections/list

func (*BoardResource) ListBoards

func (r *BoardResource) ListBoards(args ListBoardOpts) (*BoardsResponse, *APIError)

ListBoards Get a list of the boards owned by the "operation user_account" + group boards where this account is a collaborator Refer: https://developers.pinterest.com/docs/api/v5/#operation/boards/list

func (*BoardResource) ListPinsOnBoard

func (r *BoardResource) ListPinsOnBoard(boardID string, args ListOptions) (*PinsResponse, *APIError)

ListPinsOnBoard Get a list of the Pins on a board owned by the "operation user_account" - or on a group board that has been shared with this account. Refer: https://developers.pinterest.com/docs/api/v5/#operation/boards/list_pins

func (*BoardResource) ListPinsOnBoardSection

func (r *BoardResource) ListPinsOnBoardSection(boardID, sectionID string, args ListOptions) (*PinsResponse, *APIError)

ListPinsOnBoardSection Get a list of the Pins on a board section of a board owned by the "operation user_account" - or on a group board that has been shared with this account. Refer: https://developers.pinterest.com/docs/api/v5/#operation/board_sections/list_pins

func (*BoardResource) UpdateBoard

func (r *BoardResource) UpdateBoard(boardID string, args UpdateBoardOpts) (*Board, *APIError)

UpdateBoard Update a board owned by the "operating user_account". Refer: https://developers.pinterest.com/docs/api/v5/#operation/boards/update

func (*BoardResource) UpdateBoardSection

func (r *BoardResource) UpdateBoardSection(boardID, sectionID string, args CreateBoardSectionOpts) (*BoardSection, *APIError)

UpdateBoardSection Update a board section on a board owned by the "operation user_account" - or on a group board that has been shared with this account. Refer: https://developers.pinterest.com/docs/api/v5/#operation/board_sections/update

type BoardSection

type BoardSection struct {
	ID   *string `json:"id"`
	Name *string `json:"name"`
}

BoardSection represents the board section info

func (BoardSection) String

func (b BoardSection) String() string

type BoardSectionsResponse

type BoardSectionsResponse struct {
	Items    []*BoardSection `json:"items"`
	Bookmark *string         `json:"bookmark"`
}

BoardSectionsResponse represents the response for list board sections

func (BoardSectionsResponse) String

func (b BoardSectionsResponse) String() string

type BoardsResponse

type BoardsResponse struct {
	Items    []*Board `json:"items"`
	Bookmark *string  `json:"bookmark"`
}

BoardsResponse represents the response for list boards

func (BoardsResponse) String

func (b BoardsResponse) String() string

type Campaign

type Campaign struct {
	ID               *string       `json:"id"`
	Type             *string       `json:"type"`
	AdAccountID      *string       `json:"ad_account_id"`
	Name             *string       `json:"name"`
	Status           *string       `json:"status"`
	LifetimeSpendCap *int          `json:"lifetime_spend_cap"`
	DailySpendCap    *int          `json:"daily_spend_cap"`
	OrderLineID      *string       `json:"order_line_id"`
	TrackingURLs     *TrackingURLs `json:"tracking_urls"`
	StartTime        *int          `json:"start_time"`
	EndTime          *int          `json:"end_time"`
	ObjectiveType    *string       `json:"objective_type"`
	CreatedTime      *int          `json:"created_time"`
	UpdatedTime      *int          `json:"updated_time"`
}

Campaign represents the campaign info.

func (Campaign) String

func (c Campaign) String() string

type CampaignsResponse

type CampaignsResponse struct {
	Items    []*Campaign `json:"items"`
	Bookmark *string     `json:"bookmark"`
}

CampaignsResponse represents the response for list campaigns.

func (CampaignsResponse) String

func (c CampaignsResponse) String() string

type Client

type Client struct {
	Cli *resty.Client
	// API Resource
	UserAccount *UserAccountResource
	Board       *BoardResource
	Pin         *PinResource
	Media       *MediaResource
	AdAccount   *AdAccountResource
}

func NewBearerClient

func NewBearerClient(bearerToken string) *Client

func NewClient

func NewClient(client *resty.Client) *Client

func NewUserClint

func NewUserClint(hc *http.Client) *Client

func (*Client) Do

func (r *Client) Do(method, path string, queryParams interface{}, jsonParams interface{}, d interface{}) *APIError

func (*Client) DoDelete

func (r *Client) DoDelete(path string, d interface{}) *APIError

func (*Client) DoGet

func (r *Client) DoGet(path string, queryParams interface{}, d interface{}) *APIError

func (*Client) DoPatch

func (r *Client) DoPatch(path string, jsonParams interface{}, d interface{}) *APIError

func (*Client) DoPost

func (r *Client) DoPost(path string, jsonParams interface{}, d interface{}) *APIError

type CreateBoardOpts

type CreateBoardOpts struct {
	Name        string `json:"name"`
	Description string `json:"description,omitempty"`
	Privacy     string `json:"privacy,omitempty"`
}

CreateBoardOpts represents the parameters for create a board

type CreateBoardSectionOpts

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

CreateBoardSectionOpts represents the parameter for create or update board section.

type CreatePinMediaSourceOpts

type CreatePinMediaSourceOpts struct {
	SourceType    string `json:"source_type"`
	ContentType   string `json:"content_type,omitempty"`
	Data          string `json:"data,omitempty,omitempty"`
	Url           string `json:"url,omitempty"`
	CoverImageURL string `json:"cover_image_url,omitempty"`
	MediaID       string `json:"media_id,omitempty"`
}

CreatePinMediaSourceOpts represents the parameters for pin media resource

type CreatePinOpts

type CreatePinOpts struct {
	Link           string                   `json:"link,omitempty"`
	Title          string                   `json:"title,omitempty"`
	Description    string                   `json:"description,omitempty"`
	AltText        string                   `json:"alt_text,omitempty"`
	BoardID        string                   `json:"board_id"`
	BoardSectionID string                   `json:"board_section_id,omitempty"`
	MediaSource    CreatePinMediaSourceOpts `json:"media_source"`
}

CreatePinOpts represents the parameters for create a pin

type DailyMetrics

type DailyMetrics struct {
	DataStatus *string  `json:"data_status"`
	Date       *string  `json:"date"`
	Metrics    *Metrics `json:"metrics"`
}

DailyMetrics represents the metrics info for a date.

func (DailyMetrics) String

func (dm DailyMetrics) String() string

type GetAdAccountAnalyticsOpts

type GetAdAccountAnalyticsOpts struct {
	StartDate            string   `url:"start_date"`
	EndDate              string   `url:"end_date"`
	Columns              []string `url:"columns"`
	Granularity          string   `url:"granularity"`
	ClickWindowDays      int      `url:"click_window_days,omitempty"`
	EngagementWindowDays int      `url:"engagement_window_days,omitempty"`
	ViewWindowDays       int      `url:"view_window_days,omitempty"`
	ConversionReportTime string   `url:"conversion_report_time,omitempty"`
}

GetAdAccountAnalyticsOpts represents the parameters for Get ad account analytics.

type GetAdAnalyticsOpts

type GetAdAnalyticsOpts struct {
	StartDate            string   `url:"start_date"`
	EndDate              string   `url:"end_date"`
	AdIDs                []string `url:"ad_ids"`
	Columns              []string `url:"columns"`
	Granularity          string   `url:"granularity"`
	ClickWindowDays      int      `url:"click_window_days,omitempty"`
	EngagementWindowDays int      `url:"engagement_window_days,omitempty"`
	ViewWindowDays       int      `url:"view_window_days,omitempty"`
	ConversionReportTime string   `url:"conversion_report_time,omitempty"`
}

GetAdAnalyticsOpts represents the parameters for Get ad analytics.

type GetAdGroupAnalyticsOpts

type GetAdGroupAnalyticsOpts struct {
	StartDate            string   `url:"start_date"`
	EndDate              string   `url:"end_date"`
	AdGroupIDs           []string `url:"ad_group_ids"`
	Columns              []string `url:"columns"`
	Granularity          string   `url:"granularity"`
	ClickWindowDays      int      `url:"click_window_days,omitempty"`
	EngagementWindowDays int      `url:"engagement_window_days,omitempty"`
	ViewWindowDays       int      `url:"view_window_days,omitempty"`
	ConversionReportTime string   `url:"conversion_report_time,omitempty"`
}

GetAdGroupAnalyticsOpts represents the parameters for Get ad group analytics.

type GetCampaignAnalyticsOpts

type GetCampaignAnalyticsOpts struct {
	StartDate            string   `url:"start_date"`
	EndDate              string   `url:"end_date"`
	CampaignIDs          []string `url:"campaign_ids"`
	Columns              []string `url:"columns"`
	Granularity          string   `url:"granularity"`
	ClickWindowDays      int      `url:"click_window_days,omitempty"`
	EngagementWindowDays int      `url:"engagement_window_days,omitempty"`
	ViewWindowDays       int      `url:"view_window_days,omitempty"`
	ConversionReportTime string   `url:"conversion_report_time,omitempty"`
}

GetCampaignAnalyticsOpts represents the parameters for Get campaign analytics.

type GetProductGroupAnalyticsOpts

type GetProductGroupAnalyticsOpts struct {
	StartDate            string   `url:"start_date"`
	EndDate              string   `url:"end_date"`
	ProductGroupIDs      []string `url:"product_group_ids"`
	Columns              []string `url:"columns"`
	Granularity          string   `url:"granularity"`
	ClickWindowDays      int      `url:"click_window_days,omitempty"`
	EngagementWindowDays int      `url:"engagement_window_days,omitempty"`
	ViewWindowDays       int      `url:"view_window_days,omitempty"`
	ConversionReportTime string   `url:"conversion_report_time,omitempty"`
}

GetProductGroupAnalyticsOpts represents the parameters for Get product group analytics.

type Image

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

Image represents the image info

func (Image) String

func (m Image) String() string

type ListAdAccountsOpts

type ListAdAccountsOpts struct {
	IncludeSharedAccounts bool `url:"include_shared_accounts,omitempty"`
	ListOptions
}

ListAdAccountsOpts represents the parameters for list ad accounts.

type ListAdGroupsOpts

type ListAdGroupsOpts struct {
	CampaignIDs               []string `url:"campaign_ids"`
	AdGroupIDs                []string `url:"ad_group_ids"`
	EntityStatuses            []string `url:"entity_statuses"`
	Order                     string   `url:"order"`
	TranslateInterestsToNames bool     `url:"translate_interests_to_names"`
	ListOptions
}

ListAdGroupsOpts represents the parameters for list ad groups.

type ListAdsOpts

type ListAdsOpts struct {
	CampaignIDs               []string `url:"campaign_ids"`
	AdGroupIDs                []string `url:"ad_group_ids"`
	AdIDs                     []string `url:"ad_ids"`
	EntityStatuses            []string `url:"entity_statuses"`
	Order                     string   `url:"order"`
	TranslateInterestsToNames bool     `url:"translate_interests_to_names"`
	ListOptions
}

ListAdsOpts represents the parameters for list ads.

type ListBoardOpts

type ListBoardOpts struct {
	ListOptions
	Privacy string `url:"privacy,omitempty"`
}

ListBoardOpts represents the parameters for list boards

type ListCampaignsOpts

type ListCampaignsOpts struct {
	CampaignIDs    []string `url:"campaign_ids"`
	EntityStatuses []string `url:"entity_statuses"`
	Order          string   `url:"order"`
	ListOptions
}

ListCampaignsOpts represents the parameters for list campaigns.

type ListOptions

type ListOptions struct {
	Bookmark string `url:"bookmark,omitempty"`
	PageSize int    `url:"page_size,omitempty"`
}

ListOptions specifies the optional parameters to various List methods that support offset pagination.

type Media

type Media struct {
	Images    map[string]*Image `json:"images"`
	MediaType *string           `json:"media_type"`
}

Media represents the media info

func (Media) String

func (m Media) String() string

type MediaResource

type MediaResource Resource

func (*MediaResource) GetMediaUploadDetail

func (r *MediaResource) GetMediaUploadDetail(mediaID string) (*MediaUpload, *APIError)

GetMediaUploadDetail Get details for a registered media upload, including its current status. Refer: https://developers.pinterest.com/docs/api/v5/#operation/media/get

func (*MediaResource) ListMediaUploads

func (r *MediaResource) ListMediaUploads(args ListOptions) (*MediaUploadsResponse, *APIError)

ListMediaUploads List media uploads filtered by given parameters. Refer: https://developers.pinterest.com/docs/api/v5/#operation/media/list

func (*MediaResource) RegisterMediaUpload

RegisterMediaUpload Register your intent to upload media. Refer: https://developers.pinterest.com/docs/api/v5/#operation/media/create

type MediaUpload

type MediaUpload struct {
	MediaID   *string `json:"media_id"`
	MediaType *string `json:"media_type"`
	Status    *string `json:"status"`
}

MediaUpload represents the media upload info.

func (MediaUpload) String

func (m MediaUpload) String() string

type MediaUploadsResponse

type MediaUploadsResponse struct {
	Items    []*MediaUpload `json:"items"`
	Bookmark *string        `json:"bookmark"`
}

MediaUploadsResponse represents the response for list media uploads.

func (MediaUploadsResponse) String

func (m MediaUploadsResponse) String() string

type Metrics

type Metrics struct {
	Engagement        *int64   `json:"ENGAGEMENT"`
	EngagementRate    *float64 `json:"ENGAGEMENT_RATE"`
	ClickThrough      *int64   `json:"CLICKTHROUGH"`
	ClickThroughRate  *float64 `json:"CLICKTHROUGH_RATE"`
	CloseUp           *int64   `json:"CLOSEUP"`
	CloseUpRate       *float64 `json:"CLOSEUP_RATE"`
	Save              *int64   `json:"SAVE"`
	SaveRate          *float64 `json:"SAVE_RATE"`
	Impression        *int64   `json:"IMPRESSION"`
	OutboundClick     *int64   `json:"OUTBOUND_CLICK"`
	OutboundClickRate *float64 `json:"OUTBOUND_CLICK_RATE"`
	PinClick          *int64   `json:"PIN_CLICK"`
	PinClickRate      *float64 `json:"PIN_CLICK_RATE"`
}

Metrics represents the metrics info.

func (Metrics) String

func (m Metrics) String() string

type Pin

type Pin struct {
	ID             *string     `json:"id"`
	CreatedAt      *string     `json:"created_at"`
	Link           *string     `json:"link"`
	Title          *string     `json:"title"`
	Description    *string     `json:"description"`
	AltText        *string     `json:"alt_text"`
	BoardID        *string     `json:"board_id"`
	BoardSectionID *string     `json:"board_section_id"`
	BoardOwner     *BoardOwner `json:"board_owner"`
	Media          *Media      `json:"media"`
}

Pin represents the pin info.

func (Pin) String

func (p Pin) String() string

type PinResource

type PinResource Resource

func (*PinResource) CreatePin

func (r *PinResource) CreatePin(args CreatePinOpts) (*Pin, *APIError)

CreatePin Create a Pin on a board or board section owned by the "operation user_account". Refer: https://developers.pinterest.com/docs/api/v5/#operation/pins/get

func (*PinResource) DeletePin

func (r *PinResource) DeletePin(pinID string) *APIError

DeletePin Delete a Pins owned by the "operation user_account" - or on a group board that has been shared with this account. Refer: https://developers.pinterest.com/docs/api/v5/#operation/pins/delete

func (*PinResource) GetPin

func (r *PinResource) GetPin(pinID, adAccountID string) (*Pin, *APIError)

GetPin Get a Pin owned by the "operation user_account" - or on a group board that has been shared with this account. Refer: https://developers.pinterest.com/docs/api/v5/#operation/pins/get

type PinsResponse

type PinsResponse struct {
	Items    []*Pin  `json:"items"`
	Bookmark *string `json:"bookmark"`
}

PinsResponse represents the response for list pins

func (PinsResponse) String

func (p PinsResponse) String() string

type RegisterMediaUploadOpts

type RegisterMediaUploadOpts struct {
	MediaType string `json:"media_type"`
}

RegisterMediaUploadOpts represents the parameters for register media upload.

type RegisterMediaUploadResponse

type RegisterMediaUploadResponse struct {
	MediaID          *string           `json:"media_id"`
	MediaType        *string           `json:"media_type"`
	UploadURL        *string           `json:"upload_url"`
	UploadParameters map[string]string `json:"upload_parameters"`
}

RegisterMediaUploadResponse The response for register media upload.

func (RegisterMediaUploadResponse) String

type Resource

type Resource struct {
	Cli *Client
}

type TrackingURLs

type TrackingURLs struct {
	Impression           []*string `json:"impression"`
	Click                []*string `json:"click"`
	Engagement           []*string `json:"engagement"`
	BuyableButton        []*string `json:"buyable_button"`
	AudienceVerification []*string `json:"audience_verification"`
}

TrackingURLs represents the Third-party tracking URLs.

func (TrackingURLs) String

func (t TrackingURLs) String() string

type UpdateBoardOpts

type UpdateBoardOpts struct {
	Name        string `json:"name,omitempty"`
	Description string `json:"description,omitempty"`
	Privacy     string `json:"privacy,omitempty"`
}

UpdateBoardOpts represents the parameters for update board

type UserAccount

type UserAccount struct {
	AccountType  *string `json:"account_type"`
	ProfileImage *string `json:"profile_image"`
	WebsiteURL   *string `json:"website_url"`
	Username     *string `json:"username"`
}

UserAccount represent a Pinterest user account Refer: https://developers.pinterest.com/docs/api/v5/#tag/user_account

func (UserAccount) String

func (u UserAccount) String() string

type UserAccountAnalytics

type UserAccountAnalytics struct {
	All *UserAccountAnalyticsMetrics `json:"all"`
}

UserAccountAnalytics represents the reponse for the user account analytics.

func (UserAccountAnalytics) String

func (m UserAccountAnalytics) String() string

type UserAccountAnalyticsMetrics

type UserAccountAnalyticsMetrics struct {
	DailyMetrics   []*DailyMetrics `json:"daily_metrics"`
	SummaryMetrics *Metrics        `json:"summary_metrics"`
}

UserAccountAnalyticsMetrics represents the metrics info for days.

func (UserAccountAnalyticsMetrics) String

type UserAccountAnalyticsOpts

type UserAccountAnalyticsOpts struct {
	StartDate          string `url:"start_date"`
	EndDate            string `url:"end_date"`
	FromClaimedContent string `url:"from_claimed_content,omitempty"`
	PinFormat          string `url:"pin_format,omitempty"`
	AppTypes           string `url:"app_types,omitempty"`
	MetricTypes        string `url:"metric_types,omitempty"`
	SplitField         string `url:"split_field,omitempty"`
	AdAccountID        string `url:"ad_account_id,omitempty"`
}

UserAccountAnalyticsOpts the parameters for the user account analytics.

type UserAccountResource

type UserAccountResource Resource

func (*UserAccountResource) GetUserAccount

func (r *UserAccountResource) GetUserAccount(adAccountID string) (*UserAccount, *APIError)

GetUserAccount Get account information for the user account Refer: https://developers.pinterest.com/docs/api/v5/#operation/user_account/get

func (*UserAccountResource) GetUserAccountAnalytics

func (r *UserAccountResource) GetUserAccountAnalytics(args UserAccountAnalyticsOpts) (*UserAccountAnalytics, *APIError)

GetUserAccountAnalytics Get analytics for the user account.

Jump to

Keyboard shortcuts

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