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

Support new GuildMember endpoints. #114

Merged
merged 3 commits into from
Feb 19, 2016
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 endpoints.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ var (
GUILD = func(gID string) string { return GUILDS + gID }
GUILD_INIVTES = func(gID string) string { return GUILDS + gID + "/invites" }
GUILD_CHANNELS = func(gID string) string { return GUILDS + gID + "/channels" }
GUILD_MEMBERS = func(gID string) string { return GUILDS + gID + "/members" }
GUILD_MEMBER = func(gID, uID string) string { return GUILDS + gID + "/members/" + uID }
GUILD_BANS = func(gID string) string { return GUILDS + gID + "/bans" }
GUILD_BAN = func(gID, uID string) string { return GUILDS + gID + "/bans/" + uID }
Expand Down
27 changes: 27 additions & 0 deletions restapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,33 @@ func (s *Session) GuildBanDelete(guildID, userID string) (err error) {
return
}

// GuildMembers returns a list of members for a guild.
// guildID : The ID of a Guild.
func (s *Session) GuildMembers(guildID string) (st []*Member, err error) {

body, err := s.Request("GET", GUILD_MEMBERS(guildID), nil)
if err != nil {
return
}

err = unmarshal(body, &st)
return
}

// GuildMember returns a members of a guild.
// guildID : The ID of a Guild.
// userID : The ID of a User
func (s *Session) GuildMember(guildID, userID string) (st *Member, err error) {

body, err := s.Request("GET", GUILD_MEMBER(guildID, userID), nil)
if err != nil {
return
}

err = unmarshal(body, &st)
return
}

// GuildMemberDelete removes the given user from the given guild.
// guildID : The ID of a Guild.
// userID : The ID of a User
Expand Down