<?php

// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.

namespace Algolia\AlgoliaSearch\Api;

use Algolia\AlgoliaSearch\Algolia;
use Algolia\AlgoliaSearch\Configuration\AgentStudioConfig;
use Algolia\AlgoliaSearch\Model\AgentStudio\AgentCompletionRequest;
use Algolia\AlgoliaSearch\Model\AgentStudio\AgentConfigCreate;
use Algolia\AlgoliaSearch\Model\AgentStudio\AgentConfigUpdate;
use Algolia\AlgoliaSearch\Model\AgentStudio\AgentWithVersionResponse;
use Algolia\AlgoliaSearch\Model\AgentStudio\AllowedDomainBulkDelete;
use Algolia\AlgoliaSearch\Model\AgentStudio\AllowedDomainBulkInsert;
use Algolia\AlgoliaSearch\Model\AgentStudio\AllowedDomainCreate;
use Algolia\AlgoliaSearch\Model\AgentStudio\AllowedDomainListResponse;
use Algolia\AlgoliaSearch\Model\AgentStudio\AllowedDomainResponse;
use Algolia\AlgoliaSearch\Model\AgentStudio\ApplicationConfigPatch;
use Algolia\AlgoliaSearch\Model\AgentStudio\ApplicationConfigResponse;
use Algolia\AlgoliaSearch\Model\AgentStudio\ConversationFullResponse;
use Algolia\AlgoliaSearch\Model\AgentStudio\FeedbackCreationRequest;
use Algolia\AlgoliaSearch\Model\AgentStudio\FeedbackResponse;
use Algolia\AlgoliaSearch\Model\AgentStudio\PaginatedAgentsResponse;
use Algolia\AlgoliaSearch\Model\AgentStudio\PaginatedConversationsResponse;
use Algolia\AlgoliaSearch\Model\AgentStudio\PaginatedProviderAuthenticationsResponse;
use Algolia\AlgoliaSearch\Model\AgentStudio\PaginatedSecretKeysResponse;
use Algolia\AlgoliaSearch\Model\AgentStudio\ProviderAuthenticationCreate;
use Algolia\AlgoliaSearch\Model\AgentStudio\ProviderAuthenticationPatch;
use Algolia\AlgoliaSearch\Model\AgentStudio\ProviderAuthenticationResponse;
use Algolia\AlgoliaSearch\Model\AgentStudio\SecretKeyCreate;
use Algolia\AlgoliaSearch\Model\AgentStudio\SecretKeyPatch;
use Algolia\AlgoliaSearch\Model\AgentStudio\SecretKeyResponse;
use Algolia\AlgoliaSearch\Model\AgentStudio\UserDataResponse;
use Algolia\AlgoliaSearch\ObjectSerializer;
use Algolia\AlgoliaSearch\RetryStrategy\AlgoliaResponse;
use Algolia\AlgoliaSearch\RetryStrategy\ApiWrapper;
use Algolia\AlgoliaSearch\RetryStrategy\ApiWrapperInterface;
use Algolia\AlgoliaSearch\RetryStrategy\ClusterHosts;
use GuzzleHttp\Psr7\Query;

/**
 * AgentStudioClient Class Doc Comment.
 *
 * @category Class
 */
class AgentStudioClient
{
    public const VERSION = '4.46.2';

    /**
     * @var ApiWrapperInterface
     */
    protected $api;

    /**
     * @var AgentStudioConfig
     */
    protected $config;

    public function __construct(ApiWrapperInterface $apiWrapper, AgentStudioConfig $config)
    {
        $this->config = $config;
        $this->api = $apiWrapper;
    }

    /**
     * Instantiate the client with basic credentials.
     *
     * @param string $appId  Application ID
     * @param string $apiKey Algolia API Key
     */
    public static function create($appId = null, $apiKey = null)
    {
        return static::createWithConfig(AgentStudioConfig::create($appId, $apiKey));
    }

    /**
     * Instantiate the client with configuration.
     *
     * @param AgentStudioConfig $config Configuration
     */
    public static function createWithConfig(AgentStudioConfig $config)
    {
        $config = clone $config;

        $apiWrapper = new ApiWrapper(
            Algolia::getHttpClient(),
            $config,
            self::getClusterHosts($config)
        );

        $client = new static($apiWrapper, $config);

        $logger = Algolia::getLogger();
        $logger->info('Algolia API client: Algolia AgentStudioClient initialized (appId: '.$config->getAppId().')');
        Algolia::logDebugWarningOnce();

        return $client;
    }

    /**
     * Gets the cluster hosts depending on the config.
     *
     * @return ClusterHosts
     */
    public static function getClusterHosts(AgentStudioConfig $config)
    {
        $cacheKey = sprintf('%s-clusterHosts-%s', __CLASS__, $config->getAppId());

        if ($hosts = $config->getHosts()) {
            // If a list of hosts was passed, we ignore the cache
            $clusterHosts = ClusterHosts::create($hosts);
        } elseif (false === ($clusterHosts = ClusterHosts::createFromCache($cacheKey))) {
            // We'll try to restore the ClusterHost from cache, if we cannot
            // we create a new instance and set the cache key
            $clusterHosts = ClusterHosts::createFromAppId($config->getAppId())
                ->setCacheKey($cacheKey)
            ;
        }

        return $clusterHosts;
    }

    /**
     * @return AgentStudioConfig
     */
    public function getClientConfig()
    {
        return $this->config;
    }

    /**
     * Stub method setting a new API key to authenticate requests.
     *
     * @param string $apiKey
     */
    public function setClientApiKey($apiKey)
    {
        $this->config->setClientApiKey($apiKey);
    }

    /**
     * Add multiple allowed domain patterns. Duplicates are skipped.
     *
     * Required API Key ACLs:
     *  - editSettings
     *
     * @param string                        $agentId                 The agentId. (required)
     * @param AllowedDomainBulkInsert|array $allowedDomainBulkInsert allowedDomainBulkInsert (required)
     *                                                               - $allowedDomainBulkInsert['domains'] => (array) List of domain patterns to add. (required)
     *
     * @see AllowedDomainBulkInsert
     *
     * @param array $requestOptions the requestOptions to send along with the query, they will be merged with the transporter requestOptions
     *
     * @return AllowedDomainListResponse|array<string, mixed>
     */
    public function bulkCreateAllowedDomains($agentId, $allowedDomainBulkInsert, $requestOptions = [])
    {
        $response = $this->bulkCreateAllowedDomainsWithHttpInfo($agentId, $allowedDomainBulkInsert, $requestOptions);

        return $response->getData();
    }

    /**
     * Delete allowed domains by id list.
     *
     * Required API Key ACLs:
     *  - editSettings
     *
     * @param string                        $agentId                 The agentId. (required)
     * @param AllowedDomainBulkDelete|array $allowedDomainBulkDelete allowedDomainBulkDelete (required)
     *                                                               - $allowedDomainBulkDelete['domainIds'] => (array) IDs of allowed domain records to delete. (required)
     *
     * @see AllowedDomainBulkDelete
     *
     * @param array $requestOptions the requestOptions to send along with the query, they will be merged with the transporter requestOptions
     */
    public function bulkDeleteAllowedDomains($agentId, $allowedDomainBulkDelete, $requestOptions = [])
    {
        $response = $this->bulkDeleteAllowedDomainsWithHttpInfo($agentId, $allowedDomainBulkDelete, $requestOptions);

        return $response->getData();
    }

    /**
     * Create a new agent.
     *
     * Required API Key ACLs:
     *  - editSettings
     *
     * @param AgentConfigCreate|array $agentConfigCreate agentConfigCreate (required)
     *                                                   - $agentConfigCreate['name'] => (string)  (required)
     *                                                   - $agentConfigCreate['description'] => (string)
     *                                                   - $agentConfigCreate['providerId'] => (string)
     *                                                   - $agentConfigCreate['model'] => (string)
     *                                                   - $agentConfigCreate['instructions'] => (string) The agent prompt: defines the agent's role, tone, and goals. Guides how it answers using the provided context. Corresponds to the 'Agent prompt' field in the dashboard. (required)
     *                                                   - $agentConfigCreate['systemPrompt'] => (string) The system prompt: defines system-level rules and constraints. Guides how the agent uses tools, features, and generates context. Prepended before `instructions` in the final prompt sent to the LLM. Typically injected by an agent template — modify with caution, as changes may affect behavior, tool usage, or response accuracy. Corresponds to the 'System prompt' field in the dashboard.
     *                                                   - $agentConfigCreate['templateType'] => (string)
     *                                                   - $agentConfigCreate['config'] => (array)
     *                                                   - $agentConfigCreate['tools'] => (array)
     *
     * @see AgentConfigCreate
     *
     * @param array $requestOptions the requestOptions to send along with the query, they will be merged with the transporter requestOptions
     *
     * @return AgentWithVersionResponse|array<string, mixed>
     */
    public function createAgent($agentConfigCreate, $requestOptions = [])
    {
        $response = $this->createAgentWithHttpInfo($agentConfigCreate, $requestOptions);

        return $response->getData();
    }

    /**
     * Add a single allowed domain pattern (e.g. https://app.example.com or *.example.com).
     *
     * Required API Key ACLs:
     *  - editSettings
     *
     * @param string                    $agentId             The agentId. (required)
     * @param AllowedDomainCreate|array $allowedDomainCreate allowedDomainCreate (required)
     *                                                       - $allowedDomainCreate['domain'] => (string) Domain or pattern, e.g. https://app.example.com or *.example.com. (required)
     *
     * @see AllowedDomainCreate
     *
     * @param array $requestOptions the requestOptions to send along with the query, they will be merged with the transporter requestOptions
     *
     * @return AllowedDomainResponse|array<string, mixed>
     */
    public function createAgentAllowedDomain($agentId, $allowedDomainCreate, $requestOptions = [])
    {
        $response = $this->createAgentAllowedDomainWithHttpInfo($agentId, $allowedDomainCreate, $requestOptions);

        return $response->getData();
    }

    /**
     * Create a completion for the specified agent.  This endpoint handles two types of requests: 1. Normal completion request: User message -> Agent response 2. Tool approval response: User approval -> Execute tool -> Agent response  Tool Approval Flow (for MCP tools with requiresApproval: true): - Request 1: User sends message -> Agent requests tool call -> Return approval request - Request 2: User approves -> Execute tool -> Agent continues with result.
     *
     * Required API Key ACLs:
     *  - search
     *
     * @param string                       $agentId                The agentId. (required)
     * @param array                        $compatibilityMode      Compatibility mode for the completion API. (required)
     * @param AgentCompletionRequest|array $agentCompletionRequest agentCompletionRequest (required)
     *                                                             - $agentCompletionRequest['configuration'] => (array)
     *                                                             - $agentCompletionRequest['messages'] => (array)
     *                                                             - $agentCompletionRequest['id'] => (string) Optional conversation id.
     *                                                             - $agentCompletionRequest['algolia'] => (array)
     *                                                             - $agentCompletionRequest['toolApprovals'] => (array) Approval decisions for pending tool calls keyed by toolCallId.
     *
     * @see AgentCompletionRequest
     *
     * @param bool   $stream                  Whether to stream the response or not. (optional, default to true)
     * @param bool   $cache                   Use cached responses if available. (optional, default to true)
     * @param bool   $memory                  Set to false to disable memory (enabled by default). (optional)
     * @param bool   $analytics               Set to false to skip analytics for this completion (default: true). Disables Agent Studio BigQuery analytics, Algolia search analytics, click analytics, and query-suggestions training. Useful for offline-eval workflows. (optional, default to true)
     * @param string $xAlgoliaSecureUserToken The X-Algolia-Secure-User-Token. (optional)
     * @param array  $requestOptions          the requestOptions to send along with the query, they will be merged with the transporter requestOptions
     *
     * @return array<string, mixed>|array<string,mixed>
     */
    public function createAgentCompletion($agentId, $compatibilityMode, $agentCompletionRequest, $stream = null, $cache = null, $memory = null, $analytics = null, $xAlgoliaSecureUserToken = null, $requestOptions = [])
    {
        $response = $this->createAgentCompletionWithHttpInfo($agentId, $compatibilityMode, $agentCompletionRequest, $stream, $cache, $memory, $analytics, $xAlgoliaSecureUserToken, $requestOptions);

        return $response->getData();
    }

    /**
     * Create new feedback entry.
     *
     * Required API Key ACLs:
     *  - search
     *
     * @param array|FeedbackCreationRequest $feedbackCreationRequest feedbackCreationRequest (required)
     *                                                               - $feedbackCreationRequest['messageId'] => (string)  (required)
     *                                                               - $feedbackCreationRequest['agentId'] => (string)  (required)
     *                                                               - $feedbackCreationRequest['vote'] => (array)  (required)
     *                                                               - $feedbackCreationRequest['tags'] => (array)
     *                                                               - $feedbackCreationRequest['notes'] => (string)
     *
     * @see FeedbackCreationRequest
     *
     * @param array $requestOptions the requestOptions to send along with the query, they will be merged with the transporter requestOptions
     *
     * @return array<string, mixed>|FeedbackResponse
     */
    public function createFeedback($feedbackCreationRequest, $requestOptions = [])
    {
        $response = $this->createFeedbackWithHttpInfo($feedbackCreationRequest, $requestOptions);

        return $response->getData();
    }

    /**
     * Create Provider.
     *
     * Required API Key ACLs:
     *  - editSettings
     *
     * @param array|ProviderAuthenticationCreate $providerAuthenticationCreate providerAuthenticationCreate (required)
     *                                                                         - $providerAuthenticationCreate['name'] => (string)  (required)
     *                                                                         - $providerAuthenticationCreate['providerName'] => (array)  (required)
     *                                                                         - $providerAuthenticationCreate['input'] => (array)  (required)
     *
     * @see ProviderAuthenticationCreate
     *
     * @param array $requestOptions the requestOptions to send along with the query, they will be merged with the transporter requestOptions
     *
     * @return array<string, mixed>|ProviderAuthenticationResponse
     */
    public function createProvider($providerAuthenticationCreate, $requestOptions = [])
    {
        $response = $this->createProviderWithHttpInfo($providerAuthenticationCreate, $requestOptions);

        return $response->getData();
    }

    /**
     * Create Secret Key.
     *
     * Required API Key ACLs:
     *  - admin
     *
     * @param array|SecretKeyCreate $secretKeyCreate secretKeyCreate (required)
     *                                               - $secretKeyCreate['name'] => (string) The name of the secret key. (required)
     *                                               - $secretKeyCreate['agentIds'] => (array) List of agent IDs this secret key is associated with.
     *
     * @see SecretKeyCreate
     *
     * @param array $requestOptions the requestOptions to send along with the query, they will be merged with the transporter requestOptions
     *
     * @return array<string, mixed>|SecretKeyResponse
     */
    public function createSecretKey($secretKeyCreate, $requestOptions = [])
    {
        $response = $this->createSecretKeyWithHttpInfo($secretKeyCreate, $requestOptions);

        return $response->getData();
    }

    /**
     * This method lets you send requests to the Algolia REST API.
     *
     * @param string $path           Path of the endpoint, for example `1/newFeature`. (required)
     * @param array  $parameters     Query parameters to apply to the current query. (optional)
     * @param array  $requestOptions the requestOptions to send along with the query, they will be merged with the transporter requestOptions
     *
     * @return array<string, mixed>|object
     */
    public function customDelete($path, $parameters = null, $requestOptions = [])
    {
        $response = $this->customDeleteWithHttpInfo($path, $parameters, $requestOptions);

        return $response->getData();
    }

    /**
     * This method lets you send requests to the Algolia REST API.
     *
     * @param string $path           Path of the endpoint, for example `1/newFeature`. (required)
     * @param array  $parameters     Query parameters to apply to the current query. (optional)
     * @param array  $requestOptions the requestOptions to send along with the query, they will be merged with the transporter requestOptions
     *
     * @return array<string, mixed>|object
     */
    public function customGet($path, $parameters = null, $requestOptions = [])
    {
        $response = $this->customGetWithHttpInfo($path, $parameters, $requestOptions);

        return $response->getData();
    }

    /**
     * This method lets you send requests to the Algolia REST API.
     *
     * @param string $path           Path of the endpoint, for example `1/newFeature`. (required)
     * @param array  $parameters     Query parameters to apply to the current query. (optional)
     * @param array  $body           Parameters to send with the custom request. (optional)
     * @param array  $requestOptions the requestOptions to send along with the query, they will be merged with the transporter requestOptions
     *
     * @return array<string, mixed>|object
     */
    public function customPost($path, $parameters = null, $body = null, $requestOptions = [])
    {
        $response = $this->customPostWithHttpInfo($path, $parameters, $body, $requestOptions);

        return $response->getData();
    }

    /**
     * This method lets you send requests to the Algolia REST API.
     *
     * @param string $path           Path of the endpoint, for example `1/newFeature`. (required)
     * @param array  $parameters     Query parameters to apply to the current query. (optional)
     * @param array  $body           Parameters to send with the custom request. (optional)
     * @param array  $requestOptions the requestOptions to send along with the query, they will be merged with the transporter requestOptions
     *
     * @return array<string, mixed>|object
     */
    public function customPut($path, $parameters = null, $body = null, $requestOptions = [])
    {
        $response = $this->customPutWithHttpInfo($path, $parameters, $body, $requestOptions);

        return $response->getData();
    }

    /**
     * Delete the specified agent.
     *
     * Required API Key ACLs:
     *  - editSettings
     *
     * @param string $agentId        The agentId. (required)
     * @param array  $requestOptions the requestOptions to send along with the query, they will be merged with the transporter requestOptions
     */
    public function deleteAgent($agentId, $requestOptions = [])
    {
        $response = $this->deleteAgentWithHttpInfo($agentId, $requestOptions);

        return $response->getData();
    }

    /**
     * Deletes the conversations matching the given filers.
     *
     * Required API Key ACLs:
     *  - logs
     *
     * @param string $agentId        The agentId. (required)
     * @param string $startDate      Filter conversations created after this date (format: YYYY-MM-DD). (optional)
     * @param string $endDate        Filter conversations created before this date (format: YYYY-MM-DD). (optional)
     * @param array  $requestOptions the requestOptions to send along with the query, they will be merged with the transporter requestOptions
     */
    public function deleteAgentConversations($agentId, $startDate = null, $endDate = null, $requestOptions = [])
    {
        $response = $this->deleteAgentConversationsWithHttpInfo($agentId, $startDate, $endDate, $requestOptions);

        return $response->getData();
    }

    /**
     * Remove an allowed domain by id.
     *
     * Required API Key ACLs:
     *  - editSettings
     *
     * @param string $domainId       The domainId. (required)
     * @param string $agentId        The agentId. (required)
     * @param array  $requestOptions the requestOptions to send along with the query, they will be merged with the transporter requestOptions
     */
    public function deleteAllowedDomain($domainId, $agentId, $requestOptions = [])
    {
        $response = $this->deleteAllowedDomainWithHttpInfo($domainId, $agentId, $requestOptions);

        return $response->getData();
    }

    /**
     * Deletes the conversation with the given ID.
     *
     * Required API Key ACLs:
     *  - logs
     *
     * @param string $conversationId The conversationId. (required)
     * @param string $agentId        The agentId. (required)
     * @param array  $requestOptions the requestOptions to send along with the query, they will be merged with the transporter requestOptions
     */
    public function deleteConversation($conversationId, $agentId, $requestOptions = [])
    {
        $response = $this->deleteConversationWithHttpInfo($conversationId, $agentId, $requestOptions);

        return $response->getData();
    }

    /**
     * Delete Provider.
     *
     * Required API Key ACLs:
     *  - editSettings
     *
     * @param string $providerId     The providerId. (required)
     * @param array  $requestOptions the requestOptions to send along with the query, they will be merged with the transporter requestOptions
     */
    public function deleteProvider($providerId, $requestOptions = [])
    {
        $response = $this->deleteProviderWithHttpInfo($providerId, $requestOptions);

        return $response->getData();
    }

    /**
     * Delete Secret Key.
     *
     * Required API Key ACLs:
     *  - admin
     *
     * @param string $secretKeyId    The secretKeyId. (required)
     * @param array  $requestOptions the requestOptions to send along with the query, they will be merged with the transporter requestOptions
     */
    public function deleteSecretKey($secretKeyId, $requestOptions = [])
    {
        $response = $this->deleteSecretKeyWithHttpInfo($secretKeyId, $requestOptions);

        return $response->getData();
    }

    /**
     * Permanently deletes all messages for the given user token. Does not delete conversations.
     *
     * Required API Key ACLs:
     *  - logs
     *
     * @param string $userToken      The userToken. (required)
     * @param array  $requestOptions the requestOptions to send along with the query, they will be merged with the transporter requestOptions
     */
    public function deleteUserData($userToken, $requestOptions = [])
    {
        $response = $this->deleteUserDataWithHttpInfo($userToken, $requestOptions);

        return $response->getData();
    }

    /**
     * Exports all conversations based on the passed filters.
     *
     * Required API Key ACLs:
     *  - logs
     *
     * @param string $agentId        The agentId. (required)
     * @param string $startDate      Filter conversations created after this date (format: YYYY-MM-DD). (optional)
     * @param string $endDate        Filter conversations created before this date (format: YYYY-MM-DD). (optional)
     * @param array  $requestOptions the requestOptions to send along with the query, they will be merged with the transporter requestOptions
     *
     * @return array<string, mixed>|ConversationFullResponse[]
     */
    public function exportConversations($agentId, $startDate = null, $endDate = null, $requestOptions = [])
    {
        $response = $this->exportConversationsWithHttpInfo($agentId, $startDate, $endDate, $requestOptions);

        return $response->getData();
    }

    /**
     * Retrieve details of the specified agent.
     *
     * Required API Key ACLs:
     *  - settings
     *
     * @param string $agentId        The agentId. (required)
     * @param array  $requestOptions the requestOptions to send along with the query, they will be merged with the transporter requestOptions
     *
     * @return AgentWithVersionResponse|array<string, mixed>
     */
    public function getAgent($agentId, $requestOptions = [])
    {
        $response = $this->getAgentWithHttpInfo($agentId, $requestOptions);

        return $response->getData();
    }

    /**
     * Get a single allowed domain by id.
     *
     * Required API Key ACLs:
     *  - settings
     *
     * @param string $domainId       The domainId. (required)
     * @param string $agentId        The agentId. (required)
     * @param array  $requestOptions the requestOptions to send along with the query, they will be merged with the transporter requestOptions
     *
     * @return AllowedDomainResponse|array<string, mixed>
     */
    public function getAllowedDomain($domainId, $agentId, $requestOptions = [])
    {
        $response = $this->getAllowedDomainWithHttpInfo($domainId, $agentId, $requestOptions);

        return $response->getData();
    }

    /**
     * Get Configuration.
     *
     * Required API Key ACLs:
     *  - logs
     *
     * @param array $requestOptions the requestOptions to send along with the query, they will be merged with the transporter requestOptions
     *
     * @return ApplicationConfigResponse|array<string, mixed>
     */
    public function getConfiguration($requestOptions = [])
    {
        $response = $this->getConfigurationWithHttpInfo($requestOptions);

        return $response->getData();
    }

    /**
     * Retrieves the conversation and its messages for the given ID.
     *
     * Required API Key ACLs:
     *  - logs
     *
     * @param string $conversationId          The conversationId. (required)
     * @param string $agentId                 The agentId. (required)
     * @param bool   $includeFeedback         Include feedback for the conversation. (optional, default to false)
     * @param string $xAlgoliaSecureUserToken The X-Algolia-Secure-User-Token. (optional)
     * @param array  $requestOptions          the requestOptions to send along with the query, they will be merged with the transporter requestOptions
     *
     * @return array<string, mixed>|ConversationFullResponse
     */
    public function getConversation($conversationId, $agentId, $includeFeedback = null, $xAlgoliaSecureUserToken = null, $requestOptions = [])
    {
        $response = $this->getConversationWithHttpInfo($conversationId, $agentId, $includeFeedback, $xAlgoliaSecureUserToken, $requestOptions);

        return $response->getData();
    }

    /**
     * Get Provider.
     *
     * Required API Key ACLs:
     *  - settings
     *
     * @param string $providerId     The providerId. (required)
     * @param array  $requestOptions the requestOptions to send along with the query, they will be merged with the transporter requestOptions
     *
     * @return array<string, mixed>|ProviderAuthenticationResponse
     */
    public function getProvider($providerId, $requestOptions = [])
    {
        $response = $this->getProviderWithHttpInfo($providerId, $requestOptions);

        return $response->getData();
    }

    /**
     * Get Secret Key.
     *
     * Required API Key ACLs:
     *  - settings
     *
     * @param string $secretKeyId    The secretKeyId. (required)
     * @param array  $requestOptions the requestOptions to send along with the query, they will be merged with the transporter requestOptions
     *
     * @return array<string, mixed>|SecretKeyResponse
     */
    public function getSecretKey($secretKeyId, $requestOptions = [])
    {
        $response = $this->getSecretKeyWithHttpInfo($secretKeyId, $requestOptions);

        return $response->getData();
    }

    /**
     * Retrieves all memories, conversations and their messages for the given user token.
     *
     * Required API Key ACLs:
     *  - logs
     *
     * @param string $userToken      The userToken. (required)
     * @param array  $requestOptions the requestOptions to send along with the query, they will be merged with the transporter requestOptions
     *
     * @return array<string, mixed>|UserDataResponse
     */
    public function getUserData($userToken, $requestOptions = [])
    {
        $response = $this->getUserDataWithHttpInfo($userToken, $requestOptions);

        return $response->getData();
    }

    /**
     * Invalidate cached completions for this agent. Filter with `before` (exclusive).
     *
     * Required API Key ACLs:
     *  - editSettings
     *
     * @param string $agentId        The agentId. (required)
     * @param string $before         Delete entries strictly before this date (exclusive, YYYY-MM-DD). (optional)
     * @param array  $requestOptions the requestOptions to send along with the query, they will be merged with the transporter requestOptions
     */
    public function invalidateAgentCache($agentId, $before = null, $requestOptions = [])
    {
        $response = $this->invalidateAgentCacheWithHttpInfo($agentId, $before, $requestOptions);

        return $response->getData();
    }

    /**
     * List all allowed domain patterns for this agent.
     *
     * Required API Key ACLs:
     *  - settings
     *
     * @param string $agentId        The agentId. (required)
     * @param array  $requestOptions the requestOptions to send along with the query, they will be merged with the transporter requestOptions
     *
     * @return AllowedDomainListResponse|array<string, mixed>
     */
    public function listAgentAllowedDomains($agentId, $requestOptions = [])
    {
        $response = $this->listAgentAllowedDomainsWithHttpInfo($agentId, $requestOptions);

        return $response->getData();
    }

    /**
     * Retrieves the conversations for the given agent ID.
     *
     * Required API Key ACLs:
     *  - logs
     *
     * @param string $agentId                 The agentId. (required)
     * @param string $startDate               Filter conversations created after this date (format: YYYY-MM-DD). (optional)
     * @param string $endDate                 Filter conversations created before this date (format: YYYY-MM-DD). (optional)
     * @param bool   $includeFeedback         Include feedback per conversation. (optional)
     * @param int    $feedbackVote            Filter by feedback value (requires includeFeedback=true). (optional)
     * @param int    $page                    Page number. (optional, default to 1)
     * @param int    $limit                   Items per page. (optional, default to 20)
     * @param string $xAlgoliaSecureUserToken The X-Algolia-Secure-User-Token. (optional)
     * @param array  $requestOptions          the requestOptions to send along with the query, they will be merged with the transporter requestOptions
     *
     * @return array<string, mixed>|PaginatedConversationsResponse
     */
    public function listAgentConversations($agentId, $startDate = null, $endDate = null, $includeFeedback = null, $feedbackVote = null, $page = null, $limit = null, $xAlgoliaSecureUserToken = null, $requestOptions = [])
    {
        $response = $this->listAgentConversationsWithHttpInfo($agentId, $startDate, $endDate, $includeFeedback, $feedbackVote, $page, $limit, $xAlgoliaSecureUserToken, $requestOptions);

        return $response->getData();
    }

    /**
     * List all agents with pagination and filtering.
     *
     * Required API Key ACLs:
     *  - settings
     *
     * @param int    $page           Page number. (optional, default to 1)
     * @param int    $limit          Items per page. (optional, default to 10)
     * @param string $providerId     Filter by provider id. (optional)
     * @param array  $requestOptions the requestOptions to send along with the query, they will be merged with the transporter requestOptions
     *
     * @return array<string, mixed>|PaginatedAgentsResponse
     */
    public function listAgents($page = null, $limit = null, $providerId = null, $requestOptions = [])
    {
        $response = $this->listAgentsWithHttpInfo($page, $limit, $providerId, $requestOptions);

        return $response->getData();
    }

    /**
     * Get Provider Models.
     *
     * Required API Key ACLs:
     *  - settings
     *
     * @param array $requestOptions the requestOptions to send along with the query, they will be merged with the transporter requestOptions
     *
     * @return array<string, mixed>|array<string,string[]>
     */
    public function listModels($requestOptions = [])
    {
        $response = $this->listModelsWithHttpInfo($requestOptions);

        return $response->getData();
    }

    /**
     * Get available models for a specific provider.
     *
     * Required API Key ACLs:
     *  - settings
     *
     * @param string $providerId     The providerId. (required)
     * @param array  $requestOptions the requestOptions to send along with the query, they will be merged with the transporter requestOptions
     *
     * @return array<string, mixed>|string[]
     */
    public function listProviderModels($providerId, $requestOptions = [])
    {
        $response = $this->listProviderModelsWithHttpInfo($providerId, $requestOptions);

        return $response->getData();
    }

    /**
     * List Providers.
     *
     * Required API Key ACLs:
     *  - settings
     *
     * @param int   $page           Page number. (optional, default to 1)
     * @param int   $limit          Items per page. (optional, default to 10)
     * @param array $requestOptions the requestOptions to send along with the query, they will be merged with the transporter requestOptions
     *
     * @return array<string, mixed>|PaginatedProviderAuthenticationsResponse
     */
    public function listProviders($page = null, $limit = null, $requestOptions = [])
    {
        $response = $this->listProvidersWithHttpInfo($page, $limit, $requestOptions);

        return $response->getData();
    }

    /**
     * List Secret Keys.
     *
     * Required API Key ACLs:
     *  - settings
     *
     * @param int   $page           Page number. (optional, default to 1)
     * @param int   $limit          Items per page. (optional, default to 10)
     * @param array $requestOptions the requestOptions to send along with the query, they will be merged with the transporter requestOptions
     *
     * @return array<string, mixed>|PaginatedSecretKeysResponse
     */
    public function listSecretKeys($page = null, $limit = null, $requestOptions = [])
    {
        $response = $this->listSecretKeysWithHttpInfo($page, $limit, $requestOptions);

        return $response->getData();
    }

    /**
     * Publish the specified agent.
     *
     * Required API Key ACLs:
     *  - editSettings
     *
     * @param string $agentId        The agentId. (required)
     * @param array  $requestOptions the requestOptions to send along with the query, they will be merged with the transporter requestOptions
     *
     * @return AgentWithVersionResponse|array<string, mixed>
     */
    public function publishAgent($agentId, $requestOptions = [])
    {
        $response = $this->publishAgentWithHttpInfo($agentId, $requestOptions);

        return $response->getData();
    }

    /**
     * Unpublish the specified agent.
     *
     * Required API Key ACLs:
     *  - editSettings
     *
     * @param string $agentId        The agentId. (required)
     * @param array  $requestOptions the requestOptions to send along with the query, they will be merged with the transporter requestOptions
     *
     * @return AgentWithVersionResponse|array<string, mixed>
     */
    public function unpublishAgent($agentId, $requestOptions = [])
    {
        $response = $this->unpublishAgentWithHttpInfo($agentId, $requestOptions);

        return $response->getData();
    }

    /**
     * Update the specified agent.
     *
     * Required API Key ACLs:
     *  - editSettings
     *
     * @param string                  $agentId           The agentId. (required)
     * @param AgentConfigUpdate|array $agentConfigUpdate agentConfigUpdate (required)
     *                                                   - $agentConfigUpdate['name'] => (string)
     *                                                   - $agentConfigUpdate['description'] => (string)
     *                                                   - $agentConfigUpdate['providerId'] => (string)
     *                                                   - $agentConfigUpdate['model'] => (string)
     *                                                   - $agentConfigUpdate['instructions'] => (string) The agent prompt: defines the agent's role, tone, and goals. Guides how it answers using the provided context. Corresponds to the 'Agent prompt' field in the dashboard.
     *                                                   - $agentConfigUpdate['systemPrompt'] => (string) The system prompt: defines system-level rules and constraints. Guides how the agent uses tools, features, and generates context. Prepended before `instructions` in the final prompt sent to the LLM. Typically injected by an agent template — modify with caution, as changes may affect behavior, tool usage, or response accuracy. Corresponds to the 'System prompt' field in the dashboard.
     *                                                   - $agentConfigUpdate['config'] => (array)
     *                                                   - $agentConfigUpdate['tools'] => (array)
     *                                                   - $agentConfigUpdate['templateType'] => (string)
     *
     * @see AgentConfigUpdate
     *
     * @param array $requestOptions the requestOptions to send along with the query, they will be merged with the transporter requestOptions
     *
     * @return AgentWithVersionResponse|array<string, mixed>
     */
    public function updateAgent($agentId, $agentConfigUpdate, $requestOptions = [])
    {
        $response = $this->updateAgentWithHttpInfo($agentId, $agentConfigUpdate, $requestOptions);

        return $response->getData();
    }

    /**
     * Patch Configuration.
     *
     * Required API Key ACLs:
     *  - logs
     *
     * @param ApplicationConfigPatch|array $applicationConfigPatch applicationConfigPatch (required)
     *                                                             - $applicationConfigPatch['maxRetentionDays'] => (int) Maximum number of days to retain data. Valid values: [0, 30, 60, 90].
     *
     * @see ApplicationConfigPatch
     *
     * @param array $requestOptions the requestOptions to send along with the query, they will be merged with the transporter requestOptions
     *
     * @return ApplicationConfigResponse|array<string, mixed>
     */
    public function updateConfiguration($applicationConfigPatch, $requestOptions = [])
    {
        $response = $this->updateConfigurationWithHttpInfo($applicationConfigPatch, $requestOptions);

        return $response->getData();
    }

    /**
     * Update Provider.
     *
     * Required API Key ACLs:
     *  - editSettings
     *
     * @param string                            $providerId                  The providerId. (required)
     * @param array|ProviderAuthenticationPatch $providerAuthenticationPatch providerAuthenticationPatch (required)
     *                                                                       - $providerAuthenticationPatch['name'] => (string)
     *                                                                       - $providerAuthenticationPatch['input'] => (array)
     *
     * @see ProviderAuthenticationPatch
     *
     * @param array $requestOptions the requestOptions to send along with the query, they will be merged with the transporter requestOptions
     *
     * @return array<string, mixed>|ProviderAuthenticationResponse
     */
    public function updateProvider($providerId, $providerAuthenticationPatch, $requestOptions = [])
    {
        $response = $this->updateProviderWithHttpInfo($providerId, $providerAuthenticationPatch, $requestOptions);

        return $response->getData();
    }

    /**
     * Patch Secret Key.
     *
     * Required API Key ACLs:
     *  - admin
     *
     * @param string               $secretKeyId    The secretKeyId. (required)
     * @param array|SecretKeyPatch $secretKeyPatch secretKeyPatch (required)
     *                                             - $secretKeyPatch['name'] => (string) The new name of the secret key.
     *                                             - $secretKeyPatch['agentIds'] => (array) Updated list of agent IDs this secret key is associated with.
     *
     * @see SecretKeyPatch
     *
     * @param array $requestOptions the requestOptions to send along with the query, they will be merged with the transporter requestOptions
     *
     * @return array<string, mixed>|SecretKeyResponse
     */
    public function updateSecretKey($secretKeyId, $secretKeyPatch, $requestOptions = [])
    {
        $response = $this->updateSecretKeyWithHttpInfo($secretKeyId, $secretKeyPatch, $requestOptions);

        return $response->getData();
    }

    /**
     * Bulk Insert Allowed Domains (with HTTP info).
     *
     * Returns the response with HTTP metadata (status code, headers, body)
     * Add multiple allowed domain patterns. Duplicates are skipped.
     * Required API Key ACLs:
     *  - editSettings
     *
     * @param string                        $agentId                 The agentId. (required)
     * @param AllowedDomainBulkInsert|array $allowedDomainBulkInsert (required)
     * @param array                         $requestOptions          Request options
     *
     * @return AlgoliaResponse
     */
    public function bulkCreateAllowedDomainsWithHttpInfo($agentId, $allowedDomainBulkInsert, $requestOptions = [])
    {
        // verify the required parameter 'agentId' is set
        if (!isset($agentId)) {
            throw new \InvalidArgumentException(
                'Parameter `agentId` is required when calling `bulkCreateAllowedDomains`.'
            );
        }
        // verify the required parameter 'agentId' is not empty
        if (isset($agentId) && '' === $agentId) {
            throw new \InvalidArgumentException(
                'Parameter `agentId` is required when calling `bulkCreateAllowedDomains`.'
            );
        }
        // verify the required parameter 'allowedDomainBulkInsert' is set
        if (!isset($allowedDomainBulkInsert)) {
            throw new \InvalidArgumentException(
                'Parameter `allowedDomainBulkInsert` is required when calling `bulkCreateAllowedDomains`.'
            );
        }

        $resourcePath = '/agent-studio/1/agents/{agentId}/allowed-domains/bulk';
        $queryParameters = [];
        $headers = [];
        $httpBody = $allowedDomainBulkInsert;

        // path params
        if (null !== $agentId) {
            $resourcePath = str_replace(
                '{agentId}',
                ObjectSerializer::toPathValue($agentId),
                $resourcePath
            );
        }

        return $this->sendRequestWithHttpInfo('POST', $resourcePath, $headers, $queryParameters, $httpBody, $requestOptions);
    }

    /**
     * Bulk Delete Allowed Domains (with HTTP info).
     *
     * Returns the response with HTTP metadata (status code, headers, body)
     * Delete allowed domains by id list.
     * Required API Key ACLs:
     *  - editSettings
     *
     * @param string                        $agentId                 The agentId. (required)
     * @param AllowedDomainBulkDelete|array $allowedDomainBulkDelete (required)
     * @param array                         $requestOptions          Request options
     *
     * @return AlgoliaResponse
     */
    public function bulkDeleteAllowedDomainsWithHttpInfo($agentId, $allowedDomainBulkDelete, $requestOptions = [])
    {
        // verify the required parameter 'agentId' is set
        if (!isset($agentId)) {
            throw new \InvalidArgumentException(
                'Parameter `agentId` is required when calling `bulkDeleteAllowedDomains`.'
            );
        }
        // verify the required parameter 'agentId' is not empty
        if (isset($agentId) && '' === $agentId) {
            throw new \InvalidArgumentException(
                'Parameter `agentId` is required when calling `bulkDeleteAllowedDomains`.'
            );
        }
        // verify the required parameter 'allowedDomainBulkDelete' is set
        if (!isset($allowedDomainBulkDelete)) {
            throw new \InvalidArgumentException(
                'Parameter `allowedDomainBulkDelete` is required when calling `bulkDeleteAllowedDomains`.'
            );
        }

        $resourcePath = '/agent-studio/1/agents/{agentId}/allowed-domains/bulk';
        $queryParameters = [];
        $headers = [];
        $httpBody = $allowedDomainBulkDelete;

        // path params
        if (null !== $agentId) {
            $resourcePath = str_replace(
                '{agentId}',
                ObjectSerializer::toPathValue($agentId),
                $resourcePath
            );
        }

        return $this->sendRequestWithHttpInfo('DELETE', $resourcePath, $headers, $queryParameters, $httpBody, $requestOptions);
    }

    /**
     * Create Agent (with HTTP info).
     *
     * Returns the response with HTTP metadata (status code, headers, body)
     * Create a new agent.
     * Required API Key ACLs:
     *  - editSettings
     *
     * @param AgentConfigCreate|array $agentConfigCreate (required)
     * @param array                   $requestOptions    Request options
     *
     * @return AlgoliaResponse
     */
    public function createAgentWithHttpInfo($agentConfigCreate, $requestOptions = [])
    {
        // verify the required parameter 'agentConfigCreate' is set
        if (!isset($agentConfigCreate)) {
            throw new \InvalidArgumentException(
                'Parameter `agentConfigCreate` is required when calling `createAgent`.'
            );
        }

        $resourcePath = '/agent-studio/1/agents';
        $queryParameters = [];
        $headers = [];
        $httpBody = $agentConfigCreate;

        return $this->sendRequestWithHttpInfo('POST', $resourcePath, $headers, $queryParameters, $httpBody, $requestOptions);
    }

    /**
     * Create Allowed Domain (with HTTP info).
     *
     * Returns the response with HTTP metadata (status code, headers, body)
     * Add a single allowed domain pattern (e.g. https://app.example.com or *.example.com).
     * Required API Key ACLs:
     *  - editSettings
     *
     * @param string                    $agentId             The agentId. (required)
     * @param AllowedDomainCreate|array $allowedDomainCreate (required)
     * @param array                     $requestOptions      Request options
     *
     * @return AlgoliaResponse
     */
    public function createAgentAllowedDomainWithHttpInfo($agentId, $allowedDomainCreate, $requestOptions = [])
    {
        // verify the required parameter 'agentId' is set
        if (!isset($agentId)) {
            throw new \InvalidArgumentException(
                'Parameter `agentId` is required when calling `createAgentAllowedDomain`.'
            );
        }
        // verify the required parameter 'agentId' is not empty
        if (isset($agentId) && '' === $agentId) {
            throw new \InvalidArgumentException(
                'Parameter `agentId` is required when calling `createAgentAllowedDomain`.'
            );
        }
        // verify the required parameter 'allowedDomainCreate' is set
        if (!isset($allowedDomainCreate)) {
            throw new \InvalidArgumentException(
                'Parameter `allowedDomainCreate` is required when calling `createAgentAllowedDomain`.'
            );
        }

        $resourcePath = '/agent-studio/1/agents/{agentId}/allowed-domains';
        $queryParameters = [];
        $headers = [];
        $httpBody = $allowedDomainCreate;

        // path params
        if (null !== $agentId) {
            $resourcePath = str_replace(
                '{agentId}',
                ObjectSerializer::toPathValue($agentId),
                $resourcePath
            );
        }

        return $this->sendRequestWithHttpInfo('POST', $resourcePath, $headers, $queryParameters, $httpBody, $requestOptions);
    }

    /**
     * Create Completion (with HTTP info).
     *
     * Returns the response with HTTP metadata (status code, headers, body)
     * Create a completion for the specified agent.  This endpoint handles two types of requests: 1. Normal completion request: User message -> Agent response 2. Tool approval response: User approval -> Execute tool -> Agent response  Tool Approval Flow (for MCP tools with requiresApproval: true): - Request 1: User sends message -> Agent requests tool call -> Return approval request - Request 2: User approves -> Execute tool -> Agent continues with result.
     * Required API Key ACLs:
     *  - search
     *
     * @param string                       $agentId                 The agentId. (required)
     * @param array                        $compatibilityMode       Compatibility mode for the completion API. (required)
     * @param AgentCompletionRequest|array $agentCompletionRequest  (required)
     * @param bool                         $stream                  Whether to stream the response or not. (optional)
     * @param bool                         $cache                   Use cached responses if available. (optional)
     * @param bool                         $memory                  Set to false to disable memory (enabled by default). (optional)
     * @param bool                         $analytics               Set to false to skip analytics for this completion (default: true). Disables Agent Studio BigQuery analytics, Algolia search analytics, click analytics, and query-suggestions training. Useful for offline-eval workflows. (optional)
     * @param string                       $xAlgoliaSecureUserToken The X-Algolia-Secure-User-Token. (optional)
     * @param array                        $requestOptions          Request options
     *
     * @return AlgoliaResponse
     */
    public function createAgentCompletionWithHttpInfo($agentId, $compatibilityMode, $agentCompletionRequest, $stream = null, $cache = null, $memory = null, $analytics = null, $xAlgoliaSecureUserToken = null, $requestOptions = [])
    {
        // verify the required parameter 'agentId' is set
        if (!isset($agentId)) {
            throw new \InvalidArgumentException(
                'Parameter `agentId` is required when calling `createAgentCompletion`.'
            );
        }
        // verify the required parameter 'agentId' is not empty
        if (isset($agentId) && '' === $agentId) {
            throw new \InvalidArgumentException(
                'Parameter `agentId` is required when calling `createAgentCompletion`.'
            );
        }
        // verify the required parameter 'compatibilityMode' is set
        if (!isset($compatibilityMode)) {
            throw new \InvalidArgumentException(
                'Parameter `compatibilityMode` is required when calling `createAgentCompletion`.'
            );
        }
        // verify the required parameter 'agentCompletionRequest' is set
        if (!isset($agentCompletionRequest)) {
            throw new \InvalidArgumentException(
                'Parameter `agentCompletionRequest` is required when calling `createAgentCompletion`.'
            );
        }

        $resourcePath = '/agent-studio/1/agents/{agentId}/completions';
        $queryParameters = [];
        $headers = [];
        $httpBody = $agentCompletionRequest;

        if (null !== $compatibilityMode) {
            $queryParameters['compatibilityMode'] = $compatibilityMode;
        }

        if (null !== $stream) {
            $queryParameters['stream'] = $stream;
        }

        if (null !== $cache) {
            $queryParameters['cache'] = $cache;
        }

        if (null !== $memory) {
            $queryParameters['memory'] = $memory;
        }

        if (null !== $analytics) {
            $queryParameters['analytics'] = $analytics;
        }

        // path params
        if (null !== $agentId) {
            $resourcePath = str_replace(
                '{agentId}',
                ObjectSerializer::toPathValue($agentId),
                $resourcePath
            );
        }

        $headers['X-Algolia-Secure-User-Token'] = $xAlgoliaSecureUserToken;

        return $this->sendRequestWithHttpInfo('POST', $resourcePath, $headers, $queryParameters, $httpBody, $requestOptions);
    }

    /**
     * Create Feedback (with HTTP info).
     *
     * Returns the response with HTTP metadata (status code, headers, body)
     * Create new feedback entry.
     * Required API Key ACLs:
     *  - search
     *
     * @param array|FeedbackCreationRequest $feedbackCreationRequest (required)
     * @param array                         $requestOptions          Request options
     *
     * @return AlgoliaResponse
     */
    public function createFeedbackWithHttpInfo($feedbackCreationRequest, $requestOptions = [])
    {
        // verify the required parameter 'feedbackCreationRequest' is set
        if (!isset($feedbackCreationRequest)) {
            throw new \InvalidArgumentException(
                'Parameter `feedbackCreationRequest` is required when calling `createFeedback`.'
            );
        }

        $resourcePath = '/agent-studio/1/feedback';
        $queryParameters = [];
        $headers = [];
        $httpBody = $feedbackCreationRequest;

        return $this->sendRequestWithHttpInfo('POST', $resourcePath, $headers, $queryParameters, $httpBody, $requestOptions);
    }

    /**
     * Create Provider (with HTTP info).
     *
     * Returns the response with HTTP metadata (status code, headers, body)
     * Create Provider.
     * Required API Key ACLs:
     *  - editSettings
     *
     * @param array|ProviderAuthenticationCreate $providerAuthenticationCreate (required)
     * @param array                              $requestOptions               Request options
     *
     * @return AlgoliaResponse
     */
    public function createProviderWithHttpInfo($providerAuthenticationCreate, $requestOptions = [])
    {
        // verify the required parameter 'providerAuthenticationCreate' is set
        if (!isset($providerAuthenticationCreate)) {
            throw new \InvalidArgumentException(
                'Parameter `providerAuthenticationCreate` is required when calling `createProvider`.'
            );
        }

        $resourcePath = '/agent-studio/1/providers';
        $queryParameters = [];
        $headers = [];
        $httpBody = $providerAuthenticationCreate;

        return $this->sendRequestWithHttpInfo('POST', $resourcePath, $headers, $queryParameters, $httpBody, $requestOptions);
    }

    /**
     * Create Secret Key (with HTTP info).
     *
     * Returns the response with HTTP metadata (status code, headers, body)
     * Create Secret Key.
     * Required API Key ACLs:
     *  - admin
     *
     * @param array|SecretKeyCreate $secretKeyCreate (required)
     * @param array                 $requestOptions  Request options
     *
     * @return AlgoliaResponse
     */
    public function createSecretKeyWithHttpInfo($secretKeyCreate, $requestOptions = [])
    {
        // verify the required parameter 'secretKeyCreate' is set
        if (!isset($secretKeyCreate)) {
            throw new \InvalidArgumentException(
                'Parameter `secretKeyCreate` is required when calling `createSecretKey`.'
            );
        }

        $resourcePath = '/agent-studio/1/secret-keys';
        $queryParameters = [];
        $headers = [];
        $httpBody = $secretKeyCreate;

        return $this->sendRequestWithHttpInfo('POST', $resourcePath, $headers, $queryParameters, $httpBody, $requestOptions);
    }

    /**
     * Send requests to the Algolia REST API (with HTTP info).
     *
     * Returns the response with HTTP metadata (status code, headers, body)
     * This method lets you send requests to the Algolia REST API.
     *
     * @param string $path           Path of the endpoint, for example `1/newFeature`. (required)
     * @param array  $parameters     Query parameters to apply to the current query. (optional)
     * @param array  $requestOptions Request options
     *
     * @return AlgoliaResponse
     */
    public function customDeleteWithHttpInfo($path, $parameters = null, $requestOptions = [])
    {
        // verify the required parameter 'path' is set
        if (!isset($path)) {
            throw new \InvalidArgumentException(
                'Parameter `path` is required when calling `customDelete`.'
            );
        }
        // verify the required parameter 'path' is not empty
        if (isset($path) && '' === $path) {
            throw new \InvalidArgumentException(
                'Parameter `path` is required when calling `customDelete`.'
            );
        }

        $resourcePath = '/agent-studio/{path}';
        $queryParameters = [];
        $headers = [];
        $httpBody = null;

        if (null !== $parameters) {
            $queryParameters = $parameters;
        }

        // path params
        if (null !== $path) {
            $resourcePath = str_replace(
                '{path}',
                $path,
                $resourcePath
            );
        }

        return $this->sendRequestWithHttpInfo('DELETE', $resourcePath, $headers, $queryParameters, $httpBody, $requestOptions);
    }

    /**
     * Send requests to the Algolia REST API (with HTTP info).
     *
     * Returns the response with HTTP metadata (status code, headers, body)
     * This method lets you send requests to the Algolia REST API.
     *
     * @param string $path           Path of the endpoint, for example `1/newFeature`. (required)
     * @param array  $parameters     Query parameters to apply to the current query. (optional)
     * @param array  $requestOptions Request options
     *
     * @return AlgoliaResponse
     */
    public function customGetWithHttpInfo($path, $parameters = null, $requestOptions = [])
    {
        // verify the required parameter 'path' is set
        if (!isset($path)) {
            throw new \InvalidArgumentException(
                'Parameter `path` is required when calling `customGet`.'
            );
        }
        // verify the required parameter 'path' is not empty
        if (isset($path) && '' === $path) {
            throw new \InvalidArgumentException(
                'Parameter `path` is required when calling `customGet`.'
            );
        }

        $resourcePath = '/agent-studio/{path}';
        $queryParameters = [];
        $headers = [];
        $httpBody = null;

        if (null !== $parameters) {
            $queryParameters = $parameters;
        }

        // path params
        if (null !== $path) {
            $resourcePath = str_replace(
                '{path}',
                $path,
                $resourcePath
            );
        }

        return $this->sendRequestWithHttpInfo('GET', $resourcePath, $headers, $queryParameters, $httpBody, $requestOptions);
    }

    /**
     * Send requests to the Algolia REST API (with HTTP info).
     *
     * Returns the response with HTTP metadata (status code, headers, body)
     * This method lets you send requests to the Algolia REST API.
     *
     * @param string $path           Path of the endpoint, for example `1/newFeature`. (required)
     * @param array  $parameters     Query parameters to apply to the current query. (optional)
     * @param array  $body           Parameters to send with the custom request. (optional)
     * @param array  $requestOptions Request options
     *
     * @return AlgoliaResponse
     */
    public function customPostWithHttpInfo($path, $parameters = null, $body = null, $requestOptions = [])
    {
        // verify the required parameter 'path' is set
        if (!isset($path)) {
            throw new \InvalidArgumentException(
                'Parameter `path` is required when calling `customPost`.'
            );
        }
        // verify the required parameter 'path' is not empty
        if (isset($path) && '' === $path) {
            throw new \InvalidArgumentException(
                'Parameter `path` is required when calling `customPost`.'
            );
        }

        $resourcePath = '/agent-studio/{path}';
        $queryParameters = [];
        $headers = [];
        $httpBody = isset($body) ? $body : [];

        if (null !== $parameters) {
            $queryParameters = $parameters;
        }

        // path params
        if (null !== $path) {
            $resourcePath = str_replace(
                '{path}',
                $path,
                $resourcePath
            );
        }

        return $this->sendRequestWithHttpInfo('POST', $resourcePath, $headers, $queryParameters, $httpBody, $requestOptions);
    }

    /**
     * Send requests to the Algolia REST API (with HTTP info).
     *
     * Returns the response with HTTP metadata (status code, headers, body)
     * This method lets you send requests to the Algolia REST API.
     *
     * @param string $path           Path of the endpoint, for example `1/newFeature`. (required)
     * @param array  $parameters     Query parameters to apply to the current query. (optional)
     * @param array  $body           Parameters to send with the custom request. (optional)
     * @param array  $requestOptions Request options
     *
     * @return AlgoliaResponse
     */
    public function customPutWithHttpInfo($path, $parameters = null, $body = null, $requestOptions = [])
    {
        // verify the required parameter 'path' is set
        if (!isset($path)) {
            throw new \InvalidArgumentException(
                'Parameter `path` is required when calling `customPut`.'
            );
        }
        // verify the required parameter 'path' is not empty
        if (isset($path) && '' === $path) {
            throw new \InvalidArgumentException(
                'Parameter `path` is required when calling `customPut`.'
            );
        }

        $resourcePath = '/agent-studio/{path}';
        $queryParameters = [];
        $headers = [];
        $httpBody = isset($body) ? $body : [];

        if (null !== $parameters) {
            $queryParameters = $parameters;
        }

        // path params
        if (null !== $path) {
            $resourcePath = str_replace(
                '{path}',
                $path,
                $resourcePath
            );
        }

        return $this->sendRequestWithHttpInfo('PUT', $resourcePath, $headers, $queryParameters, $httpBody, $requestOptions);
    }

    /**
     * Delete Agent (with HTTP info).
     *
     * Returns the response with HTTP metadata (status code, headers, body)
     * Delete the specified agent.
     * Required API Key ACLs:
     *  - editSettings
     *
     * @param string $agentId        The agentId. (required)
     * @param array  $requestOptions Request options
     *
     * @return AlgoliaResponse
     */
    public function deleteAgentWithHttpInfo($agentId, $requestOptions = [])
    {
        // verify the required parameter 'agentId' is set
        if (!isset($agentId)) {
            throw new \InvalidArgumentException(
                'Parameter `agentId` is required when calling `deleteAgent`.'
            );
        }
        // verify the required parameter 'agentId' is not empty
        if (isset($agentId) && '' === $agentId) {
            throw new \InvalidArgumentException(
                'Parameter `agentId` is required when calling `deleteAgent`.'
            );
        }

        $resourcePath = '/agent-studio/1/agents/{agentId}';
        $queryParameters = [];
        $headers = [];
        $httpBody = null;

        // path params
        if (null !== $agentId) {
            $resourcePath = str_replace(
                '{agentId}',
                ObjectSerializer::toPathValue($agentId),
                $resourcePath
            );
        }

        return $this->sendRequestWithHttpInfo('DELETE', $resourcePath, $headers, $queryParameters, $httpBody, $requestOptions);
    }

    /**
     * Delete Conversations (with HTTP info).
     *
     * Returns the response with HTTP metadata (status code, headers, body)
     * Deletes the conversations matching the given filers.
     * Required API Key ACLs:
     *  - logs
     *
     * @param string $agentId        The agentId. (required)
     * @param string $startDate      Filter conversations created after this date (format: YYYY-MM-DD). (optional)
     * @param string $endDate        Filter conversations created before this date (format: YYYY-MM-DD). (optional)
     * @param array  $requestOptions Request options
     *
     * @return AlgoliaResponse
     */
    public function deleteAgentConversationsWithHttpInfo($agentId, $startDate = null, $endDate = null, $requestOptions = [])
    {
        // verify the required parameter 'agentId' is set
        if (!isset($agentId)) {
            throw new \InvalidArgumentException(
                'Parameter `agentId` is required when calling `deleteAgentConversations`.'
            );
        }
        // verify the required parameter 'agentId' is not empty
        if (isset($agentId) && '' === $agentId) {
            throw new \InvalidArgumentException(
                'Parameter `agentId` is required when calling `deleteAgentConversations`.'
            );
        }

        $resourcePath = '/agent-studio/1/agents/{agentId}/conversations';
        $queryParameters = [];
        $headers = [];
        $httpBody = null;

        if (null !== $startDate) {
            $queryParameters['startDate'] = $startDate;
        }

        if (null !== $endDate) {
            $queryParameters['endDate'] = $endDate;
        }

        // path params
        if (null !== $agentId) {
            $resourcePath = str_replace(
                '{agentId}',
                ObjectSerializer::toPathValue($agentId),
                $resourcePath
            );
        }

        return $this->sendRequestWithHttpInfo('DELETE', $resourcePath, $headers, $queryParameters, $httpBody, $requestOptions);
    }

    /**
     * Delete Allowed Domain (with HTTP info).
     *
     * Returns the response with HTTP metadata (status code, headers, body)
     * Remove an allowed domain by id.
     * Required API Key ACLs:
     *  - editSettings
     *
     * @param string $domainId       The domainId. (required)
     * @param string $agentId        The agentId. (required)
     * @param array  $requestOptions Request options
     *
     * @return AlgoliaResponse
     */
    public function deleteAllowedDomainWithHttpInfo($domainId, $agentId, $requestOptions = [])
    {
        // verify the required parameter 'domainId' is set
        if (!isset($domainId)) {
            throw new \InvalidArgumentException(
                'Parameter `domainId` is required when calling `deleteAllowedDomain`.'
            );
        }
        // verify the required parameter 'domainId' is not empty
        if (isset($domainId) && '' === $domainId) {
            throw new \InvalidArgumentException(
                'Parameter `domainId` is required when calling `deleteAllowedDomain`.'
            );
        }
        // verify the required parameter 'agentId' is set
        if (!isset($agentId)) {
            throw new \InvalidArgumentException(
                'Parameter `agentId` is required when calling `deleteAllowedDomain`.'
            );
        }
        // verify the required parameter 'agentId' is not empty
        if (isset($agentId) && '' === $agentId) {
            throw new \InvalidArgumentException(
                'Parameter `agentId` is required when calling `deleteAllowedDomain`.'
            );
        }

        $resourcePath = '/agent-studio/1/agents/{agentId}/allowed-domains/{domainId}';
        $queryParameters = [];
        $headers = [];
        $httpBody = null;

        // path params
        if (null !== $domainId) {
            $resourcePath = str_replace(
                '{domainId}',
                ObjectSerializer::toPathValue($domainId),
                $resourcePath
            );
        }

        // path params
        if (null !== $agentId) {
            $resourcePath = str_replace(
                '{agentId}',
                ObjectSerializer::toPathValue($agentId),
                $resourcePath
            );
        }

        return $this->sendRequestWithHttpInfo('DELETE', $resourcePath, $headers, $queryParameters, $httpBody, $requestOptions);
    }

    /**
     * Delete Conversation (with HTTP info).
     *
     * Returns the response with HTTP metadata (status code, headers, body)
     * Deletes the conversation with the given ID.
     * Required API Key ACLs:
     *  - logs
     *
     * @param string $conversationId The conversationId. (required)
     * @param string $agentId        The agentId. (required)
     * @param array  $requestOptions Request options
     *
     * @return AlgoliaResponse
     */
    public function deleteConversationWithHttpInfo($conversationId, $agentId, $requestOptions = [])
    {
        // verify the required parameter 'conversationId' is set
        if (!isset($conversationId)) {
            throw new \InvalidArgumentException(
                'Parameter `conversationId` is required when calling `deleteConversation`.'
            );
        }
        // verify the required parameter 'conversationId' is not empty
        if (isset($conversationId) && '' === $conversationId) {
            throw new \InvalidArgumentException(
                'Parameter `conversationId` is required when calling `deleteConversation`.'
            );
        }
        // verify the required parameter 'agentId' is set
        if (!isset($agentId)) {
            throw new \InvalidArgumentException(
                'Parameter `agentId` is required when calling `deleteConversation`.'
            );
        }
        // verify the required parameter 'agentId' is not empty
        if (isset($agentId) && '' === $agentId) {
            throw new \InvalidArgumentException(
                'Parameter `agentId` is required when calling `deleteConversation`.'
            );
        }

        $resourcePath = '/agent-studio/1/agents/{agentId}/conversations/{conversationId}';
        $queryParameters = [];
        $headers = [];
        $httpBody = null;

        // path params
        if (null !== $conversationId) {
            $resourcePath = str_replace(
                '{conversationId}',
                ObjectSerializer::toPathValue($conversationId),
                $resourcePath
            );
        }

        // path params
        if (null !== $agentId) {
            $resourcePath = str_replace(
                '{agentId}',
                ObjectSerializer::toPathValue($agentId),
                $resourcePath
            );
        }

        return $this->sendRequestWithHttpInfo('DELETE', $resourcePath, $headers, $queryParameters, $httpBody, $requestOptions);
    }

    /**
     * Delete Provider (with HTTP info).
     *
     * Returns the response with HTTP metadata (status code, headers, body)
     * Delete Provider.
     * Required API Key ACLs:
     *  - editSettings
     *
     * @param string $providerId     The providerId. (required)
     * @param array  $requestOptions Request options
     *
     * @return AlgoliaResponse
     */
    public function deleteProviderWithHttpInfo($providerId, $requestOptions = [])
    {
        // verify the required parameter 'providerId' is set
        if (!isset($providerId)) {
            throw new \InvalidArgumentException(
                'Parameter `providerId` is required when calling `deleteProvider`.'
            );
        }
        // verify the required parameter 'providerId' is not empty
        if (isset($providerId) && '' === $providerId) {
            throw new \InvalidArgumentException(
                'Parameter `providerId` is required when calling `deleteProvider`.'
            );
        }

        $resourcePath = '/agent-studio/1/providers/{providerId}';
        $queryParameters = [];
        $headers = [];
        $httpBody = null;

        // path params
        if (null !== $providerId) {
            $resourcePath = str_replace(
                '{providerId}',
                ObjectSerializer::toPathValue($providerId),
                $resourcePath
            );
        }

        return $this->sendRequestWithHttpInfo('DELETE', $resourcePath, $headers, $queryParameters, $httpBody, $requestOptions);
    }

    /**
     * Delete Secret Key (with HTTP info).
     *
     * Returns the response with HTTP metadata (status code, headers, body)
     * Delete Secret Key.
     * Required API Key ACLs:
     *  - admin
     *
     * @param string $secretKeyId    The secretKeyId. (required)
     * @param array  $requestOptions Request options
     *
     * @return AlgoliaResponse
     */
    public function deleteSecretKeyWithHttpInfo($secretKeyId, $requestOptions = [])
    {
        // verify the required parameter 'secretKeyId' is set
        if (!isset($secretKeyId)) {
            throw new \InvalidArgumentException(
                'Parameter `secretKeyId` is required when calling `deleteSecretKey`.'
            );
        }
        // verify the required parameter 'secretKeyId' is not empty
        if (isset($secretKeyId) && '' === $secretKeyId) {
            throw new \InvalidArgumentException(
                'Parameter `secretKeyId` is required when calling `deleteSecretKey`.'
            );
        }

        $resourcePath = '/agent-studio/1/secret-keys/{secretKeyId}';
        $queryParameters = [];
        $headers = [];
        $httpBody = null;

        // path params
        if (null !== $secretKeyId) {
            $resourcePath = str_replace(
                '{secretKeyId}',
                ObjectSerializer::toPathValue($secretKeyId),
                $resourcePath
            );
        }

        return $this->sendRequestWithHttpInfo('DELETE', $resourcePath, $headers, $queryParameters, $httpBody, $requestOptions);
    }

    /**
     * Delete Data By User Token (with HTTP info).
     *
     * Returns the response with HTTP metadata (status code, headers, body)
     * Permanently deletes all messages for the given user token. Does not delete conversations.
     * Required API Key ACLs:
     *  - logs
     *
     * @param string $userToken      The userToken. (required)
     * @param array  $requestOptions Request options
     *
     * @return AlgoliaResponse
     */
    public function deleteUserDataWithHttpInfo($userToken, $requestOptions = [])
    {
        // verify the required parameter 'userToken' is set
        if (!isset($userToken)) {
            throw new \InvalidArgumentException(
                'Parameter `userToken` is required when calling `deleteUserData`.'
            );
        }
        // verify the required parameter 'userToken' is not empty
        if (isset($userToken) && '' === $userToken) {
            throw new \InvalidArgumentException(
                'Parameter `userToken` is required when calling `deleteUserData`.'
            );
        }

        $resourcePath = '/agent-studio/1/user-data/{userToken}';
        $queryParameters = [];
        $headers = [];
        $httpBody = null;

        // path params
        if (null !== $userToken) {
            $resourcePath = str_replace(
                '{userToken}',
                ObjectSerializer::toPathValue($userToken),
                $resourcePath
            );
        }

        return $this->sendRequestWithHttpInfo('DELETE', $resourcePath, $headers, $queryParameters, $httpBody, $requestOptions);
    }

    /**
     * Export Conversations (with HTTP info).
     *
     * Returns the response with HTTP metadata (status code, headers, body)
     * Exports all conversations based on the passed filters.
     * Required API Key ACLs:
     *  - logs
     *
     * @param string $agentId        The agentId. (required)
     * @param string $startDate      Filter conversations created after this date (format: YYYY-MM-DD). (optional)
     * @param string $endDate        Filter conversations created before this date (format: YYYY-MM-DD). (optional)
     * @param array  $requestOptions Request options
     *
     * @return AlgoliaResponse
     */
    public function exportConversationsWithHttpInfo($agentId, $startDate = null, $endDate = null, $requestOptions = [])
    {
        // verify the required parameter 'agentId' is set
        if (!isset($agentId)) {
            throw new \InvalidArgumentException(
                'Parameter `agentId` is required when calling `exportConversations`.'
            );
        }
        // verify the required parameter 'agentId' is not empty
        if (isset($agentId) && '' === $agentId) {
            throw new \InvalidArgumentException(
                'Parameter `agentId` is required when calling `exportConversations`.'
            );
        }

        $resourcePath = '/agent-studio/1/agents/{agentId}/conversations/export';
        $queryParameters = [];
        $headers = [];
        $httpBody = null;

        if (null !== $startDate) {
            $queryParameters['startDate'] = $startDate;
        }

        if (null !== $endDate) {
            $queryParameters['endDate'] = $endDate;
        }

        // path params
        if (null !== $agentId) {
            $resourcePath = str_replace(
                '{agentId}',
                ObjectSerializer::toPathValue($agentId),
                $resourcePath
            );
        }

        return $this->sendRequestWithHttpInfo('GET', $resourcePath, $headers, $queryParameters, $httpBody, $requestOptions);
    }

    /**
     * Get Agent (with HTTP info).
     *
     * Returns the response with HTTP metadata (status code, headers, body)
     * Retrieve details of the specified agent.
     * Required API Key ACLs:
     *  - settings
     *
     * @param string $agentId        The agentId. (required)
     * @param array  $requestOptions Request options
     *
     * @return AlgoliaResponse
     */
    public function getAgentWithHttpInfo($agentId, $requestOptions = [])
    {
        // verify the required parameter 'agentId' is set
        if (!isset($agentId)) {
            throw new \InvalidArgumentException(
                'Parameter `agentId` is required when calling `getAgent`.'
            );
        }
        // verify the required parameter 'agentId' is not empty
        if (isset($agentId) && '' === $agentId) {
            throw new \InvalidArgumentException(
                'Parameter `agentId` is required when calling `getAgent`.'
            );
        }

        $resourcePath = '/agent-studio/1/agents/{agentId}';
        $queryParameters = [];
        $headers = [];
        $httpBody = null;

        // path params
        if (null !== $agentId) {
            $resourcePath = str_replace(
                '{agentId}',
                ObjectSerializer::toPathValue($agentId),
                $resourcePath
            );
        }

        return $this->sendRequestWithHttpInfo('GET', $resourcePath, $headers, $queryParameters, $httpBody, $requestOptions);
    }

    /**
     * Get Allowed Domain (with HTTP info).
     *
     * Returns the response with HTTP metadata (status code, headers, body)
     * Get a single allowed domain by id.
     * Required API Key ACLs:
     *  - settings
     *
     * @param string $domainId       The domainId. (required)
     * @param string $agentId        The agentId. (required)
     * @param array  $requestOptions Request options
     *
     * @return AlgoliaResponse
     */
    public function getAllowedDomainWithHttpInfo($domainId, $agentId, $requestOptions = [])
    {
        // verify the required parameter 'domainId' is set
        if (!isset($domainId)) {
            throw new \InvalidArgumentException(
                'Parameter `domainId` is required when calling `getAllowedDomain`.'
            );
        }
        // verify the required parameter 'domainId' is not empty
        if (isset($domainId) && '' === $domainId) {
            throw new \InvalidArgumentException(
                'Parameter `domainId` is required when calling `getAllowedDomain`.'
            );
        }
        // verify the required parameter 'agentId' is set
        if (!isset($agentId)) {
            throw new \InvalidArgumentException(
                'Parameter `agentId` is required when calling `getAllowedDomain`.'
            );
        }
        // verify the required parameter 'agentId' is not empty
        if (isset($agentId) && '' === $agentId) {
            throw new \InvalidArgumentException(
                'Parameter `agentId` is required when calling `getAllowedDomain`.'
            );
        }

        $resourcePath = '/agent-studio/1/agents/{agentId}/allowed-domains/{domainId}';
        $queryParameters = [];
        $headers = [];
        $httpBody = null;

        // path params
        if (null !== $domainId) {
            $resourcePath = str_replace(
                '{domainId}',
                ObjectSerializer::toPathValue($domainId),
                $resourcePath
            );
        }

        // path params
        if (null !== $agentId) {
            $resourcePath = str_replace(
                '{agentId}',
                ObjectSerializer::toPathValue($agentId),
                $resourcePath
            );
        }

        return $this->sendRequestWithHttpInfo('GET', $resourcePath, $headers, $queryParameters, $httpBody, $requestOptions);
    }

    /**
     * Get Configuration (with HTTP info).
     *
     * Returns the response with HTTP metadata (status code, headers, body)
     * Get Configuration.
     * Required API Key ACLs:
     *  - logs
     *
     * @param array $requestOptions Request options
     *
     * @return AlgoliaResponse
     */
    public function getConfigurationWithHttpInfo($requestOptions = [])
    {
        $resourcePath = '/agent-studio/1/configuration';
        $queryParameters = [];
        $headers = [];
        $httpBody = null;

        return $this->sendRequestWithHttpInfo('GET', $resourcePath, $headers, $queryParameters, $httpBody, $requestOptions);
    }

    /**
     * Get Conversation (with HTTP info).
     *
     * Returns the response with HTTP metadata (status code, headers, body)
     * Retrieves the conversation and its messages for the given ID.
     * Required API Key ACLs:
     *  - logs
     *
     * @param string $conversationId          The conversationId. (required)
     * @param string $agentId                 The agentId. (required)
     * @param bool   $includeFeedback         Include feedback for the conversation. (optional)
     * @param string $xAlgoliaSecureUserToken The X-Algolia-Secure-User-Token. (optional)
     * @param array  $requestOptions          Request options
     *
     * @return AlgoliaResponse
     */
    public function getConversationWithHttpInfo($conversationId, $agentId, $includeFeedback = null, $xAlgoliaSecureUserToken = null, $requestOptions = [])
    {
        // verify the required parameter 'conversationId' is set
        if (!isset($conversationId)) {
            throw new \InvalidArgumentException(
                'Parameter `conversationId` is required when calling `getConversation`.'
            );
        }
        // verify the required parameter 'conversationId' is not empty
        if (isset($conversationId) && '' === $conversationId) {
            throw new \InvalidArgumentException(
                'Parameter `conversationId` is required when calling `getConversation`.'
            );
        }
        // verify the required parameter 'agentId' is set
        if (!isset($agentId)) {
            throw new \InvalidArgumentException(
                'Parameter `agentId` is required when calling `getConversation`.'
            );
        }
        // verify the required parameter 'agentId' is not empty
        if (isset($agentId) && '' === $agentId) {
            throw new \InvalidArgumentException(
                'Parameter `agentId` is required when calling `getConversation`.'
            );
        }

        $resourcePath = '/agent-studio/1/agents/{agentId}/conversations/{conversationId}';
        $queryParameters = [];
        $headers = [];
        $httpBody = null;

        if (null !== $includeFeedback) {
            $queryParameters['includeFeedback'] = $includeFeedback;
        }

        // path params
        if (null !== $conversationId) {
            $resourcePath = str_replace(
                '{conversationId}',
                ObjectSerializer::toPathValue($conversationId),
                $resourcePath
            );
        }

        // path params
        if (null !== $agentId) {
            $resourcePath = str_replace(
                '{agentId}',
                ObjectSerializer::toPathValue($agentId),
                $resourcePath
            );
        }

        $headers['X-Algolia-Secure-User-Token'] = $xAlgoliaSecureUserToken;

        return $this->sendRequestWithHttpInfo('GET', $resourcePath, $headers, $queryParameters, $httpBody, $requestOptions);
    }

    /**
     * Get Provider (with HTTP info).
     *
     * Returns the response with HTTP metadata (status code, headers, body)
     * Get Provider.
     * Required API Key ACLs:
     *  - settings
     *
     * @param string $providerId     The providerId. (required)
     * @param array  $requestOptions Request options
     *
     * @return AlgoliaResponse
     */
    public function getProviderWithHttpInfo($providerId, $requestOptions = [])
    {
        // verify the required parameter 'providerId' is set
        if (!isset($providerId)) {
            throw new \InvalidArgumentException(
                'Parameter `providerId` is required when calling `getProvider`.'
            );
        }
        // verify the required parameter 'providerId' is not empty
        if (isset($providerId) && '' === $providerId) {
            throw new \InvalidArgumentException(
                'Parameter `providerId` is required when calling `getProvider`.'
            );
        }

        $resourcePath = '/agent-studio/1/providers/{providerId}';
        $queryParameters = [];
        $headers = [];
        $httpBody = null;

        // path params
        if (null !== $providerId) {
            $resourcePath = str_replace(
                '{providerId}',
                ObjectSerializer::toPathValue($providerId),
                $resourcePath
            );
        }

        return $this->sendRequestWithHttpInfo('GET', $resourcePath, $headers, $queryParameters, $httpBody, $requestOptions);
    }

    /**
     * Get Secret Key (with HTTP info).
     *
     * Returns the response with HTTP metadata (status code, headers, body)
     * Get Secret Key.
     * Required API Key ACLs:
     *  - settings
     *
     * @param string $secretKeyId    The secretKeyId. (required)
     * @param array  $requestOptions Request options
     *
     * @return AlgoliaResponse
     */
    public function getSecretKeyWithHttpInfo($secretKeyId, $requestOptions = [])
    {
        // verify the required parameter 'secretKeyId' is set
        if (!isset($secretKeyId)) {
            throw new \InvalidArgumentException(
                'Parameter `secretKeyId` is required when calling `getSecretKey`.'
            );
        }
        // verify the required parameter 'secretKeyId' is not empty
        if (isset($secretKeyId) && '' === $secretKeyId) {
            throw new \InvalidArgumentException(
                'Parameter `secretKeyId` is required when calling `getSecretKey`.'
            );
        }

        $resourcePath = '/agent-studio/1/secret-keys/{secretKeyId}';
        $queryParameters = [];
        $headers = [];
        $httpBody = null;

        // path params
        if (null !== $secretKeyId) {
            $resourcePath = str_replace(
                '{secretKeyId}',
                ObjectSerializer::toPathValue($secretKeyId),
                $resourcePath
            );
        }

        return $this->sendRequestWithHttpInfo('GET', $resourcePath, $headers, $queryParameters, $httpBody, $requestOptions);
    }

    /**
     * Get Data By User Token (with HTTP info).
     *
     * Returns the response with HTTP metadata (status code, headers, body)
     * Retrieves all memories, conversations and their messages for the given user token.
     * Required API Key ACLs:
     *  - logs
     *
     * @param string $userToken      The userToken. (required)
     * @param array  $requestOptions Request options
     *
     * @return AlgoliaResponse
     */
    public function getUserDataWithHttpInfo($userToken, $requestOptions = [])
    {
        // verify the required parameter 'userToken' is set
        if (!isset($userToken)) {
            throw new \InvalidArgumentException(
                'Parameter `userToken` is required when calling `getUserData`.'
            );
        }
        // verify the required parameter 'userToken' is not empty
        if (isset($userToken) && '' === $userToken) {
            throw new \InvalidArgumentException(
                'Parameter `userToken` is required when calling `getUserData`.'
            );
        }

        $resourcePath = '/agent-studio/1/user-data/{userToken}';
        $queryParameters = [];
        $headers = [];
        $httpBody = null;

        // path params
        if (null !== $userToken) {
            $resourcePath = str_replace(
                '{userToken}',
                ObjectSerializer::toPathValue($userToken),
                $resourcePath
            );
        }

        return $this->sendRequestWithHttpInfo('GET', $resourcePath, $headers, $queryParameters, $httpBody, $requestOptions);
    }

    /**
     * Invalidate Agent Cache (with HTTP info).
     *
     * Returns the response with HTTP metadata (status code, headers, body)
     * Invalidate cached completions for this agent. Filter with `before` (exclusive).
     * Required API Key ACLs:
     *  - editSettings
     *
     * @param string $agentId        The agentId. (required)
     * @param string $before         Delete entries strictly before this date (exclusive, YYYY-MM-DD). (optional)
     * @param array  $requestOptions Request options
     *
     * @return AlgoliaResponse
     */
    public function invalidateAgentCacheWithHttpInfo($agentId, $before = null, $requestOptions = [])
    {
        // verify the required parameter 'agentId' is set
        if (!isset($agentId)) {
            throw new \InvalidArgumentException(
                'Parameter `agentId` is required when calling `invalidateAgentCache`.'
            );
        }
        // verify the required parameter 'agentId' is not empty
        if (isset($agentId) && '' === $agentId) {
            throw new \InvalidArgumentException(
                'Parameter `agentId` is required when calling `invalidateAgentCache`.'
            );
        }

        $resourcePath = '/agent-studio/1/agents/{agentId}/cache';
        $queryParameters = [];
        $headers = [];
        $httpBody = null;

        if (null !== $before) {
            $queryParameters['before'] = $before;
        }

        // path params
        if (null !== $agentId) {
            $resourcePath = str_replace(
                '{agentId}',
                ObjectSerializer::toPathValue($agentId),
                $resourcePath
            );
        }

        return $this->sendRequestWithHttpInfo('DELETE', $resourcePath, $headers, $queryParameters, $httpBody, $requestOptions);
    }

    /**
     * List Allowed Domains (with HTTP info).
     *
     * Returns the response with HTTP metadata (status code, headers, body)
     * List all allowed domain patterns for this agent.
     * Required API Key ACLs:
     *  - settings
     *
     * @param string $agentId        The agentId. (required)
     * @param array  $requestOptions Request options
     *
     * @return AlgoliaResponse
     */
    public function listAgentAllowedDomainsWithHttpInfo($agentId, $requestOptions = [])
    {
        // verify the required parameter 'agentId' is set
        if (!isset($agentId)) {
            throw new \InvalidArgumentException(
                'Parameter `agentId` is required when calling `listAgentAllowedDomains`.'
            );
        }
        // verify the required parameter 'agentId' is not empty
        if (isset($agentId) && '' === $agentId) {
            throw new \InvalidArgumentException(
                'Parameter `agentId` is required when calling `listAgentAllowedDomains`.'
            );
        }

        $resourcePath = '/agent-studio/1/agents/{agentId}/allowed-domains';
        $queryParameters = [];
        $headers = [];
        $httpBody = null;

        // path params
        if (null !== $agentId) {
            $resourcePath = str_replace(
                '{agentId}',
                ObjectSerializer::toPathValue($agentId),
                $resourcePath
            );
        }

        return $this->sendRequestWithHttpInfo('GET', $resourcePath, $headers, $queryParameters, $httpBody, $requestOptions);
    }

    /**
     * List Conversations (with HTTP info).
     *
     * Returns the response with HTTP metadata (status code, headers, body)
     * Retrieves the conversations for the given agent ID.
     * Required API Key ACLs:
     *  - logs
     *
     * @param string $agentId                 The agentId. (required)
     * @param string $startDate               Filter conversations created after this date (format: YYYY-MM-DD). (optional)
     * @param string $endDate                 Filter conversations created before this date (format: YYYY-MM-DD). (optional)
     * @param bool   $includeFeedback         Include feedback per conversation. (optional)
     * @param int    $feedbackVote            Filter by feedback value (requires includeFeedback=true). (optional)
     * @param int    $page                    Page number. (optional)
     * @param int    $limit                   Items per page. (optional)
     * @param string $xAlgoliaSecureUserToken The X-Algolia-Secure-User-Token. (optional)
     * @param array  $requestOptions          Request options
     *
     * @return AlgoliaResponse
     */
    public function listAgentConversationsWithHttpInfo($agentId, $startDate = null, $endDate = null, $includeFeedback = null, $feedbackVote = null, $page = null, $limit = null, $xAlgoliaSecureUserToken = null, $requestOptions = [])
    {
        // verify the required parameter 'agentId' is set
        if (!isset($agentId)) {
            throw new \InvalidArgumentException(
                'Parameter `agentId` is required when calling `listAgentConversations`.'
            );
        }
        // verify the required parameter 'agentId' is not empty
        if (isset($agentId) && '' === $agentId) {
            throw new \InvalidArgumentException(
                'Parameter `agentId` is required when calling `listAgentConversations`.'
            );
        }

        $resourcePath = '/agent-studio/1/agents/{agentId}/conversations';
        $queryParameters = [];
        $headers = [];
        $httpBody = null;

        if (null !== $startDate) {
            $queryParameters['startDate'] = $startDate;
        }

        if (null !== $endDate) {
            $queryParameters['endDate'] = $endDate;
        }

        if (null !== $includeFeedback) {
            $queryParameters['includeFeedback'] = $includeFeedback;
        }

        if (null !== $feedbackVote) {
            $queryParameters['feedbackVote'] = $feedbackVote;
        }

        if (null !== $page) {
            $queryParameters['page'] = $page;
        }

        if (null !== $limit) {
            $queryParameters['limit'] = $limit;
        }

        // path params
        if (null !== $agentId) {
            $resourcePath = str_replace(
                '{agentId}',
                ObjectSerializer::toPathValue($agentId),
                $resourcePath
            );
        }

        $headers['X-Algolia-Secure-User-Token'] = $xAlgoliaSecureUserToken;

        return $this->sendRequestWithHttpInfo('GET', $resourcePath, $headers, $queryParameters, $httpBody, $requestOptions);
    }

    /**
     * List Agents (with HTTP info).
     *
     * Returns the response with HTTP metadata (status code, headers, body)
     * List all agents with pagination and filtering.
     * Required API Key ACLs:
     *  - settings
     *
     * @param int    $page           Page number. (optional)
     * @param int    $limit          Items per page. (optional)
     * @param string $providerId     Filter by provider id. (optional)
     * @param array  $requestOptions Request options
     *
     * @return AlgoliaResponse
     */
    public function listAgentsWithHttpInfo($page = null, $limit = null, $providerId = null, $requestOptions = [])
    {
        $resourcePath = '/agent-studio/1/agents';
        $queryParameters = [];
        $headers = [];
        $httpBody = null;

        if (null !== $page) {
            $queryParameters['page'] = $page;
        }

        if (null !== $limit) {
            $queryParameters['limit'] = $limit;
        }

        if (null !== $providerId) {
            $queryParameters['providerId'] = $providerId;
        }

        return $this->sendRequestWithHttpInfo('GET', $resourcePath, $headers, $queryParameters, $httpBody, $requestOptions);
    }

    /**
     * Get Provider Models (with HTTP info).
     *
     * Returns the response with HTTP metadata (status code, headers, body)
     * Get Provider Models.
     * Required API Key ACLs:
     *  - settings
     *
     * @param array $requestOptions Request options
     *
     * @return AlgoliaResponse
     */
    public function listModelsWithHttpInfo($requestOptions = [])
    {
        $resourcePath = '/agent-studio/1/providers/models';
        $queryParameters = [];
        $headers = [];
        $httpBody = null;

        return $this->sendRequestWithHttpInfo('GET', $resourcePath, $headers, $queryParameters, $httpBody, $requestOptions);
    }

    /**
     * Get Provider Models By Id (with HTTP info).
     *
     * Returns the response with HTTP metadata (status code, headers, body)
     * Get available models for a specific provider.
     * Required API Key ACLs:
     *  - settings
     *
     * @param string $providerId     The providerId. (required)
     * @param array  $requestOptions Request options
     *
     * @return AlgoliaResponse
     */
    public function listProviderModelsWithHttpInfo($providerId, $requestOptions = [])
    {
        // verify the required parameter 'providerId' is set
        if (!isset($providerId)) {
            throw new \InvalidArgumentException(
                'Parameter `providerId` is required when calling `listProviderModels`.'
            );
        }
        // verify the required parameter 'providerId' is not empty
        if (isset($providerId) && '' === $providerId) {
            throw new \InvalidArgumentException(
                'Parameter `providerId` is required when calling `listProviderModels`.'
            );
        }

        $resourcePath = '/agent-studio/1/providers/{providerId}/models';
        $queryParameters = [];
        $headers = [];
        $httpBody = null;

        // path params
        if (null !== $providerId) {
            $resourcePath = str_replace(
                '{providerId}',
                ObjectSerializer::toPathValue($providerId),
                $resourcePath
            );
        }

        return $this->sendRequestWithHttpInfo('GET', $resourcePath, $headers, $queryParameters, $httpBody, $requestOptions);
    }

    /**
     * List Providers (with HTTP info).
     *
     * Returns the response with HTTP metadata (status code, headers, body)
     * List Providers.
     * Required API Key ACLs:
     *  - settings
     *
     * @param int   $page           Page number. (optional)
     * @param int   $limit          Items per page. (optional)
     * @param array $requestOptions Request options
     *
     * @return AlgoliaResponse
     */
    public function listProvidersWithHttpInfo($page = null, $limit = null, $requestOptions = [])
    {
        $resourcePath = '/agent-studio/1/providers';
        $queryParameters = [];
        $headers = [];
        $httpBody = null;

        if (null !== $page) {
            $queryParameters['page'] = $page;
        }

        if (null !== $limit) {
            $queryParameters['limit'] = $limit;
        }

        return $this->sendRequestWithHttpInfo('GET', $resourcePath, $headers, $queryParameters, $httpBody, $requestOptions);
    }

    /**
     * List Secret Keys (with HTTP info).
     *
     * Returns the response with HTTP metadata (status code, headers, body)
     * List Secret Keys.
     * Required API Key ACLs:
     *  - settings
     *
     * @param int   $page           Page number. (optional)
     * @param int   $limit          Items per page. (optional)
     * @param array $requestOptions Request options
     *
     * @return AlgoliaResponse
     */
    public function listSecretKeysWithHttpInfo($page = null, $limit = null, $requestOptions = [])
    {
        $resourcePath = '/agent-studio/1/secret-keys';
        $queryParameters = [];
        $headers = [];
        $httpBody = null;

        if (null !== $page) {
            $queryParameters['page'] = $page;
        }

        if (null !== $limit) {
            $queryParameters['limit'] = $limit;
        }

        return $this->sendRequestWithHttpInfo('GET', $resourcePath, $headers, $queryParameters, $httpBody, $requestOptions);
    }

    /**
     * Publish Agent (with HTTP info).
     *
     * Returns the response with HTTP metadata (status code, headers, body)
     * Publish the specified agent.
     * Required API Key ACLs:
     *  - editSettings
     *
     * @param string $agentId        The agentId. (required)
     * @param array  $requestOptions Request options
     *
     * @return AlgoliaResponse
     */
    public function publishAgentWithHttpInfo($agentId, $requestOptions = [])
    {
        // verify the required parameter 'agentId' is set
        if (!isset($agentId)) {
            throw new \InvalidArgumentException(
                'Parameter `agentId` is required when calling `publishAgent`.'
            );
        }
        // verify the required parameter 'agentId' is not empty
        if (isset($agentId) && '' === $agentId) {
            throw new \InvalidArgumentException(
                'Parameter `agentId` is required when calling `publishAgent`.'
            );
        }

        $resourcePath = '/agent-studio/1/agents/{agentId}/publish';
        $queryParameters = [];
        $headers = [];
        $httpBody = null;

        // path params
        if (null !== $agentId) {
            $resourcePath = str_replace(
                '{agentId}',
                ObjectSerializer::toPathValue($agentId),
                $resourcePath
            );
        }

        return $this->sendRequestWithHttpInfo('POST', $resourcePath, $headers, $queryParameters, $httpBody, $requestOptions);
    }

    /**
     * Unpublish Agent (with HTTP info).
     *
     * Returns the response with HTTP metadata (status code, headers, body)
     * Unpublish the specified agent.
     * Required API Key ACLs:
     *  - editSettings
     *
     * @param string $agentId        The agentId. (required)
     * @param array  $requestOptions Request options
     *
     * @return AlgoliaResponse
     */
    public function unpublishAgentWithHttpInfo($agentId, $requestOptions = [])
    {
        // verify the required parameter 'agentId' is set
        if (!isset($agentId)) {
            throw new \InvalidArgumentException(
                'Parameter `agentId` is required when calling `unpublishAgent`.'
            );
        }
        // verify the required parameter 'agentId' is not empty
        if (isset($agentId) && '' === $agentId) {
            throw new \InvalidArgumentException(
                'Parameter `agentId` is required when calling `unpublishAgent`.'
            );
        }

        $resourcePath = '/agent-studio/1/agents/{agentId}/unpublish';
        $queryParameters = [];
        $headers = [];
        $httpBody = null;

        // path params
        if (null !== $agentId) {
            $resourcePath = str_replace(
                '{agentId}',
                ObjectSerializer::toPathValue($agentId),
                $resourcePath
            );
        }

        return $this->sendRequestWithHttpInfo('POST', $resourcePath, $headers, $queryParameters, $httpBody, $requestOptions);
    }

    /**
     * Update Agent (with HTTP info).
     *
     * Returns the response with HTTP metadata (status code, headers, body)
     * Update the specified agent.
     * Required API Key ACLs:
     *  - editSettings
     *
     * @param string                  $agentId           The agentId. (required)
     * @param AgentConfigUpdate|array $agentConfigUpdate (required)
     * @param array                   $requestOptions    Request options
     *
     * @return AlgoliaResponse
     */
    public function updateAgentWithHttpInfo($agentId, $agentConfigUpdate, $requestOptions = [])
    {
        // verify the required parameter 'agentId' is set
        if (!isset($agentId)) {
            throw new \InvalidArgumentException(
                'Parameter `agentId` is required when calling `updateAgent`.'
            );
        }
        // verify the required parameter 'agentId' is not empty
        if (isset($agentId) && '' === $agentId) {
            throw new \InvalidArgumentException(
                'Parameter `agentId` is required when calling `updateAgent`.'
            );
        }
        // verify the required parameter 'agentConfigUpdate' is set
        if (!isset($agentConfigUpdate)) {
            throw new \InvalidArgumentException(
                'Parameter `agentConfigUpdate` is required when calling `updateAgent`.'
            );
        }

        $resourcePath = '/agent-studio/1/agents/{agentId}';
        $queryParameters = [];
        $headers = [];
        $httpBody = $agentConfigUpdate;

        // path params
        if (null !== $agentId) {
            $resourcePath = str_replace(
                '{agentId}',
                ObjectSerializer::toPathValue($agentId),
                $resourcePath
            );
        }

        return $this->sendRequestWithHttpInfo('PATCH', $resourcePath, $headers, $queryParameters, $httpBody, $requestOptions);
    }

    /**
     * Patch Configuration (with HTTP info).
     *
     * Returns the response with HTTP metadata (status code, headers, body)
     * Patch Configuration.
     * Required API Key ACLs:
     *  - logs
     *
     * @param ApplicationConfigPatch|array $applicationConfigPatch (required)
     * @param array                        $requestOptions         Request options
     *
     * @return AlgoliaResponse
     */
    public function updateConfigurationWithHttpInfo($applicationConfigPatch, $requestOptions = [])
    {
        // verify the required parameter 'applicationConfigPatch' is set
        if (!isset($applicationConfigPatch)) {
            throw new \InvalidArgumentException(
                'Parameter `applicationConfigPatch` is required when calling `updateConfiguration`.'
            );
        }

        $resourcePath = '/agent-studio/1/configuration';
        $queryParameters = [];
        $headers = [];
        $httpBody = $applicationConfigPatch;

        return $this->sendRequestWithHttpInfo('PATCH', $resourcePath, $headers, $queryParameters, $httpBody, $requestOptions);
    }

    /**
     * Update Provider (with HTTP info).
     *
     * Returns the response with HTTP metadata (status code, headers, body)
     * Update Provider.
     * Required API Key ACLs:
     *  - editSettings
     *
     * @param string                            $providerId                  The providerId. (required)
     * @param array|ProviderAuthenticationPatch $providerAuthenticationPatch (required)
     * @param array                             $requestOptions              Request options
     *
     * @return AlgoliaResponse
     */
    public function updateProviderWithHttpInfo($providerId, $providerAuthenticationPatch, $requestOptions = [])
    {
        // verify the required parameter 'providerId' is set
        if (!isset($providerId)) {
            throw new \InvalidArgumentException(
                'Parameter `providerId` is required when calling `updateProvider`.'
            );
        }
        // verify the required parameter 'providerId' is not empty
        if (isset($providerId) && '' === $providerId) {
            throw new \InvalidArgumentException(
                'Parameter `providerId` is required when calling `updateProvider`.'
            );
        }
        // verify the required parameter 'providerAuthenticationPatch' is set
        if (!isset($providerAuthenticationPatch)) {
            throw new \InvalidArgumentException(
                'Parameter `providerAuthenticationPatch` is required when calling `updateProvider`.'
            );
        }

        $resourcePath = '/agent-studio/1/providers/{providerId}';
        $queryParameters = [];
        $headers = [];
        $httpBody = $providerAuthenticationPatch;

        // path params
        if (null !== $providerId) {
            $resourcePath = str_replace(
                '{providerId}',
                ObjectSerializer::toPathValue($providerId),
                $resourcePath
            );
        }

        return $this->sendRequestWithHttpInfo('PATCH', $resourcePath, $headers, $queryParameters, $httpBody, $requestOptions);
    }

    /**
     * Patch Secret Key (with HTTP info).
     *
     * Returns the response with HTTP metadata (status code, headers, body)
     * Patch Secret Key.
     * Required API Key ACLs:
     *  - admin
     *
     * @param string               $secretKeyId    The secretKeyId. (required)
     * @param array|SecretKeyPatch $secretKeyPatch (required)
     * @param array                $requestOptions Request options
     *
     * @return AlgoliaResponse
     */
    public function updateSecretKeyWithHttpInfo($secretKeyId, $secretKeyPatch, $requestOptions = [])
    {
        // verify the required parameter 'secretKeyId' is set
        if (!isset($secretKeyId)) {
            throw new \InvalidArgumentException(
                'Parameter `secretKeyId` is required when calling `updateSecretKey`.'
            );
        }
        // verify the required parameter 'secretKeyId' is not empty
        if (isset($secretKeyId) && '' === $secretKeyId) {
            throw new \InvalidArgumentException(
                'Parameter `secretKeyId` is required when calling `updateSecretKey`.'
            );
        }
        // verify the required parameter 'secretKeyPatch' is set
        if (!isset($secretKeyPatch)) {
            throw new \InvalidArgumentException(
                'Parameter `secretKeyPatch` is required when calling `updateSecretKey`.'
            );
        }

        $resourcePath = '/agent-studio/1/secret-keys/{secretKeyId}';
        $queryParameters = [];
        $headers = [];
        $httpBody = $secretKeyPatch;

        // path params
        if (null !== $secretKeyId) {
            $resourcePath = str_replace(
                '{secretKeyId}',
                ObjectSerializer::toPathValue($secretKeyId),
                $resourcePath
            );
        }

        return $this->sendRequestWithHttpInfo('PATCH', $resourcePath, $headers, $queryParameters, $httpBody, $requestOptions);
    }

    /**
     * Helper: Forges a secured user token (JWT) for Agent Studio authenticated requests.
     *
     * @param string $secretKey   the secret key to sign the token with
     * @param string $secretKeyId the key ID to include in the JWT header (kid)
     * @param string $userId      the user identifier to include as the subject (sub) claim
     * @param int    $expiresIn   The token expiration in seconds from now. Defaults to 86400 (24 hours).
     *
     * @return string the signed JWT token
     */
    public function forgeSecuredUserToken($secretKey, $secretKeyId, $userId, $expiresIn = 86400)
    {
        $header = rtrim(strtr(base64_encode(json_encode(['alg' => 'HS256', 'typ' => 'JWT', 'kid' => $secretKeyId], JSON_UNESCAPED_SLASHES)), '+/', '-_'), '=');
        $payload = rtrim(strtr(base64_encode(json_encode(['sub' => $userId, 'exp' => time() + $expiresIn], JSON_UNESCAPED_SLASHES)), '+/', '-_'), '=');
        $signature = rtrim(strtr(base64_encode(hash_hmac('sha256', $header.'.'.$payload, $secretKey, true)), '+/', '-_'), '=');

        return $header.'.'.$payload.'.'.$signature;
    }

    private function sendRequestWithHttpInfo($method, $resourcePath, $headers, $queryParameters, $httpBody, $requestOptions, $useReadTransporter = false)
    {
        if (!isset($requestOptions['headers'])) {
            $requestOptions['headers'] = [];
        }
        if (!isset($requestOptions['queryParameters'])) {
            $requestOptions['queryParameters'] = [];
        }

        $requestOptions['headers'] = array_merge($headers, $requestOptions['headers']);
        $requestOptions['queryParameters'] = array_merge($queryParameters, $requestOptions['queryParameters']);
        $query = Query::build($requestOptions['queryParameters']);

        return $this->api->sendRequest(
            $method,
            $resourcePath.($query ? "?{$query}" : ''),
            $httpBody,
            $requestOptions,
            $useReadTransporter,
            true
        );
    }
}
