feat(analytics): add analytics rules and events support #72
+415
−18
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Change Summary
Rationale
The Typesense server provides analytics capabilities through its
/analytics
endpoints, but these features were not accessible through the Java client. Users needed to track search analytics and user interactions but had to implement their own HTTP calls or workarounds.This PR adds complete support for Analytics Rules and Events.
Changes
Added Features:
Analytics.java
):AnalyticsRules.java
,AnalyticsRule.java
):create()
: Create new analytics collection rulesupsert()
: Create or update existing rulesretrieve()
: Get single or all analytics rulesdelete()
: Remove analytics rulesAnalyticsEvents.java
):create()
: Track custom analytics eventsCode Changes:
Client.java
:Helper.java
:Documentation Updates:
README.md
:Tests:
AnalyticsRulesTest.java
: Complete test coverage for rules APIAnalyticsEventsTest.java
: Event creation and validation testsContext
This implementation addresses and closes the feature request in #71 by @danipenaperez for analytics support in the Java client. It provides a complete solution for both analytics rules and events tracking, giving users the full power of Typesense analytics.
The changes follow the existing client architecture patterns and include comprehensive tests and documentation to ensure reliable usage.
PR Checklist