Pinterest

Contents

Cordova plugin for Pinterest

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

Ionic Pinterest插件的安装(Installation)

ionic cordova plugin add cordova-plugin-pinterest npm install @ionic-native/pinterest

Ionic Pinterest插件支持的平台(Supported Platforms)

  • Android
  • iOS

Ionic Pinterest插件的用法(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) => console.log(pins))
  .catch(err => console.error(err));

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

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