@datocms/cma-client
Version:
JS client for DatoCMS REST Content Management API
107 lines • 3 kB
JavaScript
import * as Utils from '@datocms/rest-client-utils';
import BaseResource from '../../BaseResource';
export default class SsoUser extends BaseResource {
/**
* 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,
});
}
}
SsoUser.TYPE = 'sso_user';
//# sourceMappingURL=SsoUser.js.map