### Hierarchy

- EventEmitter
  - AppleTV

## Index

### Enumerations

- Key

### Interfaces

- Events

### Constructors

- constructor

### Properties

- address
- connection
- credentials
- name
- pairingId
- port
- uid
- defaultMaxListeners

### Methods

- addListener
- closeConnection
- emit
- eventNames
- getMaxListeners
- listenerCount
- listeners
- messageOfType
- off
- on
- once
- openConnection
- pair
- prependListener
- prependOnceListener
- rawListeners
- removeAllListeners
- removeListener
- requestPlaybackQueue
- sendKeyCommand
- sendMessage
- setMaxListeners
- waitForSequence
- key
- listenerCount

## Constructors

### constructor

- new AppleTV(service: Service): AppleTV

- Overrides EventEmitter.__constructor

  - Defined in src/lib/appletv.ts:53

  #### Parameters

  - ##### service: Service

  #### Returns AppleTV

## Properties

### address

address: string

- Defined in src/lib/appletv.ts:46

### connection

connection: Connection

- Defined in src/lib/appletv.ts:51

### credentials

credentials: Credentials

- Defined in src/lib/appletv.ts:50

### name

name: string

- Defined in src/lib/appletv.ts:45

### pairingId

pairingId: string = uuid()

- Defined in src/lib/appletv.ts:49

### port

port: number

- Defined in src/lib/appletv.ts:47

### uid

uid: string

- Defined in src/lib/appletv.ts:48

### Static defaultMaxListeners

defaultMaxListeners: number

Inherited from Connection.defaultMaxListeners

- Defined in node_modules/@types/node/events.d.ts:45

## Methods

### addListener

- addListener(event: string | symbol, listener: (...args: any[]) => void): this

- Inherited from Connection.addListener

  - Defined in node_modules/@types/node/globals.d.ts:541

  #### Parameters

  - ##### event: string | symbol

  - ##### listener: (...args: any[]) => void

    - - (...args: any[]): void

      - #### Parameters

        - ##### Rest ...args: any[]

        #### Returns void

  #### Returns this

### closeConnection

- closeConnection(): void

- - Defined in src/lib/appletv.ts:114

  Closes the connection to the Apple TV.

  #### Returns void

### emit

- emit(event: string | symbol, ...args: any[]): boolean

- Inherited from Connection.emit

  - Defined in node_modules/@types/node/globals.d.ts:551

  #### Parameters

  - ##### event: string | symbol

  - ##### Rest ...args: any[]

  #### Returns boolean

### eventNames

- eventNames(): Array<string | symbol>

- Inherited from Connection.eventNames

  - Defined in node_modules/@types/node/globals.d.ts:556

  #### Returns Array<string | symbol>

### getMaxListeners

- getMaxListeners(): number

- Inherited from Connection.getMaxListeners

  - Defined in node_modules/@types/node/globals.d.ts:548

  #### Returns number

### listenerCount

- listenerCount(type: string | symbol): number

- Inherited from Connection.listenerCount

  - Defined in node_modules/@types/node/globals.d.ts:552

  #### Parameters

  - ##### type: string | symbol

  #### Returns number

### listeners

- listeners(event: string | symbol): Function[]

- Inherited from Connection.listeners

  - Defined in node_modules/@types/node/globals.d.ts:549

  #### Parameters

  - ##### event: string | symbol

  #### Returns Function[]

### messageOfType

- messageOfType(type: Type, timeout?: number): Promise<Message>

- - Defined in src/lib/appletv.ts:140

  Wait for a single message of a specified type.

  #### Parameters

  - ##### type: Type

    The type of the message to wait for.

  - ##### Default value timeout: number = 5

    The timeout (in seconds).

  #### Returns Promise<Message>

  A promise that resolves to the Message.

### off

- off(event: string | symbol, listener: (...args: any[]) => void): this

- Inherited from Connection.off

  - Defined in node_modules/@types/node/globals.d.ts:545

  #### Parameters

  - ##### event: string | symbol

  - ##### listener: (...args: any[]) => void

    - - (...args: any[]): void

      - #### Parameters

        - ##### Rest ...args: any[]

        #### Returns void

  #### Returns this

### on

- on(event: string | symbol, listener: (...args: any[]) => void): this

- Inherited from Connection.on

  - Defined in node_modules/@types/node/globals.d.ts:542

  #### Parameters

  - ##### event: string | symbol

  - ##### listener: (...args: any[]) => void

    - - (...args: any[]): void

      - #### Parameters

        - ##### Rest ...args: any[]

        #### Returns void

  #### Returns this

### once

- once(event: string | symbol, listener: (...args: any[]) => void): this

- Inherited from Connection.once

  - Defined in node_modules/@types/node/globals.d.ts:543

  #### Parameters

  - ##### event: string | symbol

  - ##### listener: (...args: any[]) => void

    - - (...args: any[]): void

      - #### Parameters

        - ##### Rest ...args: any[]

        #### Returns void

  #### Returns this

### openConnection

- openConnection(credentials?: Credentials): Promise<AppleTV>

- - Defined in src/lib/appletv.ts:82

  Opens a connection to the AppleTV over the MRP protocol.

  #### Parameters

  - ##### Optional credentials: Credentials

    The credentials object for this AppleTV

  #### Returns Promise<AppleTV>

  A promise that resolves to the AppleTV object.

### pair

- pair(): Promise<(pin: string) => Promise<AppleTV>>

- - Defined in src/lib/appletv.ts:72

  Pair with an already discovered AppleTV.

  #### Returns Promise<(pin: string) => Promise<AppleTV>>

  A promise that resolves to the AppleTV object.

### prependListener

- prependListener(event: string | symbol, listener: (...args: any[]) => void): this

- Inherited from Connection.prependListener

  - Defined in node_modules/@types/node/globals.d.ts:554

  #### Parameters

  - ##### event: string | symbol

  - ##### listener: (...args: any[]) => void

    - - (...args: any[]): void

      - #### Parameters

        - ##### Rest ...args: any[]

        #### Returns void

  #### Returns this

### prependOnceListener

- prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this

- Inherited from Connection.prependOnceListener

  - Defined in node_modules/@types/node/globals.d.ts:555

  #### Parameters

  - ##### event: string | symbol

  - ##### listener: (...args: any[]) => void

    - - (...args: any[]): void

      - #### Parameters

        - ##### Rest ...args: any[]

        #### Returns void

  #### Returns this

### rawListeners

- rawListeners(event: string | symbol): Function[]

- Inherited from Connection.rawListeners

  - Defined in node_modules/@types/node/globals.d.ts:550

  #### Parameters

  - ##### event: string | symbol

  #### Returns Function[]

### removeAllListeners

- removeAllListeners(event?: string | symbol): this

- Inherited from Connection.removeAllListeners

  - Defined in node_modules/@types/node/globals.d.ts:546

  #### Parameters

  - ##### Optional event: string | symbol

  #### Returns this

### removeListener

- removeListener(event: string | symbol, listener: (...args: any[]) => void): this

- Inherited from Connection.removeListener

  - Defined in node_modules/@types/node/globals.d.ts:544

  #### Parameters

  - ##### event: string | symbol

  - ##### listener: (...args: any[]) => void

    - - (...args: any[]): void

      - #### Parameters

        - ##### Rest ...args: any[]

        #### Returns void

  #### Returns this

### requestPlaybackQueue

- requestPlaybackQueue(options: PlaybackQueueRequestOptions): Promise<NowPlayingInfo>

- - Defined in src/lib/appletv.ts:163

  Requests the current playback queue from the Apple TV.

  #### Parameters

  - ##### options: PlaybackQueueRequestOptions

    Options to send

  #### Returns Promise<NowPlayingInfo>

  A Promise that resolves to a NewPlayingInfo object.

### sendKeyCommand

- sendKeyCommand(key: Key): Promise<AppleTV>

- - Defined in src/lib/appletv.ts:172

  Send a key command to the AppleTV.

  #### Parameters

  - ##### key: Key

    The key to press.

  #### Returns Promise<AppleTV>

  A promise that resolves to the AppleTV object after the message has been sent.

### sendMessage

- sendMessage(definitionFilename: string, messageType: string, body: {}, waitForResponse: boolean, priority?: number): Promise<Message>

- - Defined in src/lib/appletv.ts:126

  Send a Protobuf message to the AppleTV. This is for advanced usage only.

  #### Parameters

  - ##### definitionFilename: string

    The Protobuf filename of the message type.

  - ##### messageType: string

    The name of the message.

  - ##### body: {}

    The message body

  - ##### waitForResponse: boolean

    Whether or not to wait for a response before resolving the Promise.

  - ##### Default value priority: number = 0

  #### Returns Promise<Message>

  A promise that resolves to the response from the AppleTV.

### setMaxListeners

- setMaxListeners(n: number): this

- Inherited from Connection.setMaxListeners

  - Defined in node_modules/@types/node/globals.d.ts:547

  #### Parameters

  - ##### n: number

  #### Returns this

### waitForSequence

- waitForSequence(sequence: number, timeout?: number): Promise<Message>

- - Defined in src/lib/appletv.ts:199

  #### Parameters

  - ##### sequence: number

  - ##### Default value timeout: number = 3

  #### Returns Promise<Message>

### Static key

- key(string: string): Key

- - Defined in src/lib/appletv.ts:398

  Convert a string representation of a key to the correct enum type.

  #### Parameters

  - ##### string: string

    The string.

  #### Returns Key

  The key enum value.

### Static listenerCount

- listenerCount(emitter: EventEmitter, event: string | symbol): number

- Inherited from Connection.listenerCount

  - Defined in node_modules/@types/node/events.d.ts:44
  deprecated

    since v4.0.0

  #### Parameters

  - ##### emitter: EventEmitter

  - ##### event: string | symbol

  #### Returns number

Generated using TypeDoc