gitee.com/larksuite/oapi-sdk-go/v3@v3.0.3/service/attendance/v1/api.go (about) 1 // Package attendance 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 larkattendance 15 16 import ( 17 "bytes" 18 "context" 19 "net/http" 20 21 "gitee.com/larksuite/oapi-sdk-go/v3/core" 22 ) 23 24 func NewService(config *larkcore.Config) *AttendanceService { 25 a := &AttendanceService{config: config} 26 a.ApprovalInfo = &approvalInfo{service: a} 27 a.File = &file{service: a} 28 a.Group = &group{service: a} 29 a.Shift = &shift{service: a} 30 a.UserApproval = &userApproval{service: a} 31 a.UserDailyShift = &userDailyShift{service: a} 32 a.UserFlow = &userFlow{service: a} 33 a.UserSetting = &userSetting{service: a} 34 a.UserStatsData = &userStatsData{service: a} 35 a.UserStatsField = &userStatsField{service: a} 36 a.UserStatsView = &userStatsView{service: a} 37 a.UserTask = &userTask{service: a} 38 a.UserTaskRemedy = &userTaskRemedy{service: a} 39 return a 40 } 41 42 type AttendanceService struct { 43 config *larkcore.Config 44 ApprovalInfo *approvalInfo // approval_info 45 File *file // 文件 46 Group *group // 考勤组管理 47 Shift *shift // 考勤班次 48 UserApproval *userApproval // 假勤审批 49 UserDailyShift *userDailyShift // 考勤排班 50 UserFlow *userFlow // user_flow 51 UserSetting *userSetting // 用户设置 52 UserStatsData *userStatsData // 考勤统计 53 UserStatsField *userStatsField // user_stats_field 54 UserStatsView *userStatsView // user_stats_view 55 UserTask *userTask // 考勤记录 56 UserTaskRemedy *userTaskRemedy // 考勤补卡 57 } 58 59 type approvalInfo struct { 60 service *AttendanceService 61 } 62 type file struct { 63 service *AttendanceService 64 } 65 type group struct { 66 service *AttendanceService 67 } 68 type shift struct { 69 service *AttendanceService 70 } 71 type userApproval struct { 72 service *AttendanceService 73 } 74 type userDailyShift struct { 75 service *AttendanceService 76 } 77 type userFlow struct { 78 service *AttendanceService 79 } 80 type userSetting struct { 81 service *AttendanceService 82 } 83 type userStatsData struct { 84 service *AttendanceService 85 } 86 type userStatsField struct { 87 service *AttendanceService 88 } 89 type userStatsView struct { 90 service *AttendanceService 91 } 92 type userTask struct { 93 service *AttendanceService 94 } 95 type userTaskRemedy struct { 96 service *AttendanceService 97 } 98 99 // 通知审批状态更新 100 // 101 // - 对于只使用飞书考勤系统而未使用飞书审批系统的企业,可以通过该接口更新写入飞书考勤系统中的三方系统审批状态,例如请假、加班、外出、出差、补卡等审批,状态包括通过、不通过、撤销等。 102 // 103 // - 发起状态的审批才可以被更新为通过、不通过,已经通过的审批才可以被更新为撤销。 104 // 105 // - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/attendance-v1/approval_info/process 106 // 107 // - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/attendancev1/process_approvalInfo.go 108 func (a *approvalInfo) Process(ctx context.Context, req *ProcessApprovalInfoReq, options ...larkcore.RequestOptionFunc) (*ProcessApprovalInfoResp, error) { 109 // 发起请求 110 apiReq := req.apiReq 111 apiReq.ApiPath = "/open-apis/attendance/v1/approval_infos/process" 112 apiReq.HttpMethod = http.MethodPost 113 apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant} 114 apiResp, err := larkcore.Request(ctx, apiReq, a.service.config, options...) 115 if err != nil { 116 return nil, err 117 } 118 // 反序列响应结果 119 resp := &ProcessApprovalInfoResp{ApiResp: apiResp} 120 err = apiResp.JSONUnmarshalBody(resp) 121 if err != nil { 122 return nil, err 123 } 124 return resp, err 125 } 126 127 // 下载文件 128 // 129 // - 通过文件 ID 下载指定的文件。 130 // 131 // - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/attendance-v1/file/download 132 // 133 // - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/attendancev1/download_file.go 134 func (f *file) Download(ctx context.Context, req *DownloadFileReq, options ...larkcore.RequestOptionFunc) (*DownloadFileResp, error) { 135 // 发起请求 136 apiReq := req.apiReq 137 apiReq.ApiPath = "/open-apis/attendance/v1/files/:file_id/download" 138 apiReq.HttpMethod = http.MethodGet 139 apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant} 140 apiResp, err := larkcore.Request(ctx, apiReq, f.service.config, options...) 141 if err != nil { 142 return nil, err 143 } 144 // 反序列响应结果 145 resp := &DownloadFileResp{ApiResp: apiResp} 146 // 如果是下载,则设置响应结果 147 if apiResp.StatusCode == http.StatusOK { 148 resp.File = bytes.NewBuffer(apiResp.RawBody) 149 resp.FileName = larkcore.FileNameByHeader(apiResp.Header) 150 return resp, err 151 } 152 err = apiResp.JSONUnmarshalBody(resp) 153 if err != nil { 154 return nil, err 155 } 156 return resp, err 157 } 158 159 // 上传文件 160 // 161 // - 上传文件并获取文件 ID,可用于“修改用户设置”接口中的 face_key 参数。 162 // 163 // - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/attendance-v1/file/upload 164 // 165 // - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/attendancev1/upload_file.go 166 func (f *file) Upload(ctx context.Context, req *UploadFileReq, options ...larkcore.RequestOptionFunc) (*UploadFileResp, error) { 167 options = append(options, larkcore.WithFileUpload()) 168 // 发起请求 169 apiReq := req.apiReq 170 apiReq.ApiPath = "/open-apis/attendance/v1/files/upload" 171 apiReq.HttpMethod = http.MethodPost 172 apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant} 173 apiResp, err := larkcore.Request(ctx, apiReq, f.service.config, options...) 174 if err != nil { 175 return nil, err 176 } 177 // 反序列响应结果 178 resp := &UploadFileResp{ApiResp: apiResp} 179 err = apiResp.JSONUnmarshalBody(resp) 180 if err != nil { 181 return nil, err 182 } 183 return resp, err 184 } 185 186 // 创建或修改考勤组 187 // 188 // - 考勤组,是对部门或者员工在某个特定场所及特定时间段内的出勤情况(包括上下班、迟到、早退、病假、婚假、丧假、公休、工作时间、加班情况等)的一种规则设定。;;通过设置考勤组,可以从部门、员工两个维度,来设定考勤方式、考勤时间、考勤地点等考勤规则。 189 // 190 // - 出于安全考虑,目前通过该接口只允许修改自己创建的考勤组。 191 // 192 // - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/attendance-v1/group/create 193 // 194 // - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/attendancev1/create_group.go 195 func (g *group) Create(ctx context.Context, req *CreateGroupReq, options ...larkcore.RequestOptionFunc) (*CreateGroupResp, error) { 196 // 发起请求 197 apiReq := req.apiReq 198 apiReq.ApiPath = "/open-apis/attendance/v1/groups" 199 apiReq.HttpMethod = http.MethodPost 200 apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant} 201 apiResp, err := larkcore.Request(ctx, apiReq, g.service.config, options...) 202 if err != nil { 203 return nil, err 204 } 205 // 反序列响应结果 206 resp := &CreateGroupResp{ApiResp: apiResp} 207 err = apiResp.JSONUnmarshalBody(resp) 208 if err != nil { 209 return nil, err 210 } 211 return resp, err 212 } 213 214 // 删除考勤组 215 // 216 // - 通过班次 ID 删除班次。 217 // 218 // - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/attendance-v1/group/delete 219 // 220 // - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/attendancev1/delete_group.go 221 func (g *group) Delete(ctx context.Context, req *DeleteGroupReq, options ...larkcore.RequestOptionFunc) (*DeleteGroupResp, error) { 222 // 发起请求 223 apiReq := req.apiReq 224 apiReq.ApiPath = "/open-apis/attendance/v1/groups/:group_id" 225 apiReq.HttpMethod = http.MethodDelete 226 apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant} 227 apiResp, err := larkcore.Request(ctx, apiReq, g.service.config, options...) 228 if err != nil { 229 return nil, err 230 } 231 // 反序列响应结果 232 resp := &DeleteGroupResp{ApiResp: apiResp} 233 err = apiResp.JSONUnmarshalBody(resp) 234 if err != nil { 235 return nil, err 236 } 237 return resp, err 238 } 239 240 // 获取考勤组详情 241 // 242 // - 通过考勤组 ID 获取考勤组详情。 243 // 244 // - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/attendance-v1/group/get 245 // 246 // - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/attendancev1/get_group.go 247 func (g *group) Get(ctx context.Context, req *GetGroupReq, options ...larkcore.RequestOptionFunc) (*GetGroupResp, error) { 248 // 发起请求 249 apiReq := req.apiReq 250 apiReq.ApiPath = "/open-apis/attendance/v1/groups/:group_id" 251 apiReq.HttpMethod = http.MethodGet 252 apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant} 253 apiResp, err := larkcore.Request(ctx, apiReq, g.service.config, options...) 254 if err != nil { 255 return nil, err 256 } 257 // 反序列响应结果 258 resp := &GetGroupResp{ApiResp: apiResp} 259 err = apiResp.JSONUnmarshalBody(resp) 260 if err != nil { 261 return nil, err 262 } 263 return resp, err 264 } 265 266 // 获取考勤组列表 267 // 268 // - 翻页获取所有考勤组列表。 269 // 270 // - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/attendance-v1/group/list 271 // 272 // - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/attendancev1/list_group.go 273 func (g *group) List(ctx context.Context, req *ListGroupReq, options ...larkcore.RequestOptionFunc) (*ListGroupResp, error) { 274 // 发起请求 275 apiReq := req.apiReq 276 apiReq.ApiPath = "/open-apis/attendance/v1/groups" 277 apiReq.HttpMethod = http.MethodGet 278 apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant} 279 apiResp, err := larkcore.Request(ctx, apiReq, g.service.config, options...) 280 if err != nil { 281 return nil, err 282 } 283 // 反序列响应结果 284 resp := &ListGroupResp{ApiResp: apiResp} 285 err = apiResp.JSONUnmarshalBody(resp) 286 if err != nil { 287 return nil, err 288 } 289 return resp, err 290 } 291 func (g *group) ListByIterator(ctx context.Context, req *ListGroupReq, options ...larkcore.RequestOptionFunc) (*ListGroupIterator, error) { 292 return &ListGroupIterator{ 293 ctx: ctx, 294 req: req, 295 listFunc: g.List, 296 options: options, 297 limit: req.Limit}, nil 298 } 299 300 // 按名称查询考勤组 301 // 302 // - 按考勤组名称查询考勤组摘要信息。查询条件支持名称精确匹配和模糊匹配两种方式。查询结果按考勤组修改时间 desc 排序,且最大记录数为 10 条。 303 // 304 // - 该接口依赖的数据和考勤组主数据间存在数据同步延时(正常数据同步 2 秒以内),因此在使用该接口时需注意评估数据延迟潜在风险。 305 // 306 // - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/attendance-v1/group/search 307 // 308 // - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/attendancev1/search_group.go 309 func (g *group) Search(ctx context.Context, req *SearchGroupReq, options ...larkcore.RequestOptionFunc) (*SearchGroupResp, error) { 310 // 发起请求 311 apiReq := req.apiReq 312 apiReq.ApiPath = "/open-apis/attendance/v1/groups/search" 313 apiReq.HttpMethod = http.MethodPost 314 apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant} 315 apiResp, err := larkcore.Request(ctx, apiReq, g.service.config, options...) 316 if err != nil { 317 return nil, err 318 } 319 // 反序列响应结果 320 resp := &SearchGroupResp{ApiResp: apiResp} 321 err = apiResp.JSONUnmarshalBody(resp) 322 if err != nil { 323 return nil, err 324 } 325 return resp, err 326 } 327 328 // 创建班次 329 // 330 // - 班次是描述一次考勤任务时间规则的统称,比如一天打多少次卡,每次卡的上下班时间,晚到多长时间算迟到,晚到多长时间算缺卡等。 331 // 332 // - - 创建一个考勤组前,必须先创建一个或者多个班次。;- 一个公司内的班次是共享的,你可以直接引用他人创建的班次,但是需要注意的是,若他人修改了班次,会影响到你的考勤组及其考勤结果。 333 // 334 // - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/attendance-v1/shift/create 335 // 336 // - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/attendancev1/create_shift.go 337 func (s *shift) Create(ctx context.Context, req *CreateShiftReq, options ...larkcore.RequestOptionFunc) (*CreateShiftResp, error) { 338 // 发起请求 339 apiReq := req.apiReq 340 apiReq.ApiPath = "/open-apis/attendance/v1/shifts" 341 apiReq.HttpMethod = http.MethodPost 342 apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant} 343 apiResp, err := larkcore.Request(ctx, apiReq, s.service.config, options...) 344 if err != nil { 345 return nil, err 346 } 347 // 反序列响应结果 348 resp := &CreateShiftResp{ApiResp: apiResp} 349 err = apiResp.JSONUnmarshalBody(resp) 350 if err != nil { 351 return nil, err 352 } 353 return resp, err 354 } 355 356 // 删除班次 357 // 358 // - 通过班次 ID 删除班次。 359 // 360 // - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/attendance-v1/shift/delete 361 // 362 // - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/attendancev1/delete_shift.go 363 func (s *shift) Delete(ctx context.Context, req *DeleteShiftReq, options ...larkcore.RequestOptionFunc) (*DeleteShiftResp, error) { 364 // 发起请求 365 apiReq := req.apiReq 366 apiReq.ApiPath = "/open-apis/attendance/v1/shifts/:shift_id" 367 apiReq.HttpMethod = http.MethodDelete 368 apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant} 369 apiResp, err := larkcore.Request(ctx, apiReq, s.service.config, options...) 370 if err != nil { 371 return nil, err 372 } 373 // 反序列响应结果 374 resp := &DeleteShiftResp{ApiResp: apiResp} 375 err = apiResp.JSONUnmarshalBody(resp) 376 if err != nil { 377 return nil, err 378 } 379 return resp, err 380 } 381 382 // 获取班次详情 383 // 384 // - 通过班次 ID 获取班次详情。 385 // 386 // - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/attendance-v1/shift/get 387 // 388 // - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/attendancev1/get_shift.go 389 func (s *shift) Get(ctx context.Context, req *GetShiftReq, options ...larkcore.RequestOptionFunc) (*GetShiftResp, error) { 390 // 发起请求 391 apiReq := req.apiReq 392 apiReq.ApiPath = "/open-apis/attendance/v1/shifts/:shift_id" 393 apiReq.HttpMethod = http.MethodGet 394 apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant} 395 apiResp, err := larkcore.Request(ctx, apiReq, s.service.config, options...) 396 if err != nil { 397 return nil, err 398 } 399 // 反序列响应结果 400 resp := &GetShiftResp{ApiResp: apiResp} 401 err = apiResp.JSONUnmarshalBody(resp) 402 if err != nil { 403 return nil, err 404 } 405 return resp, err 406 } 407 408 // 获取班次列表 409 // 410 // - 翻页获取所有班次列表。 411 // 412 // - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/attendance-v1/shift/list 413 // 414 // - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/attendancev1/list_shift.go 415 func (s *shift) List(ctx context.Context, req *ListShiftReq, options ...larkcore.RequestOptionFunc) (*ListShiftResp, error) { 416 // 发起请求 417 apiReq := req.apiReq 418 apiReq.ApiPath = "/open-apis/attendance/v1/shifts" 419 apiReq.HttpMethod = http.MethodGet 420 apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant} 421 apiResp, err := larkcore.Request(ctx, apiReq, s.service.config, options...) 422 if err != nil { 423 return nil, err 424 } 425 // 反序列响应结果 426 resp := &ListShiftResp{ApiResp: apiResp} 427 err = apiResp.JSONUnmarshalBody(resp) 428 if err != nil { 429 return nil, err 430 } 431 return resp, err 432 } 433 func (s *shift) ListByIterator(ctx context.Context, req *ListShiftReq, options ...larkcore.RequestOptionFunc) (*ListShiftIterator, error) { 434 return &ListShiftIterator{ 435 ctx: ctx, 436 req: req, 437 listFunc: s.List, 438 options: options, 439 limit: req.Limit}, nil 440 } 441 442 // 按名称查询班次 443 // 444 // - 通过班次的名称查询班次信息。 445 // 446 // - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/attendance-v1/shift/query 447 // 448 // - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/attendancev1/query_shift.go 449 func (s *shift) Query(ctx context.Context, req *QueryShiftReq, options ...larkcore.RequestOptionFunc) (*QueryShiftResp, error) { 450 // 发起请求 451 apiReq := req.apiReq 452 apiReq.ApiPath = "/open-apis/attendance/v1/shifts/query" 453 apiReq.HttpMethod = http.MethodPost 454 apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant} 455 apiResp, err := larkcore.Request(ctx, apiReq, s.service.config, options...) 456 if err != nil { 457 return nil, err 458 } 459 // 反序列响应结果 460 resp := &QueryShiftResp{ApiResp: apiResp} 461 err = apiResp.JSONUnmarshalBody(resp) 462 if err != nil { 463 return nil, err 464 } 465 return resp, err 466 } 467 468 // 写入审批结果 469 // 470 // - 由于部分企业使用的是自己的审批系统,而不是飞书审批系统,因此员工的请假、加班等数据无法流入到飞书考勤系统中,导致员工在请假时间段内依然收到打卡提醒,并且被记为缺卡。;;对于这些只使用飞书考勤系统,而未使用飞书审批系统的企业,可以通过考勤开放接口的形式,将三方审批结果数据回写到飞书考勤系统中。 471 // 472 // - 目前支持写入加班、请假、出差和外出这四种审批结果,写入只会追加(insert),不会覆盖(update) 473 // 474 // - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/attendance-v1/user_approval/create 475 // 476 // - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/attendancev1/create_userApproval.go 477 func (u *userApproval) Create(ctx context.Context, req *CreateUserApprovalReq, options ...larkcore.RequestOptionFunc) (*CreateUserApprovalResp, error) { 478 // 发起请求 479 apiReq := req.apiReq 480 apiReq.ApiPath = "/open-apis/attendance/v1/user_approvals" 481 apiReq.HttpMethod = http.MethodPost 482 apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant} 483 apiResp, err := larkcore.Request(ctx, apiReq, u.service.config, options...) 484 if err != nil { 485 return nil, err 486 } 487 // 反序列响应结果 488 resp := &CreateUserApprovalResp{ApiResp: apiResp} 489 err = apiResp.JSONUnmarshalBody(resp) 490 if err != nil { 491 return nil, err 492 } 493 return resp, err 494 } 495 496 // 获取审批通过数据 497 // 498 // - 获取员工在某段时间内的请假、加班、外出和出差四种审批的通过数据。 499 // 500 // - 请假的假期时长字段,暂未开放提供,待后续提供。 501 // 502 // - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/attendance-v1/user_approval/query 503 // 504 // - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/attendancev1/query_userApproval.go 505 func (u *userApproval) Query(ctx context.Context, req *QueryUserApprovalReq, options ...larkcore.RequestOptionFunc) (*QueryUserApprovalResp, error) { 506 // 发起请求 507 apiReq := req.apiReq 508 apiReq.ApiPath = "/open-apis/attendance/v1/user_approvals/query" 509 apiReq.HttpMethod = http.MethodPost 510 apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant} 511 apiResp, err := larkcore.Request(ctx, apiReq, u.service.config, options...) 512 if err != nil { 513 return nil, err 514 } 515 // 反序列响应结果 516 resp := &QueryUserApprovalResp{ApiResp: apiResp} 517 err = apiResp.JSONUnmarshalBody(resp) 518 if err != nil { 519 return nil, err 520 } 521 return resp, err 522 } 523 524 // 创建或修改班表 525 // 526 // - 班表是用来描述考勤组内人员每天按哪个班次进行上班。目前班表支持按一个整月对一位或多位人员进行排班。 527 // 528 // - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/attendance-v1/user_daily_shift/batch_create 529 // 530 // - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/attendancev1/batchCreate_userDailyShift.go 531 func (u *userDailyShift) BatchCreate(ctx context.Context, req *BatchCreateUserDailyShiftReq, options ...larkcore.RequestOptionFunc) (*BatchCreateUserDailyShiftResp, error) { 532 // 发起请求 533 apiReq := req.apiReq 534 apiReq.ApiPath = "/open-apis/attendance/v1/user_daily_shifts/batch_create" 535 apiReq.HttpMethod = http.MethodPost 536 apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant} 537 apiResp, err := larkcore.Request(ctx, apiReq, u.service.config, options...) 538 if err != nil { 539 return nil, err 540 } 541 // 反序列响应结果 542 resp := &BatchCreateUserDailyShiftResp{ApiResp: apiResp} 543 err = apiResp.JSONUnmarshalBody(resp) 544 if err != nil { 545 return nil, err 546 } 547 return resp, err 548 } 549 550 // 查询班表信息 551 // 552 // - 支持查询多个用户的排班情况,查询的时间跨度不能超过 30 天。 553 // 554 // - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/attendance-v1/user_daily_shift/query 555 // 556 // - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/attendancev1/query_userDailyShift.go 557 func (u *userDailyShift) Query(ctx context.Context, req *QueryUserDailyShiftReq, options ...larkcore.RequestOptionFunc) (*QueryUserDailyShiftResp, error) { 558 // 发起请求 559 apiReq := req.apiReq 560 apiReq.ApiPath = "/open-apis/attendance/v1/user_daily_shifts/query" 561 apiReq.HttpMethod = http.MethodPost 562 apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant} 563 apiResp, err := larkcore.Request(ctx, apiReq, u.service.config, options...) 564 if err != nil { 565 return nil, err 566 } 567 // 反序列响应结果 568 resp := &QueryUserDailyShiftResp{ApiResp: apiResp} 569 err = apiResp.JSONUnmarshalBody(resp) 570 if err != nil { 571 return nil, err 572 } 573 return resp, err 574 } 575 576 // 导入打卡流水记录 577 // 578 // - 导入授权内员工的打卡流水记录。导入后,会根据员工所在的考勤组班次规则,计算最终的打卡状态与结果。 579 // 580 // - 适用于考勤机数据导入等场景。 581 // 582 // - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/attendance-v1/user_flow/batch_create 583 // 584 // - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/attendancev1/batchCreate_userFlow.go 585 func (u *userFlow) BatchCreate(ctx context.Context, req *BatchCreateUserFlowReq, options ...larkcore.RequestOptionFunc) (*BatchCreateUserFlowResp, error) { 586 // 发起请求 587 apiReq := req.apiReq 588 apiReq.ApiPath = "/open-apis/attendance/v1/user_flows/batch_create" 589 apiReq.HttpMethod = http.MethodPost 590 apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant} 591 apiResp, err := larkcore.Request(ctx, apiReq, u.service.config, options...) 592 if err != nil { 593 return nil, err 594 } 595 // 反序列响应结果 596 resp := &BatchCreateUserFlowResp{ApiResp: apiResp} 597 err = apiResp.JSONUnmarshalBody(resp) 598 if err != nil { 599 return nil, err 600 } 601 return resp, err 602 } 603 604 // 获取打卡流水记录 605 // 606 // - 通过打卡记录 ID 获取用户的打卡流水记录。 607 // 608 // - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/attendance-v1/user_flow/get 609 // 610 // - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/attendancev1/get_userFlow.go 611 func (u *userFlow) Get(ctx context.Context, req *GetUserFlowReq, options ...larkcore.RequestOptionFunc) (*GetUserFlowResp, error) { 612 // 发起请求 613 apiReq := req.apiReq 614 apiReq.ApiPath = "/open-apis/attendance/v1/user_flows/:user_flow_id" 615 apiReq.HttpMethod = http.MethodGet 616 apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant} 617 apiResp, err := larkcore.Request(ctx, apiReq, u.service.config, options...) 618 if err != nil { 619 return nil, err 620 } 621 // 反序列响应结果 622 resp := &GetUserFlowResp{ApiResp: apiResp} 623 err = apiResp.JSONUnmarshalBody(resp) 624 if err != nil { 625 return nil, err 626 } 627 return resp, err 628 } 629 630 // 批量查询打卡流水记录 631 // 632 // - 批量查询授权内员工的实际打卡流水记录。例如,企业给一个员工设定的班次是上午 9 点和下午 6 点各打一次上下班卡,但是该员工在这期间打了多次卡,该接口会把所有的打卡记录都返回。 633 // 634 // - 如果只需获取打卡结果,而不需要详细的打卡数据,可使用“获取打卡结果”的接口。 635 // 636 // - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/attendance-v1/user_flow/query 637 // 638 // - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/attendancev1/query_userFlow.go 639 func (u *userFlow) Query(ctx context.Context, req *QueryUserFlowReq, options ...larkcore.RequestOptionFunc) (*QueryUserFlowResp, error) { 640 // 发起请求 641 apiReq := req.apiReq 642 apiReq.ApiPath = "/open-apis/attendance/v1/user_flows/query" 643 apiReq.HttpMethod = http.MethodPost 644 apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant} 645 apiResp, err := larkcore.Request(ctx, apiReq, u.service.config, options...) 646 if err != nil { 647 return nil, err 648 } 649 // 反序列响应结果 650 resp := &QueryUserFlowResp{ApiResp: apiResp} 651 err = apiResp.JSONUnmarshalBody(resp) 652 if err != nil { 653 return nil, err 654 } 655 return resp, err 656 } 657 658 // 修改用户设置 659 // 660 // - 修改授权内员工的用户设置信息,包括人脸照片文件 ID。 661 // 662 // - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/attendance-v1/user_setting/modify 663 // 664 // - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/attendancev1/modify_userSetting.go 665 func (u *userSetting) Modify(ctx context.Context, req *ModifyUserSettingReq, options ...larkcore.RequestOptionFunc) (*ModifyUserSettingResp, error) { 666 // 发起请求 667 apiReq := req.apiReq 668 apiReq.ApiPath = "/open-apis/attendance/v1/user_settings/modify" 669 apiReq.HttpMethod = http.MethodPost 670 apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant} 671 apiResp, err := larkcore.Request(ctx, apiReq, u.service.config, options...) 672 if err != nil { 673 return nil, err 674 } 675 // 反序列响应结果 676 resp := &ModifyUserSettingResp{ApiResp: apiResp} 677 err = apiResp.JSONUnmarshalBody(resp) 678 if err != nil { 679 return nil, err 680 } 681 return resp, err 682 } 683 684 // 批量查询用户设置 685 // 686 // - 批量查询授权内员工的用户设置信息,包括人脸照片文件 ID、人脸照片更新时间。 687 // 688 // - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/attendance-v1/user_setting/query 689 // 690 // - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/attendancev1/query_userSetting.go 691 func (u *userSetting) Query(ctx context.Context, req *QueryUserSettingReq, options ...larkcore.RequestOptionFunc) (*QueryUserSettingResp, error) { 692 // 发起请求 693 apiReq := req.apiReq 694 apiReq.ApiPath = "/open-apis/attendance/v1/user_settings/query" 695 apiReq.HttpMethod = http.MethodGet 696 apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant} 697 apiResp, err := larkcore.Request(ctx, apiReq, u.service.config, options...) 698 if err != nil { 699 return nil, err 700 } 701 // 反序列响应结果 702 resp := &QueryUserSettingResp{ApiResp: apiResp} 703 err = apiResp.JSONUnmarshalBody(resp) 704 if err != nil { 705 return nil, err 706 } 707 return resp, err 708 } 709 710 // 查询统计数据 711 // 712 // - 查询日度统计或月度统计的统计数据。 713 // 714 // - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/attendance-v1/user_stats_data/query 715 // 716 // - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/attendancev1/query_userStatsData.go 717 func (u *userStatsData) Query(ctx context.Context, req *QueryUserStatsDataReq, options ...larkcore.RequestOptionFunc) (*QueryUserStatsDataResp, error) { 718 // 发起请求 719 apiReq := req.apiReq 720 apiReq.ApiPath = "/open-apis/attendance/v1/user_stats_datas/query" 721 apiReq.HttpMethod = http.MethodPost 722 apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant} 723 apiResp, err := larkcore.Request(ctx, apiReq, u.service.config, options...) 724 if err != nil { 725 return nil, err 726 } 727 // 反序列响应结果 728 resp := &QueryUserStatsDataResp{ApiResp: apiResp} 729 err = apiResp.JSONUnmarshalBody(resp) 730 if err != nil { 731 return nil, err 732 } 733 return resp, err 734 } 735 736 // 查询统计表头 737 // 738 // - 查询考勤统计支持的日度统计或月度统计的统计表头。 739 // 740 // - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/attendance-v1/user_stats_field/query 741 // 742 // - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/attendancev1/query_userStatsField.go 743 func (u *userStatsField) Query(ctx context.Context, req *QueryUserStatsFieldReq, options ...larkcore.RequestOptionFunc) (*QueryUserStatsFieldResp, error) { 744 // 发起请求 745 apiReq := req.apiReq 746 apiReq.ApiPath = "/open-apis/attendance/v1/user_stats_fields/query" 747 apiReq.HttpMethod = http.MethodPost 748 apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant} 749 apiResp, err := larkcore.Request(ctx, apiReq, u.service.config, options...) 750 if err != nil { 751 return nil, err 752 } 753 // 反序列响应结果 754 resp := &QueryUserStatsFieldResp{ApiResp: apiResp} 755 err = apiResp.JSONUnmarshalBody(resp) 756 if err != nil { 757 return nil, err 758 } 759 return resp, err 760 } 761 762 // 查询统计设置 763 // 764 // - 查询开发者定制的日度统计或月度统计的统计报表表头设置信息。 765 // 766 // - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/attendance-v1/user_stats_view/query 767 // 768 // - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/attendancev1/query_userStatsView.go 769 func (u *userStatsView) Query(ctx context.Context, req *QueryUserStatsViewReq, options ...larkcore.RequestOptionFunc) (*QueryUserStatsViewResp, error) { 770 // 发起请求 771 apiReq := req.apiReq 772 apiReq.ApiPath = "/open-apis/attendance/v1/user_stats_views/query" 773 apiReq.HttpMethod = http.MethodPost 774 apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant} 775 apiResp, err := larkcore.Request(ctx, apiReq, u.service.config, options...) 776 if err != nil { 777 return nil, err 778 } 779 // 反序列响应结果 780 resp := &QueryUserStatsViewResp{ApiResp: apiResp} 781 err = apiResp.JSONUnmarshalBody(resp) 782 if err != nil { 783 return nil, err 784 } 785 return resp, err 786 } 787 788 // 更新统计设置 789 // 790 // - 更新开发者定制的日度统计或月度统计的统计报表表头设置信息。 791 // 792 // - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/attendance-v1/user_stats_view/update 793 // 794 // - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/attendancev1/update_userStatsView.go 795 func (u *userStatsView) Update(ctx context.Context, req *UpdateUserStatsViewReq, options ...larkcore.RequestOptionFunc) (*UpdateUserStatsViewResp, error) { 796 // 发起请求 797 apiReq := req.apiReq 798 apiReq.ApiPath = "/open-apis/attendance/v1/user_stats_views/:user_stats_view_id" 799 apiReq.HttpMethod = http.MethodPut 800 apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant} 801 apiResp, err := larkcore.Request(ctx, apiReq, u.service.config, options...) 802 if err != nil { 803 return nil, err 804 } 805 // 反序列响应结果 806 resp := &UpdateUserStatsViewResp{ApiResp: apiResp} 807 err = apiResp.JSONUnmarshalBody(resp) 808 if err != nil { 809 return nil, err 810 } 811 return resp, err 812 } 813 814 // 获取打卡结果 815 // 816 // - 获取企业内员工的实际打卡结果,包括上班打卡结果和下班打卡结果。 817 // 818 // - - 如果企业给一个员工设定的班次是上午 9 点和下午 6 点各打一次上下班卡,即使员工在这期间打了多次卡,该接口也只会返回 1 条记录。;- 如果要获取打卡的详细数据,如打卡位置等信息,可使用“获取打卡流水记录”或“批量查询打卡流水记录”的接口。 819 // 820 // - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/attendance-v1/user_task/query 821 // 822 // - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/attendancev1/query_userTask.go 823 func (u *userTask) Query(ctx context.Context, req *QueryUserTaskReq, options ...larkcore.RequestOptionFunc) (*QueryUserTaskResp, error) { 824 // 发起请求 825 apiReq := req.apiReq 826 apiReq.ApiPath = "/open-apis/attendance/v1/user_tasks/query" 827 apiReq.HttpMethod = http.MethodPost 828 apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant} 829 apiResp, err := larkcore.Request(ctx, apiReq, u.service.config, options...) 830 if err != nil { 831 return nil, err 832 } 833 // 反序列响应结果 834 resp := &QueryUserTaskResp{ApiResp: apiResp} 835 err = apiResp.JSONUnmarshalBody(resp) 836 if err != nil { 837 return nil, err 838 } 839 return resp, err 840 } 841 842 // 通知补卡审批发起 843 // 844 // - 对于只使用飞书考勤系统而未使用飞书审批系统的企业,可以通过该接口,将在三方审批系统中发起的补卡审批数据,写入到飞书考勤系统中,状态为审批中。写入后可以由[通知审批状态更新](/ssl:ttdoc/uAjLw4CM/ukTMukTMukTM/reference/attendance-v1/approval_info/process) 进行状态更新 845 // 846 // - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/attendance-v1/user_task_remedy/create 847 // 848 // - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/attendancev1/create_userTaskRemedy.go 849 func (u *userTaskRemedy) Create(ctx context.Context, req *CreateUserTaskRemedyReq, options ...larkcore.RequestOptionFunc) (*CreateUserTaskRemedyResp, error) { 850 // 发起请求 851 apiReq := req.apiReq 852 apiReq.ApiPath = "/open-apis/attendance/v1/user_task_remedys" 853 apiReq.HttpMethod = http.MethodPost 854 apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant} 855 apiResp, err := larkcore.Request(ctx, apiReq, u.service.config, options...) 856 if err != nil { 857 return nil, err 858 } 859 // 反序列响应结果 860 resp := &CreateUserTaskRemedyResp{ApiResp: apiResp} 861 err = apiResp.JSONUnmarshalBody(resp) 862 if err != nil { 863 return nil, err 864 } 865 return resp, err 866 } 867 868 // 获取补卡记录 869 // 870 // - 获取授权内员工的补卡记录。 871 // 872 // - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/attendance-v1/user_task_remedy/query 873 // 874 // - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/attendancev1/query_userTaskRemedy.go 875 func (u *userTaskRemedy) Query(ctx context.Context, req *QueryUserTaskRemedyReq, options ...larkcore.RequestOptionFunc) (*QueryUserTaskRemedyResp, error) { 876 // 发起请求 877 apiReq := req.apiReq 878 apiReq.ApiPath = "/open-apis/attendance/v1/user_task_remedys/query" 879 apiReq.HttpMethod = http.MethodPost 880 apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant} 881 apiResp, err := larkcore.Request(ctx, apiReq, u.service.config, options...) 882 if err != nil { 883 return nil, err 884 } 885 // 反序列响应结果 886 resp := &QueryUserTaskRemedyResp{ApiResp: apiResp} 887 err = apiResp.JSONUnmarshalBody(resp) 888 if err != nil { 889 return nil, err 890 } 891 return resp, err 892 } 893 894 // 获取用户可补卡时间 895 // 896 // - 获取用户某天可以补的第几次上 / 下班卡的时间。 897 // 898 // - 官网API文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/attendance-v1/user_task_remedy/query_user_allowed_remedys 899 // 900 // - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/attendancev1/queryUserAllowedRemedys_userTaskRemedy.go 901 func (u *userTaskRemedy) QueryUserAllowedRemedys(ctx context.Context, req *QueryUserAllowedRemedysUserTaskRemedyReq, options ...larkcore.RequestOptionFunc) (*QueryUserAllowedRemedysUserTaskRemedyResp, error) { 902 // 发起请求 903 apiReq := req.apiReq 904 apiReq.ApiPath = "/open-apis/attendance/v1/user_task_remedys/query_user_allowed_remedys" 905 apiReq.HttpMethod = http.MethodPost 906 apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant} 907 apiResp, err := larkcore.Request(ctx, apiReq, u.service.config, options...) 908 if err != nil { 909 return nil, err 910 } 911 // 反序列响应结果 912 resp := &QueryUserAllowedRemedysUserTaskRemedyResp{ApiResp: apiResp} 913 err = apiResp.JSONUnmarshalBody(resp) 914 if err != nil { 915 return nil, err 916 } 917 return resp, err 918 }