Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/teambition/Pocket-Node-SDK
Headless Node.js SDK for integrating with [Pocket](http://getpocket.com/)
https://github.com/teambition/Pocket-Node-SDK
Last synced: 3 months ago
JSON representation
Headless Node.js SDK for integrating with [Pocket](http://getpocket.com/)
- Host: GitHub
- URL: https://github.com/teambition/Pocket-Node-SDK
- Owner: teambition
- Archived: true
- Created: 2013-12-04T07:01:38.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2014-10-23T02:04:38.000Z (about 10 years ago)
- Last Synced: 2024-04-13T16:10:59.493Z (7 months ago)
- Language: CoffeeScript
- Size: 290 KB
- Stars: 23
- Watchers: 2
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Node SDK for [Pocket](http://getpocket.com)
This is a headless sdk for integrating with pocket app, including add new articles, modify exist articles and fetch articles, etc.## Install
First, install the pocket sdk with [npm](http://npmjs.org).
```
npm install pocket-sdk
```## How to use
```
pocket = require('pocket-sdk')consumer_key = 'your consumer_key'
redirect_uri = 'your redirect_uri'pocket.init(consumer_key, redirect_uri)
# required access token
pocket.get({
access_token: access_token
}, (err, ret) ->
# ret: { status: 1, complete: 1, list: {} ]
)pocket.add({
url: '',
title: '',
tags: '',
tweet_id: ''
}, (err, ret) ->
# ret: { item: {}, status:1 }
)pocket.send([actions], (err, ret) ->
# ret: { action_results:[true], status: 1 }
)```
## Use pocket.oauth middleware
- Supported Options
- authorizeUri: `/pocket/authorize`
- pocketCallback: `/pocket/callback`
- refer: `pocket`
- afterSuccess: (req, res) ->```
pocket.init(consumer_key, redirect_uri)app.configure ->
app.use(express.bodyParser())
app.use(express.query())
app.use(express.cookieParser())
app.use(app.router)app.use(pocket.oauth({
afterSuccess: (token, req, res, next) ->
# TODO: callback
# token: { access_token: '', username: ''}
pocket.setAccessToken(token.access_token)
next()
}))```
## DevelopFirst, install module dependencies with `npm install`. If you don't have grunt-cli installed, run `npm install -g grunt-cli`.
Then, whenever you modified the source code in src folder, run `grunt` to compile before use. Or, just run `grunt watch` to let grunt compile the source code automatically when editing.