UNPKG

@datocms/cma-client

Version:
351 lines 12.7 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 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)); export default Site; //# sourceMappingURL=Site.js.map