Skip to content

Commit 5bdc77a

Browse files
authored
Merge branch 'main' into feat/add-query-predicate-ct
2 parents c834ace + 3fb7b4e commit 5bdc77a

File tree

58 files changed

+408
-190
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+408
-190
lines changed

clients/algoliasearch-client-dart/packages/client_composition/lib/algolia_client_composition.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,5 @@ export 'src/model/sort_remaining_by.dart';
5656
export 'src/model/supported_language.dart';
5757
export 'src/model/value.dart';
5858
export 'src/model/widgets.dart';
59+
60+
export 'src/extension.dart';
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
targets:
2+
$default:
3+
builders:
4+
json_serializable:
5+
options:
6+
any_map: false
7+
checked: true
8+
create_factory: true
9+
create_to_json: true
10+
disallow_unrecognized_keys: false
11+
explicit_to_json: true
12+
field_rename: none
13+
ignore_unannotated: false
14+
include_if_null: false
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

docs/bundled/insights-snippets.json

Lines changed: 11 additions & 11 deletions
Large diffs are not rendered by default.

docs/snippets/csharp/src/Insights.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@ public async Task SnippetForInsightsClientPushEvents1()
509509
Index = "products",
510510
UserToken = "user-123456",
511511
AuthenticatedUserToken = "user-123456",
512-
Timestamp = 1742601600000L,
512+
Timestamp = 1742860800000L,
513513
ObjectIDs = new List<string> { "9780545139700", "9780439784542" },
514514
QueryID = "43b15df305339e827f0ac0bdc5ebcaa7",
515515
}
@@ -522,7 +522,7 @@ public async Task SnippetForInsightsClientPushEvents1()
522522
Index = "products",
523523
UserToken = "user-123456",
524524
AuthenticatedUserToken = "user-123456",
525-
Timestamp = 1742601600000L,
525+
Timestamp = 1742860800000L,
526526
ObjectIDs = new List<string> { "9780545139700", "9780439784542" },
527527
}
528528
),

docs/snippets/dart/lib/insights.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,7 @@ void snippetForpushEvents1() async {
566566
index: "products",
567567
userToken: "user-123456",
568568
authenticatedUserToken: "user-123456",
569-
timestamp: 1742601600000,
569+
timestamp: 1742860800000,
570570
objectIDs: [
571571
"9780545139700",
572572
"9780439784542",
@@ -579,7 +579,7 @@ void snippetForpushEvents1() async {
579579
index: "products",
580580
userToken: "user-123456",
581581
authenticatedUserToken: "user-123456",
582-
timestamp: 1742601600000,
582+
timestamp: 1742860800000,
583583
objectIDs: [
584584
"9780545139700",
585585
"9780439784542",

docs/snippets/go/src/insights.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/snippets/java/src/test/java/com/algolia/Insights.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ void snippetForPushEvents1() throws Exception {
490490
.setIndex("products")
491491
.setUserToken("user-123456")
492492
.setAuthenticatedUserToken("user-123456")
493-
.setTimestamp(1742601600000L)
493+
.setTimestamp(1742860800000L)
494494
.setObjectIDs(Arrays.asList("9780545139700", "9780439784542"))
495495
.setQueryID("43b15df305339e827f0ac0bdc5ebcaa7"),
496496
new ViewedObjectIDs()
@@ -499,7 +499,7 @@ void snippetForPushEvents1() throws Exception {
499499
.setIndex("products")
500500
.setUserToken("user-123456")
501501
.setAuthenticatedUserToken("user-123456")
502-
.setTimestamp(1742601600000L)
502+
.setTimestamp(1742860800000L)
503503
.setObjectIDs(Arrays.asList("9780545139700", "9780439784542"))
504504
)
505505
)

docs/snippets/javascript/src/insights.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ export async function snippetForPushEvents1(): Promise<void> {
453453
index: 'products',
454454
userToken: 'user-123456',
455455
authenticatedUserToken: 'user-123456',
456-
timestamp: 1742601600000,
456+
timestamp: 1742860800000,
457457
objectIDs: ['9780545139700', '9780439784542'],
458458
queryID: '43b15df305339e827f0ac0bdc5ebcaa7',
459459
},
@@ -463,7 +463,7 @@ export async function snippetForPushEvents1(): Promise<void> {
463463
index: 'products',
464464
userToken: 'user-123456',
465465
authenticatedUserToken: 'user-123456',
466-
timestamp: 1742601600000,
466+
timestamp: 1742860800000,
467467
objectIDs: ['9780545139700', '9780439784542'],
468468
},
469469
],

docs/snippets/kotlin/src/main/kotlin/com/algolia/snippets/Insights.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,7 @@ class SnippetInsightsClient {
533533
index = "products",
534534
userToken = "user-123456",
535535
authenticatedUserToken = "user-123456",
536-
timestamp = 1742601600000L,
536+
timestamp = 1742860800000L,
537537
objectIDs = listOf("9780545139700", "9780439784542"),
538538
queryID = "43b15df305339e827f0ac0bdc5ebcaa7",
539539
),
@@ -543,7 +543,7 @@ class SnippetInsightsClient {
543543
index = "products",
544544
userToken = "user-123456",
545545
authenticatedUserToken = "user-123456",
546-
timestamp = 1742601600000L,
546+
timestamp = 1742860800000L,
547547
objectIDs = listOf("9780545139700", "9780439784542"),
548548
),
549549
),

docs/snippets/php/src/Insights.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,7 @@ public function snippetForPushEvents1(): void
589589
'index' => 'products',
590590
'userToken' => 'user-123456',
591591
'authenticatedUserToken' => 'user-123456',
592-
'timestamp' => 1742601600000,
592+
'timestamp' => 1742860800000,
593593
'objectIDs' => [
594594
'9780545139700',
595595

@@ -603,7 +603,7 @@ public function snippetForPushEvents1(): void
603603
'index' => 'products',
604604
'userToken' => 'user-123456',
605605
'authenticatedUserToken' => 'user-123456',
606-
'timestamp' => 1742601600000,
606+
'timestamp' => 1742860800000,
607607
'objectIDs' => [
608608
'9780545139700',
609609

docs/snippets/python/insights.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,7 @@ def snippet_for_push_events1():
634634
"index": "products",
635635
"userToken": "user-123456",
636636
"authenticatedUserToken": "user-123456",
637-
"timestamp": 1742601600000,
637+
"timestamp": 1742860800000,
638638
"objectIDs": [
639639
"9780545139700",
640640
"9780439784542",
@@ -647,7 +647,7 @@ def snippet_for_push_events1():
647647
"index": "products",
648648
"userToken": "user-123456",
649649
"authenticatedUserToken": "user-123456",
650-
"timestamp": 1742601600000,
650+
"timestamp": 1742860800000,
651651
"objectIDs": [
652652
"9780545139700",
653653
"9780439784542",

docs/snippets/ruby/insights.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ def snippet_for_push_events1
487487
index: "products",
488488
user_token: "user-123456",
489489
authenticated_user_token: "user-123456",
490-
timestamp: 1742601600000,
490+
timestamp: 1742860800000,
491491
object_ids: ["9780545139700", "9780439784542"],
492492
query_id: "43b15df305339e827f0ac0bdc5ebcaa7"
493493
),
@@ -497,7 +497,7 @@ def snippet_for_push_events1
497497
index: "products",
498498
user_token: "user-123456",
499499
authenticated_user_token: "user-123456",
500-
timestamp: 1742601600000,
500+
timestamp: 1742860800000,
501501
object_ids: ["9780545139700", "9780439784542"]
502502
)
503503
]

docs/snippets/scala/src/main/scala/Insights.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -623,7 +623,7 @@ class SnippetInsightsClient {
623623
index = "products",
624624
userToken = "user-123456",
625625
authenticatedUserToken = Some("user-123456"),
626-
timestamp = Some(1742601600000L),
626+
timestamp = Some(1742860800000L),
627627
objectIDs = Seq("9780545139700", "9780439784542"),
628628
queryID = "43b15df305339e827f0ac0bdc5ebcaa7"
629629
),
@@ -633,7 +633,7 @@ class SnippetInsightsClient {
633633
index = "products",
634634
userToken = "user-123456",
635635
authenticatedUserToken = Some("user-123456"),
636-
timestamp = Some(1742601600000L),
636+
timestamp = Some(1742860800000L),
637637
objectIDs = Seq("9780545139700", "9780439784542")
638638
)
639639
)

docs/snippets/swift/Sources/Insights.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ final class InsightsClientSnippet {
401401
queryID: "43b15df305339e827f0ac0bdc5ebcaa7",
402402
userToken: "user-123456",
403403
authenticatedUserToken: "user-123456",
404-
timestamp: Int64(1_742_601_600_000)
404+
timestamp: Int64(1_742_860_800_000)
405405
)),
406406
EventsItems.viewedObjectIDs(ViewedObjectIDs(
407407
eventName: "Product Detail Page Viewed",
@@ -410,7 +410,7 @@ final class InsightsClientSnippet {
410410
objectIDs: ["9780545139700", "9780439784542"],
411411
userToken: "user-123456",
412412
authenticatedUserToken: "user-123456",
413-
timestamp: Int64(1_742_601_600_000)
413+
timestamp: Int64(1_742_860_800_000)
414414
)),
415415
]))
416416
// >LOG

generators/src/main/java/com/algolia/codegen/AlgoliaGoGenerator.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ public String getName() {
2828
public void processOpts() {
2929
String client = (String) additionalProperties.get("client");
3030

31-
additionalProperties.put("packageName", client.equals("query-suggestions") ? "suggestions" : client);
31+
additionalProperties.put("packageName", client.equals("query-suggestions") ? "suggestions" : Helpers.camelize(client));
3232
additionalProperties.put("enumClassPrefix", true);
33-
additionalProperties.put("is" + Helpers.capitalize(Helpers.camelize((String) additionalProperties.get("client"))) + "Client", true);
33+
additionalProperties.put("is" + Helpers.capitalize(Helpers.camelize(client)) + "Client", true);
3434

3535
String outputFolder = "algolia" + File.separator + client;
3636
setOutputDir(getOutputDir() + File.separator + outputFolder);

generators/src/main/java/com/algolia/codegen/cts/AlgoliaCTSGenerator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ public Map<String, Object> postProcessSupportingFileData(Map<String, Object> obj
145145
// We can put whatever we want in the bundle, and it will be accessible in the template
146146
bundle.put("mode", mode);
147147
bundle.put("is" + Helpers.capitalize(Helpers.camelize(client)) + "Client", true);
148-
bundle.put("isStandaloneClient", client.contains("search") || client.contains("composition"));
148+
bundle.put("isStandaloneClient", client.contains("search") || client.contains("composition") || client.contains("realtime"));
149149
bundle.put("isSearchClient", client.contains("search")); // just so algoliasearch is treated as a search client too
150150
bundle.put("client", Helpers.createClientName(importClientName, language) + "Client");
151151
bundle.put("clientPrefix", Helpers.createClientName(importClientName, language));

generators/src/main/java/com/algolia/codegen/cts/manager/GoCTSManager.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,13 @@ public String getClient() {
2323

2424
@Override
2525
public void addDataToBundle(Map<String, Object> bundle) throws GeneratorException {
26-
Object clientPrefix = bundle.get("clientPrefix");
26+
String clientPrefix = (String) bundle.get("clientPrefix");
2727
bundle.put("clientName", Helpers.toPascalCase(this.client));
2828

2929
if (clientPrefix.equals("query-suggestions")) {
3030
bundle.put("clientPrefix", "suggestions");
31+
} else {
32+
bundle.put("clientPrefix", Helpers.camelize(clientPrefix));
3133
}
3234

3335
bundle.put("clientImport", clientPrefix);

generators/src/main/java/com/algolia/codegen/cts/manager/JavascriptCTSManager.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ public void addDataToBundle(Map<String, Object> bundle) throws GeneratorExceptio
5656
bundle.put("clientName", "compositionClient");
5757
bundle.put("importPackage", "@algolia/client-composition");
5858
break;
59+
case "realtime-personalization":
60+
bundle.put("clientName", "realtimePersonalizationClient");
61+
bundle.put("importPackage", "@algolia/client-realtime-personalization");
62+
break;
5963
case "algoliasearch":
6064
bundle.put("clientName", "liteClient");
6165
bundle.put("importPackage", "algoliasearch/lite");

generators/src/main/java/com/algolia/codegen/cts/tests/TestsRequest.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,15 @@ public void run(Map<String, CodegenModel> models, Map<String, CodegenOperation>
8181
List<Object> blocksE2E = new ArrayList<>();
8282
ParametersWithDataType paramsType = new ParametersWithDataType(models, language, client, false);
8383

84-
bundle.put("e2eAppID", client.startsWith("composition") ? "METIS_APPLICATION_ID" : "ALGOLIA_APPLICATION_ID");
84+
bundle.put(
85+
"e2eAppID",
86+
client.startsWith("composition") || client.startsWith("realtime") ? "METIS_APPLICATION_ID" : "ALGOLIA_APPLICATION_ID"
87+
);
8588
bundle.put(
8689
"e2eApiKey",
87-
client.startsWith("composition") ? "METIS_API_KEY" : (client.equals("monitoring") ? "MONITORING_API_KEY" : "ALGOLIA_ADMIN_KEY")
90+
client.startsWith("composition") || client.startsWith("realtime")
91+
? "METIS_API_KEY"
92+
: (client.equals("monitoring") ? "MONITORING_API_KEY" : "ALGOLIA_ADMIN_KEY")
8893
);
8994
bundle.put("useEchoRequester", true);
9095

playground/javascript/node/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"@algolia/client-insights": "link:../../../clients/algoliasearch-client-javascript/packages/client-insights",
1515
"@algolia/client-personalization": "link:../../../clients/algoliasearch-client-javascript/packages/client-personalization",
1616
"@algolia/client-query-suggestions": "link:../../../clients/algoliasearch-client-javascript/packages/client-query-suggestions",
17+
"@algolia/client-realtime-personalization": "link:../../../clients/algoliasearch-client-javascript/packages/client-realtime-personalization",
1718
"@algolia/client-search": "link:../../../clients/algoliasearch-client-javascript/packages/client-search",
1819
"@algolia/composition": "link:../../../clients/algoliasearch-client-javascript/packages/composition",
1920
"@algolia/ingestion": "link:../../../clients/algoliasearch-client-javascript/packages/ingestion",
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import { ApiError } from '@algolia/client-common';
2+
import { realtimePersonalizationClient } from '@algolia/client-realtime-personalization';
3+
4+
const appId = process.env.METIS_APPLICATION_ID || '**** APP_ID *****';
5+
const apiKey = process.env.METIS_API_KEY || '**** ADMIN_KEY *****';
6+
7+
// Init client with appId and apiKey
8+
const client = realtimePersonalizationClient(appId, apiKey, 'us');
9+
10+
async function testRealtimePersonalization() {
11+
try {
12+
console.log(appId, apiKey);
13+
14+
const resp = await client.getUser({userToken: "foo"});
15+
16+
console.log(resp);
17+
18+
} catch (e) {
19+
if (e instanceof ApiError) {
20+
return console.log(`[${e.status}] ${e.message}`, e.stackTrace, e);
21+
}
22+
23+
console.log('[ERROR]', e);
24+
}
25+
}
26+
27+
testRealtimePersonalization();
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
strategy:
2+
type: string
3+
enum:
4+
- session
5+
- hybrid
6+
example: 'session'
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# path
2+
UserToken:
3+
name: userToken
4+
in: path
5+
required: true
6+
description: Unique identifier representing a user for which to fetch the personalization profile.
7+
schema:
8+
$ref: '../../common/schemas/SearchParams.yml#/userToken'
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
user:
2+
type: object
3+
additionalProperties: false
4+
required:
5+
- version
6+
- userID
7+
- search
8+
properties:
9+
version:
10+
type: string
11+
description: Version of the response format.
12+
userID:
13+
type: string
14+
description: User ID of the user.
15+
search:
16+
type: object
17+
description: |
18+
Index personalization filters by index name.
19+
additionalProperties:
20+
$ref: '#/searchFilters'
21+
22+
searchFilters:
23+
type: object
24+
additionalProperties: false
25+
properties:
26+
indices:
27+
type: array
28+
items:
29+
type: string
30+
example: ['storefront', 'storefront_price_asc', 'storefront_price_desc']
31+
strategy:
32+
$ref: '../enums.yml#/strategy'
33+
filters:
34+
$ref: '#/searchFilter'
35+
36+
searchFilter:
37+
type: object
38+
additionalProperties: false
39+
properties:
40+
session:
41+
type: array
42+
items:
43+
type: string
44+
example: ['brand:Dyson<score=12>']

0 commit comments

Comments
 (0)