-
Notifications
You must be signed in to change notification settings - Fork 171
/
client.go
100 lines (69 loc) · 3.32 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
package meetingroom
import (
"context"
"github.com/ArtisanCloud/PowerWeChat/v3/src/kernel"
response2 "github.com/ArtisanCloud/PowerWeChat/v3/src/kernel/response"
"github.com/ArtisanCloud/PowerWeChat/v3/src/work/oa/meetingroom/request"
"github.com/ArtisanCloud/PowerWeChat/v3/src/work/oa/meetingroom/response"
)
type Client struct {
BaseClient *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/93619
func (comp *Client) Add(ctx context.Context, options *request.RequestMeetingRoomAdd) (*response.ResponseMeetingRoomAdd, error) {
result := &response.ResponseMeetingRoomAdd{}
_, err := comp.BaseClient.HttpPostJson(ctx, "cgi-bin/oa/meetingroom/add", options, nil, nil, result)
return result, err
}
// 查询会议室
// https://developer.work.weixin.qq.com/document/path/93619
func (comp *Client) List(ctx context.Context, options *request.RequestMeetingRoomList) (*response.ResponseMeetingRoomList, error) {
result := &response.ResponseMeetingRoomList{}
_, err := comp.BaseClient.HttpPostJson(ctx, "cgi-bin/oa/meetingroom/list", options, nil, nil, result)
return result, err
}
// 编辑会议室
// https://developer.work.weixin.qq.com/document/path/93619
func (comp *Client) Edit(ctx context.Context, options *request.RequestMeetingRoomEdit) (*response2.ResponseWork, error) {
result := &response2.ResponseWork{}
_, err := comp.BaseClient.HttpPostJson(ctx, "cgi-bin/oa/meetingroom/edit", options, nil, nil, result)
return result, err
}
// 删除会议室
// https://developer.work.weixin.qq.com/document/path/93619
func (comp *Client) Del(ctx context.Context, options *request.RequestMeetingRoomDel) (*response2.ResponseWork, error) {
result := &response2.ResponseWork{}
_, err := comp.BaseClient.HttpPostJson(ctx, "cgi-bin/oa/meetingroom/del", options, nil, nil, result)
return result, err
}
// 查询会议室的预定信息
// https://developer.work.weixin.qq.com/document/path/93620#%E6%9F%A5%E8%AF%A2%E4%BC%9A%E8%AE%AE%E5%AE%A4%E7%9A%84%E9%A2%84%E5%AE%9A%E4%BF%A1%E6%81%AF
func (comp *Client) GetBookingInfo(ctx context.Context, options *request.RequestMeetingRoomGetBookingInfo) (*response.ResponseMeetingRoomGetBookingInfo, error) {
result := &response.ResponseMeetingRoomGetBookingInfo{}
_, err := comp.BaseClient.HttpPostJson(ctx, "cgi-bin/oa/meetingroom/get_booking_info", options, nil, nil, result)
return result, err
}
// 预定会议室
// https://developer.work.weixin.qq.com/document/path/93620
func (comp *Client) Book(ctx context.Context, options *request.RequestMeetingRoomBook) (*response.ResponseMeetingRoomGetBook, error) {
result := &response.ResponseMeetingRoomGetBook{}
_, err := comp.BaseClient.HttpPostJson(ctx, "cgi-bin/oa/meetingroom/book", options, nil, nil, result)
return result, err
}
// 取消预定会议室
// https://developer.work.weixin.qq.com/document/path/93620
func (comp *Client) CancelBook(ctx context.Context, options *request.RequestMeetingRoomCancelBook) (*response2.ResponseWork, error) {
result := &response2.ResponseWork{}
_, err := comp.BaseClient.HttpPostJson(ctx, "cgi-bin/oa/meetingroom/cancel_book", options, nil, nil, result)
return result, err
}