api

package
v0.2.11 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: MIT, Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Encode

func Encode(e *Endpoint) map[string]string

Encode encodes an endpoint to endpoint metadata

func Validate

func Validate(e *Endpoint) error

Validate validates an endpoint to guarantee it won't blow up when being served

Types

type Api

type Api interface {
	// Initialise options
	Init(...Option) error
	// Get the options
	Options() Options
	// Register a http handler
	Register(*Endpoint) error
	// Register a route
	Deregister(*Endpoint) error
	// Implemenation of api
	String() string
}

type Endpoint

type Endpoint struct {
	// RPC Method e.g. Greeter.Hello
	Name string
	// Description e.g what's this endpoint for
	Description string
	// API Handler e.g rpc, proxy
	Handler string
	// HTTP Host e.g example.com
	Host []string
	// HTTP Methods e.g GET, POST
	Method []string
	// HTTP Path e.g /greeter. Expect POSIX regex
	Path []string
	// Body destination
	// "*" or "" - top level message value
	// "string" - inner message value
	Body string
	// Stream flag
	Stream bool
}

Endpoint is a mapping between an RPC method and HTTP endpoint

func Decode

func Decode(e map[string]string) *Endpoint

Decode decodes endpoint metadata into an endpoint

type Option

type Option func(*Options) error

type Options

type Options struct{}

type Service

type Service struct {
	// Name of service
	Name string
	// The endpoint for this service
	Endpoint *Endpoint
	// Versions of this service
	Services []*interface{}
}

Service represents an API service

Directories

Path Synopsis
Package handler provides http handlers
Package handler provides http handlers
event
Package event provides a handler which publishes an event
Package event provides a handler which publishes an event
web
Package web contains the web handler including websocket support
Package web contains the web handler including websocket support
internal
Package resolver resolves a http request to an endpoint
Package resolver resolves a http request to an endpoint
grpc
Package grpc resolves a grpc service like /greeter.Say/Hello to greeter service
Package grpc resolves a grpc service like /greeter.Say/Hello to greeter service
host
Package host resolves using http host
Package host resolves using http host
path
Package path resolves using http path
Package path resolves using http path
vpath
Package vpath resolves using http path and recognised versioned urls
Package vpath resolves using http path and recognised versioned urls
Package router provides api service routing
Package router provides api service routing
registry
Package registry provides a dynamic api service router
Package registry provides a dynamic api service router
Package server provides an API gateway server which handles inbound requests
Package server provides an API gateway server which handles inbound requests

Jump to

Keyboard shortcuts

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