@algolia/monitoring 1.0.0-alpha.3 → 1.0.0-alpha.31
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.
- package/dist/model/clientMethodProps.d.ts +38 -38
- package/dist/model/clientMethodProps.d.ts.map +1 -1
- package/dist/{monitoring.cjs.js → monitoring.cjs} +65 -103
- package/dist/monitoring.esm.browser.js +110 -135
- package/dist/monitoring.esm.node.js +66 -104
- package/dist/monitoring.umd.js +2 -2
- package/dist/src/monitoringClient.d.ts +30 -43
- package/dist/src/monitoringClient.d.ts.map +1 -1
- package/index.js +1 -1
- package/model/clientMethodProps.ts +40 -40
- package/package.json +9 -9
|
@@ -26,14 +26,35 @@ function createBrowserLocalStorageCache(options) {
|
|
|
26
26
|
function getNamespace() {
|
|
27
27
|
return JSON.parse(getStorage().getItem(namespaceKey) || '{}');
|
|
28
28
|
}
|
|
29
|
+
function setNamespace(namespace) {
|
|
30
|
+
getStorage().setItem(namespaceKey, JSON.stringify(namespace));
|
|
31
|
+
}
|
|
32
|
+
function removeOutdatedCacheItems() {
|
|
33
|
+
const timeToLive = options.timeToLive ? options.timeToLive * 1000 : null;
|
|
34
|
+
const namespace = getNamespace();
|
|
35
|
+
const filteredNamespaceWithoutOldFormattedCacheItems = Object.fromEntries(Object.entries(namespace).filter(([, cacheItem]) => {
|
|
36
|
+
return cacheItem.timestamp !== undefined;
|
|
37
|
+
}));
|
|
38
|
+
setNamespace(filteredNamespaceWithoutOldFormattedCacheItems);
|
|
39
|
+
if (!timeToLive) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
const filteredNamespaceWithoutExpiredItems = Object.fromEntries(Object.entries(filteredNamespaceWithoutOldFormattedCacheItems).filter(([, cacheItem]) => {
|
|
43
|
+
const currentTimestamp = new Date().getTime();
|
|
44
|
+
const isExpired = cacheItem.timestamp + timeToLive < currentTimestamp;
|
|
45
|
+
return !isExpired;
|
|
46
|
+
}));
|
|
47
|
+
setNamespace(filteredNamespaceWithoutExpiredItems);
|
|
48
|
+
}
|
|
29
49
|
return {
|
|
30
50
|
get(key, defaultValue, events = {
|
|
31
51
|
miss: () => Promise.resolve()
|
|
32
52
|
}) {
|
|
33
53
|
return Promise.resolve().then(() => {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
54
|
+
removeOutdatedCacheItems();
|
|
55
|
+
return getNamespace()[JSON.stringify(key)];
|
|
56
|
+
}).then(value => {
|
|
57
|
+
return Promise.all([value ? value.value : defaultValue(), value !== undefined]);
|
|
37
58
|
}).then(([value, exists]) => {
|
|
38
59
|
return Promise.all([value, exists || events.miss(value)]);
|
|
39
60
|
}).then(([value]) => value);
|
|
@@ -41,7 +62,10 @@ function createBrowserLocalStorageCache(options) {
|
|
|
41
62
|
set(key, value) {
|
|
42
63
|
return Promise.resolve().then(() => {
|
|
43
64
|
const namespace = getNamespace();
|
|
44
|
-
namespace[JSON.stringify(key)] =
|
|
65
|
+
namespace[JSON.stringify(key)] = {
|
|
66
|
+
timestamp: new Date().getTime(),
|
|
67
|
+
value
|
|
68
|
+
};
|
|
45
69
|
getStorage().setItem(namespaceKey, JSON.stringify(namespace));
|
|
46
70
|
return value;
|
|
47
71
|
});
|
|
@@ -171,6 +195,20 @@ function createStatefulHost(host, status = 'up') {
|
|
|
171
195
|
};
|
|
172
196
|
}
|
|
173
197
|
|
|
198
|
+
function _toPrimitive(t, r) {
|
|
199
|
+
if ("object" != typeof t || !t) return t;
|
|
200
|
+
var e = t[Symbol.toPrimitive];
|
|
201
|
+
if (void 0 !== e) {
|
|
202
|
+
var i = e.call(t, r || "default");
|
|
203
|
+
if ("object" != typeof i) return i;
|
|
204
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
205
|
+
}
|
|
206
|
+
return ("string" === r ? String : Number)(t);
|
|
207
|
+
}
|
|
208
|
+
function _toPropertyKey(t) {
|
|
209
|
+
var i = _toPrimitive(t, "string");
|
|
210
|
+
return "symbol" == typeof i ? i : String(i);
|
|
211
|
+
}
|
|
174
212
|
function _defineProperty(obj, key, value) {
|
|
175
213
|
key = _toPropertyKey(key);
|
|
176
214
|
if (key in obj) {
|
|
@@ -185,20 +223,6 @@ function _defineProperty(obj, key, value) {
|
|
|
185
223
|
}
|
|
186
224
|
return obj;
|
|
187
225
|
}
|
|
188
|
-
function _toPrimitive(input, hint) {
|
|
189
|
-
if (typeof input !== "object" || input === null) return input;
|
|
190
|
-
var prim = input[Symbol.toPrimitive];
|
|
191
|
-
if (prim !== undefined) {
|
|
192
|
-
var res = prim.call(input, hint || "default");
|
|
193
|
-
if (typeof res !== "object") return res;
|
|
194
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
195
|
-
}
|
|
196
|
-
return (hint === "string" ? String : Number)(input);
|
|
197
|
-
}
|
|
198
|
-
function _toPropertyKey(arg) {
|
|
199
|
-
var key = _toPrimitive(arg, "string");
|
|
200
|
-
return typeof key === "symbol" ? key : String(key);
|
|
201
|
-
}
|
|
202
226
|
|
|
203
227
|
class AlgoliaError extends Error {
|
|
204
228
|
constructor(message, name) {
|
|
@@ -219,7 +243,7 @@ class ErrorWithStackTrace extends AlgoliaError {
|
|
|
219
243
|
}
|
|
220
244
|
class RetryError extends ErrorWithStackTrace {
|
|
221
245
|
constructor(stackTrace) {
|
|
222
|
-
super('Unreachable hosts - your application id may be incorrect. If the error persists,
|
|
246
|
+
super('Unreachable hosts - your application id may be incorrect. If the error persists, please create a ticket at https://support.algolia.com/ sharing steps we can use to reproduce the issue.', stackTrace, 'RetryError');
|
|
223
247
|
}
|
|
224
248
|
}
|
|
225
249
|
class ApiError extends ErrorWithStackTrace {
|
|
@@ -244,20 +268,9 @@ class DetailedApiError extends ApiError {
|
|
|
244
268
|
this.error = error;
|
|
245
269
|
}
|
|
246
270
|
}
|
|
247
|
-
|
|
248
|
-
function shuffle(array) {
|
|
249
|
-
const shuffledArray = array;
|
|
250
|
-
for (let c = array.length - 1; c > 0; c--) {
|
|
251
|
-
const b = Math.floor(Math.random() * (c + 1));
|
|
252
|
-
const a = array[c];
|
|
253
|
-
shuffledArray[c] = array[b];
|
|
254
|
-
shuffledArray[b] = a;
|
|
255
|
-
}
|
|
256
|
-
return shuffledArray;
|
|
257
|
-
}
|
|
258
271
|
function serializeUrl(host, path, queryParameters) {
|
|
259
272
|
const queryParametersAsString = serializeQueryParameters(queryParameters);
|
|
260
|
-
let url = `${host.protocol}://${host.url}/${path.charAt(0) === '/' ? path.
|
|
273
|
+
let url = `${host.protocol}://${host.url}${host.port ? `:${host.port}` : ''}/${path.charAt(0) === '/' ? path.substring(1) : path}`;
|
|
261
274
|
if (queryParametersAsString.length) {
|
|
262
275
|
url += `?${queryParametersAsString}`;
|
|
263
276
|
}
|
|
@@ -265,7 +278,7 @@ function serializeUrl(host, path, queryParameters) {
|
|
|
265
278
|
}
|
|
266
279
|
function serializeQueryParameters(parameters) {
|
|
267
280
|
const isObjectOrArray = value => Object.prototype.toString.call(value) === '[object Object]' || Object.prototype.toString.call(value) === '[object Array]';
|
|
268
|
-
return Object.keys(parameters).map(key => `${key}=${encodeURIComponent(isObjectOrArray(parameters[key]) ? JSON.stringify(parameters[key]) : parameters[key])}`).join('&');
|
|
281
|
+
return Object.keys(parameters).map(key => `${key}=${encodeURIComponent(isObjectOrArray(parameters[key]) ? JSON.stringify(parameters[key]) : parameters[key]).replaceAll('+', '%20')}`).join('&');
|
|
269
282
|
}
|
|
270
283
|
function serializeData(request, requestOptions) {
|
|
271
284
|
if (request.method === 'GET' || request.data === undefined && requestOptions.data === undefined) {
|
|
@@ -673,42 +686,17 @@ function createXhrRequester() {
|
|
|
673
686
|
}
|
|
674
687
|
|
|
675
688
|
// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.
|
|
676
|
-
const apiClientVersion = '1.0.0-alpha.
|
|
677
|
-
function getDefaultHosts(
|
|
689
|
+
const apiClientVersion = '1.0.0-alpha.31';
|
|
690
|
+
function getDefaultHosts() {
|
|
678
691
|
return [
|
|
679
|
-
{
|
|
680
|
-
|
|
681
|
-
accept: 'read',
|
|
682
|
-
protocol: 'https',
|
|
683
|
-
},
|
|
684
|
-
{
|
|
685
|
-
url: `${appId}.algolia.net`,
|
|
686
|
-
accept: 'write',
|
|
687
|
-
protocol: 'https',
|
|
688
|
-
},
|
|
689
|
-
].concat(shuffle([
|
|
690
|
-
{
|
|
691
|
-
url: `${appId}-1.algolianet.com`,
|
|
692
|
-
accept: 'readWrite',
|
|
693
|
-
protocol: 'https',
|
|
694
|
-
},
|
|
695
|
-
{
|
|
696
|
-
url: `${appId}-2.algolianet.com`,
|
|
697
|
-
accept: 'readWrite',
|
|
698
|
-
protocol: 'https',
|
|
699
|
-
},
|
|
700
|
-
{
|
|
701
|
-
url: `${appId}-3.algolianet.com`,
|
|
702
|
-
accept: 'readWrite',
|
|
703
|
-
protocol: 'https',
|
|
704
|
-
},
|
|
705
|
-
]));
|
|
692
|
+
{ url: 'status.algolia.com', accept: 'readWrite', protocol: 'https' },
|
|
693
|
+
];
|
|
706
694
|
}
|
|
707
695
|
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
708
696
|
function createMonitoringClient({ appId: appIdOption, apiKey: apiKeyOption, authMode, algoliaAgents, ...options }) {
|
|
709
697
|
const auth = createAuth(appIdOption, apiKeyOption, authMode);
|
|
710
698
|
const transporter = createTransporter({
|
|
711
|
-
hosts: getDefaultHosts(
|
|
699
|
+
hosts: getDefaultHosts(),
|
|
712
700
|
...options,
|
|
713
701
|
algoliaAgent: getAlgoliaAgent({
|
|
714
702
|
algoliaAgents,
|
|
@@ -758,15 +746,14 @@ function createMonitoringClient({ appId: appIdOption, apiKey: apiKeyOption, auth
|
|
|
758
746
|
/**
|
|
759
747
|
* This method allow you to send requests to the Algolia REST API.
|
|
760
748
|
*
|
|
761
|
-
* @
|
|
762
|
-
* @param
|
|
763
|
-
* @param
|
|
764
|
-
* @param del.parameters - Query parameters to apply to the current query.
|
|
749
|
+
* @param customDelete - The customDelete object.
|
|
750
|
+
* @param customDelete.path - Path of the endpoint, anything after \"/1\" must be specified.
|
|
751
|
+
* @param customDelete.parameters - Query parameters to apply to the current query.
|
|
765
752
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
766
753
|
*/
|
|
767
|
-
|
|
754
|
+
customDelete({ path, parameters }, requestOptions) {
|
|
768
755
|
if (!path) {
|
|
769
|
-
throw new Error('Parameter `path` is required when calling `
|
|
756
|
+
throw new Error('Parameter `path` is required when calling `customDelete`.');
|
|
770
757
|
}
|
|
771
758
|
const requestPath = '/1{path}'.replace('{path}', path);
|
|
772
759
|
const headers = {};
|
|
@@ -782,15 +769,14 @@ function createMonitoringClient({ appId: appIdOption, apiKey: apiKeyOption, auth
|
|
|
782
769
|
/**
|
|
783
770
|
* This method allow you to send requests to the Algolia REST API.
|
|
784
771
|
*
|
|
785
|
-
* @
|
|
786
|
-
* @param
|
|
787
|
-
* @param
|
|
788
|
-
* @param get.parameters - Query parameters to apply to the current query.
|
|
772
|
+
* @param customGet - The customGet object.
|
|
773
|
+
* @param customGet.path - Path of the endpoint, anything after \"/1\" must be specified.
|
|
774
|
+
* @param customGet.parameters - Query parameters to apply to the current query.
|
|
789
775
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
790
776
|
*/
|
|
791
|
-
|
|
777
|
+
customGet({ path, parameters }, requestOptions) {
|
|
792
778
|
if (!path) {
|
|
793
|
-
throw new Error('Parameter `path` is required when calling `
|
|
779
|
+
throw new Error('Parameter `path` is required when calling `customGet`.');
|
|
794
780
|
}
|
|
795
781
|
const requestPath = '/1{path}'.replace('{path}', path);
|
|
796
782
|
const headers = {};
|
|
@@ -803,10 +789,59 @@ function createMonitoringClient({ appId: appIdOption, apiKey: apiKeyOption, auth
|
|
|
803
789
|
};
|
|
804
790
|
return transporter.request(request, requestOptions);
|
|
805
791
|
},
|
|
792
|
+
/**
|
|
793
|
+
* This method allow you to send requests to the Algolia REST API.
|
|
794
|
+
*
|
|
795
|
+
* @param customPost - The customPost object.
|
|
796
|
+
* @param customPost.path - Path of the endpoint, anything after \"/1\" must be specified.
|
|
797
|
+
* @param customPost.parameters - Query parameters to apply to the current query.
|
|
798
|
+
* @param customPost.body - Parameters to send with the custom request.
|
|
799
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
800
|
+
*/
|
|
801
|
+
customPost({ path, parameters, body }, requestOptions) {
|
|
802
|
+
if (!path) {
|
|
803
|
+
throw new Error('Parameter `path` is required when calling `customPost`.');
|
|
804
|
+
}
|
|
805
|
+
const requestPath = '/1{path}'.replace('{path}', path);
|
|
806
|
+
const headers = {};
|
|
807
|
+
const queryParameters = parameters ? parameters : {};
|
|
808
|
+
const request = {
|
|
809
|
+
method: 'POST',
|
|
810
|
+
path: requestPath,
|
|
811
|
+
queryParameters,
|
|
812
|
+
headers,
|
|
813
|
+
data: body ? body : {},
|
|
814
|
+
};
|
|
815
|
+
return transporter.request(request, requestOptions);
|
|
816
|
+
},
|
|
817
|
+
/**
|
|
818
|
+
* This method allow you to send requests to the Algolia REST API.
|
|
819
|
+
*
|
|
820
|
+
* @param customPut - The customPut object.
|
|
821
|
+
* @param customPut.path - Path of the endpoint, anything after \"/1\" must be specified.
|
|
822
|
+
* @param customPut.parameters - Query parameters to apply to the current query.
|
|
823
|
+
* @param customPut.body - Parameters to send with the custom request.
|
|
824
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
825
|
+
*/
|
|
826
|
+
customPut({ path, parameters, body }, requestOptions) {
|
|
827
|
+
if (!path) {
|
|
828
|
+
throw new Error('Parameter `path` is required when calling `customPut`.');
|
|
829
|
+
}
|
|
830
|
+
const requestPath = '/1{path}'.replace('{path}', path);
|
|
831
|
+
const headers = {};
|
|
832
|
+
const queryParameters = parameters ? parameters : {};
|
|
833
|
+
const request = {
|
|
834
|
+
method: 'PUT',
|
|
835
|
+
path: requestPath,
|
|
836
|
+
queryParameters,
|
|
837
|
+
headers,
|
|
838
|
+
data: body ? body : {},
|
|
839
|
+
};
|
|
840
|
+
return transporter.request(request, requestOptions);
|
|
841
|
+
},
|
|
806
842
|
/**
|
|
807
843
|
* List known incidents for selected clusters.
|
|
808
844
|
*
|
|
809
|
-
* @summary List incidents for selected clusters.
|
|
810
845
|
* @param getClusterIncidents - The getClusterIncidents object.
|
|
811
846
|
* @param getClusterIncidents.clusters - Subset of clusters, separated by comma.
|
|
812
847
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
@@ -829,7 +864,6 @@ function createMonitoringClient({ appId: appIdOption, apiKey: apiKeyOption, auth
|
|
|
829
864
|
/**
|
|
830
865
|
* Report whether a cluster is operational.
|
|
831
866
|
*
|
|
832
|
-
* @summary List statuses of selected clusters.
|
|
833
867
|
* @param getClusterStatus - The getClusterStatus object.
|
|
834
868
|
* @param getClusterStatus.clusters - Subset of clusters, separated by comma.
|
|
835
869
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
@@ -852,7 +886,6 @@ function createMonitoringClient({ appId: appIdOption, apiKey: apiKeyOption, auth
|
|
|
852
886
|
/**
|
|
853
887
|
* List known incidents for all clusters.
|
|
854
888
|
*
|
|
855
|
-
* @summary List incidents.
|
|
856
889
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
857
890
|
*/
|
|
858
891
|
getIncidents(requestOptions) {
|
|
@@ -870,7 +903,6 @@ function createMonitoringClient({ appId: appIdOption, apiKey: apiKeyOption, auth
|
|
|
870
903
|
/**
|
|
871
904
|
* List the average times for indexing operations for selected clusters.
|
|
872
905
|
*
|
|
873
|
-
* @summary Get indexing times.
|
|
874
906
|
* @param getIndexingTime - The getIndexingTime object.
|
|
875
907
|
* @param getIndexingTime.clusters - Subset of clusters, separated by comma.
|
|
876
908
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
@@ -893,7 +925,6 @@ function createMonitoringClient({ appId: appIdOption, apiKey: apiKeyOption, auth
|
|
|
893
925
|
/**
|
|
894
926
|
* List the servers belonging to clusters. The response depends on whether you authenticate your API request: - With authentication, the response lists the servers assigned to your Algolia application\'s cluster. - Without authentication, the response lists the servers for all Algolia clusters.
|
|
895
927
|
*
|
|
896
|
-
* @summary List servers.
|
|
897
928
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
898
929
|
*/
|
|
899
930
|
getInventory(requestOptions) {
|
|
@@ -911,7 +942,6 @@ function createMonitoringClient({ appId: appIdOption, apiKey: apiKeyOption, auth
|
|
|
911
942
|
/**
|
|
912
943
|
* List the average latency for search requests for selected clusters.
|
|
913
944
|
*
|
|
914
|
-
* @summary Get search latency times.
|
|
915
945
|
* @param getLatency - The getLatency object.
|
|
916
946
|
* @param getLatency.clusters - Subset of clusters, separated by comma.
|
|
917
947
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
@@ -934,7 +964,6 @@ function createMonitoringClient({ appId: appIdOption, apiKey: apiKeyOption, auth
|
|
|
934
964
|
/**
|
|
935
965
|
* Report the aggregate value of a metric for a selected period of time.
|
|
936
966
|
*
|
|
937
|
-
* @summary Get metrics for a given period.
|
|
938
967
|
* @param getMetrics - The getMetrics object.
|
|
939
968
|
* @param getMetrics.metric - Metric to report. For more information about the individual metrics, see the response. To include all metrics, use `*` as the parameter.
|
|
940
969
|
* @param getMetrics.period - Period over which to aggregate the metrics: - `minute`. Aggregate the last minute. 1 data point per 10 seconds. - `hour`. Aggregate the last hour. 1 data point per minute. - `day`. Aggregate the last day. 1 data point per 10 minutes. - `week`. Aggregate the last week. 1 data point per hour. - `month`. Aggregate the last month. 1 data point per day.
|
|
@@ -963,7 +992,6 @@ function createMonitoringClient({ appId: appIdOption, apiKey: apiKeyOption, auth
|
|
|
963
992
|
/**
|
|
964
993
|
* Test whether clusters are reachable or not.
|
|
965
994
|
*
|
|
966
|
-
* @summary Test the reachability of clusters.
|
|
967
995
|
* @param getReachability - The getReachability object.
|
|
968
996
|
* @param getReachability.clusters - Subset of clusters, separated by comma.
|
|
969
997
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
@@ -986,7 +1014,6 @@ function createMonitoringClient({ appId: appIdOption, apiKey: apiKeyOption, auth
|
|
|
986
1014
|
/**
|
|
987
1015
|
* Report whether clusters are operational. The response depends on whether you authenticate your API request. - With authentication, the response includes the status of the cluster assigned to your Algolia application. - Without authentication, the response lists the statuses of all public Algolia clusters.
|
|
988
1016
|
*
|
|
989
|
-
* @summary List cluster statuses.
|
|
990
1017
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
991
1018
|
*/
|
|
992
1019
|
getStatus(requestOptions) {
|
|
@@ -1001,58 +1028,6 @@ function createMonitoringClient({ appId: appIdOption, apiKey: apiKeyOption, auth
|
|
|
1001
1028
|
};
|
|
1002
1029
|
return transporter.request(request, requestOptions);
|
|
1003
1030
|
},
|
|
1004
|
-
/**
|
|
1005
|
-
* This method allow you to send requests to the Algolia REST API.
|
|
1006
|
-
*
|
|
1007
|
-
* @summary Send requests to the Algolia REST API.
|
|
1008
|
-
* @param post - The post object.
|
|
1009
|
-
* @param post.path - Path of the endpoint, anything after \"/1\" must be specified.
|
|
1010
|
-
* @param post.parameters - Query parameters to apply to the current query.
|
|
1011
|
-
* @param post.body - Parameters to send with the custom request.
|
|
1012
|
-
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1013
|
-
*/
|
|
1014
|
-
post({ path, parameters, body }, requestOptions) {
|
|
1015
|
-
if (!path) {
|
|
1016
|
-
throw new Error('Parameter `path` is required when calling `post`.');
|
|
1017
|
-
}
|
|
1018
|
-
const requestPath = '/1{path}'.replace('{path}', path);
|
|
1019
|
-
const headers = {};
|
|
1020
|
-
const queryParameters = parameters ? parameters : {};
|
|
1021
|
-
const request = {
|
|
1022
|
-
method: 'POST',
|
|
1023
|
-
path: requestPath,
|
|
1024
|
-
queryParameters,
|
|
1025
|
-
headers,
|
|
1026
|
-
data: body ? body : {},
|
|
1027
|
-
};
|
|
1028
|
-
return transporter.request(request, requestOptions);
|
|
1029
|
-
},
|
|
1030
|
-
/**
|
|
1031
|
-
* This method allow you to send requests to the Algolia REST API.
|
|
1032
|
-
*
|
|
1033
|
-
* @summary Send requests to the Algolia REST API.
|
|
1034
|
-
* @param put - The put object.
|
|
1035
|
-
* @param put.path - Path of the endpoint, anything after \"/1\" must be specified.
|
|
1036
|
-
* @param put.parameters - Query parameters to apply to the current query.
|
|
1037
|
-
* @param put.body - Parameters to send with the custom request.
|
|
1038
|
-
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1039
|
-
*/
|
|
1040
|
-
put({ path, parameters, body }, requestOptions) {
|
|
1041
|
-
if (!path) {
|
|
1042
|
-
throw new Error('Parameter `path` is required when calling `put`.');
|
|
1043
|
-
}
|
|
1044
|
-
const requestPath = '/1{path}'.replace('{path}', path);
|
|
1045
|
-
const headers = {};
|
|
1046
|
-
const queryParameters = parameters ? parameters : {};
|
|
1047
|
-
const request = {
|
|
1048
|
-
method: 'PUT',
|
|
1049
|
-
path: requestPath,
|
|
1050
|
-
queryParameters,
|
|
1051
|
-
headers,
|
|
1052
|
-
data: body ? body : {},
|
|
1053
|
-
};
|
|
1054
|
-
return transporter.request(request, requestOptions);
|
|
1055
|
-
},
|
|
1056
1031
|
};
|
|
1057
1032
|
}
|
|
1058
1033
|
|