Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add puppet schemas and add user_link #9

Merged
merged 2 commits into from
Apr 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@
# Dependency directories (remove the comment below to include it)
# vendor/
.idea/
go.sum
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
module github.com/wechaty/go-wechaty

require github.com/otiai10/opengraph v1.1.1

go 1.14
40 changes: 40 additions & 0 deletions src/wechaty-puppet/schemas/contact.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package schemas

type ContactGender uint8

const (
ContactGenderUnknown ContactGender = 0
ContactGenderMale ContactGender = 1
ContactGenderFemale ContactGender = 2
)

type ContactType uint8

const (
ContactTypeUnknown ContactType = 0
ContactTypePersonal ContactType = 1
ContactTypeOfficial ContactType = 2
)

type ContactQueryFilter struct {
Alias string
Id string
Name string
WeiXin string
}

type ContactPayload struct {
Id string
Gender ContactGender
Type ContactType
Name string
Avatar string
Address string
Alias string
City string
Friend bool
Province string
Signature string
Start bool
WeiXin string
}
75 changes: 75 additions & 0 deletions src/wechaty-puppet/schemas/events.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
package schemas

type ScanStatus uint8

const (
ScanStatusUnknown ScanStatus = 0
ScanStatusCancel ScanStatus = 1
ScanStatusWaiting ScanStatus = 2
ScanStatusScanned ScanStatus = 3
ScanStatusConfirmed ScanStatus = 4
ScanStatusTimeout ScanStatus = 5
)

type EventFriendshipPayload struct {
FriendshipId string
}

type EventLoginPayload struct {
ContactId string
}

type EventLogoutPayload struct {
ContactId string
Data string
}

type EventMessagePayload struct {
MessageId string
}

type EventRoomInvitePayload struct {
RoomInvitationId string
}

type EventRoomJoinPayload struct {
InviteeIdList []string
InviterId string
RoomId string
Timestamp int64
}

type EventRoomLeavePayload struct {
RemoveIdList []string
RemoverId string
RoomId string
Timestamp int64
}

type EventRoomTopicPayload struct {
ChangerId string
NewTopic string
OldTopic string
RoomId string
Timestamp int64
}

type EventScanPayload struct {
BaseEventPayload
Status ScanStatus
QrCode string
}

type BaseEventPayload struct {
Data string
}

type EventDongPayload = BaseEventPayload

type EventErrorPayload = BaseEventPayload

type EventReadyPayload = BaseEventPayload

type EventResetPayload = BaseEventPayload

type EventHeartbeatPayload = BaseEventPayload
57 changes: 57 additions & 0 deletions src/wechaty-puppet/schemas/friendship.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package schemas

type FriendshipType uint8

const (
FriendshipTypeUnknown FriendshipType = 0
FriendshipTypeConfirm FriendshipType = 1
FriendshipTypeReceive FriendshipType = 2
FriendshipTypeVerify FriendshipType = 3
)

type FriendshipSceneType uint8

const (
FriendshipSceneTypeUnknown FriendshipSceneType = 0
FriendshipSceneTypeQQ FriendshipSceneType = 1
FriendshipSceneTypeEmail FriendshipSceneType = 2
FriendshipSceneTypeWeiXin FriendshipSceneType = 3
FriendshipSceneTypeQQTBD FriendshipSceneType = 12 // QQ号搜索
FriendshipSceneTypeRoom FriendshipSceneType = 14
FriendshipSceneTypePhone FriendshipSceneType = 15
FriendshipSceneTypeCard FriendshipSceneType = 17 // 名片分享
FriendshipSceneTypeLocation FriendshipSceneType = 18
FriendshipSceneTypeBottle FriendshipSceneType = 25
FriendshipSceneTypeShaking FriendshipSceneType = 29
FriendshipSceneTypeQRCode FriendshipSceneType = 30
)

type FriendshipPayloadBase struct {
Id string
ContactId string
Hello string
Timestamp int64
}

type FriendshipPayloadConfirm struct {
FriendshipPayloadBase
Type FriendshipType // FriendshipTypeConfirm
}

type FriendshipPayloadReceive struct {
FriendshipPayloadBase
Type FriendshipType // FriendshipTypeReceive
Scene FriendshipSceneType
Stranger string
Ticket string
}

type FriendshipPayloadVerify struct {
FriendshipPayloadBase
Type FriendshipType // FriendshipTypeVerify
}

type FriendshipSearchCondition struct {
Phone string
WeiXin string
}
8 changes: 4 additions & 4 deletions src/wechaty-puppet/schemas/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package schemas
type ImageType uint8

const (
Unknown ImageType = 0
Thumbnail = 1
HD = 2
Artwork = 3
Unknown ImageType = 0
SilkageNet marked this conversation as resolved.
Show resolved Hide resolved
Thumbnail ImageType = 1
HD ImageType = 2
Artwork ImageType = 3
)
104 changes: 104 additions & 0 deletions src/wechaty-puppet/schemas/message.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
package schemas

type MessageType uint8

const (
MessageTypeUnknown MessageType = 0
MessageTypeAttachment MessageType = 1
MessageTypeAudio MessageType = 2
MessageTypeContact MessageType = 3
MessageTypeChatHistory MessageType = 4
MessageTypeEmoticon MessageType = 5
MessageTypeImage MessageType = 6
MessageTypeText MessageType = 7
MessageTypeLocation MessageType = 8
MessageTypeMiniProgram MessageType = 9
MessageTypeTransfer MessageType = 10
MessageTypeRedEnvelope MessageType = 11
MessageTypeRecalled MessageType = 12
MessageTypeUrl MessageType = 13
MessageTypeVideo MessageType = 14
)

type WeChatAppMessageType int

const (
WeChatAppMessageTypeText WeChatAppMessageType = 1
WeChatAppMessageTypeImg WeChatAppMessageType = 2
WeChatAppMessageTypeAudio WeChatAppMessageType = 3
WeChatAppMessageTypeVideo WeChatAppMessageType = 4
WeChatAppMessageTypeUrl WeChatAppMessageType = 5
WeChatAppMessageTypeAttach WeChatAppMessageType = 6
WeChatAppMessageTypeOpen WeChatAppMessageType = 7
WeChatAppMessageTypeEmoji WeChatAppMessageType = 8
WeChatAppMessageTypeVoiceRemind WeChatAppMessageType = 9
WeChatAppMessageTypeScanGood WeChatAppMessageType = 10
WeChatAppMessageTypeGood WeChatAppMessageType = 13
WeChatAppMessageTypeEmotion WeChatAppMessageType = 15
WeChatAppMessageTypeCardTicket WeChatAppMessageType = 16
WeChatAppMessageTypeRealtimeShareLocation WeChatAppMessageType = 17
WeChatAppMessageTypeChatHistory WeChatAppMessageType = 19
WeChatAppMessageTypeMiniProgram WeChatAppMessageType = 33
WeChatAppMessageTypeTransfers WeChatAppMessageType = 2000
WeChatAppMessageTypeRedEnvelopes WeChatAppMessageType = 2001
WeChatAppMessageTypeReaderType WeChatAppMessageType = 100001
)

type WeChatMessageType int

const (
WeChatMessageTypeText WeChatMessageType = 1
WeChatMessageTypeImage WeChatMessageType = 3
WeChatMessageTypeVoice WeChatMessageType = 34
WeChatMessageTypeVerifyMsg WeChatMessageType = 37
WeChatMessageTypePossibleFriendMsg WeChatMessageType = 40
WeChatMessageTypeShareCard WeChatMessageType = 42
WeChatMessageTypeVideo WeChatMessageType = 43
WeChatMessageTypeEmoticon WeChatMessageType = 47
WeChatMessageTypeLocation WeChatMessageType = 48
WeChatMessageTypeApp WeChatMessageType = 49
WeChatMessageTypeVOIPMsg WeChatMessageType = 50
WeChatMessageTypeStatusNotify WeChatMessageType = 51
WeChatMessageTypeVOIPNotify WeChatMessageType = 52
WeChatMessageTypeVOIPInvite WeChatMessageType = 53
WeChatMessageTypeMicroVideo WeChatMessageType = 62
WeChatMessageTypeTransfer WeChatMessageType = 2000 // 转账
WeChatMessageTypeRedEnvelope WeChatMessageType = 2001 // 红包
WeChatMessageTypeMiniProgram WeChatMessageType = 2002 // 小程序
WeChatMessageTypeGroupInvite WeChatMessageType = 2003 // 群邀请
WeChatMessageTypeFile WeChatMessageType = 2004 // 文件消息
WeChatMessageTypeSysNotice WeChatMessageType = 9999
WeChatMessageTypeSys WeChatMessageType = 10000
WeChatMessageTypeRecalled WeChatMessageType = 10002
)

type MessagePayloadBase struct {
Id string
MentionIdList []string
Filename string
Text string
Timestamp string
Type MessageType
}

type MessagePayloadRoom struct {
FromId string
RoomId string
ToId string
}

type MessagePayloadTo = MessagePayloadRoom

type MessagePayload struct {
MessagePayloadBase
MessagePayloadRoom
}

type MessageQueryFilter struct {
FromId string
Id string
RoomId string
Text string
ToId string
Type MessageType
}
11 changes: 11 additions & 0 deletions src/wechaty-puppet/schemas/mini_program.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package schemas

type MiniProgramPayload struct {
AppId string
Description string
PagePath string
ThumbUrl string
Title string
Username string
ThumbKey string
}
7 changes: 7 additions & 0 deletions src/wechaty-puppet/schemas/puppet.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package schemas

type PuppetOptions struct {
endpoint string
timeout int64
token string
}
29 changes: 29 additions & 0 deletions src/wechaty-puppet/schemas/room.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package schemas

type RoomMemberQueryFilter struct {
Name string
RoomAlias string
ContactAlias string
}

type RoomQueryFilter struct {
Id string
Topic string
}

type RoomPayload struct {
Id string
Topic string
Avatar string
MemberIdList []string
OwnerId string
AdminIdList []string
}

type RoomMemberPayload struct {
Id string
RoomAlias string
InviterId string
Avatar string
Name string
}
13 changes: 13 additions & 0 deletions src/wechaty-puppet/schemas/room_invitation.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package schemas

type RoomInvitationPayload struct {
Id string
InviterId string
Topic string
Avatar string
Invitation string
MemberCount int
MemberIdList []string
Timestamp int64
ReceiverId string
}
8 changes: 8 additions & 0 deletions src/wechaty-puppet/schemas/url_link.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package schemas

type UrlLinkPayload struct {
Description string
ThumbnailUrl string
Title string
Url string
}
7 changes: 7 additions & 0 deletions src/wechaty/user/contact.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package user

import "github.com/wechaty/go-wechaty/src/wechaty"

type Contact struct {
wechaty.Accessory
}
2 changes: 1 addition & 1 deletion src/wechaty/user/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type Images struct {
// NewImages create image struct
func NewImages(id string, accessory wechaty.Accessory) *Images {
if accessory.Puppet == nil {
panic("Image class can not be instanciated without a puppet!")
panic("Image class can not be instantiated without a puppet!")
}
return &Images{accessory, id}
}
Expand Down
Loading