yunxin

package module
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2022 License: Apache-2.0 Imports: 15 Imported by: 0

README

go-yunxin

https://dev.yunxin.163.com/ server side API sdk

https://pkg.go.dev/github.com/not-a-dog/go-yunxin

Usage


client := yunxin.NewClient("", "")
user, err := client.GetUserInfos(ctx, &yunxin.GetUserInfosParam{Accids: []string{"111111"}})

Dev

添加接口
  1. 从 yunxin 文档中找到相关接口 XXX
  2. path.go 中定义 PathXXX
  3. xxx.go 中定义好 XXXParam XXXResponse
  4. go generate
  5. go build ./...
测试
WY_APP_KEY=xxx WY_APP_SECRET=yyy go run example/chatroom/main.go

Documentation

Index

Constants

View Source
const (
	HTTPAppKey   = "AppKey"
	HTTPNonce    = "Nonce"
	HTTPCurTime  = "CurTime"
	HTTPCheckSum = "CheckSum"

	HTTPContentType     = "Content-Type"
	HTTPXFormURLEncoded = "application/x-www-form-urlencoded;charset=utf-8"
)
View Source
const (
	ClientTypeWeblink    = 1
	ClientTypeCommonlink = 2
	ClientTypeWechatlink = 3
)
View Source
const (
	PathUserCreate         = `/user/create.action`
	PathUserUpdate         = `/user/update.action`
	PathUserRefreshToken   = `/user/refreshToken.action`
	PathUserBlock          = `/user/block.action`
	PathUserUnBlock        = `/user/unblock.action`
	PathUserUpdateUserInfo = `/user/updateUinfo.action`
	PathGetUserInfos       = `/user/getUinfos.action`
	PathUserSetDonnop      = `/user/setDonnop.action`
	PathUserMute           = `/user/mute.action`

	PathFriendAdd    = `/friend/add.action`
	PathFriendUpdate = `/friend/update.action`
	PathFriendDelete = `/friend/delete.action`
	PathFriendGet    = `/friend/get.action`

	PathUserSetSpecialRelation   = `/user/setSpecialRelation.action`
	PathUserListBlackAndMuteList = `/user/listBlackAndMuteList.action`

	PathMsgSendMsg = `/msg/sendMsg.action`
	PathMsgDelMsg  = `/msg/delMsg.action`

	PathChatRoomCreate                  = `/chatroom/create.action`
	PathChatroomGet                     = `/chatroom/get.action`
	PathChatroomGetBatch                = `/chatroom/getBatch.action`
	PathChatRoomRequestAddr             = `/chatroom/requestAddr.action`
	PathChatRoomSendMsg                 = `/chatroom/sendMsg.action`
	PathChatRoomMembersByPage           = `/chatroom/membersByPage.action`
	PathChatRoomSetMemberRole           = `/chatroom/setMemberRole.action`
	PathChatRoomRecall                  = `/chatroom/recall.action`
	PathChatRoomUpdateInOutNotification = `/chatroom/updateInOutNotification.action`
)
View Source
const DefaultHost = "https://api.netease.im/nimserver"

Variables

This section is empty.

Functions

func JSONFormEncode

func JSONFormEncode(v reflect.Value) string

func RegisterEncoder

func RegisterEncoder(value interface{}, encoder func(reflect.Value) string)

func Request

func Request[T any](c *Client, ctx context.Context, param Param) (*T, error)

Types

type AsError added in v0.0.3

type AsError interface {
	AsError() error
}

type BasicResponse

type BasicResponse struct {
	RawBodyModel
	Code int    `json:"code"`
	Desc string `json:"desc,omitempty"` // Error description
}

func (BasicResponse) AsError added in v0.0.2

func (r BasicResponse) AsError() error

func (*BasicResponse) IsSuccess

func (r *BasicResponse) IsSuccess() bool

type ChatRoomCreateParam

type ChatRoomCreateParam struct {
	Creator          string           `schema:"creator,required"`
	Name             string           `schema:"name,required"`
	Announcement     string           `schema:"announcement"`
	BroadcastURL     string           `schema:"broadcasturl"`
	Ext              string           `schema:"ext"`
	QueueLevel       QueueLevel       `schema:"queuelevel"`
	Bid              string           `schema:"bid"` // TODO json string
	DelayClosePolicy DelayClosePolicy `schema:"delayClosePolicy"`
	DelaySeconds     int64            `schema:"delaySeconds"`
}

func (ChatRoomCreateParam) GetPath

func (ChatRoomCreateParam) GetPath() string

type ChatRoomCreateResponse

type ChatRoomCreateResponse struct {
	BasicResponse
	ChatRoom *ChatRoomInfo `json:"chatroom"`
}

type ChatRoomInfo

type ChatRoomInfo struct {
	RoomID          int64             `json:"roomid"`
	Valid           bool              `json:"valid"`
	Announcement    *string           `json:"announcement"`
	Name            string            `json:"name"`
	Broadcasturl    string            `json:"broadcasturl"`
	Ext             string            `json:"ext"`
	QueueLevel      QueueLevel        `json:"queuelevel"`
	Muted           bool              `json:"muted"`
	Creator         string            `json:"creator"`
	DelayInfo       ChatroomDelayInfo `json:"delayInfo"`
	Onlineusercount *int              `json:"onlineusercount,omitempty"`
	IOnotify        *bool             `json:"ionotify,omitempty"`
}

type ChatRoomMember added in v0.0.2

type ChatRoomMember struct {
	RoomID       int64              `json:"roomid"`
	AccID        string             `json:"accid"`
	Nick         string             `json:"nick"`
	Avator       string             `json:"avator"`
	Ext          string             `json:"ext"`
	Type         ChatRoomMemberType `json:"type"`
	Level        int                `json:"level"`
	OnlineStat   bool               `json:"onlineStat"`
	EnterTime    MillsSecond        `json:"enterTime"`
	Blacklisted  bool               `json:"blacklisted"`
	Muted        bool               `json:"muted"`
	TempMuted    bool               `json:"tempMuted"`
	TempMuteTTL  int                `json:"tempMuteTtl"`
	IsRobot      bool               `json:"isRobot"`
	RobotExpirAt int                `json:"robotExpirAt"`
}

type ChatRoomMemberQueryType added in v0.0.2

type ChatRoomMemberQueryType int
const (
	ChatRoomMemberQueryTypeDefault ChatRoomMemberQueryType = 0
	ChatRoomMemberQueryTypeTemp    ChatRoomMemberQueryType = 1
	ChatRoomMemberQueryTypeOnline  ChatRoomMemberQueryType = 2
)

type ChatRoomMemberType added in v0.0.2

type ChatRoomMemberType string
const (
	ChatRoomMemberTypeUnset     ChatRoomMemberType = "UNSET"
	ChatRoomMemberTypeLimited   ChatRoomMemberType = "LIMITED"
	ChatRoomMemberTypeCommon    ChatRoomMemberType = "COMMON"
	ChatRoomMemberTypeCreator   ChatRoomMemberType = "CREATOR"
	ChatRoomMemberTypeManager   ChatRoomMemberType = "MANAGER"
	ChatRoomMemberTypeTemporary ChatRoomMemberType = "TEMPORARY"
)

type ChatRoomMembersByPageParam added in v0.0.2

type ChatRoomMembersByPageParam struct {
	RoomID  int64                   `schema:"roomid,required"`
	Type    ChatRoomMemberQueryType `schema:"type,required"`
	EndTime MillsSecond             `schema:"endtime,required"`
	Limit   int64                   `schema:"limit,required"` // <=100
}

func (ChatRoomMembersByPageParam) GetPath added in v0.0.2

type ChatRoomMembersByPageResponse added in v0.0.2

type ChatRoomMembersByPageResponse struct {
	BasicResponse
	Desc struct {
		Data []*ChatRoomMember `json:"data"`
	} `json:"desc"`
}

type ChatRoomMsg added in v0.0.2

type ChatRoomMsg struct {
	Time             string `json:"time"`
	FromAccount      string `json:"fromAccount"`
	FromNick         string `json:"fromNick"`
	FromAvator       string `json:"fromAvator"`
	MsgIDClient      string `json:"msgid_client"`
	FromClientType   string `json:"fromClientType"`
	Attach           string `json:"attach"`
	RoomID           string `json:"roomId"`
	Type             string `json:"type"`
	Ext              string `json:"ext"`
	HighPriorityFlag int    `json:"highPriorityFlag"`
	MsgAbandonFlag   int    `json:"msgAbandonFlag"`
}

type ChatRoomRecallParam added in v0.0.2

type ChatRoomRecallParam struct {
	RoomID        int64  `schema:"roomid,required"`
	FromAccID     string `schema:"fromAcc,required"`
	MsgID         string `schema:"msgId,required"`
	OperatorAccID string `schema:"operatorAcc,required"` // 消息撤回的操作者accid
	NotifyExt     string `schema:"notifyExt"`            // json
	MsgTimetag    int64  `schema:"msgTimetag,required"`  // 被撤回消息的时间戳(单位:毫秒)
}

func (ChatRoomRecallParam) GetPath added in v0.0.2

func (ChatRoomRecallParam) GetPath() string

type ChatRoomRecallResponse added in v0.0.2

type ChatRoomRecallResponse struct {
	BasicResponse
}

type ChatRoomRequestAddrParam added in v0.0.2

type ChatRoomRequestAddrParam struct {
	RoomID     int64      `schema:"roomid,required"`
	AccID      string     `schema:"accid,required"`
	ClientType ClientType `schema:"clienttype"`
	ClientIP   string     `schema:"clientip"`
}

func (ChatRoomRequestAddrParam) GetPath added in v0.0.2

func (ChatRoomRequestAddrParam) GetPath() string

type ChatRoomRequestAddrResponse added in v0.0.2

type ChatRoomRequestAddrResponse struct {
	BasicResponse
	Addr []string `json:"addr"`
}

type ChatRoomSendMsgParam added in v0.0.2

type ChatRoomSendMsgParam struct {
	RoomID                         int64   `schema:"roomid,required"`
	MsgID                          string  `schema:"msgId,required"`
	FromAccID                      string  `schema:"fromAccid,required"`
	MsgType                        MsgType `schema:"msgType"`
	SubType                        int     `schema:"subType"`
	ResendFlag                     int     `schema:"resendFlag"`
	Attach                         string  `schema:"attach"`
	Ext                            string  `schema:"ext"`
	SkipHistory                    int     `schema:"skipHistory"`
	AbandonRatio                   int     `schema:"abandonRatio"`
	HighPriority                   bool    `schema:"highPriority"`
	NeedHighPriorityMsgResend      bool    `schema:"needHighPriorityMsgResend"`
	UseYidun                       int     `schema:"useYidun"`
	YidunAntiCheating              string  `schema:"yidunAntiCheating"`
	YidunAntiSpamExt               string  `schema:"yidunAntiSpamExt"`
	Bid                            string  `schema:"bid"`
	Antispam                       string  `schema:"antispam"`
	NotifyTargetTags               string  `schema:"notifyTargetTags"`
	AntispamCustom                 string  `schema:"antispamCustom"`
	Env                            string  `schema:"env"`
	ChatMsgPriority                int     `schema:"chatMsgPriority"`
	ForbiddenIfHighPriorityMsgFreq int     `schema:"forbiddenIfHighPriorityMsgFreq"`
	LocX                           float64 `schema:"locX"`
	LocY                           float64 `schema:"locY"`
	LocZ                           float64 `schema:"locZ"`
}

func (ChatRoomSendMsgParam) GetPath added in v0.0.2

func (ChatRoomSendMsgParam) GetPath() string

type ChatRoomSendMsgResponse added in v0.0.2

type ChatRoomSendMsgResponse struct {
	BasicResponse
	Desc *ChatRoomMsg `json:"desc"`
}

type ChatRoomSetMemberRoleBasicInfo added in v0.0.2

type ChatRoomSetMemberRoleBasicInfo struct {
	RoomID int64              `json:"roomid"`
	AccID  string             `json:"accid"`
	Type   ChatRoomMemberType `json:"type"`
	Level  int                `json:"level"`
}

type ChatRoomSetMemberRoleOptType added in v0.0.2

type ChatRoomSetMemberRoleOptType int
const (
	ChatRoomSetMemberRoleOptTypeAsAdmin ChatRoomSetMemberRoleOptType = 1
	ChatRoomSetMemberRoleOptTypeAsNomal ChatRoomSetMemberRoleOptType = 2
	ChatRoomSetMemberRoleOptTypeAsBlock ChatRoomSetMemberRoleOptType = -1
	ChatRoomSetMemberRoleOptTypeAsBan   ChatRoomSetMemberRoleOptType = -2
)

type ChatRoomSetMemberRoleParam added in v0.0.2

type ChatRoomSetMemberRoleParam struct {
	RoomID    int64                        `schema:"roomid,required"`
	Operator  string                       `schema:"operator,required"`
	Target    string                       `schema:"target,required"`
	Opt       ChatRoomSetMemberRoleOptType `schema:"opt,required"`
	OptValue  bool                         `schema:"optvalue,required"`
	NotifyExt string                       `schema:"notifyExt"` // json
}

func (ChatRoomSetMemberRoleParam) GetPath added in v0.0.2

type ChatRoomSetMemberRoleResponse added in v0.0.2

type ChatRoomSetMemberRoleResponse struct {
	BasicResponse
	Desc ChatRoomSetMemberRoleBasicInfo `json:"desc"`
}

type ChatRoomUpdateInOutNotificationParam added in v0.0.4

type ChatRoomUpdateInOutNotificationParam struct {
	RoomID int64 `schema:"roomid,required"`
	Close  bool  `schema:"close,required"`
}

func (ChatRoomUpdateInOutNotificationParam) GetPath added in v0.0.4

type ChatRoomUpdateInOutNotificationResponse added in v0.0.4

type ChatRoomUpdateInOutNotificationResponse struct {
	BasicResponse
}

type ChatroomDelayInfo

type ChatroomDelayInfo struct {
	DelayCloseEnable bool `json:"delayCloseEnable"`
	DelayClosePolicy bool `json:"delayClosePolicy"`
	DelaySeconds     bool `json:"delaySeconds"`
	Status           bool `json:"status"`
}

type ChatroomGetBatchParam added in v0.0.2

type ChatroomGetBatchParam struct {
	RoomIDs             StringSlice `schema:"roomids"`
	NeedOnlineUserCount bool        `schema:"needOnlineUserCount"`
}

func (ChatroomGetBatchParam) GetPath added in v0.0.2

func (ChatroomGetBatchParam) GetPath() string

type ChatroomGetBatchResponse added in v0.0.2

type ChatroomGetBatchResponse struct {
	BasicResponse
	NoExistRooms []int64         `json:"noExistRooms"`
	FailRooms    []int64         `json:"failRooms"`
	SuccRooms    []*ChatRoomInfo `json:"succRooms"`
}

type ChatroomGetParam added in v0.0.2

type ChatroomGetParam struct {
	RoomID              int64 `schema:"roomid"`
	NeedOnlineUserCount bool  `schema:"needOnlineUserCount"`
}

func (ChatroomGetParam) GetPath added in v0.0.2

func (ChatroomGetParam) GetPath() string

type ChatroomGetResponse added in v0.0.2

type ChatroomGetResponse struct {
	BasicResponse
	ChatRoom *ChatRoomInfo `json:"chatroom"`
}

type Client

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

func NewClient

func NewClient(appKey, appSecret string, opts ...Option) *Client

func (*Client) AddCheckSum

func (c *Client) AddCheckSum(r *http.Request)

func (*Client) AddFormBody

func (c *Client) AddFormBody(r *http.Request, v any) error

func (*Client) ChatRoomCreate

func (c *Client) ChatRoomCreate(ctx context.Context, param *ChatRoomCreateParam) (*ChatRoomCreateResponse, error)

func (*Client) ChatRoomMembersByPage added in v0.0.2

func (c *Client) ChatRoomMembersByPage(ctx context.Context, param *ChatRoomMembersByPageParam) (*ChatRoomMembersByPageResponse, error)

func (*Client) ChatRoomRecall added in v0.0.2

func (c *Client) ChatRoomRecall(ctx context.Context, param *ChatRoomRecallParam) (*ChatRoomRecallResponse, error)

func (*Client) ChatRoomRequestAddr added in v0.0.2

func (c *Client) ChatRoomRequestAddr(ctx context.Context, param *ChatRoomRequestAddrParam) (*ChatRoomRequestAddrResponse, error)

func (*Client) ChatRoomSendMsg added in v0.0.2

func (c *Client) ChatRoomSendMsg(ctx context.Context, param *ChatRoomSendMsgParam) (*ChatRoomSendMsgResponse, error)

func (*Client) ChatRoomSetMemberRole added in v0.0.2

func (c *Client) ChatRoomSetMemberRole(ctx context.Context, param *ChatRoomSetMemberRoleParam) (*ChatRoomSetMemberRoleResponse, error)

func (*Client) ChatRoomUpdateInOutNotification added in v0.0.4

func (*Client) ChatroomGet added in v0.0.2

func (c *Client) ChatroomGet(ctx context.Context, param *ChatroomGetParam) (*ChatroomGetResponse, error)

func (*Client) ChatroomGetBatch added in v0.0.2

func (c *Client) ChatroomGetBatch(ctx context.Context, param *ChatroomGetBatchParam) (*ChatroomGetBatchResponse, error)

func (*Client) FriendAdd

func (c *Client) FriendAdd(ctx context.Context, param *FriendAddParam) (*FriendAddResponse, error)

func (*Client) FriendDelete

func (c *Client) FriendDelete(ctx context.Context, param *FriendDeleteParam) (*FriendDeleteResponse, error)

func (*Client) FriendGet

func (c *Client) FriendGet(ctx context.Context, param *FriendGetParam) (*FriendGetResponse, error)

func (*Client) FriendUpdate

func (c *Client) FriendUpdate(ctx context.Context, param *FriendUpdateParam) (*FriendUpdateResponse, error)

func (*Client) GetUserInfos

func (c *Client) GetUserInfos(ctx context.Context, param *GetUserInfosParam) (*GetUserInfosResponse, error)

func (*Client) JSONResponse

func (c *Client) JSONResponse(resp *http.Response, outPtr any) error

func (*Client) MsgDelMsg added in v0.0.3

func (c *Client) MsgDelMsg(ctx context.Context, param *MsgDelMsgParam) (*MsgDelMsgResponse, error)

func (*Client) PostForm

func (c *Client) PostForm(ctx context.Context, path string, value any) (*http.Response, error)

func (*Client) SignACCIDToken

func (c *Client) SignACCIDToken(accid string, TTLSecond int) string

func (*Client) URL

func (c *Client) URL(path string) string

func (*Client) UserBlock

func (c *Client) UserBlock(ctx context.Context, param *UserBlockParam) (*UserBlockResponse, error)

func (*Client) UserCreate

func (c *Client) UserCreate(ctx context.Context, param *UserCreateParam) (*UserCreateResponse, error)

func (*Client) UserListBlackAndMuteList

func (c *Client) UserListBlackAndMuteList(ctx context.Context, param *UserListBlackAndMuteListParam) (*UserListBlackAndMuteListResponse, error)

func (*Client) UserMute

func (c *Client) UserMute(ctx context.Context, param *UserMuteParam) (*UserMuteResponse, error)

func (*Client) UserRefreshToken

func (c *Client) UserRefreshToken(ctx context.Context, param *UserRefreshTokenParam) (*UserRefreshTokenResponse, error)

func (*Client) UserSetDonnop

func (c *Client) UserSetDonnop(ctx context.Context, param *UserSetDonnopParam) (*UserSetDonnopResponse, error)

func (*Client) UserSetSpecialRelation

func (c *Client) UserSetSpecialRelation(ctx context.Context, param *UserSetSpecialRelationParam) (*UserSetSpecialRelationResponse, error)

func (*Client) UserUnBlock

func (c *Client) UserUnBlock(ctx context.Context, param *UserUnBlockParam) (*UserUnBlockResponse, error)

func (*Client) UserUpdate

func (c *Client) UserUpdate(ctx context.Context, param *UserUpdateParam) (*UserUpdateResponse, error)

func (*Client) UserUpdateUserInfo

func (c *Client) UserUpdateUserInfo(ctx context.Context, param *UserUpdateUserInfoParam) (*UserUpdateUserInfoResponse, error)

type ClientType added in v0.0.2

type ClientType int

type CreateUserInfo

type CreateUserInfo struct {
	AccID string `json:"accid"`
	Token string `json:"token"`
	Name  string `json:"name"`
}

type DelayClosePolicy

type DelayClosePolicy int
const (
	DelayClosePolicyNever         DelayClosePolicy = 0 // 不开启定时关闭
	DelayClosePolicyByTime        DelayClosePolicy = 1 // 固定时间关闭
	DelayClosePolicyOnEmptyByTime DelayClosePolicy = 2 // 空闲关闭(等聊天室中没有用户后固定时间关闭)
)

type DeleteMsgType added in v0.0.3

type DeleteMsgType int
const (
	DeleteMsgTypeSingle DeleteMsgType = 7
	DeleteMsgTypeTeam   DeleteMsgType = 8
)

type FriendAddParam

type FriendAddParam struct {
	AccID    string        `schema:"accid,required"`
	FAccID   string        `schema:"faccid,required"`
	Type     FriendAddType `schema:"type,required"`
	Msg      string        `schema:"msg"`
	ServerEx string        `schema:"serverex"`
}

func (FriendAddParam) GetPath

func (FriendAddParam) GetPath() string

type FriendAddResponse

type FriendAddResponse struct {
	BasicResponse
}

type FriendAddType

type FriendAddType int
const (
	FriendAddDirect  FriendAddType = 1
	FriendAddRequest FriendAddType = 2
	FriendAddApprove FriendAddType = 3
	FriendAddReject  FriendAddType = 4
)

1直接加好友,2请求加好友,3同意加好友,4拒绝加好友

type FriendDeleteParam

type FriendDeleteParam struct {
	AccID         string `schema:"accid,required"`
	FAccID        string `schema:"faccid,required"`
	IsDeleteAlias bool   `schema:"isDeleteAlias"`
}

func (FriendDeleteParam) GetPath

func (FriendDeleteParam) GetPath() string

type FriendDeleteResponse

type FriendDeleteResponse struct {
	BasicResponse
}

type FriendGetParam

type FriendGetParam struct {
	AccID      string `schema:"accid,required"`
	UpdateTime int64  `schema:"updatetime,required"` // 毫秒
}

func (FriendGetParam) GetPath

func (FriendGetParam) GetPath() string

type FriendGetResponse

type FriendGetResponse struct {
	BasicResponse
	Friends []*FriendInfo `json:"friends"`
}

type FriendInfo

type FriendInfo struct {
	FAccID      string `json:"faccid"`
	CreateTime  int64  `json:"createtime"`
	BiDirection bool   `json:"bidirection"`
	Alias       string `json:"alias"`
}

type FriendUpdateParam

type FriendUpdateParam struct {
	AccID    string `schema:"accid,required"`
	FAccID   string `schema:"faccid,required"`
	Alias    string `schema:"alias"`
	Ex       string `schema:"ex"`
	ServerEx string `schema:"serverex"`
}

func (FriendUpdateParam) GetPath

func (FriendUpdateParam) GetPath() string

type FriendUpdateResponse

type FriendUpdateResponse struct {
	BasicResponse
}

type GetUserInfosParam

type GetUserInfosParam struct {
	Accids StringSlice `schema:"accids,required"`
}

func (GetUserInfosParam) GetPath

func (GetUserInfosParam) GetPath() string

type GetUserInfosResponse

type GetUserInfosResponse struct {
	BasicResponse
	Uinfos []*UserInfo `json:"uinfos"`
}

type Logger added in v0.0.3

type Logger interface {
	Info(args ...interface{})
	Error(args ...interface{})
}

type MillsSecond added in v0.0.2

type MillsSecond int64

func NewMillsSecond added in v0.0.2

func NewMillsSecond(t time.Time) MillsSecond

func (MillsSecond) ToTime added in v0.0.2

func (t MillsSecond) ToTime() time.Time

type MsgDelMsgParam added in v0.0.3

type MsgDelMsgParam struct {
	DeleteMsgID string        `schema:"deleteMsgid,required"`
	TimeTag     int64         `schema:"timetag,required"`
	Type        DeleteMsgType `schema:"type,required"`
	From        string        `schema:"from,required"`
	To          string        `schema:"to,required"`
}

func (MsgDelMsgParam) GetPath added in v0.0.3

func (MsgDelMsgParam) GetPath() string

type MsgDelMsgResponse added in v0.0.3

type MsgDelMsgResponse struct {
	BasicResponse
}

type MsgType added in v0.0.2

type MsgType int
const (
	MsgTypeText   MsgType = 0
	MsgTypePic    MsgType = 1
	MsgTypeAudio  MsgType = 2
	MsgTypeVideo  MsgType = 3
	MsgTypeLoc    MsgType = 4
	MsgTypeFile   MsgType = 6
	MsgTypeTips   MsgType = 10
	MsgTypeCustom MsgType = 100
)

type Option

type Option func(c *Client)

func WithEncoder

func WithEncoder(encoder *schema.Encoder) Option

func WithHTTPClient

func WithHTTPClient(h *http.Client) Option

func WithHost

func WithHost(host string) Option

func WithLogger added in v0.0.3

func WithLogger(logger Logger) Option

type Param

type Param interface {
	GetPath() string
}

type QueueLevel

type QueueLevel int
const (
	QueueLevelAny       QueueLevel = 0
	QueueLevelOnlyAdmin QueueLevel = 1
)

type RawBodyModel

type RawBodyModel struct {
	RawBody string `json:"-"`
}

func (*RawBodyModel) SetRawBody

func (r *RawBodyModel) SetRawBody(raw []byte)

type RefreshTokenInfo

type RefreshTokenInfo struct {
	AccID string `json:"accid"`
	Token string `json:"token"`
}

type RelationType

type RelationType int
const (
	RelationTypeBlack RelationType = 1
	RelationTypeMute  RelationType = 2
)

1:黑名单操作,2:静音列表操作

type StringSlice

type StringSlice []string

type UserBlockParam

type UserBlockParam struct {
	AccID         string `schema:"accid,required"`
	Needkick      bool   `schema:"needkick"`
	KickNotifyExt string `schema:"kickNotifyExt"`
}

func (UserBlockParam) GetPath

func (UserBlockParam) GetPath() string

type UserBlockResponse

type UserBlockResponse struct {
	BasicResponse
}

type UserCreateParam

type UserCreateParam struct {
	AccID  string `schema:"accid,required"`
	Name   string `schema:"name"`
	Icon   string `schema:"icon"`
	Token  string `schema:"token"`
	Sign   string `schema:"sign"` // 用户签名
	Email  string `schema:"email"`
	Birth  string `schema:"birth"`
	Mobile string `schema:"mobile"`
	Gender int    `schema:"gender"`
	Ex     string `schema:"ex"`
	Bid    string `schema:"bid"`
}

func (UserCreateParam) GetPath

func (UserCreateParam) GetPath() string

type UserCreateResponse

type UserCreateResponse struct {
	BasicResponse
	Info *CreateUserInfo `json:"info"`
}

type UserInfo

type UserInfo struct {
	AccID  string `json:"accid"`
	Name   string `json:"name"`
	Icon   string `json:"icon"`
	Sign   string `json:"sign"` // 用户签名
	Email  string `json:"email"`
	Birth  string `json:"birth"`
	Mobile string `json:"mobile"`
	Ex     string `json:"ex"`
	Gender int    `json:"gender"`
	Valid  bool   `json:"valid"`
	Mute   bool   `json:"mute"`
}

type UserListBlackAndMuteListParam

type UserListBlackAndMuteListParam struct {
	AccID string `schema:"accid,required"`
}

func (UserListBlackAndMuteListParam) GetPath

type UserListBlackAndMuteListResponse

type UserListBlackAndMuteListResponse struct {
	BasicResponse
	BlackList []string `json:"blacklist"`
	MuteList  []string `json:"mutelist"`
}

type UserMuteParam

type UserMuteParam struct {
	AccID string `schema:"accid,required"`
	Mute  bool   `schema:"mute,required"`
}

func (UserMuteParam) GetPath

func (UserMuteParam) GetPath() string

type UserMuteResponse

type UserMuteResponse struct {
	BasicResponse
}

type UserRefreshTokenParam

type UserRefreshTokenParam struct {
	AccID string `schema:"accid,required"`
}

func (UserRefreshTokenParam) GetPath

func (UserRefreshTokenParam) GetPath() string

type UserRefreshTokenResponse

type UserRefreshTokenResponse struct {
	BasicResponse
	Info *RefreshTokenInfo `json:"info"`
}

type UserSetDonnopParam

type UserSetDonnopParam struct {
	AccID      string `schema:"accid,required"`
	DonnopOpen bool   `schema:"donnopOpen,required"`
}

func (UserSetDonnopParam) GetPath

func (UserSetDonnopParam) GetPath() string

type UserSetDonnopResponse

type UserSetDonnopResponse struct {
	BasicResponse
}

type UserSetSpecialRelationParam

type UserSetSpecialRelationParam struct {
	AccID        string       `schema:"accid,required"`
	TargetAcc    string       `schema:"targetAcc,required"`
	RelationType RelationType `schema:"relationType,required"`
	Value        int          `schema:"value,required"` // 0:取消,1:加入
}

func (UserSetSpecialRelationParam) GetPath

type UserSetSpecialRelationResponse

type UserSetSpecialRelationResponse struct {
	BasicResponse
}

type UserUnBlockParam

type UserUnBlockParam struct {
	AccID string `schema:"accid,required"`
}

func (UserUnBlockParam) GetPath

func (UserUnBlockParam) GetPath() string

type UserUnBlockResponse

type UserUnBlockResponse struct {
	BasicResponse
}

type UserUpdateParam

type UserUpdateParam struct {
	AccID string `schema:"accid,required"`
	Token string `schema:"token"`
}

func (UserUpdateParam) GetPath

func (UserUpdateParam) GetPath() string

type UserUpdateResponse

type UserUpdateResponse struct {
	BasicResponse
}

type UserUpdateUserInfoParam

type UserUpdateUserInfoParam struct {
	AccID  string `schema:"accid,required"`
	Name   string `schema:"name"`
	Icon   string `schema:"icon"`
	Sign   string `schema:"sign"` // 用户签名
	Email  string `schema:"email"`
	Birth  string `schema:"birth"`
	Mobile string `schema:"mobile"`
	Gender int    `schema:"gender"`
	Ex     string `schema:"ex"`
	Bid    string `schema:"bid"` // 反垃圾业务ID,JSON字符串,{"textbid":"","picbid":""}
}

func (UserUpdateUserInfoParam) GetPath

func (UserUpdateUserInfoParam) GetPath() string

type UserUpdateUserInfoResponse

type UserUpdateUserInfoResponse struct {
	BasicResponse
}

type WithRawBody

type WithRawBody interface {
	SetRawBody(raw []byte)
}

type YunxinError added in v0.0.2

type YunxinError struct {
	BasicResponse
}

func (*YunxinError) Error added in v0.0.4

func (y *YunxinError) Error() string

Directories

Path Synopsis
example

Jump to

Keyboard shortcuts

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