diff options
author | Ruzette Tanyag <ruzette@users.noreply.github.com> | 2017-02-14 10:28:08 -0500 |
---|---|---|
committer | Harrison Healey <harrisonmhealey@gmail.com> | 2017-02-14 10:28:08 -0500 |
commit | 28aa7cdbf2357bda51ba740fd4d7af48b36b96b4 (patch) | |
tree | 0a7daa93b5fa594b113f905506ed6ee6940e789b /api4/api.go | |
parent | 9dabd10da975a47155641351bbf61b6fb203b4ca (diff) | |
download | chat-28aa7cdbf2357bda51ba740fd4d7af48b36b96b4.tar.gz chat-28aa7cdbf2357bda51ba740fd4d7af48b36b96b4.tar.bz2 chat-28aa7cdbf2357bda51ba740fd4d7af48b36b96b4.zip |
Implement GET channels endpoints for APIv4 (#5363)
* implement get channels endpoints and updated drivers and unittests
* removed channel deletion on tear down, removed manage permission on get channels endpoints, and updated utils to add constant channel length
* added constants for user, team and channel length, updated context to use the model functions
* make sure team name length should be less than the minimum length and revert underscore to team name validity
* changed post test condition from notfound to unauthorized
Diffstat (limited to 'api4/api.go')
-rw-r--r-- | api4/api.go | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/api4/api.go b/api4/api.go index 6348714b2..b05c1a7db 100644 --- a/api4/api.go +++ b/api4/api.go @@ -32,13 +32,14 @@ type Routes struct { TeamMembers *mux.Router // 'api/v4/teams/{team_id:[A-Za-z0-9_-]+}/members' TeamMember *mux.Router // 'api/v4/teams/{team_id:[A-Za-z0-9_-]+}/members/{user_id:[A-Za-z0-9_-]+}' - Channels *mux.Router // 'api/v4/channels' - Channel *mux.Router // 'api/v4/channels/{channel_id:[A-Za-z0-9]+}' - ChannelByName *mux.Router // 'api/v4/teams/{team_id:[A-Za-z0-9]+}/channels/name/{channel_name:[A-Za-z0-9_-]+}' - ChannelsForTeam *mux.Router // 'api/v4/teams/{team_id:[A-Za-z0-9]+}/channels' - ChannelMembers *mux.Router // 'api/v4/channels/{channel_id:[A-Za-z0-9]+}/members' - ChannelMember *mux.Router // 'api/v4/channels/{channel_id:[A-Za-z0-9]+}/members/{user_id:[A-Za-z0-9]+}' - ChannelMembersForUser *mux.Router // 'api/v4/users/{user_id:[A-Za-z0-9]+}/teams/{team_id:[A-Za-z0-9]+}/channels/members' + Channels *mux.Router // 'api/v4/channels' + Channel *mux.Router // 'api/v4/channels/{channel_id:[A-Za-z0-9]+}' + ChannelByName *mux.Router // 'api/v4/teams/{team_id:[A-Za-z0-9]+}/channels/name/{channel_name:[A-Za-z0-9_-]+}' + ChannelByNameForTeamName *mux.Router // 'api/v4/teams/name/{team_name:[A-Za-z0-9_-]+}/channels/name/{channel_name:[A-Za-z0-9_-]+}' + ChannelsForTeam *mux.Router // 'api/v4/teams/{team_id:[A-Za-z0-9]+}/channels' + ChannelMembers *mux.Router // 'api/v4/channels/{channel_id:[A-Za-z0-9]+}/members' + ChannelMember *mux.Router // 'api/v4/channels/{channel_id:[A-Za-z0-9]+}/members/{user_id:[A-Za-z0-9]+}' + ChannelMembersForUser *mux.Router // 'api/v4/users/{user_id:[A-Za-z0-9]+}/teams/{team_id:[A-Za-z0-9]+}/channels/members' Posts *mux.Router // 'api/v4/posts' Post *mux.Router // 'api/v4/posts/{post_id:[A-Za-z0-9]+}' @@ -102,7 +103,8 @@ func InitApi(full bool) { BaseRoutes.Channels = BaseRoutes.ApiRoot.PathPrefix("/channels").Subrouter() BaseRoutes.Channel = BaseRoutes.Channels.PathPrefix("/{channel_id:[A-Za-z0-9]+}").Subrouter() - BaseRoutes.ChannelByName = BaseRoutes.Team.PathPrefix("/name/{channel_name:[A-Za-z0-9_-]+}").Subrouter() + BaseRoutes.ChannelByName = BaseRoutes.Team.PathPrefix("/channels/name/{channel_name:[A-Za-z0-9_-]+}").Subrouter() + BaseRoutes.ChannelByNameForTeamName = BaseRoutes.TeamByName.PathPrefix("/channels/name/{channel_name:[A-Za-z0-9_-]+}").Subrouter() BaseRoutes.ChannelsForTeam = BaseRoutes.Team.PathPrefix("/channels").Subrouter() BaseRoutes.ChannelMembers = BaseRoutes.Channel.PathPrefix("/members").Subrouter() BaseRoutes.ChannelMember = BaseRoutes.ChannelMembers.PathPrefix("/{user_id:[A-Za-z0-9]+}").Subrouter() |