-
Notifications
You must be signed in to change notification settings - Fork 245
/
import_discord_channel.go
41 lines (33 loc) · 1.19 KB
/
import_discord_channel.go
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
34
35
36
37
38
39
40
41
package requests
import (
"errors"
"github.com/status-im/status-go/eth-node/types"
)
// errrors
var (
ErrImportDiscordChannelMissingFilesToImport = errors.New("import-discord-channel: missing files to import")
ErrImportDiscordChannelChannelIDIsEmpty = errors.New("import-discord-channel: discord channel id is empty")
ErrImportDiscordChannelCommunityIDIsEmpty = errors.New("import-discord-channel: community id is empty")
)
type ImportDiscordChannel struct {
Name string `json:"name"`
DiscordChannelID string `json:"discordChannelID"`
CommunityID types.HexBytes `json:"communityId"`
Description string `json:"description"`
Color string `json:"color"`
Emoji string `json:"emoji"`
FilesToImport []string `json:"filesToImport"`
From int64 `json:"from"`
}
func (r *ImportDiscordChannel) Validate() error {
if len(r.FilesToImport) == 0 {
return ErrImportDiscordChannelMissingFilesToImport
}
if len(r.DiscordChannelID) == 0 {
return ErrImportDiscordChannelChannelIDIsEmpty
}
if len(r.CommunityID) == 0 {
return ErrImportDiscordChannelCommunityIDIsEmpty
}
return nil
}