-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontacts.go
More file actions
97 lines (87 loc) · 3.68 KB
/
Copy pathcontacts.go
File metadata and controls
97 lines (87 loc) · 3.68 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
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
89
90
91
92
93
94
95
96
97
package uimserver
import "context"
type Contact struct {
Id string `json:"id"`
AccountId string `json:"accountId"`
UserId string `json:"userId"`
Nickname string `json:"nickname"`
Avatar string `json:"avatar"`
Gender int32 `json:"gender"`
Mobile string `json:"mobile"`
Country string `json:"country"`
State string `json:"state"`
City string `json:"city"`
Signature string `json:"signature"`
Alias string `json:"alias"`
Tags []string `json:"tags"`
Source string `json:"source"`
IsBlackListed bool `json:"isBlackListed"`
ExtendProps map[string]interface{} `json:"extendProps"`
CreateAt int64 `json:"createAt"`
UpdateAt int64 `json:"updateAt"`
}
type ContactAddParameters struct {
AppId string `json:"appId"`
AccountId string `json:"accountId"`
UserId string `json:"userId"`
Nickname string `json:"nickname"`
Avatar string `json:"avatar"`
Gender int32 `json:"gender"`
Mobile string `json:"mobile"`
Country string `json:"country"`
State string `json:"state"`
City string `json:"city"`
Signature string `json:"signature"`
Alias string `json:"alias"`
Tags []string `json:"tags"`
Source string `json:"source"`
IsBlackListed bool `json:"isBlackListed"`
ExtendProps map[string]interface{} `json:"extendProps"`
}
type ContactAddResponse struct {
Response
}
type ContactUpdateParameters struct {
AppId string `json:"appId"`
AccountId string `json:"accountId"`
UserId string `json:"userId"`
Nickname string `json:"nickname"`
Avatar string `json:"avatar"`
Gender int32 `json:"gender"`
Mobile string `json:"mobile"`
Country string `json:"country"`
State string `json:"state"`
City string `json:"city"`
Signature string `json:"signature"`
Alias string `json:"alias"`
Tags []string `json:"tags"`
Source string `json:"source"`
IsBlackListed bool `json:"isBlackListed"`
ExtendProps map[string]interface{} `json:"extendProps"`
}
type ContactUpdateResponse struct {
Response
Contact Contact `json:"contact"`
}
func (api *Client) ContactAdd(req *ContactAddParameters) error {
return api.ContactAddContext(context.Background(), req)
}
func (api *Client) ContactAddContext(ctx context.Context, req *ContactAddParameters) error {
response := Response{}
err := api.postJSONMethod(ctx, "/contact/add", req, &response)
if err != nil {
return err
}
return response.Err()
}
func (api *Client) ContactUpdate(req *ContactUpdateParameters) error {
return api.ContactUpdateContext(context.Background(), req)
}
func (api *Client) ContactUpdateContext(ctx context.Context, req *ContactUpdateParameters) error {
response := Response{}
err := api.postJSONMethod(ctx, "/contact/updateFromProvider", req, &response)
if err != nil {
return err
}
return response.Err()
}