Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Client

api

public

Hierarchy

  • Client

Index

Constructors

constructor

Properties

Readonly baseUrl

baseUrl: string

Methods

addDiscordGuild

addLinkPattern

addPhrase

addYouTubeChannel

addYouTubeVideo

analyze

  • Will request the analysis of a message. You should listen to the analysis notification for the result. This method will NOT return the analysis result right away, as it's an asynchronous operation.

    Parameters

    Returns void

attemptToReconnect

  • attemptToReconnect(): Promise<void>

emit

  • emit<T>(event: string, data?: T): void
  • Will emit an event, if it exists. Otherwise it will do nothing.

    Type parameters

    • T = any

    Parameters

    • event: string

      The event name.

    • Optional data: T

      The data which will be passed to the event handler.

    Returns void

getDiscordGuilds

  • Will get a list of blacklisted Discord guilds.

    Parameters

    Returns Promise<(string | DiscordGuild)[]>

    The list of blacklisted Discord guilds.

getLinkPatterns

  • Will get a list of blacklisted link patterns.

    Parameters

    Returns Promise<(string | LinkPattern)[]>

    The list of blacklisted link patterns.

getPhrases

  • Will get a list of blacklisted phrases.

    Parameters

    Returns Promise<(string | Phrase)[]>

    The list of blacklisted phrases.

getYouTubeChannels

  • Will get a list of blacklisted YouTube channels.

    Parameters

    Returns Promise<(string | YouTubeChannel)[]>

    The list of blacklisted YouTube channels.

getYouTubeVideos

  • Will get a list of blacklisted YouTube videos.

    Parameters

    Returns Promise<(string | YouTubeVideo)[]>

    The list of blacklisted YouTube videos.

login

  • login(apiKey: string): Promise<void>
  • Method used to authenticate to the Nakiri Gateway and set the API key to be used for HTTP requests.

    Parameters

    • apiKey: string

      The API key which will be used for authentication.

    Returns Promise<void>

off

  • off(event: string): void
  • Unregisters an event handler.

    Parameters

    • event: string

      The event name.

    Returns void

on

  • on(event: "error", handler: GatewayEventHandler<GatewayError>): void
  • on(event: "entryAdded", handler: GatewayEventHandler<BlacklistMutationData>): void
  • on(event: "entryRemoved", handler: GatewayEventHandler<BlacklistMutationData>): void
  • on(event: "analysis", handler: GatewayEventHandler<AnalysisNotification>): void
  • on(event: "ready", handler: GatewayEventHandler<GatewayIdentifyResponse>): void
  • on(event: "reconnect", handler: GatewayEventHandler<GatewayReconnectResponse>): void
  • Error event handler. Will fire when the Gateway emits an error.

    Parameters

    • event: "error"

      The event name.

    • handler: GatewayEventHandler<GatewayError>

      The event handler.

    Returns void

  • Entry Added event handler. Will fire when the Gateway sends a notification about the addition of a new entry.

    Parameters

    • event: "entryAdded"

      The event name.

    • handler: GatewayEventHandler<BlacklistMutationData>

      The event handler.

    Returns void

  • Entry Removed event handler. Will fire when the Gateway sends a notification about the removal of an entry.

    Parameters

    • event: "entryRemoved"

      The event name.

    • handler: GatewayEventHandler<BlacklistMutationData>

      The event handler.

    Returns void

  • Generic event handler.

    Parameters

    • event: "analysis"

      The event name.

    • handler: GatewayEventHandler<AnalysisNotification>

      The event handler.

    Returns void

  • Ready event handler. Will fire when the Gateway was successfully authenticated and a session has been established.

    Parameters

    • event: "ready"

      The event name.

    • handler: GatewayEventHandler<GatewayIdentifyResponse>

      The event handler.

    Returns void

  • Reconnect event handler. Will fire on successful Gateway reconnection and authentication.

    Parameters

    • event: "reconnect"

      The event name.

    • handler: GatewayEventHandler<GatewayReconnectResponse>

      The event handler.

    Returns void

Generated using TypeDoc