Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
88.58% covered (warning)
88.58%
799 / 902
46.43% covered (danger)
46.43%
13 / 28
CRAP
0.00% covered (danger)
0.00%
0 / 1
FingerprintApi
88.58% covered (warning)
88.58%
799 / 902
46.43% covered (danger)
46.43%
13 / 28
105.88
0.00% covered (danger)
0.00%
0 / 1
 __construct
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
2
 getConfig
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 deleteVisitorData
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 deleteVisitorDataWithHttpInfo
48.39% covered (danger)
48.39%
15 / 31
0.00% covered (danger)
0.00%
0 / 1
10.95
 deleteVisitorDataAsync
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
1 / 1
1
 deleteVisitorDataAsyncWithHttpInfo
90.91% covered (success)
90.91%
10 / 11
0.00% covered (danger)
0.00%
0 / 1
1.00
 deleteVisitorDataRequest
100.00% covered (success)
100.00%
23 / 23
100.00% covered (success)
100.00%
1 / 1
3
 getEvent
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getEventWithHttpInfo
54.29% covered (warning)
54.29%
19 / 35
0.00% covered (danger)
0.00%
0 / 1
9.44
 getEventAsync
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
1 / 1
1
 getEventAsyncWithHttpInfo
93.75% covered (success)
93.75%
15 / 16
0.00% covered (danger)
0.00%
0 / 1
1.00
 getEventRequest
100.00% covered (success)
100.00%
31 / 31
100.00% covered (success)
100.00%
1 / 1
3
 searchEvents
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 searchEventsWithHttpInfo
54.29% covered (warning)
54.29%
19 / 35
0.00% covered (danger)
0.00%
0 / 1
9.44
 searchEventsAsync
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
1 / 1
1
 searchEventsAsyncWithHttpInfo
93.75% covered (success)
93.75%
15 / 16
0.00% covered (danger)
0.00%
0 / 1
1.00
 searchEventsRequest
99.06% covered (success)
99.06%
422 / 426
0.00% covered (danger)
0.00%
0 / 1
11
 updateEvent
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 updateEventWithHttpInfo
48.39% covered (danger)
48.39%
15 / 31
0.00% covered (danger)
0.00%
0 / 1
10.95
 updateEventAsync
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
1 / 1
1
 updateEventAsyncWithHttpInfo
90.91% covered (success)
90.91%
10 / 11
0.00% covered (danger)
0.00%
0 / 1
1.00
 updateEventRequest
100.00% covered (success)
100.00%
25 / 25
100.00% covered (success)
100.00%
1 / 1
3
 createHttpClientOption
50.00% covered (danger)
50.00%
5 / 10
0.00% covered (danger)
0.00%
0 / 1
8.12
 handleDeleteVisitorDataError
97.06% covered (success)
97.06%
33 / 34
0.00% covered (danger)
0.00%
0 / 1
6
 handleGetEventError
85.42% covered (warning)
85.42%
41 / 48
0.00% covered (danger)
0.00%
0 / 1
8.20
 handleSearchEventsError
79.41% covered (warning)
79.41%
27 / 34
0.00% covered (danger)
0.00%
0 / 1
6.31
 handleUpdateEventError
97.06% covered (success)
97.06%
33 / 34
0.00% covered (danger)
0.00%
0 / 1
6
 handleResponseWithDataType
44.44% covered (danger)
44.44%
8 / 18
0.00% covered (danger)
0.00%
0 / 1
4.54
1<?php
2
3/**
4 * FingerprintApi.
5 *
6 * @category Class
7 *
8 * @author   OpenAPI Generator team
9 *
10 * @see     https://openapi-generator.tech
11 */
12
13/**
14 * Server API.
15 *
16 * Fingerprint Server API allows you to get, search, and update Events in a server environment. It can be used for data exports, decision-making, and data analysis scenarios. Server API is intended for server-side usage, it's not intended to be used from the client side, whether it's a browser or a mobile device.
17 *
18 * The version of the OpenAPI document: 4
19 * Contact: support@fingerprint.com
20 * Generated by: https://openapi-generator.tech
21 * Generator version: 7.21.0
22 */
23
24/**
25 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
26 * https://openapi-generator.tech
27 * Do not edit the class manually.
28 */
29
30namespace Fingerprint\ServerSdk\Api;
31
32use Fingerprint\ServerSdk\ApiException;
33use Fingerprint\ServerSdk\Configuration;
34use Fingerprint\ServerSdk\Model\BotInfoCategory;
35use Fingerprint\ServerSdk\Model\BotInfoConfidence;
36use Fingerprint\ServerSdk\Model\BotInfoIdentity;
37use Fingerprint\ServerSdk\Model\Event;
38use Fingerprint\ServerSdk\Model\EventSearch;
39use Fingerprint\ServerSdk\Model\EventUpdate;
40use Fingerprint\ServerSdk\Model\SearchEventsBot;
41use Fingerprint\ServerSdk\Model\SearchEventsBotInfo;
42use Fingerprint\ServerSdk\Model\SearchEventsIncrementalIdentificationStatus;
43use Fingerprint\ServerSdk\Model\SearchEventsRareDevicePercentileBucket;
44use Fingerprint\ServerSdk\Model\SearchEventsSdkPlatform;
45use Fingerprint\ServerSdk\Model\SearchEventsVpnConfidence;
46use Fingerprint\ServerSdk\ObjectSerializer;
47use GuzzleHttp\Client;
48use GuzzleHttp\ClientInterface;
49use GuzzleHttp\Exception\ConnectException;
50use GuzzleHttp\Exception\GuzzleException;
51use GuzzleHttp\Exception\RequestException;
52use GuzzleHttp\Promise\PromiseInterface;
53use GuzzleHttp\Psr7\Request;
54use GuzzleHttp\RequestOptions;
55use GuzzleHttp\Utils;
56use Psr\Http\Message\RequestInterface;
57use Psr\Http\Message\ResponseInterface;
58
59/**
60 * FingerprintApi Class Doc Comment.
61 *
62 * @category Class
63 *
64 * @author   OpenAPI Generator team
65 *
66 * @see     https://openapi-generator.tech
67 */
68class FingerprintApi
69{
70    /**
71     * @var ClientInterface HTTP client used to make API requests
72     */
73    protected ClientInterface $client;
74
75    /**
76     * @var Configuration API client configuration
77     */
78    protected Configuration $config;
79
80    /**
81     * @var string integration information
82     */
83    protected string $integration_info = 'fingerprint-pro-server-php-sdk/7.2.0-beta.2';
84
85    /**
86     * @param Configuration        $config API client configuration
87     * @param ClientInterface|null $client HTTP client instance, defaults to a new Guzzle client
88     */
89    public function __construct(
90        Configuration $config,
91        ?ClientInterface $client = null
92    ) {
93        $this->client = $client ?: new Client();
94        $this->config = $config;
95    }
96
97    /**
98     * Get the API client configuration.
99     *
100     * @return Configuration the API client configuration
101     */
102    public function getConfig(): Configuration
103    {
104        return $this->config;
105    }
106
107    /**
108     * Operation deleteVisitorData.
109     *
110     * Delete a visitor ID
111     *
112     * @param string $visitor_id The [visitor ID](https://docs.fingerprint.com/reference/js-agent-v4-get-function#visitor_id) you want to delete. (required)
113     *
114     * @noinspection GrazieInspection
115     *
116     * @throws ApiException                  on non-2xx response or if the response body is not in the expected format
117     * @throws \InvalidArgumentException
118     * @throws GuzzleException
119     * @throws \DateMalformedStringException
120     */
121    public function deleteVisitorData(string $visitor_id): void
122    {
123        $this->deleteVisitorDataWithHttpInfo($visitor_id);
124    }
125
126    /**
127     * Operation deleteVisitorDataWithHttpInfo.
128     *
129     * Delete a visitor ID
130     *
131     * @param string $visitor_id The [visitor ID](https://docs.fingerprint.com/reference/js-agent-v4-get-function#visitor_id) you want to delete. (required)
132     *
133     * @noinspection GrazieInspection
134     *
135     * @return array{ null, ResponseInterface }
136     *
137     * @throws ApiException                  on non-2xx response or if the response body is not in the expected format
138     * @throws \InvalidArgumentException
139     * @throws GuzzleException
140     * @throws \DateMalformedStringException
141     */
142    public function deleteVisitorDataWithHttpInfo(string $visitor_id): array
143    {
144        $request = $this->deleteVisitorDataRequest($visitor_id);
145
146        try {
147            $options = $this->createHttpClientOption();
148
149            try {
150                $response = $this->client->send($request, $options);
151            } catch (RequestException $e) {
152                throw new ApiException(
153                    "[{$e->getCode()}{$e->getMessage()}",
154                    (int) $e->getCode(),
155                    $e->getResponse(),
156                    $e
157                );
158            } catch (ConnectException $e) {
159                throw new ApiException(
160                    "[{$e->getCode()}{$e->getMessage()}",
161                    (int) $e->getCode(),
162                    null,
163                    $e
164                );
165            }
166
167            $statusCode = $response->getStatusCode();
168
169            if ($statusCode < 200 || $statusCode > 299) {
170                throw new ApiException(
171                    sprintf(
172                        '[%d] Error connecting to the API (%s)',
173                        $statusCode,
174                        $request->getUri()
175                    ),
176                    $statusCode,
177                    $response
178                );
179            }
180
181            return [null, $response];
182        } catch (ApiException $e) {
183            $this->handleDeleteVisitorDataError($e);
184        }
185    }
186
187    /**
188     * Operation deleteVisitorDataAsync.
189     *
190     * Delete a visitor ID
191     *
192     * @param string $visitor_id The [visitor ID](https://docs.fingerprint.com/reference/js-agent-v4-get-function#visitor_id) you want to delete. (required)
193     *
194     * @noinspection GrazieInspection
195     *
196     * @return PromiseInterface promise resolving to the deserialized response
197     *
198     * @throws \InvalidArgumentException
199     */
200    public function deleteVisitorDataAsync(string $visitor_id): PromiseInterface
201    {
202        return $this->deleteVisitorDataAsyncWithHttpInfo($visitor_id)
203            ->then(
204                function ($response) {
205                    return $response[0];
206                }
207            );
208    }
209
210    /**
211     * Operation deleteVisitorDataAsyncWithHttpInfo.
212     *
213     * Delete a visitor ID
214     *
215     * @param string $visitor_id The [visitor ID](https://docs.fingerprint.com/reference/js-agent-v4-get-function#visitor_id) you want to delete. (required)
216     *
217     * @noinspection GrazieInspection
218     *
219     * @return PromiseInterface promise resolving to an array of deserialized data and the HTTP response
220     *
221     * @throws \InvalidArgumentException
222     */
223    public function deleteVisitorDataAsyncWithHttpInfo(string $visitor_id): PromiseInterface
224    {
225        $request = $this->deleteVisitorDataRequest($visitor_id);
226
227        return $this->client
228            ->sendAsync($request, $this->createHttpClientOption())
229            ->then(
230                function ($response) {
231                    return [null, $response];
232                },
233                function ($e) {
234                    $this->handleDeleteVisitorDataError($e);
235                }
236            );
237    }
238
239    /**
240     * Create request for operation 'deleteVisitorData'.
241     *
242     * @param string $visitor_id The [visitor ID](https://docs.fingerprint.com/reference/js-agent-v4-get-function#visitor_id) you want to delete. (required)
243     *
244     * @noinspection GrazieInspection
245     *
246     * @return Request the prepared HTTP request
247     *
248     * @throws \InvalidArgumentException
249     */
250    public function deleteVisitorDataRequest(string $visitor_id): Request
251    {
252        $resourcePath = '/visitors/{visitor_id}';
253        $headers = [
254            'Authorization' => 'Bearer '.$this->config->getApiKey(),
255        ];
256        $queryParams = ['ii' => $this->integration_info];
257        $headerParams = [];
258
259        // path params
260        $resourcePath = str_replace(
261            '{visitor_id}',
262            ObjectSerializer::toPathValue($visitor_id),
263            $resourcePath
264        );
265
266        if ($this->config->getUserAgent()) {
267            $headers['User-Agent'] = $this->config->getUserAgent();
268        }
269
270        $headers = array_merge(
271            $headerParams,
272            $headers
273        );
274
275        $query = ObjectSerializer::buildQuery($queryParams);
276
277        return new Request(
278            'DELETE',
279            $this->config->getHost().$resourcePath.($query ? "?$query" : ''),
280            $headers,
281        );
282    }
283
284    /**
285     * Operation getEvent.
286     *
287     * Get an event by event ID
288     *
289     * @param string      $event_id   The unique [identifier](https://docs.fingerprint.com/reference/js-agent-v4-get-function#event_id) of each identification request (`requestId` can be used in its place). (required)
290     * @param string|null $ruleset_id The ID of the ruleset to evaluate against the event, producing the action to take for this event. The resulting action is returned in the `rule_action` attribute of the response. (optional)
291     *
292     * @noinspection GrazieInspection
293     *
294     * @throws ApiException                  on non-2xx response or if the response body is not in the expected format
295     * @throws \InvalidArgumentException
296     * @throws GuzzleException
297     * @throws \DateMalformedStringException
298     */
299    public function getEvent(string $event_id, ?string $ruleset_id = null): Event
300    {
301        list($response) = $this->getEventWithHttpInfo($event_id, $ruleset_id);
302
303        return $response;
304    }
305
306    /**
307     * Operation getEventWithHttpInfo.
308     *
309     * Get an event by event ID
310     *
311     * @param string      $event_id   The unique [identifier](https://docs.fingerprint.com/reference/js-agent-v4-get-function#event_id) of each identification request (`requestId` can be used in its place). (required)
312     * @param string|null $ruleset_id The ID of the ruleset to evaluate against the event, producing the action to take for this event. The resulting action is returned in the `rule_action` attribute of the response. (optional)
313     *
314     * @noinspection GrazieInspection
315     *
316     * @return array{ Event|null, ResponseInterface }
317     *
318     * @throws ApiException                  on non-2xx response or if the response body is not in the expected format
319     * @throws \InvalidArgumentException
320     * @throws GuzzleException
321     * @throws \DateMalformedStringException
322     */
323    public function getEventWithHttpInfo(string $event_id, ?string $ruleset_id = null): array
324    {
325        $request = $this->getEventRequest($event_id, $ruleset_id);
326
327        try {
328            $options = $this->createHttpClientOption();
329
330            try {
331                $response = $this->client->send($request, $options);
332            } catch (RequestException $e) {
333                throw new ApiException(
334                    "[{$e->getCode()}{$e->getMessage()}",
335                    (int) $e->getCode(),
336                    $e->getResponse(),
337                    $e
338                );
339            } catch (ConnectException $e) {
340                throw new ApiException(
341                    "[{$e->getCode()}{$e->getMessage()}",
342                    (int) $e->getCode(),
343                    null,
344                    $e
345                );
346            }
347
348            $statusCode = $response->getStatusCode();
349
350            if ($statusCode < 200 || $statusCode > 299) {
351                throw new ApiException(
352                    sprintf(
353                        '[%d] Error connecting to the API (%s)',
354                        $statusCode,
355                        $request->getUri()
356                    ),
357                    $statusCode,
358                    $response
359                );
360            }
361
362            return $this->handleResponseWithDataType(
363                '\Fingerprint\ServerSdk\Model\Event',
364                $request,
365                $response
366            );
367        } catch (ApiException $e) {
368            $this->handleGetEventError($e);
369        }
370    }
371
372    /**
373     * Operation getEventAsync.
374     *
375     * Get an event by event ID
376     *
377     * @param string      $event_id   The unique [identifier](https://docs.fingerprint.com/reference/js-agent-v4-get-function#event_id) of each identification request (`requestId` can be used in its place). (required)
378     * @param string|null $ruleset_id The ID of the ruleset to evaluate against the event, producing the action to take for this event. The resulting action is returned in the `rule_action` attribute of the response. (optional)
379     *
380     * @noinspection GrazieInspection
381     *
382     * @return PromiseInterface promise resolving to the deserialized response
383     *
384     * @throws \InvalidArgumentException
385     */
386    public function getEventAsync(string $event_id, ?string $ruleset_id = null): PromiseInterface
387    {
388        return $this->getEventAsyncWithHttpInfo($event_id, $ruleset_id)
389            ->then(
390                function ($response) {
391                    return $response[0];
392                }
393            );
394    }
395
396    /**
397     * Operation getEventAsyncWithHttpInfo.
398     *
399     * Get an event by event ID
400     *
401     * @param string      $event_id   The unique [identifier](https://docs.fingerprint.com/reference/js-agent-v4-get-function#event_id) of each identification request (`requestId` can be used in its place). (required)
402     * @param string|null $ruleset_id The ID of the ruleset to evaluate against the event, producing the action to take for this event. The resulting action is returned in the `rule_action` attribute of the response. (optional)
403     *
404     * @noinspection GrazieInspection
405     *
406     * @return PromiseInterface promise resolving to an array of deserialized data and the HTTP response
407     *
408     * @throws \InvalidArgumentException
409     */
410    public function getEventAsyncWithHttpInfo(string $event_id, ?string $ruleset_id = null): PromiseInterface
411    {
412        $request = $this->getEventRequest($event_id, $ruleset_id);
413
414        return $this->client
415            ->sendAsync($request, $this->createHttpClientOption())
416            ->then(
417                function ($response) {
418                    $content = (string) $response->getBody();
419                    $response->getBody()->rewind();
420
421                    return [
422                        ObjectSerializer::deserialize($content, '\Fingerprint\ServerSdk\Model\Event'),
423                        $response,
424                    ];
425                },
426                function ($e) {
427                    $this->handleGetEventError($e);
428                }
429            );
430    }
431
432    /**
433     * Create request for operation 'getEvent'.
434     *
435     * @param string      $event_id   The unique [identifier](https://docs.fingerprint.com/reference/js-agent-v4-get-function#event_id) of each identification request (`requestId` can be used in its place). (required)
436     * @param string|null $ruleset_id The ID of the ruleset to evaluate against the event, producing the action to take for this event. The resulting action is returned in the `rule_action` attribute of the response. (optional)
437     *
438     * @noinspection GrazieInspection
439     *
440     * @return Request the prepared HTTP request
441     *
442     * @throws \InvalidArgumentException
443     */
444    public function getEventRequest(string $event_id, ?string $ruleset_id = null): Request
445    {
446        $resourcePath = '/events/{event_id}';
447        $headers = [
448            'Authorization' => 'Bearer '.$this->config->getApiKey(),
449        ];
450        $queryParams = ['ii' => $this->integration_info];
451        $headerParams = [];
452
453        // query params
454        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
455            $ruleset_id,
456            'ruleset_id',
457            'string',
458            'form',
459            true,
460            false
461        ) ?? []);
462
463        // path params
464        $resourcePath = str_replace(
465            '{event_id}',
466            ObjectSerializer::toPathValue($event_id),
467            $resourcePath
468        );
469
470        if ($this->config->getUserAgent()) {
471            $headers['User-Agent'] = $this->config->getUserAgent();
472        }
473
474        $headers = array_merge(
475            $headerParams,
476            $headers
477        );
478
479        $query = ObjectSerializer::buildQuery($queryParams);
480
481        return new Request(
482            'GET',
483            $this->config->getHost().$resourcePath.($query ? "?$query" : ''),
484            $headers,
485        );
486    }
487
488    /**
489     * Operation searchEvents.
490     *
491     * Search events
492     *
493     * @param int                                              $limit                             Maximum number of events to return. Results are selected from the time range (`start`, `end`), ordered by `reverse`, then truncated to provided `limit` size. So `reverse=true` returns the oldest N=`limit` events, otherwise the newest N=`limit` events. (optional, default to 10)
494     * @param string|null                                      $pagination_key                    Use `pagination_key` to get the next page of results.  When more results are available (e.g., you requested up to 100 results for your query using `limit`, but there are more than 100 events total matching your request), the `pagination_key` field is added to the response. The pagination key is an arbitrary string that should not be interpreted in any way and should be passed as-is. In the following request, use that value in the `pagination_key` parameter to get the next page of results:  1. First request, returning most recent 100 events: `GET api-base-url/events?limit=100` 2. Use `response.pagination_key` to get the next page of results: `GET api-base-url/events?limit=100&pagination_key=1740815825085` (optional)
495     * @param string|null                                      $visitor_id                        Unique [visitor identifier](https://docs.fingerprint.com/reference/js-agent-v4-get-function#visitor_id) issued by Fingerprint Identification and all active Smart Signals.  Filter events by matching Visitor ID (`identification.visitor_id` property). (optional)
496     * @param string|null                                      $high_recall_id                    The High Recall ID is a supplementary browser identifier designed for use cases that require wider coverage over precision. Compared to the standard visitor ID, the High Recall ID strives to match incoming browsers more generously (rather than precisely) with existing browsers and thus identifies fewer browsers as new. The High Recall ID is best suited for use cases that are sensitive to browsers being identified as new and where mismatched browsers are not detrimental.  Filter events by matching High Recall ID (`supplementary_id_high_recall.visitor_id` property). (optional)
497     * @param SearchEventsBot|null                             $bot                               Filter events by the Bot Detection result, specifically:   `all` - events where any kind of bot was detected.   `good` - events where a good bot was detected.   `bad` - events where a bad bot was detected.   `none` - events where no bot was detected. > Note: When using this parameter, only events with the `bot` property set to a valid value are returned. Events without a `bot` Smart Signal result are left out of the response. (optional)
498     * @param SearchEventsBotInfo|null                         $bot_info                          Filter events by their Bot Info result, specifically:   - `all` - events where any kind of bot was detected.   - `none` - events where no bot was detected. (optional)
499     * @param BotInfoCategory[]|null                           $bot_info_category                 Filter events by their Bot Info Category.  Multiple categories can be provided using the repeated keys syntax. For example, `bot_info_category=ai_agent&bot_info_category=ai_assistant`, will match events with a Bot Info Category of `ai_agent` or `ai_assistant`. Other notations like comma-separated or bracket notation are not supported. (optional)
500     * @param BotInfoIdentity[]|null                           $bot_info_identity                 Filter events by their Bot Info Identity type.  Multiple identity types can be provided using the repeated keys syntax. For example, `bot_info_identity=verified&bot_info_identity=signed`, will match events with a Bot Info Identity of `verified` or `signed`. Other notations like comma-separated or bracket notation are not supported. (optional)
501     * @param BotInfoConfidence[]|null                         $bot_info_confidence               Filter events by their Bot Info Confidence.  Multiple confidences can be provided using the repeated keys syntax. For example, `bot_info_confidence=high&bot_info_confidence=medium`, will match events with a Bot Info Confidence of `high` or `medium`. Other notations like comma-separated or bracket notation are not supported. (optional)
502     * @param string[]|null                                    $bot_info_provider                 Filter events by their Bot Info Provider. The provider must match exactly, partial or wildcard matching is not supported.  Multiple Providers can be provided using the repeated keys syntax. For example, `bot_info_provider=OpenAI&bot_info_provider=AWS`, will match events with a Bot Info Provider of `OpenAI` or `AWS`. Other notations like comma-separated or bracket notation are not supported. (optional)
503     * @param string[]|null                                    $bot_info_name                     Filter events by their Bot Info Name. The name must match exactly, partial or wildcard matching is not supported.  Multiple Names can be provided using the repeated keys syntax. For example, `bot_info_name=ChatGPT%20Agent&bot_info_name=Bedrock%20AgentCore`, will match events with a Bot Info Name of `ChatGPT Agent` or `Bedrock AgentCore`. Other notations like comma-separated or bracket notation are not supported. (optional)
504     * @param string|null                                      $ip_address                        Filter events by IP address or IP range (if CIDR notation is used). If CIDR notation is not used, a /32 for IPv4 or /128 for IPv6 is assumed. Examples of range based queries: 10.0.0.0/24, 192.168.0.1/32 (optional)
505     * @param string|null                                      $asn                               Filter events by the ASN associated with the event's IP address. This corresponds to the `ip_info.(v4|v6).asn` property in the response. (optional)
506     * @param string|null                                      $linked_id                         Filter events by your custom identifier.  You can use [linked Ids](https://docs.fingerprint.com/reference/js-agent-v4-get-function#linkedid) to associate identification requests with your own identifier, for example, session Id, purchase Id, or transaction Id. You can then use this `linked_id` parameter to retrieve all events associated with your custom identifier. (optional)
507     * @param string|null                                      $url                               Filter events by the URL (`url` property) associated with the event. (optional)
508     * @param string|null                                      $bundle_id                         Filter events by the Bundle ID (iOS) associated with the event. (optional)
509     * @param string|null                                      $package_name                      Filter events by the Package Name (Android) associated with the event. (optional)
510     * @param string|null                                      $origin                            Filter events by the origin field of the event. This is applicable to web events only (e.g., https://example.com) (optional)
511     * @param int|\DateTime|null                               $start                             Include events that happened after this point (with timestamp greater than or equal the provided `start` Unix milliseconds value or RFC3339 timestamp). Defaults to 7 days ago. Setting `start` does not change `end`'s default of `now` â€” adjust it separately if needed. (optional)
512     * @param int|\DateTime|null                               $end                               Include events that happened before this point (with timestamp less than or equal the provided `end` Unix milliseconds value or RFC3339 timestamp). Defaults to now. Setting `end` does not change `start`'s default of `7 days ago` â€” adjust it separately if needed. (optional)
513     * @param bool|null                                        $reverse                           When `true`, sort events oldest first (ascending timestamp order). Defaults to `false` (newest first, descending timestamp order). (optional)
514     * @param bool|null                                        $suspect                           Filter events previously tagged as suspicious via the [Update API](https://docs.fingerprint.com/reference/server-api-v4-update-event). > Note: When using this parameter, only events with the `suspect` property explicitly set to `true` or `false` are returned. Events with undefined `suspect` property are left out of the response. (optional)
515     * @param bool|null                                        $vpn                               Filter events by VPN Detection result. > Note: When using this parameter, only events with the `vpn` property set to `true` or `false` are returned. Events without a `vpn` Smart Signal result are left out of the response. (optional)
516     * @param bool|null                                        $virtual_machine                   Filter events by Virtual Machine Detection result. > Note: When using this parameter, only events with the `virtual_machine` property set to `true` or `false` are returned. Events without a `virtual_machine` Smart Signal result are left out of the response. (optional)
517     * @param bool|null                                        $tampering                         Filter events by Browser Tampering Detection result. > Note: When using this parameter, only events with the `tampering.result` property set to `true` or `false` are returned. Events without a `tampering` Smart Signal result are left out of the response. (optional)
518     * @param bool|null                                        $anti_detect_browser               Filter events by Anti-detect Browser Detection result. > Note: When using this parameter, only events with the `tampering.anti_detect_browser` property set to `true` or `false` are returned. Events without a `tampering` Smart Signal result are left out of the response. (optional)
519     * @param bool|null                                        $incognito                         Filter events by Browser Incognito Detection result. > Note: When using this parameter, only events with the `incognito` property set to `true` or `false` are returned. Events without an `incognito` Smart Signal result are left out of the response. (optional)
520     * @param bool|null                                        $privacy_settings                  Filter events by Privacy Settings Detection result. > Note: When using this parameter, only events with the `privacy_settings` property set to `true` or `false` are returned. Events without a `privacy_settings` Smart Signal result are left out of the response. (optional)
521     * @param bool|null                                        $jailbroken                        Filter events by Jailbroken Device Detection result. > Note: When using this parameter, only events with the `jailbroken` property set to `true` or `false` are returned. Events without a `jailbroken` Smart Signal result are left out of the response. (optional)
522     * @param bool|null                                        $frida                             Filter events by Frida Detection result. > Note: When using this parameter, only events with the `frida` property set to `true` or `false` are returned. Events without a `frida` Smart Signal result are left out of the response. (optional)
523     * @param bool|null                                        $factory_reset                     Filter events by Factory Reset Detection result. > Note: When using this parameter, only events with a `factory_reset` time. Events without a `factory_reset` Smart Signal result are left out of the response. (optional)
524     * @param bool|null                                        $cloned_app                        Filter events by Cloned App Detection result. > Note: When using this parameter, only events with the `cloned_app` property set to `true` or `false` are returned. Events without a `cloned_app` Smart Signal result are left out of the response. (optional)
525     * @param bool|null                                        $emulator                          Filter events by Android Emulator Detection result. > Note: When using this parameter, only events with the `emulator` property set to `true` or `false` are returned. Events without an `emulator` Smart Signal result are left out of the response. (optional)
526     * @param bool|null                                        $root_apps                         Filter events by Rooted Device Detection result. > Note: When using this parameter, only events with the `root_apps` property set to `true` or `false` are returned. Events without a `root_apps` Smart Signal result are left out of the response. (optional)
527     * @param SearchEventsVpnConfidence|null                   $vpn_confidence                    Filter events by VPN Detection result confidence level. `high` - events with high VPN Detection confidence. `medium` - events with medium VPN Detection confidence. `low` - events with low VPN Detection confidence. > Note: When using this parameter, only events with the `vpn.confidence` property set to a valid value are returned. Events without a `vpn` Smart Signal result are left out of the response. (optional)
528     * @param float|null                                       $min_suspect_score                 Filter events with Suspect Score result above a provided minimum threshold. > Note: When using this parameter, only events where the `suspect_score` property set to a value exceeding your threshold are returned. Events without a `suspect_score` Smart Signal result are left out of the response. (optional)
529     * @param bool|null                                        $developer_tools                   Filter events by Developer Tools detection result. > Note: When using this parameter, only events with the `developer_tools` property set to `true` or `false` are returned. Events without a `developer_tools` Smart Signal result are left out of the response. (optional)
530     * @param bool|null                                        $location_spoofing                 Filter events by Location Spoofing detection result. > Note: When using this parameter, only events with the `location_spoofing` property set to `true` or `false` are returned. Events without a `location_spoofing` Smart Signal result are left out of the response. (optional)
531     * @param bool|null                                        $mitm_attack                       Filter events by MITM (Man-in-the-Middle) Attack detection result. > Note: When using this parameter, only events with the `mitm_attack` property set to `true` or `false` are returned. Events without a `mitm_attack` Smart Signal result are left out of the response. (optional)
532     * @param bool|null                                        $rare_device                       Filter events by Device Rarity detection result. > Note: When using this parameter, only events with the `rare_device` property set to `true` or `false` are returned. Events without a Device Rarity Smart Signal result are left out of the response.  > This Smart Signal is currently in beta and only available to select customers. If you are interested, please [contact our support team](https://fingerprint.com/support/). (optional)
533     * @param SearchEventsRareDevicePercentileBucket|null      $rare_device_percentile_bucket     Filter events by Device Rarity percentile bucket. `<p95` - device configuration is in the bottom 95% (most common). `p95-p99` - device is in the 95th to 99th percentile. `p99-p99.5` - device is in the 99th to 99.5th percentile. `p99.5-p99.9` - device is in the 99.5th to 99.9th percentile. `p99.9+` - device is in the top 0.1% (rarest). `not_seen` - device configuration has never been observed before.  > This Smart Signal is currently in beta and only available to select customers. If you are interested, please [contact our support team](https://fingerprint.com/support/). (optional)
534     * @param bool|null                                        $proxy                             Filter events by Proxy detection result. > Note: When using this parameter, only events with the `proxy` property set to `true` or `false` are returned. Events without a `proxy` Smart Signal result are left out of the response. (optional)
535     * @param string|null                                      $sdk_version                       Filter events by a specific SDK version associated with the identification event (`sdk.version` property). Example: `3.11.14` (optional)
536     * @param SearchEventsSdkPlatform|null                     $sdk_platform                      Filter events by the SDK Platform associated with the identification event (`sdk.platform` property) . `js` - Javascript agent (Web). `ios` - Apple iOS based devices. `android` - Android based devices. (optional)
537     * @param string[]|null                                    $environment                       Filter for events by providing one or more environment IDs (`environment_id` property).  ### Array syntax To provide multiple environment IDs, use the repeated keys syntax (`environment=env1&environment=env2`). Other notations like comma-separated (`environment=env1,env2`) or bracket notation (`environment[]=env1&environment[]=env2`) are not supported. (optional)
538     * @param string|null                                      $proximity_id                      Filter events by the most precise Proximity ID provided by default. > Note: When using this parameter, only events with the `proximity.id` property matching the provided ID are returned. Events without a `proximity` result are left out of the response. (optional)
539     * @param int|null                                         $total_hits                        When set, the response will include a `total_hits` property with a count of total query matches across all pages, up to the specified limit. (optional)
540     * @param bool|null                                        $tor_node                          Filter events by Tor Node detection result. > Note: When using this parameter, only events with the `tor_node` property set to `true` or `false` are returned. Events without a `tor_node` detection result are left out of the response. (optional)
541     * @param SearchEventsIncrementalIdentificationStatus|null $incremental_identification_status Filter events by their incremental identification status (`incremental_identification_status` property). Non incremental identification events are left out of the response. (optional)
542     * @param bool|null                                        $simulator                         Filter events by iOS Simulator Detection result.  > Note: When using this parameter, only events with the `simulator` property set to `true` or `false` are returned. Events without a `simulator` Smart Signal result are left out of the response. (optional)
543     *
544     * @noinspection GrazieInspection
545     *
546     * @throws ApiException                  on non-2xx response or if the response body is not in the expected format
547     * @throws \InvalidArgumentException
548     * @throws GuzzleException
549     * @throws \DateMalformedStringException
550     */
551    public function searchEvents(int $limit = 10, ?string $pagination_key = null, ?string $visitor_id = null, ?string $high_recall_id = null, ?SearchEventsBot $bot = null, ?SearchEventsBotInfo $bot_info = null, ?array $bot_info_category = null, ?array $bot_info_identity = null, ?array $bot_info_confidence = null, ?array $bot_info_provider = null, ?array $bot_info_name = null, ?string $ip_address = null, ?string $asn = null, ?string $linked_id = null, ?string $url = null, ?string $bundle_id = null, ?string $package_name = null, ?string $origin = null, \DateTime|int|null $start = null, \DateTime|int|null $end = null, ?bool $reverse = null, ?bool $suspect = null, ?bool $vpn = null, ?bool $virtual_machine = null, ?bool $tampering = null, ?bool $anti_detect_browser = null, ?bool $incognito = null, ?bool $privacy_settings = null, ?bool $jailbroken = null, ?bool $frida = null, ?bool $factory_reset = null, ?bool $cloned_app = null, ?bool $emulator = null, ?bool $root_apps = null, ?SearchEventsVpnConfidence $vpn_confidence = null, ?float $min_suspect_score = null, ?bool $developer_tools = null, ?bool $location_spoofing = null, ?bool $mitm_attack = null, ?bool $rare_device = null, ?SearchEventsRareDevicePercentileBucket $rare_device_percentile_bucket = null, ?bool $proxy = null, ?string $sdk_version = null, ?SearchEventsSdkPlatform $sdk_platform = null, ?array $environment = null, ?string $proximity_id = null, ?int $total_hits = null, ?bool $tor_node = null, ?SearchEventsIncrementalIdentificationStatus $incremental_identification_status = null, ?bool $simulator = null): EventSearch
552    {
553        list($response) = $this->searchEventsWithHttpInfo($limit, $pagination_key, $visitor_id, $high_recall_id, $bot, $bot_info, $bot_info_category, $bot_info_identity, $bot_info_confidence, $bot_info_provider, $bot_info_name, $ip_address, $asn, $linked_id, $url, $bundle_id, $package_name, $origin, $start, $end, $reverse, $suspect, $vpn, $virtual_machine, $tampering, $anti_detect_browser, $incognito, $privacy_settings, $jailbroken, $frida, $factory_reset, $cloned_app, $emulator, $root_apps, $vpn_confidence, $min_suspect_score, $developer_tools, $location_spoofing, $mitm_attack, $rare_device, $rare_device_percentile_bucket, $proxy, $sdk_version, $sdk_platform, $environment, $proximity_id, $total_hits, $tor_node, $incremental_identification_status, $simulator);
554
555        return $response;
556    }
557
558    /**
559     * Operation searchEventsWithHttpInfo.
560     *
561     * Search events
562     *
563     * @param int                                              $limit                             Maximum number of events to return. Results are selected from the time range (`start`, `end`), ordered by `reverse`, then truncated to provided `limit` size. So `reverse=true` returns the oldest N=`limit` events, otherwise the newest N=`limit` events. (optional, default to 10)
564     * @param string|null                                      $pagination_key                    Use `pagination_key` to get the next page of results.  When more results are available (e.g., you requested up to 100 results for your query using `limit`, but there are more than 100 events total matching your request), the `pagination_key` field is added to the response. The pagination key is an arbitrary string that should not be interpreted in any way and should be passed as-is. In the following request, use that value in the `pagination_key` parameter to get the next page of results:  1. First request, returning most recent 100 events: `GET api-base-url/events?limit=100` 2. Use `response.pagination_key` to get the next page of results: `GET api-base-url/events?limit=100&pagination_key=1740815825085` (optional)
565     * @param string|null                                      $visitor_id                        Unique [visitor identifier](https://docs.fingerprint.com/reference/js-agent-v4-get-function#visitor_id) issued by Fingerprint Identification and all active Smart Signals.  Filter events by matching Visitor ID (`identification.visitor_id` property). (optional)
566     * @param string|null                                      $high_recall_id                    The High Recall ID is a supplementary browser identifier designed for use cases that require wider coverage over precision. Compared to the standard visitor ID, the High Recall ID strives to match incoming browsers more generously (rather than precisely) with existing browsers and thus identifies fewer browsers as new. The High Recall ID is best suited for use cases that are sensitive to browsers being identified as new and where mismatched browsers are not detrimental.  Filter events by matching High Recall ID (`supplementary_id_high_recall.visitor_id` property). (optional)
567     * @param SearchEventsBot|null                             $bot                               Filter events by the Bot Detection result, specifically:   `all` - events where any kind of bot was detected.   `good` - events where a good bot was detected.   `bad` - events where a bad bot was detected.   `none` - events where no bot was detected. > Note: When using this parameter, only events with the `bot` property set to a valid value are returned. Events without a `bot` Smart Signal result are left out of the response. (optional)
568     * @param SearchEventsBotInfo|null                         $bot_info                          Filter events by their Bot Info result, specifically:   - `all` - events where any kind of bot was detected.   - `none` - events where no bot was detected. (optional)
569     * @param BotInfoCategory[]|null                           $bot_info_category                 Filter events by their Bot Info Category.  Multiple categories can be provided using the repeated keys syntax. For example, `bot_info_category=ai_agent&bot_info_category=ai_assistant`, will match events with a Bot Info Category of `ai_agent` or `ai_assistant`. Other notations like comma-separated or bracket notation are not supported. (optional)
570     * @param BotInfoIdentity[]|null                           $bot_info_identity                 Filter events by their Bot Info Identity type.  Multiple identity types can be provided using the repeated keys syntax. For example, `bot_info_identity=verified&bot_info_identity=signed`, will match events with a Bot Info Identity of `verified` or `signed`. Other notations like comma-separated or bracket notation are not supported. (optional)
571     * @param BotInfoConfidence[]|null                         $bot_info_confidence               Filter events by their Bot Info Confidence.  Multiple confidences can be provided using the repeated keys syntax. For example, `bot_info_confidence=high&bot_info_confidence=medium`, will match events with a Bot Info Confidence of `high` or `medium`. Other notations like comma-separated or bracket notation are not supported. (optional)
572     * @param string[]|null                                    $bot_info_provider                 Filter events by their Bot Info Provider. The provider must match exactly, partial or wildcard matching is not supported.  Multiple Providers can be provided using the repeated keys syntax. For example, `bot_info_provider=OpenAI&bot_info_provider=AWS`, will match events with a Bot Info Provider of `OpenAI` or `AWS`. Other notations like comma-separated or bracket notation are not supported. (optional)
573     * @param string[]|null                                    $bot_info_name                     Filter events by their Bot Info Name. The name must match exactly, partial or wildcard matching is not supported.  Multiple Names can be provided using the repeated keys syntax. For example, `bot_info_name=ChatGPT%20Agent&bot_info_name=Bedrock%20AgentCore`, will match events with a Bot Info Name of `ChatGPT Agent` or `Bedrock AgentCore`. Other notations like comma-separated or bracket notation are not supported. (optional)
574     * @param string|null                                      $ip_address                        Filter events by IP address or IP range (if CIDR notation is used). If CIDR notation is not used, a /32 for IPv4 or /128 for IPv6 is assumed. Examples of range based queries: 10.0.0.0/24, 192.168.0.1/32 (optional)
575     * @param string|null                                      $asn                               Filter events by the ASN associated with the event's IP address. This corresponds to the `ip_info.(v4|v6).asn` property in the response. (optional)
576     * @param string|null                                      $linked_id                         Filter events by your custom identifier.  You can use [linked Ids](https://docs.fingerprint.com/reference/js-agent-v4-get-function#linkedid) to associate identification requests with your own identifier, for example, session Id, purchase Id, or transaction Id. You can then use this `linked_id` parameter to retrieve all events associated with your custom identifier. (optional)
577     * @param string|null                                      $url                               Filter events by the URL (`url` property) associated with the event. (optional)
578     * @param string|null                                      $bundle_id                         Filter events by the Bundle ID (iOS) associated with the event. (optional)
579     * @param string|null                                      $package_name                      Filter events by the Package Name (Android) associated with the event. (optional)
580     * @param string|null                                      $origin                            Filter events by the origin field of the event. This is applicable to web events only (e.g., https://example.com) (optional)
581     * @param int|\DateTime|null                               $start                             Include events that happened after this point (with timestamp greater than or equal the provided `start` Unix milliseconds value or RFC3339 timestamp). Defaults to 7 days ago. Setting `start` does not change `end`'s default of `now` â€” adjust it separately if needed. (optional)
582     * @param int|\DateTime|null                               $end                               Include events that happened before this point (with timestamp less than or equal the provided `end` Unix milliseconds value or RFC3339 timestamp). Defaults to now. Setting `end` does not change `start`'s default of `7 days ago` â€” adjust it separately if needed. (optional)
583     * @param bool|null                                        $reverse                           When `true`, sort events oldest first (ascending timestamp order). Defaults to `false` (newest first, descending timestamp order). (optional)
584     * @param bool|null                                        $suspect                           Filter events previously tagged as suspicious via the [Update API](https://docs.fingerprint.com/reference/server-api-v4-update-event). > Note: When using this parameter, only events with the `suspect` property explicitly set to `true` or `false` are returned. Events with undefined `suspect` property are left out of the response. (optional)
585     * @param bool|null                                        $vpn                               Filter events by VPN Detection result. > Note: When using this parameter, only events with the `vpn` property set to `true` or `false` are returned. Events without a `vpn` Smart Signal result are left out of the response. (optional)
586     * @param bool|null                                        $virtual_machine                   Filter events by Virtual Machine Detection result. > Note: When using this parameter, only events with the `virtual_machine` property set to `true` or `false` are returned. Events without a `virtual_machine` Smart Signal result are left out of the response. (optional)
587     * @param bool|null                                        $tampering                         Filter events by Browser Tampering Detection result. > Note: When using this parameter, only events with the `tampering.result` property set to `true` or `false` are returned. Events without a `tampering` Smart Signal result are left out of the response. (optional)
588     * @param bool|null                                        $anti_detect_browser               Filter events by Anti-detect Browser Detection result. > Note: When using this parameter, only events with the `tampering.anti_detect_browser` property set to `true` or `false` are returned. Events without a `tampering` Smart Signal result are left out of the response. (optional)
589     * @param bool|null                                        $incognito                         Filter events by Browser Incognito Detection result. > Note: When using this parameter, only events with the `incognito` property set to `true` or `false` are returned. Events without an `incognito` Smart Signal result are left out of the response. (optional)
590     * @param bool|null                                        $privacy_settings                  Filter events by Privacy Settings Detection result. > Note: When using this parameter, only events with the `privacy_settings` property set to `true` or `false` are returned. Events without a `privacy_settings` Smart Signal result are left out of the response. (optional)
591     * @param bool|null                                        $jailbroken                        Filter events by Jailbroken Device Detection result. > Note: When using this parameter, only events with the `jailbroken` property set to `true` or `false` are returned. Events without a `jailbroken` Smart Signal result are left out of the response. (optional)
592     * @param bool|null                                        $frida                             Filter events by Frida Detection result. > Note: When using this parameter, only events with the `frida` property set to `true` or `false` are returned. Events without a `frida` Smart Signal result are left out of the response. (optional)
593     * @param bool|null                                        $factory_reset                     Filter events by Factory Reset Detection result. > Note: When using this parameter, only events with a `factory_reset` time. Events without a `factory_reset` Smart Signal result are left out of the response. (optional)
594     * @param bool|null                                        $cloned_app                        Filter events by Cloned App Detection result. > Note: When using this parameter, only events with the `cloned_app` property set to `true` or `false` are returned. Events without a `cloned_app` Smart Signal result are left out of the response. (optional)
595     * @param bool|null                                        $emulator                          Filter events by Android Emulator Detection result. > Note: When using this parameter, only events with the `emulator` property set to `true` or `false` are returned. Events without an `emulator` Smart Signal result are left out of the response. (optional)
596     * @param bool|null                                        $root_apps                         Filter events by Rooted Device Detection result. > Note: When using this parameter, only events with the `root_apps` property set to `true` or `false` are returned. Events without a `root_apps` Smart Signal result are left out of the response. (optional)
597     * @param SearchEventsVpnConfidence|null                   $vpn_confidence                    Filter events by VPN Detection result confidence level. `high` - events with high VPN Detection confidence. `medium` - events with medium VPN Detection confidence. `low` - events with low VPN Detection confidence. > Note: When using this parameter, only events with the `vpn.confidence` property set to a valid value are returned. Events without a `vpn` Smart Signal result are left out of the response. (optional)
598     * @param float|null                                       $min_suspect_score                 Filter events with Suspect Score result above a provided minimum threshold. > Note: When using this parameter, only events where the `suspect_score` property set to a value exceeding your threshold are returned. Events without a `suspect_score` Smart Signal result are left out of the response. (optional)
599     * @param bool|null                                        $developer_tools                   Filter events by Developer Tools detection result. > Note: When using this parameter, only events with the `developer_tools` property set to `true` or `false` are returned. Events without a `developer_tools` Smart Signal result are left out of the response. (optional)
600     * @param bool|null                                        $location_spoofing                 Filter events by Location Spoofing detection result. > Note: When using this parameter, only events with the `location_spoofing` property set to `true` or `false` are returned. Events without a `location_spoofing` Smart Signal result are left out of the response. (optional)
601     * @param bool|null                                        $mitm_attack                       Filter events by MITM (Man-in-the-Middle) Attack detection result. > Note: When using this parameter, only events with the `mitm_attack` property set to `true` or `false` are returned. Events without a `mitm_attack` Smart Signal result are left out of the response. (optional)
602     * @param bool|null                                        $rare_device                       Filter events by Device Rarity detection result. > Note: When using this parameter, only events with the `rare_device` property set to `true` or `false` are returned. Events without a Device Rarity Smart Signal result are left out of the response.  > This Smart Signal is currently in beta and only available to select customers. If you are interested, please [contact our support team](https://fingerprint.com/support/). (optional)
603     * @param SearchEventsRareDevicePercentileBucket|null      $rare_device_percentile_bucket     Filter events by Device Rarity percentile bucket. `<p95` - device configuration is in the bottom 95% (most common). `p95-p99` - device is in the 95th to 99th percentile. `p99-p99.5` - device is in the 99th to 99.5th percentile. `p99.5-p99.9` - device is in the 99.5th to 99.9th percentile. `p99.9+` - device is in the top 0.1% (rarest). `not_seen` - device configuration has never been observed before.  > This Smart Signal is currently in beta and only available to select customers. If you are interested, please [contact our support team](https://fingerprint.com/support/). (optional)
604     * @param bool|null                                        $proxy                             Filter events by Proxy detection result. > Note: When using this parameter, only events with the `proxy` property set to `true` or `false` are returned. Events without a `proxy` Smart Signal result are left out of the response. (optional)
605     * @param string|null                                      $sdk_version                       Filter events by a specific SDK version associated with the identification event (`sdk.version` property). Example: `3.11.14` (optional)
606     * @param SearchEventsSdkPlatform|null                     $sdk_platform                      Filter events by the SDK Platform associated with the identification event (`sdk.platform` property) . `js` - Javascript agent (Web). `ios` - Apple iOS based devices. `android` - Android based devices. (optional)
607     * @param string[]|null                                    $environment                       Filter for events by providing one or more environment IDs (`environment_id` property).  ### Array syntax To provide multiple environment IDs, use the repeated keys syntax (`environment=env1&environment=env2`). Other notations like comma-separated (`environment=env1,env2`) or bracket notation (`environment[]=env1&environment[]=env2`) are not supported. (optional)
608     * @param string|null                                      $proximity_id                      Filter events by the most precise Proximity ID provided by default. > Note: When using this parameter, only events with the `proximity.id` property matching the provided ID are returned. Events without a `proximity` result are left out of the response. (optional)
609     * @param int|null                                         $total_hits                        When set, the response will include a `total_hits` property with a count of total query matches across all pages, up to the specified limit. (optional)
610     * @param bool|null                                        $tor_node                          Filter events by Tor Node detection result. > Note: When using this parameter, only events with the `tor_node` property set to `true` or `false` are returned. Events without a `tor_node` detection result are left out of the response. (optional)
611     * @param SearchEventsIncrementalIdentificationStatus|null $incremental_identification_status Filter events by their incremental identification status (`incremental_identification_status` property). Non incremental identification events are left out of the response. (optional)
612     * @param bool|null                                        $simulator                         Filter events by iOS Simulator Detection result.  > Note: When using this parameter, only events with the `simulator` property set to `true` or `false` are returned. Events without a `simulator` Smart Signal result are left out of the response. (optional)
613     *
614     * @noinspection GrazieInspection
615     *
616     * @return array{ EventSearch|null, ResponseInterface }
617     *
618     * @throws ApiException                  on non-2xx response or if the response body is not in the expected format
619     * @throws \InvalidArgumentException
620     * @throws GuzzleException
621     * @throws \DateMalformedStringException
622     */
623    public function searchEventsWithHttpInfo(int $limit = 10, ?string $pagination_key = null, ?string $visitor_id = null, ?string $high_recall_id = null, ?SearchEventsBot $bot = null, ?SearchEventsBotInfo $bot_info = null, ?array $bot_info_category = null, ?array $bot_info_identity = null, ?array $bot_info_confidence = null, ?array $bot_info_provider = null, ?array $bot_info_name = null, ?string $ip_address = null, ?string $asn = null, ?string $linked_id = null, ?string $url = null, ?string $bundle_id = null, ?string $package_name = null, ?string $origin = null, \DateTime|int|null $start = null, \DateTime|int|null $end = null, ?bool $reverse = null, ?bool $suspect = null, ?bool $vpn = null, ?bool $virtual_machine = null, ?bool $tampering = null, ?bool $anti_detect_browser = null, ?bool $incognito = null, ?bool $privacy_settings = null, ?bool $jailbroken = null, ?bool $frida = null, ?bool $factory_reset = null, ?bool $cloned_app = null, ?bool $emulator = null, ?bool $root_apps = null, ?SearchEventsVpnConfidence $vpn_confidence = null, ?float $min_suspect_score = null, ?bool $developer_tools = null, ?bool $location_spoofing = null, ?bool $mitm_attack = null, ?bool $rare_device = null, ?SearchEventsRareDevicePercentileBucket $rare_device_percentile_bucket = null, ?bool $proxy = null, ?string $sdk_version = null, ?SearchEventsSdkPlatform $sdk_platform = null, ?array $environment = null, ?string $proximity_id = null, ?int $total_hits = null, ?bool $tor_node = null, ?SearchEventsIncrementalIdentificationStatus $incremental_identification_status = null, ?bool $simulator = null): array
624    {
625        $request = $this->searchEventsRequest($limit, $pagination_key, $visitor_id, $high_recall_id, $bot, $bot_info, $bot_info_category, $bot_info_identity, $bot_info_confidence, $bot_info_provider, $bot_info_name, $ip_address, $asn, $linked_id, $url, $bundle_id, $package_name, $origin, $start, $end, $reverse, $suspect, $vpn, $virtual_machine, $tampering, $anti_detect_browser, $incognito, $privacy_settings, $jailbroken, $frida, $factory_reset, $cloned_app, $emulator, $root_apps, $vpn_confidence, $min_suspect_score, $developer_tools, $location_spoofing, $mitm_attack, $rare_device, $rare_device_percentile_bucket, $proxy, $sdk_version, $sdk_platform, $environment, $proximity_id, $total_hits, $tor_node, $incremental_identification_status, $simulator);
626
627        try {
628            $options = $this->createHttpClientOption();
629
630            try {
631                $response = $this->client->send($request, $options);
632            } catch (RequestException $e) {
633                throw new ApiException(
634                    "[{$e->getCode()}{$e->getMessage()}",
635                    (int) $e->getCode(),
636                    $e->getResponse(),
637                    $e
638                );
639            } catch (ConnectException $e) {
640                throw new ApiException(
641                    "[{$e->getCode()}{$e->getMessage()}",
642                    (int) $e->getCode(),
643                    null,
644                    $e
645                );
646            }
647
648            $statusCode = $response->getStatusCode();
649
650            if ($statusCode < 200 || $statusCode > 299) {
651                throw new ApiException(
652                    sprintf(
653                        '[%d] Error connecting to the API (%s)',
654                        $statusCode,
655                        $request->getUri()
656                    ),
657                    $statusCode,
658                    $response
659                );
660            }
661
662            return $this->handleResponseWithDataType(
663                '\Fingerprint\ServerSdk\Model\EventSearch',
664                $request,
665                $response
666            );
667        } catch (ApiException $e) {
668            $this->handleSearchEventsError($e);
669        }
670    }
671
672    /**
673     * Operation searchEventsAsync.
674     *
675     * Search events
676     *
677     * @param int                                              $limit                             Maximum number of events to return. Results are selected from the time range (`start`, `end`), ordered by `reverse`, then truncated to provided `limit` size. So `reverse=true` returns the oldest N=`limit` events, otherwise the newest N=`limit` events. (optional, default to 10)
678     * @param string|null                                      $pagination_key                    Use `pagination_key` to get the next page of results.  When more results are available (e.g., you requested up to 100 results for your query using `limit`, but there are more than 100 events total matching your request), the `pagination_key` field is added to the response. The pagination key is an arbitrary string that should not be interpreted in any way and should be passed as-is. In the following request, use that value in the `pagination_key` parameter to get the next page of results:  1. First request, returning most recent 100 events: `GET api-base-url/events?limit=100` 2. Use `response.pagination_key` to get the next page of results: `GET api-base-url/events?limit=100&pagination_key=1740815825085` (optional)
679     * @param string|null                                      $visitor_id                        Unique [visitor identifier](https://docs.fingerprint.com/reference/js-agent-v4-get-function#visitor_id) issued by Fingerprint Identification and all active Smart Signals.  Filter events by matching Visitor ID (`identification.visitor_id` property). (optional)
680     * @param string|null                                      $high_recall_id                    The High Recall ID is a supplementary browser identifier designed for use cases that require wider coverage over precision. Compared to the standard visitor ID, the High Recall ID strives to match incoming browsers more generously (rather than precisely) with existing browsers and thus identifies fewer browsers as new. The High Recall ID is best suited for use cases that are sensitive to browsers being identified as new and where mismatched browsers are not detrimental.  Filter events by matching High Recall ID (`supplementary_id_high_recall.visitor_id` property). (optional)
681     * @param SearchEventsBot|null                             $bot                               Filter events by the Bot Detection result, specifically:   `all` - events where any kind of bot was detected.   `good` - events where a good bot was detected.   `bad` - events where a bad bot was detected.   `none` - events where no bot was detected. > Note: When using this parameter, only events with the `bot` property set to a valid value are returned. Events without a `bot` Smart Signal result are left out of the response. (optional)
682     * @param SearchEventsBotInfo|null                         $bot_info                          Filter events by their Bot Info result, specifically:   - `all` - events where any kind of bot was detected.   - `none` - events where no bot was detected. (optional)
683     * @param BotInfoCategory[]|null                           $bot_info_category                 Filter events by their Bot Info Category.  Multiple categories can be provided using the repeated keys syntax. For example, `bot_info_category=ai_agent&bot_info_category=ai_assistant`, will match events with a Bot Info Category of `ai_agent` or `ai_assistant`. Other notations like comma-separated or bracket notation are not supported. (optional)
684     * @param BotInfoIdentity[]|null                           $bot_info_identity                 Filter events by their Bot Info Identity type.  Multiple identity types can be provided using the repeated keys syntax. For example, `bot_info_identity=verified&bot_info_identity=signed`, will match events with a Bot Info Identity of `verified` or `signed`. Other notations like comma-separated or bracket notation are not supported. (optional)
685     * @param BotInfoConfidence[]|null                         $bot_info_confidence               Filter events by their Bot Info Confidence.  Multiple confidences can be provided using the repeated keys syntax. For example, `bot_info_confidence=high&bot_info_confidence=medium`, will match events with a Bot Info Confidence of `high` or `medium`. Other notations like comma-separated or bracket notation are not supported. (optional)
686     * @param string[]|null                                    $bot_info_provider                 Filter events by their Bot Info Provider. The provider must match exactly, partial or wildcard matching is not supported.  Multiple Providers can be provided using the repeated keys syntax. For example, `bot_info_provider=OpenAI&bot_info_provider=AWS`, will match events with a Bot Info Provider of `OpenAI` or `AWS`. Other notations like comma-separated or bracket notation are not supported. (optional)
687     * @param string[]|null                                    $bot_info_name                     Filter events by their Bot Info Name. The name must match exactly, partial or wildcard matching is not supported.  Multiple Names can be provided using the repeated keys syntax. For example, `bot_info_name=ChatGPT%20Agent&bot_info_name=Bedrock%20AgentCore`, will match events with a Bot Info Name of `ChatGPT Agent` or `Bedrock AgentCore`. Other notations like comma-separated or bracket notation are not supported. (optional)
688     * @param string|null                                      $ip_address                        Filter events by IP address or IP range (if CIDR notation is used). If CIDR notation is not used, a /32 for IPv4 or /128 for IPv6 is assumed. Examples of range based queries: 10.0.0.0/24, 192.168.0.1/32 (optional)
689     * @param string|null                                      $asn                               Filter events by the ASN associated with the event's IP address. This corresponds to the `ip_info.(v4|v6).asn` property in the response. (optional)
690     * @param string|null                                      $linked_id                         Filter events by your custom identifier.  You can use [linked Ids](https://docs.fingerprint.com/reference/js-agent-v4-get-function#linkedid) to associate identification requests with your own identifier, for example, session Id, purchase Id, or transaction Id. You can then use this `linked_id` parameter to retrieve all events associated with your custom identifier. (optional)
691     * @param string|null                                      $url                               Filter events by the URL (`url` property) associated with the event. (optional)
692     * @param string|null                                      $bundle_id                         Filter events by the Bundle ID (iOS) associated with the event. (optional)
693     * @param string|null                                      $package_name                      Filter events by the Package Name (Android) associated with the event. (optional)
694     * @param string|null                                      $origin                            Filter events by the origin field of the event. This is applicable to web events only (e.g., https://example.com) (optional)
695     * @param int|\DateTime|null                               $start                             Include events that happened after this point (with timestamp greater than or equal the provided `start` Unix milliseconds value or RFC3339 timestamp). Defaults to 7 days ago. Setting `start` does not change `end`'s default of `now` â€” adjust it separately if needed. (optional)
696     * @param int|\DateTime|null                               $end                               Include events that happened before this point (with timestamp less than or equal the provided `end` Unix milliseconds value or RFC3339 timestamp). Defaults to now. Setting `end` does not change `start`'s default of `7 days ago` â€” adjust it separately if needed. (optional)
697     * @param bool|null                                        $reverse                           When `true`, sort events oldest first (ascending timestamp order). Defaults to `false` (newest first, descending timestamp order). (optional)
698     * @param bool|null                                        $suspect                           Filter events previously tagged as suspicious via the [Update API](https://docs.fingerprint.com/reference/server-api-v4-update-event). > Note: When using this parameter, only events with the `suspect` property explicitly set to `true` or `false` are returned. Events with undefined `suspect` property are left out of the response. (optional)
699     * @param bool|null                                        $vpn                               Filter events by VPN Detection result. > Note: When using this parameter, only events with the `vpn` property set to `true` or `false` are returned. Events without a `vpn` Smart Signal result are left out of the response. (optional)
700     * @param bool|null                                        $virtual_machine                   Filter events by Virtual Machine Detection result. > Note: When using this parameter, only events with the `virtual_machine` property set to `true` or `false` are returned. Events without a `virtual_machine` Smart Signal result are left out of the response. (optional)
701     * @param bool|null                                        $tampering                         Filter events by Browser Tampering Detection result. > Note: When using this parameter, only events with the `tampering.result` property set to `true` or `false` are returned. Events without a `tampering` Smart Signal result are left out of the response. (optional)
702     * @param bool|null                                        $anti_detect_browser               Filter events by Anti-detect Browser Detection result. > Note: When using this parameter, only events with the `tampering.anti_detect_browser` property set to `true` or `false` are returned. Events without a `tampering` Smart Signal result are left out of the response. (optional)
703     * @param bool|null                                        $incognito                         Filter events by Browser Incognito Detection result. > Note: When using this parameter, only events with the `incognito` property set to `true` or `false` are returned. Events without an `incognito` Smart Signal result are left out of the response. (optional)
704     * @param bool|null                                        $privacy_settings                  Filter events by Privacy Settings Detection result. > Note: When using this parameter, only events with the `privacy_settings` property set to `true` or `false` are returned. Events without a `privacy_settings` Smart Signal result are left out of the response. (optional)
705     * @param bool|null                                        $jailbroken                        Filter events by Jailbroken Device Detection result. > Note: When using this parameter, only events with the `jailbroken` property set to `true` or `false` are returned. Events without a `jailbroken` Smart Signal result are left out of the response. (optional)
706     * @param bool|null                                        $frida                             Filter events by Frida Detection result. > Note: When using this parameter, only events with the `frida` property set to `true` or `false` are returned. Events without a `frida` Smart Signal result are left out of the response. (optional)
707     * @param bool|null                                        $factory_reset                     Filter events by Factory Reset Detection result. > Note: When using this parameter, only events with a `factory_reset` time. Events without a `factory_reset` Smart Signal result are left out of the response. (optional)
708     * @param bool|null                                        $cloned_app                        Filter events by Cloned App Detection result. > Note: When using this parameter, only events with the `cloned_app` property set to `true` or `false` are returned. Events without a `cloned_app` Smart Signal result are left out of the response. (optional)
709     * @param bool|null                                        $emulator                          Filter events by Android Emulator Detection result. > Note: When using this parameter, only events with the `emulator` property set to `true` or `false` are returned. Events without an `emulator` Smart Signal result are left out of the response. (optional)
710     * @param bool|null                                        $root_apps                         Filter events by Rooted Device Detection result. > Note: When using this parameter, only events with the `root_apps` property set to `true` or `false` are returned. Events without a `root_apps` Smart Signal result are left out of the response. (optional)
711     * @param SearchEventsVpnConfidence|null                   $vpn_confidence                    Filter events by VPN Detection result confidence level. `high` - events with high VPN Detection confidence. `medium` - events with medium VPN Detection confidence. `low` - events with low VPN Detection confidence. > Note: When using this parameter, only events with the `vpn.confidence` property set to a valid value are returned. Events without a `vpn` Smart Signal result are left out of the response. (optional)
712     * @param float|null                                       $min_suspect_score                 Filter events with Suspect Score result above a provided minimum threshold. > Note: When using this parameter, only events where the `suspect_score` property set to a value exceeding your threshold are returned. Events without a `suspect_score` Smart Signal result are left out of the response. (optional)
713     * @param bool|null                                        $developer_tools                   Filter events by Developer Tools detection result. > Note: When using this parameter, only events with the `developer_tools` property set to `true` or `false` are returned. Events without a `developer_tools` Smart Signal result are left out of the response. (optional)
714     * @param bool|null                                        $location_spoofing                 Filter events by Location Spoofing detection result. > Note: When using this parameter, only events with the `location_spoofing` property set to `true` or `false` are returned. Events without a `location_spoofing` Smart Signal result are left out of the response. (optional)
715     * @param bool|null                                        $mitm_attack                       Filter events by MITM (Man-in-the-Middle) Attack detection result. > Note: When using this parameter, only events with the `mitm_attack` property set to `true` or `false` are returned. Events without a `mitm_attack` Smart Signal result are left out of the response. (optional)
716     * @param bool|null                                        $rare_device                       Filter events by Device Rarity detection result. > Note: When using this parameter, only events with the `rare_device` property set to `true` or `false` are returned. Events without a Device Rarity Smart Signal result are left out of the response.  > This Smart Signal is currently in beta and only available to select customers. If you are interested, please [contact our support team](https://fingerprint.com/support/). (optional)
717     * @param SearchEventsRareDevicePercentileBucket|null      $rare_device_percentile_bucket     Filter events by Device Rarity percentile bucket. `<p95` - device configuration is in the bottom 95% (most common). `p95-p99` - device is in the 95th to 99th percentile. `p99-p99.5` - device is in the 99th to 99.5th percentile. `p99.5-p99.9` - device is in the 99.5th to 99.9th percentile. `p99.9+` - device is in the top 0.1% (rarest). `not_seen` - device configuration has never been observed before.  > This Smart Signal is currently in beta and only available to select customers. If you are interested, please [contact our support team](https://fingerprint.com/support/). (optional)
718     * @param bool|null                                        $proxy                             Filter events by Proxy detection result. > Note: When using this parameter, only events with the `proxy` property set to `true` or `false` are returned. Events without a `proxy` Smart Signal result are left out of the response. (optional)
719     * @param string|null                                      $sdk_version                       Filter events by a specific SDK version associated with the identification event (`sdk.version` property). Example: `3.11.14` (optional)
720     * @param SearchEventsSdkPlatform|null                     $sdk_platform                      Filter events by the SDK Platform associated with the identification event (`sdk.platform` property) . `js` - Javascript agent (Web). `ios` - Apple iOS based devices. `android` - Android based devices. (optional)
721     * @param string[]|null                                    $environment                       Filter for events by providing one or more environment IDs (`environment_id` property).  ### Array syntax To provide multiple environment IDs, use the repeated keys syntax (`environment=env1&environment=env2`). Other notations like comma-separated (`environment=env1,env2`) or bracket notation (`environment[]=env1&environment[]=env2`) are not supported. (optional)
722     * @param string|null                                      $proximity_id                      Filter events by the most precise Proximity ID provided by default. > Note: When using this parameter, only events with the `proximity.id` property matching the provided ID are returned. Events without a `proximity` result are left out of the response. (optional)
723     * @param int|null                                         $total_hits                        When set, the response will include a `total_hits` property with a count of total query matches across all pages, up to the specified limit. (optional)
724     * @param bool|null                                        $tor_node                          Filter events by Tor Node detection result. > Note: When using this parameter, only events with the `tor_node` property set to `true` or `false` are returned. Events without a `tor_node` detection result are left out of the response. (optional)
725     * @param SearchEventsIncrementalIdentificationStatus|null $incremental_identification_status Filter events by their incremental identification status (`incremental_identification_status` property). Non incremental identification events are left out of the response. (optional)
726     * @param bool|null                                        $simulator                         Filter events by iOS Simulator Detection result.  > Note: When using this parameter, only events with the `simulator` property set to `true` or `false` are returned. Events without a `simulator` Smart Signal result are left out of the response. (optional)
727     *
728     * @noinspection GrazieInspection
729     *
730     * @return PromiseInterface promise resolving to the deserialized response
731     *
732     * @throws \InvalidArgumentException
733     */
734    public function searchEventsAsync(int $limit = 10, ?string $pagination_key = null, ?string $visitor_id = null, ?string $high_recall_id = null, ?SearchEventsBot $bot = null, ?SearchEventsBotInfo $bot_info = null, ?array $bot_info_category = null, ?array $bot_info_identity = null, ?array $bot_info_confidence = null, ?array $bot_info_provider = null, ?array $bot_info_name = null, ?string $ip_address = null, ?string $asn = null, ?string $linked_id = null, ?string $url = null, ?string $bundle_id = null, ?string $package_name = null, ?string $origin = null, \DateTime|int|null $start = null, \DateTime|int|null $end = null, ?bool $reverse = null, ?bool $suspect = null, ?bool $vpn = null, ?bool $virtual_machine = null, ?bool $tampering = null, ?bool $anti_detect_browser = null, ?bool $incognito = null, ?bool $privacy_settings = null, ?bool $jailbroken = null, ?bool $frida = null, ?bool $factory_reset = null, ?bool $cloned_app = null, ?bool $emulator = null, ?bool $root_apps = null, ?SearchEventsVpnConfidence $vpn_confidence = null, ?float $min_suspect_score = null, ?bool $developer_tools = null, ?bool $location_spoofing = null, ?bool $mitm_attack = null, ?bool $rare_device = null, ?SearchEventsRareDevicePercentileBucket $rare_device_percentile_bucket = null, ?bool $proxy = null, ?string $sdk_version = null, ?SearchEventsSdkPlatform $sdk_platform = null, ?array $environment = null, ?string $proximity_id = null, ?int $total_hits = null, ?bool $tor_node = null, ?SearchEventsIncrementalIdentificationStatus $incremental_identification_status = null, ?bool $simulator = null): PromiseInterface
735    {
736        return $this->searchEventsAsyncWithHttpInfo($limit, $pagination_key, $visitor_id, $high_recall_id, $bot, $bot_info, $bot_info_category, $bot_info_identity, $bot_info_confidence, $bot_info_provider, $bot_info_name, $ip_address, $asn, $linked_id, $url, $bundle_id, $package_name, $origin, $start, $end, $reverse, $suspect, $vpn, $virtual_machine, $tampering, $anti_detect_browser, $incognito, $privacy_settings, $jailbroken, $frida, $factory_reset, $cloned_app, $emulator, $root_apps, $vpn_confidence, $min_suspect_score, $developer_tools, $location_spoofing, $mitm_attack, $rare_device, $rare_device_percentile_bucket, $proxy, $sdk_version, $sdk_platform, $environment, $proximity_id, $total_hits, $tor_node, $incremental_identification_status, $simulator)
737            ->then(
738                function ($response) {
739                    return $response[0];
740                }
741            );
742    }
743
744    /**
745     * Operation searchEventsAsyncWithHttpInfo.
746     *
747     * Search events
748     *
749     * @param int                                              $limit                             Maximum number of events to return. Results are selected from the time range (`start`, `end`), ordered by `reverse`, then truncated to provided `limit` size. So `reverse=true` returns the oldest N=`limit` events, otherwise the newest N=`limit` events. (optional, default to 10)
750     * @param string|null                                      $pagination_key                    Use `pagination_key` to get the next page of results.  When more results are available (e.g., you requested up to 100 results for your query using `limit`, but there are more than 100 events total matching your request), the `pagination_key` field is added to the response. The pagination key is an arbitrary string that should not be interpreted in any way and should be passed as-is. In the following request, use that value in the `pagination_key` parameter to get the next page of results:  1. First request, returning most recent 100 events: `GET api-base-url/events?limit=100` 2. Use `response.pagination_key` to get the next page of results: `GET api-base-url/events?limit=100&pagination_key=1740815825085` (optional)
751     * @param string|null                                      $visitor_id                        Unique [visitor identifier](https://docs.fingerprint.com/reference/js-agent-v4-get-function#visitor_id) issued by Fingerprint Identification and all active Smart Signals.  Filter events by matching Visitor ID (`identification.visitor_id` property). (optional)
752     * @param string|null                                      $high_recall_id                    The High Recall ID is a supplementary browser identifier designed for use cases that require wider coverage over precision. Compared to the standard visitor ID, the High Recall ID strives to match incoming browsers more generously (rather than precisely) with existing browsers and thus identifies fewer browsers as new. The High Recall ID is best suited for use cases that are sensitive to browsers being identified as new and where mismatched browsers are not detrimental.  Filter events by matching High Recall ID (`supplementary_id_high_recall.visitor_id` property). (optional)
753     * @param SearchEventsBot|null                             $bot                               Filter events by the Bot Detection result, specifically:   `all` - events where any kind of bot was detected.   `good` - events where a good bot was detected.   `bad` - events where a bad bot was detected.   `none` - events where no bot was detected. > Note: When using this parameter, only events with the `bot` property set to a valid value are returned. Events without a `bot` Smart Signal result are left out of the response. (optional)
754     * @param SearchEventsBotInfo|null                         $bot_info                          Filter events by their Bot Info result, specifically:   - `all` - events where any kind of bot was detected.   - `none` - events where no bot was detected. (optional)
755     * @param BotInfoCategory[]|null                           $bot_info_category                 Filter events by their Bot Info Category.  Multiple categories can be provided using the repeated keys syntax. For example, `bot_info_category=ai_agent&bot_info_category=ai_assistant`, will match events with a Bot Info Category of `ai_agent` or `ai_assistant`. Other notations like comma-separated or bracket notation are not supported. (optional)
756     * @param BotInfoIdentity[]|null                           $bot_info_identity                 Filter events by their Bot Info Identity type.  Multiple identity types can be provided using the repeated keys syntax. For example, `bot_info_identity=verified&bot_info_identity=signed`, will match events with a Bot Info Identity of `verified` or `signed`. Other notations like comma-separated or bracket notation are not supported. (optional)
757     * @param BotInfoConfidence[]|null                         $bot_info_confidence               Filter events by their Bot Info Confidence.  Multiple confidences can be provided using the repeated keys syntax. For example, `bot_info_confidence=high&bot_info_confidence=medium`, will match events with a Bot Info Confidence of `high` or `medium`. Other notations like comma-separated or bracket notation are not supported. (optional)
758     * @param string[]|null                                    $bot_info_provider                 Filter events by their Bot Info Provider. The provider must match exactly, partial or wildcard matching is not supported.  Multiple Providers can be provided using the repeated keys syntax. For example, `bot_info_provider=OpenAI&bot_info_provider=AWS`, will match events with a Bot Info Provider of `OpenAI` or `AWS`. Other notations like comma-separated or bracket notation are not supported. (optional)
759     * @param string[]|null                                    $bot_info_name                     Filter events by their Bot Info Name. The name must match exactly, partial or wildcard matching is not supported.  Multiple Names can be provided using the repeated keys syntax. For example, `bot_info_name=ChatGPT%20Agent&bot_info_name=Bedrock%20AgentCore`, will match events with a Bot Info Name of `ChatGPT Agent` or `Bedrock AgentCore`. Other notations like comma-separated or bracket notation are not supported. (optional)
760     * @param string|null                                      $ip_address                        Filter events by IP address or IP range (if CIDR notation is used). If CIDR notation is not used, a /32 for IPv4 or /128 for IPv6 is assumed. Examples of range based queries: 10.0.0.0/24, 192.168.0.1/32 (optional)
761     * @param string|null                                      $asn                               Filter events by the ASN associated with the event's IP address. This corresponds to the `ip_info.(v4|v6).asn` property in the response. (optional)
762     * @param string|null                                      $linked_id                         Filter events by your custom identifier.  You can use [linked Ids](https://docs.fingerprint.com/reference/js-agent-v4-get-function#linkedid) to associate identification requests with your own identifier, for example, session Id, purchase Id, or transaction Id. You can then use this `linked_id` parameter to retrieve all events associated with your custom identifier. (optional)
763     * @param string|null                                      $url                               Filter events by the URL (`url` property) associated with the event. (optional)
764     * @param string|null                                      $bundle_id                         Filter events by the Bundle ID (iOS) associated with the event. (optional)
765     * @param string|null                                      $package_name                      Filter events by the Package Name (Android) associated with the event. (optional)
766     * @param string|null                                      $origin                            Filter events by the origin field of the event. This is applicable to web events only (e.g., https://example.com) (optional)
767     * @param int|\DateTime|null                               $start                             Include events that happened after this point (with timestamp greater than or equal the provided `start` Unix milliseconds value or RFC3339 timestamp). Defaults to 7 days ago. Setting `start` does not change `end`'s default of `now` â€” adjust it separately if needed. (optional)
768     * @param int|\DateTime|null                               $end                               Include events that happened before this point (with timestamp less than or equal the provided `end` Unix milliseconds value or RFC3339 timestamp). Defaults to now. Setting `end` does not change `start`'s default of `7 days ago` â€” adjust it separately if needed. (optional)
769     * @param bool|null                                        $reverse                           When `true`, sort events oldest first (ascending timestamp order). Defaults to `false` (newest first, descending timestamp order). (optional)
770     * @param bool|null                                        $suspect                           Filter events previously tagged as suspicious via the [Update API](https://docs.fingerprint.com/reference/server-api-v4-update-event). > Note: When using this parameter, only events with the `suspect` property explicitly set to `true` or `false` are returned. Events with undefined `suspect` property are left out of the response. (optional)
771     * @param bool|null                                        $vpn                               Filter events by VPN Detection result. > Note: When using this parameter, only events with the `vpn` property set to `true` or `false` are returned. Events without a `vpn` Smart Signal result are left out of the response. (optional)
772     * @param bool|null                                        $virtual_machine                   Filter events by Virtual Machine Detection result. > Note: When using this parameter, only events with the `virtual_machine` property set to `true` or `false` are returned. Events without a `virtual_machine` Smart Signal result are left out of the response. (optional)
773     * @param bool|null                                        $tampering                         Filter events by Browser Tampering Detection result. > Note: When using this parameter, only events with the `tampering.result` property set to `true` or `false` are returned. Events without a `tampering` Smart Signal result are left out of the response. (optional)
774     * @param bool|null                                        $anti_detect_browser               Filter events by Anti-detect Browser Detection result. > Note: When using this parameter, only events with the `tampering.anti_detect_browser` property set to `true` or `false` are returned. Events without a `tampering` Smart Signal result are left out of the response. (optional)
775     * @param bool|null                                        $incognito                         Filter events by Browser Incognito Detection result. > Note: When using this parameter, only events with the `incognito` property set to `true` or `false` are returned. Events without an `incognito` Smart Signal result are left out of the response. (optional)
776     * @param bool|null                                        $privacy_settings                  Filter events by Privacy Settings Detection result. > Note: When using this parameter, only events with the `privacy_settings` property set to `true` or `false` are returned. Events without a `privacy_settings` Smart Signal result are left out of the response. (optional)
777     * @param bool|null                                        $jailbroken                        Filter events by Jailbroken Device Detection result. > Note: When using this parameter, only events with the `jailbroken` property set to `true` or `false` are returned. Events without a `jailbroken` Smart Signal result are left out of the response. (optional)
778     * @param bool|null                                        $frida                             Filter events by Frida Detection result. > Note: When using this parameter, only events with the `frida` property set to `true` or `false` are returned. Events without a `frida` Smart Signal result are left out of the response. (optional)
779     * @param bool|null                                        $factory_reset                     Filter events by Factory Reset Detection result. > Note: When using this parameter, only events with a `factory_reset` time. Events without a `factory_reset` Smart Signal result are left out of the response. (optional)
780     * @param bool|null                                        $cloned_app                        Filter events by Cloned App Detection result. > Note: When using this parameter, only events with the `cloned_app` property set to `true` or `false` are returned. Events without a `cloned_app` Smart Signal result are left out of the response. (optional)
781     * @param bool|null                                        $emulator                          Filter events by Android Emulator Detection result. > Note: When using this parameter, only events with the `emulator` property set to `true` or `false` are returned. Events without an `emulator` Smart Signal result are left out of the response. (optional)
782     * @param bool|null                                        $root_apps                         Filter events by Rooted Device Detection result. > Note: When using this parameter, only events with the `root_apps` property set to `true` or `false` are returned. Events without a `root_apps` Smart Signal result are left out of the response. (optional)
783     * @param SearchEventsVpnConfidence|null                   $vpn_confidence                    Filter events by VPN Detection result confidence level. `high` - events with high VPN Detection confidence. `medium` - events with medium VPN Detection confidence. `low` - events with low VPN Detection confidence. > Note: When using this parameter, only events with the `vpn.confidence` property set to a valid value are returned. Events without a `vpn` Smart Signal result are left out of the response. (optional)
784     * @param float|null                                       $min_suspect_score                 Filter events with Suspect Score result above a provided minimum threshold. > Note: When using this parameter, only events where the `suspect_score` property set to a value exceeding your threshold are returned. Events without a `suspect_score` Smart Signal result are left out of the response. (optional)
785     * @param bool|null                                        $developer_tools                   Filter events by Developer Tools detection result. > Note: When using this parameter, only events with the `developer_tools` property set to `true` or `false` are returned. Events without a `developer_tools` Smart Signal result are left out of the response. (optional)
786     * @param bool|null                                        $location_spoofing                 Filter events by Location Spoofing detection result. > Note: When using this parameter, only events with the `location_spoofing` property set to `true` or `false` are returned. Events without a `location_spoofing` Smart Signal result are left out of the response. (optional)
787     * @param bool|null                                        $mitm_attack                       Filter events by MITM (Man-in-the-Middle) Attack detection result. > Note: When using this parameter, only events with the `mitm_attack` property set to `true` or `false` are returned. Events without a `mitm_attack` Smart Signal result are left out of the response. (optional)
788     * @param bool|null                                        $rare_device                       Filter events by Device Rarity detection result. > Note: When using this parameter, only events with the `rare_device` property set to `true` or `false` are returned. Events without a Device Rarity Smart Signal result are left out of the response.  > This Smart Signal is currently in beta and only available to select customers. If you are interested, please [contact our support team](https://fingerprint.com/support/). (optional)
789     * @param SearchEventsRareDevicePercentileBucket|null      $rare_device_percentile_bucket     Filter events by Device Rarity percentile bucket. `<p95` - device configuration is in the bottom 95% (most common). `p95-p99` - device is in the 95th to 99th percentile. `p99-p99.5` - device is in the 99th to 99.5th percentile. `p99.5-p99.9` - device is in the 99.5th to 99.9th percentile. `p99.9+` - device is in the top 0.1% (rarest). `not_seen` - device configuration has never been observed before.  > This Smart Signal is currently in beta and only available to select customers. If you are interested, please [contact our support team](https://fingerprint.com/support/). (optional)
790     * @param bool|null                                        $proxy                             Filter events by Proxy detection result. > Note: When using this parameter, only events with the `proxy` property set to `true` or `false` are returned. Events without a `proxy` Smart Signal result are left out of the response. (optional)
791     * @param string|null                                      $sdk_version                       Filter events by a specific SDK version associated with the identification event (`sdk.version` property). Example: `3.11.14` (optional)
792     * @param SearchEventsSdkPlatform|null                     $sdk_platform                      Filter events by the SDK Platform associated with the identification event (`sdk.platform` property) . `js` - Javascript agent (Web). `ios` - Apple iOS based devices. `android` - Android based devices. (optional)
793     * @param string[]|null                                    $environment                       Filter for events by providing one or more environment IDs (`environment_id` property).  ### Array syntax To provide multiple environment IDs, use the repeated keys syntax (`environment=env1&environment=env2`). Other notations like comma-separated (`environment=env1,env2`) or bracket notation (`environment[]=env1&environment[]=env2`) are not supported. (optional)
794     * @param string|null                                      $proximity_id                      Filter events by the most precise Proximity ID provided by default. > Note: When using this parameter, only events with the `proximity.id` property matching the provided ID are returned. Events without a `proximity` result are left out of the response. (optional)
795     * @param int|null                                         $total_hits                        When set, the response will include a `total_hits` property with a count of total query matches across all pages, up to the specified limit. (optional)
796     * @param bool|null                                        $tor_node                          Filter events by Tor Node detection result. > Note: When using this parameter, only events with the `tor_node` property set to `true` or `false` are returned. Events without a `tor_node` detection result are left out of the response. (optional)
797     * @param SearchEventsIncrementalIdentificationStatus|null $incremental_identification_status Filter events by their incremental identification status (`incremental_identification_status` property). Non incremental identification events are left out of the response. (optional)
798     * @param bool|null                                        $simulator                         Filter events by iOS Simulator Detection result.  > Note: When using this parameter, only events with the `simulator` property set to `true` or `false` are returned. Events without a `simulator` Smart Signal result are left out of the response. (optional)
799     *
800     * @noinspection GrazieInspection
801     *
802     * @return PromiseInterface promise resolving to an array of deserialized data and the HTTP response
803     *
804     * @throws \InvalidArgumentException
805     */
806    public function searchEventsAsyncWithHttpInfo(int $limit = 10, ?string $pagination_key = null, ?string $visitor_id = null, ?string $high_recall_id = null, ?SearchEventsBot $bot = null, ?SearchEventsBotInfo $bot_info = null, ?array $bot_info_category = null, ?array $bot_info_identity = null, ?array $bot_info_confidence = null, ?array $bot_info_provider = null, ?array $bot_info_name = null, ?string $ip_address = null, ?string $asn = null, ?string $linked_id = null, ?string $url = null, ?string $bundle_id = null, ?string $package_name = null, ?string $origin = null, \DateTime|int|null $start = null, \DateTime|int|null $end = null, ?bool $reverse = null, ?bool $suspect = null, ?bool $vpn = null, ?bool $virtual_machine = null, ?bool $tampering = null, ?bool $anti_detect_browser = null, ?bool $incognito = null, ?bool $privacy_settings = null, ?bool $jailbroken = null, ?bool $frida = null, ?bool $factory_reset = null, ?bool $cloned_app = null, ?bool $emulator = null, ?bool $root_apps = null, ?SearchEventsVpnConfidence $vpn_confidence = null, ?float $min_suspect_score = null, ?bool $developer_tools = null, ?bool $location_spoofing = null, ?bool $mitm_attack = null, ?bool $rare_device = null, ?SearchEventsRareDevicePercentileBucket $rare_device_percentile_bucket = null, ?bool $proxy = null, ?string $sdk_version = null, ?SearchEventsSdkPlatform $sdk_platform = null, ?array $environment = null, ?string $proximity_id = null, ?int $total_hits = null, ?bool $tor_node = null, ?SearchEventsIncrementalIdentificationStatus $incremental_identification_status = null, ?bool $simulator = null): PromiseInterface
807    {
808        $request = $this->searchEventsRequest($limit, $pagination_key, $visitor_id, $high_recall_id, $bot, $bot_info, $bot_info_category, $bot_info_identity, $bot_info_confidence, $bot_info_provider, $bot_info_name, $ip_address, $asn, $linked_id, $url, $bundle_id, $package_name, $origin, $start, $end, $reverse, $suspect, $vpn, $virtual_machine, $tampering, $anti_detect_browser, $incognito, $privacy_settings, $jailbroken, $frida, $factory_reset, $cloned_app, $emulator, $root_apps, $vpn_confidence, $min_suspect_score, $developer_tools, $location_spoofing, $mitm_attack, $rare_device, $rare_device_percentile_bucket, $proxy, $sdk_version, $sdk_platform, $environment, $proximity_id, $total_hits, $tor_node, $incremental_identification_status, $simulator);
809
810        return $this->client
811            ->sendAsync($request, $this->createHttpClientOption())
812            ->then(
813                function ($response) {
814                    $content = (string) $response->getBody();
815                    $response->getBody()->rewind();
816
817                    return [
818                        ObjectSerializer::deserialize($content, '\Fingerprint\ServerSdk\Model\EventSearch'),
819                        $response,
820                    ];
821                },
822                function ($e) {
823                    $this->handleSearchEventsError($e);
824                }
825            );
826    }
827
828    /**
829     * Create request for operation 'searchEvents'.
830     *
831     * @param int                                              $limit                             Maximum number of events to return. Results are selected from the time range (`start`, `end`), ordered by `reverse`, then truncated to provided `limit` size. So `reverse=true` returns the oldest N=`limit` events, otherwise the newest N=`limit` events. (optional, default to 10)
832     * @param string|null                                      $pagination_key                    Use `pagination_key` to get the next page of results.  When more results are available (e.g., you requested up to 100 results for your query using `limit`, but there are more than 100 events total matching your request), the `pagination_key` field is added to the response. The pagination key is an arbitrary string that should not be interpreted in any way and should be passed as-is. In the following request, use that value in the `pagination_key` parameter to get the next page of results:  1. First request, returning most recent 100 events: `GET api-base-url/events?limit=100` 2. Use `response.pagination_key` to get the next page of results: `GET api-base-url/events?limit=100&pagination_key=1740815825085` (optional)
833     * @param string|null                                      $visitor_id                        Unique [visitor identifier](https://docs.fingerprint.com/reference/js-agent-v4-get-function#visitor_id) issued by Fingerprint Identification and all active Smart Signals.  Filter events by matching Visitor ID (`identification.visitor_id` property). (optional)
834     * @param string|null                                      $high_recall_id                    The High Recall ID is a supplementary browser identifier designed for use cases that require wider coverage over precision. Compared to the standard visitor ID, the High Recall ID strives to match incoming browsers more generously (rather than precisely) with existing browsers and thus identifies fewer browsers as new. The High Recall ID is best suited for use cases that are sensitive to browsers being identified as new and where mismatched browsers are not detrimental.  Filter events by matching High Recall ID (`supplementary_id_high_recall.visitor_id` property). (optional)
835     * @param SearchEventsBot|null                             $bot                               Filter events by the Bot Detection result, specifically:   `all` - events where any kind of bot was detected.   `good` - events where a good bot was detected.   `bad` - events where a bad bot was detected.   `none` - events where no bot was detected. > Note: When using this parameter, only events with the `bot` property set to a valid value are returned. Events without a `bot` Smart Signal result are left out of the response. (optional)
836     * @param SearchEventsBotInfo|null                         $bot_info                          Filter events by their Bot Info result, specifically:   - `all` - events where any kind of bot was detected.   - `none` - events where no bot was detected. (optional)
837     * @param BotInfoCategory[]|null                           $bot_info_category                 Filter events by their Bot Info Category.  Multiple categories can be provided using the repeated keys syntax. For example, `bot_info_category=ai_agent&bot_info_category=ai_assistant`, will match events with a Bot Info Category of `ai_agent` or `ai_assistant`. Other notations like comma-separated or bracket notation are not supported. (optional)
838     * @param BotInfoIdentity[]|null                           $bot_info_identity                 Filter events by their Bot Info Identity type.  Multiple identity types can be provided using the repeated keys syntax. For example, `bot_info_identity=verified&bot_info_identity=signed`, will match events with a Bot Info Identity of `verified` or `signed`. Other notations like comma-separated or bracket notation are not supported. (optional)
839     * @param BotInfoConfidence[]|null                         $bot_info_confidence               Filter events by their Bot Info Confidence.  Multiple confidences can be provided using the repeated keys syntax. For example, `bot_info_confidence=high&bot_info_confidence=medium`, will match events with a Bot Info Confidence of `high` or `medium`. Other notations like comma-separated or bracket notation are not supported. (optional)
840     * @param string[]|null                                    $bot_info_provider                 Filter events by their Bot Info Provider. The provider must match exactly, partial or wildcard matching is not supported.  Multiple Providers can be provided using the repeated keys syntax. For example, `bot_info_provider=OpenAI&bot_info_provider=AWS`, will match events with a Bot Info Provider of `OpenAI` or `AWS`. Other notations like comma-separated or bracket notation are not supported. (optional)
841     * @param string[]|null                                    $bot_info_name                     Filter events by their Bot Info Name. The name must match exactly, partial or wildcard matching is not supported.  Multiple Names can be provided using the repeated keys syntax. For example, `bot_info_name=ChatGPT%20Agent&bot_info_name=Bedrock%20AgentCore`, will match events with a Bot Info Name of `ChatGPT Agent` or `Bedrock AgentCore`. Other notations like comma-separated or bracket notation are not supported. (optional)
842     * @param string|null                                      $ip_address                        Filter events by IP address or IP range (if CIDR notation is used). If CIDR notation is not used, a /32 for IPv4 or /128 for IPv6 is assumed. Examples of range based queries: 10.0.0.0/24, 192.168.0.1/32 (optional)
843     * @param string|null                                      $asn                               Filter events by the ASN associated with the event's IP address. This corresponds to the `ip_info.(v4|v6).asn` property in the response. (optional)
844     * @param string|null                                      $linked_id                         Filter events by your custom identifier.  You can use [linked Ids](https://docs.fingerprint.com/reference/js-agent-v4-get-function#linkedid) to associate identification requests with your own identifier, for example, session Id, purchase Id, or transaction Id. You can then use this `linked_id` parameter to retrieve all events associated with your custom identifier. (optional)
845     * @param string|null                                      $url                               Filter events by the URL (`url` property) associated with the event. (optional)
846     * @param string|null                                      $bundle_id                         Filter events by the Bundle ID (iOS) associated with the event. (optional)
847     * @param string|null                                      $package_name                      Filter events by the Package Name (Android) associated with the event. (optional)
848     * @param string|null                                      $origin                            Filter events by the origin field of the event. This is applicable to web events only (e.g., https://example.com) (optional)
849     * @param int|\DateTime|null                               $start                             Include events that happened after this point (with timestamp greater than or equal the provided `start` Unix milliseconds value or RFC3339 timestamp). Defaults to 7 days ago. Setting `start` does not change `end`'s default of `now` â€” adjust it separately if needed. (optional)
850     * @param int|\DateTime|null                               $end                               Include events that happened before this point (with timestamp less than or equal the provided `end` Unix milliseconds value or RFC3339 timestamp). Defaults to now. Setting `end` does not change `start`'s default of `7 days ago` â€” adjust it separately if needed. (optional)
851     * @param bool|null                                        $reverse                           When `true`, sort events oldest first (ascending timestamp order). Defaults to `false` (newest first, descending timestamp order). (optional)
852     * @param bool|null                                        $suspect                           Filter events previously tagged as suspicious via the [Update API](https://docs.fingerprint.com/reference/server-api-v4-update-event). > Note: When using this parameter, only events with the `suspect` property explicitly set to `true` or `false` are returned. Events with undefined `suspect` property are left out of the response. (optional)
853     * @param bool|null                                        $vpn                               Filter events by VPN Detection result. > Note: When using this parameter, only events with the `vpn` property set to `true` or `false` are returned. Events without a `vpn` Smart Signal result are left out of the response. (optional)
854     * @param bool|null                                        $virtual_machine                   Filter events by Virtual Machine Detection result. > Note: When using this parameter, only events with the `virtual_machine` property set to `true` or `false` are returned. Events without a `virtual_machine` Smart Signal result are left out of the response. (optional)
855     * @param bool|null                                        $tampering                         Filter events by Browser Tampering Detection result. > Note: When using this parameter, only events with the `tampering.result` property set to `true` or `false` are returned. Events without a `tampering` Smart Signal result are left out of the response. (optional)
856     * @param bool|null                                        $anti_detect_browser               Filter events by Anti-detect Browser Detection result. > Note: When using this parameter, only events with the `tampering.anti_detect_browser` property set to `true` or `false` are returned. Events without a `tampering` Smart Signal result are left out of the response. (optional)
857     * @param bool|null                                        $incognito                         Filter events by Browser Incognito Detection result. > Note: When using this parameter, only events with the `incognito` property set to `true` or `false` are returned. Events without an `incognito` Smart Signal result are left out of the response. (optional)
858     * @param bool|null                                        $privacy_settings                  Filter events by Privacy Settings Detection result. > Note: When using this parameter, only events with the `privacy_settings` property set to `true` or `false` are returned. Events without a `privacy_settings` Smart Signal result are left out of the response. (optional)
859     * @param bool|null                                        $jailbroken                        Filter events by Jailbroken Device Detection result. > Note: When using this parameter, only events with the `jailbroken` property set to `true` or `false` are returned. Events without a `jailbroken` Smart Signal result are left out of the response. (optional)
860     * @param bool|null                                        $frida                             Filter events by Frida Detection result. > Note: When using this parameter, only events with the `frida` property set to `true` or `false` are returned. Events without a `frida` Smart Signal result are left out of the response. (optional)
861     * @param bool|null                                        $factory_reset                     Filter events by Factory Reset Detection result. > Note: When using this parameter, only events with a `factory_reset` time. Events without a `factory_reset` Smart Signal result are left out of the response. (optional)
862     * @param bool|null                                        $cloned_app                        Filter events by Cloned App Detection result. > Note: When using this parameter, only events with the `cloned_app` property set to `true` or `false` are returned. Events without a `cloned_app` Smart Signal result are left out of the response. (optional)
863     * @param bool|null                                        $emulator                          Filter events by Android Emulator Detection result. > Note: When using this parameter, only events with the `emulator` property set to `true` or `false` are returned. Events without an `emulator` Smart Signal result are left out of the response. (optional)
864     * @param bool|null                                        $root_apps                         Filter events by Rooted Device Detection result. > Note: When using this parameter, only events with the `root_apps` property set to `true` or `false` are returned. Events without a `root_apps` Smart Signal result are left out of the response. (optional)
865     * @param SearchEventsVpnConfidence|null                   $vpn_confidence                    Filter events by VPN Detection result confidence level. `high` - events with high VPN Detection confidence. `medium` - events with medium VPN Detection confidence. `low` - events with low VPN Detection confidence. > Note: When using this parameter, only events with the `vpn.confidence` property set to a valid value are returned. Events without a `vpn` Smart Signal result are left out of the response. (optional)
866     * @param float|null                                       $min_suspect_score                 Filter events with Suspect Score result above a provided minimum threshold. > Note: When using this parameter, only events where the `suspect_score` property set to a value exceeding your threshold are returned. Events without a `suspect_score` Smart Signal result are left out of the response. (optional)
867     * @param bool|null                                        $developer_tools                   Filter events by Developer Tools detection result. > Note: When using this parameter, only events with the `developer_tools` property set to `true` or `false` are returned. Events without a `developer_tools` Smart Signal result are left out of the response. (optional)
868     * @param bool|null                                        $location_spoofing                 Filter events by Location Spoofing detection result. > Note: When using this parameter, only events with the `location_spoofing` property set to `true` or `false` are returned. Events without a `location_spoofing` Smart Signal result are left out of the response. (optional)
869     * @param bool|null                                        $mitm_attack                       Filter events by MITM (Man-in-the-Middle) Attack detection result. > Note: When using this parameter, only events with the `mitm_attack` property set to `true` or `false` are returned. Events without a `mitm_attack` Smart Signal result are left out of the response. (optional)
870     * @param bool|null                                        $rare_device                       Filter events by Device Rarity detection result. > Note: When using this parameter, only events with the `rare_device` property set to `true` or `false` are returned. Events without a Device Rarity Smart Signal result are left out of the response.  > This Smart Signal is currently in beta and only available to select customers. If you are interested, please [contact our support team](https://fingerprint.com/support/). (optional)
871     * @param SearchEventsRareDevicePercentileBucket|null      $rare_device_percentile_bucket     Filter events by Device Rarity percentile bucket. `<p95` - device configuration is in the bottom 95% (most common). `p95-p99` - device is in the 95th to 99th percentile. `p99-p99.5` - device is in the 99th to 99.5th percentile. `p99.5-p99.9` - device is in the 99.5th to 99.9th percentile. `p99.9+` - device is in the top 0.1% (rarest). `not_seen` - device configuration has never been observed before.  > This Smart Signal is currently in beta and only available to select customers. If you are interested, please [contact our support team](https://fingerprint.com/support/). (optional)
872     * @param bool|null                                        $proxy                             Filter events by Proxy detection result. > Note: When using this parameter, only events with the `proxy` property set to `true` or `false` are returned. Events without a `proxy` Smart Signal result are left out of the response. (optional)
873     * @param string|null                                      $sdk_version                       Filter events by a specific SDK version associated with the identification event (`sdk.version` property). Example: `3.11.14` (optional)
874     * @param SearchEventsSdkPlatform|null                     $sdk_platform                      Filter events by the SDK Platform associated with the identification event (`sdk.platform` property) . `js` - Javascript agent (Web). `ios` - Apple iOS based devices. `android` - Android based devices. (optional)
875     * @param string[]|null                                    $environment                       Filter for events by providing one or more environment IDs (`environment_id` property).  ### Array syntax To provide multiple environment IDs, use the repeated keys syntax (`environment=env1&environment=env2`). Other notations like comma-separated (`environment=env1,env2`) or bracket notation (`environment[]=env1&environment[]=env2`) are not supported. (optional)
876     * @param string|null                                      $proximity_id                      Filter events by the most precise Proximity ID provided by default. > Note: When using this parameter, only events with the `proximity.id` property matching the provided ID are returned. Events without a `proximity` result are left out of the response. (optional)
877     * @param int|null                                         $total_hits                        When set, the response will include a `total_hits` property with a count of total query matches across all pages, up to the specified limit. (optional)
878     * @param bool|null                                        $tor_node                          Filter events by Tor Node detection result. > Note: When using this parameter, only events with the `tor_node` property set to `true` or `false` are returned. Events without a `tor_node` detection result are left out of the response. (optional)
879     * @param SearchEventsIncrementalIdentificationStatus|null $incremental_identification_status Filter events by their incremental identification status (`incremental_identification_status` property). Non incremental identification events are left out of the response. (optional)
880     * @param bool|null                                        $simulator                         Filter events by iOS Simulator Detection result.  > Note: When using this parameter, only events with the `simulator` property set to `true` or `false` are returned. Events without a `simulator` Smart Signal result are left out of the response. (optional)
881     *
882     * @noinspection GrazieInspection
883     *
884     * @return Request the prepared HTTP request
885     *
886     * @throws \InvalidArgumentException
887     */
888    public function searchEventsRequest(int $limit = 10, ?string $pagination_key = null, ?string $visitor_id = null, ?string $high_recall_id = null, ?SearchEventsBot $bot = null, ?SearchEventsBotInfo $bot_info = null, ?array $bot_info_category = null, ?array $bot_info_identity = null, ?array $bot_info_confidence = null, ?array $bot_info_provider = null, ?array $bot_info_name = null, ?string $ip_address = null, ?string $asn = null, ?string $linked_id = null, ?string $url = null, ?string $bundle_id = null, ?string $package_name = null, ?string $origin = null, \DateTime|int|null $start = null, \DateTime|int|null $end = null, ?bool $reverse = null, ?bool $suspect = null, ?bool $vpn = null, ?bool $virtual_machine = null, ?bool $tampering = null, ?bool $anti_detect_browser = null, ?bool $incognito = null, ?bool $privacy_settings = null, ?bool $jailbroken = null, ?bool $frida = null, ?bool $factory_reset = null, ?bool $cloned_app = null, ?bool $emulator = null, ?bool $root_apps = null, ?SearchEventsVpnConfidence $vpn_confidence = null, ?float $min_suspect_score = null, ?bool $developer_tools = null, ?bool $location_spoofing = null, ?bool $mitm_attack = null, ?bool $rare_device = null, ?SearchEventsRareDevicePercentileBucket $rare_device_percentile_bucket = null, ?bool $proxy = null, ?string $sdk_version = null, ?SearchEventsSdkPlatform $sdk_platform = null, ?array $environment = null, ?string $proximity_id = null, ?int $total_hits = null, ?bool $tor_node = null, ?SearchEventsIncrementalIdentificationStatus $incremental_identification_status = null, ?bool $simulator = null): Request
889    {
890        if (null !== $limit && $limit > 100) {
891            throw new \InvalidArgumentException('invalid value for "$limit" when calling FingerprintApi.searchEvents, must be smaller than or equal to 100.');
892        }
893        if (null !== $limit && $limit < 1) {
894            throw new \InvalidArgumentException('invalid value for "$limit" when calling FingerprintApi.searchEvents, must be bigger than or equal to 1.');
895        }
896        if (null !== $total_hits && $total_hits > 1000) {
897            throw new \InvalidArgumentException('invalid value for "$total_hits" when calling FingerprintApi.searchEvents, must be smaller than or equal to 1000.');
898        }
899        if (null !== $total_hits && $total_hits < 1) {
900            throw new \InvalidArgumentException('invalid value for "$total_hits" when calling FingerprintApi.searchEvents, must be bigger than or equal to 1.');
901        }
902
903        $resourcePath = '/events';
904        $headers = [
905            'Authorization' => 'Bearer '.$this->config->getApiKey(),
906        ];
907        $queryParams = ['ii' => $this->integration_info];
908        $headerParams = [];
909
910        // query params
911        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
912            $limit,
913            'limit',
914            'integer',
915            'form',
916            true,
917            false
918        ) ?? []);
919        // query params
920        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
921            $pagination_key,
922            'pagination_key',
923            'string',
924            'form',
925            true,
926            false
927        ) ?? []);
928        // query params
929        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
930            $visitor_id,
931            'visitor_id',
932            'string',
933            'form',
934            true,
935            false
936        ) ?? []);
937        // query params
938        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
939            $high_recall_id,
940            'high_recall_id',
941            'string',
942            'form',
943            true,
944            false
945        ) ?? []);
946        // query params
947        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
948            $bot,
949            'bot',
950            'SearchEventsBot',
951            'form',
952            true,
953            false
954        ) ?? []);
955        // query params
956        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
957            $bot_info,
958            'bot_info',
959            'SearchEventsBotInfo',
960            'form',
961            true,
962            false
963        ) ?? []);
964        // query params
965        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
966            $bot_info_category,
967            'bot_info_category',
968            'array',
969            'form',
970            true,
971            false
972        ) ?? []);
973        // query params
974        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
975            $bot_info_identity,
976            'bot_info_identity',
977            'array',
978            'form',
979            true,
980            false
981        ) ?? []);
982        // query params
983        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
984            $bot_info_confidence,
985            'bot_info_confidence',
986            'array',
987            'form',
988            true,
989            false
990        ) ?? []);
991        // query params
992        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
993            $bot_info_provider,
994            'bot_info_provider',
995            'array',
996            'form',
997            true,
998            false
999        ) ?? []);
1000        // query params
1001        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1002            $bot_info_name,
1003            'bot_info_name',
1004            'array',
1005            'form',
1006            true,
1007            false
1008        ) ?? []);
1009        // query params
1010        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1011            $ip_address,
1012            'ip_address',
1013            'string',
1014            'form',
1015            true,
1016            false
1017        ) ?? []);
1018        // query params
1019        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1020            $asn,
1021            'asn',
1022            'string',
1023            'form',
1024            true,
1025            false
1026        ) ?? []);
1027        // query params
1028        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1029            $linked_id,
1030            'linked_id',
1031            'string',
1032            'form',
1033            true,
1034            false
1035        ) ?? []);
1036        // query params
1037        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1038            $url,
1039            'url',
1040            'string',
1041            'form',
1042            true,
1043            false
1044        ) ?? []);
1045        // query params
1046        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1047            $bundle_id,
1048            'bundle_id',
1049            'string',
1050            'form',
1051            true,
1052            false
1053        ) ?? []);
1054        // query params
1055        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1056            $package_name,
1057            'package_name',
1058            'string',
1059            'form',
1060            true,
1061            false
1062        ) ?? []);
1063        // query params
1064        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1065            $origin,
1066            'origin',
1067            'string',
1068            'form',
1069            true,
1070            false
1071        ) ?? []);
1072        // query params
1073        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1074            $start,
1075            'start',
1076            'int|\DateTime',
1077            'form',
1078            true,
1079            false
1080        ) ?? []);
1081        // query params
1082        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1083            $end,
1084            'end',
1085            'int|\DateTime',
1086            'form',
1087            true,
1088            false
1089        ) ?? []);
1090        // query params
1091        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1092            $reverse,
1093            'reverse',
1094            'boolean',
1095            'form',
1096            true,
1097            false
1098        ) ?? []);
1099        // query params
1100        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1101            $suspect,
1102            'suspect',
1103            'boolean',
1104            'form',
1105            true,
1106            false
1107        ) ?? []);
1108        // query params
1109        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1110            $vpn,
1111            'vpn',
1112            'boolean',
1113            'form',
1114            true,
1115            false
1116        ) ?? []);
1117        // query params
1118        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1119            $virtual_machine,
1120            'virtual_machine',
1121            'boolean',
1122            'form',
1123            true,
1124            false
1125        ) ?? []);
1126        // query params
1127        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1128            $tampering,
1129            'tampering',
1130            'boolean',
1131            'form',
1132            true,
1133            false
1134        ) ?? []);
1135        // query params
1136        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1137            $anti_detect_browser,
1138            'anti_detect_browser',
1139            'boolean',
1140            'form',
1141            true,
1142            false
1143        ) ?? []);
1144        // query params
1145        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1146            $incognito,
1147            'incognito',
1148            'boolean',
1149            'form',
1150            true,
1151            false
1152        ) ?? []);
1153        // query params
1154        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1155            $privacy_settings,
1156            'privacy_settings',
1157            'boolean',
1158            'form',
1159            true,
1160            false
1161        ) ?? []);
1162        // query params
1163        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1164            $jailbroken,
1165            'jailbroken',
1166            'boolean',
1167            'form',
1168            true,
1169            false
1170        ) ?? []);
1171        // query params
1172        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1173            $frida,
1174            'frida',
1175            'boolean',
1176            'form',
1177            true,
1178            false
1179        ) ?? []);
1180        // query params
1181        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1182            $factory_reset,
1183            'factory_reset',
1184            'boolean',
1185            'form',
1186            true,
1187            false
1188        ) ?? []);
1189        // query params
1190        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1191            $cloned_app,
1192            'cloned_app',
1193            'boolean',
1194            'form',
1195            true,
1196            false
1197        ) ?? []);
1198        // query params
1199        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1200            $emulator,
1201            'emulator',
1202            'boolean',
1203            'form',
1204            true,
1205            false
1206        ) ?? []);
1207        // query params
1208        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1209            $root_apps,
1210            'root_apps',
1211            'boolean',
1212            'form',
1213            true,
1214            false
1215        ) ?? []);
1216        // query params
1217        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1218            $vpn_confidence,
1219            'vpn_confidence',
1220            'SearchEventsVpnConfidence',
1221            'form',
1222            true,
1223            false
1224        ) ?? []);
1225        // query params
1226        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1227            $min_suspect_score,
1228            'min_suspect_score',
1229            'number',
1230            'form',
1231            true,
1232            false
1233        ) ?? []);
1234        // query params
1235        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1236            $developer_tools,
1237            'developer_tools',
1238            'boolean',
1239            'form',
1240            true,
1241            false
1242        ) ?? []);
1243        // query params
1244        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1245            $location_spoofing,
1246            'location_spoofing',
1247            'boolean',
1248            'form',
1249            true,
1250            false
1251        ) ?? []);
1252        // query params
1253        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1254            $mitm_attack,
1255            'mitm_attack',
1256            'boolean',
1257            'form',
1258            true,
1259            false
1260        ) ?? []);
1261        // query params
1262        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1263            $rare_device,
1264            'rare_device',
1265            'boolean',
1266            'form',
1267            true,
1268            false
1269        ) ?? []);
1270        // query params
1271        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1272            $rare_device_percentile_bucket,
1273            'rare_device_percentile_bucket',
1274            'SearchEventsRareDevicePercentileBucket',
1275            'form',
1276            true,
1277            false
1278        ) ?? []);
1279        // query params
1280        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1281            $proxy,
1282            'proxy',
1283            'boolean',
1284            'form',
1285            true,
1286            false
1287        ) ?? []);
1288        // query params
1289        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1290            $sdk_version,
1291            'sdk_version',
1292            'string',
1293            'form',
1294            true,
1295            false
1296        ) ?? []);
1297        // query params
1298        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1299            $sdk_platform,
1300            'sdk_platform',
1301            'SearchEventsSdkPlatform',
1302            'form',
1303            true,
1304            false
1305        ) ?? []);
1306        // query params
1307        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1308            $environment,
1309            'environment',
1310            'array',
1311            'form',
1312            true,
1313            false
1314        ) ?? []);
1315        // query params
1316        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1317            $proximity_id,
1318            'proximity_id',
1319            'string',
1320            'form',
1321            true,
1322            false
1323        ) ?? []);
1324        // query params
1325        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1326            $total_hits,
1327            'total_hits',
1328            'integer',
1329            'form',
1330            true,
1331            false
1332        ) ?? []);
1333        // query params
1334        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1335            $tor_node,
1336            'tor_node',
1337            'boolean',
1338            'form',
1339            true,
1340            false
1341        ) ?? []);
1342        // query params
1343        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1344            $incremental_identification_status,
1345            'incremental_identification_status',
1346            'SearchEventsIncrementalIdentificationStatus',
1347            'form',
1348            true,
1349            false
1350        ) ?? []);
1351        // query params
1352        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1353            $simulator,
1354            'simulator',
1355            'boolean',
1356            'form',
1357            true,
1358            false
1359        ) ?? []);
1360
1361        if ($this->config->getUserAgent()) {
1362            $headers['User-Agent'] = $this->config->getUserAgent();
1363        }
1364
1365        $headers = array_merge(
1366            $headerParams,
1367            $headers
1368        );
1369
1370        $query = ObjectSerializer::buildQuery($queryParams);
1371
1372        return new Request(
1373            'GET',
1374            $this->config->getHost().$resourcePath.($query ? "?$query" : ''),
1375            $headers,
1376        );
1377    }
1378
1379    /**
1380     * Operation updateEvent.
1381     *
1382     * Update an event
1383     *
1384     * @param string      $event_id     The unique event [identifier](https://docs.fingerprint.com/reference/js-agent-v4-get-function#event_id). (required)
1385     * @param EventUpdate $event_update event_update (required)
1386     *
1387     * @noinspection GrazieInspection
1388     *
1389     * @throws ApiException                  on non-2xx response or if the response body is not in the expected format
1390     * @throws \InvalidArgumentException
1391     * @throws GuzzleException
1392     * @throws \DateMalformedStringException
1393     */
1394    public function updateEvent(string $event_id, EventUpdate $event_update): void
1395    {
1396        $this->updateEventWithHttpInfo($event_id, $event_update);
1397    }
1398
1399    /**
1400     * Operation updateEventWithHttpInfo.
1401     *
1402     * Update an event
1403     *
1404     * @param string      $event_id     The unique event [identifier](https://docs.fingerprint.com/reference/js-agent-v4-get-function#event_id). (required)
1405     * @param EventUpdate $event_update (required)
1406     *
1407     * @noinspection GrazieInspection
1408     *
1409     * @return array{ null, ResponseInterface }
1410     *
1411     * @throws ApiException                  on non-2xx response or if the response body is not in the expected format
1412     * @throws \InvalidArgumentException
1413     * @throws GuzzleException
1414     * @throws \DateMalformedStringException
1415     */
1416    public function updateEventWithHttpInfo(string $event_id, EventUpdate $event_update): array
1417    {
1418        $request = $this->updateEventRequest($event_id, $event_update);
1419
1420        try {
1421            $options = $this->createHttpClientOption();
1422
1423            try {
1424                $response = $this->client->send($request, $options);
1425            } catch (RequestException $e) {
1426                throw new ApiException(
1427                    "[{$e->getCode()}{$e->getMessage()}",
1428                    (int) $e->getCode(),
1429                    $e->getResponse(),
1430                    $e
1431                );
1432            } catch (ConnectException $e) {
1433                throw new ApiException(
1434                    "[{$e->getCode()}{$e->getMessage()}",
1435                    (int) $e->getCode(),
1436                    null,
1437                    $e
1438                );
1439            }
1440
1441            $statusCode = $response->getStatusCode();
1442
1443            if ($statusCode < 200 || $statusCode > 299) {
1444                throw new ApiException(
1445                    sprintf(
1446                        '[%d] Error connecting to the API (%s)',
1447                        $statusCode,
1448                        $request->getUri()
1449                    ),
1450                    $statusCode,
1451                    $response
1452                );
1453            }
1454
1455            return [null, $response];
1456        } catch (ApiException $e) {
1457            $this->handleUpdateEventError($e);
1458        }
1459    }
1460
1461    /**
1462     * Operation updateEventAsync.
1463     *
1464     * Update an event
1465     *
1466     * @param string      $event_id     The unique event [identifier](https://docs.fingerprint.com/reference/js-agent-v4-get-function#event_id). (required)
1467     * @param EventUpdate $event_update (required)
1468     *
1469     * @noinspection GrazieInspection
1470     *
1471     * @return PromiseInterface promise resolving to the deserialized response
1472     *
1473     * @throws \InvalidArgumentException
1474     */
1475    public function updateEventAsync(string $event_id, EventUpdate $event_update): PromiseInterface
1476    {
1477        return $this->updateEventAsyncWithHttpInfo($event_id, $event_update)
1478            ->then(
1479                function ($response) {
1480                    return $response[0];
1481                }
1482            );
1483    }
1484
1485    /**
1486     * Operation updateEventAsyncWithHttpInfo.
1487     *
1488     * Update an event
1489     *
1490     * @param string      $event_id     The unique event [identifier](https://docs.fingerprint.com/reference/js-agent-v4-get-function#event_id). (required)
1491     * @param EventUpdate $event_update (required)
1492     *
1493     * @noinspection GrazieInspection
1494     *
1495     * @return PromiseInterface promise resolving to an array of deserialized data and the HTTP response
1496     *
1497     * @throws \InvalidArgumentException
1498     */
1499    public function updateEventAsyncWithHttpInfo(string $event_id, EventUpdate $event_update): PromiseInterface
1500    {
1501        $request = $this->updateEventRequest($event_id, $event_update);
1502
1503        return $this->client
1504            ->sendAsync($request, $this->createHttpClientOption())
1505            ->then(
1506                function ($response) {
1507                    return [null, $response];
1508                },
1509                function ($e) {
1510                    $this->handleUpdateEventError($e);
1511                }
1512            );
1513    }
1514
1515    /**
1516     * Create request for operation 'updateEvent'.
1517     *
1518     * @param string      $event_id     The unique event [identifier](https://docs.fingerprint.com/reference/js-agent-v4-get-function#event_id). (required)
1519     * @param EventUpdate $event_update (required)
1520     *
1521     * @noinspection GrazieInspection
1522     *
1523     * @return Request the prepared HTTP request
1524     *
1525     * @throws \InvalidArgumentException
1526     */
1527    public function updateEventRequest(string $event_id, EventUpdate $event_update): Request
1528    {
1529        $resourcePath = '/events/{event_id}';
1530        $headers = [
1531            'Authorization' => 'Bearer '.$this->config->getApiKey(),
1532        ];
1533        $queryParams = ['ii' => $this->integration_info];
1534        $headerParams = [];
1535
1536        // path params
1537        $resourcePath = str_replace(
1538            '{event_id}',
1539            ObjectSerializer::toPathValue($event_id),
1540            $resourcePath
1541        );
1542
1543        $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($event_update));
1544
1545        if ($this->config->getUserAgent()) {
1546            $headers['User-Agent'] = $this->config->getUserAgent();
1547        }
1548
1549        $headers = array_merge(
1550            $headerParams,
1551            $headers
1552        );
1553
1554        $query = ObjectSerializer::buildQuery($queryParams);
1555
1556        return new Request(
1557            'PATCH',
1558            $this->config->getHost().$resourcePath.($query ? "?$query" : ''),
1559            $headers,
1560            $httpBody
1561        );
1562    }
1563
1564    /**
1565     * Create http client option.
1566     *
1567     * @return array HTTP client options
1568     *
1569     * @throws \RuntimeException on file opening failure
1570     */
1571    protected function createHttpClientOption(): array
1572    {
1573        $options = [];
1574        if ($this->config->getDebug()) {
1575            $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a');
1576            if (!$options[RequestOptions::DEBUG]) {
1577                throw new \RuntimeException('Failed to open the debug file: '.$this->config->getDebugFile());
1578            }
1579        }
1580
1581        if ($this->config->getCertFile()) {
1582            $options[RequestOptions::CERT] = $this->config->getCertFile();
1583        }
1584
1585        if ($this->config->getKeyFile()) {
1586            $options[RequestOptions::SSL_KEY] = $this->config->getKeyFile();
1587        }
1588
1589        return $options;
1590    }
1591
1592    /**
1593     * Handle error responses for operation 'deleteVisitorData'.
1594     *
1595     * @param ApiException $e the API exception to handle
1596     *
1597     * @throws ApiException                  always rethrown after setting error details
1598     * @throws \DateMalformedStringException
1599     *
1600     * @noinspection PhpDuplicateSwitchCaseBodyInspection
1601     * @noinspection RedundantSuppression
1602     */
1603    private function handleDeleteVisitorDataError(ApiException $e): never
1604    {
1605        $response = $e->getResponseObject();
1606
1607        if (null !== $response) {
1608            $errorCode = $e->getCode();
1609
1610            $content = (string) $response->getBody();
1611            $response->getBody()->rewind();
1612
1613            switch ($errorCode) {
1614                case 400:
1615                    $data = ObjectSerializer::deserialize(
1616                        $content,
1617                        '\Fingerprint\ServerSdk\Model\ErrorResponse'
1618                    );
1619                    $e->setErrorDetails($data);
1620
1621                    throw $e;
1622
1623                case 403:
1624                    $data = ObjectSerializer::deserialize(
1625                        $content,
1626                        '\Fingerprint\ServerSdk\Model\ErrorResponse'
1627                    );
1628                    $e->setErrorDetails($data);
1629
1630                    throw $e;
1631
1632                case 404:
1633                    $data = ObjectSerializer::deserialize(
1634                        $content,
1635                        '\Fingerprint\ServerSdk\Model\ErrorResponse'
1636                    );
1637                    $e->setErrorDetails($data);
1638
1639                    throw $e;
1640
1641                case 429:
1642                    $data = ObjectSerializer::deserialize(
1643                        $content,
1644                        '\Fingerprint\ServerSdk\Model\ErrorResponse'
1645                    );
1646                    $e->setErrorDetails($data);
1647
1648                    throw $e;
1649            }
1650        }
1651
1652        throw $e;
1653    }
1654
1655    /**
1656     * Handle error responses for operation 'getEvent'.
1657     *
1658     * @param ApiException $e the API exception to handle
1659     *
1660     * @throws ApiException                  always rethrown after setting error details
1661     * @throws \DateMalformedStringException
1662     *
1663     * @noinspection PhpDuplicateSwitchCaseBodyInspection
1664     * @noinspection RedundantSuppression
1665     */
1666    private function handleGetEventError(ApiException $e): never
1667    {
1668        $response = $e->getResponseObject();
1669
1670        if (null !== $response) {
1671            $errorCode = $e->getCode();
1672
1673            $content = (string) $response->getBody();
1674            $response->getBody()->rewind();
1675
1676            switch ($errorCode) {
1677                case 200:
1678                    $data = ObjectSerializer::deserialize(
1679                        $content,
1680                        '\Fingerprint\ServerSdk\Model\Event'
1681                    );
1682                    $e->setErrorDetails($data);
1683
1684                    throw $e;
1685
1686                case 400:
1687                    $data = ObjectSerializer::deserialize(
1688                        $content,
1689                        '\Fingerprint\ServerSdk\Model\ErrorResponse'
1690                    );
1691                    $e->setErrorDetails($data);
1692
1693                    throw $e;
1694
1695                case 403:
1696                    $data = ObjectSerializer::deserialize(
1697                        $content,
1698                        '\Fingerprint\ServerSdk\Model\ErrorResponse'
1699                    );
1700                    $e->setErrorDetails($data);
1701
1702                    throw $e;
1703
1704                case 404:
1705                    $data = ObjectSerializer::deserialize(
1706                        $content,
1707                        '\Fingerprint\ServerSdk\Model\ErrorResponse'
1708                    );
1709                    $e->setErrorDetails($data);
1710
1711                    throw $e;
1712
1713                case 429:
1714                    $data = ObjectSerializer::deserialize(
1715                        $content,
1716                        '\Fingerprint\ServerSdk\Model\ErrorResponse'
1717                    );
1718                    $e->setErrorDetails($data);
1719
1720                    throw $e;
1721
1722                case 500:
1723                    $data = ObjectSerializer::deserialize(
1724                        $content,
1725                        '\Fingerprint\ServerSdk\Model\ErrorResponse'
1726                    );
1727                    $e->setErrorDetails($data);
1728
1729                    throw $e;
1730            }
1731        }
1732
1733        throw $e;
1734    }
1735
1736    /**
1737     * Handle error responses for operation 'searchEvents'.
1738     *
1739     * @param ApiException $e the API exception to handle
1740     *
1741     * @throws ApiException                  always rethrown after setting error details
1742     * @throws \DateMalformedStringException
1743     *
1744     * @noinspection PhpDuplicateSwitchCaseBodyInspection
1745     * @noinspection RedundantSuppression
1746     */
1747    private function handleSearchEventsError(ApiException $e): never
1748    {
1749        $response = $e->getResponseObject();
1750
1751        if (null !== $response) {
1752            $errorCode = $e->getCode();
1753
1754            $content = (string) $response->getBody();
1755            $response->getBody()->rewind();
1756
1757            switch ($errorCode) {
1758                case 200:
1759                    $data = ObjectSerializer::deserialize(
1760                        $content,
1761                        '\Fingerprint\ServerSdk\Model\EventSearch'
1762                    );
1763                    $e->setErrorDetails($data);
1764
1765                    throw $e;
1766
1767                case 400:
1768                    $data = ObjectSerializer::deserialize(
1769                        $content,
1770                        '\Fingerprint\ServerSdk\Model\ErrorResponse'
1771                    );
1772                    $e->setErrorDetails($data);
1773
1774                    throw $e;
1775
1776                case 403:
1777                    $data = ObjectSerializer::deserialize(
1778                        $content,
1779                        '\Fingerprint\ServerSdk\Model\ErrorResponse'
1780                    );
1781                    $e->setErrorDetails($data);
1782
1783                    throw $e;
1784
1785                case 500:
1786                    $data = ObjectSerializer::deserialize(
1787                        $content,
1788                        '\Fingerprint\ServerSdk\Model\ErrorResponse'
1789                    );
1790                    $e->setErrorDetails($data);
1791
1792                    throw $e;
1793            }
1794        }
1795
1796        throw $e;
1797    }
1798
1799    /**
1800     * Handle error responses for operation 'updateEvent'.
1801     *
1802     * @param ApiException $e the API exception to handle
1803     *
1804     * @throws ApiException                  always rethrown after setting error details
1805     * @throws \DateMalformedStringException
1806     *
1807     * @noinspection PhpDuplicateSwitchCaseBodyInspection
1808     * @noinspection RedundantSuppression
1809     */
1810    private function handleUpdateEventError(ApiException $e): never
1811    {
1812        $response = $e->getResponseObject();
1813
1814        if (null !== $response) {
1815            $errorCode = $e->getCode();
1816
1817            $content = (string) $response->getBody();
1818            $response->getBody()->rewind();
1819
1820            switch ($errorCode) {
1821                case 400:
1822                    $data = ObjectSerializer::deserialize(
1823                        $content,
1824                        '\Fingerprint\ServerSdk\Model\ErrorResponse'
1825                    );
1826                    $e->setErrorDetails($data);
1827
1828                    throw $e;
1829
1830                case 403:
1831                    $data = ObjectSerializer::deserialize(
1832                        $content,
1833                        '\Fingerprint\ServerSdk\Model\ErrorResponse'
1834                    );
1835                    $e->setErrorDetails($data);
1836
1837                    throw $e;
1838
1839                case 404:
1840                    $data = ObjectSerializer::deserialize(
1841                        $content,
1842                        '\Fingerprint\ServerSdk\Model\ErrorResponse'
1843                    );
1844                    $e->setErrorDetails($data);
1845
1846                    throw $e;
1847
1848                case 409:
1849                    $data = ObjectSerializer::deserialize(
1850                        $content,
1851                        '\Fingerprint\ServerSdk\Model\ErrorResponse'
1852                    );
1853                    $e->setErrorDetails($data);
1854
1855                    throw $e;
1856            }
1857        }
1858
1859        throw $e;
1860    }
1861
1862    /**
1863     * Deserialize the response body into the given data type.
1864     *
1865     * @param string            $dataType the expected data type for deserialization
1866     * @param RequestInterface  $request  the original HTTP request
1867     * @param ResponseInterface $response the HTTP response to deserialize
1868     *
1869     * @return array{mixed, ResponseInterface} deserialized data and the HTTP response
1870     *
1871     * @throws ApiException
1872     * @throws \DateMalformedStringException
1873     */
1874    private function handleResponseWithDataType(
1875        string $dataType,
1876        RequestInterface $request,
1877        ResponseInterface $response
1878    ): array {
1879        $content = (string) $response->getBody();
1880        $response->getBody()->rewind();
1881        if ('string' !== $dataType) {
1882            try {
1883                $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
1884            } catch (\JsonException $exception) {
1885                throw new ApiException(
1886                    sprintf(
1887                        'Error JSON decoding server response (%s)',
1888                        $request->getUri()
1889                    ),
1890                    $exception->getCode(),
1891                    $response,
1892                    $exception
1893                );
1894            }
1895        }
1896
1897        return [
1898            ObjectSerializer::deserialize($content, $dataType),
1899            $response,
1900        ];
1901    }
1902}