Skip to content

Commit

Permalink
feat: add update_event method
Browse files Browse the repository at this point in the history
  • Loading branch information
ilfa committed Jul 15, 2024
1 parent 961a165 commit 752b1c9
Show file tree
Hide file tree
Showing 16 changed files with 1,063 additions and 0 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ Class | Method | HTTP request | Description
*FingerprintApi* | [**delete_visitor_data**](docs/FingerprintApi.md#delete_visitor_data) | **DELETE** /visitors/{visitor_id} | Delete data by visitor ID
*FingerprintApi* | [**get_event**](docs/FingerprintApi.md#get_event) | **GET** /events/{request_id} | Get event by request ID
*FingerprintApi* | [**get_visits**](docs/FingerprintApi.md#get_visits) | **GET** /visitors/{visitor_id} | Get visits by visitor ID
*FingerprintApi* | [**update_event**](docs/FingerprintApi.md#update_event) | **PUT** /events/{request_id} | Update an event with a given request ID

## Documentation For Models

Expand All @@ -190,12 +191,17 @@ Class | Method | HTTP request | Description
- [ErrorCommon429ResponseError](docs/ErrorCommon429ResponseError.md)
- [ErrorEvent404Response](docs/ErrorEvent404Response.md)
- [ErrorEvent404ResponseError](docs/ErrorEvent404ResponseError.md)
- [ErrorUpdateEvent400Response](docs/ErrorUpdateEvent400Response.md)
- [ErrorUpdateEvent400ResponseError](docs/ErrorUpdateEvent400ResponseError.md)
- [ErrorUpdateEvent409Response](docs/ErrorUpdateEvent409Response.md)
- [ErrorUpdateEvent409ResponseError](docs/ErrorUpdateEvent409ResponseError.md)
- [ErrorVisitor400Response](docs/ErrorVisitor400Response.md)
- [ErrorVisitor400ResponseError](docs/ErrorVisitor400ResponseError.md)
- [ErrorVisitor404Response](docs/ErrorVisitor404Response.md)
- [ErrorVisitor404ResponseError](docs/ErrorVisitor404ResponseError.md)
- [ErrorVisits403](docs/ErrorVisits403.md)
- [EventResponse](docs/EventResponse.md)
- [EventUpdateRequest](docs/EventUpdateRequest.md)
- [FactoryResetResult](docs/FactoryResetResult.md)
- [FridaResult](docs/FridaResult.md)
- [HighActivityResult](docs/HighActivityResult.md)
Expand Down
9 changes: 9 additions & 0 deletions docs/ErrorUpdateEvent400Response.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# ErrorUpdateEvent400Response

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**error** | [**ErrorUpdateEvent400ResponseError**](ErrorUpdateEvent400ResponseError.md) | | [optional]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

10 changes: 10 additions & 0 deletions docs/ErrorUpdateEvent400ResponseError.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# ErrorUpdateEvent400ResponseError

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**code** | **str** | Error code: * `RequestCannotBeParsed` - the JSON content of the request contains some errors that prevented us from parsing it (wrong type/surpassed limits) * `Failed` - the event is more than 10 days old and cannot be updated |
**message** | **str** | Details about the underlying issue with the input payload |

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

9 changes: 9 additions & 0 deletions docs/ErrorUpdateEvent409Response.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# ErrorUpdateEvent409Response

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**error** | [**ErrorUpdateEvent409ResponseError**](ErrorUpdateEvent409ResponseError.md) | | [optional]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

10 changes: 10 additions & 0 deletions docs/ErrorUpdateEvent409ResponseError.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# ErrorUpdateEvent409ResponseError

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**code** | **str** | Error code: * `StateNotReady` - The event specified with request id is not ready for updates yet. Try again. This error happens in rare cases when update API is called immediately after receiving the request id on the client. In case you need to send information right away, we recommend using the JS agent API instead. |
**message** | **str** | |

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

11 changes: 11 additions & 0 deletions docs/EventUpdateRequest.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# EventUpdateRequest

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**linked_id** | **str** | LinkedID value to assign to the existing event | [optional]
**tag** | **object** | Full `tag` value to be set to the existing event. Replaces any existing `tag` payload completely. | [optional]
**suspect** | **bool** | Suspect flag indicating observed suspicious or fraudulent event | [optional]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

55 changes: 55 additions & 0 deletions docs/FingerprintApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Method | HTTP request | Description
[**delete_visitor_data**](FingerprintApi.md#delete_visitor_data) | **DELETE** /visitors/{visitor_id} | Delete data by visitor ID
[**get_event**](FingerprintApi.md#get_event) | **GET** /events/{request_id} | Get event by request ID
[**get_visits**](FingerprintApi.md#get_visits) | **GET** /visitors/{visitor_id} | Get visits by visitor ID
[**update_event**](FingerprintApi.md#update_event) | **PUT** /events/{request_id} | Update an event with a given request ID

# **delete_visitor_data**
> delete_visitor_data(visitor_id)
Expand Down Expand Up @@ -172,3 +173,57 @@ Name | Type | Description | Notes

[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

# **update_event**
> update_event(request_id, body=body)
Update an event with a given request ID

Change information in existing events specified by `requestId` or *flag suspicious events*. When an event is created, it is assigned `linkedId` and `tag` submitted through the JS agent parameters. This information might not be available on the client so the Server API allows for updating the attributes after the fact. **Warning** It's not possible to update events older than 10 days.

### Example
```python
import fingerprint_pro_server_api_sdk
from fingerprint_pro_server_api_sdk import Response
from fingerprint_pro_server_api_sdk.rest import ApiException

# Configure API key authorization and region
configuration = fingerprint_pro_server_api_sdk.Configuration(api_key="SECRET_API_KEY")
# configuration = fingerprint_pro_server_api_sdk.Configuration(api_key="SECRET_API_KEY", region="eu")

# create an instance of the API class
api_instance = fingerprint_pro_server_api_sdk.FingerprintApi(configuration)
visitor_id = 'visitor_id_example' # str |
#request_id = 'request_id_example' # str | Filter events by requestId (optional)
#linked_id = 'linked_id_example' # str | Filter events by custom identifier (optional)
limit = 10 # int | Limit scanned results (optional)
#before = 56 # int | Used to paginate results (optional)

try:
api_response: Response = api_instance.get_visits(visitor_id, limit=2)
print(api_response)
except ApiException as e:
print("Exception when calling DefaultApi->visitors_visitor_id_get: %s\n" % e)
```

### Parameters

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**request_id** | **str**| The unique event [identifier](https://dev.fingerprint.com/docs/js-agent#requestid). |
**body** | [**EventUpdateRequest**](EventUpdateRequest.md)| | [optional]

### Return type

void (empty response body)

### Authorization

[ApiKeyHeader](../README.md#ApiKeyHeader), [ApiKeyQuery](../README.md#ApiKeyQuery)

### HTTP request headers

- **Content-Type**: application/json
- **Accept**: application/json

[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

5 changes: 5 additions & 0 deletions fingerprint_pro_server_api_sdk/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,17 @@
from fingerprint_pro_server_api_sdk.models.error_common429_response_error import ErrorCommon429ResponseError
from fingerprint_pro_server_api_sdk.models.error_event404_response import ErrorEvent404Response
from fingerprint_pro_server_api_sdk.models.error_event404_response_error import ErrorEvent404ResponseError
from fingerprint_pro_server_api_sdk.models.error_update_event400_response import ErrorUpdateEvent400Response
from fingerprint_pro_server_api_sdk.models.error_update_event400_response_error import ErrorUpdateEvent400ResponseError
from fingerprint_pro_server_api_sdk.models.error_update_event409_response import ErrorUpdateEvent409Response
from fingerprint_pro_server_api_sdk.models.error_update_event409_response_error import ErrorUpdateEvent409ResponseError
from fingerprint_pro_server_api_sdk.models.error_visitor400_response import ErrorVisitor400Response
from fingerprint_pro_server_api_sdk.models.error_visitor400_response_error import ErrorVisitor400ResponseError
from fingerprint_pro_server_api_sdk.models.error_visitor404_response import ErrorVisitor404Response
from fingerprint_pro_server_api_sdk.models.error_visitor404_response_error import ErrorVisitor404ResponseError
from fingerprint_pro_server_api_sdk.models.error_visits403 import ErrorVisits403
from fingerprint_pro_server_api_sdk.models.event_response import EventResponse
from fingerprint_pro_server_api_sdk.models.event_update_request import EventUpdateRequest
from fingerprint_pro_server_api_sdk.models.factory_reset_result import FactoryResetResult
from fingerprint_pro_server_api_sdk.models.frida_result import FridaResult
from fingerprint_pro_server_api_sdk.models.high_activity_result import HighActivityResult
Expand Down
119 changes: 119 additions & 0 deletions fingerprint_pro_server_api_sdk/api/fingerprint_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,3 +374,122 @@ def get_visits_with_http_info(self, visitor_id, **kwargs): # noqa: E501
error = self.api_client.deserialize(e, 'TooManyRequestsResponse', True)
raise extend_exception(e, error)
raise e

def update_event(self, request_id, **kwargs): # noqa: E501
"""Update an event with a given request ID # noqa: E501
Change information in existing events specified by `requestId` or *flag suspicious events*. When an event is created, it is assigned `linkedId` and `tag` submitted through the JS agent parameters. This information might not be available on the client so the Server API allows for updating the attributes after the fact. **Warning** It's not possible to update events older than 10 days. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.update_event(request_id, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str request_id: The unique event [identifier](https://dev.fingerprint.com/docs/js-agent#requestid). (required)
:param EventUpdateRequest body:
:return: None
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.update_event_with_http_info(request_id, **kwargs) # noqa: E501
else:
(data) = self.update_event_with_http_info(request_id, **kwargs) # noqa: E501
return data

def update_event_with_http_info(self, request_id, **kwargs): # noqa: E501
"""Update an event with a given request ID # noqa: E501
Change information in existing events specified by `requestId` or *flag suspicious events*. When an event is created, it is assigned `linkedId` and `tag` submitted through the JS agent parameters. This information might not be available on the client so the Server API allows for updating the attributes after the fact. **Warning** It's not possible to update events older than 10 days. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.update_event_with_http_info(request_id, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str request_id: The unique event [identifier](https://dev.fingerprint.com/docs/js-agent#requestid). (required)
:param EventUpdateRequest body:
:return: None
If the method is called asynchronously,
returns the request thread.
"""

all_params = ['request_id', 'body'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')

params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method update_event" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'request_id' is set
if ('request_id' not in params or
params['request_id'] is None): # noqa: E501
raise ValueError("Missing the required parameter `request_id` when calling `update_event`") # noqa: E501

collection_formats = {}

path_params = {}
if 'request_id' in params:
path_params['request_id'] = params['request_id'] # noqa: E501

query_params = []
query_params.append(('ii', 'fingerprint-pro-server-python-sdk/6.0.0'))

header_params = {}

form_params = []
local_var_files = {}

body_params = None
if 'body' in params:
body_params = params['body']
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json']) # noqa: E501

# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json']) # noqa: E501

# Authentication setting
auth_settings = ['ApiKeyHeader', 'ApiKeyQuery'] # noqa: E501

try:
return self.api_client.call_api(
'/events/{request_id}', 'PUT',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=None, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
except ApiException as e:
if e.status == 400:
error = self.api_client.deserialize(e, 'ErrorUpdateEvent400Response', True)
raise extend_exception(e, error)
if e.status == 403:
error = self.api_client.deserialize(e, 'ErrorCommon403Response', True)
raise extend_exception(e, error)
if e.status == 404:
error = self.api_client.deserialize(e, 'ErrorEvent404Response', True)
raise extend_exception(e, error)
if e.status == 409:
error = self.api_client.deserialize(e, 'ErrorUpdateEvent409Response', True)
raise extend_exception(e, error)
raise e
5 changes: 5 additions & 0 deletions fingerprint_pro_server_api_sdk/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,17 @@
from fingerprint_pro_server_api_sdk.models.error_common429_response_error import ErrorCommon429ResponseError
from fingerprint_pro_server_api_sdk.models.error_event404_response import ErrorEvent404Response
from fingerprint_pro_server_api_sdk.models.error_event404_response_error import ErrorEvent404ResponseError
from fingerprint_pro_server_api_sdk.models.error_update_event400_response import ErrorUpdateEvent400Response
from fingerprint_pro_server_api_sdk.models.error_update_event400_response_error import ErrorUpdateEvent400ResponseError
from fingerprint_pro_server_api_sdk.models.error_update_event409_response import ErrorUpdateEvent409Response
from fingerprint_pro_server_api_sdk.models.error_update_event409_response_error import ErrorUpdateEvent409ResponseError
from fingerprint_pro_server_api_sdk.models.error_visitor400_response import ErrorVisitor400Response
from fingerprint_pro_server_api_sdk.models.error_visitor400_response_error import ErrorVisitor400ResponseError
from fingerprint_pro_server_api_sdk.models.error_visitor404_response import ErrorVisitor404Response
from fingerprint_pro_server_api_sdk.models.error_visitor404_response_error import ErrorVisitor404ResponseError
from fingerprint_pro_server_api_sdk.models.error_visits403 import ErrorVisits403
from fingerprint_pro_server_api_sdk.models.event_response import EventResponse
from fingerprint_pro_server_api_sdk.models.event_update_request import EventUpdateRequest
from fingerprint_pro_server_api_sdk.models.factory_reset_result import FactoryResetResult
from fingerprint_pro_server_api_sdk.models.frida_result import FridaResult
from fingerprint_pro_server_api_sdk.models.high_activity_result import HighActivityResult
Expand Down
Loading

0 comments on commit 752b1c9

Please sign in to comment.