LiquidSDK

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CommandToHttpAdapter added in v1.4.0

func CommandToHttpAdapter(f func(string, CommandRequest) interface{}) func(*gin.Context, CommandRequest)

Types

type CmdAccount

type CmdAccount struct {
	FromType  string      `json:"from_type" default:""`
	FromId    string      `json:"from_id" default:""`
	FromToken string      `json:"from_token" default:""`
	Platform  string      `json:"platform" default:"main"`
	ExtraData interface{} `json:"extra_data" default:""`
}

type CmdAccountResponse

type CmdAccountResponse struct {
	AutoId     *string `json:"auto_id" bson:"auto_id"`
	InviteCode *string `json:"invite_code" bson:"invite_code"`
}

type CmdAuth

type CmdAuth struct {
	AutoId     *string `json:"auto_id" bson:"auto_id"`
	InviteCode *string `json:"invite_code" bson:"invite_code"`
	Platform   *string `json:"platform" bson:"platform"`
}

type CmdAuthResponse

type CmdAuthResponse struct {
	LiquidId    *string `json:"liquid_id" bson:"liquid_id"`
	LiquidToken *string `json:"liquid_token" bson:"liquid_token"`
}

type CmdBind

type CmdBind struct {
	AutoId     string `json:"auto_id" bson:"auto_id"`
	InviteCode string `json:"invite_code" bson:"invite_code"`
	FromId     string `json:"from_id" bson:"from_id"`       //(str)third_party id or device id
	FromToken  string `json:"from_token" bson:"from_token"` // (str)third_party token
	FromType   string `json:"from_type" bson:"from_type"`   // (str)third_party name
}

type CmdCommand

type CmdCommand struct {
	LiquidId    *string     `json:"liquid_id" bson:"liquid_id"`
	LiquidToken *string     `json:"liquid_token" bson:"liquid_token"`
	Platform    *string     `json:"platform" bson:"platform"`
	CmdId       *string     `json:"cmd_id"`
	CmdSn       *string     `json:"cmd_sn"`
	CmdName     *string     `json:"cmd_name"`
	CmdData     interface{} `json:"cmd_data"`
}

type CmdCommandResponse

type CmdCommandResponse struct {
	CmdData interface{} `json:"cmd_data"`
	CmdSn   *string     `json:"cmd_sn"`
}

type CmdErrorResponse added in v1.4.0

type CmdErrorResponse struct {
	Code  int    `json:"code"`
	Error string `json:"error"`
	Type  string `json:"type,omitempty"`
}

func ResponseError added in v1.4.1

func ResponseError(code int, error string) CmdErrorResponse

type CmdRegister

type CmdRegister struct {
	FromType  string      `json:"from_type"`
	Account   string      `json:"account"`
	Password  string      `json:"password"`
	ExtraData interface{} `json:"extra_data" default:""`
}

type CmdSignedBody

type CmdSignedBody struct {
	LiSign string `json:"LiSign"`
	LiData string `json:"LiData"`
}

type CommandRequest

type CommandRequest interface {
	ToStruct(interface{}, string) error
	Raw() interface{}
	Get(key string) interface{}
	GetLiquidId() string
	GetPlatform() string
	GetCmdId() string
	GetCmdSn() string
	GetCmdName() string
}

type CommandSDK

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

func (*CommandSDK) Register

func (system *CommandSDK) Register(name string, f func(string, CommandRequest) interface{}, opts ...*options.CommandOptions)

func (*CommandSDK) RegisterDirect

func (system *CommandSDK) RegisterDirect(name string, f func(string, CommandRequest) interface{}, opts ...*options.CommandOptions)

func (*CommandSDK) RegisterHttp

func (system *CommandSDK) RegisterHttp(name string, f func(*gin.Context, CommandRequest))

func (*CommandSDK) RegisterHttpDirect

func (system *CommandSDK) RegisterHttpDirect(name string, f func(*gin.Context, CommandRequest))

func (*CommandSDK) RunCommand

func (system *CommandSDK) RunCommand(data *CmdCommand) interface{}

func (*CommandSDK) RunDirectCommand

func (system *CommandSDK) RunDirectCommand(data *CmdCommand) interface{}

func (*CommandSDK) RunHttpCommand

func (system *CommandSDK) RunHttpCommand(c *gin.Context, data *CmdCommand)

func (*CommandSDK) RunHttpDirectCommand

func (system *CommandSDK) RunHttpDirectCommand(c *gin.Context, data *CmdCommand)

type CommandSystem

type CommandSystem interface {
	RunCommand(*CmdCommand) interface{}
	RunDirectCommand(*CmdCommand) interface{}
	RunHttpDirectCommand(*gin.Context, *CmdCommand)
	RunHttpCommand(*gin.Context, *CmdCommand)
}

type LiquidRequest

type LiquidRequest struct {
	LiquidId *string
	Platform *string
	CmdId    *string
	CmdSn    *string
	CmdName  *string
	CmdData  interface{}
}

func (*LiquidRequest) Get

func (request *LiquidRequest) Get(key string) interface{}

func (*LiquidRequest) GetCmdId

func (request *LiquidRequest) GetCmdId() string

func (*LiquidRequest) GetCmdName

func (request *LiquidRequest) GetCmdName() string

func (*LiquidRequest) GetCmdSn

func (request *LiquidRequest) GetCmdSn() string

func (*LiquidRequest) GetLiquidId

func (request *LiquidRequest) GetLiquidId() string

func (*LiquidRequest) GetPlatform

func (request *LiquidRequest) GetPlatform() string

func (*LiquidRequest) Raw

func (request *LiquidRequest) Raw() interface{}

func (*LiquidRequest) ToStruct

func (request *LiquidRequest) ToStruct(target interface{}, tag string) error

type LiquidServer

type LiquidServer struct {
	CodeName        string
	LiquidKey       string
	LiquidKeyUpdate time.Time
	TokenExpireTime int
	// contains filtered or unexported fields
}

func GetServer

func GetServer() *LiquidServer

func (*LiquidServer) GenerateKey

func (server *LiquidServer) GenerateKey()

func (*LiquidServer) GetFeature

func (server *LiquidServer) GetFeature(Name string) CommandSystem

func (*LiquidServer) GetKey

func (server *LiquidServer) GetKey() string

func (*LiquidServer) GetKeyStatic

func (server *LiquidServer) GetKeyStatic() string

func (*LiquidServer) GetMemberSystem

func (server *LiquidServer) GetMemberSystem(memberType string) MemberSystem

func (*LiquidServer) InitCodenameKey

func (server *LiquidServer) InitCodenameKey()

func (*LiquidServer) RegisterFeature

func (server *LiquidServer) RegisterFeature(Name string, Instance CommandSystem) bool

func (*LiquidServer) RegisterMember

func (server *LiquidServer) RegisterMember(memberType string, MemberInstance MemberSystem) bool

func (*LiquidServer) SetCodeName

func (server *LiquidServer) SetCodeName(codename string)

func (*LiquidServer) SetTokenExpireTime

func (server *LiquidServer) SetTokenExpireTime(seconds int)

type MemberSystem

type MemberSystem interface {
	Register(
		fromType,
		account,
		password,
		platform string,
		extraArgs interface{}) (status int, error string)
	Validate(
		fromId,
		fromToken,
		platform string,
		extraArgs interface{}) (valid bool, msg string, overrideFromId string)
}

Jump to

Keyboard shortcuts

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