puppetservice

package
v0.4.12 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2024 License: Apache-2.0 Imports: 26 Imported by: 1

Documentation

Index

Constants

View Source
const TLSCaCert = `` /* 2060-byte string literal not displayed */

TLSCaCert Wechaty Certificate Authority Repo:

https://github.com/wechaty/dotenv/tree/main/ca

The SSL_ROOT_CERT is a root certificate generated by and for wechaty community.

Because it's the default root cert for the puppet service,

so all the Polyglot Wechaty SDK should set this cert to be trusted by default.

Update:

  • Huan(202108): init, expired in 3650 days (after 2031/07)
View Source
const TLSInsecureServerCertCommonName = "insecure"

TLSInsecureServerCertCommonName Common Name:

  • Server Name Indication (SNI)
  • Case insensitive

Wechaty Token format: `${SNI}/${UUIDv4}`

Variables

View Source
var (
	// ErrNoEndpoint err no endpoint
	ErrNoEndpoint = errors.New("no endpoint")
	// ErrURLLinkPayloadNotFound ...
	ErrURLLinkPayloadNotFound = errors.New("UrlLinkPayloadNotFound")
)
View Source
var ErrNoName = errors.New("no name")

ErrNoName err no name

View Source
var (
	// ErrNotToken token not found error
	// Deprecated
	ErrNotToken = errors.New("wechaty-puppet-service: token not found. See: <https://github.com/wechaty/wechaty-puppet-service#1-wechaty_puppet_service_token>")
)
View Source
var ErrTokenNotFound = errors.New("wechaty-puppet-service: WECHATY_PUPPET_SERVICE_TOKEN not found")

ErrTokenNotFound err token not found

Functions

func NewFileBoxFromMessageFileStream added in v0.3.5

func NewFileBoxFromMessageFileStream(client pbwechaty.Puppet_MessageFileStreamClient) (*filebox.FileBox, error)

NewFileBoxFromMessageFileStream ...

func ToMessageSendFileWriter added in v0.3.5

func ToMessageSendFileWriter(client pbwechaty.Puppet_MessageSendFileStreamClient, conversationID string, fileBox *filebox.FileBox) (io.Writer, error)

ToMessageSendFileWriter 把 grpc 流包装到 io.Writer 接口

Types

type DownloadFile added in v0.4.0

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

DownloadFile 把 grpc download 流包装到 io.Reader 接口

func NewDownloadFile added in v0.4.0

func NewDownloadFile(client pbwechaty.Puppet_DownloadClient) *DownloadFile

NewDownloadFile 把 grpc download 流包装到 io.Reader 接口

func (*DownloadFile) Read added in v0.4.0

func (m *DownloadFile) Read(p []byte) (n int, err error)

Read 把 grpc download 流包装到 io.Reader 接口

type MessageFile added in v0.3.5

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

MessageFile 把 grpc 流包装到 io.Reader 接口

func NewMessageFile added in v0.3.5

NewMessageFile ...

func (*MessageFile) Read added in v0.3.5

func (m *MessageFile) Read(p []byte) (n int, err error)

Read 把 grpc 流包装到 io.Reader 接口

type MessageSendFile added in v0.3.5

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

MessageSendFile 把 grpc 流包装到 io.Writer 接口

func (*MessageSendFile) Write added in v0.3.5

func (m *MessageSendFile) Write(p []byte) (n int, err error)

Write 把 grpc 流包装到 io.Writer 接口

type Options added in v0.4.11

type Options struct {
	wechatypuppet.Option

	GrpcReconnectInterval time.Duration
	Authority             string
	TLS                   TLSConfig
}

Options puppet-service options

type PuppetService

type PuppetService struct {
	*wechatyPuppet.Puppet
	// contains filtered or unexported fields
}

PuppetService struct

func NewNewPuppetService added in v0.4.11

func NewNewPuppetService(opts Options) (*PuppetService, error)

NewNewPuppetService create puppet service

func NewPuppetService

func NewPuppetService(o wechatyPuppet.Option) (*PuppetService, error)

NewPuppetService new PuppetService struct Deprecated: please use NewNewPuppetService

func (*PuppetService) ContactAlias

func (p *PuppetService) ContactAlias(contactID string) (string, error)

ContactAlias ...

func (*PuppetService) ContactAvatar

func (p *PuppetService) ContactAvatar(contactID string) (*filebox.FileBox, error)

ContactAvatar ...

func (*PuppetService) ContactList

func (p *PuppetService) ContactList() ([]string, error)

ContactList ...

func (*PuppetService) ContactQRCode

func (p *PuppetService) ContactQRCode(contactID string) (string, error)

ContactQRCode ...

func (*PuppetService) ContactRawPayload

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

ContactRawPayload ...

func (*PuppetService) ContactSelfQRCode

func (p *PuppetService) ContactSelfQRCode() (string, error)

ContactSelfQRCode ...

func (*PuppetService) Ding

func (p *PuppetService) Ding(data string)

Ding ...

func (*PuppetService) DirtyPayload

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

DirtyPayload ...

func (*PuppetService) FriendshipAccept

func (p *PuppetService) FriendshipAccept(friendshipID string) (err error)

FriendshipAccept ...

func (*PuppetService) FriendshipAdd

func (p *PuppetService) FriendshipAdd(contactID, hello string) (err error)

FriendshipAdd ...

func (*PuppetService) FriendshipRawPayload

func (p *PuppetService) FriendshipRawPayload(id string) (*schemas.FriendshipPayload, error)

FriendshipRawPayload ...

func (*PuppetService) FriendshipSearchPhone

func (p *PuppetService) FriendshipSearchPhone(phone string) (string, error)

FriendshipSearchPhone ...

func (*PuppetService) FriendshipSearchWeixin

func (p *PuppetService) FriendshipSearchWeixin(weixin string) (string, error)

FriendshipSearchWeixin ...

func (*PuppetService) Logout

func (p *PuppetService) Logout() error

Logout ...

func (*PuppetService) MessageContact

func (p *PuppetService) MessageContact(messageID string) (string, error)

MessageContact ...

func (*PuppetService) MessageFile

func (p *PuppetService) MessageFile(id string) (*filebox.FileBox, error)

MessageFile ...

func (*PuppetService) MessageForward added in v0.4.0

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

MessageForward message forward

func (*PuppetService) MessageImage

func (p *PuppetService) MessageImage(messageID string, imageType schemas.ImageType) (*filebox.FileBox, error)

MessageImage ...

func (*PuppetService) MessageLocation added in v0.4.12

func (p *PuppetService) MessageLocation(messageID string) (*schemas.LocationPayload, error)

MessageLocation get location payload

func (*PuppetService) MessageRawMiniProgramPayload

func (p *PuppetService) MessageRawMiniProgramPayload(messageID string) (*schemas.MiniProgramPayload, error)

MessageRawMiniProgramPayload ...

func (*PuppetService) MessageRawPayload

func (p *PuppetService) MessageRawPayload(id string) (*schemas.MessagePayload, error)

MessageRawPayload ...

func (*PuppetService) MessageRecall

func (p *PuppetService) MessageRecall(messageID string) (bool, error)

MessageRecall ...

func (*PuppetService) MessageSendContact

func (p *PuppetService) MessageSendContact(conversationID string, contactID string) (string, error)

MessageSendContact ...

func (*PuppetService) MessageSendFile

func (p *PuppetService) MessageSendFile(conversationID string, fileBox *filebox.FileBox) (string, error)

MessageSendFile ...

func (*PuppetService) MessageSendLocation added in v0.4.12

func (p *PuppetService) MessageSendLocation(conversationID string, payload *schemas.LocationPayload) (string, error)

MessageSendLocation send location

func (*PuppetService) MessageSendMiniProgram

func (p *PuppetService) MessageSendMiniProgram(conversationID string, miniProgramPayload *schemas.MiniProgramPayload) (string, error)

MessageSendMiniProgram ...

func (*PuppetService) MessageSendText

func (p *PuppetService) MessageSendText(conversationID string, text string, mentionIDList ...string) (string, error)

MessageSendText ...

func (*PuppetService) MessageSendURL

func (p *PuppetService) MessageSendURL(conversationID string, urlLinkPayload *schemas.UrlLinkPayload) (string, error)

MessageSendURL ...

func (*PuppetService) MessageURL

func (p *PuppetService) MessageURL(messageID string) (*schemas.UrlLinkPayload, error)

MessageURL ...

func (*PuppetService) RoomAdd

func (p *PuppetService) RoomAdd(roomID, contactID string) error

RoomAdd ...

func (*PuppetService) RoomAnnounce

func (p *PuppetService) RoomAnnounce(roomID string) (string, error)

RoomAnnounce ...

func (*PuppetService) RoomAvatar

func (p *PuppetService) RoomAvatar(roomID string) (*filebox.FileBox, error)

RoomAvatar ...

func (*PuppetService) RoomCreate

func (p *PuppetService) RoomCreate(contactIDList []string, topic string) (string, error)

RoomCreate ...

func (*PuppetService) RoomDel

func (p *PuppetService) RoomDel(roomID, contactID string) error

RoomDel ...

func (*PuppetService) RoomInvitationAccept

func (p *PuppetService) RoomInvitationAccept(roomInvitationID string) error

RoomInvitationAccept ...

func (*PuppetService) RoomInvitationRawPayload

func (p *PuppetService) RoomInvitationRawPayload(id string) (*schemas.RoomInvitationPayload, error)

RoomInvitationRawPayload ...

func (*PuppetService) RoomList

func (p *PuppetService) RoomList() ([]string, error)

RoomList ...

func (*PuppetService) RoomMemberList

func (p *PuppetService) RoomMemberList(roomID string) ([]string, error)

RoomMemberList ...

func (*PuppetService) RoomMemberRawPayload

func (p *PuppetService) RoomMemberRawPayload(roomID string, contactID string) (*schemas.RoomMemberPayload, error)

RoomMemberRawPayload ...

func (*PuppetService) RoomQRCode

func (p *PuppetService) RoomQRCode(roomID string) (string, error)

RoomQRCode ...

func (*PuppetService) RoomQuit

func (p *PuppetService) RoomQuit(roomID string) error

RoomQuit ...

func (*PuppetService) RoomRawPayload

func (p *PuppetService) RoomRawPayload(id string) (*schemas.RoomPayload, error)

RoomRawPayload ...

func (*PuppetService) RoomTopic

func (p *PuppetService) RoomTopic(roomID string) (string, error)

RoomTopic ...

func (*PuppetService) SetContactAlias

func (p *PuppetService) SetContactAlias(contactID string, alias string) error

SetContactAlias ...

func (*PuppetService) SetContactAvatar

func (p *PuppetService) SetContactAvatar(contactID string, fileBox *filebox.FileBox) error

SetContactAvatar ...

func (*PuppetService) SetContactSelfName

func (p *PuppetService) SetContactSelfName(name string) error

SetContactSelfName ...

func (*PuppetService) SetContactSelfSignature

func (p *PuppetService) SetContactSelfSignature(signature string) error

SetContactSelfSignature ...

func (*PuppetService) SetRoomAnnounce

func (p *PuppetService) SetRoomAnnounce(roomID, text string) error

SetRoomAnnounce ...

func (*PuppetService) SetRoomTopic

func (p *PuppetService) SetRoomTopic(roomID string, topic string) error

SetRoomTopic ...

func (*PuppetService) Start

func (p *PuppetService) Start() (err error)

Start ...

func (*PuppetService) Stop

func (p *PuppetService) Stop()

Stop ...

func (*PuppetService) TagContactAdd

func (p *PuppetService) TagContactAdd(id, contactID string) (err error)

TagContactAdd ...

func (*PuppetService) TagContactDelete

func (p *PuppetService) TagContactDelete(id string) (err error)

TagContactDelete ...

func (*PuppetService) TagContactList

func (p *PuppetService) TagContactList(contactID string) ([]string, error)

TagContactList ...

func (*PuppetService) TagContactRemove

func (p *PuppetService) TagContactRemove(id, contactID string) (err error)

TagContactRemove ...

type ServiceEndPoint

type ServiceEndPoint struct {
	IP   string `json:"ip"`
	Port int    `json:"port,omitempty"`
}

ServiceEndPoint api.chatie.io endpoint api response Deprecated

func (*ServiceEndPoint) IsValid

func (p *ServiceEndPoint) IsValid() bool

IsValid EndPoint is valid

func (*ServiceEndPoint) Target

func (p *ServiceEndPoint) Target() string

Target Export IP+Port

type TLSConfig added in v0.4.11

type TLSConfig struct {
	CaCert     string
	ServerName string

	Disable bool //  only for compatible with old clients/servers
}

TLSConfig tls config

Jump to

Keyboard shortcuts

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