UNPKG

looker-sdk

Version:

The SDK for Looker's Core API for Node.js.

1,398 lines 554 kB
"use strict"; /** * Looker API 3.0 Reference * ### Authorization The Looker API uses Looker **API3** credentials for authorization and access control. Looker admins can create API3 credentials on Looker's **Admin/Users** page. Pass API3 credentials to the **_/login** endpoint to obtain a temporary access_token. Include that access_token in the Authorization header of Looker API requests. For details, see [Looker API Authorization](https://looker.com/docs/r/api/authorization) ### Client SDKs The Looker API is a RESTful system that should be usable by any programming language capable of making HTTPS requests. Client SDKs for a variety of programming languages can be generated from the Looker API's Swagger JSON metadata to streamline use of the Looker API in your applications. A client SDK for Ruby is available as an example. For more information, see [Looker API Client SDKs](https://looker.com/docs/r/api/client_sdks) ### Try It Out! The 'api-docs' page served by the Looker instance includes 'Try It Out!' buttons for each API method. After logging in with API3 credentials, you can use the \"Try It Out!\" buttons to call the API directly from the documentation page to interactively explore API features and responses. ### Versioning Future releases of Looker will expand this API release-by-release to securely expose more and more of the core power of Looker to API client applications. API endpoints marked as \"beta\" may receive breaking changes without warning. Stable (non-beta) API endpoints should not receive breaking changes in future releases. For more information, see [Looker API Versioning](https://looker.com/docs/r/api/versioning) * * OpenAPI spec version: 3.0.0 * * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ Object.defineProperty(exports, "__esModule", { value: true }); var request = require("request"); var Promise = require("bluebird"); var defaultBasePath = 'https://learnbeta.looker.com:19999/api/3.0'; // =============================================== // This file is autogenerated - Please do not edit // =============================================== /* tslint:disable:no-unused-variable */ var AccessFilter = (function () { function AccessFilter() { } return AccessFilter; }()); exports.AccessFilter = AccessFilter; var AccessToken = (function () { function AccessToken() { } return AccessToken; }()); exports.AccessToken = AccessToken; var ApiSession = (function () { function ApiSession() { } return ApiSession; }()); exports.ApiSession = ApiSession; var ApiVersion = (function () { function ApiVersion() { } return ApiVersion; }()); exports.ApiVersion = ApiVersion; var ApiVersionElement = (function () { function ApiVersionElement() { } return ApiVersionElement; }()); exports.ApiVersionElement = ApiVersionElement; var BackupConfiguration = (function () { function BackupConfiguration() { } return BackupConfiguration; }()); exports.BackupConfiguration = BackupConfiguration; var ContentFavorite = (function () { function ContentFavorite() { } return ContentFavorite; }()); exports.ContentFavorite = ContentFavorite; var ContentMeta = (function () { function ContentMeta() { } return ContentMeta; }()); exports.ContentMeta = ContentMeta; var ContentMetaGroupUser = (function () { function ContentMetaGroupUser() { } return ContentMetaGroupUser; }()); exports.ContentMetaGroupUser = ContentMetaGroupUser; var ContentView = (function () { function ContentView() { } return ContentView; }()); exports.ContentView = ContentView; var CreateDashboardRenderTask = (function () { function CreateDashboardRenderTask() { } return CreateDashboardRenderTask; }()); exports.CreateDashboardRenderTask = CreateDashboardRenderTask; var CreateQueryTask = (function () { function CreateQueryTask() { } return CreateQueryTask; }()); exports.CreateQueryTask = CreateQueryTask; var CredentialsApi = (function () { function CredentialsApi() { } return CredentialsApi; }()); exports.CredentialsApi = CredentialsApi; var CredentialsApi3 = (function () { function CredentialsApi3() { } return CredentialsApi3; }()); exports.CredentialsApi3 = CredentialsApi3; var CredentialsEmail = (function () { function CredentialsEmail() { } return CredentialsEmail; }()); exports.CredentialsEmail = CredentialsEmail; var CredentialsEmbed = (function () { function CredentialsEmbed() { } return CredentialsEmbed; }()); exports.CredentialsEmbed = CredentialsEmbed; var CredentialsGoogle = (function () { function CredentialsGoogle() { } return CredentialsGoogle; }()); exports.CredentialsGoogle = CredentialsGoogle; var CredentialsLDAP = (function () { function CredentialsLDAP() { } return CredentialsLDAP; }()); exports.CredentialsLDAP = CredentialsLDAP; var CredentialsLookerOpenid = (function () { function CredentialsLookerOpenid() { } return CredentialsLookerOpenid; }()); exports.CredentialsLookerOpenid = CredentialsLookerOpenid; var CredentialsSaml = (function () { function CredentialsSaml() { } return CredentialsSaml; }()); exports.CredentialsSaml = CredentialsSaml; var CredentialsTotp = (function () { function CredentialsTotp() { } return CredentialsTotp; }()); exports.CredentialsTotp = CredentialsTotp; var DBConnection = (function () { function DBConnection() { } return DBConnection; }()); exports.DBConnection = DBConnection; var DBConnectionBase = (function () { function DBConnectionBase() { } return DBConnectionBase; }()); exports.DBConnectionBase = DBConnectionBase; var DBConnectionTestResult = (function () { function DBConnectionTestResult() { } return DBConnectionTestResult; }()); exports.DBConnectionTestResult = DBConnectionTestResult; var Dashboard = (function () { function Dashboard() { } return Dashboard; }()); exports.Dashboard = Dashboard; var DashboardBase = (function () { function DashboardBase() { } return DashboardBase; }()); exports.DashboardBase = DashboardBase; var DashboardElement = (function () { function DashboardElement() { } return DashboardElement; }()); exports.DashboardElement = DashboardElement; var DashboardFilter = (function () { function DashboardFilter() { } return DashboardFilter; }()); exports.DashboardFilter = DashboardFilter; var DashboardLayout = (function () { function DashboardLayout() { } return DashboardLayout; }()); exports.DashboardLayout = DashboardLayout; var DashboardLayoutComponent = (function () { function DashboardLayoutComponent() { } return DashboardLayoutComponent; }()); exports.DashboardLayoutComponent = DashboardLayoutComponent; var DataActionForm = (function () { function DataActionForm() { } return DataActionForm; }()); exports.DataActionForm = DataActionForm; var DataActionFormField = (function () { function DataActionFormField() { } return DataActionFormField; }()); exports.DataActionFormField = DataActionFormField; var DataActionFormSelectOption = (function () { function DataActionFormSelectOption() { } return DataActionFormSelectOption; }()); exports.DataActionFormSelectOption = DataActionFormSelectOption; var DataActionRequest = (function () { function DataActionRequest() { } return DataActionRequest; }()); exports.DataActionRequest = DataActionRequest; var DataActionResponse = (function () { function DataActionResponse() { } return DataActionResponse; }()); exports.DataActionResponse = DataActionResponse; var Datagroup = (function () { function Datagroup() { } return Datagroup; }()); exports.Datagroup = Datagroup; var Dialect = (function () { function Dialect() { } return Dialect; }()); exports.Dialect = Dialect; var DialectInfo = (function () { function DialectInfo() { } return DialectInfo; }()); exports.DialectInfo = DialectInfo; var DialectInfoOptions = (function () { function DialectInfoOptions() { } return DialectInfoOptions; }()); exports.DialectInfoOptions = DialectInfoOptions; var GitStatus = (function () { function GitStatus() { } return GitStatus; }()); exports.GitStatus = GitStatus; var Group = (function () { function Group() { } return Group; }()); exports.Group = Group; var GroupIdForGroupInclusion = (function () { function GroupIdForGroupInclusion() { } return GroupIdForGroupInclusion; }()); exports.GroupIdForGroupInclusion = GroupIdForGroupInclusion; var GroupIdForGroupUserInclusion = (function () { function GroupIdForGroupUserInclusion() { } return GroupIdForGroupUserInclusion; }()); exports.GroupIdForGroupUserInclusion = GroupIdForGroupUserInclusion; var HomepageItem = (function () { function HomepageItem() { } return HomepageItem; }()); exports.HomepageItem = HomepageItem; var HomepageSection = (function () { function HomepageSection() { } return HomepageSection; }()); exports.HomepageSection = HomepageSection; var LDAPConfig = (function () { function LDAPConfig() { } return LDAPConfig; }()); exports.LDAPConfig = LDAPConfig; var LDAPConfigTestResult = (function () { function LDAPConfigTestResult() { } return LDAPConfigTestResult; }()); exports.LDAPConfigTestResult = LDAPConfigTestResult; var LDAPGroupRead = (function () { function LDAPGroupRead() { } return LDAPGroupRead; }()); exports.LDAPGroupRead = LDAPGroupRead; var LDAPGroupWrite = (function () { function LDAPGroupWrite() { } return LDAPGroupWrite; }()); exports.LDAPGroupWrite = LDAPGroupWrite; var LDAPUser = (function () { function LDAPUser() { } return LDAPUser; }()); exports.LDAPUser = LDAPUser; var LegacyFeature = (function () { function LegacyFeature() { } return LegacyFeature; }()); exports.LegacyFeature = LegacyFeature; var Look = (function () { function Look() { } return Look; }()); exports.Look = Look; var LookBasic = (function () { function LookBasic() { } return LookBasic; }()); exports.LookBasic = LookBasic; var LookModel = (function () { function LookModel() { } return LookModel; }()); exports.LookModel = LookModel; var LookWithDashboards = (function () { function LookWithDashboards() { } return LookWithDashboards; }()); exports.LookWithDashboards = LookWithDashboards; var LookWithQuery = (function () { function LookWithQuery() { } return LookWithQuery; }()); exports.LookWithQuery = LookWithQuery; var LookmlModel = (function () { function LookmlModel() { } return LookmlModel; }()); exports.LookmlModel = LookmlModel; var LookmlModelExplore = (function () { function LookmlModelExplore() { } return LookmlModelExplore; }()); exports.LookmlModelExplore = LookmlModelExplore; var LookmlModelExploreAccessFilter = (function () { function LookmlModelExploreAccessFilter() { } return LookmlModelExploreAccessFilter; }()); exports.LookmlModelExploreAccessFilter = LookmlModelExploreAccessFilter; var LookmlModelExploreAlias = (function () { function LookmlModelExploreAlias() { } return LookmlModelExploreAlias; }()); exports.LookmlModelExploreAlias = LookmlModelExploreAlias; var LookmlModelExploreAlwaysFilter = (function () { function LookmlModelExploreAlwaysFilter() { } return LookmlModelExploreAlwaysFilter; }()); exports.LookmlModelExploreAlwaysFilter = LookmlModelExploreAlwaysFilter; var LookmlModelExploreConditionallyFilter = (function () { function LookmlModelExploreConditionallyFilter() { } return LookmlModelExploreConditionallyFilter; }()); exports.LookmlModelExploreConditionallyFilter = LookmlModelExploreConditionallyFilter; var LookmlModelExploreError = (function () { function LookmlModelExploreError() { } return LookmlModelExploreError; }()); exports.LookmlModelExploreError = LookmlModelExploreError; var LookmlModelExploreField = (function () { function LookmlModelExploreField() { } return LookmlModelExploreField; }()); exports.LookmlModelExploreField = LookmlModelExploreField; var LookmlModelExploreFieldEnumeration = (function () { function LookmlModelExploreFieldEnumeration() { } return LookmlModelExploreFieldEnumeration; }()); exports.LookmlModelExploreFieldEnumeration = LookmlModelExploreFieldEnumeration; var LookmlModelExploreFieldSqlCase = (function () { function LookmlModelExploreFieldSqlCase() { } return LookmlModelExploreFieldSqlCase; }()); exports.LookmlModelExploreFieldSqlCase = LookmlModelExploreFieldSqlCase; var LookmlModelExploreFieldset = (function () { function LookmlModelExploreFieldset() { } return LookmlModelExploreFieldset; }()); exports.LookmlModelExploreFieldset = LookmlModelExploreFieldset; var LookmlModelExploreJoins = (function () { function LookmlModelExploreJoins() { } return LookmlModelExploreJoins; }()); exports.LookmlModelExploreJoins = LookmlModelExploreJoins; var LookmlModelExploreSet = (function () { function LookmlModelExploreSet() { } return LookmlModelExploreSet; }()); exports.LookmlModelExploreSet = LookmlModelExploreSet; var LookmlModelNavExplore = (function () { function LookmlModelNavExplore() { } return LookmlModelNavExplore; }()); exports.LookmlModelNavExplore = LookmlModelNavExplore; var ModelError = (function () { function ModelError() { } return ModelError; }()); exports.ModelError = ModelError; var ModelSet = (function () { function ModelSet() { } return ModelSet; }()); exports.ModelSet = ModelSet; var ModelsNotValidated = (function () { function ModelsNotValidated() { } return ModelsNotValidated; }()); exports.ModelsNotValidated = ModelsNotValidated; var Permission = (function () { function Permission() { } return Permission; }()); exports.Permission = Permission; var PermissionSet = (function () { function PermissionSet() { } return PermissionSet; }()); exports.PermissionSet = PermissionSet; var PrefetchAccessFilterValue = (function () { function PrefetchAccessFilterValue() { } return PrefetchAccessFilterValue; }()); exports.PrefetchAccessFilterValue = PrefetchAccessFilterValue; var PrefetchDashboardFilterValue = (function () { function PrefetchDashboardFilterValue() { } return PrefetchDashboardFilterValue; }()); exports.PrefetchDashboardFilterValue = PrefetchDashboardFilterValue; var PrefetchDashboardRequest = (function () { function PrefetchDashboardRequest() { } return PrefetchDashboardRequest; }()); exports.PrefetchDashboardRequest = PrefetchDashboardRequest; var PrefetchMapper = (function () { function PrefetchMapper() { } return PrefetchMapper; }()); exports.PrefetchMapper = PrefetchMapper; var Project = (function () { function Project() { } return Project; }()); exports.Project = Project; var ProjectError = (function () { function ProjectError() { } return ProjectError; }()); exports.ProjectError = ProjectError; var ProjectFile = (function () { function ProjectFile() { } return ProjectFile; }()); exports.ProjectFile = ProjectFile; var ProjectValidation = (function () { function ProjectValidation() { } return ProjectValidation; }()); exports.ProjectValidation = ProjectValidation; var ProjectValidationCache = (function () { function ProjectValidationCache() { } return ProjectValidationCache; }()); exports.ProjectValidationCache = ProjectValidationCache; var ProjectWorkspace = (function () { function ProjectWorkspace() { } return ProjectWorkspace; }()); exports.ProjectWorkspace = ProjectWorkspace; var Query = (function () { function Query() { } return Query; }()); exports.Query = Query; var QueryTask = (function () { function QueryTask() { } return QueryTask; }()); exports.QueryTask = QueryTask; var RenderTask = (function () { function RenderTask() { } return RenderTask; }()); exports.RenderTask = RenderTask; var Role = (function () { function Role() { } return Role; }()); exports.Role = Role; var RunningQueries = (function () { function RunningQueries() { } return RunningQueries; }()); exports.RunningQueries = RunningQueries; var SamlConfig = (function () { function SamlConfig() { } return SamlConfig; }()); exports.SamlConfig = SamlConfig; var SamlGroupRead = (function () { function SamlGroupRead() { } return SamlGroupRead; }()); exports.SamlGroupRead = SamlGroupRead; var SamlGroupWrite = (function () { function SamlGroupWrite() { } return SamlGroupWrite; }()); exports.SamlGroupWrite = SamlGroupWrite; var SamlMetadataParseResult = (function () { function SamlMetadataParseResult() { } return SamlMetadataParseResult; }()); exports.SamlMetadataParseResult = SamlMetadataParseResult; var SamlUserAttributeRead = (function () { function SamlUserAttributeRead() { } return SamlUserAttributeRead; }()); exports.SamlUserAttributeRead = SamlUserAttributeRead; var SamlUserAttributeWrite = (function () { function SamlUserAttributeWrite() { } return SamlUserAttributeWrite; }()); exports.SamlUserAttributeWrite = SamlUserAttributeWrite; var ScheduledPlan = (function () { function ScheduledPlan() { } return ScheduledPlan; }()); exports.ScheduledPlan = ScheduledPlan; var ScheduledPlanDestination = (function () { function ScheduledPlanDestination() { } return ScheduledPlanDestination; }()); exports.ScheduledPlanDestination = ScheduledPlanDestination; var Session = (function () { function Session() { } return Session; }()); exports.Session = Session; var Snippet = (function () { function Snippet() { } return Snippet; }()); exports.Snippet = Snippet; var Space = (function () { function Space() { } return Space; }()); exports.Space = Space; var SpaceBase = (function () { function SpaceBase() { } return SpaceBase; }()); exports.SpaceBase = SpaceBase; var SqlQuery = (function () { function SqlQuery() { } return SqlQuery; }()); exports.SqlQuery = SqlQuery; var SqlQueryCreate = (function () { function SqlQueryCreate() { } return SqlQueryCreate; }()); exports.SqlQueryCreate = SqlQueryCreate; var Timezone = (function () { function Timezone() { } return Timezone; }()); exports.Timezone = Timezone; var User = (function () { function User() { } return User; }()); exports.User = User; var UserAttribute = (function () { function UserAttribute() { } return UserAttribute; }()); exports.UserAttribute = UserAttribute; var UserAttributeGroupValue = (function () { function UserAttributeGroupValue() { } return UserAttributeGroupValue; }()); exports.UserAttributeGroupValue = UserAttributeGroupValue; var UserAttributeWithValue = (function () { function UserAttributeWithValue() { } return UserAttributeWithValue; }()); exports.UserAttributeWithValue = UserAttributeWithValue; var UserIdOnly = (function () { function UserIdOnly() { } return UserIdOnly; }()); exports.UserIdOnly = UserIdOnly; var UserPublic = (function () { function UserPublic() { } return UserPublic; }()); exports.UserPublic = UserPublic; var ValidationError = (function () { function ValidationError() { } return ValidationError; }()); exports.ValidationError = ValidationError; var ValidationErrorDetail = (function () { function ValidationErrorDetail() { } return ValidationErrorDetail; }()); exports.ValidationErrorDetail = ValidationErrorDetail; var Whitelabel = (function () { function Whitelabel() { } return Whitelabel; }()); exports.Whitelabel = Whitelabel; var Workspace = (function () { function Workspace() { } return Workspace; }()); exports.Workspace = Workspace; var HttpBasicAuth = (function () { function HttpBasicAuth() { } HttpBasicAuth.prototype.applyToRequest = function (requestOptions) { requestOptions.auth = { username: this.username, password: this.password }; }; return HttpBasicAuth; }()); exports.HttpBasicAuth = HttpBasicAuth; var ApiKeyAuth = (function () { function ApiKeyAuth(location, paramName) { this.location = location; this.paramName = paramName; } ApiKeyAuth.prototype.applyToRequest = function (requestOptions) { if (this.location == "query") { requestOptions.qs[this.paramName] = this.apiKey; } else if (this.location == "header" && requestOptions && requestOptions.headers) { requestOptions.headers[this.paramName] = this.apiKey; } }; return ApiKeyAuth; }()); exports.ApiKeyAuth = ApiKeyAuth; var OAuth = (function () { function OAuth() { } OAuth.prototype.applyToRequest = function (requestOptions) { if (requestOptions && requestOptions.headers) { requestOptions.headers["Authorization"] = "Bearer " + this.accessToken; } }; return OAuth; }()); exports.OAuth = OAuth; var VoidAuth = (function () { function VoidAuth() { } VoidAuth.prototype.applyToRequest = function (_) { // Do nothing }; return VoidAuth; }()); exports.VoidAuth = VoidAuth; var ApiAuthApiApiKeys; (function (ApiAuthApiApiKeys) { })(ApiAuthApiApiKeys = exports.ApiAuthApiApiKeys || (exports.ApiAuthApiApiKeys = {})); var ApiAuthApi = (function () { function ApiAuthApi(basePathOrUsername, password, basePath) { this.basePath = defaultBasePath; this.defaultHeaders = {}; this._useQuerystring = false; this.authentications = { 'default': new VoidAuth(), }; if (password) { if (basePath) { this.basePath = basePath; } } else { if (basePathOrUsername) { this.basePath = basePathOrUsername; } } } Object.defineProperty(ApiAuthApi.prototype, "useQuerystring", { set: function (value) { this._useQuerystring = value; }, enumerable: true, configurable: true }); ApiAuthApi.prototype.setApiKey = function (key, value) { this.authentications[ApiAuthApiApiKeys[key]].apiKey = value; }; /** * Login * ### Present client credentials to obtain an authorization token Looker API implements the OAuth2 [Resource Owner Password Credentials Grant](https://looker.com/docs/r/api/outh2_resource_owner_pc) pattern. The client credentials required for this login must be obtained by creating an API3 key on a user account in the Looker Admin console. The API3 key consists of a public &#x60;client_id&#x60; and a private &#x60;client_secret&#x60;. The access token returned by &#x60;login&#x60; must be used in the HTTP Authorization header of subsequent API requests, like this: &#x60;&#x60;&#x60; Authorization: token 4QDkCyCtZzYgj4C2p2cj3csJH7zqS5RzKs2kTnG4 &#x60;&#x60;&#x60; Replace \&quot;4QDkCy...\&quot; with the &#x60;access_token&#x60; value returned by &#x60;login&#x60;. The word &#39;token&#39; is a string literal and must be included exactly as shown. For more information and detailed examples of Looker API authorization, see [How to Authenticate to Looker API3](https://github.com/looker/looker-sdk-ruby/blob/master/authentication.md). * @param clientId client_id part of API3 Key. * @param clientSecret client_secret part of API3 Key. */ ApiAuthApi.prototype.login = function (clientId, clientSecret) { var localVarPath = this.basePath + '/login'; var queryParameters = {}; var headerParams = Object.assign({}, this.defaultHeaders); var formParams = {}; if (clientId !== undefined) { queryParameters['client_id'] = clientId; } if (clientSecret !== undefined) { queryParameters['client_secret'] = clientSecret; } var useFormData = false; var requestOptions = { method: 'POST', qs: queryParameters, headers: headerParams, uri: localVarPath, useQuerystring: this._useQuerystring, json: true, }; this.authentications.default.applyToRequest(requestOptions); if (Object.keys(formParams).length) { if (useFormData) { requestOptions.formData = formParams; } else { requestOptions.form = formParams; } } return new Promise(function (resolve, reject) { request(requestOptions, function (error, response, body) { if (error) { reject(error); } else { if (response.statusCode >= 200 && response.statusCode <= 299) { resolve({ response: response, body: body }); } else { reject({ response: response, body: body }); } } }); }); }; /** * Login user * ### Create an access token for a given user. This can only be called by an authenticated admin user. It allows that admin to generate a new authentication token for the user with the given user id. That token can then be used for subsequent API calls - which are then performed *as* that target user. The target user does *not* need to have a pre-existing API client_id/client_secret pair. And, no such credentials are created by this call. This allows for building systems where api user authentication for an arbitrary number of users is done outside of Looker and funneled through a single &#39;service account&#39; with admin permissions. Note that a new access token is generated on each call. If target users are going to be making numerous API calls in a short period then it is wise to cache this authentication token rather than call this before each of those API calls. See &#39;login&#39; for more detail on the access token and how to use it. * @param userId Id of user. */ ApiAuthApi.prototype.loginUser = function (userId) { var localVarPath = this.basePath + '/login/{user_id}' .replace('{' + 'user_id' + '}', String(userId)); var queryParameters = {}; var headerParams = Object.assign({}, this.defaultHeaders); var formParams = {}; // verify required parameter 'userId' is not null or undefined if (userId === null || userId === undefined) { throw new Error('Required parameter userId was null or undefined when calling loginUser.'); } var useFormData = false; var requestOptions = { method: 'POST', qs: queryParameters, headers: headerParams, uri: localVarPath, useQuerystring: this._useQuerystring, json: true, }; this.authentications.default.applyToRequest(requestOptions); if (Object.keys(formParams).length) { if (useFormData) { requestOptions.formData = formParams; } else { requestOptions.form = formParams; } } return new Promise(function (resolve, reject) { request(requestOptions, function (error, response, body) { if (error) { reject(error); } else { if (response.statusCode >= 200 && response.statusCode <= 299) { resolve({ response: response, body: body }); } else { reject({ response: response, body: body }); } } }); }); }; /** * Logout * ### Logout of the API and invalidate the current access token. */ ApiAuthApi.prototype.logout = function () { var localVarPath = this.basePath + '/logout'; var queryParameters = {}; var headerParams = Object.assign({}, this.defaultHeaders); var formParams = {}; var useFormData = false; var requestOptions = { method: 'DELETE', qs: queryParameters, headers: headerParams, uri: localVarPath, useQuerystring: this._useQuerystring, json: true, }; this.authentications.default.applyToRequest(requestOptions); if (Object.keys(formParams).length) { if (useFormData) { requestOptions.formData = formParams; } else { requestOptions.form = formParams; } } return new Promise(function (resolve, reject) { request(requestOptions, function (error, response, body) { if (error) { reject(error); } else { if (response.statusCode >= 200 && response.statusCode <= 299) { resolve({ response: response, body: body }); } else { reject({ response: response, body: body }); } } }); }); }; return ApiAuthApi; }()); exports.ApiAuthApi = ApiAuthApi; var AuthApiApiKeys; (function (AuthApiApiKeys) { })(AuthApiApiKeys = exports.AuthApiApiKeys || (exports.AuthApiApiKeys = {})); var AuthApi = (function () { function AuthApi(basePathOrUsername, password, basePath) { this.basePath = defaultBasePath; this.defaultHeaders = {}; this._useQuerystring = false; this.authentications = { 'default': new VoidAuth(), }; if (password) { if (basePath) { this.basePath = basePath; } } else { if (basePathOrUsername) { this.basePath = basePathOrUsername; } } } Object.defineProperty(AuthApi.prototype, "useQuerystring", { set: function (value) { this._useQuerystring = value; }, enumerable: true, configurable: true }); AuthApi.prototype.setApiKey = function (key, value) { this.authentications[AuthApiApiKeys[key]].apiKey = value; }; /** * Create SAML Test Configuration * ### Create a SAML test configuration. * @param body SAML test config */ AuthApi.prototype.createSamlTestConfig = function (body) { var localVarPath = this.basePath + '/saml_test_configs'; var queryParameters = {}; var headerParams = Object.assign({}, this.defaultHeaders); var formParams = {}; // verify required parameter 'body' is not null or undefined if (body === null || body === undefined) { throw new Error('Required parameter body was null or undefined when calling createSamlTestConfig.'); } var useFormData = false; var requestOptions = { method: 'POST', qs: queryParameters, headers: headerParams, uri: localVarPath, useQuerystring: this._useQuerystring, json: true, body: body, }; this.authentications.default.applyToRequest(requestOptions); if (Object.keys(formParams).length) { if (useFormData) { requestOptions.formData = formParams; } else { requestOptions.form = formParams; } } return new Promise(function (resolve, reject) { request(requestOptions, function (error, response, body) { if (error) { reject(error); } else { if (response.statusCode >= 200 && response.statusCode <= 299) { resolve({ response: response, body: body }); } else { reject({ response: response, body: body }); } } }); }); }; /** * Delete SAML Test Configuration * ### Delete a SAML test configuration. * @param testSlug Slug of test config */ AuthApi.prototype.deleteSamlTestConfig = function (testSlug) { var localVarPath = this.basePath + '/saml_test_configs/{test_slug}' .replace('{' + 'test_slug' + '}', String(testSlug)); var queryParameters = {}; var headerParams = Object.assign({}, this.defaultHeaders); var formParams = {}; // verify required parameter 'testSlug' is not null or undefined if (testSlug === null || testSlug === undefined) { throw new Error('Required parameter testSlug was null or undefined when calling deleteSamlTestConfig.'); } var useFormData = false; var requestOptions = { method: 'DELETE', qs: queryParameters, headers: headerParams, uri: localVarPath, useQuerystring: this._useQuerystring, json: true, }; this.authentications.default.applyToRequest(requestOptions); if (Object.keys(formParams).length) { if (useFormData) { requestOptions.formData = formParams; } else { requestOptions.form = formParams; } } return new Promise(function (resolve, reject) { request(requestOptions, function (error, response, body) { if (error) { reject(error); } else { if (response.statusCode >= 200 && response.statusCode <= 299) { resolve({ response: response, body: body }); } else { reject({ response: response, body: body }); } } }); }); }; /** * Parse SAML IdP Url * ### Fetch the given url and parse it as a SAML IdP metadata document and return the result. Note that this requires that the url be public or at least at a location where the Looker instance can fetch it without requiring any special authentication. * @param body SAML IdP metadata public url */ AuthApi.prototype.fetchAndParseSamlIdpMetadata = function (body) { var localVarPath = this.basePath + '/fetch_and_parse_saml_idp_metadata'; var queryParameters = {}; var headerParams = Object.assign({}, this.defaultHeaders); var formParams = {}; // verify required parameter 'body' is not null or undefined if (body === null || body === undefined) { throw new Error('Required parameter body was null or undefined when calling fetchAndParseSamlIdpMetadata.'); } var useFormData = false; var requestOptions = { method: 'POST', qs: queryParameters, headers: headerParams, uri: localVarPath, useQuerystring: this._useQuerystring, json: true, body: body, }; this.authentications.default.applyToRequest(requestOptions); if (Object.keys(formParams).length) { if (useFormData) { requestOptions.formData = formParams; } else { requestOptions.form = formParams; } } return new Promise(function (resolve, reject) { request(requestOptions, function (error, response, body) { if (error) { reject(error); } else { if (response.statusCode >= 200 && response.statusCode <= 299) { resolve({ response: response, body: body }); } else { reject({ response: response, body: body }); } } }); }); }; /** * Get LDAP Configuration * ### Get the LDAP configuration. Looker can be optionally configured to authenticate users against an Active Directory or other LDAP directory server. LDAP setup requires coordination with an administrator of that directory server. Only Looker administrators can read and update the LDAP configuration. Configuring LDAP impacts authentication for all users. This configuration should be done carefully. Looker maintains a single LDAP configuration. It can be read and updated. Updates only succeed if the new state will be valid (in the sense that all required fields are populated); it is up to you to ensure that the configuration is appropriate and correct). LDAP is enabled or disabled for Looker using the **enabled** field. Looker will never return an **auth_password** field. That value can be set, but never retrieved. See the [Looker LDAP docs](https://www.looker.com/docs/r/api/ldap_setup) for additional information. */ AuthApi.prototype.ldapConfig = function () { var localVarPath = this.basePath + '/ldap_config'; var queryParameters = {}; var headerParams = Object.assign({}, this.defaultHeaders); var formParams = {}; var useFormData = false; var requestOptions = { method: 'GET', qs: queryParameters, headers: headerParams, uri: localVarPath, useQuerystring: this._useQuerystring, json: true, }; this.authentications.default.applyToRequest(requestOptions); if (Object.keys(formParams).length) { if (useFormData) { requestOptions.formData = formParams; } else { requestOptions.form = formParams; } } return new Promise(function (resolve, reject) { request(requestOptions, function (error, response, body) { if (error) { reject(error); } else { if (response.statusCode >= 200 && response.statusCode <= 299) { resolve({ response: response, body: body }); } else { reject({ response: response, body: body }); } } }); }); }; /** * Parse SAML IdP XML * ### Parse the given xml as a SAML IdP metadata document and return the result. * @param body SAML IdP metadata xml */ AuthApi.prototype.parseSamlIdpMetadata = function (body) { var localVarPath = this.basePath + '/parse_saml_idp_metadata'; var queryParameters = {}; var headerParams = Object.assign({}, this.defaultHeaders); var formParams = {}; // verify required parameter 'body' is not null or undefined if (body === null || body === undefined) { throw new Error('Required parameter body was null or undefined when calling parseSamlIdpMetadata.'); } var useFormData = false; var requestOptions = { method: 'POST', qs: queryParameters, headers: headerParams, uri: localVarPath, useQuerystring: this._useQuerystring, json: true, body: body, }; this.authentications.default.applyToRequest(requestOptions); if (Object.keys(formParams).length) { if (useFormData) { requestOptions.formData = formParams; } else { requestOptions.form = formParams; } } return new Promise(function (resolve, reject) { request(requestOptions, function (error, response, body) { if (error) { reject(error); } else { if (response.statusCode >= 200 && response.statusCode <= 299) { resolve({ response: response, body: body }); } else { reject({ response: response, body: body }); } } }); }); }; /** * Get SAML Configuration * ### Get the SAML configuration. Looker can be optionally configured to authenticate users against a SAML authentication server. SAML setup requires coordination with an administrator of that server. Only Looker administrators can read and update the SAML configuration. Configuring SAML impacts authentication for all users. This configuration should be done carefully. Looker maintains a single SAML configuation. It can be read and updated. Updates only succeed if the new state will be valid (in the sense that all required fields are populated); it is up to you to ensure that the configuration is appropriate and correct). SAML is enabled or disabled for Looker using the **enabled** field. */ AuthApi.prototype.samlConfig = function () { var localVarPath = this.basePath + '/saml_config'; var queryParameters = {}; var headerParams = Object.assign({}, this.defaultHeaders); var formParams = {}; var useFormData = false; var requestOptions = { method: 'GET', qs: queryParameters, headers: headerParams, uri: localVarPath, useQuerystring: this._useQuerystring, json: true, }; this.authentications.default.applyToRequest(requestOptions); if (Object.keys(formParams).length) { if (useFormData) { requestOptions.formData = formParams; } else { requestOptions.form = formParams; } } return new Promise(function (resolve, reject) { request(requestOptions, function (error, response, body) { if (error) { reject(error); } else { if (response.statusCode >= 200 && response.statusCode <= 299) { resolve({ response: response, body: body }); } else { reject({ response: response, body: body }); } } }); }); }; /** * Get SAML Test Configuration * ### Get a SAML test configuration by test_slug. * @param testSlug Slug of test config */ AuthApi.prototype.samlTestConfig = function (testSlug) { var localVarPath = this.basePath + '/saml_test_configs/{test_slug}' .replace('{' + 'test_slug' + '}', String(testSlug)); var queryParameters = {}; var headerParams = Object.assign({}, this.defaultHeaders); var formParams = {}; // verify required parameter 'testSlug' is not null or undefined if (testSlug === null || testSlug === undefined) { throw new Error('Required parameter testSlug was null or undefined when calling samlTestConfig.'); } var useFormData = false; var requestOptions = { method: 'GET', qs: queryParameters, headers: headerParams, uri: localVarPath, useQuerystring: this._useQuerystring, json: true, }; this.authentications.default.applyToRequest(requestOptions); if (Object.keys(formParams).length) { if (useFormData) { requestOptions.formData = formParams; } else { requestOptions.form = formParams; } } return new Promise(function (resolve, reject) { request(requestOptions, function (error, response, body) { if (error) { reject(error); } else { if (response.statusCode >= 200 && response.statusCode <= 299) { resolve({ response: response, body: body }); } else { reject({ response: response, body: body }); } } }); }); }; /** * Test LDAP Auth * ### Test the connection authentication settings for an LDAP configuration. This tests that the connection is possible and that a &#39;server&#39; account to be used by Looker can authenticate to the LDAP server given connection and authentication information. **connection_host**, **connection_port**, and **auth_username**, are required. **connection_tls** and **auth_password** are optional. Example: &#x60;&#x60;&#x60;json { \&quot;connection_host\&quot;: \&quot;ldap.example.com\&quot;, \&quot;connection_port\&quot;: \&quot;636\&quot;, \&quot;connection_tls\&quot;: true, \&quot;auth_username\&quot;: \&quot;cn&#x3D;looker,dc&#x3D;example,dc&#x3D;com\&quot;, \&quot;auth_password\&quot;: \&quot;secret\&quot; } &#x60;&#x60;&#x60; Looker will never return an **auth_password**. If this request omits the **auth_password** field, then the **auth_password** value from the active config (if present) will be used for the test. The active LDAP settings are not modified. * @param body LDAP Config */ AuthApi.prototype.testLdapConfigAuth = function (body) { var localVarPath = this.basePath + '/ldap_config/test_auth'; var queryParameters = {}; var headerParams = Object.assign({}, this.defaultHeaders); var formParams = {}; // verify required parameter 'body' is not null or undefined if (body === null || body === undefined) { throw new Error('Required parameter body was null or undefined when calling testLdapConfigAuth.'); } var useFormData = false; var requestOptions = { method: 'PUT', qs: queryParameters, headers: headerParams, uri: localVarPath, useQuerystring: this._useQuerystring, json: true, body: body, }; this.authentications.default.applyToRequest(requestOptions); if (Object.keys(formParams).length) { if (useFormData) { requestOptions.formData = formParams; } else { requestOptions.form = formParams; } } return new Promise(function (resolve, reject) { request(requestOptions, function (error, response, body) { if (error) { reject(error); } else { if (response.statusCode >= 200 && response.statusCode <= 299) { resolve({ response: response, body: body }); } else { reject({ response: response, body: body }); } } }); }); }; /** * Test LDAP Connection * ### Test the connection settings for an LDAP configuration. This tests that the connection is possible given a connection_host and connection_port. **connection_host** and **connection_port** are required. **connection_tls** is optional. Example: &#x60;&#x60;&#x60;json { \&quot;connection_host\&quot;: \&quot;ldap.example.com\&quot;, \&quot;connection_port\&quot;: \&quot;636\&quot;, \&quot;connection_tls\&quot;: true } &#x60;&#x60;&#x60; No authentication to the LDAP server is attempted. The active LDAP settings are not modified. * @param body LDAP Config */ AuthApi.prototype.testLdapConfigConnection = function (body) { var localVarPath = this.basePath + '/ldap_config/test_connection'; var queryParameters = {}; var headerParams = Object.assign({}, this.defaultHeaders); var formParams = {}; // verify required parameter 'body' is not null or undefined if (body === null || body === undefined) { throw new Error('Required parameter body was null or undefined when calling testLdapConfigConnection.'); } var useFormData = false; var requestOptions = { method: 'PUT', qs: queryParameters, headers: headerParams, uri: localVarPath, useQuerystring: this._useQuerystring, json: true, body: body, }; this.authentications.default.applyToRequest(requestOptions); if (Object.keys(formParams).length) { if (useFormData) { requestOptions.formData = formParams; } else { requestOptions.form = formParams; } } return new Promise(function (resolve, reject) { request(requestOptions, function (error, response, body) { if (error) { reject(error); } else { if (response.statusCode >= 200 && response.statusCode <= 299) { resolve({ response: response, body: body }); } else { reject({ response: response, body: body }); } } }); }); }; /** * Test LDAP Us