contential
Advanced tools
Comparing version 0.0.6 to 0.0.7
{ | ||
"name": "contential", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"description": "JavaScript client for Contential.", | ||
@@ -5,0 +5,0 @@ "author": "Tom Andre", |
@@ -36,2 +36,29 @@ import axios from 'axios'; | ||
async update({ regionId, spaceId, recordId, localeId, data, apiKey }) { | ||
try { | ||
const apiKeyId = apiKey || this.client.apiKey; | ||
regionId = regionId || 'global'; | ||
const query = { | ||
localeId, | ||
}; | ||
const url = `${ | ||
this.client.config[regionId].CONTENT_URL | ||
}/spaces/${spaceId}/records/${recordId}?${queryString.stringify(query)}`; | ||
const contentType = | ||
typeof data === 'object' ? 'application/json' : 'text/plain'; | ||
const response = await axios({ | ||
method: 'PUT', | ||
url, | ||
headers: { | ||
'content-type': contentType, | ||
'x-api-key': apiKeyId, | ||
}, | ||
data, | ||
}); | ||
return response.data; | ||
} catch (error) { | ||
throw error.response.data; | ||
} | ||
} | ||
async get({ regionId, spaceId, recordId, localeId, apiKey }) { | ||
@@ -38,0 +65,0 @@ try { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
43071
1164