Skip to content
This repository has been archived by the owner on Jan 19, 2022. It is now read-only.

Commit

Permalink
feat(api): baseline working api
Browse files Browse the repository at this point in the history
  • Loading branch information
zkat committed Mar 16, 2018
1 parent f527429 commit 122658e
Show file tree
Hide file tree
Showing 6 changed files with 232 additions and 153 deletions.
9 changes: 5 additions & 4 deletions config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@

const pudding = require('figgy-pudding')

const NpmHooksConfig = pudding({
'scope': {}
})
const NpmHooksConfig = pudding()

module.exports = config
function config (opts) {
return NpmHooksConfig(opts, opts.config)
return NpmHooksConfig.apply(
null,
[opts, opts.config].concat([].slice.call(arguments, 1))
)
}
9 changes: 5 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@ module.exports = {
name = name.replace(/^@?/, '@')
}

return fetch('/v1/hooks/hook', config({
opts = config({
method: 'POST',
body: { type, name, endpoint, secret }
}, opts))
}, opts)
return fetch.json('/v1/hooks/hook', opts)
},

rm (id, opts) {
return fetch(`/v1/hooks/hook/${encodeURIComponent(id)}`, config({
return fetch.json(`/v1/hooks/hook/${encodeURIComponent(id)}`, config({
method: 'DELETE'
}, opts))
},
Expand All @@ -39,6 +40,6 @@ module.exports = {
return fetch.json(`/v1/hooks/hook/${encodeURIComponent(id)}`, config({
method: 'PUT',
body: {endpoint, secret}
}))
}, opts))
}
}
Loading

0 comments on commit 122658e

Please sign in to comment.