gorestful

package
v0.0.0-...-ce83e3f Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2024 License: BSD-2-Clause Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Name    string
	BaseURI string
	Kind    string

	PackageName    string
	RootImportPath string
	Services       map[string]*ClientService
	TargetDir      string
	// contains filtered or unexported fields
}

Client represents a Golang client

func NewClient

func NewClient(apiDef *raml.APIDefinition, kind, packageName, rootImportPath, targetDir string,
	libsRootURLs []string) (Client, error)

NewClient creates a new Golang client

func (Client) Generate

func (gc Client) Generate() error

Generate generates all Go client files

type ClientService

type ClientService struct {
	resource.ClientService
	PackageName string
	BaseURI     string
	NewParams   []string
	Methods     []clientMethod
}

ClientService represents a root endpoint of an API

func (ClientService) Imports

func (cs ClientService) Imports() []string

func (ClientService) NeedImportJSON

func (cs ClientService) NeedImportJSON() bool

NeedImportJSON returns true if this service need to import encoding/json

type Server

type Server struct {
	ResourcesDef []*goResource
	PackageName  string // Name of the package this server resides in

	RootImportPath string
	TargetDir      string // root directory of the generated code
	// contains filtered or unexported fields
}

Server represents a Go server

func NewServer

func NewServer(kind string, apiDef *raml.APIDefinition, packageName, apiDocsDir, rootImportPath string,
	withMain bool, targetDir string, libsRootURLs []string) *Server

NewServer creates a new Golang server

func (*Server) APIDocsDir

func (gs *Server) APIDocsDir() string

APIDocsDir implements codegen.Server.APIDocsDir interface

func (*Server) Generate

func (gs *Server) Generate() error

Generate implements codegen.Server.Generate interface

func (Server) RouteImports

func (gs Server) RouteImports() []string

RouteImports returns all resources routes

func (Server) ShowAPIDocsAndIndex

func (gs Server) ShowAPIDocsAndIndex() bool

ShowAPIDocsAndIndex returns if show api docs and index

func (Server) Title

func (gs Server) Title() string

Title returns title of this server

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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