UNPKG

reveal-sdk-node

Version:

RevealBI Node.js SDK

81 lines (80 loc) 3.29 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.RVSharePointDataSource = void 0; const RVDashboardDataSource_1 = require("../AbstractClasses/RVDashboardDataSource"); const RVSharePointAuthenticationMethod_1 = require("./RVSharePointAuthenticationMethod"); /** SharePoint data source, contains the URL to the SharePoint site to use. */ class RVSharePointDataSource extends RVDashboardDataSource_1.RVDashboardDataSource { /** @hidden */ constructor(json) { super(json); this._url = null; /** The authentication method to use when connecting to SharePoint */ this._authenticationMethod = RVSharePointAuthenticationMethod_1.RVSharePointAuthenticationMethod.Windows; if (json) { var props = json.Properties; this._url = props['Url']; var authMethod = props['AuthenticationMethod']; if (authMethod) { this._authenticationMethod = RVSharePointAuthenticationMethod_1.RVSharePointAuthenticationMethod[authMethod]; } } } /** @hidden */ toJson() { var json = super.toJson(); var props = json.Properties; props['Url'] = this._url; const authMethodStr = RVSharePointAuthenticationMethod_1.RVSharePointAuthenticationMethod[this._authenticationMethod]; props['AuthenticationMethod'] = authMethodStr; return json; } /** @hidden */ getProviderKey() { return 'SHAREPOINT'; } /** URL to the SharePoint site (or sub site) to use */ get url() { return this._url; } set url(value) { this._url = value; } get authenticationMethod() { return this._authenticationMethod; } set authenticationMethod(value) { this._authenticationMethod = value; } /** @hidden */ getType() { return "RVSharePointDataSource"; } /** @hidden */ _getWrapper() { let wrapper = super._getWrapper(); wrapper.url(this.url); wrapper.authenticationMethod(this._convertAuthenticationMethod(this.authenticationMethod)); return wrapper; } /** @hidden */ _convertAuthenticationMethod(authMethod) { let result = null; switch (authMethod) { case RVSharePointAuthenticationMethod_1.RVSharePointAuthenticationMethod.Form: result = $.ig.RVSharePointAuthenticationMethodInternal.prototype.form; break; case RVSharePointAuthenticationMethod_1.RVSharePointAuthenticationMethod.Office365: result = $.ig.RVSharePointAuthenticationMethodInternal.prototype.office365; break; case RVSharePointAuthenticationMethod_1.RVSharePointAuthenticationMethod.WebLogin: result = $.ig.RVSharePointAuthenticationMethodInternal.prototype.webLogin; break; case RVSharePointAuthenticationMethod_1.RVSharePointAuthenticationMethod.Windows: result = $.ig.RVSharePointAuthenticationMethodInternal.prototype.windows; break; } return result; } } exports.RVSharePointDataSource = RVSharePointDataSource;