@francofantomius/jellyfin 0.1.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -187,6 +187,15 @@ interface BaseItemDto {
187
187
  BackdropImageTags?: string[];
188
188
  MediaSources?: MediaSourceInfo[];
189
189
  HasLyrics?: boolean;
190
+ /**
191
+ * Trickplay thumbnail metadata dictionary (Jellyfin 10.9+).
192
+ * Keyed by MediaSourceId -> Width string -> TrickplayInfoDto.
193
+ */
194
+ Trickplay?: Record<string, Record<string, TrickplayInfoDto>> | null;
195
+ /**
196
+ * Chapter markers associated with the media item.
197
+ */
198
+ Chapters?: ChapterInfoDto[];
190
199
  /**
191
200
  * Unique relational playlist entry ID (Jellyfin 12+).
192
201
  * Distinguishes duplicate tracks inside the same playlist.
@@ -255,7 +264,17 @@ interface GetSongsOptions {
255
264
  interface SearchOptions {
256
265
  limit?: number;
257
266
  startIndex?: number;
258
- includeItemTypes?: string;
267
+ parentId?: string;
268
+ includeItemTypes?: string | string[];
269
+ mediaTypes?: string | string[];
270
+ genres?: string[];
271
+ years?: number[];
272
+ isFavorite?: boolean;
273
+ sortBy?: string;
274
+ sortOrder?: 'Ascending' | 'Descending';
275
+ fields?: string;
276
+ recursive?: boolean;
277
+ userId?: string;
259
278
  }
260
279
  interface CreatePlaylistDto {
261
280
  Name: string;
@@ -279,12 +298,14 @@ interface UpdatePlaylistOptions {
279
298
  name?: string;
280
299
  }
281
300
  interface AudioStreamOptions {
301
+ static?: boolean;
282
302
  maxStreamingBitrate?: string | number;
283
303
  quality?: AudioQualityPresetKey | AudioQualityOption | number | string;
284
304
  startTimeTicks?: number;
285
305
  container?: string;
286
306
  transcodingContainer?: string;
287
307
  audioCodec?: string;
308
+ deviceId?: string;
288
309
  /**
289
310
  * Whether to include the api_key token in the URL query parameters.
290
311
  * Defaults to true for HTML5 <audio> tag compatibility.
@@ -298,6 +319,7 @@ interface AudioHlsStreamOptions {
298
319
  startTimeTicks?: number;
299
320
  audioCodec?: string;
300
321
  segmentLength?: number;
322
+ deviceId?: string;
301
323
  /**
302
324
  * Whether to include the api_key token in the URL query parameters.
303
325
  * Defaults to true for legacy compatibility.
@@ -435,6 +457,7 @@ interface VideoStreamOptions {
435
457
  container?: string;
436
458
  transcodingContainer?: string;
437
459
  transcodingProtocol?: string;
460
+ deviceId?: string;
438
461
  useQueryToken?: boolean;
439
462
  }
440
463
  interface VideoHlsStreamOptions {
@@ -446,14 +469,15 @@ interface VideoHlsStreamOptions {
446
469
  maxWidth?: number;
447
470
  maxHeight?: number;
448
471
  maxFramerate?: number;
449
- segmentLength?: number;
450
- minSegments?: number;
451
472
  audioStreamIndex?: number;
452
473
  subtitleStreamIndex?: number;
453
474
  subtitleMethod?: 'Embed' | 'Encode' | 'Hls' | 'External';
475
+ startTimeTicks?: number;
476
+ segmentLength?: number;
477
+ minSegments?: number;
454
478
  transcodingContainer?: 'ts' | 'fmp4' | string;
455
479
  transcodingProtocol?: 'hls';
456
- startTimeTicks?: number;
480
+ deviceId?: string;
457
481
  useQueryToken?: boolean;
458
482
  }
459
483
  interface SubtitleTrackInfo {
@@ -491,6 +515,322 @@ interface DownloadItemOptions {
491
515
  index?: number;
492
516
  quality?: VideoQualityPresetKey | VideoQualityOption | number | string;
493
517
  }
518
+ interface GetResumeItemsOptions {
519
+ userId?: string;
520
+ limit?: number;
521
+ startIndex?: number;
522
+ parentId?: string;
523
+ mediaTypes?: string[];
524
+ enableImages?: boolean;
525
+ enableUserData?: boolean;
526
+ imageTypeLimit?: number;
527
+ enableImageTypes?: string[];
528
+ fields?: string;
529
+ }
530
+ interface GetNextUpOptions {
531
+ userId?: string;
532
+ parentId?: string;
533
+ seriesId?: string;
534
+ limit?: number;
535
+ startIndex?: number;
536
+ fields?: string;
537
+ enableImages?: boolean;
538
+ enableUserData?: boolean;
539
+ enableTotalRecordCount?: boolean;
540
+ imageTypeLimit?: number;
541
+ enableImageTypes?: string[];
542
+ disableFirstEpisode?: boolean;
543
+ nextUpDateCutoff?: string;
544
+ }
545
+ interface GetLatestMediaOptions {
546
+ userId?: string;
547
+ parentId?: string;
548
+ limit?: number;
549
+ fields?: string;
550
+ includeItemTypes?: string[];
551
+ isPlayed?: boolean;
552
+ enableImages?: boolean;
553
+ imageTypeLimit?: number;
554
+ enableImageTypes?: string[];
555
+ groupItems?: boolean;
556
+ }
557
+ interface StopActiveEncodingOptions {
558
+ playSessionId: string;
559
+ deviceId?: string;
560
+ }
561
+ type WebSocketMessageType = 'KeepAlive' | 'ForceKeepAlive' | 'LibraryChanged' | 'UserDataChanged' | 'Sessions' | 'Play' | 'Playstate' | 'GeneralCommand' | 'ActivityLogEntry' | 'ScheduledTasksInfo' | 'ScheduledTasksInfoStop' | 'SessionsStart' | 'SessionsStop' | (string & {});
562
+ interface WebSocketInboundMessage<T = unknown> {
563
+ MessageType: WebSocketMessageType;
564
+ MessageId?: string;
565
+ Data?: T;
566
+ }
567
+ interface LibraryChangedData {
568
+ FoldersAddedTo?: string[];
569
+ FoldersRemovedFrom?: string[];
570
+ ItemsAdded?: string[];
571
+ ItemsUpdated?: string[];
572
+ ItemsRemoved?: string[];
573
+ CollectionFolders?: string[];
574
+ EmptyFolders?: string[];
575
+ }
576
+ interface UserDataChangedData {
577
+ UserId: string;
578
+ UserDataList: UserItemDataDto[];
579
+ }
580
+ interface WebSocketModuleOptions {
581
+ url?: string;
582
+ autoReconnect?: boolean;
583
+ reconnectIntervalMs?: number;
584
+ maxReconnectAttempts?: number;
585
+ keepAliveIntervalMs?: number;
586
+ webSocketFactory?: (url: string) => any;
587
+ }
588
+ interface SessionPlayState {
589
+ PositionTicks?: number;
590
+ CanSeek?: boolean;
591
+ IsPaused?: boolean;
592
+ IsMuted?: boolean;
593
+ VolumeLevel?: number;
594
+ AudioStreamIndex?: number;
595
+ SubtitleStreamIndex?: number;
596
+ MediaSourceId?: string;
597
+ PlayMethod?: string;
598
+ RepeatMode?: string;
599
+ PlaylistItemId?: string;
600
+ }
601
+ interface SessionInfoDto {
602
+ Id: string;
603
+ UserId?: string;
604
+ UserName?: string;
605
+ Client?: string;
606
+ LastActivityDate?: string;
607
+ LastPlaybackCheckIn?: string;
608
+ DeviceName?: string;
609
+ DeviceType?: string;
610
+ NowPlayingItem?: BaseItemDto;
611
+ NowViewingItem?: BaseItemDto;
612
+ DeviceId?: string;
613
+ ApplicationVersion?: string;
614
+ IsActive?: boolean;
615
+ SupportsMediaControl?: boolean;
616
+ SupportsRemoteControl?: boolean;
617
+ PlayableMediaTypes?: string[];
618
+ SupportedCommands?: string[];
619
+ TranscodingInfo?: Record<string, unknown>;
620
+ PlayState?: SessionPlayState;
621
+ AdditionalUsers?: Array<{
622
+ UserId: string;
623
+ UserName: string;
624
+ }>;
625
+ Capabilities?: Record<string, unknown>;
626
+ }
627
+ interface GetSessionsOptions {
628
+ controllableByUserId?: string;
629
+ deviceId?: string;
630
+ activeWithinSeconds?: number;
631
+ }
632
+ type PlayCommandType = 'PlayNow' | 'PlayNext' | 'PlayLast';
633
+ interface RemotePlayOptions {
634
+ playCommand?: PlayCommandType;
635
+ startPositionTicks?: number;
636
+ mediaSourceId?: string;
637
+ audioStreamIndex?: number;
638
+ subtitleStreamIndex?: number;
639
+ startIndex?: number;
640
+ }
641
+ type PlaystateCommand = 'PlayPause' | 'Pause' | 'Unpause' | 'Stop' | 'Seek' | 'NextTrack' | 'PreviousTrack';
642
+ type GeneralCommandType = 'MoveUp' | 'MoveDown' | 'MoveLeft' | 'MoveRight' | 'PageUp' | 'PageDown' | 'PreviousLetter' | 'NextLetter' | 'ToggleOsd' | 'ToggleContextMenu' | 'Select' | 'Back' | 'TakeScreenshot' | 'SendKey' | 'SendString' | 'GoHome' | 'GoToSettings' | 'VolumeUp' | 'VolumeDown' | 'Mute' | 'Unmute' | 'ToggleMute' | 'SetVolume' | 'SetAudioStreamIndex' | 'SetSubtitleStreamIndex' | 'DisplayContent' | 'DisplayMessage' | (string & {});
643
+ interface GeneralCommandDto {
644
+ Name: GeneralCommandType;
645
+ Arguments?: Record<string, string>;
646
+ }
647
+ interface SessionMessageOptions {
648
+ header?: string;
649
+ text: string;
650
+ timeoutMs?: number;
651
+ }
652
+ interface QuickConnectResult {
653
+ Code: string;
654
+ Secret: string;
655
+ AuthenticationToken?: string;
656
+ }
657
+ interface QuickConnectState {
658
+ Authenticated: boolean;
659
+ Secret: string;
660
+ Code?: string;
661
+ AuthenticationToken?: string;
662
+ UserId?: string;
663
+ DateAdded?: string;
664
+ }
665
+ interface QuickConnectPollOptions {
666
+ intervalMs?: number;
667
+ timeoutMs?: number;
668
+ signal?: AbortSignal;
669
+ }
670
+ /**
671
+ * Metadata describing generated trickplay tiles for scrubbing previews (Jellyfin 10.9+).
672
+ */
673
+ interface TrickplayInfoDto {
674
+ Width: number;
675
+ Height: number;
676
+ TileWidth: number;
677
+ TileHeight: number;
678
+ ThumbnailCount: number;
679
+ Interval: number;
680
+ Bandwidth: number;
681
+ }
682
+ interface TrickplayStreamOptions {
683
+ mediaSourceId?: string;
684
+ useQueryToken?: boolean;
685
+ }
686
+ interface TrickplayManifestTile {
687
+ index: number;
688
+ durationMs: number;
689
+ url: string;
690
+ }
691
+ interface TrickplayManifestInfo {
692
+ width: number;
693
+ rawM3u8: string;
694
+ tiles: TrickplayManifestTile[];
695
+ }
696
+ interface ThumbnailLookupOptions {
697
+ item?: BaseItemDto;
698
+ trickplayInfo?: TrickplayInfoDto;
699
+ timestampMs?: number;
700
+ timestampTicks?: number;
701
+ width?: number;
702
+ mediaSourceId?: string;
703
+ useQueryToken?: boolean;
704
+ }
705
+ interface ThumbnailLookupResult {
706
+ tileIndex: number;
707
+ imageUrl: string;
708
+ x: number;
709
+ y: number;
710
+ width: number;
711
+ height: number;
712
+ thumbnailIndex: number;
713
+ }
714
+ /**
715
+ * Chapter marker within a media item.
716
+ */
717
+ interface ChapterInfoDto {
718
+ StartPositionTicks: number;
719
+ Name?: string;
720
+ ImageTag?: string;
721
+ ImagePath?: string;
722
+ ImageDateModified?: string;
723
+ MarkerType?: 'IntroStart' | 'IntroEnd' | 'CreditsStart' | 'CreditsEnd' | (string & {});
724
+ }
725
+ interface ChapterImageOptions {
726
+ maxWidth?: number;
727
+ maxHeight?: number;
728
+ width?: number;
729
+ height?: number;
730
+ quality?: number;
731
+ format?: 'jpg' | 'png' | 'webp';
732
+ tag?: string;
733
+ fillWidth?: number;
734
+ fillHeight?: number;
735
+ useQueryToken?: boolean;
736
+ }
737
+ type MediaSegmentType = 'Intro' | 'Outro' | 'Preview' | 'Recap' | 'Commercial' | (string & {});
738
+ interface MediaSegmentDto {
739
+ Id: string;
740
+ ItemId: string;
741
+ Type: MediaSegmentType;
742
+ StartTicks: number;
743
+ EndTicks: number;
744
+ }
745
+ interface GetMediaSegmentsOptions {
746
+ includeSegmentTypes?: MediaSegmentType[];
747
+ }
748
+ interface MarkerRange {
749
+ startTicks: number;
750
+ endTicks: number;
751
+ startMs: number;
752
+ endMs: number;
753
+ }
754
+ interface IntroCreditsMarkers {
755
+ intro?: MarkerRange;
756
+ credits?: MarkerRange;
757
+ segments: MediaSegmentDto[];
758
+ }
759
+ interface GetGenresOptions {
760
+ parentId?: string;
761
+ startIndex?: number;
762
+ limit?: number;
763
+ searchTerm?: string;
764
+ sortBy?: string;
765
+ sortOrder?: 'Ascending' | 'Descending';
766
+ enableImages?: boolean;
767
+ imageTypeLimit?: number;
768
+ enableImageTypes?: string[];
769
+ userId?: string;
770
+ }
771
+ interface GetStudiosOptions {
772
+ parentId?: string;
773
+ startIndex?: number;
774
+ limit?: number;
775
+ searchTerm?: string;
776
+ sortBy?: string;
777
+ sortOrder?: 'Ascending' | 'Descending';
778
+ enableImages?: boolean;
779
+ imageTypeLimit?: number;
780
+ enableImageTypes?: string[];
781
+ userId?: string;
782
+ }
783
+ interface GetCollectionsOptions {
784
+ parentId?: string;
785
+ startIndex?: number;
786
+ limit?: number;
787
+ searchTerm?: string;
788
+ sortBy?: string;
789
+ sortOrder?: 'Ascending' | 'Descending';
790
+ enableImages?: boolean;
791
+ imageTypeLimit?: number;
792
+ enableImageTypes?: string[];
793
+ userId?: string;
794
+ }
795
+ interface GetCollectionItemsOptions {
796
+ userId?: string;
797
+ startIndex?: number;
798
+ limit?: number;
799
+ fields?: string;
800
+ sortBy?: string;
801
+ sortOrder?: 'Ascending' | 'Descending';
802
+ }
803
+ interface CreateCollectionOptions {
804
+ name: string;
805
+ ids?: string[];
806
+ parentId?: string;
807
+ isFolder?: boolean;
808
+ }
809
+ interface DisplayPreferencesDto {
810
+ Id?: string;
811
+ ViewType?: string;
812
+ SortBy?: string;
813
+ IndexBy?: string;
814
+ RememberIndexing?: boolean;
815
+ PrimaryImageHeight?: number;
816
+ PrimaryImageWidth?: number;
817
+ CustomPrefs?: Record<string, string>;
818
+ ScrollDirection?: 'Horizontal' | 'Vertical' | (string & {});
819
+ ShowBackdrop?: boolean;
820
+ RememberSorting?: boolean;
821
+ SortOrder?: 'Ascending' | 'Descending' | (string & {});
822
+ ShowSidebar?: boolean;
823
+ Client?: string;
824
+ [key: string]: unknown;
825
+ }
826
+ interface GetDisplayPreferencesOptions {
827
+ userId?: string;
828
+ client?: string;
829
+ }
830
+ interface UpdateDisplayPreferencesOptions {
831
+ userId?: string;
832
+ client?: string;
833
+ }
494
834
 
495
835
  interface RequestOptions {
496
836
  method?: string;
@@ -746,8 +1086,11 @@ declare class PlaybackModule {
746
1086
  reportProgress(itemId: string, positionTicks?: number, isPaused?: boolean): Promise<void>;
747
1087
  /**
748
1088
  * Report that playback has stopped for an item.
1089
+ * Optionally teardown active transcoding session if playSessionId is provided.
749
1090
  */
750
- reportStopped(itemId: string, positionTicks?: number): Promise<void>;
1091
+ reportStopped(itemId: string, positionTicks?: number, options?: {
1092
+ playSessionId?: string;
1093
+ }): Promise<void>;
751
1094
  }
752
1095
 
753
1096
  declare class MediaModule {
@@ -966,6 +1309,494 @@ declare class OfflineStorageManager {
966
1309
  formatBytes(bytes: number): string;
967
1310
  }
968
1311
 
1312
+ declare class ResumeModule {
1313
+ private http;
1314
+ private getUserId;
1315
+ constructor(http: HttpTransport, getUserId: () => string);
1316
+ private resolveUserId;
1317
+ /**
1318
+ * Fetch items currently in-progress for the user via /UserItems/Resume.
1319
+ */
1320
+ getResumeItems(options?: GetResumeItemsOptions): Promise<ItemsResponse>;
1321
+ /**
1322
+ * Convenience alias for getResumeItems.
1323
+ */
1324
+ getItems(options?: GetResumeItemsOptions): Promise<ItemsResponse>;
1325
+ }
1326
+
1327
+ declare class NextUpModule {
1328
+ private http;
1329
+ private getUserId;
1330
+ constructor(http: HttpTransport, getUserId: () => string);
1331
+ private resolveUserId;
1332
+ /**
1333
+ * Fetch the next unplayed episodes for followed series via /Shows/NextUp.
1334
+ */
1335
+ getNextUp(options?: GetNextUpOptions): Promise<ItemsResponse>;
1336
+ /**
1337
+ * Convenience alias for getNextUp.
1338
+ */
1339
+ getEpisodes(options?: GetNextUpOptions): Promise<ItemsResponse>;
1340
+ }
1341
+
1342
+ declare class LatestModule {
1343
+ private http;
1344
+ private getUserId;
1345
+ constructor(http: HttpTransport, getUserId: () => string);
1346
+ private resolveUserId;
1347
+ /**
1348
+ * Fetch recently added media items for the user via /Users/{userId}/Items/Latest.
1349
+ */
1350
+ getLatest(options?: GetLatestMediaOptions): Promise<BaseItemDto[]>;
1351
+ /**
1352
+ * Convenience helper to fetch recently added movies.
1353
+ */
1354
+ getLatestMovies(options?: Omit<GetLatestMediaOptions, 'includeItemTypes'>): Promise<BaseItemDto[]>;
1355
+ /**
1356
+ * Convenience helper to fetch recently added TV episodes.
1357
+ */
1358
+ getLatestEpisodes(options?: Omit<GetLatestMediaOptions, 'includeItemTypes'>): Promise<BaseItemDto[]>;
1359
+ /**
1360
+ * Convenience helper to fetch recently added music albums.
1361
+ */
1362
+ getLatestAlbums(options?: Omit<GetLatestMediaOptions, 'includeItemTypes'>): Promise<BaseItemDto[]>;
1363
+ }
1364
+
1365
+ declare class TranscodeModule {
1366
+ private http;
1367
+ private getDeviceId;
1368
+ constructor(http: HttpTransport, getDeviceId: () => string);
1369
+ /**
1370
+ * Explicitly stop an active server transcoding session via DELETE /Videos/ActiveEncodings.
1371
+ * This terminates lingering FFmpeg processes on the Jellyfin server.
1372
+ *
1373
+ * @param playSessionId The unique playback session ID.
1374
+ * @param deviceId The client device ID (defaults to configured client device ID).
1375
+ */
1376
+ stopActiveEncoding(playSessionId: string, deviceId?: string): Promise<void>;
1377
+ /**
1378
+ * Convenience alias for stopActiveEncoding.
1379
+ */
1380
+ stop(playSessionId: string, deviceId?: string): Promise<void>;
1381
+ }
1382
+
1383
+ declare const COMMON_SEARCH_FIELDS = "PrimaryImageAspectRatio,PrimaryImageTag,ImageTags,BackdropImageTags,AlbumPrimaryImageTag,AlbumId,AudioInfo,MediaSources,Chapters,HasLyrics,Overview,Genres,Studios,ProductionYear,OfficialRating,CommunityRating,CriticRating,PremiereDate,RunTimeTicks,IndexNumber,ParentIndexNumber,SeriesName,SeriesId,SeasonId,SeasonName,UserData";
1384
+ declare class SearchModule {
1385
+ private http;
1386
+ private getUserId;
1387
+ constructor(http: HttpTransport, getUserId: () => string);
1388
+ private resolveUserId;
1389
+ /**
1390
+ * Universal search across Jellyfin items with comprehensive filters.
1391
+ */
1392
+ search(query: string, options?: SearchOptions): Promise<ItemsResponse>;
1393
+ /**
1394
+ * Search specifically within a specific library or parent folder.
1395
+ */
1396
+ searchInLibrary(parentId: string, query: string, options?: Omit<SearchOptions, 'parentId'>): Promise<ItemsResponse>;
1397
+ /**
1398
+ * Convenience helper to search audio tracks / songs.
1399
+ */
1400
+ searchSongs(query: string, options?: Omit<SearchOptions, 'includeItemTypes'>): Promise<ItemsResponse>;
1401
+ /**
1402
+ * Convenience helper to search music albums.
1403
+ */
1404
+ searchAlbums(query: string, options?: Omit<SearchOptions, 'includeItemTypes'>): Promise<ItemsResponse>;
1405
+ /**
1406
+ * Convenience helper to search music artists.
1407
+ */
1408
+ searchArtists(query: string, options?: Omit<SearchOptions, 'includeItemTypes'>): Promise<ItemsResponse>;
1409
+ /**
1410
+ * Convenience helper to search movies.
1411
+ */
1412
+ searchMovies(query: string, options?: Omit<SearchOptions, 'includeItemTypes'>): Promise<ItemsResponse>;
1413
+ /**
1414
+ * Convenience helper to search TV series.
1415
+ */
1416
+ searchSeries(query: string, options?: Omit<SearchOptions, 'includeItemTypes'>): Promise<ItemsResponse>;
1417
+ /**
1418
+ * Convenience helper to search TV episodes.
1419
+ */
1420
+ searchEpisodes(query: string, options?: Omit<SearchOptions, 'includeItemTypes'>): Promise<ItemsResponse>;
1421
+ }
1422
+
1423
+ type WebSocketEventListener = (...args: any[]) => void;
1424
+ declare class WebSocketModule {
1425
+ private http;
1426
+ private getDeviceId;
1427
+ private ws;
1428
+ private keepAliveTimer;
1429
+ private reconnectTimer;
1430
+ private listeners;
1431
+ private reconnectAttempts;
1432
+ private explicitlyClosed;
1433
+ private options;
1434
+ constructor(http: HttpTransport, getDeviceId: () => string);
1435
+ /**
1436
+ * Check whether the WebSocket is currently open and connected.
1437
+ */
1438
+ get isConnected(): boolean;
1439
+ /**
1440
+ * Build the Jellyfin WebSocket URL from current serverUrl, accessToken, and deviceId.
1441
+ */
1442
+ getWebSocketUrl(): string;
1443
+ /**
1444
+ * Connect to the Jellyfin WebSocket endpoint.
1445
+ */
1446
+ connect(options?: WebSocketModuleOptions): void;
1447
+ /**
1448
+ * Disconnect the WebSocket and prevent automatic reconnection.
1449
+ */
1450
+ disconnect(): void;
1451
+ /**
1452
+ * Send a raw string or JSON message through the open WebSocket.
1453
+ */
1454
+ send(message: string | Record<string, unknown>): void;
1455
+ /**
1456
+ * Send a KeepAlive message to the Jellyfin server.
1457
+ */
1458
+ sendKeepAlive(): void;
1459
+ /**
1460
+ * Subscribe to real-time session updates from the server.
1461
+ */
1462
+ startSessionsSubscription(intervalMs?: number): void;
1463
+ /**
1464
+ * Stop receiving real-time session updates.
1465
+ */
1466
+ stopSessionsSubscription(): void;
1467
+ /**
1468
+ * Subscribe to scheduled tasks updates from the server.
1469
+ */
1470
+ startScheduledTasksSubscription(intervalMs?: number): void;
1471
+ /**
1472
+ * Stop scheduled tasks updates.
1473
+ */
1474
+ stopScheduledTasksSubscription(): void;
1475
+ /**
1476
+ * Subscribe to server activity log updates.
1477
+ */
1478
+ startActivityLogSubscription(intervalMs?: number): void;
1479
+ /**
1480
+ * Stop server activity log updates.
1481
+ */
1482
+ stopActivityLogSubscription(): void;
1483
+ on(event: 'open', listener: () => void): () => void;
1484
+ on(event: 'close', listener: (code?: number, reason?: string) => void): () => void;
1485
+ on(event: 'error', listener: (error: unknown) => void): () => void;
1486
+ on(event: 'message', listener: (msg: WebSocketInboundMessage) => void): () => void;
1487
+ on(event: 'libraryChanged', listener: (data: LibraryChangedData) => void): () => void;
1488
+ on(event: 'userDataChanged', listener: (data: UserDataChangedData) => void): () => void;
1489
+ on(event: 'sessions', listener: (data: SessionInfoDto[]) => void): () => void;
1490
+ on(event: string, listener: WebSocketEventListener): () => void;
1491
+ off(event: string, listener: WebSocketEventListener): void;
1492
+ emit(event: string, ...args: unknown[]): void;
1493
+ private setupSocketEvents;
1494
+ private startKeepAlive;
1495
+ private stopKeepAlive;
1496
+ private scheduleReconnect;
1497
+ private cleanup;
1498
+ }
1499
+
1500
+ declare class SessionsModule {
1501
+ private http;
1502
+ private getUserId;
1503
+ constructor(http: HttpTransport, getUserId: () => string);
1504
+ /**
1505
+ * Query active client sessions across the Jellyfin server via GET /Sessions.
1506
+ */
1507
+ getSessions(options?: GetSessionsOptions): Promise<SessionInfoDto[]>;
1508
+ /**
1509
+ * Instruct a remote session to start playback of specified items via POST /Sessions/{sessionId}/Playing.
1510
+ *
1511
+ * @param sessionId The target session ID.
1512
+ * @param itemIds Single item ID or array of item IDs to play.
1513
+ * @param options Additional playback parameters (command type, start ticks, etc.).
1514
+ */
1515
+ play(sessionId: string, itemIds: string | string[], options?: RemotePlayOptions): Promise<void>;
1516
+ /**
1517
+ * Send a playback control command to a remote session via POST /Sessions/{sessionId}/Playing/{command}.
1518
+ */
1519
+ sendPlaystateCommand(sessionId: string, command: PlaystateCommand, params?: Record<string, unknown>): Promise<void>;
1520
+ /**
1521
+ * Toggle play / pause on a remote session.
1522
+ */
1523
+ playPause(sessionId: string): Promise<void>;
1524
+ /**
1525
+ * Pause playback on a remote session.
1526
+ */
1527
+ pause(sessionId: string): Promise<void>;
1528
+ /**
1529
+ * Resume playback on a remote session.
1530
+ */
1531
+ unpause(sessionId: string): Promise<void>;
1532
+ /**
1533
+ * Stop playback on a remote session.
1534
+ */
1535
+ stop(sessionId: string): Promise<void>;
1536
+ /**
1537
+ * Seek to a specific tick position on a remote session.
1538
+ *
1539
+ * @param sessionId Target session ID.
1540
+ * @param positionTicks Position in ticks (1 tick = 10,000 milliseconds = 100 nanoseconds).
1541
+ */
1542
+ seek(sessionId: string, positionTicks: number): Promise<void>;
1543
+ /**
1544
+ * Skip to the next track on a remote session.
1545
+ */
1546
+ nextTrack(sessionId: string): Promise<void>;
1547
+ /**
1548
+ * Skip to the previous track on a remote session.
1549
+ */
1550
+ previousTrack(sessionId: string): Promise<void>;
1551
+ /**
1552
+ * Send a general command to a remote session via POST /Sessions/{sessionId}/Command.
1553
+ */
1554
+ sendGeneralCommand(sessionId: string, command: GeneralCommandDto): Promise<void>;
1555
+ /**
1556
+ * Set volume level on a remote session (0-100).
1557
+ */
1558
+ setVolume(sessionId: string, volume: number): Promise<void>;
1559
+ /**
1560
+ * Mute audio on a remote session.
1561
+ */
1562
+ mute(sessionId: string): Promise<void>;
1563
+ /**
1564
+ * Unmute audio on a remote session.
1565
+ */
1566
+ unmute(sessionId: string): Promise<void>;
1567
+ /**
1568
+ * Toggle mute on a remote session.
1569
+ */
1570
+ toggleMute(sessionId: string): Promise<void>;
1571
+ /**
1572
+ * Switch the audio stream index on a remote session.
1573
+ */
1574
+ setAudioStreamIndex(sessionId: string, index: number): Promise<void>;
1575
+ /**
1576
+ * Switch the subtitle stream index on a remote session.
1577
+ */
1578
+ setSubtitleStreamIndex(sessionId: string, index: number): Promise<void>;
1579
+ /**
1580
+ * Display an on-screen dialog message modal on a remote session via POST /Sessions/{sessionId}/Message.
1581
+ */
1582
+ sendMessage(sessionId: string, options: SessionMessageOptions | string): Promise<void>;
1583
+ /**
1584
+ * Instruct a remote session to navigate and view an item or page via POST /Sessions/{sessionId}/Viewing.
1585
+ */
1586
+ viewItem(sessionId: string, itemType: string, itemId: string, itemName: string): Promise<void>;
1587
+ }
1588
+
1589
+ declare class QuickConnectModule {
1590
+ private http;
1591
+ constructor(http: HttpTransport);
1592
+ /**
1593
+ * Check whether Quick Connect is enabled on the connected Jellyfin server.
1594
+ */
1595
+ isEnabled(): Promise<boolean>;
1596
+ /**
1597
+ * Initiate a Quick Connect authentication session.
1598
+ * Typically called by a client device (e.g. Smart TV or CLI) to generate a user-facing pairing code.
1599
+ */
1600
+ initiate(): Promise<QuickConnectResult>;
1601
+ /**
1602
+ * Check the current authorization status of an initiated Quick Connect secret.
1603
+ *
1604
+ * @param secret The secret token returned from initiate().
1605
+ */
1606
+ check(secret: string): Promise<QuickConnectState>;
1607
+ /**
1608
+ * Authorize a Quick Connect pairing code from an authenticated session.
1609
+ * Typically called on a mobile app or browser where the user is already logged in.
1610
+ *
1611
+ * @param code The pairing code shown on the target device.
1612
+ * @param userId Optional specific user ID to authenticate as (defaults to the currently authenticated user).
1613
+ */
1614
+ authorize(code: string, userId?: string): Promise<boolean>;
1615
+ /**
1616
+ * Repeatedly poll until the user authorizes the Quick Connect request or a timeout occurs.
1617
+ *
1618
+ * @param secret The secret token returned from initiate().
1619
+ * @param options Polling configuration (intervalMs, timeoutMs, signal).
1620
+ */
1621
+ poll(secret: string, options?: QuickConnectPollOptions): Promise<QuickConnectState>;
1622
+ }
1623
+
1624
+ declare class TrickplayModule {
1625
+ private http;
1626
+ constructor(http: HttpTransport);
1627
+ /**
1628
+ * Generates the HLS playlist URL for trickplay scrubbing image tiles.
1629
+ * E.g. /Videos/{itemId}/Trickplay/{width}/tiles.m3u8
1630
+ */
1631
+ getTilesHlsUrl(itemId: string, width: number, options?: TrickplayStreamOptions): string;
1632
+ /**
1633
+ * Generates the URL for a specific trickplay thumbnail tile image sheet.
1634
+ * E.g. /Videos/{itemId}/Trickplay/{width}/{index}.jpg
1635
+ */
1636
+ getTileImageUrl(itemId: string, width: number, index: number, options?: TrickplayStreamOptions): string;
1637
+ /**
1638
+ * Fetches and parses the HLS trickplay manifest (tiles.m3u8) for the given item and resolution.
1639
+ */
1640
+ getTrickplayManifest(itemId: string, width: number, options?: {
1641
+ mediaSourceId?: string;
1642
+ useQueryToken?: boolean;
1643
+ }): Promise<TrickplayManifestInfo>;
1644
+ /**
1645
+ * Helper to parse #EXTINF and tile file names from a tiles.m3u8 playlist.
1646
+ */
1647
+ private parseTilesM3u8;
1648
+ /**
1649
+ * Extracts the available trickplay thumbnail widths from a BaseItemDto's Trickplay metadata.
1650
+ */
1651
+ getAvailableResolutions(item: BaseItemDto, mediaSourceId?: string): number[];
1652
+ /**
1653
+ * Retrieves the TrickplayInfoDto metadata for a specified item and optional width.
1654
+ */
1655
+ getTrickplayInfo(item: BaseItemDto, width?: number, mediaSourceId?: string): TrickplayInfoDto | null;
1656
+ /**
1657
+ * Calculates the exact tile sheet index, image URL, and sprite coordinates (x, y, width, height)
1658
+ * for a given playback timestamp to render scrubbing thumbnails in a player or seekbar UI.
1659
+ */
1660
+ getThumbnailForTimestamp(options: ThumbnailLookupOptions): ThumbnailLookupResult | null;
1661
+ }
1662
+
1663
+ declare class ChaptersModule {
1664
+ private http;
1665
+ private getUserId?;
1666
+ constructor(http: HttpTransport, getUserId?: () => string);
1667
+ /**
1668
+ * Synchronously extracts chapter markers from an already fetched BaseItemDto.
1669
+ */
1670
+ extractChapters(item: BaseItemDto): ChapterInfoDto[];
1671
+ /**
1672
+ * Fetches the chapter markers for an item from the server.
1673
+ */
1674
+ getChapters(itemId: string): Promise<ChapterInfoDto[]>;
1675
+ /**
1676
+ * Generates the URL for a chapter preview thumbnail image.
1677
+ * E.g. /Items/{itemId}/Images/Chapter/{chapterIndex}
1678
+ */
1679
+ getChapterImageUrl(itemId: string, chapterIndex: number, options?: ChapterImageOptions): string;
1680
+ /**
1681
+ * Retrieves media segments (Intro, Outro, Recap, Commercials) for an item via Jellyfin 10.10+ /MediaSegments.
1682
+ */
1683
+ getMediaSegments(itemId: string, options?: GetMediaSegmentsOptions): Promise<MediaSegmentDto[]>;
1684
+ /**
1685
+ * Resolves intro and end credits markers for an item, combining /MediaSegments API
1686
+ * and chapter marker heuristics (MarkerType or naming like 'Intro', 'Opening', 'Credits', 'Ending').
1687
+ */
1688
+ getIntroCredits(itemOrChaptersOrId: BaseItemDto | ChapterInfoDto[] | string, mediaSegments?: MediaSegmentDto[]): Promise<IntroCreditsMarkers>;
1689
+ /**
1690
+ * Checks whether the current playback position falls within an intro or credits range.
1691
+ */
1692
+ findCurrentSegment(positionTicks: number, markersOrSegments: IntroCreditsMarkers | MediaSegmentDto[]): {
1693
+ type: string;
1694
+ startTicks: number;
1695
+ endTicks: number;
1696
+ } | null;
1697
+ /**
1698
+ * Returns the timestamp ticks to skip to if the current position is within a skippable segment,
1699
+ * or null if not currently within any skippable range.
1700
+ */
1701
+ getSkipPosition(positionTicks: number, markersOrSegments: IntroCreditsMarkers | MediaSegmentDto[]): number | null;
1702
+ }
1703
+
1704
+ declare class GenresModule {
1705
+ private http;
1706
+ private getUserId;
1707
+ constructor(http: HttpTransport, getUserId: () => string);
1708
+ private resolveUserId;
1709
+ /**
1710
+ * Retrieves video/movie genres from the server via GET /Genres.
1711
+ */
1712
+ getGenres(options?: GetGenresOptions): Promise<ItemsResponse>;
1713
+ /**
1714
+ * Retrieves a single genre by name via GET /Genres/{genreName}.
1715
+ */
1716
+ getGenre(genreName: string, options?: {
1717
+ userId?: string;
1718
+ }): Promise<BaseItemDto>;
1719
+ /**
1720
+ * Retrieves music genres from the server via GET /MusicGenres.
1721
+ */
1722
+ getMusicGenres(options?: GetGenresOptions): Promise<ItemsResponse>;
1723
+ /**
1724
+ * Retrieves a single music genre by name via GET /MusicGenres/{genreName}.
1725
+ */
1726
+ getMusicGenre(genreName: string, options?: {
1727
+ userId?: string;
1728
+ }): Promise<BaseItemDto>;
1729
+ /**
1730
+ * Retrieves studios/production companies from the server via GET /Studios.
1731
+ */
1732
+ getStudios(options?: GetStudiosOptions): Promise<ItemsResponse>;
1733
+ /**
1734
+ * Retrieves a single studio by name via GET /Studios/{studioName}.
1735
+ */
1736
+ getStudio(studioName: string, options?: {
1737
+ userId?: string;
1738
+ }): Promise<BaseItemDto>;
1739
+ }
1740
+
1741
+ declare class CollectionsModule {
1742
+ private http;
1743
+ private getUserId;
1744
+ constructor(http: HttpTransport, getUserId: () => string);
1745
+ private resolveUserId;
1746
+ /**
1747
+ * Retrieves user BoxSet / Collections via GET /Collections.
1748
+ */
1749
+ getCollections(options?: GetCollectionsOptions): Promise<ItemsResponse>;
1750
+ /**
1751
+ * Retrieves the items belonging to a collection / BoxSet.
1752
+ */
1753
+ getCollectionItems(collectionId: string, options?: GetCollectionItemsOptions): Promise<ItemsResponse>;
1754
+ /**
1755
+ * Creates a new BoxSet / Collection via POST /Collections.
1756
+ */
1757
+ createCollection(options: CreateCollectionOptions): Promise<{
1758
+ Id: string;
1759
+ }>;
1760
+ /**
1761
+ * Adds items to an existing BoxSet / Collection via POST /Collections/{collectionId}/Items.
1762
+ */
1763
+ addToCollection(collectionId: string, itemIds: string | string[]): Promise<void>;
1764
+ /**
1765
+ * Removes items from an existing BoxSet / Collection via DELETE /Collections/{collectionId}/Items.
1766
+ */
1767
+ removeFromCollection(collectionId: string, itemIds: string | string[]): Promise<void>;
1768
+ }
1769
+
1770
+ declare class DisplayPreferencesModule {
1771
+ private http;
1772
+ private getUserId;
1773
+ private defaultClient;
1774
+ constructor(http: HttpTransport, getUserId: () => string, defaultClient?: string);
1775
+ private resolveUserId;
1776
+ /**
1777
+ * Retrieves the user's display preferences for a specific folder or view.
1778
+ * GET /DisplayPreferences/{displayPreferencesId}
1779
+ */
1780
+ getDisplayPreferences(displayPreferencesId: string, options?: GetDisplayPreferencesOptions): Promise<DisplayPreferencesDto>;
1781
+ /**
1782
+ * Updates display preferences for a specific folder or view.
1783
+ * POST /DisplayPreferences/{displayPreferencesId}
1784
+ */
1785
+ updateDisplayPreferences(displayPreferencesId: string, preferences: DisplayPreferencesDto, options?: UpdateDisplayPreferencesOptions): Promise<void>;
1786
+ /**
1787
+ * Sets a custom client-specific key-value pair in CustomPrefs.
1788
+ */
1789
+ setCustomPreference(displayPreferencesId: string, key: string, value: string, options?: UpdateDisplayPreferencesOptions): Promise<DisplayPreferencesDto>;
1790
+ /**
1791
+ * Updates sort field and order preferences for a view.
1792
+ */
1793
+ setSortPreferences(displayPreferencesId: string, sortBy: string, sortOrder: 'Ascending' | 'Descending', options?: UpdateDisplayPreferencesOptions): Promise<DisplayPreferencesDto>;
1794
+ /**
1795
+ * Sets the view presentation layout type (e.g. 'Poster', 'Thumb', 'Banner', 'List').
1796
+ */
1797
+ setViewType(displayPreferencesId: string, viewType: string, options?: UpdateDisplayPreferencesOptions): Promise<DisplayPreferencesDto>;
1798
+ }
1799
+
969
1800
  interface CacheRecord<T = unknown> {
970
1801
  key: string;
971
1802
  data: T;
@@ -1007,12 +1838,25 @@ declare class JellyfinClient {
1007
1838
  readonly auth: AuthModule;
1008
1839
  readonly system: SystemModule;
1009
1840
  readonly library: LibraryModule;
1841
+ readonly search: SearchModule;
1010
1842
  readonly playlists: PlaylistsModule;
1011
1843
  readonly playback: PlaybackModule;
1012
1844
  readonly media: MediaModule;
1013
1845
  readonly lyrics: LyricsModule;
1014
1846
  readonly favorites: FavoritesModule;
1015
1847
  readonly offline: OfflineStorageManager;
1848
+ readonly resume: ResumeModule;
1849
+ readonly nextUp: NextUpModule;
1850
+ readonly latest: LatestModule;
1851
+ readonly transcode: TranscodeModule;
1852
+ readonly websocket: WebSocketModule;
1853
+ readonly sessions: SessionsModule;
1854
+ readonly quickConnect: QuickConnectModule;
1855
+ readonly trickplay: TrickplayModule;
1856
+ readonly chapters: ChaptersModule;
1857
+ readonly genres: GenresModule;
1858
+ readonly collections: CollectionsModule;
1859
+ readonly displayPreferences: DisplayPreferencesModule;
1016
1860
  private http;
1017
1861
  private storage;
1018
1862
  private cache;
@@ -1089,4 +1933,4 @@ declare class JellyfinAuthError extends JellyfinApiError {
1089
1933
  constructor(message?: string, status?: number, endpoint?: string);
1090
1934
  }
1091
1935
 
1092
- export { AUDIO_QUALITY_PRESETS, type ArtworkUrlOptions, type AudioHlsStreamOptions, type AudioQualityOption, type AudioQualityPresetKey, type AudioStreamOptions, AuthModule, type AuthenticationResult, type BaseItemDto, type CacheAdapter, type CacheRecord, type ClientCapabilities, type ClientEventListener, type ClientEventType, type ClientInfo, type CreatePlaylistDto, type CreatePlaylistOptions, type DownloadItemOptions, type DownloadProgress, type DownloadRecord, type DownloadUrlOptions, FavoritesModule, type GetAlbumsOptions, type GetArtistsOptions, type GetEpisodesOptions, type GetMoviesOptions, type GetSeasonsOptions, type GetSeriesOptions, type GetSongsOptions, type GetVideosOptions, HttpTransport, IndexedDBCacheAdapter, type ItemsResponse, JellyfinApiError, JellyfinAuthError, JellyfinClient, type JellyfinClientOptions, JellyfinError, LibraryModule, LocalStorageAdapter, type LyricLine, type LyricsDto, LyricsModule, MediaModule, type MediaSourceInfo, type MediaStreamInfo, MemoryCacheAdapter, MemoryStorage, OfflineStorageManager, type PlaybackInfoOptions, type PlaybackInfoResponse, PlaybackModule, PlaylistsModule, type PublicSystemInfo, type RequestOptions, type SearchOptions, type StorageAdapter, type SubtitleTrackInfo, type SubtitleUrlOptions, type SystemInfo, SystemModule, type UpdatePlaylistOptions, type UserDto, type UserItemDataDto, VIDEO_QUALITY_PRESETS, type VideoHlsStreamOptions, type VideoQualityOption, type VideoQualityPresetKey, type VideoStreamOptions, buildAuthHeader, cleanUrl, fetchWithCache, formatBitrate, generateDeviceId, getAudioQualityList, getDefaultStorage, getVideoQualityList, isV12OrHigher, isVersionAtLeast, parseSemVer, resolveAudioQuality, resolveVideoQuality };
1936
+ export { AUDIO_QUALITY_PRESETS, type ArtworkUrlOptions, type AudioHlsStreamOptions, type AudioQualityOption, type AudioQualityPresetKey, type AudioStreamOptions, AuthModule, type AuthenticationResult, type BaseItemDto, COMMON_SEARCH_FIELDS, type CacheAdapter, type CacheRecord, type ChapterImageOptions, type ChapterInfoDto, ChaptersModule, type ClientCapabilities, type ClientEventListener, type ClientEventType, type ClientInfo, CollectionsModule, type CreateCollectionOptions, type CreatePlaylistDto, type CreatePlaylistOptions, type DisplayPreferencesDto, DisplayPreferencesModule, type DownloadItemOptions, type DownloadProgress, type DownloadRecord, type DownloadUrlOptions, FavoritesModule, type GeneralCommandDto, type GeneralCommandType, GenresModule, type GetAlbumsOptions, type GetArtistsOptions, type GetCollectionItemsOptions, type GetCollectionsOptions, type GetDisplayPreferencesOptions, type GetEpisodesOptions, type GetGenresOptions, type GetLatestMediaOptions, type GetMediaSegmentsOptions, type GetMoviesOptions, type GetNextUpOptions, type GetResumeItemsOptions, type GetSeasonsOptions, type GetSeriesOptions, type GetSessionsOptions, type GetSongsOptions, type GetStudiosOptions, type GetVideosOptions, HttpTransport, IndexedDBCacheAdapter, type IntroCreditsMarkers, type ItemsResponse, JellyfinApiError, JellyfinAuthError, JellyfinClient, type JellyfinClientOptions, JellyfinError, LatestModule, type LibraryChangedData, LibraryModule, LocalStorageAdapter, type LyricLine, type LyricsDto, LyricsModule, type MarkerRange, MediaModule, type MediaSegmentDto, type MediaSegmentType, type MediaSourceInfo, type MediaStreamInfo, MemoryCacheAdapter, MemoryStorage, NextUpModule, OfflineStorageManager, type PlayCommandType, type PlaybackInfoOptions, type PlaybackInfoResponse, PlaybackModule, PlaylistsModule, type PlaystateCommand, type PublicSystemInfo, QuickConnectModule, type QuickConnectPollOptions, type QuickConnectResult, type QuickConnectState, type RemotePlayOptions, type RequestOptions, ResumeModule, SearchModule, type SearchOptions, type SessionInfoDto, type SessionMessageOptions, type SessionPlayState, SessionsModule, type StopActiveEncodingOptions, type StorageAdapter, type SubtitleTrackInfo, type SubtitleUrlOptions, type SystemInfo, SystemModule, type ThumbnailLookupOptions, type ThumbnailLookupResult, TranscodeModule, type TrickplayInfoDto, type TrickplayManifestInfo, type TrickplayManifestTile, TrickplayModule, type TrickplayStreamOptions, type UpdateDisplayPreferencesOptions, type UpdatePlaylistOptions, type UserDataChangedData, type UserDto, type UserItemDataDto, VIDEO_QUALITY_PRESETS, type VideoHlsStreamOptions, type VideoQualityOption, type VideoQualityPresetKey, type VideoStreamOptions, type WebSocketEventListener, type WebSocketInboundMessage, type WebSocketMessageType, WebSocketModule, type WebSocketModuleOptions, buildAuthHeader, cleanUrl, fetchWithCache, formatBitrate, generateDeviceId, getAudioQualityList, getDefaultStorage, getVideoQualityList, isV12OrHigher, isVersionAtLeast, parseSemVer, resolveAudioQuality, resolveVideoQuality };