Merge pull request #552 from Seklfreak/add-get-invite-with-count
adds InviteWithCounts
This commit is contained in:
commit
ab79149c74
2 changed files with 17 additions and 0 deletions
13
restapi.go
13
restapi.go
|
@ -1717,6 +1717,19 @@ func (s *Session) Invite(inviteID string) (st *Invite, err error) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// InviteWithCounts returns an Invite structure of the given invite including approximate member counts
|
||||||
|
// inviteID : The invite code
|
||||||
|
func (s *Session) InviteWithCounts(inviteID string) (st *Invite, err error) {
|
||||||
|
|
||||||
|
body, err := s.RequestWithBucketID("GET", EndpointInvite(inviteID)+"?with_counts=true", nil, EndpointInvite(""))
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
err = unmarshal(body, &st)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// InviteDelete deletes an existing invite
|
// InviteDelete deletes an existing invite
|
||||||
// inviteID : the code of an invite
|
// inviteID : the code of an invite
|
||||||
func (s *Session) InviteDelete(inviteID string) (st *Invite, err error) {
|
func (s *Session) InviteDelete(inviteID string) (st *Invite, err error) {
|
||||||
|
|
|
@ -177,6 +177,10 @@ type Invite struct {
|
||||||
Revoked bool `json:"revoked"`
|
Revoked bool `json:"revoked"`
|
||||||
Temporary bool `json:"temporary"`
|
Temporary bool `json:"temporary"`
|
||||||
Unique bool `json:"unique"`
|
Unique bool `json:"unique"`
|
||||||
|
|
||||||
|
// will only be filled when using InviteWithCounts
|
||||||
|
ApproximatePresenceCount int `json:"approximate_presence_count"`
|
||||||
|
ApproximateMemberCount int `json:"approximate_member_count"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// ChannelType is the type of a Channel
|
// ChannelType is the type of a Channel
|
||||||
|
|
Loading…
Reference in a new issue