This version (v0.7) has not been published to npm yet.
Skip to content

Reference / @getenginex/sdk-predictions / createPredictions

createPredictions() ​

createPredictions(client): PredictionsClient

Creates the predictions namespaces on top of a @getenginex/sdk client. It creates no session, tenant or transport of its own and makes no request: call it once per client (in the browser, one per app; on the server, one per request, together with the client).

After enginex.dispose(), createPredictions still accepts the client, but every predictions method rejects with CONFIGURATION_ERROR, like the core methods.

Parameters ​

client ​

EnginexClient

The client returned by createEnginexClient (the object itself, not a copy).

Returns ​

PredictionsClient

Example ​

ts
import { createEnginexClient } from '@getenginex/sdk'
import { createPredictions } from '@getenginex/sdk-predictions'

export const enginex = createEnginexClient({ locale: 'pt-BR' })
export const predictions = createPredictions(enginex)

Throws ​

CONFIGURATION_ERROR if client is not a client created by createEnginexClient (e.g. an arbitrary object or a { ...enginex } copy), or if it was created by an incompatible copy of @getenginex/sdk (install a single core version). Identify with isEnginexError(error, 'CONFIGURATION_ERROR').