example

package
v0.2.21 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: MIT Imports: 12 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetRoutes

func GetRoutes(s IEchoService) []api2.Route

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(baseURL string, opts ...api2.Option) (*Client, error)

func (*Client) Close

func (c *Client) Close() error

func (*Client) Echo

func (c *Client) Echo(ctx context.Context, req *EchoRequest) (res *EchoResponse, err error)

func (*Client) Hello

func (c *Client) Hello(ctx context.Context, req *HelloRequest) (res *HelloResponse, err error)

func (*Client) Raw added in v0.2.10

func (c *Client) Raw(ctx context.Context, req *RawRequest) (res *RawResponse, err error)

func (*Client) Redirect added in v0.2.4

func (c *Client) Redirect(ctx context.Context, req *RedirectRequest) (res *RedirectResponse, err error)

func (*Client) Since

func (c *Client) Since(ctx context.Context, req *SinceRequest) (res *SinceResponse, err error)

func (*Client) Stream added in v0.2.1

func (c *Client) Stream(ctx context.Context, req *StreamRequest) (res *StreamResponse, err error)

type Color added in v0.2.17

type Color byte
const (
	ColorRed Color = iota + 1
	ColorGreen
	ColorBlue
)

typegen_ignore(ColorGreen)

func (Color) MarshalJSON added in v0.2.17

func (c Color) MarshalJSON() ([]byte, error)

func (Color) String added in v0.2.17

func (c Color) String() string

func (*Color) UnmarshalJSON added in v0.2.17

func (c *Color) UnmarshalJSON(data []byte) error

type CustomType

type CustomType struct {
	Hell int
	UserSettings
}

type CustomType2

type CustomType2 struct {
	Hell int
	*UserSettings
}

type Direction

type Direction int
const (
	North Direction = iota
	East
	South
	West
	DirectionCount
)

Values of Direction.

Enum members can be skipped in tx and openapi.json: typegen_ignore(East) typegen_ignore(West)

type EchoRepository

type EchoRepository struct {
}

func NewEchoRepository

func NewEchoRepository() *EchoRepository

func (*EchoRepository) Generate

func (s *EchoRepository) Generate() (*Result, error)

type EchoRequest

type EchoRequest struct {
	User    string `url:"user"`
	Session string `header:"session"`
	Text    string `json:"text"`

	Bar   time.Duration        `json:"bar"`
	Code  OpCode               `json:"code"`
	Dir   Direction            `json:"dir"`
	Items []CustomType2        `json:"items"`
	Maps  map[string]Direction `json:"maps"`
	// contains filtered or unexported fields
}

type EchoResponse

type EchoResponse struct {
	Text  string `json:"text"` // field comment.
	Old   string `json:"old"`  // Deprecated! Use field Text.
	Old2  string `json:"old2"` // The field is DEPRECATED!
	Color Color  `json:"color"`
}

EchoResponse.

type EchoService

type EchoService struct {
	// contains filtered or unexported fields
}

func NewEchoService

func NewEchoService(repo *EchoRepository) *EchoService

func (*EchoService) Echo

func (s *EchoService) Echo(ctx context.Context, req *EchoRequest) (*EchoResponse, error)

func (*EchoService) Hello

func (s *EchoService) Hello(ctx context.Context, req *HelloRequest) (*HelloResponse, error)

func (*EchoService) Raw added in v0.2.10

func (s *EchoService) Raw(ctx context.Context, req *RawRequest) (*RawResponse, error)

func (*EchoService) Redirect added in v0.2.4

func (s *EchoService) Redirect(ctx context.Context, req *RedirectRequest) (*RedirectResponse, error)

func (*EchoService) Since

func (s *EchoService) Since(ctx context.Context, req *SinceRequest) (*SinceResponse, error)

func (*EchoService) Stream added in v0.2.1

func (s *EchoService) Stream(ctx context.Context, req *StreamRequest) (*StreamResponse, error)

type HelloRequest

type HelloRequest struct {
	Key string `query:"key"`
}

type HelloResponse

type HelloResponse struct {
	Session string `header:"session"`
}

type IEchoService

type IEchoService interface {
	Hello(ctx context.Context, req *HelloRequest) (*HelloResponse, error)
	Echo(ctx context.Context, req *EchoRequest) (*EchoResponse, error)
	Since(ctx context.Context, req *SinceRequest) (*SinceResponse, error)
	Stream(ctx context.Context, req *StreamRequest) (*StreamResponse, error)
	Redirect(ctx context.Context, req *RedirectRequest) (*RedirectResponse, error)
	Raw(ctx context.Context, req *RawRequest) (*RawResponse, error)
}

type OpCode

type OpCode byte
const (
	Op_Read OpCode = iota + 1
	Op_Write
	Op_Add
)

func (OpCode) String added in v0.2.17

func (o OpCode) String() string

type RawRequest added in v0.2.10

type RawRequest struct {
	Token []byte `use_as_body:"true" is_raw:"true"`
}

type RawResponse added in v0.2.10

type RawResponse struct {
	Token []byte `use_as_body:"true" is_raw:"true"`
}

type RedirectRequest added in v0.2.4

type RedirectRequest struct {
	ID string `query:"id"`
}

type RedirectResponse added in v0.2.4

type RedirectResponse struct {
	Status int    `use_as_status:"true"`
	URL    string `header:"Location"`
}

type Result

type Result struct {
	Data string
}

type SinceRequest

type SinceRequest struct {
	Session string                 `header:"session"`
	Body    *timestamppb.Timestamp `use_as_body:"true" is_protobuf:"true"`
}

type SinceResponse

type SinceResponse struct {
	Body *durationpb.Duration `use_as_body:"true" is_protobuf:"true"`
}

type StreamRequest added in v0.2.1

type StreamRequest struct {
	Session string        `header:"session"`
	Body    io.ReadCloser `use_as_body:"true" is_stream:"true"`
}

type StreamResponse added in v0.2.1

type StreamResponse struct {
	Body io.ReadCloser `use_as_body:"true" is_stream:"true"`
}

type UserSettings

type UserSettings map[string]interface{}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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