in operations/codeup/changeRequestComments.ts [92:131]
export async function listChangeRequestCommentsFunc(
organizationId: string,
repositoryId: string,
localId: string,
patchSetBizIds?: string[],
commentType: string = "GLOBAL_COMMENT", // Possible values: GLOBAL_COMMENT, INLINE_COMMENT
state: string = "OPENED", // Possible values: OPENED, DRAFT
resolved: boolean = false,
filePath?: string
): Promise<z.infer<typeof ChangeRequestCommentSchema>[]> {
const encodedRepoId = handleRepositoryIdEncoding(repositoryId);
const url = `/oapi/v1/codeup/organizations/${organizationId}/repositories/${encodedRepoId}/changeRequests/${localId}/comments/list`;
// 准备payload
const payload: Record<string, any> = {
patchSetBizIds: patchSetBizIds || [],
commentType: commentType,
state: state,
resolved: resolved,
};
// 添加可选参数
if (filePath) {
payload.filePath = filePath;
}
const response = await yunxiaoRequest(url, {
method: "POST",
body: payload,
});
// 确保响应是数组
if (!Array.isArray(response)) {
return [];
}
// 解析每个评论对象
return response.map(comment => ChangeRequestCommentSchema.parse(comment));
}