From 26f6bc0804bbc3a8097851d6e18dfe3b5a04778a Mon Sep 17 00:00:00 2001 From: Marcos Defendi Date: Fri, 31 Aug 2018 10:37:39 -0300 Subject: [PATCH] Rest groups and channels moderators --- _data/toc.yml | 2 + .../documentation/documentation-map/README.md | 2 + developer-guides/rest-api/README.md | 2 + developer-guides/rest-api/channels/README.md | 1 + .../rest-api/channels/moderators/README.md | 43 +++++++++++++++++++ developer-guides/rest-api/groups/README.md | 1 + .../rest-api/groups/moderators/README.md | 43 +++++++++++++++++++ 7 files changed, 94 insertions(+) create mode 100644 developer-guides/rest-api/channels/moderators/README.md create mode 100644 developer-guides/rest-api/groups/moderators/README.md diff --git a/_data/toc.yml b/_data/toc.yml index e1ff9db43d..9676d8f38e 100644 --- a/_data/toc.yml +++ b/_data/toc.yml @@ -249,6 +249,7 @@ - list.joined - list - members + - moderators - open - removeModerator - removeOwner @@ -299,6 +300,7 @@ - leave - list - listAll + - moderators - open - removeModerator - removeOwner diff --git a/contributing/documentation/documentation-map/README.md b/contributing/documentation/documentation-map/README.md index 4d8a520750..4af4fc65d3 100644 --- a/contributing/documentation/documentation-map/README.md +++ b/contributing/documentation/documentation-map/README.md @@ -277,6 +277,7 @@ Here you can also find what articles are incomplete and missing. - list.joined - list - members + - moderators - open - removeModerator - removeOwner @@ -329,6 +330,7 @@ Here you can also find what articles are incomplete and missing. - list - listAll - [members](../missing-and-outdated-list/index.html#groupsmembers) + - moderators - open - removeModerator - removeOwner diff --git a/developer-guides/rest-api/README.md b/developer-guides/rest-api/README.md index f4d87ed2af..0e644c9d34 100644 --- a/developer-guides/rest-api/README.md +++ b/developer-guides/rest-api/README.md @@ -91,6 +91,7 @@ When calling a production Rocket.Chat server, ensure it is running via HTTPS and | `/api/v1/channels.list` | Retrieves all of the channels from the server. | [Link](channels/list/) | | `/api/v1/channels.list.joined` | Gets only the channels the calling user has joined. | [Link](channels/list-joined/) | | `/api/v1/channels.members` | Retrieves all channel users. | [Link](channels/members/) | +| `/api/v1/channels.moderators` | List all moderators of a channel. | [Link](channels/moderators/) | | `/api/v1/channels.open` | Adds the channel back to the user's list of channels. | [Link](channels/open/) | | `/api/v1/channels.rename` | Changes a channel's name. | [Link](channels/rename/) | | `/api/v1/channels.roles` | Gets the user's roles in the channel. | [Link](channels/roles/) | @@ -121,6 +122,7 @@ When calling a production Rocket.Chat server, ensure it is running via HTTPS and | `/api/v1/groups.leave` | Removes the calling user from the private group. | [Link](groups/leave/) | | `/api/v1/groups.list` | List the private groups the caller is part of. | [Link](groups/list/) | | `/api/v1/groups.listAll` | List all the private groups. | [Link](groups/listall/) | +| `/api/v1/groups.moderators` | List all moderators of a group. | [Link](groups/moderators/) | | `/api/v1/groups.open` | Adds the private group back to the list of groups. | [Link](groups/open/) | | `/api/v1/groups.rename` | Changes the name of the private group. | [Link](groups/rename/) | | `/api/v1/groups.roles` | Gets the user's roles in the private group. | [Link](groups/roles/) | diff --git a/developer-guides/rest-api/channels/README.md b/developer-guides/rest-api/channels/README.md index ca0d8b70a4..852088be75 100644 --- a/developer-guides/rest-api/channels/README.md +++ b/developer-guides/rest-api/channels/README.md @@ -22,6 +22,7 @@ These methods apply to public channels only. Use `groups.*` methods for private | `/api/v1/channels.list` | Retrieves all of the channels from the server. | [Link](list/) | | `/api/v1/channels.list.joined` | Gets only the channels the calling user has joined. | [Link](list-joined/) | | `/api/v1/channels.members` | Retrieves all channel users. | [Link](members/) | +| `/api/v1/channels.moderators` | List all moderators of a channel. | [Link](moderators/) | | `/api/v1/channels.open` | Adds the channel back to the user's list of channels. | [Link](open/) | | `/api/v1/channels.removeModerator` | Removes the role of moderator from a user in a channel. | [Link](removemoderator/) | | `/api/v1/channels.removeOwner` | Removes the role of owner from a user in a channel. | [Link](removeowner/) | diff --git a/developer-guides/rest-api/channels/moderators/README.md b/developer-guides/rest-api/channels/moderators/README.md new file mode 100644 index 0000000000..60f713c815 --- /dev/null +++ b/developer-guides/rest-api/channels/moderators/README.md @@ -0,0 +1,43 @@ +# Channel Moderators List + +Lists all channel moderators. + +| URL | Requires Auth | HTTP Method | +| :--- | :--- | :--- | +| `/api/v1/channels.moderators` | `yes` | `GET` | + +## Query Parameters + +| Argument | Example | Required | Description | +| :--------- | :------------------ | :------------------------ | :----------------- | +| `roomId` | `ByehQjC44FwMeiLbX` | Required (if no roomName) | The channel's id | +| `roomName` | `general` | Required (if no roomId) | The channel's name | + +## Example Call + +```bash +curl -H "X-Auth-Token: 9HqLlyZOugoStsXCUfD_0YdwnNnunAJF8V47U3QHXSq" \ + -H "X-User-Id: aobEdbYhXfu5hkeqG" \ + http://localhost:3000/api/v1/channels.moderators?roomId=ByehQjC44FwMeiLbX +``` + +## Example Result + +```json +{ + "moderators": [ + { + "_id": "rocket.cat", + "username": "rocket.cat", + "name": Rocket.Cat + } + ], + "success": true +} +``` + +## Change Log + +| Version | Description | +| :--- | :--- | +| 0.70.0 | Added | diff --git a/developer-guides/rest-api/groups/README.md b/developer-guides/rest-api/groups/README.md index 177349f0bb..9d1df88436 100644 --- a/developer-guides/rest-api/groups/README.md +++ b/developer-guides/rest-api/groups/README.md @@ -18,6 +18,7 @@ | `/api/v1/groups.leave` | Removes the calling user from the private group. | [Link](leave/) | | `/api/v1/groups.list` | List the private groups the caller is part of. | [Link](list/) | | `/api/v1/groups.listAll` | List all the private groups. | [Link](listall/) | +| `/api/v1/groups.moderators` | List all moderators of a group. | [Link](moderators/) | | `/api/v1/groups.open` | Adds the private group back to the list of groups. | [Link](open/) | | `/api/v1/groups.removeModerator` | Removes the role of moderator from a user in a group. | [Link](removemoderator/) | | `/api/v1/groups.removeOwner` | Removes the role of owner from a user in a group. | [Link](removeowner/) | diff --git a/developer-guides/rest-api/groups/moderators/README.md b/developer-guides/rest-api/groups/moderators/README.md new file mode 100644 index 0000000000..050039a7c3 --- /dev/null +++ b/developer-guides/rest-api/groups/moderators/README.md @@ -0,0 +1,43 @@ +# Group Moderators List + +Lists all group moderators. + +| URL | Requires Auth | HTTP Method | +| :--- | :--- | :--- | +| `/api/v1/groups.moderators` | `yes` | `GET` | + +## Query Parameters + +| Argument | Example | Required | Description | +| :--------- | :------------------ | :------------------------ | :----------------- | +| `roomId` | `ByehQjC44FwMeiLbX` | Required (if no roomName) | The group's id | +| `roomName` | `general` | Required (if no roomId) | The group's name | + +## Example Call + +```bash +curl -H "X-Auth-Token: 9HqLlyZOugoStsXCUfD_0YdwnNnunAJF8V47U3QHXSq" \ + -H "X-User-Id: aobEdbYhXfu5hkeqG" \ + http://localhost:3000/api/v1/groups.moderators?roomId=ByehQjC44FwMeiLbX +``` + +## Example Result + +```json +{ + "moderators": [ + { + "_id": "rocket.cat", + "username": "rocket.cat", + "name": Rocket.Cat + } + ], + "success": true +} +``` + +## Change Log + +| Version | Description | +| :--- | :--- | +| 0.70.0 | Added |