algoliasearch

  • Version 4.10.3
  • Published
  • 196 kB
  • 14 dependencies
  • MIT license

Install

npm i algoliasearch
yarn add algoliasearch
pnpm add algoliasearch

Overview

A fully-featured and blazing-fast JavaScript API client to interact with Algolia API.

Index

Functions

function algoliasearch

algoliasearch: typeof algoliasearch;

    Type Aliases

    type AlgoliaSearchOptions

    type AlgoliaSearchOptions = Partial<ClientTransporterOptions> &
    WithoutCredentials<SearchClientOptions>;

      type AnalyticsClient

      type AnalyticsClient = AnalyticsClient_2 & {
      readonly addABTest: (
      abTest: ABTest,
      requestOptions?: RequestOptions
      ) => Readonly<Promise<AddABTestResponse>>;
      readonly getABTest: (
      abTestID: number,
      requestOptions?: RequestOptions
      ) => Readonly<Promise<GetABTestResponse>>;
      readonly getABTests: (
      requestOptions?: RequestOptions & GetABTestsOptions
      ) => Readonly<Promise<GetABTestsResponse>>;
      readonly stopABTest: (
      abTestID: number,
      requestOptions?: RequestOptions
      ) => Readonly<Promise<StopABTestResponse>>;
      readonly deleteABTest: (
      abTestID: number,
      requestOptions?: RequestOptions
      ) => Readonly<Promise<DeleteABTestResponse>>;
      };

        type InitAnalyticsOptions

        type InitAnalyticsOptions = Partial<ClientTransporterOptions> &
        OptionalCredentials<AnalyticsClientOptions>;

          type InitPersonalizationOptions

          type InitPersonalizationOptions = Partial<ClientTransporterOptions> &
          OptionalCredentials<PersonalizationClientOptions>;

            type InitRecommendationOptions

            type InitRecommendationOptions = InitPersonalizationOptions;
            • Deprecated

              Use InitPersonalizationOptions instead.

            type OptionalCredentials

            type OptionalCredentials<TClientOptions extends Credentials> = Omit<
            TClientOptions,
            keyof Credentials
            > &
            Pick<Partial<TClientOptions>, keyof Credentials>;

              type PersonalizationClient

              type PersonalizationClient = PersonalizationClient_2 & {
              readonly getPersonalizationStrategy: (
              requestOptions?: RequestOptions
              ) => Readonly<Promise<GetPersonalizationStrategyResponse>>;
              readonly setPersonalizationStrategy: (
              personalizationStrategy: PersonalizationStrategy,
              requestOptions?: RequestOptions
              ) => Readonly<Promise<SetPersonalizationStrategyResponse>>;
              };

                type RecommendationClient

                type RecommendationClient = PersonalizationClient;
                • Deprecated

                  Use PersonalizationClient instead.

                type SearchClient

                type SearchClient = SearchClient_2 & {
                readonly initIndex: (indexName: string) => SearchIndex;
                readonly search: <TObject>(
                queries: readonly MultipleQueriesQuery[],
                requestOptions?: RequestOptions & MultipleQueriesOptions
                ) => Readonly<Promise<MultipleQueriesResponse<TObject>>>;
                readonly searchForFacetValues: (
                queries: ReadonlyArray<{
                readonly indexName: string;
                readonly params: SearchForFacetValuesQueryParams & SearchOptions;
                }>,
                requestOptions?: RequestOptions
                ) => Readonly<Promise<readonly SearchForFacetValuesResponse[]>>;
                readonly multipleBatch: (
                requests: readonly MultipleBatchRequest[],
                requestOptions?: RequestOptions
                ) => Readonly<WaitablePromise<MultipleBatchResponse>>;
                readonly multipleGetObjects: <TObject>(
                requests: readonly MultipleGetObject[],
                requestOptions?: RequestOptions
                ) => Readonly<Promise<MultipleGetObjectsResponse<TObject>>>;
                readonly multipleQueries: <TObject>(
                queries: readonly MultipleQueriesQuery[],
                requestOptions?: RequestOptions & MultipleQueriesOptions
                ) => Readonly<Promise<MultipleQueriesResponse<TObject>>>;
                readonly copyIndex: (
                from: string,
                to: string,
                requestOptions?: CopyIndexOptions & RequestOptions
                ) => Readonly<WaitablePromise<IndexOperationResponse>>;
                readonly copySettings: (
                from: string,
                to: string,
                requestOptions?: RequestOptions
                ) => Readonly<WaitablePromise<IndexOperationResponse>>;
                readonly copyRules: (
                from: string,
                to: string,
                requestOptions?: RequestOptions
                ) => Readonly<WaitablePromise<IndexOperationResponse>>;
                readonly copySynonyms: (
                from: string,
                to: string,
                requestOptions?: RequestOptions
                ) => Readonly<WaitablePromise<IndexOperationResponse>>;
                readonly moveIndex: (
                from: string,
                to: string,
                requestOptions?: RequestOptions
                ) => Readonly<WaitablePromise<IndexOperationResponse>>;
                readonly listIndices: (
                requestOptions?: RequestOptions
                ) => Readonly<Promise<ListIndicesResponse>>;
                readonly getLogs: (
                requestOptions?: RequestOptions
                ) => Readonly<Promise<GetLogsResponse>>;
                readonly listClusters: (
                requestOptions?: RequestOptions
                ) => Readonly<Promise<ListClustersResponse>>;
                readonly multipleSearchForFacetValues: (
                queries: ReadonlyArray<{
                readonly indexName: string;
                readonly params: SearchForFacetValuesQueryParams & SearchOptions;
                }>,
                requestOptions?: RequestOptions
                ) => Readonly<Promise<readonly SearchForFacetValuesResponse[]>>;
                readonly getApiKey: (
                apiKey: string,
                requestOptions?: RequestOptions
                ) => Readonly<Promise<GetApiKeyResponse>>;
                readonly addApiKey: (
                acl: readonly ApiKeyACLType[],
                requestOptions?: AddApiKeyOptions &
                Pick<RequestOptions, Exclude<keyof RequestOptions, 'queryParameters'>>
                ) => Readonly<WaitablePromise<AddApiKeyResponse>>;
                readonly listApiKeys: (
                requestOptions?: RequestOptions
                ) => Readonly<Promise<ListApiKeysResponse>>;
                readonly updateApiKey: (
                apiKey: string,
                requestOptions?: UpdateApiKeyOptions &
                Pick<RequestOptions, Exclude<keyof RequestOptions, 'queryParameters'>>
                ) => Readonly<WaitablePromise<UpdateApiKeyResponse>>;
                readonly deleteApiKey: (
                apiKey: string,
                requestOptions?: RequestOptions
                ) => Readonly<WaitablePromise<DeleteApiKeyResponse>>;
                readonly restoreApiKey: (
                apiKey: string,
                requestOptions?: RequestOptions
                ) => Readonly<WaitablePromise<RestoreApiKeyResponse>>;
                readonly assignUserID: (
                userID: string,
                clusterName: string,
                requestOptions?: RequestOptions
                ) => Readonly<Promise<AssignUserIDResponse>>;
                readonly assignUserIDs: (
                userIDs: readonly string[],
                clusterName: string,
                requestOptions?: RequestOptions
                ) => Readonly<Promise<AssignUserIDsResponse>>;
                readonly getUserID: (
                userID: string,
                requestOptions?: RequestOptions
                ) => Readonly<Promise<UserIDResponse>>;
                readonly searchUserIDs: (
                query: string,
                requestOptions?: SearchUserIDsOptions & RequestOptions
                ) => Readonly<Promise<SearchUserIDsResponse>>;
                readonly listUserIDs: (
                requestOptions?: ListUserIDsOptions & RequestOptions
                ) => Readonly<Promise<ListUserIDsResponse>>;
                readonly getTopUserIDs: (
                requestOptions?: RequestOptions
                ) => Readonly<Promise<GetTopUserIDsResponse>>;
                readonly removeUserID: (
                userID: string,
                requestOptions?: RequestOptions
                ) => Readonly<Promise<RemoveUserIDResponse>>;
                readonly hasPendingMappings: (
                requestOptions?: HasPendingMappingsOptions & RequestOptions
                ) => Readonly<Promise<HasPendingMappingsResponse>>;
                readonly generateSecuredApiKey: (
                parentApiKey: string,
                restrictions: SecuredApiKeyRestrictions
                ) => string;
                readonly getSecuredApiKeyRemainingValidity: (securedApiKey: string) => number;
                readonly clearDictionaryEntries: (
                dictionary: DictionaryName,
                requestOptions?: RequestOptions & DictionaryEntriesOptions
                ) => Readonly<WaitablePromise<DictionaryEntriesResponse>>;
                readonly deleteDictionaryEntries: (
                dictionary: DictionaryName,
                objectIDs: readonly string[],
                requestOptions?: RequestOptions & DictionaryEntriesOptions
                ) => Readonly<WaitablePromise<DictionaryEntriesResponse>>;
                readonly replaceDictionaryEntries: (
                dictionary: DictionaryName,
                entries: readonly DictionaryEntry[],
                requestOptions?: RequestOptions & DictionaryEntriesOptions
                ) => Readonly<WaitablePromise<DictionaryEntriesResponse>>;
                readonly saveDictionaryEntries: (
                dictionary: DictionaryName,
                entries: readonly DictionaryEntry[],
                requestOptions?: RequestOptions & DictionaryEntriesOptions
                ) => Readonly<WaitablePromise<DictionaryEntriesResponse>>;
                readonly searchDictionaryEntries: (
                dictionary: DictionaryName,
                query: string,
                requestOptions?: RequestOptions
                ) => Readonly<Promise<SearchDictionaryEntriesResponse>>;
                readonly getDictionarySettings: (
                requestOptions?: RequestOptions
                ) => Readonly<Promise<GetDictionarySettingsResponse>>;
                readonly setDictionarySettings: (
                settings: DictionarySettings,
                requestOptions?: RequestOptions
                ) => Readonly<WaitablePromise<DictionaryEntriesResponse>>;
                readonly getAppTask: (
                taskID: number,
                requestOptions?: RequestOptions
                ) => Readonly<Promise<TaskStatusResponse>>;
                readonly initAnalytics: (options?: InitAnalyticsOptions) => AnalyticsClient;
                readonly initPersonalization: (
                options?: InitPersonalizationOptions
                ) => PersonalizationClient;
                /**
                * @deprecated Use `initPersonalization` instead.
                */
                readonly initRecommendation: (
                options?: InitPersonalizationOptions
                ) => PersonalizationClient;
                } & Destroyable;

                  type SearchIndex

                  type SearchIndex = SearchIndex_2 & {
                  readonly search: <TObject>(
                  query: string,
                  requestOptions?: RequestOptions & SearchOptions
                  ) => Readonly<Promise<SearchResponse<TObject>>>;
                  readonly searchForFacetValues: (
                  facetName: string,
                  facetQuery: string,
                  requestOptions?: RequestOptions & SearchOptions
                  ) => Readonly<Promise<SearchForFacetValuesResponse>>;
                  readonly findAnswers: <TObject>(
                  query: string,
                  queryLanguages: readonly string[],
                  requestOptions?: RequestOptions & FindAnswersOptions
                  ) => Readonly<Promise<FindAnswersResponse<TObject>>>;
                  readonly batch: (
                  requests: readonly BatchRequest[],
                  requestOptions?: RequestOptions
                  ) => Readonly<WaitablePromise<BatchResponse>>;
                  readonly delete: (
                  requestOptions?: RequestOptions
                  ) => Readonly<WaitablePromise<DeleteResponse>>;
                  readonly getObject: <TObject>(
                  objectID: string,
                  requestOptions?: RequestOptions & GetObjectOptions
                  ) => Readonly<Promise<TObject & ObjectWithObjectID>>;
                  readonly getObjects: <TObject>(
                  objectIDs: readonly string[],
                  requestOptions?: RequestOptions & GetObjectsOptions
                  ) => Readonly<Promise<GetObjectsResponse<TObject>>>;
                  readonly saveObject: (
                  object: Readonly<Record<string, any>>,
                  requestOptions?: RequestOptions & ChunkOptions & SaveObjectsOptions
                  ) => Readonly<WaitablePromise<SaveObjectResponse>>;
                  readonly saveObjects: (
                  objects: ReadonlyArray<Readonly<Record<string, any>>>,
                  requestOptions?: RequestOptions & ChunkOptions & SaveObjectsOptions
                  ) => Readonly<WaitablePromise<ChunkedBatchResponse>>;
                  readonly waitTask: (
                  taskID: number,
                  requestOptions?: RequestOptions
                  ) => Readonly<Promise<void>>;
                  readonly setSettings: (
                  settings: Settings,
                  requestOptions?: RequestOptions
                  ) => Readonly<WaitablePromise<SetSettingsResponse>>;
                  readonly getSettings: (
                  requestOptions?: RequestOptions
                  ) => Readonly<Promise<Settings>>;
                  readonly partialUpdateObject: (
                  object: Record<string, any>,
                  requestOptions?: RequestOptions & ChunkOptions & PartialUpdateObjectsOptions
                  ) => Readonly<WaitablePromise<PartialUpdateObjectResponse>>;
                  readonly partialUpdateObjects: (
                  objects: ReadonlyArray<Record<string, any>>,
                  requestOptions?: RequestOptions & ChunkOptions & PartialUpdateObjectsOptions
                  ) => Readonly<WaitablePromise<ChunkedBatchResponse>>;
                  readonly deleteObject: (
                  objectID: string,
                  requestOptions?: RequestOptions
                  ) => Readonly<WaitablePromise<DeleteResponse>>;
                  readonly deleteObjects: (
                  objectIDs: readonly string[],
                  requestOptions?: RequestOptions & ChunkOptions
                  ) => Readonly<WaitablePromise<ChunkedBatchResponse>>;
                  readonly deleteBy: (
                  filters: DeleteByFiltersOptions,
                  requestOptions?: RequestOptions
                  ) => Readonly<WaitablePromise<DeleteResponse>>;
                  readonly clearObjects: (
                  requestOptions?: RequestOptions
                  ) => Readonly<WaitablePromise<DeleteResponse>>;
                  readonly browseObjects: <TObject>(
                  requestOptions?: SearchOptions & BrowseOptions<TObject> & RequestOptions
                  ) => Readonly<Promise<void>>;
                  readonly getObjectPosition: (
                  searchResponse: SearchResponse<{}>,
                  objectID: string
                  ) => number;
                  readonly findObject: <TObject>(
                  callback: (object: TObject & ObjectWithObjectID) => boolean,
                  requestOptions?: FindObjectOptions & RequestOptions
                  ) => Readonly<Promise<FindObjectResponse<TObject>>>;
                  readonly exists: (requestOptions?: RequestOptions) => Readonly<Promise<boolean>>;
                  readonly saveSynonym: (
                  synonym: Synonym,
                  requestOptions?: RequestOptions & SaveSynonymsOptions
                  ) => Readonly<WaitablePromise<SaveSynonymResponse>>;
                  readonly saveSynonyms: (
                  synonyms: readonly Synonym[],
                  requestOptions?: SaveSynonymsOptions & RequestOptions
                  ) => Readonly<WaitablePromise<SaveSynonymsResponse>>;
                  readonly getSynonym: (
                  objectID: string,
                  requestOptions?: RequestOptions
                  ) => Readonly<Promise<Synonym>>;
                  readonly searchSynonyms: (
                  query: string,
                  requestOptions?: SearchSynonymsOptions & RequestOptions
                  ) => Readonly<Promise<SearchSynonymsResponse>>;
                  readonly browseSynonyms: (
                  requestOptions?: SearchSynonymsOptions &
                  BrowseOptions<Synonym> &
                  RequestOptions
                  ) => Readonly<Promise<void>>;
                  readonly deleteSynonym: (
                  objectID: string,
                  requestOptions?: DeleteSynonymOptions & RequestOptions
                  ) => Readonly<WaitablePromise<DeleteResponse>>;
                  readonly clearSynonyms: (
                  requestOptions?: ClearSynonymsOptions & RequestOptions
                  ) => Readonly<WaitablePromise<DeleteResponse>>;
                  readonly replaceAllObjects: (
                  objects: ReadonlyArray<Readonly<Record<string, any>>>,
                  requestOptions?: ReplaceAllObjectsOptions &
                  ChunkOptions &
                  SaveObjectsOptions &
                  RequestOptions
                  ) => Readonly<WaitablePromise<ChunkedBatchResponse>>;
                  readonly replaceAllSynonyms: (
                  synonyms: readonly Synonym[],
                  requestOptions?: RequestOptions &
                  Pick<
                  SaveSynonymsOptions,
                  Exclude<
                  keyof SaveSynonymsOptions,
                  'clearExistingSynonyms' | 'replaceExistingSynonyms'
                  >
                  >
                  ) => Readonly<WaitablePromise<SaveSynonymsResponse>>;
                  readonly searchRules: (
                  query: string,
                  requestOptions?: RequestOptions & SearchRulesOptions
                  ) => Readonly<Promise<SearchResponse<Rule>>>;
                  readonly getRule: (
                  objectID: string,
                  requestOptions?: RequestOptions
                  ) => Readonly<Promise<Rule>>;
                  readonly deleteRule: (
                  objectID: string,
                  requestOptions?: RequestOptions
                  ) => Readonly<WaitablePromise<DeleteResponse>>;
                  readonly saveRule: (
                  rule: Rule,
                  requestOptions?: RequestOptions & SaveRulesOptions
                  ) => Readonly<WaitablePromise<SaveRuleResponse>>;
                  readonly saveRules: (
                  rules: readonly Rule[],
                  requestOptions?: RequestOptions & SaveRulesOptions
                  ) => Readonly<WaitablePromise<SaveRulesResponse>>;
                  readonly replaceAllRules: (
                  rules: readonly Rule[],
                  requestOptions?: RequestOptions & SaveRulesOptions
                  ) => Readonly<WaitablePromise<SaveRulesResponse>>;
                  readonly browseRules: (
                  requestOptions?: SearchRulesOptions & BrowseOptions<Rule> & RequestOptions
                  ) => Readonly<Promise<void>>;
                  readonly clearRules: (
                  requestOptions?: RequestOptions & ClearRulesOptions
                  ) => Readonly<WaitablePromise<DeleteResponse>>;
                  };

                    type WithoutCredentials

                    type WithoutCredentials<TClientOptions extends Credentials> = Omit<
                    TClientOptions,
                    keyof Credentials
                    >;

                      Namespaces

                      namespace algoliasearch

                      namespace algoliasearch {}

                        variable version

                        var version: string;

                          Package Files (2)

                          Dependencies (14)

                          Dev Dependencies (0)

                          No dev dependencies.

                          Peer Dependencies (0)

                          No peer dependencies.

                          Badge

                          To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                          You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/algoliasearch.

                          • Markdown
                            [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/algoliasearch)
                          • HTML
                            <a href="https://www.jsdocs.io/package/algoliasearch"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>