rest

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2024 License: GPL-3.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Email        = NewParam("email")
	Username     = NewParam("username")
	Token        = NewParam("token")
	Id           = NewParam("id")
	PermissionId = NewParam("permission-id")
	RoleId       = NewParam("role-id")
	UserId       = NewParam("user-id")
	JwtId        = NewParam("jwt-id")
)

Param values

Functions

This section is empty.

Types

type Endpoint

type Endpoint struct {
	Name   string
	Params []Param
}

Endpoint is the REST endpoint

func NewEndpoint

func NewEndpoint(name string, params ...Param) *Endpoint

NewEndpoint creates a new Endpoint

func (Endpoint) String

func (r Endpoint) String() string

String returns the string representation of the Endpoint

type Handler added in v0.4.0

type Handler struct {
	Endpoint   *Endpoint
	GRPCMethod grpc.Method
}

Handler is a handler for a REST endpoint

func NewHandler added in v0.4.0

func NewHandler(
	endpoint *Endpoint,
	grpcMethod grpc.Method,
) *Handler

NewHandler creates a new handler

type Method

type Method int

Method is the type of REST request method

const (
	GET Method = iota
	POST
	PUT
	PATCH
	DELETE
	INVALID
)

Method values

func GetMethod

func GetMethod(method string) Method

GetMethod returns the Method from the string

type Param

type Param struct {
	Name string
}

Param is the type of REST request parameter

func NewParam

func NewParam(name string) Param

NewParam creates a new Param

func (Param) String

func (r Param) String() string

String returns the string representation of the Param

Jump to

Keyboard shortcuts

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