### Install Algolia Go Client Source: https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-go/README.md Install the Algolia API Go Client using the go get command. ```bash go get github.com/algolia/algoliasearch-client-go/v4 ``` -------------------------------- ### Example push config for AlgoliaWeb Source: https://github.com/algolia/api-clients-automation/blob/main/website/docs/generating-guides.md Example push config for the AlgoliaWeb repository. It defines two tasks: one for onboarding guides (saveObjectsMovies) and one for ingestion guides (pushSetup), each with a PR branch, commit message, and output file. Placeholder variables are provided for the onboarding task. ```javascript { AlgoliaWeb: { baseBranch: 'develop', tasks: [ { prBranch: 'feat/update-generated-onboarding-guides', commitMessage: 'feat: update generated onboarding guides', files: { type: 'guides', names: ['saveObjectsMovies'], output: '_client/src/routes/launchpad/onboarding-snippets.json', placeholderVariables: { ALGOLIA_APPLICATION_ID: 'YourApplicationID', ALGOLIA_API_KEY: 'YourWriteAPIKey', '': 'movies_index', }, }, }, { prBranch: 'feat/update-generated-ingestion-guides', commitMessage: 'feat: update generated ingestion guides', files: { type: 'guides', names: ['pushSetup'], output: '_client/src/routes/connectors/generated/ingestion-snippets.json', }, }, ], }, } ``` -------------------------------- ### Setup repository tooling with nvm (nvm) and yarn install implicitly via yarn (yarn) — command: nvm use && yarn Source: https://github.com/algolia/api-clients-automation/blob/main/README.md Sets up the repository tooling by switching to the project's Node version and installing dependencies with Yarn. Prerequisite: Node Version Manager (npx) is required. ```bash nvm use && yarn ``` -------------------------------- ### Start local development server with yarn start Source: https://github.com/algolia/api-clients-automation/blob/main/website/README.md Starts a local development server and opens a browser window. Most changes are reflected live without restarting the server. ```bash $ yarn start ``` -------------------------------- ### Set up the development environment with Docker (docker) — command: yarn docker: Source: https://github.com/algolia/api-clients-automation/blob/main/README.md Sets up ther/>.prerequisite: Docker must be used to avoid installing tooling for every API clients, as stated in the source warning. This command likely builds or starts Docker containers for the project's tooling setup. ```SOURCE MISSING: code is missing in the source.Input text does not contain the code block content for this code block? The source only has the command in a code block: 'yarn docker:setup' is present in the source. The code block content is exactly 'yarn docker: yarn docker: ``` -------------------------------- ### Install @algolia/agent-studio with a package manager Source: https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-javascript/packages/agent-studio/README.md Install the @algolia/agent-studio client using your preferred package manager. The package is already a dependency of the algoliasearch client, so manual installation is only needed if you are not using algoliasearch. ```bash yarn add @algolia/agent-studio@1.4.0 # or npm install @algolia/agent-studio@1.4.0 # or pnpm add @algolia/agent-studio@1.4.0 ``` -------------------------------- ### Install @algolia/client-query-suggestions with a package manager Source: https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-javascript/packages/client-query-suggestions/README.md Install the client package with your preferred package manager. The version is pinned to 5.59.0. ```bash yarn add @algolia/client-query-suggestions@5.59.0 # or npm install @algolia/client-query-suggestions@5.59.0 # or pnpm add @algolia/client-query-suggestions@5.59.0 ``` -------------------------------- ### Install @algolia/client-abtesting with package manager Source: https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-javascript/packages/client-abtesting/README.md Install the client package using yarn, npm, or pnpm. The commands are alternatives; choose one based on your package manager. ```bash yarn add @algolia/client-abtesting@5.59.0 # or npm install @algolia/client-abtesting@5.59.0 # or pnpm add @algolia/client-abtesting@5.59.0 ``` -------------------------------- ### Install Algolia.Search with .NET CLI Source: https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-csharp/README.md Install the Algolia.Search NuGet package using the .NET CLI. Replace with the desired version. ```bash dotnet add package Algolia.Search --version ``` -------------------------------- ### Install @algolia/client-personalization with package manager Source: https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-javascript/packages/client-personalization/README.md Install the client package using yarn, npm, or pnpm. The package is already a dependency of the main algoliasearch client, so manual installation is only needed if you are not using that. ```bash yarn add @algolia/client-personalization@5.59.0 # or npm install @algolia/client-personalization@5.59.0 # or pnpm add @algolia/client-personalization@5.59.0 ``` -------------------------------- ### Install @algolia/abtesting with a package manager Source: https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-javascript/packages/abtesting/README.md Install the client using yarn, npm, or pnpm. The version is pinned to 1.25.0. ```bash yarn add @algolia/abtesting@1.25.0 # or npm install @algolia/abtesting@1.25.0 # or pnpm add @algolia/abtesting@1.25.0 ``` -------------------------------- ### Install @algolia/recommend with a package manager Source: https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-javascript/packages/recommend/README.md Install the @algolia/recommend package version 5.59.0 using yarn, npm, or pnpm. The package is a dependency of the main algoliasearch client, so it may already be installed. ```bash yarn add @algolia/recommend@5.59.0 # or npm install @algolia/recommend@5.59.0 # or pnpm add @algolia/recommend@5.59.0 ``` -------------------------------- ### Project CLI Commands Source: https://github.com/algolia/api-clients-automation/blob/main/AGENTS.md Commands for setup, generation, testing, formatting, and release. Includes options like --docs and --dry-run. ```bash # Setup nvm use && yarn # Install dependencies yarn docker:setup # Setup Docker environment # Generation yarn cli generate javascript # Generate all JS clients yarn cli generate python search # Generate Python search client yarn cli build specs # Bundle OpenAPI specs yarn cli build specs --docs # Build specs with doc snippets # Testing yarn cli cts generate [lang] # Generate CTS tests yarn cli cts run [lang] # Run CTS tests yarn cli playground {lang} {client} # Run interactive playground # Formatting yarn cli format {language} {folder} # Release yarn cli release # Create release PR yarn cli release --dry-run # Test release without pushing ``` -------------------------------- ### Create client, save object, wait for task, and search Source: https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-php/README.md PHP example showing how to import the SearchClient, create a client with your app ID and API key, save a record, wait for indexing, and perform a search with typo tolerance. Replace placeholders like and with your actual values. ```php use Algolia\AlgoliaSearch\Api\SearchClient; $client = SearchClient::create('', ''); // Add a new record to your Algolia index $response = $client->saveObject( '', ['objectID' => 'id', 'test' => 'val', ], ); // play with the response var_dump($response); // Poll the task status to know when it has been indexed $client->waitForTask('', $response['taskID']); // Fetch search results, with typo tolerance $response = $client->search( ['requests' => [ ['indexName' => '', 'query' => '', 'hitsPerPage' => 50, ], ], ], ); // play with the response var_dump($response); ``` -------------------------------- ### Install the Algolia Ruby client with gem install Source: https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-ruby/README.md Install the Algolia Ruby API client using the RubyGems package manager. ```bash gem install algolia ``` -------------------------------- ### Example User-Agent Source: https://github.com/algolia/api-clients-automation/blob/main/website/docs/add-a-new-language.md Example of a User-Agent string built from the base, client, and segments. The order of segments is arbitrary. ```text Algolia for Java (4.0.0); JVM (11.0.14); Search (4.0.0); experimental ; test (8.0.0-beta) ``` -------------------------------- ### Install @algolia/client-search with package managers Source: https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-javascript/packages/client-search/README.md Install the client package using yarn, npm, or pnpm. The version is pinned to 5.59.0. ```bash yarn add @algolia/client-search@5.59.0 # or npm install @algolia/client-search@5.59.0 # or pnpm add @algolia/client-search@5.59.0 ``` -------------------------------- ### Install Algolia Python API Client with pip Source: https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-python/README.md Install the Algolia Python API Client using pip. The command installs version 4.x, which is required for the examples on this page. ```bash pip install --upgrade 'algoliasearch>=4.0,<5.0' ``` -------------------------------- ### Install @algolia/monitoring with package managers Source: https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-javascript/packages/monitoring/README.md Install the @algolia/monitoring@1.59.0 package using yarn, npm, or pnpm. ```bash yarn add @algolia/monitoring@1.59.0 # or npm install @algolia/monitoring@1.59.0 # or pnpm add @algolia/monitoring@1.59.0 ``` -------------------------------- ### Install dependencies with yarn Source: https://github.com/algolia/api-clients-automation/blob/main/website/README.md Run this command in the project root to install all required dependencies for the Docusaurus website. ```bash $ yarn ``` -------------------------------- ### Mount Docker images with yarn docker:setup Source: https://github.com/algolia/api-clients-automation/blob/main/website/docs/setup-repository.md Runs the Docker setup script to build and mount the required Docker images for the project. ```bash yarn docker:setup ``` -------------------------------- ### Initialize client and save an object Source: https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-python/README.md Import the SearchClient, initialize it with your app ID and API key, and save a new record to your index. The example shows how to print the response and its JSON representation, and how to wait for the indexing task to complete. ```python from algoliasearch.search.client import SearchClient _client = SearchClient("YOUR_APP_ID", "YOUR_API_KEY") # Add a new record to your Algolia index response = await _client.save_object( index_name="", body={ "objectID": "id", "test": "val", }, ) # use the class directly print(response) # print the JSON response print(response.to_json()) # Poll the task status to know when it has been indexed await client.wait_for_task(index_name="", task_id=response.task_id) ``` -------------------------------- ### Install @algolia/client-analytics with a package manager Source: https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-javascript/packages/client-analytics/README.md Install the client package using yarn, npm, or pnpm. The version is pinned to 5.59.0. ```bash yarn add @algolia/client-analytics@5.59.0 # or npm install @algolia/client-analytics@5.59.0 # or pnpm add @algolia/client-analytics@5.59.0 ``` -------------------------------- ### Build scope command usage Source: https://github.com/algolia/api-clients-automation/blob/main/website/docs/CLI/build-commands.md Shows the general syntax for building clients, playground, snippets, or guides. `language` and `client` default to `all`, and `client` is variadic. ```bash apic build ``` -------------------------------- ### Install @algolia/client-insights with package managers Source: https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-javascript/packages/client-insights/README.md Install the client package using yarn, npm, or pnpm. The version is pinned to 5.59.0. ```bash yarn add @algolia/client-insights@5.59.0 # or npm install @algolia/client-insights@5.59.0 # or pnpm add @algolia/client-insights@5.59.0 ``` -------------------------------- ### Install @algolia/ingestion with a package manager Source: https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-javascript/packages/ingestion/README.md Install the @algolia/ingestion package using yarn, npm, or pnpm. The package is a dependency of the main algoliasearch client, so it may already be installed. ```bash yarn add @algolia/ingestion@1.59.0 # or npm install @algolia/ingestion@1.59.0 # or pnpm add @algolia/ingestion@1.59.0 ``` -------------------------------- ### Install @algolia/advanced-personalization with a package manager Source: https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-javascript/packages/advanced-personalization/README.md Install the client using Yarn, npm, or pnpm. The package is available at version 0.0.1-alpha.48. ```bash yarn add @algolia/advanced-personalization@0.0.1-alpha.48 # or npm install @algolia/advanced-personalization@0.0.1-alpha.48 # or pnpm add @algolia/advanced-personalization@0.0.1-alpha.48 ``` -------------------------------- ### Install Algolia Swift client for Swift 3 from Git branch (CocoaPods) Source: https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-swift/README.md Use this CocoaPods directive to install the Algolia Swift client from the 'swift-3' branch of the GitHub repository. This is an alternative to the version-based installation for Swift 3 projects. ```ruby pod 'AlgoliaSearch-Client-Swift', :git => 'https://github.com/algolia/algoliasearch-client-swift.git', :branch => 'swift-3' ``` -------------------------------- ### Install Algolia PHP client with Composer Source: https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-php/README.md Install the Algolia PHP API client using Composer. Requires PHP ^8.0. ```bash composer require algolia/algoliasearch-client-php "^4.0" ``` -------------------------------- ### Install @algolia/composition with a package manager Source: https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-javascript/packages/composition/README.md Install the @algolia/composition package using your preferred package manager. The version is pinned to 1.34.0. ```bash yarn add @algolia/composition@1.34.0 # or npm install @algolia/composition@1.34.0 # or pnpm add @algolia/composition@1.34.0 ``` -------------------------------- ### Install Algolia Swift client for Swift 4 from Git branch (CocoaPods) Source: https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-swift/README.md Use this CocoaPods directive to install the Algolia Swift client from the 'swift-4' branch of the GitHub repository. This is an alternative to the version-based installation for Swift 4 projects. ```ruby pod 'AlgoliaSearch-Client-Swift', :git => 'https://github.com/algolia/algoliasearch-client-swift.git', :branch => 'swift-4' ``` -------------------------------- ### Run Renovate locally Source: https://github.com/algolia/api-clients-automation/blob/main/website/docs/setup-repository.md Installs Renovate globally and runs it locally with a dry run, using a GitHub token and debug logging. ```sh npm install -g renovate GITHUB_COM_TOKEN="" LOG_LEVEL=debug renovate --dry-run --platform local ``` -------------------------------- ### Install for Flutter projects with flutter pub add Source: https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-dart/packages/client_recommend/README.md Use this command in a Flutter project to add the algolia_client_recommend package as a dependency. ```shell flutter pub add algolia_client_recommend ``` -------------------------------- ### Install for Flutter projects Source: https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-dart/packages/client_search/README.md Adds the algolia_client_search package to a Flutter project using the flutter pub add command. ```shell flutter pub add algolia_client_search ``` -------------------------------- ### Client Directory Commands (requires Dart SDK + Melos) Source: https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-dart/AGENTS.md Run these commands from the client directory (clients/algoliasearch-client-dart) after ensuring Dart SDK and Melos are installed. They install dependencies, run tests across packages, format code, and analyze code. ```bash # From client directory (requires Dart SDK + Melos) cd clients/algoliasearch-client-dart melos bootstrap # Install dependencies melos run test # Run tests across packages dart format . # Format code dart analyze # Analyze code ``` -------------------------------- ### Install algoliasearch with package managers Source: https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-javascript/README.md Install the algoliasearch package version 5.59.0 using yarn, npm, or pnpm. All clients come with type definitions and are available for both browser and node environments. ```bash yarn add algoliasearch@5.59.0 # or npm install algoliasearch@5.59.0 # or pnpm add algoliasearch@5.59.0 ``` -------------------------------- ### Install for Dart projects Source: https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-dart/packages/client_search/README.md Adds the algolia_client_search package to a Dart project using the dart pub add command. ```shell dart pub add algolia_client_search ``` -------------------------------- ### Install for Dart projects with dart pub add Source: https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-dart/packages/client_recommend/README.md Use this command in a Dart project to add the algolia_client_recommend package as a dependency. ```shell dart pub add algolia_client_recommend ``` -------------------------------- ### Quick start: save object and search with Algolia Java client Source: https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-java/README.md Imports the SearchClient and model classes, creates a client with your application ID and API key, saves a record, waits for the task to complete, and performs a search with typo tolerance. Replace YOUR_APP_ID, YOUR_API_KEY, YOUR_INDEX_NAME, and YOUR_QUERY with your actual values. ```java import com.algolia.api.SearchClient; import com.algolia.model.search.*; SearchClient client = new SearchClient("YOUR_APP_ID", "YOUR_API_KEY"); // Add a new record to your Algolia index var response = client.saveObject("", Map.of("objectID", "id", "test", "val")); // Poll the task status to know when it has been indexed client.waitForTask("", response.getTaskID()); // Fetch search results, with typo tolerance client.search( new SearchMethodParams() .setRequests(List.of(new SearchForHits().setIndexName("").setQuery("").setHitsPerPage(50))), Hit.class ); ``` -------------------------------- ### Install Algolia Client Core for Flutter Source: https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-dart/packages/client_core/README.md Use this command to add the algolia_client_core package to a Flutter project. ```shell flutter pub add algolia_client_core ``` -------------------------------- ### Install Algolia Client Core for Dart Source: https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-dart/packages/client_core/README.md Use this command to add the algolia_client_core package to a Dart project. ```shell dart pub add algolia_client_core ``` -------------------------------- ### Generation Config Patterns for Swift Client Source: https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-swift/AGENTS.md Example patterns from 'config/generation.config.mjs' showing which Swift client paths are generated (no '!') and which are hand-written (with '!'). Use this to determine if a file is safe to edit. ```javascript // In generation.config.mjs - patterns WITHOUT '!' are GENERATED (do not edit) 'clients/algoliasearch-client-swift/**/Sources/**', // Generated '!clients/algoliasearch-client-swift/Sources/Core/**', // Hand-written ✓ '!clients/algoliasearch-client-swift/Sources/Search/Extra/**', // Hand-written ✓ ``` -------------------------------- ### Install for Flutter projects Source: https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-dart/packages/client_composition/README.md Add the Algolia Composition API Client as a dependency in a Flutter project using the flutter pub add command. ```shell flutter pub add algolia_client_composition ``` -------------------------------- ### Initialize the query suggestions client Source: https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-javascript/packages/client-query-suggestions/README.md Import the client and create an instance with your Algolia application ID and API key. Replace the placeholders with your actual credentials. ```js import { querySuggestionsClient } from '@algolia/client-query-suggestions'; const client = querySuggestionsClient('YOUR_APP_ID', 'YOUR_API_KEY'); ``` -------------------------------- ### Install for Flutter projects Source: https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-dart/packages/client_agent_studio/README.md Adds the Algolia Agent Studio API Client as a dependency to a Flutter project using the flutter pub add command. ```shell flutter pub add algolia_client_agent_studio ``` -------------------------------- ### Install for Dart projects Source: https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-dart/packages/client_composition/README.md Add the Algolia Composition API Client as a dependency in a Dart project using the dart pub add command. ```shell dart pub add algolia_client_composition ``` -------------------------------- ### Transporter creation example Source: https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-javascript/AGENTS.md Core transport configuration in packages/client-common/src/transporter/. Pass hosts, cache, requester, and caches for failover and deduplication. ```typescript // Core transport in packages/client-common/src/transporter/ createTransporter({ hosts, // Host[] - API hosts with failover hostsCache, // Cache for host state requester, // Pluggable HTTP implementation requestsCache, // Request deduplication responsesCache, // Response caching }); ``` -------------------------------- ### Path file structure for search endpoint Source: https://github.com/algolia/api-clients-automation/blob/main/specs/AGENTS.md Example path file for a search endpoint, showing the required structure with operationId, parameters, requestBody, and responses using $ref references. ```yaml # paths/search.yml post: operationId: search summary: Search for records tags: - search parameters: - $ref: '../common/parameters.yml#/indexName' requestBody: required: true content: application/json: schema: $ref: '../common/schemas.yml#/SearchParams' responses: '200': description: OK content: application/json: schema: $ref: '../common/schemas.yml#/SearchResponse' ``` -------------------------------- ### Async Context Examples Source: https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-dart/AGENTS.md Shows that await can only be used in async functions, and that top-level code requires an async main function. ```dart // Can only await in async functions Future myFunction() async { final response = await client.search(params); } // Top-level requires main void main() async { final response = await client.search(params); } ``` -------------------------------- ### Install for Dart projects Source: https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-dart/packages/client_agent_studio/README.md Adds the Algolia Agent Studio API Client as a dependency to a Dart project using the dart pub add command. ```shell dart pub add algolia_client_agent_studio ``` -------------------------------- ### Import and initialize the ingestion client Source: https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-javascript/packages/ingestion/README.md Import the ingestionClient from '@algolia/ingestion' and create a client instance with your Algolia application ID and API key. This is the starting point for using the API client. ```js import { ingestionClient } from '@algolia/ingestion'; const client = ingestionClient('YOUR_APP_ID', 'YOUR_API_KEY'); ``` -------------------------------- ### Transport Architecture Example Source: https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-ruby/AGENTS.md Shows the Transport class structure in lib/algolia/transport/. Initializes HTTP requester and retry strategy, and defines a request method with host failover. ```ruby # lib/algolia/transport/ class Transport def initialize(config) @http_requester = HttpRequester.new(config.app_id, config.api_key) @retry_strategy = RetryStrategy.new(config.hosts) end def request(method, path, body, opts) # Retry with host failover end end ``` -------------------------------- ### Transporter Architecture Example Source: https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-python/AGENTS.md Core transport class in algoliasearch/http/ showing the Transporter with retry strategy and async request method. ```python # Core transport in algoliasearch/http/ class Transporter(BaseTransporter): def __init__(self, config: BaseConfig): self._session: Optional[ClientSession] = None self._retry_strategy = RetryStrategy() async def request(self, verb, path, request_options, use_read_transporter): # Retry with host failover ``` -------------------------------- ### Import and initialize personalizationClient Source: https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-javascript/packages/client-personalization/README.md Import the personalizationClient from the package and create a client instance with your Algolia application ID and API key. This is the starting point for using the Personalization API. ```js import { personalizationClient } from '@algolia/client-personalization'; const client = personalizationClient('YOUR_APP_ID', 'YOUR_API_KEY'); ``` -------------------------------- ### Build, Test, and Lint Commands Source: https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-go/AGENTS.md Commands to build, generate tests, run tests, and format the Go client. Run from repo root or client directory as indicated. ```bash # From repo root (api-clients-automation) yarn cli build clients go # Build Go client yarn cli cts generate go # Generate CTS tests yarn cli cts run go # Run CTS tests yarn cli playground go search # Interactive playground yarn cli format go clients/algoliasearch-client-go # From client directory cd clients/algoliasearch-client-go go build ./... # Build all packages go test ./... # Run tests golangci-lint run # Run linter ``` -------------------------------- ### Build and test commands from client directory Source: https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-javascript/AGENTS.md Run these from the client directory for package-specific work. ```bash # From client directory (for package-specific work) cd clients/algoliasearch-client-javascript yarn build # Build packages yarn test # Run tests ``` -------------------------------- ### Mustache syntax example Source: https://github.com/algolia/api-clients-automation/blob/main/templates/AGENTS.md Illustrates core Mustache constructs: loops over operations, variable interpolation, conditionals, and partial includes. Comments are shown with {{! ... }}. ```mustache {{#operations}} {{! Loop over operations }} {{#operation}} {{operationId}} {{! Variable }} {{#hasParams}}...{{/hasParams}} {{! Conditional }} {{>partial_name}} {{! Include partial }} {{/operation}} {{/operations}} ``` -------------------------------- ### Build all clients Source: https://github.com/algolia/api-clients-automation/blob/main/website/docs/CLI/build-commands.md Builds all clients for all supported languages. ```bash apic build clients ``` -------------------------------- ### Example glob patterns from generation config Source: https://github.com/algolia/api-clients-automation/blob/main/clients/AGENTS.md Shows how to identify generated vs hand-written files using glob patterns in config/generation.config.mjs. Patterns without '!' are generated and should not be edited; patterns with '!' are hand-written and safe to edit. ```javascript 'clients/algoliasearch-client-go/algolia/**', // Generated '!clients/algoliasearch-client-go/algolia/transport/**', // Hand-written (safe) ``` -------------------------------- ### Build all specs Source: https://github.com/algolia/api-clients-automation/blob/main/website/docs/CLI/build-commands.md Builds all API specs. ```bash apic build specs ``` -------------------------------- ### Build and Test Commands for Kotlin Client Source: https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-kotlin/AGENTS.md Commands to build, test, and format the Kotlin client from the repo root and client directory. ```bash # From repo root (api-clients-automation) yarn cli build clients kotlin # Build Kotlin client yarn cli cts generate kotlin # Generate CTS tests yarn cli cts run kotlin # Run CTS tests yarn cli playground kotlin search # Interactive playground yarn cli format kotlin clients/algoliasearch-client-kotlin # From client directory cd clients/algoliasearch-client-kotlin ./gradlew build # Build all targets ./gradlew jvmTest # Run JVM tests ./gradlew spotlessApply # Apply formatting ``` -------------------------------- ### Import and initialize recommendClient Source: https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-javascript/packages/recommend/README.md Import the recommendClient from @algolia/recommend and initialize it with your Algolia application ID and API key. ```js import { recommendClient } from '@algolia/recommend'; const client = recommendClient('YOUR_APP_ID', 'YOUR_API_KEY'); ``` -------------------------------- ### Create a client and save an object Source: https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-ruby/README.md Create a SearchClient with your Application ID and API Key, then save an object to an index. ```ruby client = Algolia::SearchClient.create('YourApplicationID', 'YourAPIKey') client.save_object('your_index_name', {objectID: 1, name: 'Foo'}) ``` -------------------------------- ### Platform Differences with expect/actual Source: https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-kotlin/AGENTS.md Illustrates platform-specific implementations using expect and actual declarations. ```kotlin // Some APIs differ by platform // Check expect/actual declarations expect fun platformSpecificFunction() // JVM implementation actual fun platformSpecificFunction() { /* JVM code */ } ``` -------------------------------- ### Build specs command usage Source: https://github.com/algolia/api-clients-automation/blob/main/website/docs/CLI/build-commands.md Shows the general syntax for building specs. The `client` parameter is variadic and defaults to `all`. ```bash apic build specs ``` -------------------------------- ### Import and initialize Algolia client Source: https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-javascript/README.md Import the Algolia API client and initialize it with your application ID and API key. Shows both the full client and the lite client usage. ```js import { algoliasearch } from 'algoliasearch'; const client = algoliasearch('YOUR_APP_ID', 'YOUR_API_KEY'); // or with the lite client import { liteClient } from 'algoliasearch/lite'; const client = liteClient('YOUR_APP_ID', 'YOUR_API_KEY'); ``` -------------------------------- ### Build and Test Commands for Swift Client Source: https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-swift/AGENTS.md Commands to build, generate, run tests, and format the Swift client from the repository root and client directory. Requires Xcode/Swift toolchain for client directory commands. ```bash # From repo root (api-clients-automation) yarn cli build clients swift # Build Swift client yarn cli cts generate swift # Generate CTS tests yarn cli cts run swift # Run CTS tests yarn cli playground swift search # Interactive playground yarn cli format swift clients/algoliasearch-client-swift # From client directory (requires Xcode/Swift toolchain) cd clients/algoliasearch-client-swift swift build # Build package swift test # Run tests ``` -------------------------------- ### Import and initialize abtestingV3Client Source: https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-javascript/packages/abtesting/README.md Import the client and create an instance using your Algolia application ID and API key. ```js import { abtestingV3Client } from '@algolia/abtesting'; const client = abtestingV3Client('YOUR_APP_ID', 'YOUR_API_KEY'); ``` -------------------------------- ### Configuration Object Pattern Source: https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-ruby/AGENTS.md Shows how to create a configuration object with app_id, api_key, hosts, and timeouts. Use this pattern when initializing the client. ```ruby # Configuration object pattern config = Algolia::Configuration.new( app_id: 'APP_ID', api_key: 'API_KEY', hosts: [...], read_timeout: 5, write_timeout: 30 ) ``` -------------------------------- ### Install Algolia Swift client for Swift 4 (CocoaPods) Source: https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-swift/README.md Use this CocoaPods directive to install the Algolia Swift client version 8.19 or later for Swift 4 projects. The version constraint '~> 8.19' allows compatible updates within the 8.x series. ```ruby pod 'AlgoliaSearch-Client-Swift', '~> 8.19' ``` -------------------------------- ### Import and initialize searchClient Source: https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-javascript/packages/client-search/README.md Import the searchClient function and create a client instance with your Algolia application ID and API key. Replace the placeholders with your actual credentials. ```js import { searchClient } from '@algolia/client-search'; const client = searchClient('YOUR_APP_ID', 'YOUR_API_KEY'); ``` -------------------------------- ### Build and Test Commands Source: https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-scala/AGENTS.md Commands to build, test, and format the Scala client. Run from the repo root or the client directory as indicated. ```bash # From repo root (api-clients-automation) yarn cli build clients scala # Build Scala client yarn cli cts generate scala # Generate CTS tests yarn cli cts run scala # Run CTS tests yarn cli playground scala search # Interactive playground yarn cli format scala clients/algoliasearch-client-scala # From client directory cd clients/algoliasearch-client-scala sbt compile # Compile sbt test # Run tests sbt scalafmtAll # Format code ``` -------------------------------- ### Install Algolia Swift client for Swift 3 (CocoaPods) Source: https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-swift/README.md Use this CocoaPods directive to install the Algolia Swift client version 4.8.1 or later for Swift 3 projects. The version constraint '~> 4.8.1' allows compatible updates within the 4.x series. ```ruby pod 'AlgoliaSearch-Client-Swift', '~> 4.8.1' ``` -------------------------------- ### CocoaPods update command Source: https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-swift/README.md Runs pod update to install the dependencies specified in the Podfile. ```bash $ pod update ``` -------------------------------- ### Build and Test Commands Source: https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-python/AGENTS.md Commands to build, generate, run tests, and format the Python client from the repo root and from the client directory. ```bash # From repo root (api-clients-automation) yarn cli build clients python # Build Python client yarn cli cts generate python # Generate CTS tests yarn cli cts run python # Run CTS tests yarn cli playground python search # Interactive playground yarn cli format python clients/algoliasearch-client-python # From client directory (requires Poetry) cd clients/algoliasearch-client-python poetry install # Install dependencies poetry run pytest # Run tests poetry run pyright # Type check ``` -------------------------------- ### Suspend Function Declaration Source: https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-kotlin/AGENTS.md Shows that all API methods are suspend functions, using search as an example. ```kotlin // All API methods are suspend functions suspend fun search(params: SearchParams): SearchResponse ``` -------------------------------- ### Build & Test Commands: Gradle Commands from Client Directory Source: https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-java/AGENTS.md Commands to build, test, and format the Java client using the Gradle wrapper from the client directory. ```bash # From client directory cd clients/algoliasearch-client-java ./gradlew build # Build with Gradle ./gradlew test # Run tests ./gradlew spotlessApply # Apply formatting ``` -------------------------------- ### Type-only import example Source: https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-javascript/AGENTS.md Use 'import type' for type-only imports to avoid runtime overhead. ```typescript // Use 'import type' for type-only imports import type { SearchResponse } from './types'; ``` -------------------------------- ### Clean Docker containers and images Source: https://github.com/algolia/api-clients-automation/blob/main/website/docs/setup-repository.md Stops all containers and removes all images created by the Docker setup. ```bash docker compose down --rmi all ``` -------------------------------- ### Build and test commands from repo root Source: https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-javascript/AGENTS.md Run these from the api-clients-automation root to build, generate CTS tests, run tests, or launch the playground. ```bash # From repo root (api-clients-automation) yarn cli build clients javascript # Build all JS packages yarn cli cts generate javascript # Generate CTS tests yarn cli cts run javascript # Run CTS tests yarn cli playground javascript node search # Interactive playground yarn cli format javascript clients/algoliasearch-client-javascript ``` -------------------------------- ### Swift client initialization and usage Source: https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-swift/README.md Imports the Algolia packages, initializes the client with your app ID and API key, saves an object, waits for indexing, and performs a search. ```swift #if canImport(AlgoliaCore) import AlgoliaCore #endif import AlgoliaSearch let client = try SearchClient(appID: "YOUR_APP_ID", apiKey: "YOUR_API_KEY") // Add a new record to your Algolia index let response = try await client.saveObject( indexName: "", body: ["objectID": "id", "test": "val"] ) // Poll the task status to know when it has been indexed try await client.waitForTask(with: response.taskID, in: "") // Fetch search results, with typo tolerance let response: SearchResponses = try await client .search(searchMethodParams: SearchMethodParams(requests: [SearchQuery.searchForHits(SearchForHits( query: "", hitsPerPage: 50, indexName: "" ))])) ``` -------------------------------- ### Build specific spec Source: https://github.com/algolia/api-clients-automation/blob/main/website/docs/CLI/build-commands.md Builds the spec for the `recommend` client. ```bash apic build specs recommend ``` -------------------------------- ### Install Algolia Insights Client for Flutter Source: https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-dart/packages/client_insights/README.md Use this command in a Flutter project to add the algolia_client_insights package as a dependency. ```shell flutter pub add algolia_client_insights ``` -------------------------------- ### Using the Algolia Scala client Source: https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-scala/README.md Imports the SearchClient, creates a client with your app ID and API key, saves an object, waits for indexing, and performs a search with typo tolerance. Replace placeholders like YOUR_APP_ID and YOUR_INDEX_NAME. ```scala import algoliasearch.api.SearchClient val client = SearchClient(appId = "YOUR_APP_ID", apiKey = "YOUR_API_KEY") // Add a new record to your Algolia index val response = client.saveObject( indexName = "", body = JObject(List(JField("objectID", JString("id")), JField("test", JString("val")))) ) // Use the response val value = Await.result(response, Duration(100, "sec")) // Poll the task status to know when it has been indexed client.waitTask("", response.getTaskID()) // Fetch search results, with typo tolerance val response = client.search( searchMethodParams = SearchMethodParams( requests = Seq( SearchForHits( indexName = "", query = Some(""), hitsPerPage = Some(50) ) ) ) ) // Use the response val value = Await.result(response, Duration(100, "sec")) ``` -------------------------------- ### Install Algolia Insights Client for Dart Source: https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-dart/packages/client_insights/README.md Use this command in a Dart project to add the algolia_client_insights package as a dependency. ```shell dart pub add algolia_client_insights ``` -------------------------------- ### Initialize SearchClient and Perform Basic Operations Source: https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-csharp/README.md Initialize the Algolia Search client and perform basic operations: save an object, wait for indexing, and search with typo tolerance. Replace placeholders like YOUR_APP_ID, YOUR_API_KEY, and index/query names with your actual values. ```csharp using Algolia.Search.Clients; using Algolia.Search.Http; var client = new SearchClient(new SearchConfig("YOUR_APP_ID", "YOUR_API_KEY")); // Add a new record to your Algolia index var response = await client.SaveObjectAsync( "", new Dictionary { { "objectID", "id" }, { "test", "val" } } ); // Poll the task status to know when it has been indexed await client.WaitForTaskAsync("", response.TaskID); // Fetch search results, with typo tolerance var response = await client.SearchAsync( new SearchMethodParams { Requests = new List { new SearchQuery( new SearchForHits { IndexName = "", Query = "", HitsPerPage = 50, } ) }, } ); ``` -------------------------------- ### Extract JavaScript template with typescript-node generator Source: https://github.com/algolia/api-clients-automation/blob/main/website/docs/add-a-new-language.md Example for the JavaScript client using the typescript-node template. Outputs the template into templates/javascript/. ```bash apic exec java "yarn openapi-generator-cli author template -g typescript-node -o templates/javascript/" ``` -------------------------------- ### CLI commands for generate, build, test, and format Source: https://github.com/algolia/api-clients-automation/blob/main/clients/AGENTS.md Provides bash commands for common tasks: generating clients (all or specific), building clients and playgrounds, running CTS tests, launching interactive playgrounds, and formatting code. ```bash # Generate yarn cli generate javascript # All JS clients yarn cli generate python search # Python search only # Build yarn cli build clients javascript # Build JS clients yarn cli build playground go search # Build Go playground # Test yarn cli cts run javascript # Run JS CTS tests yarn cli playground python search # Interactive playground # Format yarn cli format javascript clients/algoliasearch-client-javascript ``` -------------------------------- ### Build and Test Commands Source: https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-ruby/AGENTS.md Commands to build, test, and format the Ruby client. Run from the repository root or client directory as indicated. ```bash # From repo root (api-clients-automation) yarn cli build clients ruby # Build Ruby client yarn cli cts generate ruby # Generate CTS tests yarn cli cts run ruby # Run CTS tests yarn cli playground ruby search # Interactive playground yarn cli format ruby clients/algoliasearch-client-ruby # From client directory cd clients/algoliasearch-client-ruby bundle install # Install dependencies bundle exec rake test # Run tests bundle exec rubocop # Run linter ``` -------------------------------- ### Build specific client for specific language Source: https://github.com/algolia/api-clients-automation/blob/main/website/docs/CLI/generate-commands.md Builds a specific client (e.g., `recommend`) for a specific language (e.g., `javascript`). ```bash apic build clients javascript recommend ``` -------------------------------- ### Generate all clients for all supported languages Source: https://github.com/algolia/api-clients-automation/blob/main/website/docs/CLI/generate-commands.md Runs the generator for all supported languages and clients. ```bash apic generate ``` -------------------------------- ### Check specs with yarn specs:lint Source: https://github.com/algolia/api-clients-automation/blob/main/website/docs/CLI/build-commands.md Checks the format of specs without overriding files. Example checks the `search` spec. ```bash yarn specs:lint search ``` -------------------------------- ### Build and Test Commands for C# Client Source: https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-csharp/AGENTS.md Commands to build, generate CTS tests, run CTS tests, and format the C# client from the repo root, and to build, test, and format from the client directory. ```bash # From repo root (api-clients-automation) yarn cli build clients csharp # Build C# client yarn cli cts generate csharp # Generate CTS tests yarn cli cts run csharp # Run CTS tests yarn cli format csharp clients/algoliasearch-client-csharp # From client directory cd clients/algoliasearch-client-csharp dotnet build # Build solution dotnet test # Run tests dotnet format # Format code ``` -------------------------------- ### Project structure tree Source: https://github.com/algolia/api-clients-automation/blob/main/clients/AGENTS.md Shows the directory layout of the clients folder, listing each language-specific client and its build tool. Each entry points to its own AGENTS.md for detailed guidance. ```text clients/ ├── algoliasearch-client-javascript/ # TypeScript/JavaScript (monorepo) → See AGENTS.md ├── algoliasearch-client-python/ # Python (Poetry) → See AGENTS.md ├── algoliasearch-client-java/ # Java (Gradle) → See AGENTS.md ├── algoliasearch-client-go/ # Go (modules) → See AGENTS.md ├── algoliasearch-client-ruby/ # Ruby (Bundler) → See AGENTS.md ├── algoliasearch-client-php/ # PHP (Composer) → See AGENTS.md ├── algoliasearch-client-kotlin/ # Kotlin (Gradle, multiplatform) → See AGENTS.md ├── algoliasearch-client-scala/ # Scala (SBT) → See AGENTS.md ├── algoliasearch-client-swift/ # Swift (SPM) → See AGENTS.md ├── algoliasearch-client-dart/ # Dart (Pub/Melos) → See AGENTS.md └── algoliasearch-client-csharp/ # C# (.NET) → See AGENTS.md ``` -------------------------------- ### Import and initialize compositionClient Source: https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-javascript/packages/composition/README.md Import the compositionClient and create a client instance with your Algolia application ID and API key. ```js import { compositionClient } from '@algolia/composition'; const client = compositionClient('YOUR_APP_ID', 'YOUR_API_KEY'); ``` -------------------------------- ### Retry Strategy Example Source: https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-ruby/AGENTS.md Shows the RetryStrategy class in lib/algolia/transport/retry_strategy.rb. Host states are :up, :down, :timed_out. Retries on network errors; 4xx errors are not retried. ```ruby # lib/algolia/transport/retry_strategy.rb class RetryStrategy # Host states: :up, :down, :timed_out # Retries on network errors # 4xx errors not retried end ``` -------------------------------- ### Initialize the agentStudioClient Source: https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-javascript/packages/agent-studio/README.md Import the client and initialize it with your Algolia application ID and API key. Replace the placeholder credentials with your own before using the client. ```js import { agentStudioClient } from '@algolia/agent-studio'; const client = agentStudioClient('YOUR_APP_ID', 'YOUR_API_KEY'); ``` -------------------------------- ### Build and test commands Source: https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-php/AGENTS.md Lists build and test commands. From repo root use yarn cli commands; from client directory use composer commands. ```bash # From repo root (api-clients-automation) yarn cli build clients php # Build PHP client yarn cli cts generate php # Generate CTS tests yarn cli cts run php # Run CTS tests yarn cli playground php search # Interactive playground yarn cli format php clients/algoliasearch-client-php # From client directory cd clients/algoliasearch-client-php composer install # Install dependencies composer test # Run tests composer cs-fix # Fix code style ``` -------------------------------- ### Suspend Functions in Kotlin Source: https://github.com/algolia/api-clients-automation/blob/main/clients/algoliasearch-client-kotlin/AGENTS.md Shows correct usage of suspend functions with runBlocking or coroutine scope. The first example is incorrect and will not compile outside a coroutine. ```kotlin // WRONG - can't call suspend outside coroutine val response = client.search(params) // CORRECT - use runBlocking or coroutine scope val response = runBlocking { client.search(params) } // Or in existing coroutine suspend fun myFunction() { val response = client.search(params) } ```