@datocms/cma-client
Advanced tools
Comparing version 3.1.8 to 3.1.9
@@ -132,3 +132,3 @@ "use strict"; | ||
var _this = this; | ||
return (0, rest_client_utils_1.request)(__assign(__assign(__assign({}, this.config), options), { logFn: this.config.logFn || console.log, userAgent: '@datocms/cma-client v3.1.8', baseUrl: this.baseUrl, preCallStack: new Error().stack, extraHeaders: __assign(__assign(__assign({}, (this.config.extraHeaders || {})), (this.config.environment | ||
return (0, rest_client_utils_1.request)(__assign(__assign(__assign({}, this.config), options), { logFn: this.config.logFn || console.log, userAgent: '@datocms/cma-client v3.1.9', baseUrl: this.baseUrl, preCallStack: new Error().stack, extraHeaders: __assign(__assign(__assign({}, (this.config.extraHeaders || {})), (this.config.environment | ||
? { 'X-Environment': this.config.environment } | ||
@@ -135,0 +135,0 @@ : {})), { 'X-API-Version': '3' }), fetchJobResult: function (jobId) { |
@@ -113,2 +113,35 @@ "use strict"; | ||
/** | ||
* Rename an environment | ||
* | ||
* Read more: https://www.datocms.com/docs/content-management-api/resources/environment/rename | ||
* | ||
* @throws {ApiError} | ||
* @throws {TimeoutError} | ||
*/ | ||
Environment.prototype.rename = function (environmentId, body) { | ||
return this.rawRename(Utils.toId(environmentId), Utils.serializeRequestBody(body, { | ||
id: Utils.toId(environmentId), | ||
type: 'environment', | ||
attributes: [], | ||
relationships: [], | ||
})).then(function (body) { | ||
return Utils.deserializeResponseBody(body); | ||
}); | ||
}; | ||
/** | ||
* Rename an environment | ||
* | ||
* Read more: https://www.datocms.com/docs/content-management-api/resources/environment/rename | ||
* | ||
* @throws {ApiError} | ||
* @throws {TimeoutError} | ||
*/ | ||
Environment.prototype.rawRename = function (environmentId, body) { | ||
return this.client.request({ | ||
method: 'PUT', | ||
url: "/environments/".concat(environmentId, "/rename"), | ||
body: body, | ||
}); | ||
}; | ||
/** | ||
* List all environments | ||
@@ -115,0 +148,0 @@ * |
@@ -106,3 +106,3 @@ var __assign = (this && this.__assign) || function () { | ||
var _this = this; | ||
return request(__assign(__assign(__assign({}, this.config), options), { logFn: this.config.logFn || console.log, userAgent: '@datocms/cma-client v3.1.8', baseUrl: this.baseUrl, preCallStack: new Error().stack, extraHeaders: __assign(__assign(__assign({}, (this.config.extraHeaders || {})), (this.config.environment | ||
return request(__assign(__assign(__assign({}, this.config), options), { logFn: this.config.logFn || console.log, userAgent: '@datocms/cma-client v3.1.9', baseUrl: this.baseUrl, preCallStack: new Error().stack, extraHeaders: __assign(__assign(__assign({}, (this.config.extraHeaders || {})), (this.config.environment | ||
? { 'X-Environment': this.config.environment } | ||
@@ -109,0 +109,0 @@ : {})), { 'X-API-Version': '3' }), fetchJobResult: function (jobId) { |
@@ -43,2 +43,20 @@ import BaseResource from '../../BaseResource'; | ||
/** | ||
* Rename an environment | ||
* | ||
* Read more: https://www.datocms.com/docs/content-management-api/resources/environment/rename | ||
* | ||
* @throws {ApiError} | ||
* @throws {TimeoutError} | ||
*/ | ||
rename(environmentId: string | SimpleSchemaTypes.EnvironmentData, body: SimpleSchemaTypes.EnvironmentRenameSchema): Promise<SimpleSchemaTypes.Environment>; | ||
/** | ||
* Rename an environment | ||
* | ||
* Read more: https://www.datocms.com/docs/content-management-api/resources/environment/rename | ||
* | ||
* @throws {ApiError} | ||
* @throws {TimeoutError} | ||
*/ | ||
rawRename(environmentId: string, body: SchemaTypes.EnvironmentRenameSchema): Promise<SchemaTypes.EnvironmentRenameTargetSchema>; | ||
/** | ||
* List all environments | ||
@@ -45,0 +63,0 @@ * |
@@ -85,2 +85,35 @@ var __extends = (this && this.__extends) || (function () { | ||
/** | ||
* Rename an environment | ||
* | ||
* Read more: https://www.datocms.com/docs/content-management-api/resources/environment/rename | ||
* | ||
* @throws {ApiError} | ||
* @throws {TimeoutError} | ||
*/ | ||
Environment.prototype.rename = function (environmentId, body) { | ||
return this.rawRename(Utils.toId(environmentId), Utils.serializeRequestBody(body, { | ||
id: Utils.toId(environmentId), | ||
type: 'environment', | ||
attributes: [], | ||
relationships: [], | ||
})).then(function (body) { | ||
return Utils.deserializeResponseBody(body); | ||
}); | ||
}; | ||
/** | ||
* Rename an environment | ||
* | ||
* Read more: https://www.datocms.com/docs/content-management-api/resources/environment/rename | ||
* | ||
* @throws {ApiError} | ||
* @throws {TimeoutError} | ||
*/ | ||
Environment.prototype.rawRename = function (environmentId, body) { | ||
return this.client.request({ | ||
method: 'PUT', | ||
url: "/environments/".concat(environmentId, "/rename"), | ||
body: body, | ||
}); | ||
}; | ||
/** | ||
* List all environments | ||
@@ -87,0 +120,0 @@ * |
@@ -43,2 +43,20 @@ import BaseResource from '../../BaseResource'; | ||
/** | ||
* Rename an environment | ||
* | ||
* Read more: https://www.datocms.com/docs/content-management-api/resources/environment/rename | ||
* | ||
* @throws {ApiError} | ||
* @throws {TimeoutError} | ||
*/ | ||
rename(environmentId: string | SimpleSchemaTypes.EnvironmentData, body: SimpleSchemaTypes.EnvironmentRenameSchema): Promise<SimpleSchemaTypes.Environment>; | ||
/** | ||
* Rename an environment | ||
* | ||
* Read more: https://www.datocms.com/docs/content-management-api/resources/environment/rename | ||
* | ||
* @throws {ApiError} | ||
* @throws {TimeoutError} | ||
*/ | ||
rawRename(environmentId: string, body: SchemaTypes.EnvironmentRenameSchema): Promise<SchemaTypes.EnvironmentRenameTargetSchema>; | ||
/** | ||
* List all environments | ||
@@ -45,0 +63,0 @@ * |
{ | ||
"name": "@datocms/cma-client", | ||
"version": "3.1.8", | ||
"version": "3.1.9", | ||
"description": "JS client for DatoCMS REST Content Management API", | ||
@@ -33,10 +33,10 @@ "keywords": ["datocms", "client"], | ||
"dependencies": { | ||
"@datocms/rest-client-utils": "^3.1.8", | ||
"@datocms/rest-client-utils": "^3.1.9", | ||
"uuid": "^9.0.1" | ||
}, | ||
"devDependencies": { | ||
"@datocms/dashboard-client": "^3.1.8", | ||
"@datocms/dashboard-client": "^3.1.9", | ||
"@types/uuid": "^9.0.7" | ||
}, | ||
"gitHead": "90d7a8706a45fcacbeb1430df55b6efc0ebea78b" | ||
"gitHead": "efe9e4ae7212492ff57d0d89c2162d7ef5ff89e1" | ||
} |
@@ -146,3 +146,3 @@ import { | ||
logFn: this.config.logFn || console.log, | ||
userAgent: '@datocms/cma-client v3.1.8', | ||
userAgent: '@datocms/cma-client v3.1.9', | ||
baseUrl: this.baseUrl, | ||
@@ -149,0 +149,0 @@ preCallStack: new Error().stack, |
@@ -93,2 +93,48 @@ import * as Utils from '@datocms/rest-client-utils'; | ||
/** | ||
* Rename an environment | ||
* | ||
* Read more: https://www.datocms.com/docs/content-management-api/resources/environment/rename | ||
* | ||
* @throws {ApiError} | ||
* @throws {TimeoutError} | ||
*/ | ||
rename( | ||
environmentId: string | SimpleSchemaTypes.EnvironmentData, | ||
body: SimpleSchemaTypes.EnvironmentRenameSchema, | ||
) { | ||
return this.rawRename( | ||
Utils.toId(environmentId), | ||
Utils.serializeRequestBody<SchemaTypes.EnvironmentRenameSchema>(body, { | ||
id: Utils.toId(environmentId), | ||
type: 'environment', | ||
attributes: [], | ||
relationships: [], | ||
}), | ||
).then((body) => | ||
Utils.deserializeResponseBody<SimpleSchemaTypes.EnvironmentRenameTargetSchema>( | ||
body, | ||
), | ||
); | ||
} | ||
/** | ||
* Rename an environment | ||
* | ||
* Read more: https://www.datocms.com/docs/content-management-api/resources/environment/rename | ||
* | ||
* @throws {ApiError} | ||
* @throws {TimeoutError} | ||
*/ | ||
rawRename( | ||
environmentId: string, | ||
body: SchemaTypes.EnvironmentRenameSchema, | ||
): Promise<SchemaTypes.EnvironmentRenameTargetSchema> { | ||
return this.client.request<SchemaTypes.EnvironmentRenameTargetSchema>({ | ||
method: 'PUT', | ||
url: `/environments/${environmentId}/rename`, | ||
body, | ||
}); | ||
} | ||
/** | ||
* List all environments | ||
@@ -95,0 +141,0 @@ * |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
3357295
99330