calendars
feishu.calendar.calendars
¶
CalendarsNamespace
¶
Bases: Namespace
日历接口命名空间。
通过 client.calendar.calendars 访问,封装飞书日历(calendar)相关的服务端接口,包括日历的创建、
查询、更新、删除与列举,以及主日历查询等能力。日历以 calendar_id 标识。
通常无需直接实例化,应通过 client.calendar.calendars 访问。
飞书文档
源代码位于: feishu/calendar/calendars.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 | |
create
async
¶
create(calendar: dict[str, Any]) -> NestedDict
创建共享日历。
calendar 是描述待创建日历的请求体,原样作为 JSON 发送,常见键包括 summary、
description、permissions、color、summary_alias 等。
参数:
| 名称 | 类型 | 描述 | 默认 |
|---|---|---|---|
|
dict[str, Any]
|
日历定义对象,例如 |
必需 |
返回:
| 类型 | 描述 |
|---|---|
NestedDict
|
包含 |
NestedDict
|
|
引发:
| 类型 | 描述 |
|---|---|
FeishuError
|
请求失败或返回错误码时抛出。 |
飞书文档
示例:
| Python Console Session | |
|---|---|
源代码位于: feishu/calendar/calendars.py
delete
async
¶
delete(calendar_id: str) -> NestedDict
删除共享日历。
参数:
| 名称 | 类型 | 描述 | 默认 |
|---|---|---|---|
|
str
|
待删除日历的 |
必需 |
返回:
| 类型 | 描述 |
|---|---|
NestedDict
|
接口返回的数据(通常为空)。 |
引发:
| 类型 | 描述 |
|---|---|
FeishuError
|
请求失败或返回错误码时抛出。 |
飞书文档
示例:
源代码位于: feishu/calendar/calendars.py
get
async
¶
get(calendar_id: str) -> NestedDict
获取日历信息。
参数:
| 名称 | 类型 | 描述 | 默认 |
|---|---|---|---|
|
str
|
日历的唯一标识 |
必需 |
返回:
| 类型 | 描述 |
|---|---|
NestedDict
|
包含 |
NestedDict
|
|
引发:
| 类型 | 描述 |
|---|---|
FeishuError
|
请求失败或返回错误码时抛出。 |
飞书文档
示例:
| Python Console Session | |
|---|---|
源代码位于: feishu/calendar/calendars.py
list
async
¶
查询日历列表。
自动翻页并将各页结果拼接为单个列表返回。page_size 会被限制在
[feishu.consts.MAX_PAGE_SIZE][] 以内。日历列表的条目位于响应体的 calendar_list
字段下。
参数:
| 名称 | 类型 | 描述 | 默认 |
|---|---|---|---|
|
int
|
每页条数,默认为 50,超过上限时按上限截断。 |
50
|
|
int | None
|
最多返回的条数;为空表示返回全部。 |
None
|
返回:
| 类型 | 描述 |
|---|---|
list[NestedDict]
|
日历数据列表,每项包含 |
引发:
| 类型 | 描述 |
|---|---|
FeishuError
|
请求失败或返回错误码时抛出。 |
飞书文档
示例:
| Python Console Session | |
|---|---|
源代码位于: feishu/calendar/calendars.py
primary
async
¶
primary(*, user_id_type: str | None = None) -> NestedDict
查询主日历信息。
获取当前身份的主日历(primary calendar)。仅当显式传入 user_id_type 时才将其
并入查询参数,未设置则省略。
参数:
| 名称 | 类型 | 描述 | 默认 |
|---|---|---|---|
|
str | None
|
返回的用户 ID 类型,如 |
None
|
返回:
| 类型 | 描述 |
|---|---|
NestedDict
|
包含 |
NestedDict
|
“user_id”: “…”}` 的列表。 |
引发:
| 类型 | 描述 |
|---|---|
FeishuError
|
请求失败或返回错误码时抛出。 |
飞书文档
示例:
| Python Console Session | |
|---|---|
源代码位于: feishu/calendar/calendars.py
update
async
¶
update(calendar_id: str, calendar: dict[str, Any]) -> NestedDict
更新日历信息。
calendar 是描述待更新字段的请求体,原样作为 JSON 发送;仅传入的字段会被更新,
未传入的字段保持不变,常见键包括 summary、description、permissions、color
等。
参数:
| 名称 | 类型 | 描述 | 默认 |
|---|---|---|---|
|
str
|
待更新日历的 |
必需 |
|
dict[str, Any]
|
待更新字段的映射,例如 |
必需 |
返回:
| 类型 | 描述 |
|---|---|
NestedDict
|
包含 |
NestedDict
|
等字段。 |
引发:
| 类型 | 描述 |
|---|---|
FeishuError
|
请求失败或返回错误码时抛出。 |
飞书文档
示例:
| Python Console Session | |
|---|---|