growthbook
Version:
The GrowthBook command-line interface (CLI) for working with the GrowthBook A/B testing, feature flagging, and experimentation platform
27 lines (26 loc) • 821 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.BaseRepository = void 0;
const node_process_1 = require("node:process");
const api_1 = require("../generated/api");
/**
* This is the class that all repositories should extend
*/
class BaseRepository {
constructor(options) {
this.apiKey = options.apiKey;
this.apiBaseUrl = options.apiBaseUrl + (options.apiVersion || '/api/v1');
}
apiConfig() {
return new api_1.Configuration({
basePath: this.apiBaseUrl,
accessToken: this.apiKey,
baseOptions: {
headers: {
'User-Agent': `growthbook-cli/${node_process_1.env.npm_package_version}`,
},
},
});
}
}
exports.BaseRepository = BaseRepository;