gitee.com/larksuite/oapi-sdk-go/v3@v3.0.3/service/ehr/v1/model.go (about) 1 // Package ehr 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 larkehr 15 16 import ( 17 "io" 18 19 "io/ioutil" 20 21 "fmt" 22 23 "context" 24 "errors" 25 26 "gitee.com/larksuite/oapi-sdk-go/v3/core" 27 ) 28 29 const ( 30 ViewBasic = "basic" // 概览, 只返回 id、name 等基本信息 31 ViewFull = "full" // 返回详细信息 32 ) 33 34 const ( 35 UserIdTypeUserId = "user_id" // 以user_id来识别用户 36 UserIdTypeUnionId = "union_id" // 以union_id来识别用户 37 UserIdTypeOpenId = "open_id" // 以open_id来识别用户 38 ) 39 40 type Attachment struct { 41 Id *string `json:"id,omitempty"` // 下载文件所需要的 Token 42 MimeType *string `json:"mime_type,omitempty"` // 文件类型 43 Name *string `json:"name,omitempty"` // 名称 44 Size *int64 `json:"size,omitempty"` // 大小 45 } 46 47 type AttachmentBuilder struct { 48 id string // 下载文件所需要的 Token 49 idFlag bool 50 mimeType string // 文件类型 51 mimeTypeFlag bool 52 name string // 名称 53 nameFlag bool 54 size int64 // 大小 55 sizeFlag bool 56 } 57 58 func NewAttachmentBuilder() *AttachmentBuilder { 59 builder := &AttachmentBuilder{} 60 return builder 61 } 62 63 // 下载文件所需要的 Token 64 // 65 // 示例值:c7273e07ed9e40a394f88c7dccb49212 66 func (builder *AttachmentBuilder) Id(id string) *AttachmentBuilder { 67 builder.id = id 68 builder.idFlag = true 69 return builder 70 } 71 72 // 文件类型 73 // 74 // 示例值:png 75 func (builder *AttachmentBuilder) MimeType(mimeType string) *AttachmentBuilder { 76 builder.mimeType = mimeType 77 builder.mimeTypeFlag = true 78 return builder 79 } 80 81 // 名称 82 // 83 // 示例值:Custom Code.png 84 func (builder *AttachmentBuilder) Name(name string) *AttachmentBuilder { 85 builder.name = name 86 builder.nameFlag = true 87 return builder 88 } 89 90 // 大小 91 // 92 // 示例值:57380 93 func (builder *AttachmentBuilder) Size(size int64) *AttachmentBuilder { 94 builder.size = size 95 builder.sizeFlag = true 96 return builder 97 } 98 99 func (builder *AttachmentBuilder) Build() *Attachment { 100 req := &Attachment{} 101 if builder.idFlag { 102 req.Id = &builder.id 103 104 } 105 if builder.mimeTypeFlag { 106 req.MimeType = &builder.mimeType 107 108 } 109 if builder.nameFlag { 110 req.Name = &builder.name 111 112 } 113 if builder.sizeFlag { 114 req.Size = &builder.size 115 116 } 117 return req 118 } 119 120 type ContractCompany struct { 121 Id *int64 `json:"id,omitempty"` // 公司 ID 122 Name *string `json:"name,omitempty"` // 公司名称 123 } 124 125 type ContractCompanyBuilder struct { 126 id int64 // 公司 ID 127 idFlag bool 128 name string // 公司名称 129 nameFlag bool 130 } 131 132 func NewContractCompanyBuilder() *ContractCompanyBuilder { 133 builder := &ContractCompanyBuilder{} 134 return builder 135 } 136 137 // 公司 ID 138 // 139 // 示例值:1695838220091399 140 func (builder *ContractCompanyBuilder) Id(id int64) *ContractCompanyBuilder { 141 builder.id = id 142 builder.idFlag = true 143 return builder 144 } 145 146 // 公司名称 147 // 148 // 示例值:油条一号 149 func (builder *ContractCompanyBuilder) Name(name string) *ContractCompanyBuilder { 150 builder.name = name 151 builder.nameFlag = true 152 return builder 153 } 154 155 func (builder *ContractCompanyBuilder) Build() *ContractCompany { 156 req := &ContractCompany{} 157 if builder.idFlag { 158 req.Id = &builder.id 159 160 } 161 if builder.nameFlag { 162 req.Name = &builder.name 163 164 } 165 return req 166 } 167 168 type CustomFields struct { 169 Key *string `json:"key,omitempty"` // 自定义字段key 170 Label *string `json:"label,omitempty"` // 自定义字段名称 171 Type *string `json:"type,omitempty"` // 自定义字段类型 172 Value *string `json:"value,omitempty"` // 根据 type 不同,结构不同,不同 type 对应的数据结构在 type 的枚举值中有描述 173 } 174 175 type CustomFieldsBuilder struct { 176 key string // 自定义字段key 177 keyFlag bool 178 label string // 自定义字段名称 179 labelFlag bool 180 type_ string // 自定义字段类型 181 typeFlag bool 182 value string // 根据 type 不同,结构不同,不同 type 对应的数据结构在 type 的枚举值中有描述 183 valueFlag bool 184 } 185 186 func NewCustomFieldsBuilder() *CustomFieldsBuilder { 187 builder := &CustomFieldsBuilder{} 188 return builder 189 } 190 191 // 自定义字段key 192 // 193 // 示例值:field_xxxxxxxx 194 func (builder *CustomFieldsBuilder) Key(key string) *CustomFieldsBuilder { 195 builder.key = key 196 builder.keyFlag = true 197 return builder 198 } 199 200 // 自定义字段名称 201 // 202 // 示例值:自定义字段 1 203 func (builder *CustomFieldsBuilder) Label(label string) *CustomFieldsBuilder { 204 builder.label = label 205 builder.labelFlag = true 206 return builder 207 } 208 209 // 自定义字段类型 210 // 211 // 示例值:date 212 func (builder *CustomFieldsBuilder) Type(type_ string) *CustomFieldsBuilder { 213 builder.type_ = type_ 214 builder.typeFlag = true 215 return builder 216 } 217 218 // 根据 type 不同,结构不同,不同 type 对应的数据结构在 type 的枚举值中有描述 219 // 220 // 示例值:2021-01-13 221 func (builder *CustomFieldsBuilder) Value(value string) *CustomFieldsBuilder { 222 builder.value = value 223 builder.valueFlag = true 224 return builder 225 } 226 227 func (builder *CustomFieldsBuilder) Build() *CustomFields { 228 req := &CustomFields{} 229 if builder.keyFlag { 230 req.Key = &builder.key 231 232 } 233 if builder.labelFlag { 234 req.Label = &builder.label 235 236 } 237 if builder.typeFlag { 238 req.Type = &builder.type_ 239 240 } 241 if builder.valueFlag { 242 req.Value = &builder.value 243 244 } 245 return req 246 } 247 248 type Education struct { 249 Level *int `json:"level,omitempty"` // 学历 250 School *string `json:"school,omitempty"` // 毕业学校 251 Major *string `json:"major,omitempty"` // 专业 252 Degree *int `json:"degree,omitempty"` // 学位 253 Start *string `json:"start,omitempty"` // 开始日期 254 End *string `json:"end,omitempty"` // 结束日期 255 } 256 257 type EducationBuilder struct { 258 level int // 学历 259 levelFlag bool 260 school string // 毕业学校 261 schoolFlag bool 262 major string // 专业 263 majorFlag bool 264 degree int // 学位 265 degreeFlag bool 266 start string // 开始日期 267 startFlag bool 268 end string // 结束日期 269 endFlag bool 270 } 271 272 func NewEducationBuilder() *EducationBuilder { 273 builder := &EducationBuilder{} 274 return builder 275 } 276 277 // 学历 278 // 279 // 示例值:8 280 func (builder *EducationBuilder) Level(level int) *EducationBuilder { 281 builder.level = level 282 builder.levelFlag = true 283 return builder 284 } 285 286 // 毕业学校 287 // 288 // 示例值:XXXX大学 289 func (builder *EducationBuilder) School(school string) *EducationBuilder { 290 builder.school = school 291 builder.schoolFlag = true 292 return builder 293 } 294 295 // 专业 296 // 297 // 示例值:XXX专业 298 func (builder *EducationBuilder) Major(major string) *EducationBuilder { 299 builder.major = major 300 builder.majorFlag = true 301 return builder 302 } 303 304 // 学位 305 // 306 // 示例值:2 307 func (builder *EducationBuilder) Degree(degree int) *EducationBuilder { 308 builder.degree = degree 309 builder.degreeFlag = true 310 return builder 311 } 312 313 // 开始日期 314 // 315 // 示例值:2020-01-01 316 func (builder *EducationBuilder) Start(start string) *EducationBuilder { 317 builder.start = start 318 builder.startFlag = true 319 return builder 320 } 321 322 // 结束日期 323 // 324 // 示例值:2020-01-01 325 func (builder *EducationBuilder) End(end string) *EducationBuilder { 326 builder.end = end 327 builder.endFlag = true 328 return builder 329 } 330 331 func (builder *EducationBuilder) Build() *Education { 332 req := &Education{} 333 if builder.levelFlag { 334 req.Level = &builder.level 335 336 } 337 if builder.schoolFlag { 338 req.School = &builder.school 339 340 } 341 if builder.majorFlag { 342 req.Major = &builder.major 343 344 } 345 if builder.degreeFlag { 346 req.Degree = &builder.degree 347 348 } 349 if builder.startFlag { 350 req.Start = &builder.start 351 352 } 353 if builder.endFlag { 354 req.End = &builder.end 355 356 } 357 return req 358 } 359 360 type EmergencyContact struct { 361 Name *string `json:"name,omitempty"` // 紧急联系人姓名 362 Relationship *int `json:"relationship,omitempty"` // 与紧急联系人的关系 363 Mobile *string `json:"mobile,omitempty"` // 手机号 364 } 365 366 type EmergencyContactBuilder struct { 367 name string // 紧急联系人姓名 368 nameFlag bool 369 relationship int // 与紧急联系人的关系 370 relationshipFlag bool 371 mobile string // 手机号 372 mobileFlag bool 373 } 374 375 func NewEmergencyContactBuilder() *EmergencyContactBuilder { 376 builder := &EmergencyContactBuilder{} 377 return builder 378 } 379 380 // 紧急联系人姓名 381 // 382 // 示例值:张三 383 func (builder *EmergencyContactBuilder) Name(name string) *EmergencyContactBuilder { 384 builder.name = name 385 builder.nameFlag = true 386 return builder 387 } 388 389 // 与紧急联系人的关系 390 // 391 // 示例值:1 392 func (builder *EmergencyContactBuilder) Relationship(relationship int) *EmergencyContactBuilder { 393 builder.relationship = relationship 394 builder.relationshipFlag = true 395 return builder 396 } 397 398 // 手机号 399 // 400 // 示例值:(+86) 13812345678 401 func (builder *EmergencyContactBuilder) Mobile(mobile string) *EmergencyContactBuilder { 402 builder.mobile = mobile 403 builder.mobileFlag = true 404 return builder 405 } 406 407 func (builder *EmergencyContactBuilder) Build() *EmergencyContact { 408 req := &EmergencyContact{} 409 if builder.nameFlag { 410 req.Name = &builder.name 411 412 } 413 if builder.relationshipFlag { 414 req.Relationship = &builder.relationship 415 416 } 417 if builder.mobileFlag { 418 req.Mobile = &builder.mobile 419 420 } 421 return req 422 } 423 424 type Employee struct { 425 UserId *string `json:"user_id,omitempty"` // 员工的用户 ID;;;user_id_type 为 user_id 时返回 user_id;;;;user_id_type 为 open_id 时返回 open_id;;;;user_id_type 为 union_id 时返回 union_id;;;;「待入职」和「已取消入职」的员工,此字段值为 null 426 SystemFields *SystemFields `json:"system_fields,omitempty"` // 系统字段 427 CustomFields []*CustomFields `json:"custom_fields,omitempty"` // 自定义字段 428 } 429 430 type EmployeeBuilder struct { 431 userId string // 员工的用户 ID;;;user_id_type 为 user_id 时返回 user_id;;;;user_id_type 为 open_id 时返回 open_id;;;;user_id_type 为 union_id 时返回 union_id;;;;「待入职」和「已取消入职」的员工,此字段值为 null 432 userIdFlag bool 433 systemFields *SystemFields // 系统字段 434 systemFieldsFlag bool 435 customFields []*CustomFields // 自定义字段 436 customFieldsFlag bool 437 } 438 439 func NewEmployeeBuilder() *EmployeeBuilder { 440 builder := &EmployeeBuilder{} 441 return builder 442 } 443 444 // 员工的用户 ID;;;user_id_type 为 user_id 时返回 user_id;;;;user_id_type 为 open_id 时返回 open_id;;;;user_id_type 为 union_id 时返回 union_id;;;;「待入职」和「已取消入职」的员工,此字段值为 null 445 // 446 // 示例值:ou_db362c0e79f5a26db1ca8e94698ee417 447 func (builder *EmployeeBuilder) UserId(userId string) *EmployeeBuilder { 448 builder.userId = userId 449 builder.userIdFlag = true 450 return builder 451 } 452 453 // 系统字段 454 // 455 // 示例值: 456 func (builder *EmployeeBuilder) SystemFields(systemFields *SystemFields) *EmployeeBuilder { 457 builder.systemFields = systemFields 458 builder.systemFieldsFlag = true 459 return builder 460 } 461 462 // 自定义字段 463 // 464 // 示例值: 465 func (builder *EmployeeBuilder) CustomFields(customFields []*CustomFields) *EmployeeBuilder { 466 builder.customFields = customFields 467 builder.customFieldsFlag = true 468 return builder 469 } 470 471 func (builder *EmployeeBuilder) Build() *Employee { 472 req := &Employee{} 473 if builder.userIdFlag { 474 req.UserId = &builder.userId 475 476 } 477 if builder.systemFieldsFlag { 478 req.SystemFields = builder.systemFields 479 } 480 if builder.customFieldsFlag { 481 req.CustomFields = builder.customFields 482 } 483 return req 484 } 485 486 type Job struct { 487 Id *int64 `json:"id,omitempty"` // 职位 ID 488 Name *string `json:"name,omitempty"` // 职位名称 489 } 490 491 type JobBuilder struct { 492 id int64 // 职位 ID 493 idFlag bool 494 name string // 职位名称 495 nameFlag bool 496 } 497 498 func NewJobBuilder() *JobBuilder { 499 builder := &JobBuilder{} 500 return builder 501 } 502 503 // 职位 ID 504 // 505 // 示例值:1695838220091399 506 func (builder *JobBuilder) Id(id int64) *JobBuilder { 507 builder.id = id 508 builder.idFlag = true 509 return builder 510 } 511 512 // 职位名称 513 // 514 // 示例值:测试工程师 515 func (builder *JobBuilder) Name(name string) *JobBuilder { 516 builder.name = name 517 builder.nameFlag = true 518 return builder 519 } 520 521 func (builder *JobBuilder) Build() *Job { 522 req := &Job{} 523 if builder.idFlag { 524 req.Id = &builder.id 525 526 } 527 if builder.nameFlag { 528 req.Name = &builder.name 529 530 } 531 return req 532 } 533 534 type JobLevel struct { 535 Id *int64 `json:"id,omitempty"` // 职级 ID 536 Name *string `json:"name,omitempty"` // 职级名称 537 } 538 539 type JobLevelBuilder struct { 540 id int64 // 职级 ID 541 idFlag bool 542 name string // 职级名称 543 nameFlag bool 544 } 545 546 func NewJobLevelBuilder() *JobLevelBuilder { 547 builder := &JobLevelBuilder{} 548 return builder 549 } 550 551 // 职级 ID 552 // 553 // 示例值:1695838220091399 554 func (builder *JobLevelBuilder) Id(id int64) *JobLevelBuilder { 555 builder.id = id 556 builder.idFlag = true 557 return builder 558 } 559 560 // 职级名称 561 // 562 // 示例值:CEO 563 func (builder *JobLevelBuilder) Name(name string) *JobLevelBuilder { 564 builder.name = name 565 builder.nameFlag = true 566 return builder 567 } 568 569 func (builder *JobLevelBuilder) Build() *JobLevel { 570 req := &JobLevel{} 571 if builder.idFlag { 572 req.Id = &builder.id 573 574 } 575 if builder.nameFlag { 576 req.Name = &builder.name 577 578 } 579 return req 580 } 581 582 type Manager struct { 583 UserId *string `json:"user_id,omitempty"` // 上级的用户 ID(user_id) 584 Name *string `json:"name,omitempty"` // 中文名 585 EnName *string `json:"en_name,omitempty"` // 英文名 586 } 587 588 type ManagerBuilder struct { 589 userId string // 上级的用户 ID(user_id) 590 userIdFlag bool 591 name string // 中文名 592 nameFlag bool 593 enName string // 英文名 594 enNameFlag bool 595 } 596 597 func NewManagerBuilder() *ManagerBuilder { 598 builder := &ManagerBuilder{} 599 return builder 600 } 601 602 // 上级的用户 ID(user_id) 603 // 604 // 示例值:ou_db362c0e79f5a26db1ca8e94698ee417 605 func (builder *ManagerBuilder) UserId(userId string) *ManagerBuilder { 606 builder.userId = userId 607 builder.userIdFlag = true 608 return builder 609 } 610 611 // 中文名 612 // 613 // 示例值:李四 614 func (builder *ManagerBuilder) Name(name string) *ManagerBuilder { 615 builder.name = name 616 builder.nameFlag = true 617 return builder 618 } 619 620 // 英文名 621 // 622 // 示例值:Tom Li 623 func (builder *ManagerBuilder) EnName(enName string) *ManagerBuilder { 624 builder.enName = enName 625 builder.enNameFlag = true 626 return builder 627 } 628 629 func (builder *ManagerBuilder) Build() *Manager { 630 req := &Manager{} 631 if builder.userIdFlag { 632 req.UserId = &builder.userId 633 634 } 635 if builder.nameFlag { 636 req.Name = &builder.name 637 638 } 639 if builder.enNameFlag { 640 req.EnName = &builder.enName 641 642 } 643 return req 644 } 645 646 type NativeRegion struct { 647 IsoCode *string `json:"iso_code,omitempty"` // ISO 编码 648 Name *string `json:"name,omitempty"` // 名称 649 } 650 651 type NativeRegionBuilder struct { 652 isoCode string // ISO 编码 653 isoCodeFlag bool 654 name string // 名称 655 nameFlag bool 656 } 657 658 func NewNativeRegionBuilder() *NativeRegionBuilder { 659 builder := &NativeRegionBuilder{} 660 return builder 661 } 662 663 // ISO 编码 664 // 665 // 示例值:CHN-11 666 func (builder *NativeRegionBuilder) IsoCode(isoCode string) *NativeRegionBuilder { 667 builder.isoCode = isoCode 668 builder.isoCodeFlag = true 669 return builder 670 } 671 672 // 名称 673 // 674 // 示例值:北京 675 func (builder *NativeRegionBuilder) Name(name string) *NativeRegionBuilder { 676 builder.name = name 677 builder.nameFlag = true 678 return builder 679 } 680 681 func (builder *NativeRegionBuilder) Build() *NativeRegion { 682 req := &NativeRegion{} 683 if builder.isoCodeFlag { 684 req.IsoCode = &builder.isoCode 685 686 } 687 if builder.nameFlag { 688 req.Name = &builder.name 689 690 } 691 return req 692 } 693 694 type SystemFields struct { 695 Name *string `json:"name,omitempty"` // 中文姓名 696 EnName *string `json:"en_name,omitempty"` // 英文姓名 697 Email *string `json:"email,omitempty"` // 邮箱 698 Mobile *string `json:"mobile,omitempty"` // 手机号码 699 DepartmentId *string `json:"department_id,omitempty"` // 部门的飞书 open_department_id 700 Manager *Manager `json:"manager,omitempty"` // 上级 701 Job *Job `json:"job,omitempty"` // 职位 702 JobLevel *JobLevel `json:"job_level,omitempty"` // 职级 703 WorkLocation *WorkLocation `json:"work_location,omitempty"` // 工作地点 704 Gender *int `json:"gender,omitempty"` // 性别 705 Birthday *string `json:"birthday,omitempty"` // 出生日期 706 NativeRegion *NativeRegion `json:"native_region,omitempty"` // 籍贯 707 Ethnicity *int `json:"ethnicity,omitempty"` // 民族 708 MaritalStatus *int `json:"marital_status,omitempty"` // 婚姻状况 709 PoliticalStatus *int `json:"political_status,omitempty"` // 政治面貌 710 EnteredWorkforceDate *string `json:"entered_workforce_date,omitempty"` // 参加工作日期 711 IdType *int `json:"id_type,omitempty"` // 证件类型 712 IdNumber *string `json:"id_number,omitempty"` // 证件号 713 HukouType *int `json:"hukou_type,omitempty"` // 户口类型 714 HukouLocation *string `json:"hukou_location,omitempty"` // 户口所在地 715 BankAccountNumber *string `json:"bank_account_number,omitempty"` // 银行卡号 716 BankName *string `json:"bank_name,omitempty"` // 开户行 717 SocialSecurityAccount *string `json:"social_security_account,omitempty"` // 社保账号 718 ProvidentFundAccount *string `json:"provident_fund_account,omitempty"` // 公积金账号 719 EmployeeNo *string `json:"employee_no,omitempty"` // 工号 720 EmployeeType *int `json:"employee_type,omitempty"` // 雇员类型 721 Status *int `json:"status,omitempty"` // 员工状态 722 HireDate *string `json:"hire_date,omitempty"` // 入职日期 723 ProbationMonths *float64 `json:"probation_months,omitempty"` // 试用期(月) 724 ConversionDate *string `json:"conversion_date,omitempty"` // 转正日期 725 Application *int `json:"application,omitempty"` // 转正申请 726 ApplicationStatus *int `json:"application_status,omitempty"` // 转正状态 727 LastDay *string `json:"last_day,omitempty"` // 离职日期 728 DepartureType *int `json:"departure_type,omitempty"` // 离职类型 729 DepartureReason *int `json:"departure_reason,omitempty"` // 离职原因 730 DepartureNotes *string `json:"departure_notes,omitempty"` // 离职备注 731 ContractCompany *ContractCompany `json:"contract_company,omitempty"` // 合同公司 732 ContractType *int `json:"contract_type,omitempty"` // 合同类型 733 ContractStartDate *string `json:"contract_start_date,omitempty"` // 合同开始日期 734 ContractExpirationDate *string `json:"contract_expiration_date,omitempty"` // 合同到期日期 735 ContractSignTimes *int `json:"contract_sign_times,omitempty"` // 劳动合同签订次数 736 PersonalEmail *string `json:"personal_email,omitempty"` // 个人邮箱 737 FamilyAddress *string `json:"family_address,omitempty"` // 家庭地址 738 PrimaryEmergencyContact *EmergencyContact `json:"primary_emergency_contact,omitempty"` // 主要紧急联系人 739 EmergencyContact []*EmergencyContact `json:"emergency_contact,omitempty"` // 紧急联系人 740 HighestLevelOfEdu *Education `json:"highest_level_of_edu,omitempty"` // 最高学历 741 Education []*Education `json:"education,omitempty"` // 教育经历 742 FormerWorkExp *WorkExperience `json:"former_work_exp,omitempty"` // 前工作经历 743 WorkExp []*WorkExperience `json:"work_exp,omitempty"` // 工作经历 744 IdPhotoPoSide []*Attachment `json:"id_photo_po_side,omitempty"` // 身份证照片(人像面) 745 IdPhotoEmSide []*Attachment `json:"id_photo_em_side,omitempty"` // 身份证照片(国徽面) 746 IdPhoto []*Attachment `json:"id_photo,omitempty"` // 证件照 747 DiplomaPhoto []*Attachment `json:"diploma_photo,omitempty"` // 学位证书 748 GraduationCert []*Attachment `json:"graduation_cert,omitempty"` // 毕业证书 749 CertOfMerit []*Attachment `json:"cert_of_merit,omitempty"` // 奖励证明 750 OffboardingFile []*Attachment `json:"offboarding_file,omitempty"` // 离职证明 751 CancelOnboardingReason *int `json:"cancel_onboarding_reason,omitempty"` // 取消入职原因 752 CancelOnboardingNotes *string `json:"cancel_onboarding_notes,omitempty"` // 取消入职备注 753 EmployeeFormStatus *int `json:"employee_form_status,omitempty"` // 入职登记表状态 754 CreateTime *int64 `json:"create_time,omitempty"` // 创建时间 755 UpdateTime *int64 `json:"update_time,omitempty"` // 更新时间 756 } 757 758 type SystemFieldsBuilder struct { 759 name string // 中文姓名 760 nameFlag bool 761 enName string // 英文姓名 762 enNameFlag bool 763 email string // 邮箱 764 emailFlag bool 765 mobile string // 手机号码 766 mobileFlag bool 767 departmentId string // 部门的飞书 open_department_id 768 departmentIdFlag bool 769 manager *Manager // 上级 770 managerFlag bool 771 job *Job // 职位 772 jobFlag bool 773 jobLevel *JobLevel // 职级 774 jobLevelFlag bool 775 workLocation *WorkLocation // 工作地点 776 workLocationFlag bool 777 gender int // 性别 778 genderFlag bool 779 birthday string // 出生日期 780 birthdayFlag bool 781 nativeRegion *NativeRegion // 籍贯 782 nativeRegionFlag bool 783 ethnicity int // 民族 784 ethnicityFlag bool 785 maritalStatus int // 婚姻状况 786 maritalStatusFlag bool 787 politicalStatus int // 政治面貌 788 politicalStatusFlag bool 789 enteredWorkforceDate string // 参加工作日期 790 enteredWorkforceDateFlag bool 791 idType int // 证件类型 792 idTypeFlag bool 793 idNumber string // 证件号 794 idNumberFlag bool 795 hukouType int // 户口类型 796 hukouTypeFlag bool 797 hukouLocation string // 户口所在地 798 hukouLocationFlag bool 799 bankAccountNumber string // 银行卡号 800 bankAccountNumberFlag bool 801 bankName string // 开户行 802 bankNameFlag bool 803 socialSecurityAccount string // 社保账号 804 socialSecurityAccountFlag bool 805 providentFundAccount string // 公积金账号 806 providentFundAccountFlag bool 807 employeeNo string // 工号 808 employeeNoFlag bool 809 employeeType int // 雇员类型 810 employeeTypeFlag bool 811 status int // 员工状态 812 statusFlag bool 813 hireDate string // 入职日期 814 hireDateFlag bool 815 probationMonths float64 // 试用期(月) 816 probationMonthsFlag bool 817 conversionDate string // 转正日期 818 conversionDateFlag bool 819 application int // 转正申请 820 applicationFlag bool 821 applicationStatus int // 转正状态 822 applicationStatusFlag bool 823 lastDay string // 离职日期 824 lastDayFlag bool 825 departureType int // 离职类型 826 departureTypeFlag bool 827 departureReason int // 离职原因 828 departureReasonFlag bool 829 departureNotes string // 离职备注 830 departureNotesFlag bool 831 contractCompany *ContractCompany // 合同公司 832 contractCompanyFlag bool 833 contractType int // 合同类型 834 contractTypeFlag bool 835 contractStartDate string // 合同开始日期 836 contractStartDateFlag bool 837 contractExpirationDate string // 合同到期日期 838 contractExpirationDateFlag bool 839 contractSignTimes int // 劳动合同签订次数 840 contractSignTimesFlag bool 841 personalEmail string // 个人邮箱 842 personalEmailFlag bool 843 familyAddress string // 家庭地址 844 familyAddressFlag bool 845 primaryEmergencyContact *EmergencyContact // 主要紧急联系人 846 primaryEmergencyContactFlag bool 847 emergencyContact []*EmergencyContact // 紧急联系人 848 emergencyContactFlag bool 849 highestLevelOfEdu *Education // 最高学历 850 highestLevelOfEduFlag bool 851 education []*Education // 教育经历 852 educationFlag bool 853 formerWorkExp *WorkExperience // 前工作经历 854 formerWorkExpFlag bool 855 workExp []*WorkExperience // 工作经历 856 workExpFlag bool 857 idPhotoPoSide []*Attachment // 身份证照片(人像面) 858 idPhotoPoSideFlag bool 859 idPhotoEmSide []*Attachment // 身份证照片(国徽面) 860 idPhotoEmSideFlag bool 861 idPhoto []*Attachment // 证件照 862 idPhotoFlag bool 863 diplomaPhoto []*Attachment // 学位证书 864 diplomaPhotoFlag bool 865 graduationCert []*Attachment // 毕业证书 866 graduationCertFlag bool 867 certOfMerit []*Attachment // 奖励证明 868 certOfMeritFlag bool 869 offboardingFile []*Attachment // 离职证明 870 offboardingFileFlag bool 871 cancelOnboardingReason int // 取消入职原因 872 cancelOnboardingReasonFlag bool 873 cancelOnboardingNotes string // 取消入职备注 874 cancelOnboardingNotesFlag bool 875 employeeFormStatus int // 入职登记表状态 876 employeeFormStatusFlag bool 877 createTime int64 // 创建时间 878 createTimeFlag bool 879 updateTime int64 // 更新时间 880 updateTimeFlag bool 881 } 882 883 func NewSystemFieldsBuilder() *SystemFieldsBuilder { 884 builder := &SystemFieldsBuilder{} 885 return builder 886 } 887 888 // 中文姓名 889 // 890 // 示例值:张三 891 func (builder *SystemFieldsBuilder) Name(name string) *SystemFieldsBuilder { 892 builder.name = name 893 builder.nameFlag = true 894 return builder 895 } 896 897 // 英文姓名 898 // 899 // 示例值:Tony Zhang 900 func (builder *SystemFieldsBuilder) EnName(enName string) *SystemFieldsBuilder { 901 builder.enName = enName 902 builder.enNameFlag = true 903 return builder 904 } 905 906 // 邮箱 907 // 908 // 示例值:a@b.com 909 func (builder *SystemFieldsBuilder) Email(email string) *SystemFieldsBuilder { 910 builder.email = email 911 builder.emailFlag = true 912 return builder 913 } 914 915 // 手机号码 916 // 917 // 示例值:(+86) 13812345678 918 func (builder *SystemFieldsBuilder) Mobile(mobile string) *SystemFieldsBuilder { 919 builder.mobile = mobile 920 builder.mobileFlag = true 921 return builder 922 } 923 924 // 部门的飞书 open_department_id 925 // 926 // 示例值:od-4d551617a5da3cec26666d33175dc8ca 927 func (builder *SystemFieldsBuilder) DepartmentId(departmentId string) *SystemFieldsBuilder { 928 builder.departmentId = departmentId 929 builder.departmentIdFlag = true 930 return builder 931 } 932 933 // 上级 934 // 935 // 示例值: 936 func (builder *SystemFieldsBuilder) Manager(manager *Manager) *SystemFieldsBuilder { 937 builder.manager = manager 938 builder.managerFlag = true 939 return builder 940 } 941 942 // 职位 943 // 944 // 示例值: 945 func (builder *SystemFieldsBuilder) Job(job *Job) *SystemFieldsBuilder { 946 builder.job = job 947 builder.jobFlag = true 948 return builder 949 } 950 951 // 职级 952 // 953 // 示例值: 954 func (builder *SystemFieldsBuilder) JobLevel(jobLevel *JobLevel) *SystemFieldsBuilder { 955 builder.jobLevel = jobLevel 956 builder.jobLevelFlag = true 957 return builder 958 } 959 960 // 工作地点 961 // 962 // 示例值: 963 func (builder *SystemFieldsBuilder) WorkLocation(workLocation *WorkLocation) *SystemFieldsBuilder { 964 builder.workLocation = workLocation 965 builder.workLocationFlag = true 966 return builder 967 } 968 969 // 性别 970 // 971 // 示例值:1 972 func (builder *SystemFieldsBuilder) Gender(gender int) *SystemFieldsBuilder { 973 builder.gender = gender 974 builder.genderFlag = true 975 return builder 976 } 977 978 // 出生日期 979 // 980 // 示例值:2020-01-01 981 func (builder *SystemFieldsBuilder) Birthday(birthday string) *SystemFieldsBuilder { 982 builder.birthday = birthday 983 builder.birthdayFlag = true 984 return builder 985 } 986 987 // 籍贯 988 // 989 // 示例值: 990 func (builder *SystemFieldsBuilder) NativeRegion(nativeRegion *NativeRegion) *SystemFieldsBuilder { 991 builder.nativeRegion = nativeRegion 992 builder.nativeRegionFlag = true 993 return builder 994 } 995 996 // 民族 997 // 998 // 示例值:2 999 func (builder *SystemFieldsBuilder) Ethnicity(ethnicity int) *SystemFieldsBuilder { 1000 builder.ethnicity = ethnicity 1001 builder.ethnicityFlag = true 1002 return builder 1003 } 1004 1005 // 婚姻状况 1006 // 1007 // 示例值:2 1008 func (builder *SystemFieldsBuilder) MaritalStatus(maritalStatus int) *SystemFieldsBuilder { 1009 builder.maritalStatus = maritalStatus 1010 builder.maritalStatusFlag = true 1011 return builder 1012 } 1013 1014 // 政治面貌 1015 // 1016 // 示例值:2 1017 func (builder *SystemFieldsBuilder) PoliticalStatus(politicalStatus int) *SystemFieldsBuilder { 1018 builder.politicalStatus = politicalStatus 1019 builder.politicalStatusFlag = true 1020 return builder 1021 } 1022 1023 // 参加工作日期 1024 // 1025 // 示例值:2020-01-01 1026 func (builder *SystemFieldsBuilder) EnteredWorkforceDate(enteredWorkforceDate string) *SystemFieldsBuilder { 1027 builder.enteredWorkforceDate = enteredWorkforceDate 1028 builder.enteredWorkforceDateFlag = true 1029 return builder 1030 } 1031 1032 // 证件类型 1033 // 1034 // 示例值:1 1035 func (builder *SystemFieldsBuilder) IdType(idType int) *SystemFieldsBuilder { 1036 builder.idType = idType 1037 builder.idTypeFlag = true 1038 return builder 1039 } 1040 1041 // 证件号 1042 // 1043 // 示例值:110122XXXXXX 1044 func (builder *SystemFieldsBuilder) IdNumber(idNumber string) *SystemFieldsBuilder { 1045 builder.idNumber = idNumber 1046 builder.idNumberFlag = true 1047 return builder 1048 } 1049 1050 // 户口类型 1051 // 1052 // 示例值:1 1053 func (builder *SystemFieldsBuilder) HukouType(hukouType int) *SystemFieldsBuilder { 1054 builder.hukouType = hukouType 1055 builder.hukouTypeFlag = true 1056 return builder 1057 } 1058 1059 // 户口所在地 1060 // 1061 // 示例值:北京市海淀区XXXX 1062 func (builder *SystemFieldsBuilder) HukouLocation(hukouLocation string) *SystemFieldsBuilder { 1063 builder.hukouLocation = hukouLocation 1064 builder.hukouLocationFlag = true 1065 return builder 1066 } 1067 1068 // 银行卡号 1069 // 1070 // 示例值:1243253453 1071 func (builder *SystemFieldsBuilder) BankAccountNumber(bankAccountNumber string) *SystemFieldsBuilder { 1072 builder.bankAccountNumber = bankAccountNumber 1073 builder.bankAccountNumberFlag = true 1074 return builder 1075 } 1076 1077 // 开户行 1078 // 1079 // 示例值:招商银行 1080 func (builder *SystemFieldsBuilder) BankName(bankName string) *SystemFieldsBuilder { 1081 builder.bankName = bankName 1082 builder.bankNameFlag = true 1083 return builder 1084 } 1085 1086 // 社保账号 1087 // 1088 // 示例值:123124124 1089 func (builder *SystemFieldsBuilder) SocialSecurityAccount(socialSecurityAccount string) *SystemFieldsBuilder { 1090 builder.socialSecurityAccount = socialSecurityAccount 1091 builder.socialSecurityAccountFlag = true 1092 return builder 1093 } 1094 1095 // 公积金账号 1096 // 1097 // 示例值:123124235 1098 func (builder *SystemFieldsBuilder) ProvidentFundAccount(providentFundAccount string) *SystemFieldsBuilder { 1099 builder.providentFundAccount = providentFundAccount 1100 builder.providentFundAccountFlag = true 1101 return builder 1102 } 1103 1104 // 工号 1105 // 1106 // 示例值:TM-00001 1107 func (builder *SystemFieldsBuilder) EmployeeNo(employeeNo string) *SystemFieldsBuilder { 1108 builder.employeeNo = employeeNo 1109 builder.employeeNoFlag = true 1110 return builder 1111 } 1112 1113 // 雇员类型 1114 // 1115 // 示例值:1 1116 func (builder *SystemFieldsBuilder) EmployeeType(employeeType int) *SystemFieldsBuilder { 1117 builder.employeeType = employeeType 1118 builder.employeeTypeFlag = true 1119 return builder 1120 } 1121 1122 // 员工状态 1123 // 1124 // 示例值:2 1125 func (builder *SystemFieldsBuilder) Status(status int) *SystemFieldsBuilder { 1126 builder.status = status 1127 builder.statusFlag = true 1128 return builder 1129 } 1130 1131 // 入职日期 1132 // 1133 // 示例值:2020-01-01 1134 func (builder *SystemFieldsBuilder) HireDate(hireDate string) *SystemFieldsBuilder { 1135 builder.hireDate = hireDate 1136 builder.hireDateFlag = true 1137 return builder 1138 } 1139 1140 // 试用期(月) 1141 // 1142 // 示例值:2 1143 func (builder *SystemFieldsBuilder) ProbationMonths(probationMonths float64) *SystemFieldsBuilder { 1144 builder.probationMonths = probationMonths 1145 builder.probationMonthsFlag = true 1146 return builder 1147 } 1148 1149 // 转正日期 1150 // 1151 // 示例值:2020-01-01 1152 func (builder *SystemFieldsBuilder) ConversionDate(conversionDate string) *SystemFieldsBuilder { 1153 builder.conversionDate = conversionDate 1154 builder.conversionDateFlag = true 1155 return builder 1156 } 1157 1158 // 转正申请 1159 // 1160 // 示例值:1 1161 func (builder *SystemFieldsBuilder) Application(application int) *SystemFieldsBuilder { 1162 builder.application = application 1163 builder.applicationFlag = true 1164 return builder 1165 } 1166 1167 // 转正状态 1168 // 1169 // 示例值:2 1170 func (builder *SystemFieldsBuilder) ApplicationStatus(applicationStatus int) *SystemFieldsBuilder { 1171 builder.applicationStatus = applicationStatus 1172 builder.applicationStatusFlag = true 1173 return builder 1174 } 1175 1176 // 离职日期 1177 // 1178 // 示例值:2020-01-01 1179 func (builder *SystemFieldsBuilder) LastDay(lastDay string) *SystemFieldsBuilder { 1180 builder.lastDay = lastDay 1181 builder.lastDayFlag = true 1182 return builder 1183 } 1184 1185 // 离职类型 1186 // 1187 // 示例值:1 1188 func (builder *SystemFieldsBuilder) DepartureType(departureType int) *SystemFieldsBuilder { 1189 builder.departureType = departureType 1190 builder.departureTypeFlag = true 1191 return builder 1192 } 1193 1194 // 离职原因 1195 // 1196 // 示例值:4 1197 func (builder *SystemFieldsBuilder) DepartureReason(departureReason int) *SystemFieldsBuilder { 1198 builder.departureReason = departureReason 1199 builder.departureReasonFlag = true 1200 return builder 1201 } 1202 1203 // 离职备注 1204 // 1205 // 示例值:世界那么大 1206 func (builder *SystemFieldsBuilder) DepartureNotes(departureNotes string) *SystemFieldsBuilder { 1207 builder.departureNotes = departureNotes 1208 builder.departureNotesFlag = true 1209 return builder 1210 } 1211 1212 // 合同公司 1213 // 1214 // 示例值: 1215 func (builder *SystemFieldsBuilder) ContractCompany(contractCompany *ContractCompany) *SystemFieldsBuilder { 1216 builder.contractCompany = contractCompany 1217 builder.contractCompanyFlag = true 1218 return builder 1219 } 1220 1221 // 合同类型 1222 // 1223 // 示例值:1 1224 func (builder *SystemFieldsBuilder) ContractType(contractType int) *SystemFieldsBuilder { 1225 builder.contractType = contractType 1226 builder.contractTypeFlag = true 1227 return builder 1228 } 1229 1230 // 合同开始日期 1231 // 1232 // 示例值:2020-01-01 1233 func (builder *SystemFieldsBuilder) ContractStartDate(contractStartDate string) *SystemFieldsBuilder { 1234 builder.contractStartDate = contractStartDate 1235 builder.contractStartDateFlag = true 1236 return builder 1237 } 1238 1239 // 合同到期日期 1240 // 1241 // 示例值:2020-01-01 1242 func (builder *SystemFieldsBuilder) ContractExpirationDate(contractExpirationDate string) *SystemFieldsBuilder { 1243 builder.contractExpirationDate = contractExpirationDate 1244 builder.contractExpirationDateFlag = true 1245 return builder 1246 } 1247 1248 // 劳动合同签订次数 1249 // 1250 // 示例值:2 1251 func (builder *SystemFieldsBuilder) ContractSignTimes(contractSignTimes int) *SystemFieldsBuilder { 1252 builder.contractSignTimes = contractSignTimes 1253 builder.contractSignTimesFlag = true 1254 return builder 1255 } 1256 1257 // 个人邮箱 1258 // 1259 // 示例值:personal@email.com 1260 func (builder *SystemFieldsBuilder) PersonalEmail(personalEmail string) *SystemFieldsBuilder { 1261 builder.personalEmail = personalEmail 1262 builder.personalEmailFlag = true 1263 return builder 1264 } 1265 1266 // 家庭地址 1267 // 1268 // 示例值:北京市海淀区XXXXX 1269 func (builder *SystemFieldsBuilder) FamilyAddress(familyAddress string) *SystemFieldsBuilder { 1270 builder.familyAddress = familyAddress 1271 builder.familyAddressFlag = true 1272 return builder 1273 } 1274 1275 // 主要紧急联系人 1276 // 1277 // 示例值: 1278 func (builder *SystemFieldsBuilder) PrimaryEmergencyContact(primaryEmergencyContact *EmergencyContact) *SystemFieldsBuilder { 1279 builder.primaryEmergencyContact = primaryEmergencyContact 1280 builder.primaryEmergencyContactFlag = true 1281 return builder 1282 } 1283 1284 // 紧急联系人 1285 // 1286 // 示例值: 1287 func (builder *SystemFieldsBuilder) EmergencyContact(emergencyContact []*EmergencyContact) *SystemFieldsBuilder { 1288 builder.emergencyContact = emergencyContact 1289 builder.emergencyContactFlag = true 1290 return builder 1291 } 1292 1293 // 最高学历 1294 // 1295 // 示例值: 1296 func (builder *SystemFieldsBuilder) HighestLevelOfEdu(highestLevelOfEdu *Education) *SystemFieldsBuilder { 1297 builder.highestLevelOfEdu = highestLevelOfEdu 1298 builder.highestLevelOfEduFlag = true 1299 return builder 1300 } 1301 1302 // 教育经历 1303 // 1304 // 示例值: 1305 func (builder *SystemFieldsBuilder) Education(education []*Education) *SystemFieldsBuilder { 1306 builder.education = education 1307 builder.educationFlag = true 1308 return builder 1309 } 1310 1311 // 前工作经历 1312 // 1313 // 示例值: 1314 func (builder *SystemFieldsBuilder) FormerWorkExp(formerWorkExp *WorkExperience) *SystemFieldsBuilder { 1315 builder.formerWorkExp = formerWorkExp 1316 builder.formerWorkExpFlag = true 1317 return builder 1318 } 1319 1320 // 工作经历 1321 // 1322 // 示例值: 1323 func (builder *SystemFieldsBuilder) WorkExp(workExp []*WorkExperience) *SystemFieldsBuilder { 1324 builder.workExp = workExp 1325 builder.workExpFlag = true 1326 return builder 1327 } 1328 1329 // 身份证照片(人像面) 1330 // 1331 // 示例值: 1332 func (builder *SystemFieldsBuilder) IdPhotoPoSide(idPhotoPoSide []*Attachment) *SystemFieldsBuilder { 1333 builder.idPhotoPoSide = idPhotoPoSide 1334 builder.idPhotoPoSideFlag = true 1335 return builder 1336 } 1337 1338 // 身份证照片(国徽面) 1339 // 1340 // 示例值: 1341 func (builder *SystemFieldsBuilder) IdPhotoEmSide(idPhotoEmSide []*Attachment) *SystemFieldsBuilder { 1342 builder.idPhotoEmSide = idPhotoEmSide 1343 builder.idPhotoEmSideFlag = true 1344 return builder 1345 } 1346 1347 // 证件照 1348 // 1349 // 示例值: 1350 func (builder *SystemFieldsBuilder) IdPhoto(idPhoto []*Attachment) *SystemFieldsBuilder { 1351 builder.idPhoto = idPhoto 1352 builder.idPhotoFlag = true 1353 return builder 1354 } 1355 1356 // 学位证书 1357 // 1358 // 示例值: 1359 func (builder *SystemFieldsBuilder) DiplomaPhoto(diplomaPhoto []*Attachment) *SystemFieldsBuilder { 1360 builder.diplomaPhoto = diplomaPhoto 1361 builder.diplomaPhotoFlag = true 1362 return builder 1363 } 1364 1365 // 毕业证书 1366 // 1367 // 示例值: 1368 func (builder *SystemFieldsBuilder) GraduationCert(graduationCert []*Attachment) *SystemFieldsBuilder { 1369 builder.graduationCert = graduationCert 1370 builder.graduationCertFlag = true 1371 return builder 1372 } 1373 1374 // 奖励证明 1375 // 1376 // 示例值: 1377 func (builder *SystemFieldsBuilder) CertOfMerit(certOfMerit []*Attachment) *SystemFieldsBuilder { 1378 builder.certOfMerit = certOfMerit 1379 builder.certOfMeritFlag = true 1380 return builder 1381 } 1382 1383 // 离职证明 1384 // 1385 // 示例值: 1386 func (builder *SystemFieldsBuilder) OffboardingFile(offboardingFile []*Attachment) *SystemFieldsBuilder { 1387 builder.offboardingFile = offboardingFile 1388 builder.offboardingFileFlag = true 1389 return builder 1390 } 1391 1392 // 取消入职原因 1393 // 1394 // 示例值:2 1395 func (builder *SystemFieldsBuilder) CancelOnboardingReason(cancelOnboardingReason int) *SystemFieldsBuilder { 1396 builder.cancelOnboardingReason = cancelOnboardingReason 1397 builder.cancelOnboardingReasonFlag = true 1398 return builder 1399 } 1400 1401 // 取消入职备注 1402 // 1403 // 示例值:个人原因 1404 func (builder *SystemFieldsBuilder) CancelOnboardingNotes(cancelOnboardingNotes string) *SystemFieldsBuilder { 1405 builder.cancelOnboardingNotes = cancelOnboardingNotes 1406 builder.cancelOnboardingNotesFlag = true 1407 return builder 1408 } 1409 1410 // 入职登记表状态 1411 // 1412 // 示例值:1 1413 func (builder *SystemFieldsBuilder) EmployeeFormStatus(employeeFormStatus int) *SystemFieldsBuilder { 1414 builder.employeeFormStatus = employeeFormStatus 1415 builder.employeeFormStatusFlag = true 1416 return builder 1417 } 1418 1419 // 创建时间 1420 // 1421 // 示例值:1608690517811 1422 func (builder *SystemFieldsBuilder) CreateTime(createTime int64) *SystemFieldsBuilder { 1423 builder.createTime = createTime 1424 builder.createTimeFlag = true 1425 return builder 1426 } 1427 1428 // 更新时间 1429 // 1430 // 示例值:1608690517811 1431 func (builder *SystemFieldsBuilder) UpdateTime(updateTime int64) *SystemFieldsBuilder { 1432 builder.updateTime = updateTime 1433 builder.updateTimeFlag = true 1434 return builder 1435 } 1436 1437 func (builder *SystemFieldsBuilder) Build() *SystemFields { 1438 req := &SystemFields{} 1439 if builder.nameFlag { 1440 req.Name = &builder.name 1441 1442 } 1443 if builder.enNameFlag { 1444 req.EnName = &builder.enName 1445 1446 } 1447 if builder.emailFlag { 1448 req.Email = &builder.email 1449 1450 } 1451 if builder.mobileFlag { 1452 req.Mobile = &builder.mobile 1453 1454 } 1455 if builder.departmentIdFlag { 1456 req.DepartmentId = &builder.departmentId 1457 1458 } 1459 if builder.managerFlag { 1460 req.Manager = builder.manager 1461 } 1462 if builder.jobFlag { 1463 req.Job = builder.job 1464 } 1465 if builder.jobLevelFlag { 1466 req.JobLevel = builder.jobLevel 1467 } 1468 if builder.workLocationFlag { 1469 req.WorkLocation = builder.workLocation 1470 } 1471 if builder.genderFlag { 1472 req.Gender = &builder.gender 1473 1474 } 1475 if builder.birthdayFlag { 1476 req.Birthday = &builder.birthday 1477 1478 } 1479 if builder.nativeRegionFlag { 1480 req.NativeRegion = builder.nativeRegion 1481 } 1482 if builder.ethnicityFlag { 1483 req.Ethnicity = &builder.ethnicity 1484 1485 } 1486 if builder.maritalStatusFlag { 1487 req.MaritalStatus = &builder.maritalStatus 1488 1489 } 1490 if builder.politicalStatusFlag { 1491 req.PoliticalStatus = &builder.politicalStatus 1492 1493 } 1494 if builder.enteredWorkforceDateFlag { 1495 req.EnteredWorkforceDate = &builder.enteredWorkforceDate 1496 1497 } 1498 if builder.idTypeFlag { 1499 req.IdType = &builder.idType 1500 1501 } 1502 if builder.idNumberFlag { 1503 req.IdNumber = &builder.idNumber 1504 1505 } 1506 if builder.hukouTypeFlag { 1507 req.HukouType = &builder.hukouType 1508 1509 } 1510 if builder.hukouLocationFlag { 1511 req.HukouLocation = &builder.hukouLocation 1512 1513 } 1514 if builder.bankAccountNumberFlag { 1515 req.BankAccountNumber = &builder.bankAccountNumber 1516 1517 } 1518 if builder.bankNameFlag { 1519 req.BankName = &builder.bankName 1520 1521 } 1522 if builder.socialSecurityAccountFlag { 1523 req.SocialSecurityAccount = &builder.socialSecurityAccount 1524 1525 } 1526 if builder.providentFundAccountFlag { 1527 req.ProvidentFundAccount = &builder.providentFundAccount 1528 1529 } 1530 if builder.employeeNoFlag { 1531 req.EmployeeNo = &builder.employeeNo 1532 1533 } 1534 if builder.employeeTypeFlag { 1535 req.EmployeeType = &builder.employeeType 1536 1537 } 1538 if builder.statusFlag { 1539 req.Status = &builder.status 1540 1541 } 1542 if builder.hireDateFlag { 1543 req.HireDate = &builder.hireDate 1544 1545 } 1546 if builder.probationMonthsFlag { 1547 req.ProbationMonths = &builder.probationMonths 1548 1549 } 1550 if builder.conversionDateFlag { 1551 req.ConversionDate = &builder.conversionDate 1552 1553 } 1554 if builder.applicationFlag { 1555 req.Application = &builder.application 1556 1557 } 1558 if builder.applicationStatusFlag { 1559 req.ApplicationStatus = &builder.applicationStatus 1560 1561 } 1562 if builder.lastDayFlag { 1563 req.LastDay = &builder.lastDay 1564 1565 } 1566 if builder.departureTypeFlag { 1567 req.DepartureType = &builder.departureType 1568 1569 } 1570 if builder.departureReasonFlag { 1571 req.DepartureReason = &builder.departureReason 1572 1573 } 1574 if builder.departureNotesFlag { 1575 req.DepartureNotes = &builder.departureNotes 1576 1577 } 1578 if builder.contractCompanyFlag { 1579 req.ContractCompany = builder.contractCompany 1580 } 1581 if builder.contractTypeFlag { 1582 req.ContractType = &builder.contractType 1583 1584 } 1585 if builder.contractStartDateFlag { 1586 req.ContractStartDate = &builder.contractStartDate 1587 1588 } 1589 if builder.contractExpirationDateFlag { 1590 req.ContractExpirationDate = &builder.contractExpirationDate 1591 1592 } 1593 if builder.contractSignTimesFlag { 1594 req.ContractSignTimes = &builder.contractSignTimes 1595 1596 } 1597 if builder.personalEmailFlag { 1598 req.PersonalEmail = &builder.personalEmail 1599 1600 } 1601 if builder.familyAddressFlag { 1602 req.FamilyAddress = &builder.familyAddress 1603 1604 } 1605 if builder.primaryEmergencyContactFlag { 1606 req.PrimaryEmergencyContact = builder.primaryEmergencyContact 1607 } 1608 if builder.emergencyContactFlag { 1609 req.EmergencyContact = builder.emergencyContact 1610 } 1611 if builder.highestLevelOfEduFlag { 1612 req.HighestLevelOfEdu = builder.highestLevelOfEdu 1613 } 1614 if builder.educationFlag { 1615 req.Education = builder.education 1616 } 1617 if builder.formerWorkExpFlag { 1618 req.FormerWorkExp = builder.formerWorkExp 1619 } 1620 if builder.workExpFlag { 1621 req.WorkExp = builder.workExp 1622 } 1623 if builder.idPhotoPoSideFlag { 1624 req.IdPhotoPoSide = builder.idPhotoPoSide 1625 } 1626 if builder.idPhotoEmSideFlag { 1627 req.IdPhotoEmSide = builder.idPhotoEmSide 1628 } 1629 if builder.idPhotoFlag { 1630 req.IdPhoto = builder.idPhoto 1631 } 1632 if builder.diplomaPhotoFlag { 1633 req.DiplomaPhoto = builder.diplomaPhoto 1634 } 1635 if builder.graduationCertFlag { 1636 req.GraduationCert = builder.graduationCert 1637 } 1638 if builder.certOfMeritFlag { 1639 req.CertOfMerit = builder.certOfMerit 1640 } 1641 if builder.offboardingFileFlag { 1642 req.OffboardingFile = builder.offboardingFile 1643 } 1644 if builder.cancelOnboardingReasonFlag { 1645 req.CancelOnboardingReason = &builder.cancelOnboardingReason 1646 1647 } 1648 if builder.cancelOnboardingNotesFlag { 1649 req.CancelOnboardingNotes = &builder.cancelOnboardingNotes 1650 1651 } 1652 if builder.employeeFormStatusFlag { 1653 req.EmployeeFormStatus = &builder.employeeFormStatus 1654 1655 } 1656 if builder.createTimeFlag { 1657 req.CreateTime = &builder.createTime 1658 1659 } 1660 if builder.updateTimeFlag { 1661 req.UpdateTime = &builder.updateTime 1662 1663 } 1664 return req 1665 } 1666 1667 type WorkExperience struct { 1668 Company *string `json:"company,omitempty"` // 公司 1669 Department *string `json:"department,omitempty"` // 部门 1670 Job *string `json:"job,omitempty"` // 职位 1671 Start *string `json:"start,omitempty"` // 开始日期 1672 End *string `json:"end,omitempty"` // 截止日期 1673 Description *string `json:"description,omitempty"` // 工作描述 1674 } 1675 1676 type WorkExperienceBuilder struct { 1677 company string // 公司 1678 companyFlag bool 1679 department string // 部门 1680 departmentFlag bool 1681 job string // 职位 1682 jobFlag bool 1683 start string // 开始日期 1684 startFlag bool 1685 end string // 截止日期 1686 endFlag bool 1687 description string // 工作描述 1688 descriptionFlag bool 1689 } 1690 1691 func NewWorkExperienceBuilder() *WorkExperienceBuilder { 1692 builder := &WorkExperienceBuilder{} 1693 return builder 1694 } 1695 1696 // 公司 1697 // 1698 // 示例值:XXXX公司 1699 func (builder *WorkExperienceBuilder) Company(company string) *WorkExperienceBuilder { 1700 builder.company = company 1701 builder.companyFlag = true 1702 return builder 1703 } 1704 1705 // 部门 1706 // 1707 // 示例值:部门1 1708 func (builder *WorkExperienceBuilder) Department(department string) *WorkExperienceBuilder { 1709 builder.department = department 1710 builder.departmentFlag = true 1711 return builder 1712 } 1713 1714 // 职位 1715 // 1716 // 示例值:职位 1717 func (builder *WorkExperienceBuilder) Job(job string) *WorkExperienceBuilder { 1718 builder.job = job 1719 builder.jobFlag = true 1720 return builder 1721 } 1722 1723 // 开始日期 1724 // 1725 // 示例值:2020-01-01 1726 func (builder *WorkExperienceBuilder) Start(start string) *WorkExperienceBuilder { 1727 builder.start = start 1728 builder.startFlag = true 1729 return builder 1730 } 1731 1732 // 截止日期 1733 // 1734 // 示例值:2020-01-01 1735 func (builder *WorkExperienceBuilder) End(end string) *WorkExperienceBuilder { 1736 builder.end = end 1737 builder.endFlag = true 1738 return builder 1739 } 1740 1741 // 工作描述 1742 // 1743 // 示例值:工作描述 1744 func (builder *WorkExperienceBuilder) Description(description string) *WorkExperienceBuilder { 1745 builder.description = description 1746 builder.descriptionFlag = true 1747 return builder 1748 } 1749 1750 func (builder *WorkExperienceBuilder) Build() *WorkExperience { 1751 req := &WorkExperience{} 1752 if builder.companyFlag { 1753 req.Company = &builder.company 1754 1755 } 1756 if builder.departmentFlag { 1757 req.Department = &builder.department 1758 1759 } 1760 if builder.jobFlag { 1761 req.Job = &builder.job 1762 1763 } 1764 if builder.startFlag { 1765 req.Start = &builder.start 1766 1767 } 1768 if builder.endFlag { 1769 req.End = &builder.end 1770 1771 } 1772 if builder.descriptionFlag { 1773 req.Description = &builder.description 1774 1775 } 1776 return req 1777 } 1778 1779 type WorkLocation struct { 1780 Id *int64 `json:"id,omitempty"` // 工作地点 ID 1781 Name *string `json:"name,omitempty"` // 工作地点名称 1782 } 1783 1784 type WorkLocationBuilder struct { 1785 id int64 // 工作地点 ID 1786 idFlag bool 1787 name string // 工作地点名称 1788 nameFlag bool 1789 } 1790 1791 func NewWorkLocationBuilder() *WorkLocationBuilder { 1792 builder := &WorkLocationBuilder{} 1793 return builder 1794 } 1795 1796 // 工作地点 ID 1797 // 1798 // 示例值:1695838220091399 1799 func (builder *WorkLocationBuilder) Id(id int64) *WorkLocationBuilder { 1800 builder.id = id 1801 builder.idFlag = true 1802 return builder 1803 } 1804 1805 // 工作地点名称 1806 // 1807 // 示例值:武汉 1808 func (builder *WorkLocationBuilder) Name(name string) *WorkLocationBuilder { 1809 builder.name = name 1810 builder.nameFlag = true 1811 return builder 1812 } 1813 1814 func (builder *WorkLocationBuilder) Build() *WorkLocation { 1815 req := &WorkLocation{} 1816 if builder.idFlag { 1817 req.Id = &builder.id 1818 1819 } 1820 if builder.nameFlag { 1821 req.Name = &builder.name 1822 1823 } 1824 return req 1825 } 1826 1827 type GetAttachmentReqBuilder struct { 1828 apiReq *larkcore.ApiReq 1829 } 1830 1831 func NewGetAttachmentReqBuilder() *GetAttachmentReqBuilder { 1832 builder := &GetAttachmentReqBuilder{} 1833 builder.apiReq = &larkcore.ApiReq{ 1834 PathParams: larkcore.PathParams{}, 1835 QueryParams: larkcore.QueryParams{}, 1836 } 1837 return builder 1838 } 1839 1840 // 文件 token 1841 // 1842 // 示例值:09bf7b924f9a4a69875788891b5970d8 1843 func (builder *GetAttachmentReqBuilder) Token(token string) *GetAttachmentReqBuilder { 1844 builder.apiReq.PathParams.Set("token", fmt.Sprint(token)) 1845 return builder 1846 } 1847 1848 func (builder *GetAttachmentReqBuilder) Build() *GetAttachmentReq { 1849 req := &GetAttachmentReq{} 1850 req.apiReq = &larkcore.ApiReq{} 1851 req.apiReq.PathParams = builder.apiReq.PathParams 1852 return req 1853 } 1854 1855 type GetAttachmentReq struct { 1856 apiReq *larkcore.ApiReq 1857 } 1858 1859 type GetAttachmentResp struct { 1860 *larkcore.ApiResp `json:"-"` 1861 larkcore.CodeError 1862 File io.Reader `json:"-"` 1863 FileName string `json:"-"` 1864 } 1865 1866 func (resp *GetAttachmentResp) Success() bool { 1867 return resp.Code == 0 1868 } 1869 1870 func (resp *GetAttachmentResp) WriteFile(fileName string) error { 1871 bs, err := ioutil.ReadAll(resp.File) 1872 if err != nil { 1873 return err 1874 } 1875 1876 err = ioutil.WriteFile(fileName, bs, 0666) 1877 if err != nil { 1878 return err 1879 } 1880 return nil 1881 } 1882 1883 type ListEmployeeReqBuilder struct { 1884 apiReq *larkcore.ApiReq 1885 limit int // 最大返回多少记录,当使用迭代器访问时才有效 1886 } 1887 1888 func NewListEmployeeReqBuilder() *ListEmployeeReqBuilder { 1889 builder := &ListEmployeeReqBuilder{} 1890 builder.apiReq = &larkcore.ApiReq{ 1891 PathParams: larkcore.PathParams{}, 1892 QueryParams: larkcore.QueryParams{}, 1893 } 1894 return builder 1895 } 1896 1897 // 最大返回多少记录,当使用迭代器访问时才有效 1898 func (builder *ListEmployeeReqBuilder) Limit(limit int) *ListEmployeeReqBuilder { 1899 builder.limit = limit 1900 return builder 1901 } 1902 1903 // 返回数据类型 1904 // 1905 // 示例值:basic 1906 func (builder *ListEmployeeReqBuilder) View(view string) *ListEmployeeReqBuilder { 1907 builder.apiReq.QueryParams.Set("view", fmt.Sprint(view)) 1908 return builder 1909 } 1910 1911 // 员工状态,不传代表查询所有员工状态;;实际在职 = 2&4;;可同时查询多个状态的记录,如 status=2&status=4 1912 // 1913 // 示例值:2 1914 func (builder *ListEmployeeReqBuilder) Status(status []int) *ListEmployeeReqBuilder { 1915 builder.apiReq.QueryParams.Set("status", fmt.Sprint(status)) 1916 return builder 1917 } 1918 1919 // 雇员类型,不传代表查询所有雇员类型 1920 // 1921 // 示例值:1 1922 func (builder *ListEmployeeReqBuilder) Type(type_ []int) *ListEmployeeReqBuilder { 1923 builder.apiReq.QueryParams.Set("type", fmt.Sprint(type_)) 1924 return builder 1925 } 1926 1927 // 查询开始时间(创建时间 >= 此时间) 1928 // 1929 // 示例值:1608690517811 1930 func (builder *ListEmployeeReqBuilder) StartTime(startTime string) *ListEmployeeReqBuilder { 1931 builder.apiReq.QueryParams.Set("start_time", fmt.Sprint(startTime)) 1932 return builder 1933 } 1934 1935 // 查询结束时间(创建时间 <= 此时间) 1936 // 1937 // 示例值:1608690517811 1938 func (builder *ListEmployeeReqBuilder) EndTime(endTime string) *ListEmployeeReqBuilder { 1939 builder.apiReq.QueryParams.Set("end_time", fmt.Sprint(endTime)) 1940 return builder 1941 } 1942 1943 // 此次调用中使用的用户ID的类型 1944 // 1945 // 示例值: 1946 func (builder *ListEmployeeReqBuilder) UserIdType(userIdType string) *ListEmployeeReqBuilder { 1947 builder.apiReq.QueryParams.Set("user_id_type", fmt.Sprint(userIdType)) 1948 return builder 1949 } 1950 1951 // user_id、open_id 或 union_id,默认为 open_id。;;如果传入的值不是 open_id,需要一并传入 user_id_type 参数。;;可一次查询多个 id 的用户,例如:user_ids=ou_8ebd4f35d7101ffdeb4771d7c8ec517e&user_ids=ou_7abc4f35d7101ffdeb4771dabcde;;[用户相关的 ID 概念](/ssl:ttdoc/home/user-identity-introduction/introduction) 1952 // 1953 // 示例值:ou_8ebd4f35d7101ffdeb4771d7c8ec517e 1954 func (builder *ListEmployeeReqBuilder) UserIds(userIds []string) *ListEmployeeReqBuilder { 1955 builder.apiReq.QueryParams.Set("user_ids", fmt.Sprint(userIds)) 1956 return builder 1957 } 1958 1959 // 分页标记,第一次请求可以不填,表示从头开始遍历;分页查询返回结果has_more 为 true 时会同时返回新的 page_token, 下次遍历可使用该返回的 page_token 获取更多信息。 1960 // 1961 // 示例值:10 1962 func (builder *ListEmployeeReqBuilder) PageToken(pageToken string) *ListEmployeeReqBuilder { 1963 builder.apiReq.QueryParams.Set("page_token", fmt.Sprint(pageToken)) 1964 return builder 1965 } 1966 1967 // 分页大小,取值范围 1~100,默认 10 1968 // 1969 // 示例值:10 1970 func (builder *ListEmployeeReqBuilder) PageSize(pageSize int) *ListEmployeeReqBuilder { 1971 builder.apiReq.QueryParams.Set("page_size", fmt.Sprint(pageSize)) 1972 return builder 1973 } 1974 1975 func (builder *ListEmployeeReqBuilder) Build() *ListEmployeeReq { 1976 req := &ListEmployeeReq{} 1977 req.apiReq = &larkcore.ApiReq{} 1978 req.Limit = builder.limit 1979 req.apiReq.QueryParams = builder.apiReq.QueryParams 1980 return req 1981 } 1982 1983 type ListEmployeeReq struct { 1984 apiReq *larkcore.ApiReq 1985 Limit int // 最多返回多少记录,只有在使用迭代器访问时,才有效 1986 1987 } 1988 1989 type ListEmployeeRespData struct { 1990 Items []*Employee `json:"items,omitempty"` // 员工列表 1991 PageToken *string `json:"page_token,omitempty"` // 下次请求需要带上的分页标记 1992 HasMore *bool `json:"has_more,omitempty"` // 是否有下一页数据 1993 } 1994 1995 type ListEmployeeResp struct { 1996 *larkcore.ApiResp `json:"-"` 1997 larkcore.CodeError 1998 Data *ListEmployeeRespData `json:"data"` // 业务数据 1999 } 2000 2001 func (resp *ListEmployeeResp) Success() bool { 2002 return resp.Code == 0 2003 } 2004 2005 type ListEmployeeIterator struct { 2006 nextPageToken *string 2007 items []*Employee 2008 index int 2009 limit int 2010 ctx context.Context 2011 req *ListEmployeeReq 2012 listFunc func(ctx context.Context, req *ListEmployeeReq, options ...larkcore.RequestOptionFunc) (*ListEmployeeResp, error) 2013 options []larkcore.RequestOptionFunc 2014 curlNum int 2015 } 2016 2017 func (iterator *ListEmployeeIterator) Next() (bool, *Employee, error) { 2018 // 达到最大量,则返回 2019 if iterator.limit > 0 && iterator.curlNum >= iterator.limit { 2020 return false, nil, nil 2021 } 2022 2023 // 为0则拉取数据 2024 if iterator.index == 0 || iterator.index >= len(iterator.items) { 2025 if iterator.index != 0 && iterator.nextPageToken == nil { 2026 return false, nil, nil 2027 } 2028 if iterator.nextPageToken != nil { 2029 iterator.req.apiReq.QueryParams.Set("page_token", *iterator.nextPageToken) 2030 } 2031 resp, err := iterator.listFunc(iterator.ctx, iterator.req, iterator.options...) 2032 if err != nil { 2033 return false, nil, err 2034 } 2035 2036 if resp.Code != 0 { 2037 return false, nil, errors.New(fmt.Sprintf("Code:%d,Msg:%s", resp.Code, resp.Msg)) 2038 } 2039 2040 if len(resp.Data.Items) == 0 { 2041 return false, nil, nil 2042 } 2043 2044 iterator.nextPageToken = resp.Data.PageToken 2045 iterator.items = resp.Data.Items 2046 iterator.index = 0 2047 } 2048 2049 block := iterator.items[iterator.index] 2050 iterator.index++ 2051 iterator.curlNum++ 2052 return true, block, nil 2053 } 2054 2055 func (iterator *ListEmployeeIterator) NextPageToken() *string { 2056 return iterator.nextPageToken 2057 }