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