diff --git a/api/messaging/spec.json b/api/messaging/spec.json index 11893f54a..35e9f4fdf 100644 --- a/api/messaging/spec.json +++ b/api/messaging/spec.json @@ -163,7 +163,7 @@ { "type": "string", "name": "name", - "required": true, + "required": false, "title": "Name of Channel" }, { @@ -179,7 +179,7 @@ "title": "Channel type" }, { - "type": "[]string", + "type": "[]uint64", "name": "members", "required": false, "title": "Initial members of the channel" diff --git a/api/messaging/spec/channel.json b/api/messaging/spec/channel.json index 7cc112a79..582f58015 100644 --- a/api/messaging/spec/channel.json +++ b/api/messaging/spec/channel.json @@ -36,7 +36,7 @@ "post": [ { "name": "name", - "required": true, + "required": false, "title": "Name of Channel", "type": "string" }, @@ -56,7 +56,7 @@ "name": "members", "required": false, "title": "Initial members of the channel", - "type": "[]string" + "type": "[]uint64" } ] } diff --git a/docs/messaging/README.md b/docs/messaging/README.md index dec14221f..42bfdfc20 100644 --- a/docs/messaging/README.md +++ b/docs/messaging/README.md @@ -117,10 +117,10 @@ A channel is a representation of a sequence of messages. It has meta data like c | Parameter | Type | Method | Description | Default | Required? | | --------- | ---- | ------ | ----------- | ------- | --------- | -| name | string | POST | Name of Channel | 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 | -| members | []string | POST | Initial members of the channel | N/A | NO | +| members | []uint64 | POST | Initial members of the channel | N/A | NO | ## Update channel details diff --git a/messaging/rest/channel.go b/messaging/rest/channel.go index e1ace58b8..8a6b959ee 100644 --- a/messaging/rest/channel.go +++ b/messaging/rest/channel.go @@ -36,7 +36,7 @@ func (ctrl *Channel) Create(ctx context.Context, r *request.ChannelCreate) (inte Name: r.Name, Topic: r.Topic, Type: types.ChannelType(r.Type), - Members: payload.ParseUInt64s(r.Members), + Members: r.Members, } return ctrl.wrap(ctrl.svc.ch.With(ctx).Create(channel)) diff --git a/messaging/rest/request/channel.go b/messaging/rest/request/channel.go index 627a7f53b..60219b44c 100644 --- a/messaging/rest/request/channel.go +++ b/messaging/rest/request/channel.go @@ -81,7 +81,7 @@ type ChannelCreate struct { Name string Topic string Type string - Members []string + Members []uint64 `json:",string"` } func NewChannelCreate() *ChannelCreate { @@ -128,6 +128,8 @@ func (cReq *ChannelCreate) Fill(r *http.Request) (err error) { cReq.Type = val } + cReq.Members = parseUInt64A(r.Form["members"]) + return err }