@book000/pixivts
Version:
pixiv Unofficial API Library for TypeScript
42 lines • 2.44 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.PixivNovelItemCheck = void 0;
const utils_1 = require("../utils");
const checks_1 = require("../checks");
const pixiv_common_1 = require("./pixiv-common");
class PixivNovelItemCheck extends checks_1.BaseSimpleCheck {
checks() {
return {
id: (data) => typeof data.id === 'number',
title: (data) => typeof data.title === 'string',
caption: (data) => typeof data.caption === 'string',
restrict: (data) => typeof data.restrict === 'number',
x_restrict: (data) => typeof data.x_restrict === 'number',
is_original: (data) => typeof data.is_original === 'boolean',
image_urls: (data) => typeof data.image_urls === 'object' &&
new pixiv_common_1.ImageUrlsCheck().throwIfFailed(data.image_urls),
create_date: (data) => typeof data.create_date === 'string',
tags: (data) => typeof data.tags === 'object' &&
Array.isArray(data.tags) &&
data.tags.every((tag) => new pixiv_common_1.TagCheck().throwIfFailed(tag)),
page_count: (data) => typeof data.page_count === 'number',
text_length: (data) => typeof data.text_length === 'number',
user: (data) => typeof data.user === 'object' &&
new pixiv_common_1.PixivUserCheck().throwIfFailed(data.user),
series: (data) => typeof data.series === 'object' &&
((0, utils_1.isEmptyObject)(data.series) ||
new pixiv_common_1.SeriesCheck().throwIfFailed(data.series)),
is_bookmarked: (data) => typeof data.is_bookmarked === 'boolean',
total_bookmarks: (data) => typeof data.total_bookmarks === 'number',
total_view: (data) => typeof data.total_view === 'number',
visible: (data) => typeof data.visible === 'boolean',
total_comments: (data) => typeof data.total_comments === 'number',
is_muted: (data) => typeof data.is_muted === 'boolean',
is_mypixiv_only: (data) => typeof data.is_mypixiv_only === 'boolean',
is_x_restricted: (data) => typeof data.is_x_restricted === 'boolean',
novel_ai_type: (data) => typeof data.novel_ai_type === 'number',
};
}
}
exports.PixivNovelItemCheck = PixivNovelItemCheck;
//# sourceMappingURL=pixiv-novel.js.map