forked from chyroc/lark
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapi_contact.merged.go
More file actions
3257 lines (2759 loc) · 254 KB
/
Copy pathapi_contact.merged.go
File metadata and controls
3257 lines (2759 loc) · 254 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Code generated by lark_sdk_gen. DO NOT EDIT.
package lark
import (
"context"
)
// CreateDepartment 该接口用于向通讯录中创建部门。[常见问题答疑](https://open.feishu.cn/document/ugTN1YjL4UTN24CO1UjN/uQzN1YjL0cTN24CN3UjN)。
//
// 只可在应用的通讯录权限范围内的部门下创建部门。若需要在根部门下创建子部门,则应用通讯录权限范围需要设置为“全部成员”。应用商店应用无权限调用此接口。
//
// doc: https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/contact-v3/department/create
func (r *ContactService) CreateDepartment(ctx context.Context, request *CreateDepartmentReq, options ...MethodOptionFunc) (*CreateDepartmentResp, *Response, error) {
if r.cli.mock.mockContactCreateDepartment != nil {
r.cli.log(ctx, LogLevelDebug, "[lark] Contact#CreateDepartment mock enable")
return r.cli.mock.mockContactCreateDepartment(ctx, request, options...)
}
req := &RawRequestReq{
Scope: "Contact",
API: "CreateDepartment",
Method: "POST",
URL: r.cli.openBaseURL + "/open-apis/contact/v3/departments",
Body: request,
MethodOption: newMethodOption(options),
NeedTenantAccessToken: true,
}
resp := new(createDepartmentResp)
response, err := r.cli.RawRequest(ctx, req, resp)
return resp.Data, response, err
}
func (r *Mock) MockContactCreateDepartment(f func(ctx context.Context, request *CreateDepartmentReq, options ...MethodOptionFunc) (*CreateDepartmentResp, *Response, error)) {
r.mockContactCreateDepartment = f
}
func (r *Mock) UnMockContactCreateDepartment() {
r.mockContactCreateDepartment = nil
}
type CreateDepartmentReq struct {
UserIDType *IDType `query:"user_id_type" json:"-"` // 用户 ID 类型, 示例值:"open_id", 可选值有: `open_id`:用户的 open id, `union_id`:用户的 union id, `user_id`:用户的 user id, 默认值: `open_id`, 当值为 `user_id`, 字段权限要求: 获取用户 user ID
DepartmentIDType *DepartmentIDType `query:"department_id_type" json:"-"` // 此次调用中使用的部门ID的类型, 示例值:"open_department_id", 可选值有: `department_id`:以自定义department_id来标识部门, `open_department_id`:以open_department_id来标识部门
ClientToken *string `query:"client_token" json:"-"` // 根据client_token是否一致来判断是否为同一请求, 示例值:"473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E"
Name string `json:"name,omitempty"` // 部门名称, 示例值:"DemoName", 最小长度:`1` 字符
I18nName *CreateDepartmentReqI18nName `json:"i18n_name,omitempty"` // 国际化的部门名称
ParentDepartmentID string `json:"parent_department_id,omitempty"` // 父部门的ID,* 创建根部门,该参数值为 “0”, 示例值:"D067"
DepartmentID *string `json:"department_id,omitempty"` // 本部门的自定义部门ID, 示例值:"D096", 最大长度:`64` 字符, 正则校验:`^0|[^od][A-Za-z0-9]*`
LeaderUserID *string `json:"leader_user_id,omitempty"` // 部门主管用户ID, 示例值:"ou_7dab8a3d3cdcc9da365777c7ad535d62"
Order *string `json:"order,omitempty"` // 部门的排序,即部门在其同级部门的展示顺序, 示例值:"100"
UnitIDs []string `json:"unit_ids,omitempty"` // 部门单位自定义ID列表,当前只支持一个, 示例值:custom_unit_id
CreateGroupChat *bool `json:"create_group_chat,omitempty"` // 是否创建部门群,默认不创建, 示例值:false
}
type CreateDepartmentReqI18nName struct {
ZhCn *string `json:"zh_cn,omitempty"` // 部门的中文名, 示例值:"Demo名称"
JaJp *string `json:"ja_jp,omitempty"` // 部门的日文名, 示例值:"デモ名"
EnUs *string `json:"en_us,omitempty"` // 部门的英文名, 示例值:"Demo Name"
}
type createDepartmentResp struct {
Code int64 `json:"code,omitempty"` // 错误码,非 0 表示失败
Msg string `json:"msg,omitempty"` // 错误描述
Data *CreateDepartmentResp `json:"data,omitempty"`
}
type CreateDepartmentResp struct {
Department *CreateDepartmentRespDepartment `json:"department,omitempty"` // 部门信息
}
type CreateDepartmentRespDepartment struct {
Name string `json:"name,omitempty"` // 部门名称,**字段权限要求(满足任一)**:, 获取部门基础信息, 以应用身份读取通讯录
I18nName *CreateDepartmentRespDepartmentI18nName `json:"i18n_name,omitempty"` // 国际化的部门名称,**字段权限要求(满足任一)**:, 获取部门基础信息, 以应用身份读取通讯录
ParentDepartmentID string `json:"parent_department_id,omitempty"` // 父部门的ID,* 创建根部门,该参数值为 “0”,**字段权限要求(满足任一)**:, 获取部门组织架构信息, 以应用身份读取通讯录
DepartmentID string `json:"department_id,omitempty"` // 本部门的自定义部门ID,**字段权限要求(满足任一)**:, 获取部门基础信息, 以应用身份读取通讯录
OpenDepartmentID string `json:"open_department_id,omitempty"` // 部门的open_id
LeaderUserID string `json:"leader_user_id,omitempty"` // 部门主管用户ID,**字段权限要求(满足任一)**:, 获取部门组织架构信息, 以应用身份读取通讯录
ChatID string `json:"chat_id,omitempty"` // 部门群ID,**字段权限要求(满足任一)**:, 获取部门基础信息, 以应用身份读取通讯录
Order string `json:"order,omitempty"` // 部门的排序,即部门在其同级部门的展示顺序,**字段权限要求(满足任一)**:, 获取部门组织架构信息, 以应用身份读取通讯录
UnitIDs []string `json:"unit_ids,omitempty"` // 部门单位自定义ID列表,当前只支持一个,**字段权限要求(满足任一)**:, 获取部门组织架构信息, 以应用身份读取通讯录
MemberCount int64 `json:"member_count,omitempty"` // 部门下用户的个数,**字段权限要求(满足任一)**:, 获取部门组织架构信息, 以应用身份读取通讯录
Status *CreateDepartmentRespDepartmentStatus `json:"status,omitempty"` // 部门状态,**字段权限要求(满足任一)**:, 获取部门基础信息, 以应用身份读取通讯录
}
type CreateDepartmentRespDepartmentI18nName struct {
ZhCn string `json:"zh_cn,omitempty"` // 部门的中文名
JaJp string `json:"ja_jp,omitempty"` // 部门的日文名
EnUs string `json:"en_us,omitempty"` // 部门的英文名
}
type CreateDepartmentRespDepartmentStatus struct {
IsDeleted bool `json:"is_deleted,omitempty"` // 是否被删除
}
// Code generated by lark_sdk_gen. DO NOT EDIT.
// DeleteDepartment 该接口用于向通讯录中删除部门。[常见问题答疑](https://open.feishu.cn/document/ugTN1YjL4UTN24CO1UjN/uQzN1YjL0cTN24CN3UjN)。
//
// 应用需要同时拥有待删除部门及其父部门的通讯录授权。应用商店应用无权限调用该接口。
//
// doc: https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/contact-v3/department/delete
func (r *ContactService) DeleteDepartment(ctx context.Context, request *DeleteDepartmentReq, options ...MethodOptionFunc) (*DeleteDepartmentResp, *Response, error) {
if r.cli.mock.mockContactDeleteDepartment != nil {
r.cli.log(ctx, LogLevelDebug, "[lark] Contact#DeleteDepartment mock enable")
return r.cli.mock.mockContactDeleteDepartment(ctx, request, options...)
}
req := &RawRequestReq{
Scope: "Contact",
API: "DeleteDepartment",
Method: "DELETE",
URL: r.cli.openBaseURL + "/open-apis/contact/v3/departments/:department_id",
Body: request,
MethodOption: newMethodOption(options),
NeedTenantAccessToken: true,
}
resp := new(deleteDepartmentResp)
response, err := r.cli.RawRequest(ctx, req, resp)
return resp.Data, response, err
}
func (r *Mock) MockContactDeleteDepartment(f func(ctx context.Context, request *DeleteDepartmentReq, options ...MethodOptionFunc) (*DeleteDepartmentResp, *Response, error)) {
r.mockContactDeleteDepartment = f
}
func (r *Mock) UnMockContactDeleteDepartment() {
r.mockContactDeleteDepartment = nil
}
type DeleteDepartmentReq struct {
DepartmentIDType *DepartmentIDType `query:"department_id_type" json:"-"` // 此次调用中使用的部门ID的类型, 示例值:"open_department_id", 可选值有: `department_id`:以自定义department_id来标识部门, `open_department_id`:以open_department_id来标识部门, 默认值: `open_department_id`
DepartmentID string `path:"department_id" json:"-"` // 部门ID,需要与查询参数中传入的department_id_type类型保持一致。, 示例值:"od-4e6ac4d14bcd5071a37a39de902c7141", 最大长度:`64` 字符, 正则校验:`^0|[^od][A-Za-z0-9]*`
}
type deleteDepartmentResp struct {
Code int64 `json:"code,omitempty"` // 错误码,非 0 表示失败
Msg string `json:"msg,omitempty"` // 错误描述
Data *DeleteDepartmentResp `json:"data,omitempty"`
}
type DeleteDepartmentResp struct{}
// Code generated by lark_sdk_gen. DO NOT EDIT.
// GetDepartment 该接口用于向通讯录获取单个部门信息。[常见问题答疑](https://open.feishu.cn/document/ugTN1YjL4UTN24CO1UjN/uQzN1YjL0cTN24CN3UjN)。
//
// 使用tenant_access_token时,应用需要拥有待查询部门的通讯录授权。如果需要获取根部门信息,则需要拥有全员权限。
// 使用user_access_token时,用户需要有待查询部门的可见性,如果需要获取根部门信息,则要求员工可见所有人。
//
// doc: https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/contact-v3/department/get
func (r *ContactService) GetDepartment(ctx context.Context, request *GetDepartmentReq, options ...MethodOptionFunc) (*GetDepartmentResp, *Response, error) {
if r.cli.mock.mockContactGetDepartment != nil {
r.cli.log(ctx, LogLevelDebug, "[lark] Contact#GetDepartment mock enable")
return r.cli.mock.mockContactGetDepartment(ctx, request, options...)
}
req := &RawRequestReq{
Scope: "Contact",
API: "GetDepartment",
Method: "GET",
URL: r.cli.openBaseURL + "/open-apis/contact/v3/departments/:department_id",
Body: request,
MethodOption: newMethodOption(options),
NeedTenantAccessToken: true,
NeedUserAccessToken: true,
}
resp := new(getDepartmentResp)
response, err := r.cli.RawRequest(ctx, req, resp)
return resp.Data, response, err
}
func (r *Mock) MockContactGetDepartment(f func(ctx context.Context, request *GetDepartmentReq, options ...MethodOptionFunc) (*GetDepartmentResp, *Response, error)) {
r.mockContactGetDepartment = f
}
func (r *Mock) UnMockContactGetDepartment() {
r.mockContactGetDepartment = nil
}
type GetDepartmentReq struct {
UserIDType *IDType `query:"user_id_type" json:"-"` // 用户 ID 类型, 示例值:"open_id", 可选值有: `open_id`:用户的 open id, `union_id`:用户的 union id, `user_id`:用户的 user id, 默认值: `open_id`, 当值为 `user_id`, 字段权限要求: 获取用户 user ID
DepartmentIDType *DepartmentIDType `query:"department_id_type" json:"-"` // 此次调用中使用的部门ID的类型, 示例值:"open_department_id", 可选值有: `department_id`:以自定义department_id来标识部门, `open_department_id`:以open_department_id来标识部门, 默认值: `open_department_id`
DepartmentID string `path:"department_id" json:"-"` // 需要获取的部门ID, 示例值:"od-4e6ac4d14bcd5071a37a39de902c7141", 最大长度:`64` 字符, 正则校验:`^0|[^od][A-Za-z0-9]*`
}
type getDepartmentResp struct {
Code int64 `json:"code,omitempty"` // 错误码,非 0 表示失败
Msg string `json:"msg,omitempty"` // 错误描述
Data *GetDepartmentResp `json:"data,omitempty"`
}
type GetDepartmentResp struct {
Department *GetDepartmentRespDepartment `json:"department,omitempty"` // 部门信息
}
type GetDepartmentRespDepartment struct {
Name string `json:"name,omitempty"` // 部门名称,**字段权限要求(满足任一)**:,以应用身份读取通讯录,获取部门基础信息,以应用身份访问通讯录,读取通讯录
I18nName *GetDepartmentRespDepartmentI18nName `json:"i18n_name,omitempty"` // 国际化的部门名称,**字段权限要求(满足任一)**:,以应用身份读取通讯录,获取部门基础信息,以应用身份访问通讯录,读取通讯录
ParentDepartmentID string `json:"parent_department_id,omitempty"` // 父部门的ID,* 创建根部门,该参数值为 “0”,**字段权限要求(满足任一)**:,以应用身份读取通讯录,获取部门组织架构信息,以应用身份访问通讯录,读取通讯录
DepartmentID string `json:"department_id,omitempty"` // 本部门的自定义部门ID,**字段权限要求(满足任一)**:,以应用身份读取通讯录,获取部门基础信息,以应用身份访问通讯录,读取通讯录
OpenDepartmentID string `json:"open_department_id,omitempty"` // 部门的open_id
LeaderUserID string `json:"leader_user_id,omitempty"` // 部门主管用户ID,**字段权限要求(满足任一)**:,以应用身份读取通讯录,获取部门组织架构信息,以应用身份访问通讯录,读取通讯录
ChatID string `json:"chat_id,omitempty"` // 部门群ID,**字段权限要求(满足任一)**:,以应用身份读取通讯录,获取部门基础信息,以应用身份访问通讯录,读取通讯录
Order string `json:"order,omitempty"` // 部门的排序,即部门在其同级部门的展示顺序,**字段权限要求(满足任一)**:,以应用身份读取通讯录,获取部门组织架构信息,以应用身份访问通讯录,读取通讯录
UnitIDs []string `json:"unit_ids,omitempty"` // 部门单位自定义ID列表,当前只支持一个,**字段权限要求(满足任一)**:,以应用身份读取通讯录,获取部门组织架构信息,以应用身份访问通讯录,读取通讯录
MemberCount int64 `json:"member_count,omitempty"` // 部门下用户的个数,**字段权限要求(满足任一)**:,以应用身份读取通讯录,获取部门组织架构信息,以应用身份访问通讯录,读取通讯录
Status *GetDepartmentRespDepartmentStatus `json:"status,omitempty"` // 部门状态,**字段权限要求(满足任一)**:,以应用身份读取通讯录,获取部门基础信息,以应用身份访问通讯录,读取通讯录
}
type GetDepartmentRespDepartmentI18nName struct {
ZhCn string `json:"zh_cn,omitempty"` // 部门的中文名
JaJp string `json:"ja_jp,omitempty"` // 部门的日文名
EnUs string `json:"en_us,omitempty"` // 部门的英文名
}
type GetDepartmentRespDepartmentStatus struct {
IsDeleted bool `json:"is_deleted,omitempty"` // 是否被删除
}
// Code generated by lark_sdk_gen. DO NOT EDIT.
// GetDepartmentList 通过部门ID获取部门的子部门列表。[常见问题答疑](https://open.feishu.cn/document/ugTN1YjL4UTN24CO1UjN/uQzN1YjL0cTN24CN3UjN)。
//
// 部门ID 必填,根部门的部门ID 为0
// - 使用 user_access_token 时,返回该用户组织架构可见性范围([登陆企业管理后台进行权限配置](https://bytedance.feishu.cn/admin/security/permission/visibility))内的所有可见部门。当进行递归查询时,只筛查最多1000个部门的可见性。
// - 使用
// tenant_access_token 则基于应用的通讯录权限范围进行权限校验与过滤。
// 如果部门ID为0,会检验应用是否有全员通讯录权限,如果是非0 部门ID,则会校验应用是否有该部门的通讯录权限。无部门权限返回无部门通讯录权限错误码,有权限则返回部门下子部门列表(根据fetch_child决定是否递归)。
//
// doc: https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/contact-v3/department/children
func (r *ContactService) GetDepartmentList(ctx context.Context, request *GetDepartmentListReq, options ...MethodOptionFunc) (*GetDepartmentListResp, *Response, error) {
if r.cli.mock.mockContactGetDepartmentList != nil {
r.cli.log(ctx, LogLevelDebug, "[lark] Contact#GetDepartmentList mock enable")
return r.cli.mock.mockContactGetDepartmentList(ctx, request, options...)
}
req := &RawRequestReq{
Scope: "Contact",
API: "GetDepartmentList",
Method: "GET",
URL: r.cli.openBaseURL + "/open-apis/contact/v3/departments/:department_id/children",
Body: request,
MethodOption: newMethodOption(options),
NeedTenantAccessToken: true,
NeedUserAccessToken: true,
}
resp := new(getDepartmentListResp)
response, err := r.cli.RawRequest(ctx, req, resp)
return resp.Data, response, err
}
func (r *Mock) MockContactGetDepartmentList(f func(ctx context.Context, request *GetDepartmentListReq, options ...MethodOptionFunc) (*GetDepartmentListResp, *Response, error)) {
r.mockContactGetDepartmentList = f
}
func (r *Mock) UnMockContactGetDepartmentList() {
r.mockContactGetDepartmentList = nil
}
type GetDepartmentListReq struct {
UserIDType *IDType `query:"user_id_type" json:"-"` // 用户 ID 类型, 示例值:"open_id", 可选值有: `open_id`:用户的 open id, `union_id`:用户的 union id, `user_id`:用户的 user id, 默认值: `open_id`, 当值为 `user_id`, 字段权限要求: 获取用户 user ID
DepartmentIDType *DepartmentIDType `query:"department_id_type" json:"-"` // 此次调用中使用的部门ID的类型, 示例值:"open_department_id", 可选值有: `department_id`:以自定义department_id来标识部门, `open_department_id`:以open_department_id来标识部门, 默认值: `open_department_id`
FetchChild *bool `query:"fetch_child" json:"-"` // 是否递归获取子部门, 示例值:false
PageSize *int64 `query:"page_size" json:"-"` // 分页大小, 示例值:10, 最大值:`50`
PageToken *string `query:"page_token" json:"-"` // 分页标记,第一次请求不填,表示从头开始遍历;分页查询结果还有更多项时会同时返回新的 page_token,下次遍历可采用该 page_token 获取查询结果, 示例值:"AQD9/Rn9eij9Pm39ED40/RD/cIFmu77WxpxPB/2oHfQLZ+G8JG6tK7+ZnHiT7COhD2hMSICh/eBl7cpzU6JEC3J7COKNe4jrQ8ExwBCR"
DepartmentID string `path:"department_id" json:"-"` // 部门ID,根部门的部门ID 为0, 示例值:"od-4e6ac4d14bcd5071a37a39de902c7141", 最大长度:`64` 字符, 正则校验:`^0|[^od][A-Za-z0-9]*`
}
type getDepartmentListResp struct {
Code int64 `json:"code,omitempty"` // 错误码,非 0 表示失败
Msg string `json:"msg,omitempty"` // 错误描述
Data *GetDepartmentListResp `json:"data,omitempty"`
}
type GetDepartmentListResp struct {
HasMore bool `json:"has_more,omitempty"` // 是否还有更多项
PageToken string `json:"page_token,omitempty"` // 分页标记,当 has_more 为 true 时,会同时返回新的 page_token,否则不返回 page_token
Items []*GetDepartmentListRespItem `json:"items,omitempty"` // 部门列表
}
type GetDepartmentListRespItem struct {
Name string `json:"name,omitempty"` // 部门名称,**字段权限要求(满足任一)**:,以应用身份读取通讯录,获取部门基础信息,以应用身份访问通讯录,读取通讯录
I18nName *GetDepartmentListRespItemI18nName `json:"i18n_name,omitempty"` // 国际化的部门名称,**字段权限要求(满足任一)**:,以应用身份读取通讯录,获取部门基础信息,以应用身份访问通讯录,读取通讯录
ParentDepartmentID string `json:"parent_department_id,omitempty"` // 父部门的ID,* 创建根部门,该参数值为 “0”,**字段权限要求(满足任一)**:,以应用身份读取通讯录,获取部门组织架构信息,以应用身份访问通讯录,读取通讯录
DepartmentID string `json:"department_id,omitempty"` // 本部门的自定义部门ID,**字段权限要求(满足任一)**:,以应用身份读取通讯录,获取部门基础信息,以应用身份访问通讯录,读取通讯录
OpenDepartmentID string `json:"open_department_id,omitempty"` // 部门的open_id
LeaderUserID string `json:"leader_user_id,omitempty"` // 部门主管用户ID,**字段权限要求(满足任一)**:,以应用身份读取通讯录,获取部门组织架构信息,以应用身份访问通讯录,读取通讯录
ChatID string `json:"chat_id,omitempty"` // 部门群ID,**字段权限要求(满足任一)**:,以应用身份读取通讯录,获取部门基础信息,以应用身份访问通讯录,读取通讯录
Order string `json:"order,omitempty"` // 部门的排序,即部门在其同级部门的展示顺序,**字段权限要求(满足任一)**:,以应用身份读取通讯录,获取部门组织架构信息,以应用身份访问通讯录,读取通讯录
UnitIDs []string `json:"unit_ids,omitempty"` // 部门单位自定义ID列表,当前只支持一个,**字段权限要求(满足任一)**:,以应用身份读取通讯录,获取部门组织架构信息,以应用身份访问通讯录,读取通讯录
MemberCount int64 `json:"member_count,omitempty"` // 部门下用户的个数,**字段权限要求(满足任一)**:,以应用身份读取通讯录,获取部门组织架构信息,以应用身份访问通讯录,读取通讯录
Status *GetDepartmentListRespItemStatus `json:"status,omitempty"` // 部门状态,**字段权限要求(满足任一)**:,以应用身份读取通讯录,获取部门基础信息,以应用身份访问通讯录,读取通讯录
CreateGroupChat bool `json:"create_group_chat,omitempty"` // 是否创建部门群,默认不创建
}
type GetDepartmentListRespItemI18nName struct {
ZhCn string `json:"zh_cn,omitempty"` // 部门的中文名
JaJp string `json:"ja_jp,omitempty"` // 部门的日文名
EnUs string `json:"en_us,omitempty"` // 部门的英文名
}
type GetDepartmentListRespItemStatus struct {
IsDeleted bool `json:"is_deleted,omitempty"` // 是否被删除
}
// Code generated by lark_sdk_gen. DO NOT EDIT.
// GetDepartmentListOld 该接口用于获取当前部门子部门列表。[常见问题答疑](https://open.feishu.cn/document/ugTN1YjL4UTN24CO1UjN/uQzN1YjL0cTN24CN3UjN)。
//
// - 使用 user_access_token 时,返回该用户组织架构可见性范围([登陆企业管理后台进行权限配置](https://bytedance.feishu.cn/admin/security/permission/visibility))内的所有可见部门。当进行递归查询时,只筛查最多1000个部门的可见性。
// - 使用
// tenant_access_token 则基于应用的通讯录权限范围进行权限校验与过滤。由于
// parent_department_id 是非必填参数,填与不填存在<b>两种数据权限校验与返回</b>情况:
// <br> <br>1、请求设置了
// parent_department_id 为A(根部门0),会检验A是否在通讯录权限内,若在( parent_department_id=0 时会校验是否为全员权限),则返回部门下子部门列表(根据fetch_child决定是否递归),否则返回无部门通讯录权限错误码。
// <br> <br>2、请求未带
// parent_department_id 参数,如通讯录范围为全员权限,只返回根部门ID(部门ID为0),否则返回根据通讯录范围配置的部门ID及子部门(根据
// fetch_child 决定是否递归)。
//
// doc: https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/contact-v3/department/list
//
// Deprecated
func (r *ContactService) GetDepartmentListOld(ctx context.Context, request *GetDepartmentListOldReq, options ...MethodOptionFunc) (*GetDepartmentListOldResp, *Response, error) {
if r.cli.mock.mockContactGetDepartmentListOld != nil {
r.cli.log(ctx, LogLevelDebug, "[lark] Contact#GetDepartmentListOld mock enable")
return r.cli.mock.mockContactGetDepartmentListOld(ctx, request, options...)
}
req := &RawRequestReq{
Scope: "Contact",
API: "GetDepartmentListOld",
Method: "GET",
URL: r.cli.openBaseURL + "/open-apis/contact/v3/departments",
Body: request,
MethodOption: newMethodOption(options),
NeedTenantAccessToken: true,
NeedUserAccessToken: true,
}
resp := new(getDepartmentListOldResp)
response, err := r.cli.RawRequest(ctx, req, resp)
return resp.Data, response, err
}
func (r *Mock) MockContactGetDepartmentListOld(f func(ctx context.Context, request *GetDepartmentListOldReq, options ...MethodOptionFunc) (*GetDepartmentListOldResp, *Response, error)) {
r.mockContactGetDepartmentListOld = f
}
func (r *Mock) UnMockContactGetDepartmentListOld() {
r.mockContactGetDepartmentListOld = nil
}
type GetDepartmentListOldReq struct {
UserIDType *IDType `query:"user_id_type" json:"-"` // 用户 ID 类型, 示例值:"open_id", 可选值有: `open_id`:用户的 open id, `union_id`:用户的 union id, `user_id`:用户的 user id, 默认值: `open_id`, 当值为 `user_id`, 字段权限要求: 获取用户 user ID
DepartmentIDType *DepartmentIDType `query:"department_id_type" json:"-"` // 此次调用中使用的部门ID的类型, 示例值:"open_department_id", 可选值有: `department_id`:以自定义department_id来标识部门, `open_department_id`:以open_department_id来标识部门, 默认值: `open_department_id`
ParentDepartmentID *string `query:"parent_department_id" json:"-"` // 父部门的ID,填上获取部门下所有子部门,此处填写的 ID 必须是 department_id_type 指定的 ID。, 示例值:"od-4e6ac4d14bcd5071a37a39de902c7141"
FetchChild *bool `query:"fetch_child" json:"-"` // 是否递归获取子部门, 示例值:是否递归获取子部门,默认值:false
PageToken *string `query:"page_token" json:"-"` // 分页标记,第一次请求不填,表示从头开始遍历;分页查询结果还有更多项时会同时返回新的 page_token,下次遍历可采用该 page_token 获取查询结果, 示例值:"AQD9/Rn9eij9Pm39ED40/RD/cIFmu77WxpxPB/2oHfQLZ%2BG8JG6tK7%2BZnHiT7COhD2hMSICh/eBl7cpzU6JEC3J7COKNe4jrQ8ExwBCR"
PageSize *int64 `query:"page_size" json:"-"` // 分页大小, 示例值:10, 最大值:`50`
}
type getDepartmentListOldResp struct {
Code int64 `json:"code,omitempty"` // 错误码,非 0 表示失败
Msg string `json:"msg,omitempty"` // 错误描述
Data *GetDepartmentListOldResp `json:"data,omitempty"`
}
type GetDepartmentListOldResp struct {
HasMore bool `json:"has_more,omitempty"` // 是否还有更多项
PageToken string `json:"page_token,omitempty"` // 分页标记,当 has_more 为 true 时,会同时返回新的 page_token,否则不返回 page_token
Items []*GetDepartmentListOldRespItem `json:"items,omitempty"`
}
type GetDepartmentListOldRespItem struct {
Name string `json:"name,omitempty"` // 部门名称,**字段权限要求(满足任一)**:,以应用身份读取通讯录,获取部门基础信息,读取通讯录,以应用身份访问通讯录
I18nName *GetDepartmentListOldRespItemI18nName `json:"i18n_name,omitempty"` // 国际化的部门名称,**字段权限要求(满足任一)**:,以应用身份读取通讯录,获取部门基础信息,读取通讯录,以应用身份访问通讯录
ParentDepartmentID string `json:"parent_department_id,omitempty"` // 父部门的ID,* 创建根部门,该参数值为 “0”,**字段权限要求(满足任一)**:,以应用身份读取通讯录,获取部门组织架构信息,读取通讯录,以应用身份访问通讯录
DepartmentID string `json:"department_id,omitempty"` // 本部门的自定义部门ID,**字段权限要求(满足任一)**:,以应用身份读取通讯录,获取部门基础信息,读取通讯录,以应用身份访问通讯录
OpenDepartmentID string `json:"open_department_id,omitempty"` // 部门的open_id
LeaderUserID string `json:"leader_user_id,omitempty"` // 部门主管用户ID,**字段权限要求(满足任一)**:,以应用身份读取通讯录,获取部门组织架构信息,读取通讯录,以应用身份访问通讯录
ChatID string `json:"chat_id,omitempty"` // 部门群ID,**字段权限要求(满足任一)**:,以应用身份读取通讯录,获取部门基础信息,读取通讯录,以应用身份访问通讯录
Order string `json:"order,omitempty"` // 部门的排序,即部门在其同级部门的展示顺序,**字段权限要求(满足任一)**:,以应用身份读取通讯录,获取部门组织架构信息,读取通讯录,以应用身份访问通讯录
UnitIDs []string `json:"unit_ids,omitempty"` // 部门单位自定义ID列表,当前只支持一个,**字段权限要求(满足任一)**:,以应用身份读取通讯录,获取部门组织架构信息,读取通讯录,以应用身份访问通讯录
MemberCount int64 `json:"member_count,omitempty"` // 部门下用户的个数,**字段权限要求(满足任一)**:,以应用身份读取通讯录,获取部门组织架构信息,读取通讯录,以应用身份访问通讯录
Status *GetDepartmentListOldRespItemStatus `json:"status,omitempty"` // 部门状态,**字段权限要求(满足任一)**:,以应用身份读取通讯录,获取部门基础信息,读取通讯录,以应用身份访问通讯录
}
type GetDepartmentListOldRespItemI18nName struct {
ZhCn string `json:"zh_cn,omitempty"` // 部门的中文名
JaJp string `json:"ja_jp,omitempty"` // 部门的日文名
EnUs string `json:"en_us,omitempty"` // 部门的英文名
}
type GetDepartmentListOldRespItemStatus struct {
IsDeleted bool `json:"is_deleted,omitempty"` // 是否被删除
}
// Code generated by lark_sdk_gen. DO NOT EDIT.
// GetParentDepartment 该接口用来递归获取部门父部门的信息,并按照由子到父的顺序返回有权限的父部门信息列表。[常见问题答疑](https://open.feishu.cn/document/ugTN1YjL4UTN24CO1UjN/uQzN1YjL0cTN24CN3UjN)。
//
// 使用tenant_access_token时,该接口只返回可见性范围内的父部门信息
// 例如:A >>B>>C>>D四级部门,通讯录权限只到B,那么查询D部门的parent,会返回B和C两级部门。
// 使用user_access_token时,该接口只返回对于用户可见的父部门信息
//
// doc: https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/contact-v3/department/parent
func (r *ContactService) GetParentDepartment(ctx context.Context, request *GetParentDepartmentReq, options ...MethodOptionFunc) (*GetParentDepartmentResp, *Response, error) {
if r.cli.mock.mockContactGetParentDepartment != nil {
r.cli.log(ctx, LogLevelDebug, "[lark] Contact#GetParentDepartment mock enable")
return r.cli.mock.mockContactGetParentDepartment(ctx, request, options...)
}
req := &RawRequestReq{
Scope: "Contact",
API: "GetParentDepartment",
Method: "GET",
URL: r.cli.openBaseURL + "/open-apis/contact/v3/departments/parent",
Body: request,
MethodOption: newMethodOption(options),
NeedTenantAccessToken: true,
NeedUserAccessToken: true,
}
resp := new(getParentDepartmentResp)
response, err := r.cli.RawRequest(ctx, req, resp)
return resp.Data, response, err
}
func (r *Mock) MockContactGetParentDepartment(f func(ctx context.Context, request *GetParentDepartmentReq, options ...MethodOptionFunc) (*GetParentDepartmentResp, *Response, error)) {
r.mockContactGetParentDepartment = f
}
func (r *Mock) UnMockContactGetParentDepartment() {
r.mockContactGetParentDepartment = nil
}
type GetParentDepartmentReq struct {
UserIDType *IDType `query:"user_id_type" json:"-"` // 用户 ID 类型, 示例值:"open_id", 可选值有: `open_id`:用户的 open id, `union_id`:用户的 union id, `user_id`:用户的 user id, 默认值: `open_id`, 当值为 `user_id`, 字段权限要求: 获取用户 user ID
DepartmentIDType *DepartmentIDType `query:"department_id_type" json:"-"` // 此次调用中使用的部门ID的类型, 示例值:"open_department_id", 可选值有: `department_id`:以自定义department_id来标识部门, `open_department_id`:以open_department_id来标识部门
DepartmentID string `query:"department_id" json:"-"` // 部门ID, 示例值:"od-4e6ac4d14bcd5071a37a39de902c7141"
PageToken *string `query:"page_token" json:"-"` // 分页标记,第一次请求不填,表示从头开始遍历;分页查询结果还有更多项时会同时返回新的 page_token,下次遍历可采用该 page_token 获取查询结果, 示例值:"AQD9/Rn9eij9Pm39ED40/RD/cIFmu77WxpxPB/2oHfQLZ%2BG8JG6tK7%2BZnHiT7COhD2hMSICh/eBl7cpzU6JEC3J7COKNe4jrQ8ExwBCR"
PageSize *int64 `query:"page_size" json:"-"` // 分页大小, 示例值:10, 最大值:`50`
}
type getParentDepartmentResp struct {
Code int64 `json:"code,omitempty"` // 错误码,非 0 表示失败
Msg string `json:"msg,omitempty"` // 错误描述
Data *GetParentDepartmentResp `json:"data,omitempty"`
}
type GetParentDepartmentResp struct {
HasMore bool `json:"has_more,omitempty"` // 是否还有更多项
PageToken string `json:"page_token,omitempty"` // 分页标记,当 has_more 为 true 时,会同时返回新的 page_token,否则不返回 page_token
Items []*GetParentDepartmentRespItem `json:"items,omitempty"`
}
type GetParentDepartmentRespItem struct {
Name string `json:"name,omitempty"` // 部门名称,**字段权限要求(满足任一)**:,以应用身份读取通讯录,获取部门基础信息,读取通讯录,以应用身份访问通讯录
I18nName *GetParentDepartmentRespItemI18nName `json:"i18n_name,omitempty"` // 国际化的部门名称,**字段权限要求(满足任一)**:,以应用身份读取通讯录,获取部门基础信息,读取通讯录,以应用身份访问通讯录
ParentDepartmentID string `json:"parent_department_id,omitempty"` // 父部门的ID,* 创建根部门,该参数值为 “0”,**字段权限要求(满足任一)**:,以应用身份读取通讯录,获取部门组织架构信息,读取通讯录,以应用身份访问通讯录
DepartmentID string `json:"department_id,omitempty"` // 本部门的自定义部门ID,**字段权限要求(满足任一)**:,以应用身份读取通讯录,获取部门基础信息,读取通讯录,以应用身份访问通讯录
OpenDepartmentID string `json:"open_department_id,omitempty"` // 部门的open_id
LeaderUserID string `json:"leader_user_id,omitempty"` // 部门主管用户ID,**字段权限要求(满足任一)**:,以应用身份读取通讯录,获取部门组织架构信息,读取通讯录,以应用身份访问通讯录
ChatID string `json:"chat_id,omitempty"` // 部门群ID,**字段权限要求(满足任一)**:,以应用身份读取通讯录,获取部门基础信息,读取通讯录,以应用身份访问通讯录
Order string `json:"order,omitempty"` // 部门的排序,即部门在其同级部门的展示顺序,**字段权限要求(满足任一)**:,以应用身份读取通讯录,获取部门组织架构信息,读取通讯录,以应用身份访问通讯录
UnitIDs []string `json:"unit_ids,omitempty"` // 部门单位自定义ID列表,当前只支持一个,**字段权限要求(满足任一)**:,以应用身份读取通讯录,获取部门组织架构信息,读取通讯录,以应用身份访问通讯录
MemberCount int64 `json:"member_count,omitempty"` // 部门下用户的个数,**字段权限要求(满足任一)**:,以应用身份读取通讯录,获取部门组织架构信息,读取通讯录,以应用身份访问通讯录
Status *GetParentDepartmentRespItemStatus `json:"status,omitempty"` // 部门状态,**字段权限要求(满足任一)**:,以应用身份读取通讯录,获取部门基础信息,读取通讯录,以应用身份访问通讯录
}
type GetParentDepartmentRespItemI18nName struct {
ZhCn string `json:"zh_cn,omitempty"` // 部门的中文名
JaJp string `json:"ja_jp,omitempty"` // 部门的日文名
EnUs string `json:"en_us,omitempty"` // 部门的英文名
}
type GetParentDepartmentRespItemStatus struct {
IsDeleted bool `json:"is_deleted,omitempty"` // 是否被删除
}
// Code generated by lark_sdk_gen. DO NOT EDIT.
// SearchDepartment 搜索部门,用户通过关键词查询可见的部门数据,部门可见性需要管理员在后台配置。[常见问题答疑](https://open.feishu.cn/document/ugTN1YjL4UTN24CO1UjN/uQzN1YjL0cTN24CN3UjN)。
//
// 部门存在,但用户搜索不到并不一定是搜索有问题,可能是管理员在后台配置了权限控制,导致用户无法搜索到该部门
//
// doc: https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/contact-v3/department/search
func (r *ContactService) SearchDepartment(ctx context.Context, request *SearchDepartmentReq, options ...MethodOptionFunc) (*SearchDepartmentResp, *Response, error) {
if r.cli.mock.mockContactSearchDepartment != nil {
r.cli.log(ctx, LogLevelDebug, "[lark] Contact#SearchDepartment mock enable")
return r.cli.mock.mockContactSearchDepartment(ctx, request, options...)
}
req := &RawRequestReq{
Scope: "Contact",
API: "SearchDepartment",
Method: "POST",
URL: r.cli.openBaseURL + "/open-apis/contact/v3/departments/search",
Body: request,
MethodOption: newMethodOption(options),
NeedUserAccessToken: true,
}
resp := new(searchDepartmentResp)
response, err := r.cli.RawRequest(ctx, req, resp)
return resp.Data, response, err
}
func (r *Mock) MockContactSearchDepartment(f func(ctx context.Context, request *SearchDepartmentReq, options ...MethodOptionFunc) (*SearchDepartmentResp, *Response, error)) {
r.mockContactSearchDepartment = f
}
func (r *Mock) UnMockContactSearchDepartment() {
r.mockContactSearchDepartment = nil
}
type SearchDepartmentReq struct {
UserIDType *IDType `query:"user_id_type" json:"-"` // 用户 ID 类型, 示例值:"open_id", 可选值有: `open_id`:用户的 open id, `union_id`:用户的 union id, `user_id`:用户的 user id, 默认值: `open_id`, 当值为 `user_id`, 字段权限要求: 获取用户 user ID
DepartmentIDType *DepartmentIDType `query:"department_id_type" json:"-"` // 此次调用中使用的部门ID的类型, 示例值:"open_department_id", 可选值有: `department_id`:以自定义 department_id 来标识部门, `open_department_id`:以 open_department_id 来标识部门
PageToken *string `query:"page_token" json:"-"` // 分页标记,第一次请求不填,表示从头开始遍历;分页查询结果还有更多项时会同时返回新的 page_token,下次遍历可采用该 page_token 获取查询结果, 示例值:"AQD9/Rn9eij9Pm39ED40/RD/cIFmu77WxpxPB/2oHfQLZ+G8JG6tK7+ZnHiT7COhD2hMSICh/eBl7cpzU6JEC3J7COKNe4jrQ8ExwBCR"
PageSize *int64 `query:"page_size" json:"-"` // 分页大小, 示例值:10, 最大值:`50`
Query string `json:"query,omitempty"` // 搜索关键词,匹配字段为部门名称(不支持匹配部门国际化名称), 示例值:"DemoName"
}
type searchDepartmentResp struct {
Code int64 `json:"code,omitempty"` // 错误码,非 0 表示失败
Msg string `json:"msg,omitempty"` // 错误描述
Data *SearchDepartmentResp `json:"data,omitempty"`
}
type SearchDepartmentResp struct {
Items []*SearchDepartmentRespItem `json:"items,omitempty"`
PageToken string `json:"page_token,omitempty"` // 分页标记,当 has_more 为 true 时,会同时返回新的 page_token,否则不返回 page_token
HasMore bool `json:"has_more,omitempty"` // 是否还有更多项
}
type SearchDepartmentRespItem struct {
Name string `json:"name,omitempty"` // 部门名称,**字段权限要求(满足任一)**:,以应用身份读取通讯录,获取部门基础信息,读取通讯录,以应用身份访问通讯录
I18nName *SearchDepartmentRespItemI18nName `json:"i18n_name,omitempty"` // 国际化的部门名称,**字段权限要求(满足任一)**:,以应用身份读取通讯录,获取部门基础信息,读取通讯录,以应用身份访问通讯录
ParentDepartmentID string `json:"parent_department_id,omitempty"` // 父部门的ID,* 创建根部门,该参数值为 “0”,**字段权限要求(满足任一)**:,以应用身份读取通讯录,获取部门组织架构信息,读取通讯录,以应用身份访问通讯录
DepartmentID string `json:"department_id,omitempty"` // 本部门的自定义部门ID,**字段权限要求(满足任一)**:,以应用身份读取通讯录,获取部门基础信息,读取通讯录,以应用身份访问通讯录
OpenDepartmentID string `json:"open_department_id,omitempty"` // 部门的open_id
LeaderUserID string `json:"leader_user_id,omitempty"` // 部门主管用户ID,**字段权限要求(满足任一)**:,以应用身份读取通讯录,获取部门组织架构信息,读取通讯录,以应用身份访问通讯录
ChatID string `json:"chat_id,omitempty"` // 部门群ID,**字段权限要求(满足任一)**:,以应用身份读取通讯录,获取部门基础信息,读取通讯录,以应用身份访问通讯录
Order string `json:"order,omitempty"` // 部门的排序,即部门在其同级部门的展示顺序,**字段权限要求(满足任一)**:,以应用身份读取通讯录,获取部门组织架构信息,读取通讯录,以应用身份访问通讯录
UnitIDs []string `json:"unit_ids,omitempty"` // 部门单位自定义ID列表,当前只支持一个,**字段权限要求(满足任一)**:,以应用身份读取通讯录,获取部门组织架构信息,读取通讯录,以应用身份访问通讯录
MemberCount int64 `json:"member_count,omitempty"` // 部门下用户的个数,**字段权限要求(满足任一)**:,以应用身份读取通讯录,获取部门组织架构信息,读取通讯录,以应用身份访问通讯录
Status *SearchDepartmentRespItemStatus `json:"status,omitempty"` // 部门状态,**字段权限要求(满足任一)**:,以应用身份读取通讯录,获取部门基础信息,读取通讯录,以应用身份访问通讯录
CreateGroupChat bool `json:"create_group_chat,omitempty"` // 是否创建部门群,默认不创建
}
type SearchDepartmentRespItemI18nName struct {
ZhCn string `json:"zh_cn,omitempty"` // 部门的中文名
JaJp string `json:"ja_jp,omitempty"` // 部门的日文名
EnUs string `json:"en_us,omitempty"` // 部门的英文名
}
type SearchDepartmentRespItemStatus struct {
IsDeleted bool `json:"is_deleted,omitempty"` // 是否被删除
}
// Code generated by lark_sdk_gen. DO NOT EDIT.
// UpdateDepartment 该接口用于更新当前部门所有信息。[常见问题答疑](https://open.feishu.cn/document/ugTN1YjL4UTN24CO1UjN/uQzN1YjL0cTN24CN3UjN)。
//
// - 调用该接口需要具有该部门以及更新操作涉及的部门的通讯录权限。应用商店应用无权限调用此接口。
// - 没有填写的字段会被置为空值(order字段除外)。
//
// doc: https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/contact-v3/department/update
func (r *ContactService) UpdateDepartment(ctx context.Context, request *UpdateDepartmentReq, options ...MethodOptionFunc) (*UpdateDepartmentResp, *Response, error) {
if r.cli.mock.mockContactUpdateDepartment != nil {
r.cli.log(ctx, LogLevelDebug, "[lark] Contact#UpdateDepartment mock enable")
return r.cli.mock.mockContactUpdateDepartment(ctx, request, options...)
}
req := &RawRequestReq{
Scope: "Contact",
API: "UpdateDepartment",
Method: "PUT",
URL: r.cli.openBaseURL + "/open-apis/contact/v3/departments/:department_id",
Body: request,
MethodOption: newMethodOption(options),
NeedTenantAccessToken: true,
}
resp := new(updateDepartmentResp)
response, err := r.cli.RawRequest(ctx, req, resp)
return resp.Data, response, err
}
func (r *Mock) MockContactUpdateDepartment(f func(ctx context.Context, request *UpdateDepartmentReq, options ...MethodOptionFunc) (*UpdateDepartmentResp, *Response, error)) {
r.mockContactUpdateDepartment = f
}
func (r *Mock) UnMockContactUpdateDepartment() {
r.mockContactUpdateDepartment = nil
}
type UpdateDepartmentReq struct {
UserIDType *IDType `query:"user_id_type" json:"-"` // 用户 ID 类型, 示例值:"open_id", 可选值有: `open_id`:用户的 open id, `union_id`:用户的 union id, `user_id`:用户的 user id, 默认值: `open_id`, 当值为 `user_id`, 字段权限要求: 获取用户 user ID
DepartmentIDType *DepartmentIDType `query:"department_id_type" json:"-"` // 此次调用中使用的部门ID的类型, 示例值:"open_department_id", 可选值有: `department_id`:以自定义department_id来标识部门, `open_department_id`:以open_department_id来标识部门, 默认值: `open_department_id`
DepartmentID string `path:"department_id" json:"-"` // 部门ID,需要与查询参数中传入的department_id_type类型保持一致。, 示例值:"od-4e6ac4d14bcd5071a37a39de902c7141", 最大长度:`64` 字符, 正则校验:`^0|[^od][A-Za-z0-9]*`
Name string `json:"name,omitempty"` // 部门名称, 示例值:"DemoName", 最小长度:`1` 字符
I18nName *UpdateDepartmentReqI18nName `json:"i18n_name,omitempty"` // 国际化的部门名称
ParentDepartmentID string `json:"parent_department_id,omitempty"` // 父部门的ID,* 创建根部门,该参数值为 “0”, 示例值:"D067"
LeaderUserID *string `json:"leader_user_id,omitempty"` // 部门主管用户ID, 示例值:"ou_7dab8a3d3cdcc9da365777c7ad535d62"
Order *string `json:"order,omitempty"` // 部门的排序,即部门在其同级部门的展示顺序, 示例值:"100"
UnitIDs []string `json:"unit_ids,omitempty"` // 部门单位自定义ID列表,当前只支持一个, 示例值:custom_unit_id
CreateGroupChat *bool `json:"create_group_chat,omitempty"` // 是否创建部门群,默认不创建, 示例值:false
}
type UpdateDepartmentReqI18nName struct {
ZhCn *string `json:"zh_cn,omitempty"` // 部门的中文名, 示例值:"Demo名称"
JaJp *string `json:"ja_jp,omitempty"` // 部门的日文名, 示例值:"デモ名"
EnUs *string `json:"en_us,omitempty"` // 部门的英文名, 示例值:"Demo Name"
}
type updateDepartmentResp struct {
Code int64 `json:"code,omitempty"` // 错误码,非 0 表示失败
Msg string `json:"msg,omitempty"` // 错误描述
Data *UpdateDepartmentResp `json:"data,omitempty"`
}
type UpdateDepartmentResp struct {
Department *UpdateDepartmentRespDepartment `json:"department,omitempty"` // 部门信息
}
type UpdateDepartmentRespDepartment struct {
Name string `json:"name,omitempty"` // 部门名称,**字段权限要求(满足任一)**:,以应用身份读取通讯录,获取部门基础信息,读取通讯录,以应用身份访问通讯录
I18nName *UpdateDepartmentRespDepartmentI18nName `json:"i18n_name,omitempty"` // 国际化的部门名称,**字段权限要求(满足任一)**:,以应用身份读取通讯录,获取部门基础信息,读取通讯录,以应用身份访问通讯录
ParentDepartmentID string `json:"parent_department_id,omitempty"` // 父部门的ID,* 创建根部门,该参数值为 “0”,**字段权限要求(满足任一)**:,以应用身份读取通讯录,获取部门组织架构信息,读取通讯录,以应用身份访问通讯录
DepartmentID string `json:"department_id,omitempty"` // 本部门的自定义部门ID,**字段权限要求(满足任一)**:,以应用身份读取通讯录,获取部门基础信息,读取通讯录,以应用身份访问通讯录
OpenDepartmentID string `json:"open_department_id,omitempty"` // 部门的open_id
LeaderUserID string `json:"leader_user_id,omitempty"` // 部门主管用户ID,**字段权限要求(满足任一)**:,以应用身份读取通讯录,获取部门组织架构信息,读取通讯录,以应用身份访问通讯录
ChatID string `json:"chat_id,omitempty"` // 部门群ID,**字段权限要求(满足任一)**:,以应用身份读取通讯录,获取部门基础信息,读取通讯录,以应用身份访问通讯录
Order string `json:"order,omitempty"` // 部门的排序,即部门在其同级部门的展示顺序,**字段权限要求(满足任一)**:,以应用身份读取通讯录,获取部门组织架构信息,读取通讯录,以应用身份访问通讯录
UnitIDs []string `json:"unit_ids,omitempty"` // 部门单位自定义ID列表,当前只支持一个,**字段权限要求(满足任一)**:,以应用身份读取通讯录,获取部门组织架构信息,读取通讯录,以应用身份访问通讯录
MemberCount int64 `json:"member_count,omitempty"` // 部门下用户的个数,**字段权限要求(满足任一)**:,以应用身份读取通讯录,获取部门组织架构信息,读取通讯录,以应用身份访问通讯录
Status *UpdateDepartmentRespDepartmentStatus `json:"status,omitempty"` // 部门状态,**字段权限要求(满足任一)**:,以应用身份读取通讯录,获取部门基础信息,读取通讯录,以应用身份访问通讯录
}
type UpdateDepartmentRespDepartmentI18nName struct {
ZhCn string `json:"zh_cn,omitempty"` // 部门的中文名
JaJp string `json:"ja_jp,omitempty"` // 部门的日文名
EnUs string `json:"en_us,omitempty"` // 部门的英文名
}
type UpdateDepartmentRespDepartmentStatus struct {
IsDeleted bool `json:"is_deleted,omitempty"` // 是否被删除
}
// Code generated by lark_sdk_gen. DO NOT EDIT.
// UpdateDepartmentPatch 该接口用于更新通讯录中部门的信息中的任一个字段。[常见问题答疑](https://open.feishu.cn/document/ugTN1YjL4UTN24CO1UjN/uQzN1YjL0cTN24CN3UjN)。
//
// 调用该接口需要具有该部门以及更新操作涉及的部门的通讯录权限。应用商店应用无权限调用此接口。
//
// doc: https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/contact-v3/department/patch
func (r *ContactService) UpdateDepartmentPatch(ctx context.Context, request *UpdateDepartmentPatchReq, options ...MethodOptionFunc) (*UpdateDepartmentPatchResp, *Response, error) {
if r.cli.mock.mockContactUpdateDepartmentPatch != nil {
r.cli.log(ctx, LogLevelDebug, "[lark] Contact#UpdateDepartmentPatch mock enable")
return r.cli.mock.mockContactUpdateDepartmentPatch(ctx, request, options...)
}
req := &RawRequestReq{
Scope: "Contact",
API: "UpdateDepartmentPatch",
Method: "PATCH",
URL: r.cli.openBaseURL + "/open-apis/contact/v3/departments/:department_id",
Body: request,
MethodOption: newMethodOption(options),
NeedTenantAccessToken: true,
}
resp := new(updateDepartmentPatchResp)
response, err := r.cli.RawRequest(ctx, req, resp)
return resp.Data, response, err
}
func (r *Mock) MockContactUpdateDepartmentPatch(f func(ctx context.Context, request *UpdateDepartmentPatchReq, options ...MethodOptionFunc) (*UpdateDepartmentPatchResp, *Response, error)) {
r.mockContactUpdateDepartmentPatch = f
}
func (r *Mock) UnMockContactUpdateDepartmentPatch() {
r.mockContactUpdateDepartmentPatch = nil
}
type UpdateDepartmentPatchReq struct {
UserIDType *IDType `query:"user_id_type" json:"-"` // 用户 ID 类型, 示例值:"open_id", 可选值有: `open_id`:用户的 open id, `union_id`:用户的 union id, `user_id`:用户的 user id, 默认值: `open_id`, 当值为 `user_id`, 字段权限要求: 获取用户 user ID
DepartmentIDType *DepartmentIDType `query:"department_id_type" json:"-"` // 此次调用中使用的部门ID的类型, 示例值:"open_department_id", 可选值有: `department_id`:以自定义department_id来标识部门, `open_department_id`:以open_department_id来标识部门, 默认值: `open_department_id`
DepartmentID string `path:"department_id" json:"-"` // 部门ID,需要与查询参数中传入的department_id_type类型保持一致。, 示例值:"od-4e6ac4d14bcd5071a37a39de902c7141", 最大长度:`64` 字符, 正则校验:`^0|[^od][A-Za-z0-9]*`
Name *string `json:"name,omitempty"` // 部门名称, 示例值:"DemoName", 最小长度:`1` 字符
I18nName *UpdateDepartmentPatchReqI18nName `json:"i18n_name,omitempty"` // 国际化的部门名称
ParentDepartmentID *string `json:"parent_department_id,omitempty"` // 父部门的ID,* 创建根部门,该参数值为 “0”, 示例值:"D067"
LeaderUserID *string `json:"leader_user_id,omitempty"` // 部门主管用户ID, 示例值:"ou_7dab8a3d3cdcc9da365777c7ad535d62"
Order *string `json:"order,omitempty"` // 部门的排序,即部门在其同级部门的展示顺序, 示例值:"100"
UnitIDs []string `json:"unit_ids,omitempty"` // 部门单位自定义ID列表,当前只支持一个, 示例值:custom_unit_id
CreateGroupChat *bool `json:"create_group_chat,omitempty"` // 是否创建部门群,默认不创建, 示例值:false
}
type UpdateDepartmentPatchReqI18nName struct {
ZhCn *string `json:"zh_cn,omitempty"` // 部门的中文名, 示例值:"Demo名称"
JaJp *string `json:"ja_jp,omitempty"` // 部门的日文名, 示例值:"デモ名"
EnUs *string `json:"en_us,omitempty"` // 部门的英文名, 示例值:"Demo Name"
}
type updateDepartmentPatchResp struct {
Code int64 `json:"code,omitempty"` // 错误码,非 0 表示失败
Msg string `json:"msg,omitempty"` // 错误描述
Data *UpdateDepartmentPatchResp `json:"data,omitempty"`
}
type UpdateDepartmentPatchResp struct {
Department *UpdateDepartmentPatchRespDepartment `json:"department,omitempty"` // 部门信息
}
type UpdateDepartmentPatchRespDepartment struct {
Name string `json:"name,omitempty"` // 部门名称,**字段权限要求(满足任一)**:,以应用身份读取通讯录,获取部门基础信息,读取通讯录,以应用身份访问通讯录
I18nName *UpdateDepartmentPatchRespDepartmentI18nName `json:"i18n_name,omitempty"` // 国际化的部门名称,**字段权限要求(满足任一)**:,以应用身份读取通讯录,获取部门基础信息,读取通讯录,以应用身份访问通讯录
ParentDepartmentID string `json:"parent_department_id,omitempty"` // 父部门的ID,* 创建根部门,该参数值为 “0”,**字段权限要求(满足任一)**:,以应用身份读取通讯录,获取部门组织架构信息,读取通讯录,以应用身份访问通讯录
DepartmentID string `json:"department_id,omitempty"` // 本部门的自定义部门ID,**字段权限要求(满足任一)**:,以应用身份读取通讯录,获取部门基础信息,读取通讯录,以应用身份访问通讯录
OpenDepartmentID string `json:"open_department_id,omitempty"` // 部门的open_id
LeaderUserID string `json:"leader_user_id,omitempty"` // 部门主管用户ID,**字段权限要求(满足任一)**:,以应用身份读取通讯录,获取部门组织架构信息,读取通讯录,以应用身份访问通讯录
ChatID string `json:"chat_id,omitempty"` // 部门群ID,**字段权限要求(满足任一)**:,以应用身份读取通讯录,获取部门基础信息,读取通讯录,以应用身份访问通讯录
Order string `json:"order,omitempty"` // 部门的排序,即部门在其同级部门的展示顺序,**字段权限要求(满足任一)**:,以应用身份读取通讯录,获取部门组织架构信息,读取通讯录,以应用身份访问通讯录
UnitIDs []string `json:"unit_ids,omitempty"` // 部门单位自定义ID列表,当前只支持一个,**字段权限要求(满足任一)**:,以应用身份读取通讯录,获取部门组织架构信息,读取通讯录,以应用身份访问通讯录
MemberCount int64 `json:"member_count,omitempty"` // 部门下用户的个数,**字段权限要求(满足任一)**:,以应用身份读取通讯录,获取部门组织架构信息,读取通讯录,以应用身份访问通讯录
Status *UpdateDepartmentPatchRespDepartmentStatus `json:"status,omitempty"` // 部门状态,**字段权限要求(满足任一)**:,以应用身份读取通讯录,获取部门基础信息,读取通讯录,以应用身份访问通讯录
}
type UpdateDepartmentPatchRespDepartmentI18nName struct {
ZhCn string `json:"zh_cn,omitempty"` // 部门的中文名
JaJp string `json:"ja_jp,omitempty"` // 部门的日文名
EnUs string `json:"en_us,omitempty"` // 部门的英文名
}
type UpdateDepartmentPatchRespDepartmentStatus struct {
IsDeleted bool `json:"is_deleted,omitempty"` // 是否被删除
}
// Code generated by lark_sdk_gen. DO NOT EDIT.
// CreateEmployeeTypeEnum 新增自定义人员类型
//
// doc: https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/contact-v3/employee_type_enum/create
func (r *ContactService) CreateEmployeeTypeEnum(ctx context.Context, request *CreateEmployeeTypeEnumReq, options ...MethodOptionFunc) (*CreateEmployeeTypeEnumResp, *Response, error) {
if r.cli.mock.mockContactCreateEmployeeTypeEnum != nil {
r.cli.log(ctx, LogLevelDebug, "[lark] Contact#CreateEmployeeTypeEnum mock enable")
return r.cli.mock.mockContactCreateEmployeeTypeEnum(ctx, request, options...)
}
req := &RawRequestReq{
Scope: "Contact",
API: "CreateEmployeeTypeEnum",
Method: "POST",
URL: r.cli.openBaseURL + "/open-apis/contact/v3/employee_type_enums",
Body: request,
MethodOption: newMethodOption(options),
NeedTenantAccessToken: true,
}
resp := new(createEmployeeTypeEnumResp)
response, err := r.cli.RawRequest(ctx, req, resp)
return resp.Data, response, err
}
func (r *Mock) MockContactCreateEmployeeTypeEnum(f func(ctx context.Context, request *CreateEmployeeTypeEnumReq, options ...MethodOptionFunc) (*CreateEmployeeTypeEnumResp, *Response, error)) {
r.mockContactCreateEmployeeTypeEnum = f
}
func (r *Mock) UnMockContactCreateEmployeeTypeEnum() {
r.mockContactCreateEmployeeTypeEnum = nil
}
type CreateEmployeeTypeEnumReq struct {
Content string `json:"content,omitempty"` // 枚举内容, 示例值:"专家", 长度范围:`1` ~ `100` 字符
EnumType int64 `json:"enum_type,omitempty"` // 类型, 示例值:2, 可选值有: `1`:内置类型, `2`:自定义
EnumStatus int64 `json:"enum_status,omitempty"` // 使用状态, 示例值:1, 可选值有: `1`:激活, `2`:未激活
I18nContent *CreateEmployeeTypeEnumReqI18nContent `json:"i18n_content,omitempty"` // i18n定义
}
type CreateEmployeeTypeEnumReqI18nContent struct {
Locale *string `json:"locale,omitempty"` // 语言版本, 示例值:"zh_cn"
Value *string `json:"value,omitempty"` // 字段名, 示例值:"专家"
}
type createEmployeeTypeEnumResp struct {
Code int64 `json:"code,omitempty"` // 错误码,非 0 表示失败
Msg string `json:"msg,omitempty"` // 错误描述
Data *CreateEmployeeTypeEnumResp `json:"data,omitempty"`
}
type CreateEmployeeTypeEnumResp struct {
EmployeeTypeEnum *CreateEmployeeTypeEnumRespEmployeeTypeEnum `json:"employee_type_enum,omitempty"` // 新建的人员类型信息
}
type CreateEmployeeTypeEnumRespEmployeeTypeEnum struct {
EnumID string `json:"enum_id,omitempty"` // 枚举值id
EnumValue string `json:"enum_value,omitempty"` // 枚举的编号值,创建新的人员类型后,系统生成对应编号。对应[创建用户接口](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/contact-v3/user/create)中用户信息的employee_type字段值
Content string `json:"content,omitempty"` // 枚举内容
EnumType int64 `json:"enum_type,omitempty"` // 类型, 可选值有: `1`:内置类型, `2`:自定义
EnumStatus int64 `json:"enum_status,omitempty"` // 使用状态, 可选值有: `1`:激活, `2`:未激活
I18nContent *CreateEmployeeTypeEnumRespEmployeeTypeEnumI18nContent `json:"i18n_content,omitempty"` // i18n定义
}
type CreateEmployeeTypeEnumRespEmployeeTypeEnumI18nContent struct {
Locale string `json:"locale,omitempty"` // 语言版本
Value string `json:"value,omitempty"` // 字段名
}
// Code generated by lark_sdk_gen. DO NOT EDIT.
// DeleteEmployeeTypeEnum 删除自定义人员枚举
//
// doc: https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/contact-v3/employee_type_enum/delete
func (r *ContactService) DeleteEmployeeTypeEnum(ctx context.Context, request *DeleteEmployeeTypeEnumReq, options ...MethodOptionFunc) (*DeleteEmployeeTypeEnumResp, *Response, error) {
if r.cli.mock.mockContactDeleteEmployeeTypeEnum != nil {
r.cli.log(ctx, LogLevelDebug, "[lark] Contact#DeleteEmployeeTypeEnum mock enable")
return r.cli.mock.mockContactDeleteEmployeeTypeEnum(ctx, request, options...)
}
req := &RawRequestReq{
Scope: "Contact",
API: "DeleteEmployeeTypeEnum",
Method: "DELETE",
URL: r.cli.openBaseURL + "/open-apis/contact/v3/employee_type_enums/:enum_id",
Body: request,
MethodOption: newMethodOption(options),
NeedTenantAccessToken: true,
}
resp := new(deleteEmployeeTypeEnumResp)
response, err := r.cli.RawRequest(ctx, req, resp)
return resp.Data, response, err
}
func (r *Mock) MockContactDeleteEmployeeTypeEnum(f func(ctx context.Context, request *DeleteEmployeeTypeEnumReq, options ...MethodOptionFunc) (*DeleteEmployeeTypeEnumResp, *Response, error)) {
r.mockContactDeleteEmployeeTypeEnum = f
}
func (r *Mock) UnMockContactDeleteEmployeeTypeEnum() {
r.mockContactDeleteEmployeeTypeEnum = nil
}
type DeleteEmployeeTypeEnumReq struct {
EnumID string `path:"enum_id" json:"-"` // 枚举值id, 示例值:"exGeIjow7zIqWMy+ONkFxA=="
}
type deleteEmployeeTypeEnumResp struct {
Code int64 `json:"code,omitempty"` // 错误码,非 0 表示失败
Msg string `json:"msg,omitempty"` // 错误描述
Data *DeleteEmployeeTypeEnumResp `json:"data,omitempty"`
}
type DeleteEmployeeTypeEnumResp struct{}
// Code generated by lark_sdk_gen. DO NOT EDIT.
// GetEmployeeTypeEnumList 该接口用于获取员工的人员类型
//
// doc: https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/contact-v3/employee_type_enum/list
func (r *ContactService) GetEmployeeTypeEnumList(ctx context.Context, request *GetEmployeeTypeEnumListReq, options ...MethodOptionFunc) (*GetEmployeeTypeEnumListResp, *Response, error) {
if r.cli.mock.mockContactGetEmployeeTypeEnumList != nil {
r.cli.log(ctx, LogLevelDebug, "[lark] Contact#GetEmployeeTypeEnumList mock enable")
return r.cli.mock.mockContactGetEmployeeTypeEnumList(ctx, request, options...)
}
req := &RawRequestReq{
Scope: "Contact",
API: "GetEmployeeTypeEnumList",
Method: "GET",
URL: r.cli.openBaseURL + "/open-apis/contact/v3/employee_type_enums",
Body: request,
MethodOption: newMethodOption(options),
NeedTenantAccessToken: true,
}
resp := new(getEmployeeTypeEnumListResp)
response, err := r.cli.RawRequest(ctx, req, resp)
return resp.Data, response, err
}
func (r *Mock) MockContactGetEmployeeTypeEnumList(f func(ctx context.Context, request *GetEmployeeTypeEnumListReq, options ...MethodOptionFunc) (*GetEmployeeTypeEnumListResp, *Response, error)) {
r.mockContactGetEmployeeTypeEnumList = f
}
func (r *Mock) UnMockContactGetEmployeeTypeEnumList() {
r.mockContactGetEmployeeTypeEnumList = nil
}
type GetEmployeeTypeEnumListReq struct {
PageToken *string `query:"page_token" json:"-"` // 分页标记,第一次请求不填,表示从头开始遍历;分页查询结果还有更多项时会同时返回新的 page_token,下次遍历可采用该 page_token 获取查询结果, 示例值:"3"
PageSize *int64 `query:"page_size" json:"-"` // 分页大小, 示例值:10, 最大值:`100`
}
type getEmployeeTypeEnumListResp struct {
Code int64 `json:"code,omitempty"` // 错误码,非 0 表示失败
Msg string `json:"msg,omitempty"` // 错误描述
Data *GetEmployeeTypeEnumListResp `json:"data,omitempty"`
}
type GetEmployeeTypeEnumListResp struct {
Items []*GetEmployeeTypeEnumListRespItem `json:"items,omitempty"` // 枚举数据
HasMore bool `json:"has_more,omitempty"` // 是否还有更多项
PageToken string `json:"page_token,omitempty"` // 分页标记,当 has_more 为 true 时,会同时返回新的 page_token,否则不返回 page_token
}
type GetEmployeeTypeEnumListRespItem struct {
EnumID string `json:"enum_id,omitempty"` // 枚举值id
EnumValue string `json:"enum_value,omitempty"` // 枚举的编号值,创建新的人员类型后,系统生成对应编号。对应[创建用户接口](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/contact-v3/user/create)中用户信息的employee_type字段值
Content string `json:"content,omitempty"` // 枚举内容
EnumType int64 `json:"enum_type,omitempty"` // 类型, 可选值有: `1`:内置类型, `2`:自定义
EnumStatus int64 `json:"enum_status,omitempty"` // 使用状态, 可选值有: `1`:激活, `2`:未激活
I18nContent *GetEmployeeTypeEnumListRespItemI18nContent `json:"i18n_content,omitempty"` // i18n定义
}
type GetEmployeeTypeEnumListRespItemI18nContent struct {
Locale string `json:"locale,omitempty"` // 语言版本
Value string `json:"value,omitempty"` // 字段名
}
// Code generated by lark_sdk_gen. DO NOT EDIT.
// UpdateEmployeeTypeEnumPatch 更新自定义人员类型
//
// doc: https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/contact-v3/employee_type_enum/update
func (r *ContactService) UpdateEmployeeTypeEnumPatch(ctx context.Context, request *UpdateEmployeeTypeEnumPatchReq, options ...MethodOptionFunc) (*UpdateEmployeeTypeEnumPatchResp, *Response, error) {
if r.cli.mock.mockContactUpdateEmployeeTypeEnumPatch != nil {
r.cli.log(ctx, LogLevelDebug, "[lark] Contact#UpdateEmployeeTypeEnumPatch mock enable")
return r.cli.mock.mockContactUpdateEmployeeTypeEnumPatch(ctx, request, options...)
}
req := &RawRequestReq{
Scope: "Contact",
API: "UpdateEmployeeTypeEnumPatch",
Method: "PUT",
URL: r.cli.openBaseURL + "/open-apis/contact/v3/employee_type_enums/:enum_id",
Body: request,
MethodOption: newMethodOption(options),
NeedTenantAccessToken: true,
}
resp := new(updateEmployeeTypeEnumPatchResp)
response, err := r.cli.RawRequest(ctx, req, resp)
return resp.Data, response, err
}
func (r *Mock) MockContactUpdateEmployeeTypeEnumPatch(f func(ctx context.Context, request *UpdateEmployeeTypeEnumPatchReq, options ...MethodOptionFunc) (*UpdateEmployeeTypeEnumPatchResp, *Response, error)) {
r.mockContactUpdateEmployeeTypeEnumPatch = f
}
func (r *Mock) UnMockContactUpdateEmployeeTypeEnumPatch() {
r.mockContactUpdateEmployeeTypeEnumPatch = nil
}
type UpdateEmployeeTypeEnumPatchReq struct {
EnumID string `path:"enum_id" json:"-"` // 枚举值id, 示例值:"exGeIjow7zIqWMy+ONkFxA=="
Content string `json:"content,omitempty"` // 枚举内容, 示例值:"专家", 长度范围:`1` ~ `100` 字符
EnumType int64 `json:"enum_type,omitempty"` // 类型, 示例值:2, 可选值有: `1`:内置类型, `2`:自定义
EnumStatus int64 `json:"enum_status,omitempty"` // 使用状态, 示例值:1, 可选值有: `1`:激活, `2`:未激活
I18nContent *UpdateEmployeeTypeEnumPatchReqI18nContent `json:"i18n_content,omitempty"` // i18n定义
}
type UpdateEmployeeTypeEnumPatchReqI18nContent struct {
Locale *string `json:"locale,omitempty"` // 语言版本, 示例值:"zh_cn"
Value *string `json:"value,omitempty"` // 字段名, 示例值:"专家"
}
type updateEmployeeTypeEnumPatchResp struct {
Code int64 `json:"code,omitempty"` // 错误码,非 0 表示失败
Msg string `json:"msg,omitempty"` // 错误描述
Data *UpdateEmployeeTypeEnumPatchResp `json:"data,omitempty"`
}
type UpdateEmployeeTypeEnumPatchResp struct {
EmployeeTypeEnum *UpdateEmployeeTypeEnumPatchRespEmployeeTypeEnum `json:"employee_type_enum,omitempty"` // 更新后的人员类型字段
}
type UpdateEmployeeTypeEnumPatchRespEmployeeTypeEnum struct {
EnumID string `json:"enum_id,omitempty"` // 枚举值id
EnumValue string `json:"enum_value,omitempty"` // 枚举的编号值,创建新的人员类型后,系统生成对应编号。对应[创建用户接口](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/contact-v3/user/create)中用户信息的employee_type字段值
Content string `json:"content,omitempty"` // 枚举内容, 长度范围:`1` ~ `100` 字符
EnumType int64 `json:"enum_type,omitempty"` // 类型, 可选值有: `1`:内置类型, `2`:自定义
EnumStatus int64 `json:"enum_status,omitempty"` // 使用状态, 可选值有: `1`:激活, `2`:未激活
I18nContent *UpdateEmployeeTypeEnumPatchRespEmployeeTypeEnumI18nContent `json:"i18n_content,omitempty"` // i18n定义
}
type UpdateEmployeeTypeEnumPatchRespEmployeeTypeEnumI18nContent struct {
Locale string `json:"locale,omitempty"` // 语言版本
Value string `json:"value,omitempty"` // 字段名
}
// Code generated by lark_sdk_gen. DO NOT EDIT.
// DeleteContactGroup 通过该接口可删除企业中的用户组,请注意删除用户组时应用的通讯录权限范围需为“全部员工”,否则会删除失败,[点击了解通讯录权限范围](https://open.feishu.cn/document/ukTMukTMukTM/uETNz4SM1MjLxUzM/v3/guides/scope_authority)。