mass-queue-types 0.10.3 → 1.0.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.
Files changed (27) hide show
  1. package/README.md +2 -2
  2. package/package.json +1 -1
  3. package/packages/mass_queue/actions/get_album.ts +4 -4
  4. package/packages/mass_queue/actions/get_album_tracks.ts +3 -3
  5. package/packages/mass_queue/actions/get_artist.ts +4 -4
  6. package/packages/mass_queue/actions/get_artist_tracks.ts +3 -3
  7. package/packages/mass_queue/actions/get_group_volume.ts +2 -2
  8. package/packages/mass_queue/actions/get_playlist.ts +5 -5
  9. package/packages/mass_queue/actions/get_playlist_tracks.ts +5 -3
  10. package/packages/mass_queue/actions/get_queue_items.ts +4 -4
  11. package/packages/mass_queue/actions/get_recommendations.ts +2 -2
  12. package/packages/mass_queue/actions/move_queue_item_down.ts +2 -2
  13. package/packages/mass_queue/actions/move_queue_item_next.ts +2 -2
  14. package/packages/mass_queue/actions/move_queue_item_up.ts +2 -2
  15. package/packages/mass_queue/actions/play_queue_item.ts +2 -2
  16. package/packages/mass_queue/actions/remove_playlist_tracks.ts +12 -0
  17. package/packages/mass_queue/actions/remove_queue_item.ts +2 -2
  18. package/packages/mass_queue/actions/send_command.ts +2 -2
  19. package/packages/mass_queue/actions/set_group_volume.ts +2 -2
  20. package/packages/mass_queue/actions/unfavorite_current_item.ts +2 -2
  21. package/packages/mass_queue/utils.ts +2 -2
  22. package/packages/music_assistant/actions/get_library.ts +2 -2
  23. package/packages/music_assistant/actions/get_queue.ts +2 -2
  24. package/packages/music_assistant/actions/play_announcement.ts +2 -2
  25. package/packages/music_assistant/actions/play_media.ts +2 -2
  26. package/packages/music_assistant/actions/search.ts +2 -2
  27. package/packages/music_assistant/actions/transfer_queue.ts +2 -2
package/README.md CHANGED
@@ -45,13 +45,13 @@ Typescript types and interfaces for the [Music Assistant Queue Actions](https://
45
45
  # Usage
46
46
 
47
47
  ## Service Schemas
48
- All service schemas are available as PARTIAL (service data only) or FULL (entire service call) schemas. Full will only work when calling `hass.callWS` due to the function schemas.
48
+ All service schemas are available as ServiceData or FULL (entire service call) schemas. Full will only work when calling `hass.callWS` due to the function schemas.
49
49
 
50
50
  **Use FULL when...**
51
51
  * You are calling `hass.callWS`.
52
52
  * You want complete validation, including the `type`, `domain`, `service`, and (if applicable), `return_response`.
53
53
 
54
- **Use PARTIAL when...**
54
+ **Use ServiceData only when...**
55
55
  * You are calling `hass.callService`.
56
56
  * You only want to validate the service data being passed.
57
57
 
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Custom Types and Interfaces for Music Assistant Queue Actions",
4
4
  "repository": "https://github.com/droans/mass-queue-types",
5
5
  "author": "Michael Carroll",
6
- "version": "0.10.3",
6
+ "version": "1.0.0",
7
7
  "module": "mass-queue-types.js",
8
8
  "keywords": [
9
9
  "home-assistant",
@@ -1,11 +1,11 @@
1
1
  import { Album } from "../types/media-items.js";
2
- import { baseMassQueueServiceWithResponseSchema, getCollectionDataPartialServiceSchema } from "../utils.js";
2
+ import { baseMassQueueServiceWithResponseSchema, getCollectionDataServiceData } from "../utils.js";
3
3
 
4
- export type getAlbumServiceResponse = Album;
4
+ export type getAlbumServiceResponse = {response: Album};
5
5
 
6
- export type getAlbumPartialServiceSchema = getCollectionDataPartialServiceSchema
6
+ export type getAlbumServiceData = getCollectionDataServiceData
7
7
 
8
8
  export interface getAlbumServiceSchema extends baseMassQueueServiceWithResponseSchema {
9
9
  service: 'get_album';
10
- service_data: getAlbumPartialServiceSchema;
10
+ service_data: getAlbumServiceData;
11
11
  }
@@ -1,10 +1,10 @@
1
- import { baseMassQueueServiceWithResponseSchema, getCollectionDataPartialServiceSchema, getTracksServiceResponse } from "../utils.js";
1
+ import { baseMassQueueServiceWithResponseSchema, getCollectionDataServiceData, getTracksServiceResponse } from "../utils.js";
2
2
 
3
3
  export type getAlbumTracksServiceResponse = getTracksServiceResponse;
4
4
 
5
- export type getAlbumTracksPartialServiceSchema = getCollectionDataPartialServiceSchema
5
+ export type getAlbumTracksServiceData = getCollectionDataServiceData
6
6
 
7
7
  export interface getAlbumTracksServiceSchema extends baseMassQueueServiceWithResponseSchema {
8
8
  service: 'get_album_tracks';
9
- service_data: getAlbumTracksPartialServiceSchema;
9
+ service_data: getAlbumTracksServiceData;
10
10
  }
@@ -1,11 +1,11 @@
1
1
  import { Artist } from "../types/media-items.js";
2
- import { baseMassQueueServiceWithResponseSchema, getCollectionDataPartialServiceSchema } from "../utils.js";
2
+ import { baseMassQueueServiceWithResponseSchema, getCollectionDataServiceData } from "../utils.js";
3
3
 
4
- export type getArtistServiceResponse = Artist;
4
+ export type getArtistServiceResponse = {response: Artist};
5
5
 
6
- export type getArtistPartialServiceSchema = getCollectionDataPartialServiceSchema
6
+ export type getArtistServiceData = getCollectionDataServiceData
7
7
 
8
8
  export interface getArtistServiceSchema extends baseMassQueueServiceWithResponseSchema {
9
9
  service: 'get_artist';
10
- service_data: getArtistPartialServiceSchema;
10
+ service_data: getArtistServiceData;
11
11
  }
@@ -1,10 +1,10 @@
1
- import { baseMassQueueServiceWithResponseSchema, getCollectionDataPartialServiceSchema, getTracksServiceResponse } from "../utils.js";
1
+ import { baseMassQueueServiceWithResponseSchema, getCollectionDataServiceData, getTracksServiceResponse } from "../utils.js";
2
2
 
3
3
  export type getArtistTracksServiceResponse = getTracksServiceResponse;
4
4
 
5
- export type getArtistTracksPartialServiceSchema = getCollectionDataPartialServiceSchema
5
+ export type getArtistTracksServiceData = getCollectionDataServiceData
6
6
 
7
7
  export interface getArtistTracksServiceSchema extends baseMassQueueServiceWithResponseSchema {
8
8
  service: 'get_artist_tracks';
9
- service_data: getArtistTracksPartialServiceSchema;
9
+ service_data: getArtistTracksServiceData;
10
10
  }
@@ -8,12 +8,12 @@ export interface getGroupVolumeServiceResponse {
8
8
  response: getGroupVolumePartialServiceResponse;
9
9
  }
10
10
 
11
- export interface getGroupVolumePartialSchema {
11
+ export interface getGroupVolumeServiceData {
12
12
  entity: string;
13
13
  }
14
14
 
15
15
  export interface getGroupVolumeServiceSchema
16
16
  extends baseMassQueueServiceWithResponseSchema {
17
17
  service: "get_group_volume";
18
- service_data: getGroupVolumePartialSchema;
18
+ service_data: getGroupVolumeServiceData;
19
19
  }
@@ -1,11 +1,11 @@
1
1
  import { Playlist } from "../types/media-items.js";
2
- import { baseMassQueueServiceWithResponseSchema, getCollectionDataPartialServiceSchema } from "../utils.js";
2
+ import { baseMassQueueServiceWithResponseSchema, getCollectionDataServiceData } from "../utils.js";
3
3
 
4
- export type getPlaylistServiceResponse = Playlist;
4
+ export type getPlaylistServiceResponse = {response: Playlist};
5
5
 
6
- export type getPlaylistPartialSchema = getCollectionDataPartialServiceSchema
6
+ export type getPlaylistServiceData = getCollectionDataServiceData
7
7
 
8
- export interface getPlaylistSchema extends baseMassQueueServiceWithResponseSchema {
8
+ export interface getPlaylistServiceSchema extends baseMassQueueServiceWithResponseSchema {
9
9
  service: 'get_playlist';
10
- service_data: getPlaylistPartialSchema;
10
+ service_data: getPlaylistServiceData;
11
11
  }
@@ -1,10 +1,12 @@
1
- import { baseMassQueueServiceWithResponseSchema, getCollectionDataPartialServiceSchema, getTracksServiceResponse } from "../utils.js";
1
+ import { baseMassQueueServiceWithResponseSchema, getCollectionDataServiceData, getTracksServiceResponse } from "../utils.js";
2
2
 
3
3
  export type getPlaylistTracksServiceResponse = getTracksServiceResponse;
4
4
 
5
- export type getPlaylistTracksPartialServiceSchema = getCollectionDataPartialServiceSchema
5
+ export interface getPlaylistTracksServiceData extends getCollectionDataServiceData {
6
+ position: number
7
+ }
6
8
 
7
9
  export interface getPlaylistTracksServiceSchema extends baseMassQueueServiceWithResponseSchema {
8
10
  service: 'get_playlist_tracks';
9
- service_data: getPlaylistTracksPartialServiceSchema;
11
+ service_data: getPlaylistTracksServiceData;
10
12
  }
@@ -17,13 +17,13 @@ export interface queueItem {
17
17
 
18
18
  export type queueItems = queueItem[];
19
19
 
20
- type getQueueItemsPartialResponse = Record<string, queueItems>;
20
+ type getQueueItemsPartialServiceResponse = Record<string, queueItems>;
21
21
 
22
22
  export interface getQueueItemsServiceResponse {
23
- response: getQueueItemsPartialResponse;
23
+ response: getQueueItemsPartialServiceResponse;
24
24
  }
25
25
 
26
- export interface getQueueItemsPartialSchema {
26
+ export interface getQueueItemsServiceData {
27
27
  entity: string;
28
28
  limit_before?: number;
29
29
  limit_after?: number;
@@ -34,5 +34,5 @@ export interface getQueueItemsPartialSchema {
34
34
  export interface getQueueItemsServiceSchema
35
35
  extends baseMassQueueServiceWithResponseSchema {
36
36
  service: "get_queue_items";
37
- service_data: getQueueItemsPartialSchema;
37
+ service_data: getQueueItemsServiceData;
38
38
  }
@@ -30,12 +30,12 @@ export interface getRecommendationsServiceResponse {
30
30
  response: getRecommendationsPartialServiceResponse;
31
31
  }
32
32
 
33
- export interface getRecommendationsPartialSchema {
33
+ export interface getRecommendationsServiceData {
34
34
  entity: string;
35
35
  }
36
36
 
37
37
  export interface getRecommendationsServiceSchema
38
38
  extends baseMassQueueServiceWithResponseSchema {
39
39
  service: "get_recommendations";
40
- service_data: getRecommendationsPartialSchema;
40
+ service_data: getRecommendationsServiceData;
41
41
  }
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  baseMassQueueServiceSchema,
3
- queueItemPartialSchema,
3
+ queueItemServiceData,
4
4
  } from "../utils.js";
5
5
 
6
6
  export interface moveQueueItemDownServiceSchema
7
7
  extends baseMassQueueServiceSchema {
8
8
  service: "move_queue_item_down";
9
- service_data: queueItemPartialSchema;
9
+ service_data: queueItemServiceData;
10
10
  }
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  baseMassQueueServiceSchema,
3
- queueItemPartialSchema,
3
+ queueItemServiceData,
4
4
  } from "../utils.js";
5
5
 
6
6
  export interface moveQueueItemNextServiceSchema
7
7
  extends baseMassQueueServiceSchema {
8
8
  service: "move_queue_item_next";
9
- service_data: queueItemPartialSchema;
9
+ service_data: queueItemServiceData;
10
10
  }
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  baseMassQueueServiceSchema,
3
- queueItemPartialSchema,
3
+ queueItemServiceData,
4
4
  } from "../utils.js";
5
5
 
6
6
  export interface moveQueueItemUpServiceSchema
7
7
  extends baseMassQueueServiceSchema {
8
8
  service: "move_queue_item_up";
9
- service_data: queueItemPartialSchema;
9
+ service_data: queueItemServiceData;
10
10
  }
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  baseMassQueueServiceSchema,
3
- queueItemPartialSchema,
3
+ queueItemServiceData,
4
4
  } from "../utils.js";
5
5
 
6
6
  export interface playQueueItemServiceSchema extends baseMassQueueServiceSchema {
7
7
  service: "play_queue_item";
8
- service_data: queueItemPartialSchema;
8
+ service_data: queueItemServiceData;
9
9
  }
@@ -0,0 +1,12 @@
1
+ import { baseMassQueueServiceSchema } from "../utils.js";
2
+
3
+ export interface removePlaylistTracksServiceData {
4
+ config_entry_id: string;
5
+ playlist_id: number | string;
6
+ positions_to_remove: number[]
7
+ }
8
+
9
+ export interface removePlaylistTracksServiceSchema extends baseMassQueueServiceSchema {
10
+ service: "remove_playlist_tracks";
11
+ service_data: removePlaylistTracksServiceData;
12
+ }
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  baseMassQueueServiceSchema,
3
- queueItemPartialSchema,
3
+ queueItemServiceData,
4
4
  } from "../utils.js";
5
5
 
6
6
  export interface removeServiceSchema extends baseMassQueueServiceSchema {
7
7
  service: "remove_queue_item";
8
- service_data: queueItemPartialSchema;
8
+ service_data: queueItemServiceData;
9
9
  }
@@ -3,7 +3,7 @@ import { baseMassQueueServiceSchema } from "../utils.js";
3
3
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
4
4
  type dataSchema = Record<string, any>;
5
5
 
6
- export interface sendCommandPartialSchema {
6
+ export interface sendCommandServiceData {
7
7
  command: string;
8
8
  config_entry_id: string;
9
9
  data: dataSchema | null | undefined;
@@ -11,5 +11,5 @@ export interface sendCommandPartialSchema {
11
11
 
12
12
  export interface sendCommandServiceSchema extends baseMassQueueServiceSchema {
13
13
  service: "send_command";
14
- service_data: sendCommandPartialSchema;
14
+ service_data: sendCommandServiceData;
15
15
  }
@@ -1,6 +1,6 @@
1
1
  import { baseMassQueueServiceSchema } from "../utils.js";
2
2
 
3
- export interface setGroupVolumePartialSchema {
3
+ export interface setGroupVolumeServiceData {
4
4
  entity: string;
5
5
  volume_level: number;
6
6
  }
@@ -8,5 +8,5 @@ export interface setGroupVolumePartialSchema {
8
8
  export interface setGroupVolumeServiceSchema
9
9
  extends baseMassQueueServiceSchema {
10
10
  service: "set_group_volume";
11
- service_data: setGroupVolumePartialSchema;
11
+ service_data: setGroupVolumeServiceData;
12
12
  }
@@ -1,11 +1,11 @@
1
1
  import { baseMassQueueServiceSchema } from "../utils.js";
2
2
 
3
- export interface unfavoriteCurrentItemPartialSchema {
3
+ export interface unfavoriteCurrentItemServiceData {
4
4
  entity: string;
5
5
  }
6
6
 
7
7
  export interface unfavoriteCurrentItemServiceSchema
8
8
  extends baseMassQueueServiceSchema {
9
9
  service: "unfavorite_current_item";
10
- service_data: unfavoriteCurrentItemPartialSchema;
10
+ service_data: unfavoriteCurrentItemServiceData;
11
11
  }
@@ -9,7 +9,7 @@ export interface baseMassQueueServiceWithResponseSchema
9
9
  return_response: true;
10
10
  }
11
11
 
12
- export interface queueItemPartialSchema {
12
+ export interface queueItemServiceData {
13
13
  entity: string;
14
14
  queue_item_id: string;
15
15
  }
@@ -32,7 +32,7 @@ export interface getTracksServiceResponse {
32
32
  };
33
33
  }
34
34
 
35
- export interface getCollectionDataPartialServiceSchema {
35
+ export interface getCollectionDataServiceData {
36
36
  uri: string;
37
37
  config_entry_id: string;
38
38
  }
@@ -12,7 +12,7 @@ export interface getLibraryServiceResponse {
12
12
  response: getLibraryPartialServiceResponse
13
13
  }
14
14
 
15
- export interface getLibraryPartialSchema {
15
+ export interface getLibraryServiceData {
16
16
  config_entry_id: string;
17
17
  media_type: MediaTypes;
18
18
  favorite?: boolean;
@@ -26,5 +26,5 @@ export interface getLibraryPartialSchema {
26
26
  export interface getLibraryServiceSchema
27
27
  extends baseMusicAssistantServiceWithResponseSchema {
28
28
  service: "get_library"
29
- service_data: getLibraryPartialSchema
29
+ service_data: getLibraryServiceData
30
30
  }
@@ -20,12 +20,12 @@ export interface getQueueServiceResponse {
20
20
  response: getQueueServiceEntitiesResponse;
21
21
  }
22
22
 
23
- export interface getQueuePartialSchema {
23
+ export interface getQueueServiceData {
24
24
  entity_id: string;
25
25
  }
26
26
 
27
27
  export interface getQueueServiceSchema
28
28
  extends baseMusicAssistantServiceWithResponseSchema {
29
29
  service: "get_queue"
30
- service_data: getQueuePartialSchema
30
+ service_data: getQueueServiceData
31
31
  }
@@ -1,6 +1,6 @@
1
1
  import { baseMusicAssistantServiceWithTargetSchema } from "../utils.js";
2
2
 
3
- export interface playAnnouncementPartialSchema {
3
+ export interface playAnnouncementServiceData {
4
4
  url: string;
5
5
  use_pre_announce?: boolean;
6
6
  }
@@ -8,5 +8,5 @@ export interface playAnnouncementPartialSchema {
8
8
  export interface playAnnouncementServiceSchema
9
9
  extends baseMusicAssistantServiceWithTargetSchema {
10
10
  service: "play_announcement"
11
- service_data: playAnnouncementPartialSchema
11
+ service_data: playAnnouncementServiceData
12
12
  }
@@ -1,7 +1,7 @@
1
1
  import { EnqueueModes, MediaTypes } from "../types.js";
2
2
  import { baseMusicAssistantServiceWithTargetSchema } from "../utils.js";
3
3
 
4
- export interface playMediaPartialSchema {
4
+ export interface playMediaServiceData {
5
5
  media_id: string;
6
6
  media_type?: MediaTypes;
7
7
  artist?: string;
@@ -13,5 +13,5 @@ export interface playMediaPartialSchema {
13
13
  export interface playMediaServiceSchema
14
14
  extends baseMusicAssistantServiceWithTargetSchema {
15
15
  service: "play_media"
16
- service_data: playMediaPartialSchema
16
+ service_data: playMediaServiceData
17
17
  }
@@ -14,7 +14,7 @@ export interface searchServiceResponse {
14
14
  response: searchPartialServiceResponse
15
15
  }
16
16
 
17
- export interface searchPartialSchema {
17
+ export interface searchServiceData {
18
18
  config_entry_id: string;
19
19
  name: string;
20
20
  media_type?: MediaTypes[];
@@ -27,5 +27,5 @@ export interface searchPartialSchema {
27
27
  export interface searchServiceSchema
28
28
  extends baseMusicAssistantServiceWithResponseSchema {
29
29
  service: "search"
30
- service_data: searchPartialSchema
30
+ service_data: searchServiceData
31
31
  }
@@ -1,6 +1,6 @@
1
1
  import { baseMusicAssistantServiceWithTargetSchema } from "../utils.js";
2
2
 
3
- export interface transferQueuePartialSchema {
3
+ export interface transferQueueServiceData {
4
4
  source_player?: string;
5
5
  auto_play?: string;
6
6
  }
@@ -8,5 +8,5 @@ export interface transferQueuePartialSchema {
8
8
  export interface transferQueueServiceSchema
9
9
  extends baseMusicAssistantServiceWithTargetSchema {
10
10
  service: "transfer_queue"
11
- service_data: transferQueuePartialSchema
11
+ service_data: transferQueueServiceData
12
12
  }