New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

kitsu

Package Overview
Dependencies
Maintainers
1
Versions
173
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

kitsu

Promise based NodeJS API wrapper for Kitsu.io

  • 0.2.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5K
decreased by-8.5%
Maintainers
1
Weekly downloads
 
Created
Source

Kitsu

npm npm installs David

Travis AppVeyor CC Coverage CC Score CC Issues

Promise based NodeJS API wrapper for Kitsu.io

Features

  • Supports OAuth2 authentication
  • Supports the JSON API specification
    • Serialises and deserialises requests for pain-free usage
  • Supports the Promise API
  • Retries on network failure
  • Timeout handling

Install

yarn add kitsu

or

npm install kitsu --save

Usage

// ES6/Babel/Webpack
import Kitsu from 'kitsu'
// CommonJS/Browserify
const Kitsu = require('kitsu')

const kitsu = new Kitsu()

kitsu.get('anime').then(res => console.log(res))

More Examples

Docs

new Kitsu([options])

Creates a new instance with the required JSON API headers already set

options

Type: object

headers

Type: object

Add extra headers to be sent with all requests, or override the default user-agent header (Kitsu/<version> (https://github.com/wopian/kitsu))

If you already have an accessToken for authentication, you can construct the authorization header here with authorization: 'Bearer <accessToken>'

retries

Type: number Default: 2

Number of times to retry requests after network failures

timeout

Type: number Default: 30000

Milliseconds to wait before aborting the request with an ETIMEDOUT error

useElectronNet

Type: boolean Default: true

When used in Electron, Kitsu will automatically use electron.net instead of the NodeJS http module

kitsu.auth([options])

Returns a Promised object containing an accessToken on successful authentication

The authorization header is automatically applied and passed in all subsequent DELETE, GET, PATCH and POST requests

options

Type: object

Inputs for the OAuth 2 Authorization Code grant type. See the Kitsu API documentation for further details

clientId (required)

Type: string

clientSecret (required)

Type: string

username (required)

Type: string

password (required)

Type: string

kitsu.delete(model, data)

Not yet implemented!

kitsu.get(model, [options])

Returns a Promised response object

model

Type: string

The resource model to request. Check out the Kitsu API documentation for available models

options

Type: object

Any of the JSON API request parameters

include

Type: string

Include relationships. Multiple includes are comma seperated

fields

Type: object

Returns only the specified fields

sort

Type: string

Sort lists by an attribute. Append - for descending order. Multiple sorts are comma seperated

page

Type: object

Limit number of returned resources (page: { limit: 2 }).

Offset returned resources (page: { offset: 20 })

filter

Type: object

Filter returned resources by an attribute

kitsu.patch(model, data)

Not yet implemented!

kitsu.post(model, data)

Not yet implemented!

kitsu.whoAmI([options])

Returns a Promised object containing the user data if the authorization header is set

options

Type: object

compact

Type: boolean Default: false

Returns just the user ID and name if true

kitsu.headers

Type: object

Returns the current headers

kitsu.isAuth

Type: boolean

Returns true if the authorization header is set

Contributing

Requirements

  • git 2.0.0 or newer
  • node.js 7.0.0 or newer
  • yarn 0.21.0 or newer (optional)

Setup

  1. Fork this repo

  2. Clone your fork:

    git clone https://github.com/your-username/kitsu.git
    cd kitsu
    
  3. Create a feature branch:

    git checkout -b your-feature-name
    
  4. Install dependencies:

    yarn install
    # or
    npm install
    
  5. Commit changes:

    git commit -am 'feat: add feature name'
    
  6. Push changes:

    git push origin your-feature-name
    
  7. Open a pull request

Releases

See CHANGELOG

License

All code released under MIT

Keywords

FAQs

Package last updated on 05 Jul 2017

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