comments
feishu.task.comments
¶
CommentsNamespace
¶
Bases: Namespace
任务评论(Comment)接口命名空间。
通过 client.task.comments 访问,封装飞书任务 v2 中评论的增删改查(创建、列举、更新、删除)。
评论挂载在某个资源上,由 resource_type(默认 task)与 resource_id(任务的 guid)共同定位。
通常无需直接实例化,应通过 client.task.comments 访问。
飞书文档
源代码位于: feishu/task/comments.py
| Python | |
|---|---|
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 | |
create
async
¶
create(resource_id: str, content: str, *, resource_type: str = 'task', user_id_type: str | None = None) -> NestedDict
在任务上创建评论。
参数:
| 名称 | 类型 | 描述 | 默认 |
|---|---|---|---|
|
str
|
被评论资源的 ID;当 |
必需 |
|
str
|
评论内容文本。 |
必需 |
|
str
|
被评论资源的类型,默认 |
'task'
|
|
str | None
|
用户 ID 的类型,如 |
None
|
返回:
| 类型 | 描述 |
|---|---|
NestedDict
|
创建结果数据,含 |
NestedDict
|
|
引发:
| 类型 | 描述 |
|---|---|
FeishuError
|
请求失败或返回错误码时抛出。 |
飞书文档
示例:
| Python Console Session | |
|---|---|
源代码位于: feishu/task/comments.py
list
async
¶
list(resource_id: str, *, resource_type: str = 'task', user_id_type: str | None = None, page_size: int = 50, max_items: int | None = None) -> list[NestedDict]
列举某个任务下的评论。
自动翻页并汇总目标资源上的评论。
参数:
| 名称 | 类型 | 描述 | 默认 |
|---|---|---|---|
|
str
|
资源 ID;当 |
必需 |
|
str
|
资源类型,默认 |
'task'
|
|
str | None
|
用户 ID 的类型,如 |
None
|
|
int
|
每页数量。默认为 50;超过 feishu.consts.MAX_PAGE_SIZE 时由客户端收敛。 |
50
|
|
int | None
|
最多返回的评论数量, |
None
|
返回:
| 类型 | 描述 |
|---|---|
list[NestedDict]
|
评论对象列表( |
引发:
| 类型 | 描述 |
|---|---|
FeishuError
|
请求失败或返回错误码时抛出。 |
飞书文档
示例:
| Python Console Session | |
|---|---|
源代码位于: feishu/task/comments.py
update
async
¶
update(comment_id: str, content: str) -> NestedDict
更新评论内容。
仅评论的创建者可编辑评论内容。需要 task:comment:write 权限。
参数:
| 名称 | 类型 | 描述 | 默认 |
|---|---|---|---|
|
str
|
评论的唯一标识 |
必需 |
|
str
|
更新后的评论内容文本。 |
必需 |
返回:
| 类型 | 描述 |
|---|---|
NestedDict
|
更新后的评论数据,含 |
NestedDict
|
|
引发:
| 类型 | 描述 |
|---|---|
FeishuError
|
请求失败或返回错误码时抛出。 |
飞书文档
示例:
| Python Console Session | |
|---|---|
源代码位于: feishu/task/comments.py
delete
async
¶
delete(comment_id: str) -> NestedDict
删除评论。
需要 task:comment:write 权限。
参数:
| 名称 | 类型 | 描述 | 默认 |
|---|---|---|---|
|
str
|
评论的唯一标识 |
必需 |
返回:
| 类型 | 描述 |
|---|---|
NestedDict
|
空数据体(接口成功时不返回额外字段)。 |
引发:
| 类型 | 描述 |
|---|---|
FeishuError
|
请求失败或返回错误码时抛出。 |
飞书文档
示例: