-
Notifications
You must be signed in to change notification settings - Fork 105
Expand file tree
/
Copy pathEventDispatcher.java
More file actions
2302 lines (2107 loc) · 122 KB
/
EventDispatcher.java
File metadata and controls
2302 lines (2107 loc) · 122 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
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
// Code generated by lark suite 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 com.lark.oapi.event;
import com.lark.oapi.core.Constants;
import com.lark.oapi.core.IHandler;
import com.lark.oapi.core.exception.DecryptException;
import com.lark.oapi.core.exception.EventTypeAlreadyHasHandlerException;
import com.lark.oapi.core.exception.IncorrectChallengeException;
import com.lark.oapi.core.exception.IncorrectSignatureException;
import com.lark.oapi.core.request.EventReq;
import com.lark.oapi.core.response.EventResp;
import com.lark.oapi.core.utils.Decryptor;
import com.lark.oapi.core.utils.Jsons;
import com.lark.oapi.core.utils.Strings;
import com.lark.oapi.event.exception.HandlerNotFoundException;
import com.lark.oapi.event.model.BaseEvent;
import com.lark.oapi.event.model.BaseEventV2;
import com.lark.oapi.event.model.Fuzzy;
import com.lark.oapi.service.acs.AcsService;
import com.lark.oapi.service.application.ApplicationService;
import com.lark.oapi.service.approval.ApprovalService;
import com.lark.oapi.service.calendar.CalendarService;
import com.lark.oapi.service.contact.ContactService;
import com.lark.oapi.service.corehr.CorehrService;
import com.lark.oapi.service.drive.DriveService;
import com.lark.oapi.service.helpdesk.HelpdeskService;
import com.lark.oapi.service.hire.HireService;
import com.lark.oapi.service.im.ImService;
import com.lark.oapi.service.meeting_room.MeetingRoomService;
import com.lark.oapi.service.task.TaskService;
import com.lark.oapi.service.vc.VcService;
import org.apache.commons.codec.binary.Hex;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.UnsupportedEncodingException;
import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.HashMap;
import java.util.Map;
public class EventDispatcher implements IHandler {
private static final Logger log = LoggerFactory.getLogger(EventDispatcher.class);
private Map<String, IEventHandler> eventType2EventHandler = new HashMap<>();
private String verificationToken;
private String encryptKey;
public EventDispatcher(Builder builder) {
this.verificationToken = builder.verificationToken;
this.encryptKey = builder.encryptKey;
this.eventType2EventHandler = builder.eventType2EventHandler;
}
public static Builder newBuilder(String verificationToken, String encryptKey) {
return new Builder(verificationToken, encryptKey);
}
public String getVerificationToken() {
return verificationToken;
}
public String getEncryptKey() {
return encryptKey;
}
public String parseReq(EventReq eventReq) throws UnsupportedEncodingException {
log.info("event req,header:{},body:{}", Jsons.LONG_TO_STR.toJson(eventReq.getHeaders()),
new String(eventReq.getBody(), StandardCharsets.UTF_8));
if (!Strings.isEmpty(encryptKey)) {
Fuzzy fuzzy = Jsons.DEFAULT.fromJson(new String(eventReq.getBody(), StandardCharsets.UTF_8), Fuzzy.class);
if (fuzzy == null || Strings.isEmpty(fuzzy.getEncrypt())) {
throw new DecryptException("The result of event decryption failed");
}
return fuzzy.getEncrypt().trim();
}
return new String(eventReq.getBody(), StandardCharsets.UTF_8).trim();
}
public String decryptEvent(String cipherEventJsonStr) {
if (!Strings.isEmpty(encryptKey)) {
// 非线程安全,所以每次要new
String plainEventJsonStr = new Decryptor(encryptKey).decrypt(cipherEventJsonStr);
log.debug("plain Event: {}", plainEventJsonStr);
return plainEventJsonStr.trim();
}
return cipherEventJsonStr;
}
private boolean verifySign(EventReq eventReq) throws NoSuchAlgorithmException {
if (Strings.isEmpty(encryptKey)) {
return true;
}
String cipherEventJsonStr = new String(eventReq.getBody(), StandardCharsets.UTF_8);
String timestamp, nonce, sourceSign, targetSign;
timestamp = eventReq.getHeaderFirstValue(Constants.X_LARK_REQUEST_TIMESTAMP);
nonce = eventReq.getHeaderFirstValue(Constants.X_LARK_REQUEST_NONCE);
sourceSign = eventReq.getHeaderFirstValue(Constants.X_LARK_SIGNATURE);
targetSign = calculateSignature(timestamp, nonce, encryptKey, cipherEventJsonStr);
return targetSign.equals(sourceSign);
}
protected String calculateSignature(String timestamp, String nonce, String encryptKey, String bodyString) throws NoSuchAlgorithmException {
StringBuilder content = new StringBuilder();
content.append(timestamp).append(nonce).append(encryptKey).append(bodyString);
MessageDigest alg = MessageDigest.getInstance("SHA-256");
String sign = Hex.encodeHexString(alg.digest(content.toString().getBytes()));
return sign;
}
private EventResp doHandle(String plainEventJsonStr, String eventType, String reqType, String challenge, String token, EventReq req) throws Exception {
EventResp resp = new EventResp();
resp.setStatusCode(200);
resp.setContentType(Constants.JSON_CONTENT_TYPE);
req.setPlain(plainEventJsonStr);
// 使用challenge进行鉴权
if (Constants.URL_VERIFICATION.equals(reqType)) {
if (!verificationToken.equals(token)) {
throw new IncorrectChallengeException();
}
resp.setBody(String.format(EventResp.CHALLENGE_RESPONSE_FORMAT,
challenge).getBytes(StandardCharsets.UTF_8));
return resp;
}
// 查找处理器,进行处理
IEventHandler handler = eventType2EventHandler.get(eventType);
if (handler == null) {
throw new HandlerNotFoundException(eventType);
}
// 装配参数
Object eventMsg = handler.getEvent();
if (handler instanceof CustomEventHandler) {
eventMsg = req;
} else {
eventMsg = Jsons.DEFAULT.fromJson(plainEventJsonStr, eventMsg.getClass());
}
if (eventMsg instanceof BaseEventV2) {
((BaseEventV2) eventMsg).setEventReq(req);
} else if (eventMsg instanceof BaseEvent) {
((BaseEvent) eventMsg).setEventReq(req);
}
// 执行处理器
handler.handle(eventMsg);
resp.setBody(String.format(EventResp.RESPONSE_FORMAT, "success").getBytes(StandardCharsets.UTF_8));
return resp;
}
public void doWithoutValidation(byte[] payload) throws Throwable {
String pl = new String(payload, StandardCharsets.UTF_8);
Fuzzy fuzzy = Jsons.DEFAULT.fromJson(pl, Fuzzy.class);
String eventType = "";
if (fuzzy.getEvent() != null) {
eventType = fuzzy.getEvent().getType();
}
if (fuzzy.getHeader() != null) {
eventType = fuzzy.getHeader().getEventType();
}
IEventHandler handler = eventType2EventHandler.get(eventType);
if (handler == null) {
throw new HandlerNotFoundException(eventType);
}
EventReq req = new EventReq();
req.setBody(payload);
req.setPlain(pl);
Object eventMsg = handler.getEvent();
if (handler instanceof CustomEventHandler) {
eventMsg = req;
} else {
eventMsg = Jsons.DEFAULT.fromJson(pl, eventMsg.getClass());
}
if (eventMsg instanceof BaseEventV2) {
((BaseEventV2) eventMsg).setEventReq(req);
} else if (eventMsg instanceof BaseEvent) {
((BaseEvent) eventMsg).setEventReq(req);
}
handler.handle(eventMsg);
}
public EventResp handle(EventReq eventReq) throws Throwable {
EventResp eventResp = new EventResp();
eventResp.setStatusCode(200);
eventResp.setContentType(Constants.JSON_CONTENT_TYPE);
try {
// 解析请求,如果需要的话
String cipherEventJsonStr = parseReq(eventReq);
// 解密请求,如果需要的话
String plainEventJsonStr = decryptEvent(cipherEventJsonStr);
// 解析关键字段
Fuzzy fuzzy = Jsons.DEFAULT.fromJson(plainEventJsonStr, Fuzzy.class);
if (Strings.isNotEmpty(fuzzy.getEncrypt())) {
throw new IllegalArgumentException("process encrypted msg event, need config encryptKey");
}
String token = fuzzy.getToken();
String eventType = "";
if (fuzzy.getEvent() != null) {
eventType = fuzzy.getEvent().getType();
}
if (fuzzy.getHeader() != null) {
token = fuzzy.getHeader().getToken();
eventType = fuzzy.getHeader().getEventType();
}
String challenge = fuzzy.getChallenge();
String reqType = fuzzy.getType();
// 验签逻辑
if (!Constants.URL_VERIFICATION.equals(reqType)) {
if (!verifySign(eventReq)) {
throw new IncorrectSignatureException();
}
}
// 处理逻辑
return doHandle(plainEventJsonStr, eventType, reqType, challenge, token, eventReq);
} catch (Throwable e) {
log.error("handle event failed,httpPath:{},requestId:{},err:"
, eventReq.getHttpPath(), eventReq.getRequestID(), e);
if (e instanceof HandlerNotFoundException) {
eventResp.setBody(String.format(EventResp.RESPONSE_FORMAT,
e.getMessage()).getBytes(StandardCharsets.UTF_8));
return eventResp;
}
eventResp.setStatusCode(500);
eventResp.setBody(String.format(EventResp.RESPONSE_FORMAT,
e.getMessage()).getBytes(StandardCharsets.UTF_8));
}
return eventResp;
}
public static class Builder {
private Map<String, IEventHandler> eventType2EventHandler = new HashMap<>();
private String verificationToken;
private String encryptKey;
public Builder(String verificationToken, String encryptKey) {
this.verificationToken = verificationToken;
this.encryptKey = encryptKey;
this.eventType2EventHandler.put("app_ticket", new AppTicketEventHandler());
}
public EventDispatcher build() {
return new EventDispatcher(this);
}
/**
* <p> 新增门禁访问记录,门禁设备识别用户成功后发送该事件给订阅应用。
* <p> 事件描述文档链接:<a href="https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/acs-v1/access_record/events/created">https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/acs-v1/access_record/events/created</a>
*
* @param handler
* @return
*/
public Builder onP2AccessRecordCreatedV1(AcsService.P2AccessRecordCreatedV1Handler handler) {
if (eventType2EventHandler.containsKey("acs.access_record.created_v1")) {
throw new EventTypeAlreadyHasHandlerException("acs.access_record.created_v1");
}
eventType2EventHandler.put("acs.access_record.created_v1", handler);
return this;
}
/**
* <p> 用户信息变更,智能门禁用户特征值变化时,发送此事件。
* <p> 事件描述文档链接:<a href="https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/acs-v1/user/events/updated">https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/acs-v1/user/events/updated</a>
*
* @param handler
* @return
*/
public Builder onP2UserUpdatedV1(AcsService.P2UserUpdatedV1Handler handler) {
if (eventType2EventHandler.containsKey("acs.user.updated_v1")) {
throw new EventTypeAlreadyHasHandlerException("acs.user.updated_v1");
}
eventType2EventHandler.put("acs.user.updated_v1", handler);
return this;
}
/**
* <p> 应用创建,当企业内有新的应用被创建时推送此事件
* <p> 事件描述文档链接:<a href="https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/application-v6/application/events/created">https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/application-v6/application/events/created</a>
*
* @param handler
* @return
*/
public Builder onP2ApplicationCreatedV6(ApplicationService.P2ApplicationCreatedV6Handler handler) {
if (eventType2EventHandler.containsKey("application.application.created_v6")) {
throw new EventTypeAlreadyHasHandlerException("application.application.created_v6");
}
eventType2EventHandler.put("application.application.created_v6", handler);
return this;
}
/**
* <p> 应用审核,通过订阅该事件,可接收应用审核(通过 / 拒绝)事件
* <p> 事件描述文档链接:<a href="https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/application-v6/application-app_version/events/audit">https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/application-v6/application-app_version/events/audit</a>
*
* @param handler
* @return
*/
public Builder onP2ApplicationAppVersionAuditV6(ApplicationService.P2ApplicationAppVersionAuditV6Handler handler) {
if (eventType2EventHandler.containsKey("application.application.app_version.audit_v6")) {
throw new EventTypeAlreadyHasHandlerException("application.application.app_version.audit_v6");
}
eventType2EventHandler.put("application.application.app_version.audit_v6", handler);
return this;
}
/**
* <p> 申请发布应用,通过订阅该事件,可接收应用提交发布申请事件
* <p> 事件描述文档链接:<a href="https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/application-v6/application-app_version/events/publish_apply">https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/application-v6/application-app_version/events/publish_apply</a>
*
* @param handler
* @return
*/
public Builder onP2ApplicationAppVersionPublishApplyV6(ApplicationService.P2ApplicationAppVersionPublishApplyV6Handler handler) {
if (eventType2EventHandler.containsKey("application.application.app_version.publish_apply_v6")) {
throw new EventTypeAlreadyHasHandlerException("application.application.app_version.publish_apply_v6");
}
eventType2EventHandler.put("application.application.app_version.publish_apply_v6", handler);
return this;
}
/**
* <p> 撤回应用发布申请,通过订阅该事件,可接收应用撤回发布申请事件
* <p> 事件描述文档链接:<a href="https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/application-v6/application-app_version/events/publish_revoke">https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/application-v6/application-app_version/events/publish_revoke</a>
*
* @param handler
* @return
*/
public Builder onP2ApplicationAppVersionPublishRevokeV6(ApplicationService.P2ApplicationAppVersionPublishRevokeV6Handler handler) {
if (eventType2EventHandler.containsKey("application.application.app_version.publish_revoke_v6")) {
throw new EventTypeAlreadyHasHandlerException("application.application.app_version.publish_revoke_v6");
}
eventType2EventHandler.put("application.application.app_version.publish_revoke_v6", handler);
return this;
}
/**
* <p> 新增应用反馈,当应用收到新反馈时,触发该事件
* <p> 事件描述文档链接:<a href="https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/application-v6/application-feedback/events/created">https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/application-v6/application-feedback/events/created</a>
*
* @param handler
* @return
*/
public Builder onP2ApplicationFeedbackCreatedV6(ApplicationService.P2ApplicationFeedbackCreatedV6Handler handler) {
if (eventType2EventHandler.containsKey("application.application.feedback.created_v6")) {
throw new EventTypeAlreadyHasHandlerException("application.application.feedback.created_v6");
}
eventType2EventHandler.put("application.application.feedback.created_v6", handler);
return this;
}
/**
* <p> 反馈更新,当反馈的处理状态被更新时,触发该事件
* <p> 事件描述文档链接:<a href="https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/application-v6/application-feedback/events/updated">https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/application-v6/application-feedback/events/updated</a>
*
* @param handler
* @return
*/
public Builder onP2ApplicationFeedbackUpdatedV6(ApplicationService.P2ApplicationFeedbackUpdatedV6Handler handler) {
if (eventType2EventHandler.containsKey("application.application.feedback.updated_v6")) {
throw new EventTypeAlreadyHasHandlerException("application.application.feedback.updated_v6");
}
eventType2EventHandler.put("application.application.feedback.updated_v6", handler);
return this;
}
/**
* <p> ,
* <p> 事件描述文档链接:<a href="https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/application-v6/event/app-availability-scope-extended">https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/application-v6/event/app-availability-scope-extended</a>
*
* @param handler
* @return
*/
public Builder onP2ApplicationVisibilityAddedV6(ApplicationService.P2ApplicationVisibilityAddedV6Handler handler) {
if (eventType2EventHandler.containsKey("application.application.visibility.added_v6")) {
throw new EventTypeAlreadyHasHandlerException("application.application.visibility.added_v6");
}
eventType2EventHandler.put("application.application.visibility.added_v6", handler);
return this;
}
/**
* <p> 机器人自定义菜单,当用户点击类型为事件的机器人菜单时触发
* <p> 事件描述文档链接:<a href="https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/application-v6/bot/events/menu">https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/application-v6/bot/events/menu</a>
*
* @param handler
* @return
*/
public Builder onP2BotMenuV6(ApplicationService.P2BotMenuV6Handler handler) {
if (eventType2EventHandler.containsKey("application.bot.menu_v6")) {
throw new EventTypeAlreadyHasHandlerException("application.bot.menu_v6");
}
eventType2EventHandler.put("application.bot.menu_v6", handler);
return this;
}
/**
* <p> ,
* <p> 事件描述文档链接:<a href="https://open.feishu.cn/document/ukTMukTMukTM/uIDO24iM4YjLygjN/event/custom-approval-event">https://open.feishu.cn/document/ukTMukTMukTM/uIDO24iM4YjLygjN/event/custom-approval-event</a>
*
* @param handler
* @return
*/
public Builder onP2ApprovalUpdatedV4(ApprovalService.P2ApprovalUpdatedV4Handler handler) {
if (eventType2EventHandler.containsKey("approval.approval.updated_v4")) {
throw new EventTypeAlreadyHasHandlerException("approval.approval.updated_v4");
}
eventType2EventHandler.put("approval.approval.updated_v4", handler);
return this;
}
/**
* <p> 日历变更,当订阅用户的日历列表有日历变动时触发此事件。
* <p> 应用首先需要调用上述接口建立订阅关系。应用收到该事件后,使用事件的 user_list 字段中的用户对应的 user_access_token 调用[获取日历列表](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar/list)接口拉取增量的变更数据
* <p> 事件描述文档链接:<a href="https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar/events/changed">https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar/events/changed</a>
*
* @param handler
* @return
*/
public Builder onP2CalendarChangedV4(CalendarService.P2CalendarChangedV4Handler handler) {
if (eventType2EventHandler.containsKey("calendar.calendar.changed_v4")) {
throw new EventTypeAlreadyHasHandlerException("calendar.calendar.changed_v4");
}
eventType2EventHandler.put("calendar.calendar.changed_v4", handler);
return this;
}
/**
* <p> ACL新建,当被订阅的日历上有ACL被创建时触发此事件。
* <p> 特殊说明:应用首先需要调用上述接口建立订阅关系。
* <p> 事件描述文档链接:<a href="https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar-acl/events/created">https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar-acl/events/created</a>
*
* @param handler
* @return
*/
public Builder onP2CalendarAclCreatedV4(CalendarService.P2CalendarAclCreatedV4Handler handler) {
if (eventType2EventHandler.containsKey("calendar.calendar.acl.created_v4")) {
throw new EventTypeAlreadyHasHandlerException("calendar.calendar.acl.created_v4");
}
eventType2EventHandler.put("calendar.calendar.acl.created_v4", handler);
return this;
}
/**
* <p> ACL移除,当被订阅的日历上有ACL被删除时触发此事件。
* <p> 特殊说明:应用首先需要调用上述接口建立订阅关系。
* <p> 事件描述文档链接:<a href="https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar-acl/events/deleted">https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar-acl/events/deleted</a>
*
* @param handler
* @return
*/
public Builder onP2CalendarAclDeletedV4(CalendarService.P2CalendarAclDeletedV4Handler handler) {
if (eventType2EventHandler.containsKey("calendar.calendar.acl.deleted_v4")) {
throw new EventTypeAlreadyHasHandlerException("calendar.calendar.acl.deleted_v4");
}
eventType2EventHandler.put("calendar.calendar.acl.deleted_v4", handler);
return this;
}
/**
* <p> 日程变更,当被订阅的用户日历下有日程变更时触发此事件。
* <p> 应用首先需要调用[订阅日程变更事件接口](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar-event/subscription)建立订阅关系。应用收到该事件后,使用事件的 user_list 字段中的用户对应的 user_access_token 调用[获取日程列表](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar-event/list)接口拉取事件中 calendar_id 字段对应的日历下的日程数据
* <p> 事件描述文档链接:<a href="https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar-event/events/changed">https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar-event/events/changed</a>
*
* @param handler
* @return
*/
public Builder onP2CalendarEventChangedV4(CalendarService.P2CalendarEventChangedV4Handler handler) {
if (eventType2EventHandler.containsKey("calendar.calendar.event.changed_v4")) {
throw new EventTypeAlreadyHasHandlerException("calendar.calendar.event.changed_v4");
}
eventType2EventHandler.put("calendar.calendar.event.changed_v4", handler);
return this;
}
/**
* <p> 成员字段变更,通过该事件订阅成员字段变更。old_object 展示更新字段的原始值。
* <p> 触发事件的动作有「打开/关闭」开关、「增加/删除」成员字段。
* <p> 事件描述文档链接:<a href="https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/contact-v3/custom_attr_event/events/updated">https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/contact-v3/custom_attr_event/events/updated</a>
*
* @param handler
* @return
*/
public Builder onP2CustomAttrEventUpdatedV3(ContactService.P2CustomAttrEventUpdatedV3Handler handler) {
if (eventType2EventHandler.containsKey("contact.custom_attr_event.updated_v3")) {
throw new EventTypeAlreadyHasHandlerException("contact.custom_attr_event.updated_v3");
}
eventType2EventHandler.put("contact.custom_attr_event.updated_v3", handler);
return this;
}
/**
* <p> 部门被创建,创建通讯录部门时发送该事件给订阅应用。
* <p> 只有当应用拥有被改动字段的数据权限时,才会接收到事件。具体的数据权限与字段的关系请参考[应用权限](https://open.feishu.cn/document/ukTMukTMukTM/uQjN3QjL0YzN04CN2cDN),或查看事件体参数列表的字段描述。
* <p> 事件描述文档链接:<a href="https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/contact-v3/department/events/created">https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/contact-v3/department/events/created</a>
*
* @param handler
* @return
*/
public Builder onP2DepartmentCreatedV3(ContactService.P2DepartmentCreatedV3Handler handler) {
if (eventType2EventHandler.containsKey("contact.department.created_v3")) {
throw new EventTypeAlreadyHasHandlerException("contact.department.created_v3");
}
eventType2EventHandler.put("contact.department.created_v3", handler);
return this;
}
/**
* <p> 部门被删除,订阅这一事件可以获得被删除部门的信息。
* <p> 只有当应用拥有被改动字段的数据权限时,才会接收到事件。具体的数据权限与字段的关系请参考[应用权限](https://open.feishu.cn/document/ukTMukTMukTM/uQjN3QjL0YzN04CN2cDN),或查看事件体参数列表的字段描述。
* <p> 事件描述文档链接:<a href="https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/contact-v3/department/events/deleted">https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/contact-v3/department/events/deleted</a>
*
* @param handler
* @return
*/
public Builder onP2DepartmentDeletedV3(ContactService.P2DepartmentDeletedV3Handler handler) {
if (eventType2EventHandler.containsKey("contact.department.deleted_v3")) {
throw new EventTypeAlreadyHasHandlerException("contact.department.deleted_v3");
}
eventType2EventHandler.put("contact.department.deleted_v3", handler);
return this;
}
/**
* <p> 部门信息被修改,通过该事件订阅部门更新。`old_object`只展示被更新字段的原始值。应用身份访问通讯录的权限为历史版本,不推荐申请。
* <p> 只有当应用拥有被改动字段的数据权限时,才会接收到事件。具体的数据权限与字段的关系请参考[应用权限](https://open.feishu.cn/document/ukTMukTMukTM/uQjN3QjL0YzN04CN2cDN),或查看事件体参数列表的字段描述。
* <p> 事件描述文档链接:<a href="https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/contact-v3/department/events/updated">https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/contact-v3/department/events/updated</a>
*
* @param handler
* @return
*/
public Builder onP2DepartmentUpdatedV3(ContactService.P2DepartmentUpdatedV3Handler handler) {
if (eventType2EventHandler.containsKey("contact.department.updated_v3")) {
throw new EventTypeAlreadyHasHandlerException("contact.department.updated_v3");
}
eventType2EventHandler.put("contact.department.updated_v3", handler);
return this;
}
/**
* <p> 启用人员类型事件,启用人员类型会发出对应事件。
* <p> 事件描述文档链接:<a href="https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/contact-v3/employee_type_enum/events/actived">https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/contact-v3/employee_type_enum/events/actived</a>
*
* @param handler
* @return
*/
public Builder onP2EmployeeTypeEnumActivedV3(ContactService.P2EmployeeTypeEnumActivedV3Handler handler) {
if (eventType2EventHandler.containsKey("contact.employee_type_enum.actived_v3")) {
throw new EventTypeAlreadyHasHandlerException("contact.employee_type_enum.actived_v3");
}
eventType2EventHandler.put("contact.employee_type_enum.actived_v3", handler);
return this;
}
/**
* <p> 新建人员类型事件,新建人员类型会发出对应事件。
* <p> 事件描述文档链接:<a href="https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/contact-v3/employee_type_enum/events/created">https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/contact-v3/employee_type_enum/events/created</a>
*
* @param handler
* @return
*/
public Builder onP2EmployeeTypeEnumCreatedV3(ContactService.P2EmployeeTypeEnumCreatedV3Handler handler) {
if (eventType2EventHandler.containsKey("contact.employee_type_enum.created_v3")) {
throw new EventTypeAlreadyHasHandlerException("contact.employee_type_enum.created_v3");
}
eventType2EventHandler.put("contact.employee_type_enum.created_v3", handler);
return this;
}
/**
* <p> 停用人员类型事件,停用人员类型会发出对应事件。
* <p> 事件描述文档链接:<a href="https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/contact-v3/employee_type_enum/events/deactivated">https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/contact-v3/employee_type_enum/events/deactivated</a>
*
* @param handler
* @return
*/
public Builder onP2EmployeeTypeEnumDeactivatedV3(ContactService.P2EmployeeTypeEnumDeactivatedV3Handler handler) {
if (eventType2EventHandler.containsKey("contact.employee_type_enum.deactivated_v3")) {
throw new EventTypeAlreadyHasHandlerException("contact.employee_type_enum.deactivated_v3");
}
eventType2EventHandler.put("contact.employee_type_enum.deactivated_v3", handler);
return this;
}
/**
* <p> 删除人员类型事件,删除人员类型会发出对应事件。
* <p> 事件描述文档链接:<a href="https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/contact-v3/employee_type_enum/events/deleted">https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/contact-v3/employee_type_enum/events/deleted</a>
*
* @param handler
* @return
*/
public Builder onP2EmployeeTypeEnumDeletedV3(ContactService.P2EmployeeTypeEnumDeletedV3Handler handler) {
if (eventType2EventHandler.containsKey("contact.employee_type_enum.deleted_v3")) {
throw new EventTypeAlreadyHasHandlerException("contact.employee_type_enum.deleted_v3");
}
eventType2EventHandler.put("contact.employee_type_enum.deleted_v3", handler);
return this;
}
/**
* <p> 修改人员类型名称事件,修改人员类型名称会发出对应事件。
* <p> 事件描述文档链接:<a href="https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/contact-v3/employee_type_enum/events/updated">https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/contact-v3/employee_type_enum/events/updated</a>
*
* @param handler
* @return
*/
public Builder onP2EmployeeTypeEnumUpdatedV3(ContactService.P2EmployeeTypeEnumUpdatedV3Handler handler) {
if (eventType2EventHandler.containsKey("contact.employee_type_enum.updated_v3")) {
throw new EventTypeAlreadyHasHandlerException("contact.employee_type_enum.updated_v3");
}
eventType2EventHandler.put("contact.employee_type_enum.updated_v3", handler);
return this;
}
/**
* <p> 通讯录范围权限被更新,当应用通讯录范围权限发生变更时,订阅这个事件的应用会收到事件。
* <p> 事件描述文档链接:<a href="https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/contact-v3/scope/events/updated">https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/contact-v3/scope/events/updated</a>
*
* @param handler
* @return
*/
public Builder onP2ScopeUpdatedV3(ContactService.P2ScopeUpdatedV3Handler handler) {
if (eventType2EventHandler.containsKey("contact.scope.updated_v3")) {
throw new EventTypeAlreadyHasHandlerException("contact.scope.updated_v3");
}
eventType2EventHandler.put("contact.scope.updated_v3", handler);
return this;
}
/**
* <p> 员工入职,通过该事件订阅员工入职。
* <p> 只有当应用拥有被改动字段的数据权限时,才会接收到事件。具体的数据权限与字段的关系请参考[应用权限](https://open.feishu.cn/document/ukTMukTMukTM/uQjN3QjL0YzN04CN2cDN),或查看事件体参数列表的字段描述。
* <p> 事件描述文档链接:<a href="https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/contact-v3/user/events/created">https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/contact-v3/user/events/created</a>
*
* @param handler
* @return
*/
public Builder onP2UserCreatedV3(ContactService.P2UserCreatedV3Handler handler) {
if (eventType2EventHandler.containsKey("contact.user.created_v3")) {
throw new EventTypeAlreadyHasHandlerException("contact.user.created_v3");
}
eventType2EventHandler.put("contact.user.created_v3", handler);
return this;
}
/**
* <p> 员工离职,通过该事件订阅员工离职。应用身份访问通讯录的权限为历史版本,不推荐申请。
* <p> 只有当应用拥有被改动字段的数据权限时,才会接收到事件。具体的数据权限与字段的关系请参考[应用权限](https://open.feishu.cn/document/ukTMukTMukTM/uQjN3QjL0YzN04CN2cDN),或查看事件体参数列表的字段描述。
* <p> 事件描述文档链接:<a href="https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/contact-v3/user/events/deleted">https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/contact-v3/user/events/deleted</a>
*
* @param handler
* @return
*/
public Builder onP2UserDeletedV3(ContactService.P2UserDeletedV3Handler handler) {
if (eventType2EventHandler.containsKey("contact.user.deleted_v3")) {
throw new EventTypeAlreadyHasHandlerException("contact.user.deleted_v3");
}
eventType2EventHandler.put("contact.user.deleted_v3", handler);
return this;
}
/**
* <p> 员工变更,通过该事件订阅员工变更。old_object中只展示更新的字段的原始值。
* <p> 只有当应用拥有被改动字段的数据权限时,才会接收到事件。具体的数据权限与字段的关系请参考[应用权限](https://open.feishu.cn/document/ukTMukTMukTM/uQjN3QjL0YzN04CN2cDN),或查看事件体参数列表的字段描述。
* <p> 事件描述文档链接:<a href="https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/contact-v3/user/events/updated">https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/contact-v3/user/events/updated</a>
*
* @param handler
* @return
*/
public Builder onP2UserUpdatedV3(ContactService.P2UserUpdatedV3Handler handler) {
if (eventType2EventHandler.containsKey("contact.user.updated_v3")) {
throw new EventTypeAlreadyHasHandlerException("contact.user.updated_v3");
}
eventType2EventHandler.put("contact.user.updated_v3", handler);
return this;
}
/**
* <p> ,
* <p> 事件描述文档链接:<a href=""></a>
*
* @param handler
* @return
*/
public Builder onP2ContractCreatedV1(CorehrService.P2ContractCreatedV1Handler handler) {
if (eventType2EventHandler.containsKey("corehr.contract.created_v1")) {
throw new EventTypeAlreadyHasHandlerException("corehr.contract.created_v1");
}
eventType2EventHandler.put("corehr.contract.created_v1", handler);
return this;
}
/**
* <p> ,
* <p> 事件描述文档链接:<a href=""></a>
*
* @param handler
* @return
*/
public Builder onP2ContractDeletedV1(CorehrService.P2ContractDeletedV1Handler handler) {
if (eventType2EventHandler.containsKey("corehr.contract.deleted_v1")) {
throw new EventTypeAlreadyHasHandlerException("corehr.contract.deleted_v1");
}
eventType2EventHandler.put("corehr.contract.deleted_v1", handler);
return this;
}
/**
* <p> ,
* <p> 事件描述文档链接:<a href=""></a>
*
* @param handler
* @return
*/
public Builder onP2ContractUpdatedV1(CorehrService.P2ContractUpdatedV1Handler handler) {
if (eventType2EventHandler.containsKey("corehr.contract.updated_v1")) {
throw new EventTypeAlreadyHasHandlerException("corehr.contract.updated_v1");
}
eventType2EventHandler.put("corehr.contract.updated_v1", handler);
return this;
}
/**
* <p> 部门创建,飞书人事中「部门被创建」时将触发此事件。触发时间为部门实际生效时间,如在 2022-01-01 创建部门,部门生效时间设置为 2022-05-01,事件将在 2022-05-01 进行推送。
* <p> 事件描述文档链接:<a href="https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/department/events/created">https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/department/events/created</a>
*
* @param handler
* @return
*/
public Builder onP2DepartmentCreatedV1(CorehrService.P2DepartmentCreatedV1Handler handler) {
if (eventType2EventHandler.containsKey("corehr.department.created_v1")) {
throw new EventTypeAlreadyHasHandlerException("corehr.department.created_v1");
}
eventType2EventHandler.put("corehr.department.created_v1", handler);
return this;
}
/**
* <p> 部门删除,飞书人事中「部门被删除」时将触发此事件
* <p> 事件描述文档链接:<a href="https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/department/events/deleted">https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/department/events/deleted</a>
*
* @param handler
* @return
*/
public Builder onP2DepartmentDeletedV1(CorehrService.P2DepartmentDeletedV1Handler handler) {
if (eventType2EventHandler.containsKey("corehr.department.deleted_v1")) {
throw new EventTypeAlreadyHasHandlerException("corehr.department.deleted_v1");
}
eventType2EventHandler.put("corehr.department.deleted_v1", handler);
return this;
}
/**
* <p> 部门更新,飞书人事中「部门信息被更新」时将触发此事件。触发时间为部门更新实际生效时间,如在 2022-01-01 更新部门,部门更新生效时间设置为 2022-05-01,事件将在 2022-05-01 进行推送。
* <p> 事件描述文档链接:<a href="https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/department/events/updated">https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/department/events/updated</a>
*
* @param handler
* @return
*/
public Builder onP2DepartmentUpdatedV1(CorehrService.P2DepartmentUpdatedV1Handler handler) {
if (eventType2EventHandler.containsKey("corehr.department.updated_v1")) {
throw new EventTypeAlreadyHasHandlerException("corehr.department.updated_v1");
}
eventType2EventHandler.put("corehr.department.updated_v1", handler);
return this;
}
/**
* <p> 员工转正,员工在飞书人事转正完成后将触发该事件
* <p> 事件描述文档链接:<a href="https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/employment/events/converted">https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/employment/events/converted</a>
*
* @param handler
* @return
*/
public Builder onP2EmploymentConvertedV1(CorehrService.P2EmploymentConvertedV1Handler handler) {
if (eventType2EventHandler.containsKey("corehr.employment.converted_v1")) {
throw new EventTypeAlreadyHasHandlerException("corehr.employment.converted_v1");
}
eventType2EventHandler.put("corehr.employment.converted_v1", handler);
return this;
}
/**
* <p> 雇佣信息创建,员工在飞书人事的「雇佣信息被创建」时将触发此事件
* <p> 事件描述文档链接:<a href="https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/employment/events/created">https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/employment/events/created</a>
*
* @param handler
* @return
*/
public Builder onP2EmploymentCreatedV1(CorehrService.P2EmploymentCreatedV1Handler handler) {
if (eventType2EventHandler.containsKey("corehr.employment.created_v1")) {
throw new EventTypeAlreadyHasHandlerException("corehr.employment.created_v1");
}
eventType2EventHandler.put("corehr.employment.created_v1", handler);
return this;
}
/**
* <p> 雇佣信息删除,员工在飞书人事的「雇佣信息被删除」时将触发此事件
* <p> 事件描述文档链接:<a href="https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/employment/events/deleted">https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/employment/events/deleted</a>
*
* @param handler
* @return
*/
public Builder onP2EmploymentDeletedV1(CorehrService.P2EmploymentDeletedV1Handler handler) {
if (eventType2EventHandler.containsKey("corehr.employment.deleted_v1")) {
throw new EventTypeAlreadyHasHandlerException("corehr.employment.deleted_v1");
}
eventType2EventHandler.put("corehr.employment.deleted_v1", handler);
return this;
}
/**
* <p> 员工完成离职,员工完成离职,即离职日期的次日凌晨时,员工雇佣状态更改为“离职”后触发该事件
* <p> 事件描述文档链接:<a href="https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/employment/events/resigned">https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/employment/events/resigned</a>
*
* @param handler
* @return
*/
public Builder onP2EmploymentResignedV1(CorehrService.P2EmploymentResignedV1Handler handler) {
if (eventType2EventHandler.containsKey("corehr.employment.resigned_v1")) {
throw new EventTypeAlreadyHasHandlerException("corehr.employment.resigned_v1");
}
eventType2EventHandler.put("corehr.employment.resigned_v1", handler);
return this;
}
/**
* <p> 雇佣信息更新,员工在飞书人事的「雇佣信息被更新」时将触发此事件
* <p> 事件描述文档链接:<a href="https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/employment/events/updated">https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/employment/events/updated</a>
*
* @param handler
* @return
*/
public Builder onP2EmploymentUpdatedV1(CorehrService.P2EmploymentUpdatedV1Handler handler) {
if (eventType2EventHandler.containsKey("corehr.employment.updated_v1")) {
throw new EventTypeAlreadyHasHandlerException("corehr.employment.updated_v1");
}
eventType2EventHandler.put("corehr.employment.updated_v1", handler);
return this;
}
/**
* <p> ,
* <p> 事件描述文档链接:<a href=""></a>
*
* @param handler
* @return
*/
public Builder onP2JobCreatedV1(CorehrService.P2JobCreatedV1Handler handler) {
if (eventType2EventHandler.containsKey("corehr.job.created_v1")) {
throw new EventTypeAlreadyHasHandlerException("corehr.job.created_v1");
}
eventType2EventHandler.put("corehr.job.created_v1", handler);
return this;
}
/**
* <p> ,
* <p> 事件描述文档链接:<a href=""></a>
*
* @param handler
* @return
*/
public Builder onP2JobDeletedV1(CorehrService.P2JobDeletedV1Handler handler) {
if (eventType2EventHandler.containsKey("corehr.job.deleted_v1")) {
throw new EventTypeAlreadyHasHandlerException("corehr.job.deleted_v1");
}
eventType2EventHandler.put("corehr.job.deleted_v1", handler);
return this;
}
/**
* <p> ,
* <p> 事件描述文档链接:<a href=""></a>
*
* @param handler
* @return
*/
public Builder onP2JobUpdatedV1(CorehrService.P2JobUpdatedV1Handler handler) {
if (eventType2EventHandler.containsKey("corehr.job.updated_v1")) {
throw new EventTypeAlreadyHasHandlerException("corehr.job.updated_v1");
}
eventType2EventHandler.put("corehr.job.updated_v1", handler);
return this;
}
/**
* <p> 异动状态变更事件,在异动发起审批和产生审批结果时触发该事件,审批结果产生的场景包括撤销、审批通过、审批拒绝
* <p> 事件描述文档链接:<a href="https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/job_change/events/updated">https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/job_change/events/updated</a>
*
* @param handler
* @return
*/
public Builder onP2JobChangeUpdatedV1(CorehrService.P2JobChangeUpdatedV1Handler handler) {
if (eventType2EventHandler.containsKey("corehr.job_change.updated_v1")) {
throw new EventTypeAlreadyHasHandlerException("corehr.job_change.updated_v1");
}
eventType2EventHandler.put("corehr.job_change.updated_v1", handler);
return this;
}
/**
* <p> 员工异动,员工在飞书人事异动完成后将触发该事件
* <p> 事件描述文档链接:<a href="https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/job_data/events/changed">https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/job_data/events/changed</a>
*
* @param handler
* @return
*/
public Builder onP2JobDataChangedV1(CorehrService.P2JobDataChangedV1Handler handler) {
if (eventType2EventHandler.containsKey("corehr.job_data.changed_v1")) {
throw new EventTypeAlreadyHasHandlerException("corehr.job_data.changed_v1");
}
eventType2EventHandler.put("corehr.job_data.changed_v1", handler);
return this;
}
/**
* <p> 员工完成入职,在「飞书人事」将待入职员工手动操作“完成入职”后,触发该事件
* <p> 事件描述文档链接:<a href="https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/job_data/events/employed">https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/job_data/events/employed</a>
*
* @param handler
* @return
*/
public Builder onP2JobDataEmployedV1(CorehrService.P2JobDataEmployedV1Handler handler) {
if (eventType2EventHandler.containsKey("corehr.job_data.employed_v1")) {
throw new EventTypeAlreadyHasHandlerException("corehr.job_data.employed_v1");
}
eventType2EventHandler.put("corehr.job_data.employed_v1", handler);
return this;
}
/**
* <p> 离职状态变更事件,在离职发起审批和产生审批结果时触发该事件,审批结果产生的场景包括撤销、审批通过、审批拒绝
* <p> 事件描述文档链接:<a href="https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/offboarding/events/updated">https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/corehr-v1/offboarding/events/updated</a>
*
* @param handler
* @return
*/
public Builder onP2OffboardingUpdatedV1(CorehrService.P2OffboardingUpdatedV1Handler handler) {
if (eventType2EventHandler.containsKey("corehr.offboarding.updated_v1")) {
throw new EventTypeAlreadyHasHandlerException("corehr.offboarding.updated_v1");
}
eventType2EventHandler.put("corehr.offboarding.updated_v1", handler);
return this;
}
/**
* <p> ,
* <p> 事件描述文档链接:<a href=""></a>
*
* @param handler
* @return
*/
public Builder onP2OrgRoleAuthorizationUpdatedV1(CorehrService.P2OrgRoleAuthorizationUpdatedV1Handler handler) {
if (eventType2EventHandler.containsKey("corehr.org_role_authorization.updated_v1")) {
throw new EventTypeAlreadyHasHandlerException("corehr.org_role_authorization.updated_v1");
}
eventType2EventHandler.put("corehr.org_role_authorization.updated_v1", handler);
return this;
}
/**
* <p> ,
* <p> 事件描述文档链接:<a href=""></a>
*
* @param handler
* @return
*/
public Builder onP2PersonCreatedV1(CorehrService.P2PersonCreatedV1Handler handler) {
if (eventType2EventHandler.containsKey("corehr.person.created_v1")) {