lib

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2021 License: MIT Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CamelCase

func CamelCase(src string) string

CamelCase converts strings like "space separated", "dash-separated", "snake_case" to "camelCase" but does not convert "TitleCase" to "camelCase"

func IsFilePermissionTooOpen added in v0.2.1

func IsFilePermissionTooOpen(path string) (bool, error)

IsFilePermissionTooOpen returns true only when the `path` doesn't have the expected permission

func OptionCase

func OptionCase(s string) string

OptionCase converts strings like "space separated", "snake_case", "camelCase", "TitleCase" to "option-case"

func PrintfStderr added in v0.5.6

func PrintfStderr(format string, args ...interface{})

PrintfStderr formats according to a format specifier and writes to standard error

func ProtectFile added in v0.2.1

func ProtectFile(path string) error

ProtectFile changes the mode of the specified `path`

func SnakeCase

func SnakeCase(s string) string

SnakeCase converts strings like "space separated", "dash-separated", "camelCase", "TitleCase" to "snake_case"

func TitleCase

func TitleCase(src string) string

TitleCase converts strings like "space separated", "dash-separated", "snake_case", "camelCase" to "TitleCase"

func WarnfStderr added in v0.5.6

func WarnfStderr(format string, args ...interface{})

WarnfStderr formats according to a format specifier and writes to standard error with `WARN: ` prefix

Types

type APIDefinitions

type APIDefinitions struct {
	Host       string
	Schemes    []string
	BasePath   string
	Methods    []APIMethod
	StructDefs map[string]StructDef
}

APIDefinitions holds all information about SORACOM API

func LoadAPIDef

func LoadAPIDef(apiDefYAMLFile string) (*APIDefinitions, error)

LoadAPIDef loads API definitions from the specified file

type APIMethod

type APIMethod struct {
	Path               string
	Method             string
	Use                string
	Tags               []string                 `yaml:"tags"`
	Summary            string                   `yaml:"summary"`
	Description        string                   `yaml:"description"`
	OperationID        string                   `yaml:"operationId"`
	Security           []map[string]interface{} `yaml:"security"`
	CLI                []string                 `yaml:"x-soracom-cli"`
	Pagination         *Pagination              `yaml:"x-soracom-cli-pagination"`
	Parameters         []APIParam               `yaml:"parameters"`
	Responses          map[string]APIResponse   `yaml:"responses"`
	Deprecated         bool                     `yaml:"deprecated"`
	AlternativeCommand string                   `yaml:"x-soracom-alternative-cli"`
}

APIMethod holds information about an API method

type APIParam

type APIParam struct {
	Name        string             `yaml:"name"`
	In          string             `yaml:"in"`
	Required    bool               `yaml:"required"`
	Description string             `yaml:"description"`
	Type        string             `yaml:"type"`
	Enum        []string           `yaml:"enum"`
	Default     interface{}        `yaml:"default,omitempty"`
	Schema      APIParamSchema     `yaml:"schema"`
	Items       APIParamArrayItems `yaml:"items"`
}

APIParam holds information about an API parameter

func (*APIParam) GetDefaultValueAsBool added in v0.5.4

func (p *APIParam) GetDefaultValueAsBool() bool

GetDefaultValueAsBool returns the default value as bool type

func (*APIParam) GetDefaultValueAsFloat added in v0.5.4

func (p *APIParam) GetDefaultValueAsFloat() float64

GetDefaultValueAsFloat returns the default value as float64 type

func (*APIParam) GetDefaultValueAsInt64 added in v0.5.4

func (p *APIParam) GetDefaultValueAsInt64() int64

GetDefaultValueAsInt64 returns the default value as int64 type

func (*APIParam) GetDefaultValueAsString added in v0.5.4

func (p *APIParam) GetDefaultValueAsString() string

GetDefaultValueAsString returns the default value as string type

type APIParamArrayItems added in v0.2.8

type APIParamArrayItems struct {
	Type   string `yaml:"type"`
	Format string `yaml:"format"`
}

APIParamArrayItems holds information about array type of parameters

type APIParamSchema

type APIParamSchema struct {
	Type   string          `yaml:"type"`
	Format string          `yaml:"format"`
	Items  *APIParamSchema `yaml:"items"`
	Ref    string          `yaml:"$ref"`
}

APIParamSchema holds information about a Schema in an API parameter

type APIResponse

type APIResponse struct {
	Schema *APIParamSchema
}

APIResponse holds information about an API response

type Pagination added in v0.4.8

type Pagination struct {
	Response Response `yaml:"response"`
	Request  Request  `yaml:"request"`
}

Pagination holds information about pagination

type Request added in v0.4.8

type Request struct {
	Param string `yaml:"param"`
}

Request holds information about request

type Response added in v0.4.8

type Response struct {
	Header string `yaml:"header"`
}

Response holds information about response

type StructDef

type StructDef struct {
	Properties []StructProperty
	References []StructReference
}

StructDef holds all information under /definitions in API definition file

type StructProperty

type StructProperty struct {
	Name        string
	Type        string
	Format      string
	Description string
	Required    bool
	Default     interface{}
}

StructProperty holds information about an entry under /definitions/{StructName}/properties in API definition file

func (*StructProperty) GetDefaultValueAsBool added in v0.5.4

func (p *StructProperty) GetDefaultValueAsBool() bool

GetDefaultValueAsBool returns the default value as bool type

func (*StructProperty) GetDefaultValueAsFloat added in v0.5.4

func (p *StructProperty) GetDefaultValueAsFloat() float64

GetDefaultValueAsFloat returns the default value as float64 type

func (*StructProperty) GetDefaultValueAsInt64 added in v0.5.4

func (p *StructProperty) GetDefaultValueAsInt64() int64

GetDefaultValueAsInt64 returns the default value as int64 type

func (*StructProperty) GetDefaultValueAsString added in v0.5.4

func (p *StructProperty) GetDefaultValueAsString() string

GetDefaultValueAsString returns the default value as string type

type StructReference

type StructReference struct {
	Name    string
	RefType string
}

StructReference holds information about a reference from a property in API definition file

Jump to

Keyboard shortcuts

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