本文整理汇总了Golang中github.com/matrix-org/bullettime/matrix/types.MembershipEventContent.Membership方法的典型用法代码示例。如果您正苦于以下问题:Golang MembershipEventContent.Membership方法的具体用法?Golang MembershipEventContent.Membership怎么用?Golang MembershipEventContent.Membership使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/matrix-org/bullettime/matrix/types.MembershipEventContent
的用法示例。
在下文中一共展示了MembershipEventContent.Membership方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: doWildcardJoin
func (e roomsEndpoint) doWildcardJoin(req *http.Request, params httprouter.Params) interface{} {
user, err := readAccessToken(e.userService, e.tokenService, req)
if err != nil {
return err
}
roomIdOrAlias := params[0].Value
room, parseErr := ct.ParseRoomId(roomIdOrAlias)
if parseErr != nil {
alias, parseErr := ct.ParseAlias(roomIdOrAlias)
if parseErr != nil {
return types.BadParamError("invalid room id or alias: " + roomIdOrAlias)
}
room, err = e.roomService.LookupAlias(alias)
if err != nil {
return err
}
}
content := types.MembershipEventContent{}
content.Membership = types.MembershipMember
_, err = e.roomService.SetState(room, user, &content, user.String())
if err != nil {
return err
}
return struct{}{}
}
示例2: doLeave
func (e roomsEndpoint) doLeave(req *http.Request, params httprouter.Params) interface{} {
room, user, err := e.getRoomAndUser(req, params)
if err != nil {
return err
}
content := types.MembershipEventContent{}
content.Membership = types.MembershipLeaving
state, err := e.roomService.SetState(room, user, &content, user.String())
if err != nil {
return err
}
return eventIdResponse{state.EventId}
}