forked from NdoleStudio/httpsms
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathguild_service.go
More file actions
33 lines (27 loc) · 797 Bytes
/
Copy pathguild_service.go
File metadata and controls
33 lines (27 loc) · 797 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package discord
import (
"context"
"encoding/json"
"fmt"
"net/http"
)
// GuildService is the API client for interacting with guilds
type GuildService service
// Get the guild object for the given id.
//
// API Docs: https://discord.com/developers/docs/resources/guild#get-guild
func (service *GuildService) Get(ctx context.Context, guildID string) (*map[string]any, *Response, error) {
request, err := service.client.newRequest(ctx, http.MethodGet, fmt.Sprintf("/guilds/%s", guildID), nil)
if err != nil {
return nil, nil, err
}
response, err := service.client.do(request)
if err != nil {
return nil, response, err
}
channel := new(map[string]any)
if err = json.Unmarshal(*response.Body, channel); err != nil {
return nil, response, err
}
return channel, response, nil
}