UNPKG

@useapi/midjourney-api

Version:

TypeScript client library for Midjourney API by useapi.net

32 lines 1.43 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.servers = exports.defaultServer = exports.ServerConfiguration = void 0; var http_1 = require("./http/http"); var ServerConfiguration = (function () { function ServerConfiguration(url, variableConfiguration) { this.url = url; this.variableConfiguration = variableConfiguration; } ServerConfiguration.prototype.setVariables = function (variableConfiguration) { Object.assign(this.variableConfiguration, variableConfiguration); }; ServerConfiguration.prototype.getConfiguration = function () { return this.variableConfiguration; }; ServerConfiguration.prototype.getUrl = function () { var replacedUrl = this.url; for (var key in this.variableConfiguration) { var re = new RegExp("{" + key + "}", "g"); replacedUrl = replacedUrl.replace(re, this.variableConfiguration[key]); } return replacedUrl; }; ServerConfiguration.prototype.makeRequestContext = function (endpoint, httpMethod) { return new http_1.RequestContext(this.getUrl() + endpoint, httpMethod); }; return ServerConfiguration; }()); exports.ServerConfiguration = ServerConfiguration; exports.defaultServer = new ServerConfiguration("https://api.useapi.net/v1", {}); exports.servers = [exports.defaultServer]; //# sourceMappingURL=servers.js.map