api

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2020 License: AGPL-3.0-only Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrorCodeUnspecifiedError = "ErrorUnspecifiedError"
)

Variables

View Source
var ErrNotFound = errors.New("not found")

Functions

func GetRequestVar

func GetRequestVar(req *http.Request, name string) (string, bool)

func GetRequestVars

func GetRequestVars(req *http.Request) map[string]string

func WriteErrorAsJSON

func WriteErrorAsJSON(rw http.ResponseWriter, err error) error

func WriteResourceAsCollectionResourceResponseJSON

func WriteResourceAsCollectionResourceResponseJSON(rw http.ResponseWriter, req *http.Request, values interface{}, nextLink *string) error

func WriteResourceAsItemResourceResponseJSON

func WriteResourceAsItemResourceResponseJSON(rw http.ResponseWriter, req *http.Request, item interface{}) error

func WriteResourceAsJSON

func WriteResourceAsJSON(rw http.ResponseWriter, resource interface{}) error

Types

type BridgeMCUMCClientsResource

type BridgeMCUMCClientsResource struct {
	CollectionResource
}

type Collection

type Collection interface{}

type CollectionResource

type CollectionResource struct {
	ODataContext  string `json:"@odata.context"`
	ODataNextLink string `json:"@odata.nextLink,omitempty"`

	Values Collection `json:"values"`
}

func NewCollectionResource

func NewCollectionResource(values Collection, req *http.Request, nextLink *string) *CollectionResource

type ErrorResource

type ErrorResource struct {
	Error interface{}
}

func NewErrorResource

func NewErrorResource(err error) *ErrorResource

type ErrorWithCodeAndMessage

type ErrorWithCodeAndMessage struct {
	Code    string `json:"code"`
	Message string `json:"message"`
	// contains filtered or unexported fields
}

func NewErrorWithCodeAndMessage

func NewErrorWithCodeAndMessage(code string, message string, err error) *ErrorWithCodeAndMessage

func (*ErrorWithCodeAndMessage) Error

func (err *ErrorWithCodeAndMessage) Error() string

func (*ErrorWithCodeAndMessage) Unwrap

func (err *ErrorWithCodeAndMessage) Unwrap() error

type Item

type Item interface{}

type ItemResource

type ItemResource struct {
	ODataContext string `json:"@odata.context"`
	Item
}

func NewItemResource

func NewItemResource(item Item, req *http.Request) *ItemResource

func (ItemResource) MarshalJSON

func (ir ItemResource) MarshalJSON() ([]byte, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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