From 56f760154752efb61d5dc4f33660afcced7fc2c5 Mon Sep 17 00:00:00 2001 From: mavolin <48887425+mavolin@users.noreply.github.com> Date: Tue, 12 May 2020 04:57:43 +0200 Subject: [PATCH 1/2] API: implement #47 --- api/invite.go | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/api/invite.go b/api/invite.go index cf7c536..df66854 100644 --- a/api/invite.go +++ b/api/invite.go @@ -9,12 +9,28 @@ import ( var EndpointInvites = Endpoint + "invites/" // Invite returns an invite object for the given code. +// +// ApproxMembers will not get filled. func (c *Client) Invite(code string) (*discord.Invite, error) { + var params struct { + WithCounts bool `schema:"with_counts"` + } + + params.WithCounts = false + + var inv *discord.Invite + return inv, c.RequestJSON( + &inv, "GET", + EndpointInvites+code, + ) +} + +// Invite returns an invite object for the given code and fills ApproxMembers. +func (c *Client) InviteWithCounts(code string) (*discord.Invite, error) { var params struct { WithCounts bool `schema:"with_counts,omitempty"` } - // Nothing says I can't! params.WithCounts = true var inv *discord.Invite From 31a96c888f86f0ab965769d876d63636879b1419 Mon Sep 17 00:00:00 2001 From: mavolin <48887425+mavolin@users.noreply.github.com> Date: Tue, 12 May 2020 05:08:55 +0200 Subject: [PATCH 2/2] API: remove params --- api/invite.go | 6 ------ 1 file changed, 6 deletions(-) diff --git a/api/invite.go b/api/invite.go index df66854..2d59eb1 100644 --- a/api/invite.go +++ b/api/invite.go @@ -12,12 +12,6 @@ var EndpointInvites = Endpoint + "invites/" // // ApproxMembers will not get filled. func (c *Client) Invite(code string) (*discord.Invite, error) { - var params struct { - WithCounts bool `schema:"with_counts"` - } - - params.WithCounts = false - var inv *discord.Invite return inv, c.RequestJSON( &inv, "GET",