From 436f3bfa14bbd6a4f31eaecc477324b5c0023352 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Przemys=C5=82aw=20=C5=BBydek?= Date: Thu, 26 Jan 2023 13:47:37 +0100 Subject: [PATCH] feat: change `before` parameter type in /visits endpoint BREAKING CHANGE: changed `before` parameter type from `int32` to `int64` --- docs/FingerprintApi.md | 2 +- res/fingerprint-server-api.yaml | 98 ++++++++++++++++++++++++++++++++- sdk/api_fingerprint.go | 4 +- test/GetVisits_test.go | 6 +- 4 files changed, 101 insertions(+), 9 deletions(-) diff --git a/docs/FingerprintApi.md b/docs/FingerprintApi.md index a837c2d..9285707 100644 --- a/docs/FingerprintApi.md +++ b/docs/FingerprintApi.md @@ -57,7 +57,7 @@ Name | Type | Description | Notes **requestId** | **optional.String**| Filter visits by requestId | **linkedId** | **optional.String**| Filter visits by custom identifier | **limit** | **optional.Int32**| Limit scanned results | - **before** | **optional.Int32**| Used to paginate results | + **before** | **optional.Int64**| Timestamp (in milliseconds since epoch) used to paginate results | ### Return type diff --git a/res/fingerprint-server-api.yaml b/res/fingerprint-server-api.yaml index ccd6ede..ff8a956 100644 --- a/res/fingerprint-server-api.yaml +++ b/res/fingerprint-server-api.yaml @@ -107,7 +107,7 @@ paths: ip: 61.127.217.15 time: '2019-05-21T16:40:13Z' withBotdError: - summary: Example response with BotD error + summary: Example error response with BotD error value: products: identification: @@ -158,6 +158,92 @@ paths: error: code: Failed message: internal server error + withBotdTooManyRequestsError: + summary: >- + Example error response with BotD error when too many + requests are sent + value: + products: + identification: + data: + visitorId: Ibk1527CUFmcnjLwIs4A9 + requestId: 0KSh65EnVoB85JBmloQK + incognito: true + linkedId: somelinkedId + time: '2019-05-21T16:40:13Z' + timestamp: 1582299576512 + url: https://www.example.com/login + ip: 61.127.217.15 + ipLocation: + accuracyRadius: 10 + latitude: 49.982 + longitude: 36.2566 + postalCode: '61202' + timezone: Europe/Dusseldorf + city: + name: Dusseldorf + continent: + code: EU + name: Europe + country: + code: DE + name: Germany + subdivisions: + - isoCode: '63' + name: North Rhine-Westphalia + browserDetails: + browserName: Chrome + browserMajorVersion: '74' + browserFullVersion: 74.0.3729 + os: Windows + osVersion: '7' + device: Other + userAgent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) .... + confidence: + score: 0.97 + visitorFound: true + firstSeenAt: + global: '2022-03-16T11:26:45.362Z' + subscription: '2022-03-16T11:31:01.101Z' + lastSeenAt: + global: '2022-03-16T11:28:34.023Z' + subscription: null + botd: + error: + code: TooManyRequests + message: too many requests + withIdentificationError: + summary: Example error response with identification error + value: + products: + identification: + error: + code: Failed + message: failed + botd: + data: + url: https://example.com/login + bot: + result: notDetected + ip: 61.127.217.15 + time: '2019-05-21T16:40:13Z' + withIdentificationTooManyRequestsError: + summary: >- + Example error response with identification error when too + many requests are sent + value: + products: + identification: + error: + code: 429 Too Many Requests + message: too many requests + botd: + data: + url: https://example.com/login + bot: + result: notDetected + ip: 61.127.217.15 + time: '2019-05-21T16:40:13Z' '403': description: Forbidden content: @@ -220,11 +306,11 @@ paths: format: int32 minimum: 0 - name: before - description: Used to paginate results + description: Timestamp (in milliseconds since epoch) used to paginate results in: query schema: type: integer - format: int32 + format: int64 minimum: 0 responses: '200': @@ -2935,6 +3021,12 @@ paths: application/json: schema: $ref: '#/components/schemas/ManyRequestsResponse' + examples: + example: + summary: Example too many requests error response + value: + error: + message: too many requests /webhook: trace: tags: diff --git a/sdk/api_fingerprint.go b/sdk/api_fingerprint.go index 2925566..2a1746a 100644 --- a/sdk/api_fingerprint.go +++ b/sdk/api_fingerprint.go @@ -172,7 +172,7 @@ This endpoint allows you to get a history of visits with all available informati * @param "RequestId" (optional.String) - Filter visits by requestId * @param "LinkedId" (optional.String) - Filter visits by custom identifier * @param "Limit" (optional.Int32) - Limit scanned results - * @param "Before" (optional.Int32) - Used to paginate results + * @param "Before" (optional.Int64) - Timestamp (in milliseconds since epoch) used to paginate results @return Response */ @@ -180,7 +180,7 @@ type FingerprintApiGetVisitsOpts struct { RequestId optional.String LinkedId optional.String Limit optional.Int32 - Before optional.Int32 + Before optional.Int64 } func (a *FingerprintApiService) GetVisits(ctx context.Context, visitorId string, localVarOptionals *FingerprintApiGetVisitsOpts) (Response, *http.Response, error) { diff --git a/test/GetVisits_test.go b/test/GetVisits_test.go index f8563e3..fd4f7ca 100644 --- a/test/GetVisits_test.go +++ b/test/GetVisits_test.go @@ -57,7 +57,7 @@ func TestReturnsVisits(t *testing.T) { func TestReturnsVisitsWithPagination(t *testing.T) { opts := sdk.FingerprintApiGetVisitsOpts{ RequestId: optional.NewString("request_id"), - Before: optional.NewInt32(10), + Before: optional.NewInt64(10), Limit: optional.NewInt32(500), LinkedId: optional.NewString("request_id"), } @@ -112,7 +112,7 @@ func TestReturnsVisitsWithPagination(t *testing.T) { func TestHandlesTooManyRequestsError(t *testing.T) { opts := sdk.FingerprintApiGetVisitsOpts{ RequestId: optional.NewString("request_id"), - Before: optional.NewInt32(10), + Before: optional.NewInt64(10), Limit: optional.NewInt32(500), LinkedId: optional.NewString("request_id"), } @@ -164,7 +164,7 @@ func TestHandlesTooManyRequestsError(t *testing.T) { func TestHandlesTooManyRequestsErrorWithoutRetryAfterHeader(t *testing.T) { opts := sdk.FingerprintApiGetVisitsOpts{ RequestId: optional.NewString("request_id"), - Before: optional.NewInt32(10), + Before: optional.NewInt64(10), Limit: optional.NewInt32(500), LinkedId: optional.NewString("request_id"), }