getLibrary()
Gets library/playlist data by ID.
Signature
const library = await window.FairShareSDK.getLibrary(libraryId);
Parameters
| Parameter | Type | Description |
|---|---|---|
libraryId | string | Library/playlist ID |
Returns
Promise<Library> — The library object with media items.
Library Object:
| Property | Type | Description |
|---|---|---|
id | number | Library ID |
title | string | Library title |
description | string | Library description |
media_items | array | Array of media objects |
item_count | number | Total number of items |
Example
// Get library/playlist const library = await window.FairShareSDK.getLibrary("my-playlist-id"); console.log('Title:', library.title); console.log('Items:', library.item_count); // Loop through media items library.media_items.forEach(item => { console.log('Media:', item.title); });