api

package
v0.0.0-...-19946b9 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthenticationMiddleware

func AuthenticationMiddleware(next http.Handler) http.Handler

Types

type AuthRequest

type AuthRequest struct {
	Email    string `json:"email"`
	Password string `json:"password"`
}

type ErrorResponse

type ErrorResponse struct {
	Error string `json:"error"`
	Code  int    `json:"code"`
}

func (ErrorResponse) Encode

func (r ErrorResponse) Encode() ([]byte, error)

type Response

type Response interface {
	Encode() ([]byte, error)
}

type Server

type Server struct {
	// contains filtered or unexported fields
}

func NewServer

func NewServer(listenAddr string, storage storage.CockroachDB) *Server

func (*Server) Start

func (s *Server) Start() error

type UserByIDRequest

type UserByIDRequest struct {
	UserID string `json:"user_id"`
}

type UserLoginResponse

type UserLoginResponse struct {
	Message string     `json:"status"`
	User    types.User `json:"user"`
	Code    int        `json:"code"`
	Token   string     `json:"token"`
}

func (UserLoginResponse) Encode

func (r UserLoginResponse) Encode() ([]byte, error)

type UserMEResponse

type UserMEResponse struct {
	Message string                    `json:"status"`
	User    types.UserWithoutPassword `json:"user"`
	Code    int                       `json:"code"`
}

func (UserMEResponse) Encode

func (r UserMEResponse) Encode() ([]byte, error)

type UserSuccessResponse

type UserSuccessResponse struct {
	Message string     `json:"status"`
	User    types.User `json:"user"`
	Code    int        `json:"code"`
}

func (UserSuccessResponse) Encode

func (r UserSuccessResponse) Encode() ([]byte, error)

Jump to

Keyboard shortcuts

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