apigen

package
v1.51.0-rc Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2022 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API struct {
	Version        string
	Description    string
	PackageName    string
	Auth           api.Auth
	EndpointGroups []*EndpointGroup
}

API represents specific API's configuration.

func (*API) Group

func (a *API) Group(name, prefix string) *EndpointGroup

Group adds new endpoints group to API.

func (*API) MustWrite added in v1.49.3

func (a *API) MustWrite(path string)

MustWrite writes generated code into a file.

type Endpoint

type Endpoint struct {
	Name         string
	Description  string
	MethodName   string
	NoCookieAuth bool
	NoAPIAuth    bool
	Request      interface{}
	Response     interface{}
	Params       []Param
}

Endpoint represents endpoint's configuration.

func (*Endpoint) APIAuth

func (e *Endpoint) APIAuth() bool

APIAuth returns endpoint's API auth status.

func (*Endpoint) CookieAuth

func (e *Endpoint) CookieAuth() bool

CookieAuth returns endpoint's cookie auth status.

type EndpointGroup

type EndpointGroup struct {
	Name      string
	Prefix    string
	Endpoints map[PathMethod]*Endpoint
}

EndpointGroup represents endpoints group.

func (*EndpointGroup) Get

func (eg *EndpointGroup) Get(path string, endpoint *Endpoint)

Get adds new GET endpoint to endpoints group.

type Param added in v1.51.1

type Param struct {
	Name string
	Type reflect.Type
}

Param represents string interpretation of param's name and type.

func NewParam added in v1.51.1

func NewParam(name string, instance interface{}) Param

NewParam constructor which creates new Param entity by given name and type.

type PathMethod

type PathMethod struct {
	Path   string
	Method string
}

PathMethod represents endpoint's path and method type.

Jump to

Keyboard shortcuts

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