client

package
v1.22.0 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func VendorImportsFromContext

func VendorImportsFromContext(ctx context.Context) map[string]bool

func WithVendorImports

func WithVendorImports(ctx context.Context, vendorImports map[string]bool) context.Context

Types

type ClientGenerator

type ClientGenerator struct {
	ServiceName string
	URL         *url.URL

	GenOption
	// contains filtered or unexported fields
}

func NewClientGenerator

func NewClientGenerator(serviceName string, u *url.URL, opts ...GenOptionFn) *ClientGenerator

func (*ClientGenerator) Load

func (g *ClientGenerator) Load()

func (*ClientGenerator) Output

func (g *ClientGenerator) Output(cwd string)

type GenOption

type GenOption struct {
	VendorImportByGoMod bool `name:"vendor-import-by-go-mod" usage:"when enable vendor only import pkg exists in go mod"`
}

type GenOptionFn

type GenOptionFn = func(o *GenOption)

func OptionVendorImportByGoMod

func OptionVendorImportByGoMod() GenOptionFn

type OperationGenerator

type OperationGenerator struct {
	ServiceName string
	File        *codegen.File
}

func NewOperationGenerator

func NewOperationGenerator(serviceName string, file *codegen.File) *OperationGenerator

func (*OperationGenerator) ID

func (g *OperationGenerator) ID(id string) string

func (*OperationGenerator) ParamField

func (g *OperationGenerator) ParamField(ctx context.Context, parameter *oas.Parameter) *codegen.SnippetField

func (*OperationGenerator) RequestBodyField

func (g *OperationGenerator) RequestBodyField(ctx context.Context, requestBody *oas.RequestBody) *codegen.SnippetField

func (*OperationGenerator) ResponseType

func (g *OperationGenerator) ResponseType(ctx context.Context, responses *oas.Responses) (codegen.SnippetType, []string)

func (*OperationGenerator) Scan

func (g *OperationGenerator) Scan(ctx context.Context, openapi *oas.OpenAPI)

func (*OperationGenerator) WriteOperation

func (g *OperationGenerator) WriteOperation(ctx context.Context, method string, path string, operation *oas.Operation)

type ServiceClientGenerator

type ServiceClientGenerator struct {
	ServiceName string
	File        *codegen.File
}

func NewServiceClientGenerator

func NewServiceClientGenerator(serviceName string, file *codegen.File) *ServiceClientGenerator

func (*ServiceClientGenerator) ClientInstanceName

func (g *ServiceClientGenerator) ClientInstanceName() string

func (*ServiceClientGenerator) ClientInterfaceName

func (g *ServiceClientGenerator) ClientInterfaceName() string

func (*ServiceClientGenerator) OperationMethod

func (g *ServiceClientGenerator) OperationMethod(ctx context.Context, operation *oas.Operation, asInterface bool) codegen.Snippet

func (*ServiceClientGenerator) Scan

func (g *ServiceClientGenerator) Scan(ctx context.Context, openapi *oas.OpenAPI)

func (*ServiceClientGenerator) WriteClient

func (g *ServiceClientGenerator) WriteClient()

func (*ServiceClientGenerator) WriteClientInterface

func (g *ServiceClientGenerator) WriteClientInterface(ctx context.Context, openapi *oas.OpenAPI)

type TypeGenerator

type TypeGenerator struct {
	ServiceName string
	File        *codegen.File
	Enums       map[string]scanner.Options
}

func NewTypeGenerator

func NewTypeGenerator(serviceName string, file *codegen.File) *TypeGenerator

func (*TypeGenerator) BasicType

func (g *TypeGenerator) BasicType(schemaType string, format string) codegen.SnippetType

func (*TypeGenerator) FieldOf

func (g *TypeGenerator) FieldOf(ctx context.Context, name string, propSchema *oas.Schema, requiredFields map[string]bool) *codegen.SnippetField

func (*TypeGenerator) FieldsFrom

func (g *TypeGenerator) FieldsFrom(ctx context.Context, schema *oas.Schema) (fields []*codegen.SnippetField)

func (*TypeGenerator) Scan

func (g *TypeGenerator) Scan(ctx context.Context, openapi *oas.OpenAPI)

func (*TypeGenerator) Type

func (g *TypeGenerator) Type(ctx context.Context, schema *oas.Schema) (codegen.SnippetType, bool)

func (*TypeGenerator) TypeIndirect

func (g *TypeGenerator) TypeIndirect(ctx context.Context, schema *oas.Schema) (codegen.SnippetType, bool)

Jump to

Keyboard shortcuts

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