import { Album, Artist, Track } from './audio.ts'; import { Playable } from './base/playable.ts'; import type { LibrarySection, SectionType } from './library.ts'; import type { PlaylistResponse } from './playlist.types.ts'; import type { PlexServer } from './server.ts'; import { Episode, Movie } from './video.ts'; export interface CreateRegularPlaylistOptions { /** True to create a smart playlist */ smart?: false; /** Regular playlists only */ items: SectionType[]; } export interface CreateSmartPlaylistOptions { /** True to create a smart playlist */ smart: true; /** Smart playlists only, the library section to create the playlist in. */ section?: LibrarySection; /** Smart playlists only, limit the number of items in the playlist. */ limit?: number; /** * Smart playlists only, a string of comma separated sort fields * or a list of sort fields in the format ``column:dir``. * See {@link Section.search} for more info. */ sort?: string; /** * Smart playlists only, a dictionary of advanced filters. * See {@link Section.search} for more info. */ filters?: Record; } export type CreatePlaylistOptions = CreateRegularPlaylistOptions | CreateSmartPlaylistOptions; type PlaylistContent = Episode | Movie | Track | Album | Artist; export interface UpdatePlaylistOptions { /** New title for the playlist */ title?: string; /** New summary/description for the playlist */ summary?: string; } export declare class Playlist extends Playable { static TAG: string; static create(server: PlexServer, title: string, options: CreatePlaylistOptions): Promise; /** * Update a playlist's metadata by ratingKey without fetching the full playlist first. * * @param server - The Plex server instance * @param ratingKey - The playlist's ratingKey * @param options - Fields to update (title and/or summary) * * @example * ```typescript * await Playlist.update(server, '12345', { * title: 'My Updated Playlist', * summary: 'A new description' * }); * ``` */ static update(server: PlexServer, ratingKey: string, options: UpdatePlaylistOptions): Promise; /** Create a smart playlist. */ private static _createSmart; private static _create; TYPE: string; addedAt: Date; updatedAt: Date; composite: string; guid: string; leafCount: number; playlistType: string; smart: boolean; summary: string; allowSync?: boolean; duration?: number; durationInSeconds?: number; /** Cache of playlist items */ private _items; _edit(args: { title?: string; summary?: string; }): Promise; edit(changeObj: { title?: string; summary?: string; }): Promise; /** * @returns the item in the playlist that matches the specified title. */ item(title: string): Promise; items(): Promise; /** Add items to a playlist. */ addItems(items: PlaylistContent[]): Promise; /** Remove an item from a playlist. */ removeItems(items: PlaylistContent[]): Promise; /** Delete the playlist. */ delete(): Promise; protected _loadData(data: PlaylistResponse): void; protected _loadFullData(data: { Metadata: PlaylistResponse[]; }): void; private _getPlaylistItemID; } export {};