Documentation
¶
Index ¶
- func CamelCase(src string) string
- func IsFilePermissionTooOpen(path string) (bool, error)
- func OptionCase(s string) string
- func PrintfStderr(format string, args ...interface{})
- func ProtectFile(path string) error
- func SnakeCase(s string) string
- func TitleCase(src string) string
- func WarnfStderr(format string, args ...interface{})
- type APIDefinitions
- type APIMethod
- type APIParam
- type APIParamArrayItems
- type APIParamSchema
- type APIResponse
- type Pagination
- type Request
- type Response
- type StructDef
- type StructProperty
- type StructReference
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CamelCase ¶
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
IsFilePermissionTooOpen returns true only when the `path` doesn't have the expected permission
func OptionCase ¶
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
ProtectFile changes the mode of the specified `path`
func SnakeCase ¶
SnakeCase converts strings like "space separated", "dash-separated", "camelCase", "TitleCase" to "snake_case"
func TitleCase ¶
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
GetDefaultValueAsBool returns the default value as bool type
func (*APIParam) GetDefaultValueAsFloat ¶ added in v0.5.4
GetDefaultValueAsFloat returns the default value as float64 type
func (*APIParam) GetDefaultValueAsInt64 ¶ added in v0.5.4
GetDefaultValueAsInt64 returns the default value as int64 type
func (*APIParam) GetDefaultValueAsString ¶ added in v0.5.4
GetDefaultValueAsString returns the default value as string type
type APIParamArrayItems ¶ added in v0.2.8
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
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 ¶
StructReference holds information about a reference from a property in API definition file