response

package
v0.0.0-...-9b2df44 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Error

func Error(w http.ResponseWriter, r *http.Request, code int, message string)

func JsonJWT

func JsonJWT(w http.ResponseWriter, r *http.Request, code int, response *JWT)

func OK

func OK(w http.ResponseWriter, r *http.Request, code int, stub *JSONStub)

Types

type JSONStub

type JSONStub struct {
	*pagination.Paginator
	Status  string            `json:"status,omitempty"`
	Message string            `json:"message,omitempty"`
	Data    interface{}       `json:"data,omitempty"`
	Links   map[string]string `json:"links,omitempty"`
}

func NewError

func NewError(message string) *JSONStub

func NewOK

func NewOK(v interface{}, pages *pagination.Paginator) *JSONStub
func (j *JSONStub) AddPaginationLinks(href string)
func (j *JSONStub) AddSelfLink(href string)

type JWT

type JWT struct {
	Status         string `json:"status,omitempty"`
	Message        string `json:"message"`
	Type           string `json:"type"`
	AccessToken    string `json:"access_token"`
	ExpirationTime string `json:"expiration_time"`
	RefreshToken   string `json:"refresh_token"`
}

Jump to

Keyboard shortcuts

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