Class PersonalizationClient

  • All Implemented Interfaces:
    Closeable, AutoCloseable

    public class PersonalizationClient
    extends Object
    implements Closeable
    Algolia's REST recommendation client that wraps an instance of the transporter HttpTransport which wraps the HTTP Client This client allows to build typed requests and read typed responses. Requests are made under the Algolia's retry-strategy. This client is intended to be reused and it's thread-safe.
    See Also:
    Algolia.com
    • Method Detail

      • getTransport

        public HttpTransport getTransport()
        Transport object responsible for the serialization/deserialization and the retry strategy.
      • getPersonalizationProfile

        public PersonalizationProfileResponse getPersonalizationProfile​(@Nonnull
                                                                        String userToken)
        Get the user profile built from Personalization strategy.

        The profile is structured by facet name used in the strategy. Each facet value is mapped to its score. Each score represents the user affinity for a specific facet value given the userToken past events and the Personalization strategy defined. Scores are bounded to 20. The last processed event timestamp is provided using the ISO 8601 format for debugging purposes.

        Parameters:
        userToken - userToken representing the user for which to fetch the Personalization profile
        Throws:
        AlgoliaRetryException - When the retry has failed on all hosts
        AlgoliaApiException - When the API sends an http error code
        AlgoliaRuntimeException - When an error occurred during the serialization
      • getPersonalizationProfile

        public PersonalizationProfileResponse getPersonalizationProfile​(@Nonnull
                                                                        String userToken,
                                                                        RequestOptions requestOptions)
        Get the user profile built from Personalization strategy.

        The profile is structured by facet name used in the strategy. Each facet value is mapped to its score. Each score represents the user affinity for a specific facet value given the userToken past events and the Personalization strategy defined. Scores are bounded to 20. The last processed event timestamp is provided using the ISO 8601 format for debugging purposes.

        Parameters:
        userToken - userToken representing the user for which to fetch the Personalization profile
        requestOptions - Options to pass to this request
        Throws:
        AlgoliaRetryException - When the retry has failed on all hosts
        AlgoliaApiException - When the API sends an http error code
        AlgoliaRuntimeException - When an error occurred during the serialization
      • getPersonalizationProfileAsync

        public CompletableFuture<PersonalizationProfileResponse> getPersonalizationProfileAsync​(@Nonnull
                                                                                                String userToken)
        Get the user profile built from Personalization strategy.

        The profile is structured by facet name used in the strategy. Each facet value is mapped to its score. Each score represents the user affinity for a specific facet value given the userToken past events and the Personalization strategy defined. Scores are bounded to 20. The last processed event timestamp is provided using the ISO 8601 format for debugging purposes.

        Parameters:
        userToken - userToken representing the user for which to fetch the Personalization profile
        Throws:
        AlgoliaRetryException - When the retry has failed on all hosts
        AlgoliaApiException - When the API sends an http error code
        AlgoliaRuntimeException - When an error occurred during the serialization
      • getPersonalizationProfileAsync

        public CompletableFuture<PersonalizationProfileResponse> getPersonalizationProfileAsync​(@Nonnull
                                                                                                String userToken,
                                                                                                RequestOptions requestOptions)
        Get the user profile built from Personalization strategy.

        The profile is structured by facet name used in the strategy. Each facet value is mapped to its score. Each score represents the user affinity for a specific facet value given the userToken past events and the Personalization strategy defined. Scores are bounded to 20. The last processed event timestamp is provided using the ISO 8601 format for debugging purposes.

        Parameters:
        userToken - userToken representing the user for which to fetch the Personalization profile
        requestOptions - Options to pass to this request
        Throws:
        AlgoliaRetryException - When the retry has failed on all hosts
        AlgoliaApiException - When the API sends an http error code
        AlgoliaRuntimeException - When an error occurred during the serialization
      • deletePersonalizationProfile

        public DeletePersonalizationProfileResponse deletePersonalizationProfile​(@Nonnull
                                                                                 String userToken)
        Delete the user profile and all its associated data.

        Returns, as part of the response, a date until which the data can safely be considered as deleted for the given user. This means that if you send events for the given user before this date, they will be ignored. Any data received after the deletedUntil date will start building a new user profile.

        It might take a couple hours before for the deletion request to be fully processed.

        Parameters:
        userToken - userToken representing the user for which to delete the Personalization profile and associated data.
        Throws:
        AlgoliaRetryException - When the retry has failed on all hosts
        AlgoliaApiException - When the API sends an http error code
        AlgoliaRuntimeException - When an error occurred during the serialization
      • deletePersonalizationProfile

        public DeletePersonalizationProfileResponse deletePersonalizationProfile​(@Nonnull
                                                                                 String userToken,
                                                                                 RequestOptions requestOptions)
        Delete the user profile and all its associated data.

        Returns, as part of the response, a date until which the data can safely be considered as deleted for the given user. This means that if you send events for the given user before this date, they will be ignored. Any data received after the deletedUntil date will start building a new user profile.

        It might take a couple hours before for the deletion request to be fully processed.

        Parameters:
        userToken - userToken representing the user for which to delete the Personalization profile and associated data.
        requestOptions - Options to pass to this request
        Throws:
        AlgoliaRetryException - When the retry has failed on all hosts
        AlgoliaApiException - When the API sends an http error code
        AlgoliaRuntimeException - When an error occurred during the serialization
      • deletePersonalizationProfileAsync

        public CompletableFuture<DeletePersonalizationProfileResponse> deletePersonalizationProfileAsync​(@Nonnull
                                                                                                         String userToken)
        Delete the user profile and all its associated data.

        Returns, as part of the response, a date until which the data can safely be considered as deleted for the given user. This means that if you send events for the given user before this date, they will be ignored. Any data received after the deletedUntil date will start building a new user profile.

        It might take a couple hours before for the deletion request to be fully processed.

        Parameters:
        userToken - userToken representing the user for which to delete the Personalization profile and associated data.
        Throws:
        AlgoliaRetryException - When the retry has failed on all hosts
        AlgoliaApiException - When the API sends an http error code
        AlgoliaRuntimeException - When an error occurred during the serialization
      • deletePersonalizationProfileAsync

        public CompletableFuture<DeletePersonalizationProfileResponse> deletePersonalizationProfileAsync​(@Nonnull
                                                                                                         String userToken,
                                                                                                         RequestOptions requestOptions)
        Delete the user profile and all its associated data.

        Returns, as part of the response, a date until which the data can safely be considered as deleted for the given user. This means that if you send events for the given user before this date, they will be ignored. Any data received after the deletedUntil date will start building a new user profile.

        It might take a couple hours before for the deletion request to be fully processed.

        Parameters:
        userToken - userToken representing the user for which to delete the Personalization profile and associated data.
        requestOptions - Options to pass to this request
        Throws:
        AlgoliaRetryException - When the retry has failed on all hosts
        AlgoliaApiException - When the API sends an http error code
        AlgoliaRuntimeException - When an error occurred during the serialization
      • getConfig

        public ConfigBase getConfig()
        Get Client's configuration