From 1b27a00990af7abf868e5f18fed2b91d67407bb1 Mon Sep 17 00:00:00 2001 From: chyroc Date: Mon, 18 Mar 2024 16:18:05 +0800 Subject: [PATCH] add: EventV2DriveFileCreatedInFolderV1 --- README.md | 36 +++++++++--------- README_CN.md | 36 +++++++++--------- api_approval_approval_define.go | 2 +- api_bitable_record_search.go | 2 +- api_corehr_department_search.go | 2 +- api_event_callback_module.go | 38 +++++++++++++++++++ ...back_v2_drive_file_created_in_folder_v1.go | 38 +++++++++++++++++++ api_event_callback_v2_url_preview_get.go | 5 ++- 8 files changed, 120 insertions(+), 39 deletions(-) create mode 100644 api_event_callback_v2_drive_file_created_in_folder_v1.go diff --git a/README.md b/README.md index cc940785..ac474b51 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ https://godoc.org/github.com/chyroc/lark ## Support APIs -API Count: 1016, Event Count: 146 +API Count: 1016, Event Count: 148
@@ -747,28 +747,36 @@ API Count: 1016, Event Count: 146 - EventV2CorehrJobUpdatedV1 - EventV2CorehrJobDeletedV1 - EventV2CorehrProcessUpdatedV2 - - EventV2CorehrProcessCcUpdatedV2 + - EventV2CorehrProcessNodeUpdatedV2 - EventV2CorehrProcessApproverUpdatedV2 - - EventV2ApplicationApplicationAppVersionAuditV6 - - EventV2ApplicationApplicationAppVersionPublishApplyV6 - - EventV2ApplicationApplicationAppVersionPublishRevokeV6 - - EventV2ApplicationApplicationCreatedV6 + - EventV2CorehrProcessCcUpdatedV2 - EventV2ContactCustomAttrEventUpdatedV3 - - EventV2DriveFileBitableRecordChangedV1 - - EventV2DriveFileTitleUpdatedV1 - - EventV2DriveFileReadV1 - - EventV2DriveFileEditV1 + - EventV2ApplicationApplicationCreatedV6 - EventV1AppOpen + - EventV1AppStatusChange + - EventV1OrderPaid + - EventV1AppTicket + - EventV1AppUninstalled + - EventV2ApplicationApplicationVisibilityAddedV6 + - EventV2ApplicationApplicationAppVersionPublishApplyV6 + - EventV2ApplicationApplicationAppVersionPublishRevokeV6 + - EventV2ApplicationApplicationAppVersionAuditV6 - EventV1OutApproval - EventV1RemedyApproval - EventV1ShiftApproval - EventV1WorkApproval - EventV1LeaveApprovalV2 - EventV1LeaveApprovalRevert + - EventV2DriveFileCreatedInFolderV1 + - EventV2DriveFileBitableFieldChangedV1 + - EventV2DriveFileBitableRecordChangedV1 + - EventV2DriveFileTitleUpdatedV1 + - EventV2DriveFileReadV1 + - EventV2DriveFileEditV1 - EventV2DriveFilePermissionMemberAddedV1 + - EventV2DriveFilePermissionMemberRemovedV1 - EventV2DriveFileTrashedV1 - EventV2DriveFileDeletedV1 - - EventV2DriveFilePermissionMemberRemovedV1 - EventV2ApprovalApprovalUpdatedV4 - EventV1ThirdPartyMeetingRoomEventUpdated - EventV1ThirdPartyMeetingRoomEventDeleted @@ -777,11 +785,6 @@ API Count: 1016, Event Count: 146 - EventV2MeetingRoomMeetingRoomStatusChangedV1 - EventV2MeetingRoomMeetingRoomDeletedV1 - EventV1ThirdPartyMeetingRoomEventCreated - - EventV1OrderPaid - - EventV1AppTicket - - EventV1AppUninstalled - - EventV1AppStatusChange - - EventV2ApplicationApplicationVisibilityAddedV6 - EventV2ApplicationApplicationFeedbackCreatedV6 - EventV2ApplicationApplicationFeedbackUpdatedV6 - EventV2TaskTaskUpdateTenantV1 @@ -846,7 +849,6 @@ API Count: 1016, Event Count: 146 - EventV2VCRoomCreatedV1 - EventV2VCRoomDeletedV1 - EventV2VCRoomUpdatedV1 - - EventV2DriveFileBitableFieldChangedV1 - EventV2VCMeetingAllMeetingStartedV1 - EventV2VCMeetingAllMeetingEndedV1 - EventV2VCRoomLevelCreatedV1 diff --git a/README_CN.md b/README_CN.md index e9c35b29..7786d305 100644 --- a/README_CN.md +++ b/README_CN.md @@ -38,7 +38,7 @@ https://godoc.org/github.com/chyroc/lark ## 支持的接口 -API 总数: 1016, 事件总数: 146 +API 总数: 1016, 事件总数: 148
@@ -747,28 +747,36 @@ API 总数: 1016, 事件总数: 146 - EventV2CorehrJobUpdatedV1 - EventV2CorehrJobDeletedV1 - EventV2CorehrProcessUpdatedV2 - - EventV2CorehrProcessCcUpdatedV2 + - EventV2CorehrProcessNodeUpdatedV2 - EventV2CorehrProcessApproverUpdatedV2 - - EventV2ApplicationApplicationAppVersionAuditV6 - - EventV2ApplicationApplicationAppVersionPublishApplyV6 - - EventV2ApplicationApplicationAppVersionPublishRevokeV6 - - EventV2ApplicationApplicationCreatedV6 + - EventV2CorehrProcessCcUpdatedV2 - EventV2ContactCustomAttrEventUpdatedV3 - - EventV2DriveFileBitableRecordChangedV1 - - EventV2DriveFileTitleUpdatedV1 - - EventV2DriveFileReadV1 - - EventV2DriveFileEditV1 + - EventV2ApplicationApplicationCreatedV6 - EventV1AppOpen + - EventV1AppStatusChange + - EventV1OrderPaid + - EventV1AppTicket + - EventV1AppUninstalled + - EventV2ApplicationApplicationVisibilityAddedV6 + - EventV2ApplicationApplicationAppVersionPublishApplyV6 + - EventV2ApplicationApplicationAppVersionPublishRevokeV6 + - EventV2ApplicationApplicationAppVersionAuditV6 - EventV1OutApproval - EventV1RemedyApproval - EventV1ShiftApproval - EventV1WorkApproval - EventV1LeaveApprovalV2 - EventV1LeaveApprovalRevert + - EventV2DriveFileCreatedInFolderV1 + - EventV2DriveFileBitableFieldChangedV1 + - EventV2DriveFileBitableRecordChangedV1 + - EventV2DriveFileTitleUpdatedV1 + - EventV2DriveFileReadV1 + - EventV2DriveFileEditV1 - EventV2DriveFilePermissionMemberAddedV1 + - EventV2DriveFilePermissionMemberRemovedV1 - EventV2DriveFileTrashedV1 - EventV2DriveFileDeletedV1 - - EventV2DriveFilePermissionMemberRemovedV1 - EventV2ApprovalApprovalUpdatedV4 - EventV1ThirdPartyMeetingRoomEventUpdated - EventV1ThirdPartyMeetingRoomEventDeleted @@ -777,11 +785,6 @@ API 总数: 1016, 事件总数: 146 - EventV2MeetingRoomMeetingRoomStatusChangedV1 - EventV2MeetingRoomMeetingRoomDeletedV1 - EventV1ThirdPartyMeetingRoomEventCreated - - EventV1OrderPaid - - EventV1AppTicket - - EventV1AppUninstalled - - EventV1AppStatusChange - - EventV2ApplicationApplicationVisibilityAddedV6 - EventV2ApplicationApplicationFeedbackCreatedV6 - EventV2ApplicationApplicationFeedbackUpdatedV6 - EventV2TaskTaskUpdateTenantV1 @@ -846,7 +849,6 @@ API 总数: 1016, 事件总数: 146 - EventV2VCRoomCreatedV1 - EventV2VCRoomDeletedV1 - EventV2VCRoomUpdatedV1 - - EventV2DriveFileBitableFieldChangedV1 - EventV2VCMeetingAllMeetingStartedV1 - EventV2VCMeetingAllMeetingEndedV1 - EventV2VCRoomLevelCreatedV1 diff --git a/api_approval_approval_define.go b/api_approval_approval_define.go index ac6ac225..4c86afe9 100644 --- a/api_approval_approval_define.go +++ b/api_approval_approval_define.go @@ -117,7 +117,7 @@ type CreateApprovalReqNode struct { // CreateApprovalReqNodeApprover ... type CreateApprovalReqNodeApprover struct { - Type string `json:"type,omitempty"` // 审批/抄送人类型, 1. 当 type 为 Supervisor、SupervisorTopDown、DepartmentManager 、DepartmentManagerTopDown 这 4 种时, 需要在 level 中填写对应的级数, 例如: 由下往上三级主管审批, level = 3;, 2. 当 type 为 Personal 时, 需要填写对应的user_id, 用于指定用户;, 3. 当 approver 为 Free 发起人自选时, 不需要指定 user_id 和level;, 4. ccer不支持 Free 发起人自选, 示例值: "Supervisor", 可选值有: Supervisor: 主管审批(由下往上), SupervisorTopDown: 主管审批(从上往下), DepartmentManager: 部门负责人审批(由下往上), DepartmentManagerTopDown: 部门负责人审批(从上往下), Personal: 指定成员, Free: 发起人自选 + Type string `json:"type,omitempty"` // 审批/抄送人类型, 1. 当 type 为 Supervisor、SupervisorTopDown、DepartmentManager 、DepartmentManagerTopDown 这 4 种时, 需要在 level 中填写对应的级数, 例如: 由下往上三级主管审批, level = 3;, 2. 当 type 为 Personal 时, 需要填写对应的user_id, 用于指定用户;, 3. 当 type 为 Free 发起人自选时, 不需要指定 user_id 和level;, 4. ccer不支持 Free 发起人自选, 示例值: "Supervisor", 可选值有: Supervisor: 主管审批(由下往上), SupervisorTopDown: 主管审批(从上往下), DepartmentManager: 部门负责人审批(由下往上), DepartmentManagerTopDown: 部门负责人审批(从上往下), Personal: 指定成员, Free: 发起人自选 UserID *string `json:"user_id,omitempty"` // 用户id, 根据user_id_type填写, 示例值: "f7cb567e" Level *string `json:"level,omitempty"` // 审批级数, 当 type 为 Supervisor、SupervisorTopDown、DepartmentManager 、DepartmentManagerTopDown 这 4 种时, 需要在 level 中填写对应的级数, 例如: 由下往上三级主管审批, level = 3, 示例值: "3" } diff --git a/api_bitable_record_search.go b/api_bitable_record_search.go index fe5813fa..8e5d41f8 100644 --- a/api_bitable_record_search.go +++ b/api_bitable_record_search.go @@ -80,7 +80,7 @@ type SearchBitableRecordReqFilter struct { type SearchBitableRecordReqFilterCondition struct { FieldName string `json:"field_name,omitempty"` // 筛选条件的左值, 值为字段的名称, 示例值: "字段1", 长度范围: `0` ~ `1000` 字符 Operator string `json:"operator,omitempty"` // 条件运算符, 示例值: "is", 可选值有: is: 等于, isNot: 不等于, contains: 包含, doesNotContain: 不包含, isEmpty: 为空, isNotEmpty: 不为空, isGreater: 大于, isGreaterEqual: 大于等于, isLess: 小于, isLessEqual: 小于等于, like: like, in: in - Value []string `json:"value,omitempty"` // 目标值, [目标值填写指南](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-record/record-filter-guide), 示例值: ["文本类容"], 长度范围: `0` ~ `10` + Value []string `json:"value,omitempty"` // 目标值, [目标值填写指南](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-record/record-filter-guide), 示例值: ["文本内容"], 长度范围: `0` ~ `10` } // SearchBitableRecordReqSort ... diff --git a/api_corehr_department_search.go b/api_corehr_department_search.go index c48a4082..f863199e 100644 --- a/api_corehr_department_search.go +++ b/api_corehr_department_search.go @@ -97,7 +97,7 @@ type SearchCoreHRDepartmentRespItem struct { Active bool `json:"active,omitempty"` // 是否启用 Description []*SearchCoreHRDepartmentRespItemDescription `json:"description,omitempty"` // 描述 CustomFields []*SearchCoreHRDepartmentRespItemCustomField `json:"custom_fields,omitempty"` // 自定义字段, 字段权限要求: 获取部门自定义字段 - StaffingModel *SearchCoreHRDepartmentRespItemStaffingModel `json:"staffing_model,omitempty"` // 是否使用职务 + StaffingModel *SearchCoreHRDepartmentRespItemStaffingModel `json:"staffing_model,omitempty"` // 是否使用职务, (功能灰度中, 暂未开放) } // SearchCoreHRDepartmentRespItemCustomField ... diff --git a/api_event_callback_module.go b/api_event_callback_module.go index db450836..9f9b9634 100644 --- a/api_event_callback_module.go +++ b/api_event_callback_module.go @@ -108,9 +108,11 @@ const ( EventTypeV2CorehrProbationUpdatedV2 EventType = "corehr.probation.updated_v2" EventTypeV2CorehrProcessApproverUpdatedV2 EventType = "corehr.process.approver.updated_v2" EventTypeV2CorehrProcessCcUpdatedV2 EventType = "corehr.process.cc.updated_v2" + EventTypeV2CorehrProcessNodeUpdatedV2 EventType = "corehr.process.node.updated_v2" EventTypeV2CorehrProcessUpdatedV2 EventType = "corehr.process.updated_v2" EventTypeV2DriveFileBitableFieldChangedV1 EventType = "drive.file.bitable_field_changed_v1" EventTypeV2DriveFileBitableRecordChangedV1 EventType = "drive.file.bitable_record_changed_v1" + EventTypeV2DriveFileCreatedInFolderV1 EventType = "drive.file.created_in_folder_v1" EventTypeV2DriveFileDeletedV1 EventType = "drive.file.deleted_v1" EventTypeV2DriveFileEditV1 EventType = "drive.file.edit_v1" EventTypeV2DriveFilePermissionMemberAddedV1 EventType = "drive.file.permission_member_added_v1" @@ -258,9 +260,11 @@ type eventHandler struct { eventV2CorehrProbationUpdatedV2Handler EventV2CorehrProbationUpdatedV2Handler eventV2CorehrProcessApproverUpdatedV2Handler EventV2CorehrProcessApproverUpdatedV2Handler eventV2CorehrProcessCcUpdatedV2Handler EventV2CorehrProcessCcUpdatedV2Handler + eventV2CorehrProcessNodeUpdatedV2Handler EventV2CorehrProcessNodeUpdatedV2Handler eventV2CorehrProcessUpdatedV2Handler EventV2CorehrProcessUpdatedV2Handler eventV2DriveFileBitableFieldChangedV1Handler EventV2DriveFileBitableFieldChangedV1Handler eventV2DriveFileBitableRecordChangedV1Handler EventV2DriveFileBitableRecordChangedV1Handler + eventV2DriveFileCreatedInFolderV1Handler EventV2DriveFileCreatedInFolderV1Handler eventV2DriveFileDeletedV1Handler EventV2DriveFileDeletedV1Handler eventV2DriveFileEditV1Handler EventV2DriveFileEditV1Handler eventV2DriveFilePermissionMemberAddedV1Handler EventV2DriveFilePermissionMemberAddedV1Handler @@ -409,9 +413,11 @@ func (r *eventHandler) clone() *eventHandler { eventV2CorehrProbationUpdatedV2Handler: r.eventV2CorehrProbationUpdatedV2Handler, eventV2CorehrProcessApproverUpdatedV2Handler: r.eventV2CorehrProcessApproverUpdatedV2Handler, eventV2CorehrProcessCcUpdatedV2Handler: r.eventV2CorehrProcessCcUpdatedV2Handler, + eventV2CorehrProcessNodeUpdatedV2Handler: r.eventV2CorehrProcessNodeUpdatedV2Handler, eventV2CorehrProcessUpdatedV2Handler: r.eventV2CorehrProcessUpdatedV2Handler, eventV2DriveFileBitableFieldChangedV1Handler: r.eventV2DriveFileBitableFieldChangedV1Handler, eventV2DriveFileBitableRecordChangedV1Handler: r.eventV2DriveFileBitableRecordChangedV1Handler, + eventV2DriveFileCreatedInFolderV1Handler: r.eventV2DriveFileCreatedInFolderV1Handler, eventV2DriveFileDeletedV1Handler: r.eventV2DriveFileDeletedV1Handler, eventV2DriveFileEditV1Handler: r.eventV2DriveFileEditV1Handler, eventV2DriveFilePermissionMemberAddedV1Handler: r.eventV2DriveFilePermissionMemberAddedV1Handler, @@ -559,9 +565,11 @@ type eventBody struct { eventV2CorehrProbationUpdatedV2 *EventV2CorehrProbationUpdatedV2 eventV2CorehrProcessApproverUpdatedV2 *EventV2CorehrProcessApproverUpdatedV2 eventV2CorehrProcessCcUpdatedV2 *EventV2CorehrProcessCcUpdatedV2 + eventV2CorehrProcessNodeUpdatedV2 *EventV2CorehrProcessNodeUpdatedV2 eventV2CorehrProcessUpdatedV2 *EventV2CorehrProcessUpdatedV2 eventV2DriveFileBitableFieldChangedV1 *EventV2DriveFileBitableFieldChangedV1 eventV2DriveFileBitableRecordChangedV1 *EventV2DriveFileBitableRecordChangedV1 + eventV2DriveFileCreatedInFolderV1 *EventV2DriveFileCreatedInFolderV1 eventV2DriveFileDeletedV1 *EventV2DriveFileDeletedV1 eventV2DriveFileEditV1 *EventV2DriveFileEditV1 eventV2DriveFilePermissionMemberAddedV1 *EventV2DriveFilePermissionMemberAddedV1 @@ -969,6 +977,12 @@ func (r *EventCallbackService) parserEventV2(req *eventReq) error { return err } req.eventV2CorehrProcessCcUpdatedV2 = event + case EventTypeV2CorehrProcessNodeUpdatedV2: + event := new(EventV2CorehrProcessNodeUpdatedV2) + if err := req.unmarshalEvent(event); err != nil { + return err + } + req.eventV2CorehrProcessNodeUpdatedV2 = event case EventTypeV2CorehrProcessUpdatedV2: event := new(EventV2CorehrProcessUpdatedV2) if err := req.unmarshalEvent(event); err != nil { @@ -987,6 +1001,12 @@ func (r *EventCallbackService) parserEventV2(req *eventReq) error { return err } req.eventV2DriveFileBitableRecordChangedV1 = event + case EventTypeV2DriveFileCreatedInFolderV1: + event := new(EventV2DriveFileCreatedInFolderV1) + if err := req.unmarshalEvent(event); err != nil { + return err + } + req.eventV2DriveFileCreatedInFolderV1 = event case EventTypeV2DriveFileDeletedV1: event := new(EventV2DriveFileDeletedV1) if err := req.unmarshalEvent(event); err != nil { @@ -2273,6 +2293,15 @@ func (r *EventCallbackService) handlerEvent(ctx context.Context, req *eventReq) } } return true, s, err + case req.eventV2CorehrProcessNodeUpdatedV2 != nil: + if r.cli.eventHandler.eventV2CorehrProcessNodeUpdatedV2Handler != nil { + if r.cli.noBlocking { + go r.cli.eventHandler.eventV2CorehrProcessNodeUpdatedV2Handler(ctx, r.cli, req.Schema, req.Header, req.eventV2CorehrProcessNodeUpdatedV2) + } else { + s, err = r.cli.eventHandler.eventV2CorehrProcessNodeUpdatedV2Handler(ctx, r.cli, req.Schema, req.Header, req.eventV2CorehrProcessNodeUpdatedV2) + } + } + return true, s, err case req.eventV2CorehrProcessUpdatedV2 != nil: if r.cli.eventHandler.eventV2CorehrProcessUpdatedV2Handler != nil { if r.cli.noBlocking { @@ -2300,6 +2329,15 @@ func (r *EventCallbackService) handlerEvent(ctx context.Context, req *eventReq) } } return true, s, err + case req.eventV2DriveFileCreatedInFolderV1 != nil: + if r.cli.eventHandler.eventV2DriveFileCreatedInFolderV1Handler != nil { + if r.cli.noBlocking { + go r.cli.eventHandler.eventV2DriveFileCreatedInFolderV1Handler(ctx, r.cli, req.Schema, req.Header, req.eventV2DriveFileCreatedInFolderV1) + } else { + s, err = r.cli.eventHandler.eventV2DriveFileCreatedInFolderV1Handler(ctx, r.cli, req.Schema, req.Header, req.eventV2DriveFileCreatedInFolderV1) + } + } + return true, s, err case req.eventV2DriveFileDeletedV1 != nil: if r.cli.eventHandler.eventV2DriveFileDeletedV1Handler != nil { if r.cli.noBlocking { diff --git a/api_event_callback_v2_drive_file_created_in_folder_v1.go b/api_event_callback_v2_drive_file_created_in_folder_v1.go new file mode 100644 index 00000000..897f2cdf --- /dev/null +++ b/api_event_callback_v2_drive_file_created_in_folder_v1.go @@ -0,0 +1,38 @@ +// Code generated by lark_sdk_gen. DO NOT EDIT. +/** + * Copyright 2022 chyroc + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package lark + +import ( + "context" +) + +// EventV2DriveFileCreatedInFolderV1 当用户订阅的文件夹下有新建文件时将触发此事件。 +// +// 了解事件订阅的使用场景和配置流程, 请点击查看 [事件订阅概述](https://open.feishu.cn/document/ukTMukTMukTM/uUTNz4SN1MjL1UzM) +// +// doc: https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/drive-v1/event/list/file-created-in-folder +func (r *EventCallbackService) HandlerEventV2DriveFileCreatedInFolderV1(f EventV2DriveFileCreatedInFolderV1Handler) { + r.cli.eventHandler.eventV2DriveFileCreatedInFolderV1Handler = f +} + +// EventV2DriveFileCreatedInFolderV1Handler event EventV2DriveFileCreatedInFolderV1 handler +type EventV2DriveFileCreatedInFolderV1Handler func(ctx context.Context, cli *Lark, schema string, header *EventHeaderV2, event *EventV2DriveFileCreatedInFolderV1) (string, error) + +// EventV2DriveFileCreatedInFolderV1 ... +type EventV2DriveFileCreatedInFolderV1 struct { +} diff --git a/api_event_callback_v2_url_preview_get.go b/api_event_callback_v2_url_preview_get.go index 4a159fd0..da625bbb 100644 --- a/api_event_callback_v2_url_preview_get.go +++ b/api_event_callback_v2_url_preview_get.go @@ -23,6 +23,7 @@ import ( // EventV2URLPreviewGet 拉取链接预览数据 回调作用于应用的链接预览能力。当企业内发布了具备链接预览能力的应用后, 企业成员在飞书客户端查看、发送链接时, 如果链接命中了应用注册的 URL 规则, 则应用会向指定的回调地址发送 拉取链接预览数据 回调。你需要在对应的业务服务器内接收回调请求, 并在 3 秒内响应回调请求, 飞书客户端会根据响应数据渲染链接预览效果。 // +// 需应用配置并生效链接预览能力后, 回调才可以推送生效。 // ## 回调 // :::html // @@ -50,7 +51,6 @@ import ( // // // 暂无 -// 需应用配置并生效链接预览能力后, 回调才可以推送生效。 // // // @@ -58,7 +58,8 @@ import ( // 字段权限要求 // // -// 暂无 +// 事件结构体中存在 `user_id` 敏感字段, 仅当应用开启以下权限后才会返回。如果无需获取该字段, 则不建议申请。 +// 获取用户 user ID // // //