Giter Club home page Giter Club logo

cordova-plugin-pinterest's Introduction

npm npm npm

Cordova Pinterest Plugin

Cordova plugin for Pinterest

Platforms

This plugin supports Android and iOS

Installation

cordova plugin add cordova-plugin-pinterest --variable APP_ID=YOUR_APP_ID

// or 

cordova plugin add https://github.com/zyramedia/cordova-plugin-pinterest --variable APP_ID=YOUR_APP_ID

Usage

You can access the plugins functions via the global variable cordova.plugins.Pinterest.

Example

function onSuccess(response) {
    console.log('Success, the response is: ', reponse);
}

function onError(errorMessage) {
    console.error('Error, the error message is: ', errorMessage);
}

var scopes = [
    cordova.plugins.Pinterest.SCOPES.READ_PUBLIC,
    cordova.plugins.Pinterest.SCOPES.WRITE_PUBLIC,
    cordova.plugins.Pinterest.SCOPES.READ_RELATIONSHIPS,
    cordova.plugins.Pinterest.SCOPES.WRITE_RELATIONSHIPS
];

// lets login first
cordova.plugins.Pinterest.login(scopes, onSuccess, onError);

// after logging in, we can perform any other function
// for the sake of a clean example, this code is here, but you should wait for the login function to succeed first
cordova.plugins.Pinterest.getMyPins(onSuccess, onError);

Methods

login

login(scopes, onSuccess, onError)
  • scopes: List of permissions to request. You can use cordova.plugins.Pinterest.SCOPES constants for convenience. Available permissions are: read_public, write_public, read_relationships, write_relationships.

Logs the user in. 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

getMe(onSuccess, onError, fields)
  • fields: (optional) Fields to retrieve, separated by commas. Defaults to all available fields.

Gets the authenticated user's profile.

getMyPins

getMyPins(onSuccess, onError, fields, limit)
  • fields: (optional) Fields to retrieve, separated by commas. Defaults to all available fields.
  • limit: (optional) Limit the number of items returned. Capped to 100. Defaults to 100.

Gets the authenticated user's Pins.

getMyBoards

getMyBoards(onSuccess, onError, fields, limit)
  • fields: (optional) Fields to retrieve, separated by commas. Defaults to all available fields.
  • limit: (optional) Limit the number of items returned. Capped to 100. Defaults to 100.

Get the authenticated user's boards.

getMyLikes

getMyLikes(onSuccess, onError, fields, limit)
  • fields: (optional) Fields to retrieve, separated by commas. Defaults to all available fields.
  • limit: (optional) Limit the number of items returned. Capped to 100. Defaults to 100.

Get the authenticated user's likes.

getMyFollowers

getMyFollowers(onSucccess, onError, fields, limit)
  • fields: (optional) Fields to retrieve, separated by commas. Defaults to all available fields.
  • limit: (optional) Limit the number of items returned. Capped to 100. Defaults to 100.

Get the authenticated user's followers.

getMyFollowedBoards

getMyFollowedBoards(onSuccess, onError, fields, limit)
  • fields: (optional) Fields to retrieve, separated by commas. Defaults to all available fields.
  • limit: (optional) Limit the number of items returned. Capped to 100. Defaults to 100.

Get the authenticated user's followed boards.

getMyFollowedInterests

getMyFollowedInterests(onSuccess, onError, fields, limit)
  • fields: (optional) Fields to retrieve, separated by commas. Defaults to all available fields.
  • limit: (optional) Limit the number of items returned. Capped to 100. Defaults to 100.

Get the authenticated user's followed interests.

getUser

getUser(username, onSuccess, onError, fields)
  • username: Username of the user
  • fields: (optional) Fields to retrieve, separated by commas. Defaults to all available fields.

Get a user's profile.

getBoard

getBoard(boardId, onSuccess, onError, fields)
  • boardId: The ID of the board
  • fields: (optional) Fields to retrieve, separated by commas. Defaults to all available fields.

Get a board's data.

getBoardPins

getBoardPins(boardId, onSuccess, onError, fields, limit)
  • boardId: The ID of the board
  • fields: (optional) Fields to retrieve, separated by commas. Defaults to all available fields.
  • limit: (optional) Limit the number of items returned. Capped to 100. Defaults to 100.

Get Pins of a specific board.

deleteBoard

deleteBoard(boardId, onSuccess, onError)
  • boardId: The ID of the board

Delete a board.

createBoard

createBoard(name, desc, onSuccess, onError)
  • name: Name of the board
  • desc: (optional) Description of the board

Create a new board for the authenticated user.

getPin

getPin(pinId, onSuccess, onError, fields)
  • pinId: The ID of the Pin
  • fields: (optional) Fields to retrieve, separated by commas. Defaults to all available fields.

Get a Pin by ID.

deletePin

deletePin(pinId, onSuccess, onError)
  • pinId: The ID of the Pin

Delete a Pin.

createPin

createPin(note, boardId, imageUrl, link, onSuccess, onError)
  • note: Note/Description of the Pin
  • boardId: Board ID to put the Pin under
  • imageUrl: URL of the image to share
  • link: (optional) Link to share

Create a Pin for the authenticated user.


Quirks

  • This plugin does not provide any pagination features. You are limited only to the latest 100 entries and you cannot fetch the next pages. This can be fixed but it will make this API more complicated. It can be added if demanded by many users.



Contribution

  • Having an issue? or looking for support? Open an issue and we will get you the help you need.
  • Got a new feature or a bug fix? Fork the repo, make your changes, and submit a pull request.

Support this project

If you find this project useful, please star the repo to let people know that it's reliable. Also, share it with friends and colleagues that might find this useful as well. Thank you ๐Ÿ˜„

cordova-plugin-pinterest's People

Contributors

coreycarron avatar ihadeed avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

cordova-plugin-pinterest's Issues

Logout

Hi, I am testing the plugin, can your please tell me how to logout from Ionic Cordova Angular2 integration? Only the first time I got the login screen, after thar 1st time the logged user profile is loaded automatically

Can't create new pin on iOS, working fine on android

Successfully logged in Pinterest on iOS
Successfully fetched Pinterest boards list on iOS
But can not create new pin
createPin(note, boardId, imageUrl, link, onSuccess, onError)

and also no callback is called(neither onSuccess nor onError)

my actual code

cordova.plugins.Pinterest.createPin(

"Heloo there", 

"807551845621954609", 

"https://ichef-1.bbci.co.uk/news/660/cpsprodpb/1325A/production/_88762487_junk_food.jpg" , 

"www.google.com",

function(result){
	alert("Succesfully pinned your post")
}, 

function(error){
	alert("Error while pinning your post")
})

The same code is working absolutely fine on android.
This is the screenshot of pinterest website(I successfully pinned it from android emulator using above code) :

pinterest pin

ionic Version : 1.3.1

please ask for any other information required.

How to provide imageUrl in function createPin(note, boardId, imageUrl, link, onSuccess, onError)

I can't find a way to provide imageUrl for the image that I have captured using :

cordova-plugin-camera

I tried passing the FILE_URI provided by this plugin, but I got this error :

message: "Parameter 'image_url' (value file:///storage/emulated/0/Android/data/com.xyzapp.ghera/cache/1511345813897.jpg) is not a valid URL format."
param: "image_url"
type: "api"

I tried passing the whole binary value from DATA_URL of image but that also resulted in error.

But when I provided a url from internet it worked.
Please tell me how can I provide image_url of the image from my device

Login on android opens up browser with an invalid Redirect URI

On making the login request, the app opens up browser with the following URL returns a response which mentions the redirect_uri doesn't match the registered URIs. (Happens when Pinterest Android APP is not installed)

https://api.pinterest.com/oauth/?client_id=+4926105309897833856&scope=read_public&redirect_uri=pdk+4926105309897833856%3A%2F%2F&response_type=token

{ status: "failure", message: "You are not permitted to access that resource.", code: 7, data: "The provided redirect_uri pdk 4926105309897833856:// does not match any of the registered redirect URIs." }

The pinterest currently allows only the redirect URIs which uses https:// protocol. While the redirect URI from the below request has something like pdk+4926105309897833856%3A%2F%2F. So the login is not working.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.