Check out Ionic Enterprise

Pinterestβ

Improve this doc

This plugin is still in beta stage and may not work as expected. Please submit any issues to the plugin repo.

Cordova plugin for Pinterest

Repo: https://github.com/zyramedia/cordova-plugin-pinterest

Installation

  1. Install the Cordova and Ionic Native plugins:
    $ ionic cordova plugin add cordova-plugin-pinterest --variable APP_ID=YOUR_APP_ID
    $ npm install --save @ionic-native/pinterest
    
  2. Add this plugin to your app's module

Supported platforms

Usage

import { Pinterest, PinterestUser, PinterestPin, PinterestBoard } from '@ionic-native/pinterest';

constructor(private pinterest: Pinterest) { }

...

const scopes = [
  this.pinterest.SCOPES.READ_PUBLIC,
  this.pinterest.SCOPES.WRITE_PUBLIC,
  this.pinterest.SCOPES.READ_RELATIONSHIPS,
  this.pinterest.SCOPES.WRITE_RELATIONSHIPS
];

this.pinterest.login(scopes)
  .then(res => console.log('Logged in!', res))
  .catch(err => console.error('Error loggin in', err));

this.pinterest.getMyPins()
  .then((pins: Array<PinterestPin>) => console.log(pins))
  .catch(err => console.error(err));

this.pinterest.getMe()
  .then((user: PinterestUser) => console.log(user));

this.pinterest.getMyBoards()
  .then((boards: Array<PinterestBoard>) => console.log(boards));

Instance Members

SCOPES

Convenience constant for authentication scopes

login(scopes)

Logs the user in using their Pinterest account.

Param Type Details
scopes Array<string>

Array of scopes that you need access to. You can use Pinterest.SCOPES constant for convenience.

Returns: Promise<any> The response object will contain the user’s profile data, as well as the access token (if you need to use it elsewhere, example: send it to your server and perform actions on behalf of the user).

getMe(fields)

Gets the authenticated user’s profile

Param Type Details
fields string

Fields to retrieve, separated by commas. Defaults to all available fields.

Returns: Promise<PinterestUser> Returns a promise that resolves with the user’s object

getMyPins(fields, limit)

Param Type Details
fields string

Optional fields separated by comma

limit number

Optional limit, defaults to 100, maximum is 100.

Returns: Promise<Array<PinterestPin>>

getMyBoards(fields, limit)

Param Type Details
fields string

Optional fields separated by comma

limit number

Optional limit, defaults to 100, maximum is 100.

Returns: Promise<Array<PinterestBoard>>

getMyLikes(fields, limit)

Get the authenticated user’s likes.

Param Type Details
fields string

Optional fields separated by comma

limit number

Optional limit, defaults to 100, maximum is 100.

Returns: Promise<Array<PinterestPin>>

getMyFollowers(fields, limit)

Get the authenticated user’s followers.

Param Type Details
fields string

Optional fields separated by comma

limit number

Optional limit, defaults to 100, maximum is 100.

Returns: Promise<Array<PinterestUser>>

getMyFollowedBoards(fields, limit)

Get the authenticated user’s followed boards.

Param Type Details
fields string

Optional fields separated by comma

limit number

Optional limit, defaults to 100, maximum is 100.

Returns: Promise<Array<PinterestBoard>>

getMyFollowedInterests(fields, limit)

Get the authenticated user’s followed interests.

Param Type Details
fields string

Optional fields separated by comma

limit number

Optional limit, defaults to 100, maximum is 100.

Returns: Promise<any>

getUser(username, fields)

Get a user’s profile.

Param Type Details
username
fields

Returns: Promise<PinterestUser>

getBoard(boardId, fields)

Get a board’s data.

Param Type Details
boardId
fields

Returns: Promise<PinterestBoard>

getBoardPins(boardId, fields, limit)

Get Pins of a specific board.

Param Type Details
boardId string

The ID of the board

fields string

Optional fields separated by comma

limit number

Optional limit, defaults to 100, maximum is 100.

Returns: Promise<Array<PinterestPin>>

deleteBoard(boardId)

Delete a board.

Param Type Details
boardId string

The ID of the board

Returns: Promise<PinterestUser>

createBoard(name, desc)

Create a new board for the authenticated user.

Param Type Details
name string

Name of the board

desc string

Optional description of the board

Returns: Promise<PinterestBoard>

getPin(pinId, fields)

Get a Pin by ID.

Param Type Details
pinId string

The ID of the Pin

fields string

Optional fields separated by comma

Returns: Promise<PinterestPin>

deletePin(pinId)

Deletes a pin

Param Type Details
pinId string

The ID of the pin

Returns: Promise<any>

createPin(note, boardId, imageUrl, link)

Creates a Pin

Param Type Details
note string

Note/Description of the pin

boardId string

Board ID to put the Pin under

imageUrl string

URL of the image to share

link string

Optional link to share

Returns: Promise<PinterestPin>

PinterestUser

Param Type Details
id string

The unique string of numbers and letters that identifies the user on Pinterest.

(optional)
username string

The user’s Pinterest username.

(optional)
first_name string

The user’s first name.

(optional)
last_name string

The user’s last name.

(optional)
bio string

The text in the user’s “About you” section in their profile.

(optional)
created_at string

The date the user created their account in ISO 8601 format

(optional)
counts any

The user’s stats, including how many Pins, follows, boards and likes they have.

(optional)
image any

The user’s profile image. The response returns the image’s URL, width and height.

(optional)

PinterestBoard

Param Type Details
id string

The unique string of numbers and letters that identifies the board on Pinterest.

(optional)
name string

The name of the board.

(optional)
url string

The link to the board.

(optional)
description string

The user-entered description of the board.

(optional)
creator PinterestUser

The first and last name, ID and profile URL of the user who created the board.

(optional)
created_at string

The date the user created the board.

(optional)
counts any

The board’s stats, including how many Pins, followers, user's following and collaborators it has.

(optional)
image any

The user’s profile image. The response returns the image’s URL, width and height.

(optional)

PinterestPin

Param Type Details
id string

The unique string of numbers and letters that identifies the Pin on Pinterest.

(optional)
link string

The URL of the webpage where the Pin was created.

(optional)
url string

The URL of the Pin on Pinterest.

(optional)
creator PinterestUser

The first and last name, ID and profile URL of the user who created the board.

(optional)
board PinterestBoard

The board that the Pin is on.

(optional)
created_at string

The date the Pin was created.

(optional)
note string

The user-entered description of the Pin.

(optional)
color string

The dominant color of the Pin’s image in hex code format.

(optional)
counts any

The Pin’s stats, including the number of repins, comments and likes.

(optional)
media any

The media type of the Pin (image or video).

(optional)
attribution any

The source data for videos, including the title, URL, provider, author name, author URL and provider name.

(optional)
image any

The Pin’s image. The default response returns the image’s URL, width and height.

(optional)
metadata any

Extra information about the Pin for Rich Pins. Includes the Pin type (e.g., article, recipe) and related information (e.g., ingredients, author).

(optional)

API

Native

General