@sebbo2002/node-pyatv 6.0.0-develop.2 → 6.0.0-develop.3

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 (120) hide show
  1. package/dist/bin/check.cjs +10 -0
  2. package/dist/bin/check.cjs.map +1 -0
  3. package/dist/bin/check.d.ts +2 -1
  4. package/dist/bin/check.js +4 -45
  5. package/dist/bin/check.js.map +1 -1
  6. package/dist/chunk-TZSWUAOB.js +7 -0
  7. package/dist/chunk-TZSWUAOB.js.map +1 -0
  8. package/dist/lib/index.cjs +7 -0
  9. package/dist/lib/index.cjs.map +1 -0
  10. package/dist/lib/{device.d.ts → index.d.cts} +340 -4
  11. package/dist/lib/index.d.ts +806 -6
  12. package/dist/lib/index.js +1 -7
  13. package/dist/lib/index.js.map +1 -1
  14. package/package.json +18 -9
  15. package/.editorconfig +0 -12
  16. package/.eslintignore +0 -4
  17. package/.eslintrc +0 -60
  18. package/.mocharc.yml +0 -7
  19. package/.nycrc +0 -32
  20. package/CHANGELOG.md +0 -295
  21. package/check.sh +0 -5
  22. package/dist/examples/push.d.ts +0 -1
  23. package/dist/examples/push.js +0 -51
  24. package/dist/examples/push.js.map +0 -1
  25. package/dist/lib/device-event.d.ts +0 -44
  26. package/dist/lib/device-event.js +0 -47
  27. package/dist/lib/device-event.js.map +0 -1
  28. package/dist/lib/device-events.d.ts +0 -30
  29. package/dist/lib/device-events.js +0 -237
  30. package/dist/lib/device-events.js.map +0 -1
  31. package/dist/lib/device.js +0 -793
  32. package/dist/lib/device.js.map +0 -1
  33. package/dist/lib/fake-spawn.d.ts +0 -43
  34. package/dist/lib/fake-spawn.js +0 -85
  35. package/dist/lib/fake-spawn.js.map +0 -1
  36. package/dist/lib/instance.d.ts +0 -97
  37. package/dist/lib/instance.js +0 -208
  38. package/dist/lib/instance.js.map +0 -1
  39. package/dist/lib/tools.d.ts +0 -12
  40. package/dist/lib/tools.js +0 -319
  41. package/dist/lib/tools.js.map +0 -1
  42. package/dist/lib/types.d.ts +0 -204
  43. package/dist/lib/types.js +0 -108
  44. package/dist/lib/types.js.map +0 -1
  45. package/docs/coverage/base.css +0 -224
  46. package/docs/coverage/block-navigation.js +0 -87
  47. package/docs/coverage/cobertura-coverage.xml +0 -2889
  48. package/docs/coverage/device-event.ts.html +0 -256
  49. package/docs/coverage/device-events.ts.html +0 -970
  50. package/docs/coverage/device.ts.html +0 -2518
  51. package/docs/coverage/fake-spawn.ts.html +0 -448
  52. package/docs/coverage/favicon.png +0 -0
  53. package/docs/coverage/index.html +0 -221
  54. package/docs/coverage/index.ts.html +0 -172
  55. package/docs/coverage/instance.ts.html +0 -718
  56. package/docs/coverage/prettify.css +0 -1
  57. package/docs/coverage/prettify.js +0 -2
  58. package/docs/coverage/sort-arrow-sprite.png +0 -0
  59. package/docs/coverage/sorter.js +0 -196
  60. package/docs/coverage/tools.ts.html +0 -1222
  61. package/docs/coverage/types.ts.html +0 -775
  62. package/docs/reference/.nojekyll +0 -1
  63. package/docs/reference/assets/highlight.css +0 -99
  64. package/docs/reference/assets/main.js +0 -58
  65. package/docs/reference/assets/search.js +0 -1
  66. package/docs/reference/assets/style.css +0 -1280
  67. package/docs/reference/classes/NodePyATVDevice.html +0 -1266
  68. package/docs/reference/classes/NodePyATVDeviceEvent.html +0 -123
  69. package/docs/reference/classes/NodePyATVInstance.html +0 -240
  70. package/docs/reference/enums/NodePyATVDeviceState.html +0 -97
  71. package/docs/reference/enums/NodePyATVExecutableType.html +0 -69
  72. package/docs/reference/enums/NodePyATVKeys.html +0 -216
  73. package/docs/reference/enums/NodePyATVListenerState.html +0 -83
  74. package/docs/reference/enums/NodePyATVMediaType.html +0 -83
  75. package/docs/reference/enums/NodePyATVPowerState.html +0 -69
  76. package/docs/reference/enums/NodePyATVProtocol.html +0 -83
  77. package/docs/reference/enums/NodePyATVRepeatState.html +0 -76
  78. package/docs/reference/enums/NodePyATVShuffleState.html +0 -76
  79. package/docs/reference/index.html +0 -139
  80. package/docs/reference/interfaces/NodePyATVDeviceOptions.html +0 -232
  81. package/docs/reference/interfaces/NodePyATVFindAndInstanceOptions.html +0 -193
  82. package/docs/reference/interfaces/NodePyATVFindOptions.html +0 -124
  83. package/docs/reference/interfaces/NodePyATVGetStateOptions.html +0 -66
  84. package/docs/reference/interfaces/NodePyATVInstanceOptions.html +0 -113
  85. package/docs/reference/interfaces/NodePyATVService.html +0 -73
  86. package/docs/reference/interfaces/NodePyATVState.html +0 -164
  87. package/docs/reference/interfaces/NodePyATVVersionResponse.html +0 -73
  88. package/docs/reference/modules.html +0 -106
  89. package/docs/reference/types/NodePyATVEventValueType.html +0 -66
  90. package/docs/tests/assets/MaterialIcons-Regular.woff +0 -0
  91. package/docs/tests/assets/MaterialIcons-Regular.woff2 +0 -0
  92. package/docs/tests/assets/app.css +0 -14
  93. package/docs/tests/assets/app.js +0 -2
  94. package/docs/tests/assets/app.js.LICENSE.txt +0 -55
  95. package/docs/tests/assets/roboto-light-webfont.woff +0 -0
  96. package/docs/tests/assets/roboto-light-webfont.woff2 +0 -0
  97. package/docs/tests/assets/roboto-medium-webfont.woff +0 -0
  98. package/docs/tests/assets/roboto-medium-webfont.woff2 +0 -0
  99. package/docs/tests/assets/roboto-regular-webfont.woff +0 -0
  100. package/docs/tests/assets/roboto-regular-webfont.woff2 +0 -0
  101. package/docs/tests/index.html +0 -2
  102. package/docs/tests/mochawesome.json +0 -4823
  103. package/release.config.cjs +0 -51
  104. package/src/bin/check.ts +0 -41
  105. package/src/examples/push.ts +0 -46
  106. package/src/lib/device-event.ts +0 -57
  107. package/src/lib/device-events.ts +0 -295
  108. package/src/lib/device.ts +0 -811
  109. package/src/lib/fake-spawn.ts +0 -121
  110. package/src/lib/index.ts +0 -29
  111. package/src/lib/instance.ts +0 -211
  112. package/src/lib/tools.ts +0 -379
  113. package/src/lib/types.ts +0 -230
  114. package/test/device-event.ts +0 -88
  115. package/test/device-events.ts +0 -502
  116. package/test/device.ts +0 -826
  117. package/test/instance.ts +0 -428
  118. package/test/tools.ts +0 -301
  119. package/tsconfig.json +0 -19
  120. package/typedoc.json +0 -15
@@ -1,6 +1,806 @@
1
- export { NodePyATVDeviceOptions, NodePyATVDeviceState, NodePyATVEventValueType, NodePyATVExecutableType, NodePyATVFindAndInstanceOptions, NodePyATVFindOptions, NodePyATVGetStateOptions, NodePyATVInstanceOptions, NodePyATVKeys, NodePyATVListenerState, NodePyATVMediaType, NodePyATVPowerState, NodePyATVProtocol, NodePyATVRepeatState, NodePyATVService, NodePyATVShuffleState, NodePyATVState, NodePyATVVersionResponse } from './types.js';
2
- export { default as NodePyATVDeviceEvent } from './device-event.js';
3
- export { default as NodePyATVDeviceEvents } from './device-events.js';
4
- export { default as NodePyATVDevice } from './device.js';
5
- export { default as NodePyATVInstance } from './instance.js';
6
- export { default } from './instance.js';
1
+ import { SpawnOptions, ChildProcess } from 'child_process';
2
+ import { EventEmitter } from 'events';
3
+
4
+ /**
5
+ * @internal
6
+ */
7
+ declare class FakeChildProcessStdIn extends EventEmitter {
8
+ write(data: string): void;
9
+ }
10
+ /**
11
+ * @internal
12
+ */
13
+ declare class FakeChildProcess extends EventEmitter {
14
+ cmd: string;
15
+ args: ReadonlyArray<string>;
16
+ timeout: NodeJS.Timeout | undefined;
17
+ stdout: EventEmitter;
18
+ stderr: EventEmitter;
19
+ stdin: FakeChildProcessStdIn;
20
+ constructor(command: string, args: ReadonlyArray<string>, options: SpawnOptions, callback: (cp: FakeChildProcessController) => void);
21
+ kill(): void;
22
+ }
23
+ /**
24
+ * @internal
25
+ */
26
+ declare class FakeChildProcessController {
27
+ _cp: FakeChildProcess;
28
+ _code: number | null;
29
+ constructor(cp: FakeChildProcess);
30
+ cmd(): string;
31
+ stdout(content: string | Record<string, unknown>): this;
32
+ stderr(content: string): this;
33
+ onStdIn(listener: (...args: any[]) => void): this;
34
+ error(error: Error): this;
35
+ code(exitCode: number): this;
36
+ end(content?: string | Record<string, unknown>): this;
37
+ }
38
+
39
+ declare enum NodePyATVExecutableType {
40
+ atvremote = "atvremote",
41
+ atvscript = "atvscript"
42
+ }
43
+ declare enum NodePyATVProtocol {
44
+ dmap = "dmap",
45
+ mrp = "mrp",
46
+ airplay = "airplay",
47
+ mdns = "mdns"
48
+ }
49
+ declare enum NodePyATVMediaType {
50
+ music = "music",
51
+ tv = "tv",
52
+ video = "video",
53
+ unknown = "unknown"
54
+ }
55
+ declare enum NodePyATVDeviceState {
56
+ idle = "idle",
57
+ loading = "loading",
58
+ paused = "paused",
59
+ playing = "playing",
60
+ seeking = "seeking",
61
+ stopped = "stopped"
62
+ }
63
+ declare enum NodePyATVRepeatState {
64
+ all = "all",
65
+ track = "track",
66
+ off = "off"
67
+ }
68
+ declare enum NodePyATVShuffleState {
69
+ albums = "albums",
70
+ songs = "songs",
71
+ off = "off"
72
+ }
73
+ declare enum NodePyATVPowerState {
74
+ on = "on",
75
+ off = "off"
76
+ }
77
+ declare enum NodePyATVKeys {
78
+ down = "down",
79
+ home = "home",
80
+ homeHold = "homeHold",
81
+ left = "left",
82
+ menu = "menu",
83
+ next = "next",
84
+ pause = "pause",
85
+ play = "play",
86
+ playPause = "playPause",
87
+ previous = "previous",
88
+ right = "right",
89
+ select = "select",
90
+ skipBackward = "skipBackward",
91
+ skipForward = "skipForward",
92
+ stop = "stop",
93
+ suspend = "suspend",
94
+ topMenu = "topMenu",
95
+ up = "up",
96
+ volumeDown = "volumeDown",
97
+ volumeUp = "volumeUp",
98
+ wakeup = "wakeup",
99
+ turnOff = "turnOff",
100
+ turnOn = "turnOn"
101
+ }
102
+ declare enum NodePyATVListenerState {
103
+ stopped = 0,
104
+ starting = 1,
105
+ started = 2,
106
+ stopping = 3
107
+ }
108
+ type NodePyATVStateIndex = keyof NodePyATVState;
109
+ type NodePyATVEventValueType = (string | number | NodePyATVMediaType | NodePyATVDeviceState | NodePyATVShuffleState | NodePyATVRepeatState);
110
+ interface NodePyATVInstanceOptions {
111
+ atvremotePath?: string;
112
+ atvscriptPath?: string;
113
+ debug?: true | ((msg: string) => void);
114
+ noColors?: true;
115
+ spawn?: (command: string, args: Array<string>, options: SpawnOptions) => (ChildProcess | FakeChildProcess);
116
+ }
117
+ interface NodePyATVVersionResponse {
118
+ pyatv: string | null;
119
+ module: string | null;
120
+ }
121
+ interface NodePyATVFindOptions {
122
+ host?: string;
123
+ hosts?: string[];
124
+ id?: string;
125
+ protocol?: NodePyATVProtocol;
126
+ dmapCredentials?: string;
127
+ mrpCredentials?: string;
128
+ airplayCredentials?: string;
129
+ companionCredentials?: string;
130
+ raopCredentials?: string;
131
+ }
132
+ interface NodePyATVFindAndInstanceOptions extends NodePyATVInstanceOptions, NodePyATVFindOptions {
133
+ }
134
+ interface NodePyATVDeviceOptions extends NodePyATVFindAndInstanceOptions {
135
+ host: string;
136
+ name: string;
137
+ model?: string;
138
+ modelName?: string;
139
+ os?: string;
140
+ version?: string;
141
+ services?: NodePyATVService[];
142
+ }
143
+ interface NodePyATVGetStateOptions {
144
+ maxAge?: number;
145
+ }
146
+ interface NodePyATVService {
147
+ protocol: NodePyATVProtocol;
148
+ port: number;
149
+ }
150
+ interface NodePyATVState {
151
+ dateTime: Date | null;
152
+ hash: string | null;
153
+ mediaType: NodePyATVMediaType | null;
154
+ deviceState: NodePyATVDeviceState | null;
155
+ title: string | null;
156
+ artist: string | null;
157
+ album: string | null;
158
+ genre: string | null;
159
+ totalTime: number | null;
160
+ position: number | null;
161
+ shuffle: NodePyATVShuffleState | null;
162
+ repeat: NodePyATVRepeatState | null;
163
+ app: string | null;
164
+ appId: string | null;
165
+ powerState: NodePyATVPowerState | null;
166
+ }
167
+ interface NodePyATVApp {
168
+ id: string;
169
+ name: string;
170
+ launch: () => Promise<void>;
171
+ }
172
+
173
+ declare class NodePyATVDeviceEvent {
174
+ protected readonly values: {
175
+ key: NodePyATVStateIndex;
176
+ old: NodePyATVEventValueType;
177
+ new: NodePyATVEventValueType;
178
+ device: NodePyATVDevice;
179
+ };
180
+ /**
181
+ *
182
+ * @param values
183
+ * @internal
184
+ */
185
+ constructor(values: {
186
+ key: NodePyATVStateIndex;
187
+ old: NodePyATVEventValueType;
188
+ new: NodePyATVEventValueType;
189
+ device: NodePyATVDevice;
190
+ });
191
+ /**
192
+ * References the attribute name which was changed. So if the
193
+ * title has been updated, this would be `title`.
194
+ */
195
+ get key(): NodePyATVStateIndex;
196
+ /**
197
+ * Holds the old value which was there
198
+ * before the value was changed.
199
+ */
200
+ get oldValue(): NodePyATVEventValueType;
201
+ /**
202
+ * @alias value
203
+ */
204
+ get newValue(): NodePyATVEventValueType;
205
+ /**
206
+ * New, current value for `key`
207
+ */
208
+ get value(): NodePyATVEventValueType;
209
+ /**
210
+ * References the device instance this
211
+ * event originates from
212
+ */
213
+ get device(): NodePyATVDevice;
214
+ }
215
+
216
+ /**
217
+ * @internal
218
+ */
219
+ declare class NodePyATVDeviceEvents extends EventEmitter {
220
+ private readonly options;
221
+ private readonly state;
222
+ private readonly device;
223
+ private pyatv;
224
+ private timeout;
225
+ private listenerState;
226
+ constructor(state: NodePyATVState, device: NodePyATVDevice, options: NodePyATVDeviceOptions);
227
+ applyStateAndEmitEvents(newState: NodePyATVState): void;
228
+ private parsePushUpdate;
229
+ private applyPushUpdate;
230
+ private checkListener;
231
+ private startListening;
232
+ protected stopListening(reqId: string): Promise<void>;
233
+ addListener(event: string | symbol, listener: (event: NodePyATVDeviceEvent) => void): this;
234
+ on(event: string | symbol, listener: (event: NodePyATVDeviceEvent) => void): this;
235
+ once(event: string | symbol, listener: (event: NodePyATVDeviceEvent) => void): this;
236
+ prependListener(event: string | symbol, listener: (event: NodePyATVDeviceEvent) => void): this;
237
+ off(event: string | symbol, listener: (event: NodePyATVDeviceEvent) => void): this;
238
+ removeAllListeners(event?: string | symbol): this;
239
+ removeListener(event: string | symbol, listener: (event: NodePyATVDeviceEvent) => void): this;
240
+ listenerCount(event?: string | symbol): number;
241
+ }
242
+
243
+ /**
244
+ * Represents an Apple TV. Use [[getState]] to query the current state (e.g. media
245
+ * type and title). You can also use the attribute methods (e.g. [[getTitle]] to get
246
+ * the state. If you want realtime updates, subscribe to it's events with an
247
+ * `EventEmitter` like API, so for example by using [[on]], [[once]] or [[addListener]].
248
+ * It's also possible to send key commands by using [[pressKey]] or methods like [[pause]].
249
+ */
250
+ declare class NodePyATVDevice implements EventEmitter {
251
+ private readonly options;
252
+ private readonly state;
253
+ private readonly events;
254
+ constructor(options: NodePyATVDeviceOptions);
255
+ /**
256
+ * Get the name of the Apple TV.
257
+ *
258
+ * ```typescript
259
+ * import pyatv from '@sebbo2002/node-pyatv';
260
+ * const devices = await pyatv.find();
261
+ * devices.forEach(device =>
262
+ * console.log(device.name)
263
+ * );
264
+ * ```
265
+ */
266
+ get name(): string;
267
+ /**
268
+ * Get the IP address of the Apple TV.
269
+ */
270
+ get host(): string;
271
+ /**
272
+ * Get the ID of the Apple TV.
273
+ */
274
+ get id(): string | undefined;
275
+ /**
276
+ * Get the used protocol to connect to the Apple TV.
277
+ */
278
+ get protocol(): NodePyATVProtocol | undefined;
279
+ /**
280
+ * Get the model identifier of the device. Only set, if the
281
+ * device was found using [[find()]]. Requires pyatv ≧ 0.10.3.
282
+ *
283
+ * @example device.model → "Gen4K"
284
+ */
285
+ get model(): string | undefined;
286
+ /**
287
+ * Get the model name of the device. Only set, if the device
288
+ * was found with [[find()]]. Requires pyatv ≧ 0.10.3.
289
+ *
290
+ * @example device.modelName → "Apple TV 4K"
291
+ */
292
+ get modelName(): string | undefined;
293
+ /**
294
+ * Get the operating system of the device. Only set, if the
295
+ * device was found with [[find()]]. Requires pyatv ≧ 0.10.3.
296
+ *
297
+ * @example device.os → "TvOS"
298
+ */
299
+ get os(): string | undefined;
300
+ /**
301
+ * Get the device version. Only set, if the device was found
302
+ * during a scan using [[find()]]. Requires pyatv ≧ 0.10.3.
303
+ *
304
+ * @example device.version → "15.5.1"
305
+ */
306
+ get version(): string | undefined;
307
+ /**
308
+ * Returns a list of services supported by the device. Ony set, if
309
+ * the device was found during a scan using [[find()]]. Requires
310
+ * pyatv ≧ 0.10.3.
311
+ *
312
+ * @example device.services → [
313
+ * {
314
+ * "protocol": "airplay",
315
+ * "port": 7000
316
+ * },
317
+ * {
318
+ * "protocol": "dmap",
319
+ * "port": 3689
320
+ * }
321
+ * ]
322
+ */
323
+ get services(): NodePyATVService[] | undefined;
324
+ /**
325
+ * Returns true, if debugging is enabled. Returns the custom
326
+ * logging method, if one was specified. Otherwise, if debug
327
+ * log is disabled, returns undefined.
328
+ */
329
+ get debug(): true | ((msg: string) => void) | undefined;
330
+ /**
331
+ * Enable or disable debugging or set a custom
332
+ * debugging method to use.
333
+ *
334
+ * @param debug
335
+ */
336
+ set debug(debug: true | ((msg: string) => void) | undefined);
337
+ /**
338
+ * Returns an object with `name`, `host`, `id` and `protocol`.
339
+ * Can be used to initiate a new device instance.
340
+ *
341
+ * @category Basic
342
+ */
343
+ toJSON(): {
344
+ name: string;
345
+ host: string;
346
+ id: string | undefined;
347
+ protocol: NodePyATVProtocol | undefined;
348
+ };
349
+ /**
350
+ * Returns a string. Just for debugging, etc.
351
+ *
352
+ * @category Basic
353
+ */
354
+ toString(): string;
355
+ /**
356
+ * Returns an [[NodePyATVState]] object representing the current state
357
+ * of the device. Has an internal cache, which has a default TTL of 5s.
358
+ * You can change this default value by passing the `maxAge` option.
359
+ *
360
+ * ```typescript
361
+ * await device.getState({maxAge: 10000}); // cache TTL: 10s
362
+ * ```
363
+ *
364
+ * @param options
365
+ * @category State
366
+ */
367
+ getState(options?: NodePyATVGetStateOptions): Promise<NodePyATVState>;
368
+ /**
369
+ * Removes the state node-pyatv cached for this device.
370
+ *
371
+ * @category State
372
+ */
373
+ clearState(): void;
374
+ private applyState;
375
+ /**
376
+ * Get the date and time when the state was last updated.
377
+ * @param options
378
+ * @category State
379
+ */
380
+ getDateTime(options?: NodePyATVGetStateOptions): Promise<Date | null>;
381
+ /**
382
+ * Get the hash of the current media
383
+ * @param options
384
+ * @category State
385
+ */
386
+ getHash(options?: NodePyATVGetStateOptions): Promise<string | null>;
387
+ /**
388
+ * Get the media type of the current media
389
+ * @param options
390
+ * @category State
391
+ */
392
+ getMediaType(options?: NodePyATVGetStateOptions): Promise<NodePyATVMediaType | null>;
393
+ /**
394
+ * Get the state of this device (e.g. playing, etc.)
395
+ * @param options
396
+ * @category State
397
+ */
398
+ getDeviceState(options?: NodePyATVGetStateOptions): Promise<NodePyATVDeviceState | null>;
399
+ /**
400
+ * Returns the title of the current playing media
401
+ * @param options
402
+ * @category State
403
+ */
404
+ getTitle(options?: NodePyATVGetStateOptions): Promise<string | null>;
405
+ /**
406
+ * Returns the artist of the current playing media
407
+ * @param options
408
+ * @category State
409
+ */
410
+ getArtist(options?: NodePyATVGetStateOptions): Promise<string | null>;
411
+ /**
412
+ * Returns the album of the current playing media
413
+ * @param options
414
+ * @category State
415
+ */
416
+ getAlbum(options?: NodePyATVGetStateOptions): Promise<string | null>;
417
+ /**
418
+ * Returns the genre of the current playing media
419
+ * @param options
420
+ * @category State
421
+ */
422
+ getGenre(options?: NodePyATVGetStateOptions): Promise<string | null>;
423
+ /**
424
+ * Returns the media length of the current playing media
425
+ * @param options
426
+ * @category State
427
+ */
428
+ getTotalTime(options?: NodePyATVGetStateOptions): Promise<number | null>;
429
+ /**
430
+ * Returns the title of the current playing media
431
+ * @param options
432
+ * @category State
433
+ */
434
+ getPosition(options?: NodePyATVGetStateOptions): Promise<number | null>;
435
+ /**
436
+ * Returns the shuffle state
437
+ * @param options
438
+ * @category State
439
+ */
440
+ getShuffle(options?: NodePyATVGetStateOptions): Promise<NodePyATVShuffleState | null>;
441
+ /**
442
+ * Returns the repeat state
443
+ * @param options
444
+ * @category State
445
+ */
446
+ getRepeat(options?: NodePyATVGetStateOptions): Promise<NodePyATVRepeatState | null>;
447
+ /**
448
+ * Returns the currently used app
449
+ * @param options
450
+ * @category State
451
+ */
452
+ getApp(options?: NodePyATVGetStateOptions): Promise<string | null>;
453
+ /**
454
+ * Returns the id of the currently used app
455
+ * @param options
456
+ * @category State
457
+ */
458
+ getAppId(options?: NodePyATVGetStateOptions): Promise<string | null>;
459
+ /**
460
+ * Returns the list of installed apps on the Apple TV. Probably requires `companionCredentials`,
461
+ * see https://pyatv.dev/documentation/atvremote/#apps for more details.
462
+ */
463
+ listApps(): Promise<NodePyATVApp[]>;
464
+ private _pressKey;
465
+ /**
466
+ * Send a key press to the Apple TV
467
+ *
468
+ * ```typescript
469
+ * await device.pressKey(NodePyATVKeys.home);
470
+ * ```
471
+ *
472
+ * <br />
473
+ *
474
+ * ```javascript
475
+ * await device.pressKey('home');
476
+ * ```
477
+ *
478
+ * @param key
479
+ * @category Control
480
+ */
481
+ pressKey(key: NodePyATVKeys): Promise<void>;
482
+ /**
483
+ * Send the "down" command
484
+ * @category Control
485
+ */
486
+ down(): Promise<void>;
487
+ /**
488
+ * Send the "home" command
489
+ * @category Control
490
+ */
491
+ home(): Promise<void>;
492
+ /**
493
+ * Send the "homeHold" command
494
+ * @category Control
495
+ */
496
+ homeHold(): Promise<void>;
497
+ /**
498
+ * Send the "left" command
499
+ * @category Control
500
+ */
501
+ left(): Promise<void>;
502
+ /**
503
+ * Send the "menu" command
504
+ * @category Control
505
+ */
506
+ menu(): Promise<void>;
507
+ /**
508
+ * Send the "next" command
509
+ * @category Control
510
+ */
511
+ next(): Promise<void>;
512
+ /**
513
+ * Send the "pause" command
514
+ * @category Control
515
+ */
516
+ pause(): Promise<void>;
517
+ /**
518
+ * Send the "play" command
519
+ * @category Control
520
+ */
521
+ play(): Promise<void>;
522
+ /**
523
+ * Send the "playPause" command
524
+ * @category Control
525
+ */
526
+ playPause(): Promise<void>;
527
+ /**
528
+ * Send the "previous" command
529
+ * @category Control
530
+ */
531
+ previous(): Promise<void>;
532
+ /**
533
+ * Send the "right" command
534
+ * @category Control
535
+ */
536
+ right(): Promise<void>;
537
+ /**
538
+ * Send the "select" command
539
+ * @category Control
540
+ */
541
+ select(): Promise<void>;
542
+ /**
543
+ * Send the "skipBackward" command
544
+ * @category Control
545
+ */
546
+ skipBackward(): Promise<void>;
547
+ /**
548
+ * Send the "skipForward" command
549
+ * @category Control
550
+ */
551
+ skipForward(): Promise<void>;
552
+ /**
553
+ * Send the "stop" command
554
+ * @category Control
555
+ */
556
+ stop(): Promise<void>;
557
+ /**
558
+ * Send the "suspend" command
559
+ * @category Control
560
+ * @deprecated
561
+ */
562
+ suspend(): Promise<void>;
563
+ /**
564
+ * Send the "topMenu" command
565
+ * @category Control
566
+ */
567
+ topMenu(): Promise<void>;
568
+ /**
569
+ * Send the "up" command
570
+ * @category Control
571
+ */
572
+ up(): Promise<void>;
573
+ /**
574
+ * Send the "volumeDown" command
575
+ * @category Control
576
+ */
577
+ volumeDown(): Promise<void>;
578
+ /**
579
+ * Send the "volumeUp" command
580
+ * @category Control
581
+ */
582
+ volumeUp(): Promise<void>;
583
+ /**
584
+ * Send the "wakeup" command
585
+ * @category Control
586
+ * @deprecated
587
+ */
588
+ wakeup(): Promise<void>;
589
+ /**
590
+ * Send the "turn_off" command
591
+ * @category Control
592
+ */
593
+ turnOff(): Promise<void>;
594
+ /**
595
+ * Send the "turn_on" command
596
+ * @category Control
597
+ */
598
+ turnOn(): Promise<void>;
599
+ /**
600
+ * Launch an application. Probably requires `companionCredentials`, see
601
+ * https://pyatv.dev/documentation/atvremote/#apps for more details.
602
+ * @param id App identifier, e.g. `com.netflix.Netflix`
603
+ */
604
+ launchApp(id: string): Promise<void>;
605
+ /**
606
+ * Add an event listener. Will start the event subscription with the
607
+ * Apple TV as long as there are listeners for any event registered.
608
+ * @param event
609
+ * @param listener
610
+ * @category Event
611
+ */
612
+ addListener(event: string | symbol, listener: (event: NodePyATVDeviceEvent) => void): this;
613
+ /**
614
+ * Emit an event.
615
+ * @param event
616
+ * @param payload
617
+ * @category Event
618
+ */
619
+ emit(event: string | symbol, payload: NodePyATVDeviceEvent): boolean;
620
+ /**
621
+ * Get all event names which are currently known.
622
+ * @category Event
623
+ */
624
+ eventNames(): Array<string | symbol>;
625
+ /**
626
+ * Get max number of listeners allowed
627
+ * @category Event
628
+ */
629
+ getMaxListeners(): number;
630
+ /**
631
+ * Get number of listeners for event
632
+ * @param event
633
+ * @category Event
634
+ */
635
+ listenerCount(event: string | symbol): number;
636
+ /**
637
+ * Get listeners for event. Will also return
638
+ * node-pyatv wrappers (e.g. once)
639
+ *
640
+ * @param event
641
+ * @category Event
642
+ */
643
+ listeners(event: string | symbol): Function[];
644
+ /**
645
+ * Remove an event listener. Will stop the event subscription with the
646
+ * Apple TV if this was the last event listener.
647
+ * @param event
648
+ * @param listener
649
+ * @category Event
650
+ */
651
+ off(event: string | symbol, listener: (event: NodePyATVDeviceEvent | Error) => void): this;
652
+ /**
653
+ * Add an event listener. Will start the event subscription with the
654
+ * Apple TV as long as there are listeners for any event registered.
655
+ * @param event
656
+ * @param listener
657
+ * @category Event
658
+ */
659
+ on(event: string | symbol, listener: (event: NodePyATVDeviceEvent | Error) => void): this;
660
+ /**
661
+ * Add an event listener. Will start the event subscription with the
662
+ * Apple TV as long as there are listeners for any event registered.
663
+ * Removes the listener automatically after the first occurrence.
664
+ * @param event
665
+ * @param listener
666
+ * @category Event
667
+ */
668
+ once(event: string | symbol, listener: (event: NodePyATVDeviceEvent | Error) => void): this;
669
+ /**
670
+ * @param event
671
+ * @param listener
672
+ * @category Event
673
+ */
674
+ prependListener(event: string | symbol, listener: (event: NodePyATVDeviceEvent | Error) => void): this;
675
+ /**
676
+ * @param event
677
+ * @param listener
678
+ * @category Event
679
+ */
680
+ prependOnceListener(event: string | symbol, listener: (event: NodePyATVDeviceEvent | Error) => void): this;
681
+ /**
682
+ * @param event
683
+ * @category Event
684
+ */
685
+ rawListeners(event: string | symbol): Function[];
686
+ /**
687
+ * Removes all listeners, either for the given event or
688
+ * for every event. Will stop the event subscription with
689
+ * the Apple TV if this was the last event listener.
690
+ *
691
+ * @param event
692
+ * @category Event
693
+ */
694
+ removeAllListeners(event?: string | symbol): this;
695
+ /**
696
+ * Remove an event listener. Will stop the event subscription with the
697
+ * Apple TV if this was the last event listener.
698
+ * @param event
699
+ * @param listener
700
+ * @category Event
701
+ */
702
+ removeListener(event: string | symbol, listener: (event: NodePyATVDeviceEvent) => void): this;
703
+ /**
704
+ * @param n
705
+ * @category Event
706
+ */
707
+ setMaxListeners(n: number): this;
708
+ }
709
+
710
+ /**
711
+ * Default class exported by `@sebbo2002/node-pyatv`. Use [[find]] to scan for devices in your local network. Use
712
+ * [[device]] to connect to a known device by passing (at least) it's name and IP.
713
+ *
714
+ * ```typescript
715
+ * import pyatv from '@sebbo2002/node-pyatv';
716
+ * ```
717
+ */
718
+ declare class NodePyATVInstance {
719
+ private readonly options;
720
+ /**
721
+ * Checks if pyatv is installed and ready to be used.
722
+ * Will throw an error if not.
723
+ *
724
+ * @param options
725
+ */
726
+ static check(options?: NodePyATVInstanceOptions): Promise<void>;
727
+ /**
728
+ * Resolves with the version of pyatv and of the module itself.
729
+ * If a value can't be found, null is returned instead.
730
+ *
731
+ * @param options
732
+ */
733
+ static version(options?: NodePyATVInstanceOptions): Promise<NodePyATVVersionResponse>;
734
+ /**
735
+ * Scan the network for Apple TVs by using pyatv's atvscript. See [[NodePyATVFindAndInstanceOptions]]
736
+ * for the options allowed. Use the `host` / `hosts` attribute to filter by IP addresses. Resolves with
737
+ * an array of [[NodePyATVDevice]].
738
+ *
739
+ * ```typescript
740
+ * import pyatv from '@sebbo2002/node-pyatv';
741
+ * const devices = await pyatv.find();
742
+ * console.log(devices);
743
+ * ```
744
+ *
745
+ * @param options
746
+ */
747
+ static find(options?: NodePyATVFindAndInstanceOptions): Promise<NodePyATVDevice[]>;
748
+ /**
749
+ * Create a [[NodePyATVDevice]] to query the state and control it.
750
+ * At least `host` and `name` are required.
751
+ *
752
+ * @param options
753
+ */
754
+ static device(options: NodePyATVDeviceOptions): NodePyATVDevice;
755
+ /**
756
+ * Use this to apply [[NodePyATVInstanceOptions]]
757
+ * (e.g. debug log method) to all further requests
758
+ *
759
+ * ```typescript
760
+ * import pyatv from '@sebbo2002/node-pyatv';
761
+ * const myPyatv = new pyatv({debug: true});
762
+ * const devices = myPyatv.find();
763
+ * console.log(devices);
764
+ * ```
765
+ * @param options
766
+ */
767
+ constructor(options?: NodePyATVInstanceOptions);
768
+ /**
769
+ * Checks if pyatv is installed and ready to be used.
770
+ * Will throw an error if not.
771
+ *
772
+ * @param options
773
+ */
774
+ check(options?: NodePyATVInstanceOptions): Promise<void>;
775
+ /**
776
+ * Resolves with the version of pyatv and of the module itself.
777
+ * If a value can't be found, null is returned instead.
778
+ *
779
+ * @param options
780
+ */
781
+ version(options?: NodePyATVInstanceOptions): Promise<NodePyATVVersionResponse>;
782
+ /**
783
+ * Scan the network for Apple TVs by using pyatv's atvscript. See [[NodePyATVFindAndInstanceOptions]]
784
+ * for the options allowed. Use the `host` / `hosts` attribute to filter by IP addresses. Resolves with
785
+ * an array of [[NodePyATVDevice]].
786
+ *
787
+ * ```typescript
788
+ * import pyatv from '@sebbo2002/node-pyatv';
789
+ * const myPyATV = new pyatv({debug: true});
790
+ * const devices = await myPyATV.find();
791
+ * console.log(devices);
792
+ * ```
793
+ *
794
+ * @param options
795
+ */
796
+ find(options?: NodePyATVFindAndInstanceOptions): Promise<NodePyATVDevice[]>;
797
+ /**
798
+ * Create a [[NodePyATVDevice]] to query the state and control it.
799
+ * At least `host` and `name` are required.
800
+ *
801
+ * @param options
802
+ */
803
+ device(options: NodePyATVDeviceOptions): NodePyATVDevice;
804
+ }
805
+
806
+ export { NodePyATVDevice, NodePyATVDeviceEvent, NodePyATVDeviceEvents, NodePyATVDeviceOptions, NodePyATVDeviceState, NodePyATVEventValueType, NodePyATVExecutableType, NodePyATVFindAndInstanceOptions, NodePyATVFindOptions, NodePyATVGetStateOptions, NodePyATVInstance, NodePyATVInstanceOptions, NodePyATVKeys, NodePyATVListenerState, NodePyATVMediaType, NodePyATVPowerState, NodePyATVProtocol, NodePyATVRepeatState, NodePyATVService, NodePyATVShuffleState, NodePyATVState, NodePyATVVersionResponse, NodePyATVInstance as default };