Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Recommender

Flike Recommender lets you easily recommend content items to users based on their interactions.

Hierarchy

  • Recommender

Index

Constructors

  • new Recommender(api_key: string, server_url?: string, version?: string): Recommender
  • Parameters

    • api_key: string

      Your API key.

    • Optional server_url: string

      (only used for internal testing)

    • Optional version: string

      Version of the API to use. Defaults to the most current version.

    Returns Recommender

Methods

  • Create a new batch recommendation job for a large quantity of users.

    This starts a long-running computation whose status you can check with the batch_recommend_query method.

    throws

    FlikeError when the job cannot be created.

    Parameters

    Returns Promise<BatchRecommendationsJob>

    Resolves to a BatchRecommendationsJob if successful. Otherwise, throws an exception.

  • Check the status of a batch recommendation job.

    The job must have previously been created using batch_recommend.

    Note that instead of polling, you can pass a webhook URL to batch_recommend. This webhook will be invoked whenever the job status changes to receive a POST request with the BatchRecommendationsResponse as payload.

    see

    batch_recommend

    throws

    FlikeError when information about the job is not available.

    Parameters

    • jobId: string

      The UUID of the job to query.

    Returns Promise<BatchRecommendationsResponse>

    Resolves to a BatchRecommendationsResponse if successful. Otherwise, throws an exception.

  • recommend(userId: string, numResults: number, context?: { itemId: string; latitude: number; longitude: number }): Promise<RecommendationsResponse>
  • Get an array of content items that a user is probable to consume/buy/subscribe/like or similar. Recommendations are sorted by descending probability of a user 'liking' them.

    throws

    FlikeError when the recommendation fails.

    Parameters

    • userId: string

      The unique identifier of the user.

    • numResults: number

      Number of content items that should be suggested.

    • Optional context: { itemId: string; latitude: number; longitude: number }
      • itemId: string
      • latitude: number
      • longitude: number

    Returns Promise<RecommendationsResponse>

    Resolves to a RecommendationsResponse if successful. Otherwise, it will throw an exception.

  • validate(): Promise<boolean>
  • Validates the connectivity to the API.

    Returns Promise<boolean>

    Resolves to true if the connection is successful, false otherwise.

Generated using TypeDoc