polyv-live-cli
Version:
CLI tool for managing PolyV live streaming services.
56 lines • 1.84 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.WhitelistServiceSdk = void 0;
const polyv_live_api_sdk_1 = require("polyv-live-api-sdk");
const errors_1 = require("../utils/errors");
class WhitelistServiceSdk {
constructor(authConfig, _serviceConfig) {
this.client = new polyv_live_api_sdk_1.PolyVClient(authConfig);
this.web = this.client.web;
}
async getWhiteList(params) {
try {
const result = await this.web.getWhiteList(params);
return result;
}
catch (error) {
throw this.wrapError(error, 'getWhiteList');
}
}
async addWhiteList(params) {
try {
const result = await this.web.addWhiteList(params);
return result;
}
catch (error) {
throw this.wrapError(error, 'addWhiteList');
}
}
async updateWhiteList(params) {
try {
const result = await this.web.updateWhiteList(params);
return result;
}
catch (error) {
throw this.wrapError(error, 'updateWhiteList');
}
}
async deleteWhiteList(params) {
try {
const result = await this.web.deleteWhiteList(params);
return result;
}
catch (error) {
throw this.wrapError(error, 'deleteWhiteList');
}
}
wrapError(error, operation) {
if (error instanceof errors_1.PolyVError) {
return error;
}
const message = error instanceof Error ? error.message : String(error);
return new errors_1.PolyVError(`${operation} failed: ${message}`, 'WHITELIST_API_ERROR', 1, { originalError: error });
}
}
exports.WhitelistServiceSdk = WhitelistServiceSdk;
//# sourceMappingURL=whitelist-service.js.map