UNPKG

@datocms/cma-client

Version:
109 lines 3.89 kB
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 MaintenanceMode = /** @class */ (function (_super) { __extends(MaintenanceMode, _super); function MaintenanceMode() { return _super !== null && _super.apply(this, arguments) || this; } /** * Retrieve maintenence mode * * Read more: https://www.datocms.com/docs/content-management-api/resources/maintenance-mode/self * * @throws {ApiError} * @throws {TimeoutError} */ MaintenanceMode.prototype.find = function () { return this.rawFind().then(function (body) { return Utils.deserializeResponseBody(body); }); }; /** * Retrieve maintenence mode * * Read more: https://www.datocms.com/docs/content-management-api/resources/maintenance-mode/self * * @throws {ApiError} * @throws {TimeoutError} */ MaintenanceMode.prototype.rawFind = function () { return this.client.request({ method: 'GET', url: '/maintenance-mode', }); }; /** * Activate maintenance mode: this means that the primary environment will be read-only * * Read more: https://www.datocms.com/docs/content-management-api/resources/maintenance-mode/activate * * @throws {ApiError} * @throws {TimeoutError} */ MaintenanceMode.prototype.activate = function (queryParams) { return this.rawActivate(queryParams).then(function (body) { return Utils.deserializeResponseBody(body); }); }; /** * Activate maintenance mode: this means that the primary environment will be read-only * * Read more: https://www.datocms.com/docs/content-management-api/resources/maintenance-mode/activate * * @throws {ApiError} * @throws {TimeoutError} */ MaintenanceMode.prototype.rawActivate = function (queryParams) { return this.client.request({ method: 'PUT', url: '/maintenance-mode/activate', queryParams: queryParams, }); }; /** * De-activate maintenance mode * * Read more: https://www.datocms.com/docs/content-management-api/resources/maintenance-mode/deactivate * * @throws {ApiError} * @throws {TimeoutError} */ MaintenanceMode.prototype.deactivate = function () { return this.rawDeactivate().then(function (body) { return Utils.deserializeResponseBody(body); }); }; /** * De-activate maintenance mode * * Read more: https://www.datocms.com/docs/content-management-api/resources/maintenance-mode/deactivate * * @throws {ApiError} * @throws {TimeoutError} */ MaintenanceMode.prototype.rawDeactivate = function () { return this.client.request({ method: 'PUT', url: '/maintenance-mode/deactivate', }); }; MaintenanceMode.TYPE = 'maintenance_mode'; return MaintenanceMode; }(BaseResource)); export default MaintenanceMode; //# sourceMappingURL=MaintenanceMode.js.map