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