gitee.com/larksuite/oapi-sdk-go/v3@v3.0.3/event/dispatcher/calendar_event_dispatch.go (about) 1 // Package dispatcher code generated by oapi sdk gen 2 /* 3 * MIT License 4 * 5 * Copyright (c) 2022 Lark Technologies Pte. Ltd. 6 * 7 * 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: 8 * 9 * The above copyright notice and this permission notice, shall be included in all copies or substantial portions of the Software. 10 * 11 * 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. 12 */ 13 14 package dispatcher 15 16 import ( 17 "context" 18 "gitee.com/larksuite/oapi-sdk-go/v3/service/calendar/v4" 19 ) 20 21 // 日历变更 22 // 23 // - 当订阅用户的日历列表有日历变动时触发此事件。 24 // 25 // - 应用首先需要调用上述接口建立订阅关系。应用收到该事件后,使用事件的 user_list 字段中的用户对应的 user_access_token 调用[获取日历列表](/ssl:ttdoc/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar/list)接口拉取增量的变更数据 26 // 27 // - 事件描述文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar/events/changed 28 func (dispatcher *EventDispatcher) OnP2CalendarChangedV4(handler func(ctx context.Context, event *larkcalendar.P2CalendarChangedV4) error) *EventDispatcher { 29 _, existed := dispatcher.eventType2EventHandler["calendar.calendar.changed_v4"] 30 if existed { 31 panic("event: multiple handler registrations for " + "calendar.calendar.changed_v4") 32 } 33 dispatcher.eventType2EventHandler["calendar.calendar.changed_v4"] = larkcalendar.NewP2CalendarChangedV4Handler(handler) 34 return dispatcher 35 } 36 37 // ACL新建 38 // 39 // - 当被订阅的日历上有ACL被创建时触发此事件。 40 // 41 // - 特殊说明:应用首先需要调用上述接口建立订阅关系。 42 // 43 // - 事件描述文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar-acl/events/created 44 func (dispatcher *EventDispatcher) OnP2CalendarAclCreatedV4(handler func(ctx context.Context, event *larkcalendar.P2CalendarAclCreatedV4) error) *EventDispatcher { 45 _, existed := dispatcher.eventType2EventHandler["calendar.calendar.acl.created_v4"] 46 if existed { 47 panic("event: multiple handler registrations for " + "calendar.calendar.acl.created_v4") 48 } 49 dispatcher.eventType2EventHandler["calendar.calendar.acl.created_v4"] = larkcalendar.NewP2CalendarAclCreatedV4Handler(handler) 50 return dispatcher 51 } 52 53 // ACL移除 54 // 55 // - 当被订阅的日历上有ACL被删除时触发此事件。 56 // 57 // - 特殊说明:应用首先需要调用上述接口建立订阅关系。 58 // 59 // - 事件描述文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar-acl/events/deleted 60 func (dispatcher *EventDispatcher) OnP2CalendarAclDeletedV4(handler func(ctx context.Context, event *larkcalendar.P2CalendarAclDeletedV4) error) *EventDispatcher { 61 _, existed := dispatcher.eventType2EventHandler["calendar.calendar.acl.deleted_v4"] 62 if existed { 63 panic("event: multiple handler registrations for " + "calendar.calendar.acl.deleted_v4") 64 } 65 dispatcher.eventType2EventHandler["calendar.calendar.acl.deleted_v4"] = larkcalendar.NewP2CalendarAclDeletedV4Handler(handler) 66 return dispatcher 67 } 68 69 // 日程变更 70 // 71 // - 当被订阅的用户日历下有日程变更时触发此事件。 72 // 73 // - 应用首先需要调用[订阅日程变更事件接口](/ssl:ttdoc/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar-event/subscription)建立订阅关系。应用收到该事件后,使用事件的 user_list 字段中的用户对应的 user_access_token 调用[获取日程列表](/ssl:ttdoc/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar-event/list)接口拉取事件中 calendar_id 字段对应的日历下的日程数据 74 // 75 // - 事件描述文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar-event/events/changed 76 func (dispatcher *EventDispatcher) OnP2CalendarEventChangedV4(handler func(ctx context.Context, event *larkcalendar.P2CalendarEventChangedV4) error) *EventDispatcher { 77 _, existed := dispatcher.eventType2EventHandler["calendar.calendar.event.changed_v4"] 78 if existed { 79 panic("event: multiple handler registrations for " + "calendar.calendar.event.changed_v4") 80 } 81 dispatcher.eventType2EventHandler["calendar.calendar.event.changed_v4"] = larkcalendar.NewP2CalendarEventChangedV4Handler(handler) 82 return dispatcher 83 }