api

package
v1.0.2-0...-93c6762 Latest Latest
Warning

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

Go to latest
Published: May 19, 2021 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Credentials        = []string{"simulator", "super_safe!"}
	EncodedCredentials = b64.StdEncoding.EncodeToString([]byte(strings.Join(Credentials, ":")))
	Authentication     = "Basic " + EncodedCredentials
	ContentType        = "Content-Type"
	JSONContent        = "application/json"
)

Functions

func FollowHandler

func FollowHandler(w http.ResponseWriter, r *http.Request)

FollowHandler godoc @Summary Follows a user, unfollows a user @Description follows a user, unfollows a user @Param latest query int false "Something about latest" @Accept json @Success 204 {object} interface{} @Failure 401 {string} string "unauthorized" @Failure 500 {string} string response.Error @Router /api/fllws/{username} [post]

func GetFollowersHandler

func GetFollowersHandler(w http.ResponseWriter, r *http.Request)

GetFollowersHandler godoc @Summary Get followers @Description Returns a list of users followers @Param no query int false "Number of results returned" @Param latest query int false "Something about latest" @Accept json @Produce json @Success 200 {object} interface{} @Failure 401 {string} string "unauthorized" @Failure 500 {string} string response.Error @Router /api/fllws/{username} [get]

func GetLatestHandler

func GetLatestHandler(w http.ResponseWriter, r *http.Request)

GetLatestHandler godoc @Summary Get the latest x @Description Get the latest x @Produce json @Success 200 {object} interface{} @Router /api/latest [get]

func GetMessagesFromUserHandler

func GetMessagesFromUserHandler(w http.ResponseWriter, r *http.Request)

GetMessagesFromUserHandler godoc @Summary Gets the latest messages from a specific user @Description Gets the latest messages in descending order from a specific user. @Param username query string true "Username" @Param no query int false "Number of results returned" @Produce json @Success 200 {object} interface{} @Failure 401 {string} string "unauthorized" @Router /api/msgs/{username} [get]

func MemoryCreateMessageHelper

func MemoryCreateMessageHelper(data []byte, username string) *http.Response

MemoryCreateMessageHelper sends a request to create a message

func MemoryFollowUserHelper

func MemoryFollowUserHelper(data []byte, username string) *http.Response

MemoryFollowUserHelper sends a request to follow a user

func MemoryGetFollowUserHelper

func MemoryGetFollowUserHelper(data []byte, username string) *http.Response

MemoryGetFollowUserHelper sends a request to get user followers

func MemoryGetLatestMessageHelper

func MemoryGetLatestMessageHelper(data []byte, username string) *http.Response

MemoryGetLatestMessageHelper requests the latest messages

func MemoryGetLatestUserMessageHelper

func MemoryGetLatestUserMessageHelper(data []byte, username string) *http.Response

MemoryGetLatestUserMessageHelper requests to get the latest message from a user

func MemoryLatestHelper

func MemoryLatestHelper() *http.Response

MemoryLatestHelper sends a request to get the latest variable

func MemoryRegisterHelper

func MemoryRegisterHelper(data []byte) *http.Response

MemoryRegisterHelepr sends a register user request

func MessagesHandler

func MessagesHandler(w http.ResponseWriter, r *http.Request)

MessagesHandler godoc @Summary Gets the latest messages @Description Gets the latest messages in descending order. @Param no query int false "Number of results returned" @Produce json @Success 200 {object} interface{} @Failure 401 {string} string "unauthorized" @Router /api/msgs [get]

func PostMessageHandler

func PostMessageHandler(w http.ResponseWriter, r *http.Request)

PostMessageHandler godoc @Summary Create a message from user @Description Creates a message from a specific user. @Param username query string true "Username" @Produce json @Success 200 {object} interface{} @Failure 401 {string} string "unauthorized" @Router /api/msgs/{username} [post]

func RegisterHandler

func RegisterHandler(w http.ResponseWriter, r *http.Request)

Messages godoc @Summary Registers a user @Description Registers a user, provided that the given info passes all checks. @Accept json @Produce json @Success 203 @Failure 400 {string} string "unauthorized" @Router /api/register [post]

func SetMuxVars

func SetMuxVars(request *http.Request, username string) *http.Request

Types

This section is empty.

Jump to

Keyboard shortcuts

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