@datocms/cma-client
Version:
JS client for DatoCMS REST Content Management API
40 lines • 1.27 kB
JavaScript
import * as Utils from '@datocms/rest-client-utils';
import BaseResource from '../../BaseResource';
export default class Session extends BaseResource {
/**
* Create a new session
*
* Read more: https://www.datocms.com/docs/content-management-api/resources/session/create
*
* @throws {ApiError}
* @throws {TimeoutError}
*
* @deprecated This API call is to be considered private and might change without notice
*/
create(body) {
return this.rawCreate(Utils.serializeRequestBody(body, {
type: 'email_credentials',
attributes: ['email', 'password', 'otp_code'],
relationships: [],
})).then((body) => Utils.deserializeResponseBody(body));
}
/**
* Create a new session
*
* Read more: https://www.datocms.com/docs/content-management-api/resources/session/create
*
* @throws {ApiError}
* @throws {TimeoutError}
*
* @deprecated This API call is to be considered private and might change without notice
*/
rawCreate(body) {
return this.client.request({
method: 'POST',
url: '/sessions',
body,
});
}
}
Session.TYPE = 'session';
//# sourceMappingURL=Session.js.map