1.0.3 • Published 3 years ago

shikimori-api-node v1.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

Документация на русском: /README_ru.md

Shikimori Web API wrapper for Node.js

Table of contents

Installation

npm i shikimori-api-node

Usage

Prologue

  1. Every function is promise.
  2. Every 'parameters' variable should be Object.
  3. Some parameters for methods are not defined in official API documentation (such as broadcast) but I tried to note ones that support them.

Authentication

If you need methods that require scopes then you will need to login with credentials of your application. Note that logging in is optional. API can work without it.

First of all, complete first two steps at shikimori/oauth.

Note that authentication code can be used only once and should be renewed by the user itself.

Loggin' in
const Shikimori = require('shikimori-api-node');
const shiki = new Shikimori();

shiki.auth.login({
  clientid: 'xxxxxxxxxxxxxx',
  clientsecret: 'xxxxxxxxxxxxxx',
  authcode: 'xxxxxxxxxxxxxx',
  useragent: 'xxxxxx', // only name of your app
  redirecturi: 'xxxxxxxxx' // optional: 'urn:ietf:wg:oauth:2.0:oob' by default
});

Authenticates you and resolves as credentials object with all info that you may need.

Refreshing token
shiki.auth.refreshToken();

Refreshes token internally and resolves as credentials object with updated info.

Requests

Small lib for API HTTP requests. Don't put '/' in start of the method. Every function resolves as HTTP body.

 

shiki.api.request.get(method, parameters)

method: string, parameters: object

Performs a GET API request.

 

shiki.api.request.post(method, parameters)

method: string, parameters: object

Performs a POST API request.

 

shiki.api.request.put(method, id, parameters)

method: string, id: integer, parameters: object

Performs a PUT API request.

 

shiki.api.request.delete(method, id)

method: string, id: integer

Performs a DELETE API request.

API v1

Achievements

shiki.api.achievements.get(userid)

List user achievements

 

Animes

shiki.api.animes.list(parameters)

Get animes

 

shiki.api.animes.get(id)

Get the anime with specified id

 

shiki.api.animes.getRoles(id)

Get the anime's roles

 

shiki.api.animes.getSimiliar(id)

Get similiar animes to specified

 

shiki.api.animes.getRelated(id)

Get animes related to specified

 

shiki.api.animes.getScreenshots(id)

Get anime's screenshots

 

shiki.api.animes.getFranchise(id)

Get anime's franchise

 

shiki.api.animes.getExternalLinks(id)

Get anime's external links (such as wikipedia or myanimelist ones)

 

shiki.api.animes.getTopics(id, parameters)

Get anime's topics

 

Appear

shiki.api.appear.create(ids)

Mark comments or topics as read

 

Bans

shiki.api.bans.list()

Get banned users

 

Calendars

shiki.api.calendars.get(censored)

Get actual calendar

 

Characters

shiki.api.characters.get(id)

Get anime character info

 

shiki.api.characters.search(search)

Search characters

 

Clubs

shiki.api.clubs.list(parameters)

Get clubs

 

shiki.api.clubs.update(id, club)

Update club

 

shiki.api.clubs.get(id)

Get the club with specified id

 

shiki.api.clubs.getAnimes(id)

Get club's animes

 

shiki.api.clubs.getMangas(id)

Get club's mangas

 

shiki.api.clubs.getRanobe(id)

Get club's ranobe

 

shiki.api.clubs.getCharacters(id)

Get club's characters

 

shiki.api.clubs.getMembers(id)

Get club's members

 

shiki.api.clubs.getImages(id)

Get club's images

 

shiki.api.clubs.join(id)

Join club

 

shiki.api.clubs.leave(id)

Leave club

 

Comments

shiki.api.comments.get(id)

Get the comment by specified id

 

shiki.api.comments.list(id, parameters)

List comments

 

shiki.api.comments.create(parameters)

Create comment

Note: broadcast param stands for comment-broadcast and can be used only by club administrator; frontend changes resolve format

 

shiki.api.comments.update(id, parameters)

Update comment

 

shiki.api.comments.delete(id)

Delete comment

 

Constants

shiki.api.constants.anime()

Get anime constants

 

shiki.api.constants.manga()

Get manga constants

 

shiki.api.constants.userRate()

Get user rate constants

 

shiki.api.constants.club()

Get club constants

 

shiki.api.constants.smileys()

Get smiles constants

 

Dialogs

shiki.api.dialogs.list()

List current user dialogs

 

shiki.api.dialogs.get(id)

Get the dialog with specified id

 

shiki.api.delete(id)

Delete dialog

 

Favorites

Alias: shiki.api.favourites

 

shiki.api.favorites.create(linked_type, linked_id, kind)

Create favourite

 

shiki.api.favorites.delete(linked_type, linked_id)

Remove favourite

 

shiki.api.favorites.reorder(id, new_index)

Assign new position to a favourite

 

Forums

shiki.api.forums.list()

List forums

 

Friends

shiki.api.friends.add(id)

Add friend

 

shiki.api.friends.remove(id)

Remove friend

 

Genres

shiki.api.genres.list()

List genres

 

Mangas

shiki.api.mangas.list(parameters)

List mangas

 

shiki.api.mangas.get(id)

Get the manga with specified id

 

shiki.api.mangas.getRoles(id)

Get manga's roles

 

shiki.api.mangas.getSimilar(id)

Get mangas similar to specified

 

shiki.api.mangas.getRelated(id)

Get mangas related to specified

 

shiki.api.mangas.getFranchise(id)

Get manga's franchise

 

shiki.api.mangas.getExternalLinks(id)

Get manga's external links

 

shiki.api.mangas.getTopics(id, parameters)

Get manga's topics

 

Messages

shiki.api.messages.get(id)

Get message with specified id

 

shiki.api.messages.send(message)

Send message

 

shiki.api.messages.update(id, message)

Update message

 

shiki.api.messages.delete(id)

Delete message

 

shiki.api.messages.markAsRead(ids, is_read)

Mark messages as read or unread

 

shiki.api.messages.markAllAsRead(parameters)

Mark all messages as read

Note: frontend changes resolve format

 

shiki.api.messages.deleteAll(parameters)

Delete all messages

Note: frontend changes resolve format

 

People

shiki.api.people.get(id)

Get the person by specified id

 

shiki.api.people.search(parameters)

Search people

 

Publishers

shiki.api.publishers.list()

List publishers

 

Ranobe

shiki.api.ranobe.list(parameters)

List ranobe

 

shiki.api.ranobe.get(id)

Get the ranobe by specified id

 

shiki.api.ranobe.getRoles(id)

Get ranobe's roles

 

shiki.api.ranobe.getSimilar(id)

Get ranobe similar to specified

 

shiki.api.ranobe.getRelated(id)

Get ranobe related to specified

 

shiki.api.ranobe.getFranchise(id)

Get ranobe's franchise

 

shiki.api.ranobe.getExternalLinks(id)

Get ranobe's external links

 

shiki.api.ranobe.getTopics(id, parameters)

Get ranobe's topics

 

Stats

shiki.api.stats.listActiveUsers()

List users having at least 1 completed animes and active during last month

 

Studios

shiki.api.studios.list()

List studios

 

Styles

shiki.api.styles.get(id)

Get style by specified id

 

shiki.api.styles.preview(style)

Preview style

 

shiki.api.styles.create(style)

Create style

 

shiki.api.styles.update(id, style)

Update style

 

Topics

shiki.api.topics.list(parameters)

List topics

 

shiki.api.topics.getUpdates(parameters)

Get topic's updates

 

shiki.api.topics.getHot(limit)

Get hot topics

 

shiki.api.topics.get(id)

Get the topic with specified id

 

shiki.api.topics.create(parameters)

Create topic

 

shiki.api.topics.update(id, parameters)

Update the specified topic

 

shiki.api.topics.delete(id)

Delete the specified topic

 

User images

shiki.api.userImages.create(parameters)

Create an user image

 

User rates

shiki.api.userRates.delete()

Clean entire user rates and history

 

shiki.api.userRates.reset()

Reset all user scores to 0

 

Users

shiki.api.users.list(parameters)

List users

 

shiki.api.users.get(id, is_nickname)

Get user with specified id or username

 

shiki.api.users.getBriefInfo(id)

Get user's brief info

 

shiki.api.users.whoami()

Get current user's brief info

 

shiki.api.users.signOut()

Sign out of current user

 

shiki.api.users.getFriends(id)

Get user's friends

 

shiki.api.users.getClubs(id)

Get user's clubs

 

shiki.api.users.getAnimeRates(id, parameters)

Get user's anime rates

 

shiki.api.users.getMangaRates(id, parameters)

Get user's manga rates

 

shiki.api.users.getFavourites(id)

Alias method: shiki.api.users.getFavourites(id)

Get user's favourites

 

shiki.api.users.getMessages(id, parameters)

Get user's messages

 

shiki.api.users.getUnreadMsgCount(id)

Alias method: shiki.api.users.getUnreadMessagesCount(id)

Get unread messages count

 

shiki.api.users.getHistory(id, parameters)

Get user's history

 

shiki.api.users.getBans(id)

Get user's blocked ones

 

Videos

shiki.api.videos.list(id)

List videos

 

shiki.api.videos.create(id, parameters)

Create a video

 

shiki.api.videos.delete(anime_id, video_id)

Delete a video

API v2

Topics - Topic ignore

shiki.api.v2.topics.ignore(id, parameters)

Ignore topic

 

shiki.api.v2.topics.unignore(id)

Unignore topic

 

Users - User ignore

shiki.api.v2.users.ignore(id)

Ignore user

 

shiki.api.v2.users.unignore(id)

Unignore user

 

Abuse requests

shiki.api.v2.abuseRequests.markCommentAsOfftopic(comment_id)

Alias method: shiki.api.v2.abuseRequests.offtopic(comment_id)

Mark comment as offtopic

 

shiki.api.v2.abuseRequests.markCommentAsSummary(comment_id)

Alias method: shiki.api.v2.abuseRequests.summary(comment_id)

Mark comment as summary

 

shiki.api.v2.abuseRequests.reportRuleViolation(parameters)

Alias method: shiki.api.v2.abuseRequests.summary(parameters)

Create abuse about violation of site rules

 

shiki.api.v2.abuseRequests.reportSpoiler(parameters)

Alias method: shiki.api.v2.abuseRequests.spoiler(parameters)

Create abuse about spoiler content in comment

 

Episode notifications

shiki.api.v2.episodeNotifications.create(parameters)

Notify shikimori about anime episode release

 

User rates - Main methods

shiki.api.v2.userRates.get(id)

Get user's rate

 

shiki.api.v2.userRates.list(parameters)

List user's rates

 

shiki.api.v2.userRates.create(parameters)

Create user rate

 

shiki.api.v2.userRates.update(id, parameters)

Update user's rate

 

shiki.api.v2.userRates.increment(id)

Increment episodes/chapters by 1

 

shiki.api.v2.userRates.delete(id)

Delete user rate

Support

QIWI: qiwi.com/n/LENNYLIZOWZSKIY

1.0.3

3 years ago

1.0.2

3 years ago

1.0.0

3 years ago