Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
53.17% covered (warning)
53.17%
487 / 916
4.76% covered (danger)
4.76%
1 / 21
CRAP
0.00% covered (danger)
0.00%
0 / 1
FingerprintApi
53.17% covered (warning)
53.17%
487 / 916
4.76% covered (danger)
4.76%
1 / 21
4963.56
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
3
 getConfig
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 deleteVisitorData
80.77% covered (warning)
80.77%
42 / 52
0.00% covered (danger)
0.00%
0 / 1
11.86
 deleteVisitorDataAsync
0.00% covered (danger)
0.00%
0 / 50
0.00% covered (danger)
0.00%
0 / 1
90
 getEvent
64.58% covered (warning)
64.58%
31 / 48
0.00% covered (danger)
0.00%
0 / 1
14.44
 getEventAsync
0.00% covered (danger)
0.00%
0 / 46
0.00% covered (danger)
0.00%
0 / 1
72
 getRelatedVisitors
75.86% covered (warning)
75.86%
44 / 58
0.00% covered (danger)
0.00%
0 / 1
14.03
 getRelatedVisitorsAsync
0.00% covered (danger)
0.00%
0 / 56
0.00% covered (danger)
0.00%
0 / 1
110
 getVisits
66.04% covered (warning)
66.04%
35 / 53
0.00% covered (danger)
0.00%
0 / 1
15.74
 getVisitsAsync
0.00% covered (danger)
0.00%
0 / 51
0.00% covered (danger)
0.00%
0 / 1
90
 searchEvents
64.58% covered (warning)
64.58%
31 / 48
0.00% covered (danger)
0.00%
0 / 1
14.44
 searchEventsAsync
0.00% covered (danger)
0.00%
0 / 46
0.00% covered (danger)
0.00%
0 / 1
72
 updateEvent
75.00% covered (warning)
75.00%
39 / 52
0.00% covered (danger)
0.00%
0 / 1
12.89
 updateEventAsync
0.00% covered (danger)
0.00%
0 / 50
0.00% covered (danger)
0.00%
0 / 1
90
 deleteVisitorDataRequest
87.18% covered (warning)
87.18%
34 / 39
0.00% covered (danger)
0.00%
0 / 1
9.17
 getEventRequest
87.18% covered (warning)
87.18%
34 / 39
0.00% covered (danger)
0.00%
0 / 1
9.17
 getRelatedVisitorsRequest
85.71% covered (warning)
85.71%
30 / 35
0.00% covered (danger)
0.00%
0 / 1
9.24
 getVisitsRequest
83.67% covered (warning)
83.67%
41 / 49
0.00% covered (danger)
0.00%
0 / 1
14.85
 searchEventsRequest
94.12% covered (success)
94.12%
80 / 85
0.00% covered (danger)
0.00%
0 / 1
34.24
 updateEventRequest
82.00% covered (warning)
82.00%
41 / 50
0.00% covered (danger)
0.00%
0 / 1
16.31
 createHttpClientOption
50.00% covered (danger)
50.00%
3 / 6
0.00% covered (danger)
0.00%
0 / 1
4.12
1<?php
2/**
3 * FingerprintApi
4 * PHP version 5.
5 *
6 * @category Class
7 *
8 * @author   Swagger Codegen team
9 *
10 * @see     https://github.com/swagger-api/swagger-codegen
11 */
12
13/**
14 * Fingerprint Server API.
15 *
16 * Fingerprint Server API allows you to search, update, and delete identification events in a server environment. It can be used for data exports, decision-making, and data analysis scenarios. Server API is intended for server-side usage, it's not intended to be used from the client side, whether it's a browser or a mobile device.
17 *
18 * OpenAPI spec version: 3
19 * Contact: support@fingerprint.com
20 * Generated by: https://github.com/swagger-api/swagger-codegen.git
21 * Swagger Codegen version: 3.0.34
22 */
23/**
24 * NOTE: This class is auto generated by the swagger code generator program.
25 * https://github.com/swagger-api/swagger-codegen
26 * Do not edit the class manually.
27 */
28
29namespace Fingerprint\ServerAPI\Api;
30
31use Fingerprint\ServerAPI\ApiException;
32use Fingerprint\ServerAPI\Configuration;
33use Fingerprint\ServerAPI\Model\EventsUpdateRequest;
34use Fingerprint\ServerAPI\Model\ModelInterface;
35use Fingerprint\ServerAPI\ObjectSerializer;
36use Fingerprint\ServerAPI\SerializationException;
37use GuzzleHttp\Client;
38use GuzzleHttp\ClientInterface;
39use GuzzleHttp\Exception\GuzzleException;
40use GuzzleHttp\Exception\RequestException;
41use GuzzleHttp\Promise\PromiseInterface;
42use GuzzleHttp\Psr7\Request;
43use GuzzleHttp\RequestOptions;
44use Psr\Http\Message\ResponseInterface;
45
46/**
47 * FingerprintApi Class Doc Comment.
48 *
49 * @category Class
50 *
51 * @author   Swagger Codegen team
52 *
53 * @see     https://github.com/swagger-api/swagger-codegen
54 */
55class FingerprintApi
56{
57    protected ClientInterface $client;
58    protected Configuration $config;
59
60    protected string $integration_info = 'fingerprint-pro-server-php-sdk/6.6.0';
61
62    public function __construct(
63        ?ClientInterface $client = null,
64        ?Configuration $config = null
65    ) {
66        $this->client = $client ?: new Client();
67        $this->config = $config ?: new Configuration();
68    }
69
70    public function getConfig(): Configuration
71    {
72        return $this->config;
73    }
74
75    /**
76     * Operation deleteVisitorData.
77     *
78     * Delete data by visitor ID
79     *
80     * @param string $visitor_id The [visitor ID](https://dev.fingerprint.com/reference/get-function#visitorid) you want to delete. (required)
81     *
82     * @return array{ null, \Psr\Http\Message\ResponseInterface }
83     *
84     * @throws \InvalidArgumentException
85     * @throws SerializationException
86     * @throws GuzzleException
87     * @throws ApiException
88     */
89    public function deleteVisitorData(string $visitor_id): array
90    {
91        $returnType = '';
92        $request = $this->deleteVisitorDataRequest($visitor_id);
93
94        try {
95            $options = $this->createHttpClientOption();
96
97            try {
98                $response = $this->client->send($request, $options);
99            } catch (RequestException $e) {
100                $apiException = new ApiException(
101                    "[{$e->getCode()}{$e->getMessage()}",
102                    $e->getCode()
103                );
104                $apiException->setResponseObject($e->getResponse());
105
106                throw $apiException;
107            }
108
109            $statusCode = $response->getStatusCode();
110
111            if ($statusCode < 200 || $statusCode > 299) {
112                $apiException = new ApiException(
113                    sprintf(
114                        '[%d] Error connecting to the API (%s)',
115                        $statusCode,
116                        $request->getUri()
117                    ),
118                    $statusCode
119                );
120                $apiException->setResponseObject($response);
121
122                throw $apiException;
123            }
124
125            return [null, $response];
126        } catch (ApiException $e) {
127            /** @var ResponseInterface $response */
128            $response = $e->getResponseObject();
129
130            switch ($e->getCode()) {
131                case 400:
132                    $errorDetail = ObjectSerializer::deserialize($response, '\Fingerprint\ServerAPI\Model\ErrorResponse');
133                    $e->setErrorDetails($errorDetail);
134                    $e->setResponseObject($response);
135
136                    break;
137
138                case 403:
139                    $errorDetail = ObjectSerializer::deserialize($response, '\Fingerprint\ServerAPI\Model\ErrorResponse');
140                    $e->setErrorDetails($errorDetail);
141                    $e->setResponseObject($response);
142
143                    break;
144
145                case 404:
146                    $errorDetail = ObjectSerializer::deserialize($response, '\Fingerprint\ServerAPI\Model\ErrorResponse');
147                    $e->setErrorDetails($errorDetail);
148                    $e->setResponseObject($response);
149
150                    break;
151
152                case 429:
153                    $errorDetail = ObjectSerializer::deserialize($response, '\Fingerprint\ServerAPI\Model\ErrorResponse');
154                    $e->setErrorDetails($errorDetail);
155                    $e->setResponseObject($response);
156
157                    break;
158            }
159
160            if (429 === $e->getCode()) {
161                $e->setRetryAfter(1);
162                if ($response->hasHeader('retry-after')) {
163                    $e->setRetryAfter((int) $response->getHeader('retry-after')[0]);
164                }
165            }
166
167            throw $e;
168        }
169    }
170
171    /**
172     * Operation deleteVisitorDataAsync.
173     *
174     * Delete data by visitor ID
175     *
176     * @param string $visitor_id The [visitor ID](https://dev.fingerprint.com/reference/get-function#visitorid) you want to delete. (required)
177     *
178     * @throws \InvalidArgumentException
179     * @throws SerializationException
180     * @throws GuzzleException
181     * @throws ApiException
182     */
183    public function deleteVisitorDataAsync(string $visitor_id): PromiseInterface
184    {
185        $returnType = '';
186        $request = $this->deleteVisitorDataRequest($visitor_id);
187
188        return $this->client
189            ->sendAsync($request, $this->createHttpClientOption())
190            ->then(
191                function ($response) use ($request) {
192                    $statusCode = $response->getStatusCode();
193
194                    if ($statusCode < 200 || $statusCode > 299) {
195                        $apiException = new ApiException(
196                            sprintf(
197                                '[%d] Error connecting to the API (%s)',
198                                $statusCode,
199                                $request->getUri()
200                            ),
201                            $statusCode
202                        );
203                        $apiException->setResponseObject($response);
204
205                        throw $apiException;
206                    }
207
208                    return [null, $response];
209                },
210                function ($e) {
211                    /** @var ResponseInterface $response */
212                    $response = $e->getResponseObject();
213
214                    switch ($e->getCode()) {
215                        case 400:
216                            $errorDetail = ObjectSerializer::deserialize($response, '\Fingerprint\ServerAPI\Model\ErrorResponse');
217                            $e->setErrorDetails($errorDetail);
218                            $e->setResponseObject($response);
219
220                            break;
221
222                        case 403:
223                            $errorDetail = ObjectSerializer::deserialize($response, '\Fingerprint\ServerAPI\Model\ErrorResponse');
224                            $e->setErrorDetails($errorDetail);
225                            $e->setResponseObject($response);
226
227                            break;
228
229                        case 404:
230                            $errorDetail = ObjectSerializer::deserialize($response, '\Fingerprint\ServerAPI\Model\ErrorResponse');
231                            $e->setErrorDetails($errorDetail);
232                            $e->setResponseObject($response);
233
234                            break;
235
236                        case 429:
237                            $errorDetail = ObjectSerializer::deserialize($response, '\Fingerprint\ServerAPI\Model\ErrorResponse');
238                            $e->setErrorDetails($errorDetail);
239                            $e->setResponseObject($response);
240
241                            break;
242                    }
243
244                    if (429 === $e->getCode()) {
245                        $e->setRetryAfter(1);
246                        if ($response->hasHeader('retry-after')) {
247                            $e->setRetryAfter((int) $response->getHeader('retry-after')[0]);
248                        }
249                    }
250
251                    throw $e;
252                }
253            );
254    }
255
256    /**
257     * Operation getEvent.
258     *
259     * Get event by request ID
260     *
261     * @param string $request_id The unique [identifier](https://dev.fingerprint.com/reference/get-function#requestid) of each identification request. (required)
262     *
263     * @return array{ \Fingerprint\ServerAPI\Model\EventsGetResponse|null, \Psr\Http\Message\ResponseInterface }
264     *
265     * @throws \InvalidArgumentException
266     * @throws SerializationException
267     * @throws GuzzleException
268     * @throws ApiException
269     */
270    public function getEvent(string $request_id): array
271    {
272        $returnType = '\Fingerprint\ServerAPI\Model\EventsGetResponse';
273        $request = $this->getEventRequest($request_id);
274
275        try {
276            $options = $this->createHttpClientOption();
277
278            try {
279                $response = $this->client->send($request, $options);
280            } catch (RequestException $e) {
281                $apiException = new ApiException(
282                    "[{$e->getCode()}{$e->getMessage()}",
283                    $e->getCode()
284                );
285                $apiException->setResponseObject($e->getResponse());
286
287                throw $apiException;
288            }
289
290            $statusCode = $response->getStatusCode();
291
292            if ($statusCode < 200 || $statusCode > 299) {
293                $apiException = new ApiException(
294                    sprintf(
295                        '[%d] Error connecting to the API (%s)',
296                        $statusCode,
297                        $request->getUri()
298                    ),
299                    $statusCode
300                );
301                $apiException->setResponseObject($response);
302
303                throw $apiException;
304            }
305
306            $serialized = ObjectSerializer::deserialize($response, $returnType);
307
308            return [$serialized, $response];
309        } catch (ApiException $e) {
310            /** @var ResponseInterface $response */
311            $response = $e->getResponseObject();
312
313            switch ($e->getCode()) {
314                case 200:
315                    $errorDetail = ObjectSerializer::deserialize($response, '\Fingerprint\ServerAPI\Model\EventsGetResponse');
316                    $e->setErrorDetails($errorDetail);
317                    $e->setResponseObject($response);
318
319                    break;
320
321                case 403:
322                    $errorDetail = ObjectSerializer::deserialize($response, '\Fingerprint\ServerAPI\Model\ErrorResponse');
323                    $e->setErrorDetails($errorDetail);
324                    $e->setResponseObject($response);
325
326                    break;
327
328                case 404:
329                    $errorDetail = ObjectSerializer::deserialize($response, '\Fingerprint\ServerAPI\Model\ErrorResponse');
330                    $e->setErrorDetails($errorDetail);
331                    $e->setResponseObject($response);
332
333                    break;
334            }
335
336            if (429 === $e->getCode()) {
337                $e->setRetryAfter(1);
338                if ($response->hasHeader('retry-after')) {
339                    $e->setRetryAfter((int) $response->getHeader('retry-after')[0]);
340                }
341            }
342
343            throw $e;
344        }
345    }
346
347    /**
348     * Operation getEventAsync.
349     *
350     * Get event by request ID
351     *
352     * @param string $request_id The unique [identifier](https://dev.fingerprint.com/reference/get-function#requestid) of each identification request. (required)
353     *
354     * @throws \InvalidArgumentException
355     * @throws SerializationException
356     * @throws GuzzleException
357     * @throws ApiException
358     */
359    public function getEventAsync(string $request_id): PromiseInterface
360    {
361        $returnType = '\Fingerprint\ServerAPI\Model\EventsGetResponse';
362        $request = $this->getEventRequest($request_id);
363
364        return $this->client
365            ->sendAsync($request, $this->createHttpClientOption())
366            ->then(
367                function ($response) use ($returnType, $request) {
368                    $statusCode = $response->getStatusCode();
369
370                    if ($statusCode < 200 || $statusCode > 299) {
371                        $apiException = new ApiException(
372                            sprintf(
373                                '[%d] Error connecting to the API (%s)',
374                                $statusCode,
375                                $request->getUri()
376                            ),
377                            $statusCode
378                        );
379                        $apiException->setResponseObject($response);
380
381                        throw $apiException;
382                    }
383
384                    $serialized = ObjectSerializer::deserialize($response, $returnType);
385
386                    return [$serialized, $response];
387                },
388                function ($e) {
389                    /** @var ResponseInterface $response */
390                    $response = $e->getResponseObject();
391
392                    switch ($e->getCode()) {
393                        case 200:
394                            $errorDetail = ObjectSerializer::deserialize($response, '\Fingerprint\ServerAPI\Model\EventsGetResponse');
395                            $e->setErrorDetails($errorDetail);
396                            $e->setResponseObject($response);
397
398                            break;
399
400                        case 403:
401                            $errorDetail = ObjectSerializer::deserialize($response, '\Fingerprint\ServerAPI\Model\ErrorResponse');
402                            $e->setErrorDetails($errorDetail);
403                            $e->setResponseObject($response);
404
405                            break;
406
407                        case 404:
408                            $errorDetail = ObjectSerializer::deserialize($response, '\Fingerprint\ServerAPI\Model\ErrorResponse');
409                            $e->setErrorDetails($errorDetail);
410                            $e->setResponseObject($response);
411
412                            break;
413                    }
414
415                    if (429 === $e->getCode()) {
416                        $e->setRetryAfter(1);
417                        if ($response->hasHeader('retry-after')) {
418                            $e->setRetryAfter((int) $response->getHeader('retry-after')[0]);
419                        }
420                    }
421
422                    throw $e;
423                }
424            );
425    }
426
427    /**
428     * Operation getRelatedVisitors.
429     *
430     * Get Related Visitors
431     *
432     * @param string $visitor_id The [visitor ID](https://dev.fingerprint.com/reference/get-function#visitorid) for which you want to find the other visitor IDs that originated from the same mobile device. (required)
433     *
434     * @return array{ \Fingerprint\ServerAPI\Model\RelatedVisitorsResponse|null, \Psr\Http\Message\ResponseInterface }
435     *
436     * @throws \InvalidArgumentException
437     * @throws SerializationException
438     * @throws GuzzleException
439     * @throws ApiException
440     */
441    public function getRelatedVisitors(string $visitor_id): array
442    {
443        $returnType = '\Fingerprint\ServerAPI\Model\RelatedVisitorsResponse';
444        $request = $this->getRelatedVisitorsRequest($visitor_id);
445
446        try {
447            $options = $this->createHttpClientOption();
448
449            try {
450                $response = $this->client->send($request, $options);
451            } catch (RequestException $e) {
452                $apiException = new ApiException(
453                    "[{$e->getCode()}{$e->getMessage()}",
454                    $e->getCode()
455                );
456                $apiException->setResponseObject($e->getResponse());
457
458                throw $apiException;
459            }
460
461            $statusCode = $response->getStatusCode();
462
463            if ($statusCode < 200 || $statusCode > 299) {
464                $apiException = new ApiException(
465                    sprintf(
466                        '[%d] Error connecting to the API (%s)',
467                        $statusCode,
468                        $request->getUri()
469                    ),
470                    $statusCode
471                );
472                $apiException->setResponseObject($response);
473
474                throw $apiException;
475            }
476
477            $serialized = ObjectSerializer::deserialize($response, $returnType);
478
479            return [$serialized, $response];
480        } catch (ApiException $e) {
481            /** @var ResponseInterface $response */
482            $response = $e->getResponseObject();
483
484            switch ($e->getCode()) {
485                case 200:
486                    $errorDetail = ObjectSerializer::deserialize($response, '\Fingerprint\ServerAPI\Model\RelatedVisitorsResponse');
487                    $e->setErrorDetails($errorDetail);
488                    $e->setResponseObject($response);
489
490                    break;
491
492                case 400:
493                    $errorDetail = ObjectSerializer::deserialize($response, '\Fingerprint\ServerAPI\Model\ErrorResponse');
494                    $e->setErrorDetails($errorDetail);
495                    $e->setResponseObject($response);
496
497                    break;
498
499                case 403:
500                    $errorDetail = ObjectSerializer::deserialize($response, '\Fingerprint\ServerAPI\Model\ErrorResponse');
501                    $e->setErrorDetails($errorDetail);
502                    $e->setResponseObject($response);
503
504                    break;
505
506                case 404:
507                    $errorDetail = ObjectSerializer::deserialize($response, '\Fingerprint\ServerAPI\Model\ErrorResponse');
508                    $e->setErrorDetails($errorDetail);
509                    $e->setResponseObject($response);
510
511                    break;
512
513                case 429:
514                    $errorDetail = ObjectSerializer::deserialize($response, '\Fingerprint\ServerAPI\Model\ErrorResponse');
515                    $e->setErrorDetails($errorDetail);
516                    $e->setResponseObject($response);
517
518                    break;
519            }
520
521            if (429 === $e->getCode()) {
522                $e->setRetryAfter(1);
523                if ($response->hasHeader('retry-after')) {
524                    $e->setRetryAfter((int) $response->getHeader('retry-after')[0]);
525                }
526            }
527
528            throw $e;
529        }
530    }
531
532    /**
533     * Operation getRelatedVisitorsAsync.
534     *
535     * Get Related Visitors
536     *
537     * @param string $visitor_id The [visitor ID](https://dev.fingerprint.com/reference/get-function#visitorid) for which you want to find the other visitor IDs that originated from the same mobile device. (required)
538     *
539     * @throws \InvalidArgumentException
540     * @throws SerializationException
541     * @throws GuzzleException
542     * @throws ApiException
543     */
544    public function getRelatedVisitorsAsync(string $visitor_id): PromiseInterface
545    {
546        $returnType = '\Fingerprint\ServerAPI\Model\RelatedVisitorsResponse';
547        $request = $this->getRelatedVisitorsRequest($visitor_id);
548
549        return $this->client
550            ->sendAsync($request, $this->createHttpClientOption())
551            ->then(
552                function ($response) use ($returnType, $request) {
553                    $statusCode = $response->getStatusCode();
554
555                    if ($statusCode < 200 || $statusCode > 299) {
556                        $apiException = new ApiException(
557                            sprintf(
558                                '[%d] Error connecting to the API (%s)',
559                                $statusCode,
560                                $request->getUri()
561                            ),
562                            $statusCode
563                        );
564                        $apiException->setResponseObject($response);
565
566                        throw $apiException;
567                    }
568
569                    $serialized = ObjectSerializer::deserialize($response, $returnType);
570
571                    return [$serialized, $response];
572                },
573                function ($e) {
574                    /** @var ResponseInterface $response */
575                    $response = $e->getResponseObject();
576
577                    switch ($e->getCode()) {
578                        case 200:
579                            $errorDetail = ObjectSerializer::deserialize($response, '\Fingerprint\ServerAPI\Model\RelatedVisitorsResponse');
580                            $e->setErrorDetails($errorDetail);
581                            $e->setResponseObject($response);
582
583                            break;
584
585                        case 400:
586                            $errorDetail = ObjectSerializer::deserialize($response, '\Fingerprint\ServerAPI\Model\ErrorResponse');
587                            $e->setErrorDetails($errorDetail);
588                            $e->setResponseObject($response);
589
590                            break;
591
592                        case 403:
593                            $errorDetail = ObjectSerializer::deserialize($response, '\Fingerprint\ServerAPI\Model\ErrorResponse');
594                            $e->setErrorDetails($errorDetail);
595                            $e->setResponseObject($response);
596
597                            break;
598
599                        case 404:
600                            $errorDetail = ObjectSerializer::deserialize($response, '\Fingerprint\ServerAPI\Model\ErrorResponse');
601                            $e->setErrorDetails($errorDetail);
602                            $e->setResponseObject($response);
603
604                            break;
605
606                        case 429:
607                            $errorDetail = ObjectSerializer::deserialize($response, '\Fingerprint\ServerAPI\Model\ErrorResponse');
608                            $e->setErrorDetails($errorDetail);
609                            $e->setResponseObject($response);
610
611                            break;
612                    }
613
614                    if (429 === $e->getCode()) {
615                        $e->setRetryAfter(1);
616                        if ($response->hasHeader('retry-after')) {
617                            $e->setRetryAfter((int) $response->getHeader('retry-after')[0]);
618                        }
619                    }
620
621                    throw $e;
622                }
623            );
624    }
625
626    /**
627     * Operation getVisits.
628     *
629     * Get visits by visitor ID
630     *
631     * @param string $visitor_id     Unique [visitor identifier](https://dev.fingerprint.com/reference/get-function#visitorid) issued by Fingerprint Pro. (required)
632     * @param string $request_id     Filter visits by `requestId`.   Every identification request has a unique identifier associated with it called `requestId`. This identifier is returned to the client in the identification [result](https://dev.fingerprint.com/reference/get-function#requestid). When you filter visits by `requestId`, only one visit will be returned. (optional)
633     * @param string $linked_id      Filter visits by your custom identifier.   You can use [`linkedId`](https://dev.fingerprint.com/reference/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)
634     * @param int    $limit          Limit scanned results.   For performance reasons, the API first scans some number of events before filtering them. Use `limit` to specify how many events are scanned before they are filtered by `requestId` or `linkedId`. Results are always returned sorted by the timestamp (most recent first). By default, the most recent 100 visits are scanned, the maximum is 500. (optional)
635     * @param string $pagination_key Use `paginationKey` to get the next page of results.   When more results are available (e.g., you requested 200 results using `limit` parameter, but a total of 600 results are available), the `paginationKey` top-level attribute is added to the response. The key corresponds to the `requestId` of the last returned event. In the following request, use that value in the `paginationKey` parameter to get the next page of results:  1. First request, returning most recent 200 events: `GET api-base-url/visitors/:visitorId?limit=200` 2. Use `response.paginationKey` to get the next page of results: `GET api-base-url/visitors/:visitorId?limit=200&paginationKey=1683900801733.Ogvu1j`  Pagination happens during scanning and before filtering, so you can get less visits than the `limit` you specified with more available on the next page. When there are no more results available for scanning, the `paginationKey` attribute is not returned. (optional)
636     * @param int    $before         ⚠️ Deprecated pagination method, please use `paginationKey` instead. Timestamp (in milliseconds since epoch) used to paginate results. (optional)
637     *
638     * @return array{ \Fingerprint\ServerAPI\Model\VisitorsGetResponse|null, \Psr\Http\Message\ResponseInterface }
639     *
640     * @throws \InvalidArgumentException
641     * @throws SerializationException
642     * @throws GuzzleException
643     * @throws ApiException
644     */
645    public function getVisits(string $visitor_id, ?string $request_id = null, ?string $linked_id = null, ?int $limit = null, ?string $pagination_key = null, ?int $before = null): array
646    {
647        $returnType = '\Fingerprint\ServerAPI\Model\VisitorsGetResponse';
648        $request = $this->getVisitsRequest($visitor_id, $request_id, $linked_id, $limit, $pagination_key, $before);
649
650        try {
651            $options = $this->createHttpClientOption();
652
653            try {
654                $response = $this->client->send($request, $options);
655            } catch (RequestException $e) {
656                $apiException = new ApiException(
657                    "[{$e->getCode()}{$e->getMessage()}",
658                    $e->getCode()
659                );
660                $apiException->setResponseObject($e->getResponse());
661
662                throw $apiException;
663            }
664
665            $statusCode = $response->getStatusCode();
666
667            if ($statusCode < 200 || $statusCode > 299) {
668                $apiException = new ApiException(
669                    sprintf(
670                        '[%d] Error connecting to the API (%s)',
671                        $statusCode,
672                        $request->getUri()
673                    ),
674                    $statusCode
675                );
676                $apiException->setResponseObject($response);
677
678                throw $apiException;
679            }
680
681            $serialized = ObjectSerializer::deserialize($response, $returnType);
682
683            return [$serialized, $response];
684        } catch (ApiException $e) {
685            /** @var ResponseInterface $response */
686            $response = $e->getResponseObject();
687
688            switch ($e->getCode()) {
689                case 200:
690                    $errorDetail = ObjectSerializer::deserialize($response, '\Fingerprint\ServerAPI\Model\VisitorsGetResponse');
691                    $e->setErrorDetails($errorDetail);
692                    $e->setResponseObject($response);
693
694                    break;
695
696                case 400:
697                    $errorDetail = ObjectSerializer::deserialize($response, '\Fingerprint\ServerAPI\Model\ErrorPlainResponse');
698                    $e->setErrorDetails($errorDetail);
699                    $e->setResponseObject($response);
700
701                    break;
702
703                case 403:
704                    $errorDetail = ObjectSerializer::deserialize($response, '\Fingerprint\ServerAPI\Model\ErrorPlainResponse');
705                    $e->setErrorDetails($errorDetail);
706                    $e->setResponseObject($response);
707
708                    break;
709
710                case 429:
711                    $errorDetail = ObjectSerializer::deserialize($response, '\Fingerprint\ServerAPI\Model\ErrorPlainResponse');
712                    $e->setErrorDetails($errorDetail);
713                    $e->setResponseObject($response);
714
715                    break;
716            }
717
718            if (429 === $e->getCode()) {
719                $e->setRetryAfter(1);
720                if ($response->hasHeader('retry-after')) {
721                    $e->setRetryAfter((int) $response->getHeader('retry-after')[0]);
722                }
723            }
724
725            throw $e;
726        }
727    }
728
729    /**
730     * Operation getVisitsAsync.
731     *
732     * Get visits by visitor ID
733     *
734     * @param string $visitor_id     Unique [visitor identifier](https://dev.fingerprint.com/reference/get-function#visitorid) issued by Fingerprint Pro. (required)
735     * @param string $request_id     Filter visits by `requestId`.   Every identification request has a unique identifier associated with it called `requestId`. This identifier is returned to the client in the identification [result](https://dev.fingerprint.com/reference/get-function#requestid). When you filter visits by `requestId`, only one visit will be returned. (optional)
736     * @param string $linked_id      Filter visits by your custom identifier.   You can use [`linkedId`](https://dev.fingerprint.com/reference/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)
737     * @param int    $limit          Limit scanned results.   For performance reasons, the API first scans some number of events before filtering them. Use `limit` to specify how many events are scanned before they are filtered by `requestId` or `linkedId`. Results are always returned sorted by the timestamp (most recent first). By default, the most recent 100 visits are scanned, the maximum is 500. (optional)
738     * @param string $pagination_key Use `paginationKey` to get the next page of results.   When more results are available (e.g., you requested 200 results using `limit` parameter, but a total of 600 results are available), the `paginationKey` top-level attribute is added to the response. The key corresponds to the `requestId` of the last returned event. In the following request, use that value in the `paginationKey` parameter to get the next page of results:  1. First request, returning most recent 200 events: `GET api-base-url/visitors/:visitorId?limit=200` 2. Use `response.paginationKey` to get the next page of results: `GET api-base-url/visitors/:visitorId?limit=200&paginationKey=1683900801733.Ogvu1j`  Pagination happens during scanning and before filtering, so you can get less visits than the `limit` you specified with more available on the next page. When there are no more results available for scanning, the `paginationKey` attribute is not returned. (optional)
739     * @param int    $before         ⚠️ Deprecated pagination method, please use `paginationKey` instead. Timestamp (in milliseconds since epoch) used to paginate results. (optional)
740     *
741     * @throws \InvalidArgumentException
742     * @throws SerializationException
743     * @throws GuzzleException
744     * @throws ApiException
745     */
746    public function getVisitsAsync(string $visitor_id, ?string $request_id = null, ?string $linked_id = null, ?int $limit = null, ?string $pagination_key = null, ?int $before = null): PromiseInterface
747    {
748        $returnType = '\Fingerprint\ServerAPI\Model\VisitorsGetResponse';
749        $request = $this->getVisitsRequest($visitor_id, $request_id, $linked_id, $limit, $pagination_key, $before);
750
751        return $this->client
752            ->sendAsync($request, $this->createHttpClientOption())
753            ->then(
754                function ($response) use ($returnType, $request) {
755                    $statusCode = $response->getStatusCode();
756
757                    if ($statusCode < 200 || $statusCode > 299) {
758                        $apiException = new ApiException(
759                            sprintf(
760                                '[%d] Error connecting to the API (%s)',
761                                $statusCode,
762                                $request->getUri()
763                            ),
764                            $statusCode
765                        );
766                        $apiException->setResponseObject($response);
767
768                        throw $apiException;
769                    }
770
771                    $serialized = ObjectSerializer::deserialize($response, $returnType);
772
773                    return [$serialized, $response];
774                },
775                function ($e) {
776                    /** @var ResponseInterface $response */
777                    $response = $e->getResponseObject();
778
779                    switch ($e->getCode()) {
780                        case 200:
781                            $errorDetail = ObjectSerializer::deserialize($response, '\Fingerprint\ServerAPI\Model\VisitorsGetResponse');
782                            $e->setErrorDetails($errorDetail);
783                            $e->setResponseObject($response);
784
785                            break;
786
787                        case 400:
788                            $errorDetail = ObjectSerializer::deserialize($response, '\Fingerprint\ServerAPI\Model\ErrorPlainResponse');
789                            $e->setErrorDetails($errorDetail);
790                            $e->setResponseObject($response);
791
792                            break;
793
794                        case 403:
795                            $errorDetail = ObjectSerializer::deserialize($response, '\Fingerprint\ServerAPI\Model\ErrorPlainResponse');
796                            $e->setErrorDetails($errorDetail);
797                            $e->setResponseObject($response);
798
799                            break;
800
801                        case 429:
802                            $errorDetail = ObjectSerializer::deserialize($response, '\Fingerprint\ServerAPI\Model\ErrorPlainResponse');
803                            $e->setErrorDetails($errorDetail);
804                            $e->setResponseObject($response);
805
806                            break;
807                    }
808
809                    if (429 === $e->getCode()) {
810                        $e->setRetryAfter(1);
811                        if ($response->hasHeader('retry-after')) {
812                            $e->setRetryAfter((int) $response->getHeader('retry-after')[0]);
813                        }
814                    }
815
816                    throw $e;
817                }
818            );
819    }
820
821    /**
822     * Operation searchEvents.
823     *
824     * Get events via search
825     *
826     * @param int    $limit               Limit the number of events returned. (required)
827     * @param string $pagination_key      Use `pagination_key` to get the next page of results.   When more results are available (e.g., you requested up to 200 results for your search using `limit`, but there are more than 200 events total matching your request), the `paginationKey` top-level attribute is added to the response. The key corresponds to the `timestamp` of the last returned event. In the following request, use that value in the `pagination_key` parameter to get the next page of results:  1. First request, returning most recent 200 events: `GET api-base-url/events/search?limit=200` 2. Use `response.paginationKey` to get the next page of results: `GET api-base-url/events/search?limit=200&pagination_key=1740815825085` (optional)
828     * @param string $visitor_id          Unique [visitor identifier](https://dev.fingerprint.com/reference/get-function#visitorid) issued by Fingerprint Pro. Filter for events matching this `visitor_id`. (optional)
829     * @param string $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 `products.botd.data.bot.result` property set to a valid value are returned. Events without a `products.botd` Smart Signal result are left out of the response. (optional)
830     * @param string $ip_address          Filter events by IP address range. The range can be as specific as a single IP (/32 for IPv4 or /128 for IPv6)  All ip_address filters must use CIDR notation, for example, 10.0.0.0/24, 192.168.0.1/32 (optional)
831     * @param string $linked_id           Filter events by your custom identifier.   You can use [linked IDs](https://dev.fingerprint.com/reference/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)
832     * @param int    $start               Filter events with a timestamp greater than the start time, in Unix time (milliseconds). (optional)
833     * @param int    $end                 Filter events with a timestamp smaller than the end time, in Unix time (milliseconds). (optional)
834     * @param bool   $reverse             Sort events in reverse timestamp order. (optional)
835     * @param bool   $suspect             Filter events previously tagged as suspicious via the [Update API](https://dev.fingerprint.com/reference/updateevent).  > 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)
836     * @param bool   $vpn                 Filter events by VPN Detection result.   > Note: When using this parameter, only events with the `products.vpn.data.result` property set to `true` or `false` are returned. Events without a `products.vpn` Smart Signal result are left out of the response. (optional)
837     * @param bool   $virtual_machine     Filter events by Virtual Machine Detection result.   > Note: When using this parameter, only events with the `products.virtualMachine.data.result` property set to `true` or `false` are returned. Events without a `products.virtualMachine` Smart Signal result are left out of the response. (optional)
838     * @param bool   $tampering           Filter events by Tampering Detection result.   > Note: When using this parameter, only events with the `products.tampering.data.result` property set to `true` or `false` are returned. Events without a `products.tampering` Smart Signal result are left out of the response. (optional)
839     * @param bool   $anti_detect_browser Filter events by Anti-detect Browser Detection result.   > Note: When using this parameter, only events with the `products.tampering.data.antiDetectBrowser` property set to `true` or `false` are returned. Events without a `products.tampering` Smart Signal result are left out of the response. (optional)
840     * @param bool   $incognito           Filter events by Browser Incognito Detection result.   > Note: When using this parameter, only events with the `products.incognito.data.result` property set to `true` or `false` are returned. Events without a `products.incognito` Smart Signal result are left out of the response. (optional)
841     * @param bool   $privacy_settings    Filter events by Privacy Settings Detection result.   > Note: When using this parameter, only events with the `products.privacySettings.data.result` property set to `true` or `false` are returned. Events without a `products.privacySettings` Smart Signal result are left out of the response. (optional)
842     * @param bool   $jailbroken          Filter events by Jailbroken Device Detection result.   > Note: When using this parameter, only events with the `products.jailbroken.data.result` property set to `true` or `false` are returned. Events without a `products.jailbroken` Smart Signal result are left out of the response. (optional)
843     * @param bool   $frida               Filter events by Frida Detection result.   > Note: When using this parameter, only events with the `products.frida.data.result` property set to `true` or `false` are returned. Events without a `products.frida` Smart Signal result are left out of the response. (optional)
844     * @param bool   $factory_reset       Filter events by Factory Reset Detection result.   > Note: When using this parameter, only events with the `products.factoryReset.data.result` property set to `true` or `false` are returned. Events without a `products.factoryReset` Smart Signal result are left out of the response. (optional)
845     * @param bool   $cloned_app          Filter events by Cloned App Detection result.   > Note: When using this parameter, only events with the `products.clonedApp.data.result` property set to `true` or `false` are returned. Events without a `products.clonedApp` Smart Signal result are left out of the response. (optional)
846     * @param bool   $emulator            Filter events by Android Emulator Detection result.   > Note: When using this parameter, only events with the `products.emulator.data.result` property set to `true` or `false` are returned. Events without a `products.emulator` Smart Signal result are left out of the response. (optional)
847     * @param bool   $root_apps           Filter events by Rooted Device Detection result.   > Note: When using this parameter, only events with the `products.rootApps.data.result` property set to `true` or `false` are returned. Events without a `products.rootApps` Smart Signal result are left out of the response. (optional)
848     * @param string $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 `products.vpn.data.confidence` property set to a valid value are returned. Events without a `products.vpn` Smart Signal result are left out of the response. (optional)
849     * @param float  $min_suspect_score   Filter events with Suspect Score result above a provided minimum threshold. > Note: When using this parameter, only events where the `products.suspectScore.data.result` property set to a value exceeding your threshold are returned. Events without a `products.suspectScore` Smart Signal result are left out of the response. (optional)
850     * @param bool   $ip_blocklist        Filter events by IP Blocklist Detection result.   > Note: When using this parameter, only events with the `products.ipBlocklist.data.result` property set to `true` or `false` are returned. Events without a `products.ipBlocklist` Smart Signal result are left out of the response. (optional)
851     * @param bool   $datacenter          Filter events by Datacenter Detection result.   > Note: When using this parameter, only events with the `products.ipInfo.data.v4.datacenter.result` or `products.ipInfo.data.v6.datacenter.result` property set to `true` or `false` are returned. Events without a `products.ipInfo` Smart Signal result are left out of the response. (optional)
852     *
853     * @return array{ \Fingerprint\ServerAPI\Model\SearchEventsResponse|null, \Psr\Http\Message\ResponseInterface }
854     *
855     * @throws \InvalidArgumentException
856     * @throws SerializationException
857     * @throws GuzzleException
858     * @throws ApiException
859     */
860    public function searchEvents(int $limit, ?string $pagination_key = null, ?string $visitor_id = null, ?string $bot = null, ?string $ip_address = null, ?string $linked_id = null, ?int $start = null, ?int $end = null, ?bool $reverse = null, ?bool $suspect = null, ?bool $vpn = null, ?bool $virtual_machine = null, ?bool $tampering = null, ?bool $anti_detect_browser = null, ?bool $incognito = null, ?bool $privacy_settings = null, ?bool $jailbroken = null, ?bool $frida = null, ?bool $factory_reset = null, ?bool $cloned_app = null, ?bool $emulator = null, ?bool $root_apps = null, ?string $vpn_confidence = null, ?float $min_suspect_score = null, ?bool $ip_blocklist = null, ?bool $datacenter = null): array
861    {
862        $returnType = '\Fingerprint\ServerAPI\Model\SearchEventsResponse';
863        $request = $this->searchEventsRequest($limit, $pagination_key, $visitor_id, $bot, $ip_address, $linked_id, $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, $ip_blocklist, $datacenter);
864
865        try {
866            $options = $this->createHttpClientOption();
867
868            try {
869                $response = $this->client->send($request, $options);
870            } catch (RequestException $e) {
871                $apiException = new ApiException(
872                    "[{$e->getCode()}{$e->getMessage()}",
873                    $e->getCode()
874                );
875                $apiException->setResponseObject($e->getResponse());
876
877                throw $apiException;
878            }
879
880            $statusCode = $response->getStatusCode();
881
882            if ($statusCode < 200 || $statusCode > 299) {
883                $apiException = new ApiException(
884                    sprintf(
885                        '[%d] Error connecting to the API (%s)',
886                        $statusCode,
887                        $request->getUri()
888                    ),
889                    $statusCode
890                );
891                $apiException->setResponseObject($response);
892
893                throw $apiException;
894            }
895
896            $serialized = ObjectSerializer::deserialize($response, $returnType);
897
898            return [$serialized, $response];
899        } catch (ApiException $e) {
900            /** @var ResponseInterface $response */
901            $response = $e->getResponseObject();
902
903            switch ($e->getCode()) {
904                case 200:
905                    $errorDetail = ObjectSerializer::deserialize($response, '\Fingerprint\ServerAPI\Model\SearchEventsResponse');
906                    $e->setErrorDetails($errorDetail);
907                    $e->setResponseObject($response);
908
909                    break;
910
911                case 400:
912                    $errorDetail = ObjectSerializer::deserialize($response, '\Fingerprint\ServerAPI\Model\ErrorResponse');
913                    $e->setErrorDetails($errorDetail);
914                    $e->setResponseObject($response);
915
916                    break;
917
918                case 403:
919                    $errorDetail = ObjectSerializer::deserialize($response, '\Fingerprint\ServerAPI\Model\ErrorResponse');
920                    $e->setErrorDetails($errorDetail);
921                    $e->setResponseObject($response);
922
923                    break;
924            }
925
926            if (429 === $e->getCode()) {
927                $e->setRetryAfter(1);
928                if ($response->hasHeader('retry-after')) {
929                    $e->setRetryAfter((int) $response->getHeader('retry-after')[0]);
930                }
931            }
932
933            throw $e;
934        }
935    }
936
937    /**
938     * Operation searchEventsAsync.
939     *
940     * Get events via search
941     *
942     * @param int    $limit               Limit the number of events returned. (required)
943     * @param string $pagination_key      Use `pagination_key` to get the next page of results.   When more results are available (e.g., you requested up to 200 results for your search using `limit`, but there are more than 200 events total matching your request), the `paginationKey` top-level attribute is added to the response. The key corresponds to the `timestamp` of the last returned event. In the following request, use that value in the `pagination_key` parameter to get the next page of results:  1. First request, returning most recent 200 events: `GET api-base-url/events/search?limit=200` 2. Use `response.paginationKey` to get the next page of results: `GET api-base-url/events/search?limit=200&pagination_key=1740815825085` (optional)
944     * @param string $visitor_id          Unique [visitor identifier](https://dev.fingerprint.com/reference/get-function#visitorid) issued by Fingerprint Pro. Filter for events matching this `visitor_id`. (optional)
945     * @param string $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 `products.botd.data.bot.result` property set to a valid value are returned. Events without a `products.botd` Smart Signal result are left out of the response. (optional)
946     * @param string $ip_address          Filter events by IP address range. The range can be as specific as a single IP (/32 for IPv4 or /128 for IPv6)  All ip_address filters must use CIDR notation, for example, 10.0.0.0/24, 192.168.0.1/32 (optional)
947     * @param string $linked_id           Filter events by your custom identifier.   You can use [linked IDs](https://dev.fingerprint.com/reference/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)
948     * @param int    $start               Filter events with a timestamp greater than the start time, in Unix time (milliseconds). (optional)
949     * @param int    $end                 Filter events with a timestamp smaller than the end time, in Unix time (milliseconds). (optional)
950     * @param bool   $reverse             Sort events in reverse timestamp order. (optional)
951     * @param bool   $suspect             Filter events previously tagged as suspicious via the [Update API](https://dev.fingerprint.com/reference/updateevent).  > 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)
952     * @param bool   $vpn                 Filter events by VPN Detection result.   > Note: When using this parameter, only events with the `products.vpn.data.result` property set to `true` or `false` are returned. Events without a `products.vpn` Smart Signal result are left out of the response. (optional)
953     * @param bool   $virtual_machine     Filter events by Virtual Machine Detection result.   > Note: When using this parameter, only events with the `products.virtualMachine.data.result` property set to `true` or `false` are returned. Events without a `products.virtualMachine` Smart Signal result are left out of the response. (optional)
954     * @param bool   $tampering           Filter events by Tampering Detection result.   > Note: When using this parameter, only events with the `products.tampering.data.result` property set to `true` or `false` are returned. Events without a `products.tampering` Smart Signal result are left out of the response. (optional)
955     * @param bool   $anti_detect_browser Filter events by Anti-detect Browser Detection result.   > Note: When using this parameter, only events with the `products.tampering.data.antiDetectBrowser` property set to `true` or `false` are returned. Events without a `products.tampering` Smart Signal result are left out of the response. (optional)
956     * @param bool   $incognito           Filter events by Browser Incognito Detection result.   > Note: When using this parameter, only events with the `products.incognito.data.result` property set to `true` or `false` are returned. Events without a `products.incognito` Smart Signal result are left out of the response. (optional)
957     * @param bool   $privacy_settings    Filter events by Privacy Settings Detection result.   > Note: When using this parameter, only events with the `products.privacySettings.data.result` property set to `true` or `false` are returned. Events without a `products.privacySettings` Smart Signal result are left out of the response. (optional)
958     * @param bool   $jailbroken          Filter events by Jailbroken Device Detection result.   > Note: When using this parameter, only events with the `products.jailbroken.data.result` property set to `true` or `false` are returned. Events without a `products.jailbroken` Smart Signal result are left out of the response. (optional)
959     * @param bool   $frida               Filter events by Frida Detection result.   > Note: When using this parameter, only events with the `products.frida.data.result` property set to `true` or `false` are returned. Events without a `products.frida` Smart Signal result are left out of the response. (optional)
960     * @param bool   $factory_reset       Filter events by Factory Reset Detection result.   > Note: When using this parameter, only events with the `products.factoryReset.data.result` property set to `true` or `false` are returned. Events without a `products.factoryReset` Smart Signal result are left out of the response. (optional)
961     * @param bool   $cloned_app          Filter events by Cloned App Detection result.   > Note: When using this parameter, only events with the `products.clonedApp.data.result` property set to `true` or `false` are returned. Events without a `products.clonedApp` Smart Signal result are left out of the response. (optional)
962     * @param bool   $emulator            Filter events by Android Emulator Detection result.   > Note: When using this parameter, only events with the `products.emulator.data.result` property set to `true` or `false` are returned. Events without a `products.emulator` Smart Signal result are left out of the response. (optional)
963     * @param bool   $root_apps           Filter events by Rooted Device Detection result.   > Note: When using this parameter, only events with the `products.rootApps.data.result` property set to `true` or `false` are returned. Events without a `products.rootApps` Smart Signal result are left out of the response. (optional)
964     * @param string $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 `products.vpn.data.confidence` property set to a valid value are returned. Events without a `products.vpn` Smart Signal result are left out of the response. (optional)
965     * @param float  $min_suspect_score   Filter events with Suspect Score result above a provided minimum threshold. > Note: When using this parameter, only events where the `products.suspectScore.data.result` property set to a value exceeding your threshold are returned. Events without a `products.suspectScore` Smart Signal result are left out of the response. (optional)
966     * @param bool   $ip_blocklist        Filter events by IP Blocklist Detection result.   > Note: When using this parameter, only events with the `products.ipBlocklist.data.result` property set to `true` or `false` are returned. Events without a `products.ipBlocklist` Smart Signal result are left out of the response. (optional)
967     * @param bool   $datacenter          Filter events by Datacenter Detection result.   > Note: When using this parameter, only events with the `products.ipInfo.data.v4.datacenter.result` or `products.ipInfo.data.v6.datacenter.result` property set to `true` or `false` are returned. Events without a `products.ipInfo` Smart Signal result are left out of the response. (optional)
968     *
969     * @throws \InvalidArgumentException
970     * @throws SerializationException
971     * @throws GuzzleException
972     * @throws ApiException
973     */
974    public function searchEventsAsync(int $limit, ?string $pagination_key = null, ?string $visitor_id = null, ?string $bot = null, ?string $ip_address = null, ?string $linked_id = null, ?int $start = null, ?int $end = null, ?bool $reverse = null, ?bool $suspect = null, ?bool $vpn = null, ?bool $virtual_machine = null, ?bool $tampering = null, ?bool $anti_detect_browser = null, ?bool $incognito = null, ?bool $privacy_settings = null, ?bool $jailbroken = null, ?bool $frida = null, ?bool $factory_reset = null, ?bool $cloned_app = null, ?bool $emulator = null, ?bool $root_apps = null, ?string $vpn_confidence = null, ?float $min_suspect_score = null, ?bool $ip_blocklist = null, ?bool $datacenter = null): PromiseInterface
975    {
976        $returnType = '\Fingerprint\ServerAPI\Model\SearchEventsResponse';
977        $request = $this->searchEventsRequest($limit, $pagination_key, $visitor_id, $bot, $ip_address, $linked_id, $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, $ip_blocklist, $datacenter);
978
979        return $this->client
980            ->sendAsync($request, $this->createHttpClientOption())
981            ->then(
982                function ($response) use ($returnType, $request) {
983                    $statusCode = $response->getStatusCode();
984
985                    if ($statusCode < 200 || $statusCode > 299) {
986                        $apiException = new ApiException(
987                            sprintf(
988                                '[%d] Error connecting to the API (%s)',
989                                $statusCode,
990                                $request->getUri()
991                            ),
992                            $statusCode
993                        );
994                        $apiException->setResponseObject($response);
995
996                        throw $apiException;
997                    }
998
999                    $serialized = ObjectSerializer::deserialize($response, $returnType);
1000
1001                    return [$serialized, $response];
1002                },
1003                function ($e) {
1004                    /** @var ResponseInterface $response */
1005                    $response = $e->getResponseObject();
1006
1007                    switch ($e->getCode()) {
1008                        case 200:
1009                            $errorDetail = ObjectSerializer::deserialize($response, '\Fingerprint\ServerAPI\Model\SearchEventsResponse');
1010                            $e->setErrorDetails($errorDetail);
1011                            $e->setResponseObject($response);
1012
1013                            break;
1014
1015                        case 400:
1016                            $errorDetail = ObjectSerializer::deserialize($response, '\Fingerprint\ServerAPI\Model\ErrorResponse');
1017                            $e->setErrorDetails($errorDetail);
1018                            $e->setResponseObject($response);
1019
1020                            break;
1021
1022                        case 403:
1023                            $errorDetail = ObjectSerializer::deserialize($response, '\Fingerprint\ServerAPI\Model\ErrorResponse');
1024                            $e->setErrorDetails($errorDetail);
1025                            $e->setResponseObject($response);
1026
1027                            break;
1028                    }
1029
1030                    if (429 === $e->getCode()) {
1031                        $e->setRetryAfter(1);
1032                        if ($response->hasHeader('retry-after')) {
1033                            $e->setRetryAfter((int) $response->getHeader('retry-after')[0]);
1034                        }
1035                    }
1036
1037                    throw $e;
1038                }
1039            );
1040    }
1041
1042    /**
1043     * Operation updateEvent.
1044     *
1045     * Update an event with a given request ID
1046     *
1047     * @param EventsUpdateRequest $body       (required)
1048     * @param string              $request_id The unique event [identifier](https://dev.fingerprint.com/reference/get-function#requestid). (required)
1049     *
1050     * @return array{ null, \Psr\Http\Message\ResponseInterface }
1051     *
1052     * @throws \InvalidArgumentException
1053     * @throws SerializationException
1054     * @throws GuzzleException
1055     * @throws ApiException
1056     */
1057    public function updateEvent(EventsUpdateRequest $body, string $request_id): array
1058    {
1059        $returnType = '';
1060        $request = $this->updateEventRequest($body, $request_id);
1061
1062        try {
1063            $options = $this->createHttpClientOption();
1064
1065            try {
1066                $response = $this->client->send($request, $options);
1067            } catch (RequestException $e) {
1068                $apiException = new ApiException(
1069                    "[{$e->getCode()}{$e->getMessage()}",
1070                    $e->getCode()
1071                );
1072                $apiException->setResponseObject($e->getResponse());
1073
1074                throw $apiException;
1075            }
1076
1077            $statusCode = $response->getStatusCode();
1078
1079            if ($statusCode < 200 || $statusCode > 299) {
1080                $apiException = new ApiException(
1081                    sprintf(
1082                        '[%d] Error connecting to the API (%s)',
1083                        $statusCode,
1084                        $request->getUri()
1085                    ),
1086                    $statusCode
1087                );
1088                $apiException->setResponseObject($response);
1089
1090                throw $apiException;
1091            }
1092
1093            return [null, $response];
1094        } catch (ApiException $e) {
1095            /** @var ResponseInterface $response */
1096            $response = $e->getResponseObject();
1097
1098            switch ($e->getCode()) {
1099                case 400:
1100                    $errorDetail = ObjectSerializer::deserialize($response, '\Fingerprint\ServerAPI\Model\ErrorResponse');
1101                    $e->setErrorDetails($errorDetail);
1102                    $e->setResponseObject($response);
1103
1104                    break;
1105
1106                case 403:
1107                    $errorDetail = ObjectSerializer::deserialize($response, '\Fingerprint\ServerAPI\Model\ErrorResponse');
1108                    $e->setErrorDetails($errorDetail);
1109                    $e->setResponseObject($response);
1110
1111                    break;
1112
1113                case 404:
1114                    $errorDetail = ObjectSerializer::deserialize($response, '\Fingerprint\ServerAPI\Model\ErrorResponse');
1115                    $e->setErrorDetails($errorDetail);
1116                    $e->setResponseObject($response);
1117
1118                    break;
1119
1120                case 409:
1121                    $errorDetail = ObjectSerializer::deserialize($response, '\Fingerprint\ServerAPI\Model\ErrorResponse');
1122                    $e->setErrorDetails($errorDetail);
1123                    $e->setResponseObject($response);
1124
1125                    break;
1126            }
1127
1128            if (429 === $e->getCode()) {
1129                $e->setRetryAfter(1);
1130                if ($response->hasHeader('retry-after')) {
1131                    $e->setRetryAfter((int) $response->getHeader('retry-after')[0]);
1132                }
1133            }
1134
1135            throw $e;
1136        }
1137    }
1138
1139    /**
1140     * Operation updateEventAsync.
1141     *
1142     * Update an event with a given request ID
1143     *
1144     * @param EventsUpdateRequest $body       (required)
1145     * @param string              $request_id The unique event [identifier](https://dev.fingerprint.com/reference/get-function#requestid). (required)
1146     *
1147     * @throws \InvalidArgumentException
1148     * @throws SerializationException
1149     * @throws GuzzleException
1150     * @throws ApiException
1151     */
1152    public function updateEventAsync(EventsUpdateRequest $body, string $request_id): PromiseInterface
1153    {
1154        $returnType = '';
1155        $request = $this->updateEventRequest($body, $request_id);
1156
1157        return $this->client
1158            ->sendAsync($request, $this->createHttpClientOption())
1159            ->then(
1160                function ($response) use ($request) {
1161                    $statusCode = $response->getStatusCode();
1162
1163                    if ($statusCode < 200 || $statusCode > 299) {
1164                        $apiException = new ApiException(
1165                            sprintf(
1166                                '[%d] Error connecting to the API (%s)',
1167                                $statusCode,
1168                                $request->getUri()
1169                            ),
1170                            $statusCode
1171                        );
1172                        $apiException->setResponseObject($response);
1173
1174                        throw $apiException;
1175                    }
1176
1177                    return [null, $response];
1178                },
1179                function ($e) {
1180                    /** @var ResponseInterface $response */
1181                    $response = $e->getResponseObject();
1182
1183                    switch ($e->getCode()) {
1184                        case 400:
1185                            $errorDetail = ObjectSerializer::deserialize($response, '\Fingerprint\ServerAPI\Model\ErrorResponse');
1186                            $e->setErrorDetails($errorDetail);
1187                            $e->setResponseObject($response);
1188
1189                            break;
1190
1191                        case 403:
1192                            $errorDetail = ObjectSerializer::deserialize($response, '\Fingerprint\ServerAPI\Model\ErrorResponse');
1193                            $e->setErrorDetails($errorDetail);
1194                            $e->setResponseObject($response);
1195
1196                            break;
1197
1198                        case 404:
1199                            $errorDetail = ObjectSerializer::deserialize($response, '\Fingerprint\ServerAPI\Model\ErrorResponse');
1200                            $e->setErrorDetails($errorDetail);
1201                            $e->setResponseObject($response);
1202
1203                            break;
1204
1205                        case 409:
1206                            $errorDetail = ObjectSerializer::deserialize($response, '\Fingerprint\ServerAPI\Model\ErrorResponse');
1207                            $e->setErrorDetails($errorDetail);
1208                            $e->setResponseObject($response);
1209
1210                            break;
1211                    }
1212
1213                    if (429 === $e->getCode()) {
1214                        $e->setRetryAfter(1);
1215                        if ($response->hasHeader('retry-after')) {
1216                            $e->setRetryAfter((int) $response->getHeader('retry-after')[0]);
1217                        }
1218                    }
1219
1220                    throw $e;
1221                }
1222            );
1223    }
1224
1225    /**
1226     * Create request for operation 'deleteVisitorData'.
1227     *
1228     * @throws \InvalidArgumentException
1229     * @throws SerializationException
1230     * @throws GuzzleException
1231     * @throws ApiException
1232     */
1233    protected function deleteVisitorDataRequest(string $visitor_id): Request
1234    {
1235        // verify the required parameter 'visitor_id' is set
1236        if (null === $visitor_id || (is_array($visitor_id) && 0 === count($visitor_id))) {
1237            throw new \InvalidArgumentException(
1238                'Missing the required parameter $visitor_id when calling deleteVisitorData'
1239            );
1240        }
1241
1242        $resourcePath = '/visitors/{visitor_id}';
1243        $headers = [];
1244        $queryParams = ['ii' => $this->integration_info];
1245        $headerParams = [];
1246        $httpBody = '';
1247
1248        // path params
1249        if (null !== $visitor_id) {
1250            $resourcePath = str_replace(
1251                '{visitor_id}',
1252                ObjectSerializer::toPathValue($visitor_id),
1253                $resourcePath
1254            );
1255        }
1256
1257        // this endpoint requires API key authentication
1258        $apiKey = $this->config->getApiKeyWithPrefix('Auth-API-Key');
1259        if (null !== $apiKey) {
1260            $headers['Auth-API-Key'] = $apiKey;
1261        }
1262        // this endpoint requires API key authentication
1263        $apiKey = $this->config->getApiKeyWithPrefix('api_key');
1264        if (null !== $apiKey) {
1265            $queryParams['api_key'] = $apiKey;
1266        }
1267
1268        $defaultHeaders = [
1269            'Content-Type' => 'application/json',
1270            'Accept' => 'application/json',
1271        ];
1272        if ($this->config->getUserAgent()) {
1273            $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
1274        }
1275
1276        $headers = array_merge(
1277            $defaultHeaders,
1278            $headerParams,
1279            $headers
1280        );
1281
1282        $query = http_build_query($queryParams);
1283
1284        return new Request(
1285            'DELETE',
1286            $this->config->getHost().$resourcePath.($query ? "?{$query}" : ''),
1287            $headers,
1288            $httpBody
1289        );
1290    }
1291
1292    /**
1293     * Create request for operation 'getEvent'.
1294     *
1295     * @throws \InvalidArgumentException
1296     * @throws SerializationException
1297     * @throws GuzzleException
1298     * @throws ApiException
1299     */
1300    protected function getEventRequest(string $request_id): Request
1301    {
1302        // verify the required parameter 'request_id' is set
1303        if (null === $request_id || (is_array($request_id) && 0 === count($request_id))) {
1304            throw new \InvalidArgumentException(
1305                'Missing the required parameter $request_id when calling getEvent'
1306            );
1307        }
1308
1309        $resourcePath = '/events/{request_id}';
1310        $headers = [];
1311        $queryParams = ['ii' => $this->integration_info];
1312        $headerParams = [];
1313        $httpBody = '';
1314
1315        // path params
1316        if (null !== $request_id) {
1317            $resourcePath = str_replace(
1318                '{request_id}',
1319                ObjectSerializer::toPathValue($request_id),
1320                $resourcePath
1321            );
1322        }
1323
1324        // this endpoint requires API key authentication
1325        $apiKey = $this->config->getApiKeyWithPrefix('Auth-API-Key');
1326        if (null !== $apiKey) {
1327            $headers['Auth-API-Key'] = $apiKey;
1328        }
1329        // this endpoint requires API key authentication
1330        $apiKey = $this->config->getApiKeyWithPrefix('api_key');
1331        if (null !== $apiKey) {
1332            $queryParams['api_key'] = $apiKey;
1333        }
1334
1335        $defaultHeaders = [
1336            'Content-Type' => 'application/json',
1337            'Accept' => 'application/json',
1338        ];
1339        if ($this->config->getUserAgent()) {
1340            $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
1341        }
1342
1343        $headers = array_merge(
1344            $defaultHeaders,
1345            $headerParams,
1346            $headers
1347        );
1348
1349        $query = http_build_query($queryParams);
1350
1351        return new Request(
1352            'GET',
1353            $this->config->getHost().$resourcePath.($query ? "?{$query}" : ''),
1354            $headers,
1355            $httpBody
1356        );
1357    }
1358
1359    /**
1360     * Create request for operation 'getRelatedVisitors'.
1361     *
1362     * @throws \InvalidArgumentException
1363     * @throws SerializationException
1364     * @throws GuzzleException
1365     * @throws ApiException
1366     */
1367    protected function getRelatedVisitorsRequest(string $visitor_id): Request
1368    {
1369        // verify the required parameter 'visitor_id' is set
1370        if (null === $visitor_id || (is_array($visitor_id) && 0 === count($visitor_id))) {
1371            throw new \InvalidArgumentException(
1372                'Missing the required parameter $visitor_id when calling getRelatedVisitors'
1373            );
1374        }
1375
1376        $resourcePath = '/related-visitors';
1377        $headers = [];
1378        $queryParams = ['ii' => $this->integration_info];
1379        $headerParams = [];
1380        $httpBody = '';
1381
1382        // query params
1383        if (null !== $visitor_id) {
1384            $queryParams['visitor_id'] = ObjectSerializer::toQueryValue($visitor_id, null);
1385        }
1386
1387        // this endpoint requires API key authentication
1388        $apiKey = $this->config->getApiKeyWithPrefix('Auth-API-Key');
1389        if (null !== $apiKey) {
1390            $headers['Auth-API-Key'] = $apiKey;
1391        }
1392        // this endpoint requires API key authentication
1393        $apiKey = $this->config->getApiKeyWithPrefix('api_key');
1394        if (null !== $apiKey) {
1395            $queryParams['api_key'] = $apiKey;
1396        }
1397
1398        $defaultHeaders = [
1399            'Content-Type' => 'application/json',
1400            'Accept' => 'application/json',
1401        ];
1402        if ($this->config->getUserAgent()) {
1403            $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
1404        }
1405
1406        $headers = array_merge(
1407            $defaultHeaders,
1408            $headerParams,
1409            $headers
1410        );
1411
1412        $query = http_build_query($queryParams);
1413
1414        return new Request(
1415            'GET',
1416            $this->config->getHost().$resourcePath.($query ? "?{$query}" : ''),
1417            $headers,
1418            $httpBody
1419        );
1420    }
1421
1422    /**
1423     * Create request for operation 'getVisits'.
1424     *
1425     * @throws \InvalidArgumentException
1426     * @throws SerializationException
1427     * @throws GuzzleException
1428     * @throws ApiException
1429     */
1430    protected function getVisitsRequest(string $visitor_id, ?string $request_id = null, ?string $linked_id = null, ?int $limit = null, ?string $pagination_key = null, ?int $before = null): Request
1431    {
1432        // verify the required parameter 'visitor_id' is set
1433        if (null === $visitor_id || (is_array($visitor_id) && 0 === count($visitor_id))) {
1434            throw new \InvalidArgumentException(
1435                'Missing the required parameter $visitor_id when calling getVisits'
1436            );
1437        }
1438
1439        $resourcePath = '/visitors/{visitor_id}';
1440        $headers = [];
1441        $queryParams = ['ii' => $this->integration_info];
1442        $headerParams = [];
1443        $httpBody = '';
1444
1445        // query params
1446        if (null !== $request_id) {
1447            $queryParams['request_id'] = ObjectSerializer::toQueryValue($request_id, null);
1448        }
1449        // query params
1450        if (null !== $linked_id) {
1451            $queryParams['linked_id'] = ObjectSerializer::toQueryValue($linked_id, null);
1452        }
1453        // query params
1454        if (null !== $limit) {
1455            $queryParams['limit'] = ObjectSerializer::toQueryValue($limit, 'int32');
1456        }
1457        // query params
1458        if (null !== $pagination_key) {
1459            $queryParams['paginationKey'] = ObjectSerializer::toQueryValue($pagination_key, null);
1460        }
1461        // query params
1462        if (null !== $before) {
1463            $queryParams['before'] = ObjectSerializer::toQueryValue($before, 'int64');
1464        }
1465
1466        // path params
1467        if (null !== $visitor_id) {
1468            $resourcePath = str_replace(
1469                '{visitor_id}',
1470                ObjectSerializer::toPathValue($visitor_id),
1471                $resourcePath
1472            );
1473        }
1474
1475        // this endpoint requires API key authentication
1476        $apiKey = $this->config->getApiKeyWithPrefix('Auth-API-Key');
1477        if (null !== $apiKey) {
1478            $headers['Auth-API-Key'] = $apiKey;
1479        }
1480        // this endpoint requires API key authentication
1481        $apiKey = $this->config->getApiKeyWithPrefix('api_key');
1482        if (null !== $apiKey) {
1483            $queryParams['api_key'] = $apiKey;
1484        }
1485
1486        $defaultHeaders = [
1487            'Content-Type' => 'application/json',
1488            'Accept' => 'application/json',
1489        ];
1490        if ($this->config->getUserAgent()) {
1491            $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
1492        }
1493
1494        $headers = array_merge(
1495            $defaultHeaders,
1496            $headerParams,
1497            $headers
1498        );
1499
1500        $query = http_build_query($queryParams);
1501
1502        return new Request(
1503            'GET',
1504            $this->config->getHost().$resourcePath.($query ? "?{$query}" : ''),
1505            $headers,
1506            $httpBody
1507        );
1508    }
1509
1510    /**
1511     * Create request for operation 'searchEvents'.
1512     *
1513     * @throws \InvalidArgumentException
1514     * @throws SerializationException
1515     * @throws GuzzleException
1516     * @throws ApiException
1517     */
1518    protected function searchEventsRequest(int $limit, ?string $pagination_key = null, ?string $visitor_id = null, ?string $bot = null, ?string $ip_address = null, ?string $linked_id = null, ?int $start = null, ?int $end = null, ?bool $reverse = null, ?bool $suspect = null, ?bool $vpn = null, ?bool $virtual_machine = null, ?bool $tampering = null, ?bool $anti_detect_browser = null, ?bool $incognito = null, ?bool $privacy_settings = null, ?bool $jailbroken = null, ?bool $frida = null, ?bool $factory_reset = null, ?bool $cloned_app = null, ?bool $emulator = null, ?bool $root_apps = null, ?string $vpn_confidence = null, ?float $min_suspect_score = null, ?bool $ip_blocklist = null, ?bool $datacenter = null): Request
1519    {
1520        // verify the required parameter 'limit' is set
1521        if (null === $limit || (is_array($limit) && 0 === count($limit))) {
1522            throw new \InvalidArgumentException(
1523                'Missing the required parameter $limit when calling searchEvents'
1524            );
1525        }
1526
1527        $resourcePath = '/events/search';
1528        $headers = [];
1529        $queryParams = ['ii' => $this->integration_info];
1530        $headerParams = [];
1531        $httpBody = '';
1532
1533        // query params
1534        if (null !== $limit) {
1535            $queryParams['limit'] = ObjectSerializer::toQueryValue($limit, 'int32');
1536        }
1537        // query params
1538        if (null !== $pagination_key) {
1539            $queryParams['pagination_key'] = ObjectSerializer::toQueryValue($pagination_key, null);
1540        }
1541        // query params
1542        if (null !== $visitor_id) {
1543            $queryParams['visitor_id'] = ObjectSerializer::toQueryValue($visitor_id, null);
1544        }
1545        // query params
1546        if (null !== $bot) {
1547            $queryParams['bot'] = ObjectSerializer::toQueryValue($bot, null);
1548        }
1549        // query params
1550        if (null !== $ip_address) {
1551            $queryParams['ip_address'] = ObjectSerializer::toQueryValue($ip_address, null);
1552        }
1553        // query params
1554        if (null !== $linked_id) {
1555            $queryParams['linked_id'] = ObjectSerializer::toQueryValue($linked_id, null);
1556        }
1557        // query params
1558        if (null !== $start) {
1559            $queryParams['start'] = ObjectSerializer::toQueryValue($start, 'int64');
1560        }
1561        // query params
1562        if (null !== $end) {
1563            $queryParams['end'] = ObjectSerializer::toQueryValue($end, 'int64');
1564        }
1565        // query params
1566        if (null !== $reverse) {
1567            $queryParams['reverse'] = ObjectSerializer::toQueryValue($reverse, null);
1568        }
1569        // query params
1570        if (null !== $suspect) {
1571            $queryParams['suspect'] = ObjectSerializer::toQueryValue($suspect, null);
1572        }
1573        // query params
1574        if (null !== $vpn) {
1575            $queryParams['vpn'] = ObjectSerializer::toQueryValue($vpn, null);
1576        }
1577        // query params
1578        if (null !== $virtual_machine) {
1579            $queryParams['virtual_machine'] = ObjectSerializer::toQueryValue($virtual_machine, null);
1580        }
1581        // query params
1582        if (null !== $tampering) {
1583            $queryParams['tampering'] = ObjectSerializer::toQueryValue($tampering, null);
1584        }
1585        // query params
1586        if (null !== $anti_detect_browser) {
1587            $queryParams['anti_detect_browser'] = ObjectSerializer::toQueryValue($anti_detect_browser, null);
1588        }
1589        // query params
1590        if (null !== $incognito) {
1591            $queryParams['incognito'] = ObjectSerializer::toQueryValue($incognito, null);
1592        }
1593        // query params
1594        if (null !== $privacy_settings) {
1595            $queryParams['privacy_settings'] = ObjectSerializer::toQueryValue($privacy_settings, null);
1596        }
1597        // query params
1598        if (null !== $jailbroken) {
1599            $queryParams['jailbroken'] = ObjectSerializer::toQueryValue($jailbroken, null);
1600        }
1601        // query params
1602        if (null !== $frida) {
1603            $queryParams['frida'] = ObjectSerializer::toQueryValue($frida, null);
1604        }
1605        // query params
1606        if (null !== $factory_reset) {
1607            $queryParams['factory_reset'] = ObjectSerializer::toQueryValue($factory_reset, null);
1608        }
1609        // query params
1610        if (null !== $cloned_app) {
1611            $queryParams['cloned_app'] = ObjectSerializer::toQueryValue($cloned_app, null);
1612        }
1613        // query params
1614        if (null !== $emulator) {
1615            $queryParams['emulator'] = ObjectSerializer::toQueryValue($emulator, null);
1616        }
1617        // query params
1618        if (null !== $root_apps) {
1619            $queryParams['root_apps'] = ObjectSerializer::toQueryValue($root_apps, null);
1620        }
1621        // query params
1622        if (null !== $vpn_confidence) {
1623            $queryParams['vpn_confidence'] = ObjectSerializer::toQueryValue($vpn_confidence, null);
1624        }
1625        // query params
1626        if (null !== $min_suspect_score) {
1627            $queryParams['min_suspect_score'] = ObjectSerializer::toQueryValue($min_suspect_score, 'float');
1628        }
1629        // query params
1630        if (null !== $ip_blocklist) {
1631            $queryParams['ip_blocklist'] = ObjectSerializer::toQueryValue($ip_blocklist, null);
1632        }
1633        // query params
1634        if (null !== $datacenter) {
1635            $queryParams['datacenter'] = ObjectSerializer::toQueryValue($datacenter, null);
1636        }
1637
1638        // this endpoint requires API key authentication
1639        $apiKey = $this->config->getApiKeyWithPrefix('Auth-API-Key');
1640        if (null !== $apiKey) {
1641            $headers['Auth-API-Key'] = $apiKey;
1642        }
1643        // this endpoint requires API key authentication
1644        $apiKey = $this->config->getApiKeyWithPrefix('api_key');
1645        if (null !== $apiKey) {
1646            $queryParams['api_key'] = $apiKey;
1647        }
1648
1649        $defaultHeaders = [
1650            'Content-Type' => 'application/json',
1651            'Accept' => 'application/json',
1652        ];
1653        if ($this->config->getUserAgent()) {
1654            $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
1655        }
1656
1657        $headers = array_merge(
1658            $defaultHeaders,
1659            $headerParams,
1660            $headers
1661        );
1662
1663        $query = http_build_query($queryParams);
1664
1665        return new Request(
1666            'GET',
1667            $this->config->getHost().$resourcePath.($query ? "?{$query}" : ''),
1668            $headers,
1669            $httpBody
1670        );
1671    }
1672
1673    /**
1674     * Create request for operation 'updateEvent'.
1675     *
1676     * @throws \InvalidArgumentException
1677     * @throws SerializationException
1678     * @throws GuzzleException
1679     * @throws ApiException
1680     */
1681    protected function updateEventRequest(EventsUpdateRequest $body, string $request_id): Request
1682    {
1683        // verify the required parameter 'body' is set
1684        if (null === $body || (is_array($body) && 0 === count($body))) {
1685            throw new \InvalidArgumentException(
1686                'Missing the required parameter $body when calling updateEvent'
1687            );
1688        }
1689        // verify the required parameter 'request_id' is set
1690        if (null === $request_id || (is_array($request_id) && 0 === count($request_id))) {
1691            throw new \InvalidArgumentException(
1692                'Missing the required parameter $request_id when calling updateEvent'
1693            );
1694        }
1695
1696        $resourcePath = '/events/{request_id}';
1697        $headers = [];
1698        $queryParams = ['ii' => $this->integration_info];
1699        $headerParams = [];
1700        $httpBody = '';
1701
1702        // path params
1703        if (null !== $request_id) {
1704            $resourcePath = str_replace(
1705                '{request_id}',
1706                ObjectSerializer::toPathValue($request_id),
1707                $resourcePath
1708            );
1709        }
1710
1711        // body params
1712        $_tempBody = null;
1713        if (isset($body)) {
1714            $_tempBody = $body;
1715        }
1716
1717        // for model (json/xml)
1718        if (isset($_tempBody)) {
1719            if ($_tempBody instanceof ModelInterface) {
1720                $httpBody = (string) $_tempBody;
1721            } else {
1722                // $_tempBody is the method argument, if present
1723                $httpBody = json_encode($_tempBody);
1724            }
1725        }
1726
1727        // this endpoint requires API key authentication
1728        $apiKey = $this->config->getApiKeyWithPrefix('Auth-API-Key');
1729        if (null !== $apiKey) {
1730            $headers['Auth-API-Key'] = $apiKey;
1731        }
1732        // this endpoint requires API key authentication
1733        $apiKey = $this->config->getApiKeyWithPrefix('api_key');
1734        if (null !== $apiKey) {
1735            $queryParams['api_key'] = $apiKey;
1736        }
1737
1738        $defaultHeaders = [
1739            'Content-Type' => 'application/json',
1740            'Accept' => 'application/json',
1741        ];
1742        if ($this->config->getUserAgent()) {
1743            $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
1744        }
1745
1746        $headers = array_merge(
1747            $defaultHeaders,
1748            $headerParams,
1749            $headers
1750        );
1751
1752        $query = http_build_query($queryParams);
1753
1754        return new Request(
1755            'PUT',
1756            $this->config->getHost().$resourcePath.($query ? "?{$query}" : ''),
1757            $headers,
1758            $httpBody
1759        );
1760    }
1761
1762    /**
1763     * Create http client option.
1764     *
1765     * @throws \RuntimeException on file opening failure
1766     */
1767    protected function createHttpClientOption(): array
1768    {
1769        $options = [];
1770        if ($this->config->getDebug()) {
1771            $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a');
1772            if (!$options[RequestOptions::DEBUG]) {
1773                throw new \RuntimeException('Failed to open the debug file: '.$this->config->getDebugFile());
1774            }
1775        }
1776
1777        return $options;
1778    }
1779}