@algolia/client-search 5.2.5 → 5.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,13 @@
1
1
  // src/searchClient.ts
2
- import { createAuth, createTransporter, getAlgoliaAgent, shuffle, createIterablePromise } from "@algolia/client-common";
3
- var apiClientVersion = "5.2.5";
2
+ import {
3
+ createAuth,
4
+ createTransporter,
5
+ getAlgoliaAgent,
6
+ shuffle,
7
+ ApiError,
8
+ createIterablePromise
9
+ } from "@algolia/client-common";
10
+ var apiClientVersion = "5.3.0";
4
11
  function getDefaultHosts(appId) {
5
12
  return [
6
13
  {
@@ -41,26 +48,25 @@ function createSearchClient({
41
48
  ...options
42
49
  }) {
43
50
  const auth = createAuth(appIdOption, apiKeyOption, authMode);
44
- const transporter = createTransporter({
45
- hosts: getDefaultHosts(appIdOption),
46
- ...options,
47
- algoliaAgent: getAlgoliaAgent({
48
- algoliaAgents,
49
- client: "Search",
50
- version: apiClientVersion
51
- }),
52
- baseHeaders: {
53
- "content-type": "text/plain",
54
- ...auth.headers(),
55
- ...options.baseHeaders
56
- },
57
- baseQueryParameters: {
58
- ...auth.queryParameters(),
59
- ...options.baseQueryParameters
60
- }
61
- });
62
51
  return {
63
- transporter,
52
+ transporter: createTransporter({
53
+ hosts: getDefaultHosts(appIdOption),
54
+ ...options,
55
+ algoliaAgent: getAlgoliaAgent({
56
+ algoliaAgents,
57
+ client: "Search",
58
+ version: apiClientVersion
59
+ }),
60
+ baseHeaders: {
61
+ "content-type": "text/plain",
62
+ ...auth.headers(),
63
+ ...options.baseHeaders
64
+ },
65
+ baseQueryParameters: {
66
+ ...auth.queryParameters(),
67
+ ...options.baseQueryParameters
68
+ }
69
+ }),
64
70
  /**
65
71
  * The `appId` currently in use.
66
72
  */
@@ -69,13 +75,15 @@ function createSearchClient({
69
75
  * Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
70
76
  */
71
77
  clearCache() {
72
- return Promise.all([transporter.requestsCache.clear(), transporter.responsesCache.clear()]).then(() => void 0);
78
+ return Promise.all([this.transporter.requestsCache.clear(), this.transporter.responsesCache.clear()]).then(
79
+ () => void 0
80
+ );
73
81
  },
74
82
  /**
75
83
  * Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
76
84
  */
77
85
  get _ua() {
78
- return transporter.algoliaAgent.value;
86
+ return this.transporter.algoliaAgent.value;
79
87
  },
80
88
  /**
81
89
  * Adds a `segment` to the `x-algolia-agent` sent with every requests.
@@ -84,7 +92,16 @@ function createSearchClient({
84
92
  * @param version - The version of the agent.
85
93
  */
86
94
  addAlgoliaAgent(segment, version) {
87
- transporter.algoliaAgent.add({ segment, version });
95
+ this.transporter.algoliaAgent.add({ segment, version });
96
+ },
97
+ /**
98
+ * Helper method to switch the API key used to authenticate the requests.
99
+ *
100
+ * @param params - Method params.
101
+ * @param params.apiKey - The new API Key to use.
102
+ */
103
+ setClientApiKey({ apiKey }) {
104
+ this.transporter.baseHeaders["x-algolia-api-key"] = apiKey;
88
105
  },
89
106
  /**
90
107
  * Helper: Wait for a task to be published (completed) for a given `indexName` and `taskID`.
@@ -448,6 +465,17 @@ function createSearchClient({
448
465
  });
449
466
  return { copyOperationResponse, batchResponses, moveOperationResponse };
450
467
  },
468
+ async indexExists({ indexName }) {
469
+ try {
470
+ await this.getSettings({ indexName });
471
+ } catch (error) {
472
+ if (error instanceof ApiError && error.status === 404) {
473
+ return false;
474
+ }
475
+ throw error;
476
+ }
477
+ return true;
478
+ },
451
479
  /**
452
480
  * Helper: calls the `search` method but with certainty that we will only request Algolia records (hits) and not facets.
453
481
  * Disclaimer: We don't assert that the parameters you pass to this method only contains `hits` requests to prevent impacting search performances, this helper is purely for typing purposes.
@@ -496,7 +524,7 @@ function createSearchClient({
496
524
  headers,
497
525
  data: apiKey
498
526
  };
499
- return transporter.request(request, requestOptions);
527
+ return this.transporter.request(request, requestOptions);
500
528
  },
501
529
  /**
502
530
  * If a record with the specified object ID exists, the existing record is replaced. Otherwise, a new record is added to the index. To update _some_ attributes of an existing record, use the [`partial` operation](#tag/Records/operation/partialUpdateObject) instead. To add, update, or replace multiple records, use the [`batch` operation](#tag/Records/operation/batch).
@@ -530,7 +558,7 @@ function createSearchClient({
530
558
  headers,
531
559
  data: body
532
560
  };
533
- return transporter.request(request, requestOptions);
561
+ return this.transporter.request(request, requestOptions);
534
562
  },
535
563
  /**
536
564
  * Adds a source to the list of allowed sources.
@@ -558,7 +586,7 @@ function createSearchClient({
558
586
  headers,
559
587
  data: source
560
588
  };
561
- return transporter.request(request, requestOptions);
589
+ return this.transporter.request(request, requestOptions);
562
590
  },
563
591
  /**
564
592
  * Assigns or moves a user ID to a cluster. The time it takes to move a user is proportional to the amount of data linked to the user ID.
@@ -594,7 +622,7 @@ function createSearchClient({
594
622
  headers,
595
623
  data: assignUserIdParams
596
624
  };
597
- return transporter.request(request, requestOptions);
625
+ return this.transporter.request(request, requestOptions);
598
626
  },
599
627
  /**
600
628
  * Adds, updates, or deletes records in one index with a single API request. Batching index updates reduces latency and increases data integrity. - Actions are applied in the order they\'re specified. - Actions are equivalent to the individual API requests of the same name.
@@ -624,7 +652,7 @@ function createSearchClient({
624
652
  headers,
625
653
  data: batchWriteParams
626
654
  };
627
- return transporter.request(request, requestOptions);
655
+ return this.transporter.request(request, requestOptions);
628
656
  },
629
657
  /**
630
658
  * Assigns multiple user IDs to a cluster. **You can\'t move users with this operation**.
@@ -663,7 +691,7 @@ function createSearchClient({
663
691
  headers,
664
692
  data: batchAssignUserIdsParams
665
693
  };
666
- return transporter.request(request, requestOptions);
694
+ return this.transporter.request(request, requestOptions);
667
695
  },
668
696
  /**
669
697
  * Adds or deletes multiple entries from your plurals, segmentation, or stop word dictionaries.
@@ -701,7 +729,7 @@ function createSearchClient({
701
729
  headers,
702
730
  data: batchDictionaryEntriesParams
703
731
  };
704
- return transporter.request(request, requestOptions);
732
+ return this.transporter.request(request, requestOptions);
705
733
  },
706
734
  /**
707
735
  * Retrieves records from an index, up to 1,000 per request. While searching retrieves _hits_ (records augmented with attributes for highlighting and ranking details), browsing _just_ returns matching records. This can be useful if you want to export your indices. - The Analytics API doesn\'t collect data when using `browse`. - Records are ranked by attributes and custom ranking. - There\'s no ranking for: typo-tolerance, number of matched words, proximity, geo distance. Browse requests automatically apply these settings: - `advancedSyntax`: `false` - `attributesToHighlight`: `[]` - `attributesToSnippet`: `[]` - `distinct`: `false` - `enablePersonalization`: `false` - `enableRules`: `false` - `facets`: `[]` - `getRankingInfo`: `false` - `ignorePlurals`: `false` - `optionalFilters`: `[]` - `typoTolerance`: `true` or `false` (`min` and `strict` is evaluated to `true`) If you send these parameters with your browse requests, they\'ll be ignored.
@@ -728,7 +756,7 @@ function createSearchClient({
728
756
  headers,
729
757
  data: browseParams ? browseParams : {}
730
758
  };
731
- return transporter.request(request, requestOptions);
759
+ return this.transporter.request(request, requestOptions);
732
760
  },
733
761
  /**
734
762
  * Deletes only the records from an index while keeping settings, synonyms, and rules.
@@ -753,7 +781,7 @@ function createSearchClient({
753
781
  queryParameters,
754
782
  headers
755
783
  };
756
- return transporter.request(request, requestOptions);
784
+ return this.transporter.request(request, requestOptions);
757
785
  },
758
786
  /**
759
787
  * Deletes all rules from the index.
@@ -782,7 +810,7 @@ function createSearchClient({
782
810
  queryParameters,
783
811
  headers
784
812
  };
785
- return transporter.request(request, requestOptions);
813
+ return this.transporter.request(request, requestOptions);
786
814
  },
787
815
  /**
788
816
  * Deletes all synonyms from the index.
@@ -811,7 +839,7 @@ function createSearchClient({
811
839
  queryParameters,
812
840
  headers
813
841
  };
814
- return transporter.request(request, requestOptions);
842
+ return this.transporter.request(request, requestOptions);
815
843
  },
816
844
  /**
817
845
  * This method allow you to send requests to the Algolia REST API.
@@ -834,7 +862,7 @@ function createSearchClient({
834
862
  queryParameters,
835
863
  headers
836
864
  };
837
- return transporter.request(request, requestOptions);
865
+ return this.transporter.request(request, requestOptions);
838
866
  },
839
867
  /**
840
868
  * This method allow you to send requests to the Algolia REST API.
@@ -857,7 +885,7 @@ function createSearchClient({
857
885
  queryParameters,
858
886
  headers
859
887
  };
860
- return transporter.request(request, requestOptions);
888
+ return this.transporter.request(request, requestOptions);
861
889
  },
862
890
  /**
863
891
  * This method allow you to send requests to the Algolia REST API.
@@ -882,7 +910,7 @@ function createSearchClient({
882
910
  headers,
883
911
  data: body ? body : {}
884
912
  };
885
- return transporter.request(request, requestOptions);
913
+ return this.transporter.request(request, requestOptions);
886
914
  },
887
915
  /**
888
916
  * This method allow you to send requests to the Algolia REST API.
@@ -907,7 +935,7 @@ function createSearchClient({
907
935
  headers,
908
936
  data: body ? body : {}
909
937
  };
910
- return transporter.request(request, requestOptions);
938
+ return this.transporter.request(request, requestOptions);
911
939
  },
912
940
  /**
913
941
  * Deletes the API key.
@@ -932,7 +960,7 @@ function createSearchClient({
932
960
  queryParameters,
933
961
  headers
934
962
  };
935
- return transporter.request(request, requestOptions);
963
+ return this.transporter.request(request, requestOptions);
936
964
  },
937
965
  /**
938
966
  * This operation doesn\'t accept empty queries or filters. It\'s more efficient to get a list of object IDs with the [`browse` operation](#tag/Search/operation/browse), and then delete the records using the [`batch` operation](#tag/Records/operation/batch).
@@ -962,7 +990,7 @@ function createSearchClient({
962
990
  headers,
963
991
  data: deleteByParams
964
992
  };
965
- return transporter.request(request, requestOptions);
993
+ return this.transporter.request(request, requestOptions);
966
994
  },
967
995
  /**
968
996
  * Deletes an index and all its settings. - Deleting an index doesn\'t delete its analytics data. - If you try to delete a non-existing index, the operation is ignored without warning. - If the index you want to delete has replica indices, the replicas become independent indices. - If the index you want to delete is a replica index, you must first unlink it from its primary index before you can delete it. For more information, see [Delete replica indices](https://www.algolia.com/doc/guides/managing-results/refine-results/sorting/how-to/deleting-replicas/).
@@ -987,7 +1015,7 @@ function createSearchClient({
987
1015
  queryParameters,
988
1016
  headers
989
1017
  };
990
- return transporter.request(request, requestOptions);
1018
+ return this.transporter.request(request, requestOptions);
991
1019
  },
992
1020
  /**
993
1021
  * Deletes a record by its object ID. To delete more than one record, use the [`batch` operation](#tag/Records/operation/batch). To delete records matching a query, use the [`deleteByQuery` operation](#tag/Records/operation/deleteBy).
@@ -1016,7 +1044,7 @@ function createSearchClient({
1016
1044
  queryParameters,
1017
1045
  headers
1018
1046
  };
1019
- return transporter.request(request, requestOptions);
1047
+ return this.transporter.request(request, requestOptions);
1020
1048
  },
1021
1049
  /**
1022
1050
  * Deletes a rule by its ID. To find the object ID for rules, use the [`search` operation](#tag/Rules/operation/searchRules).
@@ -1049,7 +1077,7 @@ function createSearchClient({
1049
1077
  queryParameters,
1050
1078
  headers
1051
1079
  };
1052
- return transporter.request(request, requestOptions);
1080
+ return this.transporter.request(request, requestOptions);
1053
1081
  },
1054
1082
  /**
1055
1083
  * Deletes a source from the list of allowed sources.
@@ -1074,7 +1102,7 @@ function createSearchClient({
1074
1102
  queryParameters,
1075
1103
  headers
1076
1104
  };
1077
- return transporter.request(request, requestOptions);
1105
+ return this.transporter.request(request, requestOptions);
1078
1106
  },
1079
1107
  /**
1080
1108
  * Deletes a synonym by its ID. To find the object IDs of your synonyms, use the [`search` operation](#tag/Synonyms/operation/searchSynonyms).
@@ -1107,7 +1135,7 @@ function createSearchClient({
1107
1135
  queryParameters,
1108
1136
  headers
1109
1137
  };
1110
- return transporter.request(request, requestOptions);
1138
+ return this.transporter.request(request, requestOptions);
1111
1139
  },
1112
1140
  /**
1113
1141
  * Gets the permissions and restrictions of an API key. When authenticating with the admin API key, you can request information for any of your application\'s keys. When authenticating with other API keys, you can only retrieve information for that key.
@@ -1129,7 +1157,7 @@ function createSearchClient({
1129
1157
  queryParameters,
1130
1158
  headers
1131
1159
  };
1132
- return transporter.request(request, requestOptions);
1160
+ return this.transporter.request(request, requestOptions);
1133
1161
  },
1134
1162
  /**
1135
1163
  * Checks the status of a given application task.
@@ -1154,7 +1182,7 @@ function createSearchClient({
1154
1182
  queryParameters,
1155
1183
  headers
1156
1184
  };
1157
- return transporter.request(request, requestOptions);
1185
+ return this.transporter.request(request, requestOptions);
1158
1186
  },
1159
1187
  /**
1160
1188
  * Lists supported languages with their supported dictionary types and number of custom entries.
@@ -1174,7 +1202,7 @@ function createSearchClient({
1174
1202
  queryParameters,
1175
1203
  headers
1176
1204
  };
1177
- return transporter.request(request, requestOptions);
1205
+ return this.transporter.request(request, requestOptions);
1178
1206
  },
1179
1207
  /**
1180
1208
  * Retrieves the languages for which standard dictionary entries are turned off.
@@ -1194,7 +1222,7 @@ function createSearchClient({
1194
1222
  queryParameters,
1195
1223
  headers
1196
1224
  };
1197
- return transporter.request(request, requestOptions);
1225
+ return this.transporter.request(request, requestOptions);
1198
1226
  },
1199
1227
  /**
1200
1228
  * The request must be authenticated by an API key with the [`logs` ACL](https://www.algolia.com/doc/guides/security/api-keys/#access-control-list-acl). - Logs are held for the last seven days. - Up to 1,000 API requests per server are logged. - This request counts towards your [operations quota](https://support.algolia.com/hc/en-us/articles/4406981829777-How-does-Algolia-count-records-and-operations-) but doesn\'t appear in the logs itself.
@@ -1231,7 +1259,7 @@ function createSearchClient({
1231
1259
  queryParameters,
1232
1260
  headers
1233
1261
  };
1234
- return transporter.request(request, requestOptions);
1262
+ return this.transporter.request(request, requestOptions);
1235
1263
  },
1236
1264
  /**
1237
1265
  * Retrieves one record by its object ID. To retrieve more than one record, use the [`objects` operation](#tag/Records/operation/getObjects).
@@ -1264,7 +1292,7 @@ function createSearchClient({
1264
1292
  queryParameters,
1265
1293
  headers
1266
1294
  };
1267
- return transporter.request(request, requestOptions);
1295
+ return this.transporter.request(request, requestOptions);
1268
1296
  },
1269
1297
  /**
1270
1298
  * Retrieves one or more records, potentially from different indices. Records are returned in the same order as the requests.
@@ -1294,7 +1322,7 @@ function createSearchClient({
1294
1322
  useReadTransporter: true,
1295
1323
  cacheable: true
1296
1324
  };
1297
- return transporter.request(request, requestOptions);
1325
+ return this.transporter.request(request, requestOptions);
1298
1326
  },
1299
1327
  /**
1300
1328
  * Retrieves a rule by its ID. To find the object ID of rules, use the [`search` operation](#tag/Rules/operation/searchRules).
@@ -1323,7 +1351,7 @@ function createSearchClient({
1323
1351
  queryParameters,
1324
1352
  headers
1325
1353
  };
1326
- return transporter.request(request, requestOptions);
1354
+ return this.transporter.request(request, requestOptions);
1327
1355
  },
1328
1356
  /**
1329
1357
  * Retrieves an object with non-null index settings.
@@ -1348,7 +1376,7 @@ function createSearchClient({
1348
1376
  queryParameters,
1349
1377
  headers
1350
1378
  };
1351
- return transporter.request(request, requestOptions);
1379
+ return this.transporter.request(request, requestOptions);
1352
1380
  },
1353
1381
  /**
1354
1382
  * Retrieves all allowed IP addresses with access to your application.
@@ -1368,7 +1396,7 @@ function createSearchClient({
1368
1396
  queryParameters,
1369
1397
  headers
1370
1398
  };
1371
- return transporter.request(request, requestOptions);
1399
+ return this.transporter.request(request, requestOptions);
1372
1400
  },
1373
1401
  /**
1374
1402
  * Retrieves a syonym by its ID. To find the object IDs for your synonyms, use the [`search` operation](#tag/Synonyms/operation/searchSynonyms).
@@ -1397,7 +1425,7 @@ function createSearchClient({
1397
1425
  queryParameters,
1398
1426
  headers
1399
1427
  };
1400
- return transporter.request(request, requestOptions);
1428
+ return this.transporter.request(request, requestOptions);
1401
1429
  },
1402
1430
  /**
1403
1431
  * Checks the status of a given task. Indexing tasks are asynchronous. When you add, update, or delete records or indices, a task is created on a queue and completed depending on the load on the server. The indexing tasks\' responses include a task ID that you can use to check the status.
@@ -1426,7 +1454,7 @@ function createSearchClient({
1426
1454
  queryParameters,
1427
1455
  headers
1428
1456
  };
1429
- return transporter.request(request, requestOptions);
1457
+ return this.transporter.request(request, requestOptions);
1430
1458
  },
1431
1459
  /**
1432
1460
  * Get the IDs of the 10 users with the highest number of records per cluster. Since it can take a few seconds to get the data from the different clusters, the response isn\'t real-time.
@@ -1446,7 +1474,7 @@ function createSearchClient({
1446
1474
  queryParameters,
1447
1475
  headers
1448
1476
  };
1449
- return transporter.request(request, requestOptions);
1477
+ return this.transporter.request(request, requestOptions);
1450
1478
  },
1451
1479
  /**
1452
1480
  * Returns the user ID data stored in the mapping. Since it can take a few seconds to get the data from the different clusters, the response isn\'t real-time.
@@ -1471,7 +1499,7 @@ function createSearchClient({
1471
1499
  queryParameters,
1472
1500
  headers
1473
1501
  };
1474
- return transporter.request(request, requestOptions);
1502
+ return this.transporter.request(request, requestOptions);
1475
1503
  },
1476
1504
  /**
1477
1505
  * To determine when the time-consuming process of creating a large batch of users or migrating users from one cluster to another is complete, this operation retrieves the status of the process.
@@ -1496,7 +1524,7 @@ function createSearchClient({
1496
1524
  queryParameters,
1497
1525
  headers
1498
1526
  };
1499
- return transporter.request(request, requestOptions);
1527
+ return this.transporter.request(request, requestOptions);
1500
1528
  },
1501
1529
  /**
1502
1530
  * Lists all API keys associated with your Algolia application, including their permissions and restrictions.
@@ -1516,7 +1544,7 @@ function createSearchClient({
1516
1544
  queryParameters,
1517
1545
  headers
1518
1546
  };
1519
- return transporter.request(request, requestOptions);
1547
+ return this.transporter.request(request, requestOptions);
1520
1548
  },
1521
1549
  /**
1522
1550
  * Lists the available clusters in a multi-cluster setup.
@@ -1536,7 +1564,7 @@ function createSearchClient({
1536
1564
  queryParameters,
1537
1565
  headers
1538
1566
  };
1539
- return transporter.request(request, requestOptions);
1567
+ return this.transporter.request(request, requestOptions);
1540
1568
  },
1541
1569
  /**
1542
1570
  * Lists all indices in the current Algolia application. The request follows any index restrictions of the API key you use to make the request.
@@ -1565,7 +1593,7 @@ function createSearchClient({
1565
1593
  queryParameters,
1566
1594
  headers
1567
1595
  };
1568
- return transporter.request(request, requestOptions);
1596
+ return this.transporter.request(request, requestOptions);
1569
1597
  },
1570
1598
  /**
1571
1599
  * Lists the userIDs assigned to a multi-cluster application. Since it can take a few seconds to get the data from the different clusters, the response isn\'t real-time.
@@ -1594,7 +1622,7 @@ function createSearchClient({
1594
1622
  queryParameters,
1595
1623
  headers
1596
1624
  };
1597
- return transporter.request(request, requestOptions);
1625
+ return this.transporter.request(request, requestOptions);
1598
1626
  },
1599
1627
  /**
1600
1628
  * Adds, updates, or deletes records in multiple indices with a single API request. - Actions are applied in the order they are specified. - Actions are equivalent to the individual API requests of the same name.
@@ -1619,7 +1647,7 @@ function createSearchClient({
1619
1647
  headers,
1620
1648
  data: batchParams
1621
1649
  };
1622
- return transporter.request(request, requestOptions);
1650
+ return this.transporter.request(request, requestOptions);
1623
1651
  },
1624
1652
  /**
1625
1653
  * Copies or moves (renames) an index within the same Algolia application. - Existing destination indices are overwritten, except for their analytics data. - If the destination index doesn\'t exist yet, it\'ll be created. **Copy** - Copying a source index that doesn\'t exist creates a new index with 0 records and default settings. - The API keys of the source index are merged with the existing keys in the destination index. - You can\'t copy the `enableReRanking`, `mode`, and `replicas` settings. - You can\'t copy to a destination index that already has replicas. - Be aware of the [size limits](https://www.algolia.com/doc/guides/scaling/algolia-service-limits/#application-record-and-index-limits). - Related guide: [Copy indices](https://www.algolia.com/doc/guides/sending-and-managing-data/manage-indices-and-apps/manage-indices/how-to/copy-indices/) **Move** - Moving a source index that doesn\'t exist is ignored without returning an error. - When moving an index, the analytics data keep their original name and a new set of analytics data is started for the new name. To access the original analytics in the dashboard, create an index with the original name. - If the destination index has replicas, moving will overwrite the existing index and copy the data to the replica indices. - Related guide: [Move indices](https://www.algolia.com/doc/guides/sending-and-managing-data/manage-indices-and-apps/manage-indices/how-to/move-indices/).
@@ -1655,7 +1683,7 @@ function createSearchClient({
1655
1683
  headers,
1656
1684
  data: operationIndexParams
1657
1685
  };
1658
- return transporter.request(request, requestOptions);
1686
+ return this.transporter.request(request, requestOptions);
1659
1687
  },
1660
1688
  /**
1661
1689
  * Adds new attributes to a record, or update existing ones. - If a record with the specified object ID doesn\'t exist, a new record is added to the index **if** `createIfNotExists` is true. - If the index doesn\'t exist yet, this method creates a new index. - You can use any first-level attribute but not nested attributes. If you specify a nested attribute, the engine treats it as a replacement for its first-level ancestor. To update an attribute without pushing the entire record, you can use these built-in operations. These operations can be helpful if you don\'t have access to your initial data. - Increment: increment a numeric attribute - Decrement: decrement a numeric attribute - Add: append a number or string element to an array attribute - Remove: remove all matching number or string elements from an array attribute made of numbers or strings - AddUnique: add a number or string element to an array attribute made of numbers or strings only if it\'s not already present - IncrementFrom: increment a numeric integer attribute only if the provided value matches the current value, and otherwise ignore the whole object update. For example, if you pass an IncrementFrom value of 2 for the version attribute, but the current value of the attribute is 1, the engine ignores the update. If the object doesn\'t exist, the engine only creates it if you pass an IncrementFrom value of 0. - IncrementSet: increment a numeric integer attribute only if the provided value is greater than the current value, and otherwise ignore the whole object update. For example, if you pass an IncrementSet value of 2 for the version attribute, and the current value of the attribute is 1, the engine updates the object. If the object doesn\'t exist yet, the engine only creates it if you pass an IncrementSet value that\'s greater than 0. You can specify an operation by providing an object with the attribute to update as the key and its value being an object with the following properties: - _operation: the operation to apply on the attribute - value: the right-hand side argument to the operation, for example, increment or decrement step, value to add or remove.
@@ -1693,7 +1721,7 @@ function createSearchClient({
1693
1721
  headers,
1694
1722
  data: attributesToUpdate
1695
1723
  };
1696
- return transporter.request(request, requestOptions);
1724
+ return this.transporter.request(request, requestOptions);
1697
1725
  },
1698
1726
  /**
1699
1727
  * Deletes a user ID and its associated data from the clusters.
@@ -1718,7 +1746,7 @@ function createSearchClient({
1718
1746
  queryParameters,
1719
1747
  headers
1720
1748
  };
1721
- return transporter.request(request, requestOptions);
1749
+ return this.transporter.request(request, requestOptions);
1722
1750
  },
1723
1751
  /**
1724
1752
  * Replaces the list of allowed sources.
@@ -1744,7 +1772,7 @@ function createSearchClient({
1744
1772
  headers,
1745
1773
  data: source
1746
1774
  };
1747
- return transporter.request(request, requestOptions);
1775
+ return this.transporter.request(request, requestOptions);
1748
1776
  },
1749
1777
  /**
1750
1778
  * Restores a deleted API key. Restoring resets the `validity` attribute to `0`. Algolia stores up to 1,000 API keys per application. If you create more, the oldest API keys are deleted and can\'t be restored.
@@ -1769,7 +1797,7 @@ function createSearchClient({
1769
1797
  queryParameters,
1770
1798
  headers
1771
1799
  };
1772
- return transporter.request(request, requestOptions);
1800
+ return this.transporter.request(request, requestOptions);
1773
1801
  },
1774
1802
  /**
1775
1803
  * Adds a record to an index or replace it. - If the record doesn\'t have an object ID, a new record with an auto-generated object ID is added to your index. - If a record with the specified object ID exists, the existing record is replaced. - If a record with the specified object ID doesn\'t exist, a new record is added to your index. - If you add a record to an index that doesn\'t exist yet, a new index is created. To update _some_ attributes of a record, use the [`partial` operation](#tag/Records/operation/partialUpdateObject). To add, update, or replace multiple records, use the [`batch` operation](#tag/Records/operation/batch).
@@ -1799,7 +1827,7 @@ function createSearchClient({
1799
1827
  headers,
1800
1828
  data: body
1801
1829
  };
1802
- return transporter.request(request, requestOptions);
1830
+ return this.transporter.request(request, requestOptions);
1803
1831
  },
1804
1832
  /**
1805
1833
  * If a rule with the specified object ID doesn\'t exist, it\'s created. Otherwise, the existing rule is replaced. To create or update more than one rule, use the [`batch` operation](#tag/Rules/operation/saveRules).
@@ -1840,7 +1868,7 @@ function createSearchClient({
1840
1868
  headers,
1841
1869
  data: rule
1842
1870
  };
1843
- return transporter.request(request, requestOptions);
1871
+ return this.transporter.request(request, requestOptions);
1844
1872
  },
1845
1873
  /**
1846
1874
  * Create or update multiple rules. If a rule with the specified object ID doesn\'t exist, Algolia creates a new one. Otherwise, existing rules are replaced.
@@ -1878,7 +1906,7 @@ function createSearchClient({
1878
1906
  headers,
1879
1907
  data: rules
1880
1908
  };
1881
- return transporter.request(request, requestOptions);
1909
+ return this.transporter.request(request, requestOptions);
1882
1910
  },
1883
1911
  /**
1884
1912
  * If a synonym with the specified object ID doesn\'t exist, Algolia adds a new one. Otherwise, the existing synonym is replaced. To add multiple synonyms in a single API request, use the [`batch` operation](#tag/Synonyms/operation/saveSynonyms).
@@ -1922,7 +1950,7 @@ function createSearchClient({
1922
1950
  headers,
1923
1951
  data: synonymHit
1924
1952
  };
1925
- return transporter.request(request, requestOptions);
1953
+ return this.transporter.request(request, requestOptions);
1926
1954
  },
1927
1955
  /**
1928
1956
  * If a synonym with the `objectID` doesn\'t exist, Algolia adds a new one. Otherwise, existing synonyms are replaced.
@@ -1960,7 +1988,7 @@ function createSearchClient({
1960
1988
  headers,
1961
1989
  data: synonymHit
1962
1990
  };
1963
- return transporter.request(request, requestOptions);
1991
+ return this.transporter.request(request, requestOptions);
1964
1992
  },
1965
1993
  /**
1966
1994
  * Sends multiple search request to one or more indices. This can be useful in these cases: - Different indices for different purposes, such as, one index for products, another one for marketing content. - Multiple searches to the same index—for example, with different filters.
@@ -2011,7 +2039,7 @@ function createSearchClient({
2011
2039
  useReadTransporter: true,
2012
2040
  cacheable: true
2013
2041
  };
2014
- return transporter.request(request, requestOptions);
2042
+ return this.transporter.request(request, requestOptions);
2015
2043
  },
2016
2044
  /**
2017
2045
  * Searches for standard and custom dictionary entries.
@@ -2053,7 +2081,7 @@ function createSearchClient({
2053
2081
  useReadTransporter: true,
2054
2082
  cacheable: true
2055
2083
  };
2056
- return transporter.request(request, requestOptions);
2084
+ return this.transporter.request(request, requestOptions);
2057
2085
  },
2058
2086
  /**
2059
2087
  * Searches for values of a specified facet attribute. - By default, facet values are sorted by decreasing count. You can adjust this with the `sortFacetValueBy` parameter. - Searching for facet values doesn\'t work if you have **more than 65 searchable facets and searchable attributes combined**.
@@ -2086,7 +2114,7 @@ function createSearchClient({
2086
2114
  useReadTransporter: true,
2087
2115
  cacheable: true
2088
2116
  };
2089
- return transporter.request(request, requestOptions);
2117
+ return this.transporter.request(request, requestOptions);
2090
2118
  },
2091
2119
  /**
2092
2120
  * Searches for rules in your index.
@@ -2115,7 +2143,7 @@ function createSearchClient({
2115
2143
  useReadTransporter: true,
2116
2144
  cacheable: true
2117
2145
  };
2118
- return transporter.request(request, requestOptions);
2146
+ return this.transporter.request(request, requestOptions);
2119
2147
  },
2120
2148
  /**
2121
2149
  * Searches a single index and return matching search results (_hits_). This method lets you retrieve up to 1,000 hits. If you need more, use the [`browse` operation](#tag/Search/operation/browse) or increase the `paginatedLimitedTo` index setting.
@@ -2144,7 +2172,7 @@ function createSearchClient({
2144
2172
  useReadTransporter: true,
2145
2173
  cacheable: true
2146
2174
  };
2147
- return transporter.request(request, requestOptions);
2175
+ return this.transporter.request(request, requestOptions);
2148
2176
  },
2149
2177
  /**
2150
2178
  * Searches for synonyms in your index.
@@ -2176,7 +2204,7 @@ function createSearchClient({
2176
2204
  useReadTransporter: true,
2177
2205
  cacheable: true
2178
2206
  };
2179
- return transporter.request(request, requestOptions);
2207
+ return this.transporter.request(request, requestOptions);
2180
2208
  },
2181
2209
  /**
2182
2210
  * Since it can take a few seconds to get the data from the different clusters, the response isn\'t real-time. To ensure rapid updates, the user IDs index isn\'t built at the same time as the mapping. Instead, it\'s built every 12 hours, at the same time as the update of user ID usage. For example, if you add or move a user ID, the search will show an old value until the next time the mapping is rebuilt (every 12 hours).
@@ -2206,7 +2234,7 @@ function createSearchClient({
2206
2234
  useReadTransporter: true,
2207
2235
  cacheable: true
2208
2236
  };
2209
- return transporter.request(request, requestOptions);
2237
+ return this.transporter.request(request, requestOptions);
2210
2238
  },
2211
2239
  /**
2212
2240
  * Turns standard stop word dictionary entries on or off for a given language.
@@ -2236,7 +2264,7 @@ function createSearchClient({
2236
2264
  headers,
2237
2265
  data: dictionarySettingsParams
2238
2266
  };
2239
- return transporter.request(request, requestOptions);
2267
+ return this.transporter.request(request, requestOptions);
2240
2268
  },
2241
2269
  /**
2242
2270
  * Update the specified index settings. Index settings that you don\'t specify are left unchanged. Specify `null` to reset a setting to its default value. For best performance, update the index settings before you add new records to your index.
@@ -2270,7 +2298,7 @@ function createSearchClient({
2270
2298
  headers,
2271
2299
  data: indexSettings
2272
2300
  };
2273
- return transporter.request(request, requestOptions);
2301
+ return this.transporter.request(request, requestOptions);
2274
2302
  },
2275
2303
  /**
2276
2304
  * Replaces the permissions of an existing API key. Any unspecified attribute resets that attribute to its default value.
@@ -2303,7 +2331,7 @@ function createSearchClient({
2303
2331
  headers,
2304
2332
  data: apiKey
2305
2333
  };
2306
- return transporter.request(request, requestOptions);
2334
+ return this.transporter.request(request, requestOptions);
2307
2335
  }
2308
2336
  };
2309
2337
  }