apiBuilder

package
v2.0.0-...-2f972be Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2023 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder

type Builder struct {
	CgiCmd     *string     `json:"CgiCmd,omitempty"`
	CgiRequest *CgiRequest `json:"CgiRequest,omitempty"`
	// contains filtered or unexported fields
}

func (*Builder) At

func (b *Builder) At(nick string, uin ...int64) IMsg

func (*Builder) BuildStringBody

func (b *Builder) BuildStringBody() (string, error)

func (*Builder) Do

func (b *Builder) Do(ctx context.Context) error

func (*Builder) DoAndResponse

func (b *Builder) DoAndResponse(ctx context.Context) (*Response, error)

func (*Builder) DoUpload

func (b *Builder) DoUpload(ctx context.Context) (*File, error)

func (*Builder) FriendManager

func (b *Builder) FriendManager() IFriendManager

func (*Builder) FriendMsg

func (b *Builder) FriendMsg() IMsg

func (*Builder) FriendPic

func (b *Builder) FriendPic() IUpload

func (*Builder) FriendVoice

func (b *Builder) FriendVoice() IUpload

func (*Builder) GetClusterInfo

func (b *Builder) GetClusterInfo() DoApi

func (*Builder) GetFriendLists

func (b *Builder) GetFriendLists(LastUin int64) IFriendManager

func (*Builder) GetGroupLists

func (b *Builder) GetGroupLists() IGroupManager

func (*Builder) GetGroupMemberLists

func (b *Builder) GetGroupMemberLists(uin int64, lastBuffer string) IGroupManager

func (*Builder) GroupManager

func (b *Builder) GroupManager() IGroupManager

func (*Builder) GroupMsg

func (b *Builder) GroupMsg() IMsg

func (*Builder) GroupPic

func (b *Builder) GroupPic() IUpload

func (*Builder) GroupSystemMsgAction

func (b *Builder) GroupSystemMsgAction(MsgType int, MsgSeq, GroupCode int64) IGroupSystemMsgAction

func (*Builder) GroupVoice

func (b *Builder) GroupVoice() IUpload

func (*Builder) JsonMsg

func (b *Builder) JsonMsg(json string) IMsg

func (*Builder) OpAccept

func (b *Builder) OpAccept() IGroupSystemMsgAction

func (*Builder) OpIgnore

func (b *Builder) OpIgnore() IGroupSystemMsgAction

func (*Builder) OpReject

func (b *Builder) OpReject() IGroupSystemMsgAction

func (*Builder) PicMsg

func (b *Builder) PicMsg(pics ...*File) IMsg

func (*Builder) Qrcode

func (b *Builder) Qrcode() IQrcode

func (*Builder) QueryUin

func (b *Builder) QueryUin() IQueryUin

func (*Builder) SendMsg

func (b *Builder) SendMsg() ISendMsg

func (*Builder) SetBase64Buf

func (b *Builder) SetBase64Buf(base64Buf string) IUpload

func (*Builder) SetFilePath

func (b *Builder) SetFilePath(path string) IUpload

func (*Builder) SetFileUrlPath

func (b *Builder) SetFileUrlPath(url string) IUpload

func (*Builder) SetUin

func (b *Builder) SetUin(uid string)

func (*Builder) TextMsg

func (b *Builder) TextMsg(text string) IMsg

func (*Builder) ToUin

func (b *Builder) ToUin(uin int64) IMsg

func (*Builder) Upload

func (b *Builder) Upload() IUpload

func (*Builder) XmlMsg

func (b *Builder) XmlMsg(xml string) IMsg

type CgiRequest

type CgiRequest struct {
	LastUin    *int64  `json:"LastUin,omitempty"`
	OpCode     *int    `json:"OpCode,omitempty"`
	MsgSeq     *int64  `json:"MsgSeq,omitempty"`
	MsgType    *int    `json:"MsgType,omitempty"`
	GroupCode  *int64  `json:"GroupCode,omitempty"`
	Uin        *int64  `json:"Uin,omitempty"`
	LastBuffer *string `json:"LastBuffer,omitempty"`
	CommandId  *int    `json:"CommandId,omitempty"`
	FilePath   *string `json:"FilePath,omitempty"`
	Base64Buf  *string `json:"Base64Buf,omitempty"`
	FileUrl    *string `json:"FileUrl,omitempty"`
	ToUin      *int64  `json:"ToUin,omitempty"`
	ToType     *int    `json:"ToType,omitempty"`
	Content    *string `json:"Content,omitempty"`
	SubMsgType *int    `json:"SubMsgType,omitempty"`
	Images     []*File `json:"Images,omitempty"`
	Uid        *string `json:"Uid,omitempty"`
	AtUinLists []struct {
		Uin  *int64  `json:"Uin,omitempty"`
		Nick *string `json:"Nick,omitempty"`
	} `json:"AtUinLists,omitempty"`
}

type ClusterInfo

type ClusterInfo struct {
	Alloc        string `json:"Alloc"`
	ClientId     string `json:"ClientId"`
	ClusterIP    string `json:"ClusterIP"`
	CpuNum       int    `json:"CpuNum"`
	FreesTimes   int    `json:"FreesTimes"`
	GCTime       string `json:"GCTime"`
	GoArch       string `json:"GoArch"`
	GoVersion    string `json:"GoVersion"`
	GoroutineNum int    `json:"GoroutineNum"`
	LastGCTime   string `json:"LastGCTime"`
	MacInfo      string `json:"MacInfo"`
	MallocsTimes int    `json:"MallocsTimes"`
	NextGC       string `json:"NextGC"`
	Platform     string `json:"Platform"`
	QQUsers      []struct {
		MoneyCount    string `json:"MoneyCount"`
		OnlieTime     string `json:"OnlieTime"`
		QQ            string `json:"QQ"`
		ReceiveCount  int    `json:"ReceiveCount"`
		SendCount     int    `json:"SendCount"`
		TotalMoney    string `json:"TotalMoney"`
		TotalRecv     string `json:"TotalRecv"`
		TotalSend     string `json:"TotalSend"`
		UserLevelInfo string `json:"UserLevelInfo"`
	} `json:"QQUsers"`
	QQUsersCounts int    `json:"QQUsersCounts"`
	ServerRuntime string `json:"ServerRuntime"`
	Sys           string `json:"Sys"`
	TotalAlloc    string `json:"TotalAlloc"`
	Version       string `json:"Version"`
}

type DoApi

type DoApi interface {
	Do(ctx context.Context) error
	DoAndResponse(ctx context.Context) (*Response, error)
}

type File

type File struct {
	FileMd5   string `json:"FileMd5"`
	FileSize  int    `json:"FileSize"`
	FileToken string `json:"FileToken"`
	FileId    int64  `json:"FileId"`
}

type FriendLists

type FriendLists struct {
	FriendLists []struct {
		Head      string `json:"Head"`
		Signature string `json:"Signature"`
		TagId     int    `json:"TagId"`
		Uid       string `json:"Uid"`
		Uin       int    `json:"Uin"`
		Nick      string `json:"Nick"`
		Sex       int    `json:"Sex"`
	} `json:"FriendLists"`
	LastBuffer string `json:"LastBuffer"`
	TagLists   []struct {
		TagId   int    `json:"TagId"`
		TagName string `json:"TagName"`
	} `json:"TagLists"`
}

type GroupLists

type GroupLists struct {
	GroupLists []struct {
		CreateTime int    `json:"CreateTime"`
		GroupCnt   int    `json:"GroupCnt"`
		GroupCode  int    `json:"GroupCode"`
		GroupName  string `json:"GroupName"`
		MemberCnt  int    `json:"MemberCnt"`
	} `json:"GroupLists"`
}

type GroupMemberLists

type GroupMemberLists struct {
	LastBuffer  string `json:"LastBuffer"`
	MemberLists []struct {
		CreditLevel   int    `json:"CreditLevel"`
		JoinTime      int    `json:"JoinTime"`
		LastSpeakTime int    `json:"LastSpeakTime"`
		Level         int    `json:"Level"`
		MemberFlag    int    `json:"MemberFlag"`
		Nick          string `json:"Nick"`
		Uid           string `json:"Uid"`
		Uin           int    `json:"Uin"`
	} `json:"MemberLists"`
}

type IFriendManager

type IFriendManager interface {
	DoApi
	GetFriendLists(LastUin int64) IFriendManager
}

type IGroupManager

type IGroupManager interface {
	DoApi
	GetGroupLists() IGroupManager
	GroupSystemMsgAction(MsgType int, MsgSeq, GroupCode int64) IGroupSystemMsgAction
}

type IGroupSystemMsgAction

type IGroupSystemMsgAction interface {
	DoApi
	OpAccept() IGroupSystemMsgAction
	OpReject() IGroupSystemMsgAction
	OpIgnore() IGroupSystemMsgAction
}

type IMainFunc

type IMainFunc interface {
	SendMsg() ISendMsg
	QueryUin() IQueryUin
	Qrcode() IQrcode
	Upload() IUpload
	GetClusterInfo() DoApi
	GroupManager() IGroupManager
	FriendManager() IFriendManager
}

func NewApi

func NewApi(url string, botQQ int64, middles ...func(*Builder) bool) IMainFunc

type IMsg

type IMsg interface {
	ToUin(uin int64) IMsg
	TextMsg(text string) IMsg
	PicMsg(...*File) IMsg
	XmlMsg(xml string) IMsg
	JsonMsg(json string) IMsg
	At(string, ...int64) IMsg
	DoApi
}

type IQrcode

type IQrcode interface {
	Get() error
	GetUrl() *string
	PrintTerminal(io.Writer) error
	GetImageBytes() []byte
}

type IQueryUin

type IQueryUin interface {
	DoApi
	SetUin(uid string)
}

type ISendMsg

type ISendMsg interface {
	FriendMsg() IMsg
	GroupMsg() IMsg
}

type IUpload

type IUpload interface {
	SetFilePath(path string) IUpload
	SetFileUrlPath(url string) IUpload
	SetBase64Buf(base64Buf string) IUpload
	FriendPic() IUpload
	FriendVoice() IUpload
	GroupVoice() IUpload
	GroupPic() IUpload
	DoUpload(ctx context.Context) (*File, error)
}

type QrcodeStruct

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

func (*QrcodeStruct) Get

func (q *QrcodeStruct) Get() error

func (*QrcodeStruct) GetImageBytes

func (q *QrcodeStruct) GetImageBytes() []byte

func (*QrcodeStruct) GetUrl

func (q *QrcodeStruct) GetUrl() *string

func (*QrcodeStruct) PrintTerminal

func (q *QrcodeStruct) PrintTerminal(writer io.Writer) error

type QueryUinStruct

type QueryUinStruct struct {
	Uin       int    `json:"Uin"`
	Uid       string `json:"Uid"`
	Nick      string `json:"Nick"`
	Head      string `json:"Head"`
	Signature string `json:"Signature"`
	Sex       int    `json:"Sex"`
	Level     int    `json:"Level"`
}

type Response

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

func NewResponse

func NewResponse(msg []byte) *Response

func (*Response) ErrorMsg

func (r *Response) ErrorMsg() string

func (*Response) GetData

func (r *Response) GetData(data interface{}) error

func (*Response) GetOrigin

func (r *Response) GetOrigin() []byte

func (*Response) Ok

func (r *Response) Ok() bool

func (*Response) Result

func (r *Response) Result() (Ret int, ErrMsg string)

type ResponseStruct

type ResponseStruct struct {
	CgiBaseResponse struct {
		Ret    int    `json:"Ret"`
		ErrMsg string `json:"ErrMsg"`
	} `json:"CgiBaseResponse"`
	ResponseData json.RawMessage `json:"ResponseData,omitempty"`
}

Jump to

Keyboard shortcuts

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