// Code generated by Lark OpenAPI.

package larkdirectory

import (
	"context"
	"github.com/larksuite/oapi-sdk-go/v3/core"
	"net/http"
)

type V1 struct {
	CollaborationRule       *collaborationRule       // collaboration_rule
	CollaborationTenant     *collaborationTenant     // collaboration_tenant
	CollborationShareEntity *collborationShareEntity // collboration_share_entity
	Department              *department              // department
	Employee                *employee                // employee
}

func New(config *larkcore.Config) *V1 {
	return &V1{
		CollaborationRule:       &collaborationRule{config: config},
		CollaborationTenant:     &collaborationTenant{config: config},
		CollborationShareEntity: &collborationShareEntity{config: config},
		Department:              &department{config: config},
		Employee:                &employee{config: config},
	}
}

type collaborationRule struct {
	config *larkcore.Config
}
type collaborationTenant struct {
	config *larkcore.Config
}
type collborationShareEntity struct {
	config *larkcore.Config
}
type department struct {
	config *larkcore.Config
}
type employee struct {
	config *larkcore.Config
}

// Create
//
// - 创建关联组织规则
//
// - 官网API文档链接:https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=create&project=directory&resource=collaboration_rule&version=v1
//
// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/directoryv1/create_collaborationRule.go
func (c *collaborationRule) Create(ctx context.Context, req *CreateCollaborationRuleReq, options ...larkcore.RequestOptionFunc) (*CreateCollaborationRuleResp, error) {
	// 发起请求
	apiReq := req.apiReq
	apiReq.ApiPath = "/open-apis/directory/v1/collaboration_rules"
	apiReq.HttpMethod = http.MethodPost
	apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeUser, larkcore.AccessTokenTypeTenant}
	apiResp, err := larkcore.Request(ctx, apiReq, c.config, options...)
	if err != nil {
		return nil, err
	}
	// 反序列响应结果
	resp := &CreateCollaborationRuleResp{ApiResp: apiResp}
	err = apiResp.JSONUnmarshalBody(resp, c.config)
	if err != nil {
		return nil, err
	}
	return resp, err
}

// Delete
//
// - 删除关联组织的规则
//
// - 官网API文档链接:https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=delete&project=directory&resource=collaboration_rule&version=v1
//
// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/directoryv1/delete_collaborationRule.go
func (c *collaborationRule) Delete(ctx context.Context, req *DeleteCollaborationRuleReq, options ...larkcore.RequestOptionFunc) (*DeleteCollaborationRuleResp, error) {
	// 发起请求
	apiReq := req.apiReq
	apiReq.ApiPath = "/open-apis/directory/v1/collaboration_rules/:collaboration_rule_id"
	apiReq.HttpMethod = http.MethodDelete
	apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeUser, larkcore.AccessTokenTypeTenant}
	apiResp, err := larkcore.Request(ctx, apiReq, c.config, options...)
	if err != nil {
		return nil, err
	}
	// 反序列响应结果
	resp := &DeleteCollaborationRuleResp{ApiResp: apiResp}
	err = apiResp.JSONUnmarshalBody(resp, c.config)
	if err != nil {
		return nil, err
	}
	return resp, err
}

// List
//
// - 获取关联组织规则列表
//
// - 官网API文档链接:https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=list&project=directory&resource=collaboration_rule&version=v1
//
// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/directoryv1/list_collaborationRule.go
func (c *collaborationRule) List(ctx context.Context, req *ListCollaborationRuleReq, options ...larkcore.RequestOptionFunc) (*ListCollaborationRuleResp, error) {
	// 发起请求
	apiReq := req.apiReq
	apiReq.ApiPath = "/open-apis/directory/v1/collaboration_rules"
	apiReq.HttpMethod = http.MethodGet
	apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeUser, larkcore.AccessTokenTypeTenant}
	apiResp, err := larkcore.Request(ctx, apiReq, c.config, options...)
	if err != nil {
		return nil, err
	}
	// 反序列响应结果
	resp := &ListCollaborationRuleResp{ApiResp: apiResp}
	err = apiResp.JSONUnmarshalBody(resp, c.config)
	if err != nil {
		return nil, err
	}
	return resp, err
}
func (c *collaborationRule) ListByIterator(ctx context.Context, req *ListCollaborationRuleReq, options ...larkcore.RequestOptionFunc) (*ListCollaborationRuleIterator, error) {
	return &ListCollaborationRuleIterator{
		ctx:      ctx,
		req:      req,
		listFunc: c.List,
		options:  options,
		limit:    req.Limit}, nil
}

// Update
//
// - 更新关联组织规则
//
// - 官网API文档链接:https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=update&project=directory&resource=collaboration_rule&version=v1
//
// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/directoryv1/update_collaborationRule.go
func (c *collaborationRule) Update(ctx context.Context, req *UpdateCollaborationRuleReq, options ...larkcore.RequestOptionFunc) (*UpdateCollaborationRuleResp, error) {
	// 发起请求
	apiReq := req.apiReq
	apiReq.ApiPath = "/open-apis/directory/v1/collaboration_rules/:collaboration_rule_id"
	apiReq.HttpMethod = http.MethodPut
	apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeUser, larkcore.AccessTokenTypeTenant}
	apiResp, err := larkcore.Request(ctx, apiReq, c.config, options...)
	if err != nil {
		return nil, err
	}
	// 反序列响应结果
	resp := &UpdateCollaborationRuleResp{ApiResp: apiResp}
	err = apiResp.JSONUnmarshalBody(resp, c.config)
	if err != nil {
		return nil, err
	}
	return resp, err
}

// List
//
// - 在创建规则时，需要知道对方租户的tenant key，为拿到有效的tenant key，这里提供一个专门给管理员获取关联组织租户的接口，该接口可以直接请求到所有关联组织列表。
//
// - 官网API文档链接:https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=list&project=directory&resource=collaboration_tenant&version=v1
//
// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/directoryv1/list_collaborationTenant.go
func (c *collaborationTenant) List(ctx context.Context, req *ListCollaborationTenantReq, options ...larkcore.RequestOptionFunc) (*ListCollaborationTenantResp, error) {
	// 发起请求
	apiReq := req.apiReq
	apiReq.ApiPath = "/open-apis/directory/v1/collaboration_tenants"
	apiReq.HttpMethod = http.MethodGet
	apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeUser, larkcore.AccessTokenTypeTenant}
	apiResp, err := larkcore.Request(ctx, apiReq, c.config, options...)
	if err != nil {
		return nil, err
	}
	// 反序列响应结果
	resp := &ListCollaborationTenantResp{ApiResp: apiResp}
	err = apiResp.JSONUnmarshalBody(resp, c.config)
	if err != nil {
		return nil, err
	}
	return resp, err
}
func (c *collaborationTenant) ListByIterator(ctx context.Context, req *ListCollaborationTenantReq, options ...larkcore.RequestOptionFunc) (*ListCollaborationTenantIterator, error) {
	return &ListCollaborationTenantIterator{
		ctx:      ctx,
		req:      req,
		listFunc: c.List,
		options:  options,
		limit:    req.Limit}, nil
}

// List
//
// - 获取双方租户分享的实体ID,完成可见性规则的设置
//
// - 官网API文档链接:https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=list&project=directory&resource=collboration_share_entity&version=v1
//
// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/directoryv1/list_collborationShareEntity.go
func (c *collborationShareEntity) List(ctx context.Context, req *ListCollborationShareEntityReq, options ...larkcore.RequestOptionFunc) (*ListCollborationShareEntityResp, error) {
	// 发起请求
	apiReq := req.apiReq
	apiReq.ApiPath = "/open-apis/directory/v1/share_entities"
	apiReq.HttpMethod = http.MethodGet
	apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeUser, larkcore.AccessTokenTypeTenant}
	apiResp, err := larkcore.Request(ctx, apiReq, c.config, options...)
	if err != nil {
		return nil, err
	}
	// 反序列响应结果
	resp := &ListCollborationShareEntityResp{ApiResp: apiResp}
	err = apiResp.JSONUnmarshalBody(resp, c.config)
	if err != nil {
		return nil, err
	}
	return resp, err
}

// Create
//
// - 创建部门信息
//
// - 官网API文档链接:https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=create&project=directory&resource=department&version=v1
//
// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/directoryv1/create_department.go
func (d *department) Create(ctx context.Context, req *CreateDepartmentReq, options ...larkcore.RequestOptionFunc) (*CreateDepartmentResp, error) {
	// 发起请求
	apiReq := req.apiReq
	apiReq.ApiPath = "/open-apis/directory/v1/departments"
	apiReq.HttpMethod = http.MethodPost
	apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeTenant, larkcore.AccessTokenTypeUser}
	apiResp, err := larkcore.Request(ctx, apiReq, d.config, options...)
	if err != nil {
		return nil, err
	}
	// 反序列响应结果
	resp := &CreateDepartmentResp{ApiResp: apiResp}
	err = apiResp.JSONUnmarshalBody(resp, d.config)
	if err != nil {
		return nil, err
	}
	return resp, err
}

// Delete
//
// - 删除部门信息
//
// - 官网API文档链接:https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=delete&project=directory&resource=department&version=v1
//
// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/directoryv1/delete_department.go
func (d *department) Delete(ctx context.Context, req *DeleteDepartmentReq, options ...larkcore.RequestOptionFunc) (*DeleteDepartmentResp, error) {
	// 发起请求
	apiReq := req.apiReq
	apiReq.ApiPath = "/open-apis/directory/v1/departments/:department_id"
	apiReq.HttpMethod = http.MethodDelete
	apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeUser, larkcore.AccessTokenTypeTenant}
	apiResp, err := larkcore.Request(ctx, apiReq, d.config, options...)
	if err != nil {
		return nil, err
	}
	// 反序列响应结果
	resp := &DeleteDepartmentResp{ApiResp: apiResp}
	err = apiResp.JSONUnmarshalBody(resp, d.config)
	if err != nil {
		return nil, err
	}
	return resp, err
}

// Filter
//
// - 查询部门ID列表
//
// - 官网API文档链接:https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=filter&project=directory&resource=department&version=v1
//
// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/directoryv1/filter_department.go
func (d *department) Filter(ctx context.Context, req *FilterDepartmentReq, options ...larkcore.RequestOptionFunc) (*FilterDepartmentResp, error) {
	// 发起请求
	apiReq := req.apiReq
	apiReq.ApiPath = "/open-apis/directory/v1/departments/filter"
	apiReq.HttpMethod = http.MethodPost
	apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeUser, larkcore.AccessTokenTypeTenant}
	apiResp, err := larkcore.Request(ctx, apiReq, d.config, options...)
	if err != nil {
		return nil, err
	}
	// 反序列响应结果
	resp := &FilterDepartmentResp{ApiResp: apiResp}
	err = apiResp.JSONUnmarshalBody(resp, d.config)
	if err != nil {
		return nil, err
	}
	return resp, err
}

// Mget
//
// - 查询部门
//
// - 官网API文档链接:https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=mget&project=directory&resource=department&version=v1
//
// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/directoryv1/mget_department.go
func (d *department) Mget(ctx context.Context, req *MgetDepartmentReq, options ...larkcore.RequestOptionFunc) (*MgetDepartmentResp, error) {
	// 发起请求
	apiReq := req.apiReq
	apiReq.ApiPath = "/open-apis/directory/v1/departments/mget"
	apiReq.HttpMethod = http.MethodPost
	apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeUser, larkcore.AccessTokenTypeTenant}
	apiResp, err := larkcore.Request(ctx, apiReq, d.config, options...)
	if err != nil {
		return nil, err
	}
	// 反序列响应结果
	resp := &MgetDepartmentResp{ApiResp: apiResp}
	err = apiResp.JSONUnmarshalBody(resp, d.config)
	if err != nil {
		return nil, err
	}
	return resp, err
}

// Patch
//
// - 更新部门信息
//
// - 官网API文档链接:https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=patch&project=directory&resource=department&version=v1
//
// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/directoryv1/patch_department.go
func (d *department) Patch(ctx context.Context, req *PatchDepartmentReq, options ...larkcore.RequestOptionFunc) (*PatchDepartmentResp, error) {
	// 发起请求
	apiReq := req.apiReq
	apiReq.ApiPath = "/open-apis/directory/v1/departments/:department_id"
	apiReq.HttpMethod = http.MethodPatch
	apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeUser, larkcore.AccessTokenTypeTenant}
	apiResp, err := larkcore.Request(ctx, apiReq, d.config, options...)
	if err != nil {
		return nil, err
	}
	// 反序列响应结果
	resp := &PatchDepartmentResp{ApiResp: apiResp}
	err = apiResp.JSONUnmarshalBody(resp, d.config)
	if err != nil {
		return nil, err
	}
	return resp, err
}

// Search
//
// - 搜索租户内部门
//
// - 官网API文档链接:https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=search&project=directory&resource=department&version=v1
//
// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/directoryv1/search_department.go
func (d *department) Search(ctx context.Context, req *SearchDepartmentReq, options ...larkcore.RequestOptionFunc) (*SearchDepartmentResp, error) {
	// 发起请求
	apiReq := req.apiReq
	apiReq.ApiPath = "/open-apis/directory/v1/departments/search"
	apiReq.HttpMethod = http.MethodPost
	apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeUser, larkcore.AccessTokenTypeTenant}
	apiResp, err := larkcore.Request(ctx, apiReq, d.config, options...)
	if err != nil {
		return nil, err
	}
	// 反序列响应结果
	resp := &SearchDepartmentResp{ApiResp: apiResp}
	err = apiResp.JSONUnmarshalBody(resp, d.config)
	if err != nil {
		return nil, err
	}
	return resp, err
}

// Create
//
// - 创建员工信息
//
// - 官网API文档链接:https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=create&project=directory&resource=employee&version=v1
//
// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/directoryv1/create_employee.go
func (e *employee) Create(ctx context.Context, req *CreateEmployeeReq, options ...larkcore.RequestOptionFunc) (*CreateEmployeeResp, error) {
	// 发起请求
	apiReq := req.apiReq
	apiReq.ApiPath = "/open-apis/directory/v1/employees"
	apiReq.HttpMethod = http.MethodPost
	apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeUser, larkcore.AccessTokenTypeTenant}
	apiResp, err := larkcore.Request(ctx, apiReq, e.config, options...)
	if err != nil {
		return nil, err
	}
	// 反序列响应结果
	resp := &CreateEmployeeResp{ApiResp: apiResp}
	err = apiResp.JSONUnmarshalBody(resp, e.config)
	if err != nil {
		return nil, err
	}
	return resp, err
}

// Delete
//
// - 离职员工信息
//
// - 官网API文档链接:https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=delete&project=directory&resource=employee&version=v1
//
// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/directoryv1/delete_employee.go
func (e *employee) Delete(ctx context.Context, req *DeleteEmployeeReq, options ...larkcore.RequestOptionFunc) (*DeleteEmployeeResp, error) {
	// 发起请求
	apiReq := req.apiReq
	apiReq.ApiPath = "/open-apis/directory/v1/employees/:employee_id"
	apiReq.HttpMethod = http.MethodDelete
	apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeUser, larkcore.AccessTokenTypeTenant}
	apiResp, err := larkcore.Request(ctx, apiReq, e.config, options...)
	if err != nil {
		return nil, err
	}
	// 反序列响应结果
	resp := &DeleteEmployeeResp{ApiResp: apiResp}
	err = apiResp.JSONUnmarshalBody(resp, e.config)
	if err != nil {
		return nil, err
	}
	return resp, err
}

// Filter
//
// - 查询员工ID列表
//
// - 官网API文档链接:https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=filter&project=directory&resource=employee&version=v1
//
// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/directoryv1/filter_employee.go
func (e *employee) Filter(ctx context.Context, req *FilterEmployeeReq, options ...larkcore.RequestOptionFunc) (*FilterEmployeeResp, error) {
	// 发起请求
	apiReq := req.apiReq
	apiReq.ApiPath = "/open-apis/directory/v1/employees/filter"
	apiReq.HttpMethod = http.MethodPost
	apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeUser, larkcore.AccessTokenTypeTenant}
	apiResp, err := larkcore.Request(ctx, apiReq, e.config, options...)
	if err != nil {
		return nil, err
	}
	// 反序列响应结果
	resp := &FilterEmployeeResp{ApiResp: apiResp}
	err = apiResp.JSONUnmarshalBody(resp, e.config)
	if err != nil {
		return nil, err
	}
	return resp, err
}

// Mget
//
// - 批量获取员工数据
//
// - 官网API文档链接:https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=mget&project=directory&resource=employee&version=v1
//
// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/directoryv1/mget_employee.go
func (e *employee) Mget(ctx context.Context, req *MgetEmployeeReq, options ...larkcore.RequestOptionFunc) (*MgetEmployeeResp, error) {
	// 发起请求
	apiReq := req.apiReq
	apiReq.ApiPath = "/open-apis/directory/v1/employees/mget"
	apiReq.HttpMethod = http.MethodPost
	apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeUser, larkcore.AccessTokenTypeTenant}
	apiResp, err := larkcore.Request(ctx, apiReq, e.config, options...)
	if err != nil {
		return nil, err
	}
	// 反序列响应结果
	resp := &MgetEmployeeResp{ApiResp: apiResp}
	err = apiResp.JSONUnmarshalBody(resp, e.config)
	if err != nil {
		return nil, err
	}
	return resp, err
}

// Patch
//
// - 更新员工信息
//
// - 官网API文档链接:https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=patch&project=directory&resource=employee&version=v1
//
// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/directoryv1/patch_employee.go
func (e *employee) Patch(ctx context.Context, req *PatchEmployeeReq, options ...larkcore.RequestOptionFunc) (*PatchEmployeeResp, error) {
	// 发起请求
	apiReq := req.apiReq
	apiReq.ApiPath = "/open-apis/directory/v1/employees/:employee_id"
	apiReq.HttpMethod = http.MethodPatch
	apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeUser, larkcore.AccessTokenTypeTenant}
	apiResp, err := larkcore.Request(ctx, apiReq, e.config, options...)
	if err != nil {
		return nil, err
	}
	// 反序列响应结果
	resp := &PatchEmployeeResp{ApiResp: apiResp}
	err = apiResp.JSONUnmarshalBody(resp, e.config)
	if err != nil {
		return nil, err
	}
	return resp, err
}

// Regular
//
// - 待离职雇员恢复成在职状态
//
// - 官网API文档链接:https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=regular&project=directory&resource=employee&version=v1
//
// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/directoryv1/regular_employee.go
func (e *employee) Regular(ctx context.Context, req *RegularEmployeeReq, options ...larkcore.RequestOptionFunc) (*RegularEmployeeResp, error) {
	// 发起请求
	apiReq := req.apiReq
	apiReq.ApiPath = "/open-apis/directory/v1/employees/:employee_id/regular"
	apiReq.HttpMethod = http.MethodPatch
	apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeUser, larkcore.AccessTokenTypeTenant}
	apiResp, err := larkcore.Request(ctx, apiReq, e.config, options...)
	if err != nil {
		return nil, err
	}
	// 反序列响应结果
	resp := &RegularEmployeeResp{ApiResp: apiResp}
	err = apiResp.JSONUnmarshalBody(resp, e.config)
	if err != nil {
		return nil, err
	}
	return resp, err
}

// Resurrect
//
// - 恢复员工信息
//
// - 官网API文档链接:https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=resurrect&project=directory&resource=employee&version=v1
//
// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/directoryv1/resurrect_employee.go
func (e *employee) Resurrect(ctx context.Context, req *ResurrectEmployeeReq, options ...larkcore.RequestOptionFunc) (*ResurrectEmployeeResp, error) {
	// 发起请求
	apiReq := req.apiReq
	apiReq.ApiPath = "/open-apis/directory/v1/employees/:employee_id/resurrect"
	apiReq.HttpMethod = http.MethodPost
	apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeUser, larkcore.AccessTokenTypeTenant}
	apiResp, err := larkcore.Request(ctx, apiReq, e.config, options...)
	if err != nil {
		return nil, err
	}
	// 反序列响应结果
	resp := &ResurrectEmployeeResp{ApiResp: apiResp}
	err = apiResp.JSONUnmarshalBody(resp, e.config)
	if err != nil {
		return nil, err
	}
	return resp, err
}

// Search
//
// - 搜索租户内员工
//
// - 官网API文档链接:https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=search&project=directory&resource=employee&version=v1
//
// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/directoryv1/search_employee.go
func (e *employee) Search(ctx context.Context, req *SearchEmployeeReq, options ...larkcore.RequestOptionFunc) (*SearchEmployeeResp, error) {
	// 发起请求
	apiReq := req.apiReq
	apiReq.ApiPath = "/open-apis/directory/v1/employees/search"
	apiReq.HttpMethod = http.MethodPost
	apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeUser, larkcore.AccessTokenTypeTenant}
	apiResp, err := larkcore.Request(ctx, apiReq, e.config, options...)
	if err != nil {
		return nil, err
	}
	// 反序列响应结果
	resp := &SearchEmployeeResp{ApiResp: apiResp}
	err = apiResp.JSONUnmarshalBody(resp, e.config)
	if err != nil {
		return nil, err
	}
	return resp, err
}

// ToBeResigned
//
// - 更新在职雇员到待离职状态
//
// - 官网API文档链接:https://open.feishu.cn/api-explorer?from=op_doc_tab&apiName=to_be_resigned&project=directory&resource=employee&version=v1
//
// - 使用Demo链接:https://github.com/larksuite/oapi-sdk-go/tree/v3_main/sample/apiall/directoryv1/toBeResigned_employee.go
func (e *employee) ToBeResigned(ctx context.Context, req *ToBeResignedEmployeeReq, options ...larkcore.RequestOptionFunc) (*ToBeResignedEmployeeResp, error) {
	// 发起请求
	apiReq := req.apiReq
	apiReq.ApiPath = "/open-apis/directory/v1/employees/:employee_id/to_be_resigned"
	apiReq.HttpMethod = http.MethodPatch
	apiReq.SupportedAccessTokenTypes = []larkcore.AccessTokenType{larkcore.AccessTokenTypeUser, larkcore.AccessTokenTypeTenant}
	apiResp, err := larkcore.Request(ctx, apiReq, e.config, options...)
	if err != nil {
		return nil, err
	}
	// 反序列响应结果
	resp := &ToBeResignedEmployeeResp{ApiResp: apiResp}
	err = apiResp.JSONUnmarshalBody(resp, e.config)
	if err != nil {
		return nil, err
	}
	return resp, err
}
