@larksuiteoapi/lark-mcp
Version:
Feishu/Lark OpenAPI MCP
562 lines • 125 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.approvalV4Tools = exports.approvalV4TaskTransfer = exports.approvalV4TaskSearch = exports.approvalV4TaskResubmit = exports.approvalV4TaskReject = exports.approvalV4TaskQuery = exports.approvalV4TaskApprove = exports.approvalV4InstanceSpecifiedRollback = exports.approvalV4InstanceSearchCc = exports.approvalV4InstanceQuery = exports.approvalV4InstancePreview = exports.approvalV4InstanceList = exports.approvalV4InstanceGet = exports.approvalV4InstanceCreate = exports.approvalV4InstanceCommentRemove = exports.approvalV4InstanceCommentList = exports.approvalV4InstanceCommentDelete = exports.approvalV4InstanceCommentCreate = exports.approvalV4InstanceCc = exports.approvalV4InstanceCancel = exports.approvalV4InstanceAddSign = exports.approvalV4ExternalTaskList = exports.approvalV4ExternalInstanceCreate = exports.approvalV4ExternalInstanceCheck = exports.approvalV4ExternalApprovalGet = exports.approvalV4ExternalApprovalCreate = exports.approvalV4ApprovalUnsubscribe = exports.approvalV4ApprovalSubscribe = exports.approvalV4ApprovalGet = exports.approvalV4ApprovalCreate = void 0;
const zod_1 = require("zod");
exports.approvalV4ApprovalCreate = {
project: 'approval',
name: 'approval.v4.approval.create',
sdkName: 'approval.v4.approval.create',
path: '/open-apis/approval/v4/approvals',
httpMethod: 'POST',
description: '[Feishu/Lark]-Approval-Approval definition-Create an approval definition-This interface is used to create an approval definition, allowing flexible specification of the basic information, forms, and processes of the approval definition',
accessTokens: ['tenant'],
schema: {
data: zod_1.z.object({
approval_name: zod_1.z
.string()
.describe('Internationalized text key of the approval title. It starts with @i18n@ and has a minimum length of 9 characters'),
approval_code: zod_1.z
.string()
.describe('Approval Definition Code. Usage instructions:- When this parameter is not provided, it indicates a new approval definition will be created, and the final response will return an auto-generated Approval Definition Code from the system.- When this parameter is provided with a specified Approval Definition Code, it indicates that the interface is being called to update the contents of the specified approval definition, with the update method being a full update that overwrites the original definition content.Approval Definition Code. Retrieval methods:- After calling the interface, obtain the `approval_code` from the response parameters.- Log in to the approval management backend and retrieve it from the URL of the specified approval definition. For detailed instructions, see ')
.optional(),
description: zod_1.z
.string()
.describe('Internationalized text key of the approval description. It starts with @i18n@ and has a minimum length of 9 characters')
.optional(),
viewers: zod_1.z
.array(zod_1.z.object({
viewer_type: zod_1.z
.enum(['TENANT', 'DEPARTMENT', 'USER', 'NONE'])
.describe('Viewer type Options:TENANT(Users in a tenant),DEPARTMENT(Specified departments),USER(Specified users),NONE(No one)')
.optional(),
viewer_user_id: zod_1.z
.string()
.describe('When viewer_type is USER, fill in the user id according to user_id_type')
.optional(),
viewer_department_id: zod_1.z
.string()
.describe('When viewer_type is DEPARTMENT, fill in the department id according to department_id_type')
.optional(),
}))
.describe('The `viewers` field specifies who can initiate the approval from the frontend of the approval application. Usage instructions:- When `viewer_type` is `USER`, `viewer_user_id` needs to be provided.- When `viewer_type` is `DEPARTMENT`, `viewer_department_id` needs to be provided.- When `viewer_type` is `TENANT` or `NONE`, neither `viewer_user_id` nor `viewer_department_id` needs to be provided.**Note**: The maximum length of the list is 200'),
form: zod_1.z
.object({
form_content: zod_1.z
.string()
.describe('Approval Definition Form. The form format is a JSON array. When actually passing the value, the JSON needs to be compressed and escaped into a String type. For descriptions of the JSON fields for each control within the form, refer to .**Note**: The example values below are not escaped. You can refer to the example code in the **Request Example** section below'),
})
.describe('Approval definition form'),
node_list: zod_1.z
.array(zod_1.z.object({
id: zod_1.z
.string()
.describe('Node ID.- The ID of the start node is `START`- The ID of the end node is `END`The start and end nodes do not require `name`, `node_type`, or `approver` to be specified'),
name: zod_1.z
.string()
.describe('Internationalized text key of the node name. It starts with @i18n@ and has a minimum length of 9 characters')
.optional(),
node_type: zod_1.z
.enum(['AND', 'OR', 'SEQUENTIAL'])
.describe("Current Node Approval Method.**Note**: When the value of this parameter is set to sequential approval (`SEQUENTIAL`), the type of approver (`approver.type`) must be set to initiator's choice (`Free`). Options:AND(Consensus Approval: Requires agreement from all approvers for the approval to be passed.),OR(Alternative Approval: Approval will be granted as long as one approver agrees.),SEQUENTIAL(Sequental Sequential Approval: Approval is carried out in the order of the approvers one by one.)")
.optional(),
approver: zod_1.z
.array(zod_1.z.object({
type: zod_1.z
.enum([
'Supervisor',
'SupervisorTopDown',
'DepartmentManager',
'DepartmentManagerTopDown',
'Personal',
'Free',
])
.describe('Types of Approvers. Instructions for Use:- When this parameter is set to Supervisor, SupervisorTopDown, DepartmentManager, or DepartmentManagerTopDown, the level parameter must be filled with the corresponding number of levels. For example, if there is a three-level approval from bottom to top, the parameter value should be Supervisor, and the level parameter value should be 3.- When this parameter is set to Personal, you need to fill in the corresponding user_id to specify the user.- When this parameter is set to Free, there is no need to specify user_id or level. Options:Supervisor(Manager (bottom up)),SupervisorTopDown(Manager (top down)),DepartmentManager(Department supervisor (bottom up)),DepartmentManagerTopDown(Department supervisor (top down)),Personal(Specified member),Free(Selected by the initiator)'),
user_id: zod_1.z
.string()
.describe('User ID:- When the type is set to Personal, this parameter is used to specify the designated user.- The ID type must match the value of the query parameter user_id_type')
.optional(),
level: zod_1.z
.string()
.describe('Approval level, when the type is Supervisor, SupervisorTopDown, DepartmentManager, DepartmentManagerTopDown, you need to fill in the corresponding level in the level, for example: review from the bottom to the top three levels, level = 3')
.optional(),
}))
.describe('List of reviewers')
.optional(),
ccer: zod_1.z
.array(zod_1.z.object({
type: zod_1.z
.enum([
'Supervisor',
'SupervisorTopDown',
'DepartmentManager',
'DepartmentManagerTopDown',
'Personal',
'Free',
])
.describe("Types of Copy Recipients. Instructions for Use:- When this parameter is set to Supervisor, SupervisorTopDown, DepartmentManager, or DepartmentManagerTopDown, the level parameter must be filled with the corresponding number of levels. For example, if there is a copy to three levels of supervisors from bottom to top, the parameter value should be Supervisor, and the level parameter value should be 3.- When this parameter is set to Personal, you need to fill in the corresponding user_id to specify the user.- When this parameter is set to Free, there is no need to specify user_id or level.- The copy recipient type does not support being set to initiator's choice (Free). Options:Supervisor(Manager (bottom up)),SupervisorTopDown(Manager (top down)),DepartmentManager(Department supervisor (bottom up)),DepartmentManagerTopDown(Department supervisor (top down)),Personal(Specified member),Free(Selected by the initiator (Copy recipient type does not support this option))"),
user_id: zod_1.z
.string()
.describe('User ID:- When the type is set to Personal, this parameter is used to specify the designated user.- The ID type must match the value of the query parameter user_id_type')
.optional(),
level: zod_1.z
.string()
.describe('Approval level, when the type is Supervisor, SupervisorTopDown, DepartmentManager, DepartmentManagerTopDown, you need to fill in the corresponding level in the level, for example: review from the bottom to the top three levels, level = 3')
.optional(),
}))
.describe('Copy sender list')
.optional(),
privilege_field: zod_1.z
.object({
writable: zod_1.z
.array(zod_1.z.string())
.describe('A list of form control item IDs with write permissions. The IDs need to be consistent with the control ID values passed in the form parameters'),
readable: zod_1.z
.array(zod_1.z.string())
.describe('A list of form control item IDs with read permissions. The IDs need to be consistent with the control ID values passed in the form parameters'),
})
.describe('Control permissions for table items')
.optional(),
approver_chosen_multi: zod_1.z
.boolean()
.describe('Whether to allow multiple selection of self-selected approvers')
.optional(),
approver_chosen_range: zod_1.z
.array(zod_1.z.object({
type: zod_1.z
.enum(['ALL', 'PERSONAL', 'ROLE'])
.describe('Approver Type Options:ALL(all people),PERSONAL(Designated Approver),ROLE(Designated Roles)')
.optional(),
id_list: zod_1.z
.array(zod_1.z.string())
.describe('ID list.- When type is set to ALL, no value needs to be provided.- When type is set to PERSONAL, provide the user ID, and the ID type must be consistent with the value of user_id_type.- When type is set to ROLE, provide the role ID. Obtaining method: After successfully , you can obtain the role ID from the return result')
.optional(),
}))
.describe('Select range of self-selected approvers')
.optional(),
starter_assignee: zod_1.z
.enum(['STARTER', 'AUTO_PASS', 'SUPERVISOR', 'DEPARTMENT_MANAGER'])
.describe('Operation when the approver is the submitter Options:STARTER(Requester Approval),AUTO_PASS(Auto-approve),SUPERVISOR(Manager Approval),DEPARTMENT_MANAGER(Department supervisor Approval)')
.optional(),
}))
.describe('Approval Definition Node List, used to set the various nodes required for the approval process. The start and end of the approval process are fixed as the start node and end node, respectively. Therefore, when passing values, the start node should be the first element of the list, and the end node should be the last element of the list'),
settings: zod_1.z
.object({
revert_interval: zod_1.z
.number()
.describe('The period of time (in seconds) during which an approval instance can be canceled after it is approved. It defaults to 31 days. 0 indicates not cancelable')
.optional(),
revert_option: zod_1.z
.number()
.describe('Whether an approval can be canceled after the first node. It defaults to 1. 0 indicates No')
.optional(),
reject_option: zod_1.z
.number()
.describe('Settings after approval is rejected. Options:0(RejectDefault Default setting, process terminated),1(RejectSubmit Return to submitter, the submitter can edit the process and resubmit)')
.optional(),
quick_approval_option: zod_1.z
.number()
.describe('Quick approval configuration item, after enabling, approval can be done directly on the card.**Default value**: 1 Options:0(Close disable),1(Open enable)')
.optional(),
})
.describe('Other settings of the approval definition')
.optional(),
config: zod_1.z
.object({
can_update_viewer: zod_1.z.boolean().describe('Whether the visible scope can be modified. It defaults to false'),
can_update_form: zod_1.z.boolean().describe('Whether the form content can be modified. It defaults to false'),
can_update_process: zod_1.z.boolean().describe('Whether process nodes can be modified. It defaults to false'),
can_update_revert: zod_1.z
.boolean()
.describe('Whether the period of time for cancellation can be modified. It defaults to false'),
help_url: zod_1.z
.string()
.describe('Used to configure the help page link, by clicking which users can be redirected to the help page from the Approval Admin')
.optional(),
})
.describe('Approval definition configuration item, used to configure whether the corresponding approval definition can be modified by the user in the ')
.optional(),
icon: zod_1.z
.number()
.describe('Approval icon enumeration, default is 0. The icons from left to right and from top to bottom are numbered 0 to 24.')
.optional(),
i18n_resources: zod_1.z
.array(zod_1.z.object({
locale: zod_1.z
.enum(['zh-CN', 'en-US', 'ja-JP'])
.describe('Language Options:zh-CN(Zhcn Chinese),en-US(Enus English),ja-JP(Jajp Japanese)'),
texts: zod_1.z
.array(zod_1.z.object({
key: zod_1.z
.string()
.describe("The copywriting key starts with `@i18n@`. This field is mainly used for internationalization, allowing users to provide copy in multiple languages simultaneously. The approval center will use the corresponding copy based on the user's current language environment. If the copy in the user's current language environment is not provided, the default language copy will be used"),
value: zod_1.z.string().describe('Copywriting'),
}))
.describe('Copywriting key and value'),
is_default: zod_1.z
.boolean()
.describe('Whether to use the default language. If the default language is used, all keys should be contained; if a non-default language is used but its keys do not exist, the default language will be used instead'),
}))
.describe('Internationalized text'),
process_manager_ids: zod_1.z
.array(zod_1.z.string())
.describe('The list of user IDs for the approval process administrators.- The ID type is consistent with the query parameter `user_id_type`.- The maximum length of the list is 200')
.optional(),
}),
params: zod_1.z.object({
department_id_type: zod_1.z
.enum(['department_id', 'open_department_id'])
.describe('The type of Department ID used in this call. For a detailed description of Department ID, see . Options:department_id(DepartmentId Supports user-defined configuration of Department ID. When custom configuring, a deleted `department_id` can be reused, therefore the `department_id` is unique within the scope of non-deleted departments.),open_department_id(OpenDepartmentId The Department ID automatically generated by the system has a fixed prefix of `od-` and is globally unique within the tenant.)')
.optional(),
user_id_type: zod_1.z.enum(['open_id', 'union_id', 'user_id']).describe('User ID type').optional(),
}),
},
};
exports.approvalV4ApprovalGet = {
project: 'approval',
name: 'approval.v4.approval.get',
sdkName: 'approval.v4.approval.get',
path: '/open-apis/approval/v4/approvals/:approval_code',
httpMethod: 'GET',
description: '[Feishu/Lark]-Approval-Approval definition-View approval definitions-Retrieve information about a specific approval definition based on filters such as approval definition code, language, user ID, etc. The information includes approval definition name, status, form controls, and nodes. After obtaining the approval definition information, you can construct a request to based on the information',
accessTokens: ['tenant'],
schema: {
params: zod_1.z.object({
locale: zod_1.z
.enum(['zh-CN', 'en-US', 'ja-JP'])
.describe('Language options, defaulting to the default language defined in the approval configuration. Options:zh-CN(Zhcn Chinese),en-US(Enus English),ja-JP(Jajp Japanese)')
.optional(),
with_admin_id: zod_1.z
.boolean()
.describe('Optional Whether to return a list of admin IDs with data permissions for the approval process**Default value**: false')
.optional(),
user_id_type: zod_1.z.enum(['open_id', 'union_id', 'user_id']).describe('User ID type').optional(),
}),
path: zod_1.z.object({
approval_code: zod_1.z
.string()
.describe('Approval definition Code. Acquisition methods:- Call the API, and get the approval_code from the response parameters.- Log in to the approval management backend, and retrieve it from the URL of the specified approval definition. For specific operations, refer to '),
}),
},
};
exports.approvalV4ApprovalSubscribe = {
project: 'approval',
name: 'approval.v4.approval.subscribe',
sdkName: 'approval.v4.approval.subscribe',
path: '/open-apis/approval/v4/approvals/:approval_code/subscribe',
httpMethod: 'POST',
description: '[Feishu/Lark]-Approval-Approval Events-Event interface-Subscribe to approval events-When the application , it needs to call this interface to specify the approval definition Code (approval_code) to enable the subscription. Only after enabling it will the application be able to receive the events corresponding to that approval definition',
accessTokens: ['tenant'],
schema: {
path: zod_1.z.object({ approval_code: zod_1.z.string().describe('Review Definition Unique Identifier') }),
},
};
exports.approvalV4ApprovalUnsubscribe = {
project: 'approval',
name: 'approval.v4.approval.unsubscribe',
sdkName: 'approval.v4.approval.unsubscribe',
path: '/open-apis/approval/v4/approvals/:approval_code/unsubscribe',
httpMethod: 'POST',
description: '[Feishu/Lark]-Approval-Approval Events-Event interface-Unsubscribe from approval events-After unsubscribing approval_code, you can no longer receive event notifications for the corresponding instance of the review definition',
accessTokens: ['tenant'],
schema: {
path: zod_1.z.object({ approval_code: zod_1.z.string().describe('Review Definition Unique Identifier').optional() }),
},
};
exports.approvalV4ExternalApprovalCreate = {
project: 'approval',
name: 'approval.v4.externalApproval.create',
sdkName: 'approval.v4.externalApproval.create',
path: '/open-apis/approval/v4/external_approvals',
httpMethod: 'POST',
description: '[Feishu/Lark]-Approval-Third-party approval definition-Create a third-party approval definition-The third-party approval definition is used to set the basic information of the approval, such as the name and description. At the same time, it is also necessary to set the approval initiation page, data callback URL and other information of the third-party approval system, so as to associate Feishu approval with the third-party approval system, so that enterprise employees can directly initiate the third-party approval within Feishu approval, and the approval center can send the approval data back to the third-party approval system',
accessTokens: ['tenant'],
schema: {
data: zod_1.z.object({
approval_name: zod_1.z
.string()
.describe('The name of the third-party approval definition.- The internationalized text key (i.e. the key in the i18n_resources.texts parameter) is passed in here, and the value needs to be assigned in the i18n_resources.texts parameter in the Key:Value format.- This parameter needs to start with @i18n@ and be at least 9 characters long'),
approval_code: zod_1.z
.string()
.describe('This value is used to determine whether calling the current interface is to create or update an approval definition. Specific description:- If the value passed in can be matched to an existing approval definition approval_code, calling this interface will update the corresponding approval definition.- If the value passed in cannot be matched to any approval definition approval_code, a new approval definition will be created and the real approval_code of the new approval definition will be returned (not the value passed in through this parameter)'),
group_code: zod_1.z
.string()
.describe('The approval group to which the approval definition belongs is user-defined. Specific description:- If the group_code passed in does not currently exist, a new approval group will be created.- If the group_code already exists, the approval group name will be updated using group_name'),
group_name: zod_1.z
.string()
.describe('Approval group name. The approval definition group name on the approval initiation page comes from this field. Specific description:- The internationalized text key (i.e. the key in the i18n_resources.texts parameter) is passed in here, and it is also necessary to assign a value in the i18n_resources.texts parameter in the Key:Value format.- This parameter needs to start with @i18n@.- If group_code does not currently exist, group_name is required, which means that the group name is set when a new approval group is created.- If group_code exists, the group name will be updated. If it is not filled in, the group name will not be updated')
.optional(),
description: zod_1.z
.string()
.describe('Description of the approval definition. When the company employee initiates the approval later, the description will be displayed on the approval initiation page.- The internationalized text key (i.e. the key in the i18n_resources.texts parameter) is passed in here, and the value needs to be assigned in the i18n_resources.texts parameter in the Key:Value format.- This parameter needs to start with @i18n@')
.optional(),
external: zod_1.z
.object({
biz_name: zod_1.z
.string()
.describe('The list is used to indicate which third-party system the approval comes from.**Note**:- The internationalized text key (i.e. the key in the i18n_resources.texts parameter) is passed in here, and the value needs to be assigned in the i18n_resources.texts parameter in the Key:Value format.- The parameter needs to start with @i18n@.- When assigning a value to this parameter in i18n_resources, there is no need to set the **from** prefix. The approval center will concatenate the **from** prefix by default')
.optional(),
biz_type: zod_1.z
.string()
.describe('Approval definition business category, custom settings. Multiple approval definitions can be set to the same or different business types for classification')
.optional(),
create_link_mobile: zod_1.z
.string()
.describe('The link for initiating a three-party approval on the mobile terminal.- If this link is set, when initiating an approval on the mobile terminal, it will jump to the three-party approval initiation page corresponding to this link.- If this link is not set, the approval will not be displayed on the mobile terminal')
.optional(),
create_link_pc: zod_1.z
.string()
.describe('The link for initiating a three-party approval on the PC side.- If this link is set, when initiating an approval on the PC side, it will jump to the three-party approval initiation page corresponding to this link.- If this link is not set, the approval will not be displayed on the PC side')
.optional(),
support_pc: zod_1.z
.boolean()
.describe('Approval defines whether to display the approval page on the PC side. If true, it will be displayed, otherwise it will not be displayed.**Note**: support_pc and support_mobile cannot both be false')
.optional(),
support_mobile: zod_1.z
.boolean()
.describe('Approval defines whether to display the approval page on the mobile terminal. If true, it will be displayed, otherwise it will not be displayed.**Note**: support_pc and support_mobile cannot both be false')
.optional(),
support_batch_read: zod_1.z.boolean().describe('Whether marking as read in batches is supported').optional(),
enable_mark_readed: zod_1.z
.boolean()
.describe('Supports labeling readable**Note**: This field is invalid and is not supported for the time being')
.optional(),
enable_quick_operate: zod_1.z
.boolean()
.describe('Whether to support quick operation**Note**: This field is invalid and is not supported for the time being')
.optional(),
action_callback_url: zod_1.z
.string()
.describe('The operation callback URL of the third-party system. After the task approver of the **pending approval** instance clicks to agree or reject the operation, the approval center calls this URL to notify the third-party system. For information about the callback address, see ')
.optional(),
action_callback_token: zod_1.z
.string()
.describe('The token brought during the callback is used by the business system to verify that the request comes from the approval center')
.optional(),
action_callback_key: zod_1.z
.string()
.describe('Request parameter encryption key. If this parameter is configured, the request parameters will be encrypted and the request needs to be decrypted after receiving the request. For the encryption and decryption algorithm, refer to ')
.optional(),
allow_batch_operate: zod_1.z
.boolean()
.describe('Whether batch approval is supported. When the value is true, the approver can process multiple tasks in batches when processing the approval tasks under this definition')
.optional(),
exclude_efficiency_statistics: zod_1.z
.boolean()
.describe('Whether approval process data is not included in efficiency statistics')
.optional(),
})
.describe('Third-party approval related'),
viewers: zod_1.z
.array(zod_1.z.object({
viewer_type: zod_1.z
.enum(['TENANT', 'DEPARTMENT', 'USER', 'NONE'])
.describe('Viewer type Options:TENANT(Users in a tenant),DEPARTMENT(Specified departments),USER(Specified users),NONE(No one)')
.optional(),
viewer_user_id: zod_1.z
.string()
.describe('When viewer_type is USER, fill in the user id according to user_id_type')
.optional(),
viewer_department_id: zod_1.z
.string()
.describe('When viewer_type is DEPARTMENT, fill in the department id according to department_id_type')
.optional(),
}))
.describe('The list of people who can see the approval. The maximum length of the list is 200. Only users in the list of people who can see the approval can see the approval on the approval initiation page. If this parameter is not passed, it means that no one can see it')
.optional(),
i18n_resources: zod_1.z
.array(zod_1.z.object({
locale: zod_1.z
.enum(['zh-CN', 'en-US', 'ja-JP'])
.describe('Language Options:zh-CN(Zhcn Chinese),en-US(Enus English),ja-JP(Jajp Japanese)'),
texts: zod_1.z
.array(zod_1.z.object({
key: zod_1.z.string().describe('The text key needs to match the key of each parameter'),
value: zod_1.z.string().describe('The copy Value is the parameter value corresponding to the copy Key'),
}))
.describe("Key:Value of the text. The key needs to start with @i18n@ and the value must be passed in according to the requirements of each parameter.**Description**: This field is mainly used for internationalization adaptation. It allows texts in multiple languages to be set at the same time. The approval center will use the matching text based on the actual user's current voice environment. If the user's current voice environment text is not set, the default language text will be used"),
is_default: zod_1.z
.boolean()
.describe('Whether to use the default language. If the default language is used, all keys should be contained; if a non-default language is used but its keys do not exist, the default language will be used instead'),
}))
.describe('Internationalized text')
.optional(),
managers: zod_1.z
.array(zod_1.z.string())
.describe('Fill in the process managers id according to the user_id_type(Maximum supported length 200)')
.optional(),
}),
params: zod_1.z.object({
department_id_type: zod_1.z
.enum(['department_id', 'open_department_id'])
.describe('The department ID type in this call. For a detailed description of department IDs, see . Options:department_id(DepartmentId Supports user-defined department ID. When customizing the configuration, the deleted department_id can be reused, so the department_id is unique within the scope of the non-deleted department.),open_department_id(OpenDepartmentId The department ID is automatically generated by the system. The ID prefix is fixed to `od-` and is globally unique within the tenant.)')
.optional(),
user_id_type: zod_1.z.enum(['open_id', 'union_id', 'user_id']).describe('User ID type').optional(),
}),
},
};
exports.approvalV4ExternalApprovalGet = {
project: 'approval',
name: 'approval.v4.externalApproval.get',
sdkName: 'approval.v4.externalApproval.get',
path: '/open-apis/approval/v4/external_approvals/:approval_code',
httpMethod: 'GET',
description: '[Feishu/Lark]-Approval-Third-party approval definition-View third-party approval definition-Call this interface to obtain detailed information of the approval definition using the third-party approval definition code. This includes the name of the third-party approval definition, description, third-party approval initiation link, callback URL, and the list of visible personnel for the approval definition',
accessTokens: ['tenant'],
schema: {
params: zod_1.z.object({ user_id_type: zod_1.z.enum(['open_id', 'union_id', 'user_id']).describe('User ID type').optional() }),
path: zod_1.z.object({
approval_code: zod_1.z
.string()
.describe('Third-party approval definition code can be obtained by:- Calling , which will return the approval definition code.- Logging into the approval management backend and obtaining it from the URL of the specified approval definition. For detailed instructions, see '),
}),
},
};
exports.approvalV4ExternalInstanceCheck = {
project: 'approval',
name: 'approval.v4.externalInstance.check',
sdkName: 'approval.v4.externalInstance.check',
path: '/open-apis/approval/v4/external_instances/check',
httpMethod: 'POST',
description: '[Feishu/Lark]-Approval-Third-party approval instances-Verify instances-Call this interface to verify third-party approval instance data, used to determine whether server-side data is up to date. Submit the latest update time of the instance when making the request. If the server does not have the instance or the instance update time on the server is not the latest, the corresponding instance ID will be returned.For example, set a timed task every 5 minutes to compare the instances generated in the past 5 minutes using this interface. If the data does not exist on the server or is not the latest, you can go to based on the instance ID and task ID returned by this interface',
accessTokens: ['tenant'],
schema: {
data: zod_1.z.object({
instances: zod_1.z
.array(zod_1.z.object({
instance_id: zod_1.z
.string()
.describe('Approval instance ID. Custom configuration needs to ensure uniqueness within the current enterprise and application.**Note**: When calling this interface and the interface for the same third-party approval instance, it is necessary to ensure that the instance ID used is consistent'),
update_time: zod_1.z.string().describe('Latest update time of the approval instance, Unix millisecond timestamp'),
tasks: zod_1.z
.array(zod_1.z.object({
task_id: zod_1.z
.string()
.describe('Approval task ID within the approval instance. Custom configuration needs to ensure uniqueness within the current enterprise and application.**Note**: When calling this interface and the interface for tasks within the same third-party approval instance, it is necessary to ensure that the task ID used is consistent'),
update_time: zod_1.z.string().describe('Latest update time of the task, Unix millisecond timestamp'),
}))
.describe('Task information'),
}))
.describe('Instance information'),
}),
},
};
exports.approvalV4ExternalInstanceCreate = {
project: 'approval',
name: 'approval.v4.externalInstance.create',
sdkName: 'approval.v4.externalInstance.create',
path: '/open-apis/approval/v4/external_instances',
httpMethod: 'POST',
description: '[Feishu/Lark]-Approval-Third-party approval instances-Sync instances-The Approval Center does not handle the circulation of approvals; the circulation of approvals occurs within the third-party system. This interface is used to synchronize the approval instances, approval tasks, and approval forwarding data generated in the third-party system after the approval circulation to the Approval Center',
accessTokens: ['tenant'],
schema: {
data: zod_1.z.object({
approval_code: zod_1.z
.string()
.describe('Approval Definition Code. The return value from is used to specify the approval definition to which the current instance belongs.**Note**: If the `title` parameter is set in the current interface, the approval instance name is displayed according to the `title`. If `title` is not set, the title of the approval instance is taken from the `name` parameter of the corresponding approval definition (`approval_code`)'),
status: zod_1.z
.enum(['PENDING', 'APPROVED', 'REJECTED', 'CANCELED', 'DELETED', 'HIDDEN', 'TERMINATED'])
.describe('Approval instance status Options:PENDING(Approving),APPROVED(The approval process has ended, and the result is approval.),REJECTED(The approval process has ended, and the result is rejection.),CANCELED(Approval sponsor withdraws),DELETED(Approval deleted),HIDDEN(Status hide (do not show status)),TERMINATED(Approval terminated)'),
extra: zod_1.z
.string()
.describe('Approval instance extension parameter, JSON format, needs to be compressed and escaped into a string when passing the value. The document number is realized by passing the business_key parameter.**Note**: The following example values are not escaped, please pay attention to escape when using. You can view the escaped extra example value in the request body example')
.optional(),
instance_id: zod_1.z
.string()
.describe('The approval instance is uniquely identified, user-defined, and it is necessary to ensure that the certificate tenant and the application are unique'),
links: zod_1.z
.object({
pc_link: zod_1.z
.string()
.describe('The PC-side third-party approval instance jump link.**Description**:- When users use the Feishu PC side to view instance details, they will jump through this link.- At least one of pc_link and mobile_link must be filled in'),
mobile_link: zod_1.z
.string()
.describe('The mobile version of the third-party approval instance jump link.**Description**:- When users use the Feishu mobile version to view instance details, they will be redirected through this link.- At least one of pc_link and mobile_link must be filled in')
.optional(),
})
.describe('Approval instance link information. The set link is used to click in the **Initiated** list of the approval center to jump back to the third-party approval system to view the approval details'),
title: zod_1.z
.string()
.describe('Approval display name.**Description**:- If this parameter is filled in, the approval name in the approval list uses this parameter. If this parameter is not filled in, the approval name uses the name defined by the approval.- The internationalized text Key (i.e. the Key in the i18n_resources.texts parameter) is passed in here, and the value needs to be assigned in the i18n_resources.texts parameter in the Key:Value format.- The Key needs to start with @i18n@')
.optional(),
form: zod_1.z
.array(zod_1.z.object({
name: zod_1.z
.string()
.describe('The form field name.**Note**:- The internationalized text key (i.e. the key in the i18n_resources.texts parameter) is passed in here, and the value needs to be assigned in the i18n_resources.texts parameter in the Key:Value format.- The key needs to start with @i18n@')
.optional(),
value: zod_1.z
.string()
.describe('Form Value.**Note**:- The value passed here is the key for internationalization texts (i.e., the Key from the `i18n_resources.texts` parameter), which also needs to be assigned in the `i18n_resources.texts` parameter in a Key:Value format.- The Key should start with `@i18n@`')
.optional(),
}))
.describe('The form data filled in by the user when submitting for approval is used for display in all approval lists. Multiple values can be submitted, but only the first 3 will be displayed in the approval center, and the total length should not exceed 2048 characters')
.optional(),
user_id: zod_1.z
.string()
.describe('Approval Initiator user_id. The initiator can see all initiated approvals in the "Initiated" list in the Approval Center. In the "Pending", "Completed", and "CC" lists, this field is used to display the initiator of the approval. For the method to obtain the user ID, see .**Note**: At least one of the initiator\'s `open_id` or `user_id` must be provided')
.optional(),
user_name: zod_1.z
.string()
.describe('Username of the approval initiator. If the initiator is not a real user (e.g., a department), and does not have a `user_id`, this parameter can be used to pass in a name.**Note**:- The value passed here is the key for internationalization texts (i.e., the Key from the `i18n_resources.texts` parameter), which also needs to be assigned in the `i18n_resources.texts` parameter in a Key:Value format.- The Key should start with `@i18n@`')
.optional(),
open_id: zod_1.z
.string()
.describe('Approval Initiator open_id. The initiator can see all initiated approvals in the "Initiated" list in the Approval Center. In the "Pending", "Completed", and "CC" lists, this field is used to display the initiator of the approval. For the method to obtain the open ID, see .**Note**: At least one of the initiator\'s `open_id` or `user_id` must be provided')
.optional(),
department_id: zod_1.z
.string()
.describe('Department ID of the initiator, which is used to display the department of the initiator in the Approval Center list. If the value is not provided, it will not be displayed. For the method to obtain the department ID, see .**Note**: If the user has not joined any department, pass an empty string `""`, and it will default to displaying the company name. If the `department_name` parameter is provided, the corresponding department name will be displayed')
.optional(),
department_name: zod_1.z
.string()
.describe('Department name of the approval initiator. If the initiator is not a real user or does not belong to a department, this parameter can be used to pass in the department name.**Note**:- The value passed here is the key for internationalization texts (i.e., the Key from the `i18n_resources.texts` parameter), which also needs to be assigned in the `i18n_resources.texts` parameter in a Key:Value format.- The Key should start with `@i18n@`')
.optional(),
start_time: zod_1.z.string().describe('Approval initiation time, Unix millisecond timestamp'),
end_time: zod_1.z
.string()
.describe('Approval instance end time: 0 for unfinished approvals, Unix millisecond timestamp'),
update_time: zod_1.z
.string()
.describe('The latest update time of the approval instance, used for data version control in push operations. If the `update_mode` value is set to `UPDATE`, the approval instance information in the Approval Center will only be updated when the provided `update_time` has changed (i.e., is greater than the previous value).**Note**: This parameter is mainly used to prevent old data from updating new data during concurrent operations'),
display_method: zod_1.z
.enum(['BROWSER', 'SIDEBAR', 'NORMAL', 'TRUSTEESHIP'])
.describe('How to open an approval instance on the list page Options:BROWSER(Jump to the default browser of the system to open),SIDEBAR(Feishu middle side drawer open),NORMAL(Feishu inline page opens),TRUSTEESHIP(Open with hosting (i.e., hosting in the Feishu Approval Center))')
.optional(),
update_mode: zod_1.z
.enum(['REPLACE', 'UPDATE'])
.describe('Update mode.- When `update_mode` is set to `REPLACE`, the current pushed data will always be used as the final data, and any extra tasks or copied data in the Approval Center that are not included in this push will be deleted.- When `update_mode` is set to `UPDATE`, the data in the Approval Center will not be deleted, but only new instances and task data will be added or updated.**Default value**: `REPLACE` Options:REPLACE(Full replacement, default),UPDATE(incremental update)')
.optional(),
task_list: zod_1.z
.array(zod_1.z.object({
task_id: zod_1.z
.string()
.describe('Unique identifier within the approval instance to locate data when updating the approval task'),
user_id: zod_1.z
.string()
.describe("Approver's user_id, the method to obtain it can be found in .**Notes**:- This task will appear in the **Pending** or **Completed** list in the approver's Feishu Approval Center.- At least one of `user_id` or `open_id` must be provided")
.optional(),
open_id: zod_1.z
.string()
.describe("Approver's open_id, the method to obtain it can be found in .**Notes**:- This task will appear in the **Pending** or **Completed** list in the approver's Feishu Approval Center.- At least one of `user_id` or `open_id` must be provided")
.optional(),
title: zod_1.z
.string()
.describe('Approval task name.**Notes**:- The value passed here is an internationalization document key (i.e., the key in `i18n_resources.texts` parameter), and the key needs to be assigned in `i18n_resources.texts` parameter in Key:Value format.- The key must start with `@i18n@`')
.optional(),
links: zod_1.z
.object({
pc_link: zod_1.z
.string()
.describe('PC-side redirection link.**Notes**:- When the user views task details on the Feishu PC side, this link will be used for redirection.- At least one of `pc_link` or `mobile_link` must be provided'),
mobile_link: zod_1.z
.string()
.describe('Mobile-side redirection link.**Notes**:- When the user views task details on the Feishu mobile side, this link will be used for redirection.- At least one of `pc_link` or `mobile_link` must be provided')
.optional(),
})
.describe("A third-party approval redirection link used in the Approval Center's **To-do** and **Done** sections, which allows users to return to the third-party approval system to view task details"),
status: zod_1.z
.enum(['PENDING', 'APPROVED', 'REJECTED', 'TRANSFERRED', 'DONE'])
.describe('Task status Options:PENDING(Pending approval),APPROVED(Task agreed),REJECTED(Reject Task denied),TRANSFERRED(Transefrred Task transfer),DONE(The task passed but the approver did not operate it; the approver cannot see the task. If you want to see it, you can copy the person.)'),
extra: zod_1.z
.string()
.describe('Extend json, the reason for the end of the task needs to be passe