Skip to content

Commit

Permalink
Added webhooks
Browse files Browse the repository at this point in the history
  • Loading branch information
restmount committed Feb 18, 2018
1 parent c9fc47c commit dc1c7ce
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 5 deletions.
5 changes: 5 additions & 0 deletions README.md
Expand Up @@ -216,6 +216,11 @@ api.productCategories.create({ name: 'Shoes' })
* `api.files.list(filter)`
* `api.files.upload(formData)`
* `api.files.delete(fileName)`
* `api.webhooks.list`
* `api.webhooks.retrieve`
* `api.webhooks.create`
* `api.webhooks.update`
* `api.webhooks.delete`
* `api.apps.settings.retrieve(appKey)`
* `api.apps.settings.update(appKey, data)`
* `api.theme.placeholders.list()`
Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
@@ -1,6 +1,6 @@
{
"name": "cezerin-client",
"version": "0.31.0",
"version": "0.31.1",
"description": "Cezerin API client library. Work on browser and server.",
"keywords": [
"cezerin",
Expand Down Expand Up @@ -33,7 +33,7 @@
},
"dependencies": {
"isomorphic-fetch": "^2.2.1",
"query-string": "^5.0.1"
"query-string": "^5.1.0"
},
"devDependencies": {
"babel-cli": "^6.26.0",
Expand Down
27 changes: 27 additions & 0 deletions src/api/webhooks.js
@@ -0,0 +1,27 @@
class Webhooks {
constructor(client) {
this.client = client;
}

list() {
return this.client.get('/webhooks');
}

retrieve(id) {
return this.client.get(`/webhooks/${id}`);
}

create(data) {
return this.client.post(`/webhooks`, data);
}

update(id, data) {
return this.client.put(`/webhooks/${id}`, data);
}

delete(id) {
return this.client.delete(`/webhooks/${id}`);
}
}

module.exports = Webhooks;
2 changes: 2 additions & 0 deletions src/index.js
Expand Up @@ -35,6 +35,7 @@ const CheckoutFields = require('./api/checkoutFields')
const Pages = require('./api/pages')
const Tokens = require('./api/tokens')
const Redirects = require('./api/redirects')
const Webhooks = require('./api/webhooks')
const Files = require('./api/files')
const AppSettings = require('./api/apps/settings')
const WebStoreAccount = require('./webstore/account')
Expand Down Expand Up @@ -87,6 +88,7 @@ class Client {
this.pages = new Pages(apiClient);
this.tokens = new Tokens(apiClient);
this.redirects = new Redirects(apiClient);
this.webhooks = new Webhooks(apiClient);
this.files = new Files(apiClient);
this.apps = {};
this.apps.settings = new AppSettings(apiClient);
Expand Down

0 comments on commit dc1c7ce

Please sign in to comment.