⚠️ Internal: This API is not publically exported by the package.

Options set when instantiating the RecommendationClient

interface RecommendationClientOptions {
    allowedAccountRoles: "root" | "manager" | "backend" | "frontend" | "demo_viewer" | ("root" | "manager" | "backend" | "frontend" | "demo_viewer")[] | "*";
    endpointBasePath?: string;
    errorRetryBehavior?: {
        exponentialDelay?: boolean;
        numberOfRetries?: number;
        retryDelay?: number;
    };
    fetchClient?: {
        (input, init?): Promise<Response>;
        (input, init?): Promise<Response>;
    };
    initialCredentials?: InitialCredentials;
    onAuthenticationError?: ((error) => void);
    onUpdateCredentials?: ((updatedCredentials) => void);
    userAgent?: string;
}

Properties

allowedAccountRoles: "root" | "manager" | "backend" | "frontend" | "demo_viewer" | ("root" | "manager" | "backend" | "frontend" | "demo_viewer")[] | "*"

An allow list of role values that can be used with this instance of the client. All accounts have a role associated that determines permissions and access. Make sure you're using an account that has the appropriate role for the given environment.

endpointBasePath?: string

Leave this property undefined to access the standard Crossing Minds API URL.

errorRetryBehavior?: {
    exponentialDelay?: boolean;
    numberOfRetries?: number;
    retryDelay?: number;
}

Determines how network calls are retried after failure. Note: not all network calls can be retried.

Type declaration

  • Optional exponentialDelay?: boolean

    Default

    true
    
  • Optional numberOfRetries?: number

    Default

    3
    
  • Optional retryDelay?: number

    Default

    250 milliseconds
    
fetchClient?: {
    (input, init?): Promise<Response>;
    (input, init?): Promise<Response>;
}

Type declaration

    • (input, init?): Promise<Response>
    • Provide a fetch function if your runtime doesn't have one in globalThis. This is not required in modern browsers, node 18+, or Cloudflare Workers (including Oxygen). Note: fetch is required to use the client.

      Parameters

      • input: RequestInfo | URL
      • Optional init: RequestInit

      Returns Promise<Response>

    • (input, init?): Promise<Response>
    • Provide a fetch function if your runtime doesn't have one in globalThis. This is not required in modern browsers, node 18+, or Cloudflare Workers (including Oxygen). Note: fetch is required to use the client.

      Parameters

      • input: string | Request | URL
      • Optional init: RequestInit

      Returns Promise<Response>

initialCredentials?: InitialCredentials

Provide credentials to be used on instantiation of the client. Authentication will be attempted in the background, if needed.

onAuthenticationError?: ((error) => void)

Type declaration

    • (error): void
    • Callback triggered on a final authentication error. If this callback is triggered, subsequent API requests that require authentication will fail until one of the login commands is called successfully.

      Parameters

      • error: unknown

      Returns void

onUpdateCredentials?: ((updatedCredentials) => void)

Type declaration

    • (updatedCredentials): void
    • Callback triggered when credentials in the client's internal state have changed. This is usually called after a successful login command.

      Parameters

      Returns void

userAgent?: string

Custom user agent string to be used in network request headers. Note: Setting the User-Agent header is restricted in browsers for security reasons.