diff --git a/lib/api/channels.js b/lib/api/channels.js index 80ccf04..1f6302e 100644 --- a/lib/api/channels.js +++ b/lib/api/channels.js @@ -46,6 +46,10 @@ class Channels { return this.client.request("POST", "channels.create", { name }, callback); } + delete (roomId, callback) { + return this.client.request("POST", "channels.delete", {roomId}, callback); + } + getIntegrations(roomId, { offset = 0, count = 0, sort = undefined, fields = undefined, query = undefined} ={}, callback) { let options = {roomId}; Object.assign(options, pageQueryMapping(arguments[1])); diff --git a/lib/api/groups.js b/lib/api/groups.js index cb40fae..f45459d 100644 --- a/lib/api/groups.js +++ b/lib/api/groups.js @@ -40,6 +40,10 @@ class Groups { return this.client.request("POST", "groups.create", { name, members}, callback); } + delete (roomId, callback) { + return this.client.request("POST", "groups.delete", {roomId}, callback); + } + getIntegrations(roomId, { offset = 0, count = 0, sort = undefined, fields = undefined, query = undefined} ={}, callback) { let options = {roomId}; Object.assign(options, pageQueryMapping(arguments[1])); diff --git a/test/channels.test.js b/test/channels.test.js index 70689a3..2527481 100644 --- a/test/channels.test.js +++ b/test/channels.test.js @@ -406,5 +406,17 @@ describe("channels", function () { readonlyChannel.channel.ro.should.equal(true); }); }); + + it("Deletes the channel", function (done) { + rocketChatClient.channels.delete(addedRoomId, function (err, result) { + should(err).be.null(); + should(result).not.be.null(); + should(result.success).be.true(); + + addedRoomId = null; + + done(); + }); + }); }); -}); \ No newline at end of file +}); diff --git a/test/groups.test.js b/test/groups.test.js index 87e4550..d30fe7a 100644 --- a/test/groups.test.js +++ b/test/groups.test.js @@ -374,5 +374,17 @@ describe("groups", () => { createGroupId = null; }); }); + + it("Deletes the group", function (done) { + rocketChatClient.groups.delete(createGroupId, function (err, result) { + should(err).be.null(); + should(result).not.be.null(); + should(result.success).be.true(); + + createGroupId = null; + + done(); + }); + }); }); });