Git Product home page Git Product logo

fanfou-sdk-browser's Introduction

fanfou-sdk-browser

Fanfou SDK for browser

Install

$ npm i fanfou-sdk-browser

Usage

import Fanfou from 'fanfou-sdk-browser'

OAuth

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

  const timeline = await ff.get('/statuses/home_timeline', {format: 'html'})
})();

XAuth

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

  await ff.xauth();

  const publimeTimeline = await ff.get('/statuses/public_timeline', {count: 10})
  const status = await ff.post('/statuses/update', {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 protocol, default is ''
  • 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

ff.getRequestToken()
ff.getAccessToken(token)
ff.xauth()
ff.get(uri, params)
ff.post(uri, params)
ff.upload(uri, params)

Examples

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

  // Get access token
  const token = await ff.getAccessToken({oauthToken: '', oauthTokenSecret: ''});

  // Get timeline
  const timeline = await ff.get('/statuses/home_timeline', {});

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

  // Upload photo
  const result = await ff.upload('/photos/upload', {photo: uploadFile, status: 'unicorn'});
})();

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')
    }
  }
})

Related

License

MIT

fanfou-sdk-browser's People

Contributors

greenkeeper[bot] avatar litomore avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

yugai liuxsdev

fanfou-sdk-browser's Issues

An in-range update of webpack is breaking the build 🚨

The devDependency webpack was updated from 4.35.3 to 4.36.0.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

webpack is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • ❌ continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).

Release Notes for v4.36.0

Features

  • SourceMapDevToolPlugin append option now supports the default placeholders in addition to [url]
  • Arrays in resolve and parser options (Rule and Loader API) support backreferences with "..." when overriding options.
Commits

The new version differs by 42 commits.

  • 95d21bb 4.36.0
  • aa1216c Merge pull request #9422 from webpack/feature/dot-dot-dot-merge
  • b3ec775 improve merging of resolve and parsing options
  • 53a5ae2 Merge pull request #9419 from vankop/remove-valid-jsdoc-rule
  • ab75240 Merge pull request #9413 from webpack/dependabot/npm_and_yarn/ajv-6.10.2
  • 0bdabf4 Merge pull request #9418 from webpack/dependabot/npm_and_yarn/eslint-plugin-jsdoc-15.5.2
  • f207cdc remove valid jsdoc rule in favour of eslint-plugin-jsdoc
  • 31333a6 chore(deps-dev): bump eslint-plugin-jsdoc from 15.3.9 to 15.5.2
  • 036adf0 Merge pull request #9417 from webpack/dependabot/npm_and_yarn/eslint-plugin-jest-22.8.0
  • 37d4480 Merge pull request #9411 from webpack/dependabot/npm_and_yarn/simple-git-1.121.0
  • ce2a183 chore(deps-dev): bump eslint-plugin-jest from 22.7.2 to 22.8.0
  • 0beeb7e Merge pull request #9391 from vankop/create-hash-typescript
  • bf1a24a #9391 resolve super call discussion
  • bd7d95b #9391 resolve discussions, AbstractMethodError
  • 4190638 chore(deps): bump ajv from 6.10.1 to 6.10.2

There are 42 commits in total.

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of query-string is breaking the build 🚨


☝️ Important announcement: Greenkeeper will be saying goodbye πŸ‘‹ and passing the torch to Snyk on June 3rd, 2020! Find out how to migrate to Snyk and more at greenkeeper.io


The dependency query-string was updated from 6.11.1 to 6.12.0.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

query-string is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.

Status Details
  • ❌ build (13.x): There are 1 failures, 0 warnings, and 0 notices.
  • βœ… build (12.x): null
  • βœ… build (10.x): null

Release Notes for v6.12.0

v6.11.1...v6.12.0

Commits

The new version differs by 2 commits.

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Add support for OAuth process

Currently, this package only supports XAuth, maybe we can add getRequestToken() and getAccessToken() for doing OAuth.

An in-range update of webpack is breaking the build 🚨

The devDependency webpack was updated from 4.39.0 to 4.39.1.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

webpack is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • ❌ continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).

Release Notes for v4.39.1

Bugfixes

  • fix problem that progress lines were too long on some terminals
  • fix a problem that ...100% is displayed instead of 100%
Commits

The new version differs by 6 commits.

  • f29445d 4.39.1
  • 1d98dad Merge pull request #9513 from webpack/bugfix/terminal-length
  • 8006117 make status logging 1 char shorter
  • ff8946e update examples
  • 5a9d029 Merge pull request #9512 from webpack/bugfix/100-percent
  • 7cfe0e6 fix 100% progress output

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

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.