Options
All
  • Public
  • Public/Protected
  • All
Menu

Client defines a client for interacting with the Sajari API.

Hierarchy

  • APIClient
    • Client

Index

Constructors

  • Constructs an instance of Client for a specific account and collection.

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

    It is also possible to optionally set the API endpoint:

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

    Parameters

    • account: string
    • collection: string
    • endpoint: string = "api.search.io"
    • Optional credentials: KeySecretCredentials

    Returns Client

Methods

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

    Parameters

    • Optional name: string

      pipeline name

    • Optional version: string

    Returns QueryPipeline

  • query(req: QueryRequest): Promise<QueryResponse>
  • Query runs a search query.

    client.query({ variables: { q: "<search query>" } })
    .then((response) => {
    // handle response
    })
    .catch(error => {
    // handle error
    })

    Parameters

    • req: QueryRequest

    Returns Promise<QueryResponse>

  • trackEvent(req: TrackEventRequest): Promise<void>
  • Parameters

    • req: TrackEventRequest

    Returns Promise<void>

Generated using TypeDoc