example

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2022 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Code generated by file example.go and line 25 DO NOT EDIT. For more detail see https://github.com/wanglihui/restyless

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type User

type User struct {
	ID      string `json:"id"`
	Name    string `json:"name"`
	Age     int    `json:"age"`
	TestKey fmt.Formatter
}

type UserProvider

type UserProvider interface {
	//GetUser
	//host=http://www.baidu.com,url=/id
	GetUser(ctx context.Context, userID types.QueryParam) (User, error)
	//PostUser
	//host=http://www.dixincaigang.cn,url=/user/
	PostUser(ctx context.Context, user User) (User, error)
	//DeleteUser
	//url=/user/{userID}
	DeleteUser(ctx context.Context, userID types.PathParam) error
	//PutUser
	//url=/user/{userID}
	PutUser(ctx context.Context, userID types.PathParam, user User) (User, error)
	//PostUser2
	//url=/user2
	PostUser2(ctx context.Context, uid types.HeaderParam, token types.HeaderParam, user User) (User, error)
	//url=/users
	GetUsers(ctx context.Context) ([]User, error)
	//url=/user/{userId}/points
	GetUserPoint(ctx context.Context) (*User, error)
	//url=/user/{userId}/age
	GetUserAge(ctx context.Context, userId types.PathParam) (int, error)
	//url=/user/map
	PostUserUseMap(ctx context.Context, user map[string]string) (User, error)
}

UserProvider host=http://www.baidu.com params named header will put into http.header, params named query will put into querystring body will put into body

func NewUserProviderImpl

func NewUserProviderImpl(r *resty.Client) UserProvider

type UserProviderImpl

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

func (*UserProviderImpl) DeleteUser

func (it *UserProviderImpl) DeleteUser(ctx context.Context, userID types.PathParam) error

func (*UserProviderImpl) GetUser

func (it *UserProviderImpl) GetUser(ctx context.Context, userID types.QueryParam) (User, error)

func (*UserProviderImpl) GetUserAge added in v0.0.7

func (it *UserProviderImpl) GetUserAge(ctx context.Context, userId types.PathParam) (int, error)

func (*UserProviderImpl) GetUserPoint added in v0.0.7

func (it *UserProviderImpl) GetUserPoint(ctx context.Context) (*User, error)

func (*UserProviderImpl) GetUsers added in v0.0.7

func (it *UserProviderImpl) GetUsers(ctx context.Context) ([]User, error)

func (*UserProviderImpl) PostUser

func (it *UserProviderImpl) PostUser(ctx context.Context, user User) (User, error)

func (*UserProviderImpl) PostUser2

func (it *UserProviderImpl) PostUser2(ctx context.Context, uid types.HeaderParam, token types.HeaderParam, user User) (User, error)

func (*UserProviderImpl) PostUserUseMap added in v0.0.7

func (it *UserProviderImpl) PostUserUseMap(ctx context.Context, user map[string]string) (User, error)

func (*UserProviderImpl) PutUser

func (it *UserProviderImpl) PutUser(ctx context.Context, userID types.PathParam, user User) (User, error)

Jump to

Keyboard shortcuts

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