codegenerator

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Process

func Process(doc *DiscoveryDocument, wr io.Writer, templatePath string) error

func ProcessAll

func ProcessAll(document io.Reader, output io.Writer) (err error)

Types

type Auth

type Auth struct {
	Scopes map[string]*OAuthScope `json:"scopes"`
}

type DiscoveryDocument

type DiscoveryDocument struct {
	Version                      string                `json:"version"`
	BaseURL                      string                `json:"baseUrl"`
	ServicePath                  string                `json:"servicePath"`
	Kind                         string                `json:"kind"`
	Description                  string                `json:"description"`
	BasePath                     string                `json:"basePath"`
	ID                           string                `json:"id"`
	DocumentationLink            string                `json:"documentationLink"`
	Revision                     string                `json:"revision"`
	DiscoveryVersion             string                `json:"discoveryVersion"`
	VersionModule                bool                  `json:"version_module"`
	Protocol                     string                `json:"protocol"`
	RootURL                      string                `json:"rootUrl"`
	OwnerDomain                  string                `json:"ownerDomain"`
	Name                         string                `json:"name"`
	BatchPath                    string                `json:"batchPath"`
	FullyEncodeReservedExpansion bool                  `json:"fullyEncodeReservedExpansion"`
	Title                        string                `json:"title"`
	OwnerName                    string                `json:"ownerName"`
	Auth                         map[string]*Auth      `json:"auth"`
	Schemas                      map[string]*Schema    `json:"schemas"`
	Resources                    map[string]*Resource  `json:"resources"`
	Parameters                   map[string]*Parameter `json:"parameters"`
}

func (*DiscoveryDocument) IsResponse

func (p *DiscoveryDocument) IsResponse(s *Schema) bool

type ErrUnknownJsonType

type ErrUnknownJsonType struct {
	Type string
}

func (*ErrUnknownJsonType) Error

func (e *ErrUnknownJsonType) Error() string

type Icons

type Icons struct {
	X16 string `json:"x16"`
	X32 string `json:"x32"`
}

type Method

type Method struct {
	Path           string                             `json:"path"`
	ID             string                             `json:"id"`
	Request        *MethodRequestType                 `json:"request"`
	Description    string                             `json:"description"`
	Response       *MethodResponseType                `json:"response"`
	ParameterOrder []string                           `json:"parameterOrder"`
	HTTPMethod     string                             `json:"httpMethod"`
	Scopes         []string                           `json:"scopes"`
	Parameters     map[string]*MethodRequestParameter `json:"parameters"`
	FlatPath       string                             `json:"flatPath"`
}

func (*Method) GetDescription

func (r *Method) GetDescription() string

func (*Method) GetParameters

func (m *Method) GetParameters() map[string]*MethodRequestParameter

func (*Method) GetRequestName

func (r *Method) GetRequestName() string

func (*Method) GetRequestType

func (r *Method) GetRequestType() string

func (*Method) GetResponseType

func (r *Method) GetResponseType() string

func (*Method) HasParameters

func (m *Method) HasParameters() bool

func (*Method) HasRequest

func (r *Method) HasRequest() bool

func (*Method) IsGet

func (m *Method) IsGet() bool

func (*Method) IsPaged

func (m *Method) IsPaged(d *DiscoveryDocument) bool

func (*Method) IsPost

func (m *Method) IsPost() bool

type MethodRequestParameter

type MethodRequestParameter struct {
	Location    string `json:"location"`
	Description string `json:"description"`
	Required    bool   `json:"required"`
	Type        string `json:"type"`
	Pattern     string `json:"pattern"`
}

func (*MethodRequestParameter) GetType

func (p *MethodRequestParameter) GetType() (string, error)

type MethodRequestType

type MethodRequestType struct {
	Ref string `json:"$ref"`
}

type MethodResponseType

type MethodResponseType struct {
	Ref string `json:"$ref"`
}

type OAuthScope

type OAuthScope struct {
	Description string `json:"description"`
}

func (*OAuthScope) GetName

func (s *OAuthScope) GetName(scopeUrl string) string

type Parameter

type Parameter struct {
	Description      string   `json:"description"`
	Default          string   `json:"default"`
	Enum             []string `json:"enum"`
	Type             string   `json:"type"`
	EnumDescriptions []string `json:"enumDescriptions"`
	Location         string   `json:"location"`
}

type PropertyDefinition

type PropertyDefinition struct {
	Type   string `json:"type"`
	Format string `json:"format"`
	Ref    string `json:"$ref"`
}

type Resource

type Resource struct {
	Methods map[string]*Method `json:"methods"`
}

func (*Resource) GetCallName

func (r *Resource) GetCallName(resourceName string, methodName string) string

func (*Resource) GetName

func (r *Resource) GetName(parameterName string) string

func (*Resource) GetResourceName

func (r *Resource) GetResourceName(resourceName string) string

func (*Resource) GetServiceName

func (r *Resource) GetServiceName(resourceName string) string

type Schema

type Schema struct {
	ID          string                     `json:"id"`
	Description string                     `json:"description"`
	Type        string                     `json:"type"`
	Properties  map[string]*SchemaProperty `json:"properties"`
}

func (*Schema) GetDescription

func (p *Schema) GetDescription() string

func (*Schema) GetName

func (p *Schema) GetName(propertyName string) string

type SchemaProperty

type SchemaProperty struct {
	PropertyDefinition
	Description      string              `json:"description"`
	EnumDescriptions []string            `json:"enumDescriptions,omitempty"`
	Items            *SchemaPropertyItem `json:"items,omitempty"`
}

func (*SchemaProperty) GetDescription

func (p *SchemaProperty) GetDescription() string

func (*SchemaProperty) GetJsonTag

func (p *SchemaProperty) GetJsonTag() string

func (*SchemaProperty) GetType

func (p *SchemaProperty) GetType() (string, error)

type SchemaPropertyItem

type SchemaPropertyItem struct {
	PropertyDefinition
	Enum []string `json:"enum"`
}

Jump to

Keyboard shortcuts

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