@goatlab/typesense
Version:
Modern TypeScript wrapper for Typesense search engine API
12 lines • 540 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getDocumentById = getDocumentById;
const typesense_model_1 = require("../../typesense.model");
async function getDocumentById(ctx, id, options) {
if (!(0, typesense_model_1.isValidDocumentId)(id)) {
throw new Error('Invalid document id');
}
const collectionName = options?.collection || ctx.fqcn();
return await ctx.httpClient.request(`/collections/${collectionName}/documents/${id}`);
}
//# sourceMappingURL=getDocumentById.js.map