Skip to content

Commit

Permalink
docs: add searchEvents example to the readme and functional tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ilfa committed Feb 5, 2025
1 parent bee13a0 commit d380b8d
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 0 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,19 @@ public class FingerprintApiExample {
System.err.println("Exception when calling FingerprintApi.getEvent:" + e.getMessage());
}

// Search events with custom filters
try {
// By visitorId
EventsGetResponse response = api.searchEvents(LIMIT, FPJS_VISITOR_ID, null, null, null, null, null, null, null);
// Bad bot
// EventsGetResponse response = api.searchEvents(LIMIT, null, "bad", null, null, null, null, null, null);
// Filtered by IP
// EventsGetResponse response = api.searchEvents(LIMIT, null, null, "192.168.0.1/32", null, null, null, null, null);
System.out.println(response.getProducts().toString());
} catch (ApiException e) {
System.err.println("Exception when calling FingerprintApi.getEvent:" + e.getMessage());
}

// Update an event with a given requestId
try {
EventsUpdateRequest request = new EventsUpdateRequest();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,15 @@ public static void main(String... args) {
System.exit(1);
}

// Search events
try {
final Object events = api.searchEvents(2, null, "bad", null, null, null, null, null, null);
System.out.println(events);
} catch (ApiException e) {
System.err.println("Exception when calling FingerprintApi.searchEvents:" + e.getMessage());
System.exit(1);
}

// Update identification event

if (FPJS_REQUEST_ID_TO_UPDATE != null) {
Expand Down
13 changes: 13 additions & 0 deletions template/README.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,19 @@ public class FingerprintApiExample {
System.err.println("Exception when calling FingerprintApi.getEvent:" + e.getMessage());
}
// Search events with custom filters
try {
// By visitorId
EventsGetResponse response = api.searchEvents(LIMIT, FPJS_VISITOR_ID, null, null, null, null, null, null, null);
// Bad bot
// EventsGetResponse response = api.searchEvents(LIMIT, null, "bad", null, null, null, null, null, null);
// Filtered by IP
// EventsGetResponse response = api.searchEvents(LIMIT, null, null, "192.168.0.1/32", null, null, null, null, null);
System.out.println(response.getProducts().toString());
} catch (ApiException e) {
System.err.println("Exception when calling FingerprintApi.getEvent:" + e.getMessage());
}
// Update an event with a given requestId
try {
EventsUpdateRequest request = new EventsUpdateRequest();
Expand Down

0 comments on commit d380b8d

Please sign in to comment.