api

package
v0.0.0-...-35e313c Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BadRequest = "Bad request"
)

BadRequest invalid request

Variables

View Source
var (
	ErrBadRequest = errors.New(BadRequest)
)

ErrBadRequest invalid request error

Functions

This section is empty.

Types

type ErrorMessages

type ErrorMessages struct {
	JSONErrorMessage string `json:"message,omitempty"`
}

ErrorMessages contains error

func (*ErrorMessages) Message

func (e *ErrorMessages) Message(message string) *ErrorMessages

Message #

type Response

type Response struct {
	JSONContainerID container.ID             `json:"container_id,omitempty"`
	JSONID          string                   `json:"id,omitempty"`
	JSONType        string                   `json:"type,omitempty"`
	JSONContainer   *container.Container     `json:"container,omitempty"`
	JSONContainers  container.Containers     `json:"containers,omitempty"`
	JSONValue       string                   `json:"value,omitempty"`
	JSONFields      field.Fields             `json:"fields,omitempty"`
	JSONField       *field.Field             `json:"field,omitempty"`
	JSONMessage     string                   `json:"message,omitempty"`
	JSONToken       string                   `json:"token,omitempty"`
	JSONObjects     []map[string]interface{} `json:"objects,omitempty"`
	JSONObject      map[string]interface{}   `json:"object,omitempty"`
}

Response contained requested info if request is successfull

func (*Response) Container

func (d *Response) Container(container *container.Container) *Response

Container #

func (*Response) Containers

func (d *Response) Containers(containers container.Containers) *Response

Containers #

func (*Response) Field

func (d *Response) Field(field *field.Field) *Response

Field #

func (*Response) Fields

func (d *Response) Fields(fields field.Fields) *Response

Fields #

func (*Response) ID

func (d *Response) ID(id string) *Response

ID set

func (*Response) Message

func (d *Response) Message(message string) *Response

Message #

func (*Response) Object

func (d *Response) Object(o map[string]interface{}) *Response

func (*Response) Objects

func (d *Response) Objects(o []map[string]interface{}) *Response

func (*Response) Token

func (d *Response) Token(token string) *Response

Token #

func (*Response) Value

func (d *Response) Value(value string) *Response

Value #

type ResponseBuilder

type ResponseBuilder struct {
	JSONData   *Response              `json:"data,omitempty"`
	JSONErrors *ErrorMessages         `json:"errors,omitempty"`
	RawJSON    map[string]interface{} `json:"data1,omitempty"`
}

ResponseBuilder is builder to create a api response

func (*ResponseBuilder) Data

func (r *ResponseBuilder) Data() *Response

Data sets data of json

func (*ResponseBuilder) Error

func (r *ResponseBuilder) Error() *ErrorMessages

Directories

Path Synopsis
Package middleware provides middleware
Package middleware provides middleware

Jump to

Keyboard shortcuts

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