rest

package
v0.4.2 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) Path added in v0.4.1

func (r Endpoint) Path() string

Path returns the path of the Endpoint

func (Endpoint) String

func (r Endpoint) String() string

String returns the string representation of the Endpoint

type Mapper added in v0.3.6

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

Mapper is the mapper for a REST endpoint and a gRPC method

func NewMapper added in v0.4.2

func NewMapper(
	endpoint *Endpoint,
	grpcMethod grpc.Method,
) *Mapper

NewMapper creates a new mapper

func (Mapper) Path added in v0.4.2

func (m Mapper) Path() string

Path returns the path of the REST endpoint

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