Skip to content
This repository has been archived by the owner on Apr 23, 2019. It is now read-only.
/ annict.js Public archive

📀 Annict API client library for JavaScript ( & TypeScript) 📺

License

Notifications You must be signed in to change notification settings

nukosuke/annict.js

Repository files navigation

Notice

Annict maintainer announced REST API as deprecated. https://twitter.com/shimbaco/status/1117113862514335744?s=20

This library is no longer maintained. Please use GraphQL instead. https://developers.annict.jp/graphql-api/

npm version Bower version Build Status Dependency Status devDependency Status Greenkeeper badge

annict.js

annict.js is client library for anime tracking service, Annict. This library supports Node.js and browser.

Install

NPM

npm install annict --save
# or if you use Yarn for package managing
yarn add annict

Bower

bower install annict --save

Usage

See also Document for more details.

Node.js

var Annict = require('annict').default;

var annict = new Annict();

annict.OAuth.token(
  CLIENT_ID,
  CLIENT_SECRET,
  GRANT_TYPE,
  REDIRECT_URI,
  CODE
)
.then(response => response.json())
.then(token => {

  annict.client.setToken(token.access_token);

  annict.Work.get({ filter_title: 'shirobako' })
  .then(response => response.json())
  .then(works    => console.log(works));

  annict.Me.Record.create({
    episode_id: 5013,
    comment: 'あぁ^~心がぴょんぴょんするんじゃぁ^~',
    rating: 5.0,
    share_twitter: 'true',
    share_facebook: 'false'
  })
  .then(response => response.json())
  .then(record   => console.log(record));

});

Browser

<body>
    ...
    <script src='/js/annict.min.js'></script>
    <script>
        var annict = new Annict();
    </script>
</body>

Available methods are partly differ between Node.js and browser.

License

Copyright (c) 2018 nukosuke
This software is licensed under MIT license. http://opensource.org/licenses/mit-license.php