im.go
1.1 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
42
43
44
45
46
47
48
49
50
51
52
53
54
package im
import (
"encoding/json"
"gitlab.fjmaimaimai.com/mmm-go/partner/pkg/constant"
)
func init() {
InitImClient(constant.IM_SERVICE_ADDRESS, constant.IM_APP_KEY, constant.IM_APP_SECRET)
}
type RequestParam interface {
Format() map[string]string
GetPath() string
Valid() error
}
//接口
func CallCreate(v UserCreate) (*UserTokenResult, error) {
var result UserTokenResult
btData, err := DefaultImClient.Call(v)
if err != nil {
return nil, err
}
err = json.Unmarshal(btData, &result)
if err != nil {
return nil, err
}
return &result, nil
}
func CallRefreshToken(v UserRefreshToken) (*UserTokenResult, error) {
var result UserTokenResult
btData, err := DefaultImClient.Call(v)
if err != nil {
return nil, err
}
err = json.Unmarshal(btData, &result)
if err != nil {
return nil, err
}
return &result, nil
}
func CallUpdate(v UserUpdate) (*BaseResp, error) {
var result BaseResp
btData, err := DefaultImClient.Call(v)
if err != nil {
return nil, err
}
err = json.Unmarshal(btData, &result)
if err != nil {
return nil, err
}
return &result, nil
}