Skip to content

Commit

Permalink
Merge pull request #2 from Typeform/webhooks
Browse files Browse the repository at this point in the history
Support responses and webhooks and update docs
  • Loading branch information
jepser authored Apr 24, 2018
2 parents 1caa69d + 3c0daec commit c97708f
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 4 deletions.
40 changes: 37 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,20 +72,22 @@ Client returns the following properties:
- `teams`
- `workspaces`
- `themes`
- `responses`
- `webhooks`

Each one of them encapsulates the operations related to it (like listing, updating, deleting the resource).

### Forms

#### `forms.list({ page: 1, page_size: 10, search: '' })`
#### `forms.list({ page: 1, page_size = 10, search = '' })`
- Get a list of your typeforms
- Returns a list of typeform with the payload [refenced here](https://developer.typeform.com/create/reference/retrieve-forms/).

#### `forms.get({ uid })`
- Get a typeform by UID
- Returns a typeform with the payload [refenced here](https://developer.typeform.com/create/reference/retrieve-form/).

#### `forms.update({ uid, data = {}, override: false })`
#### `forms.update({ uid, data = {}, override = false })`
- Get a typeform by UID
- Returns a typeform with the payload [refenced here](https://developer.typeform.com/create/reference/retrieve-form/).

Expand Down Expand Up @@ -182,6 +184,39 @@ Each one of them encapsulates the operations related to it (like listing, updati
- `members`: `string` or an `array` and should be the email fo the user
- Removing multiple members at once is possible using an array of emails

### Responses

#### `responses.list({ uid, page_size, since, until, after, before, completed, sort, query, fields })`
- List responses from the given ID
- `uid`: typeform UID
- For parameter details check [the documentation](https://developer.typeform.com/responses/reference/retrieve-responses/)

## Webhooks

#### `webhook.get({ uid, tag })`
- Get detailf for a webhook with the given tag
- `uid`: typeform UID
- `tag`: tag of the webhook created

#### `webhook.create({ uid, tag, url, enable = false })`
- Create a webhook with the given tag
- `uid`: typeform UID
- `tag`: (string) tag of the webhook, how are you going to identify it
- `url`: (string) url of the service you want to notify
- `enable`: (bool)

#### `webhook.update({ uid, tag, url, enable = false })`
- Update a webhook with the given tag
- `uid`: typeform UID
- `tag`: (string) tag of the webhook, how are you going to identify it
- `url`: (string) url of the service you want to notify
- `enable`: (bool)

#### `webhook.delete({ uid, tag })`
- Delete for a webhook with the given tag
- `uid`: typeform UID
- `tag`: (string) tag of the webhook

## Examples

##### Update specific typeform property, as [referenced here](https://developer.typeform.com/create/reference/update-form-patch/)
Expand Down Expand Up @@ -254,7 +289,6 @@ The theme property applies a `theme` to the form. If you don't specify a value f

```


### Testing

The project has implemeted unit and integration tests.
Expand Down
2 changes: 1 addition & 1 deletion src/webhooks.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export const webhooks = http => ({
list: args => getWebhook(http, args),
get: args => getWebhook(http, args),
create: args => createWebhook(http, args),
update: args => updateWebhook(http, args),
delete: args => deleteWebhook(http, args)
Expand Down

0 comments on commit c97708f

Please sign in to comment.