Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | 60x 60x 60x 55x 55x | import { LablebRequestBuilder } from "../../request/main/main.request";
import { GlobalRequestOptions, OverloadedGlobalOptions } from "../../request/main/main.request.type";
import { lablebClientBatchAutocompleteFeedback, lablebClientSingleAutocompleteFeedback } from "../autocomplete-feedback/autocomplete-feedback";
import { lablebClientAutocomplete } from "../autocomplete/autocomplete";
import { lablebClientDelete } from "../delete/delete";
import { lablebClientIndexing } from "../indexing/indexing";
import { lablebClientBatchRecommendFeedback, lablebClientSingleRecommendFeedback } from "../recommend-feedback/recommend-feedback";
import { lablebClientRecommend } from "../recommend/recommend";
import { lablebClientSearchById } from "../search-by-id/search-by-id";
import { lablebClientBatchSearchFeedback, lablebClientSingleSearchFeedback } from "../search-feedback/search-feedback";
import { lablebClientSearch } from "../search/search";
import axios from 'axios';
export function LablebClient(globalOptions: GlobalRequestOptions & OverloadedGlobalOptions = {}) {
const { interceptors, ...options } = globalOptions;
Iif (interceptors)
for (let { request, response } of interceptors) {
axios.interceptors.request.use(request.onFulfilled, request.onRejected, request.options);
axios.interceptors.response.use(response.onFulfilled, response.onRejected, response.options);
}
const requestBuilder = LablebRequestBuilder(options);
const clientContext = {
requestBuilder,
globalOptions: options,
};
return {
index: lablebClientIndexing.bind(clientContext),
delete: lablebClientDelete.bind(clientContext),
search: lablebClientSearch.bind(clientContext),
searchById: lablebClientSearchById.bind(clientContext),
autocomplete: lablebClientAutocomplete.bind(clientContext),
recommend: lablebClientRecommend.bind(clientContext),
feedback: {
search: {
single: lablebClientSingleSearchFeedback.bind(clientContext),
batch: lablebClientBatchSearchFeedback.bind(clientContext),
},
autocomplete: {
single: lablebClientSingleAutocompleteFeedback.bind(clientContext),
batch: lablebClientBatchAutocompleteFeedback.bind(clientContext),
},
recommend: {
single: lablebClientSingleRecommendFeedback.bind(clientContext),
batch: lablebClientBatchRecommendFeedback.bind(clientContext),
},
},
__defaults__: {
"API_BASE_URL": process.env.API_BASE_URL,
"GLOBAL_DEFAULT_INDEX_NAME": process.env.GLOBAL_DEFAULT_INDEX_NAME,
"GLOBAL_DEFAULT_SEARCH_HANDLER": process.env.GLOBAL_DEFAULT_SEARCH_HANDLER,
"GLOBAL_DEFAULT_AUTOCOMPLETE_HANDLER": process.env.GLOBAL_DEFAULT_AUTOCOMPLETE_HANDLER,
"GLOBAL_DEFAULT_RECOMMEND_HANDLER": process.env.GLOBAL_DEFAULT_RECOMMEND_HANDLER,
}
}
}
|