-
Notifications
You must be signed in to change notification settings - Fork 1
/
ban.go
86 lines (74 loc) · 2.19 KB
/
ban.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
package go_ts3
// banadd `manage_scope, write_scope`
type BanAddRequest struct {
IP string `schema:"ip,omitempty"`
Name string `schema:"name,omitempty"`
UID string `schema:"uid,omitempty"`
MyTsID string `schema:"mytsid,omitempty"`
Time int `schema:"time,omitempty"`
BanReason string `schema:"banreason,omitempty"`
LastNickname string `schema:"lastnickname,omitempty"`
}
func (c *TeamspeakHttpClient) BanAdd(request BanAddRequest) error {
return c.requestWithParams(
"banadd",
request,
nil,
)
}
// banclient `manage_scope, write_scope`
type BanClientRequest struct {
ClientId int `schema:"clid,required"`
Time int `schema:"time,omitempty"`
BanReason string `schema:"banreason,omitempty"`
}
func (c *TeamspeakHttpClient) BanClient(request BanClientRequest) error {
return c.requestWithParams(
"banclient",
request,
nil,
)
}
// bandel `manage_scope, write_scope`
type banDeleteRequest struct {
BanId int `schema:"banid"`
}
func (c *TeamspeakHttpClient) BanDelete(banId int) error {
return c.requestWithParams(
"bandel",
banDeleteRequest{BanId: banId},
nil,
)
}
// bandelall `manage_scope, write_scope`
func (c *TeamspeakHttpClient) BanDeleteAll() error {
return c.request("bandelall", nil)
}
// banlist `manage_scope, write_scope, read_scope`
type Ban struct {
BanId string `json:"banid"`
Created string `json:"created"`
Duration string `json:"duration"`
Enforcements string `json:"enforcements"`
InvokerClientDbId string `json:"invokercldbid"`
InvokerName string `json:"invokername"`
InvokerUID string `json:"invokeruid"`
IP string `json:"ip"`
LastNickname string `json:"lastnickname"`
Mytsid string `json:"mytsid"`
Name string `json:"name"`
Reason string `json:"reason"`
UID string `json:"uid"`
}
type BanListRequest struct {
Start int `schema:"start"`
Duration int `schema:"duration"`
}
func (c *TeamspeakHttpClient) BanList(request BanListRequest) (*[]Ban, error) {
var bans []Ban
err := c.requestWithParams("banlist", request, &bans)
if err != nil {
return nil, err
}
return &bans, nil
}