engine

package
v0.0.0-...-f68bb27 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2025 License: MIT Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadContent

func LoadContent(options *types.Options) (content []byte, err error)

Types

type Endpoint

type Endpoint struct {
	Methods    []string        `json:"methods"`
	Parameters Parameters      `json:"parameters"`
	Args       json.RawMessage `json:"args"`
}

type Parameter

type Parameter struct {
	// Type among ["", "string", "array", "object", "boolean", "integer", ]
	Type string `json:"type"`
	// Format can be ["uri", ]
	Format   string `json:"format"`
	Pattern  string `json:"pattern"`
	Default  any    `json:"default"`
	Required bool   `json:"required"`

	// Metadata may be empty
	Title       string `json:"title"`
	Description string `json:"description"`

	// Integer constraints
	Minimum int `json:"minimum"`
	Maximum int `json:"maximum"`

	// String constraints
	MinLength int `json:"minLength"`
	MaxLength int `json:"maxLength"`

	// List of accepted values
	Enum  []string    `json:"enum"`
	OneOf []Parameter `json:"oneOf"`

	// todo: items
	// Maximum length of Items
	MaxItems int `json:"maxItems"`
}

type Parameters

type Parameters = map[string]Parameter

type Route

type Route struct {
	Namespace string     `json:"namespace"`
	Methods   []string   `json:"methods"`
	Endpoints []Endpoint `json:"endpoints"`
}

type Specification

type Specification struct {
	Name           string           `json:"name"`
	Description    string           `json:"description"`
	URL            string           `json:"url"`
	Home           string           `json:"home"`
	GmtOffset      int              `json:"gmt_offset"`
	TimezoneString string           `json:"timezone_string"`
	Namespaces     []string         `json:"namespaces"`
	Authentication []interface{}    `json:"authentication"`
	Routes         map[string]Route `json:"routes"`
}

func ParseSpecification

func ParseSpecification(content []byte) (*Specification, error)

type URLRequest

type URLRequest struct {
	URL     string            `json:"url"`
	Method  string            `json:"method"`
	Body    string            `json:"body"`
	Headers map[string]string `json:"headers"`
	Builtin bool              `json:"builtin"`
}

func ParseEndpoints

func ParseEndpoints(api *Specification) (endpoints []URLRequest, error error)

Jump to

Keyboard shortcuts

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