Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return (
userID: string,
clusterName: string,
requestOptions?: RequestOptions
): Readonly> => {
const mappedRequestOptions = createMappedRequestOptions(requestOptions);
// eslint-disable-next-line functional/immutable-data
mappedRequestOptions.headers['X-Algolia-User-ID'] = userID;
return base.transporter.write(
{
method: MethodEnum.Post,
path: '1/clusters/mapping',
data: {
cluster: clusterName,
},
},
mappedRequestOptions
);
};
};
return (
objectID: string,
requestOptions?: RequestOptions
): Readonly> => {
const { forwardToReplicas, ...options } = requestOptions || {};
const mappedRequestOptions = createMappedRequestOptions(options);
if (forwardToReplicas) {
mappedRequestOptions.queryParameters.forwardToReplicas = 1; // eslint-disable-line functional/immutable-data
}
return createWaitablePromise(
base.transporter.write(
{
method: MethodEnum.Delete,
path: encode('1/indexes/%s/rules/%s', base.indexName, objectID),
},
mappedRequestOptions
),
(response, waitRequestOptions) => waitTask(base)(response.taskID, waitRequestOptions)
);
};
};
return (
requestOptions?: RequestOptions & ClearRulesOptions
): Readonly> => {
const { forwardToReplicas, ...options } = requestOptions || {};
const mappedRequestOptions = createMappedRequestOptions(options);
if (forwardToReplicas) {
mappedRequestOptions.queryParameters.forwardToReplicas = 1; // eslint-disable-line functional/immutable-data
}
return createWaitablePromise(
base.transporter.write(
{
method: MethodEnum.Post,
path: encode('1/indexes/%s/rules/clear', base.indexName),
},
mappedRequestOptions
),
(response, waitRequestOptions) => waitTask(base)(response.taskID, waitRequestOptions)
);
};
};
return (
objectID: string,
requestOptions?: RequestOptions & DeleteSynonymOptions
): Readonly> => {
const { forwardToReplicas, ...options } = requestOptions || {};
const mappedRequestOptions = createMappedRequestOptions(options);
if (forwardToReplicas) {
mappedRequestOptions.queryParameters.forwardToReplicas = 1; // eslint-disable-line functional/immutable-data
}
return createWaitablePromise(
base.transporter.write(
{
method: MethodEnum.Delete,
path: encode('1/indexes/%s/synonyms/%s', base.indexName, objectID),
},
mappedRequestOptions
),
(response, waitRequestOptions) => waitTask(base)(response.taskID, waitRequestOptions)
);
};
};
return (
settings: Settings,
requestOptions?: RequestOptions & SetSettingsOptions
): Readonly> => {
const { forwardToReplicas, ...options } = requestOptions || {};
const mappedRequestOptions = createMappedRequestOptions(options);
if (forwardToReplicas) {
mappedRequestOptions.queryParameters.forwardToReplicas = 1; // eslint-disable-line functional/immutable-data
}
return createWaitablePromise(
base.transporter.write(
{
method: MethodEnum.Put,
path: encode('1/indexes/%s/settings', base.indexName),
data: settings,
},
mappedRequestOptions
),
(response, waitRequestOptions) => waitTask(base)(response.taskID, waitRequestOptions)
);
return (
userID: string,
requestOptions?: RequestOptions
): Readonly> => {
const mappedRequestOptions = createMappedRequestOptions(requestOptions);
// eslint-disable-next-line functional/immutable-data
mappedRequestOptions.headers['X-Algolia-User-ID'] = userID;
return base.transporter.write(
{
method: MethodEnum.Delete,
path: '1/clusters/mapping',
},
mappedRequestOptions
);
};
};
return (
requestOptions?: ListUserIDsOptions & RequestOptions
): Readonly> => {
const { page, hitsPerPage, ...options } = requestOptions || {};
const mappedRequestOptions = createMappedRequestOptions(options);
if (page) {
mappedRequestOptions.queryParameters.page = page; // eslint-disable-line functional/immutable-data
}
if (hitsPerPage) {
mappedRequestOptions.queryParameters.hitsPerPage = hitsPerPage; // eslint-disable-line functional/immutable-data
}
return base.transporter.read(
{
method: MethodEnum.Get,
path: '1/clusters/mapping',
},
mappedRequestOptions
);
return (requestOptions?: RequestOptions): Readonly> => {
const mappedRequestOptions = createMappedRequestOptions(requestOptions);
// eslint-disable-next-line functional/immutable-data
mappedRequestOptions.queryParameters.getVersion = '2';
return base.transporter.read(
{
method: MethodEnum.Get,
path: encode('1/indexes/%s/settings', base.indexName),
},
mappedRequestOptions
);
};
};
return (
rules: readonly Rule[],
requestOptions?: RequestOptions & SaveRulesOptions
): Readonly> => {
const { forwardToReplicas, clearExistingRules, ...options } = requestOptions || {};
const mappedRequestOptions = createMappedRequestOptions(options);
if (forwardToReplicas) {
mappedRequestOptions.queryParameters.forwardToReplicas = 1; // eslint-disable-line functional/immutable-data
}
if (clearExistingRules) {
mappedRequestOptions.queryParameters.clearExistingRules = 1; // eslint-disable-line functional/immutable-data
}
return createWaitablePromise(
base.transporter.write(
{
method: MethodEnum.Post,
path: encode('1/indexes/%s/rules/batch', base.indexName),
data: rules,
},
return (
requestOptions?: ClearSynonymsOptions & RequestOptions
): Readonly> => {
const { forwardToReplicas, ...options } = requestOptions || {};
const mappedRequestOptions = createMappedRequestOptions(options);
if (forwardToReplicas) {
mappedRequestOptions.queryParameters.forwardToReplicas = 1; // eslint-disable-line functional/immutable-data
}
return createWaitablePromise(
base.transporter.write(
{
method: MethodEnum.Post,
path: encode('1/indexes/%s/synonyms/clear', base.indexName),
},
mappedRequestOptions
),
(response, waitRequestOptions) => waitTask(base)(response.taskID, waitRequestOptions)
);
};
};