Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fanfou-sdk

Package Overview
Dependencies
Maintainers
1
Versions
61
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fanfou-sdk

Fanfou SDK for Node.js

  • 5.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
55K
increased by68.85%
Maintainers
1
Weekly downloads
 
Created
Source

fanfou-sdk-node

Fanfou SDK for Node.js

Install

npm i fanfou-sdk

Usage

import Fanfou from 'fanfou-sdk';

OAuth

const ff = new Fanfou({
	consumerKey: '',
	consumerSecret: '',
	oauthToken: '',
	oauthTokenSecret: ''
});

const timeline = await ff.getHomeTimeline();

XAuth

const ff = new Fanfou({
	consumerKey: '',
	consumerSecret: '',
	username: '',
	password: ''
});

await ff.xauth();

const timeline = await ff.getPublicTimeline({count: 10});
const status = await ff.createStatus({status: 'Hi Fanfou'});

Options

  • consumerKey: The consumer key
  • consumerSecret: The consumer secret
  • oauthToken: The OAuth token
  • oauthTokenSecret: The OAuth token secret
  • username: The Fanfou username
  • password: The Fanfou password
  • protocol: Set the prototol, default is http:
  • apiDomain: Set the API domain, default is api.fanfou.com
  • oauthDomain: Set the OAuth domain, default is fanfou.com
  • hooks: Hooks allow modifications with OAuth

For more Fanfou API docs, see the Fanfou API doc.

API

For full SDK API, please refer to the documentation.

Examples

// Get request token
const token = await ff.getRequestToken();

// Get access token
const token = await ff.getAccessToken(token);

// Get timeline
const timeline = await ff.getHomeTimeline();

// Post status
const status = await ff.createStatus({status: 'post test'});

// Upload photo
const result = await ff.uploadPhoto({photo: fs.createReadStream(path), status: 'unicorn'});

// Get user
const user = await ff.getUser({id: 'lito'});

// Request Fanfou API by passing the URI
const timeline = await ff.get('/statuses/home_timeline', {count: 10});
const status = await ff.post('/statuses/update', {status: 'Hi Fanfou'});

Tips

Use hooks for your reverse-proxy server

const ff = new Fanfou({
	consumerKey: '',
	consumerSecret: '',
	oauthToken: '',
	oauthTokenSecret: '',
	apiDomain: 'api.example.com',
	oauthDomain: 'example.com',
	hooks: {
		baseString: str => {
			return str.replace('example.com', 'fanfou.com');
		}
	}
});

License

MIT

Keywords

FAQs

Package last updated on 11 Sep 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc