"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createRequestBuilder = exports.registerRequestBuilder = void 0;
var error_1 = require("../error");
var _builders = {};
/**
 * Registers a factory for creating request builders for the given kind. This only needs to be called in the entry point of your custom viewer bundle.
 *
 * @param kind
 * @param factory
 * @since 0.13
 */
function registerRequestBuilder(kind, factory) {
    _builders[kind] = factory;
}
exports.registerRequestBuilder = registerRequestBuilder;
/**
 * Creates the request builder for the given kind
 *
 * @param agentUri
 * @param kind
 * @since 0.13
 */
function createRequestBuilder(agentUri, kind) {
    if (_builders[kind]) {
        return _builders[kind](agentUri);
    }
    throw new error_1.MgError("Unknown or unsupported client kind: ".concat(kind));
}
exports.createRequestBuilder = createRequestBuilder;
//# sourceMappingURL=factory.js.map