forked from xen0n/go-workwx
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathagent.go
More file actions
78 lines (71 loc) · 2.52 KB
/
agent.go
File metadata and controls
78 lines (71 loc) · 2.52 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
package workwx
// AgentInfo 应用信息
type AgentInfo struct {
// AgentID 企业应用id
AgentID int64
// Name 企业应用名称
Name string
// SquareLogoURL 企业应用方形头像
SquareLogoURL string
// Description 企业应用详情
Description string
// AllowUserInfos 企业应用可见范围(人员)
AllowUserInfos AgentAllowUserInfos
// AllowPartys 企业应用可见范围(部门)
AllowPartys AgentAllowPartys
// AllowTags 企业应用可见范围(标签)
AllowTags AgentAllowTags
// Close 企业应用是否被停用。0:未被停用;1:被停用
Close int
// RedirectDomain 企业应用可信域名
RedirectDomain string
// ReportLocationFlag 企业应用是否打开地理位置上报 0:不上报;1:进入会话上报
ReportLocationFlag int
// IsReportEnter 是否上报用户进入应用事件。0:不接收;1:接收
IsReportEnter int
// HomeURL 应用主页url
HomeURL string
// CustomizedPublishStatus 代开发自建应用返回该字段,表示代开发发布状态。
// 0:待开发(企业已授权,服务商未创建应用)
// 1:开发中(服务商已创建应用,未上线)
// 2:已上线(服务商已上线应用且不存在未上线版本)
// 3:存在未上线版本(服务商已上线应用但存在未上线版本)
CustomizedPublishStatus int
}
// GetCurrentAgentInfo 获取当前应用详情
func (c *WorkwxApp) GetCurrentAgentInfo() (*AgentInfo, error) {
return c.GetAgentInfo(c.AgentID)
}
// GetAgentInfo 获取指定应用详情
func (c *WorkwxApp) GetAgentInfo(agentID int64) (*AgentInfo, error) {
resp, err := c.execAgentGet(reqAgentGet{
AgentID: agentID,
})
if err != nil {
return nil, err
}
agentInfo := &AgentInfo{
AgentID: resp.AgentID,
Name: resp.Name,
SquareLogoURL: resp.SquareLogoURL,
Description: resp.Description,
AllowUserInfos: resp.AllowUserInfos,
AllowPartys: resp.AllowPartys,
AllowTags: resp.AllowTags,
Close: resp.Close,
RedirectDomain: resp.RedirectDomain,
ReportLocationFlag: resp.ReportLocationFlag,
IsReportEnter: resp.IsReportEnter,
HomeURL: resp.HomeURL,
CustomizedPublishStatus: resp.CustomizedPublishStatus,
}
return agentInfo, nil
}
// GetAgentList 获取应用列表
func (c *WorkwxApp) GetAgentList() ([]AgentItem, error) {
resp, err := c.execAgentList(reqAgentList{})
if err != nil {
return nil, err
}
return resp.AgentList, nil
}