Add ability to set type of the channel over rest request
This commit is contained in:
parent
e926b6a05a
commit
9621132629
@ -246,6 +246,7 @@ A channel is a representation of a sequence of messages. It has meta data like c
|
||||
| --------- | ---- | ------ | ----------- | ------- | --------- |
|
||||
| name | string | POST | Name of Channel | N/A | YES |
|
||||
| topic | string | POST | Subject of Channel | N/A | NO |
|
||||
| type | string | POST | Channel type | N/A | NO |
|
||||
|
||||
## Update channel details
|
||||
|
||||
@ -262,6 +263,7 @@ A channel is a representation of a sequence of messages. It has meta data like c
|
||||
| channelID | uint64 | PATH | Channel ID | N/A | YES |
|
||||
| name | string | POST | Name of Channel | N/A | NO |
|
||||
| topic | string | POST | Subject of Channel | N/A | NO |
|
||||
| type | string | POST | Channel type | N/A | NO |
|
||||
| archive | bool | POST | Request channel to be archived or unarchived | N/A | NO |
|
||||
| organisationID | uint64 | POST | Move channel to different organisation | N/A | NO |
|
||||
|
||||
|
||||
@ -214,7 +214,8 @@
|
||||
"parameters": {
|
||||
"post": [
|
||||
{ "type": "string", "name": "name", "required": true, "title": "Name of Channel" },
|
||||
{ "type": "string", "name": "topic", "required": false, "title": "Subject of Channel" }
|
||||
{ "type": "string", "name": "topic", "required": false, "title": "Subject of Channel" },
|
||||
{ "type": "string", "name": "type", "required": false, "title": "Channel type" }
|
||||
]
|
||||
}
|
||||
},
|
||||
@ -230,6 +231,7 @@
|
||||
"post": [
|
||||
{ "type": "string", "name": "name", "required": false, "title": "Name of Channel" },
|
||||
{ "type": "string", "name": "topic", "required": false, "title": "Subject of Channel" },
|
||||
{ "type": "string", "name": "type", "required": false, "title": "Channel type" },
|
||||
{ "type": "bool", "name": "archive", "required": false, "title": "Request channel to be archived or unarchived" },
|
||||
{ "type": "uint64", "name": "organisationID", "required": false, "title": "Move channel to different organisation" }
|
||||
]
|
||||
|
||||
@ -46,6 +46,12 @@
|
||||
"required": false,
|
||||
"title": "Subject of Channel",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "type",
|
||||
"required": false,
|
||||
"title": "Channel type",
|
||||
"type": "string"
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -77,6 +83,12 @@
|
||||
"title": "Subject of Channel",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "type",
|
||||
"required": false,
|
||||
"title": "Channel type",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "archive",
|
||||
"required": false,
|
||||
|
||||
@ -34,6 +34,7 @@ func (ctrl *Channel) Create(ctx context.Context, r *request.ChannelCreate) (inte
|
||||
channel := &types.Channel{
|
||||
Name: r.Name,
|
||||
Topic: r.Topic,
|
||||
Type: types.ChannelType(r.Type),
|
||||
}
|
||||
|
||||
return ctrl.wrap(ctrl.svc.ch.With(ctx).Create(channel))
|
||||
@ -44,6 +45,7 @@ func (ctrl *Channel) Edit(ctx context.Context, r *request.ChannelEdit) (interfac
|
||||
ID: r.ChannelID,
|
||||
Name: r.Name,
|
||||
Topic: r.Topic,
|
||||
Type: types.ChannelType(r.Type),
|
||||
}
|
||||
|
||||
return ctrl.wrap(ctrl.svc.ch.With(ctx).Update(channel))
|
||||
|
||||
@ -79,6 +79,7 @@ var _ RequestFiller = NewChannelList()
|
||||
type ChannelCreate struct {
|
||||
Name string
|
||||
Topic string
|
||||
Type string
|
||||
}
|
||||
|
||||
func NewChannelCreate() *ChannelCreate {
|
||||
@ -119,6 +120,10 @@ func (c *ChannelCreate) Fill(r *http.Request) error {
|
||||
|
||||
c.Topic = val
|
||||
}
|
||||
if val, ok := post["type"]; ok {
|
||||
|
||||
c.Type = val
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
@ -130,6 +135,7 @@ type ChannelEdit struct {
|
||||
ChannelID uint64
|
||||
Name string
|
||||
Topic string
|
||||
Type string
|
||||
Archive bool
|
||||
OrganisationID uint64
|
||||
}
|
||||
@ -173,6 +179,10 @@ func (c *ChannelEdit) Fill(r *http.Request) error {
|
||||
|
||||
c.Topic = val
|
||||
}
|
||||
if val, ok := post["type"]; ok {
|
||||
|
||||
c.Type = val
|
||||
}
|
||||
if val, ok := post["archive"]; ok {
|
||||
|
||||
c.Archive = parseBool(val)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user