Options
All
  • Public
  • Public/Protected
  • All
Menu

Client is the root class for interfacing with Beneath from the browser. It is a wrapper for the Beneath REST APIs. You can use it to read from and write data to streams, and to run warehouse queries.

To instantiate a new client and find a stream:

const client = Client({ secret: "YOUR_SECRET" });
const stream = client.findStream("USERNAME/PROJECT/STREAM");

If your code runs in the browser (i.e. it's part of your frontend), you must use a read-only secret. You can obtain a new secret from your settings page on https://beneath.dev.

Note that you can use this class from outside the browser, but it uses the less performant REST APIs, not the gRPC APIs (like the Python client does).

Hierarchy

  • Client

Index

Constructors

Properties

Methods

Constructors

constructor

  • new Client(opts?: ClientOptions): Client
  • Parameters

    • Optional opts: ClientOptions

      The connection options, see the class docs for an example

    Returns Client

Properties

Private connection

connection: any

secret

secret: undefined | string

Methods

findStream

  • Type parameters

    • TRecord = any

      Optional type for the records in the stream. No error is thrown if it doesn't correctly correspond to the stream's schema; it is for type hinting purposes only.

    Parameters

    Returns Stream<TRecord>

ping

  • ping(): Promise<Response<PingData, any>>
  • Pings the server and reports a) whether the user is authenticated, b) the library version is up-to-date

    Returns Promise<Response<PingData, any>>

queryWarehouse

  • queryWarehouse<TRecord>(opts: QueryWarehouseOptions): Promise<QueryWarehouseResult<TRecord>>
  • Type parameters

    • TRecord = any

    Parameters

    • opts: QueryWarehouseOptions

      Parameters of the warehouse query to execute

    Returns Promise<QueryWarehouseResult<TRecord>>

Legend

  • Property

Generated using TypeDoc