Skip to content

Commit

Permalink
[NEW] Added docs for addLeader and removeLeader endpoints in groups a…
Browse files Browse the repository at this point in the history
…nd channels (RocketChat#1096)

* add docs of channels.addLeader/removeLeader and groups.addLeader/removeLeader

* update references of addLeader and removeLeader

* fixed references

* add version on groups.addLeader/removeLeader changelog and linked references in rest-api/README.md
  • Loading branch information
thayannevls authored and MartinSchoeler committed Feb 20, 2019
1 parent 582947a commit 61168cb
Show file tree
Hide file tree
Showing 9 changed files with 216 additions and 0 deletions.
4 changes: 4 additions & 0 deletions _data/toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@
- twitter
- Channels:
- addAll
- AddLeader
- addModerator
- addOwner
- archive
Expand All @@ -267,6 +268,7 @@
- moderators
- online
- open
- removeLeader
- removeModerator
- removeOwner
- rename
Expand Down Expand Up @@ -303,6 +305,7 @@
- get
- Groups:
- addAll
- addLeader
- addModerator
- addOwner
- archive
Expand All @@ -323,6 +326,7 @@
- messages
- moderators
- open
- removeLeader
- removeModerator
- removeOwner
- rename
Expand Down
4 changes: 4 additions & 0 deletions contributing/documentation/documentation-map/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ Here you can also find what articles are incomplete and missing.
- twitter
- Channels:
- addAll
- addLeader
- addModerator
- addOwner
- archive
Expand All @@ -281,6 +282,7 @@ Here you can also find what articles are incomplete and missing.
- messages
- online
- open
- removeLeader
- removeModerator
- removeOwner
- rename
Expand Down Expand Up @@ -317,6 +319,7 @@ Here you can also find what articles are incomplete and missing.
- get
- Groups:
- addAll
- addLeader
- addModerator
- addOwner
- archive
Expand All @@ -337,6 +340,7 @@ Here you can also find what articles are incomplete and missing.
- messages
- moderators
- open
- removeLeader
- removeModerator
- removeOwner
- rename
Expand Down
4 changes: 4 additions & 0 deletions developer-guides/rest-api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ When calling a production Rocket.Chat server, ensure it is running via HTTPS and
| Url | Short Description | Details Page |
| :-------------------------------------------- | :---------------------------------------------------------- | :---------------------------------------------- |
| `/api/v1/channels.addAll` | Adds all of the users on the server to a channel. | [Link](channels/addall/) |
| `/api/v1/channels.addLeader` | Gives the role of Leader for a user in the current channel. | [Link](channels/addleader/) |
| `/api/v1/channels.archive` | Archives a channel. | [Link](channels/archive/) |
| `/api/v1/channels.cleanHistory` | Cleans up a channel's history, requires special permission. | [Link](channels/cleanhistory/) |
| `/api/v1/channels.close` | Removes a channel from a user's list of channels. | [Link](channels/close/) |
Expand All @@ -99,6 +100,7 @@ When calling a production Rocket.Chat server, ensure it is running via HTTPS and
| `/api/v1/channels.moderators` | List all moderators of a channel. | [Link](channels/moderators/) |
| `/api/v1/channels.online` | List all online users of a channel. | [Link](channels/online/) |
| `/api/v1/channels.open` | Adds the channel back to the user's list of channels. | [Link](channels/open/) |
| `/api/v1/channels.removeleader` | Removes the role of Leader for a user in the current channel. | [Link](channels/removeleader/) |
| `/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/) |
| `/api/v1/channels.setCustomFields` | Sets a channel's custom fields. | [Link](channels/setcustomfields/) |
Expand All @@ -117,6 +119,7 @@ When calling a production Rocket.Chat server, ensure it is running via HTTPS and
| Url | Short Description | Details Page |
| :------------------------------- | :------------------------------------------------- | :----------------------------- |
| `/api/v1/groups.archive` | Archives a private group. | [Link](groups/archive/) |
| `/api/v1/groups.addLeader` | Gives the role of Leader for a user in the current group. | [Link](groups/addleader/) |
| `/api/v1/groups.close` | Removes a private group from the list of groups. | [Link](groups/close/) |
| `/api/v1/groups.counters` | Gets group counters. | [Link](groups/counters/) |
| `/api/v1/groups.create` | Creates a new private group. | [Link](groups/create/) |
Expand All @@ -133,6 +136,7 @@ When calling a production Rocket.Chat server, ensure it is running via HTTPS and
| `/api/v1/groups.messages` | Retrieves all group messages. | [Link](groups/messages/) |
| `/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.removeLeader` | Removes the role of Leader for a user in the current group. | [Link](groups/removeleader/) |
| `/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/) |
| `/api/v1/groups.setAnnouncement` | Sets a group's announcement. | [Link](groups/setannouncement/)|
Expand Down
2 changes: 2 additions & 0 deletions developer-guides/rest-api/channels/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ These methods apply to public channels only. Use `groups.*` methods for private
| Url | Short Description | Details Page |
| :--- | :--- | :--- |
| `/api/v1/channels.addAll` | Adds all of the users on the server to a channel. | [Link](addall/) |
| `/api/v1/channels.addLeader` | Gives the role of Leader for a user in the current channel. | [Link](addleader/) |
| `/api/v1/channels.addModerator` | Gives the role of moderator to a user in a channel. | [Link](addmoderator/) |
| `/api/v1/channels.addOwner` | Gives the role of owner to a user in a channel. | [Link](addowner/) |
| `/api/v1/channels.archive` | Archives a channel. | [Link](archive/) |
Expand All @@ -28,6 +29,7 @@ These methods apply to public channels only. Use `groups.*` methods for private
| `/api/v1/channels.moderators` | List all moderators of a channel. | [Link](moderators/) |
| `/api/v1/channels.online` | List all online users of a channel. | [Link](online/) |
| `/api/v1/channels.open` | Adds the channel back to the user's list of channels. | [Link](open/) |
| `/api/v1/channels.removeleader` | Removes the role of Leader for a user in the current channel. | [Link](removeleader/) |
| `/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/) |
| `/api/v1/channels.rename` | Changes a channel's name. | [Link](rename/) |
Expand Down
50 changes: 50 additions & 0 deletions developer-guides/rest-api/channels/addleader/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Channel Add Leader

Gives the role of Leader for a user in the current channel.

| URL | Requires Auth | HTTP Method |
| :--- | :--- | :--- |
| `/api/v1/channels.addLeader` | `yes` | `POST` |

## Payload

| Argument | Example | Required | Description |
| :--- | :--- | :--- | :--- |
| `roomId` | `ByehQjC44FwMeiLbX` | Required | The channel's id |
| `userId` | `oCHkav5Zf6vmpu2W2` | Required | The user's id |

## Example Call

```bash
curl -H "X-Auth-Token: 9HqLlyZOugoStsXCUfD_0YdwnNnunAJF8V47U3QHXSq" \
-H "X-User-Id: aobEdbYhXfu5hkeqG" \
-H "Content-type: application/json" \
http://localhost:3000/api/v1/channels.addLeader \
-d '{"roomId": "ByehQjC44FwMeiLbX", "userId": "oCHkav5Zf6vmpu2W2"}'
```

## Success Example Result

```json
{
"success": true
}
```

## Bad Request Example Result

If the user is already a leader, will return a `400 bad request` status.

```json
{
"success": false,
"error": "User is already a leader [error-user-already-leader]",
"errorType": "error-user-already-leader"
}
```

## Change Log

| Version | Description |
| :--- | :--- |
| 0.75.0 | Added. |
50 changes: 50 additions & 0 deletions developer-guides/rest-api/channels/removeleader/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Channel Remove Leader

Removes the role of Leader for a user in the current channel.

| URL | Requires Auth | HTTP Method |
| :--- | :--- | :--- |
| `/api/v1/channels.removeLeader` | `yes` | `POST` |

## Payload

| Argument | Example | Required | Description |
| :--- | :--- | :--- | :--- |
| `roomId` | `ByehQjC44FwMeiLbX` | Required | The channel's id |
| `userId` | `oCHkav5Zf6vmpu2W2` | Required | The user's id |

## Example Call

```bash
curl -H "X-Auth-Token: 9HqLlyZOugoStsXCUfD_0YdwnNnunAJF8V47U3QHXSq" \
-H "X-User-Id: aobEdbYhXfu5hkeqG" \
-H "Content-type: application/json" \
http://localhost:3000/api/v1/channels.removeLeader \
-d '{"roomId": "ByehQjC44FwMeiLbX", "userId": "oCHkav5Zf6vmpu2W2"}'
```

## Success Example Result

```json
{
"success": true
}
```

## Bad Request Example Result

If the user is not a leader, will return a `400 bad request` status.

```json
{
"success": false,
"error": "User is not a leader [error-user-not-leader]",
"errorType": "error-user-not-leader"
}
```

## Change Log

| Version | Description |
| :--- | :--- |
| 0.75.0 | Added. |
2 changes: 2 additions & 0 deletions developer-guides/rest-api/groups/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
| Url | Short Description | Details Page |
| :--- | :--- | :--- |
| `/api/v1/groups.addAll` | Adds all of the users on the server to a private group. | [Link](addall/) |
| `/api/v1/groups.addLeader` | Gives the role of Leader for a user in the current group. | [Link](addleader/) |
| `/api/v1/groups.addModerator` | Gives the role of moderator to a user in a group. | [Link](addmoderator/) |
| `/api/v1/groups.addOwner` | Gives the role of owner to a user in a group. | [Link](addowner/) |
| `/api/v1/groups.archive` | Archives a private group. | [Link](archive/) |
Expand All @@ -23,6 +24,7 @@
| `/api/v1/groups.members` | Gets the users of participants of a private group. | [Link](members/) |
| `/api/v1/groups.messages` | Retrieves all group messages. | [Link](messages/) |
| `/api/v1/groups.open` | Adds the private group back to the list of groups. | [Link](open/) |
| `/api/v1/groups.removeLeader` | Removes the role of Leader for a user in the current group. | [Link](removeleader/) |
| `/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/) |
| `/api/v1/groups.rename` | Changes the name of the private group. | [Link](rename/) |
Expand Down
50 changes: 50 additions & 0 deletions developer-guides/rest-api/groups/addleader/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Group Add Leader

Gives the role of Leader for a user in the current group.

| URL | Requires Auth | HTTP Method |
| :--- | :--- | :--- |
| `/api/v1/groups.addLeader` | `yes` | `POST` |

## Payload

| Argument | Example | Required | Description |
| :--- | :--- | :--- | :--- |
| `roomId` | `ByehQjC44FwMeiLbX` | Required | The groups's id |
| `userId` | `oCHkav5Zf6vmpu2W2` | Required | The user's id |

## Example Call

```bash
curl -H "X-Auth-Token: 9HqLlyZOugoStsXCUfD_0YdwnNnunAJF8V47U3QHXSq" \
-H "X-User-Id: aobEdbYhXfu5hkeqG" \
-H "Content-type: application/json" \
http://localhost:3000/api/v1/groups.addLeader \
-d '{"roomId": "ByehQjC44FwMeiLbX", "userId": "oCHkav5Zf6vmpu2W2"}'
```

## Success Example Result

```json
{
"success": true
}
```

## Bad Request Example Result

If the user is already a leader, will return a `400 bad request` status.

```json
{
"success": false,
"error": "User is already a leader [error-user-already-leader]",
"errorType": "error-user-already-leader"
}
```

## Change Log

| Version | Description |
| :--- | :--- |
| 0.58.0 | Added. |
50 changes: 50 additions & 0 deletions developer-guides/rest-api/groups/removeleader/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Group Remove Leader

Removes the role of Leader for a user in the current group.

| URL | Requires Auth | HTTP Method |
| :--- | :--- | :--- |
| `/api/v1/groups.removeLeader` | `yes` | `POST` |

## Payload

| Argument | Example | Required | Description |
| :--- | :--- | :--- | :--- |
| `roomId` | `ByehQjC44FwMeiLbX` | Required | The groups's id |
| `userId` | `oCHkav5Zf6vmpu2W2` | Required | The user's id |

## Example Call

```bash
curl -H "X-Auth-Token: 9HqLlyZOugoStsXCUfD_0YdwnNnunAJF8V47U3QHXSq" \
-H "X-User-Id: aobEdbYhXfu5hkeqG" \
-H "Content-type: application/json" \
http://localhost:3000/api/v1/groups.removeLeader \
-d '{"roomId": "ByehQjC44FwMeiLbX", "userId": "oCHkav5Zf6vmpu2W2"}'
```

## Success Example Result

```json
{
"success": true
}
```

## Bad Request Example Result

If the user is not a leader, will return a `400 bad request` status.

```json
{
"success": false,
"error": "User is not a leader [error-user-not-leader]",
"errorType": "error-user-not-leader"
}
```

## Change Log

| Version | Description |
| :--- | :--- |
| 0.58.0 | Added. |

0 comments on commit 61168cb

Please sign in to comment.