Skip to content

fix(playground): reflect spec changes #1790

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/pr-title.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ jobs:
- name: Pull Request title rules
uses: Slashgear/[email protected]
with:
regexp: '^(docs|chore)|((?:feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert)\((?:clients|generators|javascript|php|java|go|kotlin|dart|cts|specs|scripts|ci|templates|deps)\)): .+'
regexp: '^(docs|chore)|((?:feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert)\((?:clients|generators|playground|javascript|php|java|go|kotlin|dart|cts|specs|scripts|ci|templates|deps)\)): .+'
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ void main() async {
apiKey: '6be0576ff61c053d5f9a3225e2a90f76',
);

// Creating an InsightEvents object with a list of InsightEvent objects.
// Each InsightEvent represents an event such as a user viewing a specific item.
// Creating an InsightsEvents object with a list of EventsItems objects.
// Each EventsItems represents an event such as a user viewing a specific item.
final events = InsightsEvents(
events: [
ViewedObjectIDs(
Expand Down
10 changes: 5 additions & 5 deletions playground/dart/bin/insights.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ void main() async {
options: ClientOptions(logger: print),
);

// Creating an InsightEvents object with a list of InsightEvent objects.
// Each InsightEvent represents an event such as a user viewing a specific item.
final events = InsightEvents(
// Creating an InsightsEvents object with a list of EventsItems objects.
// Each EventsItems represents an event such as a user viewing a specific item.
final events = InsightsEvents(
events: [
InsightEvent(
ViewEvent(
eventType: EventType.view,
eventName: 'View event',
index: 'instant_search',
Expand All @@ -25,7 +25,7 @@ void main() async {
)
],
);
await insights.pushEvents(insightEvents: events);
await insights.pushEvents(insightsEvents: events);

// Close the client and dispose of all underlying resources.
insights.dispose();
Expand Down
6 changes: 4 additions & 2 deletions playground/go/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@ require (
)

require (
github.com/gabriel-vasile/mimetype v1.4.2 // indirect
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/go-playground/validator/v10 v10.12.0 // indirect
github.com/leodido/go-urn v1.2.2 // indirect
github.com/go-playground/validator/v10 v10.14.1 // indirect
github.com/leodido/go-urn v1.2.4 // indirect
golang.org/x/crypto v0.7.0 // indirect
golang.org/x/net v0.8.0 // indirect
golang.org/x/sys v0.6.0 // indirect
golang.org/x/text v0.8.0 // indirect
)
15 changes: 8 additions & 7 deletions playground/go/go.sum
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/gabriel-vasile/mimetype v1.4.2 h1:w5qFW6JKBz9Y393Y4q372O9A7cUSequkh1Q7OhCmWKU=
github.com/gabriel-vasile/mimetype v1.4.2/go.mod h1:zApsH/mKG4w07erKIaJPFiX0Tsq9BFQgN3qGY5GnNgA=
github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s=
github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA=
github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=
github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
github.com/go-playground/validator/v10 v10.12.0 h1:E4gtWgxWxp8YSxExrQFv5BpCahla0PVF2oTTEYaWQGI=
github.com/go-playground/validator/v10 v10.12.0/go.mod h1:hCAPuzYvKdP33pxWa+2+6AIKXEKqjIUyqsNCtbsSJrA=
github.com/joho/godotenv v1.4.0 h1:3l4+N6zfMWnkbPEXKng2o2/MR5mSwTrBih4ZEkkz1lg=
github.com/joho/godotenv v1.4.0/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=
github.com/go-playground/validator/v10 v10.14.1 h1:9c50NUPC30zyuKprjL3vNZ0m5oG+jU0zvx4AqHGnv4k=
github.com/go-playground/validator/v10 v10.14.1/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU=
github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0=
github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=
github.com/leodido/go-urn v1.2.2 h1:7z68G0FCGvDk646jz1AelTYNYWrTNm0bEcFAo147wt4=
github.com/leodido/go-urn v1.2.2/go.mod h1:kUaIbLZWttglzwNuG0pgsh5vuV6u2YcGBYz1hIPjtOQ=
github.com/leodido/go-urn v1.2.4 h1:XlAE/cm/ms7TE/VMVoduSpNBoyc2dOxHs5MZSwAN63Q=
github.com/leodido/go-urn v1.2.4/go.mod h1:7ZrI8mTSeBSHl/UaRyKQW1qZeMgak41ANeCNaVckg+4=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/rwtodd/Go.Sed v0.0.0-20210816025313-55464686f9ef/go.mod h1:8AEUvGVi2uQ5b24BIhcr0GCcpd/RNAFWaN2CJFrWIIQ=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
Expand All @@ -26,6 +25,8 @@ github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ
github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
golang.org/x/crypto v0.7.0 h1:AvwMYaRytfdeVt3u6mLaxYtErKYjxA2OXjJ1HHq6t3A=
golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU=
golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ=
golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc=
golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68=
Expand Down
14 changes: 7 additions & 7 deletions playground/go/insights.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,23 @@ import (
func testInsights(appID, apiKey string) int {
insightsClient := insights.NewClient(appID, apiKey, insights.US)

events := insights.NewInsightEvents([]insights.InsightEvent{
*insights.NewInsightEvent("click",
"myEvent",
events := insights.NewInsightsEvents([]insights.EventsItems{
insights.ClickedObjectIDsAsEventsItems(insights.NewClickedObjectIDs("myEvent",
insights.CLICKEVENT_CLICK,
"test_index",
[]string{"myObjectID"},
"myToken",
insights.WithInsightEventPositions([]int32{1, 2, 3}),
insights.WithInsightEventQueryID("myQueryID")),
insights.WithClickedObjectIDsTimestamp(1234567890))),
})
pushEventsResponse, err := insightsClient.PushEvents(
eventsResponse, err := insightsClient.PushEvents(
insightsClient.NewApiPushEventsRequest(events),
)
if err != nil {
fmt.Printf("request error with PushEvents: %v\n", err)
return 1
}

printResponse(pushEventsResponse)
printResponse(eventsResponse)

return 0
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ public static void main(String[] args) {
InsightsClient client = new InsightsClient(dotenv.get("ALGOLIA_APPLICATION_ID"), dotenv.get("ALGOLIA_SEARCH_KEY"));

String indexName = dotenv.get("SEARCH_INDEX");
InsightEvents params = new InsightEvents();
InsightEvent event = new InsightEvent();
event.setEventType(EventType.CLICK);
event.setUserToken("user");
event.setIndex("test_what");
event.setEventName("test");
InsightsEvents params = new InsightsEvents();
EventsItems event = EventsItems.of(new ClickedObjectIDs()
.setEventType(ClickEvent.CLICK)
.setUserToken("user")
.setIndex("test_what")
.setEventName("test"));
params.addEvents(event);

try {
PushEventsResponse result = client.pushEvents(params);
EventsResponse result = client.pushEvents(params);
System.out.println(result);
} catch (AlgoliaApiException e) {
// the API failed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ public static void main(String[] args) {
try {
List<Actor> records = Arrays.asList(new Actor("Tom Cruise"), new Actor("Scarlett Johansson"));

List<BatchOperation> batch = new ArrayList<>();
List<BatchRequest> batch = new ArrayList<>();

for (Actor record : records) {
batch.add(new BatchOperation().setAction(Action.ADD_OBJECT).setBody(record));
batch.add(new BatchRequest().setAction(Action.ADD_OBJECT).setBody(record));
}

BatchResponse response = client.batch(indexName, new BatchWriteParams().setRequests(batch));
Expand Down
1 change: 1 addition & 0 deletions playground/kotlin/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bin
30 changes: 0 additions & 30 deletions playground/kotlin/bin/main/com/algolia/playground/AbTesting.kt

This file was deleted.

25 changes: 0 additions & 25 deletions playground/kotlin/bin/main/com/algolia/playground/Analytics.kt

This file was deleted.

22 changes: 0 additions & 22 deletions playground/kotlin/bin/main/com/algolia/playground/Ingestion.kt

This file was deleted.

38 changes: 0 additions & 38 deletions playground/kotlin/bin/main/com/algolia/playground/Insights.kt

This file was deleted.

This file was deleted.

56 changes: 0 additions & 56 deletions playground/kotlin/bin/main/com/algolia/playground/Predict.kt

This file was deleted.

This file was deleted.

Loading