events
feishu.calendar.events
¶
EventsNamespace
¶
Bases: Namespace
日程接口命名空间。
通过 client.calendar.events 访问,封装飞书日历中日程(event)相关的服务端接口,包括日程的创建、
查询、更新、删除与列举等能力。日程隶属于某个日历,以 event_id 标识。
通常无需直接实例化,应通过 client.calendar.events 访问。
飞书文档
源代码位于: feishu/calendar/events.py
| Python | |
|---|---|
32 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 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 | |
create
async
¶
create(calendar_id: str, event: dict[str, Any], *, idempotency_key: str | None = None) -> NestedDict
创建日程。
event 是描述待创建日程的请求体,原样作为 JSON 发送,常见键包括 summary、
description、start_time、end_time、vchat、visibility、reminders 等。
仅当显式传入 idempotency_key 时才将其并入查询参数,用于幂等创建。
参数:
| 名称 | 类型 | 描述 | 默认 |
|---|---|---|---|
|
str
|
日历的 |
必需 |
|
dict[str, Any]
|
日程定义对象,例如
|
必需 |
|
str | None
|
幂等键;设置后在一段时间内重复请求只会创建一个日程, 为空时省略该参数。 |
None
|
返回:
| 类型 | 描述 |
|---|---|
NestedDict
|
包含 |
NestedDict
|
|
引发:
| 类型 | 描述 |
|---|---|
FeishuError
|
请求失败或返回错误码时抛出。 |
飞书文档
示例:
| Python Console Session | |
|---|---|
源代码位于: feishu/calendar/events.py
delete
async
¶
delete(calendar_id: str, event_id: str) -> NestedDict
删除日程。
参数:
| 名称 | 类型 | 描述 | 默认 |
|---|---|---|---|
|
str
|
日历的 |
必需 |
|
str
|
待删除日程的 |
必需 |
返回:
| 类型 | 描述 |
|---|---|
NestedDict
|
接口返回的数据(通常为空)。 |
引发:
| 类型 | 描述 |
|---|---|
FeishuError
|
请求失败或返回错误码时抛出。 |
飞书文档
示例:
源代码位于: feishu/calendar/events.py
get
async
¶
get(calendar_id: str, event_id: str) -> NestedDict
获取日程信息。
参数:
| 名称 | 类型 | 描述 | 默认 |
|---|---|---|---|
|
str
|
日历的 |
必需 |
|
str
|
日程的 |
必需 |
返回:
| 类型 | 描述 |
|---|---|
NestedDict
|
包含 |
NestedDict
|
|
引发:
| 类型 | 描述 |
|---|---|
FeishuError
|
请求失败或返回错误码时抛出。 |
飞书文档
示例:
| Python Console Session | |
|---|---|
源代码位于: feishu/calendar/events.py
list
async
¶
list(calendar_id: str, *, page_size: int = 50, max_items: int | None = None, start_time: str | None = None, end_time: str | None = None) -> list[NestedDict]
获取日程列表。
自动翻页并将各页结果拼接为单个列表返回。page_size 会被限制在
[feishu.consts.MAX_PAGE_SIZE][] 以内。仅将显式传入的可选查询参数并入请求,
未设置的项会被省略。
参数:
| 名称 | 类型 | 描述 | 默认 |
|---|---|---|---|
|
str
|
日历的 |
必需 |
|
int
|
每页条数,默认为 50,超过上限时按上限截断。 |
50
|
|
int | None
|
最多返回的条数;为空表示返回全部。 |
None
|
|
str | None
|
时间范围的起始(Unix 秒时间戳字符串);为空时省略该参数。 |
None
|
|
str | None
|
时间范围的结束(Unix 秒时间戳字符串);为空时省略该参数。 |
None
|
返回:
| 类型 | 描述 |
|---|---|
list[NestedDict]
|
日程数据列表,每项包含 |
引发:
| 类型 | 描述 |
|---|---|
FeishuError
|
请求失败或返回错误码时抛出。 |
飞书文档
示例:
| Python Console Session | |
|---|---|
源代码位于: feishu/calendar/events.py
update
async
¶
update(calendar_id: str, event_id: str, event: dict[str, Any]) -> NestedDict
更新日程。
event 是描述待更新字段的请求体,原样作为 JSON 发送;仅传入的字段会被更新,
未传入的字段保持不变,常见键包括 summary、description、start_time、end_time
等。
参数:
| 名称 | 类型 | 描述 | 默认 |
|---|---|---|---|
|
str
|
日历的 |
必需 |
|
str
|
待更新日程的 |
必需 |
|
dict[str, Any]
|
待更新字段的映射,例如 |
必需 |
返回:
| 类型 | 描述 |
|---|---|
NestedDict
|
包含 |
引发:
| 类型 | 描述 |
|---|---|
FeishuError
|
请求失败或返回错误码时抛出。 |
飞书文档
示例:
| Python Console Session | |
|---|---|