server

package
v0.0.0-...-8c85031 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 12, 2020 License: MIT Imports: 14 Imported by: 0

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

type ChannelWithMemberInfo struct {
	sidebar.Channel
	MemberID string
	Member   bool
}

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 JWTToken

type JWTToken struct {
	UserID        string
	WorkspaceID   string
	Authenticated bool
	jwt.StandardClaims
}

JWTToken contains information to be stored in a JWT on the client side.

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL