@openforge/elastic-enterprise-search
Version:
Official Node.js client for Elastic Enterprise Search, App Search, and Workplace Search.
259 lines • 10.7 kB
JavaScript
;
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
class API {
async createContentSource(params, options) {
const { body, ...querystring } = params !== null && params !== void 0 ? params : {};
return await this.transport.request({
method: 'POST',
path: '/api/ws/v1/sources',
querystring,
body: body
}, options);
}
async listContentSources(params, options) {
const { ...querystring } = params !== null && params !== void 0 ? params : {};
return await this.transport.request({
method: 'GET',
path: '/api/ws/v1/sources',
querystring
}, options);
}
async getContentSource(params, options) {
const { content_source_id, ...querystring } = params !== null && params !== void 0 ? params : {};
return await this.transport.request({
method: 'GET',
path: `/api/ws/v1/sources/${content_source_id}`,
querystring
}, options);
}
async putContentSource(params, options) {
const { content_source_id, body, ...querystring } = params !== null && params !== void 0 ? params : {};
return await this.transport.request({
method: 'PUT',
path: `/api/ws/v1/sources/${content_source_id}`,
querystring,
body: body
}, options);
}
async deleteContentSource(params, options) {
const { content_source_id, ...querystring } = params !== null && params !== void 0 ? params : {};
return await this.transport.request({
method: 'DELETE',
path: `/api/ws/v1/sources/${content_source_id}`,
querystring
}, options);
}
async putContentSourceIcons(params, options) {
const { content_source_id, body, ...querystring } = params !== null && params !== void 0 ? params : {};
return await this.transport.request({
method: 'PUT',
path: `/api/ws/v1/sources/${content_source_id}/icon`,
querystring,
body: body
}, options);
}
async deleteDocumentsByQuery(params, options) {
const { content_source_id, body, ...querystring } = params !== null && params !== void 0 ? params : {};
return await this.transport.request({
method: 'DELETE',
path: `/api/ws/v1/sources/${content_source_id}/documents`,
querystring,
body: body
}, options);
}
async listDocuments(params, options) {
const { content_source_id, body, ...querystring } = params !== null && params !== void 0 ? params : {};
return await this.transport.request({
method: 'POST',
path: `/api/ws/v1/sources/${content_source_id}/documents`,
querystring,
body: body
}, options);
}
async indexDocuments(params, options) {
const { content_source_id, documents, ...querystring } = params !== null && params !== void 0 ? params : {};
return await this.transport.request({
method: 'POST',
path: `/api/ws/v1/sources/${content_source_id}/documents/bulk_create`,
querystring,
body: documents
}, options);
}
async deleteDocuments(params, options) {
const { content_source_id, document_ids, ...querystring } = params !== null && params !== void 0 ? params : {};
return await this.transport.request({
method: 'POST',
path: `/api/ws/v1/sources/${content_source_id}/documents/bulk_destroy`,
querystring,
body: document_ids
}, options);
}
async getDocument(params, options) {
const { content_source_id, document_id, ...querystring } = params !== null && params !== void 0 ? params : {};
return await this.transport.request({
method: 'GET',
path: `/api/ws/v1/sources/${content_source_id}/documents/${document_id}`,
querystring
}, options);
}
async listExternalIdentities(params, options) {
const { content_source_id, ...querystring } = params !== null && params !== void 0 ? params : {};
return await this.transport.request({
method: 'GET',
path: `/api/ws/v1/sources/${content_source_id}/external_identities`,
querystring
}, options);
}
async createExternalIdentity(params, options) {
const { content_source_id, body, ...querystring } = params !== null && params !== void 0 ? params : {};
return await this.transport.request({
method: 'POST',
path: `/api/ws/v1/sources/${content_source_id}/external_identities`,
querystring,
body: body
}, options);
}
async getExternalIdentity(params, options) {
const { content_source_id, external_user_id, ...querystring } = params !== null && params !== void 0 ? params : {};
return await this.transport.request({
method: 'GET',
path: `/api/ws/v1/sources/${content_source_id}/external_identities/${external_user_id}`,
querystring
}, options);
}
async putExternalIdentity(params, options) {
const { content_source_id, external_user_id, body, ...querystring } = params !== null && params !== void 0 ? params : {};
return await this.transport.request({
method: 'PUT',
path: `/api/ws/v1/sources/${content_source_id}/external_identities/${external_user_id}`,
querystring,
body: body
}, options);
}
async deleteExternalIdentity(params, options) {
const { content_source_id, external_user_id, ...querystring } = params !== null && params !== void 0 ? params : {};
return await this.transport.request({
method: 'DELETE',
path: `/api/ws/v1/sources/${content_source_id}/external_identities/${external_user_id}`,
querystring
}, options);
}
async commandSyncJobs(params, options) {
const { content_source_id, body, ...querystring } = params !== null && params !== void 0 ? params : {};
return await this.transport.request({
method: 'POST',
path: `/api/ws/v1/sources/${content_source_id}/sync/jobs`,
querystring,
body: body
}, options);
}
async getSynonymSet(params, options) {
const { synonym_set_id, ...querystring } = params !== null && params !== void 0 ? params : {};
return await this.transport.request({
method: 'GET',
path: `/api/ws/v1/synonyms/${synonym_set_id}`,
querystring
}, options);
}
async putSynonymSet(params, options) {
const { synonym_set_id, body, ...querystring } = params !== null && params !== void 0 ? params : {};
return await this.transport.request({
method: 'PUT',
path: `/api/ws/v1/synonyms/${synonym_set_id}`,
querystring,
body: body
}, options);
}
async deleteSynonymSet(params, options) {
const { synonym_set_id, ...querystring } = params !== null && params !== void 0 ? params : {};
return await this.transport.request({
method: 'DELETE',
path: `/api/ws/v1/synonyms/${synonym_set_id}`,
querystring
}, options);
}
async listSynonymSets(params, options) {
const { body, ...querystring } = params !== null && params !== void 0 ? params : {};
return await this.transport.request({
method: 'GET',
path: '/api/ws/v1/synonyms',
querystring,
body: body
}, options);
}
async createBatchSynonymSets(params, options) {
const { body, ...querystring } = params !== null && params !== void 0 ? params : {};
return await this.transport.request({
method: 'POST',
path: '/api/ws/v1/synonyms',
querystring,
body: body
}, options);
}
async getTriggersBlocklist(params, options) {
return await this.transport.request({
method: 'GET',
path: '/api/ws/v1/automatic_query_refinement'
}, options);
}
async putTriggersBlocklist(params, options) {
const { ...querystring } = params !== null && params !== void 0 ? params : {};
return await this.transport.request({
method: 'PUT',
path: '/api/ws/v1/automatic_query_refinement',
querystring
}, options);
}
async getAutoQueryRefinementDetails(params, options) {
const { content_source_id, ...querystring } = params !== null && params !== void 0 ? params : {};
return await this.transport.request({
method: 'GET',
path: `/api/ws/v1/sources/${content_source_id}/automatic_query_refinement`,
querystring
}, options);
}
async getCurrentUser(params, options) {
return await this.transport.request({
method: 'GET',
path: '/api/ws/v1/whoami'
}, options);
}
async createAnalyticsEvent(params, options) {
const { body, ...querystring } = params !== null && params !== void 0 ? params : {};
return await this.transport.request({
method: 'POST',
path: '/api/ws/v1/analytics/event',
querystring,
body: body
}, options);
}
async search(params, options) {
const { body, ...querystring } = params !== null && params !== void 0 ? params : {};
return await this.transport.request({
method: 'POST',
path: '/api/ws/v1/search',
querystring,
body: body
}, options);
}
}
exports.default = API;
//# sourceMappingURL=api.js.map