@datocms/cma-client
Version:
JS client for DatoCMS REST Content Management API
379 lines • 14 kB
JavaScript
"use strict";
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 __());
};
})();
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 });
var Utils = __importStar(require("@datocms/rest-client-utils"));
var BaseResource_1 = __importDefault(require("../../BaseResource"));
var Site = /** @class */ (function (_super) {
__extends(Site, _super);
function Site() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* Retrieve the site
*
* Read more: https://www.datocms.com/docs/content-management-api/resources/site/self
*
* @throws {ApiError}
* @throws {TimeoutError}
*/
Site.prototype.find = function (queryParams) {
return this.rawFind(queryParams).then(function (body) {
return Utils.deserializeResponseBody(body);
});
};
/**
* Retrieve the site
*
* Read more: https://www.datocms.com/docs/content-management-api/resources/site/self
*
* @throws {ApiError}
* @throws {TimeoutError}
*/
Site.prototype.rawFind = function (queryParams) {
return this.client.request({
method: 'GET',
url: '/site',
queryParams: queryParams,
});
};
/**
* Update the site's settings
*
* Read more: https://www.datocms.com/docs/content-management-api/resources/site/update
*
* @throws {ApiError}
* @throws {TimeoutError}
*/
Site.prototype.update = function (body) {
return this.rawUpdate(Utils.serializeRequestBody(body, {
type: 'site',
attributes: [
'no_index',
'favicon',
'global_seo',
'name',
'theme',
'locales',
'timezone',
'require_2fa',
'ip_tracking_enabled',
'force_use_of_sandbox_environments',
],
relationships: ['sso_default_role'],
})).then(function (body) {
return Utils.deserializeResponseBody(body);
});
};
/**
* Update the site's settings
*
* Read more: https://www.datocms.com/docs/content-management-api/resources/site/update
*
* @throws {ApiError}
* @throws {TimeoutError}
*/
Site.prototype.rawUpdate = function (body) {
return this.client.request({
method: 'PUT',
url: '/site',
body: body,
});
};
/**
* Activate improved timezone management
*
* Read more: https://www.datocms.com/docs/content-management-api/resources/site/activate_improved_timezone_management
*
* @throws {ApiError}
* @throws {TimeoutError}
*
* @deprecated This API call is to be considered private and might change without notice
*/
Site.prototype.activateImprovedTimezoneManagement = function () {
return this.rawActivateImprovedTimezoneManagement().then(function (body) {
return Utils.deserializeResponseBody(body);
});
};
/**
* Activate improved timezone management
*
* Read more: https://www.datocms.com/docs/content-management-api/resources/site/activate_improved_timezone_management
*
* @throws {ApiError}
* @throws {TimeoutError}
*
* @deprecated This API call is to be considered private and might change without notice
*/
Site.prototype.rawActivateImprovedTimezoneManagement = function () {
return this.client.request({
method: 'PUT',
url: '/site/activate-improved-timezone-management',
});
};
/**
* Activate improved hex management
*
* Read more: https://www.datocms.com/docs/content-management-api/resources/site/activate_improved_hex_management
*
* @throws {ApiError}
* @throws {TimeoutError}
*
* @deprecated This API call is to be considered private and might change without notice
*/
Site.prototype.activateImprovedHexManagement = function () {
return this.rawActivateImprovedHexManagement().then(function (body) {
return Utils.deserializeResponseBody(body);
});
};
/**
* Activate improved hex management
*
* Read more: https://www.datocms.com/docs/content-management-api/resources/site/activate_improved_hex_management
*
* @throws {ApiError}
* @throws {TimeoutError}
*
* @deprecated This API call is to be considered private and might change without notice
*/
Site.prototype.rawActivateImprovedHexManagement = function () {
return this.client.request({
method: 'PUT',
url: '/site/activate-improved-hex-management',
});
};
/**
* Activate improved GraphQL multi-locale fields option
*
* Read more: https://www.datocms.com/docs/content-management-api/resources/site/activate_improved_gql_multilocale_fields
*
* @throws {ApiError}
* @throws {TimeoutError}
*
* @deprecated This API call is to be considered private and might change without notice
*/
Site.prototype.activateImprovedGqlMultilocaleFields = function () {
return this.rawActivateImprovedGqlMultilocaleFields().then(function (body) {
return Utils.deserializeResponseBody(body);
});
};
/**
* Activate improved GraphQL multi-locale fields option
*
* Read more: https://www.datocms.com/docs/content-management-api/resources/site/activate_improved_gql_multilocale_fields
*
* @throws {ApiError}
* @throws {TimeoutError}
*
* @deprecated This API call is to be considered private and might change without notice
*/
Site.prototype.rawActivateImprovedGqlMultilocaleFields = function () {
return this.client.request({
method: 'PUT',
url: '/site/activate-improved-gql-multilocale-fields',
});
};
/**
* Activate improved GraphQL visibility control option
*
* Read more: https://www.datocms.com/docs/content-management-api/resources/site/activate_improved_gql_visibility_control
*
* @throws {ApiError}
* @throws {TimeoutError}
*
* @deprecated This API call is to be considered private and might change without notice
*/
Site.prototype.activateImprovedGqlVisibilityControl = function () {
return this.rawActivateImprovedGqlVisibilityControl().then(function (body) {
return Utils.deserializeResponseBody(body);
});
};
/**
* Activate improved GraphQL visibility control option
*
* Read more: https://www.datocms.com/docs/content-management-api/resources/site/activate_improved_gql_visibility_control
*
* @throws {ApiError}
* @throws {TimeoutError}
*
* @deprecated This API call is to be considered private and might change without notice
*/
Site.prototype.rawActivateImprovedGqlVisibilityControl = function () {
return this.client.request({
method: 'PUT',
url: '/site/activate-improved-gql-visibility-control',
});
};
/**
* Activate improved Boolean fields option
*
* Read more: https://www.datocms.com/docs/content-management-api/resources/site/activate_improved_boolean_fields
*
* @throws {ApiError}
* @throws {TimeoutError}
*
* @deprecated This API call is to be considered private and might change without notice
*/
Site.prototype.activateImprovedBooleanFields = function () {
return this.rawActivateImprovedBooleanFields().then(function (body) {
return Utils.deserializeResponseBody(body);
});
};
/**
* Activate improved Boolean fields option
*
* Read more: https://www.datocms.com/docs/content-management-api/resources/site/activate_improved_boolean_fields
*
* @throws {ApiError}
* @throws {TimeoutError}
*
* @deprecated This API call is to be considered private and might change without notice
*/
Site.prototype.rawActivateImprovedBooleanFields = function () {
return this.client.request({
method: 'PUT',
url: '/site/activate-improved-boolean-fields',
});
};
/**
* Set draft mode default to true for all environment's models
*
* Read more: https://www.datocms.com/docs/content-management-api/resources/site/activate_draft_mode_as_default
*
* @throws {ApiError}
* @throws {TimeoutError}
*
* @deprecated This API call is to be considered private and might change without notice
*/
Site.prototype.activateDraftModeAsDefault = function () {
return this.rawActivateDraftModeAsDefault().then(function (body) {
return Utils.deserializeResponseBody(body);
});
};
/**
* Set draft mode default to true for all environment's models
*
* Read more: https://www.datocms.com/docs/content-management-api/resources/site/activate_draft_mode_as_default
*
* @throws {ApiError}
* @throws {TimeoutError}
*
* @deprecated This API call is to be considered private and might change without notice
*/
Site.prototype.rawActivateDraftModeAsDefault = function () {
return this.client.request({
method: 'PUT',
url: '/site/activate-draft-mode-as-default',
});
};
/**
* Activate improved validation at publishing option
*
* Read more: https://www.datocms.com/docs/content-management-api/resources/site/activate_improved_validation_at_publishing
*
* @throws {ApiError}
* @throws {TimeoutError}
*
* @deprecated This API call is to be considered private and might change without notice
*/
Site.prototype.activateImprovedValidationAtPublishing = function () {
return this.rawActivateImprovedValidationAtPublishing().then(function (body) {
return Utils.deserializeResponseBody(body);
});
};
/**
* Activate improved validation at publishing option
*
* Read more: https://www.datocms.com/docs/content-management-api/resources/site/activate_improved_validation_at_publishing
*
* @throws {ApiError}
* @throws {TimeoutError}
*
* @deprecated This API call is to be considered private and might change without notice
*/
Site.prototype.rawActivateImprovedValidationAtPublishing = function () {
return this.client.request({
method: 'PUT',
url: '/site/activate-improved-validation-at-publishing',
});
};
/**
* Update CDN settings default assets
*
* Read more: https://www.datocms.com/docs/content-management-api/resources/site/update_assets_cdn_default_settings
*
* @throws {ApiError}
* @throws {TimeoutError}
*
* @deprecated This API call is to be considered private and might change without notice
*/
Site.prototype.updateAssetsCdnDefaultSettings = function (body) {
return this.rawUpdateAssetsCdnDefaultSettings(Utils.serializeRequestBody(body, {
type: 'assets-cdn-default-settings',
attributes: ['assets_cdn_default_settings'],
relationships: [],
})).then(function (body) {
return Utils.deserializeResponseBody(body);
});
};
/**
* Update CDN settings default assets
*
* Read more: https://www.datocms.com/docs/content-management-api/resources/site/update_assets_cdn_default_settings
*
* @throws {ApiError}
* @throws {TimeoutError}
*
* @deprecated This API call is to be considered private and might change without notice
*/
Site.prototype.rawUpdateAssetsCdnDefaultSettings = function (body) {
return this.client.request({
method: 'PUT',
url: '/site/assets-cdn-default-settings',
body: body,
});
};
Site.TYPE = 'site';
return Site;
}(BaseResource_1.default));
exports.default = Site;
//# sourceMappingURL=Site.js.map