Debian Codegraph @

emoji.go

raw symbols SCIP
1 package slack
2
3 import (
4 "context"
5 "net/url"
6 )
7
8 type emojiResponseFull struct {
9 Emoji map[string]string `json:"emoji"`
10 SlackResponse
11 }
12
13 // GetEmoji retrieves all the emojis
14 func (api *Client) GetEmoji() (map[string]string, error) {
15 return api.GetEmojiContext(context.Background())
16 }
17
18 // GetEmojiContext retrieves all the emojis with a custom context
19 func (api *Client) GetEmojiContext(ctx context.Context) (map[string]string, error) {
20 values := url.Values{
21 "token": {api.token},
22 }
23 response := &emojiResponseFull{}
24
25 err := api.postMethod(ctx, "emoji.list", values, response)
26 if err != nil {
27 return nil, err
28 }
29
30 if response.Err() != nil {
31 return nil, response.Err()
32 }
33
34 return response.Emoji, nil
35 }