Skip to content

Commit 8d50251

Browse files
algolia-botmillotp
andcommitted
fix(clients): add batchSize to accountCopyIndex (#5181) (generated) [skip ci]
Co-authored-by: Pierre Millot <[email protected]>
1 parent 256482c commit 8d50251

File tree

41 files changed

+144
-104
lines changed

Some content is hidden

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

41 files changed

+144
-104
lines changed

clients/algoliasearch-client-javascript/packages/client-search/builds/fetch.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,17 @@ export function searchClient(appId: string, apiKey: string, options?: ClientOpti
107107
* @param accountCopyIndex.destinationAppID - The application ID to write the index to.
108108
* @param accountCopyIndex.destinationApiKey - The API Key of the `destinationAppID` to write the index to, must have write ACLs.
109109
* @param accountCopyIndex.destinationIndexName - The name of the index to write the copied index to.
110+
* @param accountCopyIndex.batchSize - The size of the chunk of `objects`. Defaults to 1000.
110111
* @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `setSettings`, `saveRules`, `saveSynonyms` and `saveObjects` method and merged with the transporter requestOptions.
111112
*/
112113
async accountCopyIndex(
113-
{ sourceIndexName, destinationAppID, destinationApiKey, destinationIndexName }: AccountCopyIndexOptions,
114+
{
115+
sourceIndexName,
116+
destinationAppID,
117+
destinationApiKey,
118+
destinationIndexName,
119+
batchSize,
120+
}: AccountCopyIndexOptions,
114121
requestOptions?: RequestOptions | undefined,
115122
): Promise<void> {
116123
const responses: Array<{ taskID: UpdatedAtResponse['taskID'] }> = [];
@@ -180,10 +187,11 @@ export function searchClient(appId: string, apiKey: string, options?: ClientOpti
180187

181188
await this.browseObjects({
182189
indexName: sourceIndexName,
190+
browseParams: batchSize ? { hitsPerPage: batchSize } : undefined,
183191
async aggregator(response: BrowseResponse) {
184192
responses.push(
185193
...(await destinationClient.saveObjects(
186-
{ indexName: destinationIndexName, objects: response.hits },
194+
{ indexName: destinationIndexName, objects: response.hits, batchSize },
187195
requestOptions,
188196
)),
189197
);

clients/algoliasearch-client-javascript/packages/client-search/builds/node.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,17 @@ export function searchClient(appId: string, apiKey: string, options?: ClientOpti
107107
* @param accountCopyIndex.destinationAppID - The application ID to write the index to.
108108
* @param accountCopyIndex.destinationApiKey - The API Key of the `destinationAppID` to write the index to, must have write ACLs.
109109
* @param accountCopyIndex.destinationIndexName - The name of the index to write the copied index to.
110+
* @param accountCopyIndex.batchSize - The size of the chunk of `objects`. Defaults to 1000.
110111
* @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `setSettings`, `saveRules`, `saveSynonyms` and `saveObjects` method and merged with the transporter requestOptions.
111112
*/
112113
async accountCopyIndex(
113-
{ sourceIndexName, destinationAppID, destinationApiKey, destinationIndexName }: AccountCopyIndexOptions,
114+
{
115+
sourceIndexName,
116+
destinationAppID,
117+
destinationApiKey,
118+
destinationIndexName,
119+
batchSize,
120+
}: AccountCopyIndexOptions,
114121
requestOptions?: RequestOptions | undefined,
115122
): Promise<void> {
116123
const responses: Array<{ taskID: UpdatedAtResponse['taskID'] }> = [];
@@ -180,10 +187,11 @@ export function searchClient(appId: string, apiKey: string, options?: ClientOpti
180187

181188
await this.browseObjects({
182189
indexName: sourceIndexName,
190+
browseParams: batchSize ? { hitsPerPage: batchSize } : undefined,
183191
async aggregator(response: BrowseResponse) {
184192
responses.push(
185193
...(await destinationClient.saveObjects(
186-
{ indexName: destinationIndexName, objects: response.hits },
194+
{ indexName: destinationIndexName, objects: response.hits, batchSize },
187195
requestOptions,
188196
)),
189197
);

clients/algoliasearch-client-javascript/packages/client-search/model/clientMethodProps.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -899,4 +899,9 @@ export type AccountCopyIndexOptions = {
899899
* The name of the index to write the copy in.
900900
*/
901901
destinationIndexName: string;
902+
903+
/**
904+
* The size of the chunk of `objects`. Defaults to 1000.
905+
*/
906+
batchSize?: number | undefined;
902907
};

docs/bundled/insights-snippets.json

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

docs/bundled/search-snippets.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2346,7 +2346,7 @@
23462346
"default": "import { algoliasearch } from 'algoliasearch';"
23472347
},
23482348
"accountCopyIndex": {
2349-
"default": "const response = await client.accountCopyIndex({\n sourceIndexName: 'cts_e2e_account_copy_index_source_javascript',\n destinationAppID: 'test-app-id-destination',\n destinationApiKey: 'test-api-key-destination',\n destinationIndexName: 'cts_e2e_account_copy_index_destination_javascript',\n});"
2349+
"default": "const response = await client.accountCopyIndex({\n sourceIndexName: 'cts_e2e_account_copy_index_source_javascript',\n destinationAppID: 'test-app-id-destination',\n destinationApiKey: 'test-api-key-destination',\n destinationIndexName: 'cts_e2e_account_copy_index_destination_javascript',\n batchSize: 2,\n});"
23502350
},
23512351
"addApiKey": {
23522352
"minimal": "const response = await client.addApiKey({ acl: ['search', 'addObject'], description: 'my new api key' });",

docs/bundled/search.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4088,6 +4088,16 @@
40884088
"schema": {
40894089
"type": "string"
40904090
}
4091+
},
4092+
{
4093+
"in": "query",
4094+
"name": "batchSize",
4095+
"description": "The size of the chunk of `objects`. Defaults to 1000.",
4096+
"required": false,
4097+
"schema": {
4098+
"type": "integer",
4099+
"default": 1000
4100+
}
40914101
}
40924102
],
40934103
"responses": {

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 = 1753488000000L,
512+
Timestamp = 1753747200000L,
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 = 1753488000000L,
525+
Timestamp = 1753747200000L,
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: 1753488000000,
569+
timestamp: 1753747200000,
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: 1753488000000,
582+
timestamp: 1753747200000,
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
@@ -488,7 +488,7 @@ void snippetForPushEvents1() throws Exception {
488488
.setIndex("products")
489489
.setUserToken("user-123456")
490490
.setAuthenticatedUserToken("user-123456")
491-
.setTimestamp(1753488000000L)
491+
.setTimestamp(1753747200000L)
492492
.setObjectIDs(Arrays.asList("9780545139700", "9780439784542"))
493493
.setQueryID("43b15df305339e827f0ac0bdc5ebcaa7"),
494494
new ViewedObjectIDs()
@@ -497,7 +497,7 @@ void snippetForPushEvents1() throws Exception {
497497
.setIndex("products")
498498
.setUserToken("user-123456")
499499
.setAuthenticatedUserToken("user-123456")
500-
.setTimestamp(1753488000000L)
500+
.setTimestamp(1753747200000L)
501501
.setObjectIDs(Arrays.asList("9780545139700", "9780439784542"))
502502
)
503503
)

0 commit comments

Comments
 (0)