Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/add-event-source-field.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@fingerprint/php-sdk': minor
---

Add `source` field to `Event` and `EdgeResponse` to identify how the event was generated (`device` or `edge`)
5 changes: 5 additions & 0 deletions .changeset/add-labels-v3.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@fingerprint/php-sdk': patch
---

**events**: Add `labels` signal to v3 schema
3 changes: 3 additions & 0 deletions .openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ docs/Model/EventRuleAction.md
docs/Model/EventRuleActionAllow.md
docs/Model/EventRuleActionBlock.md
docs/Model/EventSearch.md
docs/Model/EventSource.md
docs/Model/EventUpdate.md
docs/Model/FontPreferences.md
docs/Model/Geolocation.md
Expand Down Expand Up @@ -82,6 +83,7 @@ src/Model/EventRuleAction.php
src/Model/EventRuleActionAllow.php
src/Model/EventRuleActionBlock.php
src/Model/EventSearch.php
src/Model/EventSource.php
src/Model/EventUpdate.php
src/Model/FontPreferences.php
src/Model/Geolocation.php
Expand Down Expand Up @@ -135,3 +137,4 @@ src/Sealed/Sealed.php
src/Sealed/UnsealAggregateException.php
src/Sealed/UnsealException.php
src/Webhook/WebhookVerifier.php
test/Model/EventSourceTest.php
2 changes: 1 addition & 1 deletion .schema-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v3.5.1
v3.6.0
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ Class | Method | HTTP request | Description
- [EventRuleActionAllow](docs/Model/EventRuleActionAllow.md)
- [EventRuleActionBlock](docs/Model/EventRuleActionBlock.md)
- [EventSearch](docs/Model/EventSearch.md)
- [EventSource](docs/Model/EventSource.md)
- [EventUpdate](docs/Model/EventUpdate.md)
- [FontPreferences](docs/Model/FontPreferences.md)
- [Geolocation](docs/Model/Geolocation.md)
Expand Down
1 change: 1 addition & 0 deletions docs/Model/Event.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**event_id** | **string** | Unique identifier of the user's request. The first portion of the event_id is a unix epoch milliseconds timestamp. |
**timestamp** | **int** | Timestamp of the event with millisecond precision in Unix time. |
**source** | [**\Fingerprint\ServerSdk\Model\EventSource**](EventSource.md) | | [optional]
**incremental_identification_status** | [**\Fingerprint\ServerSdk\Model\IncrementalIdentificationStatus**](IncrementalIdentificationStatus.md) | | [optional]
**linked_id** | **string** | A customer-provided id that was sent with the request. | [optional]
**environment_id** | **string** | Environment Id of the event. | [optional]
Expand Down
15 changes: 15 additions & 0 deletions docs/Model/EventSource.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# EventSource Enum

Identifies how the event was generated.
- `device` - the event was generated by the JS agent or a mobile SDK running on an end-user device.
- `edge` - the event was generated by the Automation Intelligence API (`/edge` endpoint), analyzing a request intercepted at the edge.


## Values

| Name | Value | Description |
| --- | --- | --- |
DEVICE | 'device' | |
EDGE | 'edge' | |

[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
19 changes: 19 additions & 0 deletions res/fingerprint-server-api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1164,6 +1164,19 @@ components:
format: int64
examples:
- 1708102555327
EventSource:
type: string
description: >
Identifies how the event was generated.

- `device` - the event was generated by the JS agent or a mobile SDK
running on an end-user device.

- `edge` - the event was generated by the Automation Intelligence API
(`/edge` endpoint), analyzing a request intercepted at the edge.
enum:
- device
- edge
Url:
type: string
examples:
Expand Down Expand Up @@ -3070,6 +3083,12 @@ components:
- android
- ios
- browser
source:
$ref: '#/components/schemas/EventSource'
x-platforms:
- android
- ios
- browser
incremental_identification_status:
$ref: '#/components/schemas/IncrementalIdentificationStatus'
x-platforms:
Expand Down
29 changes: 29 additions & 0 deletions src/Model/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ class Event implements ModelInterface, \ArrayAccess, \JsonSerializable
protected static array $openAPITypes = [
'event_id' => 'string',
'timestamp' => 'int',
'source' => '\Fingerprint\ServerSdk\Model\EventSource',
'incremental_identification_status' => '\Fingerprint\ServerSdk\Model\IncrementalIdentificationStatus',
'linked_id' => 'string',
'environment_id' => 'string',
Expand Down Expand Up @@ -141,6 +142,7 @@ class Event implements ModelInterface, \ArrayAccess, \JsonSerializable
protected static array $openAPIFormats = [
'event_id' => null,
'timestamp' => 'int64',
'source' => null,
'incremental_identification_status' => null,
'linked_id' => null,
'environment_id' => null,
Expand Down Expand Up @@ -213,6 +215,7 @@ class Event implements ModelInterface, \ArrayAccess, \JsonSerializable
protected static array $openAPINullables = [
'event_id' => false,
'timestamp' => false,
'source' => false,
'incremental_identification_status' => false,
'linked_id' => false,
'environment_id' => false,
Expand Down Expand Up @@ -293,6 +296,7 @@ class Event implements ModelInterface, \ArrayAccess, \JsonSerializable
protected static array $attributeMap = [
'event_id' => 'event_id',
'timestamp' => 'timestamp',
'source' => 'source',
'incremental_identification_status' => 'incremental_identification_status',
'linked_id' => 'linked_id',
'environment_id' => 'environment_id',
Expand Down Expand Up @@ -365,6 +369,7 @@ class Event implements ModelInterface, \ArrayAccess, \JsonSerializable
protected static array $setters = [
'event_id' => 'setEventId',
'timestamp' => 'setTimestamp',
'source' => 'setSource',
'incremental_identification_status' => 'setIncrementalIdentificationStatus',
'linked_id' => 'setLinkedId',
'environment_id' => 'setEnvironmentId',
Expand Down Expand Up @@ -437,6 +442,7 @@ class Event implements ModelInterface, \ArrayAccess, \JsonSerializable
protected static array $getters = [
'event_id' => 'getEventId',
'timestamp' => 'getTimestamp',
'source' => 'getSource',
'incremental_identification_status' => 'getIncrementalIdentificationStatus',
'linked_id' => 'getLinkedId',
'environment_id' => 'getEnvironmentId',
Expand Down Expand Up @@ -518,6 +524,7 @@ public function __construct(?array $data = null)
{
$this->setIfExists('event_id', $data ?? [], null);
$this->setIfExists('timestamp', $data ?? [], null);
$this->setIfExists('source', $data ?? [], null);
$this->setIfExists('incremental_identification_status', $data ?? [], null);
$this->setIfExists('linked_id', $data ?? [], null);
$this->setIfExists('environment_id', $data ?? [], null);
Expand Down Expand Up @@ -771,6 +778,28 @@ public function setTimestamp(int $timestamp): self
return $this;
}

/**
* Gets source.
*
*/
public function getSource(): EventSource|string|null
{
return $this->container['source'];
}

/**
* Sets source.
*
* @param EventSource|string $source source
*
*/
public function setSource(EventSource|string $source): self
{
$this->container['source'] = $source;

return $this;
}

/**
* Gets incremental_identification_status.
*
Expand Down
52 changes: 52 additions & 0 deletions src/Model/EventSource.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?php

/**
* EventSource.
*
* @category Enum
*
* @author Fingerprint
*
* @see https://fingerprint.com
*/

/**
* Server API.
*
* Fingerprint Server API allows you to get, search, and update Events in a server environment. It can be used for data exports, decision-making, and data analysis scenarios. Server API is intended for server-side usage, it's not intended to be used from the client side, whether it's a browser or a mobile device. The API also supports collection of Automation Intelligence for requests to your server in edge, pre-origin, or middleware contexts.
*
* The version of the OpenAPI document: 4
* Contact: support@fingerprint.com
* Generated by: https://openapi-generator.tech
* Generator version: 7.23.0
*/

/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/

namespace Fingerprint\ServerSdk\Model;

/**
* Identifies how the event was generated.
* - `device` - the event was generated by the JS agent or a mobile SDK running on an end-user device.
* - `edge` - the event was generated by the Automation Intelligence API (`/edge` endpoint), analyzing a request intercepted at the edge.
*
* @category Enum
*
* @description Identifies how the event was generated. - &#x60;device&#x60; - the event was generated by the JS agent or a mobile SDK running on an end-user device. - &#x60;edge&#x60; - the event was generated by the Automation Intelligence API (&#x60;/edge&#x60; endpoint), analyzing a request intercepted at the edge.
*
* @author Fingerprint
*
* @see https://fingerprint.com
*
* @noinspection GrazieInspection
* @noinspection RedundantSuppression
*/
enum EventSource: string
{
case DEVICE = 'device';
case EDGE = 'edge';
}
81 changes: 81 additions & 0 deletions test/Model/EventSourceTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<?php

/**
* EventSourceTest.
*
* PHP version 8.1
*
* @category Class
*
* @author OpenAPI Generator team
*
* @see https://openapi-generator.tech
*/

/**
* Server API.
*
* Fingerprint Server API allows you to get, search, and update Events in a server environment. It can be used for data exports, decision-making, and data analysis scenarios. Server API is intended for server-side usage, it's not intended to be used from the client side, whether it's a browser or a mobile device. The API also supports collection of Automation Intelligence for requests to your server in edge, pre-origin, or middleware contexts.
*
* The version of the OpenAPI document: 4
* Contact: support@fingerprint.com
* Generated by: https://openapi-generator.tech
* Generator version: 7.23.0
*/

/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Please update the test case below to test the model.
*/

namespace Fingerprint\ServerSdk\Test\Model;

use PHPUnit\Framework\TestCase;

/**
* EventSourceTest Class Doc Comment.
*
* @category Class
*
* @description Identifies how the event was generated. - &#x60;device&#x60; - the event was generated by the JS agent or a mobile SDK running on an end-user device. - &#x60;edge&#x60; - the event was generated by the Automation Intelligence API (&#x60;/edge&#x60; endpoint), analyzing a request intercepted at the edge.
*
* @author OpenAPI Generator team
*
* @see https://openapi-generator.tech
*
* @internal
*
* @coversNothing
*/
class EventSourceTest extends TestCase
{
/**
* Setup before running any test case.
*/
public static function setUpBeforeClass(): void {}

/**
* Clean up after running all test cases.
*/
public static function tearDownAfterClass(): void {}

/**
* Setup before running each test case.
*/
public function setUp(): void {}

/**
* Clean up after running each test case.
*/
public function tearDown(): void {}

/**
* Test "EventSource".
*/
public function testEventSource()
{
// TODO: implement
self::markTestIncomplete('Not implemented');
}
}
6 changes: 6 additions & 0 deletions test/mocks/errors/400_edge_ip_required.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"error": {
"code": "request_cannot_be_parsed",
"message": "at least one of ipv4_address or ipv6_address is required"
}
}
6 changes: 6 additions & 0 deletions test/mocks/errors/400_edge_unknown_field.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"error": {
"code": "request_cannot_be_parsed",
"message": "request body contains an unknown field \"unknown\""
}
}
6 changes: 6 additions & 0 deletions test/mocks/errors/400_request_read_timeout.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"error": {
"code": "request_read_timeout",
"message": "request read timeout"
}
}
6 changes: 6 additions & 0 deletions test/mocks/errors/413_payload_too_large.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"error": {
"code": "payload_too_large",
"message": "payload too large"
}
}
6 changes: 6 additions & 0 deletions test/mocks/errors/429_too_many_search_requests.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"error": {
"code": "too_many_requests",
"message": "too many search requests"
}
}
1 change: 1 addition & 0 deletions test/mocks/events/get_event_200.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"tags": {},
"timestamp": 1708102555327,
"event_id": "1708102555327.NLOjmg",
"source": "device",
"incremental_identification_status": "completed",
"url": "https://www.example.com/login?hope{this{works[!",
"ip_address": "61.127.217.15",
Expand Down
1 change: 1 addition & 0 deletions test/mocks/events/get_event_200_with_unknown_field.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"tags": {},
"timestamp": 1708102555327,
"event_id": "1708102555327.NLOjmg",
"source": "device",
"incremental_identification_status": "completed",
"url": "https://www.example.com/login?hope{this{works[!",
"ip_address": "61.127.217.15",
Expand Down
1 change: 1 addition & 0 deletions test/mocks/events/get_event_ruleset_200.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"tags": {},
"timestamp": 1708102555327,
"event_id": "1708102555327.NLOjmg",
"source": "device",
"incremental_identification_status": "completed",
"url": "https://www.example.com/login?hope{this{works[!",
"ip_address": "61.127.217.15",
Expand Down
1 change: 1 addition & 0 deletions test/mocks/events/get_event_with_bot_info_200.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"tags": {},
"timestamp": 1708102555327,
"event_id": "1708102555327.NLOjmg",
"source": "device",
"incremental_identification_status": "completed",
"url": "https://www.example.com/login?hope{this{works[!",
"ip_address": "61.127.217.15",
Expand Down
Loading
Loading