Skip to content

Commit f85f12c

Browse files
committedNov 3, 2021
gateway endpoint support
1 parent bde8f23 commit f85f12c

File tree

4 files changed

+40
-1
lines changed

4 files changed

+40
-1
lines changed
 

‎constants.go

+4
Original file line numberDiff line numberDiff line change
@@ -107,4 +107,8 @@ const (
107107
// Permissions
108108
GuildApplicationCommandsPermissionsFmt = GuildApplicationsFmt + "/permissions"
109109
GuildApplicationCommandPermissionsFmt = GuildApplicationsFmt + "/%d/permissions"
110+
111+
// Gateway
112+
GatewayFmt = BaseURL + "/gateway"
113+
GatewayBotFmt = GatewayFmt + "/bot"
110114
)

‎gateway.go

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
package rest
2+
3+
import (
4+
"net/http"
5+
6+
"github.com/Postcord/objects"
7+
)
8+
9+
func (c *Client) Gateway() (*objects.Gateway, error) {
10+
var gateway objects.Gateway
11+
err := NewRequest().
12+
Method(http.MethodGet).
13+
Path(GatewayFmt).
14+
ContentType(JsonContentType).
15+
Expect(http.StatusOK).
16+
Bind(&gateway).
17+
Send(c)
18+
19+
return &gateway, err
20+
}
21+
22+
func (c *Client) GatewayBot() (*objects.Gateway, error) {
23+
var gateway objects.Gateway
24+
err := NewRequest().
25+
Method(http.MethodGet).
26+
Path(GatewayBotFmt).
27+
ContentType(JsonContentType).
28+
Expect(http.StatusOK).
29+
Bind(&gateway).
30+
Send(c)
31+
32+
return &gateway, err
33+
}

‎go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module github.com/Postcord/rest
33
go 1.14
44

55
require (
6-
github.com/Postcord/objects v0.0.17
6+
github.com/Postcord/objects v0.0.18
77
github.com/go-redis/redis/v8 v8.11.4
88
github.com/go-redsync/redsync/v4 v4.4.2
99
github.com/google/go-querystring v1.1.0

‎go.sum

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ github.com/Postcord/objects v0.0.16 h1:rPIPg+gKw1TxPkvY/7iBRH89+Ei5o3M/Da+sKdUF9
22
github.com/Postcord/objects v0.0.16/go.mod h1:DdFNHjas9Xby/YNGwr5XWuD+8kyNvGmtozW4LiF3QF8=
33
github.com/Postcord/objects v0.0.17 h1:S2Smapxv9da1hccKgTblXmVHGtuP1slXEZsrhVFivas=
44
github.com/Postcord/objects v0.0.17/go.mod h1:DdFNHjas9Xby/YNGwr5XWuD+8kyNvGmtozW4LiF3QF8=
5+
github.com/Postcord/objects v0.0.18 h1:BFxlpJK7/mCcCUPPDz/OPgehpLwr6pym+Mi7fmqkGXA=
6+
github.com/Postcord/objects v0.0.18/go.mod h1:DdFNHjas9Xby/YNGwr5XWuD+8kyNvGmtozW4LiF3QF8=
57
github.com/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE=
68
github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
79
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=

0 commit comments

Comments
 (0)