@hubspot/api-client
Version:
NodeJS v3 [HubSpot API](https://developers.hubspot.com/docs/api/overview) SDK(Client) files
30 lines • 1.13 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.servers = exports.server1 = exports.ServerConfiguration = void 0;
const http_1 = require("./http/http");
class ServerConfiguration {
constructor(url, variableConfiguration) {
this.url = url;
this.variableConfiguration = variableConfiguration;
}
setVariables(variableConfiguration) {
Object.assign(this.variableConfiguration, variableConfiguration);
}
getConfiguration() {
return this.variableConfiguration;
}
getUrl() {
let replacedUrl = this.url;
for (const [key, value] of Object.entries(this.variableConfiguration)) {
replacedUrl = replacedUrl.replaceAll(`{${key}}`, value);
}
return replacedUrl;
}
makeRequestContext(endpoint, httpMethod) {
return new http_1.RequestContext(this.getUrl() + endpoint, httpMethod);
}
}
exports.ServerConfiguration = ServerConfiguration;
exports.server1 = new ServerConfiguration("https://api.hubapi.com", {});
exports.servers = [exports.server1];
//# sourceMappingURL=servers.js.map