Skip to content

Commit c94df63

Browse files
authored
Merge pull request #258 from jamiequint/enable_admin_away_mode_changes
enable updating admin away mode and reassignment settings
2 parents aacc1dc + 1266c97 commit c94df63

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,11 @@ client.admins.me(callback);
415415
client.admins.find('123456789', callback);
416416
```
417417

418+
```
419+
// Update admin away mode and reassign settings
420+
client.admins.away('123456789', {'away_mode_enabled': true, 'away_mode_reassign': false}, callback);
421+
```
422+
418423
## Tags
419424

420425
```node

lib/admin.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,7 @@ export default class Admin {
1111
me(f) {
1212
return this.client.get('/me', {}, f);
1313
}
14+
away(id, params, f) {
15+
return this.client.put(`/admins/${id}/away`, params, f);
16+
}
1417
}

test/admin.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,12 @@ describe('admins', () => {
2727
done();
2828
});
2929
});
30+
it('should update admin away mode and reassign settings', done => {
31+
nock('https://api.intercom.io').put('/admins/baz/away', { away_mode_enabled: true, away_mode_reassign: false }).reply(200, {});
32+
const client = new Client('foo', 'bar').usePromises();
33+
client.admins.away('baz', { away_mode_enabled: true, away_mode_reassign: false }).then(r => {
34+
assert.equal(200, r.statusCode);
35+
done();
36+
});
37+
});
3038
});

0 commit comments

Comments
 (0)