@datocms/cma-client
Version:
JS client for DatoCMS REST Content Management API
81 lines • 2.64 kB
JavaScript
import * as Utils from '@datocms/rest-client-utils';
import BaseResource from '../../BaseResource';
export default class EditingSession extends BaseResource {
/**
* List all editing sessions
*
* Read more: https://www.datocms.com/docs/content-management-api/resources/editing-session/instances
*
* @throws {ApiError}
* @throws {TimeoutError}
*
* @deprecated This API call is to be considered private and might change without notice
*/
list() {
return this.rawList().then((body) => Utils.deserializeResponseBody(body));
}
/**
* List all editing sessions
*
* Read more: https://www.datocms.com/docs/content-management-api/resources/editing-session/instances
*
* @throws {ApiError}
* @throws {TimeoutError}
*
* @deprecated This API call is to be considered private and might change without notice
*/
rawList() {
return this.client.request({
method: 'GET',
url: '/editing-sessions',
});
}
/**
* Allows all actions on editing sessions
*
* Read more: https://www.datocms.com/docs/content-management-api/resources/editing-session/update
*
* @throws {ApiError}
* @throws {TimeoutError}
*
* @deprecated This API call is to be considered private and might change without notice
*/
rawUpdate(editingSessionId, body) {
return this.client.request({
method: 'PUT',
url: `/editing-sessions/${editingSessionId}`,
body,
});
}
/**
* Delete an editing session
*
* Read more: https://www.datocms.com/docs/content-management-api/resources/editing-session/destroy
*
* @throws {ApiError}
* @throws {TimeoutError}
*
* @deprecated This API call is to be considered private and might change without notice
*/
destroy(editingSessionId) {
return this.rawDestroy(Utils.toId(editingSessionId)).then((body) => Utils.deserializeResponseBody(body));
}
/**
* Delete an editing session
*
* Read more: https://www.datocms.com/docs/content-management-api/resources/editing-session/destroy
*
* @throws {ApiError}
* @throws {TimeoutError}
*
* @deprecated This API call is to be considered private and might change without notice
*/
rawDestroy(editingSessionId) {
return this.client.request({
method: 'DELETE',
url: `/editing-sessions/${editingSessionId}`,
});
}
}
EditingSession.TYPE = 'editing_session';
//# sourceMappingURL=EditingSession.js.map