node-hitomi
Version:
Hitomi.la API for Node.js
62 lines (58 loc) • 1.5 kB
JavaScript
'use strict';
const base = require('../internal/base.cjs');
class Title {
constructor(display, japanese = null) {
this.display = display;
this.japanese = japanese;
}
}
class GalleryReference extends base.Base {
constructor(hitomi, id) {
super(hitomi);
this.id = id;
}
retrieve() {
return this.hitomi.galleries.retrieve(this.id);
}
}
class TranslatedGallery extends GalleryReference {
constructor(hitomi, id, language, url) {
super(hitomi, id);
this.language = language;
this.url = url;
}
}
class Gallery extends TranslatedGallery {
constructor(hitomi, id, language, url, title, type, artists, groups, series, characters, tags, files, translations, relations, isBlocked, addedDate, publishedDate = null, video = null) {
super(hitomi, id, language, url);
this.title = title;
this.type = type;
this.artists = artists;
this.groups = groups;
this.series = series;
this.characters = characters;
this.tags = tags;
this.files = files;
this.translations = translations;
this.relations = relations;
this.isBlocked = isBlocked;
this.addedDate = addedDate;
this.publishedDate = publishedDate;
this.video = video;
}
getThumbnails() {
return [this.files[0], this.files[Math.floor(this.files.length / 2)]];
}
}
Gallery.TYPES = new Set([
'doujinshi',
'manga',
'artistcg',
'gamecg',
'imageset',
'anime'
]);
exports.Gallery = Gallery;
exports.GalleryReference = GalleryReference;
exports.Title = Title;
exports.TranslatedGallery = TranslatedGallery;