Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
95.65% covered (success)
95.65%
1012 / 1058
78.57% covered (warning)
78.57%
22 / 28
CRAP
0.00% covered (danger)
0.00%
0 / 1
FingerprintApi
95.65% covered (success)
95.65%
1012 / 1058
78.57% covered (warning)
78.57%
22 / 28
113
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
100.00% covered (success)
100.00%
31 / 31
100.00% covered (success)
100.00%
1 / 1
6
 deleteVisitorDataAsync
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
1 / 1
1
 deleteVisitorDataAsyncWithHttpInfo
78.12% covered (warning)
78.12%
25 / 32
0.00% covered (danger)
0.00%
0 / 1
4.17
 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
100.00% covered (success)
100.00%
35 / 35
100.00% covered (success)
100.00%
1 / 1
6
 getEventAsync
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
1 / 1
1
 getEventAsyncWithHttpInfo
81.08% covered (warning)
81.08%
30 / 37
0.00% covered (danger)
0.00%
0 / 1
4.11
 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
100.00% covered (success)
100.00%
35 / 35
100.00% covered (success)
100.00%
1 / 1
6
 searchEventsAsync
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
1 / 1
1
 searchEventsAsyncWithHttpInfo
81.08% covered (warning)
81.08%
30 / 37
0.00% covered (danger)
0.00%
0 / 1
4.11
 searchEventsRequest
100.00% covered (success)
100.00%
452 / 452
100.00% covered (success)
100.00%
1 / 1
13
 updateEvent
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 updateEventWithHttpInfo
100.00% covered (success)
100.00%
31 / 31
100.00% covered (success)
100.00%
1 / 1
6
 updateEventAsync
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
1 / 1
1
 updateEventAsyncWithHttpInfo
78.12% covered (warning)
78.12%
25 / 32
0.00% covered (danger)
0.00%
0 / 1
4.17
 updateEventRequest
100.00% covered (success)
100.00%
25 / 25
100.00% covered (success)
100.00%
1 / 1
3
 createHttpClientOption
100.00% covered (success)
100.00%
14 / 14
100.00% covered (success)
100.00%
1 / 1
5
 handleDeleteVisitorDataError
100.00% covered (success)
100.00%
34 / 34
100.00% covered (success)
100.00%
1 / 1
6
 handleGetEventError
90.32% covered (success)
90.32%
56 / 62
0.00% covered (danger)
0.00%
0 / 1
10.09
 handleSearchEventsError
80.65% covered (warning)
80.65%
50 / 62
0.00% covered (danger)
0.00%
0 / 1
10.73
 handleUpdateEventError
100.00% covered (success)
100.00%
34 / 34
100.00% covered (success)
100.00%
1 / 1
6
 handleResponseWithDataType
100.00% covered (success)
100.00%
18 / 18
100.00% covered (success)
100.00%
1 / 1
3
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. The API also supports collection of Automation Intelligence for requests to your server in edge, pre-origin, or middleware contexts.
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.23.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\SearchEventsSource;
46use Fingerprint\ServerSdk\Model\SearchEventsVpnConfidence;
47use Fingerprint\ServerSdk\ObjectSerializer;
48use GuzzleHttp\Client;
49use GuzzleHttp\ClientInterface;
50use GuzzleHttp\Exception\ConnectException;
51use GuzzleHttp\Exception\GuzzleException;
52use GuzzleHttp\Exception\RequestException;
53use GuzzleHttp\Promise\PromiseInterface;
54use GuzzleHttp\Psr7\Request;
55use GuzzleHttp\RequestOptions;
56use GuzzleHttp\Utils;
57use Psr\Http\Message\RequestInterface;
58use Psr\Http\Message\ResponseInterface;
59
60/**
61 * FingerprintApi Class Doc Comment.
62 *
63 * @category Class
64 *
65 * @author   OpenAPI Generator team
66 *
67 * @see     https://openapi-generator.tech
68 */
69class FingerprintApi
70{
71    /**
72     * @var ClientInterface HTTP client used to make API requests
73     */
74    protected ClientInterface $client;
75
76    /**
77     * @var Configuration API client configuration
78     */
79    protected Configuration $config;
80
81    /**
82     * @var string integration information
83     */
84    protected string $integration_info = 'fingerprint-pro-server-php-sdk/7.9.0';
85
86    /**
87     * @param Configuration        $config API client configuration
88     * @param ClientInterface|null $client HTTP client instance, defaults to a new Guzzle client
89     */
90    public function __construct(
91        Configuration $config,
92        ?ClientInterface $client = null
93    ) {
94        $this->client = $client ?: new Client();
95        $this->config = $config;
96    }
97
98    /**
99     * Get the API client configuration.
100     *
101     * @return Configuration the API client configuration
102     */
103    public function getConfig(): Configuration
104    {
105        return $this->config;
106    }
107
108    /**
109     * Operation deleteVisitorData.
110     *
111     * Delete a visitor ID
112     *
113     * @param string $visitor_id The [visitor ID](https://docs.fingerprint.com/reference/js-agent-get-function#visitor_id) you want to delete. (required)
114     *
115     * @noinspection GrazieInspection
116     *
117     * @throws ApiException                  on non-2xx response or if the response body is not in the expected format
118     * @throws \InvalidArgumentException
119     * @throws GuzzleException
120     * @throws \DateMalformedStringException
121     */
122    public function deleteVisitorData(string $visitor_id): void
123    {
124        $this->deleteVisitorDataWithHttpInfo($visitor_id);
125    }
126
127    /**
128     * Operation deleteVisitorDataWithHttpInfo.
129     *
130     * Delete a visitor ID
131     *
132     * @param string $visitor_id The [visitor ID](https://docs.fingerprint.com/reference/js-agent-get-function#visitor_id) you want to delete. (required)
133     *
134     * @noinspection GrazieInspection
135     *
136     * @return array{ null, ResponseInterface }
137     *
138     * @throws ApiException                  on non-2xx response or if the response body is not in the expected format
139     * @throws \InvalidArgumentException
140     * @throws GuzzleException
141     * @throws \DateMalformedStringException
142     */
143    public function deleteVisitorDataWithHttpInfo(string $visitor_id): array
144    {
145        $request = $this->deleteVisitorDataRequest($visitor_id);
146
147        try {
148            $options = $this->createHttpClientOption();
149
150            try {
151                $response = $this->client->send($request, $options);
152            } catch (RequestException $e) {
153                throw new ApiException(
154                    "[{$e->getCode()}] {$e->getMessage()}",
155                    (int) $e->getCode(),
156                    $e->getResponse(),
157                    $e
158                );
159            } catch (ConnectException $e) {
160                throw new ApiException(
161                    "[{$e->getCode()}] {$e->getMessage()}",
162                    (int) $e->getCode(),
163                    null,
164                    $e
165                );
166            }
167
168            $statusCode = $response->getStatusCode();
169
170            if ($statusCode < 200 || $statusCode > 299) {
171                throw new ApiException(
172                    sprintf(
173                        '[%d] Error connecting to the API (%s)',
174                        $statusCode,
175                        $request->getUri()
176                    ),
177                    $statusCode,
178                    $response
179                );
180            }
181
182            return [null, $response];
183        } catch (ApiException $e) {
184            $this->handleDeleteVisitorDataError($e);
185        }
186    }
187
188    /**
189     * Operation deleteVisitorDataAsync.
190     *
191     * Delete a visitor ID
192     *
193     * @param string $visitor_id The [visitor ID](https://docs.fingerprint.com/reference/js-agent-get-function#visitor_id) you want to delete. (required)
194     *
195     * @noinspection GrazieInspection
196     *
197     * @return PromiseInterface promise resolving to the deserialized response
198     *
199     * @throws \InvalidArgumentException
200     */
201    public function deleteVisitorDataAsync(string $visitor_id): PromiseInterface
202    {
203        return $this->deleteVisitorDataAsyncWithHttpInfo($visitor_id)
204            ->then(
205                function ($response) {
206                    return $response[0];
207                }
208            );
209    }
210
211    /**
212     * Operation deleteVisitorDataAsyncWithHttpInfo.
213     *
214     * Delete a visitor ID
215     *
216     * @param string $visitor_id The [visitor ID](https://docs.fingerprint.com/reference/js-agent-get-function#visitor_id) you want to delete. (required)
217     *
218     * @noinspection GrazieInspection
219     *
220     * @return PromiseInterface promise resolving to an array of deserialized data and the HTTP response
221     *
222     * @throws \InvalidArgumentException
223     */
224    public function deleteVisitorDataAsyncWithHttpInfo(string $visitor_id): PromiseInterface
225    {
226        $request = $this->deleteVisitorDataRequest($visitor_id);
227
228        return $this->client
229            ->sendAsync($request, $this->createHttpClientOption())
230            ->then(
231                function ($response) {
232                    return [null, $response];
233                },
234                function ($e) {
235                    if ($e instanceof RequestException) {
236                        $e = new ApiException(
237                            "[{$e->getCode()}] {$e->getMessage()}",
238                            (int) $e->getCode(),
239                            $e->getResponse(),
240                            $e
241                        );
242                    } elseif ($e instanceof ConnectException) {
243                        $e = new ApiException(
244                            "[{$e->getCode()}] {$e->getMessage()}",
245                            (int) $e->getCode(),
246                            null,
247                            $e
248                        );
249                    } elseif (!$e instanceof ApiException) {
250                        $e = new ApiException(
251                            $e->getMessage(),
252                            (int) $e->getCode(),
253                            null,
254                            $e
255                        );
256                    }
257                    $this->handleDeleteVisitorDataError($e);
258                }
259            );
260    }
261
262    /**
263     * Create request for operation 'deleteVisitorData'.
264     *
265     * @param string $visitor_id The [visitor ID](https://docs.fingerprint.com/reference/js-agent-get-function#visitor_id) you want to delete. (required)
266     *
267     * @noinspection GrazieInspection
268     *
269     * @return Request the prepared HTTP request
270     *
271     * @throws \InvalidArgumentException
272     */
273    public function deleteVisitorDataRequest(string $visitor_id): Request
274    {
275        $resourcePath = '/visitors/{visitor_id}';
276        $headers = [
277            'Authorization' => 'Bearer '.$this->config->getApiKey(),
278        ];
279        $queryParams = ['ii' => $this->integration_info];
280        $headerParams = [];
281
282        // path params
283        $resourcePath = str_replace(
284            '{visitor_id}',
285            ObjectSerializer::toPathValue($visitor_id),
286            $resourcePath
287        );
288
289        if ($this->config->getUserAgent()) {
290            $headers['User-Agent'] = $this->config->getUserAgent();
291        }
292
293        $headers = array_merge(
294            $headerParams,
295            $headers
296        );
297
298        $query = ObjectSerializer::buildQuery($queryParams);
299
300        return new Request(
301            'DELETE',
302            $this->config->getHost().$resourcePath.($query ? "?$query" : ''),
303            $headers,
304        );
305    }
306
307    /**
308     * Operation getEvent.
309     *
310     * Get an event by event ID
311     *
312     * @param string      $event_id   The unique [identifier](https://docs.fingerprint.com/reference/js-agent-get-function#event_id) of each identification request (`requestId` can be used in its place). (required)
313     * @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)
314     *
315     * @noinspection GrazieInspection
316     *
317     * @throws ApiException                  on non-2xx response or if the response body is not in the expected format
318     * @throws \InvalidArgumentException
319     * @throws GuzzleException
320     * @throws \DateMalformedStringException
321     */
322    public function getEvent(string $event_id, ?string $ruleset_id = null): Event
323    {
324        list($response) = $this->getEventWithHttpInfo($event_id, $ruleset_id);
325
326        return $response;
327    }
328
329    /**
330     * Operation getEventWithHttpInfo.
331     *
332     * Get an event by event ID
333     *
334     * @param string      $event_id   The unique [identifier](https://docs.fingerprint.com/reference/js-agent-get-function#event_id) of each identification request (`requestId` can be used in its place). (required)
335     * @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)
336     *
337     * @noinspection GrazieInspection
338     *
339     * @return array{ Event|null, ResponseInterface }
340     *
341     * @throws ApiException                  on non-2xx response or if the response body is not in the expected format
342     * @throws \InvalidArgumentException
343     * @throws GuzzleException
344     * @throws \DateMalformedStringException
345     */
346    public function getEventWithHttpInfo(string $event_id, ?string $ruleset_id = null): array
347    {
348        $request = $this->getEventRequest($event_id, $ruleset_id);
349
350        try {
351            $options = $this->createHttpClientOption();
352
353            try {
354                $response = $this->client->send($request, $options);
355            } catch (RequestException $e) {
356                throw new ApiException(
357                    "[{$e->getCode()}] {$e->getMessage()}",
358                    (int) $e->getCode(),
359                    $e->getResponse(),
360                    $e
361                );
362            } catch (ConnectException $e) {
363                throw new ApiException(
364                    "[{$e->getCode()}] {$e->getMessage()}",
365                    (int) $e->getCode(),
366                    null,
367                    $e
368                );
369            }
370
371            $statusCode = $response->getStatusCode();
372
373            if ($statusCode < 200 || $statusCode > 299) {
374                throw new ApiException(
375                    sprintf(
376                        '[%d] Error connecting to the API (%s)',
377                        $statusCode,
378                        $request->getUri()
379                    ),
380                    $statusCode,
381                    $response
382                );
383            }
384
385            return $this->handleResponseWithDataType(
386                '\Fingerprint\ServerSdk\Model\Event',
387                $request,
388                $response
389            );
390        } catch (ApiException $e) {
391            $this->handleGetEventError($e);
392        }
393    }
394
395    /**
396     * Operation getEventAsync.
397     *
398     * Get an event by event ID
399     *
400     * @param string      $event_id   The unique [identifier](https://docs.fingerprint.com/reference/js-agent-get-function#event_id) of each identification request (`requestId` can be used in its place). (required)
401     * @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)
402     *
403     * @noinspection GrazieInspection
404     *
405     * @return PromiseInterface promise resolving to the deserialized response
406     *
407     * @throws \InvalidArgumentException
408     */
409    public function getEventAsync(string $event_id, ?string $ruleset_id = null): PromiseInterface
410    {
411        return $this->getEventAsyncWithHttpInfo($event_id, $ruleset_id)
412            ->then(
413                function ($response) {
414                    return $response[0];
415                }
416            );
417    }
418
419    /**
420     * Operation getEventAsyncWithHttpInfo.
421     *
422     * Get an event by event ID
423     *
424     * @param string      $event_id   The unique [identifier](https://docs.fingerprint.com/reference/js-agent-get-function#event_id) of each identification request (`requestId` can be used in its place). (required)
425     * @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)
426     *
427     * @noinspection GrazieInspection
428     *
429     * @return PromiseInterface promise resolving to an array of deserialized data and the HTTP response
430     *
431     * @throws \InvalidArgumentException
432     */
433    public function getEventAsyncWithHttpInfo(string $event_id, ?string $ruleset_id = null): PromiseInterface
434    {
435        $request = $this->getEventRequest($event_id, $ruleset_id);
436
437        return $this->client
438            ->sendAsync($request, $this->createHttpClientOption())
439            ->then(
440                function ($response) {
441                    $content = (string) $response->getBody();
442                    $response->getBody()->rewind();
443
444                    return [
445                        ObjectSerializer::deserialize($content, '\Fingerprint\ServerSdk\Model\Event'),
446                        $response,
447                    ];
448                },
449                function ($e) {
450                    if ($e instanceof RequestException) {
451                        $e = new ApiException(
452                            "[{$e->getCode()}] {$e->getMessage()}",
453                            (int) $e->getCode(),
454                            $e->getResponse(),
455                            $e
456                        );
457                    } elseif ($e instanceof ConnectException) {
458                        $e = new ApiException(
459                            "[{$e->getCode()}] {$e->getMessage()}",
460                            (int) $e->getCode(),
461                            null,
462                            $e
463                        );
464                    } elseif (!$e instanceof ApiException) {
465                        $e = new ApiException(
466                            $e->getMessage(),
467                            (int) $e->getCode(),
468                            null,
469                            $e
470                        );
471                    }
472                    $this->handleGetEventError($e);
473                }
474            );
475    }
476
477    /**
478     * Create request for operation 'getEvent'.
479     *
480     * @param string      $event_id   The unique [identifier](https://docs.fingerprint.com/reference/js-agent-get-function#event_id) of each identification request (`requestId` can be used in its place). (required)
481     * @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)
482     *
483     * @noinspection GrazieInspection
484     *
485     * @return Request the prepared HTTP request
486     *
487     * @throws \InvalidArgumentException
488     */
489    public function getEventRequest(string $event_id, ?string $ruleset_id = null): Request
490    {
491        $resourcePath = '/events/{event_id}';
492        $headers = [
493            'Authorization' => 'Bearer '.$this->config->getApiKey(),
494        ];
495        $queryParams = ['ii' => $this->integration_info];
496        $headerParams = [];
497
498        // query params
499        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
500            $ruleset_id,
501            'ruleset_id',
502            'string',
503            'form',
504            true,
505            false
506        ) ?? []);
507
508        // path params
509        $resourcePath = str_replace(
510            '{event_id}',
511            ObjectSerializer::toPathValue($event_id),
512            $resourcePath
513        );
514
515        if ($this->config->getUserAgent()) {
516            $headers['User-Agent'] = $this->config->getUserAgent();
517        }
518
519        $headers = array_merge(
520            $headerParams,
521            $headers
522        );
523
524        $query = ObjectSerializer::buildQuery($queryParams);
525
526        return new Request(
527            'GET',
528            $this->config->getHost().$resourcePath.($query ? "?$query" : ''),
529            $headers,
530        );
531    }
532
533    /**
534     * Operation searchEvents.
535     *
536     * Search events
537     *
538     * @param int                                              $limit                             Maximum number of events to return. Defaults to 10 when omitted. 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)
539     * @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=S9rgMMUb4z3X5t5pr_tSgoSZlmyF0O8X7kCV2m981-iY1LmRTjraa1rTk3L-hQExnDWCi0RA-zAIjaVSTNO2AN2eqQWgzT0RjbieMxRfSdkM-HmOhdOgdQvYfPG3vqU1DJKh4Q` (optional)
540     * @param string|null                                      $visitor_id                        Unique [visitor identifier](https://docs.fingerprint.com/reference/js-agent-get-function#visitor_id) issued by Fingerprint Identification and all active Smart Signals.  Filter events by matching Visitor ID (`identification.visitor_id` property). (optional)
541     * @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)
542     * @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)
543     * @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, and no `bot_info` was present. (optional)
544     * @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)
545     * @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)
546     * @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)
547     * @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)
548     * @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)
549     * @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)
550     * @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)
551     * @param string|null                                      $linked_id                         Filter events by your custom identifier.  You can use [linked IDs](https://docs.fingerprint.com/reference/js-agent-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)
552     * @param string|null                                      $url                               Filter events by the URL (`url` property) associated with the event. (optional)
553     * @param string|null                                      $bundle_id                         Filter events by the Bundle ID (iOS) associated with the event. (optional)
554     * @param string|null                                      $package_name                      Filter events by the Package Name (Android) associated with the event. (optional)
555     * @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)
556     * @param \DateTime|int|null                               $start                             Include events that happened after the provided `start` date formatted as an RFC3339 timestamp. For backward compatibility, a Unix milliseconds timestamp is also accepted. Defaults to 7 days ago. Setting `start` does not change the default `end` date of `now` â€” adjust it separately if needed. (optional)
557     * @param \DateTime|int|null                               $end                               Include events that happened before the provided `end` date formatted as an RFC3339 timestamp. For backward compatibility, a Unix milliseconds timestamp is also accepted. Defaults to now. Setting `end` does not change the default `start` date of `7 days ago` â€” adjust it separately if needed. (optional)
558     * @param bool|null                                        $reverse                           When `true`, sort events oldest first (ascending timestamp order). Defaults to `false` (newest first, descending timestamp order). (optional)
559     * @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)
560     * @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)
561     * @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)
562     * @param bool|null                                        $tampering                         Filter events by Browser Tampering Detection result. > Note: When using this parameter, only events with the `tampering` property set to `true` or `false` are returned. Events without a `tampering` Smart Signal result are left out of the response. (optional)
563     * @param bool|null                                        $anti_detect_browser               Filter events by Anti-detect Browser Detection result. > Note: When using this parameter, only events with the `tampering_details.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)
564     * @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)
565     * @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)
566     * @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)
567     * @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)
568     * @param bool|null                                        $factory_reset                     Filter events by Factory Reset Detection result. > Note: When using this parameter, only events with a `factory_reset_timestamp` property populated are included. Events without a `factory_reset_timestamp` Smart Signal result are left out of the response. (optional)
569     * @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)
570     * @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)
571     * @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)
572     * @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)
573     * @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)
574     * @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)
575     * @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)
576     * @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)
577     * @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)
578     * @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)
579     * @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)
580     * @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)
581     * @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)
582     * @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)
583     * @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)
584     * @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)
585     * @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)
586     * @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)
587     * @param bool|null                                        $simulator                         Filter events by the Simulator Detection result (native iOS SDK and Safari on iOS).  > 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)
588     * @param SearchEventsSource[]|null                        $source                            Selects the source of events to search. When omitted, only traditional identification events generated from devices are returned (the default behavior). When set to `edge`, only Automation Intelligence (Edge) events are returned.  To retrieve all events regardless of source, you must make two requests. One with the `source` parameter set to `edge`, and another with the `source` parameter omitted.  > Note: The Automation Intelligence API is in public preview testing phase.  If you encounter any issues, please [contact](https://fingerprint.com/support/) our support team. (optional)
589     * @param bool|null                                        $active_call                       Filter events by Active Call Detection result on mobile devices.  > Note: When using this parameter, only events with the `active_call` property set to `true` or `false` are returned. Events without an `active_call` Smart Signal result are left out of the response. (optional)
590     * @param bool|null                                        $compromised_device_integrity      Filter events by Compromised Device Integrity result on Android devices.  > Note: When using this parameter, only events with the `compromised_device_integrity` property set to `true` or `false` are returned. Events without a `compromised_device_integrity` Smart Signal result are left out of the response. (optional)
591     *
592     * @noinspection GrazieInspection
593     *
594     * @throws ApiException                  on non-2xx response or if the response body is not in the expected format
595     * @throws \InvalidArgumentException
596     * @throws GuzzleException
597     * @throws \DateMalformedStringException
598     */
599    public function searchEvents(?int $limit = null, ?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 $source = null, ?bool $active_call = null, ?bool $compromised_device_integrity = null): EventSearch
600    {
601        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, $source, $active_call, $compromised_device_integrity);
602
603        return $response;
604    }
605
606    /**
607     * Operation searchEventsWithHttpInfo.
608     *
609     * Search events
610     *
611     * @param int                                              $limit                             Maximum number of events to return. Defaults to 10 when omitted. 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)
612     * @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=S9rgMMUb4z3X5t5pr_tSgoSZlmyF0O8X7kCV2m981-iY1LmRTjraa1rTk3L-hQExnDWCi0RA-zAIjaVSTNO2AN2eqQWgzT0RjbieMxRfSdkM-HmOhdOgdQvYfPG3vqU1DJKh4Q` (optional)
613     * @param string|null                                      $visitor_id                        Unique [visitor identifier](https://docs.fingerprint.com/reference/js-agent-get-function#visitor_id) issued by Fingerprint Identification and all active Smart Signals.  Filter events by matching Visitor ID (`identification.visitor_id` property). (optional)
614     * @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)
615     * @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)
616     * @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, and no `bot_info` was present. (optional)
617     * @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)
618     * @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)
619     * @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)
620     * @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)
621     * @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)
622     * @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)
623     * @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)
624     * @param string|null                                      $linked_id                         Filter events by your custom identifier.  You can use [linked IDs](https://docs.fingerprint.com/reference/js-agent-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)
625     * @param string|null                                      $url                               Filter events by the URL (`url` property) associated with the event. (optional)
626     * @param string|null                                      $bundle_id                         Filter events by the Bundle ID (iOS) associated with the event. (optional)
627     * @param string|null                                      $package_name                      Filter events by the Package Name (Android) associated with the event. (optional)
628     * @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)
629     * @param \DateTime|int|null                               $start                             Include events that happened after the provided `start` date formatted as an RFC3339 timestamp. For backward compatibility, a Unix milliseconds timestamp is also accepted. Defaults to 7 days ago. Setting `start` does not change the default `end` date of `now` â€” adjust it separately if needed. (optional)
630     * @param \DateTime|int|null                               $end                               Include events that happened before the provided `end` date formatted as an RFC3339 timestamp. For backward compatibility, a Unix milliseconds timestamp is also accepted. Defaults to now. Setting `end` does not change the default `start` date of `7 days ago` â€” adjust it separately if needed. (optional)
631     * @param bool|null                                        $reverse                           When `true`, sort events oldest first (ascending timestamp order). Defaults to `false` (newest first, descending timestamp order). (optional)
632     * @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)
633     * @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)
634     * @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)
635     * @param bool|null                                        $tampering                         Filter events by Browser Tampering Detection result. > Note: When using this parameter, only events with the `tampering` property set to `true` or `false` are returned. Events without a `tampering` Smart Signal result are left out of the response. (optional)
636     * @param bool|null                                        $anti_detect_browser               Filter events by Anti-detect Browser Detection result. > Note: When using this parameter, only events with the `tampering_details.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)
637     * @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)
638     * @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)
639     * @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)
640     * @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)
641     * @param bool|null                                        $factory_reset                     Filter events by Factory Reset Detection result. > Note: When using this parameter, only events with a `factory_reset_timestamp` property populated are included. Events without a `factory_reset_timestamp` Smart Signal result are left out of the response. (optional)
642     * @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)
643     * @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)
644     * @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)
645     * @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)
646     * @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)
647     * @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)
648     * @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)
649     * @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)
650     * @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)
651     * @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)
652     * @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)
653     * @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)
654     * @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)
655     * @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)
656     * @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)
657     * @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)
658     * @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)
659     * @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)
660     * @param bool|null                                        $simulator                         Filter events by the Simulator Detection result (native iOS SDK and Safari on iOS).  > 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)
661     * @param SearchEventsSource[]|null                        $source                            Selects the source of events to search. When omitted, only traditional identification events generated from devices are returned (the default behavior). When set to `edge`, only Automation Intelligence (Edge) events are returned.  To retrieve all events regardless of source, you must make two requests. One with the `source` parameter set to `edge`, and another with the `source` parameter omitted.  > Note: The Automation Intelligence API is in public preview testing phase.  If you encounter any issues, please [contact](https://fingerprint.com/support/) our support team. (optional)
662     * @param bool|null                                        $active_call                       Filter events by Active Call Detection result on mobile devices.  > Note: When using this parameter, only events with the `active_call` property set to `true` or `false` are returned. Events without an `active_call` Smart Signal result are left out of the response. (optional)
663     * @param bool|null                                        $compromised_device_integrity      Filter events by Compromised Device Integrity result on Android devices.  > Note: When using this parameter, only events with the `compromised_device_integrity` property set to `true` or `false` are returned. Events without a `compromised_device_integrity` Smart Signal result are left out of the response. (optional)
664     *
665     * @noinspection GrazieInspection
666     *
667     * @return array{ EventSearch|null, ResponseInterface }
668     *
669     * @throws ApiException                  on non-2xx response or if the response body is not in the expected format
670     * @throws \InvalidArgumentException
671     * @throws GuzzleException
672     * @throws \DateMalformedStringException
673     */
674    public function searchEventsWithHttpInfo(?int $limit = null, ?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 $source = null, ?bool $active_call = null, ?bool $compromised_device_integrity = null): array
675    {
676        $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, $source, $active_call, $compromised_device_integrity);
677
678        try {
679            $options = $this->createHttpClientOption();
680
681            try {
682                $response = $this->client->send($request, $options);
683            } catch (RequestException $e) {
684                throw new ApiException(
685                    "[{$e->getCode()}] {$e->getMessage()}",
686                    (int) $e->getCode(),
687                    $e->getResponse(),
688                    $e
689                );
690            } catch (ConnectException $e) {
691                throw new ApiException(
692                    "[{$e->getCode()}] {$e->getMessage()}",
693                    (int) $e->getCode(),
694                    null,
695                    $e
696                );
697            }
698
699            $statusCode = $response->getStatusCode();
700
701            if ($statusCode < 200 || $statusCode > 299) {
702                throw new ApiException(
703                    sprintf(
704                        '[%d] Error connecting to the API (%s)',
705                        $statusCode,
706                        $request->getUri()
707                    ),
708                    $statusCode,
709                    $response
710                );
711            }
712
713            return $this->handleResponseWithDataType(
714                '\Fingerprint\ServerSdk\Model\EventSearch',
715                $request,
716                $response
717            );
718        } catch (ApiException $e) {
719            $this->handleSearchEventsError($e);
720        }
721    }
722
723    /**
724     * Operation searchEventsAsync.
725     *
726     * Search events
727     *
728     * @param int                                              $limit                             Maximum number of events to return. Defaults to 10 when omitted. 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)
729     * @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=S9rgMMUb4z3X5t5pr_tSgoSZlmyF0O8X7kCV2m981-iY1LmRTjraa1rTk3L-hQExnDWCi0RA-zAIjaVSTNO2AN2eqQWgzT0RjbieMxRfSdkM-HmOhdOgdQvYfPG3vqU1DJKh4Q` (optional)
730     * @param string|null                                      $visitor_id                        Unique [visitor identifier](https://docs.fingerprint.com/reference/js-agent-get-function#visitor_id) issued by Fingerprint Identification and all active Smart Signals.  Filter events by matching Visitor ID (`identification.visitor_id` property). (optional)
731     * @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)
732     * @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)
733     * @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, and no `bot_info` was present. (optional)
734     * @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)
735     * @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)
736     * @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)
737     * @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)
738     * @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)
739     * @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)
740     * @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)
741     * @param string|null                                      $linked_id                         Filter events by your custom identifier.  You can use [linked IDs](https://docs.fingerprint.com/reference/js-agent-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)
742     * @param string|null                                      $url                               Filter events by the URL (`url` property) associated with the event. (optional)
743     * @param string|null                                      $bundle_id                         Filter events by the Bundle ID (iOS) associated with the event. (optional)
744     * @param string|null                                      $package_name                      Filter events by the Package Name (Android) associated with the event. (optional)
745     * @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)
746     * @param \DateTime|int|null                               $start                             Include events that happened after the provided `start` date formatted as an RFC3339 timestamp. For backward compatibility, a Unix milliseconds timestamp is also accepted. Defaults to 7 days ago. Setting `start` does not change the default `end` date of `now` â€” adjust it separately if needed. (optional)
747     * @param \DateTime|int|null                               $end                               Include events that happened before the provided `end` date formatted as an RFC3339 timestamp. For backward compatibility, a Unix milliseconds timestamp is also accepted. Defaults to now. Setting `end` does not change the default `start` date of `7 days ago` â€” adjust it separately if needed. (optional)
748     * @param bool|null                                        $reverse                           When `true`, sort events oldest first (ascending timestamp order). Defaults to `false` (newest first, descending timestamp order). (optional)
749     * @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)
750     * @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)
751     * @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)
752     * @param bool|null                                        $tampering                         Filter events by Browser Tampering Detection result. > Note: When using this parameter, only events with the `tampering` property set to `true` or `false` are returned. Events without a `tampering` Smart Signal result are left out of the response. (optional)
753     * @param bool|null                                        $anti_detect_browser               Filter events by Anti-detect Browser Detection result. > Note: When using this parameter, only events with the `tampering_details.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)
754     * @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)
755     * @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)
756     * @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)
757     * @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)
758     * @param bool|null                                        $factory_reset                     Filter events by Factory Reset Detection result. > Note: When using this parameter, only events with a `factory_reset_timestamp` property populated are included. Events without a `factory_reset_timestamp` Smart Signal result are left out of the response. (optional)
759     * @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)
760     * @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)
761     * @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)
762     * @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)
763     * @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)
764     * @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)
765     * @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)
766     * @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)
767     * @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)
768     * @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)
769     * @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)
770     * @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)
771     * @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)
772     * @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)
773     * @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)
774     * @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)
775     * @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)
776     * @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)
777     * @param bool|null                                        $simulator                         Filter events by the Simulator Detection result (native iOS SDK and Safari on iOS).  > 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)
778     * @param SearchEventsSource[]|null                        $source                            Selects the source of events to search. When omitted, only traditional identification events generated from devices are returned (the default behavior). When set to `edge`, only Automation Intelligence (Edge) events are returned.  To retrieve all events regardless of source, you must make two requests. One with the `source` parameter set to `edge`, and another with the `source` parameter omitted.  > Note: The Automation Intelligence API is in public preview testing phase.  If you encounter any issues, please [contact](https://fingerprint.com/support/) our support team. (optional)
779     * @param bool|null                                        $active_call                       Filter events by Active Call Detection result on mobile devices.  > Note: When using this parameter, only events with the `active_call` property set to `true` or `false` are returned. Events without an `active_call` Smart Signal result are left out of the response. (optional)
780     * @param bool|null                                        $compromised_device_integrity      Filter events by Compromised Device Integrity result on Android devices.  > Note: When using this parameter, only events with the `compromised_device_integrity` property set to `true` or `false` are returned. Events without a `compromised_device_integrity` Smart Signal result are left out of the response. (optional)
781     *
782     * @noinspection GrazieInspection
783     *
784     * @return PromiseInterface promise resolving to the deserialized response
785     *
786     * @throws \InvalidArgumentException
787     */
788    public function searchEventsAsync(?int $limit = null, ?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 $source = null, ?bool $active_call = null, ?bool $compromised_device_integrity = null): PromiseInterface
789    {
790        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, $source, $active_call, $compromised_device_integrity)
791            ->then(
792                function ($response) {
793                    return $response[0];
794                }
795            );
796    }
797
798    /**
799     * Operation searchEventsAsyncWithHttpInfo.
800     *
801     * Search events
802     *
803     * @param int                                              $limit                             Maximum number of events to return. Defaults to 10 when omitted. 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)
804     * @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=S9rgMMUb4z3X5t5pr_tSgoSZlmyF0O8X7kCV2m981-iY1LmRTjraa1rTk3L-hQExnDWCi0RA-zAIjaVSTNO2AN2eqQWgzT0RjbieMxRfSdkM-HmOhdOgdQvYfPG3vqU1DJKh4Q` (optional)
805     * @param string|null                                      $visitor_id                        Unique [visitor identifier](https://docs.fingerprint.com/reference/js-agent-get-function#visitor_id) issued by Fingerprint Identification and all active Smart Signals.  Filter events by matching Visitor ID (`identification.visitor_id` property). (optional)
806     * @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)
807     * @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)
808     * @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, and no `bot_info` was present. (optional)
809     * @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)
810     * @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)
811     * @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)
812     * @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)
813     * @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)
814     * @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)
815     * @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)
816     * @param string|null                                      $linked_id                         Filter events by your custom identifier.  You can use [linked IDs](https://docs.fingerprint.com/reference/js-agent-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)
817     * @param string|null                                      $url                               Filter events by the URL (`url` property) associated with the event. (optional)
818     * @param string|null                                      $bundle_id                         Filter events by the Bundle ID (iOS) associated with the event. (optional)
819     * @param string|null                                      $package_name                      Filter events by the Package Name (Android) associated with the event. (optional)
820     * @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)
821     * @param \DateTime|int|null                               $start                             Include events that happened after the provided `start` date formatted as an RFC3339 timestamp. For backward compatibility, a Unix milliseconds timestamp is also accepted. Defaults to 7 days ago. Setting `start` does not change the default `end` date of `now` â€” adjust it separately if needed. (optional)
822     * @param \DateTime|int|null                               $end                               Include events that happened before the provided `end` date formatted as an RFC3339 timestamp. For backward compatibility, a Unix milliseconds timestamp is also accepted. Defaults to now. Setting `end` does not change the default `start` date of `7 days ago` â€” adjust it separately if needed. (optional)
823     * @param bool|null                                        $reverse                           When `true`, sort events oldest first (ascending timestamp order). Defaults to `false` (newest first, descending timestamp order). (optional)
824     * @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)
825     * @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)
826     * @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)
827     * @param bool|null                                        $tampering                         Filter events by Browser Tampering Detection result. > Note: When using this parameter, only events with the `tampering` property set to `true` or `false` are returned. Events without a `tampering` Smart Signal result are left out of the response. (optional)
828     * @param bool|null                                        $anti_detect_browser               Filter events by Anti-detect Browser Detection result. > Note: When using this parameter, only events with the `tampering_details.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)
829     * @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)
830     * @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)
831     * @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)
832     * @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)
833     * @param bool|null                                        $factory_reset                     Filter events by Factory Reset Detection result. > Note: When using this parameter, only events with a `factory_reset_timestamp` property populated are included. Events without a `factory_reset_timestamp` Smart Signal result are left out of the response. (optional)
834     * @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)
835     * @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)
836     * @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)
837     * @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)
838     * @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)
839     * @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)
840     * @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)
841     * @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)
842     * @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)
843     * @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)
844     * @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)
845     * @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)
846     * @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)
847     * @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)
848     * @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)
849     * @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)
850     * @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)
851     * @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)
852     * @param bool|null                                        $simulator                         Filter events by the Simulator Detection result (native iOS SDK and Safari on iOS).  > 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)
853     * @param SearchEventsSource[]|null                        $source                            Selects the source of events to search. When omitted, only traditional identification events generated from devices are returned (the default behavior). When set to `edge`, only Automation Intelligence (Edge) events are returned.  To retrieve all events regardless of source, you must make two requests. One with the `source` parameter set to `edge`, and another with the `source` parameter omitted.  > Note: The Automation Intelligence API is in public preview testing phase.  If you encounter any issues, please [contact](https://fingerprint.com/support/) our support team. (optional)
854     * @param bool|null                                        $active_call                       Filter events by Active Call Detection result on mobile devices.  > Note: When using this parameter, only events with the `active_call` property set to `true` or `false` are returned. Events without an `active_call` Smart Signal result are left out of the response. (optional)
855     * @param bool|null                                        $compromised_device_integrity      Filter events by Compromised Device Integrity result on Android devices.  > Note: When using this parameter, only events with the `compromised_device_integrity` property set to `true` or `false` are returned. Events without a `compromised_device_integrity` Smart Signal result are left out of the response. (optional)
856     *
857     * @noinspection GrazieInspection
858     *
859     * @return PromiseInterface promise resolving to an array of deserialized data and the HTTP response
860     *
861     * @throws \InvalidArgumentException
862     */
863    public function searchEventsAsyncWithHttpInfo(?int $limit = null, ?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 $source = null, ?bool $active_call = null, ?bool $compromised_device_integrity = null): PromiseInterface
864    {
865        $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, $source, $active_call, $compromised_device_integrity);
866
867        return $this->client
868            ->sendAsync($request, $this->createHttpClientOption())
869            ->then(
870                function ($response) {
871                    $content = (string) $response->getBody();
872                    $response->getBody()->rewind();
873
874                    return [
875                        ObjectSerializer::deserialize($content, '\Fingerprint\ServerSdk\Model\EventSearch'),
876                        $response,
877                    ];
878                },
879                function ($e) {
880                    if ($e instanceof RequestException) {
881                        $e = new ApiException(
882                            "[{$e->getCode()}] {$e->getMessage()}",
883                            (int) $e->getCode(),
884                            $e->getResponse(),
885                            $e
886                        );
887                    } elseif ($e instanceof ConnectException) {
888                        $e = new ApiException(
889                            "[{$e->getCode()}] {$e->getMessage()}",
890                            (int) $e->getCode(),
891                            null,
892                            $e
893                        );
894                    } elseif (!$e instanceof ApiException) {
895                        $e = new ApiException(
896                            $e->getMessage(),
897                            (int) $e->getCode(),
898                            null,
899                            $e
900                        );
901                    }
902                    $this->handleSearchEventsError($e);
903                }
904            );
905    }
906
907    /**
908     * Create request for operation 'searchEvents'.
909     *
910     * @param int                                              $limit                             Maximum number of events to return. Defaults to 10 when omitted. 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)
911     * @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=S9rgMMUb4z3X5t5pr_tSgoSZlmyF0O8X7kCV2m981-iY1LmRTjraa1rTk3L-hQExnDWCi0RA-zAIjaVSTNO2AN2eqQWgzT0RjbieMxRfSdkM-HmOhdOgdQvYfPG3vqU1DJKh4Q` (optional)
912     * @param string|null                                      $visitor_id                        Unique [visitor identifier](https://docs.fingerprint.com/reference/js-agent-get-function#visitor_id) issued by Fingerprint Identification and all active Smart Signals.  Filter events by matching Visitor ID (`identification.visitor_id` property). (optional)
913     * @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)
914     * @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)
915     * @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, and no `bot_info` was present. (optional)
916     * @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)
917     * @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)
918     * @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)
919     * @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)
920     * @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)
921     * @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)
922     * @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)
923     * @param string|null                                      $linked_id                         Filter events by your custom identifier.  You can use [linked IDs](https://docs.fingerprint.com/reference/js-agent-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)
924     * @param string|null                                      $url                               Filter events by the URL (`url` property) associated with the event. (optional)
925     * @param string|null                                      $bundle_id                         Filter events by the Bundle ID (iOS) associated with the event. (optional)
926     * @param string|null                                      $package_name                      Filter events by the Package Name (Android) associated with the event. (optional)
927     * @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)
928     * @param \DateTime|int|null                               $start                             Include events that happened after the provided `start` date formatted as an RFC3339 timestamp. For backward compatibility, a Unix milliseconds timestamp is also accepted. Defaults to 7 days ago. Setting `start` does not change the default `end` date of `now` â€” adjust it separately if needed. (optional)
929     * @param \DateTime|int|null                               $end                               Include events that happened before the provided `end` date formatted as an RFC3339 timestamp. For backward compatibility, a Unix milliseconds timestamp is also accepted. Defaults to now. Setting `end` does not change the default `start` date of `7 days ago` â€” adjust it separately if needed. (optional)
930     * @param bool|null                                        $reverse                           When `true`, sort events oldest first (ascending timestamp order). Defaults to `false` (newest first, descending timestamp order). (optional)
931     * @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)
932     * @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)
933     * @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)
934     * @param bool|null                                        $tampering                         Filter events by Browser Tampering Detection result. > Note: When using this parameter, only events with the `tampering` property set to `true` or `false` are returned. Events without a `tampering` Smart Signal result are left out of the response. (optional)
935     * @param bool|null                                        $anti_detect_browser               Filter events by Anti-detect Browser Detection result. > Note: When using this parameter, only events with the `tampering_details.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)
936     * @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)
937     * @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)
938     * @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)
939     * @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)
940     * @param bool|null                                        $factory_reset                     Filter events by Factory Reset Detection result. > Note: When using this parameter, only events with a `factory_reset_timestamp` property populated are included. Events without a `factory_reset_timestamp` Smart Signal result are left out of the response. (optional)
941     * @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)
942     * @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)
943     * @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)
944     * @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)
945     * @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)
946     * @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)
947     * @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)
948     * @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)
949     * @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)
950     * @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)
951     * @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)
952     * @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)
953     * @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)
954     * @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)
955     * @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)
956     * @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)
957     * @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)
958     * @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)
959     * @param bool|null                                        $simulator                         Filter events by the Simulator Detection result (native iOS SDK and Safari on iOS).  > 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)
960     * @param SearchEventsSource[]|null                        $source                            Selects the source of events to search. When omitted, only traditional identification events generated from devices are returned (the default behavior). When set to `edge`, only Automation Intelligence (Edge) events are returned.  To retrieve all events regardless of source, you must make two requests. One with the `source` parameter set to `edge`, and another with the `source` parameter omitted.  > Note: The Automation Intelligence API is in public preview testing phase.  If you encounter any issues, please [contact](https://fingerprint.com/support/) our support team. (optional)
961     * @param bool|null                                        $active_call                       Filter events by Active Call Detection result on mobile devices.  > Note: When using this parameter, only events with the `active_call` property set to `true` or `false` are returned. Events without an `active_call` Smart Signal result are left out of the response. (optional)
962     * @param bool|null                                        $compromised_device_integrity      Filter events by Compromised Device Integrity result on Android devices.  > Note: When using this parameter, only events with the `compromised_device_integrity` property set to `true` or `false` are returned. Events without a `compromised_device_integrity` Smart Signal result are left out of the response. (optional)
963     *
964     * @noinspection GrazieInspection
965     *
966     * @return Request the prepared HTTP request
967     *
968     * @throws \InvalidArgumentException
969     */
970    public function searchEventsRequest(?int $limit = null, ?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 $source = null, ?bool $active_call = null, ?bool $compromised_device_integrity = null): Request
971    {
972        if (null !== $limit && $limit > 100) {
973            throw new \InvalidArgumentException('invalid value for "$limit" when calling FingerprintApi.searchEvents, must be smaller than or equal to 100.');
974        }
975        if (null !== $limit && $limit < 1) {
976            throw new \InvalidArgumentException('invalid value for "$limit" when calling FingerprintApi.searchEvents, must be bigger than or equal to 1.');
977        }
978        if (null !== $total_hits && $total_hits > 1000) {
979            throw new \InvalidArgumentException('invalid value for "$total_hits" when calling FingerprintApi.searchEvents, must be smaller than or equal to 1000.');
980        }
981        if (null !== $total_hits && $total_hits < 1) {
982            throw new \InvalidArgumentException('invalid value for "$total_hits" when calling FingerprintApi.searchEvents, must be bigger than or equal to 1.');
983        }
984        if (null !== $source && count($source) > 1) {
985            throw new \InvalidArgumentException('invalid value for "$source" when calling FingerprintApi.searchEvents, number of items must be less than or equal to 1.');
986        }
987
988        $resourcePath = '/events';
989        $headers = [
990            'Authorization' => 'Bearer '.$this->config->getApiKey(),
991        ];
992        $queryParams = ['ii' => $this->integration_info];
993        $headerParams = [];
994
995        // query params
996        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
997            $limit,
998            'limit',
999            'integer',
1000            'form',
1001            true,
1002            false
1003        ) ?? []);
1004        // query params
1005        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1006            $pagination_key,
1007            'pagination_key',
1008            'string',
1009            'form',
1010            true,
1011            false
1012        ) ?? []);
1013        // query params
1014        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1015            $visitor_id,
1016            'visitor_id',
1017            'string',
1018            'form',
1019            true,
1020            false
1021        ) ?? []);
1022        // query params
1023        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1024            $high_recall_id,
1025            'high_recall_id',
1026            'string',
1027            'form',
1028            true,
1029            false
1030        ) ?? []);
1031        // query params
1032        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1033            $bot,
1034            'bot',
1035            'SearchEventsBot',
1036            'form',
1037            true,
1038            false
1039        ) ?? []);
1040        // query params
1041        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1042            $bot_info,
1043            'bot_info',
1044            'SearchEventsBotInfo',
1045            'form',
1046            true,
1047            false
1048        ) ?? []);
1049        // query params
1050        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1051            $bot_info_category,
1052            'bot_info_category',
1053            'array',
1054            'form',
1055            true,
1056            false
1057        ) ?? []);
1058        // query params
1059        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1060            $bot_info_identity,
1061            'bot_info_identity',
1062            'array',
1063            'form',
1064            true,
1065            false
1066        ) ?? []);
1067        // query params
1068        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1069            $bot_info_confidence,
1070            'bot_info_confidence',
1071            'array',
1072            'form',
1073            true,
1074            false
1075        ) ?? []);
1076        // query params
1077        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1078            $bot_info_provider,
1079            'bot_info_provider',
1080            'array',
1081            'form',
1082            true,
1083            false
1084        ) ?? []);
1085        // query params
1086        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1087            $bot_info_name,
1088            'bot_info_name',
1089            'array',
1090            'form',
1091            true,
1092            false
1093        ) ?? []);
1094        // query params
1095        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1096            $ip_address,
1097            'ip_address',
1098            'string',
1099            'form',
1100            true,
1101            false
1102        ) ?? []);
1103        // query params
1104        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1105            $asn,
1106            'asn',
1107            'string',
1108            'form',
1109            true,
1110            false
1111        ) ?? []);
1112        // query params
1113        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1114            $linked_id,
1115            'linked_id',
1116            'string',
1117            'form',
1118            true,
1119            false
1120        ) ?? []);
1121        // query params
1122        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1123            $url,
1124            'url',
1125            'string',
1126            'form',
1127            true,
1128            false
1129        ) ?? []);
1130        // query params
1131        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1132            $bundle_id,
1133            'bundle_id',
1134            'string',
1135            'form',
1136            true,
1137            false
1138        ) ?? []);
1139        // query params
1140        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1141            $package_name,
1142            'package_name',
1143            'string',
1144            'form',
1145            true,
1146            false
1147        ) ?? []);
1148        // query params
1149        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1150            $origin,
1151            'origin',
1152            'string',
1153            'form',
1154            true,
1155            false
1156        ) ?? []);
1157        // query params
1158        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1159            $start,
1160            'start',
1161            '\DateTime|int',
1162            'form',
1163            true,
1164            false
1165        ) ?? []);
1166        // query params
1167        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1168            $end,
1169            'end',
1170            '\DateTime|int',
1171            'form',
1172            true,
1173            false
1174        ) ?? []);
1175        // query params
1176        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1177            $reverse,
1178            'reverse',
1179            'boolean',
1180            'form',
1181            true,
1182            false
1183        ) ?? []);
1184        // query params
1185        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1186            $suspect,
1187            'suspect',
1188            'boolean',
1189            'form',
1190            true,
1191            false
1192        ) ?? []);
1193        // query params
1194        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1195            $vpn,
1196            'vpn',
1197            'boolean',
1198            'form',
1199            true,
1200            false
1201        ) ?? []);
1202        // query params
1203        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1204            $virtual_machine,
1205            'virtual_machine',
1206            'boolean',
1207            'form',
1208            true,
1209            false
1210        ) ?? []);
1211        // query params
1212        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1213            $tampering,
1214            'tampering',
1215            'boolean',
1216            'form',
1217            true,
1218            false
1219        ) ?? []);
1220        // query params
1221        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1222            $anti_detect_browser,
1223            'anti_detect_browser',
1224            'boolean',
1225            'form',
1226            true,
1227            false
1228        ) ?? []);
1229        // query params
1230        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1231            $incognito,
1232            'incognito',
1233            'boolean',
1234            'form',
1235            true,
1236            false
1237        ) ?? []);
1238        // query params
1239        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1240            $privacy_settings,
1241            'privacy_settings',
1242            'boolean',
1243            'form',
1244            true,
1245            false
1246        ) ?? []);
1247        // query params
1248        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1249            $jailbroken,
1250            'jailbroken',
1251            'boolean',
1252            'form',
1253            true,
1254            false
1255        ) ?? []);
1256        // query params
1257        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1258            $frida,
1259            'frida',
1260            'boolean',
1261            'form',
1262            true,
1263            false
1264        ) ?? []);
1265        // query params
1266        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1267            $factory_reset,
1268            'factory_reset',
1269            'boolean',
1270            'form',
1271            true,
1272            false
1273        ) ?? []);
1274        // query params
1275        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1276            $cloned_app,
1277            'cloned_app',
1278            'boolean',
1279            'form',
1280            true,
1281            false
1282        ) ?? []);
1283        // query params
1284        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1285            $emulator,
1286            'emulator',
1287            'boolean',
1288            'form',
1289            true,
1290            false
1291        ) ?? []);
1292        // query params
1293        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1294            $root_apps,
1295            'root_apps',
1296            'boolean',
1297            'form',
1298            true,
1299            false
1300        ) ?? []);
1301        // query params
1302        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1303            $vpn_confidence,
1304            'vpn_confidence',
1305            'SearchEventsVpnConfidence',
1306            'form',
1307            true,
1308            false
1309        ) ?? []);
1310        // query params
1311        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1312            $min_suspect_score,
1313            'min_suspect_score',
1314            'number',
1315            'form',
1316            true,
1317            false
1318        ) ?? []);
1319        // query params
1320        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1321            $developer_tools,
1322            'developer_tools',
1323            'boolean',
1324            'form',
1325            true,
1326            false
1327        ) ?? []);
1328        // query params
1329        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1330            $location_spoofing,
1331            'location_spoofing',
1332            'boolean',
1333            'form',
1334            true,
1335            false
1336        ) ?? []);
1337        // query params
1338        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1339            $mitm_attack,
1340            'mitm_attack',
1341            'boolean',
1342            'form',
1343            true,
1344            false
1345        ) ?? []);
1346        // query params
1347        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1348            $rare_device,
1349            'rare_device',
1350            'boolean',
1351            'form',
1352            true,
1353            false
1354        ) ?? []);
1355        // query params
1356        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1357            $rare_device_percentile_bucket,
1358            'rare_device_percentile_bucket',
1359            'SearchEventsRareDevicePercentileBucket',
1360            'form',
1361            true,
1362            false
1363        ) ?? []);
1364        // query params
1365        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1366            $proxy,
1367            'proxy',
1368            'boolean',
1369            'form',
1370            true,
1371            false
1372        ) ?? []);
1373        // query params
1374        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1375            $sdk_version,
1376            'sdk_version',
1377            'string',
1378            'form',
1379            true,
1380            false
1381        ) ?? []);
1382        // query params
1383        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1384            $sdk_platform,
1385            'sdk_platform',
1386            'SearchEventsSdkPlatform',
1387            'form',
1388            true,
1389            false
1390        ) ?? []);
1391        // query params
1392        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1393            $environment,
1394            'environment',
1395            'array',
1396            'form',
1397            true,
1398            false
1399        ) ?? []);
1400        // query params
1401        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1402            $proximity_id,
1403            'proximity_id',
1404            'string',
1405            'form',
1406            true,
1407            false
1408        ) ?? []);
1409        // query params
1410        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1411            $total_hits,
1412            'total_hits',
1413            'integer',
1414            'form',
1415            true,
1416            false
1417        ) ?? []);
1418        // query params
1419        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1420            $tor_node,
1421            'tor_node',
1422            'boolean',
1423            'form',
1424            true,
1425            false
1426        ) ?? []);
1427        // query params
1428        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1429            $incremental_identification_status,
1430            'incremental_identification_status',
1431            'SearchEventsIncrementalIdentificationStatus',
1432            'form',
1433            true,
1434            false
1435        ) ?? []);
1436        // query params
1437        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1438            $simulator,
1439            'simulator',
1440            'boolean',
1441            'form',
1442            true,
1443            false
1444        ) ?? []);
1445        // query params
1446        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1447            $source,
1448            'source',
1449            'array',
1450            'form',
1451            true,
1452            false
1453        ) ?? []);
1454        // query params
1455        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1456            $active_call,
1457            'active_call',
1458            'boolean',
1459            'form',
1460            true,
1461            false
1462        ) ?? []);
1463        // query params
1464        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1465            $compromised_device_integrity,
1466            'compromised_device_integrity',
1467            'boolean',
1468            'form',
1469            true,
1470            false
1471        ) ?? []);
1472
1473        if ($this->config->getUserAgent()) {
1474            $headers['User-Agent'] = $this->config->getUserAgent();
1475        }
1476
1477        $headers = array_merge(
1478            $headerParams,
1479            $headers
1480        );
1481
1482        $query = ObjectSerializer::buildQuery($queryParams);
1483
1484        return new Request(
1485            'GET',
1486            $this->config->getHost().$resourcePath.($query ? "?$query" : ''),
1487            $headers,
1488        );
1489    }
1490
1491    /**
1492     * Operation updateEvent.
1493     *
1494     * Update an event
1495     *
1496     * @param string      $event_id     The unique event [identifier](https://docs.fingerprint.com/reference/js-agent-get-function#event_id). (required)
1497     * @param EventUpdate $event_update event_update (required)
1498     *
1499     * @noinspection GrazieInspection
1500     *
1501     * @throws ApiException                  on non-2xx response or if the response body is not in the expected format
1502     * @throws \InvalidArgumentException
1503     * @throws GuzzleException
1504     * @throws \DateMalformedStringException
1505     */
1506    public function updateEvent(string $event_id, EventUpdate $event_update): void
1507    {
1508        $this->updateEventWithHttpInfo($event_id, $event_update);
1509    }
1510
1511    /**
1512     * Operation updateEventWithHttpInfo.
1513     *
1514     * Update an event
1515     *
1516     * @param string      $event_id     The unique event [identifier](https://docs.fingerprint.com/reference/js-agent-get-function#event_id). (required)
1517     * @param EventUpdate $event_update (required)
1518     *
1519     * @noinspection GrazieInspection
1520     *
1521     * @return array{ null, ResponseInterface }
1522     *
1523     * @throws ApiException                  on non-2xx response or if the response body is not in the expected format
1524     * @throws \InvalidArgumentException
1525     * @throws GuzzleException
1526     * @throws \DateMalformedStringException
1527     */
1528    public function updateEventWithHttpInfo(string $event_id, EventUpdate $event_update): array
1529    {
1530        $request = $this->updateEventRequest($event_id, $event_update);
1531
1532        try {
1533            $options = $this->createHttpClientOption();
1534
1535            try {
1536                $response = $this->client->send($request, $options);
1537            } catch (RequestException $e) {
1538                throw new ApiException(
1539                    "[{$e->getCode()}] {$e->getMessage()}",
1540                    (int) $e->getCode(),
1541                    $e->getResponse(),
1542                    $e
1543                );
1544            } catch (ConnectException $e) {
1545                throw new ApiException(
1546                    "[{$e->getCode()}] {$e->getMessage()}",
1547                    (int) $e->getCode(),
1548                    null,
1549                    $e
1550                );
1551            }
1552
1553            $statusCode = $response->getStatusCode();
1554
1555            if ($statusCode < 200 || $statusCode > 299) {
1556                throw new ApiException(
1557                    sprintf(
1558                        '[%d] Error connecting to the API (%s)',
1559                        $statusCode,
1560                        $request->getUri()
1561                    ),
1562                    $statusCode,
1563                    $response
1564                );
1565            }
1566
1567            return [null, $response];
1568        } catch (ApiException $e) {
1569            $this->handleUpdateEventError($e);
1570        }
1571    }
1572
1573    /**
1574     * Operation updateEventAsync.
1575     *
1576     * Update an event
1577     *
1578     * @param string      $event_id     The unique event [identifier](https://docs.fingerprint.com/reference/js-agent-get-function#event_id). (required)
1579     * @param EventUpdate $event_update (required)
1580     *
1581     * @noinspection GrazieInspection
1582     *
1583     * @return PromiseInterface promise resolving to the deserialized response
1584     *
1585     * @throws \InvalidArgumentException
1586     */
1587    public function updateEventAsync(string $event_id, EventUpdate $event_update): PromiseInterface
1588    {
1589        return $this->updateEventAsyncWithHttpInfo($event_id, $event_update)
1590            ->then(
1591                function ($response) {
1592                    return $response[0];
1593                }
1594            );
1595    }
1596
1597    /**
1598     * Operation updateEventAsyncWithHttpInfo.
1599     *
1600     * Update an event
1601     *
1602     * @param string      $event_id     The unique event [identifier](https://docs.fingerprint.com/reference/js-agent-get-function#event_id). (required)
1603     * @param EventUpdate $event_update (required)
1604     *
1605     * @noinspection GrazieInspection
1606     *
1607     * @return PromiseInterface promise resolving to an array of deserialized data and the HTTP response
1608     *
1609     * @throws \InvalidArgumentException
1610     */
1611    public function updateEventAsyncWithHttpInfo(string $event_id, EventUpdate $event_update): PromiseInterface
1612    {
1613        $request = $this->updateEventRequest($event_id, $event_update);
1614
1615        return $this->client
1616            ->sendAsync($request, $this->createHttpClientOption())
1617            ->then(
1618                function ($response) {
1619                    return [null, $response];
1620                },
1621                function ($e) {
1622                    if ($e instanceof RequestException) {
1623                        $e = new ApiException(
1624                            "[{$e->getCode()}] {$e->getMessage()}",
1625                            (int) $e->getCode(),
1626                            $e->getResponse(),
1627                            $e
1628                        );
1629                    } elseif ($e instanceof ConnectException) {
1630                        $e = new ApiException(
1631                            "[{$e->getCode()}] {$e->getMessage()}",
1632                            (int) $e->getCode(),
1633                            null,
1634                            $e
1635                        );
1636                    } elseif (!$e instanceof ApiException) {
1637                        $e = new ApiException(
1638                            $e->getMessage(),
1639                            (int) $e->getCode(),
1640                            null,
1641                            $e
1642                        );
1643                    }
1644                    $this->handleUpdateEventError($e);
1645                }
1646            );
1647    }
1648
1649    /**
1650     * Create request for operation 'updateEvent'.
1651     *
1652     * @param string      $event_id     The unique event [identifier](https://docs.fingerprint.com/reference/js-agent-get-function#event_id). (required)
1653     * @param EventUpdate $event_update (required)
1654     *
1655     * @noinspection GrazieInspection
1656     *
1657     * @return Request the prepared HTTP request
1658     *
1659     * @throws \InvalidArgumentException
1660     */
1661    public function updateEventRequest(string $event_id, EventUpdate $event_update): Request
1662    {
1663        $resourcePath = '/events/{event_id}';
1664        $headers = [
1665            'Authorization' => 'Bearer '.$this->config->getApiKey(),
1666        ];
1667        $queryParams = ['ii' => $this->integration_info];
1668        $headerParams = [];
1669
1670        // path params
1671        $resourcePath = str_replace(
1672            '{event_id}',
1673            ObjectSerializer::toPathValue($event_id),
1674            $resourcePath
1675        );
1676
1677        $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($event_update));
1678
1679        if ($this->config->getUserAgent()) {
1680            $headers['User-Agent'] = $this->config->getUserAgent();
1681        }
1682
1683        $headers = array_merge(
1684            $headerParams,
1685            $headers
1686        );
1687
1688        $query = ObjectSerializer::buildQuery($queryParams);
1689
1690        return new Request(
1691            'PATCH',
1692            $this->config->getHost().$resourcePath.($query ? "?$query" : ''),
1693            $headers,
1694            $httpBody
1695        );
1696    }
1697
1698    /**
1699     * Create http client option.
1700     *
1701     * @return array HTTP client options
1702     *
1703     * @throws \RuntimeException on file opening failure
1704     */
1705    protected function createHttpClientOption(): array
1706    {
1707        // Path parameters are percent-encoded (see ObjectSerializer::toPathValue()),
1708        // but curl still decodes and collapses RFC 3986 dot-segments (e.g. a
1709        // literal '.' or '..' path parameter) before the request is sent unless
1710        // explicitly told not to. CURLOPT_PATH_AS_IS makes curl transmit the URL
1711        // exactly as built, so an event/visitor ID can never be misrouted to a
1712        // different endpoint via path normalization.
1713        $options = [
1714            'curl' => [
1715                \CURLOPT_PATH_AS_IS => true,
1716            ],
1717        ];
1718        if ($this->config->getDebug()) {
1719            $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a');
1720            if (!$options[RequestOptions::DEBUG]) {
1721                throw new \RuntimeException('Failed to open the debug file: '.$this->config->getDebugFile());
1722            }
1723        }
1724
1725        if ($this->config->getCertFile()) {
1726            $options[RequestOptions::CERT] = $this->config->getCertFile();
1727        }
1728
1729        if ($this->config->getKeyFile()) {
1730            $options[RequestOptions::SSL_KEY] = $this->config->getKeyFile();
1731        }
1732
1733        return $options;
1734    }
1735
1736    /**
1737     * Handle error responses for operation 'deleteVisitorData'.
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 handleDeleteVisitorDataError(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 400:
1759                    $data = ObjectSerializer::deserialize(
1760                        $content,
1761                        '\Fingerprint\ServerSdk\Model\ErrorResponse'
1762                    );
1763                    $e->setErrorDetails($data);
1764
1765                    throw $e;
1766
1767                case 403:
1768                    $data = ObjectSerializer::deserialize(
1769                        $content,
1770                        '\Fingerprint\ServerSdk\Model\ErrorResponse'
1771                    );
1772                    $e->setErrorDetails($data);
1773
1774                    throw $e;
1775
1776                case 404:
1777                    $data = ObjectSerializer::deserialize(
1778                        $content,
1779                        '\Fingerprint\ServerSdk\Model\ErrorResponse'
1780                    );
1781                    $e->setErrorDetails($data);
1782
1783                    throw $e;
1784
1785                case 429:
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 'getEvent'.
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 handleGetEventError(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 200:
1822                    $data = ObjectSerializer::deserialize(
1823                        $content,
1824                        '\Fingerprint\ServerSdk\Model\Event'
1825                    );
1826                    $e->setErrorDetails($data);
1827
1828                    throw $e;
1829
1830                case 400:
1831                    $data = ObjectSerializer::deserialize(
1832                        $content,
1833                        '\Fingerprint\ServerSdk\Model\ErrorResponse'
1834                    );
1835                    $e->setErrorDetails($data);
1836
1837                    throw $e;
1838
1839                case 403:
1840                    $data = ObjectSerializer::deserialize(
1841                        $content,
1842                        '\Fingerprint\ServerSdk\Model\ErrorResponse'
1843                    );
1844                    $e->setErrorDetails($data);
1845
1846                    throw $e;
1847
1848                case 404:
1849                    $data = ObjectSerializer::deserialize(
1850                        $content,
1851                        '\Fingerprint\ServerSdk\Model\ErrorResponse'
1852                    );
1853                    $e->setErrorDetails($data);
1854
1855                    throw $e;
1856
1857                case 429:
1858                    $data = ObjectSerializer::deserialize(
1859                        $content,
1860                        '\Fingerprint\ServerSdk\Model\ErrorResponse'
1861                    );
1862                    $e->setErrorDetails($data);
1863
1864                    throw $e;
1865
1866                case 500:
1867                    $data = ObjectSerializer::deserialize(
1868                        $content,
1869                        '\Fingerprint\ServerSdk\Model\ErrorResponse'
1870                    );
1871                    $e->setErrorDetails($data);
1872
1873                    throw $e;
1874
1875                case 503:
1876                    $data = ObjectSerializer::deserialize(
1877                        $content,
1878                        '\Fingerprint\ServerSdk\Model\ErrorResponse'
1879                    );
1880                    $e->setErrorDetails($data);
1881
1882                    throw $e;
1883
1884                case 504:
1885                    $data = ObjectSerializer::deserialize(
1886                        $content,
1887                        '\Fingerprint\ServerSdk\Model\ErrorResponse'
1888                    );
1889                    $e->setErrorDetails($data);
1890
1891                    throw $e;
1892            }
1893        }
1894
1895        throw $e;
1896    }
1897
1898    /**
1899     * Handle error responses for operation 'searchEvents'.
1900     *
1901     * @param ApiException $e the API exception to handle
1902     *
1903     * @throws ApiException                  always rethrown after setting error details
1904     * @throws \DateMalformedStringException
1905     *
1906     * @noinspection PhpDuplicateSwitchCaseBodyInspection
1907     * @noinspection RedundantSuppression
1908     */
1909    private function handleSearchEventsError(ApiException $e): never
1910    {
1911        $response = $e->getResponseObject();
1912
1913        if (null !== $response) {
1914            $errorCode = $e->getCode();
1915
1916            $content = (string) $response->getBody();
1917            $response->getBody()->rewind();
1918
1919            switch ($errorCode) {
1920                case 200:
1921                    $data = ObjectSerializer::deserialize(
1922                        $content,
1923                        '\Fingerprint\ServerSdk\Model\EventSearch'
1924                    );
1925                    $e->setErrorDetails($data);
1926
1927                    throw $e;
1928
1929                case 400:
1930                    $data = ObjectSerializer::deserialize(
1931                        $content,
1932                        '\Fingerprint\ServerSdk\Model\ErrorResponse'
1933                    );
1934                    $e->setErrorDetails($data);
1935
1936                    throw $e;
1937
1938                case 403:
1939                    $data = ObjectSerializer::deserialize(
1940                        $content,
1941                        '\Fingerprint\ServerSdk\Model\ErrorResponse'
1942                    );
1943                    $e->setErrorDetails($data);
1944
1945                    throw $e;
1946
1947                case 404:
1948                    $data = ObjectSerializer::deserialize(
1949                        $content,
1950                        '\Fingerprint\ServerSdk\Model\ErrorResponse'
1951                    );
1952                    $e->setErrorDetails($data);
1953
1954                    throw $e;
1955
1956                case 429:
1957                    $data = ObjectSerializer::deserialize(
1958                        $content,
1959                        '\Fingerprint\ServerSdk\Model\ErrorResponse'
1960                    );
1961                    $e->setErrorDetails($data);
1962
1963                    throw $e;
1964
1965                case 500:
1966                    $data = ObjectSerializer::deserialize(
1967                        $content,
1968                        '\Fingerprint\ServerSdk\Model\ErrorResponse'
1969                    );
1970                    $e->setErrorDetails($data);
1971
1972                    throw $e;
1973
1974                case 503:
1975                    $data = ObjectSerializer::deserialize(
1976                        $content,
1977                        '\Fingerprint\ServerSdk\Model\ErrorResponse'
1978                    );
1979                    $e->setErrorDetails($data);
1980
1981                    throw $e;
1982
1983                case 504:
1984                    $data = ObjectSerializer::deserialize(
1985                        $content,
1986                        '\Fingerprint\ServerSdk\Model\ErrorResponse'
1987                    );
1988                    $e->setErrorDetails($data);
1989
1990                    throw $e;
1991            }
1992        }
1993
1994        throw $e;
1995    }
1996
1997    /**
1998     * Handle error responses for operation 'updateEvent'.
1999     *
2000     * @param ApiException $e the API exception to handle
2001     *
2002     * @throws ApiException                  always rethrown after setting error details
2003     * @throws \DateMalformedStringException
2004     *
2005     * @noinspection PhpDuplicateSwitchCaseBodyInspection
2006     * @noinspection RedundantSuppression
2007     */
2008    private function handleUpdateEventError(ApiException $e): never
2009    {
2010        $response = $e->getResponseObject();
2011
2012        if (null !== $response) {
2013            $errorCode = $e->getCode();
2014
2015            $content = (string) $response->getBody();
2016            $response->getBody()->rewind();
2017
2018            switch ($errorCode) {
2019                case 400:
2020                    $data = ObjectSerializer::deserialize(
2021                        $content,
2022                        '\Fingerprint\ServerSdk\Model\ErrorResponse'
2023                    );
2024                    $e->setErrorDetails($data);
2025
2026                    throw $e;
2027
2028                case 403:
2029                    $data = ObjectSerializer::deserialize(
2030                        $content,
2031                        '\Fingerprint\ServerSdk\Model\ErrorResponse'
2032                    );
2033                    $e->setErrorDetails($data);
2034
2035                    throw $e;
2036
2037                case 404:
2038                    $data = ObjectSerializer::deserialize(
2039                        $content,
2040                        '\Fingerprint\ServerSdk\Model\ErrorResponse'
2041                    );
2042                    $e->setErrorDetails($data);
2043
2044                    throw $e;
2045
2046                case 409:
2047                    $data = ObjectSerializer::deserialize(
2048                        $content,
2049                        '\Fingerprint\ServerSdk\Model\ErrorResponse'
2050                    );
2051                    $e->setErrorDetails($data);
2052
2053                    throw $e;
2054            }
2055        }
2056
2057        throw $e;
2058    }
2059
2060    /**
2061     * Deserialize the response body into the given data type.
2062     *
2063     * @param string            $dataType the expected data type for deserialization
2064     * @param RequestInterface  $request  the original HTTP request
2065     * @param ResponseInterface $response the HTTP response to deserialize
2066     *
2067     * @return array{mixed, ResponseInterface} deserialized data and the HTTP response
2068     *
2069     * @throws ApiException
2070     * @throws \DateMalformedStringException
2071     */
2072    private function handleResponseWithDataType(
2073        string $dataType,
2074        RequestInterface $request,
2075        ResponseInterface $response
2076    ): array {
2077        $content = (string) $response->getBody();
2078        $response->getBody()->rewind();
2079        if ('string' !== $dataType) {
2080            try {
2081                $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
2082            } catch (\JsonException $exception) {
2083                throw new ApiException(
2084                    sprintf(
2085                        'Error JSON decoding server response (%s)',
2086                        $request->getUri()
2087                    ),
2088                    $exception->getCode(),
2089                    $response,
2090                    $exception
2091                );
2092            }
2093        }
2094
2095        return [
2096            ObjectSerializer::deserialize($content, $dataType),
2097            $response,
2098        ];
2099    }
2100}