Skip to content

Commit

Permalink
feat(core): added update translations method to update multiple trans…
Browse files Browse the repository at this point in the history
…lations at once (#29)

From the API documentation it is possible to update multiple translations at once. See here https://developers.shopware.com/developers-guide/rest-api/api-resource-translation/ and here https://developers.shopware.com/developers-guide/rest-api/examples/translation/
  • Loading branch information
Zwergal authored and apertureless committed Nov 8, 2018
1 parent f05e1e5 commit 21dd0b3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ Find the [docs here](https://apertureless.github.io/shopware-api-client/#/) *con
- .getTranslation(id, [callback]) 🔀 `Promise`
- .createTranslation(id, body, [callback]) 🔀 `Promise`
- .updateTranslation(id, body, [callback]) 🔀 `Promise`
- .updateTranslations(body, [callback]) 🔀 `Promise`
- .deleteTranslation(id, [callback]) 🔀 `Promise`

## Contributing
Expand Down
12 changes: 12 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -894,6 +894,18 @@ class Shopware {
})
}

updateTranslations(body) {
if (!body) {
return handleError(ERROR.MISSING_BODY)
}

return this.handleRequest({
url: `translations/`,
method: 'PUT',
body
})
}

deleteTranslation(id) {
if (!id) {
return handleError(ERROR.MISSING_ID)
Expand Down

0 comments on commit 21dd0b3

Please sign in to comment.