-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcomplain.go
88 lines (74 loc) · 2.08 KB
/
complain.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
87
88
package go_ts3
// complainadd `manage_scope, write_scope`
type complainAddRequest struct {
TargetClientDbId int `schema:"tcldbid"`
Message string `schema:"message"`
}
func (c *TeamspeakHttpClient) ComplainAdd(targetClientDbId int, message string) error {
return c.requestWithParams(
"complainadd",
complainAddRequest{
TargetClientDbId: targetClientDbId,
Message: message,
},
nil,
)
}
// complaindel `manage_scope, write_scope`
type complainDeleteRequest struct {
TargetClientDbId int `schema:"tcldbid"`
SenderClientDbId int `schema:"fcldbid"`
}
func (c *TeamspeakHttpClient) ComplainDelete(targetClientDbId int, senderClientDbId int) error {
return c.requestWithParams(
"complaindel",
complainDeleteRequest{
TargetClientDbId: targetClientDbId,
SenderClientDbId: senderClientDbId,
},
nil,
)
}
// complaindelall `manage_scope, write_scope`
type complainDeleteAllRequest struct {
TargetClientDbId int `schema:"tcldbid"`
}
func (c *TeamspeakHttpClient) ComplainDeleteAll(targetClientDbId int) error {
return c.requestWithParams(
"complaindelall",
complainDeleteAllRequest{TargetClientDbId: targetClientDbId},
nil,
)
}
// complainlist `manage_scope, write_scope, read_scope`
type Complain struct {
SenderClientDbId string `json:"fcldbid"`
SenderName string `json:"fname"`
Message string `json:"message"`
Timestamp string `json:"timestamp"`
TargetClientDbId string `json:"tcldbid"`
TargetName string `json:"tname"`
}
func (c *TeamspeakHttpClient) ComplainList() (*[]Complain, error) {
var complains []Complain
err := c.request("complainlist", &complains)
if err != nil {
return nil, err
}
return &complains, err
}
type complainListByTargetRequest struct {
TargetClientDbId int `schema:"tcldbid"`
}
func (c *TeamspeakHttpClient) ComplainListByTarget(targetClientDbId int) (*[]Complain, error) {
var complains []Complain
err := c.requestWithParams(
"complainlist",
complainListByTargetRequest{TargetClientDbId: targetClientDbId},
&complains,
)
if err != nil {
return nil, err
}
return &complains, err
}