Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

Implements

  • ServiceListener
  • ServiceEmitter
  • ServiceListener
  • ServiceEmitter

Index

Constructors

constructor

  • new DiscourseService(data: DiscourseConstructor, listen?: boolean): DiscourseService

Properties

Private data

data: DiscourseConstructor

Private receivedPostIds

receivedPostIds: Set<number> = new Set<number>()

Protected workers

workers: WorkerMap<string | null> = new Map<T, Worker<T>>()

Static Private _serviceName

_serviceName: string = path.basename(__filename.split('.')[0])

Static Protected logger

logger: Logger = new Logger()

A place to put output for debug and reference.

Accessors

apiHandle

  • get apiHandle(): void

serviceName

  • get serviceName(): string

Static Protected expressApp

  • get expressApp(): express.Express

Methods

Protected activateMessageListener

  • activateMessageListener(): void

fetchNotes

  • fetchNotes(thread: string, _room: string, filter: RegExp): Promise<string[]>
  • Promise to find the first page of comment history of a particular thread. Will prompt the API to perform some short-listing if the regex begins with some key words.

    Parameters

    • thread: string

      id of the thread to search.

    • _room: string

      id of the room in which the thread resides.

    • filter: RegExp

      Criteria to match.

    Returns Promise<string[]>

Protected getWorker

Protected handleEvent

listen

  • listen(): void

makeGeneric

makeSpecific

  • Promise to turn the generic message format into a specific form to be emitted.

    Parameters

    Returns Promise<DiscourseEmitContext>

    Promise that resolves to the emit suitable form.

makeTagUpdate

  • Promise to turn the generic message format into a tag update to be emitted.

    Parameters

    Returns Promise<DiscourseEmitContext>

    Promise that resolves to the tag update object.

queueEvent

registerEvent

  • registerEvent(registration: ServiceRegistration): void
  • Store an event of interest, so that the method gets triggered appropriately.

    Parameters

    • registration: ServiceRegistration

      Registration object with event trigger and other details.

    Returns void

Protected removeWorker

  • removeWorker(context: string | null): void

sendData

Protected sendPayload

translateEventName

  • translateEventName(eventType: string): string
  • Turns the generic, messenger, name for an event into a specific trigger name for this class.

    Parameters

    • eventType: string

      Name of the event to translate, eg 'message'.

    Returns string

    This class's equivalent, eg 'post'.

Static Protected extractMetadata

  • extractMetadata(message: string, format: string): Metadata
  • Given a basic string this will extract a more rich context for the event, if embedded.

    Parameters

    • message: string

      Basic string that may contain metadata.

    • format: string

      Format of the metadata encoding.

    Returns Metadata

    Object of content, genesis and hidden.

Static Protected getIndicatorArrays

  • getIndicatorArrays(): object

Static initInterimContext

Static Protected messageOfTheDay

  • messageOfTheDay(): string

Static Protected stringifyMetadata

Generated using TypeDoc