@datocms/cma-client
Version:
JS client for DatoCMS REST Content Management API
136 lines • 4.31 kB
JavaScript
;
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const Utils = __importStar(require("@datocms/rest-client-utils"));
const BaseResource_1 = __importDefault(require("../../BaseResource"));
class SsoUser extends BaseResource_1.default {
/**
* List all users
*
* Read more: https://www.datocms.com/docs/content-management-api/resources/sso-user/instances
*
* @throws {ApiError}
* @throws {TimeoutError}
*/
list() {
return this.rawList().then((body) => Utils.deserializeResponseBody(body));
}
/**
* List all users
*
* Read more: https://www.datocms.com/docs/content-management-api/resources/sso-user/instances
*
* @throws {ApiError}
* @throws {TimeoutError}
*/
rawList() {
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}
*/
find(userId) {
return this.rawFind(Utils.toId(userId)).then((body) => 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}
*/
rawFind(userId) {
return this.client.request({
method: 'GET',
url: `/sso-users/${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}
*/
copyUsers() {
return this.rawCopyUsers().then((body) => 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}
*/
rawCopyUsers() {
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}
*/
destroy(userId, queryParams) {
return this.rawDestroy(Utils.toId(userId), queryParams).then((body) => 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}
*/
rawDestroy(userId, queryParams) {
return this.client.request({
method: 'DELETE',
url: `/sso-users/${userId}`,
queryParams,
});
}
}
exports.default = SsoUser;
SsoUser.TYPE = 'sso_user';
//# sourceMappingURL=SsoUser.js.map