apigen

package
v1.65.1 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2022 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const DateFormat = "2006-01-02T15:04:05.999Z"

DateFormat is the layout of dates passed into and out of the API.

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) MustWriteGo added in v1.55.1

func (a *API) MustWriteGo(path string)

MustWriteGo writes generated Go code into a file.

func (*API) MustWriteTS added in v1.63.1

func (a *API) MustWriteTS(path string)

MustWriteTS writes generated TypeScript code into a file.

type Endpoint

type Endpoint struct {
	Name         string
	Description  string
	MethodName   string
	RequestName  string
	NoCookieAuth bool
	NoAPIAuth    bool
	Request      interface{}
	Response     interface{}
	QueryParams  []Param
	PathParams   []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
	// contains filtered or unexported fields
}

EndpointGroup represents endpoints group.

func (*EndpointGroup) Delete added in v1.57.1

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

Delete adds new DELETE endpoint to endpoints group.

func (*EndpointGroup) Get

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

Get adds new GET endpoint to endpoints group.

func (*EndpointGroup) Patch added in v1.54.1

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

Patch adds new PATCH endpoint to endpoints group.

func (*EndpointGroup) Post added in v1.55.1

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

Post adds new POST 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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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