Skip to content

Commit 7bb0720

Browse files
authored
fix(playground): reflect spec changes (#1790)
1 parent 3ff73cf commit 7bb0720

File tree

26 files changed

+66
-343
lines changed

26 files changed

+66
-343
lines changed

.github/workflows/pr-title.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ jobs:
1616
- name: Pull Request title rules
1717
uses: Slashgear/[email protected]
1818
with:
19-
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)\)): .+'
19+
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)\)): .+'

clients/algoliasearch-client-dart/packages/client_insights/example/example.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ void main() async {
77
apiKey: '6be0576ff61c053d5f9a3225e2a90f76',
88
);
99

10-
// Creating an InsightEvents object with a list of InsightEvent objects.
11-
// Each InsightEvent represents an event such as a user viewing a specific item.
10+
// Creating an InsightsEvents object with a list of EventsItems objects.
11+
// Each EventsItems represents an event such as a user viewing a specific item.
1212
final events = InsightsEvents(
1313
events: [
1414
ViewedObjectIDs(

playground/dart/bin/insights.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ void main() async {
1111
options: ClientOptions(logger: print),
1212
);
1313

14-
// Creating an InsightEvents object with a list of InsightEvent objects.
15-
// Each InsightEvent represents an event such as a user viewing a specific item.
16-
final events = InsightEvents(
14+
// Creating an InsightsEvents object with a list of EventsItems objects.
15+
// Each EventsItems represents an event such as a user viewing a specific item.
16+
final events = InsightsEvents(
1717
events: [
18-
InsightEvent(
18+
ViewEvent(
1919
eventType: EventType.view,
2020
eventName: 'View event',
2121
index: 'instant_search',
@@ -25,7 +25,7 @@ void main() async {
2525
)
2626
],
2727
);
28-
await insights.pushEvents(insightEvents: events);
28+
await insights.pushEvents(insightsEvents: events);
2929

3030
// Close the client and dispose of all underlying resources.
3131
insights.dispose();

playground/go/go.mod

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,13 @@ require (
1010
)
1111

1212
require (
13+
github.com/gabriel-vasile/mimetype v1.4.2 // indirect
1314
github.com/go-playground/locales v0.14.1 // indirect
1415
github.com/go-playground/universal-translator v0.18.1 // indirect
15-
github.com/go-playground/validator/v10 v10.12.0 // indirect
16-
github.com/leodido/go-urn v1.2.2 // indirect
16+
github.com/go-playground/validator/v10 v10.14.1 // indirect
17+
github.com/leodido/go-urn v1.2.4 // indirect
1718
golang.org/x/crypto v0.7.0 // indirect
19+
golang.org/x/net v0.8.0 // indirect
1820
golang.org/x/sys v0.6.0 // indirect
1921
golang.org/x/text v0.8.0 // indirect
2022
)

playground/go/go.sum

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,21 @@
11
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
22
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
33
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
4+
github.com/gabriel-vasile/mimetype v1.4.2 h1:w5qFW6JKBz9Y393Y4q372O9A7cUSequkh1Q7OhCmWKU=
5+
github.com/gabriel-vasile/mimetype v1.4.2/go.mod h1:zApsH/mKG4w07erKIaJPFiX0Tsq9BFQgN3qGY5GnNgA=
46
github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s=
57
github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA=
68
github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=
79
github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
810
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
9-
github.com/go-playground/validator/v10 v10.12.0 h1:E4gtWgxWxp8YSxExrQFv5BpCahla0PVF2oTTEYaWQGI=
10-
github.com/go-playground/validator/v10 v10.12.0/go.mod h1:hCAPuzYvKdP33pxWa+2+6AIKXEKqjIUyqsNCtbsSJrA=
11-
github.com/joho/godotenv v1.4.0 h1:3l4+N6zfMWnkbPEXKng2o2/MR5mSwTrBih4ZEkkz1lg=
12-
github.com/joho/godotenv v1.4.0/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=
11+
github.com/go-playground/validator/v10 v10.14.1 h1:9c50NUPC30zyuKprjL3vNZ0m5oG+jU0zvx4AqHGnv4k=
12+
github.com/go-playground/validator/v10 v10.14.1/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU=
1313
github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0=
1414
github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=
15-
github.com/leodido/go-urn v1.2.2 h1:7z68G0FCGvDk646jz1AelTYNYWrTNm0bEcFAo147wt4=
16-
github.com/leodido/go-urn v1.2.2/go.mod h1:kUaIbLZWttglzwNuG0pgsh5vuV6u2YcGBYz1hIPjtOQ=
15+
github.com/leodido/go-urn v1.2.4 h1:XlAE/cm/ms7TE/VMVoduSpNBoyc2dOxHs5MZSwAN63Q=
16+
github.com/leodido/go-urn v1.2.4/go.mod h1:7ZrI8mTSeBSHl/UaRyKQW1qZeMgak41ANeCNaVckg+4=
1717
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
1818
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
19-
github.com/rwtodd/Go.Sed v0.0.0-20210816025313-55464686f9ef/go.mod h1:8AEUvGVi2uQ5b24BIhcr0GCcpd/RNAFWaN2CJFrWIIQ=
2019
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
2120
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
2221
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
@@ -26,6 +25,8 @@ github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ
2625
github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
2726
golang.org/x/crypto v0.7.0 h1:AvwMYaRytfdeVt3u6mLaxYtErKYjxA2OXjJ1HHq6t3A=
2827
golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU=
28+
golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ=
29+
golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc=
2930
golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ=
3031
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
3132
golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68=

playground/go/insights.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,23 @@ import (
99
func testInsights(appID, apiKey string) int {
1010
insightsClient := insights.NewClient(appID, apiKey, insights.US)
1111

12-
events := insights.NewInsightEvents([]insights.InsightEvent{
13-
*insights.NewInsightEvent("click",
14-
"myEvent",
12+
events := insights.NewInsightsEvents([]insights.EventsItems{
13+
insights.ClickedObjectIDsAsEventsItems(insights.NewClickedObjectIDs("myEvent",
14+
insights.CLICKEVENT_CLICK,
1515
"test_index",
16+
[]string{"myObjectID"},
1617
"myToken",
17-
insights.WithInsightEventPositions([]int32{1, 2, 3}),
18-
insights.WithInsightEventQueryID("myQueryID")),
18+
insights.WithClickedObjectIDsTimestamp(1234567890))),
1919
})
20-
pushEventsResponse, err := insightsClient.PushEvents(
20+
eventsResponse, err := insightsClient.PushEvents(
2121
insightsClient.NewApiPushEventsRequest(events),
2222
)
2323
if err != nil {
2424
fmt.Printf("request error with PushEvents: %v\n", err)
2525
return 1
2626
}
2727

28-
printResponse(pushEventsResponse)
28+
printResponse(eventsResponse)
2929

3030
return 0
3131
}

playground/java/src/main/java/com/algolia/playground/Insights.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,16 @@ public static void main(String[] args) {
1313
InsightsClient client = new InsightsClient(dotenv.get("ALGOLIA_APPLICATION_ID"), dotenv.get("ALGOLIA_SEARCH_KEY"));
1414

1515
String indexName = dotenv.get("SEARCH_INDEX");
16-
InsightEvents params = new InsightEvents();
17-
InsightEvent event = new InsightEvent();
18-
event.setEventType(EventType.CLICK);
19-
event.setUserToken("user");
20-
event.setIndex("test_what");
21-
event.setEventName("test");
16+
InsightsEvents params = new InsightsEvents();
17+
EventsItems event = EventsItems.of(new ClickedObjectIDs()
18+
.setEventType(ClickEvent.CLICK)
19+
.setUserToken("user")
20+
.setIndex("test_what")
21+
.setEventName("test"));
2222
params.addEvents(event);
2323

2424
try {
25-
PushEventsResponse result = client.pushEvents(params);
25+
EventsResponse result = client.pushEvents(params);
2626
System.out.println(result);
2727
} catch (AlgoliaApiException e) {
2828
// the API failed

playground/java/src/main/java/com/algolia/playground/Search.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ public static void main(String[] args) {
4242
try {
4343
List<Actor> records = Arrays.asList(new Actor("Tom Cruise"), new Actor("Scarlett Johansson"));
4444

45-
List<BatchOperation> batch = new ArrayList<>();
45+
List<BatchRequest> batch = new ArrayList<>();
4646

4747
for (Actor record : records) {
48-
batch.add(new BatchOperation().setAction(Action.ADD_OBJECT).setBody(record));
48+
batch.add(new BatchRequest().setAction(Action.ADD_OBJECT).setBody(record));
4949
}
5050

5151
BatchResponse response = client.batch(indexName, new BatchWriteParams().setRequests(batch));

playground/kotlin/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
bin

playground/kotlin/bin/main/com/algolia/playground/AbTesting.kt

Lines changed: 0 additions & 30 deletions
This file was deleted.

playground/kotlin/bin/main/com/algolia/playground/Analytics.kt

Lines changed: 0 additions & 25 deletions
This file was deleted.

playground/kotlin/bin/main/com/algolia/playground/Ingestion.kt

Lines changed: 0 additions & 22 deletions
This file was deleted.

playground/kotlin/bin/main/com/algolia/playground/Insights.kt

Lines changed: 0 additions & 38 deletions
This file was deleted.

playground/kotlin/bin/main/com/algolia/playground/Personalization.kt

Lines changed: 0 additions & 23 deletions
This file was deleted.

playground/kotlin/bin/main/com/algolia/playground/Predict.kt

Lines changed: 0 additions & 56 deletions
This file was deleted.

playground/kotlin/bin/main/com/algolia/playground/QuerySuggestion.kt

Lines changed: 0 additions & 24 deletions
This file was deleted.

0 commit comments

Comments
 (0)