@datocms/cma-client
Version:
JS client for DatoCMS REST Content Management API
141 lines • 4.71 kB
JavaScript
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 SsoGroup = /** @class */ (function (_super) {
__extends(SsoGroup, _super);
function SsoGroup() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* List all SSO groups
*
* Read more: https://www.datocms.com/docs/content-management-api/resources/sso-group/instances
*
* @throws {ApiError}
* @throws {TimeoutError}
*/
SsoGroup.prototype.list = function () {
return this.rawList().then(function (body) {
return Utils.deserializeResponseBody(body);
});
};
/**
* List all SSO groups
*
* Read more: https://www.datocms.com/docs/content-management-api/resources/sso-group/instances
*
* @throws {ApiError}
* @throws {TimeoutError}
*/
SsoGroup.prototype.rawList = function () {
return this.client.request({
method: 'GET',
url: '/sso-groups',
});
};
/**
* Sync SSO provider groups to DatoCMS roles
*
* Read more: https://www.datocms.com/docs/content-management-api/resources/sso-group/copy_roles
*
* @throws {ApiError}
* @throws {TimeoutError}
*/
SsoGroup.prototype.copyRoles = function (ssoGroupId) {
return this.rawCopyRoles(Utils.toId(ssoGroupId)).then(function (body) {
return Utils.deserializeResponseBody(body);
});
};
/**
* Sync SSO provider groups to DatoCMS roles
*
* Read more: https://www.datocms.com/docs/content-management-api/resources/sso-group/copy_roles
*
* @throws {ApiError}
* @throws {TimeoutError}
*/
SsoGroup.prototype.rawCopyRoles = function (ssoGroupId) {
return this.client.request({
method: 'POST',
url: "/sso-groups/".concat(ssoGroupId, "/copy-roles"),
});
};
/**
* Update a SSO group
*
* Read more: https://www.datocms.com/docs/content-management-api/resources/sso-group/update
*
* @throws {ApiError}
* @throws {TimeoutError}
*/
SsoGroup.prototype.update = function (ssoGroupId, body) {
return this.rawUpdate(Utils.toId(ssoGroupId), Utils.serializeRequestBody(body, {
id: Utils.toId(ssoGroupId),
type: 'sso_group',
attributes: ['priority'],
relationships: ['role'],
})).then(function (body) {
return Utils.deserializeResponseBody(body);
});
};
/**
* Update a SSO group
*
* Read more: https://www.datocms.com/docs/content-management-api/resources/sso-group/update
*
* @throws {ApiError}
* @throws {TimeoutError}
*/
SsoGroup.prototype.rawUpdate = function (ssoGroupId, body) {
return this.client.request({
method: 'PUT',
url: "/sso-groups/".concat(ssoGroupId),
body: body,
});
};
/**
* Delete a group
*
* Read more: https://www.datocms.com/docs/content-management-api/resources/sso-group/destroy
*
* @throws {ApiError}
* @throws {TimeoutError}
*/
SsoGroup.prototype.destroy = function (ssoGroupId) {
return this.rawDestroy(Utils.toId(ssoGroupId)).then(function (body) {
return Utils.deserializeResponseBody(body);
});
};
/**
* Delete a group
*
* Read more: https://www.datocms.com/docs/content-management-api/resources/sso-group/destroy
*
* @throws {ApiError}
* @throws {TimeoutError}
*/
SsoGroup.prototype.rawDestroy = function (ssoGroupId) {
return this.client.request({
method: 'DELETE',
url: "/sso-groups/".concat(ssoGroupId),
});
};
SsoGroup.TYPE = 'sso_group';
return SsoGroup;
}(BaseResource));
export default SsoGroup;
//# sourceMappingURL=SsoGroup.js.map