@soundretouch/api 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 (160) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +107 -0
  3. package/dist/index.d.ts +23 -0
  4. package/dist/index.d.ts.map +1 -0
  5. package/dist/index.js +3 -0
  6. package/dist/index.js.map +1 -0
  7. package/dist/src/client/errors.d.ts +35 -0
  8. package/dist/src/client/errors.d.ts.map +1 -0
  9. package/dist/src/client/errors.js +44 -0
  10. package/dist/src/client/errors.js.map +1 -0
  11. package/dist/src/client/http.d.ts +40 -0
  12. package/dist/src/client/http.d.ts.map +1 -0
  13. package/dist/src/client/http.js +88 -0
  14. package/dist/src/client/http.js.map +1 -0
  15. package/dist/src/client/ws.d.ts +82 -0
  16. package/dist/src/client/ws.d.ts.map +1 -0
  17. package/dist/src/client/ws.js +153 -0
  18. package/dist/src/client/ws.js.map +1 -0
  19. package/dist/src/client/xml.d.ts +8 -0
  20. package/dist/src/client/xml.d.ts.map +1 -0
  21. package/dist/src/client/xml.js +18 -0
  22. package/dist/src/client/xml.js.map +1 -0
  23. package/dist/src/device/SoundTouchDevice.d.ts +457 -0
  24. package/dist/src/device/SoundTouchDevice.d.ts.map +1 -0
  25. package/dist/src/device/SoundTouchDevice.js +623 -0
  26. package/dist/src/device/SoundTouchDevice.js.map +1 -0
  27. package/dist/src/discovery/SoundTouchDiscovery.d.ts +18 -0
  28. package/dist/src/discovery/SoundTouchDiscovery.d.ts.map +1 -0
  29. package/dist/src/discovery/SoundTouchDiscovery.js +42 -0
  30. package/dist/src/discovery/SoundTouchDiscovery.js.map +1 -0
  31. package/dist/src/endpoints/audioProductLevelControls.d.ts +24 -0
  32. package/dist/src/endpoints/audioProductLevelControls.d.ts.map +1 -0
  33. package/dist/src/endpoints/audioProductLevelControls.js +44 -0
  34. package/dist/src/endpoints/audioProductLevelControls.js.map +1 -0
  35. package/dist/src/endpoints/audioProductToneControls.d.ts +24 -0
  36. package/dist/src/endpoints/audioProductToneControls.d.ts.map +1 -0
  37. package/dist/src/endpoints/audioProductToneControls.js +44 -0
  38. package/dist/src/endpoints/audioProductToneControls.js.map +1 -0
  39. package/dist/src/endpoints/audiodspcontrols.d.ts +24 -0
  40. package/dist/src/endpoints/audiodspcontrols.d.ts.map +1 -0
  41. package/dist/src/endpoints/audiodspcontrols.js +44 -0
  42. package/dist/src/endpoints/audiodspcontrols.js.map +1 -0
  43. package/dist/src/endpoints/bass.d.ts +23 -0
  44. package/dist/src/endpoints/bass.d.ts.map +1 -0
  45. package/dist/src/endpoints/bass.js +33 -0
  46. package/dist/src/endpoints/bass.js.map +1 -0
  47. package/dist/src/endpoints/bassCapabilities.d.ts +11 -0
  48. package/dist/src/endpoints/bassCapabilities.d.ts.map +1 -0
  49. package/dist/src/endpoints/bassCapabilities.js +16 -0
  50. package/dist/src/endpoints/bassCapabilities.js.map +1 -0
  51. package/dist/src/endpoints/capabilities.d.ts +11 -0
  52. package/dist/src/endpoints/capabilities.d.ts.map +1 -0
  53. package/dist/src/endpoints/capabilities.js +16 -0
  54. package/dist/src/endpoints/capabilities.js.map +1 -0
  55. package/dist/src/endpoints/info.d.ts +11 -0
  56. package/dist/src/endpoints/info.d.ts.map +1 -0
  57. package/dist/src/endpoints/info.js +16 -0
  58. package/dist/src/endpoints/info.js.map +1 -0
  59. package/dist/src/endpoints/key.d.ts +37 -0
  60. package/dist/src/endpoints/key.d.ts.map +1 -0
  61. package/dist/src/endpoints/key.js +45 -0
  62. package/dist/src/endpoints/key.js.map +1 -0
  63. package/dist/src/endpoints/name.d.ts +14 -0
  64. package/dist/src/endpoints/name.d.ts.map +1 -0
  65. package/dist/src/endpoints/name.js +23 -0
  66. package/dist/src/endpoints/name.js.map +1 -0
  67. package/dist/src/endpoints/nowPlaying.d.ts +11 -0
  68. package/dist/src/endpoints/nowPlaying.d.ts.map +1 -0
  69. package/dist/src/endpoints/nowPlaying.js +16 -0
  70. package/dist/src/endpoints/nowPlaying.js.map +1 -0
  71. package/dist/src/endpoints/presets.d.ts +11 -0
  72. package/dist/src/endpoints/presets.d.ts.map +1 -0
  73. package/dist/src/endpoints/presets.js +20 -0
  74. package/dist/src/endpoints/presets.js.map +1 -0
  75. package/dist/src/endpoints/select.d.ts +20 -0
  76. package/dist/src/endpoints/select.d.ts.map +1 -0
  77. package/dist/src/endpoints/select.js +33 -0
  78. package/dist/src/endpoints/select.js.map +1 -0
  79. package/dist/src/endpoints/sources.d.ts +11 -0
  80. package/dist/src/endpoints/sources.d.ts.map +1 -0
  81. package/dist/src/endpoints/sources.js +16 -0
  82. package/dist/src/endpoints/sources.js.map +1 -0
  83. package/dist/src/endpoints/trackInfo.d.ts +11 -0
  84. package/dist/src/endpoints/trackInfo.d.ts.map +1 -0
  85. package/dist/src/endpoints/trackInfo.js +16 -0
  86. package/dist/src/endpoints/trackInfo.js.map +1 -0
  87. package/dist/src/endpoints/volume.d.ts +21 -0
  88. package/dist/src/endpoints/volume.d.ts.map +1 -0
  89. package/dist/src/endpoints/volume.js +33 -0
  90. package/dist/src/endpoints/volume.js.map +1 -0
  91. package/dist/src/endpoints/zone.d.ts +57 -0
  92. package/dist/src/endpoints/zone.d.ts.map +1 -0
  93. package/dist/src/endpoints/zone.js +83 -0
  94. package/dist/src/endpoints/zone.js.map +1 -0
  95. package/dist/src/types/AudioDspControls.d.ts +7 -0
  96. package/dist/src/types/AudioDspControls.d.ts.map +1 -0
  97. package/dist/src/types/AudioDspControls.js +2 -0
  98. package/dist/src/types/AudioDspControls.js.map +1 -0
  99. package/dist/src/types/AudioProductLevelControls.d.ts +15 -0
  100. package/dist/src/types/AudioProductLevelControls.d.ts.map +1 -0
  101. package/dist/src/types/AudioProductLevelControls.js +2 -0
  102. package/dist/src/types/AudioProductLevelControls.js.map +1 -0
  103. package/dist/src/types/AudioProductToneControls.d.ts +15 -0
  104. package/dist/src/types/AudioProductToneControls.d.ts.map +1 -0
  105. package/dist/src/types/AudioProductToneControls.js +2 -0
  106. package/dist/src/types/AudioProductToneControls.js.map +1 -0
  107. package/dist/src/types/Bass.d.ts +6 -0
  108. package/dist/src/types/Bass.d.ts.map +1 -0
  109. package/dist/src/types/Bass.js +2 -0
  110. package/dist/src/types/Bass.js.map +1 -0
  111. package/dist/src/types/BassCapabilities.d.ts +8 -0
  112. package/dist/src/types/BassCapabilities.d.ts.map +1 -0
  113. package/dist/src/types/BassCapabilities.js +2 -0
  114. package/dist/src/types/BassCapabilities.js.map +1 -0
  115. package/dist/src/types/Capabilities.d.ts +10 -0
  116. package/dist/src/types/Capabilities.d.ts.map +1 -0
  117. package/dist/src/types/Capabilities.js +2 -0
  118. package/dist/src/types/Capabilities.js.map +1 -0
  119. package/dist/src/types/ContentItem.d.ts +5 -0
  120. package/dist/src/types/ContentItem.d.ts.map +1 -0
  121. package/dist/src/types/ContentItem.js +2 -0
  122. package/dist/src/types/ContentItem.js.map +1 -0
  123. package/dist/src/types/DeviceInfo.d.ts +22 -0
  124. package/dist/src/types/DeviceInfo.d.ts.map +1 -0
  125. package/dist/src/types/DeviceInfo.js +2 -0
  126. package/dist/src/types/DeviceInfo.js.map +1 -0
  127. package/dist/src/types/Enums.d.ts +8 -0
  128. package/dist/src/types/Enums.d.ts.map +1 -0
  129. package/dist/src/types/Enums.js +2 -0
  130. package/dist/src/types/Enums.js.map +1 -0
  131. package/dist/src/types/NowPlaying.d.ts +25 -0
  132. package/dist/src/types/NowPlaying.d.ts.map +1 -0
  133. package/dist/src/types/NowPlaying.js +2 -0
  134. package/dist/src/types/NowPlaying.js.map +1 -0
  135. package/dist/src/types/Presets.d.ts +15 -0
  136. package/dist/src/types/Presets.d.ts.map +1 -0
  137. package/dist/src/types/Presets.js +2 -0
  138. package/dist/src/types/Presets.js.map +1 -0
  139. package/dist/src/types/Recents.d.ts +14 -0
  140. package/dist/src/types/Recents.d.ts.map +1 -0
  141. package/dist/src/types/Recents.js +2 -0
  142. package/dist/src/types/Recents.js.map +1 -0
  143. package/dist/src/types/Sources.d.ts +12 -0
  144. package/dist/src/types/Sources.d.ts.map +1 -0
  145. package/dist/src/types/Sources.js +2 -0
  146. package/dist/src/types/Sources.js.map +1 -0
  147. package/dist/src/types/Updates.d.ts +37 -0
  148. package/dist/src/types/Updates.d.ts.map +1 -0
  149. package/dist/src/types/Updates.js +2 -0
  150. package/dist/src/types/Updates.js.map +1 -0
  151. package/dist/src/types/Volume.d.ts +6 -0
  152. package/dist/src/types/Volume.d.ts.map +1 -0
  153. package/dist/src/types/Volume.js +2 -0
  154. package/dist/src/types/Volume.js.map +1 -0
  155. package/dist/src/types/Zone.d.ts +22 -0
  156. package/dist/src/types/Zone.d.ts.map +1 -0
  157. package/dist/src/types/Zone.js +2 -0
  158. package/dist/src/types/Zone.js.map +1 -0
  159. package/docs/SoundTouch-Web-API.pdf +0 -0
  160. package/package.json +86 -0
@@ -0,0 +1,18 @@
1
+ import { XMLParser } from 'fast-xml-parser';
2
+ const parser = new XMLParser({
3
+ ignoreAttributes: false,
4
+ attributeNamePrefix: '',
5
+ parseAttributeValue: true,
6
+ parseTagValue: true,
7
+ trimValues: true,
8
+ });
9
+ /**
10
+ * Parses XML into the requested type using the configured XML parser.
11
+ *
12
+ * @param xml Raw XML string to parse.
13
+ * @returns Parsed XML payload typed as the requested generic type.
14
+ */
15
+ export function parseXml(xml) {
16
+ return parser.parse(xml);
17
+ }
18
+ //# sourceMappingURL=xml.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"xml.js","sourceRoot":"","sources":["../../../src/client/xml.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAE3C,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC;IACzB,gBAAgB,EAAE,KAAK;IACvB,mBAAmB,EAAE,EAAE;IACvB,mBAAmB,EAAE,IAAI;IACzB,aAAa,EAAE,IAAI;IACnB,UAAU,EAAE,IAAI;CACnB,CAAC,CAAA;AAEF;;;;;GAKG;AACH,MAAM,UAAU,QAAQ,CAAI,GAAW;IACnC,OAAO,MAAM,CAAC,KAAK,CAAC,GAAG,CAAM,CAAA;AACjC,CAAC"}
@@ -0,0 +1,457 @@
1
+ import { HttpClientOptions } from '../client/http';
2
+ import { WebSocketClientOptions } from '../client/ws';
3
+ import { SoundTouchKey } from '../endpoints/key';
4
+ import { AudioDspControls } from '../types/AudioDspControls';
5
+ import { AudioProductLevelControls, AudioProductLevelControlsUpdate } from '../types/AudioProductLevelControls';
6
+ import { AudioProductToneControls, AudioProductToneControlsUpdate } from '../types/AudioProductToneControls';
7
+ import { Bass } from '../types/Bass';
8
+ import { BassCapabilities } from '../types/BassCapabilities';
9
+ import { Capabilities } from '../types/Capabilities';
10
+ import { ContentItem } from '../types/ContentItem';
11
+ import { DeviceInfo } from '../types/DeviceInfo';
12
+ import { NowPlaying } from '../types/NowPlaying';
13
+ import { Preset, Presets } from '../types/Presets';
14
+ import { Recents } from '../types/Recents';
15
+ import { Sources } from '../types/Sources';
16
+ import { Volume } from '../types/Volume';
17
+ import { Zone, ZoneConfig, ZoneSlaveConfig } from '../types/Zone';
18
+ export type SoundTouchDeviceOptions = {
19
+ http?: HttpClientOptions;
20
+ ws?: WebSocketClientOptions;
21
+ };
22
+ /**
23
+ * Represents a SoundTouch device and provides methods to interact with it.
24
+ *
25
+ * @param host The hostname or IP address of the SoundTouch device.
26
+ * @param options Optional HTTP and WebSocket client configuration.
27
+ *
28
+ * @example
29
+ * const device = new SoundTouchDevice('192.168.1.x');
30
+ * const info = await device.info();
31
+ */
32
+ export declare class SoundTouchDevice {
33
+ readonly host: string;
34
+ private httpClient;
35
+ private wsClient;
36
+ constructor(host: string, options?: SoundTouchDeviceOptions);
37
+ /**
38
+ * Gets device information including identifiers, components, and network info.
39
+ *
40
+ * GET /info
41
+ *
42
+ * @returns Promise<DeviceInfo> A promise that resolves to the device info payload as returned by the device.
43
+ */
44
+ info(): Promise<DeviceInfo>;
45
+ /**
46
+ * Gets info about the currently playing media.
47
+ *
48
+ * GET /now_playing
49
+ *
50
+ * @returns Promise<NowPlaying> A promise that resolves to the now playing payload as returned by the device.
51
+ */
52
+ nowPlaying(): Promise<NowPlaying>;
53
+ /**
54
+ * Gets track information for the currently playing media.
55
+ *
56
+ * GET /trackInfo
57
+ *
58
+ * @returns Promise<NowPlaying> A promise that resolves to the now playing payload as returned by the device.
59
+ */
60
+ trackInfo(): Promise<NowPlaying>;
61
+ /**
62
+ * Lists available content sources on the device.
63
+ *
64
+ * GET /sources
65
+ *
66
+ * @returns Promise<Sources> A promise that resolves to the sources payload as returned by the device.
67
+ */
68
+ sources(): Promise<Sources>;
69
+ /**
70
+ * Selects a content source on the device.
71
+ *
72
+ * Use the /sources endpoint to discover which sources are available for a device.
73
+ * The available sources vary by product and SoundTouch account.
74
+ *
75
+ * POST /select
76
+ *
77
+ * @param item ContentItem describing the source and optional source account.
78
+ * @returns A promise that resolves when the device accepts the selection.
79
+ *
80
+ * @example
81
+ * await device.select({ source: 'AUX', sourceAccount: 'AUX' })
82
+ * await device.select({ source: 'BLUETOOTH' })
83
+ * await device.select({ source: 'PRODUCT', sourceAccount: 'TV' })
84
+ */
85
+ select(item: ContentItem): Promise<void>;
86
+ /**
87
+ * Gets the current volume settings from the device.
88
+ *
89
+ * GET /volume
90
+ *
91
+ * @returns Promise<Volume> A promise that resolves to the volume payload as returned by the device.
92
+ */
93
+ volume(): Promise<Volume>;
94
+ /**
95
+ * Gets the current bass setting from the device.
96
+ *
97
+ * GET /bass
98
+ *
99
+ * @returns Promise<Bass> A promise that resolves to the bass payload as returned by the device.
100
+ */
101
+ bass(): Promise<Bass>;
102
+ /**
103
+ * Gets bass capability information for the device.
104
+ *
105
+ * GET /bassCapabilities
106
+ *
107
+ * @returns Promise<BassCapabilities> A promise that resolves to the bass capabilities payload as returned by the device.
108
+ */
109
+ bassCapabilities(): Promise<BassCapabilities>;
110
+ /**
111
+ * Retrieves system capabilities for the device.
112
+ *
113
+ * GET /capabilities
114
+ *
115
+ * @returns Promise<Capabilities> A promise that resolves to the capabilities payload as returned by the device.
116
+ */
117
+ capabilities(): Promise<Capabilities>;
118
+ /**
119
+ * Gets the current DSP settings for the device.
120
+ *
121
+ * GET /audiodspcontrols
122
+ *
123
+ * @returns Promise<AudioDspControls> A promise that resolves to the DSP controls payload as returned by the device.
124
+ */
125
+ audioDspControls(): Promise<AudioDspControls>;
126
+ /**
127
+ * Gets the current bass and treble settings from the device.
128
+ *
129
+ * GET /audioproducttonecontrols
130
+ *
131
+ * @returns Promise<AudioProductToneControls> A promise that resolves to the tone controls payload as returned by the device.
132
+ */
133
+ audioProductToneControls(): Promise<AudioProductToneControls>;
134
+ /**
135
+ * Updates bass and/or treble settings for the device. Only included values are changed.
136
+ *
137
+ * POST /audioproducttonecontrols
138
+ *
139
+ * @param values Tone values to update (bass and/or treble).
140
+ * @returns A promise that resolves when the device accepts the tone update.
141
+ *
142
+ * @example
143
+ * await device.setAudioProductToneControls({ bass: 2 })
144
+ * await device.setAudioProductToneControls({ treble: -1 })
145
+ */
146
+ setAudioProductToneControls(values: AudioProductToneControlsUpdate): Promise<void>;
147
+ /**
148
+ * Gets the current front-center and rear-surround level settings from the device.
149
+ *
150
+ * GET /audioproductlevelcontrols
151
+ *
152
+ * @returns Promise<AudioProductLevelControls> A promise that resolves to the level controls payload as returned by the device.
153
+ */
154
+ audioProductLevelControls(): Promise<AudioProductLevelControls>;
155
+ /**
156
+ * Updates front-center and/or rear-surround levels for the device. Only included values are changed.
157
+ *
158
+ * POST /audioproductlevelcontrols
159
+ *
160
+ * @param values Level values to update (frontCenterSpeakerLevel and/or rearSurroundSpeakersLevel).
161
+ * @returns A promise that resolves when the device accepts the level update.
162
+ *
163
+ * @example
164
+ * await device.setAudioProductLevelControls({ frontCenterSpeakerLevel: 1 })
165
+ * await device.setAudioProductLevelControls({ rearSurroundSpeakersLevel: -2 })
166
+ */
167
+ setAudioProductLevelControls(values: AudioProductLevelControlsUpdate): Promise<void>;
168
+ /**
169
+ * Updates DSP settings for the device. Only included values are changed.
170
+ *
171
+ * POST /audiodspcontrols
172
+ *
173
+ * @param values DSP values to update (audiomode and/or videosyncaudiodelay).
174
+ * @returns A promise that resolves when the device accepts the DSP update.
175
+ *
176
+ * @example
177
+ * await device.setAudioDspControls({ audiomode: 'movie' })
178
+ * await device.setAudioDspControls({ videosyncaudiodelay: 150 })
179
+ */
180
+ setAudioDspControls(values: AudioDspControls): Promise<void>;
181
+ /**
182
+ * Gets the list of current presets from the device.
183
+ *
184
+ * GET /presets
185
+ *
186
+ * @returns Promise<Presets> A promise that resolves to the presets payload as returned by the device.
187
+ */
188
+ presets(): Promise<Presets>;
189
+ /**
190
+ * Sets the device name.
191
+ *
192
+ * POST /name
193
+ *
194
+ * @param name The name to assign to the device.
195
+ * @returns A promise that resolves when the device accepts the new name.
196
+ *
197
+ * @example
198
+ * await device.setName('Living Room')
199
+ */
200
+ setName(name: string): Promise<void>;
201
+ /**
202
+ * Sets the bass level for the device.
203
+ *
204
+ * POST /bass
205
+ *
206
+ * @param value Bass value to set.
207
+ * @returns A promise that resolves when the device accepts the bass value.
208
+ */
209
+ setBass(value: number): Promise<void>;
210
+ /**
211
+ * Sets the volume level and mute state for the device. Volume ranges between 0 and 100 inclusive.
212
+ *
213
+ * POST /volume
214
+ *
215
+ * The muteenabled setting is applied first, if present. The system will be unmuted if the
216
+ * volume value is larger than the current volume setting.
217
+ *
218
+ * @param value Volume value to set.
219
+ * @param muteenabled Optional mute state to set before applying the volume value.
220
+ * @returns A promise that resolves when the device accepts the volume value.
221
+ *
222
+ * @example
223
+ * await device.setVolume(25)
224
+ * await device.setVolume(10, true)
225
+ */
226
+ setVolume(value: number, muteenabled?: boolean): Promise<void>;
227
+ /**
228
+ * Gets the current multi-room zone state from the device.
229
+ *
230
+ * GET /getZone
231
+ *
232
+ * @returns Promise<Zone> A promise that resolves to the zone payload as returned by the device.
233
+ */
234
+ zone(): Promise<Zone>;
235
+ /**
236
+ * Creates or updates a multi-room zone.
237
+ *
238
+ * POST /setZone
239
+ *
240
+ * @param config Zone configuration including master, sender IP, and member list.
241
+ * @returns A promise that resolves when the device accepts the zone configuration.
242
+ */
243
+ setZone(config: ZoneConfig): Promise<void>;
244
+ /**
245
+ * Adds one or more slaves to a "play everywhere" zone.
246
+ *
247
+ * POST /addZoneSlave
248
+ *
249
+ * @param config Zone slave configuration including master and member list.
250
+ * @returns A promise that resolves when the device accepts the zone update.
251
+ */
252
+ addZoneSlave(config: ZoneSlaveConfig): Promise<void>;
253
+ /**
254
+ * Removes one or more slaves from a "play everywhere" zone.
255
+ *
256
+ * POST /removeZoneSlave
257
+ *
258
+ * @param config Zone slave configuration including master and member list.
259
+ * @returns A promise that resolves when the device accepts the zone update.
260
+ */
261
+ removeZoneSlave(config: ZoneSlaveConfig): Promise<void>;
262
+ /**
263
+ * Sends a remote button press or release to the device.
264
+ *
265
+ * POST /key
266
+ *
267
+ * Keys are used as a simple means to interact with the SoundTouch speaker.
268
+ * For a full listing of supported keys see "KEY VALUE" in section 4.1 of the API docs.
269
+ * It is good practice to send a "press" followed by a "release" to simulate a full key click.
270
+ *
271
+ * @param key Key value to send.
272
+ * @param state Key state to send: "press" or "release".
273
+ * @param sender Sender label to include in the request.
274
+ * @returns A promise that resolves when the device accepts the key event.
275
+ *
276
+ * @example
277
+ * await device.keyPress('PLAY', 'press', 'Gabbo')
278
+ * await device.keyPress('PLAY', 'release', 'Gabbo')
279
+ */
280
+ keyPress(key: SoundTouchKey, state?: 'press' | 'release', sender?: string): Promise<void>;
281
+ /**
282
+ * Sends a press then release sequence for a key.
283
+ *
284
+ * POST /key
285
+ *
286
+ * @param key Key value to send.
287
+ * @param sender Sender label to include in the request.
288
+ * @returns A promise that resolves when the device accepts both key events.
289
+ *
290
+ * @example
291
+ * await device.keyPressAndRelease('PLAY', 'Gabbo')
292
+ */
293
+ keyPressAndRelease(key: SoundTouchKey, sender?: string): Promise<void>;
294
+ /**
295
+ * Subscribes to now playing update notifications.
296
+ *
297
+ * @param handler Callback invoked with the parsed now playing payload.
298
+ * @returns Unsubscribe function.
299
+ *
300
+ * @example
301
+ * device.onNowPlayingUpdated((nowPlaying) => console.log(nowPlaying))
302
+ */
303
+ onNowPlayingUpdated(handler: (nowPlaying: NowPlaying) => void): () => void;
304
+ /**
305
+ * Subscribes to volume update notifications.
306
+ *
307
+ * @param handler Callback invoked with the parsed volume payload.
308
+ * @returns Unsubscribe function.
309
+ *
310
+ * @example
311
+ * device.onVolumeUpdated((volume) => console.log(volume))
312
+ */
313
+ onVolumeUpdated(handler: (volume: Volume) => void): () => void;
314
+ /**
315
+ * Subscribes to bass update notifications.
316
+ *
317
+ * @param handler Callback invoked when bass changes.
318
+ * @returns Unsubscribe function.
319
+ *
320
+ * @example
321
+ * device.onBassUpdated(() => console.log('Bass changed'))
322
+ */
323
+ onBassUpdated(handler: () => void): () => void;
324
+ /**
325
+ * Subscribes to zone map update notifications.
326
+ *
327
+ * @param handler Callback invoked when the zone map changes.
328
+ * @returns Unsubscribe function.
329
+ *
330
+ * @example
331
+ * device.onZoneUpdated(() => console.log('Zone map changed'))
332
+ */
333
+ onZoneUpdated(handler: () => void): () => void;
334
+ /**
335
+ * Subscribes to software update status notifications.
336
+ *
337
+ * @param handler Callback invoked when update status changes.
338
+ * @returns Unsubscribe function.
339
+ *
340
+ * @example
341
+ * device.onSwUpdateStatusUpdated(() => console.log('SW update status changed'))
342
+ */
343
+ onSwUpdateStatusUpdated(handler: () => void): () => void;
344
+ /**
345
+ * Subscribes to site survey results update notifications.
346
+ *
347
+ * @param handler Callback invoked when site survey results change.
348
+ * @returns Unsubscribe function.
349
+ *
350
+ * @example
351
+ * device.onSiteSurveyResultsUpdated(() => console.log('Site survey updated'))
352
+ */
353
+ onSiteSurveyResultsUpdated(handler: () => void): () => void;
354
+ /**
355
+ * Subscribes to sources update notifications.
356
+ *
357
+ * @param handler Callback invoked when sources change.
358
+ * @returns Unsubscribe function.
359
+ *
360
+ * @example
361
+ * device.onSourcesUpdated(() => console.log('Sources updated'))
362
+ */
363
+ onSourcesUpdated(handler: () => void): () => void;
364
+ /**
365
+ * Subscribes to now selection update notifications.
366
+ *
367
+ * @param handler Callback invoked with the selected preset.
368
+ * @returns Unsubscribe function.
369
+ *
370
+ * @example
371
+ * device.onNowSelectionUpdated((preset) => console.log(preset))
372
+ */
373
+ onNowSelectionUpdated(handler: (preset: Preset) => void): () => void;
374
+ /**
375
+ * Subscribes to network connection state notifications.
376
+ *
377
+ * @param handler Callback invoked when connection state changes.
378
+ * @returns Unsubscribe function.
379
+ *
380
+ * @example
381
+ * device.onConnectionStateUpdated(() => console.log('Connection state changed'))
382
+ */
383
+ onConnectionStateUpdated(handler: () => void): () => void;
384
+ /**
385
+ * Subscribes to device info update notifications.
386
+ *
387
+ * @param handler Callback invoked when device info changes.
388
+ * @returns Unsubscribe function.
389
+ *
390
+ * @example
391
+ * device.onInfoUpdated(() => console.log('Device info changed'))
392
+ */
393
+ onInfoUpdated(handler: () => void): () => void;
394
+ /**
395
+ * Subscribes to presets update notifications.
396
+ *
397
+ * @param handler Callback invoked with the parsed presets payload.
398
+ * @returns Unsubscribe function.
399
+ *
400
+ * @example
401
+ * device.onPresetsUpdated((presets) => console.log(presets))
402
+ */
403
+ onPresetsUpdated(handler: (presets: Presets) => void): () => void;
404
+ /**
405
+ * Subscribes to recents update notifications.
406
+ *
407
+ * @param handler Callback invoked with the parsed recents payload.
408
+ * @returns Unsubscribe function.
409
+ *
410
+ * @example
411
+ * device.onRecentsUpdated((recents) => console.log(recents))
412
+ */
413
+ onRecentsUpdated(handler: (recents: Recents) => void): () => void;
414
+ /**
415
+ * Subscribes to account mode update notifications.
416
+ *
417
+ * @param handler Callback invoked when account mode changes.
418
+ * @returns Unsubscribe function.
419
+ *
420
+ * @example
421
+ * device.onAcctModeUpdated(() => console.log('Account mode changed'))
422
+ */
423
+ onAcctModeUpdated(handler: () => void): () => void;
424
+ /**
425
+ * Subscribes to error notifications.
426
+ *
427
+ * @param handler Callback invoked when an error notification is received.
428
+ * @returns Unsubscribe function.
429
+ *
430
+ * @example
431
+ * device.onErrorNotification((error) => console.log(error))
432
+ */
433
+ onErrorNotification(handler: (error: Record<string, unknown>) => void): () => void;
434
+ /**
435
+ * Subscribes to WebSocket errors.
436
+ *
437
+ * @param handler Callback invoked when a WebSocket error is raised.
438
+ * @returns Unsubscribe function.
439
+ *
440
+ * @example
441
+ * device.onWebSocketError((error) => console.error(error))
442
+ */
443
+ onWebSocketError(handler: (error: unknown) => void): () => void;
444
+ /**
445
+ * Starts listening for async notifications and returns a handle to stop.
446
+ *
447
+ * @returns Handle with a stop method that closes the WebSocket connection.
448
+ *
449
+ * @example
450
+ * const handle = device.listenUpdates()
451
+ * handle.stop()
452
+ */
453
+ listenUpdates(): {
454
+ stop: () => void;
455
+ };
456
+ }
457
+ //# sourceMappingURL=SoundTouchDevice.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SoundTouchDevice.d.ts","sourceRoot":"","sources":["../../../src/device/SoundTouchDevice.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAC9D,OAAO,EAAmB,sBAAsB,EAAE,MAAM,cAAc,CAAA;AAQtE,OAAO,EAAwC,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAStF,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAA;AAC5D,OAAO,EAAE,yBAAyB,EAAE,+BAA+B,EAAE,MAAM,oCAAoC,CAAA;AAC/G,OAAO,EAAE,wBAAwB,EAAE,8BAA8B,EAAE,MAAM,mCAAmC,CAAA;AAC5G,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AACpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAA;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAq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