Skip to content

Commit

Permalink
Merge pull request #28 from fingerprintjs/feature/update-before-param…
Browse files Browse the repository at this point in the history
…eter

feat: change "before" parameter type in /visits endpoint from "int32" to "int64"
  • Loading branch information
TheUnderScorer authored Jan 30, 2023
2 parents c2245d2 + 436f3bf commit 7fb2732
Show file tree
Hide file tree
Showing 4 changed files with 101 additions and 9 deletions.
2 changes: 1 addition & 1 deletion docs/FingerprintApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
98 changes: 95 additions & 3 deletions res/fingerprint-server-api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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':
Expand Down Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions sdk/api_fingerprint.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,15 +172,15 @@ 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
*/

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) {
Expand Down
6 changes: 3 additions & 3 deletions test/GetVisits_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
}
Expand Down Expand Up @@ -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"),
}
Expand Down Expand Up @@ -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"),
}
Expand Down

0 comments on commit 7fb2732

Please sign in to comment.