gitee.com/larksuite/oapi-sdk-go/v3@v3.0.3/service/calendar/v4/api.go (about) 1 // Package calendar code generated by oapi sdk gen 2 /* 3 * MIT License 4 * 5 * Copyright (c) 2022 Lark Technologies Pte. Ltd. 6 * 7 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 8 * 9 * The above copyright notice and this permission notice, shall be included in all copies or substantial portions of the Software. 10 * 11 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 12 */ 13 14 package larkcalendar 15 16 import ( 17 "context" 18 "net/http" 19 20 "gitee.com/larksuite/oapi-sdk-go/v3/core" 21 ) 22 23 func NewService(config *larkcore.Config) *CalendarService { 24 c := &CalendarService{config: config} 25 c.Calendar = &calendar{service: c} 26 c.CalendarAcl = &calendarAcl{service: c} 27 c.CalendarEvent = &calendarEvent{service: c} 28 c.CalendarEventAttendee = &calendarEventAttendee{service: c} 29 c.CalendarEventAttendeeChatMember = &calendarEventAttendeeChatMember{service: c} 30 c.ExchangeBinding = &exchangeBinding{service: c} 31 c.Freebusy = &freebusy{service: c} 32 c.Setting = &setting{service: c} 33 c.TimeoffEvent = &timeoffEvent{service: c} 34 return c 35 } 36 37 type CalendarService struct { 38 config *larkcore.Config 39 Calendar *calendar // 日历 40 CalendarAcl *calendarAcl // 用户访问控制 41 CalendarEvent *calendarEvent // 日程 42 CalendarEventAttendee *calendarEventAttendee // 日程参与人 43 CalendarEventAttendeeChatMember *calendarEventAttendeeChatMember // 日程参与人群成员 44 ExchangeBinding *exchangeBinding // Exchange绑定 45 Freebusy *freebusy // 忙闲 46 Setting *setting // 日历设置 47 TimeoffEvent *timeoffEvent // 请假 48 } 49 50 type calendar struct { 51 service *CalendarService 52 } 53 type calendarAcl struct { 54 service *CalendarService 55 } 56 type calendarEvent struct { 57 service *CalendarService 58 } 59 type calendarEventAttendee struct { 60 service *CalendarService 61 } 62 type calendarEventAttendeeChatMember struct { 63 service *CalendarService 64 } 65 type exchangeBinding struct { 66 service *CalendarService 67 } 68 type freebusy struct { 69 service *CalendarService 70 } 71 type setting struct { 72 service *CalendarService 73 } 74 type timeoffEvent struct { 75 service *CalendarService 76 } 77 78 // 创建日历 79 // 80 // - 该接口用于为当前身份(应用 / 用户)创建一个共享日历。;;身份由 Header Authorization 的 Token 类型决定。 81 // 82 // - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar/create 83 // 84 // - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/calendarv4/create_calendar.go 85 func (c *calendar) Create(ctx context.Context, req *CreateCalendarReq, options ...larkcore.RequestOptionFunc) (*CreateCalendarResp, error) { 86 // 发起请求 87 apiReq := req.apiReq 88 apiReq.ApiPath = "/open-apis/calendar/v4/calendars" 89 apiReq.HttpMethod = http.MethodPost 90 apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant, larkcore.AccessTokenTypeUser} 91 apiResp, err := larkcore.Request(ctx, apiReq, c.service.config, options...) 92 if err != nil { 93 return nil, err 94 } 95 // 反序列响应结果 96 resp := &CreateCalendarResp{ApiResp: apiResp} 97 err = apiResp.JSONUnmarshalBody(resp) 98 if err != nil { 99 return nil, err 100 } 101 return resp, err 102 } 103 104 // 删除日历 105 // 106 // - 该接口用于以当前身份(应用 / 用户)删除一个共享日历。;;身份由 Header Authorization 的 Token 类型决定。 107 // 108 // - 当前身份必须对日历具有 owner 权限。 109 // 110 // - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar/delete 111 // 112 // - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/calendarv4/delete_calendar.go 113 func (c *calendar) Delete(ctx context.Context, req *DeleteCalendarReq, options ...larkcore.RequestOptionFunc) (*DeleteCalendarResp, error) { 114 // 发起请求 115 apiReq := req.apiReq 116 apiReq.ApiPath = "/open-apis/calendar/v4/calendars/:calendar_id" 117 apiReq.HttpMethod = http.MethodDelete 118 apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant, larkcore.AccessTokenTypeUser} 119 apiResp, err := larkcore.Request(ctx, apiReq, c.service.config, options...) 120 if err != nil { 121 return nil, err 122 } 123 // 反序列响应结果 124 resp := &DeleteCalendarResp{ApiResp: apiResp} 125 err = apiResp.JSONUnmarshalBody(resp) 126 if err != nil { 127 return nil, err 128 } 129 return resp, err 130 } 131 132 // 获取日历 133 // 134 // - 该接口用于以当前身份(应用 / 用户)根据日历 ID 获取日历信息。;;身份由 Header Authorization 的 Token 类型决定。 135 // 136 // - 当前身份必须对日历有访问权限。 137 // 138 // - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar/get 139 // 140 // - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/calendarv4/get_calendar.go 141 func (c *calendar) Get(ctx context.Context, req *GetCalendarReq, options ...larkcore.RequestOptionFunc) (*GetCalendarResp, error) { 142 // 发起请求 143 apiReq := req.apiReq 144 apiReq.ApiPath = "/open-apis/calendar/v4/calendars/:calendar_id" 145 apiReq.HttpMethod = http.MethodGet 146 apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant, larkcore.AccessTokenTypeUser} 147 apiResp, err := larkcore.Request(ctx, apiReq, c.service.config, options...) 148 if err != nil { 149 return nil, err 150 } 151 // 反序列响应结果 152 resp := &GetCalendarResp{ApiResp: apiResp} 153 err = apiResp.JSONUnmarshalBody(resp) 154 if err != nil { 155 return nil, err 156 } 157 return resp, err 158 } 159 160 // 获取日历列表 161 // 162 // - 该接口用于分页获得当前身份(应用 / 用户)的日历列表。;;身份由 Header Authorization 的 Token 类型决定。 163 // 164 // - 调用时首先使用 page_token 分页拉取存量数据,之后使用 sync_token 增量同步变更数据。 165 // 166 // - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar/list 167 // 168 // - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/calendarv4/list_calendar.go 169 func (c *calendar) List(ctx context.Context, req *ListCalendarReq, options ...larkcore.RequestOptionFunc) (*ListCalendarResp, error) { 170 // 发起请求 171 apiReq := req.apiReq 172 apiReq.ApiPath = "/open-apis/calendar/v4/calendars" 173 apiReq.HttpMethod = http.MethodGet 174 apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant, larkcore.AccessTokenTypeUser} 175 apiResp, err := larkcore.Request(ctx, apiReq, c.service.config, options...) 176 if err != nil { 177 return nil, err 178 } 179 // 反序列响应结果 180 resp := &ListCalendarResp{ApiResp: apiResp} 181 err = apiResp.JSONUnmarshalBody(resp) 182 if err != nil { 183 return nil, err 184 } 185 return resp, err 186 } 187 188 // 更新日历 189 // 190 // - 该接口用于以当前身份(应用 / 用户)修改日历信息。;;身份由 Header Authorization 的 Token 类型决定。 191 // 192 // - 当前身份对日历有 owner 权限时,可修改全局字段:summary, description, permission。;;当前身份对日历不具有 owner 权限时,仅可修改对自己生效的字段:color, summary_alias。 193 // 194 // - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar/patch 195 // 196 // - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/calendarv4/patch_calendar.go 197 func (c *calendar) Patch(ctx context.Context, req *PatchCalendarReq, options ...larkcore.RequestOptionFunc) (*PatchCalendarResp, error) { 198 // 发起请求 199 apiReq := req.apiReq 200 apiReq.ApiPath = "/open-apis/calendar/v4/calendars/:calendar_id" 201 apiReq.HttpMethod = http.MethodPatch 202 apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant, larkcore.AccessTokenTypeUser} 203 apiResp, err := larkcore.Request(ctx, apiReq, c.service.config, options...) 204 if err != nil { 205 return nil, err 206 } 207 // 反序列响应结果 208 resp := &PatchCalendarResp{ApiResp: apiResp} 209 err = apiResp.JSONUnmarshalBody(resp) 210 if err != nil { 211 return nil, err 212 } 213 return resp, err 214 } 215 216 // 获取主日历 217 // 218 // - 获取当前身份的主日历信息。 219 // 220 // - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar/primary 221 // 222 // - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/calendarv4/primary_calendar.go 223 func (c *calendar) Primary(ctx context.Context, req *PrimaryCalendarReq, options ...larkcore.RequestOptionFunc) (*PrimaryCalendarResp, error) { 224 // 发起请求 225 apiReq := req.apiReq 226 apiReq.ApiPath = "/open-apis/calendar/v4/calendars/primary" 227 apiReq.HttpMethod = http.MethodPost 228 apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant, larkcore.AccessTokenTypeUser} 229 apiResp, err := larkcore.Request(ctx, apiReq, c.service.config, options...) 230 if err != nil { 231 return nil, err 232 } 233 // 反序列响应结果 234 resp := &PrimaryCalendarResp{ApiResp: apiResp} 235 err = apiResp.JSONUnmarshalBody(resp) 236 if err != nil { 237 return nil, err 238 } 239 return resp, err 240 } 241 242 // 搜索日历 243 // 244 // - 该接口用于通过关键字查询公共日历或用户主日历。 245 // 246 // - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar/search 247 // 248 // - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/calendarv4/search_calendar.go 249 func (c *calendar) Search(ctx context.Context, req *SearchCalendarReq, options ...larkcore.RequestOptionFunc) (*SearchCalendarResp, error) { 250 // 发起请求 251 apiReq := req.apiReq 252 apiReq.ApiPath = "/open-apis/calendar/v4/calendars/search" 253 apiReq.HttpMethod = http.MethodPost 254 apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant} 255 apiResp, err := larkcore.Request(ctx, apiReq, c.service.config, options...) 256 if err != nil { 257 return nil, err 258 } 259 // 反序列响应结果 260 resp := &SearchCalendarResp{ApiResp: apiResp} 261 err = apiResp.JSONUnmarshalBody(resp) 262 if err != nil { 263 return nil, err 264 } 265 return resp, err 266 } 267 func (c *calendar) SearchByIterator(ctx context.Context, req *SearchCalendarReq, options ...larkcore.RequestOptionFunc) (*SearchCalendarIterator, error) { 268 return &SearchCalendarIterator{ 269 ctx: ctx, 270 req: req, 271 listFunc: c.Search, 272 options: options, 273 limit: req.Limit}, nil 274 } 275 276 // 订阅日历 277 // 278 // - 该接口用于以当前身份(应用 / 用户)订阅某个日历。;;身份由 Header Authorization 的 Token 类型决定。 279 // 280 // - - 仅可订阅类型为 primary 或 shared 的公开日历。;- 可订阅日历数量上限为1000。 281 // 282 // - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar/subscribe 283 // 284 // - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/calendarv4/subscribe_calendar.go 285 func (c *calendar) Subscribe(ctx context.Context, req *SubscribeCalendarReq, options ...larkcore.RequestOptionFunc) (*SubscribeCalendarResp, error) { 286 // 发起请求 287 apiReq := req.apiReq 288 apiReq.ApiPath = "/open-apis/calendar/v4/calendars/:calendar_id/subscribe" 289 apiReq.HttpMethod = http.MethodPost 290 apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeUser, larkcore.AccessTokenTypeTenant} 291 apiResp, err := larkcore.Request(ctx, apiReq, c.service.config, options...) 292 if err != nil { 293 return nil, err 294 } 295 // 反序列响应结果 296 resp := &SubscribeCalendarResp{ApiResp: apiResp} 297 err = apiResp.JSONUnmarshalBody(resp) 298 if err != nil { 299 return nil, err 300 } 301 return resp, err 302 } 303 304 // 订阅日历变更事件 305 // 306 // - 该接口用于以用户身份订阅当前身份下日历列表中的所有日历变更。 307 // 308 // - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar/subscription 309 // 310 // - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/calendarv4/subscription_calendar.go 311 func (c *calendar) Subscription(ctx context.Context, options ...larkcore.RequestOptionFunc) (*SubscriptionCalendarResp, error) { 312 // 发起请求 313 apiReq := &larkcore.ApiReq{ 314 PathParams: larkcore.PathParams{}, 315 QueryParams: larkcore.QueryParams{}, 316 } 317 apiReq.ApiPath = "/open-apis/calendar/v4/calendars/subscription" 318 apiReq.HttpMethod = http.MethodPost 319 apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeUser} 320 apiResp, err := larkcore.Request(ctx, apiReq, c.service.config, options...) 321 if err != nil { 322 return nil, err 323 } 324 // 反序列响应结果 325 resp := &SubscriptionCalendarResp{ApiResp: apiResp} 326 err = apiResp.JSONUnmarshalBody(resp) 327 if err != nil { 328 return nil, err 329 } 330 return resp, err 331 } 332 333 // 取消订阅日历 334 // 335 // - 该接口用于以当前身份(应用 / 用户)取消对某日历的订阅状态。;;身份由 Header Authorization 的 Token 类型决定。 336 // 337 // - 仅可操作已经被当前身份订阅的日历。 338 // 339 // - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar/unsubscribe 340 // 341 // - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/calendarv4/unsubscribe_calendar.go 342 func (c *calendar) Unsubscribe(ctx context.Context, req *UnsubscribeCalendarReq, options ...larkcore.RequestOptionFunc) (*UnsubscribeCalendarResp, error) { 343 // 发起请求 344 apiReq := req.apiReq 345 apiReq.ApiPath = "/open-apis/calendar/v4/calendars/:calendar_id/unsubscribe" 346 apiReq.HttpMethod = http.MethodPost 347 apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeUser, larkcore.AccessTokenTypeTenant} 348 apiResp, err := larkcore.Request(ctx, apiReq, c.service.config, options...) 349 if err != nil { 350 return nil, err 351 } 352 // 反序列响应结果 353 resp := &UnsubscribeCalendarResp{ApiResp: apiResp} 354 err = apiResp.JSONUnmarshalBody(resp) 355 if err != nil { 356 return nil, err 357 } 358 return resp, err 359 } 360 361 // 取消订阅日历变更事件 362 // 363 // - 该接口用于以用户身份取消订阅当前身份下日历列表中的日历变更事件。 364 // 365 // - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar/unsubscription 366 // 367 // - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/calendarv4/unsubscription_calendar.go 368 func (c *calendar) Unsubscription(ctx context.Context, options ...larkcore.RequestOptionFunc) (*UnsubscriptionCalendarResp, error) { 369 // 发起请求 370 apiReq := &larkcore.ApiReq{ 371 PathParams: larkcore.PathParams{}, 372 QueryParams: larkcore.QueryParams{}, 373 } 374 apiReq.ApiPath = "/open-apis/calendar/v4/calendars/unsubscription" 375 apiReq.HttpMethod = http.MethodPost 376 apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeUser} 377 apiResp, err := larkcore.Request(ctx, apiReq, c.service.config, options...) 378 if err != nil { 379 return nil, err 380 } 381 // 反序列响应结果 382 resp := &UnsubscriptionCalendarResp{ApiResp: apiResp} 383 err = apiResp.JSONUnmarshalBody(resp) 384 if err != nil { 385 return nil, err 386 } 387 return resp, err 388 } 389 390 // 创建访问控制 391 // 392 // - 该接口用于以当前身份(应用 / 用户)给日历添加访问控制权限,即日历成员。;;身份由 Header Authorization 的 Token 类型决定。 393 // 394 // - 当前身份需要有日历的 owner 权限,并且日历的类型只能为 primary 或 shared。 395 // 396 // - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar-acl/create 397 // 398 // - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/calendarv4/create_calendarAcl.go 399 func (c *calendarAcl) Create(ctx context.Context, req *CreateCalendarAclReq, options ...larkcore.RequestOptionFunc) (*CreateCalendarAclResp, error) { 400 // 发起请求 401 apiReq := req.apiReq 402 apiReq.ApiPath = "/open-apis/calendar/v4/calendars/:calendar_id/acls" 403 apiReq.HttpMethod = http.MethodPost 404 apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant, larkcore.AccessTokenTypeUser} 405 apiResp, err := larkcore.Request(ctx, apiReq, c.service.config, options...) 406 if err != nil { 407 return nil, err 408 } 409 // 反序列响应结果 410 resp := &CreateCalendarAclResp{ApiResp: apiResp} 411 err = apiResp.JSONUnmarshalBody(resp) 412 if err != nil { 413 return nil, err 414 } 415 return resp, err 416 } 417 418 // 删除访问控制 419 // 420 // - 该接口用于以当前身份(应用 / 用户)删除日历的控制权限,即日历成员。;;身份由 Header Authorization 的 Token 类型决定。 421 // 422 // - 当前身份需要有日历的 owner 权限,并且日历的类型只能为 primary 或 shared。 423 // 424 // - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar-acl/delete 425 // 426 // - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/calendarv4/delete_calendarAcl.go 427 func (c *calendarAcl) Delete(ctx context.Context, req *DeleteCalendarAclReq, options ...larkcore.RequestOptionFunc) (*DeleteCalendarAclResp, error) { 428 // 发起请求 429 apiReq := req.apiReq 430 apiReq.ApiPath = "/open-apis/calendar/v4/calendars/:calendar_id/acls/:acl_id" 431 apiReq.HttpMethod = http.MethodDelete 432 apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant, larkcore.AccessTokenTypeUser} 433 apiResp, err := larkcore.Request(ctx, apiReq, c.service.config, options...) 434 if err != nil { 435 return nil, err 436 } 437 // 反序列响应结果 438 resp := &DeleteCalendarAclResp{ApiResp: apiResp} 439 err = apiResp.JSONUnmarshalBody(resp) 440 if err != nil { 441 return nil, err 442 } 443 return resp, err 444 } 445 446 // 获取访问控制列表 447 // 448 // - 该接口用于以当前身份(应用 / 用户)获取日历的控制权限列表。;;身份由 Header Authorization 的 Token 类型决定。 449 // 450 // - 当前身份需要有日历的 owner 权限,并且日历的类型只能为 primary 或 shared。 451 // 452 // - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar-acl/list 453 // 454 // - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/calendarv4/list_calendarAcl.go 455 func (c *calendarAcl) List(ctx context.Context, req *ListCalendarAclReq, options ...larkcore.RequestOptionFunc) (*ListCalendarAclResp, error) { 456 // 发起请求 457 apiReq := req.apiReq 458 apiReq.ApiPath = "/open-apis/calendar/v4/calendars/:calendar_id/acls" 459 apiReq.HttpMethod = http.MethodGet 460 apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant, larkcore.AccessTokenTypeUser} 461 apiResp, err := larkcore.Request(ctx, apiReq, c.service.config, options...) 462 if err != nil { 463 return nil, err 464 } 465 // 反序列响应结果 466 resp := &ListCalendarAclResp{ApiResp: apiResp} 467 err = apiResp.JSONUnmarshalBody(resp) 468 if err != nil { 469 return nil, err 470 } 471 return resp, err 472 } 473 func (c *calendarAcl) ListByIterator(ctx context.Context, req *ListCalendarAclReq, options ...larkcore.RequestOptionFunc) (*ListCalendarAclIterator, error) { 474 return &ListCalendarAclIterator{ 475 ctx: ctx, 476 req: req, 477 listFunc: c.List, 478 options: options, 479 limit: req.Limit}, nil 480 } 481 482 // 订阅日历访问控制变更事件; 483 // 484 // - 该接口用于以用户身份订阅指定日历下的日历成员变更事件。 485 // 486 // - 用户必须对日历有访问权限。 487 // 488 // - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar-acl/subscription 489 // 490 // - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/calendarv4/subscription_calendarAcl.go 491 func (c *calendarAcl) Subscription(ctx context.Context, req *SubscriptionCalendarAclReq, options ...larkcore.RequestOptionFunc) (*SubscriptionCalendarAclResp, error) { 492 // 发起请求 493 apiReq := req.apiReq 494 apiReq.ApiPath = "/open-apis/calendar/v4/calendars/:calendar_id/acls/subscription" 495 apiReq.HttpMethod = http.MethodPost 496 apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeUser} 497 apiResp, err := larkcore.Request(ctx, apiReq, c.service.config, options...) 498 if err != nil { 499 return nil, err 500 } 501 // 反序列响应结果 502 resp := &SubscriptionCalendarAclResp{ApiResp: apiResp} 503 err = apiResp.JSONUnmarshalBody(resp) 504 if err != nil { 505 return nil, err 506 } 507 return resp, err 508 } 509 510 // 取消订阅日历访问控制变更事件 511 // 512 // - 该接口用于以用户身份取消订阅指定日历下的日历成员变更事件。 513 // 514 // - 用户必须对日历有访问权限。 515 // 516 // - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar-acl/unsubscription 517 // 518 // - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/calendarv4/unsubscription_calendarAcl.go 519 func (c *calendarAcl) Unsubscription(ctx context.Context, req *UnsubscriptionCalendarAclReq, options ...larkcore.RequestOptionFunc) (*UnsubscriptionCalendarAclResp, error) { 520 // 发起请求 521 apiReq := req.apiReq 522 apiReq.ApiPath = "/open-apis/calendar/v4/calendars/:calendar_id/acls/unsubscription" 523 apiReq.HttpMethod = http.MethodPost 524 apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeUser} 525 apiResp, err := larkcore.Request(ctx, apiReq, c.service.config, options...) 526 if err != nil { 527 return nil, err 528 } 529 // 反序列响应结果 530 resp := &UnsubscriptionCalendarAclResp{ApiResp: apiResp} 531 err = apiResp.JSONUnmarshalBody(resp) 532 if err != nil { 533 return nil, err 534 } 535 return resp, err 536 } 537 538 // 创建日程 539 // 540 // - 该接口用于以当前身份(应用 / 用户)在日历上创建一个日程。;;身份由 Header Authorization 的 Token 类型决定。 541 // 542 // - 当前身份必须对日历有 writer 或 owner 权限,并且日历的类型只能为 primary 或 shared。 543 // 544 // - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar-event/create 545 // 546 // - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/calendarv4/create_calendarEvent.go 547 func (c *calendarEvent) Create(ctx context.Context, req *CreateCalendarEventReq, options ...larkcore.RequestOptionFunc) (*CreateCalendarEventResp, error) { 548 // 发起请求 549 apiReq := req.apiReq 550 apiReq.ApiPath = "/open-apis/calendar/v4/calendars/:calendar_id/events" 551 apiReq.HttpMethod = http.MethodPost 552 apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant, larkcore.AccessTokenTypeUser} 553 apiResp, err := larkcore.Request(ctx, apiReq, c.service.config, options...) 554 if err != nil { 555 return nil, err 556 } 557 // 反序列响应结果 558 resp := &CreateCalendarEventResp{ApiResp: apiResp} 559 err = apiResp.JSONUnmarshalBody(resp) 560 if err != nil { 561 return nil, err 562 } 563 return resp, err 564 } 565 566 // 删除日程 567 // 568 // - 该接口用于以当前身份(应用 / 用户)删除日历上的一个日程。;;身份由 Header Authorization 的 Token 类型决定。 569 // 570 // - 当前身份必须对日历有 writer 或 owner 权限,并且日历的类型只能为 primary 或 shared。;;当前身份必须是日程的组织者。 571 // 572 // - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar-event/delete 573 // 574 // - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/calendarv4/delete_calendarEvent.go 575 func (c *calendarEvent) Delete(ctx context.Context, req *DeleteCalendarEventReq, options ...larkcore.RequestOptionFunc) (*DeleteCalendarEventResp, error) { 576 // 发起请求 577 apiReq := req.apiReq 578 apiReq.ApiPath = "/open-apis/calendar/v4/calendars/:calendar_id/events/:event_id" 579 apiReq.HttpMethod = http.MethodDelete 580 apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant, larkcore.AccessTokenTypeUser} 581 apiResp, err := larkcore.Request(ctx, apiReq, c.service.config, options...) 582 if err != nil { 583 return nil, err 584 } 585 // 反序列响应结果 586 resp := &DeleteCalendarEventResp{ApiResp: apiResp} 587 err = apiResp.JSONUnmarshalBody(resp) 588 if err != nil { 589 return nil, err 590 } 591 return resp, err 592 } 593 594 // 获取日程 595 // 596 // - 该接口用于以当前身份(应用 / 用户)获取日历上的一个日程。;身份由 Header Authorization 的 Token 类型决定。 597 // 598 // - - 当前身份必须对日历有reader、writer或owner权限才会返回日程详细信息(调用[获取日历](/ssl:ttdoc/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar/get)接口,role字段可查看权限)。;- [例外日程](/ssl:ttdoc/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar-event/introduction#71c5ec78)可通过event_id的非0时间戳后缀,来获取修改的重复性日程的哪一天日程的时间信息。 599 // 600 // - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar-event/get 601 // 602 // - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/calendarv4/get_calendarEvent.go 603 func (c *calendarEvent) Get(ctx context.Context, req *GetCalendarEventReq, options ...larkcore.RequestOptionFunc) (*GetCalendarEventResp, error) { 604 // 发起请求 605 apiReq := req.apiReq 606 apiReq.ApiPath = "/open-apis/calendar/v4/calendars/:calendar_id/events/:event_id" 607 apiReq.HttpMethod = http.MethodGet 608 apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant, larkcore.AccessTokenTypeUser} 609 apiResp, err := larkcore.Request(ctx, apiReq, c.service.config, options...) 610 if err != nil { 611 return nil, err 612 } 613 // 反序列响应结果 614 resp := &GetCalendarEventResp{ApiResp: apiResp} 615 err = apiResp.JSONUnmarshalBody(resp) 616 if err != nil { 617 return nil, err 618 } 619 return resp, err 620 } 621 622 // 获取日程列表 623 // 624 // - 该接口用于以当前身份(应用 / 用户)获取日历下的日程列表。;身份由 Header Authorization 的 Token 类型决定。 625 // 626 // - - 当前身份必须对日历有reader、writer或owner权限才会返回日程详细信息(调用[获取日历](/ssl:ttdoc/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar/get)接口,role字段可查看权限)。;;- 仅支持primary、shared和resource类型的日历获取日程列表。;;- 调用时首先使用 page_token 分页拉取存量数据,之后使用 sync_token 增量同步变更数据。;;- 为了确保调用方日程同步数据的一致性,在使用sync_token时,不能同时使用start_time和end_time,否则可能造成日程数据缺失。 627 // 628 // - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar-event/list 629 // 630 // - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/calendarv4/list_calendarEvent.go 631 func (c *calendarEvent) List(ctx context.Context, req *ListCalendarEventReq, options ...larkcore.RequestOptionFunc) (*ListCalendarEventResp, error) { 632 // 发起请求 633 apiReq := req.apiReq 634 apiReq.ApiPath = "/open-apis/calendar/v4/calendars/:calendar_id/events" 635 apiReq.HttpMethod = http.MethodGet 636 apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant, larkcore.AccessTokenTypeUser} 637 apiResp, err := larkcore.Request(ctx, apiReq, c.service.config, options...) 638 if err != nil { 639 return nil, err 640 } 641 // 反序列响应结果 642 resp := &ListCalendarEventResp{ApiResp: apiResp} 643 err = apiResp.JSONUnmarshalBody(resp) 644 if err != nil { 645 return nil, err 646 } 647 return resp, err 648 } 649 650 // 更新日程 651 // 652 // - 该接口用于以当前身份(应用 / 用户)更新日历上的一个日程。;;身份由 Header Authorization 的 Token 类型决定。 653 // 654 // - 当前身份必须对日历有 writer 或 owner 权限,并且日历的类型只能为 primary 或 shared。;;当前身份为日程组织者时,可修改所有可编辑字段。;;当前身份为日程参与者时,仅可编辑部分字段。(如:visibility, free_busy_status, color, reminders) 655 // 656 // - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar-event/patch 657 // 658 // - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/calendarv4/patch_calendarEvent.go 659 func (c *calendarEvent) Patch(ctx context.Context, req *PatchCalendarEventReq, options ...larkcore.RequestOptionFunc) (*PatchCalendarEventResp, error) { 660 // 发起请求 661 apiReq := req.apiReq 662 apiReq.ApiPath = "/open-apis/calendar/v4/calendars/:calendar_id/events/:event_id" 663 apiReq.HttpMethod = http.MethodPatch 664 apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant, larkcore.AccessTokenTypeUser} 665 apiResp, err := larkcore.Request(ctx, apiReq, c.service.config, options...) 666 if err != nil { 667 return nil, err 668 } 669 // 反序列响应结果 670 resp := &PatchCalendarEventResp{ApiResp: apiResp} 671 err = apiResp.JSONUnmarshalBody(resp) 672 if err != nil { 673 return nil, err 674 } 675 return resp, err 676 } 677 678 // 搜索日程 679 // 680 // - 该接口用于以用户身份搜索某日历下的相关日程。;;身份由 Header Authorization 的 Token 类型决定。 681 // 682 // - 当前身份必须对日历有reader、writer或owner权限(调用[获取日历](/ssl:ttdoc/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar/get)接口,role字段可查看权限)。 683 // 684 // - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar-event/search 685 // 686 // - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/calendarv4/search_calendarEvent.go 687 func (c *calendarEvent) Search(ctx context.Context, req *SearchCalendarEventReq, options ...larkcore.RequestOptionFunc) (*SearchCalendarEventResp, error) { 688 // 发起请求 689 apiReq := req.apiReq 690 apiReq.ApiPath = "/open-apis/calendar/v4/calendars/:calendar_id/events/search" 691 apiReq.HttpMethod = http.MethodPost 692 apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeUser} 693 apiResp, err := larkcore.Request(ctx, apiReq, c.service.config, options...) 694 if err != nil { 695 return nil, err 696 } 697 // 反序列响应结果 698 resp := &SearchCalendarEventResp{ApiResp: apiResp} 699 err = apiResp.JSONUnmarshalBody(resp) 700 if err != nil { 701 return nil, err 702 } 703 return resp, err 704 } 705 func (c *calendarEvent) SearchByIterator(ctx context.Context, req *SearchCalendarEventReq, options ...larkcore.RequestOptionFunc) (*SearchCalendarEventIterator, error) { 706 return &SearchCalendarEventIterator{ 707 ctx: ctx, 708 req: req, 709 listFunc: c.Search, 710 options: options, 711 limit: req.Limit}, nil 712 } 713 714 // 订阅日程变更事件 715 // 716 // - 该接口用于以用户身份订阅指定日历下的日程变更事件。 717 // 718 // - 当前身份必须对日历有reader、writer或owner权限(调用[获取日历](/ssl:ttdoc/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar/get)接口,role字段可查看权限)。 719 // 720 // - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar-event/subscription 721 // 722 // - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/calendarv4/subscription_calendarEvent.go 723 func (c *calendarEvent) Subscription(ctx context.Context, req *SubscriptionCalendarEventReq, options ...larkcore.RequestOptionFunc) (*SubscriptionCalendarEventResp, error) { 724 // 发起请求 725 apiReq := req.apiReq 726 apiReq.ApiPath = "/open-apis/calendar/v4/calendars/:calendar_id/events/subscription" 727 apiReq.HttpMethod = http.MethodPost 728 apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeUser} 729 apiResp, err := larkcore.Request(ctx, apiReq, c.service.config, options...) 730 if err != nil { 731 return nil, err 732 } 733 // 反序列响应结果 734 resp := &SubscriptionCalendarEventResp{ApiResp: apiResp} 735 err = apiResp.JSONUnmarshalBody(resp) 736 if err != nil { 737 return nil, err 738 } 739 return resp, err 740 } 741 742 // 取消订阅日程变更事件 743 // 744 // - 该接口用于以用户身份取消订阅指定日历下的日程变更事件。 745 // 746 // - 当前身份必须对日历有reader、writer或owner权限(调用[获取日历](/ssl:ttdoc/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar/get)接口,role字段可查看权限)。 747 // 748 // - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar-event/unsubscription 749 // 750 // - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/calendarv4/unsubscription_calendarEvent.go 751 func (c *calendarEvent) Unsubscription(ctx context.Context, req *UnsubscriptionCalendarEventReq, options ...larkcore.RequestOptionFunc) (*UnsubscriptionCalendarEventResp, error) { 752 // 发起请求 753 apiReq := req.apiReq 754 apiReq.ApiPath = "/open-apis/calendar/v4/calendars/:calendar_id/events/unsubscription" 755 apiReq.HttpMethod = http.MethodPost 756 apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeUser} 757 apiResp, err := larkcore.Request(ctx, apiReq, c.service.config, options...) 758 if err != nil { 759 return nil, err 760 } 761 // 反序列响应结果 762 resp := &UnsubscriptionCalendarEventResp{ApiResp: apiResp} 763 err = apiResp.JSONUnmarshalBody(resp) 764 if err != nil { 765 return nil, err 766 } 767 return resp, err 768 } 769 770 // 删除日程参与人 771 // 772 // - 批量删除日程的参与人。 773 // 774 // - - 当前身份需要有日历的 writer 或 owner 权限,并且日历的类型只能为 primary 或 shared。;;- 当前身份需要是日程的组织者。 775 // 776 // - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar-event-attendee/batch_delete 777 // 778 // - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/calendarv4/batchDelete_calendarEventAttendee.go 779 func (c *calendarEventAttendee) BatchDelete(ctx context.Context, req *BatchDeleteCalendarEventAttendeeReq, options ...larkcore.RequestOptionFunc) (*BatchDeleteCalendarEventAttendeeResp, error) { 780 // 发起请求 781 apiReq := req.apiReq 782 apiReq.ApiPath = "/open-apis/calendar/v4/calendars/:calendar_id/events/:event_id/attendees/batch_delete" 783 apiReq.HttpMethod = http.MethodPost 784 apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant, larkcore.AccessTokenTypeUser} 785 apiResp, err := larkcore.Request(ctx, apiReq, c.service.config, options...) 786 if err != nil { 787 return nil, err 788 } 789 // 反序列响应结果 790 resp := &BatchDeleteCalendarEventAttendeeResp{ApiResp: apiResp} 791 err = apiResp.JSONUnmarshalBody(resp) 792 if err != nil { 793 return nil, err 794 } 795 return resp, err 796 } 797 798 // 创建日程参与人; 799 // 800 // - 批量给日程添加参与人。 801 // 802 // - - 当前身份需要有日历的 writer 或 owner 权限,并且日历的类型只能为 primary 或 shared。;;- 当前身份需要是日程的组织者,或日程设置了「参与人可邀请其它参与人」权限。;;- 新添加的日程参与人必须与日程组织者在同一个企业内。;;- 使用该接口添加会议室后,会议室会进入异步的预约流程,请求结束不代表会议室预约成功,需后续再查询预约状态。;;- 每个日程最多只能有 3000 名参与人。;;- 开启管理员能力后预约会议室可不受会议室预约范围的限制(当前不支持用管理员身份给其他人的日程预约会议室) 803 // 804 // - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar-event-attendee/create 805 // 806 // - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/calendarv4/create_calendarEventAttendee.go 807 func (c *calendarEventAttendee) Create(ctx context.Context, req *CreateCalendarEventAttendeeReq, options ...larkcore.RequestOptionFunc) (*CreateCalendarEventAttendeeResp, error) { 808 // 发起请求 809 apiReq := req.apiReq 810 apiReq.ApiPath = "/open-apis/calendar/v4/calendars/:calendar_id/events/:event_id/attendees" 811 apiReq.HttpMethod = http.MethodPost 812 apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant, larkcore.AccessTokenTypeUser} 813 apiResp, err := larkcore.Request(ctx, apiReq, c.service.config, options...) 814 if err != nil { 815 return nil, err 816 } 817 // 反序列响应结果 818 resp := &CreateCalendarEventAttendeeResp{ApiResp: apiResp} 819 err = apiResp.JSONUnmarshalBody(resp) 820 if err != nil { 821 return nil, err 822 } 823 return resp, err 824 } 825 826 // 获取日程参与人列表 827 // 828 // - 获取日程的参与人列表,若参与者列表中有群组,请使用 [获取参与人群成员列表](/ssl:ttdoc/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar-event-attendee-chat_member/list) 。 829 // 830 // - - 当前身份必须对日历有reader、writer或owner权限(调用[获取日历](/ssl:ttdoc/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar/get)接口,role字段可查看权限)。;;- 当前身份必须有权限查看日程的参与人列表。 831 // 832 // - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar-event-attendee/list 833 // 834 // - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/calendarv4/list_calendarEventAttendee.go 835 func (c *calendarEventAttendee) List(ctx context.Context, req *ListCalendarEventAttendeeReq, options ...larkcore.RequestOptionFunc) (*ListCalendarEventAttendeeResp, error) { 836 // 发起请求 837 apiReq := req.apiReq 838 apiReq.ApiPath = "/open-apis/calendar/v4/calendars/:calendar_id/events/:event_id/attendees" 839 apiReq.HttpMethod = http.MethodGet 840 apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant, larkcore.AccessTokenTypeUser} 841 apiResp, err := larkcore.Request(ctx, apiReq, c.service.config, options...) 842 if err != nil { 843 return nil, err 844 } 845 // 反序列响应结果 846 resp := &ListCalendarEventAttendeeResp{ApiResp: apiResp} 847 err = apiResp.JSONUnmarshalBody(resp) 848 if err != nil { 849 return nil, err 850 } 851 return resp, err 852 } 853 func (c *calendarEventAttendee) ListByIterator(ctx context.Context, req *ListCalendarEventAttendeeReq, options ...larkcore.RequestOptionFunc) (*ListCalendarEventAttendeeIterator, error) { 854 return &ListCalendarEventAttendeeIterator{ 855 ctx: ctx, 856 req: req, 857 listFunc: c.List, 858 options: options, 859 limit: req.Limit}, nil 860 } 861 862 // 获取日程参与群成员列表 863 // 864 // - 获取日程的群参与人的群成员列表。 865 // 866 // - - 当前身份必须有权限查看日程的参与人列表。;;- 当前身份必须在群聊中,或有权限查看群成员列表。 867 // 868 // - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/calendar-event-attendee-chat_member/list 869 // 870 // - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/calendarv4/list_calendarEventAttendeeChatMember.go 871 func (c *calendarEventAttendeeChatMember) List(ctx context.Context, req *ListCalendarEventAttendeeChatMemberReq, options ...larkcore.RequestOptionFunc) (*ListCalendarEventAttendeeChatMemberResp, error) { 872 // 发起请求 873 apiReq := req.apiReq 874 apiReq.ApiPath = "/open-apis/calendar/v4/calendars/:calendar_id/events/:event_id/attendees/:attendee_id/chat_members" 875 apiReq.HttpMethod = http.MethodGet 876 apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant, larkcore.AccessTokenTypeUser} 877 apiResp, err := larkcore.Request(ctx, apiReq, c.service.config, options...) 878 if err != nil { 879 return nil, err 880 } 881 // 反序列响应结果 882 resp := &ListCalendarEventAttendeeChatMemberResp{ApiResp: apiResp} 883 err = apiResp.JSONUnmarshalBody(resp) 884 if err != nil { 885 return nil, err 886 } 887 return resp, err 888 } 889 func (c *calendarEventAttendeeChatMember) ListByIterator(ctx context.Context, req *ListCalendarEventAttendeeChatMemberReq, options ...larkcore.RequestOptionFunc) (*ListCalendarEventAttendeeChatMemberIterator, error) { 890 return &ListCalendarEventAttendeeChatMemberIterator{ 891 ctx: ctx, 892 req: req, 893 listFunc: c.List, 894 options: options, 895 limit: req.Limit}, nil 896 } 897 898 // 创建Exchange绑定关系 899 // 900 // - 本接口将Exchange账户绑定到飞书账户,进而支持Exchange日历的导入 901 // 902 // - 操作用户需要是企业超级管理员 903 // 904 // - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/exchange_binding/create 905 // 906 // - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/calendarv4/create_exchangeBinding.go 907 func (e *exchangeBinding) Create(ctx context.Context, req *CreateExchangeBindingReq, options ...larkcore.RequestOptionFunc) (*CreateExchangeBindingResp, error) { 908 // 发起请求 909 apiReq := req.apiReq 910 apiReq.ApiPath = "/open-apis/calendar/v4/exchange_bindings" 911 apiReq.HttpMethod = http.MethodPost 912 apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeUser} 913 apiResp, err := larkcore.Request(ctx, apiReq, e.service.config, options...) 914 if err != nil { 915 return nil, err 916 } 917 // 反序列响应结果 918 resp := &CreateExchangeBindingResp{ApiResp: apiResp} 919 err = apiResp.JSONUnmarshalBody(resp) 920 if err != nil { 921 return nil, err 922 } 923 return resp, err 924 } 925 926 // 解除Exchange绑定关系 927 // 928 // - 本接口解除Exchange账户和飞书账户的绑定关系,Exchange账户解除绑定后才能绑定其他飞书账户 929 // 930 // - 操作用户需要是企业超级管理员 931 // 932 // - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/exchange_binding/delete 933 // 934 // - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/calendarv4/delete_exchangeBinding.go 935 func (e *exchangeBinding) Delete(ctx context.Context, req *DeleteExchangeBindingReq, options ...larkcore.RequestOptionFunc) (*DeleteExchangeBindingResp, error) { 936 // 发起请求 937 apiReq := req.apiReq 938 apiReq.ApiPath = "/open-apis/calendar/v4/exchange_bindings/:exchange_binding_id" 939 apiReq.HttpMethod = http.MethodDelete 940 apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeUser} 941 apiResp, err := larkcore.Request(ctx, apiReq, e.service.config, options...) 942 if err != nil { 943 return nil, err 944 } 945 // 反序列响应结果 946 resp := &DeleteExchangeBindingResp{ApiResp: apiResp} 947 err = apiResp.JSONUnmarshalBody(resp) 948 if err != nil { 949 return nil, err 950 } 951 return resp, err 952 } 953 954 // 获取绑定状态 955 // 956 // - 本接口获取Exchange账户的绑定状态,包括exchange日历是否同步完成。 957 // 958 // - 操作用户需要是企业超级管理员 959 // 960 // - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/exchange_binding/get 961 // 962 // - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/calendarv4/get_exchangeBinding.go 963 func (e *exchangeBinding) Get(ctx context.Context, req *GetExchangeBindingReq, options ...larkcore.RequestOptionFunc) (*GetExchangeBindingResp, error) { 964 // 发起请求 965 apiReq := req.apiReq 966 apiReq.ApiPath = "/open-apis/calendar/v4/exchange_bindings/:exchange_binding_id" 967 apiReq.HttpMethod = http.MethodGet 968 apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeUser} 969 apiResp, err := larkcore.Request(ctx, apiReq, e.service.config, options...) 970 if err != nil { 971 return nil, err 972 } 973 // 反序列响应结果 974 resp := &GetExchangeBindingResp{ApiResp: apiResp} 975 err = apiResp.JSONUnmarshalBody(resp) 976 if err != nil { 977 return nil, err 978 } 979 return resp, err 980 } 981 982 // 查询忙闲 983 // 984 // - 查询用户主日历或会议室的忙闲信息。 985 // 986 // - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/freebusy/list 987 // 988 // - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/calendarv4/list_freebusy.go 989 func (f *freebusy) List(ctx context.Context, req *ListFreebusyReq, options ...larkcore.RequestOptionFunc) (*ListFreebusyResp, error) { 990 // 发起请求 991 apiReq := req.apiReq 992 apiReq.ApiPath = "/open-apis/calendar/v4/freebusy/list" 993 apiReq.HttpMethod = http.MethodPost 994 apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant} 995 apiResp, err := larkcore.Request(ctx, apiReq, f.service.config, options...) 996 if err != nil { 997 return nil, err 998 } 999 // 反序列响应结果 1000 resp := &ListFreebusyResp{ApiResp: apiResp} 1001 err = apiResp.JSONUnmarshalBody(resp) 1002 if err != nil { 1003 return nil, err 1004 } 1005 return resp, err 1006 } 1007 1008 // 生成CalDAV配置 1009 // 1010 // - 用于为当前用户生成一个CalDAV账号密码,用于将飞书日历信息同步到本地设备日历。 1011 // 1012 // - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/setting/generate_caldav_conf 1013 // 1014 // - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/calendarv4/generateCaldavConf_setting.go 1015 func (s *setting) GenerateCaldavConf(ctx context.Context, req *GenerateCaldavConfSettingReq, options ...larkcore.RequestOptionFunc) (*GenerateCaldavConfSettingResp, error) { 1016 // 发起请求 1017 apiReq := req.apiReq 1018 apiReq.ApiPath = "/open-apis/calendar/v4/settings/generate_caldav_conf" 1019 apiReq.HttpMethod = http.MethodPost 1020 apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeUser} 1021 apiResp, err := larkcore.Request(ctx, apiReq, s.service.config, options...) 1022 if err != nil { 1023 return nil, err 1024 } 1025 // 反序列响应结果 1026 resp := &GenerateCaldavConfSettingResp{ApiResp: apiResp} 1027 err = apiResp.JSONUnmarshalBody(resp) 1028 if err != nil { 1029 return nil, err 1030 } 1031 return resp, err 1032 } 1033 1034 // 创建请假日程 1035 // 1036 // - 为指定用户创建一个请假日程,可以是一个普通请假日程,也可以是一个全天日程。;创建请假日程后,会在相应时间内,在用户个人签名页展示请假信息。 1037 // 1038 // - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/timeoff_event/create 1039 // 1040 // - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/calendarv4/create_timeoffEvent.go 1041 func (t *timeoffEvent) Create(ctx context.Context, req *CreateTimeoffEventReq, options ...larkcore.RequestOptionFunc) (*CreateTimeoffEventResp, error) { 1042 // 发起请求 1043 apiReq := req.apiReq 1044 apiReq.ApiPath = "/open-apis/calendar/v4/timeoff_events" 1045 apiReq.HttpMethod = http.MethodPost 1046 apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant} 1047 apiResp, err := larkcore.Request(ctx, apiReq, t.service.config, options...) 1048 if err != nil { 1049 return nil, err 1050 } 1051 // 反序列响应结果 1052 resp := &CreateTimeoffEventResp{ApiResp: apiResp} 1053 err = apiResp.JSONUnmarshalBody(resp) 1054 if err != nil { 1055 return nil, err 1056 } 1057 return resp, err 1058 } 1059 1060 // 删除请假日程 1061 // 1062 // - 删除一个指定的请假日程,请假日程删除,用户个人签名页的请假信息也会消失。;一个应用只能删除自己创建的请假日程。 1063 // 1064 // - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/calendar-v4/timeoff_event/delete 1065 // 1066 // - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/calendarv4/delete_timeoffEvent.go 1067 func (t *timeoffEvent) Delete(ctx context.Context, req *DeleteTimeoffEventReq, options ...larkcore.RequestOptionFunc) (*DeleteTimeoffEventResp, error) { 1068 // 发起请求 1069 apiReq := req.apiReq 1070 apiReq.ApiPath = "/open-apis/calendar/v4/timeoff_events/:timeoff_event_id" 1071 apiReq.HttpMethod = http.MethodDelete 1072 apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant} 1073 apiResp, err := larkcore.Request(ctx, apiReq, t.service.config, options...) 1074 if err != nil { 1075 return nil, err 1076 } 1077 // 反序列响应结果 1078 resp := &DeleteTimeoffEventResp{ApiResp: apiResp} 1079 err = apiResp.JSONUnmarshalBody(resp) 1080 if err != nil { 1081 return nil, err 1082 } 1083 return resp, err 1084 }