forked from larksuite/oapi-sdk-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
api.go
1084 lines (1043 loc) · 48.4 KB
/
api.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
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Package calendar code generated by oapi sdk gen
/*
* MIT License
*
* Copyright (c) 2022 Lark Technologies Pte. Ltd.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice, shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package larkcalendar
import (
"context"
"net/http"
"github.com/assassinLL/oapi-sdk-go/v3/core"
)
func NewService(config *larkcore.Config) *CalendarService {
c := &CalendarService{config: config}
c.Calendar = &calendar{service: c}
c.CalendarAcl = &calendarAcl{service: c}
c.CalendarEvent = &calendarEvent{service: c}
c.CalendarEventAttendee = &calendarEventAttendee{service: c}
c.CalendarEventAttendeeChatMember = &calendarEventAttendeeChatMember{service: c}
c.ExchangeBinding = &exchangeBinding{service: c}
c.Freebusy = &freebusy{service: c}
c.Setting = &setting{service: c}
c.TimeoffEvent = &timeoffEvent{service: c}
return c
}
type CalendarService struct {
config *larkcore.Config
Calendar *calendar // 日历管理
CalendarAcl *calendarAcl // 日历访问控制
CalendarEvent *calendarEvent // 日程
CalendarEventAttendee *calendarEventAttendee // 日程参与人
CalendarEventAttendeeChatMember *calendarEventAttendeeChatMember // 日程参与人群成员
ExchangeBinding *exchangeBinding // Exchange绑定
Freebusy *freebusy // freebusy
Setting *setting // 日历设置
TimeoffEvent *timeoffEvent // 请假
}
type calendar struct {
service *CalendarService
}
type calendarAcl struct {
service *CalendarService
}
type calendarEvent struct {
service *CalendarService
}
type calendarEventAttendee struct {
service *CalendarService
}
type calendarEventAttendeeChatMember struct {
service *CalendarService
}
type exchangeBinding struct {
service *CalendarService
}
type freebusy struct {
service *CalendarService
}
type setting struct {
service *CalendarService
}
type timeoffEvent struct {
service *CalendarService
}
// 创建共享日历
//
// - 该接口用于为当前身份(应用 / 用户)创建一个共享日历。;;身份由 Header Authorization 的 Token 类型决定。
//
// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar/create
//
// - 使用Demo链接:https://github.com/assassinLL/oapi-sdk-go/tree/v3_main/sample/apiall/calendarv4/create_calendar.go
func (c *calendar) Create(ctx context.Context, req *CreateCalendarReq, options ...larkcore.RequestOptionFunc) (*CreateCalendarResp, error) {
// 发起请求
apiReq := req.apiReq
apiReq.ApiPath = "/open-apis/calendar/v4/calendars"
apiReq.HttpMethod = http.MethodPost
apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant, larkcore.AccessTokenTypeUser}
apiResp, err := larkcore.Request(ctx, apiReq, c.service.config, options...)
if err != nil {
return nil, err
}
// 反序列响应结果
resp := &CreateCalendarResp{ApiResp: apiResp}
err = apiResp.JSONUnmarshalBody(resp, c.service.config)
if err != nil {
return nil, err
}
return resp, err
}
// 删除共享日历
//
// - 该接口用于以当前身份(应用 / 用户)删除一个共享日历。;;身份由 Header Authorization 的 Token 类型决定。
//
// - 当前身份必须对日历具有 owner 权限。
//
// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar/delete
//
// - 使用Demo链接:https://github.com/assassinLL/oapi-sdk-go/tree/v3_main/sample/apiall/calendarv4/delete_calendar.go
func (c *calendar) Delete(ctx context.Context, req *DeleteCalendarReq, options ...larkcore.RequestOptionFunc) (*DeleteCalendarResp, error) {
// 发起请求
apiReq := req.apiReq
apiReq.ApiPath = "/open-apis/calendar/v4/calendars/:calendar_id"
apiReq.HttpMethod = http.MethodDelete
apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant, larkcore.AccessTokenTypeUser}
apiResp, err := larkcore.Request(ctx, apiReq, c.service.config, options...)
if err != nil {
return nil, err
}
// 反序列响应结果
resp := &DeleteCalendarResp{ApiResp: apiResp}
err = apiResp.JSONUnmarshalBody(resp, c.service.config)
if err != nil {
return nil, err
}
return resp, err
}
// 查询日历信息
//
// - 该接口用于以当前身份(应用 / 用户)根据日历 ID 获取日历信息。;;身份由 Header Authorization 的 Token 类型决定。
//
// - 当前身份必须对日历有访问权限。
//
// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar/get
//
// - 使用Demo链接:https://github.com/assassinLL/oapi-sdk-go/tree/v3_main/sample/apiall/calendarv4/get_calendar.go
func (c *calendar) Get(ctx context.Context, req *GetCalendarReq, options ...larkcore.RequestOptionFunc) (*GetCalendarResp, error) {
// 发起请求
apiReq := req.apiReq
apiReq.ApiPath = "/open-apis/calendar/v4/calendars/:calendar_id"
apiReq.HttpMethod = http.MethodGet
apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant, larkcore.AccessTokenTypeUser}
apiResp, err := larkcore.Request(ctx, apiReq, c.service.config, options...)
if err != nil {
return nil, err
}
// 反序列响应结果
resp := &GetCalendarResp{ApiResp: apiResp}
err = apiResp.JSONUnmarshalBody(resp, c.service.config)
if err != nil {
return nil, err
}
return resp, err
}
// 查询日历列表
//
// - 该接口用于分页获得当前身份(应用 / 用户)的日历列表。;;身份由 Header Authorization 的 Token 类型决定。
//
// - 调用时首先使用 page_token 分页拉取存量数据,之后使用 sync_token 增量同步变更数据。
//
// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar/list
//
// - 使用Demo链接:https://github.com/assassinLL/oapi-sdk-go/tree/v3_main/sample/apiall/calendarv4/list_calendar.go
func (c *calendar) List(ctx context.Context, req *ListCalendarReq, options ...larkcore.RequestOptionFunc) (*ListCalendarResp, error) {
// 发起请求
apiReq := req.apiReq
apiReq.ApiPath = "/open-apis/calendar/v4/calendars"
apiReq.HttpMethod = http.MethodGet
apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant, larkcore.AccessTokenTypeUser}
apiResp, err := larkcore.Request(ctx, apiReq, c.service.config, options...)
if err != nil {
return nil, err
}
// 反序列响应结果
resp := &ListCalendarResp{ApiResp: apiResp}
err = apiResp.JSONUnmarshalBody(resp, c.service.config)
if err != nil {
return nil, err
}
return resp, err
}
// 更新日历信息
//
// - 该接口用于以当前身份(应用 / 用户)修改日历信息。;;身份由 Header Authorization 的 Token 类型决定。
//
// - 当前身份对日历有 owner 权限时,可修改全局字段:summary, description, permission。;;当前身份对日历不具有 owner 权限时,仅可修改对自己生效的字段:color, summary_alias。
//
// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar/patch
//
// - 使用Demo链接:https://github.com/assassinLL/oapi-sdk-go/tree/v3_main/sample/apiall/calendarv4/patch_calendar.go
func (c *calendar) Patch(ctx context.Context, req *PatchCalendarReq, options ...larkcore.RequestOptionFunc) (*PatchCalendarResp, error) {
// 发起请求
apiReq := req.apiReq
apiReq.ApiPath = "/open-apis/calendar/v4/calendars/:calendar_id"
apiReq.HttpMethod = http.MethodPatch
apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant, larkcore.AccessTokenTypeUser}
apiResp, err := larkcore.Request(ctx, apiReq, c.service.config, options...)
if err != nil {
return nil, err
}
// 反序列响应结果
resp := &PatchCalendarResp{ApiResp: apiResp}
err = apiResp.JSONUnmarshalBody(resp, c.service.config)
if err != nil {
return nil, err
}
return resp, err
}
// 查询主日历信息
//
// - 获取当前身份的主日历信息。
//
// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar/primary
//
// - 使用Demo链接:https://github.com/assassinLL/oapi-sdk-go/tree/v3_main/sample/apiall/calendarv4/primary_calendar.go
func (c *calendar) Primary(ctx context.Context, req *PrimaryCalendarReq, options ...larkcore.RequestOptionFunc) (*PrimaryCalendarResp, error) {
// 发起请求
apiReq := req.apiReq
apiReq.ApiPath = "/open-apis/calendar/v4/calendars/primary"
apiReq.HttpMethod = http.MethodPost
apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant, larkcore.AccessTokenTypeUser}
apiResp, err := larkcore.Request(ctx, apiReq, c.service.config, options...)
if err != nil {
return nil, err
}
// 反序列响应结果
resp := &PrimaryCalendarResp{ApiResp: apiResp}
err = apiResp.JSONUnmarshalBody(resp, c.service.config)
if err != nil {
return nil, err
}
return resp, err
}
// 搜索日历
//
// - 该接口用于通过关键字查询公共日历或用户主日历。
//
// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar/search
//
// - 使用Demo链接:https://github.com/assassinLL/oapi-sdk-go/tree/v3_main/sample/apiall/calendarv4/search_calendar.go
func (c *calendar) Search(ctx context.Context, req *SearchCalendarReq, options ...larkcore.RequestOptionFunc) (*SearchCalendarResp, error) {
// 发起请求
apiReq := req.apiReq
apiReq.ApiPath = "/open-apis/calendar/v4/calendars/search"
apiReq.HttpMethod = http.MethodPost
apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
apiResp, err := larkcore.Request(ctx, apiReq, c.service.config, options...)
if err != nil {
return nil, err
}
// 反序列响应结果
resp := &SearchCalendarResp{ApiResp: apiResp}
err = apiResp.JSONUnmarshalBody(resp, c.service.config)
if err != nil {
return nil, err
}
return resp, err
}
func (c *calendar) SearchByIterator(ctx context.Context, req *SearchCalendarReq, options ...larkcore.RequestOptionFunc) (*SearchCalendarIterator, error) {
return &SearchCalendarIterator{
ctx: ctx,
req: req,
listFunc: c.Search,
options: options,
limit: req.Limit}, nil
}
// 订阅日历
//
// - 该接口用于以当前身份(应用 / 用户)订阅某个日历。;;身份由 Header Authorization 的 Token 类型决定。
//
// - - 仅可订阅类型为 primary 或 shared 的公开日历。;- 可订阅日历数量上限为1000。
//
// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar/subscribe
//
// - 使用Demo链接:https://github.com/assassinLL/oapi-sdk-go/tree/v3_main/sample/apiall/calendarv4/subscribe_calendar.go
func (c *calendar) Subscribe(ctx context.Context, req *SubscribeCalendarReq, options ...larkcore.RequestOptionFunc) (*SubscribeCalendarResp, error) {
// 发起请求
apiReq := req.apiReq
apiReq.ApiPath = "/open-apis/calendar/v4/calendars/:calendar_id/subscribe"
apiReq.HttpMethod = http.MethodPost
apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeUser, larkcore.AccessTokenTypeTenant}
apiResp, err := larkcore.Request(ctx, apiReq, c.service.config, options...)
if err != nil {
return nil, err
}
// 反序列响应结果
resp := &SubscribeCalendarResp{ApiResp: apiResp}
err = apiResp.JSONUnmarshalBody(resp, c.service.config)
if err != nil {
return nil, err
}
return resp, err
}
// 订阅日历变更事件
//
// - 该接口用于以用户身份订阅当前身份下日历列表中的所有日历变更。
//
// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar/subscription
//
// - 使用Demo链接:https://github.com/assassinLL/oapi-sdk-go/tree/v3_main/sample/apiall/calendarv4/subscription_calendar.go
func (c *calendar) Subscription(ctx context.Context, options ...larkcore.RequestOptionFunc) (*SubscriptionCalendarResp, error) {
// 发起请求
apiReq := &larkcore.ApiReq{
PathParams: larkcore.PathParams{},
QueryParams: larkcore.QueryParams{},
}
apiReq.ApiPath = "/open-apis/calendar/v4/calendars/subscription"
apiReq.HttpMethod = http.MethodPost
apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeUser}
apiResp, err := larkcore.Request(ctx, apiReq, c.service.config, options...)
if err != nil {
return nil, err
}
// 反序列响应结果
resp := &SubscriptionCalendarResp{ApiResp: apiResp}
err = apiResp.JSONUnmarshalBody(resp, c.service.config)
if err != nil {
return nil, err
}
return resp, err
}
// 取消订阅日历
//
// - 该接口用于以当前身份(应用 / 用户)取消对某日历的订阅状态。;;身份由 Header Authorization 的 Token 类型决定。
//
// - 仅可操作已经被当前身份订阅的日历。
//
// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar/unsubscribe
//
// - 使用Demo链接:https://github.com/assassinLL/oapi-sdk-go/tree/v3_main/sample/apiall/calendarv4/unsubscribe_calendar.go
func (c *calendar) Unsubscribe(ctx context.Context, req *UnsubscribeCalendarReq, options ...larkcore.RequestOptionFunc) (*UnsubscribeCalendarResp, error) {
// 发起请求
apiReq := req.apiReq
apiReq.ApiPath = "/open-apis/calendar/v4/calendars/:calendar_id/unsubscribe"
apiReq.HttpMethod = http.MethodPost
apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeUser, larkcore.AccessTokenTypeTenant}
apiResp, err := larkcore.Request(ctx, apiReq, c.service.config, options...)
if err != nil {
return nil, err
}
// 反序列响应结果
resp := &UnsubscribeCalendarResp{ApiResp: apiResp}
err = apiResp.JSONUnmarshalBody(resp, c.service.config)
if err != nil {
return nil, err
}
return resp, err
}
// 取消订阅日历变更事件
//
// - 该接口用于以用户身份取消订阅当前身份下日历列表中的日历变更事件。
//
// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar/unsubscription
//
// - 使用Demo链接:https://github.com/assassinLL/oapi-sdk-go/tree/v3_main/sample/apiall/calendarv4/unsubscription_calendar.go
func (c *calendar) Unsubscription(ctx context.Context, options ...larkcore.RequestOptionFunc) (*UnsubscriptionCalendarResp, error) {
// 发起请求
apiReq := &larkcore.ApiReq{
PathParams: larkcore.PathParams{},
QueryParams: larkcore.QueryParams{},
}
apiReq.ApiPath = "/open-apis/calendar/v4/calendars/unsubscription"
apiReq.HttpMethod = http.MethodPost
apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeUser}
apiResp, err := larkcore.Request(ctx, apiReq, c.service.config, options...)
if err != nil {
return nil, err
}
// 反序列响应结果
resp := &UnsubscriptionCalendarResp{ApiResp: apiResp}
err = apiResp.JSONUnmarshalBody(resp, c.service.config)
if err != nil {
return nil, err
}
return resp, err
}
// 创建访问控制
//
// - 该接口用于以当前身份(应用 / 用户)给日历添加访问控制权限,即日历成员。;;身份由 Header Authorization 的 Token 类型决定。
//
// - 当前身份需要有日历的 owner 权限,并且日历的类型只能为 primary 或 shared。
//
// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar-acl/create
//
// - 使用Demo链接:https://github.com/assassinLL/oapi-sdk-go/tree/v3_main/sample/apiall/calendarv4/create_calendarAcl.go
func (c *calendarAcl) Create(ctx context.Context, req *CreateCalendarAclReq, options ...larkcore.RequestOptionFunc) (*CreateCalendarAclResp, error) {
// 发起请求
apiReq := req.apiReq
apiReq.ApiPath = "/open-apis/calendar/v4/calendars/:calendar_id/acls"
apiReq.HttpMethod = http.MethodPost
apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant, larkcore.AccessTokenTypeUser}
apiResp, err := larkcore.Request(ctx, apiReq, c.service.config, options...)
if err != nil {
return nil, err
}
// 反序列响应结果
resp := &CreateCalendarAclResp{ApiResp: apiResp}
err = apiResp.JSONUnmarshalBody(resp, c.service.config)
if err != nil {
return nil, err
}
return resp, err
}
// 删除访问控制
//
// - 该接口用于以当前身份(应用 / 用户)删除日历的控制权限,即日历成员。;;身份由 Header Authorization 的 Token 类型决定。
//
// - 当前身份需要有日历的 owner 权限,并且日历的类型只能为 primary 或 shared。
//
// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar-acl/delete
//
// - 使用Demo链接:https://github.com/assassinLL/oapi-sdk-go/tree/v3_main/sample/apiall/calendarv4/delete_calendarAcl.go
func (c *calendarAcl) Delete(ctx context.Context, req *DeleteCalendarAclReq, options ...larkcore.RequestOptionFunc) (*DeleteCalendarAclResp, error) {
// 发起请求
apiReq := req.apiReq
apiReq.ApiPath = "/open-apis/calendar/v4/calendars/:calendar_id/acls/:acl_id"
apiReq.HttpMethod = http.MethodDelete
apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant, larkcore.AccessTokenTypeUser}
apiResp, err := larkcore.Request(ctx, apiReq, c.service.config, options...)
if err != nil {
return nil, err
}
// 反序列响应结果
resp := &DeleteCalendarAclResp{ApiResp: apiResp}
err = apiResp.JSONUnmarshalBody(resp, c.service.config)
if err != nil {
return nil, err
}
return resp, err
}
// 获取访问控制列表
//
// - 该接口用于以当前身份(应用 / 用户)获取日历的控制权限列表。;;身份由 Header Authorization 的 Token 类型决定。
//
// - 当前身份需要有日历的 owner 权限,并且日历的类型只能为 primary 或 shared。
//
// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar-acl/list
//
// - 使用Demo链接:https://github.com/assassinLL/oapi-sdk-go/tree/v3_main/sample/apiall/calendarv4/list_calendarAcl.go
func (c *calendarAcl) List(ctx context.Context, req *ListCalendarAclReq, options ...larkcore.RequestOptionFunc) (*ListCalendarAclResp, error) {
// 发起请求
apiReq := req.apiReq
apiReq.ApiPath = "/open-apis/calendar/v4/calendars/:calendar_id/acls"
apiReq.HttpMethod = http.MethodGet
apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant, larkcore.AccessTokenTypeUser}
apiResp, err := larkcore.Request(ctx, apiReq, c.service.config, options...)
if err != nil {
return nil, err
}
// 反序列响应结果
resp := &ListCalendarAclResp{ApiResp: apiResp}
err = apiResp.JSONUnmarshalBody(resp, c.service.config)
if err != nil {
return nil, err
}
return resp, err
}
func (c *calendarAcl) ListByIterator(ctx context.Context, req *ListCalendarAclReq, options ...larkcore.RequestOptionFunc) (*ListCalendarAclIterator, error) {
return &ListCalendarAclIterator{
ctx: ctx,
req: req,
listFunc: c.List,
options: options,
limit: req.Limit}, nil
}
// 订阅日历访问控制变更事件;
//
// - 该接口用于以用户身份订阅指定日历下的日历成员变更事件。
//
// - 用户必须对日历有访问权限。
//
// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar-acl/subscription
//
// - 使用Demo链接:https://github.com/assassinLL/oapi-sdk-go/tree/v3_main/sample/apiall/calendarv4/subscription_calendarAcl.go
func (c *calendarAcl) Subscription(ctx context.Context, req *SubscriptionCalendarAclReq, options ...larkcore.RequestOptionFunc) (*SubscriptionCalendarAclResp, error) {
// 发起请求
apiReq := req.apiReq
apiReq.ApiPath = "/open-apis/calendar/v4/calendars/:calendar_id/acls/subscription"
apiReq.HttpMethod = http.MethodPost
apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeUser}
apiResp, err := larkcore.Request(ctx, apiReq, c.service.config, options...)
if err != nil {
return nil, err
}
// 反序列响应结果
resp := &SubscriptionCalendarAclResp{ApiResp: apiResp}
err = apiResp.JSONUnmarshalBody(resp, c.service.config)
if err != nil {
return nil, err
}
return resp, err
}
// 取消订阅日历访问控制变更事件
//
// - 该接口用于以用户身份取消订阅指定日历下的日历成员变更事件。
//
// - 用户必须对日历有访问权限。
//
// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar-acl/unsubscription
//
// - 使用Demo链接:https://github.com/assassinLL/oapi-sdk-go/tree/v3_main/sample/apiall/calendarv4/unsubscription_calendarAcl.go
func (c *calendarAcl) Unsubscription(ctx context.Context, req *UnsubscriptionCalendarAclReq, options ...larkcore.RequestOptionFunc) (*UnsubscriptionCalendarAclResp, error) {
// 发起请求
apiReq := req.apiReq
apiReq.ApiPath = "/open-apis/calendar/v4/calendars/:calendar_id/acls/unsubscription"
apiReq.HttpMethod = http.MethodPost
apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeUser}
apiResp, err := larkcore.Request(ctx, apiReq, c.service.config, options...)
if err != nil {
return nil, err
}
// 反序列响应结果
resp := &UnsubscriptionCalendarAclResp{ApiResp: apiResp}
err = apiResp.JSONUnmarshalBody(resp, c.service.config)
if err != nil {
return nil, err
}
return resp, err
}
// 创建日程
//
// - 该接口用于以当前身份(应用 / 用户)在日历上创建一个日程。;;身份由 Header Authorization 的 Token 类型决定。
//
// - 当前身份必须对日历有 writer 或 owner 权限,并且日历的类型只能为 primary 或 shared。
//
// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar-event/create
//
// - 使用Demo链接:https://github.com/assassinLL/oapi-sdk-go/tree/v3_main/sample/apiall/calendarv4/create_calendarEvent.go
func (c *calendarEvent) Create(ctx context.Context, req *CreateCalendarEventReq, options ...larkcore.RequestOptionFunc) (*CreateCalendarEventResp, error) {
// 发起请求
apiReq := req.apiReq
apiReq.ApiPath = "/open-apis/calendar/v4/calendars/:calendar_id/events"
apiReq.HttpMethod = http.MethodPost
apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant, larkcore.AccessTokenTypeUser}
apiResp, err := larkcore.Request(ctx, apiReq, c.service.config, options...)
if err != nil {
return nil, err
}
// 反序列响应结果
resp := &CreateCalendarEventResp{ApiResp: apiResp}
err = apiResp.JSONUnmarshalBody(resp, c.service.config)
if err != nil {
return nil, err
}
return resp, err
}
// 删除日程
//
// - 该接口用于以当前身份(应用 / 用户)删除日历上的一个日程。;;身份由 Header Authorization 的 Token 类型决定。
//
// - 当前身份必须对日历有 writer 或 owner 权限,并且日历的类型只能为 primary 或 shared。;;当前身份必须是日程的组织者。
//
// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar-event/delete
//
// - 使用Demo链接:https://github.com/assassinLL/oapi-sdk-go/tree/v3_main/sample/apiall/calendarv4/delete_calendarEvent.go
func (c *calendarEvent) Delete(ctx context.Context, req *DeleteCalendarEventReq, options ...larkcore.RequestOptionFunc) (*DeleteCalendarEventResp, error) {
// 发起请求
apiReq := req.apiReq
apiReq.ApiPath = "/open-apis/calendar/v4/calendars/:calendar_id/events/:event_id"
apiReq.HttpMethod = http.MethodDelete
apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant, larkcore.AccessTokenTypeUser}
apiResp, err := larkcore.Request(ctx, apiReq, c.service.config, options...)
if err != nil {
return nil, err
}
// 反序列响应结果
resp := &DeleteCalendarEventResp{ApiResp: apiResp}
err = apiResp.JSONUnmarshalBody(resp, c.service.config)
if err != nil {
return nil, err
}
return resp, err
}
// 获取日程
//
// - 该接口用于以当前身份(应用 / 用户)获取日历上的一个日程。;身份由 Header Authorization 的 Token 类型决定。
//
// - - 当前身份必须对日历有reader、writer或owner权限才会返回日程详细信息(调用[获取日历](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar/get)接口,role字段可查看权限)。;- [例外日程](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar-event/introduction#71c5ec78)可通过event_id的非0时间戳后缀,来获取修改的重复性日程的哪一天日程的时间信息。
//
// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar-event/get
//
// - 使用Demo链接:https://github.com/assassinLL/oapi-sdk-go/tree/v3_main/sample/apiall/calendarv4/get_calendarEvent.go
func (c *calendarEvent) Get(ctx context.Context, req *GetCalendarEventReq, options ...larkcore.RequestOptionFunc) (*GetCalendarEventResp, error) {
// 发起请求
apiReq := req.apiReq
apiReq.ApiPath = "/open-apis/calendar/v4/calendars/:calendar_id/events/:event_id"
apiReq.HttpMethod = http.MethodGet
apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant, larkcore.AccessTokenTypeUser}
apiResp, err := larkcore.Request(ctx, apiReq, c.service.config, options...)
if err != nil {
return nil, err
}
// 反序列响应结果
resp := &GetCalendarEventResp{ApiResp: apiResp}
err = apiResp.JSONUnmarshalBody(resp, c.service.config)
if err != nil {
return nil, err
}
return resp, err
}
// 获取日程列表
//
// - 该接口用于以当前身份(应用 / 用户)获取日历下的日程列表。;身份由 Header Authorization 的 Token 类型决定。
//
// - - 当前身份必须对日历有reader、writer或owner权限才会返回日程详细信息(调用[获取日历](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar/get)接口,role字段可查看权限)。;;- 仅支持primary、shared和resource类型的日历获取日程列表。;;- page_token 分页拉取存量数据,sync_token 增量同步变更数据;目前仅传anchor_time时,会返回page_token。;;- 为了确保调用方日程同步数据的一致性,在使用sync_token时,不能同时使用start_time和end_time,否则可能造成日程数据缺失。
//
// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar-event/list
//
// - 使用Demo链接:https://github.com/assassinLL/oapi-sdk-go/tree/v3_main/sample/apiall/calendarv4/list_calendarEvent.go
func (c *calendarEvent) List(ctx context.Context, req *ListCalendarEventReq, options ...larkcore.RequestOptionFunc) (*ListCalendarEventResp, error) {
// 发起请求
apiReq := req.apiReq
apiReq.ApiPath = "/open-apis/calendar/v4/calendars/:calendar_id/events"
apiReq.HttpMethod = http.MethodGet
apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant, larkcore.AccessTokenTypeUser}
apiResp, err := larkcore.Request(ctx, apiReq, c.service.config, options...)
if err != nil {
return nil, err
}
// 反序列响应结果
resp := &ListCalendarEventResp{ApiResp: apiResp}
err = apiResp.JSONUnmarshalBody(resp, c.service.config)
if err != nil {
return nil, err
}
return resp, err
}
// 更新日程
//
// - 该接口用于以当前身份(应用 / 用户)更新日历上的一个日程。;;身份由 Header Authorization 的 Token 类型决定。
//
// - 当前身份必须对日历有 writer 或 owner 权限,并且日历的类型只能为 primary 或 shared。;;当前身份为日程组织者时,可修改所有可编辑字段。;;当前身份为日程参与者时,仅可编辑部分字段。(如:visibility, free_busy_status, color, reminders)
//
// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar-event/patch
//
// - 使用Demo链接:https://github.com/assassinLL/oapi-sdk-go/tree/v3_main/sample/apiall/calendarv4/patch_calendarEvent.go
func (c *calendarEvent) Patch(ctx context.Context, req *PatchCalendarEventReq, options ...larkcore.RequestOptionFunc) (*PatchCalendarEventResp, error) {
// 发起请求
apiReq := req.apiReq
apiReq.ApiPath = "/open-apis/calendar/v4/calendars/:calendar_id/events/:event_id"
apiReq.HttpMethod = http.MethodPatch
apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant, larkcore.AccessTokenTypeUser}
apiResp, err := larkcore.Request(ctx, apiReq, c.service.config, options...)
if err != nil {
return nil, err
}
// 反序列响应结果
resp := &PatchCalendarEventResp{ApiResp: apiResp}
err = apiResp.JSONUnmarshalBody(resp, c.service.config)
if err != nil {
return nil, err
}
return resp, err
}
// 搜索日程
//
// - 该接口用于以用户身份搜索某日历下的相关日程。;;身份由 Header Authorization 的 Token 类型决定。
//
// - 当前身份必须对日历有reader、writer或owner权限(调用[获取日历](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar/get)接口,role字段可查看权限)。
//
// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar-event/search
//
// - 使用Demo链接:https://github.com/assassinLL/oapi-sdk-go/tree/v3_main/sample/apiall/calendarv4/search_calendarEvent.go
func (c *calendarEvent) Search(ctx context.Context, req *SearchCalendarEventReq, options ...larkcore.RequestOptionFunc) (*SearchCalendarEventResp, error) {
// 发起请求
apiReq := req.apiReq
apiReq.ApiPath = "/open-apis/calendar/v4/calendars/:calendar_id/events/search"
apiReq.HttpMethod = http.MethodPost
apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeUser}
apiResp, err := larkcore.Request(ctx, apiReq, c.service.config, options...)
if err != nil {
return nil, err
}
// 反序列响应结果
resp := &SearchCalendarEventResp{ApiResp: apiResp}
err = apiResp.JSONUnmarshalBody(resp, c.service.config)
if err != nil {
return nil, err
}
return resp, err
}
func (c *calendarEvent) SearchByIterator(ctx context.Context, req *SearchCalendarEventReq, options ...larkcore.RequestOptionFunc) (*SearchCalendarEventIterator, error) {
return &SearchCalendarEventIterator{
ctx: ctx,
req: req,
listFunc: c.Search,
options: options,
limit: req.Limit}, nil
}
// 订阅日程变更事件
//
// - 该接口用于以用户身份订阅指定日历下的日程变更事件。
//
// - 当前身份必须对日历有reader、writer或owner权限(调用[获取日历](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar/get)接口,role字段可查看权限)。
//
// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar-event/subscription
//
// - 使用Demo链接:https://github.com/assassinLL/oapi-sdk-go/tree/v3_main/sample/apiall/calendarv4/subscription_calendarEvent.go
func (c *calendarEvent) Subscription(ctx context.Context, req *SubscriptionCalendarEventReq, options ...larkcore.RequestOptionFunc) (*SubscriptionCalendarEventResp, error) {
// 发起请求
apiReq := req.apiReq
apiReq.ApiPath = "/open-apis/calendar/v4/calendars/:calendar_id/events/subscription"
apiReq.HttpMethod = http.MethodPost
apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeUser}
apiResp, err := larkcore.Request(ctx, apiReq, c.service.config, options...)
if err != nil {
return nil, err
}
// 反序列响应结果
resp := &SubscriptionCalendarEventResp{ApiResp: apiResp}
err = apiResp.JSONUnmarshalBody(resp, c.service.config)
if err != nil {
return nil, err
}
return resp, err
}
// 取消订阅日程变更事件
//
// - 该接口用于以用户身份取消订阅指定日历下的日程变更事件。
//
// - 当前身份必须对日历有reader、writer或owner权限(调用[获取日历](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar/get)接口,role字段可查看权限)。
//
// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar-event/unsubscription
//
// - 使用Demo链接:https://github.com/assassinLL/oapi-sdk-go/tree/v3_main/sample/apiall/calendarv4/unsubscription_calendarEvent.go
func (c *calendarEvent) Unsubscription(ctx context.Context, req *UnsubscriptionCalendarEventReq, options ...larkcore.RequestOptionFunc) (*UnsubscriptionCalendarEventResp, error) {
// 发起请求
apiReq := req.apiReq
apiReq.ApiPath = "/open-apis/calendar/v4/calendars/:calendar_id/events/unsubscription"
apiReq.HttpMethod = http.MethodPost
apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeUser}
apiResp, err := larkcore.Request(ctx, apiReq, c.service.config, options...)
if err != nil {
return nil, err
}
// 反序列响应结果
resp := &UnsubscriptionCalendarEventResp{ApiResp: apiResp}
err = apiResp.JSONUnmarshalBody(resp, c.service.config)
if err != nil {
return nil, err
}
return resp, err
}
// 删除日程参与人
//
// - 批量删除日程的参与人。
//
// - - 当前身份需要有日历的 writer 或 owner 权限,并且日历的类型只能为 primary 或 shared。;;- 当前身份需要是日程的组织者。
//
// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar-event-attendee/batch_delete
//
// - 使用Demo链接:https://github.com/assassinLL/oapi-sdk-go/tree/v3_main/sample/apiall/calendarv4/batchDelete_calendarEventAttendee.go
func (c *calendarEventAttendee) BatchDelete(ctx context.Context, req *BatchDeleteCalendarEventAttendeeReq, options ...larkcore.RequestOptionFunc) (*BatchDeleteCalendarEventAttendeeResp, error) {
// 发起请求
apiReq := req.apiReq
apiReq.ApiPath = "/open-apis/calendar/v4/calendars/:calendar_id/events/:event_id/attendees/batch_delete"
apiReq.HttpMethod = http.MethodPost
apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant, larkcore.AccessTokenTypeUser}
apiResp, err := larkcore.Request(ctx, apiReq, c.service.config, options...)
if err != nil {
return nil, err
}
// 反序列响应结果
resp := &BatchDeleteCalendarEventAttendeeResp{ApiResp: apiResp}
err = apiResp.JSONUnmarshalBody(resp, c.service.config)
if err != nil {
return nil, err
}
return resp, err
}
// 创建日程参与人;
//
// - 批量给日程添加参与人。
//
// - - 当前身份需要有日历的 writer 或 owner 权限,并且日历的类型只能为 primary 或 shared。;;- 当前身份需要是日程的组织者,或日程设置了「参与人可邀请其它参与人」权限。;;- 新添加的日程参与人必须与日程组织者在同一个企业内。;;- 使用该接口添加会议室后,会议室会进入异步的预约流程,请求结束不代表会议室预约成功,需后续再查询预约状态。;;- 每个日程最多只能有 3000 名参与人。;;- 开启管理员能力后预约会议室可不受会议室预约范围的限制(当前不支持用管理员身份给其他人的日程预约会议室)
//
// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar-event-attendee/create
//
// - 使用Demo链接:https://github.com/assassinLL/oapi-sdk-go/tree/v3_main/sample/apiall/calendarv4/create_calendarEventAttendee.go
func (c *calendarEventAttendee) Create(ctx context.Context, req *CreateCalendarEventAttendeeReq, options ...larkcore.RequestOptionFunc) (*CreateCalendarEventAttendeeResp, error) {
// 发起请求
apiReq := req.apiReq
apiReq.ApiPath = "/open-apis/calendar/v4/calendars/:calendar_id/events/:event_id/attendees"
apiReq.HttpMethod = http.MethodPost
apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant, larkcore.AccessTokenTypeUser}
apiResp, err := larkcore.Request(ctx, apiReq, c.service.config, options...)
if err != nil {
return nil, err
}
// 反序列响应结果
resp := &CreateCalendarEventAttendeeResp{ApiResp: apiResp}
err = apiResp.JSONUnmarshalBody(resp, c.service.config)
if err != nil {
return nil, err
}
return resp, err
}
// 获取日程参与人列表
//
// - 获取日程的参与人列表,若参与者列表中有群组,请使用 [获取参与人群成员列表](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar-event-attendee-chat_member/list) 。
//
// - - 当前身份必须对日历有reader、writer或owner权限(调用[获取日历](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar/get)接口,role字段可查看权限)。;;- 当前身份必须有权限查看日程的参与人列表。
//
// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar-event-attendee/list
//
// - 使用Demo链接:https://github.com/assassinLL/oapi-sdk-go/tree/v3_main/sample/apiall/calendarv4/list_calendarEventAttendee.go
func (c *calendarEventAttendee) List(ctx context.Context, req *ListCalendarEventAttendeeReq, options ...larkcore.RequestOptionFunc) (*ListCalendarEventAttendeeResp, error) {
// 发起请求
apiReq := req.apiReq
apiReq.ApiPath = "/open-apis/calendar/v4/calendars/:calendar_id/events/:event_id/attendees"
apiReq.HttpMethod = http.MethodGet
apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant, larkcore.AccessTokenTypeUser}
apiResp, err := larkcore.Request(ctx, apiReq, c.service.config, options...)
if err != nil {
return nil, err
}
// 反序列响应结果
resp := &ListCalendarEventAttendeeResp{ApiResp: apiResp}
err = apiResp.JSONUnmarshalBody(resp, c.service.config)
if err != nil {
return nil, err
}
return resp, err
}
func (c *calendarEventAttendee) ListByIterator(ctx context.Context, req *ListCalendarEventAttendeeReq, options ...larkcore.RequestOptionFunc) (*ListCalendarEventAttendeeIterator, error) {
return &ListCalendarEventAttendeeIterator{
ctx: ctx,
req: req,
listFunc: c.List,
options: options,
limit: req.Limit}, nil
}
// 获取日程参与群成员列表
//
// - 获取日程的群参与人的群成员列表。
//
// - - 当前身份必须有权限查看日程的参与人列表。;;- 当前身份必须在群聊中,或有权限查看群成员列表。
//
// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar-event-attendee-chat_member/list
//
// - 使用Demo链接:https://github.com/assassinLL/oapi-sdk-go/tree/v3_main/sample/apiall/calendarv4/list_calendarEventAttendeeChatMember.go
func (c *calendarEventAttendeeChatMember) List(ctx context.Context, req *ListCalendarEventAttendeeChatMemberReq, options ...larkcore.RequestOptionFunc) (*ListCalendarEventAttendeeChatMemberResp, error) {
// 发起请求
apiReq := req.apiReq
apiReq.ApiPath = "/open-apis/calendar/v4/calendars/:calendar_id/events/:event_id/attendees/:attendee_id/chat_members"
apiReq.HttpMethod = http.MethodGet
apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant, larkcore.AccessTokenTypeUser}
apiResp, err := larkcore.Request(ctx, apiReq, c.service.config, options...)
if err != nil {
return nil, err
}
// 反序列响应结果
resp := &ListCalendarEventAttendeeChatMemberResp{ApiResp: apiResp}
err = apiResp.JSONUnmarshalBody(resp, c.service.config)
if err != nil {
return nil, err
}
return resp, err
}
func (c *calendarEventAttendeeChatMember) ListByIterator(ctx context.Context, req *ListCalendarEventAttendeeChatMemberReq, options ...larkcore.RequestOptionFunc) (*ListCalendarEventAttendeeChatMemberIterator, error) {
return &ListCalendarEventAttendeeChatMemberIterator{
ctx: ctx,
req: req,
listFunc: c.List,
options: options,
limit: req.Limit}, nil
}
// 创建Exchange绑定关系
//
// - 本接口将Exchange账户绑定到飞书账户,进而支持Exchange日历的导入
//
// - 操作用户需要是企业超级管理员
//
// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/exchange_binding/create
//
// - 使用Demo链接:https://github.com/assassinLL/oapi-sdk-go/tree/v3_main/sample/apiall/calendarv4/create_exchangeBinding.go
func (e *exchangeBinding) Create(ctx context.Context, req *CreateExchangeBindingReq, options ...larkcore.RequestOptionFunc) (*CreateExchangeBindingResp, error) {
// 发起请求
apiReq := req.apiReq
apiReq.ApiPath = "/open-apis/calendar/v4/exchange_bindings"
apiReq.HttpMethod = http.MethodPost
apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeUser}
apiResp, err := larkcore.Request(ctx, apiReq, e.service.config, options...)
if err != nil {
return nil, err
}
// 反序列响应结果
resp := &CreateExchangeBindingResp{ApiResp: apiResp}
err = apiResp.JSONUnmarshalBody(resp, e.service.config)
if err != nil {
return nil, err
}
return resp, err
}
// 解除Exchange绑定关系
//
// - 本接口解除Exchange账户和飞书账户的绑定关系,Exchange账户解除绑定后才能绑定其他飞书账户
//
// - 操作用户需要是企业超级管理员
//
// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/exchange_binding/delete
//
// - 使用Demo链接:https://github.com/assassinLL/oapi-sdk-go/tree/v3_main/sample/apiall/calendarv4/delete_exchangeBinding.go
func (e *exchangeBinding) Delete(ctx context.Context, req *DeleteExchangeBindingReq, options ...larkcore.RequestOptionFunc) (*DeleteExchangeBindingResp, error) {
// 发起请求
apiReq := req.apiReq
apiReq.ApiPath = "/open-apis/calendar/v4/exchange_bindings/:exchange_binding_id"
apiReq.HttpMethod = http.MethodDelete
apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeUser}
apiResp, err := larkcore.Request(ctx, apiReq, e.service.config, options...)
if err != nil {
return nil, err
}
// 反序列响应结果
resp := &DeleteExchangeBindingResp{ApiResp: apiResp}
err = apiResp.JSONUnmarshalBody(resp, e.service.config)
if err != nil {
return nil, err
}
return resp, err
}
// 获取绑定状态
//
// - 本接口获取Exchange账户的绑定状态,包括exchange日历是否同步完成。
//
// - 操作用户需要是企业超级管理员
//
// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/exchange_binding/get
//
// - 使用Demo链接:https://github.com/assassinLL/oapi-sdk-go/tree/v3_main/sample/apiall/calendarv4/get_exchangeBinding.go
func (e *exchangeBinding) Get(ctx context.Context, req *GetExchangeBindingReq, options ...larkcore.RequestOptionFunc) (*GetExchangeBindingResp, error) {
// 发起请求
apiReq := req.apiReq
apiReq.ApiPath = "/open-apis/calendar/v4/exchange_bindings/:exchange_binding_id"
apiReq.HttpMethod = http.MethodGet
apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeUser}
apiResp, err := larkcore.Request(ctx, apiReq, e.service.config, options...)
if err != nil {
return nil, err
}
// 反序列响应结果
resp := &GetExchangeBindingResp{ApiResp: apiResp}
err = apiResp.JSONUnmarshalBody(resp, e.service.config)
if err != nil {
return nil, err
}
return resp, err
}
// 查询主日历忙闲信息
//
// - 查询用户主日历或会议室的忙闲信息。
//
// - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/freebusy/list
//
// - 使用Demo链接:https://github.com/assassinLL/oapi-sdk-go/tree/v3_main/sample/apiall/calendarv4/list_freebusy.go
func (f *freebusy) List(ctx context.Context, req *ListFreebusyReq, options ...larkcore.RequestOptionFunc) (*ListFreebusyResp, error) {
// 发起请求
apiReq := req.apiReq
apiReq.ApiPath = "/open-apis/calendar/v4/freebusy/list"
apiReq.HttpMethod = http.MethodPost
apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant}
apiResp, err := larkcore.Request(ctx, apiReq, f.service.config, options...)
if err != nil {
return nil, err
}
// 反序列响应结果
resp := &ListFreebusyResp{ApiResp: apiResp}