UNPKG

@datocms/cma-client

Version:
136 lines 4.39 kB
var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); import * as Utils from '@datocms/rest-client-utils'; import BaseResource from '../../BaseResource'; var SsoUser = /** @class */ (function (_super) { __extends(SsoUser, _super); function SsoUser() { return _super !== null && _super.apply(this, arguments) || this; } /** * List all users * * Read more: https://www.datocms.com/docs/content-management-api/resources/sso-user/instances * * @throws {ApiError} * @throws {TimeoutError} */ SsoUser.prototype.list = function () { return this.rawList().then(function (body) { return Utils.deserializeResponseBody(body); }); }; /** * List all users * * Read more: https://www.datocms.com/docs/content-management-api/resources/sso-user/instances * * @throws {ApiError} * @throws {TimeoutError} */ SsoUser.prototype.rawList = function () { return this.client.request({ method: 'GET', url: '/sso-users', }); }; /** * Returns a SSO user * * Read more: https://www.datocms.com/docs/content-management-api/resources/sso-user/self * * @throws {ApiError} * @throws {TimeoutError} */ SsoUser.prototype.find = function (userId) { return this.rawFind(Utils.toId(userId)).then(function (body) { return Utils.deserializeResponseBody(body); }); }; /** * Returns a SSO user * * Read more: https://www.datocms.com/docs/content-management-api/resources/sso-user/self * * @throws {ApiError} * @throws {TimeoutError} */ SsoUser.prototype.rawFind = function (userId) { return this.client.request({ method: 'GET', url: "/sso-users/".concat(userId), }); }; /** * Copy editors as SSO users * * Read more: https://www.datocms.com/docs/content-management-api/resources/sso-user/copy_users * * @throws {ApiError} * @throws {TimeoutError} */ SsoUser.prototype.copyUsers = function () { return this.rawCopyUsers().then(function (body) { return Utils.deserializeResponseBody(body); }); }; /** * Copy editors as SSO users * * Read more: https://www.datocms.com/docs/content-management-api/resources/sso-user/copy_users * * @throws {ApiError} * @throws {TimeoutError} */ SsoUser.prototype.rawCopyUsers = function () { return this.client.request({ method: 'POST', url: '/sso-users/copy-users', }); }; /** * Delete a SSO user * * Read more: https://www.datocms.com/docs/content-management-api/resources/sso-user/destroy * * @throws {ApiError} * @throws {TimeoutError} */ SsoUser.prototype.destroy = function (userId, queryParams) { return this.rawDestroy(Utils.toId(userId), queryParams).then(function (body) { return Utils.deserializeResponseBody(body); }); }; /** * Delete a SSO user * * Read more: https://www.datocms.com/docs/content-management-api/resources/sso-user/destroy * * @throws {ApiError} * @throws {TimeoutError} */ SsoUser.prototype.rawDestroy = function (userId, queryParams) { return this.client.request({ method: 'DELETE', url: "/sso-users/".concat(userId), queryParams: queryParams, }); }; SsoUser.TYPE = 'sso_user'; return SsoUser; }(BaseResource)); export default SsoUser; //# sourceMappingURL=SsoUser.js.map