Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • EventEmitter
    • Api

Implements

Index

Constructors

constructor

  • new Api(context: ApiContext, io: HttpIo): Api

Properties

context

context: ApiContext

io

io: HttpIo

messagesPoller

messagesPoller: MessagesPoller

Static defaultMaxListeners

defaultMaxListeners: number

Methods

acceptContactRequest

  • acceptContactRequest(contactUsername: string): Promise<this>
  • Parameters

    • contactUsername: string

    Returns Promise<this>

addListener

  • addListener(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

declineContactRequest

  • declineContactRequest(contactUsername: string): Promise<this>
  • Parameters

    • contactUsername: string

    Returns Promise<this>

emit

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

    • event: string | symbol
    • Rest ...args: any[]

    Returns boolean

eventNames

  • eventNames(): Array<string | symbol>
  • Returns Array<string | symbol>

getContact

  • getContact(contactId: string): Promise<Contact>

getContacts

  • getContacts(): Promise<Contact[]>

getConversation

  • getConversation(conversationId: string): Promise<Conversation>

getConversations

getMaxListeners

  • getMaxListeners(): number
  • Returns number

getState

  • getState(): ApiContext.Json

Protected handlePollingEvent

listen

  • listen(): Promise<this>
  • Start polling and emitting events

    Returns Promise<this>

listenerCount

  • listenerCount(type: string | symbol): number
  • Parameters

    • type: string | symbol

    Returns number

listeners

  • listeners(event: string | symbol): Function[]
  • Parameters

    • event: string | symbol

    Returns Function[]

on

  • on(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

once

  • once(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

prependListener

  • prependListener(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

prependOnceListener

  • prependOnceListener(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

removeAllListeners

  • removeAllListeners(event?: string | symbol): this
  • Parameters

    • Optional event: string | symbol

    Returns this

removeListener

  • removeListener(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

sendImage

sendMessage

setMaxListeners

  • setMaxListeners(n: number): this
  • Parameters

    • n: number

    Returns this

setStatus

  • setStatus(status: api.Status): Promise<void>

stopListening

  • stopListening(): Promise<this>
  • Stop polling and emitting events

    Returns Promise<this>

Static listenerCount

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

    • emitter: EventEmitter
    • event: string | symbol

    Returns number

Generated using TypeDoc