From 7e9d2169c22fc8978aabfe516d7284b16ca0746d Mon Sep 17 00:00:00 2001 From: Eugene Bolshakov Date: Fri, 23 Feb 2018 14:34:17 +0300 Subject: [PATCH 1/4] Add channels.setCustomFields and groups.setCustomFields. Fix purpose. Signed-off-by: Eugene Bolshakov --- _data/toc.yml | 2 + .../documentation/documentation-map/README.md | 2 + developer-guides/rest-api/README.md | 42 +++++++------ developer-guides/rest-api/channels/README.md | 3 +- .../channels/setcustomfields/README.md | 55 +++++++++++++++++ .../rest-api/channels/setpurpose/README.md | 4 +- developer-guides/rest-api/groups/README.md | 3 +- .../rest-api/groups/setcustomfields/README.md | 61 +++++++++++++++++++ .../rest-api/groups/setpurpose/README.md | 4 +- 9 files changed, 150 insertions(+), 26 deletions(-) create mode 100644 developer-guides/rest-api/channels/setcustomfields/README.md create mode 100644 developer-guides/rest-api/groups/setcustomfields/README.md diff --git a/_data/toc.yml b/_data/toc.yml index 9d853fbe64..13a152e20d 100644 --- a/_data/toc.yml +++ b/_data/toc.yml @@ -221,6 +221,7 @@ - removeModerator - removeOwner - rename + - setCustomFields - setDescription - setJoinCode - setPurpose @@ -260,6 +261,7 @@ - removeModerator - removeOwner - rename + - setCustomFields - setDescription - setPurpose - setReadOnly diff --git a/contributing/documentation/documentation-map/README.md b/contributing/documentation/documentation-map/README.md index 8c0a83e514..293951d804 100644 --- a/contributing/documentation/documentation-map/README.md +++ b/contributing/documentation/documentation-map/README.md @@ -264,6 +264,7 @@ Here you can also find what articles are incomplete and missing. - removeModerator - removeOwner - rename + - setCustomFields - setDescription - setJoinCode - setPurpose @@ -306,6 +307,7 @@ Here you can also find what articles are incomplete and missing. - removeModerator - removeOwner - rename + - setCustomFields - setDescription - setPurpose - setReadOnly diff --git a/developer-guides/rest-api/README.md b/developer-guides/rest-api/README.md index cd4b76e7fb..16d0186b6c 100644 --- a/developer-guides/rest-api/README.md +++ b/developer-guides/rest-api/README.md @@ -65,9 +65,10 @@ When calling a production Rocket.Chat server, ensure it is running via HTTPS and | `/api/v1/channels.list.joined` | Gets only the channels the calling user has joined. | [Link](channels/list-joined/) | | `/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.setCustomFields` | Sets a channel's custom fields. | [Link](channels/setcustomfields/) | | `/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/) | +| `/api/v1/channels.setPurpose` | Sets a channel's purpose. | [Link](channels/setpurpose/) | | `/api/v1/channels.setReadOnly` | Sets whether a channel is read only or not. | [Link](channels/setreadonly/) | | `/api/v1/channels.setTopic` | Sets a channel's topic. | [Link](channels/settopic/) | | `/api/v1/channels.setType` | Sets the type of room the channel should be. | [Link](channels/settype/) | @@ -75,25 +76,26 @@ When calling a production Rocket.Chat server, ensure it is running via HTTPS and ### Groups -| Url | Short Description | Details Page | -| :------------------------------ | :------------------------------------------------- | :----------------------------- | -| `/api/v1/groups.archive` | Archives a private group. | [Link](groups/archive/) | -| `/api/v1/groups.close` | Removes a private group from the list of groups. | [Link](groups/close/) | -| `/api/v1/groups.create` | Creates a new private group. | [Link](groups/create/) | -| `/api/v1/groups.history` | Retrieves the messages from a private group. | [Link](groups/history/) | -| `/api/v1/groups.info` | Gets the information about a private group. | [Link](groups/info/) | -| `/api/v1/groups.invite` | Adds a user to the private group. | [Link](groups/invite/) | -| `/api/v1/groups.kick` | Removes a user from a private group. | [Link](groups/kick/) | -| `/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.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.setDescription` | Sets a private group's description. | [Link](groups/setdescription/) | -| `/api/v1/groups.setPurpose` | Sets a private group's description. | [Link](groups/setpurpose/) | -| `/api/v1/groups.setReadOnly` | Sets whether the room is read only or not. | [Link](groups/setreadonly/) | -| `/api/v1/groups.setTopic` | Sets a private group's topic. | [Link](groups/settopic/) | -| `/api/v1/groups.setType` | Sets the type of room this group will be. | [Link](groups/settype/) | -| `/api/v1/groups.unarchive` | Unarchives a private group. | [Link](groups/unarchive/) | +| Url | Short Description | Details Page | +| :------------------------------- | :------------------------------------------------- | :------------------------------ | +| `/api/v1/groups.archive` | Archives a private group. | [Link](groups/archive/) | +| `/api/v1/groups.close` | Removes a private group from the list of groups. | [Link](groups/close/) | +| `/api/v1/groups.create` | Creates a new private group. | [Link](groups/create/) | +| `/api/v1/groups.history` | Retrieves the messages from a private group. | [Link](groups/history/) | +| `/api/v1/groups.info` | Gets the information about a private group. | [Link](groups/info/) | +| `/api/v1/groups.invite` | Adds a user to the private group. | [Link](groups/invite/) | +| `/api/v1/groups.kick` | Removes a user from a private group. | [Link](groups/kick/) | +| `/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.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.setCustomFields` | Sets private group's custom fields. | [Link](groups/setcustomfields/) | +| `/api/v1/groups.setDescription` | Sets a private group's description. | [Link](groups/setdescription/) | +| `/api/v1/groups.setPurpose` | Sets a private group's purpose. | [Link](groups/setpurpose/) | +| `/api/v1/groups.setReadOnly` | Sets whether the room is read only or not. | [Link](groups/setreadonly/) | +| `/api/v1/groups.setTopic` | Sets a private group's topic. | [Link](groups/settopic/) | +| `/api/v1/groups.setType` | Sets the type of room this group will be. | [Link](groups/settype/) | +| `/api/v1/groups.unarchive` | Unarchives a private group. | [Link](groups/unarchive/) | ### Chat diff --git a/developer-guides/rest-api/channels/README.md b/developer-guides/rest-api/channels/README.md index 09f0a34d09..61583793f2 100644 --- a/developer-guides/rest-api/channels/README.md +++ b/developer-guides/rest-api/channels/README.md @@ -21,9 +21,10 @@ | `/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/) | +| `/api/v1/channels.setCustomFields` | Sets a channel's custom fields. | [Link](setcustomfields/) | | `/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/) | +| `/api/v1/channels.setPurpose` | Sets a channel's purpose. | [Link](setpurpose/) | | `/api/v1/channels.setReadOnly` | Sets whether a channel is read only or not. | [Link](setreadonly/) | | `/api/v1/channels.setTopic` | Sets a channel's topic. | [Link](settopic/) | | `/api/v1/channels.setType` | Sets the type of room the channel should be. | [Link](settype/) | diff --git a/developer-guides/rest-api/channels/setcustomfields/README.md b/developer-guides/rest-api/channels/setcustomfields/README.md new file mode 100644 index 0000000000..d39b6a75bc --- /dev/null +++ b/developer-guides/rest-api/channels/setcustomfields/README.md @@ -0,0 +1,55 @@ +# Channel Set Custom Fields + +Sets the custom fields for the channel. + +| URL | Requires Auth | HTTP Method | +| :--- | :--- | :--- | +| `/api/v1/channels.setCustomFields` | `yes` | `POST` | + +## Payload + +One of roomId or roomName is required. + +| Argument | Example | Required | Description | +| :--- | :--- | :--- | :--- | +| `roomId` | `GENERAL` | Required | The channel's id | +| `roomName` | `general` | Required | The channel's name | +| `customFields` | `{"organization": "tra-la-la"}` | Required | The custom fields to set for the channel. | + +## Example Call + +```bash +curl -H "X-Auth-Token: 8h2mKAwxB3AQrFSjLVKMooJyjdCFaA7W45sWlHP8IzO" \ + -H "X-User-Id: ew28FnZqipDpvKw3R" \ + -H "Content-type: application/json" \ + http://localhost:3000/api/v1/channels.setCustomFields \ + -d '{"roomId": "GENERAL", "customFields":{"organization": "tra-la-la"} }' +``` + +## Example Result + +```json +{ + "channel":{ + "_id":"GENERAL", + "ts":"2018-02-18T19:41:02.875Z", + "t":"c", + "name":"general", + "msgs":236, + "default":true, + "_updatedAt":"2018-02-23T11:09:05.973Z", + "lm":"2018-02-18T22:18:20.288Z", + "customFields":{ + "organization":"tra-la-la" + } + }, + "success":true, + "developerWarning":"[WARNING]: The \"usernames\" field has been removed for performance reasons. Please use the \"*.members\" endpoint to get a list of members/users in a room." +} +``` + +## Change Log + +| Version | Description | +| :--- | :--- | +| 0.62.0 | Added | diff --git a/developer-guides/rest-api/channels/setpurpose/README.md b/developer-guides/rest-api/channels/setpurpose/README.md index bce726c198..f972b8fa6b 100644 --- a/developer-guides/rest-api/channels/setpurpose/README.md +++ b/developer-guides/rest-api/channels/setpurpose/README.md @@ -1,6 +1,6 @@ # Channel Set Purpose -Sets the description for the channel. +Sets the purpose for the channel. | URL | Requires Auth | HTTP Method | | :--- | :--- | :--- | @@ -11,7 +11,7 @@ Sets the description for the channel. | Argument | Example | Required | Description | | :--- | :--- | :--- | :--- | | `roomId` | `ByehQjC44FwMeiLbX` | Required | The channel's id | -| `purpose` | `Test out everything.` | Required | The description to set for the channel. | +| `purpose` | `Test out everything.` | Required | The purpose to set for the channel. | ## Example Call diff --git a/developer-guides/rest-api/groups/README.md b/developer-guides/rest-api/groups/README.md index 30632d9be4..fa1c663471 100644 --- a/developer-guides/rest-api/groups/README.md +++ b/developer-guides/rest-api/groups/README.md @@ -19,8 +19,9 @@ | `/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/) | +| `/api/v1/groups.setCustomFields` | Sets private group's custom fields. | [Link](setcustomfields/) | | `/api/v1/groups.setDescription` | Sets a private group's description. | [Link](setdescription/) | -| `/api/v1/groups.setPurpose` | Sets a private group's description. | [Link](setpurpose/) | +| `/api/v1/groups.setPurpose` | Sets a private group's purpose. | [Link](setpurpose/) | | `/api/v1/groups.setReadOnly` | Sets whether the room is read only or not. | [Link](setreadonly/) | | `/api/v1/groups.setTopic` | Sets a private group's topic. | [Link](settopic/) | | `/api/v1/groups.setType` | Sets the type of room this group will be. | [Link](settype/) | diff --git a/developer-guides/rest-api/groups/setcustomfields/README.md b/developer-guides/rest-api/groups/setcustomfields/README.md new file mode 100644 index 0000000000..fe0b792118 --- /dev/null +++ b/developer-guides/rest-api/groups/setcustomfields/README.md @@ -0,0 +1,61 @@ +# Group Set Custom Fields + +Sets the custom fields for the private group. + +| URL | Requires Auth | HTTP Method | +| :--- | :--- | :--- | +| `/api/v1/groups.setCustomFields` | `yes` | `POST` | + +## Payload + +One of roomId or roomName is required. + +| Argument | Example | Required | Description | +| :--- | :--- | :--- | :--- | +| `roomId` | `euzoT67Gx6nXcn66M` | Required | The private group's id | +| `roomName` | `channel.cf.1518990680083` | Required | The private group's name | +| `customFields` | `{"company": "sell-and-more"}` | Required | The custom fields to set for the private group. | + +## Example Call + +```bash +curl -H "X-Auth-Token: 8h2mKAwxB3AQrFSjLVKMooJyjdCFaA7W45sWlHP8IzO" \ + -H "X-User-Id: ew28FnZqipDpvKw3R" \ + -H "Content-type: application/json" \ + http://localhost:3000/api/v1/groups.setCustomFields \ + -d '{"roomId": "euzoT67Gx6nXcn66M", "customFields":{"company": "sell-and-more"} }' +``` + +## Example Result + +```json +{ + "group":{ + "_id":"euzoT67Gx6nXcn66M", + "name":"channel.cf.1518990680083", + "fname":"channel.cf.1518990680083", + "t":"p", + "msgs":0, + "u":{ + "_id":"ew28FnZqipDpvKw3R", + "username":"rocketchat.internal.admin.test" + }, + "customFields":{ + "company":"sell-and-more" + }, + "ts":"2018-02-18T21:51:20.091Z", + "ro":false, + "sysMes":true, + "_updatedAt":"2018-02-23T11:27:01.411Z", + "username":"rocketchat.internal.admin.test" + }, + "success":true, + "developerWarning":"[WARNING]: The \"usernames\" field has been removed for performance reasons. Please use the \"*.members\" endpoint to get a list of members/users in a room." +} +``` + +## Change Log + +| Version | Description | +| :--- | :--- | +| 0.62.0 | Added | diff --git a/developer-guides/rest-api/groups/setpurpose/README.md b/developer-guides/rest-api/groups/setpurpose/README.md index 93282d0e28..b70b7e9c93 100644 --- a/developer-guides/rest-api/groups/setpurpose/README.md +++ b/developer-guides/rest-api/groups/setpurpose/README.md @@ -1,6 +1,6 @@ # Group Set Purpose -Sets the description for the private group. +Sets the purpose for the private group. | URL | Requires Auth | HTTP Method | | :--- | :--- | :--- | @@ -11,7 +11,7 @@ Sets the description for the private group. | Argument | Example | Required | Description | | :--- | :--- | :--- | :--- | | `roomId` | `ByehQjC44FwMeiLbX` | Required | The private group's id | -| `purpose` | `Test out everything.` | Required | The description to set for the private group. | +| `purpose` | `Test out everything.` | Required | The purpose to set for the private group. | ## Example Call From 6b14544983ed86d3498cd636dcf59821cd62388d Mon Sep 17 00:00:00 2001 From: Eugene Bolshakov Date: Fri, 23 Feb 2018 22:34:22 +0300 Subject: [PATCH 2/4] Restore setPurpose description Signed-off-by: Eugene Bolshakov --- developer-guides/rest-api/README.md | 4 ++-- developer-guides/rest-api/channels/README.md | 2 +- developer-guides/rest-api/channels/setpurpose/README.md | 4 ++-- developer-guides/rest-api/groups/README.md | 2 +- developer-guides/rest-api/groups/setpurpose/README.md | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/developer-guides/rest-api/README.md b/developer-guides/rest-api/README.md index 16d0186b6c..fd30954e12 100644 --- a/developer-guides/rest-api/README.md +++ b/developer-guides/rest-api/README.md @@ -68,7 +68,7 @@ When calling a production Rocket.Chat server, ensure it is running via HTTPS and | `/api/v1/channels.setCustomFields` | Sets a channel's custom fields. | [Link](channels/setcustomfields/) | | `/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 purpose. | [Link](channels/setpurpose/) | +| `/api/v1/channels.setPurpose` | Sets a channel's description. | [Link](channels/setpurpose/) | | `/api/v1/channels.setReadOnly` | Sets whether a channel is read only or not. | [Link](channels/setreadonly/) | | `/api/v1/channels.setTopic` | Sets a channel's topic. | [Link](channels/settopic/) | | `/api/v1/channels.setType` | Sets the type of room the channel should be. | [Link](channels/settype/) | @@ -91,7 +91,7 @@ When calling a production Rocket.Chat server, ensure it is running via HTTPS and | `/api/v1/groups.rename` | Changes the name of the private group. | [Link](groups/rename/) | | `/api/v1/groups.setCustomFields` | Sets private group's custom fields. | [Link](groups/setcustomfields/) | | `/api/v1/groups.setDescription` | Sets a private group's description. | [Link](groups/setdescription/) | -| `/api/v1/groups.setPurpose` | Sets a private group's purpose. | [Link](groups/setpurpose/) | +| `/api/v1/groups.setPurpose` | Sets a private group's description. | [Link](groups/setpurpose/) | | `/api/v1/groups.setReadOnly` | Sets whether the room is read only or not. | [Link](groups/setreadonly/) | | `/api/v1/groups.setTopic` | Sets a private group's topic. | [Link](groups/settopic/) | | `/api/v1/groups.setType` | Sets the type of room this group will be. | [Link](groups/settype/) | diff --git a/developer-guides/rest-api/channels/README.md b/developer-guides/rest-api/channels/README.md index 61583793f2..8b0418468f 100644 --- a/developer-guides/rest-api/channels/README.md +++ b/developer-guides/rest-api/channels/README.md @@ -24,7 +24,7 @@ | `/api/v1/channels.setCustomFields` | Sets a channel's custom fields. | [Link](setcustomfields/) | | `/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 purpose. | [Link](setpurpose/) | +| `/api/v1/channels.setPurpose` | Sets a channel's description. | [Link](setpurpose/) | | `/api/v1/channels.setReadOnly` | Sets whether a channel is read only or not. | [Link](setreadonly/) | | `/api/v1/channels.setTopic` | Sets a channel's topic. | [Link](settopic/) | | `/api/v1/channels.setType` | Sets the type of room the channel should be. | [Link](settype/) | diff --git a/developer-guides/rest-api/channels/setpurpose/README.md b/developer-guides/rest-api/channels/setpurpose/README.md index f972b8fa6b..bce726c198 100644 --- a/developer-guides/rest-api/channels/setpurpose/README.md +++ b/developer-guides/rest-api/channels/setpurpose/README.md @@ -1,6 +1,6 @@ # Channel Set Purpose -Sets the purpose for the channel. +Sets the description for the channel. | URL | Requires Auth | HTTP Method | | :--- | :--- | :--- | @@ -11,7 +11,7 @@ Sets the purpose for the channel. | Argument | Example | Required | Description | | :--- | :--- | :--- | :--- | | `roomId` | `ByehQjC44FwMeiLbX` | Required | The channel's id | -| `purpose` | `Test out everything.` | Required | The purpose to set for the channel. | +| `purpose` | `Test out everything.` | Required | The description to set for the channel. | ## Example Call diff --git a/developer-guides/rest-api/groups/README.md b/developer-guides/rest-api/groups/README.md index fa1c663471..5dc5552d93 100644 --- a/developer-guides/rest-api/groups/README.md +++ b/developer-guides/rest-api/groups/README.md @@ -21,7 +21,7 @@ | `/api/v1/groups.rename` | Changes the name of the private group. | [Link](rename/) | | `/api/v1/groups.setCustomFields` | Sets private group's custom fields. | [Link](setcustomfields/) | | `/api/v1/groups.setDescription` | Sets a private group's description. | [Link](setdescription/) | -| `/api/v1/groups.setPurpose` | Sets a private group's purpose. | [Link](setpurpose/) | +| `/api/v1/groups.setPurpose` | Sets a private group's description. | [Link](setpurpose/) | | `/api/v1/groups.setReadOnly` | Sets whether the room is read only or not. | [Link](setreadonly/) | | `/api/v1/groups.setTopic` | Sets a private group's topic. | [Link](settopic/) | | `/api/v1/groups.setType` | Sets the type of room this group will be. | [Link](settype/) | diff --git a/developer-guides/rest-api/groups/setpurpose/README.md b/developer-guides/rest-api/groups/setpurpose/README.md index b70b7e9c93..93282d0e28 100644 --- a/developer-guides/rest-api/groups/setpurpose/README.md +++ b/developer-guides/rest-api/groups/setpurpose/README.md @@ -1,6 +1,6 @@ # Group Set Purpose -Sets the purpose for the private group. +Sets the description for the private group. | URL | Requires Auth | HTTP Method | | :--- | :--- | :--- | @@ -11,7 +11,7 @@ Sets the purpose for the private group. | Argument | Example | Required | Description | | :--- | :--- | :--- | :--- | | `roomId` | `ByehQjC44FwMeiLbX` | Required | The private group's id | -| `purpose` | `Test out everything.` | Required | The purpose to set for the private group. | +| `purpose` | `Test out everything.` | Required | The description to set for the private group. | ## Example Call From eb4ad0fa995b30878632c972a100ee2d8cd82da7 Mon Sep 17 00:00:00 2001 From: Eugene Bolshakov Date: Fri, 23 Feb 2018 22:39:00 +0300 Subject: [PATCH 3/4] Obsolescence notification is added Signed-off-by: Eugene Bolshakov --- developer-guides/rest-api/channels/setpurpose/README.md | 2 +- developer-guides/rest-api/groups/setpurpose/README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/developer-guides/rest-api/channels/setpurpose/README.md b/developer-guides/rest-api/channels/setpurpose/README.md index bce726c198..1498978019 100644 --- a/developer-guides/rest-api/channels/setpurpose/README.md +++ b/developer-guides/rest-api/channels/setpurpose/README.md @@ -1,6 +1,6 @@ # Channel Set Purpose -Sets the description for the channel. +Sets the description for the channel (the same as channels.setDescription, obsolete). | URL | Requires Auth | HTTP Method | | :--- | :--- | :--- | diff --git a/developer-guides/rest-api/groups/setpurpose/README.md b/developer-guides/rest-api/groups/setpurpose/README.md index 93282d0e28..b2d0606c6a 100644 --- a/developer-guides/rest-api/groups/setpurpose/README.md +++ b/developer-guides/rest-api/groups/setpurpose/README.md @@ -1,6 +1,6 @@ # Group Set Purpose -Sets the description for the private group. +Sets the description for the private group (the same as groups.setDescription, obsolete). | URL | Requires Auth | HTTP Method | | :--- | :--- | :--- | From 8733b64ff7e9f3d8d99ba55a06ac21a18ed992ef Mon Sep 17 00:00:00 2001 From: Eugene Bolshakov Date: Sun, 25 Feb 2018 00:13:26 +0300 Subject: [PATCH 4/4] Update Schema Definition: add customFields Signed-off-by: Eugene Bolshakov --- developer-guides/schema-definition/README.md | 89 ++++++++++++-------- 1 file changed, 56 insertions(+), 33 deletions(-) diff --git a/developer-guides/schema-definition/README.md b/developer-guides/schema-definition/README.md index 5c8a300a64..5a5f713d93 100644 --- a/developer-guides/schema-definition/README.md +++ b/developer-guides/schema-definition/README.md @@ -20,27 +20,36 @@ "u": { // Object Owner User "_id": "CABrXSHpDqbZXGkYR", // Random.id() User Id "username": "john" // String User Username + }, + "customFields": { // Object User defined custom fields (for t:c and t:p only) + "userDefinedField": "userValue", // User defined field example + "userDefinedField2": true, // User defined field example + "userObject3": { // User defined field example + "a": "hello", + "b": "lalala" + } } } ``` ### Fields -| Fields | Type | Description | -| :---------- | :------------ | :----------------------- | -| \_id | Random.id() | Room Id | -| t | String | Room Type | -| ts | Date | Room Creation Timestamp | -| name | String | Room Name (t:d -> empty) | -| lm | Date | Last Message Timestamp | -| msgs | Integer | Messages Counter | -| cl | Boolean | If users can leave room | -| ro | Boolean | Read Only | -| usernames | Array[String] | Room Users | -| usernames.0 | String | User Username | -| u | Object | Owner User | -| u.\_id | Random.id() | User Id | -| u.username | String | User Username | +| Fields | Type | Description | +| :----------- | :------------ | :---------------------------------------- | +| \_id | Random.id() | Room Id | +| t | String | Room Type | +| ts | Date | Room Creation Timestamp | +| name | String | Room Name (t:d -> empty) | +| lm | Date | Last Message Timestamp | +| msgs | Integer | Messages Counter | +| cl | Boolean | If users can leave room | +| ro | Boolean | Read Only | +| usernames | Array[String] | Room Users | +| usernames.0 | String | User Username | +| u | Object | Owner User | +| u.\_id | Random.id() | User Id | +| u.username | String | User Username | +| customFields | Object | User custom fields (for t:c and t:p only) | ### Indexes @@ -70,30 +79,44 @@ "v": { // Object Visitor "_id": "CABrXSHpDqbZXGkYR", // Random.id() Visitor Id "username": "anonymous" // String Visitor Username + }, + "customFields": { // Object User defined custom fields + "userDefinedField": "userValue", // User defined field example + "userDefinedField2": true, // User defined field example + "userObject3": { // User defined field example + "a": "hello", + "b": "lalala" + } } } ``` ### Fields -| Fields | Type | Description | -| :--------- | :---------- | :--------------------------------------------------------------- | -| \_id | Random.id() | Subscriptions Id | -| t | String | Subscription Type (copy from Room) | -| ts | Date | Subscription Creation Timestamp | -| ls | Date | Last Seen Timestamp | -| name | String | Subscription Name (t:d -> target username) | -| rid | Random.id() | Room Id | -| f | Boolean | Favorited | -| open | Boolean | Is Room Opened | -| alert | Boolean | Room has unread messages for this user | -| unread | Integer | Counter of unread messages with mentions or from direct messages | -| u | Object | User | -| u.\_id | Random.id() | User Id | -| u.username | String | User Username | -| v | Object | Visitor | -| v.\_id | Random.id() | Visitor Id | -| v.username | String | Visitor Username | +| Fields | Type | Description | +| :----------- | :---------- | :--------------------------------------------------------------- | +| \_id | Random.id() | Subscriptions Id | +| t | String | Subscription Type (copy from Room) | +| ts | Date | Subscription Creation Timestamp | +| ls | Date | Last Seen Timestamp | +| name | String | Subscription Name (t:d -> target username) | +| rid | Random.id() | Room Id | +| f | Boolean | Favorited | +| open | Boolean | Is Room Opened | +| alert | Boolean | Room has unread messages for this user | +| unread | Integer | Counter of unread messages with mentions or from direct messages | +| u | Object | User | +| u.\_id | Random.id() | User Id | +| u.username | String | User Username | +| v | Object | Visitor | +| v.\_id | Random.id() | Visitor Id | +| v.username | String | Visitor Username | +| customFields | Object | User custom fields | + +Notes about customFields: + +- customFields inherits from room's customFields for channels (Room Type: c = chanel) and groups (Room Type: p = group) and changes with room's customFields +- customFields inherits from user's customFields for Direct Messages (Room Type: d = direct) and changes with user's customFields. Note that users of Direct Messages room will have own customFields. ### Indexes