apimodels

package
v0.0.14 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2024 License: GPL-3.0 Imports: 3 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApiContext

type ApiContext struct {
	Trazability Trazability
	Database    database.Database
	Request     Request
	Response    Response
}

type Endpoint

type Endpoint struct {
	Path   string     `json:"path"`
	Method HttpMethod `json:"method"`

	RequestMimeType  MimeType `json:"requestMimeType"`
	ResponseMimeType MimeType `json:"responseMimeType"`

	Listener EndpointListener `json:"-"`
	Checks   EndpointCheck    `json:"-"`

	Secured  bool `json:"secured"`
	Database bool `json:"-"`
}

type EndpointCheck

type EndpointCheck func(context *ApiContext) *Error

type EndpointListener

type EndpointListener func(context *ApiContext) (*interface{}, *Error)

type Error

type Error struct {
	Status  int               `json:"status,omitempty"`
	Error   apierror.ApiError `json:"error,omitempty"`
	Message string            `json:"message,omitempty"`
}

type HttpHeaders added in v0.0.14

type HttpHeaders string
const (
	HeaderContentType             HttpHeaders = "Content-Type"
	HeaderAccept                  HttpHeaders = "Accept"
	HeaderAuthorization           HttpHeaders = "Authorization"
	HeaderUserAgent               HttpHeaders = "User-Agent"
	HeaderContentLength           HttpHeaders = "Content-Length"
	HeaderContentEncoding         HttpHeaders = "Content-Encoding"
	HeaderContentDisposition      HttpHeaders = "Content-Disposition"
	HeaderContentTransferEncoding HttpHeaders = "Content-Transfer-Encoding"
	HeaderContentLanguage         HttpHeaders = "Content-Language"
)

type HttpMethod added in v0.0.14

type HttpMethod int
const (
	GetMethod HttpMethod = iota
	PostMethod
	PutMethod
	DeleteMethod
	PatchMethod
	OptionsMethod
	HeadMethod
	TraceMethod
)

type Launcher

type Launcher struct {
	Id           string       `json:"id"`
	LauncherType LauncherType `json:"type"`
}

type LauncherType

type LauncherType int
const (
	AUTOMATED LauncherType = iota
	USER
)

type Message

type Message struct {
	Status  int    `json:"status,omitempty"`
	Message string `json:"message,omitempty"`
}

type MimeType added in v0.0.14

type MimeType string
const (
	MimeApplicationJson        MimeType = "application/json"
	MimeApplicationXml         MimeType = "application/xml"
	MimeApplicationYaml        MimeType = "application/yaml"
	MimeApplicationForm        MimeType = "application/x-www-form-urlencoded"
	MimeApplicationOctetStream MimeType = "application/octet-stream"
	MimeTextPlain              MimeType = "text/plain"
	MimeTextHtml               MimeType = "text/html"
)

type Request

type Request struct {
	Authorization string            `json:"authorization"`
	IP            string            `json:"ip"`
	UserAgent     string            `json:"userAgent"`
	Params        map[string]string `json:"params"`
	Body          interface{}       `json:"body"`
	Headers       map[string]string `json:"headers"`
	Files         interface{}       `json:"files"`
}

type Response

type Response struct {
	Code         int         `json:"-"`
	Response     interface{} `json:"response"`
	ResponseTime int64       `json:"response_time"`
}

type Trazability

type Trazability struct {
	Endpoint  Endpoint          `json:"endpoint"`
	Timestamp *int64            `json:"timestamp"`
	Launcher  Launcher          `json:"launcher"`
	User      *usersmodels.User `json:"user"`
}

Jump to

Keyboard shortcuts

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