Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Client

Client defines a client for interacting with the Sajari API.

Hierarchy

  • Client

Index

Constructors

constructor

  • new Client(project: string, collection: string, endpoint?: string, key?: undefined | string, secret?: undefined | string, config?: Partial<ConfigObj>): Client
  • Constructs an instance of Client for a specific account and collection.

    const client = new Client("<account_id>", "<collection_id>");

    It is also possible to optionally set the API endpoint:

    const client = new Client("<account_id>", "<collection_id>", "<endpoint>");

    Parameters

    • project: string
    • collection: string
    • Default value endpoint: string = `${isSSR() ? "https:" : ""}//jsonapi.sajari.net`
    • Optional key: undefined | string
    • Optional secret: undefined | string
    • Optional config: Partial<ConfigObj>

    Returns Client

Properties

collection

collection: string

config

config: ConfigObj

endpoint

endpoint: string

Optional key

key: undefined | string

project

project: string

Optional secret

secret: undefined | string

userAgent

userAgent: string = ""

Methods

call

  • call<Response>(path: string, request: Record<string, any>, signal?: AbortSignal): Promise<Response>
  • call executes a request to the Sajari API

    Type parameters

    • Response

    Parameters

    • path: string
    • request: Record<string, any>
    • Optional signal: AbortSignal

    Returns Promise<Response>

interactionConsume

  • interactionConsume(token: string, identifier: string, weight: number, data?: Record<string, string>): Promise<void>
  • interactionConsume consumes an interaction token.

    Parameters

    • token: string
    • identifier: string
    • weight: number
    • Default value data: Record<string, string> = {}

    Returns Promise<void>

pipeline

  • pipeline(name: string, version?: undefined | string): QueryPipeline
  • pipeline creates a new QueryPipeline instance that inherits configuration from the Client.

    Parameters

    • name: string

      pipeline name

    • Optional version: undefined | string

    Returns QueryPipeline

Generated using TypeDoc