api

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2020 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NoSecurity

func NoSecurity(err error, log contract.Logger) contract.Security

NoSecurity creates a new NullSecurity instance.

Types

type JSONSchema

type JSONSchema map[string]interface{}

JSONSchema is an internal type to hold a JSON schema definition.

type NullOperation

type NullOperation struct {
	errors.NullObjectPrototype
}

NullOperation is used whenever we can't have a real one. Reports the contained error on every method call.

func NoOperation

func NoOperation(err error, log contract.Logger) *NullOperation

NoOperation creates a new NullOperation instance.

func (NullOperation) Data

Data reports an error.

func (NullOperation) Description

func (op NullOperation) Description() string

Description reports an error.

func (NullOperation) GetRequest

func (op NullOperation) GetRequest() (*http.Request, error)

GetRequest reports an error.

func (NullOperation) ID

func (op NullOperation) ID() string

ID reports an error.

func (NullOperation) Method

func (op NullOperation) Method() string

Method reports an error.

func (NullOperation) Name

func (op NullOperation) Name() string

Name reports an error.

func (NullOperation) Path

func (op NullOperation) Path() string

Path reports an error.

func (NullOperation) Resolve

func (op NullOperation) Resolve() contract.DataResolver

Resolve reports an error.

func (NullOperation) Result

func (op NullOperation) Result() *contract.OperationResult

Result reports an error.

type NullSecurity

type NullSecurity struct {
	errors.NullObjectPrototype
}

NullSecurity is used whenever we can't have a real one. Reports the contained error on every method call.

func (*NullSecurity) Enrich

func (sec *NullSecurity) Enrich(req *http.Request, log contract.Logger)

Enrich reports an error.

func (*NullSecurity) GetName

func (sec *NullSecurity) GetName() string

GetName reports an error.

type NullSpec

type NullSpec struct {
	errors.NullObjectPrototype
}

NullSpec is a placehilder spec used when we can't have a real one.

func NoSpec

func NoSpec(err error, log contract.Logger) NullSpec

NoSpec creates a new NullSpec instance.

func (NullSpec) Description

func (spec NullSpec) Description() string

Description reports an error.

func (NullSpec) GetOperation

func (spec NullSpec) GetOperation(name string) contract.Operation

GetOperation reports an error.

func (NullSpec) Operations

func (spec NullSpec) Operations() contract.OperationIterator

Operations reports an error.

func (NullSpec) Title

func (spec NullSpec) Title() string

Title reports an error.

func (NullSpec) Version

func (spec NullSpec) Version() string

Version reports an error.

type OperationCache

type OperationCache struct {
	// contains filtered or unexported fields
}

OperationCache proxies the GetOperation method and caches returned operations.

func NewOperationCache

func NewOperationCache(spec contract.OperationAccess) OperationCache

NewOperationCache creates a new OperationCache instance.

func (OperationCache) GetOperation

func (cache OperationCache) GetOperation(id string) contract.Operation

GetOperation returns a previously cache operation instance, when present, otherwise gets it from the spec, caches and returns.

type OperationPrototype

type OperationPrototype struct {
	contract.EntityTrait
	contract.Operation
	// contains filtered or unexported fields
}

OperationPrototype is a prototype implementation for operations.

func NewOperationPrototype

func NewOperationPrototype(log contract.Logger) *OperationPrototype

NewOperationPrototype create a new OperationPrototype instance.

func (*OperationPrototype) Data

Data returns a pointer to the internal data object.

func (*OperationPrototype) GetRequest

func (op *OperationPrototype) GetRequest() (*http.Request, error)

GetRequest creates an http.Request instance and prepares it to make an API request.

func (*OperationPrototype) Result

Result returns a pointer to the internal result object.

type Schema

type Schema struct {
	Name       string
	JSONSchema JSONSchema
}

Schema represents a JSON Schema used to validate response data.

func (*Schema) Cast

func (schema *Schema) Cast(v string) interface{}

Cast attempts to cast a string value to a native type according to the provided JSON schema.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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