Skip to content

enable updating admin away mode and reassignment settings #258

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,11 @@ client.admins.me(callback);
client.admins.find('123456789', callback);
```

```
// Update admin away mode and reassign settings
client.admins.away('123456789', {'away_mode_enabled': true, 'away_mode_reassign': false}, callback);
```

## Tags

```node
Expand Down
3 changes: 3 additions & 0 deletions lib/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,7 @@ export default class Admin {
me(f) {
return this.client.get('/me', {}, f);
}
away(id, params, f) {
return this.client.put(`/admins/${id}/away`, params, f);
}
}
8 changes: 8 additions & 0 deletions test/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,12 @@ describe('admins', () => {
done();
});
});
it('should update admin away mode and reassign settings', done => {
nock('https://api.intercom.io').put('/admins/baz/away', { away_mode_enabled: true, away_mode_reassign: false }).reply(200, {});
const client = new Client('foo', 'bar').usePromises();
client.admins.away('baz', { away_mode_enabled: true, away_mode_reassign: false }).then(r => {
assert.equal(200, r.statusCode);
done();
});
});
});