@datocms/cma-client
Version:
JS client for DatoCMS REST Content Management API
397 lines • 14 kB
JavaScript
import * as Utils from '@datocms/rest-client-utils';
import BaseResource from '../../BaseResource';
export default class Site extends BaseResource {
/**
* Retrieve the site
*
* Read more: https://www.datocms.com/docs/content-management-api/resources/site/self
*
* @throws {ApiError}
* @throws {TimeoutError}
*/
find(queryParams) {
return this.rawFind(queryParams).then((body) => Utils.deserializeResponseBody(body));
}
/**
* Retrieve the site
*
* Read more: https://www.datocms.com/docs/content-management-api/resources/site/self
*
* @throws {ApiError}
* @throws {TimeoutError}
*/
rawFind(queryParams) {
return this.client.request({
method: 'GET',
url: '/site',
queryParams,
});
}
/**
* Update the site's settings
*
* Read more: https://www.datocms.com/docs/content-management-api/resources/site/update
*
* @throws {ApiError}
* @throws {TimeoutError}
*/
update(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((body) => 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}
*/
rawUpdate(body) {
return this.client.request({
method: 'PUT',
url: '/site',
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
*/
activateImprovedTimezoneManagement() {
return this.rawActivateImprovedTimezoneManagement().then((body) => 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
*/
rawActivateImprovedTimezoneManagement() {
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
*/
activateImprovedHexManagement() {
return this.rawActivateImprovedHexManagement().then((body) => 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
*/
rawActivateImprovedHexManagement() {
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
*/
activateImprovedGqlMultilocaleFields() {
return this.rawActivateImprovedGqlMultilocaleFields().then((body) => 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
*/
rawActivateImprovedGqlMultilocaleFields() {
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
*/
activateImprovedGqlVisibilityControl() {
return this.rawActivateImprovedGqlVisibilityControl().then((body) => 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
*/
rawActivateImprovedGqlVisibilityControl() {
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
*/
activateImprovedBooleanFields() {
return this.rawActivateImprovedBooleanFields().then((body) => 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
*/
rawActivateImprovedBooleanFields() {
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
*/
activateDraftModeAsDefault() {
return this.rawActivateDraftModeAsDefault().then((body) => 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
*/
rawActivateDraftModeAsDefault() {
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
*/
activateImprovedValidationAtPublishing() {
return this.rawActivateImprovedValidationAtPublishing().then((body) => 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
*/
rawActivateImprovedValidationAtPublishing() {
return this.client.request({
method: 'PUT',
url: '/site/activate-improved-validation-at-publishing',
});
}
/**
* Activate having two different GraphQL fields for regular blocks and inline blocks
*
* Read more: https://www.datocms.com/docs/content-management-api/resources/site/activate_improved_exposure_of_inline_blocks_in_cda
*
* @throws {ApiError}
* @throws {TimeoutError}
*
* @deprecated This API call is to be considered private and might change without notice
*/
activateImprovedExposureOfInlineBlocksInCda() {
return this.rawActivateImprovedExposureOfInlineBlocksInCda().then((body) => Utils.deserializeResponseBody(body));
}
/**
* Activate having two different GraphQL fields for regular blocks and inline blocks
*
* Read more: https://www.datocms.com/docs/content-management-api/resources/site/activate_improved_exposure_of_inline_blocks_in_cda
*
* @throws {ApiError}
* @throws {TimeoutError}
*
* @deprecated This API call is to be considered private and might change without notice
*/
rawActivateImprovedExposureOfInlineBlocksInCda() {
return this.client.request({
method: 'PUT',
url: '/site/activate-improved-exposure-of-inline-blocks-in-cda',
});
}
/**
* Activate improved items listing
*
* Read more: https://www.datocms.com/docs/content-management-api/resources/site/activate_improved_items_listing
*
* @throws {ApiError}
* @throws {TimeoutError}
*
* @deprecated This API call is to be considered private and might change without notice
*/
activateImprovedItemsListing() {
return this.rawActivateImprovedItemsListing().then((body) => Utils.deserializeResponseBody(body));
}
/**
* Activate improved items listing
*
* Read more: https://www.datocms.com/docs/content-management-api/resources/site/activate_improved_items_listing
*
* @throws {ApiError}
* @throws {TimeoutError}
*
* @deprecated This API call is to be considered private and might change without notice
*/
rawActivateImprovedItemsListing() {
return this.client.request({
method: 'PUT',
url: '/site/activate-improved-items-listing',
});
}
/**
* Activate milliseconds in datetime
*
* Read more: https://www.datocms.com/docs/content-management-api/resources/site/activate_milliseconds_in_datetime
*
* @throws {ApiError}
* @throws {TimeoutError}
*
* @deprecated This API call is to be considered private and might change without notice
*/
activateMillisecondsInDatetime() {
return this.rawActivateMillisecondsInDatetime().then((body) => Utils.deserializeResponseBody(body));
}
/**
* Activate milliseconds in datetime
*
* Read more: https://www.datocms.com/docs/content-management-api/resources/site/activate_milliseconds_in_datetime
*
* @throws {ApiError}
* @throws {TimeoutError}
*
* @deprecated This API call is to be considered private and might change without notice
*/
rawActivateMillisecondsInDatetime() {
return this.client.request({
method: 'PUT',
url: '/site/activate-milliseconds-in-datetime',
});
}
/**
* 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
*/
updateAssetsCdnDefaultSettings(body) {
return this.rawUpdateAssetsCdnDefaultSettings(Utils.serializeRequestBody(body, {
type: 'assets-cdn-default-settings',
attributes: ['assets_cdn_default_settings'],
relationships: [],
})).then((body) => 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
*/
rawUpdateAssetsCdnDefaultSettings(body) {
return this.client.request({
method: 'PUT',
url: '/site/assets-cdn-default-settings',
body,
});
}
}
Site.TYPE = 'site';
//# sourceMappingURL=Site.js.map