-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathsensitive.go
More file actions
41 lines (34 loc) · 1.26 KB
/
Copy pathsensitive.go
File metadata and controls
41 lines (34 loc) · 1.26 KB
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 juggleimsdk
import (
"fmt"
"net/http"
)
type SensitiveWord struct {
Id string `json:"id"`
Word string `json:"word"`
WordType int `json:"word_type"`
}
type SensitiveWords struct {
Items []*SensitiveWord `json:"items"`
Total int32 `json:"total"`
IsFinished bool `json:"is_finished"`
}
type DelSensitiveWordsReq struct {
Words []string `json:"words"`
}
func (sdk *JuggleIMSdk) QrySensitiveWords(size, page int, word string, wordType int) (*SensitiveWords, ApiCode, string, error) {
urlPath := fmt.Sprintf("/apigateway/sensitivewords/list?size=%d&page=%d&word=%s&word_type=%d", size, page, word, wordType)
resp := &SensitiveWords{}
code, traceId, err := sdk.HttpCall(http.MethodGet, urlPath, nil, resp)
return resp, code, traceId, err
}
func (sdk *JuggleIMSdk) AddSensitiveWords(words SensitiveWords) (ApiCode, string, error) {
urlPath := "/apigateway/sensitivewords/add"
code, traceId, err := sdk.HttpCall(http.MethodPost, urlPath, words, nil)
return code, traceId, err
}
func (sdk *JuggleIMSdk) DeleteSensitiveWords(req DelSensitiveWordsReq) (ApiCode, string, error) {
urlPath := "/apigateway/sensitivewords/del"
code, traceId, err := sdk.HttpCall(http.MethodPost, urlPath, req, nil)
return code, traceId, err
}