model

package
v0.0.0-...-72504b9 Latest Latest
Warning

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

Go to latest
Published: May 30, 2019 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Api

type Api struct {
	Version     string
	BasePath    string
	Paths       map[string]Command
	Definitions map[string]Definition
}

func UnmarshalApi

func UnmarshalApi(b bytes.Buffer) (*Api, error)

func (*Api) Convert

func (a *Api) Convert(tags *Tags) *spec.Swagger

type Chapter

type Chapter struct {
	Name        string    `json:"name"`
	Commands    []Command `json:"commands-data"`
	SubChapters []Chapter `json:"sub-chapters"`
}

type Command

type Command struct {
	Name                 string                 `json:"name"`
	Type                 string                 `json:"type"`
	Definition           string                 `json:"request"`
	Response             Response               `json:"response"`
	Description          string                 `json:"description"`
	Documented           bool                   `json:"documented"`
	Internal             bool                   `json:"internal"`
	Deprecated           bool                   `json:"deprecated"`
	AdditionalProperties map[string]interface{} `json:""`
}

func (*Command) UnmarshalJSON

func (c *Command) UnmarshalJSON(body []byte) error

type Content

type Content struct {
	Chapters []Chapter `json:"chapters"`
}

type Definition

type Definition struct {
	Name                 string                 `json:"name"`
	ObjectType           string                 `json:"objectType"`
	RequestType          string                 `json:"requestType"`
	Show                 bool                   `json:"show"`
	Common               bool                   `json:"common"`
	Description          string                 `json:"description"`
	Fields               []Field                `json:"fields"`
	UnderMoreFields      []Field                `json:"under-more-fields"`
	RequiredFields       []Field                `json:"required-fields"`
	AdditionalProperties map[string]interface{} `json:""`
}

func (*Definition) UnmarshalJSON

func (d *Definition) UnmarshalJSON(body []byte) error

type ElementType

type ElementType struct {
	Name       string `json:"name"`
	ObjectName string `json:"object-name"`
}

func (ElementType) GetElementType

func (t ElementType) GetElementType() ElementType

func (ElementType) GetName

func (t ElementType) GetName() string

func (ElementType) GetObjectName

func (t ElementType) GetObjectName() string

func (ElementType) GetValidValues

func (t ElementType) GetValidValues() []string

type Field

type Field struct {
	Name                 string                 `json:"name"`
	Description          string                 `json:"description"`
	Types                []Type                 `json:"types"`
	UnderMore            bool                   `json:"under-more"`
	Deprecated           bool                   `json:"deprecated"`
	FieldOrder           int                    `json:"field-order"`
	Default              string                 `json:"default-value"`
	Required             bool                   `json:"required"`
	Alternatives         []Field                `json:"field-alternatives"`
	InRequest            bool                   `json:"field-in-request"`
	AdditionalProperties map[string]interface{} `json:""`
}

func (*Field) UnmarshalJSON

func (f *Field) UnmarshalJSON(body []byte) error

type Model

type Model struct {
	Version     string       `json:"version"`
	Path        string       `json:"path"`
	Commands    []Command    `json:"commands"`
	Definitions []Definition `json:"objects"`
}

type Response

type Response struct {
	Success ResponseObject `json:"on-success"`
	Failure ResponseObject `json:"on-failure"`
}

func (*Response) UnmarshalJSON

func (r *Response) UnmarshalJSON(body []byte) error

type ResponseObject

type ResponseObject struct {
	Code string `json:"status-code"`
	Name string `json:"object"`
}

func (*ResponseObject) UnmarshalJSON

func (r *ResponseObject) UnmarshalJSON(body []byte) error

type Tags

type Tags map[string][]string

func UnmarshalTags

func UnmarshalTags(b bytes.Buffer) (*Tags, error)

func (Tags) MarshalJSON

func (t Tags) MarshalJSON() ([]byte, error)

type Type

type Type struct {
	Name        string      `json:"name"`
	ValidValues []string    `json:"valid-values"`
	ObjectName  string      `json:"object-name"`
	ElementType ElementType `json:"element-type"`
}

func (Type) GetElementType

func (t Type) GetElementType() ElementType

func (Type) GetName

func (t Type) GetName() string

func (Type) GetObjectName

func (t Type) GetObjectName() string

func (Type) GetValidValues

func (t Type) GetValidValues() []string

type TypeOrElementType

type TypeOrElementType interface {
	GetName() string
	GetValidValues() []string
	GetObjectName() string
	GetElementType() ElementType
}

Jump to

Keyboard shortcuts

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