Implement support for new member role endpoint (#289)
Implements support for the new member role add and delete endpoint hammerandchisel/discord-api-docs#179
This commit is contained in:
parent
315ae45231
commit
2092185ec5
3 changed files with 24 additions and 0 deletions
|
@ -62,6 +62,7 @@ var (
|
||||||
EndpointGuildChannels = func(gID string) string { return EndpointGuilds + gID + "/channels" }
|
EndpointGuildChannels = func(gID string) string { return EndpointGuilds + gID + "/channels" }
|
||||||
EndpointGuildMembers = func(gID string) string { return EndpointGuilds + gID + "/members" }
|
EndpointGuildMembers = func(gID string) string { return EndpointGuilds + gID + "/members" }
|
||||||
EndpointGuildMember = func(gID, uID string) string { return EndpointGuilds + gID + "/members/" + uID }
|
EndpointGuildMember = func(gID, uID string) string { return EndpointGuilds + gID + "/members/" + uID }
|
||||||
|
EndpointGuildMemberRole = func(gID, uID, rID string) string { return EndpointGuilds + gID + "/members/" + uID + "/roles/" + rID }
|
||||||
EndpointGuildBans = func(gID string) string { return EndpointGuilds + gID + "/bans" }
|
EndpointGuildBans = func(gID string) string { return EndpointGuilds + gID + "/bans" }
|
||||||
EndpointGuildBan = func(gID, uID string) string { return EndpointGuilds + gID + "/bans/" + uID }
|
EndpointGuildBan = func(gID, uID string) string { return EndpointGuilds + gID + "/bans/" + uID }
|
||||||
EndpointGuildIntegrations = func(gID string) string { return EndpointGuilds + gID + "/integrations" }
|
EndpointGuildIntegrations = func(gID string) string { return EndpointGuilds + gID + "/integrations" }
|
||||||
|
|
22
restapi.go
22
restapi.go
|
@ -732,6 +732,28 @@ func (s *Session) GuildMemberNickname(guildID, userID, nickname string) (err err
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GuildMemberRoleAdd adds the specified role to a given member
|
||||||
|
// guildID : The ID of a Guild.
|
||||||
|
// userID : The ID of a User.
|
||||||
|
// roleID : The ID of a Role to be assigned to the user.
|
||||||
|
func (s *Session) GuildMemberRoleAdd(guildID, userID, roleID string) (err error) {
|
||||||
|
|
||||||
|
_, err = s.RequestWithBucketID("PUT", EndpointGuildMemberRole(guildID, userID, roleID), nil, EndpointGuildMemberRole(guildID, userID, roleID))
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// GuildMemberRoleRemove removes the specified role to a given member
|
||||||
|
// guildID : The ID of a Guild.
|
||||||
|
// userID : The ID of a User.
|
||||||
|
// roleID : The ID of a Role to be removed from the user.
|
||||||
|
func (s *Session) GuildMemberRoleRemove(guildID, userID, roleID string) (err error) {
|
||||||
|
|
||||||
|
_, err = s.RequestWithBucketID("DELETE", EndpointGuildMemberRole(guildID, userID, roleID), nil, EndpointGuildMemberRole(guildID, userID, roleID))
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// GuildChannels returns an array of Channel structures for all channels of a
|
// GuildChannels returns an array of Channel structures for all channels of a
|
||||||
// given guild.
|
// given guild.
|
||||||
// guildID : The ID of a Guild.
|
// guildID : The ID of a Guild.
|
||||||
|
|
|
@ -291,6 +291,7 @@ type Game struct {
|
||||||
URL string `json:"url"`
|
URL string `json:"url"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// UnmarshalJSON unmarshals json to Game struct
|
||||||
func (g *Game) UnmarshalJSON(bytes []byte) error {
|
func (g *Game) UnmarshalJSON(bytes []byte) error {
|
||||||
temp := &struct {
|
temp := &struct {
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
|
|
Loading…
Reference in a new issue