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