rest

package
Version: v0.0.0-...-ee8eda9 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthTokenPayload

type AuthTokenPayload struct {
	// app_id
	// required: true
	// example: "react"
	AppID string `json:"app_id" validate:"required"`
	// uid
	// required: true
	// example: 0
	UID int `json:"uid" validate:"required"`
	// verified
	// required: true
	// example: true
	Verified bool `json:"verified" validated:"required"`
	// scopes
	// required: false
	// example: ['read','write']
	Scopes []string `json:"scopes,omitempty"`
}

AuthTokenPayload swagger:model AuthTokenPayload

type Err

type Err interface {
	WriteResponse(w http.ResponseWriter)
}

func NewBadRequestError

func NewBadRequestError(msg string) Err

func NewForbiddenError

func NewForbiddenError(msg string) Err

func NewInternalServerError

func NewInternalServerError(msg string) Err

func NewNonAuthoritative

func NewNonAuthoritative(msg string) Err

func NewNotFoundError

func NewNotFoundError(msg string) Err

func NewUnauthorized

func NewUnauthorized(msg string) Err

type OpaAllow

type OpaAllow struct {
	Allow bool `json:"allow"`
}

type OpaInputReq

type OpaInputReq struct {
	Input OpaReq
}

type OpaReq

type OpaReq struct {
	UID    int      `json:"uid"`
	Method string   `json:"method"`
	Path   string   `json:"path"`
	Scopes []string `json:"scopes"`
}

type OpaResult

type OpaResult struct {
	Result OpaAllow `json:"result"`
}

type PairToken

type PairToken struct {
	// access_token
	// required: true
	AccessToken *Token `json:"access_token" validate:"required"`
	// refresh_token
	// required: true
	RefreshToken *Token `json:"refresh_token" validate:"required"`
}

Pair Token swagger:model PairToken

type Suc

type Suc interface {
	WriteResponse(w http.ResponseWriter)
}

func NewBasicSuccess

func NewBasicSuccess(msg string, p interface{}) Suc

func NewSuccessCreated

func NewSuccessCreated(msg string, p interface{}) Suc

type Token

type Token struct {
	// jwt
	// required: true
	JWT string `json:"jwt" validate:"required"`
	// expires_at
	// required: false
	ExpiresAt time.Time `json:"expires_at,omitempty"`
}

Token swagger:model Token

Jump to

Keyboard shortcuts

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