Documentation ¶
Index ¶
Constants ¶
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 ¶
func TypescriptTypeName ¶ added in v1.75.2
TypescriptTypeName gets the corresponding TypeScript type for a provided reflect.Type.
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
MustWriteGo writes generated Go code into a file.
func (*API) MustWriteTS ¶ added in v1.63.1
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) CookieAuth ¶
CookieAuth returns endpoint's cookie auth status.
type EndpointGroup ¶
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 StringBuilder ¶ added in v1.75.2
StringBuilder is an extension of strings.Builder that allows for writing formatted lines.
func (*StringBuilder) Writelnf ¶ added in v1.75.2
func (s *StringBuilder) Writelnf(format string, a ...interface{})
Writelnf formats arguments according to a format specifier and appends the resulting string to the StringBuilder's buffer.
type Types ¶ added in v1.75.2
type Types struct {
// contains filtered or unexported fields
}
Types handles generating definitions from types.
func NewTypes ¶ added in v1.75.2
func NewTypes() Types
NewTypes creates a new type definition generator.
func (*Types) All ¶ added in v1.75.2
All returns a slice containing every top-level type and their dependencies.
func (*Types) GenerateTypescriptDefinitions ¶ added in v1.75.2
GenerateTypescriptDefinitions returns the TypeScript class definitions corresponding to the registered Go types.