-
Notifications
You must be signed in to change notification settings - Fork 173
/
client.go
231 lines (152 loc) · 7.38 KB
/
client.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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
package webdrive
import (
"github.com/ArtisanCloud/PowerWeChat/v2/src/kernel"
response2 "github.com/ArtisanCloud/PowerWeChat/v2/src/kernel/response"
"github.com/ArtisanCloud/PowerWeChat/v2/src/work/oa/webdrive/request"
"github.com/ArtisanCloud/PowerWeChat/v2/src/work/oa/webdrive/response"
)
type Client struct {
*kernel.BaseClient
}
func NewClient(app kernel.ApplicationInterface) (*Client, error) {
baseClient, err := kernel.NewBaseClient(&app, nil)
if err != nil {
return nil, err
}
return &Client{
baseClient,
}, nil
}
// 新建空间
// https://developer.work.weixin.qq.com/document/path/93655#新建空间
func (comp *Client) SpaceCreate(options *request.RequestWebDriveSpaceCreate) (*response.ResponseWebDriveSpaceCreate, error) {
result := &response.ResponseWebDriveSpaceCreate{}
_, err := comp.HttpPostJson("cgi-bin/webdrive/space_create", options, nil, nil, result)
return result, err
}
// 重命名空间
// https://developer.work.weixin.qq.com/document/path/93655#重命名空间
func (comp *Client) SpaceRename(options *request.RequestWebDriveSpaceRename) (*response2.ResponseWork, error) {
result := &response2.ResponseWork{}
_, err := comp.HttpPostJson("cgi-bin/webdrive/space_rename", options, nil, nil, result)
return result, err
}
// 解散空间
// https://developer.work.weixin.qq.com/document/path/93655#解散空间
func (comp *Client) SpaceDismiss(options *request.RequestWebDriveSpaceDismiss) (*response2.ResponseWork, error) {
result := &response2.ResponseWork{}
_, err := comp.HttpPostJson("cgi-bin/webdrive/space_dismiss", options, nil, nil, result)
return result, err
}
// 获取空间信息
// https://developer.work.weixin.qq.com/document/path/93655#获取空间相册信息
func (comp *Client) SpaceInfo(options *request.RequestWebDriveSpaceInfo) (*response.ResponseWebDriveSpaceInfo, error) {
result := &response.ResponseWebDriveSpaceInfo{}
_, err := comp.HttpPostJson("cgi-bin/webdrive/space_info", options, nil, nil, result)
return result, err
}
// 添加成员/部门
// https://developer.work.weixin.qq.com/document/path/93656#添加成员部门
func (comp *Client) SpaceACLAdd(options *request.RequestWebDriveSpaceACLAdd) (*response2.ResponseWork, error) {
result := &response2.ResponseWork{}
_, err := comp.HttpPostJson("cgi-bin/webdrive/space_acl_add", options, nil, nil, result)
return result, err
}
// 移除成员/部门
// https://developer.work.weixin.qq.com/document/path/93656#移除成员部门
func (comp *Client) SpaceACLDel(options *request.RequestWebDriveSpaceACLDel) (*response2.ResponseWork, error) {
result := &response2.ResponseWork{}
_, err := comp.HttpPostJson("cgi-bin/webdrive/space_acl_del", options, nil, nil, result)
return result, err
}
// 安全设置
// https://developer.work.weixin.qq.com/document/path/93656#安全设置
func (comp *Client) SpaceSetting(options *request.RequestWebDriveSpaceSetting) (*response2.ResponseWork, error) {
result := &response2.ResponseWork{}
_, err := comp.HttpPostJson("cgi-bin/webdrive/space_setting", options, nil, nil, result)
return result, err
}
// 获取邀请链接
// https://developer.work.weixin.qq.com/document/path/93656#获取邀请链接
func (comp *Client) SpaceShare(options *request.RequestWebDriveSpaceShare) (*response.ResponseWebDriveSpaceShare, error) {
result := &response.ResponseWebDriveSpaceShare{}
_, err := comp.HttpPostJson("cgi-bin/webdrive/space_share", options, nil, nil, result)
return result, err
}
// 获取文件列表
// https://developer.work.weixin.qq.com/document/path/93657#获取文件列表
func (comp *Client) FileList(options *request.RequestWebDriveFileList) (*response.ResponseWebDriveFileList, error) {
result := &response.ResponseWebDriveFileList{}
_, err := comp.HttpPostJson("cgi-bin/webdrive/file_list", options, nil, nil, result)
return result, err
}
// 上传文件
// https://developer.work.weixin.qq.com/document/path/93657#上传文件
func (comp *Client) FileUpload(options *request.RequestWebDriveFileUpload) (*response.ResponseWebDriveFileUpload, error) {
result := &response.ResponseWebDriveFileUpload{}
_, err := comp.HttpPostJson("cgi-bin/webdrive/file_upload", options, nil, nil, result)
return result, err
}
// 下载文件
// https://developer.work.weixin.qq.com/document/path/93657#下载文件
func (comp *Client) FileDownload(options *request.RequestWebDriveFileDownload) (*response.ResponseWebDriveFileDownload, error) {
result := &response.ResponseWebDriveFileDownload{}
_, err := comp.HttpPostJson("cgi-bin/webdrive/file_download", options, nil, nil, result)
return result, err
}
// 新建文件/微文档
// https://developer.work.weixin.qq.com/document/path/93657#新建文件文档
func (comp *Client) FileCreate(options *request.RequestWebDriveFileCreate) (*response.ResponseWebDriveFileCreate, error) {
result := &response.ResponseWebDriveFileCreate{}
_, err := comp.HttpPostJson("cgi-bin/webdrive/file_create", options, nil, nil, result)
return result, err
}
// 重命名文件
// https://developer.work.weixin.qq.com/document/path/93657#重命名文件
func (comp *Client) FileRename(options *request.RequestWebDriveFileRename) (*response.ResponseWebDriveFileRename, error) {
result := &response.ResponseWebDriveFileRename{}
_, err := comp.HttpPostJson("cgi-bin/webdrive/file_rename", options, nil, nil, result)
return result, err
}
// 移动文件
// https://developer.work.weixin.qq.com/document/path/93657#移动文件
func (comp *Client) FileMove(options *request.RequestWebDriveFileMove) (*response.ResponseWebDriveFileMove, error) {
result := &response.ResponseWebDriveFileMove{}
_, err := comp.HttpPostJson("cgi-bin/webdrive/file_move", options, nil, nil, result)
return result, err
}
// 删除文件
// https://developer.work.weixin.qq.com/document/path/93657#删除文件
func (comp *Client) FileDelete(options *request.RequestWebDriveFileDelete) (*response2.ResponseWork, error) {
result := &response2.ResponseWork{}
_, err := comp.HttpPostJson("cgi-bin/webdrive/file_delete", options, nil, nil, result)
return result, err
}
// 新增成员
// https://developer.work.weixin.qq.com/document/path/93658
func (comp *Client) FileACLAdd(options *request.RequestWebDriveFileACLAdd) (*response2.ResponseWork, error) {
result := &response2.ResponseWork{}
_, err := comp.HttpPostJson("cgi-bin/webdrive/file_acl_add", options, nil, nil, result)
return result, err
}
// 删除成员
// https://developer.work.weixin.qq.com/document/path/93658#删除成员
func (comp *Client) FileACLDel(options *request.RequestWebDriveFileACLDel) (*response2.ResponseWork, error) {
result := &response2.ResponseWork{}
_, err := comp.HttpPostJson("cgi-bin/webdrive/file_acl_del", options, nil, nil, result)
return result, err
}
// 分享设置
// https://developer.work.weixin.qq.com/document/path/93658#分享设置
func (comp *Client) FileSetting(options *request.RequestWebDriveFileSetting) (*response2.ResponseWork, error) {
result := &response2.ResponseWork{}
_, err := comp.HttpPostJson("cgi-bin/webdrive/file_setting", options, nil, nil, result)
return result, err
}
// 获取分享链接
// https://developer.work.weixin.qq.com/document/path/95860#获取分享链接
func (comp *Client) FileShare(options *request.RequestWebDriveFileShare) (*response.ResponseWebDriveFileShare, error) {
result := &response.ResponseWebDriveFileShare{}
_, err := comp.HttpPostJson("cgi-bin/webdrive/file_share", options, nil, nil, result)
return result, err
}