3
0

Update generated code with new version of spec tool

This commit is contained in:
Denis Arh 2018-07-20 10:50:40 +02:00
parent 78c9d9ae76
commit 6a3e38bc2b
11 changed files with 68 additions and 42 deletions

View File

@ -20,6 +20,7 @@
"name": "Field"
}
],
"Parameters": null,
"Protocol": "",
"Authentication": [],
"Path": "/field",

View File

@ -42,6 +42,7 @@
"name": "ModuleContentRow"
}
],
"Parameters": null,
"Protocol": "",
"Authentication": [],
"Path": "/module",

View File

@ -8,7 +8,7 @@ Organisations represent a top-level grouping entity. There may be many organisat
| URI | Protocol | Method | Authentication |
| --- | -------- | ------ | -------------- |
| `/organisation/` | HTTP/S | GET | Client ID, Session ID |
| `/organisations/` | HTTP/S | GET | Client ID, Session ID |
#### Request parameters
@ -22,7 +22,7 @@ Organisations represent a top-level grouping entity. There may be many organisat
| URI | Protocol | Method | Authentication |
| --- | -------- | ------ | -------------- |
| `/organisation/` | HTTP/S | PUT | Client ID, Session ID |
| `/organisations/` | HTTP/S | PUT | Client ID, Session ID |
#### Request parameters
@ -36,7 +36,7 @@ Organisations represent a top-level grouping entity. There may be many organisat
| URI | Protocol | Method | Authentication |
| --- | -------- | ------ | -------------- |
| `/organisation/{id}` | HTTP/S | POST | Client ID, Session ID |
| `/organisations/{id}` | HTTP/S | POST | Client ID, Session ID |
#### Request parameters
@ -51,7 +51,7 @@ Organisations represent a top-level grouping entity. There may be many organisat
| URI | Protocol | Method | Authentication |
| --- | -------- | ------ | -------------- |
| `/organisation/{id}` | HTTP/S | DELETE | Client ID, Session ID |
| `/organisations/{id}` | HTTP/S | DELETE | Client ID, Session ID |
#### Request parameters
@ -65,7 +65,7 @@ Organisations represent a top-level grouping entity. There may be many organisat
| URI | Protocol | Method | Authentication |
| --- | -------- | ------ | -------------- |
| `/organisation/{id}` | HTTP/S | GET | Client ID, Session ID |
| `/organisations/{id}` | HTTP/S | GET | Client ID, Session ID |
#### Request parameters
@ -79,7 +79,7 @@ Organisations represent a top-level grouping entity. There may be many organisat
| URI | Protocol | Method | Authentication |
| --- | -------- | ------ | -------------- |
| `/organisation/{id}/archive` | HTTP/S | POST | Client ID, Session ID |
| `/organisations/{id}/archive` | HTTP/S | POST | Client ID, Session ID |
#### Request parameters
@ -100,7 +100,7 @@ An organisation may have many teams. Teams may have many channels available. Acc
| URI | Protocol | Method | Authentication |
| --- | -------- | ------ | -------------- |
| `/team/` | HTTP/S | GET | Client ID, Session ID |
| `/teams/` | HTTP/S | GET | Client ID, Session ID |
#### Request parameters
@ -114,7 +114,7 @@ An organisation may have many teams. Teams may have many channels available. Acc
| URI | Protocol | Method | Authentication |
| --- | -------- | ------ | -------------- |
| `/team/` | HTTP/S | PUT | Client ID, Session ID |
| `/teams/` | HTTP/S | PUT | Client ID, Session ID |
#### Request parameters
@ -129,7 +129,7 @@ An organisation may have many teams. Teams may have many channels available. Acc
| URI | Protocol | Method | Authentication |
| --- | -------- | ------ | -------------- |
| `/team/{id}` | HTTP/S | POST | Client ID, Session ID |
| `/teams/{id}` | HTTP/S | POST | Client ID, Session ID |
#### Request parameters
@ -145,7 +145,7 @@ An organisation may have many teams. Teams may have many channels available. Acc
| URI | Protocol | Method | Authentication |
| --- | -------- | ------ | -------------- |
| `/team/{id}` | HTTP/S | GET | Client ID, Session ID |
| `/teams/{id}` | HTTP/S | GET | Client ID, Session ID |
#### Request parameters
@ -159,7 +159,7 @@ An organisation may have many teams. Teams may have many channels available. Acc
| URI | Protocol | Method | Authentication |
| --- | -------- | ------ | -------------- |
| `/team/{id}` | HTTP/S | DELETE | Client ID, Session ID |
| `/teams/{id}` | HTTP/S | DELETE | Client ID, Session ID |
#### Request parameters
@ -173,7 +173,7 @@ An organisation may have many teams. Teams may have many channels available. Acc
| URI | Protocol | Method | Authentication |
| --- | -------- | ------ | -------------- |
| `/team/{id}/archive` | HTTP/S | POST | Client ID, Session ID |
| `/teams/{id}/archive` | HTTP/S | POST | Client ID, Session ID |
#### Request parameters
@ -187,7 +187,7 @@ An organisation may have many teams. Teams may have many channels available. Acc
| URI | Protocol | Method | Authentication |
| --- | -------- | ------ | -------------- |
| `/team/{id}/move` | HTTP/S | POST | Client ID, Session ID |
| `/teams/{id}/move` | HTTP/S | POST | Client ID, Session ID |
#### Request parameters
@ -202,7 +202,7 @@ An organisation may have many teams. Teams may have many channels available. Acc
| URI | Protocol | Method | Authentication |
| --- | -------- | ------ | -------------- |
| `/team/{id}/merge` | HTTP/S | POST | Client ID, Session ID |
| `/teams/{id}/merge` | HTTP/S | POST | Client ID, Session ID |
#### Request parameters
@ -224,7 +224,7 @@ A channel is a representation of a sequence of messages. It has meta data like c
| URI | Protocol | Method | Authentication |
| --- | -------- | ------ | -------------- |
| `/channel/` | HTTP/S | GET | Client ID, Session ID |
| `/channels/` | HTTP/S | GET | Client ID, Session ID |
#### Request parameters
@ -238,7 +238,7 @@ A channel is a representation of a sequence of messages. It has meta data like c
| URI | Protocol | Method | Authentication |
| --- | -------- | ------ | -------------- |
| `/channel/` | HTTP/S | PUT | Client ID, Session ID |
| `/channels/` | HTTP/S | PUT | Client ID, Session ID |
#### Request parameters
@ -253,7 +253,7 @@ A channel is a representation of a sequence of messages. It has meta data like c
| URI | Protocol | Method | Authentication |
| --- | -------- | ------ | -------------- |
| `/channel/{channelId}` | HTTP/S | POST | Client ID, Session ID |
| `/channels/{channelId}` | HTTP/S | POST | Client ID, Session ID |
#### Request parameters
@ -271,7 +271,7 @@ A channel is a representation of a sequence of messages. It has meta data like c
| URI | Protocol | Method | Authentication |
| --- | -------- | ------ | -------------- |
| `/channel/{channelId}` | HTTP/S | GET | Client ID, Session ID |
| `/channels/{channelId}` | HTTP/S | GET | Client ID, Session ID |
#### Request parameters
@ -285,7 +285,7 @@ A channel is a representation of a sequence of messages. It has meta data like c
| URI | Protocol | Method | Authentication |
| --- | -------- | ------ | -------------- |
| `/channel/{channelId}` | HTTP/S | DELETE | Client ID, Session ID |
| `/channels/{channelId}` | HTTP/S | DELETE | Client ID, Session ID |
#### Request parameters
@ -324,7 +324,7 @@ The following event types may be sent with a message event:
| URI | Protocol | Method | Authentication |
| --- | -------- | ------ | -------------- |
| `/message/` | HTTP/S | POST | Client ID, Session ID |
| `/channels/{channelId}/messages/` | HTTP/S | POST | Client ID, Session ID |
#### Request parameters
@ -338,7 +338,7 @@ The following event types may be sent with a message event:
| URI | Protocol | Method | Authentication |
| --- | -------- | ------ | -------------- |
| `/message/{messageId}` | HTTP/S | PUT | Client ID, Session ID |
| `/channels/{channelId}/messages/{messageId}` | HTTP/S | PUT | Client ID, Session ID |
#### Request parameters
@ -353,7 +353,7 @@ The following event types may be sent with a message event:
| URI | Protocol | Method | Authentication |
| --- | -------- | ------ | -------------- |
| `/message/{messageId}` | HTTP/S | DELETE | Client ID, Session ID |
| `/channels/{channelId}/messages/{messageId}` | HTTP/S | DELETE | Client ID, Session ID |
#### Request parameters
@ -367,7 +367,7 @@ The following event types may be sent with a message event:
| URI | Protocol | Method | Authentication |
| --- | -------- | ------ | -------------- |
| `/message/{messageId}/attach` | HTTP/S | PUT | Client ID, Session ID |
| `/channels/{channelId}/messages/{messageId}/attach` | HTTP/S | PUT | Client ID, Session ID |
#### Request parameters
@ -380,7 +380,7 @@ The following event types may be sent with a message event:
| URI | Protocol | Method | Authentication |
| --- | -------- | ------ | -------------- |
| `/message/search` | HTTP/S | GET | Client ID, Session ID |
| `/channels/{channelId}/messages/search` | HTTP/S | GET | Client ID, Session ID |
#### Request parameters
@ -395,7 +395,7 @@ The following event types may be sent with a message event:
| URI | Protocol | Method | Authentication |
| --- | -------- | ------ | -------------- |
| `/message/{messageId}/pin` | HTTP/S | POST | Client ID, Session ID |
| `/channels/{channelId}/messages/{messageId}/pin` | HTTP/S | POST | Client ID, Session ID |
#### Request parameters
@ -409,7 +409,7 @@ The following event types may be sent with a message event:
| URI | Protocol | Method | Authentication |
| --- | -------- | ------ | -------------- |
| `/message/{messageId}/pin` | HTTP/S | DELETE | Client ID, Session ID |
| `/channels/{channelId}/messages/{messageId}/pin` | HTTP/S | DELETE | Client ID, Session ID |
#### Request parameters
@ -423,7 +423,7 @@ The following event types may be sent with a message event:
| URI | Protocol | Method | Authentication |
| --- | -------- | ------ | -------------- |
| `/message/{messageId}/flag` | HTTP/S | POST | Client ID, Session ID |
| `/channels/{channelId}/messages/{messageId}/flag` | HTTP/S | POST | Client ID, Session ID |
#### Request parameters
@ -437,7 +437,7 @@ The following event types may be sent with a message event:
| URI | Protocol | Method | Authentication |
| --- | -------- | ------ | -------------- |
| `/message/{messageId}/flag` | HTTP/S | DELETE | Client ID, Session ID |
| `/channels/{channelId}/messages/{messageId}/flag` | HTTP/S | DELETE | Client ID, Session ID |
#### Request parameters
@ -451,7 +451,7 @@ The following event types may be sent with a message event:
| URI | Protocol | Method | Authentication |
| --- | -------- | ------ | -------------- |
| `/message/{messageId}/react` | HTTP/S | POST | Client ID, Session ID |
| `/channels/{channelId}/messages/{messageId}/react` | HTTP/S | POST | Client ID, Session ID |
#### Request parameters
@ -466,7 +466,7 @@ The following event types may be sent with a message event:
| URI | Protocol | Method | Authentication |
| --- | -------- | ------ | -------------- |
| `/message/{messageId}/react/{reactionId}` | HTTP/S | DELETE | Client ID, Session ID |
| `/channels/{channelId}/messages/{messageId}/react/{reactionId}` | HTTP/S | DELETE | Client ID, Session ID |
#### Request parameters
@ -486,7 +486,7 @@ The following event types may be sent with a message event:
| URI | Protocol | Method | Authentication |
| --- | -------- | ------ | -------------- |
| `/user/search` | HTTP/S | GET | Client ID, Session ID |
| `/users/search` | HTTP/S | GET | Client ID, Session ID |
#### Request parameters

View File

@ -3,6 +3,7 @@
"Package": "sam",
"Interface": "Auth",
"Struct": [],
"Parameters": null,
"Protocol": "",
"Authentication": null,
"Path": "/auth",

View File

@ -50,12 +50,13 @@
"name": "Channel"
}
],
"Parameters": null,
"Protocol": "",
"Authentication": [
"Client ID",
"Session ID"
],
"Path": "/channel",
"Path": "/channels",
"APIs": [
{
"Name": "list",

View File

@ -127,12 +127,22 @@
"name": "Attachment"
}
],
"Parameters": {
"path": [
{
"name": "channelId",
"required": true,
"title": "Channel ID",
"type": "uint64"
}
]
},
"Protocol": "",
"Authentication": [
"Client ID",
"Session ID"
],
"Path": "/message",
"Path": "/channels/{channelId}/messages",
"APIs": [
{
"Name": "create",

View File

@ -33,12 +33,13 @@
"name": "Organisation"
}
],
"Parameters": null,
"Protocol": "",
"Authentication": [
"Client ID",
"Session ID"
],
"Path": "/organisation",
"Path": "/organisations",
"APIs": [
{
"Name": "list",

View File

@ -45,12 +45,13 @@
"name": "Team"
}
],
"Parameters": null,
"Protocol": "",
"Authentication": [
"Client ID",
"Session ID"
],
"Path": "/team",
"Path": "/teams",
"APIs": [
{
"Name": "list",

View File

@ -48,12 +48,13 @@
"name": "User"
}
],
"Parameters": null,
"Protocol": "",
"Authentication": [
"Client ID",
"Session ID"
],
"Path": "/user",
"Path": "/users",
"APIs": [
{
"Name": "search",

View File

@ -36,7 +36,7 @@ func MountRoutes(r chi.Router) {
})
r.Group(func(r chi.Router) {
r.Use(channel.Channel.Authenticator())
r.Route("/channel", func(r chi.Router) {
r.Route("/channels", func(r chi.Router) {
r.Get("/", channel.List)
r.Put("/", channel.Create)
r.Post("/{channelId}", channel.Edit)
@ -46,7 +46,7 @@ func MountRoutes(r chi.Router) {
})
r.Group(func(r chi.Router) {
r.Use(message.Message.Authenticator())
r.Route("/message", func(r chi.Router) {
r.Route("/channels/{channelId}/messages", func(r chi.Router) {
r.Post("/", message.Create)
r.Put("/{messageId}", message.Edit)
r.Delete("/{messageId}", message.Delete)
@ -62,7 +62,7 @@ func MountRoutes(r chi.Router) {
})
r.Group(func(r chi.Router) {
r.Use(organisation.Organisation.Authenticator())
r.Route("/organisation", func(r chi.Router) {
r.Route("/organisations", func(r chi.Router) {
r.Get("/", organisation.List)
r.Put("/", organisation.Create)
r.Post("/{id}", organisation.Edit)
@ -73,7 +73,7 @@ func MountRoutes(r chi.Router) {
})
r.Group(func(r chi.Router) {
r.Use(team.Team.Authenticator())
r.Route("/team", func(r chi.Router) {
r.Route("/teams", func(r chi.Router) {
r.Get("/", team.List)
r.Put("/", team.Create)
r.Post("/{id}", team.Edit)
@ -86,7 +86,7 @@ func MountRoutes(r chi.Router) {
})
r.Group(func(r chi.Router) {
r.Use(user.User.Authenticator())
r.Route("/user", func(r chi.Router) {
r.Route("/users", func(r chi.Router) {
r.Get("/search", user.Search)
})
})

View File

@ -24,7 +24,8 @@ var _ = chi.URLParam
// Message create request parameters
type MessageCreateRequest struct {
Contents string
ChannelId uint64
Contents string
}
func (MessageCreateRequest) new() *MessageCreateRequest {
@ -44,6 +45,8 @@ func (m *MessageCreateRequest) Fill(r *http.Request) error {
post[name] = string(param[0])
}
m.ChannelId = parseUInt64(chi.URLParam(r, "channelId"))
m.Contents = post["contents"]
return nil
}
@ -111,6 +114,7 @@ var _ RequestFiller = MessageDeleteRequest{}.new()
// Message attach request parameters
type MessageAttachRequest struct {
ChannelId uint64
}
func (MessageAttachRequest) new() *MessageAttachRequest {
@ -129,6 +133,8 @@ func (m *MessageAttachRequest) Fill(r *http.Request) error {
for name, param := range postVars {
post[name] = string(param[0])
}
m.ChannelId = parseUInt64(chi.URLParam(r, "channelId"))
return nil
}
@ -136,6 +142,7 @@ var _ RequestFiller = MessageAttachRequest{}.new()
// Message search request parameters
type MessageSearchRequest struct {
ChannelId uint64
Query string
Message_type string
}
@ -157,6 +164,8 @@ func (m *MessageSearchRequest) Fill(r *http.Request) error {
post[name] = string(param[0])
}
m.ChannelId = parseUInt64(chi.URLParam(r, "channelId"))
m.Query = get["query"]
m.Message_type = get["message_type"]