@nuclearplayer/plugin-sdk 2.1.1 → 2.3.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 +583 -1
- package/dist/index.js +288 -204
- package/package.json +5 -2
package/dist/index.d.ts
CHANGED
|
@@ -311,6 +311,8 @@ export declare class NuclearAPI {
|
|
|
311
311
|
readonly Favorites: FavoritesAPI;
|
|
312
312
|
readonly Logger: LoggerAPI;
|
|
313
313
|
readonly Dashboard: DashboardAPI;
|
|
314
|
+
readonly Playback: PlaybackAPI;
|
|
315
|
+
readonly Playlists: PlaylistsAPI;
|
|
314
316
|
constructor(opts?: {
|
|
315
317
|
settingsHost?: SettingsHost;
|
|
316
318
|
providersHost?: ProvidersHost;
|
|
@@ -322,6 +324,8 @@ export declare class NuclearAPI {
|
|
|
322
324
|
favoritesHost?: FavoritesHost;
|
|
323
325
|
loggerHost?: LoggerHost;
|
|
324
326
|
dashboardHost?: DashboardHost;
|
|
327
|
+
playbackHost?: PlaybackHost;
|
|
328
|
+
playlistsHost?: PlaylistsHost;
|
|
325
329
|
});
|
|
326
330
|
}
|
|
327
331
|
|
|
@@ -367,6 +371,38 @@ export declare type NumberWidget = {
|
|
|
367
371
|
|
|
368
372
|
export declare function pickArtwork(set: ArtworkSet | undefined, purpose: ArtworkPurpose, targetPx: number): Artwork | undefined;
|
|
369
373
|
|
|
374
|
+
export declare class PlaybackAPI {
|
|
375
|
+
#private;
|
|
376
|
+
constructor(host?: PlaybackHost);
|
|
377
|
+
getState(): Promise<PlaybackState>;
|
|
378
|
+
play(): Promise<void>;
|
|
379
|
+
pause(): Promise<void>;
|
|
380
|
+
stop(): Promise<void>;
|
|
381
|
+
toggle(): Promise<void>;
|
|
382
|
+
seekTo(seconds: number): Promise<void>;
|
|
383
|
+
subscribe(listener: PlaybackListener): () => void;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
export declare type PlaybackHost = {
|
|
387
|
+
getState: () => Promise<PlaybackState>;
|
|
388
|
+
play: () => Promise<void>;
|
|
389
|
+
pause: () => Promise<void>;
|
|
390
|
+
stop: () => Promise<void>;
|
|
391
|
+
toggle: () => Promise<void>;
|
|
392
|
+
seekTo: (seconds: number) => Promise<void>;
|
|
393
|
+
subscribe: (listener: PlaybackListener) => () => void;
|
|
394
|
+
};
|
|
395
|
+
|
|
396
|
+
export declare type PlaybackListener = (state: PlaybackState) => void;
|
|
397
|
+
|
|
398
|
+
export declare type PlaybackState = {
|
|
399
|
+
status: PlaybackStatus;
|
|
400
|
+
seek: number;
|
|
401
|
+
duration: number;
|
|
402
|
+
};
|
|
403
|
+
|
|
404
|
+
export declare type PlaybackStatus = 'playing' | 'paused' | 'stopped';
|
|
405
|
+
|
|
370
406
|
export declare type Playlist = {
|
|
371
407
|
id: string;
|
|
372
408
|
name: string;
|
|
@@ -381,6 +417,515 @@ export declare type Playlist = {
|
|
|
381
417
|
items: PlaylistItem[];
|
|
382
418
|
};
|
|
383
419
|
|
|
420
|
+
export declare const PLAYLIST_EXPORT_VERSION = 1;
|
|
421
|
+
|
|
422
|
+
export declare const playlistExportSchema: z.ZodObject<{
|
|
423
|
+
version: z.ZodNumber;
|
|
424
|
+
playlist: z.ZodObject<{
|
|
425
|
+
id: z.ZodString;
|
|
426
|
+
name: z.ZodString;
|
|
427
|
+
description: z.ZodOptional<z.ZodString>;
|
|
428
|
+
artwork: z.ZodOptional<z.ZodObject<{
|
|
429
|
+
items: z.ZodArray<z.ZodObject<{
|
|
430
|
+
url: z.ZodString;
|
|
431
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
432
|
+
height: z.ZodOptional<z.ZodNumber>;
|
|
433
|
+
purpose: z.ZodOptional<z.ZodEnum<["avatar", "cover", "background", "thumbnail"]>>;
|
|
434
|
+
source: z.ZodOptional<z.ZodObject<{
|
|
435
|
+
provider: z.ZodString;
|
|
436
|
+
id: z.ZodString;
|
|
437
|
+
url: z.ZodOptional<z.ZodString>;
|
|
438
|
+
}, "strip", z.ZodTypeAny, {
|
|
439
|
+
id: string;
|
|
440
|
+
provider: string;
|
|
441
|
+
url?: string | undefined;
|
|
442
|
+
}, {
|
|
443
|
+
id: string;
|
|
444
|
+
provider: string;
|
|
445
|
+
url?: string | undefined;
|
|
446
|
+
}>>;
|
|
447
|
+
}, "strip", z.ZodTypeAny, {
|
|
448
|
+
url: string;
|
|
449
|
+
width?: number | undefined;
|
|
450
|
+
height?: number | undefined;
|
|
451
|
+
purpose?: "avatar" | "cover" | "background" | "thumbnail" | undefined;
|
|
452
|
+
source?: {
|
|
453
|
+
id: string;
|
|
454
|
+
provider: string;
|
|
455
|
+
url?: string | undefined;
|
|
456
|
+
} | undefined;
|
|
457
|
+
}, {
|
|
458
|
+
url: string;
|
|
459
|
+
width?: number | undefined;
|
|
460
|
+
height?: number | undefined;
|
|
461
|
+
purpose?: "avatar" | "cover" | "background" | "thumbnail" | undefined;
|
|
462
|
+
source?: {
|
|
463
|
+
id: string;
|
|
464
|
+
provider: string;
|
|
465
|
+
url?: string | undefined;
|
|
466
|
+
} | undefined;
|
|
467
|
+
}>, "many">;
|
|
468
|
+
}, "strip", z.ZodTypeAny, {
|
|
469
|
+
items: {
|
|
470
|
+
url: string;
|
|
471
|
+
width?: number | undefined;
|
|
472
|
+
height?: number | undefined;
|
|
473
|
+
purpose?: "avatar" | "cover" | "background" | "thumbnail" | undefined;
|
|
474
|
+
source?: {
|
|
475
|
+
id: string;
|
|
476
|
+
provider: string;
|
|
477
|
+
url?: string | undefined;
|
|
478
|
+
} | undefined;
|
|
479
|
+
}[];
|
|
480
|
+
}, {
|
|
481
|
+
items: {
|
|
482
|
+
url: string;
|
|
483
|
+
width?: number | undefined;
|
|
484
|
+
height?: number | undefined;
|
|
485
|
+
purpose?: "avatar" | "cover" | "background" | "thumbnail" | undefined;
|
|
486
|
+
source?: {
|
|
487
|
+
id: string;
|
|
488
|
+
provider: string;
|
|
489
|
+
url?: string | undefined;
|
|
490
|
+
} | undefined;
|
|
491
|
+
}[];
|
|
492
|
+
}>>;
|
|
493
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
494
|
+
createdAtIso: z.ZodString;
|
|
495
|
+
lastModifiedIso: z.ZodString;
|
|
496
|
+
origin: z.ZodOptional<z.ZodObject<{
|
|
497
|
+
provider: z.ZodString;
|
|
498
|
+
id: z.ZodString;
|
|
499
|
+
url: z.ZodOptional<z.ZodString>;
|
|
500
|
+
}, "strip", z.ZodTypeAny, {
|
|
501
|
+
id: string;
|
|
502
|
+
provider: string;
|
|
503
|
+
url?: string | undefined;
|
|
504
|
+
}, {
|
|
505
|
+
id: string;
|
|
506
|
+
provider: string;
|
|
507
|
+
url?: string | undefined;
|
|
508
|
+
}>>;
|
|
509
|
+
isReadOnly: z.ZodBoolean;
|
|
510
|
+
parentId: z.ZodOptional<z.ZodString>;
|
|
511
|
+
items: z.ZodArray<z.ZodObject<{
|
|
512
|
+
id: z.ZodString;
|
|
513
|
+
track: z.ZodObject<{
|
|
514
|
+
title: z.ZodString;
|
|
515
|
+
artists: z.ZodArray<z.ZodObject<{
|
|
516
|
+
name: z.ZodString;
|
|
517
|
+
roles: z.ZodArray<z.ZodString, "many">;
|
|
518
|
+
source: z.ZodOptional<z.ZodObject<{
|
|
519
|
+
provider: z.ZodString;
|
|
520
|
+
id: z.ZodString;
|
|
521
|
+
url: z.ZodOptional<z.ZodString>;
|
|
522
|
+
}, "strip", z.ZodTypeAny, {
|
|
523
|
+
id: string;
|
|
524
|
+
provider: string;
|
|
525
|
+
url?: string | undefined;
|
|
526
|
+
}, {
|
|
527
|
+
id: string;
|
|
528
|
+
provider: string;
|
|
529
|
+
url?: string | undefined;
|
|
530
|
+
}>>;
|
|
531
|
+
}, "strip", z.ZodTypeAny, {
|
|
532
|
+
name: string;
|
|
533
|
+
roles: string[];
|
|
534
|
+
source?: {
|
|
535
|
+
id: string;
|
|
536
|
+
provider: string;
|
|
537
|
+
url?: string | undefined;
|
|
538
|
+
} | undefined;
|
|
539
|
+
}, {
|
|
540
|
+
name: string;
|
|
541
|
+
roles: string[];
|
|
542
|
+
source?: {
|
|
543
|
+
id: string;
|
|
544
|
+
provider: string;
|
|
545
|
+
url?: string | undefined;
|
|
546
|
+
} | undefined;
|
|
547
|
+
}>, "many">;
|
|
548
|
+
durationMs: z.ZodOptional<z.ZodNumber>;
|
|
549
|
+
source: z.ZodObject<{
|
|
550
|
+
provider: z.ZodString;
|
|
551
|
+
id: z.ZodString;
|
|
552
|
+
url: z.ZodOptional<z.ZodString>;
|
|
553
|
+
}, "strip", z.ZodTypeAny, {
|
|
554
|
+
id: string;
|
|
555
|
+
provider: string;
|
|
556
|
+
url?: string | undefined;
|
|
557
|
+
}, {
|
|
558
|
+
id: string;
|
|
559
|
+
provider: string;
|
|
560
|
+
url?: string | undefined;
|
|
561
|
+
}>;
|
|
562
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
563
|
+
title: z.ZodString;
|
|
564
|
+
artists: z.ZodArray<z.ZodObject<{
|
|
565
|
+
name: z.ZodString;
|
|
566
|
+
roles: z.ZodArray<z.ZodString, "many">;
|
|
567
|
+
source: z.ZodOptional<z.ZodObject<{
|
|
568
|
+
provider: z.ZodString;
|
|
569
|
+
id: z.ZodString;
|
|
570
|
+
url: z.ZodOptional<z.ZodString>;
|
|
571
|
+
}, "strip", z.ZodTypeAny, {
|
|
572
|
+
id: string;
|
|
573
|
+
provider: string;
|
|
574
|
+
url?: string | undefined;
|
|
575
|
+
}, {
|
|
576
|
+
id: string;
|
|
577
|
+
provider: string;
|
|
578
|
+
url?: string | undefined;
|
|
579
|
+
}>>;
|
|
580
|
+
}, "strip", z.ZodTypeAny, {
|
|
581
|
+
name: string;
|
|
582
|
+
roles: string[];
|
|
583
|
+
source?: {
|
|
584
|
+
id: string;
|
|
585
|
+
provider: string;
|
|
586
|
+
url?: string | undefined;
|
|
587
|
+
} | undefined;
|
|
588
|
+
}, {
|
|
589
|
+
name: string;
|
|
590
|
+
roles: string[];
|
|
591
|
+
source?: {
|
|
592
|
+
id: string;
|
|
593
|
+
provider: string;
|
|
594
|
+
url?: string | undefined;
|
|
595
|
+
} | undefined;
|
|
596
|
+
}>, "many">;
|
|
597
|
+
durationMs: z.ZodOptional<z.ZodNumber>;
|
|
598
|
+
source: z.ZodObject<{
|
|
599
|
+
provider: z.ZodString;
|
|
600
|
+
id: z.ZodString;
|
|
601
|
+
url: z.ZodOptional<z.ZodString>;
|
|
602
|
+
}, "strip", z.ZodTypeAny, {
|
|
603
|
+
id: string;
|
|
604
|
+
provider: string;
|
|
605
|
+
url?: string | undefined;
|
|
606
|
+
}, {
|
|
607
|
+
id: string;
|
|
608
|
+
provider: string;
|
|
609
|
+
url?: string | undefined;
|
|
610
|
+
}>;
|
|
611
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
612
|
+
title: z.ZodString;
|
|
613
|
+
artists: z.ZodArray<z.ZodObject<{
|
|
614
|
+
name: z.ZodString;
|
|
615
|
+
roles: z.ZodArray<z.ZodString, "many">;
|
|
616
|
+
source: z.ZodOptional<z.ZodObject<{
|
|
617
|
+
provider: z.ZodString;
|
|
618
|
+
id: z.ZodString;
|
|
619
|
+
url: z.ZodOptional<z.ZodString>;
|
|
620
|
+
}, "strip", z.ZodTypeAny, {
|
|
621
|
+
id: string;
|
|
622
|
+
provider: string;
|
|
623
|
+
url?: string | undefined;
|
|
624
|
+
}, {
|
|
625
|
+
id: string;
|
|
626
|
+
provider: string;
|
|
627
|
+
url?: string | undefined;
|
|
628
|
+
}>>;
|
|
629
|
+
}, "strip", z.ZodTypeAny, {
|
|
630
|
+
name: string;
|
|
631
|
+
roles: string[];
|
|
632
|
+
source?: {
|
|
633
|
+
id: string;
|
|
634
|
+
provider: string;
|
|
635
|
+
url?: string | undefined;
|
|
636
|
+
} | undefined;
|
|
637
|
+
}, {
|
|
638
|
+
name: string;
|
|
639
|
+
roles: string[];
|
|
640
|
+
source?: {
|
|
641
|
+
id: string;
|
|
642
|
+
provider: string;
|
|
643
|
+
url?: string | undefined;
|
|
644
|
+
} | undefined;
|
|
645
|
+
}>, "many">;
|
|
646
|
+
durationMs: z.ZodOptional<z.ZodNumber>;
|
|
647
|
+
source: z.ZodObject<{
|
|
648
|
+
provider: z.ZodString;
|
|
649
|
+
id: z.ZodString;
|
|
650
|
+
url: z.ZodOptional<z.ZodString>;
|
|
651
|
+
}, "strip", z.ZodTypeAny, {
|
|
652
|
+
id: string;
|
|
653
|
+
provider: string;
|
|
654
|
+
url?: string | undefined;
|
|
655
|
+
}, {
|
|
656
|
+
id: string;
|
|
657
|
+
provider: string;
|
|
658
|
+
url?: string | undefined;
|
|
659
|
+
}>;
|
|
660
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
661
|
+
note: z.ZodOptional<z.ZodString>;
|
|
662
|
+
addedAtIso: z.ZodString;
|
|
663
|
+
}, "strip", z.ZodTypeAny, {
|
|
664
|
+
id: string;
|
|
665
|
+
track: {
|
|
666
|
+
artists: {
|
|
667
|
+
name: string;
|
|
668
|
+
roles: string[];
|
|
669
|
+
source?: {
|
|
670
|
+
id: string;
|
|
671
|
+
provider: string;
|
|
672
|
+
url?: string | undefined;
|
|
673
|
+
} | undefined;
|
|
674
|
+
}[];
|
|
675
|
+
source: {
|
|
676
|
+
id: string;
|
|
677
|
+
provider: string;
|
|
678
|
+
url?: string | undefined;
|
|
679
|
+
};
|
|
680
|
+
title: string;
|
|
681
|
+
durationMs?: number | undefined;
|
|
682
|
+
} & {
|
|
683
|
+
[k: string]: unknown;
|
|
684
|
+
};
|
|
685
|
+
addedAtIso: string;
|
|
686
|
+
note?: string | undefined;
|
|
687
|
+
}, {
|
|
688
|
+
id: string;
|
|
689
|
+
track: {
|
|
690
|
+
artists: {
|
|
691
|
+
name: string;
|
|
692
|
+
roles: string[];
|
|
693
|
+
source?: {
|
|
694
|
+
id: string;
|
|
695
|
+
provider: string;
|
|
696
|
+
url?: string | undefined;
|
|
697
|
+
} | undefined;
|
|
698
|
+
}[];
|
|
699
|
+
source: {
|
|
700
|
+
id: string;
|
|
701
|
+
provider: string;
|
|
702
|
+
url?: string | undefined;
|
|
703
|
+
};
|
|
704
|
+
title: string;
|
|
705
|
+
durationMs?: number | undefined;
|
|
706
|
+
} & {
|
|
707
|
+
[k: string]: unknown;
|
|
708
|
+
};
|
|
709
|
+
addedAtIso: string;
|
|
710
|
+
note?: string | undefined;
|
|
711
|
+
}>, "many">;
|
|
712
|
+
}, "strip", z.ZodTypeAny, {
|
|
713
|
+
items: {
|
|
714
|
+
id: string;
|
|
715
|
+
track: {
|
|
716
|
+
artists: {
|
|
717
|
+
name: string;
|
|
718
|
+
roles: string[];
|
|
719
|
+
source?: {
|
|
720
|
+
id: string;
|
|
721
|
+
provider: string;
|
|
722
|
+
url?: string | undefined;
|
|
723
|
+
} | undefined;
|
|
724
|
+
}[];
|
|
725
|
+
source: {
|
|
726
|
+
id: string;
|
|
727
|
+
provider: string;
|
|
728
|
+
url?: string | undefined;
|
|
729
|
+
};
|
|
730
|
+
title: string;
|
|
731
|
+
durationMs?: number | undefined;
|
|
732
|
+
} & {
|
|
733
|
+
[k: string]: unknown;
|
|
734
|
+
};
|
|
735
|
+
addedAtIso: string;
|
|
736
|
+
note?: string | undefined;
|
|
737
|
+
}[];
|
|
738
|
+
id: string;
|
|
739
|
+
name: string;
|
|
740
|
+
createdAtIso: string;
|
|
741
|
+
lastModifiedIso: string;
|
|
742
|
+
isReadOnly: boolean;
|
|
743
|
+
artwork?: {
|
|
744
|
+
items: {
|
|
745
|
+
url: string;
|
|
746
|
+
width?: number | undefined;
|
|
747
|
+
height?: number | undefined;
|
|
748
|
+
purpose?: "avatar" | "cover" | "background" | "thumbnail" | undefined;
|
|
749
|
+
source?: {
|
|
750
|
+
id: string;
|
|
751
|
+
provider: string;
|
|
752
|
+
url?: string | undefined;
|
|
753
|
+
} | undefined;
|
|
754
|
+
}[];
|
|
755
|
+
} | undefined;
|
|
756
|
+
description?: string | undefined;
|
|
757
|
+
tags?: string[] | undefined;
|
|
758
|
+
origin?: {
|
|
759
|
+
id: string;
|
|
760
|
+
provider: string;
|
|
761
|
+
url?: string | undefined;
|
|
762
|
+
} | undefined;
|
|
763
|
+
parentId?: string | undefined;
|
|
764
|
+
}, {
|
|
765
|
+
items: {
|
|
766
|
+
id: string;
|
|
767
|
+
track: {
|
|
768
|
+
artists: {
|
|
769
|
+
name: string;
|
|
770
|
+
roles: string[];
|
|
771
|
+
source?: {
|
|
772
|
+
id: string;
|
|
773
|
+
provider: string;
|
|
774
|
+
url?: string | undefined;
|
|
775
|
+
} | undefined;
|
|
776
|
+
}[];
|
|
777
|
+
source: {
|
|
778
|
+
id: string;
|
|
779
|
+
provider: string;
|
|
780
|
+
url?: string | undefined;
|
|
781
|
+
};
|
|
782
|
+
title: string;
|
|
783
|
+
durationMs?: number | undefined;
|
|
784
|
+
} & {
|
|
785
|
+
[k: string]: unknown;
|
|
786
|
+
};
|
|
787
|
+
addedAtIso: string;
|
|
788
|
+
note?: string | undefined;
|
|
789
|
+
}[];
|
|
790
|
+
id: string;
|
|
791
|
+
name: string;
|
|
792
|
+
createdAtIso: string;
|
|
793
|
+
lastModifiedIso: string;
|
|
794
|
+
isReadOnly: boolean;
|
|
795
|
+
artwork?: {
|
|
796
|
+
items: {
|
|
797
|
+
url: string;
|
|
798
|
+
width?: number | undefined;
|
|
799
|
+
height?: number | undefined;
|
|
800
|
+
purpose?: "avatar" | "cover" | "background" | "thumbnail" | undefined;
|
|
801
|
+
source?: {
|
|
802
|
+
id: string;
|
|
803
|
+
provider: string;
|
|
804
|
+
url?: string | undefined;
|
|
805
|
+
} | undefined;
|
|
806
|
+
}[];
|
|
807
|
+
} | undefined;
|
|
808
|
+
description?: string | undefined;
|
|
809
|
+
tags?: string[] | undefined;
|
|
810
|
+
origin?: {
|
|
811
|
+
id: string;
|
|
812
|
+
provider: string;
|
|
813
|
+
url?: string | undefined;
|
|
814
|
+
} | undefined;
|
|
815
|
+
parentId?: string | undefined;
|
|
816
|
+
}>;
|
|
817
|
+
}, "strip", z.ZodTypeAny, {
|
|
818
|
+
version: number;
|
|
819
|
+
playlist: {
|
|
820
|
+
items: {
|
|
821
|
+
id: string;
|
|
822
|
+
track: {
|
|
823
|
+
artists: {
|
|
824
|
+
name: string;
|
|
825
|
+
roles: string[];
|
|
826
|
+
source?: {
|
|
827
|
+
id: string;
|
|
828
|
+
provider: string;
|
|
829
|
+
url?: string | undefined;
|
|
830
|
+
} | undefined;
|
|
831
|
+
}[];
|
|
832
|
+
source: {
|
|
833
|
+
id: string;
|
|
834
|
+
provider: string;
|
|
835
|
+
url?: string | undefined;
|
|
836
|
+
};
|
|
837
|
+
title: string;
|
|
838
|
+
durationMs?: number | undefined;
|
|
839
|
+
} & {
|
|
840
|
+
[k: string]: unknown;
|
|
841
|
+
};
|
|
842
|
+
addedAtIso: string;
|
|
843
|
+
note?: string | undefined;
|
|
844
|
+
}[];
|
|
845
|
+
id: string;
|
|
846
|
+
name: string;
|
|
847
|
+
createdAtIso: string;
|
|
848
|
+
lastModifiedIso: string;
|
|
849
|
+
isReadOnly: boolean;
|
|
850
|
+
artwork?: {
|
|
851
|
+
items: {
|
|
852
|
+
url: string;
|
|
853
|
+
width?: number | undefined;
|
|
854
|
+
height?: number | undefined;
|
|
855
|
+
purpose?: "avatar" | "cover" | "background" | "thumbnail" | undefined;
|
|
856
|
+
source?: {
|
|
857
|
+
id: string;
|
|
858
|
+
provider: string;
|
|
859
|
+
url?: string | undefined;
|
|
860
|
+
} | undefined;
|
|
861
|
+
}[];
|
|
862
|
+
} | undefined;
|
|
863
|
+
description?: string | undefined;
|
|
864
|
+
tags?: string[] | undefined;
|
|
865
|
+
origin?: {
|
|
866
|
+
id: string;
|
|
867
|
+
provider: string;
|
|
868
|
+
url?: string | undefined;
|
|
869
|
+
} | undefined;
|
|
870
|
+
parentId?: string | undefined;
|
|
871
|
+
};
|
|
872
|
+
}, {
|
|
873
|
+
version: number;
|
|
874
|
+
playlist: {
|
|
875
|
+
items: {
|
|
876
|
+
id: string;
|
|
877
|
+
track: {
|
|
878
|
+
artists: {
|
|
879
|
+
name: string;
|
|
880
|
+
roles: string[];
|
|
881
|
+
source?: {
|
|
882
|
+
id: string;
|
|
883
|
+
provider: string;
|
|
884
|
+
url?: string | undefined;
|
|
885
|
+
} | undefined;
|
|
886
|
+
}[];
|
|
887
|
+
source: {
|
|
888
|
+
id: string;
|
|
889
|
+
provider: string;
|
|
890
|
+
url?: string | undefined;
|
|
891
|
+
};
|
|
892
|
+
title: string;
|
|
893
|
+
durationMs?: number | undefined;
|
|
894
|
+
} & {
|
|
895
|
+
[k: string]: unknown;
|
|
896
|
+
};
|
|
897
|
+
addedAtIso: string;
|
|
898
|
+
note?: string | undefined;
|
|
899
|
+
}[];
|
|
900
|
+
id: string;
|
|
901
|
+
name: string;
|
|
902
|
+
createdAtIso: string;
|
|
903
|
+
lastModifiedIso: string;
|
|
904
|
+
isReadOnly: boolean;
|
|
905
|
+
artwork?: {
|
|
906
|
+
items: {
|
|
907
|
+
url: string;
|
|
908
|
+
width?: number | undefined;
|
|
909
|
+
height?: number | undefined;
|
|
910
|
+
purpose?: "avatar" | "cover" | "background" | "thumbnail" | undefined;
|
|
911
|
+
source?: {
|
|
912
|
+
id: string;
|
|
913
|
+
provider: string;
|
|
914
|
+
url?: string | undefined;
|
|
915
|
+
} | undefined;
|
|
916
|
+
}[];
|
|
917
|
+
} | undefined;
|
|
918
|
+
description?: string | undefined;
|
|
919
|
+
tags?: string[] | undefined;
|
|
920
|
+
origin?: {
|
|
921
|
+
id: string;
|
|
922
|
+
provider: string;
|
|
923
|
+
url?: string | undefined;
|
|
924
|
+
} | undefined;
|
|
925
|
+
parentId?: string | undefined;
|
|
926
|
+
};
|
|
927
|
+
}>;
|
|
928
|
+
|
|
384
929
|
export declare type PlaylistIndexEntry = Pick<Playlist, 'id' | 'name' | 'createdAtIso' | 'lastModifiedIso' | 'isReadOnly' | 'artwork'> & {
|
|
385
930
|
itemCount: number;
|
|
386
931
|
totalDurationMs: number;
|
|
@@ -627,6 +1172,11 @@ export declare type PlaylistItem<T extends Track = Track> = {
|
|
|
627
1172
|
addedAtIso: string;
|
|
628
1173
|
};
|
|
629
1174
|
|
|
1175
|
+
export declare type PlaylistProvider = ProviderDescriptor<'playlists'> & {
|
|
1176
|
+
matchesUrl: (url: string) => boolean;
|
|
1177
|
+
fetchPlaylistByUrl: (url: string) => Promise<Playlist>;
|
|
1178
|
+
};
|
|
1179
|
+
|
|
630
1180
|
export declare type PlaylistRef = {
|
|
631
1181
|
id: string;
|
|
632
1182
|
name: string;
|
|
@@ -634,6 +1184,21 @@ export declare type PlaylistRef = {
|
|
|
634
1184
|
source: ProviderRef;
|
|
635
1185
|
};
|
|
636
1186
|
|
|
1187
|
+
export declare class PlaylistsAPI {
|
|
1188
|
+
#private;
|
|
1189
|
+
constructor(host?: PlaylistsHost);
|
|
1190
|
+
getIndex(): Promise<PlaylistIndexEntry[]>;
|
|
1191
|
+
getPlaylist(id: string): Promise<Playlist | null>;
|
|
1192
|
+
createPlaylist(name: string): Promise<string>;
|
|
1193
|
+
deletePlaylist(id: string): Promise<void>;
|
|
1194
|
+
addTracks(playlistId: string, tracks: Track[]): Promise<PlaylistItem[]>;
|
|
1195
|
+
removeTracks(playlistId: string, itemIds: string[]): Promise<void>;
|
|
1196
|
+
reorderTracks(playlistId: string, from: number, to: number): Promise<void>;
|
|
1197
|
+
importPlaylist(playlist: Playlist): Promise<string>;
|
|
1198
|
+
saveQueueAsPlaylist(name: string): Promise<string>;
|
|
1199
|
+
subscribe(listener: PlaylistsListener): () => void;
|
|
1200
|
+
}
|
|
1201
|
+
|
|
637
1202
|
export declare const playlistSchema: z.ZodObject<{
|
|
638
1203
|
id: z.ZodString;
|
|
639
1204
|
name: z.ZodString;
|
|
@@ -1028,6 +1593,21 @@ export declare const playlistSchema: z.ZodObject<{
|
|
|
1028
1593
|
parentId?: string | undefined;
|
|
1029
1594
|
}>;
|
|
1030
1595
|
|
|
1596
|
+
export declare type PlaylistsHost = {
|
|
1597
|
+
getIndex: () => Promise<PlaylistIndexEntry[]>;
|
|
1598
|
+
getPlaylist: (id: string) => Promise<Playlist | null>;
|
|
1599
|
+
createPlaylist: (name: string) => Promise<string>;
|
|
1600
|
+
deletePlaylist: (id: string) => Promise<void>;
|
|
1601
|
+
addTracks: (playlistId: string, tracks: Track[]) => Promise<PlaylistItem[]>;
|
|
1602
|
+
removeTracks: (playlistId: string, itemIds: string[]) => Promise<void>;
|
|
1603
|
+
reorderTracks: (playlistId: string, from: number, to: number) => Promise<void>;
|
|
1604
|
+
importPlaylist: (playlist: Playlist) => Promise<string>;
|
|
1605
|
+
saveQueueAsPlaylist: (name: string) => Promise<string>;
|
|
1606
|
+
subscribe: (listener: PlaylistsListener) => () => void;
|
|
1607
|
+
};
|
|
1608
|
+
|
|
1609
|
+
export declare type PlaylistsListener = (index: PlaylistIndexEntry[]) => void;
|
|
1610
|
+
|
|
1031
1611
|
export declare type PluginIcon = {
|
|
1032
1612
|
type: 'link';
|
|
1033
1613
|
link: string;
|
|
@@ -1066,7 +1646,7 @@ export declare type ProviderDescriptor<K extends ProviderKind = ProviderKind> =
|
|
|
1066
1646
|
pluginId?: string;
|
|
1067
1647
|
};
|
|
1068
1648
|
|
|
1069
|
-
export declare type ProviderKind = 'metadata' | 'streaming' | 'lyrics' | 'dashboard' | (string & {});
|
|
1649
|
+
export declare type ProviderKind = 'metadata' | 'streaming' | 'lyrics' | 'dashboard' | 'playlists' | (string & {});
|
|
1070
1650
|
|
|
1071
1651
|
export declare type ProviderRef = {
|
|
1072
1652
|
provider: string;
|
|
@@ -1294,6 +1874,8 @@ export declare type StringWidget = {
|
|
|
1294
1874
|
type: 'textarea';
|
|
1295
1875
|
placeholder?: string;
|
|
1296
1876
|
rows?: number;
|
|
1877
|
+
} | {
|
|
1878
|
+
type: 'info';
|
|
1297
1879
|
};
|
|
1298
1880
|
|
|
1299
1881
|
export declare type Track = {
|