fastcomments-sdk
Version:
FastComments API Client - A SDK for interacting with the FastComments API
63 lines • 2.9 kB
JavaScript
;
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.FastCommentsSDK = exports.HiddenApi = exports.PublicApi = exports.DefaultApi = exports.Configuration = void 0;
exports.createFastCommentsSDK = createFastCommentsSDK;
// Export the generated API client
__exportStar(require("./generated/api"), exports);
__exportStar(require("./generated/model"), exports);
var configuration_1 = require("./generated/configuration");
Object.defineProperty(exports, "Configuration", { enumerable: true, get: function () { return configuration_1.Configuration; } });
// Re-export commonly used types and classes for convenience
var api_1 = require("./generated/api");
Object.defineProperty(exports, "DefaultApi", { enumerable: true, get: function () { return api_1.DefaultApi; } });
Object.defineProperty(exports, "PublicApi", { enumerable: true, get: function () { return api_1.PublicApi; } });
Object.defineProperty(exports, "HiddenApi", { enumerable: true, get: function () { return api_1.HiddenApi; } });
// Export SSO functionality
__exportStar(require("./sso"), exports);
// Export a default factory function for easy initialization
const api_2 = require("./generated/api");
const configuration_2 = require("./generated/configuration");
class FastCommentsSDK {
constructor(config = {}) {
const configuration = new configuration_2.Configuration({
apiKey: config.apiKey,
basePath: config.basePath || 'https://fastcomments.com',
});
this.config = configuration;
this.defaultApi = new api_2.DefaultApi(configuration);
this.publicApi = new api_2.PublicApi(configuration);
this.hiddenApi = new api_2.HiddenApi(configuration);
}
/**
* Update the API key for authenticated requests
*/
setApiKey(apiKey) {
this.config.apiKey = apiKey;
}
/**
* Update the base path for API requests
*/
setBasePath(basePath) {
this.config.basePath = basePath;
}
}
exports.FastCommentsSDK = FastCommentsSDK;
// Export a convenience function to create a new SDK instance
function createFastCommentsSDK(config) {
return new FastCommentsSDK(config);
}
//# sourceMappingURL=index.js.map