mirror of
https://gitlab.com/vyla-entertainment/documentation.git
synced 2026-11-20 17:45:44 -05:00
made sdk docs up to date
This commit is contained in:
@@ -34,8 +34,8 @@ const sdk = new VylaSDK();
|
||||
const searchResult = await sdk.searchManga('Chainsaw Man', 1, 10);
|
||||
|
||||
console.log(`Total results: ${searchResult.total}`);
|
||||
searchResult.items.forEach((manga) => {
|
||||
console.log(`[ID: ${manga.id}] ${manga.title} - ${manga.latestChapter}`);
|
||||
searchResult.results.forEach((manga) => {
|
||||
console.log(`[ID: ${manga.id}] ${manga.title} (${manga.status})`);
|
||||
});
|
||||
```
|
||||
|
||||
@@ -43,15 +43,22 @@ searchResult.items.forEach((manga) => {
|
||||
```json
|
||||
{
|
||||
"page": 1,
|
||||
"perPage": 10,
|
||||
"total": 42,
|
||||
"items": [
|
||||
"results": [
|
||||
{
|
||||
"id": "chainsaw-man",
|
||||
"title": "Chainsaw Man",
|
||||
"cover": "https://cdn.atsu.moe/covers/chainsaw-man.webp",
|
||||
"englishTitle": "Chainsaw Man",
|
||||
"authors": ["Tatsuki Fujimoto"],
|
||||
"type": "Manga",
|
||||
"medium": "MANGA",
|
||||
"status": "Ongoing",
|
||||
"latestChapter": "Chapter 180"
|
||||
"year": 2018,
|
||||
"rating": 8.7,
|
||||
"popularity": 120000,
|
||||
"poster": "https://cdn.atsu.moe/static/covers/chainsaw-man.webp",
|
||||
"posterSmall": "https://cdn.atsu.moe/static/covers/chainsaw-man-sm.webp",
|
||||
"posterMedium": "https://cdn.atsu.moe/static/covers/chainsaw-man-md.webp"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -61,18 +68,18 @@ searchResult.items.forEach((manga) => {
|
||||
|
||||
### 2. Fetching Manga Details & Chapters
|
||||
|
||||
Retrieve full metadata, descriptions, genres, and the complete chapter index:
|
||||
Retrieve full metadata, synopsis, genres, and the complete chapter index:
|
||||
|
||||
```javascript
|
||||
const mangaDetails = await sdk.getManga('chainsaw-man');
|
||||
|
||||
console.log('Title:', mangaDetails.title);
|
||||
console.log('Synopsis:', mangaDetails.description);
|
||||
console.log('Synopsis:', mangaDetails.synopsis);
|
||||
console.log('Genres:', mangaDetails.genres.join(', '));
|
||||
console.log('Available Chapters:', mangaDetails.chapters.length);
|
||||
|
||||
const latest = mangaDetails.chapters[0];
|
||||
console.log(`Latest Chapter: ${latest.chapterNumber} (ID: ${latest.id})`);
|
||||
console.log(`Latest Chapter: ${latest.number} (ID: ${latest.id})`);
|
||||
```
|
||||
|
||||
---
|
||||
@@ -85,23 +92,31 @@ To render the reader view, fetch the ordered page image assets for a specific ch
|
||||
const mangaId = 'chainsaw-man';
|
||||
const chapterId = 'chapter-1';
|
||||
|
||||
const pages = await sdk.getMangaChapter(mangaId, chapterId);
|
||||
const chapter = await sdk.getMangaChapter(mangaId, chapterId);
|
||||
|
||||
console.log(`Chapter contains ${pages.length} pages.`);
|
||||
console.log(`Chapter ${chapter.number} contains ${chapter.pages.length} pages.`);
|
||||
|
||||
pages.forEach((page, index) => {
|
||||
console.log(`Page ${index + 1}: ${page.url} [${page.width}x${page.height}]`);
|
||||
chapter.pages.forEach((page) => {
|
||||
console.log(`Page ${page.number}: ${page.url} [${page.width}x${page.height}]`);
|
||||
});
|
||||
```
|
||||
|
||||
#### Page Object Structure
|
||||
#### Chapter Response Structure
|
||||
```json
|
||||
{
|
||||
"index": 1,
|
||||
"url": "https://cdn.atsu.moe/data/.../01.webp",
|
||||
"width": 1080,
|
||||
"height": 1600,
|
||||
"aspectRatio": 0.675
|
||||
"id": "chapter-1",
|
||||
"number": 1,
|
||||
"title": "Dog & Chainsaw",
|
||||
"scanlatorId": null,
|
||||
"pages": [
|
||||
{
|
||||
"number": 1,
|
||||
"url": "https://cdn.atsu.moe/static/data/.../01.webp",
|
||||
"width": 1080,
|
||||
"height": 1600,
|
||||
"aspectRatio": 0.675
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
@@ -113,4 +128,4 @@ When rendering manga pages in a frontend reader:
|
||||
|
||||
1. **Prevent Cumulative Layout Shift (CLS)**: Use the provided `aspectRatio` or `width`/`height` in CSS (`aspect-ratio: attr(width) / attr(height);`) to reserve vertical scroll space before each image finishes downloading.
|
||||
2. **Preload Neighboring Pages**: Implement a 2-page lookahead preloader so viewers turning pages experience instantaneous transitions.
|
||||
3. **Session Cleanup**: In long-running background tasks, invoke `cleanup()` from the module when closing reader sessions to terminate idle TLS sockets.
|
||||
3. **Session Cleanup**: In long-running background tasks, invoke `cleanup()` from `src/manga/atsu.js` when closing reader sessions to terminate idle TLS sockets.
|
||||
Reference in New Issue
Block a user