From 3998bc9601c7ac7cf13d1dd20a12fc7f3217323f Mon Sep 17 00:00:00 2001 From: vynmera <39674991+vynmera@users.noreply.github.com> Date: Tue, 29 May 2018 22:39:14 +0000 Subject: [PATCH] Add channels.setDefault --- _data/toc.yml | 1 + .../documentation/documentation-map/README.md | 1 + developer-guides/rest-api/README.md | 1 + developer-guides/rest-api/channels/README.md | 1 + .../rest-api/channels/setdefault/README.md | 59 +++++++++++++++++++ 5 files changed, 63 insertions(+) create mode 100644 developer-guides/rest-api/channels/setdefault/README.md diff --git a/_data/toc.yml b/_data/toc.yml index 08875fcc75..cddb71d267 100644 --- a/_data/toc.yml +++ b/_data/toc.yml @@ -238,6 +238,7 @@ - removeOwner - rename - setCustomFields + - setDefault - setDescription - setJoinCode - setPurpose diff --git a/contributing/documentation/documentation-map/README.md b/contributing/documentation/documentation-map/README.md index d80312ba83..38490e92b1 100644 --- a/contributing/documentation/documentation-map/README.md +++ b/contributing/documentation/documentation-map/README.md @@ -279,6 +279,7 @@ Here you can also find what articles are incomplete and missing. - removeOwner - rename - setCustomFields + - setDefault - setDescription - setJoinCode - setPurpose diff --git a/developer-guides/rest-api/README.md b/developer-guides/rest-api/README.md index ac1bc24336..3c29b45d04 100644 --- a/developer-guides/rest-api/README.md +++ b/developer-guides/rest-api/README.md @@ -81,6 +81,7 @@ When calling a production Rocket.Chat server, ensure it is running via HTTPS and | `/api/v1/channels.rename` | Changes a channel's name. | [Link](channels/rename/) | | `/api/v1/channels.setCustomFields` | Sets a channel's custom fields. | [Link](channels/setcustomfields/) | | `/api/v1/channels.setAnnouncement` | Sets a channel's announcement. | [Link](channels/setannouncement/) | +| `/api/v1/channels.setDefault` | Sets whether a channel is a default channel or not. | [Link](channels/setdefault/) | | `/api/v1/channels.setDescription` | Sets a channel's description. | [Link](channels/setdescription/) | | `/api/v1/channels.setJoinCode` | Sets the channel's code required to join it. | [Link](channels/setjoincode/) | | `/api/v1/channels.setPurpose` | Sets a channel's description. | [Link](channels/setpurpose/) | diff --git a/developer-guides/rest-api/channels/README.md b/developer-guides/rest-api/channels/README.md index 650815337c..540b5ca2b7 100644 --- a/developer-guides/rest-api/channels/README.md +++ b/developer-guides/rest-api/channels/README.md @@ -24,6 +24,7 @@ | `/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/) | | `/api/v1/channels.setCustomFields` | Sets a channel's custom fields. | [Link](setcustomfields/) | +| `/api/v1/channels.setDefault` | Sets a channel's default status. | [Link](setdefault/) | | `/api/v1/channels.setDescription` | Sets a channel's description. | [Link](setdescription/) | | `/api/v1/channels.setJoinCode` | Sets the channel's code required to join it. | [Link](setjoincode/) | | `/api/v1/channels.setPurpose` | Sets a channel's description. | [Link](setpurpose/) | diff --git a/developer-guides/rest-api/channels/setdefault/README.md b/developer-guides/rest-api/channels/setdefault/README.md new file mode 100644 index 0000000000..de90424be7 --- /dev/null +++ b/developer-guides/rest-api/channels/setdefault/README.md @@ -0,0 +1,59 @@ +# Channel Set Default + +Sets whether the channel is a default channel or not. + +| URL | Requires Auth | HTTP Method | +| :--- | :--- | :--- | +| `/api/v1/channels.setDefault` | `yes` | `POST` | + +## Payload + +| Argument | Example | Required | Description | +| :--- | :--- | :--- | :--- | +| `roomId` | `ByehQjC44FwMeiLbX` | Required | The channel's id | +| `default` | `true` | Required | Boolean of whether the room is default or not. | + +## 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.setDefault \ + -d '{ "roomId": "ByehQjC44FwMeiLbX", "default": true }' +``` + +## Example Result + +```json +{ + "channel": { + "_id": "ByehQjC44FwMeiLbX", + "name": "testing0", + "t": "c", + "msgs": 0, + "u": { + "_id": "aiPqNoGkjpNDiRx6d", + "username": "goose160" + }, + "ts": "2017-01-05T18:02:50.754Z", + "ro": true, + "sysMes": true, + "_updatedAt": "2017-01-05T19:02:24.429Z", + "usernames": [ + "goose160", + "graywolf336" + ], + "joinCodeRequired": true, + "muted": [], + "default": true + }, + "success": true +} +``` + +## Change Log + +| Version | Description | +| :--- | :--- | +| 0.66.0 | Added |