gitee.com/larksuite/oapi-sdk-go/v3@v3.0.3/event/dispatcher/contact_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/contact/v3" 19 ) 20 21 // 成员字段变更 22 // 23 // - 通过该事件订阅成员字段变更。old_object 展示更新字段的原始值。 24 // 25 // - 触发事件的动作有「打开/关闭」开关、「增加/删除」成员字段。 26 // 27 // - 事件描述文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/contact-v3/custom_attr_event/events/updated 28 func (dispatcher *EventDispatcher) OnP2CustomAttrEventUpdatedV3(handler func(ctx context.Context, event *larkcontact.P2CustomAttrEventUpdatedV3) error) *EventDispatcher { 29 _, existed := dispatcher.eventType2EventHandler["contact.custom_attr_event.updated_v3"] 30 if existed { 31 panic("event: multiple handler registrations for " + "contact.custom_attr_event.updated_v3") 32 } 33 dispatcher.eventType2EventHandler["contact.custom_attr_event.updated_v3"] = larkcontact.NewP2CustomAttrEventUpdatedV3Handler(handler) 34 return dispatcher 35 } 36 37 // 部门创建事件 38 // 39 // - 创建通讯录部门时发送该事件给订阅应用。 40 // 41 // - 只有当应用拥有被改动字段的数据权限时,才会接收到事件。具体的数据权限与字段的关系请参考[应用权限](/ssl:ttdoc/ukTMukTMukTM/uQjN3QjL0YzN04CN2cDN),或查看事件体参数列表的字段描述。 42 // 43 // - 事件描述文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/contact-v3/department/events/created 44 func (dispatcher *EventDispatcher) OnP2DepartmentCreatedV3(handler func(ctx context.Context, event *larkcontact.P2DepartmentCreatedV3) error) *EventDispatcher { 45 _, existed := dispatcher.eventType2EventHandler["contact.department.created_v3"] 46 if existed { 47 panic("event: multiple handler registrations for " + "contact.department.created_v3") 48 } 49 dispatcher.eventType2EventHandler["contact.department.created_v3"] = larkcontact.NewP2DepartmentCreatedV3Handler(handler) 50 return dispatcher 51 } 52 53 // 部门被删除 54 // 55 // - 订阅这一事件可以获得被删除部门的信息。 56 // 57 // - 只有当应用拥有被改动字段的数据权限时,才会接收到事件。具体的数据权限与字段的关系请参考[应用权限](/ssl:ttdoc/ukTMukTMukTM/uQjN3QjL0YzN04CN2cDN),或查看事件体参数列表的字段描述。 58 // 59 // - 事件描述文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/contact-v3/department/events/deleted 60 func (dispatcher *EventDispatcher) OnP2DepartmentDeletedV3(handler func(ctx context.Context, event *larkcontact.P2DepartmentDeletedV3) error) *EventDispatcher { 61 _, existed := dispatcher.eventType2EventHandler["contact.department.deleted_v3"] 62 if existed { 63 panic("event: multiple handler registrations for " + "contact.department.deleted_v3") 64 } 65 dispatcher.eventType2EventHandler["contact.department.deleted_v3"] = larkcontact.NewP2DepartmentDeletedV3Handler(handler) 66 return dispatcher 67 } 68 69 // 修改部门 70 // 71 // - 通过该事件订阅部门更新。old_object只展示被更新字段的原始值。应用身份访问通讯录的权限为历史版本,不推荐申请。 72 // 73 // - 只有当应用拥有被改动字段的数据权限时,才会接收到事件。具体的数据权限与字段的关系请参考[应用权限](/ssl:ttdoc/ukTMukTMukTM/uQjN3QjL0YzN04CN2cDN),或查看事件体参数列表的字段描述。 74 // 75 // - 事件描述文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/contact-v3/department/events/updated 76 func (dispatcher *EventDispatcher) OnP2DepartmentUpdatedV3(handler func(ctx context.Context, event *larkcontact.P2DepartmentUpdatedV3) error) *EventDispatcher { 77 _, existed := dispatcher.eventType2EventHandler["contact.department.updated_v3"] 78 if existed { 79 panic("event: multiple handler registrations for " + "contact.department.updated_v3") 80 } 81 dispatcher.eventType2EventHandler["contact.department.updated_v3"] = larkcontact.NewP2DepartmentUpdatedV3Handler(handler) 82 return dispatcher 83 } 84 85 // 启用人员类型事件 86 // 87 // - 启用人员类型会发出对应事件。 88 // 89 // - 事件描述文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/contact-v3/employee_type_enum/events/actived 90 func (dispatcher *EventDispatcher) OnP2EmployeeTypeEnumActivedV3(handler func(ctx context.Context, event *larkcontact.P2EmployeeTypeEnumActivedV3) error) *EventDispatcher { 91 _, existed := dispatcher.eventType2EventHandler["contact.employee_type_enum.actived_v3"] 92 if existed { 93 panic("event: multiple handler registrations for " + "contact.employee_type_enum.actived_v3") 94 } 95 dispatcher.eventType2EventHandler["contact.employee_type_enum.actived_v3"] = larkcontact.NewP2EmployeeTypeEnumActivedV3Handler(handler) 96 return dispatcher 97 } 98 99 // 新建人员类型事件 100 // 101 // - 新建人员类型会发出对应事件。 102 // 103 // - 事件描述文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/contact-v3/employee_type_enum/events/created 104 func (dispatcher *EventDispatcher) OnP2EmployeeTypeEnumCreatedV3(handler func(ctx context.Context, event *larkcontact.P2EmployeeTypeEnumCreatedV3) error) *EventDispatcher { 105 _, existed := dispatcher.eventType2EventHandler["contact.employee_type_enum.created_v3"] 106 if existed { 107 panic("event: multiple handler registrations for " + "contact.employee_type_enum.created_v3") 108 } 109 dispatcher.eventType2EventHandler["contact.employee_type_enum.created_v3"] = larkcontact.NewP2EmployeeTypeEnumCreatedV3Handler(handler) 110 return dispatcher 111 } 112 113 // 停用人员类型事件 114 // 115 // - 停用人员类型会发出对应事件。 116 // 117 // - 事件描述文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/contact-v3/employee_type_enum/events/deactivated 118 func (dispatcher *EventDispatcher) OnP2EmployeeTypeEnumDeactivatedV3(handler func(ctx context.Context, event *larkcontact.P2EmployeeTypeEnumDeactivatedV3) error) *EventDispatcher { 119 _, existed := dispatcher.eventType2EventHandler["contact.employee_type_enum.deactivated_v3"] 120 if existed { 121 panic("event: multiple handler registrations for " + "contact.employee_type_enum.deactivated_v3") 122 } 123 dispatcher.eventType2EventHandler["contact.employee_type_enum.deactivated_v3"] = larkcontact.NewP2EmployeeTypeEnumDeactivatedV3Handler(handler) 124 return dispatcher 125 } 126 127 // 删除人员类型事件 128 // 129 // - 删除人员类型会发出对应事件。 130 // 131 // - 事件描述文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/contact-v3/employee_type_enum/events/deleted 132 func (dispatcher *EventDispatcher) OnP2EmployeeTypeEnumDeletedV3(handler func(ctx context.Context, event *larkcontact.P2EmployeeTypeEnumDeletedV3) error) *EventDispatcher { 133 _, existed := dispatcher.eventType2EventHandler["contact.employee_type_enum.deleted_v3"] 134 if existed { 135 panic("event: multiple handler registrations for " + "contact.employee_type_enum.deleted_v3") 136 } 137 dispatcher.eventType2EventHandler["contact.employee_type_enum.deleted_v3"] = larkcontact.NewP2EmployeeTypeEnumDeletedV3Handler(handler) 138 return dispatcher 139 } 140 141 // 修改人员类型名称事件 142 // 143 // - 修改人员类型名称会发出对应事件。 144 // 145 // - 事件描述文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/contact-v3/employee_type_enum/events/updated 146 func (dispatcher *EventDispatcher) OnP2EmployeeTypeEnumUpdatedV3(handler func(ctx context.Context, event *larkcontact.P2EmployeeTypeEnumUpdatedV3) error) *EventDispatcher { 147 _, existed := dispatcher.eventType2EventHandler["contact.employee_type_enum.updated_v3"] 148 if existed { 149 panic("event: multiple handler registrations for " + "contact.employee_type_enum.updated_v3") 150 } 151 dispatcher.eventType2EventHandler["contact.employee_type_enum.updated_v3"] = larkcontact.NewP2EmployeeTypeEnumUpdatedV3Handler(handler) 152 return dispatcher 153 } 154 155 // 通讯录范围权限被更新 156 // 157 // - 当应用通讯录范围权限发生变更时,订阅这个事件的应用会收到事件。 158 // 159 // - 事件描述文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/contact-v3/scope/events/updated 160 func (dispatcher *EventDispatcher) OnP2ScopeUpdatedV3(handler func(ctx context.Context, event *larkcontact.P2ScopeUpdatedV3) error) *EventDispatcher { 161 _, existed := dispatcher.eventType2EventHandler["contact.scope.updated_v3"] 162 if existed { 163 panic("event: multiple handler registrations for " + "contact.scope.updated_v3") 164 } 165 dispatcher.eventType2EventHandler["contact.scope.updated_v3"] = larkcontact.NewP2ScopeUpdatedV3Handler(handler) 166 return dispatcher 167 } 168 169 // 员工入职 170 // 171 // - 通过该事件订阅员工入职。 172 // 173 // - 只有当应用拥有被改动字段的数据权限时,才会接收到事件。具体的数据权限与字段的关系请参考[应用权限](/ssl:ttdoc/ukTMukTMukTM/uQjN3QjL0YzN04CN2cDN),或查看事件体参数列表的字段描述。 174 // 175 // - 事件描述文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/contact-v3/user/events/created 176 func (dispatcher *EventDispatcher) OnP2UserCreatedV3(handler func(ctx context.Context, event *larkcontact.P2UserCreatedV3) error) *EventDispatcher { 177 _, existed := dispatcher.eventType2EventHandler["contact.user.created_v3"] 178 if existed { 179 panic("event: multiple handler registrations for " + "contact.user.created_v3") 180 } 181 dispatcher.eventType2EventHandler["contact.user.created_v3"] = larkcontact.NewP2UserCreatedV3Handler(handler) 182 return dispatcher 183 } 184 185 // 员工离职 186 // 187 // - 通过该事件订阅员工离职。应用身份访问通讯录的权限为历史版本,不推荐申请。 188 // 189 // - 只有当应用拥有被改动字段的数据权限时,才会接收到事件。具体的数据权限与字段的关系请参考[应用权限](/ssl:ttdoc/ukTMukTMukTM/uQjN3QjL0YzN04CN2cDN),或查看事件体参数列表的字段描述。 190 // 191 // - 事件描述文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/contact-v3/user/events/deleted 192 func (dispatcher *EventDispatcher) OnP2UserDeletedV3(handler func(ctx context.Context, event *larkcontact.P2UserDeletedV3) error) *EventDispatcher { 193 _, existed := dispatcher.eventType2EventHandler["contact.user.deleted_v3"] 194 if existed { 195 panic("event: multiple handler registrations for " + "contact.user.deleted_v3") 196 } 197 dispatcher.eventType2EventHandler["contact.user.deleted_v3"] = larkcontact.NewP2UserDeletedV3Handler(handler) 198 return dispatcher 199 } 200 201 // 员工变更 202 // 203 // - 通过该事件订阅员工变更。old_object中只展示更新的字段的原始值。 204 // 205 // - 只有当应用拥有被改动字段的数据权限时,才会接收到事件。具体的数据权限与字段的关系请参考[应用权限](/ssl:ttdoc/ukTMukTMukTM/uQjN3QjL0YzN04CN2cDN),或查看事件体参数列表的字段描述。 206 // 207 // - 事件描述文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/contact-v3/user/events/updated 208 func (dispatcher *EventDispatcher) OnP2UserUpdatedV3(handler func(ctx context.Context, event *larkcontact.P2UserUpdatedV3) error) *EventDispatcher { 209 _, existed := dispatcher.eventType2EventHandler["contact.user.updated_v3"] 210 if existed { 211 panic("event: multiple handler registrations for " + "contact.user.updated_v3") 212 } 213 dispatcher.eventType2EventHandler["contact.user.updated_v3"] = larkcontact.NewP2UserUpdatedV3Handler(handler) 214 return dispatcher 215 }