Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
95.56% covered (success)
95.56%
990 / 1036
78.57% covered (warning)
78.57%
22 / 28
CRAP
0.00% covered (danger)
0.00%
0 / 1
FingerprintApi
95.56% covered (success)
95.56%
990 / 1036
78.57% covered (warning)
78.57%
22 / 28
111
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%
444 / 444
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
89.09% covered (warning)
89.09%
49 / 55
0.00% covered (danger)
0.00%
0 / 1
9.11
 handleSearchEventsError
78.18% covered (warning)
78.18%
43 / 55
0.00% covered (danger)
0.00%
0 / 1
9.84
 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.7.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 iOS Simulator Detection result.  > Note: When using this parameter, only events with the `simulator` property set to `true` or `false` are returned. Events without a `simulator` Smart Signal result are left out of the response. (optional)
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     *
591     * @noinspection GrazieInspection
592     *
593     * @throws ApiException                  on non-2xx response or if the response body is not in the expected format
594     * @throws \InvalidArgumentException
595     * @throws GuzzleException
596     * @throws \DateMalformedStringException
597     */
598    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): EventSearch
599    {
600        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);
601
602        return $response;
603    }
604
605    /**
606     * Operation searchEventsWithHttpInfo.
607     *
608     * Search events
609     *
610     * @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)
611     * @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)
612     * @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)
613     * @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)
614     * @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)
615     * @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)
616     * @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)
617     * @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)
618     * @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)
619     * @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)
620     * @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)
621     * @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)
622     * @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)
623     * @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)
624     * @param string|null                                      $url                               Filter events by the URL (`url` property) associated with the event. (optional)
625     * @param string|null                                      $bundle_id                         Filter events by the Bundle ID (iOS) associated with the event. (optional)
626     * @param string|null                                      $package_name                      Filter events by the Package Name (Android) associated with the event. (optional)
627     * @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)
628     * @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)
629     * @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)
630     * @param bool|null                                        $reverse                           When `true`, sort events oldest first (ascending timestamp order). Defaults to `false` (newest first, descending timestamp order). (optional)
631     * @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)
632     * @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)
633     * @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)
634     * @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)
635     * @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)
636     * @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)
637     * @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)
638     * @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)
639     * @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)
640     * @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)
641     * @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)
642     * @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)
643     * @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)
644     * @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)
645     * @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)
646     * @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)
647     * @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)
648     * @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)
649     * @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)
650     * @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)
651     * @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)
652     * @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)
653     * @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)
654     * @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)
655     * @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)
656     * @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)
657     * @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)
658     * @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)
659     * @param bool|null                                        $simulator                         Filter events by iOS Simulator Detection result.  > Note: When using this parameter, only events with the `simulator` property set to `true` or `false` are returned. Events without a `simulator` Smart Signal result are left out of the response. (optional)
660     * @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)
661     * @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)
662     *
663     * @noinspection GrazieInspection
664     *
665     * @return array{ EventSearch|null, ResponseInterface }
666     *
667     * @throws ApiException                  on non-2xx response or if the response body is not in the expected format
668     * @throws \InvalidArgumentException
669     * @throws GuzzleException
670     * @throws \DateMalformedStringException
671     */
672    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): array
673    {
674        $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);
675
676        try {
677            $options = $this->createHttpClientOption();
678
679            try {
680                $response = $this->client->send($request, $options);
681            } catch (RequestException $e) {
682                throw new ApiException(
683                    "[{$e->getCode()}] {$e->getMessage()}",
684                    (int) $e->getCode(),
685                    $e->getResponse(),
686                    $e
687                );
688            } catch (ConnectException $e) {
689                throw new ApiException(
690                    "[{$e->getCode()}] {$e->getMessage()}",
691                    (int) $e->getCode(),
692                    null,
693                    $e
694                );
695            }
696
697            $statusCode = $response->getStatusCode();
698
699            if ($statusCode < 200 || $statusCode > 299) {
700                throw new ApiException(
701                    sprintf(
702                        '[%d] Error connecting to the API (%s)',
703                        $statusCode,
704                        $request->getUri()
705                    ),
706                    $statusCode,
707                    $response
708                );
709            }
710
711            return $this->handleResponseWithDataType(
712                '\Fingerprint\ServerSdk\Model\EventSearch',
713                $request,
714                $response
715            );
716        } catch (ApiException $e) {
717            $this->handleSearchEventsError($e);
718        }
719    }
720
721    /**
722     * Operation searchEventsAsync.
723     *
724     * Search events
725     *
726     * @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)
727     * @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)
728     * @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)
729     * @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)
730     * @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)
731     * @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)
732     * @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)
733     * @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)
734     * @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)
735     * @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)
736     * @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)
737     * @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)
738     * @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)
739     * @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)
740     * @param string|null                                      $url                               Filter events by the URL (`url` property) associated with the event. (optional)
741     * @param string|null                                      $bundle_id                         Filter events by the Bundle ID (iOS) associated with the event. (optional)
742     * @param string|null                                      $package_name                      Filter events by the Package Name (Android) associated with the event. (optional)
743     * @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)
744     * @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)
745     * @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)
746     * @param bool|null                                        $reverse                           When `true`, sort events oldest first (ascending timestamp order). Defaults to `false` (newest first, descending timestamp order). (optional)
747     * @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)
748     * @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)
749     * @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)
750     * @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)
751     * @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)
752     * @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)
753     * @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)
754     * @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)
755     * @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)
756     * @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)
757     * @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)
758     * @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)
759     * @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)
760     * @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)
761     * @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)
762     * @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)
763     * @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)
764     * @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)
765     * @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)
766     * @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)
767     * @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)
768     * @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)
769     * @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)
770     * @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)
771     * @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)
772     * @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)
773     * @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)
774     * @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)
775     * @param bool|null                                        $simulator                         Filter events by iOS Simulator Detection result.  > Note: When using this parameter, only events with the `simulator` property set to `true` or `false` are returned. Events without a `simulator` Smart Signal result are left out of the response. (optional)
776     * @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)
777     * @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)
778     *
779     * @noinspection GrazieInspection
780     *
781     * @return PromiseInterface promise resolving to the deserialized response
782     *
783     * @throws \InvalidArgumentException
784     */
785    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): PromiseInterface
786    {
787        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)
788            ->then(
789                function ($response) {
790                    return $response[0];
791                }
792            );
793    }
794
795    /**
796     * Operation searchEventsAsyncWithHttpInfo.
797     *
798     * Search events
799     *
800     * @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)
801     * @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)
802     * @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)
803     * @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)
804     * @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)
805     * @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)
806     * @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)
807     * @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)
808     * @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)
809     * @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)
810     * @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)
811     * @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)
812     * @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)
813     * @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)
814     * @param string|null                                      $url                               Filter events by the URL (`url` property) associated with the event. (optional)
815     * @param string|null                                      $bundle_id                         Filter events by the Bundle ID (iOS) associated with the event. (optional)
816     * @param string|null                                      $package_name                      Filter events by the Package Name (Android) associated with the event. (optional)
817     * @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)
818     * @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)
819     * @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)
820     * @param bool|null                                        $reverse                           When `true`, sort events oldest first (ascending timestamp order). Defaults to `false` (newest first, descending timestamp order). (optional)
821     * @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)
822     * @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)
823     * @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)
824     * @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)
825     * @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)
826     * @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)
827     * @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)
828     * @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)
829     * @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)
830     * @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)
831     * @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)
832     * @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)
833     * @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)
834     * @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)
835     * @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)
836     * @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)
837     * @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)
838     * @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)
839     * @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)
840     * @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)
841     * @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)
842     * @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)
843     * @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)
844     * @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)
845     * @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)
846     * @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)
847     * @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)
848     * @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)
849     * @param bool|null                                        $simulator                         Filter events by iOS Simulator Detection result.  > Note: When using this parameter, only events with the `simulator` property set to `true` or `false` are returned. Events without a `simulator` Smart Signal result are left out of the response. (optional)
850     * @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)
851     * @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)
852     *
853     * @noinspection GrazieInspection
854     *
855     * @return PromiseInterface promise resolving to an array of deserialized data and the HTTP response
856     *
857     * @throws \InvalidArgumentException
858     */
859    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): PromiseInterface
860    {
861        $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);
862
863        return $this->client
864            ->sendAsync($request, $this->createHttpClientOption())
865            ->then(
866                function ($response) {
867                    $content = (string) $response->getBody();
868                    $response->getBody()->rewind();
869
870                    return [
871                        ObjectSerializer::deserialize($content, '\Fingerprint\ServerSdk\Model\EventSearch'),
872                        $response,
873                    ];
874                },
875                function ($e) {
876                    if ($e instanceof RequestException) {
877                        $e = new ApiException(
878                            "[{$e->getCode()}] {$e->getMessage()}",
879                            (int) $e->getCode(),
880                            $e->getResponse(),
881                            $e
882                        );
883                    } elseif ($e instanceof ConnectException) {
884                        $e = new ApiException(
885                            "[{$e->getCode()}] {$e->getMessage()}",
886                            (int) $e->getCode(),
887                            null,
888                            $e
889                        );
890                    } elseif (!$e instanceof ApiException) {
891                        $e = new ApiException(
892                            $e->getMessage(),
893                            (int) $e->getCode(),
894                            null,
895                            $e
896                        );
897                    }
898                    $this->handleSearchEventsError($e);
899                }
900            );
901    }
902
903    /**
904     * Create request for operation 'searchEvents'.
905     *
906     * @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)
907     * @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)
908     * @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)
909     * @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)
910     * @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)
911     * @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)
912     * @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)
913     * @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)
914     * @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)
915     * @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)
916     * @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)
917     * @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)
918     * @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)
919     * @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)
920     * @param string|null                                      $url                               Filter events by the URL (`url` property) associated with the event. (optional)
921     * @param string|null                                      $bundle_id                         Filter events by the Bundle ID (iOS) associated with the event. (optional)
922     * @param string|null                                      $package_name                      Filter events by the Package Name (Android) associated with the event. (optional)
923     * @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)
924     * @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)
925     * @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)
926     * @param bool|null                                        $reverse                           When `true`, sort events oldest first (ascending timestamp order). Defaults to `false` (newest first, descending timestamp order). (optional)
927     * @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)
928     * @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)
929     * @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)
930     * @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)
931     * @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)
932     * @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)
933     * @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)
934     * @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)
935     * @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)
936     * @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)
937     * @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)
938     * @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)
939     * @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)
940     * @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)
941     * @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)
942     * @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)
943     * @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)
944     * @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)
945     * @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)
946     * @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)
947     * @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)
948     * @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)
949     * @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)
950     * @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)
951     * @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)
952     * @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)
953     * @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)
954     * @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)
955     * @param bool|null                                        $simulator                         Filter events by iOS Simulator Detection result.  > Note: When using this parameter, only events with the `simulator` property set to `true` or `false` are returned. Events without a `simulator` Smart Signal result are left out of the response. (optional)
956     * @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)
957     * @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)
958     *
959     * @noinspection GrazieInspection
960     *
961     * @return Request the prepared HTTP request
962     *
963     * @throws \InvalidArgumentException
964     */
965    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): Request
966    {
967        if (null !== $limit && $limit > 100) {
968            throw new \InvalidArgumentException('invalid value for "$limit" when calling FingerprintApi.searchEvents, must be smaller than or equal to 100.');
969        }
970        if (null !== $limit && $limit < 1) {
971            throw new \InvalidArgumentException('invalid value for "$limit" when calling FingerprintApi.searchEvents, must be bigger than or equal to 1.');
972        }
973        if (null !== $total_hits && $total_hits > 1000) {
974            throw new \InvalidArgumentException('invalid value for "$total_hits" when calling FingerprintApi.searchEvents, must be smaller than or equal to 1000.');
975        }
976        if (null !== $total_hits && $total_hits < 1) {
977            throw new \InvalidArgumentException('invalid value for "$total_hits" when calling FingerprintApi.searchEvents, must be bigger than or equal to 1.');
978        }
979        if (null !== $source && count($source) > 1) {
980            throw new \InvalidArgumentException('invalid value for "$source" when calling FingerprintApi.searchEvents, number of items must be less than or equal to 1.');
981        }
982
983        $resourcePath = '/events';
984        $headers = [
985            'Authorization' => 'Bearer '.$this->config->getApiKey(),
986        ];
987        $queryParams = ['ii' => $this->integration_info];
988        $headerParams = [];
989
990        // query params
991        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
992            $limit,
993            'limit',
994            'integer',
995            'form',
996            true,
997            false
998        ) ?? []);
999        // query params
1000        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1001            $pagination_key,
1002            'pagination_key',
1003            'string',
1004            'form',
1005            true,
1006            false
1007        ) ?? []);
1008        // query params
1009        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1010            $visitor_id,
1011            'visitor_id',
1012            'string',
1013            'form',
1014            true,
1015            false
1016        ) ?? []);
1017        // query params
1018        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1019            $high_recall_id,
1020            'high_recall_id',
1021            'string',
1022            'form',
1023            true,
1024            false
1025        ) ?? []);
1026        // query params
1027        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1028            $bot,
1029            'bot',
1030            'SearchEventsBot',
1031            'form',
1032            true,
1033            false
1034        ) ?? []);
1035        // query params
1036        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1037            $bot_info,
1038            'bot_info',
1039            'SearchEventsBotInfo',
1040            'form',
1041            true,
1042            false
1043        ) ?? []);
1044        // query params
1045        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1046            $bot_info_category,
1047            'bot_info_category',
1048            'array',
1049            'form',
1050            true,
1051            false
1052        ) ?? []);
1053        // query params
1054        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1055            $bot_info_identity,
1056            'bot_info_identity',
1057            'array',
1058            'form',
1059            true,
1060            false
1061        ) ?? []);
1062        // query params
1063        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1064            $bot_info_confidence,
1065            'bot_info_confidence',
1066            'array',
1067            'form',
1068            true,
1069            false
1070        ) ?? []);
1071        // query params
1072        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1073            $bot_info_provider,
1074            'bot_info_provider',
1075            'array',
1076            'form',
1077            true,
1078            false
1079        ) ?? []);
1080        // query params
1081        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1082            $bot_info_name,
1083            'bot_info_name',
1084            'array',
1085            'form',
1086            true,
1087            false
1088        ) ?? []);
1089        // query params
1090        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1091            $ip_address,
1092            'ip_address',
1093            'string',
1094            'form',
1095            true,
1096            false
1097        ) ?? []);
1098        // query params
1099        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1100            $asn,
1101            'asn',
1102            'string',
1103            'form',
1104            true,
1105            false
1106        ) ?? []);
1107        // query params
1108        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1109            $linked_id,
1110            'linked_id',
1111            'string',
1112            'form',
1113            true,
1114            false
1115        ) ?? []);
1116        // query params
1117        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1118            $url,
1119            'url',
1120            'string',
1121            'form',
1122            true,
1123            false
1124        ) ?? []);
1125        // query params
1126        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1127            $bundle_id,
1128            'bundle_id',
1129            'string',
1130            'form',
1131            true,
1132            false
1133        ) ?? []);
1134        // query params
1135        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1136            $package_name,
1137            'package_name',
1138            'string',
1139            'form',
1140            true,
1141            false
1142        ) ?? []);
1143        // query params
1144        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1145            $origin,
1146            'origin',
1147            'string',
1148            'form',
1149            true,
1150            false
1151        ) ?? []);
1152        // query params
1153        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1154            $start,
1155            'start',
1156            '\DateTime|int',
1157            'form',
1158            true,
1159            false
1160        ) ?? []);
1161        // query params
1162        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1163            $end,
1164            'end',
1165            '\DateTime|int',
1166            'form',
1167            true,
1168            false
1169        ) ?? []);
1170        // query params
1171        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1172            $reverse,
1173            'reverse',
1174            'boolean',
1175            'form',
1176            true,
1177            false
1178        ) ?? []);
1179        // query params
1180        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1181            $suspect,
1182            'suspect',
1183            'boolean',
1184            'form',
1185            true,
1186            false
1187        ) ?? []);
1188        // query params
1189        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1190            $vpn,
1191            'vpn',
1192            'boolean',
1193            'form',
1194            true,
1195            false
1196        ) ?? []);
1197        // query params
1198        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1199            $virtual_machine,
1200            'virtual_machine',
1201            'boolean',
1202            'form',
1203            true,
1204            false
1205        ) ?? []);
1206        // query params
1207        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1208            $tampering,
1209            'tampering',
1210            'boolean',
1211            'form',
1212            true,
1213            false
1214        ) ?? []);
1215        // query params
1216        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1217            $anti_detect_browser,
1218            'anti_detect_browser',
1219            'boolean',
1220            'form',
1221            true,
1222            false
1223        ) ?? []);
1224        // query params
1225        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1226            $incognito,
1227            'incognito',
1228            'boolean',
1229            'form',
1230            true,
1231            false
1232        ) ?? []);
1233        // query params
1234        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1235            $privacy_settings,
1236            'privacy_settings',
1237            'boolean',
1238            'form',
1239            true,
1240            false
1241        ) ?? []);
1242        // query params
1243        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1244            $jailbroken,
1245            'jailbroken',
1246            'boolean',
1247            'form',
1248            true,
1249            false
1250        ) ?? []);
1251        // query params
1252        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1253            $frida,
1254            'frida',
1255            'boolean',
1256            'form',
1257            true,
1258            false
1259        ) ?? []);
1260        // query params
1261        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1262            $factory_reset,
1263            'factory_reset',
1264            'boolean',
1265            'form',
1266            true,
1267            false
1268        ) ?? []);
1269        // query params
1270        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1271            $cloned_app,
1272            'cloned_app',
1273            'boolean',
1274            'form',
1275            true,
1276            false
1277        ) ?? []);
1278        // query params
1279        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1280            $emulator,
1281            'emulator',
1282            'boolean',
1283            'form',
1284            true,
1285            false
1286        ) ?? []);
1287        // query params
1288        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1289            $root_apps,
1290            'root_apps',
1291            'boolean',
1292            'form',
1293            true,
1294            false
1295        ) ?? []);
1296        // query params
1297        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1298            $vpn_confidence,
1299            'vpn_confidence',
1300            'SearchEventsVpnConfidence',
1301            'form',
1302            true,
1303            false
1304        ) ?? []);
1305        // query params
1306        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1307            $min_suspect_score,
1308            'min_suspect_score',
1309            'number',
1310            'form',
1311            true,
1312            false
1313        ) ?? []);
1314        // query params
1315        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1316            $developer_tools,
1317            'developer_tools',
1318            'boolean',
1319            'form',
1320            true,
1321            false
1322        ) ?? []);
1323        // query params
1324        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1325            $location_spoofing,
1326            'location_spoofing',
1327            'boolean',
1328            'form',
1329            true,
1330            false
1331        ) ?? []);
1332        // query params
1333        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1334            $mitm_attack,
1335            'mitm_attack',
1336            'boolean',
1337            'form',
1338            true,
1339            false
1340        ) ?? []);
1341        // query params
1342        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1343            $rare_device,
1344            'rare_device',
1345            'boolean',
1346            'form',
1347            true,
1348            false
1349        ) ?? []);
1350        // query params
1351        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1352            $rare_device_percentile_bucket,
1353            'rare_device_percentile_bucket',
1354            'SearchEventsRareDevicePercentileBucket',
1355            'form',
1356            true,
1357            false
1358        ) ?? []);
1359        // query params
1360        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1361            $proxy,
1362            'proxy',
1363            'boolean',
1364            'form',
1365            true,
1366            false
1367        ) ?? []);
1368        // query params
1369        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1370            $sdk_version,
1371            'sdk_version',
1372            'string',
1373            'form',
1374            true,
1375            false
1376        ) ?? []);
1377        // query params
1378        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1379            $sdk_platform,
1380            'sdk_platform',
1381            'SearchEventsSdkPlatform',
1382            'form',
1383            true,
1384            false
1385        ) ?? []);
1386        // query params
1387        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1388            $environment,
1389            'environment',
1390            'array',
1391            'form',
1392            true,
1393            false
1394        ) ?? []);
1395        // query params
1396        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1397            $proximity_id,
1398            'proximity_id',
1399            'string',
1400            'form',
1401            true,
1402            false
1403        ) ?? []);
1404        // query params
1405        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1406            $total_hits,
1407            'total_hits',
1408            'integer',
1409            'form',
1410            true,
1411            false
1412        ) ?? []);
1413        // query params
1414        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1415            $tor_node,
1416            'tor_node',
1417            'boolean',
1418            'form',
1419            true,
1420            false
1421        ) ?? []);
1422        // query params
1423        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1424            $incremental_identification_status,
1425            'incremental_identification_status',
1426            'SearchEventsIncrementalIdentificationStatus',
1427            'form',
1428            true,
1429            false
1430        ) ?? []);
1431        // query params
1432        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1433            $simulator,
1434            'simulator',
1435            'boolean',
1436            'form',
1437            true,
1438            false
1439        ) ?? []);
1440        // query params
1441        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1442            $source,
1443            'source',
1444            'array',
1445            'form',
1446            true,
1447            false
1448        ) ?? []);
1449        // query params
1450        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
1451            $active_call,
1452            'active_call',
1453            'boolean',
1454            'form',
1455            true,
1456            false
1457        ) ?? []);
1458
1459        if ($this->config->getUserAgent()) {
1460            $headers['User-Agent'] = $this->config->getUserAgent();
1461        }
1462
1463        $headers = array_merge(
1464            $headerParams,
1465            $headers
1466        );
1467
1468        $query = ObjectSerializer::buildQuery($queryParams);
1469
1470        return new Request(
1471            'GET',
1472            $this->config->getHost().$resourcePath.($query ? "?$query" : ''),
1473            $headers,
1474        );
1475    }
1476
1477    /**
1478     * Operation updateEvent.
1479     *
1480     * Update an event
1481     *
1482     * @param string      $event_id     The unique event [identifier](https://docs.fingerprint.com/reference/js-agent-get-function#event_id). (required)
1483     * @param EventUpdate $event_update event_update (required)
1484     *
1485     * @noinspection GrazieInspection
1486     *
1487     * @throws ApiException                  on non-2xx response or if the response body is not in the expected format
1488     * @throws \InvalidArgumentException
1489     * @throws GuzzleException
1490     * @throws \DateMalformedStringException
1491     */
1492    public function updateEvent(string $event_id, EventUpdate $event_update): void
1493    {
1494        $this->updateEventWithHttpInfo($event_id, $event_update);
1495    }
1496
1497    /**
1498     * Operation updateEventWithHttpInfo.
1499     *
1500     * Update an event
1501     *
1502     * @param string      $event_id     The unique event [identifier](https://docs.fingerprint.com/reference/js-agent-get-function#event_id). (required)
1503     * @param EventUpdate $event_update (required)
1504     *
1505     * @noinspection GrazieInspection
1506     *
1507     * @return array{ null, ResponseInterface }
1508     *
1509     * @throws ApiException                  on non-2xx response or if the response body is not in the expected format
1510     * @throws \InvalidArgumentException
1511     * @throws GuzzleException
1512     * @throws \DateMalformedStringException
1513     */
1514    public function updateEventWithHttpInfo(string $event_id, EventUpdate $event_update): array
1515    {
1516        $request = $this->updateEventRequest($event_id, $event_update);
1517
1518        try {
1519            $options = $this->createHttpClientOption();
1520
1521            try {
1522                $response = $this->client->send($request, $options);
1523            } catch (RequestException $e) {
1524                throw new ApiException(
1525                    "[{$e->getCode()}] {$e->getMessage()}",
1526                    (int) $e->getCode(),
1527                    $e->getResponse(),
1528                    $e
1529                );
1530            } catch (ConnectException $e) {
1531                throw new ApiException(
1532                    "[{$e->getCode()}] {$e->getMessage()}",
1533                    (int) $e->getCode(),
1534                    null,
1535                    $e
1536                );
1537            }
1538
1539            $statusCode = $response->getStatusCode();
1540
1541            if ($statusCode < 200 || $statusCode > 299) {
1542                throw new ApiException(
1543                    sprintf(
1544                        '[%d] Error connecting to the API (%s)',
1545                        $statusCode,
1546                        $request->getUri()
1547                    ),
1548                    $statusCode,
1549                    $response
1550                );
1551            }
1552
1553            return [null, $response];
1554        } catch (ApiException $e) {
1555            $this->handleUpdateEventError($e);
1556        }
1557    }
1558
1559    /**
1560     * Operation updateEventAsync.
1561     *
1562     * Update an event
1563     *
1564     * @param string      $event_id     The unique event [identifier](https://docs.fingerprint.com/reference/js-agent-get-function#event_id). (required)
1565     * @param EventUpdate $event_update (required)
1566     *
1567     * @noinspection GrazieInspection
1568     *
1569     * @return PromiseInterface promise resolving to the deserialized response
1570     *
1571     * @throws \InvalidArgumentException
1572     */
1573    public function updateEventAsync(string $event_id, EventUpdate $event_update): PromiseInterface
1574    {
1575        return $this->updateEventAsyncWithHttpInfo($event_id, $event_update)
1576            ->then(
1577                function ($response) {
1578                    return $response[0];
1579                }
1580            );
1581    }
1582
1583    /**
1584     * Operation updateEventAsyncWithHttpInfo.
1585     *
1586     * Update an event
1587     *
1588     * @param string      $event_id     The unique event [identifier](https://docs.fingerprint.com/reference/js-agent-get-function#event_id). (required)
1589     * @param EventUpdate $event_update (required)
1590     *
1591     * @noinspection GrazieInspection
1592     *
1593     * @return PromiseInterface promise resolving to an array of deserialized data and the HTTP response
1594     *
1595     * @throws \InvalidArgumentException
1596     */
1597    public function updateEventAsyncWithHttpInfo(string $event_id, EventUpdate $event_update): PromiseInterface
1598    {
1599        $request = $this->updateEventRequest($event_id, $event_update);
1600
1601        return $this->client
1602            ->sendAsync($request, $this->createHttpClientOption())
1603            ->then(
1604                function ($response) {
1605                    return [null, $response];
1606                },
1607                function ($e) {
1608                    if ($e instanceof RequestException) {
1609                        $e = new ApiException(
1610                            "[{$e->getCode()}] {$e->getMessage()}",
1611                            (int) $e->getCode(),
1612                            $e->getResponse(),
1613                            $e
1614                        );
1615                    } elseif ($e instanceof ConnectException) {
1616                        $e = new ApiException(
1617                            "[{$e->getCode()}] {$e->getMessage()}",
1618                            (int) $e->getCode(),
1619                            null,
1620                            $e
1621                        );
1622                    } elseif (!$e instanceof ApiException) {
1623                        $e = new ApiException(
1624                            $e->getMessage(),
1625                            (int) $e->getCode(),
1626                            null,
1627                            $e
1628                        );
1629                    }
1630                    $this->handleUpdateEventError($e);
1631                }
1632            );
1633    }
1634
1635    /**
1636     * Create request for operation 'updateEvent'.
1637     *
1638     * @param string      $event_id     The unique event [identifier](https://docs.fingerprint.com/reference/js-agent-get-function#event_id). (required)
1639     * @param EventUpdate $event_update (required)
1640     *
1641     * @noinspection GrazieInspection
1642     *
1643     * @return Request the prepared HTTP request
1644     *
1645     * @throws \InvalidArgumentException
1646     */
1647    public function updateEventRequest(string $event_id, EventUpdate $event_update): Request
1648    {
1649        $resourcePath = '/events/{event_id}';
1650        $headers = [
1651            'Authorization' => 'Bearer '.$this->config->getApiKey(),
1652        ];
1653        $queryParams = ['ii' => $this->integration_info];
1654        $headerParams = [];
1655
1656        // path params
1657        $resourcePath = str_replace(
1658            '{event_id}',
1659            ObjectSerializer::toPathValue($event_id),
1660            $resourcePath
1661        );
1662
1663        $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($event_update));
1664
1665        if ($this->config->getUserAgent()) {
1666            $headers['User-Agent'] = $this->config->getUserAgent();
1667        }
1668
1669        $headers = array_merge(
1670            $headerParams,
1671            $headers
1672        );
1673
1674        $query = ObjectSerializer::buildQuery($queryParams);
1675
1676        return new Request(
1677            'PATCH',
1678            $this->config->getHost().$resourcePath.($query ? "?$query" : ''),
1679            $headers,
1680            $httpBody
1681        );
1682    }
1683
1684    /**
1685     * Create http client option.
1686     *
1687     * @return array HTTP client options
1688     *
1689     * @throws \RuntimeException on file opening failure
1690     */
1691    protected function createHttpClientOption(): array
1692    {
1693        // Path parameters are percent-encoded (see ObjectSerializer::toPathValue()),
1694        // but curl still decodes and collapses RFC 3986 dot-segments (e.g. a
1695        // literal '.' or '..' path parameter) before the request is sent unless
1696        // explicitly told not to. CURLOPT_PATH_AS_IS makes curl transmit the URL
1697        // exactly as built, so an event/visitor ID can never be misrouted to a
1698        // different endpoint via path normalization.
1699        $options = [
1700            'curl' => [
1701                \CURLOPT_PATH_AS_IS => true,
1702            ],
1703        ];
1704        if ($this->config->getDebug()) {
1705            $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a');
1706            if (!$options[RequestOptions::DEBUG]) {
1707                throw new \RuntimeException('Failed to open the debug file: '.$this->config->getDebugFile());
1708            }
1709        }
1710
1711        if ($this->config->getCertFile()) {
1712            $options[RequestOptions::CERT] = $this->config->getCertFile();
1713        }
1714
1715        if ($this->config->getKeyFile()) {
1716            $options[RequestOptions::SSL_KEY] = $this->config->getKeyFile();
1717        }
1718
1719        return $options;
1720    }
1721
1722    /**
1723     * Handle error responses for operation 'deleteVisitorData'.
1724     *
1725     * @param ApiException $e the API exception to handle
1726     *
1727     * @throws ApiException                  always rethrown after setting error details
1728     * @throws \DateMalformedStringException
1729     *
1730     * @noinspection PhpDuplicateSwitchCaseBodyInspection
1731     * @noinspection RedundantSuppression
1732     */
1733    private function handleDeleteVisitorDataError(ApiException $e): never
1734    {
1735        $response = $e->getResponseObject();
1736
1737        if (null !== $response) {
1738            $errorCode = $e->getCode();
1739
1740            $content = (string) $response->getBody();
1741            $response->getBody()->rewind();
1742
1743            switch ($errorCode) {
1744                case 400:
1745                    $data = ObjectSerializer::deserialize(
1746                        $content,
1747                        '\Fingerprint\ServerSdk\Model\ErrorResponse'
1748                    );
1749                    $e->setErrorDetails($data);
1750
1751                    throw $e;
1752
1753                case 403:
1754                    $data = ObjectSerializer::deserialize(
1755                        $content,
1756                        '\Fingerprint\ServerSdk\Model\ErrorResponse'
1757                    );
1758                    $e->setErrorDetails($data);
1759
1760                    throw $e;
1761
1762                case 404:
1763                    $data = ObjectSerializer::deserialize(
1764                        $content,
1765                        '\Fingerprint\ServerSdk\Model\ErrorResponse'
1766                    );
1767                    $e->setErrorDetails($data);
1768
1769                    throw $e;
1770
1771                case 429:
1772                    $data = ObjectSerializer::deserialize(
1773                        $content,
1774                        '\Fingerprint\ServerSdk\Model\ErrorResponse'
1775                    );
1776                    $e->setErrorDetails($data);
1777
1778                    throw $e;
1779            }
1780        }
1781
1782        throw $e;
1783    }
1784
1785    /**
1786     * Handle error responses for operation 'getEvent'.
1787     *
1788     * @param ApiException $e the API exception to handle
1789     *
1790     * @throws ApiException                  always rethrown after setting error details
1791     * @throws \DateMalformedStringException
1792     *
1793     * @noinspection PhpDuplicateSwitchCaseBodyInspection
1794     * @noinspection RedundantSuppression
1795     */
1796    private function handleGetEventError(ApiException $e): never
1797    {
1798        $response = $e->getResponseObject();
1799
1800        if (null !== $response) {
1801            $errorCode = $e->getCode();
1802
1803            $content = (string) $response->getBody();
1804            $response->getBody()->rewind();
1805
1806            switch ($errorCode) {
1807                case 200:
1808                    $data = ObjectSerializer::deserialize(
1809                        $content,
1810                        '\Fingerprint\ServerSdk\Model\Event'
1811                    );
1812                    $e->setErrorDetails($data);
1813
1814                    throw $e;
1815
1816                case 400:
1817                    $data = ObjectSerializer::deserialize(
1818                        $content,
1819                        '\Fingerprint\ServerSdk\Model\ErrorResponse'
1820                    );
1821                    $e->setErrorDetails($data);
1822
1823                    throw $e;
1824
1825                case 403:
1826                    $data = ObjectSerializer::deserialize(
1827                        $content,
1828                        '\Fingerprint\ServerSdk\Model\ErrorResponse'
1829                    );
1830                    $e->setErrorDetails($data);
1831
1832                    throw $e;
1833
1834                case 404:
1835                    $data = ObjectSerializer::deserialize(
1836                        $content,
1837                        '\Fingerprint\ServerSdk\Model\ErrorResponse'
1838                    );
1839                    $e->setErrorDetails($data);
1840
1841                    throw $e;
1842
1843                case 429:
1844                    $data = ObjectSerializer::deserialize(
1845                        $content,
1846                        '\Fingerprint\ServerSdk\Model\ErrorResponse'
1847                    );
1848                    $e->setErrorDetails($data);
1849
1850                    throw $e;
1851
1852                case 500:
1853                    $data = ObjectSerializer::deserialize(
1854                        $content,
1855                        '\Fingerprint\ServerSdk\Model\ErrorResponse'
1856                    );
1857                    $e->setErrorDetails($data);
1858
1859                    throw $e;
1860
1861                case 504:
1862                    $data = ObjectSerializer::deserialize(
1863                        $content,
1864                        '\Fingerprint\ServerSdk\Model\ErrorResponse'
1865                    );
1866                    $e->setErrorDetails($data);
1867
1868                    throw $e;
1869            }
1870        }
1871
1872        throw $e;
1873    }
1874
1875    /**
1876     * Handle error responses for operation 'searchEvents'.
1877     *
1878     * @param ApiException $e the API exception to handle
1879     *
1880     * @throws ApiException                  always rethrown after setting error details
1881     * @throws \DateMalformedStringException
1882     *
1883     * @noinspection PhpDuplicateSwitchCaseBodyInspection
1884     * @noinspection RedundantSuppression
1885     */
1886    private function handleSearchEventsError(ApiException $e): never
1887    {
1888        $response = $e->getResponseObject();
1889
1890        if (null !== $response) {
1891            $errorCode = $e->getCode();
1892
1893            $content = (string) $response->getBody();
1894            $response->getBody()->rewind();
1895
1896            switch ($errorCode) {
1897                case 200:
1898                    $data = ObjectSerializer::deserialize(
1899                        $content,
1900                        '\Fingerprint\ServerSdk\Model\EventSearch'
1901                    );
1902                    $e->setErrorDetails($data);
1903
1904                    throw $e;
1905
1906                case 400:
1907                    $data = ObjectSerializer::deserialize(
1908                        $content,
1909                        '\Fingerprint\ServerSdk\Model\ErrorResponse'
1910                    );
1911                    $e->setErrorDetails($data);
1912
1913                    throw $e;
1914
1915                case 403:
1916                    $data = ObjectSerializer::deserialize(
1917                        $content,
1918                        '\Fingerprint\ServerSdk\Model\ErrorResponse'
1919                    );
1920                    $e->setErrorDetails($data);
1921
1922                    throw $e;
1923
1924                case 404:
1925                    $data = ObjectSerializer::deserialize(
1926                        $content,
1927                        '\Fingerprint\ServerSdk\Model\ErrorResponse'
1928                    );
1929                    $e->setErrorDetails($data);
1930
1931                    throw $e;
1932
1933                case 429:
1934                    $data = ObjectSerializer::deserialize(
1935                        $content,
1936                        '\Fingerprint\ServerSdk\Model\ErrorResponse'
1937                    );
1938                    $e->setErrorDetails($data);
1939
1940                    throw $e;
1941
1942                case 500:
1943                    $data = ObjectSerializer::deserialize(
1944                        $content,
1945                        '\Fingerprint\ServerSdk\Model\ErrorResponse'
1946                    );
1947                    $e->setErrorDetails($data);
1948
1949                    throw $e;
1950
1951                case 504:
1952                    $data = ObjectSerializer::deserialize(
1953                        $content,
1954                        '\Fingerprint\ServerSdk\Model\ErrorResponse'
1955                    );
1956                    $e->setErrorDetails($data);
1957
1958                    throw $e;
1959            }
1960        }
1961
1962        throw $e;
1963    }
1964
1965    /**
1966     * Handle error responses for operation 'updateEvent'.
1967     *
1968     * @param ApiException $e the API exception to handle
1969     *
1970     * @throws ApiException                  always rethrown after setting error details
1971     * @throws \DateMalformedStringException
1972     *
1973     * @noinspection PhpDuplicateSwitchCaseBodyInspection
1974     * @noinspection RedundantSuppression
1975     */
1976    private function handleUpdateEventError(ApiException $e): never
1977    {
1978        $response = $e->getResponseObject();
1979
1980        if (null !== $response) {
1981            $errorCode = $e->getCode();
1982
1983            $content = (string) $response->getBody();
1984            $response->getBody()->rewind();
1985
1986            switch ($errorCode) {
1987                case 400:
1988                    $data = ObjectSerializer::deserialize(
1989                        $content,
1990                        '\Fingerprint\ServerSdk\Model\ErrorResponse'
1991                    );
1992                    $e->setErrorDetails($data);
1993
1994                    throw $e;
1995
1996                case 403:
1997                    $data = ObjectSerializer::deserialize(
1998                        $content,
1999                        '\Fingerprint\ServerSdk\Model\ErrorResponse'
2000                    );
2001                    $e->setErrorDetails($data);
2002
2003                    throw $e;
2004
2005                case 404:
2006                    $data = ObjectSerializer::deserialize(
2007                        $content,
2008                        '\Fingerprint\ServerSdk\Model\ErrorResponse'
2009                    );
2010                    $e->setErrorDetails($data);
2011
2012                    throw $e;
2013
2014                case 409:
2015                    $data = ObjectSerializer::deserialize(
2016                        $content,
2017                        '\Fingerprint\ServerSdk\Model\ErrorResponse'
2018                    );
2019                    $e->setErrorDetails($data);
2020
2021                    throw $e;
2022            }
2023        }
2024
2025        throw $e;
2026    }
2027
2028    /**
2029     * Deserialize the response body into the given data type.
2030     *
2031     * @param string            $dataType the expected data type for deserialization
2032     * @param RequestInterface  $request  the original HTTP request
2033     * @param ResponseInterface $response the HTTP response to deserialize
2034     *
2035     * @return array{mixed, ResponseInterface} deserialized data and the HTTP response
2036     *
2037     * @throws ApiException
2038     * @throws \DateMalformedStringException
2039     */
2040    private function handleResponseWithDataType(
2041        string $dataType,
2042        RequestInterface $request,
2043        ResponseInterface $response
2044    ): array {
2045        $content = (string) $response->getBody();
2046        $response->getBody()->rewind();
2047        if ('string' !== $dataType) {
2048            try {
2049                $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
2050            } catch (\JsonException $exception) {
2051                throw new ApiException(
2052                    sprintf(
2053                        'Error JSON decoding server response (%s)',
2054                        $request->getUri()
2055                    ),
2056                    $exception->getCode(),
2057                    $response,
2058                    $exception
2059                );
2060            }
2061        }
2062
2063        return [
2064            ObjectSerializer::deserialize($content, $dataType),
2065            $response,
2066        ];
2067    }
2068}