wechatypuppet

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IPuppetAbstract

type IPuppetAbstract interface {
	MessageSearch(query *schemas.MessageQueryFilter) ([]string, error)
	MessagePayload(messageID string) (payload *schemas.MessagePayload, err error)
	FriendshipPayload(friendshipID string) (*schemas.FriendshipPayload, error)
	SetFriendshipPayload(friendshipID string, newPayload *schemas.FriendshipPayload)
	RoomPayload(roomID string) (payload *schemas.RoomPayload, err error)
	ContactPayload(contactID string) (*schemas.ContactPayload, error)
	ContactSearch(query interface{}, searchIDList []string) ([]string, error)
	FriendshipSearch(query *schemas.FriendshipSearchCondition) (string, error)
	SelfID() string

	events.EventEmitter
	ContactValidate(contactID string) bool
	RoomValidate(roomID string) bool
	RoomMemberSearch(roomID string, query interface{}) ([]string, error)
	RoomMemberPayload(roomID, memberID string) (*schemas.RoomMemberPayload, error)
	MessageForward(conversationID string, messageID string) (string, error)
	RoomSearch(query *schemas.RoomQueryFilter) ([]string, error)
	RoomInvitationPayload(roomInvitationID string) (*schemas.RoomInvitationPayload, error)
	SetRoomInvitationPayload(payload *schemas.RoomInvitationPayload)
	DirtyPayload(payloadType schemas.PayloadType, id string) error
	MessageMiniProgram(messageID string) (*schemas.MiniProgramPayload, error)
	// contains filtered or unexported methods
}

IPuppetAbstract puppet abstract class interface

type MsgAdapter

type MsgAdapter interface {
	Handle(payload *schemas.MessagePayload)
}

MsgAdapter 消息适配器

func NewMsgAdapter

func NewMsgAdapter(msgType schemas.MessageType) MsgAdapter

NewMsgAdapter 各种 puppet 返回的消息有出入,这里做统一

type Option

type Option struct {
	Endpoint              string
	Timeout               time.Duration
	Token                 string
	GrpcReconnectInterval time.Duration
}

Option puppet option

type OptionFn

type OptionFn func(opts *Option)

OptionFn func

func WithEndpoint

func WithEndpoint(endpoint string) OptionFn

WithEndpoint with Endpoint

func WithTimeout

func WithTimeout(duration time.Duration) OptionFn

WithTimeout with Timeout

func WithToken

func WithToken(token string) OptionFn

WithToken with Token

type Puppet

type Puppet struct {
	Option

	// puppet implementation puppet_service or puppet_mock
	events.EventEmitter
	// contains filtered or unexported fields
}

Puppet puppet abstract struct

func NewPuppet

func NewPuppet(option Option) (*Puppet, error)

NewPuppet instance

func (*Puppet) ContactPayload

func (p *Puppet) ContactPayload(contactID string) (*schemas.ContactPayload, error)

ContactPayload ...

func (*Puppet) ContactSearch

func (p *Puppet) ContactSearch(query interface{}, searchIDList []string) ([]string, error)

ContactSearch query params is string or *schemas.ContactQueryFilter

func (*Puppet) ContactValidate

func (p *Puppet) ContactValidate(contactID string) bool

ContactValidate ...

func (*Puppet) DirtyPayload

func (p *Puppet) DirtyPayload(payloadType schemas.PayloadType, id string) error

DirtyPayload base clean cache

func (*Puppet) FriendshipPayload

func (p *Puppet) FriendshipPayload(friendshipID string) (*schemas.FriendshipPayload, error)

FriendshipPayload ...

func (*Puppet) FriendshipSearch

func (p *Puppet) FriendshipSearch(query *schemas.FriendshipSearchCondition) (string, error)

FriendshipSearch ...

func (*Puppet) MessageForward

func (p *Puppet) MessageForward(conversationID string, messageID string) (string, error)

MessageForward ...

func (*Puppet) MessageList

func (p *Puppet) MessageList() (ks []string)

MessageList message list

func (*Puppet) MessageMiniProgram

func (p *Puppet) MessageMiniProgram(messageID string) (*schemas.MiniProgramPayload, error)

MessageMiniProgram ...

func (*Puppet) MessagePayload

func (p *Puppet) MessagePayload(messageID string) (*schemas.MessagePayload, error)

MessagePayload message payload todo:: no finish

func (*Puppet) MessageSearch

func (p *Puppet) MessageSearch(query *schemas.MessageQueryFilter) ([]string, error)

MessageSearch search message

func (*Puppet) OnDirty

func (p *Puppet) OnDirty(payloadType schemas.PayloadType, id string) error

OnDirty clean cache

func (*Puppet) RoomInvitationPayload

func (p *Puppet) RoomInvitationPayload(roomInvitationID string) (*schemas.RoomInvitationPayload, error)

RoomInvitationPayload ...

func (*Puppet) RoomMemberPayload

func (p *Puppet) RoomMemberPayload(roomID, memberID string) (*schemas.RoomMemberPayload, error)

RoomMemberPayload ...

func (*Puppet) RoomMemberSearch

func (p *Puppet) RoomMemberSearch(roomID string, query interface{}) ([]string, error)

RoomMemberSearch ...

func (*Puppet) RoomPayload

func (p *Puppet) RoomPayload(roomID string) (payload *schemas.RoomPayload, err error)

RoomPayload ...

func (*Puppet) RoomSearch

func (p *Puppet) RoomSearch(query *schemas.RoomQueryFilter) ([]string, error)

RoomSearch ...

func (*Puppet) RoomValidate

func (p *Puppet) RoomValidate(roomID string) bool

RoomValidate ...

func (*Puppet) SelfID

func (p *Puppet) SelfID() string

SelfID self id

func (*Puppet) SetFriendshipPayload

func (p *Puppet) SetFriendshipPayload(friendshipID string, newPayload *schemas.FriendshipPayload)

SetFriendshipPayload ...

func (*Puppet) SetID

func (p *Puppet) SetID(id string)

SetID set login id

func (*Puppet) SetPuppetImplementation

func (p *Puppet) SetPuppetImplementation(i IPuppetAbstract)

SetPuppetImplementation set puppet implementation

func (*Puppet) SetRoomInvitationPayload

func (p *Puppet) SetRoomInvitationPayload(payload *schemas.RoomInvitationPayload)

SetRoomInvitationPayload ...

type RawMsgAdapter

type RawMsgAdapter struct{}

RawMsgAdapter 不需要处理的消息

func (RawMsgAdapter) Handle

func (r RawMsgAdapter) Handle(msg *schemas.MessagePayload)

Handle ~

type RecalledMsgAdapter

type RecalledMsgAdapter struct{}

RecalledMsgAdapter 撤回类型的消息适配器

func (RecalledMsgAdapter) Handle

func (r RecalledMsgAdapter) Handle(payload *schemas.MessagePayload)

Handle padlocal 返回的是 xml,需要解析出 msgId

type UnknownMsgAdapter

type UnknownMsgAdapter struct{}

UnknownMsgAdapter Unknown 类型的消息适配器

func (UnknownMsgAdapter) Handle

func (u UnknownMsgAdapter) Handle(payload *schemas.MessagePayload)

Handle 对 Unknown 类型的消息做适配

Directories

Path Synopsis
Package events provides simple EventEmitter support for Go Programming Language
Package events provides simple EventEmitter support for Go Programming Language

Jump to

Keyboard shortcuts

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