api

package
v4.0.0-...-755bc99 Latest Latest
Warning

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

Go to latest
Published: May 26, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterSiteServant

func RegisterSiteServant(e *gin.Engine, s Site, m ...SiteChain)

RegisterSiteServant register Site servant to gin

Types

type AgentInfo

type AgentInfo struct {
	Platform  string `json:"platform"`
	UserAgent string `json:"user_agent"`
}

type LoginReq

type LoginReq struct {
	AgentInfo AgentInfo `json:"agent_info"`
	Name      string    `json:"name"`
	Passwd    string    `json:"passwd"`
}

type LoginResp

type LoginResp struct {
	UserInfo
	ServerInfo ServerInfo `json:"server_info"`
	JwtToken   string     `json:"jwt_token"`
}

type LogoutReq

type LogoutReq struct {
	AgentInfo AgentInfo `json:"agent_info"`
	Name      string    `json:"name"`
}

type ServerInfo

type ServerInfo struct {
	ApiVer string `json:"api_ver"`
}

type Site

type Site interface {

	// Chain provide handlers chain for gin
	Chain() gin.HandlersChain

	MultiAttachments(*gin.Context)
	ManyResources(*gin.Context)
	AnyStaticks(*gin.Context)
	Statics(*gin.Context)
	Assets(*gin.Context, *LoginReq) mir.Error
	SimpleUpload(*gin.Context, *LoginReq) (*LoginResp, mir.Error)
	FileUpload(*gin.Context)
	ImageUpload(*gin.Context)
	Logout(context.Context, *LogoutReq) mir.Error
	Login(context.Context, *LoginReq) (*LoginResp, mir.Error)
	PrevTweets(context.Context, *TweetsReq) (*TweetsResp, mir.Error)
	NextTweets(context.Context, *TweetsReq) (*TweetsResp, mir.Error)
	AnyTopics(context.Context) mir.Error
	Articles(context.Context) mir.Error
	Index(context.Context) mir.Error
	// contains filtered or unexported methods
}

type SiteChain

type SiteChain interface {
	ChainMultiAttachments() gin.HandlersChain
	ChainSimpleUpload() gin.HandlersChain
	ChainFileUpload() gin.HandlersChain
	ChainIndex() gin.HandlersChain
	// contains filtered or unexported methods
}

type Tweet

type Tweet struct {
	Type    string `json:"type"`
	Content string `json:"content"`
}

type TweetsReq

type TweetsReq struct {
	Date string `json:"date"`
}

type TweetsResp

type TweetsResp struct {
	Tweets []Tweet `json:"tweets"`
	Total  uint32  `json:"total"`
}

type UnimplementedSiteChain

type UnimplementedSiteChain struct{}

UnimplementedSiteChain can be embedded to have forward compatible implementations.

func (*UnimplementedSiteChain) ChainFileUpload

func (b *UnimplementedSiteChain) ChainFileUpload() gin.HandlersChain

func (*UnimplementedSiteChain) ChainIndex

func (b *UnimplementedSiteChain) ChainIndex() gin.HandlersChain

func (*UnimplementedSiteChain) ChainMultiAttachments

func (b *UnimplementedSiteChain) ChainMultiAttachments() gin.HandlersChain

func (*UnimplementedSiteChain) ChainSimpleUpload

func (b *UnimplementedSiteChain) ChainSimpleUpload() gin.HandlersChain

type UnimplementedSiteServant

type UnimplementedSiteServant struct{}

UnimplementedSiteServant can be embedded to have forward compatible implementations.

func (UnimplementedSiteServant) AnyStaticks

func (UnimplementedSiteServant) AnyStaticks(c *gin.Context)

func (UnimplementedSiteServant) AnyTopics

func (UnimplementedSiteServant) AnyTopics(c context.Context) mir.Error

func (UnimplementedSiteServant) Articles

func (UnimplementedSiteServant) Articles(c context.Context) mir.Error

func (UnimplementedSiteServant) Assets

func (UnimplementedSiteServant) Assets(c *gin.Context, req *LoginReq) mir.Error

func (UnimplementedSiteServant) Chain

func (UnimplementedSiteServant) FileUpload

func (UnimplementedSiteServant) FileUpload(c *gin.Context)

func (UnimplementedSiteServant) ImageUpload

func (UnimplementedSiteServant) ImageUpload(c *gin.Context)

func (UnimplementedSiteServant) Index

func (UnimplementedSiteServant) Index(c context.Context) mir.Error

func (UnimplementedSiteServant) Login

func (UnimplementedSiteServant) Login(c context.Context, req *LoginReq) (*LoginResp, mir.Error)

func (UnimplementedSiteServant) Logout

func (UnimplementedSiteServant) Logout(c context.Context, req *LogoutReq) mir.Error

func (UnimplementedSiteServant) ManyResources

func (UnimplementedSiteServant) ManyResources(c *gin.Context)

func (UnimplementedSiteServant) MultiAttachments

func (UnimplementedSiteServant) MultiAttachments(c *gin.Context)

func (UnimplementedSiteServant) NextTweets

func (UnimplementedSiteServant) NextTweets(c context.Context, req *TweetsReq) (*TweetsResp, mir.Error)

func (UnimplementedSiteServant) PrevTweets

func (UnimplementedSiteServant) PrevTweets(c context.Context, req *TweetsReq) (*TweetsResp, mir.Error)

func (UnimplementedSiteServant) SimpleUpload

func (UnimplementedSiteServant) SimpleUpload(c *gin.Context, req *LoginReq) (*LoginResp, mir.Error)

func (UnimplementedSiteServant) Statics

func (UnimplementedSiteServant) Statics(c *gin.Context)

type UserInfo

type UserInfo struct {
	Name string `json:"name"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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