UNPKG

weaviate-client

Version:
34 lines (33 loc) • 1.02 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const commandBase_js_1 = require("../validation/commandBase.js"); class ClassificationsGetter extends commandBase_js_1.CommandBase { id; constructor(client) { super(client); } withId = (id) => { this.id = id; return this; }; validateIsSet = (prop, name, setter) => { if (prop == undefined || prop == null || prop.length == 0) { this.addError(`${name} must be set - set with ${setter}`); } }; validateId = () => { this.validateIsSet(this.id, 'id', '.withId(id)'); }; validate = () => { this.validateId(); }; do = () => { this.validate(); if (this.errors.length > 0) { return Promise.reject(new Error('invalid usage: ' + this.errors.join(', '))); } const path = `/classifications/${this.id}`; return this.client.get(path); }; } exports.default = ClassificationsGetter;