Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewServer ¶
func NewServer(auth sidebar.Authenticater, create sidebar.Creater, delete sidebar.Deleter, add sidebar.Adder, get sidebar.Getter, up sidebar.Updater) *server
NewServer receives all services needed to provide functionality then uses those services to spin-up an HTTP server. A hub for handling Websocket connections is also started in a goroutine. These things are wrapped in the server and returned.
Types ¶
type AuthInfo ¶
type AuthInfo struct { Email string `json:"email"` Password string `json:"password"` Workspace string `json:"workspace"` }
AuthInfo is used to decode requests to log in.
type ChannelWithMemberInfo ¶
ChannelWithMemberInfo contains a channel, a user id, and a bool telling whether the user is a member of this channel. This is stored within a UserWithChannels struct.
type ChannelWithUsersAndMessages ¶
type ChannelWithUsersAndMessages struct { Channel sidebar.Channel UsersInChannel []*sidebar.User MessagesInChannel []*sidebar.ChatMessage }
ChannelWithUsersAndMessages provides a channel along with information about all users and messages in the channel.
type PasswordUpdate ¶
type PasswordUpdate struct { OldPassword string `json:"old_password"` NewPassword string `json:"new_password"` }
PasswordUpdate is used to decode requests to update the user's password.
type SignupUser ¶
type SignupUser struct { ID string `json:"id"` DisplayName string `json:"display_name"` Email string `json:"email"` Password string `json:"password"` ProfileImg string `json:"profile_image"` }
SignupUser is used to decode JSON sent from the frontend for creating a new account.
type UserWithChannels ¶
type UserWithChannels struct { User sidebar.User Channels []*ChannelWithMemberInfo }
UserWithChannels provides the user's information along with all the channels to which the user belongs.