web

package
v0.0.0-...-3addf0d Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrBadRequest  = GameError{StatusCode: http.StatusBadRequest, Type: "api_error", Message: "Cannot process current request"}
	ErrInvalidJSON = GameError{StatusCode: http.StatusBadRequest, Type: "invalid_json", Message: "Invalid or malformed JSON"}
)

Functions

This section is empty.

Types

type GameError

type GameError struct {
	StatusCode int    `json:"-"`
	Type       string `json:"type"`
	Message    string `json:"message,omitempty"`
}

func (GameError) Send

func (e GameError) Send(w http.ResponseWriter) error

type ResponseAPI

type ResponseAPI struct {
	Success bool        `json:"success"`
	Status  int         `json:"status,omitempty"`
	Result  interface{} `json:"result,omitempty"`
}

func Duplicate

func Duplicate(result interface{}, status int) *ResponseAPI

func NoContent

func NoContent(result interface{}, status int) *ResponseAPI

func Success

func Success(result interface{}, status int) *ResponseAPI

func (*ResponseAPI) Send

func (r *ResponseAPI) Send(w http.ResponseWriter) error

Jump to

Keyboard shortcuts

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