The interface that clients (like the browser extension) use to communicate with backends. This is essentially the "bare minimum" of shared functionality that a client will use to communicate with a backend

Remarks

As a result of the multi-purpose design of the beta-* packages, clients can require additional functionality beyond this interface to match their environment. For example, the extension has a separate provider abstraction to bridge this interface into the browser environment.

Hierarchy

  • ICensorBackend

Implemented by

Properties

onImageCensored: IEvent<ICensorBackend, ImageCensorResponse>

An event fired when the backend has completed censoring a request and the client can continue.

requestId?: string

This property was part of legacy functionality and will be removed in a future release.

Deprecated

Methods

  • Request cancellation of a previously sent censoring request.

    Parameters

    • request: CancelRequest

      Details of the censoring request to cancel.

    Returns Promise<void>

    Remarks

    Some backends may not support this, but should handle the cancellation request regardless.

  • Censor a given image based on the given censoring request.

    Parameters

    Returns Promise<undefined | boolean | ImageCensorResponse>

    Either the censored image response, or true if the server has accepted the request asynchronously and will return it through the onImageCensored event.

  • Checks the current backend's availability and readiness for requests.

    Parameters

    • Optional host: string

      The host address to check for availability. When not specified, should use the backend's default address.

    Returns Promise<ConnectionStatus>

  • Requests any assets of the specified type stored by the backend.

    Parameters

    • assetType: AssetType

      The asset type to fetch from the backend.

    Returns Promise<undefined | string[]>

    Remarks

    This is mostly used by clients to determine what backend-side assets are available for selection by the user (like stickers)

  • Returns any user preferences stored by the backend.

    Returns Promise<undefined | Partial<IPreferences>>

    Remarks

    If the backend doesn't store user preferences, return undefined from the Promise.

  • Fetches censoring statistics from the backend.

    Returns Promise<undefined | StatisticsData>

    Remarks

    Not all backends support this. If not, just return a Promise<undefined>

  • Requests that a backend should reset any stored censoring statistics.

    Returns Promise<boolean>

    Remarks

    Not all backends support this, nor do they have to honour this. If the backend doesn't support this, it will return a Promise<false> regardless.

  • Updates/saves user preferences as stored by the backend/

    Parameters

    • preferences: IPreferences

      The new user preferences to store in the backend.

    Returns Promise<boolean>

    Remarks

    If the backend doesn't store user preferences, just return a Promise<false>

Generated using TypeDoc