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