// Package search code generated by oapi sdk gen
/*
 * MIT License
 *
 * Copyright (c) 2022 Lark Technologies Pte. Ltd.
 *
 * 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:
 *
 * The above copyright notice and this permission notice, shall be included in all copies or substantial portions of the Software.
 *
 * 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.
 */

package larksearch

import (
	"fmt"

	"context"
	"errors"

	"github.com/larksuite/oapi-sdk-go/v3/core"
)

const (
	SearchAppUserIDTypeUserId  = "user_id"  // 以 user_id 来识别用户
	SearchAppUserIDTypeUnionId = "union_id" // 以 union_id 来识别用户
	SearchAppUserIDTypeOpenId  = "open_id"  // 以 open_id 来识别用户
)

const (
	DataSourceStateOnline  = 0 // 已上线
	DataSourceStateOffline = 1 // 未上线

)

const (
	ConnectTypeDefault  = 0 // 调用搜索请求时，使用的是飞书搜索接口
	ConnectTypeCallback = 1 // 调用搜索请求时，使用的是自定义回调函数的Uri

)

const (
	ListDataSourceViewFULL  = 0 // 全量数据
	ListDataSourceViewBASIC = 1 // 摘要数据

)

const (
	PatchDataSourceStateOnline  = 0 // 已上线
	PatchDataSourceStateOffline = 1 // 未上线

)

const (
	SearchMessageMessageTypeFile  = "file"  // 文件
	SearchMessageMessageTypeImage = "image" // 图片
	SearchMessageMessageTypeMedia = "media" // 视频
)

const (
	SearchMessageFromTypeBot  = "bot"  // 机器人
	SearchMessageFromTypeUser = "user" // 用户
)

const (
	SearchMessageChatTypeGroupChat = "group_chat" // 群聊
	SearchMessageChatTypeP2pChat   = "p2p_chat"   // 单聊
)

const (
	SearchMessageUserIDTypeUserId  = "user_id"  // 以 user_id 来识别用户
	SearchMessageUserIDTypeUnionId = "union_id" // 以 union_id 来识别用户
	SearchMessageUserIDTypeOpenId  = "open_id"  // 以 open_id 来识别用户
)

type Acl struct {
	Access *string `json:"access,omitempty"` // 权限类型，优先级：Deny > Allow。

	Value *string `json:"value,omitempty"` // 设置的权限值，例如 userID ，依赖 type 描述。;;**注**：在 type 为 user 且 access 为 allow 时，可填 "everyone" 来表示该数据项对全员可见；

	Type *string `json:"type,omitempty"` // 权限值类型
}

type AclBuilder struct {
	access     string // 权限类型，优先级：Deny > Allow。
	accessFlag bool

	value     string // 设置的权限值，例如 userID ，依赖 type 描述。;;**注**：在 type 为 user 且 access 为 allow 时，可填 "everyone" 来表示该数据项对全员可见；
	valueFlag bool

	type_    string // 权限值类型
	typeFlag bool
}

func NewAclBuilder() *AclBuilder {
	builder := &AclBuilder{}
	return builder
}

// 权限类型，优先级：Deny > Allow。
//
// 示例值：allow
func (builder *AclBuilder) Access(access string) *AclBuilder {
	builder.access = access
	builder.accessFlag = true
	return builder
}

// 设置的权限值，例如 userID ，依赖 type 描述。;;**注**：在 type 为 user 且 access 为 allow 时，可填 "everyone" 来表示该数据项对全员可见；
//
// 示例值：d35e3c23
func (builder *AclBuilder) Value(value string) *AclBuilder {
	builder.value = value
	builder.valueFlag = true
	return builder
}

// 权限值类型
//
// 示例值：user
func (builder *AclBuilder) Type(type_ string) *AclBuilder {
	builder.type_ = type_
	builder.typeFlag = true
	return builder
}

func (builder *AclBuilder) Build() *Acl {
	req := &Acl{}
	if builder.accessFlag {
		req.Access = &builder.access

	}
	if builder.valueFlag {
		req.Value = &builder.value

	}
	if builder.typeFlag {
		req.Type = &builder.type_

	}
	return req
}

type BatchItemResult struct {
	ItemId *string `json:"item_id,omitempty"` // 数据项ID，对应一条索引数据的ID

	IsSuccess *bool `json:"is_success,omitempty"` // 判断单条数据是否成功

	Err *string `json:"err,omitempty"` // 如果单条数据失败，表示单条数据的错误信息；如果单条数据成功被索引，则err是空字符串
}

type BatchItemResultBuilder struct {
	itemId     string // 数据项ID，对应一条索引数据的ID
	itemIdFlag bool

	isSuccess     bool // 判断单条数据是否成功
	isSuccessFlag bool

	err     string // 如果单条数据失败，表示单条数据的错误信息；如果单条数据成功被索引，则err是空字符串
	errFlag bool
}

func NewBatchItemResultBuilder() *BatchItemResultBuilder {
	builder := &BatchItemResultBuilder{}
	return builder
}

// 数据项ID，对应一条索引数据的ID
//
// 示例值：
func (builder *BatchItemResultBuilder) ItemId(itemId string) *BatchItemResultBuilder {
	builder.itemId = itemId
	builder.itemIdFlag = true
	return builder
}

// 判断单条数据是否成功
//
// 示例值：
func (builder *BatchItemResultBuilder) IsSuccess(isSuccess bool) *BatchItemResultBuilder {
	builder.isSuccess = isSuccess
	builder.isSuccessFlag = true
	return builder
}

// 如果单条数据失败，表示单条数据的错误信息；如果单条数据成功被索引，则err是空字符串
//
// 示例值：
func (builder *BatchItemResultBuilder) Err(err string) *BatchItemResultBuilder {
	builder.err = err
	builder.errFlag = true
	return builder
}

func (builder *BatchItemResultBuilder) Build() *BatchItemResult {
	req := &BatchItemResult{}
	if builder.itemIdFlag {
		req.ItemId = &builder.itemId

	}
	if builder.isSuccessFlag {
		req.IsSuccess = &builder.isSuccess

	}
	if builder.errFlag {
		req.Err = &builder.err

	}
	return req
}

type CallbackAction struct {
	Tag *string `json:"tag,omitempty"` // tag

	Value *CallbackActionValue `json:"value,omitempty"` // CallbackActionValue
}

type CallbackActionBuilder struct {
	tag     string // tag
	tagFlag bool

	value     *CallbackActionValue // CallbackActionValue
	valueFlag bool
}

func NewCallbackActionBuilder() *CallbackActionBuilder {
	builder := &CallbackActionBuilder{}
	return builder
}

// tag
//
// 示例值：""
func (builder *CallbackActionBuilder) Tag(tag string) *CallbackActionBuilder {
	builder.tag = tag
	builder.tagFlag = true
	return builder
}

// CallbackActionValue
//
// 示例值：
func (builder *CallbackActionBuilder) Value(value *CallbackActionValue) *CallbackActionBuilder {
	builder.value = value
	builder.valueFlag = true
	return builder
}

func (builder *CallbackActionBuilder) Build() *CallbackAction {
	req := &CallbackAction{}
	if builder.tagFlag {
		req.Tag = &builder.tag

	}
	if builder.valueFlag {
		req.Value = builder.value
	}
	return req
}

type CallbackActionValue struct {
	StrategyInfo *string `json:"strategy_info,omitempty"` // strategy_info

	AgentId *string `json:"agent_id,omitempty"` // agent_id

	AgentType *int `json:"agent_type,omitempty"` // agent_type

	ResponseType *int `json:"response_type,omitempty"` // response_type

	SessionId *string `json:"session_id,omitempty"` // 当前会话的 id，需要透传到下一次请求中
}

type CallbackActionValueBuilder struct {
	strategyInfo     string // strategy_info
	strategyInfoFlag bool

	agentId     string // agent_id
	agentIdFlag bool

	agentType     int // agent_type
	agentTypeFlag bool

	responseType     int // response_type
	responseTypeFlag bool

	sessionId     string // 当前会话的 id，需要透传到下一次请求中
	sessionIdFlag bool
}

func NewCallbackActionValueBuilder() *CallbackActionValueBuilder {
	builder := &CallbackActionValueBuilder{}
	return builder
}

// strategy_info
//
// 示例值：""
func (builder *CallbackActionValueBuilder) StrategyInfo(strategyInfo string) *CallbackActionValueBuilder {
	builder.strategyInfo = strategyInfo
	builder.strategyInfoFlag = true
	return builder
}

// agent_id
//
// 示例值：""
func (builder *CallbackActionValueBuilder) AgentId(agentId string) *CallbackActionValueBuilder {
	builder.agentId = agentId
	builder.agentIdFlag = true
	return builder
}

// agent_type
//
// 示例值：1
func (builder *CallbackActionValueBuilder) AgentType(agentType int) *CallbackActionValueBuilder {
	builder.agentType = agentType
	builder.agentTypeFlag = true
	return builder
}

// response_type
//
// 示例值：1
func (builder *CallbackActionValueBuilder) ResponseType(responseType int) *CallbackActionValueBuilder {
	builder.responseType = responseType
	builder.responseTypeFlag = true
	return builder
}

// 当前会话的 id，需要透传到下一次请求中
//
// 示例值：“”
func (builder *CallbackActionValueBuilder) SessionId(sessionId string) *CallbackActionValueBuilder {
	builder.sessionId = sessionId
	builder.sessionIdFlag = true
	return builder
}

func (builder *CallbackActionValueBuilder) Build() *CallbackActionValue {
	req := &CallbackActionValue{}
	if builder.strategyInfoFlag {
		req.StrategyInfo = &builder.strategyInfo

	}
	if builder.agentIdFlag {
		req.AgentId = &builder.agentId

	}
	if builder.agentTypeFlag {
		req.AgentType = &builder.agentType

	}
	if builder.responseTypeFlag {
		req.ResponseType = &builder.responseType

	}
	if builder.sessionIdFlag {
		req.SessionId = &builder.sessionId

	}
	return req
}

type CardCallbackRequest struct {
	OpenChatId *string `json:"open_chat_id,omitempty"` // open_chat_id

	OpenMessageId *string `json:"open_message_id,omitempty"` // open_message_id

	Token *string `json:"token,omitempty"` // token

	Action *CallbackAction `json:"action,omitempty"` // CallbackAction
}

type CardCallbackRequestBuilder struct {
	openChatId     string // open_chat_id
	openChatIdFlag bool

	openMessageId     string // open_message_id
	openMessageIdFlag bool

	token     string // token
	tokenFlag bool

	action     *CallbackAction // CallbackAction
	actionFlag bool
}

func NewCardCallbackRequestBuilder() *CardCallbackRequestBuilder {
	builder := &CardCallbackRequestBuilder{}
	return builder
}

// open_chat_id
//
// 示例值：""
func (builder *CardCallbackRequestBuilder) OpenChatId(openChatId string) *CardCallbackRequestBuilder {
	builder.openChatId = openChatId
	builder.openChatIdFlag = true
	return builder
}

// open_message_id
//
// 示例值：""
func (builder *CardCallbackRequestBuilder) OpenMessageId(openMessageId string) *CardCallbackRequestBuilder {
	builder.openMessageId = openMessageId
	builder.openMessageIdFlag = true
	return builder
}

// token
//
// 示例值：""
func (builder *CardCallbackRequestBuilder) Token(token string) *CardCallbackRequestBuilder {
	builder.token = token
	builder.tokenFlag = true
	return builder
}

// CallbackAction
//
// 示例值：
func (builder *CardCallbackRequestBuilder) Action(action *CallbackAction) *CardCallbackRequestBuilder {
	builder.action = action
	builder.actionFlag = true
	return builder
}

func (builder *CardCallbackRequestBuilder) Build() *CardCallbackRequest {
	req := &CardCallbackRequest{}
	if builder.openChatIdFlag {
		req.OpenChatId = &builder.openChatId

	}
	if builder.openMessageIdFlag {
		req.OpenMessageId = &builder.openMessageId

	}
	if builder.tokenFlag {
		req.Token = &builder.token

	}
	if builder.actionFlag {
		req.Action = builder.action
	}
	return req
}

type Chunk struct {
	ChunkId *string `json:"chunk_id,omitempty"` // 文本块的唯一标识

	DocId *string `json:"doc_id,omitempty"` // 文档的唯一标识

	DatasetId *string `json:"dataset_id,omitempty"` // 该文档对应的数据集id

	UpdateTime *string `json:"update_time,omitempty"` // 更新时间，精确到秒级

	Content *string `json:"content,omitempty"` // 需要向量化的文本内容

	FilterData *string `json:"filter_data,omitempty"` // 数据集对应filter_shema的值

	Score *float64 `json:"score,omitempty"` // 排序模型返回的分数

	TokenNum *int `json:"token_num,omitempty"` // 文本块的token数

	Overlength *bool `json:"overlength,omitempty"` // 文本块的长度是否超过阈值
}

type ChunkBuilder struct {
	chunkId     string // 文本块的唯一标识
	chunkIdFlag bool

	docId     string // 文档的唯一标识
	docIdFlag bool

	datasetId     string // 该文档对应的数据集id
	datasetIdFlag bool

	updateTime     string // 更新时间，精确到秒级
	updateTimeFlag bool

	content     string // 需要向量化的文本内容
	contentFlag bool

	filterData     string // 数据集对应filter_shema的值
	filterDataFlag bool

	score     float64 // 排序模型返回的分数
	scoreFlag bool

	tokenNum     int // 文本块的token数
	tokenNumFlag bool

	overlength     bool // 文本块的长度是否超过阈值
	overlengthFlag bool
}

func NewChunkBuilder() *ChunkBuilder {
	builder := &ChunkBuilder{}
	return builder
}

// 文本块的唯一标识
//
// 示例值：3953903108179099661
func (builder *ChunkBuilder) ChunkId(chunkId string) *ChunkBuilder {
	builder.chunkId = chunkId
	builder.chunkIdFlag = true
	return builder
}

// 文档的唯一标识
//
// 示例值：3953903108179099667
func (builder *ChunkBuilder) DocId(docId string) *ChunkBuilder {
	builder.docId = docId
	builder.docIdFlag = true
	return builder
}

// 该文档对应的数据集id
//
// 示例值：6953903108179099667
func (builder *ChunkBuilder) DatasetId(datasetId string) *ChunkBuilder {
	builder.datasetId = datasetId
	builder.datasetIdFlag = true
	return builder
}

// 更新时间，精确到秒级
//
// 示例值：1990-12-31T23:59:60Z
func (builder *ChunkBuilder) UpdateTime(updateTime string) *ChunkBuilder {
	builder.updateTime = updateTime
	builder.updateTimeFlag = true
	return builder
}

// 需要向量化的文本内容
//
// 示例值：这是一段纯文本内容
func (builder *ChunkBuilder) Content(content string) *ChunkBuilder {
	builder.content = content
	builder.contentFlag = true
	return builder
}

// 数据集对应filter_shema的值
//
// 示例值：{\"domains\": [\"domain1\"],\"versions\": [\"v1\"]}
func (builder *ChunkBuilder) FilterData(filterData string) *ChunkBuilder {
	builder.filterData = filterData
	builder.filterDataFlag = true
	return builder
}

// 排序模型返回的分数
//
// 示例值：0.9
func (builder *ChunkBuilder) Score(score float64) *ChunkBuilder {
	builder.score = score
	builder.scoreFlag = true
	return builder
}

// 文本块的token数
//
// 示例值：480
func (builder *ChunkBuilder) TokenNum(tokenNum int) *ChunkBuilder {
	builder.tokenNum = tokenNum
	builder.tokenNumFlag = true
	return builder
}

// 文本块的长度是否超过阈值
//
// 示例值：false
func (builder *ChunkBuilder) Overlength(overlength bool) *ChunkBuilder {
	builder.overlength = overlength
	builder.overlengthFlag = true
	return builder
}

func (builder *ChunkBuilder) Build() *Chunk {
	req := &Chunk{}
	if builder.chunkIdFlag {
		req.ChunkId = &builder.chunkId

	}
	if builder.docIdFlag {
		req.DocId = &builder.docId

	}
	if builder.datasetIdFlag {
		req.DatasetId = &builder.datasetId

	}
	if builder.updateTimeFlag {
		req.UpdateTime = &builder.updateTime

	}
	if builder.contentFlag {
		req.Content = &builder.content

	}
	if builder.filterDataFlag {
		req.FilterData = &builder.filterData

	}
	if builder.scoreFlag {
		req.Score = &builder.score

	}
	if builder.tokenNumFlag {
		req.TokenNum = &builder.tokenNum

	}
	if builder.overlengthFlag {
		req.Overlength = &builder.overlength

	}
	return req
}

type ConnectDataSource struct {
	ServiceUrl *string `json:"service_url,omitempty"` // 要托管的服务API地址，例如https://open.feishu.cn/xxxx/xxxx

	ProjectName *string `json:"project_name,omitempty"` // 项目地址，只能包含小写字母，如bytedance_test

	DisplayName *string `json:"display_name,omitempty"` // datasource名称，会展示在飞书搜索分类按钮（searchTab）中，如：公司wiki

	Description *string `json:"description,omitempty"` // 描述datasource

	IconUrl *string `json:"icon_url,omitempty"` // 图标

	ProjectDescription *string `json:"project_description,omitempty"` // 托管api的描述

	ContactEmail *string `json:"contact_email,omitempty"` // 联系人邮箱，开发人员的邮箱，用于托管API的SLA（Service Level Agreement）问题沟通

	TenantName *string `json:"tenant_name,omitempty"` // 创建api的组织名称，对企业开发者来说，建议使用企业名称
}

type ConnectDataSourceBuilder struct {
	serviceUrl     string // 要托管的服务API地址，例如https://open.feishu.cn/xxxx/xxxx
	serviceUrlFlag bool

	projectName     string // 项目地址，只能包含小写字母，如bytedance_test
	projectNameFlag bool

	displayName     string // datasource名称，会展示在飞书搜索分类按钮（searchTab）中，如：公司wiki
	displayNameFlag bool

	description     string // 描述datasource
	descriptionFlag bool

	iconUrl     string // 图标
	iconUrlFlag bool

	projectDescription     string // 托管api的描述
	projectDescriptionFlag bool

	contactEmail     string // 联系人邮箱，开发人员的邮箱，用于托管API的SLA（Service Level Agreement）问题沟通
	contactEmailFlag bool

	tenantName     string // 创建api的组织名称，对企业开发者来说，建议使用企业名称
	tenantNameFlag bool
}

func NewConnectDataSourceBuilder() *ConnectDataSourceBuilder {
	builder := &ConnectDataSourceBuilder{}
	return builder
}

// 要托管的服务API地址，例如https://open.feishu.cn/xxxx/xxxx
//
// 示例值：
func (builder *ConnectDataSourceBuilder) ServiceUrl(serviceUrl string) *ConnectDataSourceBuilder {
	builder.serviceUrl = serviceUrl
	builder.serviceUrlFlag = true
	return builder
}

// 项目地址，只能包含小写字母，如bytedance_test
//
// 示例值：
func (builder *ConnectDataSourceBuilder) ProjectName(projectName string) *ConnectDataSourceBuilder {
	builder.projectName = projectName
	builder.projectNameFlag = true
	return builder
}

// datasource名称，会展示在飞书搜索分类按钮（searchTab）中，如：公司wiki
//
// 示例值：
func (builder *ConnectDataSourceBuilder) DisplayName(displayName string) *ConnectDataSourceBuilder {
	builder.displayName = displayName
	builder.displayNameFlag = true
	return builder
}

// 描述datasource
//
// 示例值：
func (builder *ConnectDataSourceBuilder) Description(description string) *ConnectDataSourceBuilder {
	builder.description = description
	builder.descriptionFlag = true
	return builder
}

// 图标
//
// 示例值：
func (builder *ConnectDataSourceBuilder) IconUrl(iconUrl string) *ConnectDataSourceBuilder {
	builder.iconUrl = iconUrl
	builder.iconUrlFlag = true
	return builder
}

// 托管api的描述
//
// 示例值：
func (builder *ConnectDataSourceBuilder) ProjectDescription(projectDescription string) *ConnectDataSourceBuilder {
	builder.projectDescription = projectDescription
	builder.projectDescriptionFlag = true
	return builder
}

// 联系人邮箱，开发人员的邮箱，用于托管API的SLA（Service Level Agreement）问题沟通
//
// 示例值：
func (builder *ConnectDataSourceBuilder) ContactEmail(contactEmail string) *ConnectDataSourceBuilder {
	builder.contactEmail = contactEmail
	builder.contactEmailFlag = true
	return builder
}

// 创建api的组织名称，对企业开发者来说，建议使用企业名称
//
// 示例值：
func (builder *ConnectDataSourceBuilder) TenantName(tenantName string) *ConnectDataSourceBuilder {
	builder.tenantName = tenantName
	builder.tenantNameFlag = true
	return builder
}

func (builder *ConnectDataSourceBuilder) Build() *ConnectDataSource {
	req := &ConnectDataSource{}
	if builder.serviceUrlFlag {
		req.ServiceUrl = &builder.serviceUrl

	}
	if builder.projectNameFlag {
		req.ProjectName = &builder.projectName

	}
	if builder.displayNameFlag {
		req.DisplayName = &builder.displayName

	}
	if builder.descriptionFlag {
		req.Description = &builder.description

	}
	if builder.iconUrlFlag {
		req.IconUrl = &builder.iconUrl

	}
	if builder.projectDescriptionFlag {
		req.ProjectDescription = &builder.projectDescription

	}
	if builder.contactEmailFlag {
		req.ContactEmail = &builder.contactEmail

	}
	if builder.tenantNameFlag {
		req.TenantName = &builder.tenantName

	}
	return req
}

type ConnectorParam struct {
	CallbackUserIdType *int `json:"callback_user_id_type,omitempty"` // 回调时Request里面的id类型

	CallbackEndpoint *string `json:"callback_endpoint,omitempty"` // 回调时的地址，必须为POST地址
}

type ConnectorParamBuilder struct {
	callbackUserIdType     int // 回调时Request里面的id类型
	callbackUserIdTypeFlag bool

	callbackEndpoint     string // 回调时的地址，必须为POST地址
	callbackEndpointFlag bool
}

func NewConnectorParamBuilder() *ConnectorParamBuilder {
	builder := &ConnectorParamBuilder{}
	return builder
}

// 回调时Request里面的id类型
//
// 示例值：1
func (builder *ConnectorParamBuilder) CallbackUserIdType(callbackUserIdType int) *ConnectorParamBuilder {
	builder.callbackUserIdType = callbackUserIdType
	builder.callbackUserIdTypeFlag = true
	return builder
}

// 回调时的地址，必须为POST地址
//
// 示例值：https://open.approval.cn/api/search
func (builder *ConnectorParamBuilder) CallbackEndpoint(callbackEndpoint string) *ConnectorParamBuilder {
	builder.callbackEndpoint = callbackEndpoint
	builder.callbackEndpointFlag = true
	return builder
}

func (builder *ConnectorParamBuilder) Build() *ConnectorParam {
	req := &ConnectorParam{}
	if builder.callbackUserIdTypeFlag {
		req.CallbackUserIdType = &builder.callbackUserIdType

	}
	if builder.callbackEndpointFlag {
		req.CallbackEndpoint = &builder.callbackEndpoint

	}
	return req
}

type CreateDocParam struct {
	DocId *string `json:"doc_id,omitempty"` // 文档的唯一标识，只允许英文字母、数字和下划线

	FilterData *string `json:"filter_data,omitempty"` // 文档对应filter_schema的值

	Content *string `json:"content,omitempty"` // 需要向量化的文本内容

	Chunks []string `json:"chunks,omitempty"` // 文本块列表

	OverlengthHandleType *int `json:"overlength_handle_type,omitempty"` // 如果文本块超过最大长度的话，确定返回错误还是进行截断，默认是返回错误
}

type CreateDocParamBuilder struct {
	docId     string // 文档的唯一标识，只允许英文字母、数字和下划线
	docIdFlag bool

	filterData     string // 文档对应filter_schema的值
	filterDataFlag bool

	content     string // 需要向量化的文本内容
	contentFlag bool

	chunks     []string // 文本块列表
	chunksFlag bool

	overlengthHandleType     int // 如果文本块超过最大长度的话，确定返回错误还是进行截断，默认是返回错误
	overlengthHandleTypeFlag bool
}

func NewCreateDocParamBuilder() *CreateDocParamBuilder {
	builder := &CreateDocParamBuilder{}
	return builder
}

// 文档的唯一标识，只允许英文字母、数字和下划线
//
// 示例值：3953903108179099667
func (builder *CreateDocParamBuilder) DocId(docId string) *CreateDocParamBuilder {
	builder.docId = docId
	builder.docIdFlag = true
	return builder
}

// 文档对应filter_schema的值
//
// 示例值：{\"domains\": [\"domain1\"],\"versions\": [\"v1\"]}
func (builder *CreateDocParamBuilder) FilterData(filterData string) *CreateDocParamBuilder {
	builder.filterData = filterData
	builder.filterDataFlag = true
	return builder
}

// 需要向量化的文本内容
//
// 示例值：这是一段纯文本内容，模型会将这段话变成向量
func (builder *CreateDocParamBuilder) Content(content string) *CreateDocParamBuilder {
	builder.content = content
	builder.contentFlag = true
	return builder
}

// 文本块列表
//
// 示例值：
func (builder *CreateDocParamBuilder) Chunks(chunks []string) *CreateDocParamBuilder {
	builder.chunks = chunks
	builder.chunksFlag = true
	return builder
}

// 如果文本块超过最大长度的话，确定返回错误还是进行截断，默认是返回错误
//
// 示例值：1
func (builder *CreateDocParamBuilder) OverlengthHandleType(overlengthHandleType int) *CreateDocParamBuilder {
	builder.overlengthHandleType = overlengthHandleType
	builder.overlengthHandleTypeFlag = true
	return builder
}

func (builder *CreateDocParamBuilder) Build() *CreateDocParam {
	req := &CreateDocParam{}
	if builder.docIdFlag {
		req.DocId = &builder.docId

	}
	if builder.filterDataFlag {
		req.FilterData = &builder.filterData

	}
	if builder.contentFlag {
		req.Content = &builder.content

	}
	if builder.chunksFlag {
		req.Chunks = builder.chunks
	}
	if builder.overlengthHandleTypeFlag {
		req.OverlengthHandleType = &builder.overlengthHandleType

	}
	return req
}

type DataSource struct {
	Id *string `json:"id,omitempty"` // 数据源的唯一标识

	Name *string `json:"name,omitempty"` // data_source的展示名称

	State *int `json:"state,omitempty"` // 数据源状态，0-已上线，1-未上线。如果未填，默认是未上线状态。

	Description *string `json:"description,omitempty"` // 对于数据源的描述

	CreateTime *string `json:"create_time,omitempty"` // 创建时间，使用Unix时间戳，单位为“秒”

	UpdateTime *string `json:"update_time,omitempty"` // 更新时间，使用Unix时间戳，单位为“秒”

	IsExceedQuota *bool `json:"is_exceed_quota,omitempty"` // 是否超限

	IconUrl *string `json:"icon_url,omitempty"` // 数据源在 search tab 上的展示图标路径

	Template *string `json:"template,omitempty"` // 数据源采用的展示模版名称

	SearchableFields []string `json:"searchable_fields,omitempty"` // 【已废弃，如有定制需要请使用“数据范式”接口】描述哪些字段可以被搜索

	I18nName *I18nMeta `json:"i18n_name,omitempty"` // 数据源的国际化展示名称

	I18nDescription *I18nMeta `json:"i18n_description,omitempty"` // 数据源的国际化描述

	SchemaId *string `json:"schema_id,omitempty"` // 数据源关联的 schema 标识

	AppId *string `json:"app_id,omitempty"` // datasource对应的开放平台应用id

	ConnectType *int `json:"connect_type,omitempty"` // 搜索请求的接入方式

	ConnectorParam *ConnectorParam `json:"connector_param,omitempty"` // 根据连接器类型不同所需要提供的相关参数

	EnableAnswer *bool `json:"enable_answer,omitempty"` // 是否使用问答服务
}

type DataSourceBuilder struct {
	id     string // 数据源的唯一标识
	idFlag bool

	name     string // data_source的展示名称
	nameFlag bool

	state     int // 数据源状态，0-已上线，1-未上线。如果未填，默认是未上线状态。
	stateFlag bool

	description     string // 对于数据源的描述
	descriptionFlag bool

	createTime     string // 创建时间，使用Unix时间戳，单位为“秒”
	createTimeFlag bool

	updateTime     string // 更新时间，使用Unix时间戳，单位为“秒”
	updateTimeFlag bool

	isExceedQuota     bool // 是否超限
	isExceedQuotaFlag bool

	iconUrl     string // 数据源在 search tab 上的展示图标路径
	iconUrlFlag bool

	template     string // 数据源采用的展示模版名称
	templateFlag bool

	searchableFields     []string // 【已废弃，如有定制需要请使用“数据范式”接口】描述哪些字段可以被搜索
	searchableFieldsFlag bool

	i18nName     *I18nMeta // 数据源的国际化展示名称
	i18nNameFlag bool

	i18nDescription     *I18nMeta // 数据源的国际化描述
	i18nDescriptionFlag bool

	schemaId     string // 数据源关联的 schema 标识
	schemaIdFlag bool

	appId     string // datasource对应的开放平台应用id
	appIdFlag bool

	connectType     int // 搜索请求的接入方式
	connectTypeFlag bool

	connectorParam     *ConnectorParam // 根据连接器类型不同所需要提供的相关参数
	connectorParamFlag bool

	enableAnswer     bool // 是否使用问答服务
	enableAnswerFlag bool
}

func NewDataSourceBuilder() *DataSourceBuilder {
	builder := &DataSourceBuilder{}
	return builder
}

// 数据源的唯一标识
//
// 示例值：5577006791947779410
func (builder *DataSourceBuilder) Id(id string) *DataSourceBuilder {
	builder.id = id
	builder.idFlag = true
	return builder
}

// data_source的展示名称
//
// 示例值：客服工单
func (builder *DataSourceBuilder) Name(name string) *DataSourceBuilder {
	builder.name = name
	builder.nameFlag = true
	return builder
}

// 数据源状态，0-已上线，1-未上线。如果未填，默认是未上线状态。
//
// 示例值：0
func (builder *DataSourceBuilder) State(state int) *DataSourceBuilder {
	builder.state = state
	builder.stateFlag = true
	return builder
}

// 对于数据源的描述
//
// 示例值：搜索客服工单数据
func (builder *DataSourceBuilder) Description(description string) *DataSourceBuilder {
	builder.description = description
	builder.descriptionFlag = true
	return builder
}

// 创建时间，使用Unix时间戳，单位为“秒”
//
// 示例值：1674309260
func (builder *DataSourceBuilder) CreateTime(createTime string) *DataSourceBuilder {
	builder.createTime = createTime
	builder.createTimeFlag = true
	return builder
}

// 更新时间，使用Unix时间戳，单位为“秒”
//
// 示例值：1674309260
func (builder *DataSourceBuilder) UpdateTime(updateTime string) *DataSourceBuilder {
	builder.updateTime = updateTime
	builder.updateTimeFlag = true
	return builder
}

// 是否超限
//
// 示例值：false
func (builder *DataSourceBuilder) IsExceedQuota(isExceedQuota bool) *DataSourceBuilder {
	builder.isExceedQuota = isExceedQuota
	builder.isExceedQuotaFlag = true
	return builder
}

// 数据源在 search tab 上的展示图标路径
//
// 示例值：https://www.xxx.com/open.jpg
func (builder *DataSourceBuilder) IconUrl(iconUrl string) *DataSourceBuilder {
	builder.iconUrl = iconUrl
	builder.iconUrlFlag = true
	return builder
}

// 数据源采用的展示模版名称
//
// 示例值：search_common_card
func (builder *DataSourceBuilder) Template(template string) *DataSourceBuilder {
	builder.template = template
	builder.templateFlag = true
	return builder
}

// 【已废弃，如有定制需要请使用“数据范式”接口】描述哪些字段可以被搜索
//
// 示例值：【已废弃，如有定制需要请使用“数据范式”接口】["field1", "field2"]
func (builder *DataSourceBuilder) SearchableFields(searchableFields []string) *DataSourceBuilder {
	builder.searchableFields = searchableFields
	builder.searchableFieldsFlag = true
	return builder
}

// 数据源的国际化展示名称
//
// 示例值：
func (builder *DataSourceBuilder) I18nName(i18nName *I18nMeta) *DataSourceBuilder {
	builder.i18nName = i18nName
	builder.i18nNameFlag = true
	return builder
}

// 数据源的国际化描述
//
// 示例值：
func (builder *DataSourceBuilder) I18nDescription(i18nDescription *I18nMeta) *DataSourceBuilder {
	builder.i18nDescription = i18nDescription
	builder.i18nDescriptionFlag = true
	return builder
}

// 数据源关联的 schema 标识
//
// 示例值：custom_schema
func (builder *DataSourceBuilder) SchemaId(schemaId string) *DataSourceBuilder {
	builder.schemaId = schemaId
	builder.schemaIdFlag = true
	return builder
}

// datasource对应的开放平台应用id
//
// 示例值：cli_a1306bed4738d01b
func (builder *DataSourceBuilder) AppId(appId string) *DataSourceBuilder {
	builder.appId = appId
	builder.appIdFlag = true
	return builder
}

// 搜索请求的接入方式
//
// 示例值：1
func (builder *DataSourceBuilder) ConnectType(connectType int) *DataSourceBuilder {
	builder.connectType = connectType
	builder.connectTypeFlag = true
	return builder
}

// 根据连接器类型不同所需要提供的相关参数
//
// 示例值：
func (builder *DataSourceBuilder) ConnectorParam(connectorParam *ConnectorParam) *DataSourceBuilder {
	builder.connectorParam = connectorParam
	builder.connectorParamFlag = true
	return builder
}

// 是否使用问答服务
//
// 示例值：false
func (builder *DataSourceBuilder) EnableAnswer(enableAnswer bool) *DataSourceBuilder {
	builder.enableAnswer = enableAnswer
	builder.enableAnswerFlag = true
	return builder
}

func (builder *DataSourceBuilder) Build() *DataSource {
	req := &DataSource{}
	if builder.idFlag {
		req.Id = &builder.id

	}
	if builder.nameFlag {
		req.Name = &builder.name

	}
	if builder.stateFlag {
		req.State = &builder.state

	}
	if builder.descriptionFlag {
		req.Description = &builder.description

	}
	if builder.createTimeFlag {
		req.CreateTime = &builder.createTime

	}
	if builder.updateTimeFlag {
		req.UpdateTime = &builder.updateTime

	}
	if builder.isExceedQuotaFlag {
		req.IsExceedQuota = &builder.isExceedQuota

	}
	if builder.iconUrlFlag {
		req.IconUrl = &builder.iconUrl

	}
	if builder.templateFlag {
		req.Template = &builder.template

	}
	if builder.searchableFieldsFlag {
		req.SearchableFields = builder.searchableFields
	}
	if builder.i18nNameFlag {
		req.I18nName = builder.i18nName
	}
	if builder.i18nDescriptionFlag {
		req.I18nDescription = builder.i18nDescription
	}
	if builder.schemaIdFlag {
		req.SchemaId = &builder.schemaId

	}
	if builder.appIdFlag {
		req.AppId = &builder.appId

	}
	if builder.connectTypeFlag {
		req.ConnectType = &builder.connectType

	}
	if builder.connectorParamFlag {
		req.ConnectorParam = builder.connectorParam
	}
	if builder.enableAnswerFlag {
		req.EnableAnswer = &builder.enableAnswer

	}
	return req
}

type Dataset struct {
	DatasetId *string `json:"dataset_id,omitempty"` // 数据集的唯一标识

	AppId *string `json:"app_id,omitempty"` // 该数据集对应的开放平台应用id

	CreateTime *string `json:"create_time,omitempty"` // 创建时间，精确到秒级

	UpdateTime *string `json:"update_time,omitempty"` // 更新时间

	ChunkNum *int `json:"chunk_num,omitempty"` // 数据集中的索引数据的数量

	DocNum *int `json:"doc_num,omitempty"` // 数据集中的数据项的数量

	Name *string `json:"name,omitempty"` // 数据源的名字，只允许英文字母、数字和下划线，需要保证应用内部的唯一性。

	Description *string `json:"description,omitempty"` // 描述该数据集的具体内容以及相关用途

	FilterSchemas []*FilterSchema `json:"filter_schemas,omitempty"` // 过滤字段，每个数据集支持多个过滤字段

	ModelConfig *ModelConfig `json:"model_config,omitempty"` // 模型配置

	ViewerAppIds []string `json:"viewer_app_ids,omitempty"` // 被授权可搜/可见的应用
}

type DatasetBuilder struct {
	datasetId     string // 数据集的唯一标识
	datasetIdFlag bool

	appId     string // 该数据集对应的开放平台应用id
	appIdFlag bool

	createTime     string // 创建时间，精确到秒级
	createTimeFlag bool

	updateTime     string // 更新时间
	updateTimeFlag bool

	chunkNum     int // 数据集中的索引数据的数量
	chunkNumFlag bool

	docNum     int // 数据集中的数据项的数量
	docNumFlag bool

	name     string // 数据源的名字，只允许英文字母、数字和下划线，需要保证应用内部的唯一性。
	nameFlag bool

	description     string // 描述该数据集的具体内容以及相关用途
	descriptionFlag bool

	filterSchemas     []*FilterSchema // 过滤字段，每个数据集支持多个过滤字段
	filterSchemasFlag bool

	modelConfig     *ModelConfig // 模型配置
	modelConfigFlag bool

	viewerAppIds     []string // 被授权可搜/可见的应用
	viewerAppIdsFlag bool
}

func NewDatasetBuilder() *DatasetBuilder {
	builder := &DatasetBuilder{}
	return builder
}

// 数据集的唯一标识
//
// 示例值：6953903108179099667
func (builder *DatasetBuilder) DatasetId(datasetId string) *DatasetBuilder {
	builder.datasetId = datasetId
	builder.datasetIdFlag = true
	return builder
}

// 该数据集对应的开放平台应用id
//
// 示例值：cli_a1306bed4738d01b
func (builder *DatasetBuilder) AppId(appId string) *DatasetBuilder {
	builder.appId = appId
	builder.appIdFlag = true
	return builder
}

// 创建时间，精确到秒级
//
// 示例值：1990-12-31T23:59:60Z
func (builder *DatasetBuilder) CreateTime(createTime string) *DatasetBuilder {
	builder.createTime = createTime
	builder.createTimeFlag = true
	return builder
}

// 更新时间
//
// 示例值：1990-12-31T23:59:60Z
func (builder *DatasetBuilder) UpdateTime(updateTime string) *DatasetBuilder {
	builder.updateTime = updateTime
	builder.updateTimeFlag = true
	return builder
}

// 数据集中的索引数据的数量
//
// 示例值：1000
func (builder *DatasetBuilder) ChunkNum(chunkNum int) *DatasetBuilder {
	builder.chunkNum = chunkNum
	builder.chunkNumFlag = true
	return builder
}

// 数据集中的数据项的数量
//
// 示例值：100
func (builder *DatasetBuilder) DocNum(docNum int) *DatasetBuilder {
	builder.docNum = docNum
	builder.docNumFlag = true
	return builder
}

// 数据源的名字，只允许英文字母、数字和下划线，需要保证应用内部的唯一性。
//
// 示例值：feishu_web_1
func (builder *DatasetBuilder) Name(name string) *DatasetBuilder {
	builder.name = name
	builder.nameFlag = true
	return builder
}

// 描述该数据集的具体内容以及相关用途
//
// 示例值：飞书官网等网页上的数据，主要用于搜索问答
func (builder *DatasetBuilder) Description(description string) *DatasetBuilder {
	builder.description = description
	builder.descriptionFlag = true
	return builder
}

// 过滤字段，每个数据集支持多个过滤字段
//
// 示例值：
func (builder *DatasetBuilder) FilterSchemas(filterSchemas []*FilterSchema) *DatasetBuilder {
	builder.filterSchemas = filterSchemas
	builder.filterSchemasFlag = true
	return builder
}

// 模型配置
//
// 示例值：
func (builder *DatasetBuilder) ModelConfig(modelConfig *ModelConfig) *DatasetBuilder {
	builder.modelConfig = modelConfig
	builder.modelConfigFlag = true
	return builder
}

// 被授权可搜/可见的应用
//
// 示例值：
func (builder *DatasetBuilder) ViewerAppIds(viewerAppIds []string) *DatasetBuilder {
	builder.viewerAppIds = viewerAppIds
	builder.viewerAppIdsFlag = true
	return builder
}

func (builder *DatasetBuilder) Build() *Dataset {
	req := &Dataset{}
	if builder.datasetIdFlag {
		req.DatasetId = &builder.datasetId

	}
	if builder.appIdFlag {
		req.AppId = &builder.appId

	}
	if builder.createTimeFlag {
		req.CreateTime = &builder.createTime

	}
	if builder.updateTimeFlag {
		req.UpdateTime = &builder.updateTime

	}
	if builder.chunkNumFlag {
		req.ChunkNum = &builder.chunkNum

	}
	if builder.docNumFlag {
		req.DocNum = &builder.docNum

	}
	if builder.nameFlag {
		req.Name = &builder.name

	}
	if builder.descriptionFlag {
		req.Description = &builder.description

	}
	if builder.filterSchemasFlag {
		req.FilterSchemas = builder.filterSchemas
	}
	if builder.modelConfigFlag {
		req.ModelConfig = builder.modelConfig
	}
	if builder.viewerAppIdsFlag {
		req.ViewerAppIds = builder.viewerAppIds
	}
	return req
}

type DepartmentId struct {
	DepartmentId *string `json:"department_id,omitempty"` //

	OpenDepartmentId *string `json:"open_department_id,omitempty"` //
}

type DepartmentIdBuilder struct {
	departmentId     string //
	departmentIdFlag bool

	openDepartmentId     string //
	openDepartmentIdFlag bool
}

func NewDepartmentIdBuilder() *DepartmentIdBuilder {
	builder := &DepartmentIdBuilder{}
	return builder
}

//
//
// 示例值：
func (builder *DepartmentIdBuilder) DepartmentId(departmentId string) *DepartmentIdBuilder {
	builder.departmentId = departmentId
	builder.departmentIdFlag = true
	return builder
}

//
//
// 示例值：
func (builder *DepartmentIdBuilder) OpenDepartmentId(openDepartmentId string) *DepartmentIdBuilder {
	builder.openDepartmentId = openDepartmentId
	builder.openDepartmentIdFlag = true
	return builder
}

func (builder *DepartmentIdBuilder) Build() *DepartmentId {
	req := &DepartmentId{}
	if builder.departmentIdFlag {
		req.DepartmentId = &builder.departmentId

	}
	if builder.openDepartmentIdFlag {
		req.OpenDepartmentId = &builder.openDepartmentId

	}
	return req
}

type DialogSearchRequest struct {
	ToolRawInstruction *string `json:"tool_raw_instruction,omitempty"` // 用户问题

	ScenarioContextSchemaVersion *string `json:"scenario_context_schema_version,omitempty"` // 场景上下文的schema版本号

	ScenarioContext *ScenarioContext `json:"scenario_context,omitempty"` // 场景上下文

	AgentType *int `json:"agent_type,omitempty"` // agent类型

	ResponseType *int `json:"response_type,omitempty"` // 返回结果的数据类型

	PassageParam *PassageParam `json:"passage_param,omitempty"` // passage_param
}

type DialogSearchRequestBuilder struct {
	toolRawInstruction     string // 用户问题
	toolRawInstructionFlag bool

	scenarioContextSchemaVersion     string // 场景上下文的schema版本号
	scenarioContextSchemaVersionFlag bool

	scenarioContext     *ScenarioContext // 场景上下文
	scenarioContextFlag bool

	agentType     int // agent类型
	agentTypeFlag bool

	responseType     int // 返回结果的数据类型
	responseTypeFlag bool

	passageParam     *PassageParam // passage_param
	passageParamFlag bool
}

func NewDialogSearchRequestBuilder() *DialogSearchRequestBuilder {
	builder := &DialogSearchRequestBuilder{}
	return builder
}

// 用户问题
//
// 示例值：帮我找一下昨天发的文档
func (builder *DialogSearchRequestBuilder) ToolRawInstruction(toolRawInstruction string) *DialogSearchRequestBuilder {
	builder.toolRawInstruction = toolRawInstruction
	builder.toolRawInstructionFlag = true
	return builder
}

// 场景上下文的schema版本号
//
// 示例值：v1
func (builder *DialogSearchRequestBuilder) ScenarioContextSchemaVersion(scenarioContextSchemaVersion string) *DialogSearchRequestBuilder {
	builder.scenarioContextSchemaVersion = scenarioContextSchemaVersion
	builder.scenarioContextSchemaVersionFlag = true
	return builder
}

// 场景上下文
//
// 示例值：
func (builder *DialogSearchRequestBuilder) ScenarioContext(scenarioContext *ScenarioContext) *DialogSearchRequestBuilder {
	builder.scenarioContext = scenarioContext
	builder.scenarioContextFlag = true
	return builder
}

// agent类型
//
// 示例值：1
func (builder *DialogSearchRequestBuilder) AgentType(agentType int) *DialogSearchRequestBuilder {
	builder.agentType = agentType
	builder.agentTypeFlag = true
	return builder
}

// 返回结果的数据类型
//
// 示例值：1
func (builder *DialogSearchRequestBuilder) ResponseType(responseType int) *DialogSearchRequestBuilder {
	builder.responseType = responseType
	builder.responseTypeFlag = true
	return builder
}

// passage_param
//
// 示例值：
func (builder *DialogSearchRequestBuilder) PassageParam(passageParam *PassageParam) *DialogSearchRequestBuilder {
	builder.passageParam = passageParam
	builder.passageParamFlag = true
	return builder
}

func (builder *DialogSearchRequestBuilder) Build() *DialogSearchRequest {
	req := &DialogSearchRequest{}
	if builder.toolRawInstructionFlag {
		req.ToolRawInstruction = &builder.toolRawInstruction

	}
	if builder.scenarioContextSchemaVersionFlag {
		req.ScenarioContextSchemaVersion = &builder.scenarioContextSchemaVersion

	}
	if builder.scenarioContextFlag {
		req.ScenarioContext = builder.scenarioContext
	}
	if builder.agentTypeFlag {
		req.AgentType = &builder.agentType

	}
	if builder.responseTypeFlag {
		req.ResponseType = &builder.responseType

	}
	if builder.passageParamFlag {
		req.PassageParam = builder.passageParam
	}
	return req
}

type Doc struct {
	DocId *string `json:"doc_id,omitempty"` // 文档的唯一标识，只允许英文字母、数字和下划线

	FilterData *string `json:"filter_data,omitempty"` // 文档对应filter_schema的值

	Chunks []*Chunk `json:"chunks,omitempty"` // 文本块列表
}

type DocBuilder struct {
	docId     string // 文档的唯一标识，只允许英文字母、数字和下划线
	docIdFlag bool

	filterData     string // 文档对应filter_schema的值
	filterDataFlag bool

	chunks     []*Chunk // 文本块列表
	chunksFlag bool
}

func NewDocBuilder() *DocBuilder {
	builder := &DocBuilder{}
	return builder
}

// 文档的唯一标识，只允许英文字母、数字和下划线
//
// 示例值：3953903108179099667
func (builder *DocBuilder) DocId(docId string) *DocBuilder {
	builder.docId = docId
	builder.docIdFlag = true
	return builder
}

// 文档对应filter_schema的值
//
// 示例值：{\"domains\": [\"domain1\"],\"versions\": [\"v1\"]}
func (builder *DocBuilder) FilterData(filterData string) *DocBuilder {
	builder.filterData = filterData
	builder.filterDataFlag = true
	return builder
}

// 文本块列表
//
// 示例值：
func (builder *DocBuilder) Chunks(chunks []*Chunk) *DocBuilder {
	builder.chunks = chunks
	builder.chunksFlag = true
	return builder
}

func (builder *DocBuilder) Build() *Doc {
	req := &Doc{}
	if builder.docIdFlag {
		req.DocId = &builder.docId

	}
	if builder.filterDataFlag {
		req.FilterData = &builder.filterData

	}
	if builder.chunksFlag {
		req.Chunks = builder.chunks
	}
	return req
}

type DocFilter struct {
	CreatorIds []string `json:"creator_ids,omitempty"` // 文档所有者OpenID

	DocTypes []string `json:"doc_types,omitempty"` // 文档类型

	FolderTokens []string `json:"folder_tokens,omitempty"` // 搜索文件夹内的文档（文件夹token列表）

	OnlyTitle *bool `json:"only_title,omitempty"` // 仅搜文档标题

	OpenTime *TimeRange `json:"open_time,omitempty"` // 浏览文档的时间范围（秒级时间戳，包含start和end字段）

	SortType *string `json:"sort_type,omitempty"` // 排序方式
}

type DocFilterBuilder struct {
	creatorIds     []string // 文档所有者OpenID
	creatorIdsFlag bool

	docTypes     []string // 文档类型
	docTypesFlag bool

	folderTokens     []string // 搜索文件夹内的文档（文件夹token列表）
	folderTokensFlag bool

	onlyTitle     bool // 仅搜文档标题
	onlyTitleFlag bool

	openTime     *TimeRange // 浏览文档的时间范围（秒级时间戳，包含start和end字段）
	openTimeFlag bool

	sortType     string // 排序方式
	sortTypeFlag bool
}

func NewDocFilterBuilder() *DocFilterBuilder {
	builder := &DocFilterBuilder{}
	return builder
}

// 文档所有者OpenID
//
// 示例值：
func (builder *DocFilterBuilder) CreatorIds(creatorIds []string) *DocFilterBuilder {
	builder.creatorIds = creatorIds
	builder.creatorIdsFlag = true
	return builder
}

// 文档类型
//
// 示例值：
func (builder *DocFilterBuilder) DocTypes(docTypes []string) *DocFilterBuilder {
	builder.docTypes = docTypes
	builder.docTypesFlag = true
	return builder
}

// 搜索文件夹内的文档（文件夹token列表）
//
// 示例值：
func (builder *DocFilterBuilder) FolderTokens(folderTokens []string) *DocFilterBuilder {
	builder.folderTokens = folderTokens
	builder.folderTokensFlag = true
	return builder
}

// 仅搜文档标题
//
// 示例值：false
func (builder *DocFilterBuilder) OnlyTitle(onlyTitle bool) *DocFilterBuilder {
	builder.onlyTitle = onlyTitle
	builder.onlyTitleFlag = true
	return builder
}

// 浏览文档的时间范围（秒级时间戳，包含start和end字段）
//
// 示例值：
func (builder *DocFilterBuilder) OpenTime(openTime *TimeRange) *DocFilterBuilder {
	builder.openTime = openTime
	builder.openTimeFlag = true
	return builder
}

// 排序方式
//
// 示例值：CREATE_TIME_ASC
func (builder *DocFilterBuilder) SortType(sortType string) *DocFilterBuilder {
	builder.sortType = sortType
	builder.sortTypeFlag = true
	return builder
}

func (builder *DocFilterBuilder) Build() *DocFilter {
	req := &DocFilter{}
	if builder.creatorIdsFlag {
		req.CreatorIds = builder.creatorIds
	}
	if builder.docTypesFlag {
		req.DocTypes = builder.docTypes
	}
	if builder.folderTokensFlag {
		req.FolderTokens = builder.folderTokens
	}
	if builder.onlyTitleFlag {
		req.OnlyTitle = &builder.onlyTitle

	}
	if builder.openTimeFlag {
		req.OpenTime = builder.openTime
	}
	if builder.sortTypeFlag {
		req.SortType = &builder.sortType

	}
	return req
}

type DocMeta struct {
	DocTypes *string `json:"doc_types,omitempty"` // 文档类型

	UpdateTime *int `json:"update_time,omitempty"` // 更新时间戳（秒）

	Url *string `json:"url,omitempty"` // 文档链接

	OwnerName *string `json:"owner_name,omitempty"` // 所有者名称

	OwnerId *string `json:"owner_id,omitempty"` // 所有者OpenID

	IsCrossTenant *bool `json:"is_cross_tenant,omitempty"` // 是否跨租户

	CreateTime *int `json:"create_time,omitempty"` // 文档创建时间戳（秒）

	LastOpenTime *int `json:"last_open_time,omitempty"` // 上次打开时间戳（秒）

	EditUserId *string `json:"edit_user_id,omitempty"` // 最后一次编辑用户OpenID

	EditUserName *string `json:"edit_user_name,omitempty"` // 最后一次编辑用户名称

	Token *string `json:"token,omitempty"` // 文档token
}

type DocMetaBuilder struct {
	docTypes     string // 文档类型
	docTypesFlag bool

	updateTime     int // 更新时间戳（秒）
	updateTimeFlag bool

	url     string // 文档链接
	urlFlag bool

	ownerName     string // 所有者名称
	ownerNameFlag bool

	ownerId     string // 所有者OpenID
	ownerIdFlag bool

	isCrossTenant     bool // 是否跨租户
	isCrossTenantFlag bool

	createTime     int // 文档创建时间戳（秒）
	createTimeFlag bool

	lastOpenTime     int // 上次打开时间戳（秒）
	lastOpenTimeFlag bool

	editUserId     string // 最后一次编辑用户OpenID
	editUserIdFlag bool

	editUserName     string // 最后一次编辑用户名称
	editUserNameFlag bool

	token     string // 文档token
	tokenFlag bool
}

func NewDocMetaBuilder() *DocMetaBuilder {
	builder := &DocMetaBuilder{}
	return builder
}

// 文档类型
//
// 示例值：SHORTCUT
func (builder *DocMetaBuilder) DocTypes(docTypes string) *DocMetaBuilder {
	builder.docTypes = docTypes
	builder.docTypesFlag = true
	return builder
}

// 更新时间戳（秒）
//
// 示例值：1766567446
func (builder *DocMetaBuilder) UpdateTime(updateTime int) *DocMetaBuilder {
	builder.updateTime = updateTime
	builder.updateTimeFlag = true
	return builder
}

// 文档链接
//
// 示例值：https://www.feishu.cn/docs/dox-1234567890abcdef
func (builder *DocMetaBuilder) Url(url string) *DocMetaBuilder {
	builder.url = url
	builder.urlFlag = true
	return builder
}

// 所有者名称
//
// 示例值：张三
func (builder *DocMetaBuilder) OwnerName(ownerName string) *DocMetaBuilder {
	builder.ownerName = ownerName
	builder.ownerNameFlag = true
	return builder
}

// 所有者OpenID
//
// 示例值：ou-7890123456abcdef
func (builder *DocMetaBuilder) OwnerId(ownerId string) *DocMetaBuilder {
	builder.ownerId = ownerId
	builder.ownerIdFlag = true
	return builder
}

// 是否跨租户
//
// 示例值：false
func (builder *DocMetaBuilder) IsCrossTenant(isCrossTenant bool) *DocMetaBuilder {
	builder.isCrossTenant = isCrossTenant
	builder.isCrossTenantFlag = true
	return builder
}

// 文档创建时间戳（秒）
//
// 示例值：1766567446
func (builder *DocMetaBuilder) CreateTime(createTime int) *DocMetaBuilder {
	builder.createTime = createTime
	builder.createTimeFlag = true
	return builder
}

// 上次打开时间戳（秒）
//
// 示例值：1766567446
func (builder *DocMetaBuilder) LastOpenTime(lastOpenTime int) *DocMetaBuilder {
	builder.lastOpenTime = lastOpenTime
	builder.lastOpenTimeFlag = true
	return builder
}

// 最后一次编辑用户OpenID
//
// 示例值：ou-1122334455aabbcc
func (builder *DocMetaBuilder) EditUserId(editUserId string) *DocMetaBuilder {
	builder.editUserId = editUserId
	builder.editUserIdFlag = true
	return builder
}

// 最后一次编辑用户名称
//
// 示例值：李四
func (builder *DocMetaBuilder) EditUserName(editUserName string) *DocMetaBuilder {
	builder.editUserName = editUserName
	builder.editUserNameFlag = true
	return builder
}

// 文档token
//
// 示例值：dox_9876543210fedcba
func (builder *DocMetaBuilder) Token(token string) *DocMetaBuilder {
	builder.token = token
	builder.tokenFlag = true
	return builder
}

func (builder *DocMetaBuilder) Build() *DocMeta {
	req := &DocMeta{}
	if builder.docTypesFlag {
		req.DocTypes = &builder.docTypes

	}
	if builder.updateTimeFlag {
		req.UpdateTime = &builder.updateTime

	}
	if builder.urlFlag {
		req.Url = &builder.url

	}
	if builder.ownerNameFlag {
		req.OwnerName = &builder.ownerName

	}
	if builder.ownerIdFlag {
		req.OwnerId = &builder.ownerId

	}
	if builder.isCrossTenantFlag {
		req.IsCrossTenant = &builder.isCrossTenant

	}
	if builder.createTimeFlag {
		req.CreateTime = &builder.createTime

	}
	if builder.lastOpenTimeFlag {
		req.LastOpenTime = &builder.lastOpenTime

	}
	if builder.editUserIdFlag {
		req.EditUserId = &builder.editUserId

	}
	if builder.editUserNameFlag {
		req.EditUserName = &builder.editUserName

	}
	if builder.tokenFlag {
		req.Token = &builder.token

	}
	return req
}

type DocPassageParam struct {
	Searchable *bool `json:"searchable,omitempty"` // 是否要搜索doc

	DocTokens []string `json:"doc_tokens,omitempty"` // 搜索几篇特定doc

	FolderTokens []string `json:"folder_tokens,omitempty"` // 搜索特定的文件夹

	ObjIds []string `json:"obj_ids,omitempty"` // 搜索特定doc（仅限内部使用，有需求请用doc_tokens）

	DisableSearchLink *bool `json:"disable_search_link,omitempty"` // 禁用搜索外链文档功能

	ExcludedObjIds []string `json:"excluded_obj_ids,omitempty"` // 排除文档id

	ExcludedDocTokens []string `json:"excluded_doc_tokens,omitempty"` // 排除文档token

	ExcludedFolderTokens []string `json:"excluded_folder_tokens,omitempty"` // 排除的文件夹token

	EnableCrossTenant *bool `json:"enable_cross_tenant,omitempty"` // 是否跨租户

	OnlySearchPublic *bool `json:"only_search_public,omitempty"` // 是否只搜公开
}

type DocPassageParamBuilder struct {
	searchable     bool // 是否要搜索doc
	searchableFlag bool

	docTokens     []string // 搜索几篇特定doc
	docTokensFlag bool

	folderTokens     []string // 搜索特定的文件夹
	folderTokensFlag bool

	objIds     []string // 搜索特定doc（仅限内部使用，有需求请用doc_tokens）
	objIdsFlag bool

	disableSearchLink     bool // 禁用搜索外链文档功能
	disableSearchLinkFlag bool

	excludedObjIds     []string // 排除文档id
	excludedObjIdsFlag bool

	excludedDocTokens     []string // 排除文档token
	excludedDocTokensFlag bool

	excludedFolderTokens     []string // 排除的文件夹token
	excludedFolderTokensFlag bool

	enableCrossTenant     bool // 是否跨租户
	enableCrossTenantFlag bool

	onlySearchPublic     bool // 是否只搜公开
	onlySearchPublicFlag bool
}

func NewDocPassageParamBuilder() *DocPassageParamBuilder {
	builder := &DocPassageParamBuilder{}
	return builder
}

// 是否要搜索doc
//
// 示例值：false
func (builder *DocPassageParamBuilder) Searchable(searchable bool) *DocPassageParamBuilder {
	builder.searchable = searchable
	builder.searchableFlag = true
	return builder
}

// 搜索几篇特定doc
//
// 示例值：
func (builder *DocPassageParamBuilder) DocTokens(docTokens []string) *DocPassageParamBuilder {
	builder.docTokens = docTokens
	builder.docTokensFlag = true
	return builder
}

// 搜索特定的文件夹
//
// 示例值：
func (builder *DocPassageParamBuilder) FolderTokens(folderTokens []string) *DocPassageParamBuilder {
	builder.folderTokens = folderTokens
	builder.folderTokensFlag = true
	return builder
}

// 搜索特定doc（仅限内部使用，有需求请用doc_tokens）
//
// 示例值：
func (builder *DocPassageParamBuilder) ObjIds(objIds []string) *DocPassageParamBuilder {
	builder.objIds = objIds
	builder.objIdsFlag = true
	return builder
}

// 禁用搜索外链文档功能
//
// 示例值：false
func (builder *DocPassageParamBuilder) DisableSearchLink(disableSearchLink bool) *DocPassageParamBuilder {
	builder.disableSearchLink = disableSearchLink
	builder.disableSearchLinkFlag = true
	return builder
}

// 排除文档id
//
// 示例值：true
func (builder *DocPassageParamBuilder) ExcludedObjIds(excludedObjIds []string) *DocPassageParamBuilder {
	builder.excludedObjIds = excludedObjIds
	builder.excludedObjIdsFlag = true
	return builder
}

// 排除文档token
//
// 示例值：true
func (builder *DocPassageParamBuilder) ExcludedDocTokens(excludedDocTokens []string) *DocPassageParamBuilder {
	builder.excludedDocTokens = excludedDocTokens
	builder.excludedDocTokensFlag = true
	return builder
}

// 排除的文件夹token
//
// 示例值：
func (builder *DocPassageParamBuilder) ExcludedFolderTokens(excludedFolderTokens []string) *DocPassageParamBuilder {
	builder.excludedFolderTokens = excludedFolderTokens
	builder.excludedFolderTokensFlag = true
	return builder
}

// 是否跨租户
//
// 示例值：false
func (builder *DocPassageParamBuilder) EnableCrossTenant(enableCrossTenant bool) *DocPassageParamBuilder {
	builder.enableCrossTenant = enableCrossTenant
	builder.enableCrossTenantFlag = true
	return builder
}

// 是否只搜公开
//
// 示例值：false
func (builder *DocPassageParamBuilder) OnlySearchPublic(onlySearchPublic bool) *DocPassageParamBuilder {
	builder.onlySearchPublic = onlySearchPublic
	builder.onlySearchPublicFlag = true
	return builder
}

func (builder *DocPassageParamBuilder) Build() *DocPassageParam {
	req := &DocPassageParam{}
	if builder.searchableFlag {
		req.Searchable = &builder.searchable

	}
	if builder.docTokensFlag {
		req.DocTokens = builder.docTokens
	}
	if builder.folderTokensFlag {
		req.FolderTokens = builder.folderTokens
	}
	if builder.objIdsFlag {
		req.ObjIds = builder.objIds
	}
	if builder.disableSearchLinkFlag {
		req.DisableSearchLink = &builder.disableSearchLink

	}
	if builder.excludedObjIdsFlag {
		req.ExcludedObjIds = builder.excludedObjIds
	}
	if builder.excludedDocTokensFlag {
		req.ExcludedDocTokens = builder.excludedDocTokens
	}
	if builder.excludedFolderTokensFlag {
		req.ExcludedFolderTokens = builder.excludedFolderTokens
	}
	if builder.enableCrossTenantFlag {
		req.EnableCrossTenant = &builder.enableCrossTenant

	}
	if builder.onlySearchPublicFlag {
		req.OnlySearchPublic = &builder.onlySearchPublic

	}
	return req
}

type DocRequest struct {
	Query *string `json:"query,omitempty"` // 搜索词

	PageSize *int `json:"page_size,omitempty"` // 每页返回数量

	PaginationToken *string `json:"pagination_token,omitempty"` // 翻页标记（需保存上次response中的内容）

	DocsFilter *DocFilter `json:"docs_filter,omitempty"` // 文档过滤参数

	WikiFilter *WikiFilter `json:"wiki_filter,omitempty"` // Wiki过滤参数
}

type DocRequestBuilder struct {
	query     string // 搜索词
	queryFlag bool

	pageSize     int // 每页返回数量
	pageSizeFlag bool

	paginationToken     string // 翻页标记（需保存上次response中的内容）
	paginationTokenFlag bool

	docsFilter     *DocFilter // 文档过滤参数
	docsFilterFlag bool

	wikiFilter     *WikiFilter // Wiki过滤参数
	wikiFilterFlag bool
}

func NewDocRequestBuilder() *DocRequestBuilder {
	builder := &DocRequestBuilder{}
	return builder
}

// 搜索词
//
// 示例值：飞书文档使用指南
func (builder *DocRequestBuilder) Query(query string) *DocRequestBuilder {
	builder.query = query
	builder.queryFlag = true
	return builder
}

// 每页返回数量
//
// 示例值：
func (builder *DocRequestBuilder) PageSize(pageSize int) *DocRequestBuilder {
	builder.pageSize = pageSize
	builder.pageSizeFlag = true
	return builder
}

// 翻页标记（需保存上次response中的内容）
//
// 示例值：token_1234567890fedcba
func (builder *DocRequestBuilder) PaginationToken(paginationToken string) *DocRequestBuilder {
	builder.paginationToken = paginationToken
	builder.paginationTokenFlag = true
	return builder
}

// 文档过滤参数
//
// 示例值：{"types": [1], "folder_tokens": ["fld_123456"]}
func (builder *DocRequestBuilder) DocsFilter(docsFilter *DocFilter) *DocRequestBuilder {
	builder.docsFilter = docsFilter
	builder.docsFilterFlag = true
	return builder
}

// Wiki过滤参数
//
// 示例值：{"space_ids": ["space_789012"], "is_public": false}
func (builder *DocRequestBuilder) WikiFilter(wikiFilter *WikiFilter) *DocRequestBuilder {
	builder.wikiFilter = wikiFilter
	builder.wikiFilterFlag = true
	return builder
}

func (builder *DocRequestBuilder) Build() *DocRequest {
	req := &DocRequest{}
	if builder.queryFlag {
		req.Query = &builder.query

	}
	if builder.pageSizeFlag {
		req.PageSize = &builder.pageSize

	}
	if builder.paginationTokenFlag {
		req.PaginationToken = &builder.paginationToken

	}
	if builder.docsFilterFlag {
		req.DocsFilter = builder.docsFilter
	}
	if builder.wikiFilterFlag {
		req.WikiFilter = builder.wikiFilter
	}
	return req
}

type DocResUnit struct {
	TitleHighlighted *string `json:"title_highlighted,omitempty"` // 标题高亮

	SummaryHighlighted *string `json:"summary_highlighted,omitempty"` // 摘要高亮

	EntityType *string `json:"entity_type,omitempty"` // 结果类型

	ResultMeta *DocMeta `json:"result_meta,omitempty"` // 文档搜索元信息
}

type DocResUnitBuilder struct {
	titleHighlighted     string // 标题高亮
	titleHighlightedFlag bool

	summaryHighlighted     string // 摘要高亮
	summaryHighlightedFlag bool

	entityType     string // 结果类型
	entityTypeFlag bool

	resultMeta     *DocMeta // 文档搜索元信息
	resultMetaFlag bool
}

func NewDocResUnitBuilder() *DocResUnitBuilder {
	builder := &DocResUnitBuilder{}
	return builder
}

// 标题高亮
//
// 示例值：<h>飞书文档</h>使用指南
func (builder *DocResUnitBuilder) TitleHighlighted(titleHighlighted string) *DocResUnitBuilder {
	builder.titleHighlighted = titleHighlighted
	builder.titleHighlightedFlag = true
	return builder
}

// 摘要高亮
//
// 示例值：本文介绍<h>飞书文档</h>的创建、编辑与分享功能
func (builder *DocResUnitBuilder) SummaryHighlighted(summaryHighlighted string) *DocResUnitBuilder {
	builder.summaryHighlighted = summaryHighlighted
	builder.summaryHighlightedFlag = true
	return builder
}

// 结果类型
//
// 示例值：DOC
func (builder *DocResUnitBuilder) EntityType(entityType string) *DocResUnitBuilder {
	builder.entityType = entityType
	builder.entityTypeFlag = true
	return builder
}

// 文档搜索元信息
//
// 示例值：{"title_highlighted":"<h>飞书文档</h>使用指南","summary_highlighted":"本文介绍<h>飞书文档</h>的创建、编辑与分享功能","entity_type":"DOC","result_meta":"{"type":SHORTCUT,"update_time":1766567613}"}
func (builder *DocResUnitBuilder) ResultMeta(resultMeta *DocMeta) *DocResUnitBuilder {
	builder.resultMeta = resultMeta
	builder.resultMetaFlag = true
	return builder
}

func (builder *DocResUnitBuilder) Build() *DocResUnit {
	req := &DocResUnit{}
	if builder.titleHighlightedFlag {
		req.TitleHighlighted = &builder.titleHighlighted

	}
	if builder.summaryHighlightedFlag {
		req.SummaryHighlighted = &builder.summaryHighlighted

	}
	if builder.entityTypeFlag {
		req.EntityType = &builder.entityType

	}
	if builder.resultMetaFlag {
		req.ResultMeta = builder.resultMeta
	}
	return req
}

type DocResponse struct {
	Total *int `json:"total,omitempty"` // 召回的全部结果个数

	HasMore *bool `json:"has_more,omitempty"` // 是否存在更多数据可供加载

	ResUnits []*DocResUnit `json:"res_units,omitempty"` // 搜索结果列表

	PaginationToken *string `json:"pagination_token,omitempty"` // 翻页标记（下一次翻页时传递给请求）
}

type DocResponseBuilder struct {
	total     int // 召回的全部结果个数
	totalFlag bool

	hasMore     bool // 是否存在更多数据可供加载
	hasMoreFlag bool

	resUnits     []*DocResUnit // 搜索结果列表
	resUnitsFlag bool

	paginationToken     string // 翻页标记（下一次翻页时传递给请求）
	paginationTokenFlag bool
}

func NewDocResponseBuilder() *DocResponseBuilder {
	builder := &DocResponseBuilder{}
	return builder
}

// 召回的全部结果个数
//
// 示例值：100
func (builder *DocResponseBuilder) Total(total int) *DocResponseBuilder {
	builder.total = total
	builder.totalFlag = true
	return builder
}

// 是否存在更多数据可供加载
//
// 示例值：true
func (builder *DocResponseBuilder) HasMore(hasMore bool) *DocResponseBuilder {
	builder.hasMore = hasMore
	builder.hasMoreFlag = true
	return builder
}

// 搜索结果列表
//
// 示例值：
func (builder *DocResponseBuilder) ResUnits(resUnits []*DocResUnit) *DocResponseBuilder {
	builder.resUnits = resUnits
	builder.resUnitsFlag = true
	return builder
}

// 翻页标记（下一次翻页时传递给请求）
//
// 示例值：token_1234567890fedcba
func (builder *DocResponseBuilder) PaginationToken(paginationToken string) *DocResponseBuilder {
	builder.paginationToken = paginationToken
	builder.paginationTokenFlag = true
	return builder
}

func (builder *DocResponseBuilder) Build() *DocResponse {
	req := &DocResponse{}
	if builder.totalFlag {
		req.Total = &builder.total

	}
	if builder.hasMoreFlag {
		req.HasMore = &builder.hasMore

	}
	if builder.resUnitsFlag {
		req.ResUnits = builder.resUnits
	}
	if builder.paginationTokenFlag {
		req.PaginationToken = &builder.paginationToken

	}
	return req
}

type EnterpriseKnowledgeSourceCommentParam struct {
	WikiSearchable *bool `json:"wiki_searchable,omitempty"` // 是否搜索知识库文档的评论。默认为 `false`。

	SpaceSearchable *bool `json:"space_searchable,omitempty"` // 是否搜索云空间文档的评论。默认为 `false`。
}

type EnterpriseKnowledgeSourceCommentParamBuilder struct {
	wikiSearchable     bool // 是否搜索知识库文档的评论。默认为 `false`。
	wikiSearchableFlag bool

	spaceSearchable     bool // 是否搜索云空间文档的评论。默认为 `false`。
	spaceSearchableFlag bool
}

func NewEnterpriseKnowledgeSourceCommentParamBuilder() *EnterpriseKnowledgeSourceCommentParamBuilder {
	builder := &EnterpriseKnowledgeSourceCommentParamBuilder{}
	return builder
}

// 是否搜索知识库文档的评论。默认为 `false`。
//
// 示例值：true
func (builder *EnterpriseKnowledgeSourceCommentParamBuilder) WikiSearchable(wikiSearchable bool) *EnterpriseKnowledgeSourceCommentParamBuilder {
	builder.wikiSearchable = wikiSearchable
	builder.wikiSearchableFlag = true
	return builder
}

// 是否搜索云空间文档的评论。默认为 `false`。
//
// 示例值：true
func (builder *EnterpriseKnowledgeSourceCommentParamBuilder) SpaceSearchable(spaceSearchable bool) *EnterpriseKnowledgeSourceCommentParamBuilder {
	builder.spaceSearchable = spaceSearchable
	builder.spaceSearchableFlag = true
	return builder
}

func (builder *EnterpriseKnowledgeSourceCommentParamBuilder) Build() *EnterpriseKnowledgeSourceCommentParam {
	req := &EnterpriseKnowledgeSourceCommentParam{}
	if builder.wikiSearchableFlag {
		req.WikiSearchable = &builder.wikiSearchable

	}
	if builder.spaceSearchableFlag {
		req.SpaceSearchable = &builder.spaceSearchable

	}
	return req
}

type EnterpriseKnowledgeSourceHelpdeskParam struct {
	Searchable *bool `json:"searchable,omitempty"` // searchable

	Filter *KnowledgeSourceHelpdeskFilter `json:"filter,omitempty"` // filter
}

type EnterpriseKnowledgeSourceHelpdeskParamBuilder struct {
	searchable     bool // searchable
	searchableFlag bool

	filter     *KnowledgeSourceHelpdeskFilter // filter
	filterFlag bool
}

func NewEnterpriseKnowledgeSourceHelpdeskParamBuilder() *EnterpriseKnowledgeSourceHelpdeskParamBuilder {
	builder := &EnterpriseKnowledgeSourceHelpdeskParamBuilder{}
	return builder
}

// searchable
//
// 示例值：false
func (builder *EnterpriseKnowledgeSourceHelpdeskParamBuilder) Searchable(searchable bool) *EnterpriseKnowledgeSourceHelpdeskParamBuilder {
	builder.searchable = searchable
	builder.searchableFlag = true
	return builder
}

// filter
//
// 示例值：
func (builder *EnterpriseKnowledgeSourceHelpdeskParamBuilder) Filter(filter *KnowledgeSourceHelpdeskFilter) *EnterpriseKnowledgeSourceHelpdeskParamBuilder {
	builder.filter = filter
	builder.filterFlag = true
	return builder
}

func (builder *EnterpriseKnowledgeSourceHelpdeskParamBuilder) Build() *EnterpriseKnowledgeSourceHelpdeskParam {
	req := &EnterpriseKnowledgeSourceHelpdeskParam{}
	if builder.searchableFlag {
		req.Searchable = &builder.searchable

	}
	if builder.filterFlag {
		req.Filter = builder.filter
	}
	return req
}

type EnterpriseKnowledgeSourceLingoParam struct {
	Searchable *bool `json:"searchable,omitempty"` // searchable
}

type EnterpriseKnowledgeSourceLingoParamBuilder struct {
	searchable     bool // searchable
	searchableFlag bool
}

func NewEnterpriseKnowledgeSourceLingoParamBuilder() *EnterpriseKnowledgeSourceLingoParamBuilder {
	builder := &EnterpriseKnowledgeSourceLingoParamBuilder{}
	return builder
}

// searchable
//
// 示例值：false
func (builder *EnterpriseKnowledgeSourceLingoParamBuilder) Searchable(searchable bool) *EnterpriseKnowledgeSourceLingoParamBuilder {
	builder.searchable = searchable
	builder.searchableFlag = true
	return builder
}

func (builder *EnterpriseKnowledgeSourceLingoParamBuilder) Build() *EnterpriseKnowledgeSourceLingoParam {
	req := &EnterpriseKnowledgeSourceLingoParam{}
	if builder.searchableFlag {
		req.Searchable = &builder.searchable

	}
	return req
}

type EnterpriseKnowledgeSourceMailParam struct {
	Searchable *bool `json:"searchable,omitempty"` // 是否搜索邮件。默认为 `false`。
}

type EnterpriseKnowledgeSourceMailParamBuilder struct {
	searchable     bool // 是否搜索邮件。默认为 `false`。
	searchableFlag bool
}

func NewEnterpriseKnowledgeSourceMailParamBuilder() *EnterpriseKnowledgeSourceMailParamBuilder {
	builder := &EnterpriseKnowledgeSourceMailParamBuilder{}
	return builder
}

// 是否搜索邮件。默认为 `false`。
//
// 示例值：true
func (builder *EnterpriseKnowledgeSourceMailParamBuilder) Searchable(searchable bool) *EnterpriseKnowledgeSourceMailParamBuilder {
	builder.searchable = searchable
	builder.searchableFlag = true
	return builder
}

func (builder *EnterpriseKnowledgeSourceMailParamBuilder) Build() *EnterpriseKnowledgeSourceMailParam {
	req := &EnterpriseKnowledgeSourceMailParam{}
	if builder.searchableFlag {
		req.Searchable = &builder.searchable

	}
	return req
}

type EnterpriseKnowledgeSourceMessageParam struct {
	Searchable *bool `json:"searchable,omitempty"` // searchable

	Filter *KnowledgeSourceMessageFilter `json:"filter,omitempty"` // filter

	Reject *KnowledgeSourceMessageReject `json:"reject,omitempty"` // reject
}

type EnterpriseKnowledgeSourceMessageParamBuilder struct {
	searchable     bool // searchable
	searchableFlag bool

	filter     *KnowledgeSourceMessageFilter // filter
	filterFlag bool

	reject     *KnowledgeSourceMessageReject // reject
	rejectFlag bool
}

func NewEnterpriseKnowledgeSourceMessageParamBuilder() *EnterpriseKnowledgeSourceMessageParamBuilder {
	builder := &EnterpriseKnowledgeSourceMessageParamBuilder{}
	return builder
}

// searchable
//
// 示例值：false
func (builder *EnterpriseKnowledgeSourceMessageParamBuilder) Searchable(searchable bool) *EnterpriseKnowledgeSourceMessageParamBuilder {
	builder.searchable = searchable
	builder.searchableFlag = true
	return builder
}

// filter
//
// 示例值：
func (builder *EnterpriseKnowledgeSourceMessageParamBuilder) Filter(filter *KnowledgeSourceMessageFilter) *EnterpriseKnowledgeSourceMessageParamBuilder {
	builder.filter = filter
	builder.filterFlag = true
	return builder
}

// reject
//
// 示例值：
func (builder *EnterpriseKnowledgeSourceMessageParamBuilder) Reject(reject *KnowledgeSourceMessageReject) *EnterpriseKnowledgeSourceMessageParamBuilder {
	builder.reject = reject
	builder.rejectFlag = true
	return builder
}

func (builder *EnterpriseKnowledgeSourceMessageParamBuilder) Build() *EnterpriseKnowledgeSourceMessageParam {
	req := &EnterpriseKnowledgeSourceMessageParam{}
	if builder.searchableFlag {
		req.Searchable = &builder.searchable

	}
	if builder.filterFlag {
		req.Filter = builder.filter
	}
	if builder.rejectFlag {
		req.Reject = builder.reject
	}
	return req
}

type EnterpriseKnowledgeSourceMinutesParam struct {
	Searchable *bool `json:"searchable,omitempty"` // 是否搜索飞书妙记。默认为 `false`。
}

type EnterpriseKnowledgeSourceMinutesParamBuilder struct {
	searchable     bool // 是否搜索飞书妙记。默认为 `false`。
	searchableFlag bool
}

func NewEnterpriseKnowledgeSourceMinutesParamBuilder() *EnterpriseKnowledgeSourceMinutesParamBuilder {
	builder := &EnterpriseKnowledgeSourceMinutesParamBuilder{}
	return builder
}

// 是否搜索飞书妙记。默认为 `false`。
//
// 示例值：true
func (builder *EnterpriseKnowledgeSourceMinutesParamBuilder) Searchable(searchable bool) *EnterpriseKnowledgeSourceMinutesParamBuilder {
	builder.searchable = searchable
	builder.searchableFlag = true
	return builder
}

func (builder *EnterpriseKnowledgeSourceMinutesParamBuilder) Build() *EnterpriseKnowledgeSourceMinutesParam {
	req := &EnterpriseKnowledgeSourceMinutesParam{}
	if builder.searchableFlag {
		req.Searchable = &builder.searchable

	}
	return req
}

type EnterpriseKnowledgeSourceParam struct {
	Space *EnterpriseKnowledgeSourceSpaceParam `json:"space,omitempty"` // 云空间文档

	Wiki *EnterpriseKnowledgeSourceWikiParam `json:"wiki,omitempty"` // 知识库文档

	Message *EnterpriseKnowledgeSourceMessageParam `json:"message,omitempty"` // 消息

	HelpdeskFaq *EnterpriseKnowledgeSourceHelpdeskParam `json:"helpdesk_faq,omitempty"` // 服务台 FAQ

	Lingo *EnterpriseKnowledgeSourceLingoParam `json:"lingo,omitempty"` // Lingo企业词典

	Comment *EnterpriseKnowledgeSourceCommentParam `json:"comment,omitempty"` // 文档评论

	Minutes *EnterpriseKnowledgeSourceMinutesParam `json:"minutes,omitempty"` // 飞书妙记

	Mail *EnterpriseKnowledgeSourceMailParam `json:"mail,omitempty"` // 邮件
}

type EnterpriseKnowledgeSourceParamBuilder struct {
	space     *EnterpriseKnowledgeSourceSpaceParam // 云空间文档
	spaceFlag bool

	wiki     *EnterpriseKnowledgeSourceWikiParam // 知识库文档
	wikiFlag bool

	message     *EnterpriseKnowledgeSourceMessageParam // 消息
	messageFlag bool

	helpdeskFaq     *EnterpriseKnowledgeSourceHelpdeskParam // 服务台 FAQ
	helpdeskFaqFlag bool

	lingo     *EnterpriseKnowledgeSourceLingoParam // Lingo企业词典
	lingoFlag bool

	comment     *EnterpriseKnowledgeSourceCommentParam // 文档评论
	commentFlag bool

	minutes     *EnterpriseKnowledgeSourceMinutesParam // 飞书妙记
	minutesFlag bool

	mail     *EnterpriseKnowledgeSourceMailParam // 邮件
	mailFlag bool
}

func NewEnterpriseKnowledgeSourceParamBuilder() *EnterpriseKnowledgeSourceParamBuilder {
	builder := &EnterpriseKnowledgeSourceParamBuilder{}
	return builder
}

// 云空间文档
//
// 示例值：
func (builder *EnterpriseKnowledgeSourceParamBuilder) Space(space *EnterpriseKnowledgeSourceSpaceParam) *EnterpriseKnowledgeSourceParamBuilder {
	builder.space = space
	builder.spaceFlag = true
	return builder
}

// 知识库文档
//
// 示例值：
func (builder *EnterpriseKnowledgeSourceParamBuilder) Wiki(wiki *EnterpriseKnowledgeSourceWikiParam) *EnterpriseKnowledgeSourceParamBuilder {
	builder.wiki = wiki
	builder.wikiFlag = true
	return builder
}

// 消息
//
// 示例值：
func (builder *EnterpriseKnowledgeSourceParamBuilder) Message(message *EnterpriseKnowledgeSourceMessageParam) *EnterpriseKnowledgeSourceParamBuilder {
	builder.message = message
	builder.messageFlag = true
	return builder
}

// 服务台 FAQ
//
// 示例值：
func (builder *EnterpriseKnowledgeSourceParamBuilder) HelpdeskFaq(helpdeskFaq *EnterpriseKnowledgeSourceHelpdeskParam) *EnterpriseKnowledgeSourceParamBuilder {
	builder.helpdeskFaq = helpdeskFaq
	builder.helpdeskFaqFlag = true
	return builder
}

// Lingo企业词典
//
// 示例值：
func (builder *EnterpriseKnowledgeSourceParamBuilder) Lingo(lingo *EnterpriseKnowledgeSourceLingoParam) *EnterpriseKnowledgeSourceParamBuilder {
	builder.lingo = lingo
	builder.lingoFlag = true
	return builder
}

// 文档评论
//
// 示例值：
func (builder *EnterpriseKnowledgeSourceParamBuilder) Comment(comment *EnterpriseKnowledgeSourceCommentParam) *EnterpriseKnowledgeSourceParamBuilder {
	builder.comment = comment
	builder.commentFlag = true
	return builder
}

// 飞书妙记
//
// 示例值：
func (builder *EnterpriseKnowledgeSourceParamBuilder) Minutes(minutes *EnterpriseKnowledgeSourceMinutesParam) *EnterpriseKnowledgeSourceParamBuilder {
	builder.minutes = minutes
	builder.minutesFlag = true
	return builder
}

// 邮件
//
// 示例值：
func (builder *EnterpriseKnowledgeSourceParamBuilder) Mail(mail *EnterpriseKnowledgeSourceMailParam) *EnterpriseKnowledgeSourceParamBuilder {
	builder.mail = mail
	builder.mailFlag = true
	return builder
}

func (builder *EnterpriseKnowledgeSourceParamBuilder) Build() *EnterpriseKnowledgeSourceParam {
	req := &EnterpriseKnowledgeSourceParam{}
	if builder.spaceFlag {
		req.Space = builder.space
	}
	if builder.wikiFlag {
		req.Wiki = builder.wiki
	}
	if builder.messageFlag {
		req.Message = builder.message
	}
	if builder.helpdeskFaqFlag {
		req.HelpdeskFaq = builder.helpdeskFaq
	}
	if builder.lingoFlag {
		req.Lingo = builder.lingo
	}
	if builder.commentFlag {
		req.Comment = builder.comment
	}
	if builder.minutesFlag {
		req.Minutes = builder.minutes
	}
	if builder.mailFlag {
		req.Mail = builder.mail
	}
	return req
}

type EnterpriseKnowledgeSourceSpaceParam struct {
	Searchable *bool `json:"searchable,omitempty"` // searchable

	Filter *KnowledgeSourceSpaceFilter `json:"filter,omitempty"` // filter

	Reject *KnowledgeSourceSpaceReject `json:"reject,omitempty"` // reject
}

type EnterpriseKnowledgeSourceSpaceParamBuilder struct {
	searchable     bool // searchable
	searchableFlag bool

	filter     *KnowledgeSourceSpaceFilter // filter
	filterFlag bool

	reject     *KnowledgeSourceSpaceReject // reject
	rejectFlag bool
}

func NewEnterpriseKnowledgeSourceSpaceParamBuilder() *EnterpriseKnowledgeSourceSpaceParamBuilder {
	builder := &EnterpriseKnowledgeSourceSpaceParamBuilder{}
	return builder
}

// searchable
//
// 示例值：false
func (builder *EnterpriseKnowledgeSourceSpaceParamBuilder) Searchable(searchable bool) *EnterpriseKnowledgeSourceSpaceParamBuilder {
	builder.searchable = searchable
	builder.searchableFlag = true
	return builder
}

// filter
//
// 示例值：
func (builder *EnterpriseKnowledgeSourceSpaceParamBuilder) Filter(filter *KnowledgeSourceSpaceFilter) *EnterpriseKnowledgeSourceSpaceParamBuilder {
	builder.filter = filter
	builder.filterFlag = true
	return builder
}

// reject
//
// 示例值：
func (builder *EnterpriseKnowledgeSourceSpaceParamBuilder) Reject(reject *KnowledgeSourceSpaceReject) *EnterpriseKnowledgeSourceSpaceParamBuilder {
	builder.reject = reject
	builder.rejectFlag = true
	return builder
}

func (builder *EnterpriseKnowledgeSourceSpaceParamBuilder) Build() *EnterpriseKnowledgeSourceSpaceParam {
	req := &EnterpriseKnowledgeSourceSpaceParam{}
	if builder.searchableFlag {
		req.Searchable = &builder.searchable

	}
	if builder.filterFlag {
		req.Filter = builder.filter
	}
	if builder.rejectFlag {
		req.Reject = builder.reject
	}
	return req
}

type EnterpriseKnowledgeSourceWikiParam struct {
	Searchable *bool `json:"searchable,omitempty"` // searchable

	Filter *KnowledgeSourceWikiFilter `json:"filter,omitempty"` // filter

	Reject *KnowledgeSourceWikiReject `json:"reject,omitempty"` // reject
}

type EnterpriseKnowledgeSourceWikiParamBuilder struct {
	searchable     bool // searchable
	searchableFlag bool

	filter     *KnowledgeSourceWikiFilter // filter
	filterFlag bool

	reject     *KnowledgeSourceWikiReject // reject
	rejectFlag bool
}

func NewEnterpriseKnowledgeSourceWikiParamBuilder() *EnterpriseKnowledgeSourceWikiParamBuilder {
	builder := &EnterpriseKnowledgeSourceWikiParamBuilder{}
	return builder
}

// searchable
//
// 示例值：false
func (builder *EnterpriseKnowledgeSourceWikiParamBuilder) Searchable(searchable bool) *EnterpriseKnowledgeSourceWikiParamBuilder {
	builder.searchable = searchable
	builder.searchableFlag = true
	return builder
}

// filter
//
// 示例值：
func (builder *EnterpriseKnowledgeSourceWikiParamBuilder) Filter(filter *KnowledgeSourceWikiFilter) *EnterpriseKnowledgeSourceWikiParamBuilder {
	builder.filter = filter
	builder.filterFlag = true
	return builder
}

// reject
//
// 示例值：
func (builder *EnterpriseKnowledgeSourceWikiParamBuilder) Reject(reject *KnowledgeSourceWikiReject) *EnterpriseKnowledgeSourceWikiParamBuilder {
	builder.reject = reject
	builder.rejectFlag = true
	return builder
}

func (builder *EnterpriseKnowledgeSourceWikiParamBuilder) Build() *EnterpriseKnowledgeSourceWikiParam {
	req := &EnterpriseKnowledgeSourceWikiParam{}
	if builder.searchableFlag {
		req.Searchable = &builder.searchable

	}
	if builder.filterFlag {
		req.Filter = builder.filter
	}
	if builder.rejectFlag {
		req.Reject = builder.reject
	}
	return req
}

type FilterSchema struct {
	Field *string `json:"field,omitempty"` // 过滤字段的名字

	Type *string `json:"type,omitempty"` // 过滤字段的类型

	DefaultVal *string `json:"default_val,omitempty"` // 过滤字段的默认值

	FieldType *string `json:"field_type,omitempty"` // 用于构建dsl过滤的类型，默认是enum
}

type FilterSchemaBuilder struct {
	field     string // 过滤字段的名字
	fieldFlag bool

	type_    string // 过滤字段的类型
	typeFlag bool

	defaultVal     string // 过滤字段的默认值
	defaultValFlag bool

	fieldType     string // 用于构建dsl过滤的类型，默认是enum
	fieldTypeFlag bool
}

func NewFilterSchemaBuilder() *FilterSchemaBuilder {
	builder := &FilterSchemaBuilder{}
	return builder
}

// 过滤字段的名字
//
// 示例值：domain
func (builder *FilterSchemaBuilder) Field(field string) *FilterSchemaBuilder {
	builder.field = field
	builder.fieldFlag = true
	return builder
}

// 过滤字段的类型
//
// 示例值：list<string>
func (builder *FilterSchemaBuilder) Type(type_ string) *FilterSchemaBuilder {
	builder.type_ = type_
	builder.typeFlag = true
	return builder
}

// 过滤字段的默认值
//
// 示例值：-1
func (builder *FilterSchemaBuilder) DefaultVal(defaultVal string) *FilterSchemaBuilder {
	builder.defaultVal = defaultVal
	builder.defaultValFlag = true
	return builder
}

// 用于构建dsl过滤的类型，默认是enum
//
// 示例值：enum
func (builder *FilterSchemaBuilder) FieldType(fieldType string) *FilterSchemaBuilder {
	builder.fieldType = fieldType
	builder.fieldTypeFlag = true
	return builder
}

func (builder *FilterSchemaBuilder) Build() *FilterSchema {
	req := &FilterSchema{}
	if builder.fieldFlag {
		req.Field = &builder.field

	}
	if builder.typeFlag {
		req.Type = &builder.type_

	}
	if builder.defaultValFlag {
		req.DefaultVal = &builder.defaultVal

	}
	if builder.fieldTypeFlag {
		req.FieldType = &builder.fieldType

	}
	return req
}

type HelpdeskPassageParam struct {
	Searchable *bool `json:"searchable,omitempty"` // 是否要搜索服务台

	HelpdeskIds []string `json:"helpdesk_ids,omitempty"` // 搜索特定的服务台
}

type HelpdeskPassageParamBuilder struct {
	searchable     bool // 是否要搜索服务台
	searchableFlag bool

	helpdeskIds     []string // 搜索特定的服务台
	helpdeskIdsFlag bool
}

func NewHelpdeskPassageParamBuilder() *HelpdeskPassageParamBuilder {
	builder := &HelpdeskPassageParamBuilder{}
	return builder
}

// 是否要搜索服务台
//
// 示例值：false
func (builder *HelpdeskPassageParamBuilder) Searchable(searchable bool) *HelpdeskPassageParamBuilder {
	builder.searchable = searchable
	builder.searchableFlag = true
	return builder
}

// 搜索特定的服务台
//
// 示例值：
func (builder *HelpdeskPassageParamBuilder) HelpdeskIds(helpdeskIds []string) *HelpdeskPassageParamBuilder {
	builder.helpdeskIds = helpdeskIds
	builder.helpdeskIdsFlag = true
	return builder
}

func (builder *HelpdeskPassageParamBuilder) Build() *HelpdeskPassageParam {
	req := &HelpdeskPassageParam{}
	if builder.searchableFlag {
		req.Searchable = &builder.searchable

	}
	if builder.helpdeskIdsFlag {
		req.HelpdeskIds = builder.helpdeskIds
	}
	return req
}

type I18nMeta struct {
	ZhCn *string `json:"zh_cn,omitempty"` // 国际化字段：中文

	EnUs *string `json:"en_us,omitempty"` // 国际化字段：英文

	JaJp *string `json:"ja_jp,omitempty"` // 国际化字段：日文
}

type I18nMetaBuilder struct {
	zhCn     string // 国际化字段：中文
	zhCnFlag bool

	enUs     string // 国际化字段：英文
	enUsFlag bool

	jaJp     string // 国际化字段：日文
	jaJpFlag bool
}

func NewI18nMetaBuilder() *I18nMetaBuilder {
	builder := &I18nMetaBuilder{}
	return builder
}

// 国际化字段：中文
//
// 示例值：任务
func (builder *I18nMetaBuilder) ZhCn(zhCn string) *I18nMetaBuilder {
	builder.zhCn = zhCn
	builder.zhCnFlag = true
	return builder
}

// 国际化字段：英文
//
// 示例值：TODO
func (builder *I18nMetaBuilder) EnUs(enUs string) *I18nMetaBuilder {
	builder.enUs = enUs
	builder.enUsFlag = true
	return builder
}

// 国际化字段：日文
//
// 示例值：タスク
func (builder *I18nMetaBuilder) JaJp(jaJp string) *I18nMetaBuilder {
	builder.jaJp = jaJp
	builder.jaJpFlag = true
	return builder
}

func (builder *I18nMetaBuilder) Build() *I18nMeta {
	req := &I18nMeta{}
	if builder.zhCnFlag {
		req.ZhCn = &builder.zhCn

	}
	if builder.enUsFlag {
		req.EnUs = &builder.enUs

	}
	if builder.jaJpFlag {
		req.JaJp = &builder.jaJp

	}
	return req
}

type Item struct {
	Id *string `json:"id,omitempty"` // item 在 datasource 中的唯一标识

	Acl []*Acl `json:"acl,omitempty"` // item 的访问权限控制。 acl 字段为空数组，则默认数据不可见。如果数据是全员可见，需要设置 access="allow"; type="user"; value="everyone"

	Metadata *ItemMetadata `json:"metadata,omitempty"` // item 的元信息

	StructuredData *string `json:"structured_data,omitempty"` // 结构化数据（以 json 字符串传递），这些字段是搜索结果的展示字段(特殊字段无须在此另外指定);具体格式可参参考 [通用模块接入指南](/uAjLw4CM/ukTMukTMukTM/search-v2/common-template-intergration-handbook) **请求创建数据项**部分

	Content *ItemContent `json:"content,omitempty"` // 非结构化数据，如文档文本，飞书搜索会用来做召回
}

type ItemBuilder struct {
	id     string // item 在 datasource 中的唯一标识
	idFlag bool

	acl     []*Acl // item 的访问权限控制。 acl 字段为空数组，则默认数据不可见。如果数据是全员可见，需要设置 access="allow"; type="user"; value="everyone"
	aclFlag bool

	metadata     *ItemMetadata // item 的元信息
	metadataFlag bool

	structuredData     string // 结构化数据（以 json 字符串传递），这些字段是搜索结果的展示字段(特殊字段无须在此另外指定);具体格式可参参考 [通用模块接入指南](/uAjLw4CM/ukTMukTMukTM/search-v2/common-template-intergration-handbook) **请求创建数据项**部分
	structuredDataFlag bool

	content     *ItemContent // 非结构化数据，如文档文本，飞书搜索会用来做召回
	contentFlag bool
}

func NewItemBuilder() *ItemBuilder {
	builder := &ItemBuilder{}
	return builder
}

// item 在 datasource 中的唯一标识
//
// 示例值：01010111
func (builder *ItemBuilder) Id(id string) *ItemBuilder {
	builder.id = id
	builder.idFlag = true
	return builder
}

// item 的访问权限控制。 acl 字段为空数组，则默认数据不可见。如果数据是全员可见，需要设置 access="allow"; type="user"; value="everyone"
//
// 示例值：
func (builder *ItemBuilder) Acl(acl []*Acl) *ItemBuilder {
	builder.acl = acl
	builder.aclFlag = true
	return builder
}

// item 的元信息
//
// 示例值：
func (builder *ItemBuilder) Metadata(metadata *ItemMetadata) *ItemBuilder {
	builder.metadata = metadata
	builder.metadataFlag = true
	return builder
}

// 结构化数据（以 json 字符串传递），这些字段是搜索结果的展示字段(特殊字段无须在此另外指定);具体格式可参参考 [通用模块接入指南](/uAjLw4CM/ukTMukTMukTM/search-v2/common-template-intergration-handbook) **请求创建数据项**部分
//
// 示例值：{\"key\":\"value\"}
func (builder *ItemBuilder) StructuredData(structuredData string) *ItemBuilder {
	builder.structuredData = structuredData
	builder.structuredDataFlag = true
	return builder
}

// 非结构化数据，如文档文本，飞书搜索会用来做召回
//
// 示例值：
func (builder *ItemBuilder) Content(content *ItemContent) *ItemBuilder {
	builder.content = content
	builder.contentFlag = true
	return builder
}

func (builder *ItemBuilder) Build() *Item {
	req := &Item{}
	if builder.idFlag {
		req.Id = &builder.id

	}
	if builder.aclFlag {
		req.Acl = builder.acl
	}
	if builder.metadataFlag {
		req.Metadata = builder.metadata
	}
	if builder.structuredDataFlag {
		req.StructuredData = &builder.structuredData

	}
	if builder.contentFlag {
		req.Content = builder.content
	}
	return req
}

type ItemContent struct {
	Format *string `json:"format,omitempty"` // 内容的格式

	ContentData *string `json:"content_data,omitempty"` // 全文数据
}

type ItemContentBuilder struct {
	format     string // 内容的格式
	formatFlag bool

	contentData     string // 全文数据
	contentDataFlag bool
}

func NewItemContentBuilder() *ItemContentBuilder {
	builder := &ItemContentBuilder{}
	return builder
}

// 内容的格式
//
// 示例值：html
func (builder *ItemContentBuilder) Format(format string) *ItemContentBuilder {
	builder.format = format
	builder.formatFlag = true
	return builder
}

// 全文数据
//
// 示例值：这是一个很长的文本
func (builder *ItemContentBuilder) ContentData(contentData string) *ItemContentBuilder {
	builder.contentData = contentData
	builder.contentDataFlag = true
	return builder
}

func (builder *ItemContentBuilder) Build() *ItemContent {
	req := &ItemContent{}
	if builder.formatFlag {
		req.Format = &builder.format

	}
	if builder.contentDataFlag {
		req.ContentData = &builder.contentData

	}
	return req
}

type ItemMetadata struct {
	Title *string `json:"title,omitempty"` // 该条数据记录对应的标题

	SourceUrl *string `json:"source_url,omitempty"` // 该条数据记录对应的跳转url

	CreateTime *int `json:"create_time,omitempty"` // 数据项的创建时间。Unix 时间，单位为秒

	UpdateTime *int `json:"update_time,omitempty"` // 数据项的更新时间。Unix 时间，单位为秒

	SourceUrlMobile *string `json:"source_url_mobile,omitempty"` // 移动端搜索命中的跳转地址。如果您PC端和移动端有不同的跳转地址，可以在这里写入移动端专用的url，我们会在搜索时为您选择合适的地址
}

type ItemMetadataBuilder struct {
	title     string // 该条数据记录对应的标题
	titleFlag bool

	sourceUrl     string // 该条数据记录对应的跳转url
	sourceUrlFlag bool

	createTime     int // 数据项的创建时间。Unix 时间，单位为秒
	createTimeFlag bool

	updateTime     int // 数据项的更新时间。Unix 时间，单位为秒
	updateTimeFlag bool

	sourceUrlMobile     string // 移动端搜索命中的跳转地址。如果您PC端和移动端有不同的跳转地址，可以在这里写入移动端专用的url，我们会在搜索时为您选择合适的地址
	sourceUrlMobileFlag bool
}

func NewItemMetadataBuilder() *ItemMetadataBuilder {
	builder := &ItemMetadataBuilder{}
	return builder
}

// 该条数据记录对应的标题
//
// 示例值：工单：无法创建文章
func (builder *ItemMetadataBuilder) Title(title string) *ItemMetadataBuilder {
	builder.title = title
	builder.titleFlag = true
	return builder
}

// 该条数据记录对应的跳转url
//
// 示例值：http://www.abc.com.cn
func (builder *ItemMetadataBuilder) SourceUrl(sourceUrl string) *ItemMetadataBuilder {
	builder.sourceUrl = sourceUrl
	builder.sourceUrlFlag = true
	return builder
}

// 数据项的创建时间。Unix 时间，单位为秒
//
// 示例值：1618831236
func (builder *ItemMetadataBuilder) CreateTime(createTime int) *ItemMetadataBuilder {
	builder.createTime = createTime
	builder.createTimeFlag = true
	return builder
}

// 数据项的更新时间。Unix 时间，单位为秒
//
// 示例值：1618831236
func (builder *ItemMetadataBuilder) UpdateTime(updateTime int) *ItemMetadataBuilder {
	builder.updateTime = updateTime
	builder.updateTimeFlag = true
	return builder
}

// 移动端搜索命中的跳转地址。如果您PC端和移动端有不同的跳转地址，可以在这里写入移动端专用的url，我们会在搜索时为您选择合适的地址
//
// 示例值：https://www.feishu.cn
func (builder *ItemMetadataBuilder) SourceUrlMobile(sourceUrlMobile string) *ItemMetadataBuilder {
	builder.sourceUrlMobile = sourceUrlMobile
	builder.sourceUrlMobileFlag = true
	return builder
}

func (builder *ItemMetadataBuilder) Build() *ItemMetadata {
	req := &ItemMetadata{}
	if builder.titleFlag {
		req.Title = &builder.title

	}
	if builder.sourceUrlFlag {
		req.SourceUrl = &builder.sourceUrl

	}
	if builder.createTimeFlag {
		req.CreateTime = &builder.createTime

	}
	if builder.updateTimeFlag {
		req.UpdateTime = &builder.updateTime

	}
	if builder.sourceUrlMobileFlag {
		req.SourceUrlMobile = &builder.sourceUrlMobile

	}
	return req
}

type ItemRecord struct {
	ItemId *string `json:"item_id,omitempty"` // 冗余当前item的ID

	DataSourceId *string `json:"data_source_id,omitempty"` // 数据源id

	Version *string `json:"version,omitempty"` // 当前数据的最新版本号，其值等于上一次item/create接口传入的时间戳

	CreatedAt *string `json:"created_at,omitempty"` // 第一次投递时间

	UpdatedAt *string `json:"updated_at,omitempty"` // 上一次更新落库时间
}

type ItemRecordBuilder struct {
	itemId     string // 冗余当前item的ID
	itemIdFlag bool

	dataSourceId     string // 数据源id
	dataSourceIdFlag bool

	version     string // 当前数据的最新版本号，其值等于上一次item/create接口传入的时间戳
	versionFlag bool

	createdAt     string // 第一次投递时间
	createdAtFlag bool

	updatedAt     string // 上一次更新落库时间
	updatedAtFlag bool
}

func NewItemRecordBuilder() *ItemRecordBuilder {
	builder := &ItemRecordBuilder{}
	return builder
}

// 冗余当前item的ID
//
// 示例值：
func (builder *ItemRecordBuilder) ItemId(itemId string) *ItemRecordBuilder {
	builder.itemId = itemId
	builder.itemIdFlag = true
	return builder
}

// 数据源id
//
// 示例值：
func (builder *ItemRecordBuilder) DataSourceId(dataSourceId string) *ItemRecordBuilder {
	builder.dataSourceId = dataSourceId
	builder.dataSourceIdFlag = true
	return builder
}

// 当前数据的最新版本号，其值等于上一次item/create接口传入的时间戳
//
// 示例值：
func (builder *ItemRecordBuilder) Version(version string) *ItemRecordBuilder {
	builder.version = version
	builder.versionFlag = true
	return builder
}

// 第一次投递时间
//
// 示例值：
func (builder *ItemRecordBuilder) CreatedAt(createdAt string) *ItemRecordBuilder {
	builder.createdAt = createdAt
	builder.createdAtFlag = true
	return builder
}

// 上一次更新落库时间
//
// 示例值：
func (builder *ItemRecordBuilder) UpdatedAt(updatedAt string) *ItemRecordBuilder {
	builder.updatedAt = updatedAt
	builder.updatedAtFlag = true
	return builder
}

func (builder *ItemRecordBuilder) Build() *ItemRecord {
	req := &ItemRecord{}
	if builder.itemIdFlag {
		req.ItemId = &builder.itemId

	}
	if builder.dataSourceIdFlag {
		req.DataSourceId = &builder.dataSourceId

	}
	if builder.versionFlag {
		req.Version = &builder.version

	}
	if builder.createdAtFlag {
		req.CreatedAt = &builder.createdAt

	}
	if builder.updatedAtFlag {
		req.UpdatedAt = &builder.updatedAt

	}
	return req
}

type KnowledgeQaAnswerRequest struct {
	Query *string `json:"query,omitempty"` // 用户问题

	EnableImage *bool `json:"enable_image,omitempty"` // 启用图片理解与展示

	KnowledgeScope *string `json:"knowledge_scope,omitempty"` // 指定答案生成的知识范围

	EnterpriseKnowledgeSource *EnterpriseKnowledgeSourceParam `json:"enterprise_knowledge_source,omitempty"` // 企业内知识的检索范围，选择企业内知识时必填

	Extra *KnowledgeSourceRequestExtra `json:"extra,omitempty"` // 额外信息

	ModelType *string `json:"model_type,omitempty"` // 大模型种类

	HistoryMessages []*KnowledgeQaMessage `json:"history_messages,omitempty"` // 用户在同一会话内的历史对话
}

type KnowledgeQaAnswerRequestBuilder struct {
	query     string // 用户问题
	queryFlag bool

	enableImage     bool // 启用图片理解与展示
	enableImageFlag bool

	knowledgeScope     string // 指定答案生成的知识范围
	knowledgeScopeFlag bool

	enterpriseKnowledgeSource     *EnterpriseKnowledgeSourceParam // 企业内知识的检索范围，选择企业内知识时必填
	enterpriseKnowledgeSourceFlag bool

	extra     *KnowledgeSourceRequestExtra // 额外信息
	extraFlag bool

	modelType     string // 大模型种类
	modelTypeFlag bool

	historyMessages     []*KnowledgeQaMessage // 用户在同一会话内的历史对话
	historyMessagesFlag bool
}

func NewKnowledgeQaAnswerRequestBuilder() *KnowledgeQaAnswerRequestBuilder {
	builder := &KnowledgeQaAnswerRequestBuilder{}
	return builder
}

// 用户问题
//
// 示例值：如何申请显示器
func (builder *KnowledgeQaAnswerRequestBuilder) Query(query string) *KnowledgeQaAnswerRequestBuilder {
	builder.query = query
	builder.queryFlag = true
	return builder
}

// 启用图片理解与展示
//
// 示例值：false
func (builder *KnowledgeQaAnswerRequestBuilder) EnableImage(enableImage bool) *KnowledgeQaAnswerRequestBuilder {
	builder.enableImage = enableImage
	builder.enableImageFlag = true
	return builder
}

// 指定答案生成的知识范围
//
// 示例值：enterprise
func (builder *KnowledgeQaAnswerRequestBuilder) KnowledgeScope(knowledgeScope string) *KnowledgeQaAnswerRequestBuilder {
	builder.knowledgeScope = knowledgeScope
	builder.knowledgeScopeFlag = true
	return builder
}

// 企业内知识的检索范围，选择企业内知识时必填
//
// 示例值：
func (builder *KnowledgeQaAnswerRequestBuilder) EnterpriseKnowledgeSource(enterpriseKnowledgeSource *EnterpriseKnowledgeSourceParam) *KnowledgeQaAnswerRequestBuilder {
	builder.enterpriseKnowledgeSource = enterpriseKnowledgeSource
	builder.enterpriseKnowledgeSourceFlag = true
	return builder
}

// 额外信息
//
// 示例值：
func (builder *KnowledgeQaAnswerRequestBuilder) Extra(extra *KnowledgeSourceRequestExtra) *KnowledgeQaAnswerRequestBuilder {
	builder.extra = extra
	builder.extraFlag = true
	return builder
}

// 大模型种类
//
// 示例值：doubao
func (builder *KnowledgeQaAnswerRequestBuilder) ModelType(modelType string) *KnowledgeQaAnswerRequestBuilder {
	builder.modelType = modelType
	builder.modelTypeFlag = true
	return builder
}

// 用户在同一会话内的历史对话
//
// 示例值：
func (builder *KnowledgeQaAnswerRequestBuilder) HistoryMessages(historyMessages []*KnowledgeQaMessage) *KnowledgeQaAnswerRequestBuilder {
	builder.historyMessages = historyMessages
	builder.historyMessagesFlag = true
	return builder
}

func (builder *KnowledgeQaAnswerRequestBuilder) Build() *KnowledgeQaAnswerRequest {
	req := &KnowledgeQaAnswerRequest{}
	if builder.queryFlag {
		req.Query = &builder.query

	}
	if builder.enableImageFlag {
		req.EnableImage = &builder.enableImage

	}
	if builder.knowledgeScopeFlag {
		req.KnowledgeScope = &builder.knowledgeScope

	}
	if builder.enterpriseKnowledgeSourceFlag {
		req.EnterpriseKnowledgeSource = builder.enterpriseKnowledgeSource
	}
	if builder.extraFlag {
		req.Extra = builder.extra
	}
	if builder.modelTypeFlag {
		req.ModelType = &builder.modelType

	}
	if builder.historyMessagesFlag {
		req.HistoryMessages = builder.historyMessages
	}
	return req
}

type KnowledgeQaAnswerResponse struct {
	Answer *string `json:"answer,omitempty"` // answer

	ReasoningContent *string `json:"reasoning_content,omitempty"` // reasoning_content

	StatusCode *int `json:"status_code,omitempty"` // 业务状态码

	StatusMessage *string `json:"status_message,omitempty"` // 业务状态消息

	References *KnowledgeQaReference `json:"references,omitempty"` // 参考列表
}

type KnowledgeQaAnswerResponseBuilder struct {
	answer     string // answer
	answerFlag bool

	reasoningContent     string // reasoning_content
	reasoningContentFlag bool

	statusCode     int // 业务状态码
	statusCodeFlag bool

	statusMessage     string // 业务状态消息
	statusMessageFlag bool

	references     *KnowledgeQaReference // 参考列表
	referencesFlag bool
}

func NewKnowledgeQaAnswerResponseBuilder() *KnowledgeQaAnswerResponseBuilder {
	builder := &KnowledgeQaAnswerResponseBuilder{}
	return builder
}

// answer
//
// 示例值：xxxxx
func (builder *KnowledgeQaAnswerResponseBuilder) Answer(answer string) *KnowledgeQaAnswerResponseBuilder {
	builder.answer = answer
	builder.answerFlag = true
	return builder
}

// reasoning_content
//
// 示例值：xxxxxx
func (builder *KnowledgeQaAnswerResponseBuilder) ReasoningContent(reasoningContent string) *KnowledgeQaAnswerResponseBuilder {
	builder.reasoningContent = reasoningContent
	builder.reasoningContentFlag = true
	return builder
}

// 业务状态码
//
// 示例值：0
func (builder *KnowledgeQaAnswerResponseBuilder) StatusCode(statusCode int) *KnowledgeQaAnswerResponseBuilder {
	builder.statusCode = statusCode
	builder.statusCodeFlag = true
	return builder
}

// 业务状态消息
//
// 示例值：“”
func (builder *KnowledgeQaAnswerResponseBuilder) StatusMessage(statusMessage string) *KnowledgeQaAnswerResponseBuilder {
	builder.statusMessage = statusMessage
	builder.statusMessageFlag = true
	return builder
}

// 参考列表
//
// 示例值：
func (builder *KnowledgeQaAnswerResponseBuilder) References(references *KnowledgeQaReference) *KnowledgeQaAnswerResponseBuilder {
	builder.references = references
	builder.referencesFlag = true
	return builder
}

func (builder *KnowledgeQaAnswerResponseBuilder) Build() *KnowledgeQaAnswerResponse {
	req := &KnowledgeQaAnswerResponse{}
	if builder.answerFlag {
		req.Answer = &builder.answer

	}
	if builder.reasoningContentFlag {
		req.ReasoningContent = &builder.reasoningContent

	}
	if builder.statusCodeFlag {
		req.StatusCode = &builder.statusCode

	}
	if builder.statusMessageFlag {
		req.StatusMessage = &builder.statusMessage

	}
	if builder.referencesFlag {
		req.References = builder.references
	}
	return req
}

type KnowledgeQaEnterpriseReference struct {
	Id *string `json:"id,omitempty"` // passage_id

	SourceType *int `json:"source_type,omitempty"` // source_type

	Title *string `json:"title,omitempty"` // title

	Content *string `json:"content,omitempty"` // content

	Url *string `json:"url,omitempty"` // url
}

type KnowledgeQaEnterpriseReferenceBuilder struct {
	id     string // passage_id
	idFlag bool

	sourceType     int // source_type
	sourceTypeFlag bool

	title     string // title
	titleFlag bool

	content     string // content
	contentFlag bool

	url     string // url
	urlFlag bool
}

func NewKnowledgeQaEnterpriseReferenceBuilder() *KnowledgeQaEnterpriseReferenceBuilder {
	builder := &KnowledgeQaEnterpriseReferenceBuilder{}
	return builder
}

// passage_id
//
// 示例值：123456
func (builder *KnowledgeQaEnterpriseReferenceBuilder) Id(id string) *KnowledgeQaEnterpriseReferenceBuilder {
	builder.id = id
	builder.idFlag = true
	return builder
}

// source_type
//
// 示例值：1
func (builder *KnowledgeQaEnterpriseReferenceBuilder) SourceType(sourceType int) *KnowledgeQaEnterpriseReferenceBuilder {
	builder.sourceType = sourceType
	builder.sourceTypeFlag = true
	return builder
}

// title
//
// 示例值：xxxxx
func (builder *KnowledgeQaEnterpriseReferenceBuilder) Title(title string) *KnowledgeQaEnterpriseReferenceBuilder {
	builder.title = title
	builder.titleFlag = true
	return builder
}

// content
//
// 示例值：xxxxxx
func (builder *KnowledgeQaEnterpriseReferenceBuilder) Content(content string) *KnowledgeQaEnterpriseReferenceBuilder {
	builder.content = content
	builder.contentFlag = true
	return builder
}

// url
//
// 示例值：xxxxx
func (builder *KnowledgeQaEnterpriseReferenceBuilder) Url(url string) *KnowledgeQaEnterpriseReferenceBuilder {
	builder.url = url
	builder.urlFlag = true
	return builder
}

func (builder *KnowledgeQaEnterpriseReferenceBuilder) Build() *KnowledgeQaEnterpriseReference {
	req := &KnowledgeQaEnterpriseReference{}
	if builder.idFlag {
		req.Id = &builder.id

	}
	if builder.sourceTypeFlag {
		req.SourceType = &builder.sourceType

	}
	if builder.titleFlag {
		req.Title = &builder.title

	}
	if builder.contentFlag {
		req.Content = &builder.content

	}
	if builder.urlFlag {
		req.Url = &builder.url

	}
	return req
}

type KnowledgeQaInternetReference struct {
	Title *string `json:"title,omitempty"` // title

	Summary *string `json:"summary,omitempty"` // summary

	Url *string `json:"url,omitempty"` // url
}

type KnowledgeQaInternetReferenceBuilder struct {
	title     string // title
	titleFlag bool

	summary     string // summary
	summaryFlag bool

	url     string // url
	urlFlag bool
}

func NewKnowledgeQaInternetReferenceBuilder() *KnowledgeQaInternetReferenceBuilder {
	builder := &KnowledgeQaInternetReferenceBuilder{}
	return builder
}

// title
//
// 示例值：xxxxxx
func (builder *KnowledgeQaInternetReferenceBuilder) Title(title string) *KnowledgeQaInternetReferenceBuilder {
	builder.title = title
	builder.titleFlag = true
	return builder
}

// summary
//
// 示例值：xxxxx
func (builder *KnowledgeQaInternetReferenceBuilder) Summary(summary string) *KnowledgeQaInternetReferenceBuilder {
	builder.summary = summary
	builder.summaryFlag = true
	return builder
}

// url
//
// 示例值：xxxxxx
func (builder *KnowledgeQaInternetReferenceBuilder) Url(url string) *KnowledgeQaInternetReferenceBuilder {
	builder.url = url
	builder.urlFlag = true
	return builder
}

func (builder *KnowledgeQaInternetReferenceBuilder) Build() *KnowledgeQaInternetReference {
	req := &KnowledgeQaInternetReference{}
	if builder.titleFlag {
		req.Title = &builder.title

	}
	if builder.summaryFlag {
		req.Summary = &builder.summary

	}
	if builder.urlFlag {
		req.Url = &builder.url

	}
	return req
}

type KnowledgeQaMessage struct {
	Role *int `json:"role,omitempty"` // 消息发送者的角色

	Content *string `json:"content,omitempty"` // 消息内容
}

type KnowledgeQaMessageBuilder struct {
	role     int // 消息发送者的角色
	roleFlag bool

	content     string // 消息内容
	contentFlag bool
}

func NewKnowledgeQaMessageBuilder() *KnowledgeQaMessageBuilder {
	builder := &KnowledgeQaMessageBuilder{}
	return builder
}

// 消息发送者的角色
//
// 示例值：1
func (builder *KnowledgeQaMessageBuilder) Role(role int) *KnowledgeQaMessageBuilder {
	builder.role = role
	builder.roleFlag = true
	return builder
}

// 消息内容
//
// 示例值：content
func (builder *KnowledgeQaMessageBuilder) Content(content string) *KnowledgeQaMessageBuilder {
	builder.content = content
	builder.contentFlag = true
	return builder
}

func (builder *KnowledgeQaMessageBuilder) Build() *KnowledgeQaMessage {
	req := &KnowledgeQaMessage{}
	if builder.roleFlag {
		req.Role = &builder.role

	}
	if builder.contentFlag {
		req.Content = &builder.content

	}
	return req
}

type KnowledgeQaReference struct {
	EnterpriseRefs []*KnowledgeQaEnterpriseReference `json:"enterprise_refs,omitempty"` // enterprise_refs

	InternetRefs []*KnowledgeQaInternetReference `json:"internet_refs,omitempty"` // internet_refs
}

type KnowledgeQaReferenceBuilder struct {
	enterpriseRefs     []*KnowledgeQaEnterpriseReference // enterprise_refs
	enterpriseRefsFlag bool

	internetRefs     []*KnowledgeQaInternetReference // internet_refs
	internetRefsFlag bool
}

func NewKnowledgeQaReferenceBuilder() *KnowledgeQaReferenceBuilder {
	builder := &KnowledgeQaReferenceBuilder{}
	return builder
}

// enterprise_refs
//
// 示例值：
func (builder *KnowledgeQaReferenceBuilder) EnterpriseRefs(enterpriseRefs []*KnowledgeQaEnterpriseReference) *KnowledgeQaReferenceBuilder {
	builder.enterpriseRefs = enterpriseRefs
	builder.enterpriseRefsFlag = true
	return builder
}

// internet_refs
//
// 示例值：
func (builder *KnowledgeQaReferenceBuilder) InternetRefs(internetRefs []*KnowledgeQaInternetReference) *KnowledgeQaReferenceBuilder {
	builder.internetRefs = internetRefs
	builder.internetRefsFlag = true
	return builder
}

func (builder *KnowledgeQaReferenceBuilder) Build() *KnowledgeQaReference {
	req := &KnowledgeQaReference{}
	if builder.enterpriseRefsFlag {
		req.EnterpriseRefs = builder.enterpriseRefs
	}
	if builder.internetRefsFlag {
		req.InternetRefs = builder.internetRefs
	}
	return req
}

type KnowledgeQaSearchEnterprisePassage struct {
	Id *string `json:"id,omitempty"` // passage_id

	SourceType *int `json:"source_type,omitempty"` // source_type

	Title *string `json:"title,omitempty"` // title

	Content *string `json:"content,omitempty"` // content

	Url *string `json:"url,omitempty"` // url

	Score *float64 `json:"score,omitempty"` // 相关性打分
}

type KnowledgeQaSearchEnterprisePassageBuilder struct {
	id     string // passage_id
	idFlag bool

	sourceType     int // source_type
	sourceTypeFlag bool

	title     string // title
	titleFlag bool

	content     string // content
	contentFlag bool

	url     string // url
	urlFlag bool

	score     float64 // 相关性打分
	scoreFlag bool
}

func NewKnowledgeQaSearchEnterprisePassageBuilder() *KnowledgeQaSearchEnterprisePassageBuilder {
	builder := &KnowledgeQaSearchEnterprisePassageBuilder{}
	return builder
}

// passage_id
//
// 示例值：123456
func (builder *KnowledgeQaSearchEnterprisePassageBuilder) Id(id string) *KnowledgeQaSearchEnterprisePassageBuilder {
	builder.id = id
	builder.idFlag = true
	return builder
}

// source_type
//
// 示例值：1
func (builder *KnowledgeQaSearchEnterprisePassageBuilder) SourceType(sourceType int) *KnowledgeQaSearchEnterprisePassageBuilder {
	builder.sourceType = sourceType
	builder.sourceTypeFlag = true
	return builder
}

// title
//
// 示例值：xxxxx
func (builder *KnowledgeQaSearchEnterprisePassageBuilder) Title(title string) *KnowledgeQaSearchEnterprisePassageBuilder {
	builder.title = title
	builder.titleFlag = true
	return builder
}

// content
//
// 示例值：xxxxxx
func (builder *KnowledgeQaSearchEnterprisePassageBuilder) Content(content string) *KnowledgeQaSearchEnterprisePassageBuilder {
	builder.content = content
	builder.contentFlag = true
	return builder
}

// url
//
// 示例值：xxxxx
func (builder *KnowledgeQaSearchEnterprisePassageBuilder) Url(url string) *KnowledgeQaSearchEnterprisePassageBuilder {
	builder.url = url
	builder.urlFlag = true
	return builder
}

// 相关性打分
//
// 示例值：0.0
func (builder *KnowledgeQaSearchEnterprisePassageBuilder) Score(score float64) *KnowledgeQaSearchEnterprisePassageBuilder {
	builder.score = score
	builder.scoreFlag = true
	return builder
}

func (builder *KnowledgeQaSearchEnterprisePassageBuilder) Build() *KnowledgeQaSearchEnterprisePassage {
	req := &KnowledgeQaSearchEnterprisePassage{}
	if builder.idFlag {
		req.Id = &builder.id

	}
	if builder.sourceTypeFlag {
		req.SourceType = &builder.sourceType

	}
	if builder.titleFlag {
		req.Title = &builder.title

	}
	if builder.contentFlag {
		req.Content = &builder.content

	}
	if builder.urlFlag {
		req.Url = &builder.url

	}
	if builder.scoreFlag {
		req.Score = &builder.score

	}
	return req
}

type KnowledgeQaSearchRequest struct {
	Query *string `json:"query,omitempty"` // query

	EnterpriseKnowledgeSource *EnterpriseKnowledgeSourceParam `json:"enterprise_knowledge_source,omitempty"` // enterprise_knowledge_source
}

type KnowledgeQaSearchRequestBuilder struct {
	query     string // query
	queryFlag bool

	enterpriseKnowledgeSource     *EnterpriseKnowledgeSourceParam // enterprise_knowledge_source
	enterpriseKnowledgeSourceFlag bool
}

func NewKnowledgeQaSearchRequestBuilder() *KnowledgeQaSearchRequestBuilder {
	builder := &KnowledgeQaSearchRequestBuilder{}
	return builder
}

// query
//
// 示例值：hello
func (builder *KnowledgeQaSearchRequestBuilder) Query(query string) *KnowledgeQaSearchRequestBuilder {
	builder.query = query
	builder.queryFlag = true
	return builder
}

// enterprise_knowledge_source
//
// 示例值：
func (builder *KnowledgeQaSearchRequestBuilder) EnterpriseKnowledgeSource(enterpriseKnowledgeSource *EnterpriseKnowledgeSourceParam) *KnowledgeQaSearchRequestBuilder {
	builder.enterpriseKnowledgeSource = enterpriseKnowledgeSource
	builder.enterpriseKnowledgeSourceFlag = true
	return builder
}

func (builder *KnowledgeQaSearchRequestBuilder) Build() *KnowledgeQaSearchRequest {
	req := &KnowledgeQaSearchRequest{}
	if builder.queryFlag {
		req.Query = &builder.query

	}
	if builder.enterpriseKnowledgeSourceFlag {
		req.EnterpriseKnowledgeSource = builder.enterpriseKnowledgeSource
	}
	return req
}

type KnowledgeSourceHelpdeskFilter struct {
	HelpdeskIds []string `json:"helpdesk_ids,omitempty"` // 服务台 ID 列表
}

type KnowledgeSourceHelpdeskFilterBuilder struct {
	helpdeskIds     []string // 服务台 ID 列表
	helpdeskIdsFlag bool
}

func NewKnowledgeSourceHelpdeskFilterBuilder() *KnowledgeSourceHelpdeskFilterBuilder {
	builder := &KnowledgeSourceHelpdeskFilterBuilder{}
	return builder
}

// 服务台 ID 列表
//
// 示例值：
func (builder *KnowledgeSourceHelpdeskFilterBuilder) HelpdeskIds(helpdeskIds []string) *KnowledgeSourceHelpdeskFilterBuilder {
	builder.helpdeskIds = helpdeskIds
	builder.helpdeskIdsFlag = true
	return builder
}

func (builder *KnowledgeSourceHelpdeskFilterBuilder) Build() *KnowledgeSourceHelpdeskFilter {
	req := &KnowledgeSourceHelpdeskFilter{}
	if builder.helpdeskIdsFlag {
		req.HelpdeskIds = builder.helpdeskIds
	}
	return req
}

type KnowledgeSourceMessageFilter struct {
	ChatIds []string `json:"chat_ids,omitempty"` // 会话 ID 列表

	TimeRange *TimeRange `json:"time_range,omitempty"` // 时间范围
}

type KnowledgeSourceMessageFilterBuilder struct {
	chatIds     []string // 会话 ID 列表
	chatIdsFlag bool

	timeRange     *TimeRange // 时间范围
	timeRangeFlag bool
}

func NewKnowledgeSourceMessageFilterBuilder() *KnowledgeSourceMessageFilterBuilder {
	builder := &KnowledgeSourceMessageFilterBuilder{}
	return builder
}

// 会话 ID 列表
//
// 示例值：
func (builder *KnowledgeSourceMessageFilterBuilder) ChatIds(chatIds []string) *KnowledgeSourceMessageFilterBuilder {
	builder.chatIds = chatIds
	builder.chatIdsFlag = true
	return builder
}

// 时间范围
//
// 示例值：
func (builder *KnowledgeSourceMessageFilterBuilder) TimeRange(timeRange *TimeRange) *KnowledgeSourceMessageFilterBuilder {
	builder.timeRange = timeRange
	builder.timeRangeFlag = true
	return builder
}

func (builder *KnowledgeSourceMessageFilterBuilder) Build() *KnowledgeSourceMessageFilter {
	req := &KnowledgeSourceMessageFilter{}
	if builder.chatIdsFlag {
		req.ChatIds = builder.chatIds
	}
	if builder.timeRangeFlag {
		req.TimeRange = builder.timeRange
	}
	return req
}

type KnowledgeSourceMessageReject struct {
	MessageIds []string `json:"message_ids,omitempty"` // 消息 ID 列表

	ChatIds []string `json:"chat_ids,omitempty"` // 会话 ID 列表
}

type KnowledgeSourceMessageRejectBuilder struct {
	messageIds     []string // 消息 ID 列表
	messageIdsFlag bool

	chatIds     []string // 会话 ID 列表
	chatIdsFlag bool
}

func NewKnowledgeSourceMessageRejectBuilder() *KnowledgeSourceMessageRejectBuilder {
	builder := &KnowledgeSourceMessageRejectBuilder{}
	return builder
}

// 消息 ID 列表
//
// 示例值：
func (builder *KnowledgeSourceMessageRejectBuilder) MessageIds(messageIds []string) *KnowledgeSourceMessageRejectBuilder {
	builder.messageIds = messageIds
	builder.messageIdsFlag = true
	return builder
}

// 会话 ID 列表
//
// 示例值：
func (builder *KnowledgeSourceMessageRejectBuilder) ChatIds(chatIds []string) *KnowledgeSourceMessageRejectBuilder {
	builder.chatIds = chatIds
	builder.chatIdsFlag = true
	return builder
}

func (builder *KnowledgeSourceMessageRejectBuilder) Build() *KnowledgeSourceMessageReject {
	req := &KnowledgeSourceMessageReject{}
	if builder.messageIdsFlag {
		req.MessageIds = builder.messageIds
	}
	if builder.chatIdsFlag {
		req.ChatIds = builder.chatIds
	}
	return req
}

type KnowledgeSourceRequestExtra struct {
	Locale *string `json:"locale,omitempty"` // locale

	Timezone *string `json:"timezone,omitempty"` // timezone
}

type KnowledgeSourceRequestExtraBuilder struct {
	locale     string // locale
	localeFlag bool

	timezone     string // timezone
	timezoneFlag bool
}

func NewKnowledgeSourceRequestExtraBuilder() *KnowledgeSourceRequestExtraBuilder {
	builder := &KnowledgeSourceRequestExtraBuilder{}
	return builder
}

// locale
//
// 示例值：zh-CN
func (builder *KnowledgeSourceRequestExtraBuilder) Locale(locale string) *KnowledgeSourceRequestExtraBuilder {
	builder.locale = locale
	builder.localeFlag = true
	return builder
}

// timezone
//
// 示例值：Asia/Tokyo
func (builder *KnowledgeSourceRequestExtraBuilder) Timezone(timezone string) *KnowledgeSourceRequestExtraBuilder {
	builder.timezone = timezone
	builder.timezoneFlag = true
	return builder
}

func (builder *KnowledgeSourceRequestExtraBuilder) Build() *KnowledgeSourceRequestExtra {
	req := &KnowledgeSourceRequestExtra{}
	if builder.localeFlag {
		req.Locale = &builder.locale

	}
	if builder.timezoneFlag {
		req.Timezone = &builder.timezone

	}
	return req
}

type KnowledgeSourceSpaceFilter struct {
	DocTokens []string `json:"doc_tokens,omitempty"` // 云空间文档 token 列表

	FolderTokens []string `json:"folder_tokens,omitempty"` // 云空间文件夹 token 列表
}

type KnowledgeSourceSpaceFilterBuilder struct {
	docTokens     []string // 云空间文档 token 列表
	docTokensFlag bool

	folderTokens     []string // 云空间文件夹 token 列表
	folderTokensFlag bool
}

func NewKnowledgeSourceSpaceFilterBuilder() *KnowledgeSourceSpaceFilterBuilder {
	builder := &KnowledgeSourceSpaceFilterBuilder{}
	return builder
}

// 云空间文档 token 列表
//
// 示例值：
func (builder *KnowledgeSourceSpaceFilterBuilder) DocTokens(docTokens []string) *KnowledgeSourceSpaceFilterBuilder {
	builder.docTokens = docTokens
	builder.docTokensFlag = true
	return builder
}

// 云空间文件夹 token 列表
//
// 示例值：
func (builder *KnowledgeSourceSpaceFilterBuilder) FolderTokens(folderTokens []string) *KnowledgeSourceSpaceFilterBuilder {
	builder.folderTokens = folderTokens
	builder.folderTokensFlag = true
	return builder
}

func (builder *KnowledgeSourceSpaceFilterBuilder) Build() *KnowledgeSourceSpaceFilter {
	req := &KnowledgeSourceSpaceFilter{}
	if builder.docTokensFlag {
		req.DocTokens = builder.docTokens
	}
	if builder.folderTokensFlag {
		req.FolderTokens = builder.folderTokens
	}
	return req
}

type KnowledgeSourceSpaceReject struct {
	DocTokens []string `json:"doc_tokens,omitempty"` // 云空间文档 token 列表

	FolderTokens []string `json:"folder_tokens,omitempty"` // 云空间文件夹 token 列表
}

type KnowledgeSourceSpaceRejectBuilder struct {
	docTokens     []string // 云空间文档 token 列表
	docTokensFlag bool

	folderTokens     []string // 云空间文件夹 token 列表
	folderTokensFlag bool
}

func NewKnowledgeSourceSpaceRejectBuilder() *KnowledgeSourceSpaceRejectBuilder {
	builder := &KnowledgeSourceSpaceRejectBuilder{}
	return builder
}

// 云空间文档 token 列表
//
// 示例值：
func (builder *KnowledgeSourceSpaceRejectBuilder) DocTokens(docTokens []string) *KnowledgeSourceSpaceRejectBuilder {
	builder.docTokens = docTokens
	builder.docTokensFlag = true
	return builder
}

// 云空间文件夹 token 列表
//
// 示例值：
func (builder *KnowledgeSourceSpaceRejectBuilder) FolderTokens(folderTokens []string) *KnowledgeSourceSpaceRejectBuilder {
	builder.folderTokens = folderTokens
	builder.folderTokensFlag = true
	return builder
}

func (builder *KnowledgeSourceSpaceRejectBuilder) Build() *KnowledgeSourceSpaceReject {
	req := &KnowledgeSourceSpaceReject{}
	if builder.docTokensFlag {
		req.DocTokens = builder.docTokens
	}
	if builder.folderTokensFlag {
		req.FolderTokens = builder.folderTokens
	}
	return req
}

type KnowledgeSourceWikiFilter struct {
	WikiTokens []string `json:"wiki_tokens,omitempty"` // 知识库文档 token 列表

	NodeTokens []string `json:"node_tokens,omitempty"` // 知识库节点 token 列表

	SpaceIds []string `json:"space_ids,omitempty"` // 知识库空间 ID 列表
}

type KnowledgeSourceWikiFilterBuilder struct {
	wikiTokens     []string // 知识库文档 token 列表
	wikiTokensFlag bool

	nodeTokens     []string // 知识库节点 token 列表
	nodeTokensFlag bool

	spaceIds     []string // 知识库空间 ID 列表
	spaceIdsFlag bool
}

func NewKnowledgeSourceWikiFilterBuilder() *KnowledgeSourceWikiFilterBuilder {
	builder := &KnowledgeSourceWikiFilterBuilder{}
	return builder
}

// 知识库文档 token 列表
//
// 示例值：
func (builder *KnowledgeSourceWikiFilterBuilder) WikiTokens(wikiTokens []string) *KnowledgeSourceWikiFilterBuilder {
	builder.wikiTokens = wikiTokens
	builder.wikiTokensFlag = true
	return builder
}

// 知识库节点 token 列表
//
// 示例值：
func (builder *KnowledgeSourceWikiFilterBuilder) NodeTokens(nodeTokens []string) *KnowledgeSourceWikiFilterBuilder {
	builder.nodeTokens = nodeTokens
	builder.nodeTokensFlag = true
	return builder
}

// 知识库空间 ID 列表
//
// 示例值：
func (builder *KnowledgeSourceWikiFilterBuilder) SpaceIds(spaceIds []string) *KnowledgeSourceWikiFilterBuilder {
	builder.spaceIds = spaceIds
	builder.spaceIdsFlag = true
	return builder
}

func (builder *KnowledgeSourceWikiFilterBuilder) Build() *KnowledgeSourceWikiFilter {
	req := &KnowledgeSourceWikiFilter{}
	if builder.wikiTokensFlag {
		req.WikiTokens = builder.wikiTokens
	}
	if builder.nodeTokensFlag {
		req.NodeTokens = builder.nodeTokens
	}
	if builder.spaceIdsFlag {
		req.SpaceIds = builder.spaceIds
	}
	return req
}

type KnowledgeSourceWikiReject struct {
	WikiTokens []string `json:"wiki_tokens,omitempty"` // 知识库文档 token 列表

	NodeTokens []string `json:"node_tokens,omitempty"` // 知识库节点 token 列表

	SpaceIds []string `json:"space_ids,omitempty"` // 知识库空间 ID 列表
}

type KnowledgeSourceWikiRejectBuilder struct {
	wikiTokens     []string // 知识库文档 token 列表
	wikiTokensFlag bool

	nodeTokens     []string // 知识库节点 token 列表
	nodeTokensFlag bool

	spaceIds     []string // 知识库空间 ID 列表
	spaceIdsFlag bool
}

func NewKnowledgeSourceWikiRejectBuilder() *KnowledgeSourceWikiRejectBuilder {
	builder := &KnowledgeSourceWikiRejectBuilder{}
	return builder
}

// 知识库文档 token 列表
//
// 示例值：
func (builder *KnowledgeSourceWikiRejectBuilder) WikiTokens(wikiTokens []string) *KnowledgeSourceWikiRejectBuilder {
	builder.wikiTokens = wikiTokens
	builder.wikiTokensFlag = true
	return builder
}

// 知识库节点 token 列表
//
// 示例值：
func (builder *KnowledgeSourceWikiRejectBuilder) NodeTokens(nodeTokens []string) *KnowledgeSourceWikiRejectBuilder {
	builder.nodeTokens = nodeTokens
	builder.nodeTokensFlag = true
	return builder
}

// 知识库空间 ID 列表
//
// 示例值：
func (builder *KnowledgeSourceWikiRejectBuilder) SpaceIds(spaceIds []string) *KnowledgeSourceWikiRejectBuilder {
	builder.spaceIds = spaceIds
	builder.spaceIdsFlag = true
	return builder
}

func (builder *KnowledgeSourceWikiRejectBuilder) Build() *KnowledgeSourceWikiReject {
	req := &KnowledgeSourceWikiReject{}
	if builder.wikiTokensFlag {
		req.WikiTokens = builder.wikiTokens
	}
	if builder.nodeTokensFlag {
		req.NodeTokens = builder.nodeTokens
	}
	if builder.spaceIdsFlag {
		req.SpaceIds = builder.spaceIds
	}
	return req
}

type LingoPassageParam struct {
	Searchable *bool `json:"searchable,omitempty"` // 是否搜索lingo
}

type LingoPassageParamBuilder struct {
	searchable     bool // 是否搜索lingo
	searchableFlag bool
}

func NewLingoPassageParamBuilder() *LingoPassageParamBuilder {
	builder := &LingoPassageParamBuilder{}
	return builder
}

// 是否搜索lingo
//
// 示例值：true
func (builder *LingoPassageParamBuilder) Searchable(searchable bool) *LingoPassageParamBuilder {
	builder.searchable = searchable
	builder.searchableFlag = true
	return builder
}

func (builder *LingoPassageParamBuilder) Build() *LingoPassageParam {
	req := &LingoPassageParam{}
	if builder.searchableFlag {
		req.Searchable = &builder.searchable

	}
	return req
}

type LlmModelConfig struct {
	ModelName *string `json:"model_name,omitempty"` // 模型名称

	Prompt *string `json:"prompt,omitempty"` // 自定义的问答prompt，占位符格式和go标准库-text/template保持一致

	MaxToken *int `json:"max_token,omitempty"` // 模型接收的最大token数

	Temperature *float64 `json:"temperature,omitempty"` // 模型生成的温度系数
}

type LlmModelConfigBuilder struct {
	modelName     string // 模型名称
	modelNameFlag bool

	prompt     string // 自定义的问答prompt，占位符格式和go标准库-text/template保持一致
	promptFlag bool

	maxToken     int // 模型接收的最大token数
	maxTokenFlag bool

	temperature     float64 // 模型生成的温度系数
	temperatureFlag bool
}

func NewLlmModelConfigBuilder() *LlmModelConfigBuilder {
	builder := &LlmModelConfigBuilder{}
	return builder
}

// 模型名称
//
// 示例值：gpt-3.5-turbo
func (builder *LlmModelConfigBuilder) ModelName(modelName string) *LlmModelConfigBuilder {
	builder.modelName = modelName
	builder.modelNameFlag = true
	return builder
}

// 自定义的问答prompt，占位符格式和go标准库-text/template保持一致
//
// 示例值：请根据以下文档回答问题，请仅依靠提供的文档段落回答问题。\n{{ range $index, $p := .Passages }}\n段落{{ $index }}：\n{{ $p }}\n{{ end }}\n请回答：\n{{ .Query }}
func (builder *LlmModelConfigBuilder) Prompt(prompt string) *LlmModelConfigBuilder {
	builder.prompt = prompt
	builder.promptFlag = true
	return builder
}

// 模型接收的最大token数
//
// 示例值：4096
func (builder *LlmModelConfigBuilder) MaxToken(maxToken int) *LlmModelConfigBuilder {
	builder.maxToken = maxToken
	builder.maxTokenFlag = true
	return builder
}

// 模型生成的温度系数
//
// 示例值：0.3
func (builder *LlmModelConfigBuilder) Temperature(temperature float64) *LlmModelConfigBuilder {
	builder.temperature = temperature
	builder.temperatureFlag = true
	return builder
}

func (builder *LlmModelConfigBuilder) Build() *LlmModelConfig {
	req := &LlmModelConfig{}
	if builder.modelNameFlag {
		req.ModelName = &builder.modelName

	}
	if builder.promptFlag {
		req.Prompt = &builder.prompt

	}
	if builder.maxTokenFlag {
		req.MaxToken = &builder.maxToken

	}
	if builder.temperatureFlag {
		req.Temperature = &builder.temperature

	}
	return req
}

type MemoryMessage struct {
	Role *string `json:"role,omitempty"` // 发送消息的角色

	Content *string `json:"content,omitempty"` // 消息内容
}

type MemoryMessageBuilder struct {
	role     string // 发送消息的角色
	roleFlag bool

	content     string // 消息内容
	contentFlag bool
}

func NewMemoryMessageBuilder() *MemoryMessageBuilder {
	builder := &MemoryMessageBuilder{}
	return builder
}

// 发送消息的角色
//
// 示例值：human
func (builder *MemoryMessageBuilder) Role(role string) *MemoryMessageBuilder {
	builder.role = role
	builder.roleFlag = true
	return builder
}

// 消息内容
//
// 示例值：番茄炒蛋怎么做？
func (builder *MemoryMessageBuilder) Content(content string) *MemoryMessageBuilder {
	builder.content = content
	builder.contentFlag = true
	return builder
}

func (builder *MemoryMessageBuilder) Build() *MemoryMessage {
	req := &MemoryMessage{}
	if builder.roleFlag {
		req.Role = &builder.role

	}
	if builder.contentFlag {
		req.Content = &builder.content

	}
	return req
}

type MessagePassageParam struct {
	Searchable *bool `json:"searchable,omitempty"` // searchable

	ChatIds []string `json:"chat_ids,omitempty"` // chat_ids

	ExcludedPassageIds []string `json:"excluded_passage_ids,omitempty"` // excluded_passage_ids

	ExcludedChatIds []string `json:"excluded_chat_ids,omitempty"` // excluded_chat_ids

	ExcludedMessageIds []string `json:"excluded_message_ids,omitempty"` // excluded_message_ids
}

type MessagePassageParamBuilder struct {
	searchable     bool // searchable
	searchableFlag bool

	chatIds     []string // chat_ids
	chatIdsFlag bool

	excludedPassageIds     []string // excluded_passage_ids
	excludedPassageIdsFlag bool

	excludedChatIds     []string // excluded_chat_ids
	excludedChatIdsFlag bool

	excludedMessageIds     []string // excluded_message_ids
	excludedMessageIdsFlag bool
}

func NewMessagePassageParamBuilder() *MessagePassageParamBuilder {
	builder := &MessagePassageParamBuilder{}
	return builder
}

// searchable
//
// 示例值：false
func (builder *MessagePassageParamBuilder) Searchable(searchable bool) *MessagePassageParamBuilder {
	builder.searchable = searchable
	builder.searchableFlag = true
	return builder
}

// chat_ids
//
// 示例值：
func (builder *MessagePassageParamBuilder) ChatIds(chatIds []string) *MessagePassageParamBuilder {
	builder.chatIds = chatIds
	builder.chatIdsFlag = true
	return builder
}

// excluded_passage_ids
//
// 示例值：
func (builder *MessagePassageParamBuilder) ExcludedPassageIds(excludedPassageIds []string) *MessagePassageParamBuilder {
	builder.excludedPassageIds = excludedPassageIds
	builder.excludedPassageIdsFlag = true
	return builder
}

// excluded_chat_ids
//
// 示例值：
func (builder *MessagePassageParamBuilder) ExcludedChatIds(excludedChatIds []string) *MessagePassageParamBuilder {
	builder.excludedChatIds = excludedChatIds
	builder.excludedChatIdsFlag = true
	return builder
}

// excluded_message_ids
//
// 示例值：
func (builder *MessagePassageParamBuilder) ExcludedMessageIds(excludedMessageIds []string) *MessagePassageParamBuilder {
	builder.excludedMessageIds = excludedMessageIds
	builder.excludedMessageIdsFlag = true
	return builder
}

func (builder *MessagePassageParamBuilder) Build() *MessagePassageParam {
	req := &MessagePassageParam{}
	if builder.searchableFlag {
		req.Searchable = &builder.searchable

	}
	if builder.chatIdsFlag {
		req.ChatIds = builder.chatIds
	}
	if builder.excludedPassageIdsFlag {
		req.ExcludedPassageIds = builder.excludedPassageIds
	}
	if builder.excludedChatIdsFlag {
		req.ExcludedChatIds = builder.excludedChatIds
	}
	if builder.excludedMessageIdsFlag {
		req.ExcludedMessageIds = builder.excludedMessageIds
	}
	return req
}

type ModelConfig struct {
	ModelName *string `json:"model_name,omitempty"` // 模型名称
}

type ModelConfigBuilder struct {
	modelName     string // 模型名称
	modelNameFlag bool
}

func NewModelConfigBuilder() *ModelConfigBuilder {
	builder := &ModelConfigBuilder{}
	return builder
}

// 模型名称
//
// 示例值：mrc-passage-encoder
func (builder *ModelConfigBuilder) ModelName(modelName string) *ModelConfigBuilder {
	builder.modelName = modelName
	builder.modelNameFlag = true
	return builder
}

func (builder *ModelConfigBuilder) Build() *ModelConfig {
	req := &ModelConfig{}
	if builder.modelNameFlag {
		req.ModelName = &builder.modelName

	}
	return req
}

type ModelParam struct {
	EncoderName *string `json:"encoder_name,omitempty"` // embedding模型名字

	RankerName *string `json:"ranker_name,omitempty"` // 排序模型名字

	FilterName *string `json:"filter_name,omitempty"` // 过滤模型名字

	BoosterName *string `json:"booster_name,omitempty"` // 时效权威互动模型名字

	PassageLanguage *string `json:"passage_language,omitempty"` // 选择返回的语种，可选{zh,en,ja,auto,all}，auto自动检测query的语种并过滤，all保留所有语种不做过滤，默认auto
}

type ModelParamBuilder struct {
	encoderName     string // embedding模型名字
	encoderNameFlag bool

	rankerName     string // 排序模型名字
	rankerNameFlag bool

	filterName     string // 过滤模型名字
	filterNameFlag bool

	boosterName     string // 时效权威互动模型名字
	boosterNameFlag bool

	passageLanguage     string // 选择返回的语种，可选{zh,en,ja,auto,all}，auto自动检测query的语种并过滤，all保留所有语种不做过滤，默认auto
	passageLanguageFlag bool
}

func NewModelParamBuilder() *ModelParamBuilder {
	builder := &ModelParamBuilder{}
	return builder
}

// embedding模型名字
//
// 示例值：lark-encoder
func (builder *ModelParamBuilder) EncoderName(encoderName string) *ModelParamBuilder {
	builder.encoderName = encoderName
	builder.encoderNameFlag = true
	return builder
}

// 排序模型名字
//
// 示例值：lark-ranker
func (builder *ModelParamBuilder) RankerName(rankerName string) *ModelParamBuilder {
	builder.rankerName = rankerName
	builder.rankerNameFlag = true
	return builder
}

// 过滤模型名字
//
// 示例值：lark-filter
func (builder *ModelParamBuilder) FilterName(filterName string) *ModelParamBuilder {
	builder.filterName = filterName
	builder.filterNameFlag = true
	return builder
}

// 时效权威互动模型名字
//
// 示例值：lark-booster
func (builder *ModelParamBuilder) BoosterName(boosterName string) *ModelParamBuilder {
	builder.boosterName = boosterName
	builder.boosterNameFlag = true
	return builder
}

// 选择返回的语种，可选{zh,en,ja,auto,all}，auto自动检测query的语种并过滤，all保留所有语种不做过滤，默认auto
//
// 示例值：zh
func (builder *ModelParamBuilder) PassageLanguage(passageLanguage string) *ModelParamBuilder {
	builder.passageLanguage = passageLanguage
	builder.passageLanguageFlag = true
	return builder
}

func (builder *ModelParamBuilder) Build() *ModelParam {
	req := &ModelParam{}
	if builder.encoderNameFlag {
		req.EncoderName = &builder.encoderName

	}
	if builder.rankerNameFlag {
		req.RankerName = &builder.rankerName

	}
	if builder.filterNameFlag {
		req.FilterName = &builder.filterName

	}
	if builder.boosterNameFlag {
		req.BoosterName = &builder.boosterName

	}
	if builder.passageLanguageFlag {
		req.PassageLanguage = &builder.passageLanguage

	}
	return req
}

type NlsModelConfig struct {
	ModelName *string `json:"model_name,omitempty"` // 模型名称
}

type NlsModelConfigBuilder struct {
	modelName     string // 模型名称
	modelNameFlag bool
}

func NewNlsModelConfigBuilder() *NlsModelConfigBuilder {
	builder := &NlsModelConfigBuilder{}
	return builder
}

// 模型名称
//
// 示例值：lark-online
func (builder *NlsModelConfigBuilder) ModelName(modelName string) *NlsModelConfigBuilder {
	builder.modelName = modelName
	builder.modelNameFlag = true
	return builder
}

func (builder *NlsModelConfigBuilder) Build() *NlsModelConfig {
	req := &NlsModelConfig{}
	if builder.modelNameFlag {
		req.ModelName = &builder.modelName

	}
	return req
}

type ParaphraseResult struct {
	Text *string `json:"text,omitempty"` // 改写后的结果

	Extra *string `json:"extra,omitempty"` // 补充字段（json序列化）
}

type ParaphraseResultBuilder struct {
	text     string // 改写后的结果
	textFlag bool

	extra     string // 补充字段（json序列化）
	extraFlag bool
}

func NewParaphraseResultBuilder() *ParaphraseResultBuilder {
	builder := &ParaphraseResultBuilder{}
	return builder
}

// 改写后的结果
//
// 示例值：改写后的结果
func (builder *ParaphraseResultBuilder) Text(text string) *ParaphraseResultBuilder {
	builder.text = text
	builder.textFlag = true
	return builder
}

// 补充字段（json序列化）
//
// 示例值：{"language": "en", "score": 0.85}
func (builder *ParaphraseResultBuilder) Extra(extra string) *ParaphraseResultBuilder {
	builder.extra = extra
	builder.extraFlag = true
	return builder
}

func (builder *ParaphraseResultBuilder) Build() *ParaphraseResult {
	req := &ParaphraseResult{}
	if builder.textFlag {
		req.Text = &builder.text

	}
	if builder.extraFlag {
		req.Extra = &builder.extra

	}
	return req
}

type Passage struct {
	PassageId *string `json:"passage_id,omitempty"` // passage的唯一标识

	PassageSource *int `json:"passage_source,omitempty"` // passage所属的数据源

	Content *string `json:"content,omitempty"` // 和query相关的文本段落

	Title *string `json:"title,omitempty"` // wiki或doc的题目

	Url *string `json:"url,omitempty"` // 跳转链接

	Score *float64 `json:"score,omitempty"` // 文本段落和query的相关性分数

	Extra *string `json:"extra,omitempty"` // 其他source相关的字段

	ContentForLlm *string `json:"content_for_llm,omitempty"` // 和query相关的文本段落经过small2big之后的片段
}

type PassageBuilder struct {
	passageId     string // passage的唯一标识
	passageIdFlag bool

	passageSource     int // passage所属的数据源
	passageSourceFlag bool

	content     string // 和query相关的文本段落
	contentFlag bool

	title     string // wiki或doc的题目
	titleFlag bool

	url     string // 跳转链接
	urlFlag bool

	score     float64 // 文本段落和query的相关性分数
	scoreFlag bool

	extra     string // 其他source相关的字段
	extraFlag bool

	contentForLlm     string // 和query相关的文本段落经过small2big之后的片段
	contentForLlmFlag bool
}

func NewPassageBuilder() *PassageBuilder {
	builder := &PassageBuilder{}
	return builder
}

// passage的唯一标识
//
// 示例值：7045980712687697921
func (builder *PassageBuilder) PassageId(passageId string) *PassageBuilder {
	builder.passageId = passageId
	builder.passageIdFlag = true
	return builder
}

// passage所属的数据源
//
// 示例值：1
func (builder *PassageBuilder) PassageSource(passageSource int) *PassageBuilder {
	builder.passageSource = passageSource
	builder.passageSourceFlag = true
	return builder
}

// 和query相关的文本段落
//
// 示例值：流程如下：xxxxxxx。可以在飞书官方官网上找到更详细内容。
func (builder *PassageBuilder) Content(content string) *PassageBuilder {
	builder.content = content
	builder.contentFlag = true
	return builder
}

// wiki或doc的题目
//
// 示例值：文档的题目
func (builder *PassageBuilder) Title(title string) *PassageBuilder {
	builder.title = title
	builder.titleFlag = true
	return builder
}

// 跳转链接
//
// 示例值：https://www.feishu.cn/hc/zh-CN/
func (builder *PassageBuilder) Url(url string) *PassageBuilder {
	builder.url = url
	builder.urlFlag = true
	return builder
}

// 文本段落和query的相关性分数
//
// 示例值：0.94
func (builder *PassageBuilder) Score(score float64) *PassageBuilder {
	builder.score = score
	builder.scoreFlag = true
	return builder
}

// 其他source相关的字段
//
// 示例值：{\"obj_id\":7263345601809530881}
func (builder *PassageBuilder) Extra(extra string) *PassageBuilder {
	builder.extra = extra
	builder.extraFlag = true
	return builder
}

// 和query相关的文本段落经过small2big之后的片段
//
// 示例值：流程如下：xxxxxxx。可以在飞书官方官网上找到更详细内容。
func (builder *PassageBuilder) ContentForLlm(contentForLlm string) *PassageBuilder {
	builder.contentForLlm = contentForLlm
	builder.contentForLlmFlag = true
	return builder
}

func (builder *PassageBuilder) Build() *Passage {
	req := &Passage{}
	if builder.passageIdFlag {
		req.PassageId = &builder.passageId

	}
	if builder.passageSourceFlag {
		req.PassageSource = &builder.passageSource

	}
	if builder.contentFlag {
		req.Content = &builder.content

	}
	if builder.titleFlag {
		req.Title = &builder.title

	}
	if builder.urlFlag {
		req.Url = &builder.url

	}
	if builder.scoreFlag {
		req.Score = &builder.score

	}
	if builder.extraFlag {
		req.Extra = &builder.extra

	}
	if builder.contentForLlmFlag {
		req.ContentForLlm = &builder.contentForLlm

	}
	return req
}

type PassageParam struct {
	DocParam *DocPassageParam `json:"doc_param,omitempty"` // 搜doc的相关参数

	WikiParam *WikiPassageParam `json:"wiki_param,omitempty"` // 搜wiki的相关参数

	WebParam *WebPassageParam `json:"web_param,omitempty"` // 搜web的相关参数

	HelpdeskParam *HelpdeskPassageParam `json:"helpdesk_param,omitempty"` // 搜helpdesk的相关参数

	LingoParam *LingoPassageParam `json:"lingo_param,omitempty"` // lingo_param

	MessageParam *MessagePassageParam `json:"message_param,omitempty"` // message_param
}

type PassageParamBuilder struct {
	docParam     *DocPassageParam // 搜doc的相关参数
	docParamFlag bool

	wikiParam     *WikiPassageParam // 搜wiki的相关参数
	wikiParamFlag bool

	webParam     *WebPassageParam // 搜web的相关参数
	webParamFlag bool

	helpdeskParam     *HelpdeskPassageParam // 搜helpdesk的相关参数
	helpdeskParamFlag bool

	lingoParam     *LingoPassageParam // lingo_param
	lingoParamFlag bool

	messageParam     *MessagePassageParam // message_param
	messageParamFlag bool
}

func NewPassageParamBuilder() *PassageParamBuilder {
	builder := &PassageParamBuilder{}
	return builder
}

// 搜doc的相关参数
//
// 示例值：
func (builder *PassageParamBuilder) DocParam(docParam *DocPassageParam) *PassageParamBuilder {
	builder.docParam = docParam
	builder.docParamFlag = true
	return builder
}

// 搜wiki的相关参数
//
// 示例值：
func (builder *PassageParamBuilder) WikiParam(wikiParam *WikiPassageParam) *PassageParamBuilder {
	builder.wikiParam = wikiParam
	builder.wikiParamFlag = true
	return builder
}

// 搜web的相关参数
//
// 示例值：
func (builder *PassageParamBuilder) WebParam(webParam *WebPassageParam) *PassageParamBuilder {
	builder.webParam = webParam
	builder.webParamFlag = true
	return builder
}

// 搜helpdesk的相关参数
//
// 示例值：
func (builder *PassageParamBuilder) HelpdeskParam(helpdeskParam *HelpdeskPassageParam) *PassageParamBuilder {
	builder.helpdeskParam = helpdeskParam
	builder.helpdeskParamFlag = true
	return builder
}

// lingo_param
//
// 示例值：
func (builder *PassageParamBuilder) LingoParam(lingoParam *LingoPassageParam) *PassageParamBuilder {
	builder.lingoParam = lingoParam
	builder.lingoParamFlag = true
	return builder
}

// message_param
//
// 示例值：
func (builder *PassageParamBuilder) MessageParam(messageParam *MessagePassageParam) *PassageParamBuilder {
	builder.messageParam = messageParam
	builder.messageParamFlag = true
	return builder
}

func (builder *PassageParamBuilder) Build() *PassageParam {
	req := &PassageParam{}
	if builder.docParamFlag {
		req.DocParam = builder.docParam
	}
	if builder.wikiParamFlag {
		req.WikiParam = builder.wikiParam
	}
	if builder.webParamFlag {
		req.WebParam = builder.webParam
	}
	if builder.helpdeskParamFlag {
		req.HelpdeskParam = builder.helpdeskParam
	}
	if builder.lingoParamFlag {
		req.LingoParam = builder.lingoParam
	}
	if builder.messageParamFlag {
		req.MessageParam = builder.messageParam
	}
	return req
}

type PatchSchemaProperty struct {
	Name *string `json:"name,omitempty"` // 属性名

	Desc *string `json:"desc,omitempty"` // 属性描述

	AnswerOption *SchemaFieldAnswerOption `json:"answer_option,omitempty"` // 问答产品设置，仅在datasource中use_answer为true时生效
}

type PatchSchemaPropertyBuilder struct {
	name     string // 属性名
	nameFlag bool

	desc     string // 属性描述
	descFlag bool

	answerOption     *SchemaFieldAnswerOption // 问答产品设置，仅在datasource中use_answer为true时生效
	answerOptionFlag bool
}

func NewPatchSchemaPropertyBuilder() *PatchSchemaPropertyBuilder {
	builder := &PatchSchemaPropertyBuilder{}
	return builder
}

// 属性名
//
// 示例值：title
func (builder *PatchSchemaPropertyBuilder) Name(name string) *PatchSchemaPropertyBuilder {
	builder.name = name
	builder.nameFlag = true
	return builder
}

// 属性描述
//
// 示例值：desc
func (builder *PatchSchemaPropertyBuilder) Desc(desc string) *PatchSchemaPropertyBuilder {
	builder.desc = desc
	builder.descFlag = true
	return builder
}

// 问答产品设置，仅在datasource中use_answer为true时生效
//
// 示例值：
func (builder *PatchSchemaPropertyBuilder) AnswerOption(answerOption *SchemaFieldAnswerOption) *PatchSchemaPropertyBuilder {
	builder.answerOption = answerOption
	builder.answerOptionFlag = true
	return builder
}

func (builder *PatchSchemaPropertyBuilder) Build() *PatchSchemaProperty {
	req := &PatchSchemaProperty{}
	if builder.nameFlag {
		req.Name = &builder.name

	}
	if builder.descFlag {
		req.Desc = &builder.desc

	}
	if builder.answerOptionFlag {
		req.AnswerOption = builder.answerOption
	}
	return req
}

type Present struct {
	Type *string `json:"type,omitempty"` // 透传数据类型

	Body *string `json:"body,omitempty"` // 透传消息体

	OperationType *string `json:"operation_type,omitempty"` // 在交互卡片的场景下，如果用户完成交互，根据交互行为 Tool 对该交互行为做出的响应

	Interactable *bool `json:"interactable,omitempty"` // 用来定义工具输出的卡片是否为交互卡片

	OperationUrl *string `json:"operation_url,omitempty"` // 卡片后续链路交互的请求地址

	CallbackUrl *string `json:"callback_url,omitempty"` // 透传数据上屏后，回调业务方的 url；支持 Open API 与 RPC 两种方式

	CallbackInfo *string `json:"callback_info,omitempty"` // 透传数据上屏后，回调给业务方的数据，仅在 type = card 时会回调

	CardTemplateId *string `json:"card_template_id,omitempty"` // 仅 type = template_card 时使用，代表模版卡片的模版信息

	CardVariables *TemplateCardVariables `json:"card_variables,omitempty"` // 仅 type = template_card 使用，对应到模版卡片中模版里的变量信息，类型应该是map<string, string>
}

type PresentBuilder struct {
	type_    string // 透传数据类型
	typeFlag bool

	body     string // 透传消息体
	bodyFlag bool

	operationType     string // 在交互卡片的场景下，如果用户完成交互，根据交互行为 Tool 对该交互行为做出的响应
	operationTypeFlag bool

	interactable     bool // 用来定义工具输出的卡片是否为交互卡片
	interactableFlag bool

	operationUrl     string // 卡片后续链路交互的请求地址
	operationUrlFlag bool

	callbackUrl     string // 透传数据上屏后，回调业务方的 url；支持 Open API 与 RPC 两种方式
	callbackUrlFlag bool

	callbackInfo     string // 透传数据上屏后，回调给业务方的数据，仅在 type = card 时会回调
	callbackInfoFlag bool

	cardTemplateId     string // 仅 type = template_card 时使用，代表模版卡片的模版信息
	cardTemplateIdFlag bool

	cardVariables     *TemplateCardVariables // 仅 type = template_card 使用，对应到模版卡片中模版里的变量信息，类型应该是map<string, string>
	cardVariablesFlag bool
}

func NewPresentBuilder() *PresentBuilder {
	builder := &PresentBuilder{}
	return builder
}

// 透传数据类型
//
// 示例值：card
func (builder *PresentBuilder) Type(type_ string) *PresentBuilder {
	builder.type_ = type_
	builder.typeFlag = true
	return builder
}

// 透传消息体
//
// 示例值：raw
func (builder *PresentBuilder) Body(body string) *PresentBuilder {
	builder.body = body
	builder.bodyFlag = true
	return builder
}

// 在交互卡片的场景下，如果用户完成交互，根据交互行为 Tool 对该交互行为做出的响应
//
// 示例值：UPDATE
func (builder *PresentBuilder) OperationType(operationType string) *PresentBuilder {
	builder.operationType = operationType
	builder.operationTypeFlag = true
	return builder
}

// 用来定义工具输出的卡片是否为交互卡片
//
// 示例值：true
func (builder *PresentBuilder) Interactable(interactable bool) *PresentBuilder {
	builder.interactable = interactable
	builder.interactableFlag = true
	return builder
}

// 卡片后续链路交互的请求地址
//
// 示例值：https://open.feishu-boe.cn/open-apis/lark_ai/operation
func (builder *PresentBuilder) OperationUrl(operationUrl string) *PresentBuilder {
	builder.operationUrl = operationUrl
	builder.operationUrlFlag = true
	return builder
}

// 透传数据上屏后，回调业务方的 url；支持 Open API 与 RPC 两种方式
//
// 示例值：Open API - https://open.feishu-boe.cn/open-apis/lark_ai/callback；RPC - sd://p.s.m
func (builder *PresentBuilder) CallbackUrl(callbackUrl string) *PresentBuilder {
	builder.callbackUrl = callbackUrl
	builder.callbackUrlFlag = true
	return builder
}

// 透传数据上屏后，回调给业务方的数据，仅在 type = card 时会回调
//
// 示例值：可以是纯文本:"callback raw data"；也可以是 json string:"{\"biz_id":\"search_context_id\"}"
func (builder *PresentBuilder) CallbackInfo(callbackInfo string) *PresentBuilder {
	builder.callbackInfo = callbackInfo
	builder.callbackInfoFlag = true
	return builder
}

// 仅 type = template_card 时使用，代表模版卡片的模版信息
//
// 示例值：default
func (builder *PresentBuilder) CardTemplateId(cardTemplateId string) *PresentBuilder {
	builder.cardTemplateId = cardTemplateId
	builder.cardTemplateIdFlag = true
	return builder
}

// 仅 type = template_card 使用，对应到模版卡片中模版里的变量信息，类型应该是map<string, string>
//
// 示例值：
func (builder *PresentBuilder) CardVariables(cardVariables *TemplateCardVariables) *PresentBuilder {
	builder.cardVariables = cardVariables
	builder.cardVariablesFlag = true
	return builder
}

func (builder *PresentBuilder) Build() *Present {
	req := &Present{}
	if builder.typeFlag {
		req.Type = &builder.type_

	}
	if builder.bodyFlag {
		req.Body = &builder.body

	}
	if builder.operationTypeFlag {
		req.OperationType = &builder.operationType

	}
	if builder.interactableFlag {
		req.Interactable = &builder.interactable

	}
	if builder.operationUrlFlag {
		req.OperationUrl = &builder.operationUrl

	}
	if builder.callbackUrlFlag {
		req.CallbackUrl = &builder.callbackUrl

	}
	if builder.callbackInfoFlag {
		req.CallbackInfo = &builder.callbackInfo

	}
	if builder.cardTemplateIdFlag {
		req.CardTemplateId = &builder.cardTemplateId

	}
	if builder.cardVariablesFlag {
		req.CardVariables = builder.cardVariables
	}
	return req
}

type PresentDataCallbackDialogRequest struct {
	MessageId *string `json:"message_id,omitempty"` // message_id

	Status *Status `json:"status,omitempty"` // status

	CallbackInfo *string `json:"callback_info,omitempty"` // callback_info
}

type PresentDataCallbackDialogRequestBuilder struct {
	messageId     string // message_id
	messageIdFlag bool

	status     *Status // status
	statusFlag bool

	callbackInfo     string // callback_info
	callbackInfoFlag bool
}

func NewPresentDataCallbackDialogRequestBuilder() *PresentDataCallbackDialogRequestBuilder {
	builder := &PresentDataCallbackDialogRequestBuilder{}
	return builder
}

// message_id
//
// 示例值：""
func (builder *PresentDataCallbackDialogRequestBuilder) MessageId(messageId string) *PresentDataCallbackDialogRequestBuilder {
	builder.messageId = messageId
	builder.messageIdFlag = true
	return builder
}

// status
//
// 示例值：
func (builder *PresentDataCallbackDialogRequestBuilder) Status(status *Status) *PresentDataCallbackDialogRequestBuilder {
	builder.status = status
	builder.statusFlag = true
	return builder
}

// callback_info
//
// 示例值：""
func (builder *PresentDataCallbackDialogRequestBuilder) CallbackInfo(callbackInfo string) *PresentDataCallbackDialogRequestBuilder {
	builder.callbackInfo = callbackInfo
	builder.callbackInfoFlag = true
	return builder
}

func (builder *PresentDataCallbackDialogRequestBuilder) Build() *PresentDataCallbackDialogRequest {
	req := &PresentDataCallbackDialogRequest{}
	if builder.messageIdFlag {
		req.MessageId = &builder.messageId

	}
	if builder.statusFlag {
		req.Status = builder.status
	}
	if builder.callbackInfoFlag {
		req.CallbackInfo = &builder.callbackInfo

	}
	return req
}

type RagAnswer struct {
	Answer *string `json:"answer,omitempty"` // 提问query的答案

	ReasoningContent *string `json:"reasoning_content,omitempty"` // 思考过程

	Passages []*Passage `json:"passages,omitempty"` // 参考资料
}

type RagAnswerBuilder struct {
	answer     string // 提问query的答案
	answerFlag bool

	reasoningContent     string // 思考过程
	reasoningContentFlag bool

	passages     []*Passage // 参考资料
	passagesFlag bool
}

func NewRagAnswerBuilder() *RagAnswerBuilder {
	builder := &RagAnswerBuilder{}
	return builder
}

// 提问query的答案
//
// 示例值：answer
func (builder *RagAnswerBuilder) Answer(answer string) *RagAnswerBuilder {
	builder.answer = answer
	builder.answerFlag = true
	return builder
}

// 思考过程
//
// 示例值：thinking
func (builder *RagAnswerBuilder) ReasoningContent(reasoningContent string) *RagAnswerBuilder {
	builder.reasoningContent = reasoningContent
	builder.reasoningContentFlag = true
	return builder
}

// 参考资料
//
// 示例值：
func (builder *RagAnswerBuilder) Passages(passages []*Passage) *RagAnswerBuilder {
	builder.passages = passages
	builder.passagesFlag = true
	return builder
}

func (builder *RagAnswerBuilder) Build() *RagAnswer {
	req := &RagAnswer{}
	if builder.answerFlag {
		req.Answer = &builder.answer

	}
	if builder.reasoningContentFlag {
		req.ReasoningContent = &builder.reasoningContent

	}
	if builder.passagesFlag {
		req.Passages = builder.passages
	}
	return req
}

type RagAnswerResponse struct {
	Answer *string `json:"answer,omitempty"` // 模型总结的结果

	Passages []*Passage `json:"passages,omitempty"` // 召回的passage列表

	Probe *RagProbe `json:"probe,omitempty"` // 返回结果提示
}

type RagAnswerResponseBuilder struct {
	answer     string // 模型总结的结果
	answerFlag bool

	passages     []*Passage // 召回的passage列表
	passagesFlag bool

	probe     *RagProbe // 返回结果提示
	probeFlag bool
}

func NewRagAnswerResponseBuilder() *RagAnswerResponseBuilder {
	builder := &RagAnswerResponseBuilder{}
	return builder
}

// 模型总结的结果
//
// 示例值：总结
func (builder *RagAnswerResponseBuilder) Answer(answer string) *RagAnswerResponseBuilder {
	builder.answer = answer
	builder.answerFlag = true
	return builder
}

// 召回的passage列表
//
// 示例值：
func (builder *RagAnswerResponseBuilder) Passages(passages []*Passage) *RagAnswerResponseBuilder {
	builder.passages = passages
	builder.passagesFlag = true
	return builder
}

// 返回结果提示
//
// 示例值：
func (builder *RagAnswerResponseBuilder) Probe(probe *RagProbe) *RagAnswerResponseBuilder {
	builder.probe = probe
	builder.probeFlag = true
	return builder
}

func (builder *RagAnswerResponseBuilder) Build() *RagAnswerResponse {
	req := &RagAnswerResponse{}
	if builder.answerFlag {
		req.Answer = &builder.answer

	}
	if builder.passagesFlag {
		req.Passages = builder.passages
	}
	if builder.probeFlag {
		req.Probe = builder.probe
	}
	return req
}

type RagProbe struct {
	HitAuthority *bool `json:"hit_authority,omitempty"` // 是否命中了权威小库

	HitConfidenceWarn *bool `json:"hit_confidence_warn,omitempty"` // 是否命中了低置信度提示

	HitLlmReject *bool `json:"hit_llm_reject,omitempty"` // 是否命中了模型拒答
}

type RagProbeBuilder struct {
	hitAuthority     bool // 是否命中了权威小库
	hitAuthorityFlag bool

	hitConfidenceWarn     bool // 是否命中了低置信度提示
	hitConfidenceWarnFlag bool

	hitLlmReject     bool // 是否命中了模型拒答
	hitLlmRejectFlag bool
}

func NewRagProbeBuilder() *RagProbeBuilder {
	builder := &RagProbeBuilder{}
	return builder
}

// 是否命中了权威小库
//
// 示例值：false
func (builder *RagProbeBuilder) HitAuthority(hitAuthority bool) *RagProbeBuilder {
	builder.hitAuthority = hitAuthority
	builder.hitAuthorityFlag = true
	return builder
}

// 是否命中了低置信度提示
//
// 示例值：false
func (builder *RagProbeBuilder) HitConfidenceWarn(hitConfidenceWarn bool) *RagProbeBuilder {
	builder.hitConfidenceWarn = hitConfidenceWarn
	builder.hitConfidenceWarnFlag = true
	return builder
}

// 是否命中了模型拒答
//
// 示例值：1
func (builder *RagProbeBuilder) HitLlmReject(hitLlmReject bool) *RagProbeBuilder {
	builder.hitLlmReject = hitLlmReject
	builder.hitLlmRejectFlag = true
	return builder
}

func (builder *RagProbeBuilder) Build() *RagProbe {
	req := &RagProbe{}
	if builder.hitAuthorityFlag {
		req.HitAuthority = &builder.hitAuthority

	}
	if builder.hitConfidenceWarnFlag {
		req.HitConfidenceWarn = &builder.hitConfidenceWarn

	}
	if builder.hitLlmRejectFlag {
		req.HitLlmReject = &builder.hitLlmReject

	}
	return req
}

type ScenarioContext struct {
	Extra *ScenarioContextExtra `json:"extra,omitempty"` // 拓展信息

	SystemInfo *SystemInfo `json:"system_info,omitempty"` // AI Engine填充的系统信息

	Memory []*MemoryMessage `json:"memory,omitempty"` // 会话的历史对话

	Scenario *string `json:"scenario,omitempty"` // 会话所处的业务场景

	WorkMode *int `json:"work_mode,omitempty"` // 会话所处的业务模式

	ToolRawInstruction *string `json:"tool_raw_instruction,omitempty"` // 用户原始的问题描述
}

type ScenarioContextBuilder struct {
	extra     *ScenarioContextExtra // 拓展信息
	extraFlag bool

	systemInfo     *SystemInfo // AI Engine填充的系统信息
	systemInfoFlag bool

	memory     []*MemoryMessage // 会话的历史对话
	memoryFlag bool

	scenario     string // 会话所处的业务场景
	scenarioFlag bool

	workMode     int // 会话所处的业务模式
	workModeFlag bool

	toolRawInstruction     string // 用户原始的问题描述
	toolRawInstructionFlag bool
}

func NewScenarioContextBuilder() *ScenarioContextBuilder {
	builder := &ScenarioContextBuilder{}
	return builder
}

// 拓展信息
//
// 示例值：v1
func (builder *ScenarioContextBuilder) Extra(extra *ScenarioContextExtra) *ScenarioContextBuilder {
	builder.extra = extra
	builder.extraFlag = true
	return builder
}

// AI Engine填充的系统信息
//
// 示例值：aa
func (builder *ScenarioContextBuilder) SystemInfo(systemInfo *SystemInfo) *ScenarioContextBuilder {
	builder.systemInfo = systemInfo
	builder.systemInfoFlag = true
	return builder
}

// 会话的历史对话
//
// 示例值：
func (builder *ScenarioContextBuilder) Memory(memory []*MemoryMessage) *ScenarioContextBuilder {
	builder.memory = memory
	builder.memoryFlag = true
	return builder
}

// 会话所处的业务场景
//
// 示例值：IM
func (builder *ScenarioContextBuilder) Scenario(scenario string) *ScenarioContextBuilder {
	builder.scenario = scenario
	builder.scenarioFlag = true
	return builder
}

// 会话所处的业务模式
//
// 示例值：1
func (builder *ScenarioContextBuilder) WorkMode(workMode int) *ScenarioContextBuilder {
	builder.workMode = workMode
	builder.workModeFlag = true
	return builder
}

// 用户原始的问题描述
//
// 示例值：我想问xxx问题
func (builder *ScenarioContextBuilder) ToolRawInstruction(toolRawInstruction string) *ScenarioContextBuilder {
	builder.toolRawInstruction = toolRawInstruction
	builder.toolRawInstructionFlag = true
	return builder
}

func (builder *ScenarioContextBuilder) Build() *ScenarioContext {
	req := &ScenarioContext{}
	if builder.extraFlag {
		req.Extra = builder.extra
	}
	if builder.systemInfoFlag {
		req.SystemInfo = builder.systemInfo
	}
	if builder.memoryFlag {
		req.Memory = builder.memory
	}
	if builder.scenarioFlag {
		req.Scenario = &builder.scenario

	}
	if builder.workModeFlag {
		req.WorkMode = &builder.workMode

	}
	if builder.toolRawInstructionFlag {
		req.ToolRawInstruction = &builder.toolRawInstruction

	}
	return req
}

type ScenarioContextExtra struct {
	GroundingId *string `json:"grounding_id,omitempty"` // Grounding ID

	ModelKey *string `json:"model_key,omitempty"` // 模型 key

	SpecifiedObjIds *string `json:"specified_obj_ids,omitempty"` // 检索时指定的文档 id, 多个 id 以`,`分隔

	SuggestQueryId *string `json:"suggest_query_id,omitempty"` // 推荐问题的 ID

	ButtonSendMessageInfo *string `json:"button_send_message_info,omitempty"` // 点击按钮发送消息时所携带的参数信息

	ButtonRegenerateMessage *string `json:"button_regenerate_message,omitempty"` // 点击重新生成按钮时携带的参数信息

	EnterpriseQaChannelInfo *string `json:"enterprise_qa_channel_info,omitempty"` // 主会话链路前端透传给后端的参数
}

type ScenarioContextExtraBuilder struct {
	groundingId     string // Grounding ID
	groundingIdFlag bool

	modelKey     string // 模型 key
	modelKeyFlag bool

	specifiedObjIds     string // 检索时指定的文档 id, 多个 id 以`,`分隔
	specifiedObjIdsFlag bool

	suggestQueryId     string // 推荐问题的 ID
	suggestQueryIdFlag bool

	buttonSendMessageInfo     string // 点击按钮发送消息时所携带的参数信息
	buttonSendMessageInfoFlag bool

	buttonRegenerateMessage     string // 点击重新生成按钮时携带的参数信息
	buttonRegenerateMessageFlag bool

	enterpriseQaChannelInfo     string // 主会话链路前端透传给后端的参数
	enterpriseQaChannelInfoFlag bool
}

func NewScenarioContextExtraBuilder() *ScenarioContextExtraBuilder {
	builder := &ScenarioContextExtraBuilder{}
	return builder
}

// Grounding ID
//
// 示例值：123
func (builder *ScenarioContextExtraBuilder) GroundingId(groundingId string) *ScenarioContextExtraBuilder {
	builder.groundingId = groundingId
	builder.groundingIdFlag = true
	return builder
}

// 模型 key
//
// 示例值：lark-online
func (builder *ScenarioContextExtraBuilder) ModelKey(modelKey string) *ScenarioContextExtraBuilder {
	builder.modelKey = modelKey
	builder.modelKeyFlag = true
	return builder
}

// 检索时指定的文档 id, 多个 id 以`,`分隔
//
// 示例值：123,456
func (builder *ScenarioContextExtraBuilder) SpecifiedObjIds(specifiedObjIds string) *ScenarioContextExtraBuilder {
	builder.specifiedObjIds = specifiedObjIds
	builder.specifiedObjIdsFlag = true
	return builder
}

// 推荐问题的 ID
//
// 示例值：789
func (builder *ScenarioContextExtraBuilder) SuggestQueryId(suggestQueryId string) *ScenarioContextExtraBuilder {
	builder.suggestQueryId = suggestQueryId
	builder.suggestQueryIdFlag = true
	return builder
}

// 点击按钮发送消息时所携带的参数信息
//
// 示例值：1
func (builder *ScenarioContextExtraBuilder) ButtonSendMessageInfo(buttonSendMessageInfo string) *ScenarioContextExtraBuilder {
	builder.buttonSendMessageInfo = buttonSendMessageInfo
	builder.buttonSendMessageInfoFlag = true
	return builder
}

// 点击重新生成按钮时携带的参数信息
//
// 示例值：1
func (builder *ScenarioContextExtraBuilder) ButtonRegenerateMessage(buttonRegenerateMessage string) *ScenarioContextExtraBuilder {
	builder.buttonRegenerateMessage = buttonRegenerateMessage
	builder.buttonRegenerateMessageFlag = true
	return builder
}

// 主会话链路前端透传给后端的参数
//
// 示例值：1
func (builder *ScenarioContextExtraBuilder) EnterpriseQaChannelInfo(enterpriseQaChannelInfo string) *ScenarioContextExtraBuilder {
	builder.enterpriseQaChannelInfo = enterpriseQaChannelInfo
	builder.enterpriseQaChannelInfoFlag = true
	return builder
}

func (builder *ScenarioContextExtraBuilder) Build() *ScenarioContextExtra {
	req := &ScenarioContextExtra{}
	if builder.groundingIdFlag {
		req.GroundingId = &builder.groundingId

	}
	if builder.modelKeyFlag {
		req.ModelKey = &builder.modelKey

	}
	if builder.specifiedObjIdsFlag {
		req.SpecifiedObjIds = &builder.specifiedObjIds

	}
	if builder.suggestQueryIdFlag {
		req.SuggestQueryId = &builder.suggestQueryId

	}
	if builder.buttonSendMessageInfoFlag {
		req.ButtonSendMessageInfo = &builder.buttonSendMessageInfo

	}
	if builder.buttonRegenerateMessageFlag {
		req.ButtonRegenerateMessage = &builder.buttonRegenerateMessage

	}
	if builder.enterpriseQaChannelInfoFlag {
		req.EnterpriseQaChannelInfo = &builder.enterpriseQaChannelInfo

	}
	return req
}

type Schema struct {
	Properties []*SchemaProperty `json:"properties,omitempty"` // 数据范式的属性定义

	Display *SchemaDisplay `json:"display,omitempty"` // 数据展示相关配置

	SchemaId *string `json:"schema_id,omitempty"` // 用户自定义数据范式的唯一标识
}

type SchemaBuilder struct {
	properties     []*SchemaProperty // 数据范式的属性定义
	propertiesFlag bool

	display     *SchemaDisplay // 数据展示相关配置
	displayFlag bool

	schemaId     string // 用户自定义数据范式的唯一标识
	schemaIdFlag bool
}

func NewSchemaBuilder() *SchemaBuilder {
	builder := &SchemaBuilder{}
	return builder
}

// 数据范式的属性定义
//
// 示例值：
func (builder *SchemaBuilder) Properties(properties []*SchemaProperty) *SchemaBuilder {
	builder.properties = properties
	builder.propertiesFlag = true
	return builder
}

// 数据展示相关配置
//
// 示例值：
func (builder *SchemaBuilder) Display(display *SchemaDisplay) *SchemaBuilder {
	builder.display = display
	builder.displayFlag = true
	return builder
}

// 用户自定义数据范式的唯一标识
//
// 示例值：jira_schema
func (builder *SchemaBuilder) SchemaId(schemaId string) *SchemaBuilder {
	builder.schemaId = schemaId
	builder.schemaIdFlag = true
	return builder
}

func (builder *SchemaBuilder) Build() *Schema {
	req := &Schema{}
	if builder.propertiesFlag {
		req.Properties = builder.properties
	}
	if builder.displayFlag {
		req.Display = builder.display
	}
	if builder.schemaIdFlag {
		req.SchemaId = &builder.schemaId

	}
	return req
}

type SchemaDisplay struct {
	CardKey *string `json:"card_key,omitempty"` // 搜索数据的展示卡片;;;卡片详细信息请参考 [通用模块接入指南](/uAjLw4CM/ukTMukTMukTM/search-v2/common-template-intergration-handbook)  "请求创建数据范式"部分

	FieldsMapping []*SchemaDisplayFieldMapping `json:"fields_mapping,omitempty"` // 数据字段名称和展示字段名称的映射关系。如果没有设置，则只会展示 与展示字段名称同名的 数据字段
}

type SchemaDisplayBuilder struct {
	cardKey     string // 搜索数据的展示卡片;;;卡片详细信息请参考 [通用模块接入指南](/uAjLw4CM/ukTMukTMukTM/search-v2/common-template-intergration-handbook)  "请求创建数据范式"部分
	cardKeyFlag bool

	fieldsMapping     []*SchemaDisplayFieldMapping // 数据字段名称和展示字段名称的映射关系。如果没有设置，则只会展示 与展示字段名称同名的 数据字段
	fieldsMappingFlag bool
}

func NewSchemaDisplayBuilder() *SchemaDisplayBuilder {
	builder := &SchemaDisplayBuilder{}
	return builder
}

// 搜索数据的展示卡片;;;卡片详细信息请参考 [通用模块接入指南](/uAjLw4CM/ukTMukTMukTM/search-v2/common-template-intergration-handbook)  "请求创建数据范式"部分
//
// 示例值：search_common_card
func (builder *SchemaDisplayBuilder) CardKey(cardKey string) *SchemaDisplayBuilder {
	builder.cardKey = cardKey
	builder.cardKeyFlag = true
	return builder
}

// 数据字段名称和展示字段名称的映射关系。如果没有设置，则只会展示 与展示字段名称同名的 数据字段
//
// 示例值：
func (builder *SchemaDisplayBuilder) FieldsMapping(fieldsMapping []*SchemaDisplayFieldMapping) *SchemaDisplayBuilder {
	builder.fieldsMapping = fieldsMapping
	builder.fieldsMappingFlag = true
	return builder
}

func (builder *SchemaDisplayBuilder) Build() *SchemaDisplay {
	req := &SchemaDisplay{}
	if builder.cardKeyFlag {
		req.CardKey = &builder.cardKey

	}
	if builder.fieldsMappingFlag {
		req.FieldsMapping = builder.fieldsMapping
	}
	return req
}

type SchemaDisplayFieldMapping struct {
	DisplayField *string `json:"display_field,omitempty"` // 展示字段名称，与 card_key 有关，每个模版能展示的字段不同。该字段不能重复

	DataField *string `json:"data_field,omitempty"` // 数据字段的名称。需要确保该字段对应在 schema 属性定义中的 is_returnable 为 true，否则无法展示。需要使用 ${xxx} 的规则来描述
}

type SchemaDisplayFieldMappingBuilder struct {
	displayField     string // 展示字段名称，与 card_key 有关，每个模版能展示的字段不同。该字段不能重复
	displayFieldFlag bool

	dataField     string // 数据字段的名称。需要确保该字段对应在 schema 属性定义中的 is_returnable 为 true，否则无法展示。需要使用 ${xxx} 的规则来描述
	dataFieldFlag bool
}

func NewSchemaDisplayFieldMappingBuilder() *SchemaDisplayFieldMappingBuilder {
	builder := &SchemaDisplayFieldMappingBuilder{}
	return builder
}

// 展示字段名称，与 card_key 有关，每个模版能展示的字段不同。该字段不能重复
//
// 示例值：summary
func (builder *SchemaDisplayFieldMappingBuilder) DisplayField(displayField string) *SchemaDisplayFieldMappingBuilder {
	builder.displayField = displayField
	builder.displayFieldFlag = true
	return builder
}

// 数据字段的名称。需要确保该字段对应在 schema 属性定义中的 is_returnable 为 true，否则无法展示。需要使用 ${xxx} 的规则来描述
//
// 示例值：${description}
func (builder *SchemaDisplayFieldMappingBuilder) DataField(dataField string) *SchemaDisplayFieldMappingBuilder {
	builder.dataField = dataField
	builder.dataFieldFlag = true
	return builder
}

func (builder *SchemaDisplayFieldMappingBuilder) Build() *SchemaDisplayFieldMapping {
	req := &SchemaDisplayFieldMapping{}
	if builder.displayFieldFlag {
		req.DisplayField = &builder.displayField

	}
	if builder.dataFieldFlag {
		req.DataField = &builder.dataField

	}
	return req
}

type SchemaEnumOptions struct {
	PossibleValues []string `json:"possible_values,omitempty"` // 用户自定filter 枚举值数组，最大长度为50
}

type SchemaEnumOptionsBuilder struct {
	possibleValues     []string // 用户自定filter 枚举值数组，最大长度为50
	possibleValuesFlag bool
}

func NewSchemaEnumOptionsBuilder() *SchemaEnumOptionsBuilder {
	builder := &SchemaEnumOptionsBuilder{}
	return builder
}

// 用户自定filter 枚举值数组，最大长度为50
//
// 示例值：v1
func (builder *SchemaEnumOptionsBuilder) PossibleValues(possibleValues []string) *SchemaEnumOptionsBuilder {
	builder.possibleValues = possibleValues
	builder.possibleValuesFlag = true
	return builder
}

func (builder *SchemaEnumOptionsBuilder) Build() *SchemaEnumOptions {
	req := &SchemaEnumOptions{}
	if builder.possibleValuesFlag {
		req.PossibleValues = builder.possibleValues
	}
	return req
}

type SchemaFieldAnswerOption struct {
	IsSearchable *bool `json:"is_searchable,omitempty"` // 是否用于搜索

	IsReturnable *bool `json:"is_returnable,omitempty"` // 是否用于返回
}

type SchemaFieldAnswerOptionBuilder struct {
	isSearchable     bool // 是否用于搜索
	isSearchableFlag bool

	isReturnable     bool // 是否用于返回
	isReturnableFlag bool
}

func NewSchemaFieldAnswerOptionBuilder() *SchemaFieldAnswerOptionBuilder {
	builder := &SchemaFieldAnswerOptionBuilder{}
	return builder
}

// 是否用于搜索
//
// 示例值：false
func (builder *SchemaFieldAnswerOptionBuilder) IsSearchable(isSearchable bool) *SchemaFieldAnswerOptionBuilder {
	builder.isSearchable = isSearchable
	builder.isSearchableFlag = true
	return builder
}

// 是否用于返回
//
// 示例值：false
func (builder *SchemaFieldAnswerOptionBuilder) IsReturnable(isReturnable bool) *SchemaFieldAnswerOptionBuilder {
	builder.isReturnable = isReturnable
	builder.isReturnableFlag = true
	return builder
}

func (builder *SchemaFieldAnswerOptionBuilder) Build() *SchemaFieldAnswerOption {
	req := &SchemaFieldAnswerOption{}
	if builder.isSearchableFlag {
		req.IsSearchable = &builder.isSearchable

	}
	if builder.isReturnableFlag {
		req.IsReturnable = &builder.isReturnable

	}
	return req
}

type SchemaFilterOptions struct {
	DisplayName *string `json:"display_name,omitempty"` // 筛选器展示名称

	I18nDisplayName *I18nMeta `json:"i18n_display_name,omitempty"` // 筛选器展示名称国际化字段

	OptionMode *string `json:"option_mode,omitempty"` // 指明该筛选器支持单选或多选，默认单选

	AssociatedSmartFilter *string `json:"associated_smart_filter,omitempty"` // 关联的综合筛选器。只有 filter_type 为"user"和"time"时可以关联。"user" -> "from"；"time" -> "date"。

	FilterType *string `json:"filter_type,omitempty"` // 筛选器类型

	PredefineEnumValues []*SchemaPredefineEnumStruct `json:"predefine_enum_values,omitempty"` // 预定义的展示枚举值。在 filter_type 为 "predefine_enum" 时必须填写

	EnableClientFilter *bool `json:"enable_client_filter,omitempty"` // 是否开启客户端筛选器

	ReferenceDatasourceId *string `json:"reference_datasource_id,omitempty"` // 可搜筛选器关联的数据源标识
}

type SchemaFilterOptionsBuilder struct {
	displayName     string // 筛选器展示名称
	displayNameFlag bool

	i18nDisplayName     *I18nMeta // 筛选器展示名称国际化字段
	i18nDisplayNameFlag bool

	optionMode     string // 指明该筛选器支持单选或多选，默认单选
	optionModeFlag bool

	associatedSmartFilter     string // 关联的综合筛选器。只有 filter_type 为"user"和"time"时可以关联。"user" -> "from"；"time" -> "date"。
	associatedSmartFilterFlag bool

	filterType     string // 筛选器类型
	filterTypeFlag bool

	predefineEnumValues     []*SchemaPredefineEnumStruct // 预定义的展示枚举值。在 filter_type 为 "predefine_enum" 时必须填写
	predefineEnumValuesFlag bool

	enableClientFilter     bool // 是否开启客户端筛选器
	enableClientFilterFlag bool

	referenceDatasourceId     string // 可搜筛选器关联的数据源标识
	referenceDatasourceIdFlag bool
}

func NewSchemaFilterOptionsBuilder() *SchemaFilterOptionsBuilder {
	builder := &SchemaFilterOptionsBuilder{}
	return builder
}

// 筛选器展示名称
//
// 示例值：创建人
func (builder *SchemaFilterOptionsBuilder) DisplayName(displayName string) *SchemaFilterOptionsBuilder {
	builder.displayName = displayName
	builder.displayNameFlag = true
	return builder
}

// 筛选器展示名称国际化字段
//
// 示例值：
func (builder *SchemaFilterOptionsBuilder) I18nDisplayName(i18nDisplayName *I18nMeta) *SchemaFilterOptionsBuilder {
	builder.i18nDisplayName = i18nDisplayName
	builder.i18nDisplayNameFlag = true
	return builder
}

// 指明该筛选器支持单选或多选，默认单选
//
// 示例值：single
func (builder *SchemaFilterOptionsBuilder) OptionMode(optionMode string) *SchemaFilterOptionsBuilder {
	builder.optionMode = optionMode
	builder.optionModeFlag = true
	return builder
}

// 关联的综合筛选器。只有 filter_type 为"user"和"time"时可以关联。"user" -> "from"；"time" -> "date"。
//
// 示例值：From
func (builder *SchemaFilterOptionsBuilder) AssociatedSmartFilter(associatedSmartFilter string) *SchemaFilterOptionsBuilder {
	builder.associatedSmartFilter = associatedSmartFilter
	builder.associatedSmartFilterFlag = true
	return builder
}

// 筛选器类型
//
// 示例值：user
func (builder *SchemaFilterOptionsBuilder) FilterType(filterType string) *SchemaFilterOptionsBuilder {
	builder.filterType = filterType
	builder.filterTypeFlag = true
	return builder
}

// 预定义的展示枚举值。在 filter_type 为 "predefine_enum" 时必须填写
//
// 示例值：
func (builder *SchemaFilterOptionsBuilder) PredefineEnumValues(predefineEnumValues []*SchemaPredefineEnumStruct) *SchemaFilterOptionsBuilder {
	builder.predefineEnumValues = predefineEnumValues
	builder.predefineEnumValuesFlag = true
	return builder
}

// 是否开启客户端筛选器
//
// 示例值：true
func (builder *SchemaFilterOptionsBuilder) EnableClientFilter(enableClientFilter bool) *SchemaFilterOptionsBuilder {
	builder.enableClientFilter = enableClientFilter
	builder.enableClientFilterFlag = true
	return builder
}

// 可搜筛选器关联的数据源标识
//
// 示例值：7264565154409461234
func (builder *SchemaFilterOptionsBuilder) ReferenceDatasourceId(referenceDatasourceId string) *SchemaFilterOptionsBuilder {
	builder.referenceDatasourceId = referenceDatasourceId
	builder.referenceDatasourceIdFlag = true
	return builder
}

func (builder *SchemaFilterOptionsBuilder) Build() *SchemaFilterOptions {
	req := &SchemaFilterOptions{}
	if builder.displayNameFlag {
		req.DisplayName = &builder.displayName

	}
	if builder.i18nDisplayNameFlag {
		req.I18nDisplayName = builder.i18nDisplayName
	}
	if builder.optionModeFlag {
		req.OptionMode = &builder.optionMode

	}
	if builder.associatedSmartFilterFlag {
		req.AssociatedSmartFilter = &builder.associatedSmartFilter

	}
	if builder.filterTypeFlag {
		req.FilterType = &builder.filterType

	}
	if builder.predefineEnumValuesFlag {
		req.PredefineEnumValues = builder.predefineEnumValues
	}
	if builder.enableClientFilterFlag {
		req.EnableClientFilter = &builder.enableClientFilter

	}
	if builder.referenceDatasourceIdFlag {
		req.ReferenceDatasourceId = &builder.referenceDatasourceId

	}
	return req
}

type SchemaPredefineEnumStruct struct {
	Name *string `json:"name,omitempty"` // 枚举值的标识。在多枚举值定义中保持唯一

	Text *string `json:"text,omitempty"` // 枚举值展示文案
}

type SchemaPredefineEnumStructBuilder struct {
	name     string // 枚举值的标识。在多枚举值定义中保持唯一
	nameFlag bool

	text     string // 枚举值展示文案
	textFlag bool
}

func NewSchemaPredefineEnumStructBuilder() *SchemaPredefineEnumStructBuilder {
	builder := &SchemaPredefineEnumStructBuilder{}
	return builder
}

// 枚举值的标识。在多枚举值定义中保持唯一
//
// 示例值：p0
func (builder *SchemaPredefineEnumStructBuilder) Name(name string) *SchemaPredefineEnumStructBuilder {
	builder.name = name
	builder.nameFlag = true
	return builder
}

// 枚举值展示文案
//
// 示例值：最高优先级
func (builder *SchemaPredefineEnumStructBuilder) Text(text string) *SchemaPredefineEnumStructBuilder {
	builder.text = text
	builder.textFlag = true
	return builder
}

func (builder *SchemaPredefineEnumStructBuilder) Build() *SchemaPredefineEnumStruct {
	req := &SchemaPredefineEnumStruct{}
	if builder.nameFlag {
		req.Name = &builder.name

	}
	if builder.textFlag {
		req.Text = &builder.text

	}
	return req
}

type SchemaProperty struct {
	Name *string `json:"name,omitempty"` // 属性名

	Type *string `json:"type,omitempty"` // 属性类型

	IsSearchable *bool `json:"is_searchable,omitempty"` // 该属性是否可用作搜索，默认为 false

	IsSortable *bool `json:"is_sortable,omitempty"` // 该属性是否可用作搜索结果排序，默认为 false。如果为 true，需要再配置 sortOptions

	IsReturnable *bool `json:"is_returnable,omitempty"` // 该属性是否可用作返回字段，为 false 时，该字段不会被召回和展示。默认为 false

	SortOptions *SchemaSortOptions `json:"sort_options,omitempty"` // 属性排序的可选配置，当 is_sortable 为 true 时，该字段为必填字段

	TypeDefinitions *SchemaTypeDefinitions `json:"type_definitions,omitempty"` // 相关类型数据的定义和约束

	SearchOptions *SchemaSearchOptions `json:"search_options,omitempty"` // 属性搜索的可选配置，当 is_searchable 为 true 时，该字段为必填参数

	IsFilterable *bool `json:"is_filterable,omitempty"` // 该属性是否可用作返回字段，为 false 时，该字段不会被筛选。默认为 false

	FilterOptions *SchemaFilterOptions `json:"filter_options,omitempty"` // 属性筛选的可选配置，当 is_searchable 为 true 时，该字段为必填参数

	AnswerOption *SchemaFieldAnswerOption `json:"answer_option,omitempty"` // 问答产品设置，仅在datasource中enable_answer为true时生效

	Desc *string `json:"desc,omitempty"` // 字段描述
}

type SchemaPropertyBuilder struct {
	name     string // 属性名
	nameFlag bool

	type_    string // 属性类型
	typeFlag bool

	isSearchable     bool // 该属性是否可用作搜索，默认为 false
	isSearchableFlag bool

	isSortable     bool // 该属性是否可用作搜索结果排序，默认为 false。如果为 true，需要再配置 sortOptions
	isSortableFlag bool

	isReturnable     bool // 该属性是否可用作返回字段，为 false 时，该字段不会被召回和展示。默认为 false
	isReturnableFlag bool

	sortOptions     *SchemaSortOptions // 属性排序的可选配置，当 is_sortable 为 true 时，该字段为必填字段
	sortOptionsFlag bool

	typeDefinitions     *SchemaTypeDefinitions // 相关类型数据的定义和约束
	typeDefinitionsFlag bool

	searchOptions     *SchemaSearchOptions // 属性搜索的可选配置，当 is_searchable 为 true 时，该字段为必填参数
	searchOptionsFlag bool

	isFilterable     bool // 该属性是否可用作返回字段，为 false 时，该字段不会被筛选。默认为 false
	isFilterableFlag bool

	filterOptions     *SchemaFilterOptions // 属性筛选的可选配置，当 is_searchable 为 true 时，该字段为必填参数
	filterOptionsFlag bool

	answerOption     *SchemaFieldAnswerOption // 问答产品设置，仅在datasource中enable_answer为true时生效
	answerOptionFlag bool

	desc     string // 字段描述
	descFlag bool
}

func NewSchemaPropertyBuilder() *SchemaPropertyBuilder {
	builder := &SchemaPropertyBuilder{}
	return builder
}

// 属性名
//
// 示例值：summary
func (builder *SchemaPropertyBuilder) Name(name string) *SchemaPropertyBuilder {
	builder.name = name
	builder.nameFlag = true
	return builder
}

// 属性类型
//
// 示例值：text
func (builder *SchemaPropertyBuilder) Type(type_ string) *SchemaPropertyBuilder {
	builder.type_ = type_
	builder.typeFlag = true
	return builder
}

// 该属性是否可用作搜索，默认为 false
//
// 示例值：true
func (builder *SchemaPropertyBuilder) IsSearchable(isSearchable bool) *SchemaPropertyBuilder {
	builder.isSearchable = isSearchable
	builder.isSearchableFlag = true
	return builder
}

// 该属性是否可用作搜索结果排序，默认为 false。如果为 true，需要再配置 sortOptions
//
// 示例值：false
func (builder *SchemaPropertyBuilder) IsSortable(isSortable bool) *SchemaPropertyBuilder {
	builder.isSortable = isSortable
	builder.isSortableFlag = true
	return builder
}

// 该属性是否可用作返回字段，为 false 时，该字段不会被召回和展示。默认为 false
//
// 示例值：true
func (builder *SchemaPropertyBuilder) IsReturnable(isReturnable bool) *SchemaPropertyBuilder {
	builder.isReturnable = isReturnable
	builder.isReturnableFlag = true
	return builder
}

// 属性排序的可选配置，当 is_sortable 为 true 时，该字段为必填字段
//
// 示例值：
func (builder *SchemaPropertyBuilder) SortOptions(sortOptions *SchemaSortOptions) *SchemaPropertyBuilder {
	builder.sortOptions = sortOptions
	builder.sortOptionsFlag = true
	return builder
}

// 相关类型数据的定义和约束
//
// 示例值：
func (builder *SchemaPropertyBuilder) TypeDefinitions(typeDefinitions *SchemaTypeDefinitions) *SchemaPropertyBuilder {
	builder.typeDefinitions = typeDefinitions
	builder.typeDefinitionsFlag = true
	return builder
}

// 属性搜索的可选配置，当 is_searchable 为 true 时，该字段为必填参数
//
// 示例值：
func (builder *SchemaPropertyBuilder) SearchOptions(searchOptions *SchemaSearchOptions) *SchemaPropertyBuilder {
	builder.searchOptions = searchOptions
	builder.searchOptionsFlag = true
	return builder
}

// 该属性是否可用作返回字段，为 false 时，该字段不会被筛选。默认为 false
//
// 示例值：false
func (builder *SchemaPropertyBuilder) IsFilterable(isFilterable bool) *SchemaPropertyBuilder {
	builder.isFilterable = isFilterable
	builder.isFilterableFlag = true
	return builder
}

// 属性筛选的可选配置，当 is_searchable 为 true 时，该字段为必填参数
//
// 示例值：
func (builder *SchemaPropertyBuilder) FilterOptions(filterOptions *SchemaFilterOptions) *SchemaPropertyBuilder {
	builder.filterOptions = filterOptions
	builder.filterOptionsFlag = true
	return builder
}

// 问答产品设置，仅在datasource中enable_answer为true时生效
//
// 示例值：
func (builder *SchemaPropertyBuilder) AnswerOption(answerOption *SchemaFieldAnswerOption) *SchemaPropertyBuilder {
	builder.answerOption = answerOption
	builder.answerOptionFlag = true
	return builder
}

// 字段描述
//
// 示例值：desc
func (builder *SchemaPropertyBuilder) Desc(desc string) *SchemaPropertyBuilder {
	builder.desc = desc
	builder.descFlag = true
	return builder
}

func (builder *SchemaPropertyBuilder) Build() *SchemaProperty {
	req := &SchemaProperty{}
	if builder.nameFlag {
		req.Name = &builder.name

	}
	if builder.typeFlag {
		req.Type = &builder.type_

	}
	if builder.isSearchableFlag {
		req.IsSearchable = &builder.isSearchable

	}
	if builder.isSortableFlag {
		req.IsSortable = &builder.isSortable

	}
	if builder.isReturnableFlag {
		req.IsReturnable = &builder.isReturnable

	}
	if builder.sortOptionsFlag {
		req.SortOptions = builder.sortOptions
	}
	if builder.typeDefinitionsFlag {
		req.TypeDefinitions = builder.typeDefinitions
	}
	if builder.searchOptionsFlag {
		req.SearchOptions = builder.searchOptions
	}
	if builder.isFilterableFlag {
		req.IsFilterable = &builder.isFilterable

	}
	if builder.filterOptionsFlag {
		req.FilterOptions = builder.filterOptions
	}
	if builder.answerOptionFlag {
		req.AnswerOption = builder.answerOption
	}
	if builder.descFlag {
		req.Desc = &builder.desc

	}
	return req
}

type SchemaSearchOptions struct {
	EnableSemanticMatch *bool `json:"enable_semantic_match,omitempty"` // 是否支持语义切词召回。默认不支持（推荐使用在长文本的场景）

	EnableExactMatch *bool `json:"enable_exact_match,omitempty"` // 是否支持精确匹配。默认不支持（推荐使用在短文本、需要精确查找的场景）

	EnablePrefixMatch *bool `json:"enable_prefix_match,omitempty"` // 是否支持前缀匹配（短文本的默认的分词/召回策略。前缀长度为 1-12）

	EnableNumberSuffixMatch *bool `json:"enable_number_suffix_match,omitempty"` // 是否支持数据后缀匹配。默认不支持（推荐使用在短文本、有数字后缀查找的场景。后缀长度为3-12）

	EnableCamelMatch *bool `json:"enable_camel_match,omitempty"` // 是否支持驼峰英文匹配。默认不支持（推荐使用在短文本，且包含驼峰形式英文的查找场景）
}

type SchemaSearchOptionsBuilder struct {
	enableSemanticMatch     bool // 是否支持语义切词召回。默认不支持（推荐使用在长文本的场景）
	enableSemanticMatchFlag bool

	enableExactMatch     bool // 是否支持精确匹配。默认不支持（推荐使用在短文本、需要精确查找的场景）
	enableExactMatchFlag bool

	enablePrefixMatch     bool // 是否支持前缀匹配（短文本的默认的分词/召回策略。前缀长度为 1-12）
	enablePrefixMatchFlag bool

	enableNumberSuffixMatch     bool // 是否支持数据后缀匹配。默认不支持（推荐使用在短文本、有数字后缀查找的场景。后缀长度为3-12）
	enableNumberSuffixMatchFlag bool

	enableCamelMatch     bool // 是否支持驼峰英文匹配。默认不支持（推荐使用在短文本，且包含驼峰形式英文的查找场景）
	enableCamelMatchFlag bool
}

func NewSchemaSearchOptionsBuilder() *SchemaSearchOptionsBuilder {
	builder := &SchemaSearchOptionsBuilder{}
	return builder
}

// 是否支持语义切词召回。默认不支持（推荐使用在长文本的场景）
//
// 示例值：true
func (builder *SchemaSearchOptionsBuilder) EnableSemanticMatch(enableSemanticMatch bool) *SchemaSearchOptionsBuilder {
	builder.enableSemanticMatch = enableSemanticMatch
	builder.enableSemanticMatchFlag = true
	return builder
}

// 是否支持精确匹配。默认不支持（推荐使用在短文本、需要精确查找的场景）
//
// 示例值：false
func (builder *SchemaSearchOptionsBuilder) EnableExactMatch(enableExactMatch bool) *SchemaSearchOptionsBuilder {
	builder.enableExactMatch = enableExactMatch
	builder.enableExactMatchFlag = true
	return builder
}

// 是否支持前缀匹配（短文本的默认的分词/召回策略。前缀长度为 1-12）
//
// 示例值：false
func (builder *SchemaSearchOptionsBuilder) EnablePrefixMatch(enablePrefixMatch bool) *SchemaSearchOptionsBuilder {
	builder.enablePrefixMatch = enablePrefixMatch
	builder.enablePrefixMatchFlag = true
	return builder
}

// 是否支持数据后缀匹配。默认不支持（推荐使用在短文本、有数字后缀查找的场景。后缀长度为3-12）
//
// 示例值：false
func (builder *SchemaSearchOptionsBuilder) EnableNumberSuffixMatch(enableNumberSuffixMatch bool) *SchemaSearchOptionsBuilder {
	builder.enableNumberSuffixMatch = enableNumberSuffixMatch
	builder.enableNumberSuffixMatchFlag = true
	return builder
}

// 是否支持驼峰英文匹配。默认不支持（推荐使用在短文本，且包含驼峰形式英文的查找场景）
//
// 示例值：false
func (builder *SchemaSearchOptionsBuilder) EnableCamelMatch(enableCamelMatch bool) *SchemaSearchOptionsBuilder {
	builder.enableCamelMatch = enableCamelMatch
	builder.enableCamelMatchFlag = true
	return builder
}

func (builder *SchemaSearchOptionsBuilder) Build() *SchemaSearchOptions {
	req := &SchemaSearchOptions{}
	if builder.enableSemanticMatchFlag {
		req.EnableSemanticMatch = &builder.enableSemanticMatch

	}
	if builder.enableExactMatchFlag {
		req.EnableExactMatch = &builder.enableExactMatch

	}
	if builder.enablePrefixMatchFlag {
		req.EnablePrefixMatch = &builder.enablePrefixMatch

	}
	if builder.enableNumberSuffixMatchFlag {
		req.EnableNumberSuffixMatch = &builder.enableNumberSuffixMatch

	}
	if builder.enableCamelMatchFlag {
		req.EnableCamelMatch = &builder.enableCamelMatch

	}
	return req
}

type SchemaSortOptions struct {
	Priority *int `json:"priority,omitempty"` // 排序的优先级，可选范围为 0~4，0为最高优先级。如果优先级相同，则随机进行排序。默认为0

	Order *string `json:"order,omitempty"` // 排序的顺序。默认为 desc
}

type SchemaSortOptionsBuilder struct {
	priority     int // 排序的优先级，可选范围为 0~4，0为最高优先级。如果优先级相同，则随机进行排序。默认为0
	priorityFlag bool

	order     string // 排序的顺序。默认为 desc
	orderFlag bool
}

func NewSchemaSortOptionsBuilder() *SchemaSortOptionsBuilder {
	builder := &SchemaSortOptionsBuilder{}
	return builder
}

// 排序的优先级，可选范围为 0~4，0为最高优先级。如果优先级相同，则随机进行排序。默认为0
//
// 示例值：0
func (builder *SchemaSortOptionsBuilder) Priority(priority int) *SchemaSortOptionsBuilder {
	builder.priority = priority
	builder.priorityFlag = true
	return builder
}

// 排序的顺序。默认为 desc
//
// 示例值：asc
func (builder *SchemaSortOptionsBuilder) Order(order string) *SchemaSortOptionsBuilder {
	builder.order = order
	builder.orderFlag = true
	return builder
}

func (builder *SchemaSortOptionsBuilder) Build() *SchemaSortOptions {
	req := &SchemaSortOptions{}
	if builder.priorityFlag {
		req.Priority = &builder.priority

	}
	if builder.orderFlag {
		req.Order = &builder.order

	}
	return req
}

type SchemaTagOptions struct {
	Name *string `json:"name,omitempty"` // tag 对应的枚举值名称

	Color *string `json:"color,omitempty"` // 标签对应的颜色

	Text *string `json:"text,omitempty"` // 标签中展示的文本
}

type SchemaTagOptionsBuilder struct {
	name     string // tag 对应的枚举值名称
	nameFlag bool

	color     string // 标签对应的颜色
	colorFlag bool

	text     string // 标签中展示的文本
	textFlag bool
}

func NewSchemaTagOptionsBuilder() *SchemaTagOptionsBuilder {
	builder := &SchemaTagOptionsBuilder{}
	return builder
}

// tag 对应的枚举值名称
//
// 示例值：status
func (builder *SchemaTagOptionsBuilder) Name(name string) *SchemaTagOptionsBuilder {
	builder.name = name
	builder.nameFlag = true
	return builder
}

// 标签对应的颜色
//
// 示例值：blue
func (builder *SchemaTagOptionsBuilder) Color(color string) *SchemaTagOptionsBuilder {
	builder.color = color
	builder.colorFlag = true
	return builder
}

// 标签中展示的文本
//
// 示例值：PASS
func (builder *SchemaTagOptionsBuilder) Text(text string) *SchemaTagOptionsBuilder {
	builder.text = text
	builder.textFlag = true
	return builder
}

func (builder *SchemaTagOptionsBuilder) Build() *SchemaTagOptions {
	req := &SchemaTagOptions{}
	if builder.nameFlag {
		req.Name = &builder.name

	}
	if builder.colorFlag {
		req.Color = &builder.color

	}
	if builder.textFlag {
		req.Text = &builder.text

	}
	return req
}

type SchemaTypeDefinitions struct {
	Tag []*SchemaTagOptions `json:"tag,omitempty"` // 标签类型的定义

	UserIds *SchemaUserIdsOption `json:"user_ids,omitempty"` // 用户身份标识
}

type SchemaTypeDefinitionsBuilder struct {
	tag     []*SchemaTagOptions // 标签类型的定义
	tagFlag bool

	userIds     *SchemaUserIdsOption // 用户身份标识
	userIdsFlag bool
}

func NewSchemaTypeDefinitionsBuilder() *SchemaTypeDefinitionsBuilder {
	builder := &SchemaTypeDefinitionsBuilder{}
	return builder
}

// 标签类型的定义
//
// 示例值：
func (builder *SchemaTypeDefinitionsBuilder) Tag(tag []*SchemaTagOptions) *SchemaTypeDefinitionsBuilder {
	builder.tag = tag
	builder.tagFlag = true
	return builder
}

// 用户身份标识
//
// 示例值：
func (builder *SchemaTypeDefinitionsBuilder) UserIds(userIds *SchemaUserIdsOption) *SchemaTypeDefinitionsBuilder {
	builder.userIds = userIds
	builder.userIdsFlag = true
	return builder
}

func (builder *SchemaTypeDefinitionsBuilder) Build() *SchemaTypeDefinitions {
	req := &SchemaTypeDefinitions{}
	if builder.tagFlag {
		req.Tag = builder.tag
	}
	if builder.userIdsFlag {
		req.UserIds = builder.userIds
	}
	return req
}

type SchemaUserIdsOption struct {
	IdType *string `json:"id_type,omitempty"` // 用户身份类型
}

type SchemaUserIdsOptionBuilder struct {
	idType     string // 用户身份类型
	idTypeFlag bool
}

func NewSchemaUserIdsOptionBuilder() *SchemaUserIdsOptionBuilder {
	builder := &SchemaUserIdsOptionBuilder{}
	return builder
}

// 用户身份类型
//
// 示例值：user_id
func (builder *SchemaUserIdsOptionBuilder) IdType(idType string) *SchemaUserIdsOptionBuilder {
	builder.idType = idType
	builder.idTypeFlag = true
	return builder
}

func (builder *SchemaUserIdsOptionBuilder) Build() *SchemaUserIdsOption {
	req := &SchemaUserIdsOption{}
	if builder.idTypeFlag {
		req.IdType = &builder.idType

	}
	return req
}

type SeperatePassage struct {
	PassageId *string `json:"passage_id,omitempty"` // passage_id

	ObjId *string `json:"obj_id,omitempty"` // obj_id

	Content *string `json:"content,omitempty"` // 内容

	NumTokens *int `json:"num_tokens,omitempty"` // passage的token数量
}

type SeperatePassageBuilder struct {
	passageId     string // passage_id
	passageIdFlag bool

	objId     string // obj_id
	objIdFlag bool

	content     string // 内容
	contentFlag bool

	numTokens     int // passage的token数量
	numTokensFlag bool
}

func NewSeperatePassageBuilder() *SeperatePassageBuilder {
	builder := &SeperatePassageBuilder{}
	return builder
}

// passage_id
//
// 示例值：6953165194634772508
func (builder *SeperatePassageBuilder) PassageId(passageId string) *SeperatePassageBuilder {
	builder.passageId = passageId
	builder.passageIdFlag = true
	return builder
}

// obj_id
//
// 示例值：6953165194634772508
func (builder *SeperatePassageBuilder) ObjId(objId string) *SeperatePassageBuilder {
	builder.objId = objId
	builder.objIdFlag = true
	return builder
}

// 内容
//
// 示例值：这是一段passage
func (builder *SeperatePassageBuilder) Content(content string) *SeperatePassageBuilder {
	builder.content = content
	builder.contentFlag = true
	return builder
}

// passage的token数量
//
// 示例值：12
func (builder *SeperatePassageBuilder) NumTokens(numTokens int) *SeperatePassageBuilder {
	builder.numTokens = numTokens
	builder.numTokensFlag = true
	return builder
}

func (builder *SeperatePassageBuilder) Build() *SeperatePassage {
	req := &SeperatePassage{}
	if builder.passageIdFlag {
		req.PassageId = &builder.passageId

	}
	if builder.objIdFlag {
		req.ObjId = &builder.objId

	}
	if builder.contentFlag {
		req.Content = &builder.content

	}
	if builder.numTokensFlag {
		req.NumTokens = &builder.numTokens

	}
	return req
}

type SimpleGetRelatedUsersRequest struct {
	UserId *string `json:"user_id,omitempty"` // 用户id

	TopK *int `json:"top_k,omitempty"` // 获取相关用户的最大人数

	StartTimeFilter *string `json:"start_time_filter,omitempty"` // 方式一：传入时间范围枚举值，“1”代表近一个月，“2”代表近两个月，“3”代表近三个月，“4”代表近六个月，“5”代表近一年，推荐采取该方式。若采用方式一，则end_time_filter无需传入。若start_time_filter和end_time_filter都不传入，则默认搜索范围为半年。 方式二：传入最早的交互时间，毫秒级时间戳。若采用方式二，建议start_time_filter和end_time_filter都传入，若不传入，则默认搜索范围为半年。

	EndTimeFilter *string `json:"end_time_filter,omitempty"` // 最晚交互时间，毫秒级时间戳。
}

type SimpleGetRelatedUsersRequestBuilder struct {
	userId     string // 用户id
	userIdFlag bool

	topK     int // 获取相关用户的最大人数
	topKFlag bool

	startTimeFilter     string // 方式一：传入时间范围枚举值，“1”代表近一个月，“2”代表近两个月，“3”代表近三个月，“4”代表近六个月，“5”代表近一年，推荐采取该方式。若采用方式一，则end_time_filter无需传入。若start_time_filter和end_time_filter都不传入，则默认搜索范围为半年。 方式二：传入最早的交互时间，毫秒级时间戳。若采用方式二，建议start_time_filter和end_time_filter都传入，若不传入，则默认搜索范围为半年。
	startTimeFilterFlag bool

	endTimeFilter     string // 最晚交互时间，毫秒级时间戳。
	endTimeFilterFlag bool
}

func NewSimpleGetRelatedUsersRequestBuilder() *SimpleGetRelatedUsersRequestBuilder {
	builder := &SimpleGetRelatedUsersRequestBuilder{}
	return builder
}

// 用户id
//
// 示例值：fdsfds2
func (builder *SimpleGetRelatedUsersRequestBuilder) UserId(userId string) *SimpleGetRelatedUsersRequestBuilder {
	builder.userId = userId
	builder.userIdFlag = true
	return builder
}

// 获取相关用户的最大人数
//
// 示例值：100
func (builder *SimpleGetRelatedUsersRequestBuilder) TopK(topK int) *SimpleGetRelatedUsersRequestBuilder {
	builder.topK = topK
	builder.topKFlag = true
	return builder
}

// 方式一：传入时间范围枚举值，“1”代表近一个月，“2”代表近两个月，“3”代表近三个月，“4”代表近六个月，“5”代表近一年，推荐采取该方式。若采用方式一，则end_time_filter无需传入。若start_time_filter和end_time_filter都不传入，则默认搜索范围为半年。 方式二：传入最早的交互时间，毫秒级时间戳。若采用方式二，建议start_time_filter和end_time_filter都传入，若不传入，则默认搜索范围为半年。
//
// 示例值：5
func (builder *SimpleGetRelatedUsersRequestBuilder) StartTimeFilter(startTimeFilter string) *SimpleGetRelatedUsersRequestBuilder {
	builder.startTimeFilter = startTimeFilter
	builder.startTimeFilterFlag = true
	return builder
}

// 最晚交互时间，毫秒级时间戳。
//
// 示例值：1736390718000
func (builder *SimpleGetRelatedUsersRequestBuilder) EndTimeFilter(endTimeFilter string) *SimpleGetRelatedUsersRequestBuilder {
	builder.endTimeFilter = endTimeFilter
	builder.endTimeFilterFlag = true
	return builder
}

func (builder *SimpleGetRelatedUsersRequestBuilder) Build() *SimpleGetRelatedUsersRequest {
	req := &SimpleGetRelatedUsersRequest{}
	if builder.userIdFlag {
		req.UserId = &builder.userId

	}
	if builder.topKFlag {
		req.TopK = &builder.topK

	}
	if builder.startTimeFilterFlag {
		req.StartTimeFilter = &builder.startTimeFilter

	}
	if builder.endTimeFilterFlag {
		req.EndTimeFilter = &builder.endTimeFilter

	}
	return req
}

type SimpleRelatedUser struct {
	UserId *string `json:"user_id,omitempty"` // 用户id

	Score *float64 `json:"score,omitempty"` // ci分数
}

type SimpleRelatedUserBuilder struct {
	userId     string // 用户id
	userIdFlag bool

	score     float64 // ci分数
	scoreFlag bool
}

func NewSimpleRelatedUserBuilder() *SimpleRelatedUserBuilder {
	builder := &SimpleRelatedUserBuilder{}
	return builder
}

// 用户id
//
// 示例值：
func (builder *SimpleRelatedUserBuilder) UserId(userId string) *SimpleRelatedUserBuilder {
	builder.userId = userId
	builder.userIdFlag = true
	return builder
}

// ci分数
//
// 示例值：0.9
func (builder *SimpleRelatedUserBuilder) Score(score float64) *SimpleRelatedUserBuilder {
	builder.score = score
	builder.scoreFlag = true
	return builder
}

func (builder *SimpleRelatedUserBuilder) Build() *SimpleRelatedUser {
	req := &SimpleRelatedUser{}
	if builder.userIdFlag {
		req.UserId = &builder.userId

	}
	if builder.scoreFlag {
		req.Score = &builder.score

	}
	return req
}

type Status struct {
	FromStatus *string `json:"from_status,omitempty"` // from_status

	ToStatus *string `json:"to_status,omitempty"` // to_status
}

type StatusBuilder struct {
	fromStatus     string // from_status
	fromStatusFlag bool

	toStatus     string // to_status
	toStatusFlag bool
}

func NewStatusBuilder() *StatusBuilder {
	builder := &StatusBuilder{}
	return builder
}

// from_status
//
// 示例值：""
func (builder *StatusBuilder) FromStatus(fromStatus string) *StatusBuilder {
	builder.fromStatus = fromStatus
	builder.fromStatusFlag = true
	return builder
}

// to_status
//
// 示例值：""
func (builder *StatusBuilder) ToStatus(toStatus string) *StatusBuilder {
	builder.toStatus = toStatus
	builder.toStatusFlag = true
	return builder
}

func (builder *StatusBuilder) Build() *Status {
	req := &Status{}
	if builder.fromStatusFlag {
		req.FromStatus = &builder.fromStatus

	}
	if builder.toStatusFlag {
		req.ToStatus = &builder.toStatus

	}
	return req
}

type SystemInfo struct {
	Time *string `json:"time,omitempty"` // 用户时间

	TimeZone *string `json:"time_zone,omitempty"` // 用户时区

	Lang *string `json:"lang,omitempty"` // 用户问题的语种

	Brand *string `json:"brand,omitempty"` // 客户端品牌

	Weekday *string `json:"weekday,omitempty"` // 星期信息

	SessionId *string `json:"session_id,omitempty"` // 一次话题的唯一标识

	ShadowName *string `json:"shadow_name,omitempty"` // 用户赋予飞飞的名字

	MsgId *string `json:"msg_id,omitempty"` // 消息 ID

	AgentId *string `json:"agent_id,omitempty"` // 场景 ID

	Locale *string `json:"locale,omitempty"` // locale

	AppVersion *string `json:"app_version,omitempty"` // app_version 客户端版本
}

type SystemInfoBuilder struct {
	time     string // 用户时间
	timeFlag bool

	timeZone     string // 用户时区
	timeZoneFlag bool

	lang     string // 用户问题的语种
	langFlag bool

	brand     string // 客户端品牌
	brandFlag bool

	weekday     string // 星期信息
	weekdayFlag bool

	sessionId     string // 一次话题的唯一标识
	sessionIdFlag bool

	shadowName     string // 用户赋予飞飞的名字
	shadowNameFlag bool

	msgId     string // 消息 ID
	msgIdFlag bool

	agentId     string // 场景 ID
	agentIdFlag bool

	locale     string // locale
	localeFlag bool

	appVersion     string // app_version 客户端版本
	appVersionFlag bool
}

func NewSystemInfoBuilder() *SystemInfoBuilder {
	builder := &SystemInfoBuilder{}
	return builder
}

// 用户时间
//
// 示例值：2006-01-02 15:04:05
func (builder *SystemInfoBuilder) Time(time string) *SystemInfoBuilder {
	builder.time = time
	builder.timeFlag = true
	return builder
}

// 用户时区
//
// 示例值：Asia/Shanghai
func (builder *SystemInfoBuilder) TimeZone(timeZone string) *SystemInfoBuilder {
	builder.timeZone = timeZone
	builder.timeZoneFlag = true
	return builder
}

// 用户问题的语种
//
// 示例值：en
func (builder *SystemInfoBuilder) Lang(lang string) *SystemInfoBuilder {
	builder.lang = lang
	builder.langFlag = true
	return builder
}

// 客户端品牌
//
// 示例值：feishu
func (builder *SystemInfoBuilder) Brand(brand string) *SystemInfoBuilder {
	builder.brand = brand
	builder.brandFlag = true
	return builder
}

// 星期信息
//
// 示例值：Monday
func (builder *SystemInfoBuilder) Weekday(weekday string) *SystemInfoBuilder {
	builder.weekday = weekday
	builder.weekdayFlag = true
	return builder
}

// 一次话题的唯一标识
//
// 示例值：123456
func (builder *SystemInfoBuilder) SessionId(sessionId string) *SystemInfoBuilder {
	builder.sessionId = sessionId
	builder.sessionIdFlag = true
	return builder
}

// 用户赋予飞飞的名字
//
// 示例值：Bob
func (builder *SystemInfoBuilder) ShadowName(shadowName string) *SystemInfoBuilder {
	builder.shadowName = shadowName
	builder.shadowNameFlag = true
	return builder
}

// 消息 ID
//
// 示例值：om_0c1e199622cec22ffcc490392b12cdac
func (builder *SystemInfoBuilder) MsgId(msgId string) *SystemInfoBuilder {
	builder.msgId = msgId
	builder.msgIdFlag = true
	return builder
}

// 场景 ID
//
// 示例值：7302361858671902739
func (builder *SystemInfoBuilder) AgentId(agentId string) *SystemInfoBuilder {
	builder.agentId = agentId
	builder.agentIdFlag = true
	return builder
}

// locale
//
// 示例值：zh_cn
func (builder *SystemInfoBuilder) Locale(locale string) *SystemInfoBuilder {
	builder.locale = locale
	builder.localeFlag = true
	return builder
}

// app_version 客户端版本
//
// 示例值：7.20.0
func (builder *SystemInfoBuilder) AppVersion(appVersion string) *SystemInfoBuilder {
	builder.appVersion = appVersion
	builder.appVersionFlag = true
	return builder
}

func (builder *SystemInfoBuilder) Build() *SystemInfo {
	req := &SystemInfo{}
	if builder.timeFlag {
		req.Time = &builder.time

	}
	if builder.timeZoneFlag {
		req.TimeZone = &builder.timeZone

	}
	if builder.langFlag {
		req.Lang = &builder.lang

	}
	if builder.brandFlag {
		req.Brand = &builder.brand

	}
	if builder.weekdayFlag {
		req.Weekday = &builder.weekday

	}
	if builder.sessionIdFlag {
		req.SessionId = &builder.sessionId

	}
	if builder.shadowNameFlag {
		req.ShadowName = &builder.shadowName

	}
	if builder.msgIdFlag {
		req.MsgId = &builder.msgId

	}
	if builder.agentIdFlag {
		req.AgentId = &builder.agentId

	}
	if builder.localeFlag {
		req.Locale = &builder.locale

	}
	if builder.appVersionFlag {
		req.AppVersion = &builder.appVersion

	}
	return req
}

type TemplateCardVariables struct {
}

type TemplateCardVariablesBuilder struct {
}

func NewTemplateCardVariablesBuilder() *TemplateCardVariablesBuilder {
	builder := &TemplateCardVariablesBuilder{}
	return builder
}

func (builder *TemplateCardVariablesBuilder) Build() *TemplateCardVariables {
	req := &TemplateCardVariables{}
	return req
}

type TimeRange struct {
	Start *int `json:"start,omitempty"` // 时间范围的起始时间戳

	End *int `json:"end,omitempty"` // 时间范围的截止时间戳
}

type TimeRangeBuilder struct {
	start     int // 时间范围的起始时间戳
	startFlag bool

	end     int // 时间范围的截止时间戳
	endFlag bool
}

func NewTimeRangeBuilder() *TimeRangeBuilder {
	builder := &TimeRangeBuilder{}
	return builder
}

// 时间范围的起始时间戳
//
// 示例值：1742348544
func (builder *TimeRangeBuilder) Start(start int) *TimeRangeBuilder {
	builder.start = start
	builder.startFlag = true
	return builder
}

// 时间范围的截止时间戳
//
// 示例值：1742348544
func (builder *TimeRangeBuilder) End(end int) *TimeRangeBuilder {
	builder.end = end
	builder.endFlag = true
	return builder
}

func (builder *TimeRangeBuilder) Build() *TimeRange {
	req := &TimeRange{}
	if builder.startFlag {
		req.Start = &builder.start

	}
	if builder.endFlag {
		req.End = &builder.end

	}
	return req
}

type UserInfo struct {
	UserLanguage *string `json:"user_language,omitempty"` // 用户使用语言类型

	Timezone *string `json:"timezone,omitempty"` // 用户时区

	UserId *string `json:"user_id,omitempty"` // 用户id

	UserOpenId *string `json:"user_open_id,omitempty"` // 用户open id

	TenantId *string `json:"tenant_id,omitempty"` // 租户id

	Locale *string `json:"locale,omitempty"` // 地区
}

type UserInfoBuilder struct {
	userLanguage     string // 用户使用语言类型
	userLanguageFlag bool

	timezone     string // 用户时区
	timezoneFlag bool

	userId     string // 用户id
	userIdFlag bool

	userOpenId     string // 用户open id
	userOpenIdFlag bool

	tenantId     string // 租户id
	tenantIdFlag bool

	locale     string // 地区
	localeFlag bool
}

func NewUserInfoBuilder() *UserInfoBuilder {
	builder := &UserInfoBuilder{}
	return builder
}

// 用户使用语言类型
//
// 示例值：English
func (builder *UserInfoBuilder) UserLanguage(userLanguage string) *UserInfoBuilder {
	builder.userLanguage = userLanguage
	builder.userLanguageFlag = true
	return builder
}

// 用户时区
//
// 示例值：zh
func (builder *UserInfoBuilder) Timezone(timezone string) *UserInfoBuilder {
	builder.timezone = timezone
	builder.timezoneFlag = true
	return builder
}

// 用户id
//
// 示例值：22
func (builder *UserInfoBuilder) UserId(userId string) *UserInfoBuilder {
	builder.userId = userId
	builder.userIdFlag = true
	return builder
}

// 用户open id
//
// 示例值：ou_abc
func (builder *UserInfoBuilder) UserOpenId(userOpenId string) *UserInfoBuilder {
	builder.userOpenId = userOpenId
	builder.userOpenIdFlag = true
	return builder
}

// 租户id
//
// 示例值：22
func (builder *UserInfoBuilder) TenantId(tenantId string) *UserInfoBuilder {
	builder.tenantId = tenantId
	builder.tenantIdFlag = true
	return builder
}

// 地区
//
// 示例值：zh-cn
func (builder *UserInfoBuilder) Locale(locale string) *UserInfoBuilder {
	builder.locale = locale
	builder.localeFlag = true
	return builder
}

func (builder *UserInfoBuilder) Build() *UserInfo {
	req := &UserInfo{}
	if builder.userLanguageFlag {
		req.UserLanguage = &builder.userLanguage

	}
	if builder.timezoneFlag {
		req.Timezone = &builder.timezone

	}
	if builder.userIdFlag {
		req.UserId = &builder.userId

	}
	if builder.userOpenIdFlag {
		req.UserOpenId = &builder.userOpenId

	}
	if builder.tenantIdFlag {
		req.TenantId = &builder.tenantId

	}
	if builder.localeFlag {
		req.Locale = &builder.locale

	}
	return req
}

type WebPassageParam struct {
	Searchable *bool `json:"searchable,omitempty"` // 是否要搜索网页

	Domains []string `json:"domains,omitempty"` // 搜索特定网页
}

type WebPassageParamBuilder struct {
	searchable     bool // 是否要搜索网页
	searchableFlag bool

	domains     []string // 搜索特定网页
	domainsFlag bool
}

func NewWebPassageParamBuilder() *WebPassageParamBuilder {
	builder := &WebPassageParamBuilder{}
	return builder
}

// 是否要搜索网页
//
// 示例值：false
func (builder *WebPassageParamBuilder) Searchable(searchable bool) *WebPassageParamBuilder {
	builder.searchable = searchable
	builder.searchableFlag = true
	return builder
}

// 搜索特定网页
//
// 示例值：
func (builder *WebPassageParamBuilder) Domains(domains []string) *WebPassageParamBuilder {
	builder.domains = domains
	builder.domainsFlag = true
	return builder
}

func (builder *WebPassageParamBuilder) Build() *WebPassageParam {
	req := &WebPassageParam{}
	if builder.searchableFlag {
		req.Searchable = &builder.searchable

	}
	if builder.domainsFlag {
		req.Domains = builder.domains
	}
	return req
}

type WikiFilter struct {
	CreatorIds []string `json:"creator_ids,omitempty"` // Wiki所有者OpenID

	DocTypes []string `json:"doc_types,omitempty"` // Wiki类型

	SpaceIds []string `json:"space_ids,omitempty"` // 搜索某个Space下的Wiki（Space ID列表）

	OnlyTitle *bool `json:"only_title,omitempty"` // 仅搜Wiki标题

	OpenTime *TimeRange `json:"open_time,omitempty"` // 浏览文档的时间范围（秒级时间戳，包含start和end字段）

	SortType *string `json:"sort_type,omitempty"` // 排序方式
}

type WikiFilterBuilder struct {
	creatorIds     []string // Wiki所有者OpenID
	creatorIdsFlag bool

	docTypes     []string // Wiki类型
	docTypesFlag bool

	spaceIds     []string // 搜索某个Space下的Wiki（Space ID列表）
	spaceIdsFlag bool

	onlyTitle     bool // 仅搜Wiki标题
	onlyTitleFlag bool

	openTime     *TimeRange // 浏览文档的时间范围（秒级时间戳，包含start和end字段）
	openTimeFlag bool

	sortType     string // 排序方式
	sortTypeFlag bool
}

func NewWikiFilterBuilder() *WikiFilterBuilder {
	builder := &WikiFilterBuilder{}
	return builder
}

// Wiki所有者OpenID
//
// 示例值：
func (builder *WikiFilterBuilder) CreatorIds(creatorIds []string) *WikiFilterBuilder {
	builder.creatorIds = creatorIds
	builder.creatorIdsFlag = true
	return builder
}

// Wiki类型
//
// 示例值：
func (builder *WikiFilterBuilder) DocTypes(docTypes []string) *WikiFilterBuilder {
	builder.docTypes = docTypes
	builder.docTypesFlag = true
	return builder
}

// 搜索某个Space下的Wiki（Space ID列表）
//
// 示例值：
func (builder *WikiFilterBuilder) SpaceIds(spaceIds []string) *WikiFilterBuilder {
	builder.spaceIds = spaceIds
	builder.spaceIdsFlag = true
	return builder
}

// 仅搜Wiki标题
//
// 示例值：false
func (builder *WikiFilterBuilder) OnlyTitle(onlyTitle bool) *WikiFilterBuilder {
	builder.onlyTitle = onlyTitle
	builder.onlyTitleFlag = true
	return builder
}

// 浏览文档的时间范围（秒级时间戳，包含start和end字段）
//
// 示例值：
func (builder *WikiFilterBuilder) OpenTime(openTime *TimeRange) *WikiFilterBuilder {
	builder.openTime = openTime
	builder.openTimeFlag = true
	return builder
}

// 排序方式
//
// 示例值：CREATE_TIME_ASC
func (builder *WikiFilterBuilder) SortType(sortType string) *WikiFilterBuilder {
	builder.sortType = sortType
	builder.sortTypeFlag = true
	return builder
}

func (builder *WikiFilterBuilder) Build() *WikiFilter {
	req := &WikiFilter{}
	if builder.creatorIdsFlag {
		req.CreatorIds = builder.creatorIds
	}
	if builder.docTypesFlag {
		req.DocTypes = builder.docTypes
	}
	if builder.spaceIdsFlag {
		req.SpaceIds = builder.spaceIds
	}
	if builder.onlyTitleFlag {
		req.OnlyTitle = &builder.onlyTitle

	}
	if builder.openTimeFlag {
		req.OpenTime = builder.openTime
	}
	if builder.sortTypeFlag {
		req.SortType = &builder.sortType

	}
	return req
}

type WikiPassageParam struct {
	Searchable *bool `json:"searchable,omitempty"` // 是否要搜索wiki

	SpaceIds []string `json:"space_ids,omitempty"` // 搜索特定空间的wiki

	ObjIds []string `json:"obj_ids,omitempty"` // 在特定的wiki内搜索（仅限内部使用，有需求请用wiki_tokens）

	WikiTokens []string `json:"wiki_tokens,omitempty"` // 在特定的wiki内搜索

	NodeTokens []string `json:"node_tokens,omitempty"` // 在特定的wiki节点范围内搜索

	ExcludedSpaceIds []string `json:"excluded_space_ids,omitempty"` // 排除space空间id

	ExcludedObjIds []string `json:"excluded_obj_ids,omitempty"` // 排除文档id

	ExcludedWikiTokens []string `json:"excluded_wiki_tokens,omitempty"` // 排除wiki的token

	ExcludedNodeTokens []string `json:"excluded_node_tokens,omitempty"` // 排除wiki的node token

	EnableCrossTenant *bool `json:"enable_cross_tenant,omitempty"` // 是否跨租户

	OnlySearchPublic *bool `json:"only_search_public,omitempty"` // 是否只搜公开
}

type WikiPassageParamBuilder struct {
	searchable     bool // 是否要搜索wiki
	searchableFlag bool

	spaceIds     []string // 搜索特定空间的wiki
	spaceIdsFlag bool

	objIds     []string // 在特定的wiki内搜索（仅限内部使用，有需求请用wiki_tokens）
	objIdsFlag bool

	wikiTokens     []string // 在特定的wiki内搜索
	wikiTokensFlag bool

	nodeTokens     []string // 在特定的wiki节点范围内搜索
	nodeTokensFlag bool

	excludedSpaceIds     []string // 排除space空间id
	excludedSpaceIdsFlag bool

	excludedObjIds     []string // 排除文档id
	excludedObjIdsFlag bool

	excludedWikiTokens     []string // 排除wiki的token
	excludedWikiTokensFlag bool

	excludedNodeTokens     []string // 排除wiki的node token
	excludedNodeTokensFlag bool

	enableCrossTenant     bool // 是否跨租户
	enableCrossTenantFlag bool

	onlySearchPublic     bool // 是否只搜公开
	onlySearchPublicFlag bool
}

func NewWikiPassageParamBuilder() *WikiPassageParamBuilder {
	builder := &WikiPassageParamBuilder{}
	return builder
}

// 是否要搜索wiki
//
// 示例值：false
func (builder *WikiPassageParamBuilder) Searchable(searchable bool) *WikiPassageParamBuilder {
	builder.searchable = searchable
	builder.searchableFlag = true
	return builder
}

// 搜索特定空间的wiki
//
// 示例值：
func (builder *WikiPassageParamBuilder) SpaceIds(spaceIds []string) *WikiPassageParamBuilder {
	builder.spaceIds = spaceIds
	builder.spaceIdsFlag = true
	return builder
}

// 在特定的wiki内搜索（仅限内部使用，有需求请用wiki_tokens）
//
// 示例值：
func (builder *WikiPassageParamBuilder) ObjIds(objIds []string) *WikiPassageParamBuilder {
	builder.objIds = objIds
	builder.objIdsFlag = true
	return builder
}

// 在特定的wiki内搜索
//
// 示例值：
func (builder *WikiPassageParamBuilder) WikiTokens(wikiTokens []string) *WikiPassageParamBuilder {
	builder.wikiTokens = wikiTokens
	builder.wikiTokensFlag = true
	return builder
}

// 在特定的wiki节点范围内搜索
//
// 示例值：
func (builder *WikiPassageParamBuilder) NodeTokens(nodeTokens []string) *WikiPassageParamBuilder {
	builder.nodeTokens = nodeTokens
	builder.nodeTokensFlag = true
	return builder
}

// 排除space空间id
//
// 示例值：false
func (builder *WikiPassageParamBuilder) ExcludedSpaceIds(excludedSpaceIds []string) *WikiPassageParamBuilder {
	builder.excludedSpaceIds = excludedSpaceIds
	builder.excludedSpaceIdsFlag = true
	return builder
}

// 排除文档id
//
// 示例值：true
func (builder *WikiPassageParamBuilder) ExcludedObjIds(excludedObjIds []string) *WikiPassageParamBuilder {
	builder.excludedObjIds = excludedObjIds
	builder.excludedObjIdsFlag = true
	return builder
}

// 排除wiki的token
//
// 示例值：true
func (builder *WikiPassageParamBuilder) ExcludedWikiTokens(excludedWikiTokens []string) *WikiPassageParamBuilder {
	builder.excludedWikiTokens = excludedWikiTokens
	builder.excludedWikiTokensFlag = true
	return builder
}

// 排除wiki的node token
//
// 示例值：
func (builder *WikiPassageParamBuilder) ExcludedNodeTokens(excludedNodeTokens []string) *WikiPassageParamBuilder {
	builder.excludedNodeTokens = excludedNodeTokens
	builder.excludedNodeTokensFlag = true
	return builder
}

// 是否跨租户
//
// 示例值：false
func (builder *WikiPassageParamBuilder) EnableCrossTenant(enableCrossTenant bool) *WikiPassageParamBuilder {
	builder.enableCrossTenant = enableCrossTenant
	builder.enableCrossTenantFlag = true
	return builder
}

// 是否只搜公开
//
// 示例值：false
func (builder *WikiPassageParamBuilder) OnlySearchPublic(onlySearchPublic bool) *WikiPassageParamBuilder {
	builder.onlySearchPublic = onlySearchPublic
	builder.onlySearchPublicFlag = true
	return builder
}

func (builder *WikiPassageParamBuilder) Build() *WikiPassageParam {
	req := &WikiPassageParam{}
	if builder.searchableFlag {
		req.Searchable = &builder.searchable

	}
	if builder.spaceIdsFlag {
		req.SpaceIds = builder.spaceIds
	}
	if builder.objIdsFlag {
		req.ObjIds = builder.objIds
	}
	if builder.wikiTokensFlag {
		req.WikiTokens = builder.wikiTokens
	}
	if builder.nodeTokensFlag {
		req.NodeTokens = builder.nodeTokens
	}
	if builder.excludedSpaceIdsFlag {
		req.ExcludedSpaceIds = builder.excludedSpaceIds
	}
	if builder.excludedObjIdsFlag {
		req.ExcludedObjIds = builder.excludedObjIds
	}
	if builder.excludedWikiTokensFlag {
		req.ExcludedWikiTokens = builder.excludedWikiTokens
	}
	if builder.excludedNodeTokensFlag {
		req.ExcludedNodeTokens = builder.excludedNodeTokens
	}
	if builder.enableCrossTenantFlag {
		req.EnableCrossTenant = &builder.enableCrossTenant

	}
	if builder.onlySearchPublicFlag {
		req.OnlySearchPublic = &builder.onlySearchPublic

	}
	return req
}

type CreateAppReqBodyBuilder struct {
	query     string // 搜索关键词
	queryFlag bool
}

func NewCreateAppReqBodyBuilder() *CreateAppReqBodyBuilder {
	builder := &CreateAppReqBodyBuilder{}
	return builder
}

// 搜索关键词
//
//示例值：测试应用
func (builder *CreateAppReqBodyBuilder) Query(query string) *CreateAppReqBodyBuilder {
	builder.query = query
	builder.queryFlag = true
	return builder
}

func (builder *CreateAppReqBodyBuilder) Build() *CreateAppReqBody {
	req := &CreateAppReqBody{}
	if builder.queryFlag {
		req.Query = &builder.query
	}
	return req
}

type CreateAppPathReqBodyBuilder struct {
	query     string
	queryFlag bool
}

func NewCreateAppPathReqBodyBuilder() *CreateAppPathReqBodyBuilder {
	builder := &CreateAppPathReqBodyBuilder{}
	return builder
}

// 搜索关键词
//
// 示例值：测试应用
func (builder *CreateAppPathReqBodyBuilder) Query(query string) *CreateAppPathReqBodyBuilder {
	builder.query = query
	builder.queryFlag = true
	return builder
}

func (builder *CreateAppPathReqBodyBuilder) Build() (*CreateAppReqBody, error) {
	req := &CreateAppReqBody{}
	if builder.queryFlag {
		req.Query = &builder.query
	}
	return req, nil
}

type CreateAppReqBuilder struct {
	apiReq *larkcore.ApiReq
	body   *CreateAppReqBody
}

func NewCreateAppReqBuilder() *CreateAppReqBuilder {
	builder := &CreateAppReqBuilder{}
	builder.apiReq = &larkcore.ApiReq{
		PathParams:  larkcore.PathParams{},
		QueryParams: larkcore.QueryParams{},
	}
	return builder
}

// 此次调用中使用的用户ID的类型
//
// 示例值：
func (builder *CreateAppReqBuilder) UserIdType(userIdType string) *CreateAppReqBuilder {
	builder.apiReq.QueryParams.Set("user_id_type", fmt.Sprint(userIdType))
	return builder
}

// 分页大小
//
// 示例值：
func (builder *CreateAppReqBuilder) PageSize(pageSize int) *CreateAppReqBuilder {
	builder.apiReq.QueryParams.Set("page_size", fmt.Sprint(pageSize))
	return builder
}

// 分页token
//
// 示例值：
func (builder *CreateAppReqBuilder) PageToken(pageToken string) *CreateAppReqBuilder {
	builder.apiReq.QueryParams.Set("page_token", fmt.Sprint(pageToken))
	return builder
}

//
func (builder *CreateAppReqBuilder) Body(body *CreateAppReqBody) *CreateAppReqBuilder {
	builder.body = body
	return builder
}

func (builder *CreateAppReqBuilder) Build() *CreateAppReq {
	req := &CreateAppReq{}
	req.apiReq = &larkcore.ApiReq{}
	req.apiReq.QueryParams = builder.apiReq.QueryParams
	req.apiReq.Body = builder.body
	return req
}

type CreateAppReqBody struct {
	Query *string `json:"query,omitempty"` // 搜索关键词
}

type CreateAppReq struct {
	apiReq *larkcore.ApiReq
	Body   *CreateAppReqBody `body:""`
}

type CreateAppRespData struct {
	Items []string `json:"items,omitempty"` // app_id列表

	PageToken *string `json:"page_token,omitempty"` // 翻页 token，传入返回下一页，首页不需要传入

	HasMore *bool `json:"has_more,omitempty"` // 是否还有下一页
}

type CreateAppResp struct {
	*larkcore.ApiResp `json:"-"`
	larkcore.CodeError
	Data *CreateAppRespData `json:"data"` // 业务数据
}

func (resp *CreateAppResp) Success() bool {
	return resp.Code == 0
}

type CreateDataSourceReqBuilder struct {
	apiReq     *larkcore.ApiReq
	dataSource *DataSource
}

func NewCreateDataSourceReqBuilder() *CreateDataSourceReqBuilder {
	builder := &CreateDataSourceReqBuilder{}
	builder.apiReq = &larkcore.ApiReq{
		PathParams:  larkcore.PathParams{},
		QueryParams: larkcore.QueryParams{},
	}
	return builder
}

// 创建一个数据源
func (builder *CreateDataSourceReqBuilder) DataSource(dataSource *DataSource) *CreateDataSourceReqBuilder {
	builder.dataSource = dataSource
	return builder
}

func (builder *CreateDataSourceReqBuilder) Build() *CreateDataSourceReq {
	req := &CreateDataSourceReq{}
	req.apiReq = &larkcore.ApiReq{}
	req.apiReq.Body = builder.dataSource
	return req
}

type CreateDataSourceReq struct {
	apiReq     *larkcore.ApiReq
	DataSource *DataSource `body:""`
}

type CreateDataSourceRespData struct {
	DataSource *DataSource `json:"data_source,omitempty"` // 数据源实例
}

type CreateDataSourceResp struct {
	*larkcore.ApiResp `json:"-"`
	larkcore.CodeError
	Data *CreateDataSourceRespData `json:"data"` // 业务数据
}

func (resp *CreateDataSourceResp) Success() bool {
	return resp.Code == 0
}

type DeleteDataSourceReqBuilder struct {
	apiReq *larkcore.ApiReq
}

func NewDeleteDataSourceReqBuilder() *DeleteDataSourceReqBuilder {
	builder := &DeleteDataSourceReqBuilder{}
	builder.apiReq = &larkcore.ApiReq{
		PathParams:  larkcore.PathParams{},
		QueryParams: larkcore.QueryParams{},
	}
	return builder
}

// 数据源的唯一标识
//
// 示例值：6953903108179099667
func (builder *DeleteDataSourceReqBuilder) DataSourceId(dataSourceId string) *DeleteDataSourceReqBuilder {
	builder.apiReq.PathParams.Set("data_source_id", fmt.Sprint(dataSourceId))
	return builder
}

func (builder *DeleteDataSourceReqBuilder) Build() *DeleteDataSourceReq {
	req := &DeleteDataSourceReq{}
	req.apiReq = &larkcore.ApiReq{}
	req.apiReq.PathParams = builder.apiReq.PathParams
	return req
}

type DeleteDataSourceReq struct {
	apiReq *larkcore.ApiReq
}

type DeleteDataSourceResp struct {
	*larkcore.ApiResp `json:"-"`
	larkcore.CodeError
}

func (resp *DeleteDataSourceResp) Success() bool {
	return resp.Code == 0
}

type GetDataSourceReqBuilder struct {
	apiReq *larkcore.ApiReq
}

func NewGetDataSourceReqBuilder() *GetDataSourceReqBuilder {
	builder := &GetDataSourceReqBuilder{}
	builder.apiReq = &larkcore.ApiReq{
		PathParams:  larkcore.PathParams{},
		QueryParams: larkcore.QueryParams{},
	}
	return builder
}

// 数据源的唯一标识
//
// 示例值：service_ticket
func (builder *GetDataSourceReqBuilder) DataSourceId(dataSourceId string) *GetDataSourceReqBuilder {
	builder.apiReq.PathParams.Set("data_source_id", fmt.Sprint(dataSourceId))
	return builder
}

func (builder *GetDataSourceReqBuilder) Build() *GetDataSourceReq {
	req := &GetDataSourceReq{}
	req.apiReq = &larkcore.ApiReq{}
	req.apiReq.PathParams = builder.apiReq.PathParams
	return req
}

type GetDataSourceReq struct {
	apiReq *larkcore.ApiReq
}

type GetDataSourceRespData struct {
	DataSource *DataSource `json:"data_source,omitempty"` // 数据源实例
}

type GetDataSourceResp struct {
	*larkcore.ApiResp `json:"-"`
	larkcore.CodeError
	Data *GetDataSourceRespData `json:"data"` // 业务数据
}

func (resp *GetDataSourceResp) Success() bool {
	return resp.Code == 0
}

type ListDataSourceReqBuilder struct {
	apiReq *larkcore.ApiReq
	limit  int // 最大返回多少记录，当使用迭代器访问时才有效
}

func NewListDataSourceReqBuilder() *ListDataSourceReqBuilder {
	builder := &ListDataSourceReqBuilder{}
	builder.apiReq = &larkcore.ApiReq{
		PathParams:  larkcore.PathParams{},
		QueryParams: larkcore.QueryParams{},
	}
	return builder
}

// 最大返回多少记录，当使用迭代器访问时才有效
func (builder *ListDataSourceReqBuilder) Limit(limit int) *ListDataSourceReqBuilder {
	builder.limit = limit
	return builder
}

// 回包数据格式，0-全量数据；1-摘要数据。;;**注**：摘要数据仅包含"id"，"name"，"state"。
//
// 示例值：0
func (builder *ListDataSourceReqBuilder) View(view int) *ListDataSourceReqBuilder {
	builder.apiReq.QueryParams.Set("view", fmt.Sprint(view))
	return builder
}

// 分页大小
//
// 示例值：10
func (builder *ListDataSourceReqBuilder) PageSize(pageSize int) *ListDataSourceReqBuilder {
	builder.apiReq.QueryParams.Set("page_size", fmt.Sprint(pageSize))
	return builder
}

// 分页标记，第一次请求不填，表示从头开始遍历；分页查询结果还有更多项时会同时返回新的 page_token，下次遍历可采用该 page_token 获取查询结果
//
// 示例值：PxZFma9OIRhdBlT/dOYNiu2Ro8F2WAhcby7OhOijfljZ
func (builder *ListDataSourceReqBuilder) PageToken(pageToken string) *ListDataSourceReqBuilder {
	builder.apiReq.QueryParams.Set("page_token", fmt.Sprint(pageToken))
	return builder
}

func (builder *ListDataSourceReqBuilder) Build() *ListDataSourceReq {
	req := &ListDataSourceReq{}
	req.apiReq = &larkcore.ApiReq{}
	req.Limit = builder.limit
	req.apiReq.QueryParams = builder.apiReq.QueryParams
	return req
}

type ListDataSourceReq struct {
	apiReq *larkcore.ApiReq
	Limit  int // 最多返回多少记录，只有在使用迭代器访问时，才有效

}

type ListDataSourceRespData struct {
	HasMore *bool `json:"has_more,omitempty"` // 是否有更多数据

	PageToken *string `json:"page_token,omitempty"` // 取数据的凭证

	Items []*DataSource `json:"items,omitempty"` // 数据源中的数据记录
}

type ListDataSourceResp struct {
	*larkcore.ApiResp `json:"-"`
	larkcore.CodeError
	Data *ListDataSourceRespData `json:"data"` // 业务数据
}

func (resp *ListDataSourceResp) Success() bool {
	return resp.Code == 0
}

type PatchDataSourceReqBodyBuilder struct {
	name     string // 数据源的展示名称
	nameFlag bool

	state     int // 数据源状态，0-已上线，1-未上线
	stateFlag bool

	description     string // 对于数据源的描述
	descriptionFlag bool

	iconUrl     string // 数据源在 search tab 上的展示图标路径
	iconUrlFlag bool

	i18nName     *I18nMeta // 数据源名称多语言配置，json格式，key为语言locale，value为对应文案，例如{"zh_cn":"测试数据源", "en_us":"Test DataSource"}
	i18nNameFlag bool

	i18nDescription     *I18nMeta // 数据源描述多语言配置，json格式，key为语言locale，value为对应文案，例如{"zh_cn":"搜索测试数据源相关数据", "en_us":"Search data from Test DataSource"}
	i18nDescriptionFlag bool

	connectorParam     *ConnectorParam // 修改connector的相关配置
	connectorParamFlag bool

	enableAnswer     bool // 是否使用问答服务
	enableAnswerFlag bool
}

func NewPatchDataSourceReqBodyBuilder() *PatchDataSourceReqBodyBuilder {
	builder := &PatchDataSourceReqBodyBuilder{}
	return builder
}

// 数据源的展示名称
//
//示例值：客服工单
func (builder *PatchDataSourceReqBodyBuilder) Name(name string) *PatchDataSourceReqBodyBuilder {
	builder.name = name
	builder.nameFlag = true
	return builder
}

// 数据源状态，0-已上线，1-未上线
//
//示例值：0
func (builder *PatchDataSourceReqBodyBuilder) State(state int) *PatchDataSourceReqBodyBuilder {
	builder.state = state
	builder.stateFlag = true
	return builder
}

// 对于数据源的描述
//
//示例值：搜索客服工单
func (builder *PatchDataSourceReqBodyBuilder) Description(description string) *PatchDataSourceReqBodyBuilder {
	builder.description = description
	builder.descriptionFlag = true
	return builder
}

// 数据源在 search tab 上的展示图标路径
//
//示例值：https://www.xxx.com/open.jpg
func (builder *PatchDataSourceReqBodyBuilder) IconUrl(iconUrl string) *PatchDataSourceReqBodyBuilder {
	builder.iconUrl = iconUrl
	builder.iconUrlFlag = true
	return builder
}

// 数据源名称多语言配置，json格式，key为语言locale，value为对应文案，例如{"zh_cn":"测试数据源", "en_us":"Test DataSource"}
//
//示例值：
func (builder *PatchDataSourceReqBodyBuilder) I18nName(i18nName *I18nMeta) *PatchDataSourceReqBodyBuilder {
	builder.i18nName = i18nName
	builder.i18nNameFlag = true
	return builder
}

// 数据源描述多语言配置，json格式，key为语言locale，value为对应文案，例如{"zh_cn":"搜索测试数据源相关数据", "en_us":"Search data from Test DataSource"}
//
//示例值：
func (builder *PatchDataSourceReqBodyBuilder) I18nDescription(i18nDescription *I18nMeta) *PatchDataSourceReqBodyBuilder {
	builder.i18nDescription = i18nDescription
	builder.i18nDescriptionFlag = true
	return builder
}

// 修改connector的相关配置
//
//示例值：
func (builder *PatchDataSourceReqBodyBuilder) ConnectorParam(connectorParam *ConnectorParam) *PatchDataSourceReqBodyBuilder {
	builder.connectorParam = connectorParam
	builder.connectorParamFlag = true
	return builder
}

// 是否使用问答服务
//
//示例值：false
func (builder *PatchDataSourceReqBodyBuilder) EnableAnswer(enableAnswer bool) *PatchDataSourceReqBodyBuilder {
	builder.enableAnswer = enableAnswer
	builder.enableAnswerFlag = true
	return builder
}

func (builder *PatchDataSourceReqBodyBuilder) Build() *PatchDataSourceReqBody {
	req := &PatchDataSourceReqBody{}
	if builder.nameFlag {
		req.Name = &builder.name
	}
	if builder.stateFlag {
		req.State = &builder.state
	}
	if builder.descriptionFlag {
		req.Description = &builder.description
	}
	if builder.iconUrlFlag {
		req.IconUrl = &builder.iconUrl
	}
	if builder.i18nNameFlag {
		req.I18nName = builder.i18nName
	}
	if builder.i18nDescriptionFlag {
		req.I18nDescription = builder.i18nDescription
	}
	if builder.connectorParamFlag {
		req.ConnectorParam = builder.connectorParam
	}
	if builder.enableAnswerFlag {
		req.EnableAnswer = &builder.enableAnswer
	}
	return req
}

type PatchDataSourcePathReqBodyBuilder struct {
	name                string
	nameFlag            bool
	state               int
	stateFlag           bool
	description         string
	descriptionFlag     bool
	iconUrl             string
	iconUrlFlag         bool
	i18nName            *I18nMeta
	i18nNameFlag        bool
	i18nDescription     *I18nMeta
	i18nDescriptionFlag bool
	connectorParam      *ConnectorParam
	connectorParamFlag  bool
	enableAnswer        bool
	enableAnswerFlag    bool
}

func NewPatchDataSourcePathReqBodyBuilder() *PatchDataSourcePathReqBodyBuilder {
	builder := &PatchDataSourcePathReqBodyBuilder{}
	return builder
}

// 数据源的展示名称
//
// 示例值：客服工单
func (builder *PatchDataSourcePathReqBodyBuilder) Name(name string) *PatchDataSourcePathReqBodyBuilder {
	builder.name = name
	builder.nameFlag = true
	return builder
}

// 数据源状态，0-已上线，1-未上线
//
// 示例值：0
func (builder *PatchDataSourcePathReqBodyBuilder) State(state int) *PatchDataSourcePathReqBodyBuilder {
	builder.state = state
	builder.stateFlag = true
	return builder
}

// 对于数据源的描述
//
// 示例值：搜索客服工单
func (builder *PatchDataSourcePathReqBodyBuilder) Description(description string) *PatchDataSourcePathReqBodyBuilder {
	builder.description = description
	builder.descriptionFlag = true
	return builder
}

// 数据源在 search tab 上的展示图标路径
//
// 示例值：https://www.xxx.com/open.jpg
func (builder *PatchDataSourcePathReqBodyBuilder) IconUrl(iconUrl string) *PatchDataSourcePathReqBodyBuilder {
	builder.iconUrl = iconUrl
	builder.iconUrlFlag = true
	return builder
}

// 数据源名称多语言配置，json格式，key为语言locale，value为对应文案，例如{"zh_cn":"测试数据源", "en_us":"Test DataSource"}
//
// 示例值：
func (builder *PatchDataSourcePathReqBodyBuilder) I18nName(i18nName *I18nMeta) *PatchDataSourcePathReqBodyBuilder {
	builder.i18nName = i18nName
	builder.i18nNameFlag = true
	return builder
}

// 数据源描述多语言配置，json格式，key为语言locale，value为对应文案，例如{"zh_cn":"搜索测试数据源相关数据", "en_us":"Search data from Test DataSource"}
//
// 示例值：
func (builder *PatchDataSourcePathReqBodyBuilder) I18nDescription(i18nDescription *I18nMeta) *PatchDataSourcePathReqBodyBuilder {
	builder.i18nDescription = i18nDescription
	builder.i18nDescriptionFlag = true
	return builder
}

// 修改connector的相关配置
//
// 示例值：
func (builder *PatchDataSourcePathReqBodyBuilder) ConnectorParam(connectorParam *ConnectorParam) *PatchDataSourcePathReqBodyBuilder {
	builder.connectorParam = connectorParam
	builder.connectorParamFlag = true
	return builder
}

// 是否使用问答服务
//
// 示例值：false
func (builder *PatchDataSourcePathReqBodyBuilder) EnableAnswer(enableAnswer bool) *PatchDataSourcePathReqBodyBuilder {
	builder.enableAnswer = enableAnswer
	builder.enableAnswerFlag = true
	return builder
}

func (builder *PatchDataSourcePathReqBodyBuilder) Build() (*PatchDataSourceReqBody, error) {
	req := &PatchDataSourceReqBody{}
	if builder.nameFlag {
		req.Name = &builder.name
	}
	if builder.stateFlag {
		req.State = &builder.state
	}
	if builder.descriptionFlag {
		req.Description = &builder.description
	}
	if builder.iconUrlFlag {
		req.IconUrl = &builder.iconUrl
	}
	if builder.i18nNameFlag {
		req.I18nName = builder.i18nName
	}
	if builder.i18nDescriptionFlag {
		req.I18nDescription = builder.i18nDescription
	}
	if builder.connectorParamFlag {
		req.ConnectorParam = builder.connectorParam
	}
	if builder.enableAnswerFlag {
		req.EnableAnswer = &builder.enableAnswer
	}
	return req, nil
}

type PatchDataSourceReqBuilder struct {
	apiReq *larkcore.ApiReq
	body   *PatchDataSourceReqBody
}

func NewPatchDataSourceReqBuilder() *PatchDataSourceReqBuilder {
	builder := &PatchDataSourceReqBuilder{}
	builder.apiReq = &larkcore.ApiReq{
		PathParams:  larkcore.PathParams{},
		QueryParams: larkcore.QueryParams{},
	}
	return builder
}

// 数据源的唯一标识
//
// 示例值：service_ticket
func (builder *PatchDataSourceReqBuilder) DataSourceId(dataSourceId string) *PatchDataSourceReqBuilder {
	builder.apiReq.PathParams.Set("data_source_id", fmt.Sprint(dataSourceId))
	return builder
}

// 更新一个已经存在的数据源
func (builder *PatchDataSourceReqBuilder) Body(body *PatchDataSourceReqBody) *PatchDataSourceReqBuilder {
	builder.body = body
	return builder
}

func (builder *PatchDataSourceReqBuilder) Build() *PatchDataSourceReq {
	req := &PatchDataSourceReq{}
	req.apiReq = &larkcore.ApiReq{}
	req.apiReq.PathParams = builder.apiReq.PathParams
	req.apiReq.Body = builder.body
	return req
}

type PatchDataSourceReqBody struct {
	Name *string `json:"name,omitempty"` // 数据源的展示名称

	State *int `json:"state,omitempty"` // 数据源状态，0-已上线，1-未上线

	Description *string `json:"description,omitempty"` // 对于数据源的描述

	IconUrl *string `json:"icon_url,omitempty"` // 数据源在 search tab 上的展示图标路径

	I18nName *I18nMeta `json:"i18n_name,omitempty"` // 数据源名称多语言配置，json格式，key为语言locale，value为对应文案，例如{"zh_cn":"测试数据源", "en_us":"Test DataSource"}

	I18nDescription *I18nMeta `json:"i18n_description,omitempty"` // 数据源描述多语言配置，json格式，key为语言locale，value为对应文案，例如{"zh_cn":"搜索测试数据源相关数据", "en_us":"Search data from Test DataSource"}

	ConnectorParam *ConnectorParam `json:"connector_param,omitempty"` // 修改connector的相关配置

	EnableAnswer *bool `json:"enable_answer,omitempty"` // 是否使用问答服务
}

type PatchDataSourceReq struct {
	apiReq *larkcore.ApiReq
	Body   *PatchDataSourceReqBody `body:""`
}

type PatchDataSourceRespData struct {
	DataSource *DataSource `json:"data_source,omitempty"` // 数据源
}

type PatchDataSourceResp struct {
	*larkcore.ApiResp `json:"-"`
	larkcore.CodeError
	Data *PatchDataSourceRespData `json:"data"` // 业务数据
}

func (resp *PatchDataSourceResp) Success() bool {
	return resp.Code == 0
}

type CreateDataSourceItemReqBuilder struct {
	apiReq *larkcore.ApiReq
	item   *Item
}

func NewCreateDataSourceItemReqBuilder() *CreateDataSourceItemReqBuilder {
	builder := &CreateDataSourceItemReqBuilder{}
	builder.apiReq = &larkcore.ApiReq{
		PathParams:  larkcore.PathParams{},
		QueryParams: larkcore.QueryParams{},
	}
	return builder
}

// 数据源的ID
//
// 示例值：service_ticket
func (builder *CreateDataSourceItemReqBuilder) DataSourceId(dataSourceId string) *CreateDataSourceItemReqBuilder {
	builder.apiReq.PathParams.Set("data_source_id", fmt.Sprint(dataSourceId))
	return builder
}

// 索引一条数据记录
func (builder *CreateDataSourceItemReqBuilder) Item(item *Item) *CreateDataSourceItemReqBuilder {
	builder.item = item
	return builder
}

func (builder *CreateDataSourceItemReqBuilder) Build() *CreateDataSourceItemReq {
	req := &CreateDataSourceItemReq{}
	req.apiReq = &larkcore.ApiReq{}
	req.apiReq.PathParams = builder.apiReq.PathParams
	req.apiReq.Body = builder.item
	return req
}

type CreateDataSourceItemReq struct {
	apiReq *larkcore.ApiReq
	Item   *Item `body:""`
}

type CreateDataSourceItemResp struct {
	*larkcore.ApiResp `json:"-"`
	larkcore.CodeError
}

func (resp *CreateDataSourceItemResp) Success() bool {
	return resp.Code == 0
}

type DeleteDataSourceItemReqBuilder struct {
	apiReq *larkcore.ApiReq
}

func NewDeleteDataSourceItemReqBuilder() *DeleteDataSourceItemReqBuilder {
	builder := &DeleteDataSourceItemReqBuilder{}
	builder.apiReq = &larkcore.ApiReq{
		PathParams:  larkcore.PathParams{},
		QueryParams: larkcore.QueryParams{},
	}
	return builder
}

// 数据源的ID
//
// 示例值：service_ticket
func (builder *DeleteDataSourceItemReqBuilder) DataSourceId(dataSourceId string) *DeleteDataSourceItemReqBuilder {
	builder.apiReq.PathParams.Set("data_source_id", fmt.Sprint(dataSourceId))
	return builder
}

// 数据记录的ID
//
// 示例值：01010111
func (builder *DeleteDataSourceItemReqBuilder) ItemId(itemId string) *DeleteDataSourceItemReqBuilder {
	builder.apiReq.PathParams.Set("item_id", fmt.Sprint(itemId))
	return builder
}

func (builder *DeleteDataSourceItemReqBuilder) Build() *DeleteDataSourceItemReq {
	req := &DeleteDataSourceItemReq{}
	req.apiReq = &larkcore.ApiReq{}
	req.apiReq.PathParams = builder.apiReq.PathParams
	return req
}

type DeleteDataSourceItemReq struct {
	apiReq *larkcore.ApiReq
}

type DeleteDataSourceItemResp struct {
	*larkcore.ApiResp `json:"-"`
	larkcore.CodeError
}

func (resp *DeleteDataSourceItemResp) Success() bool {
	return resp.Code == 0
}

type GetDataSourceItemReqBuilder struct {
	apiReq *larkcore.ApiReq
}

func NewGetDataSourceItemReqBuilder() *GetDataSourceItemReqBuilder {
	builder := &GetDataSourceItemReqBuilder{}
	builder.apiReq = &larkcore.ApiReq{
		PathParams:  larkcore.PathParams{},
		QueryParams: larkcore.QueryParams{},
	}
	return builder
}

// 数据源的id
//
// 示例值：service_ticket
func (builder *GetDataSourceItemReqBuilder) DataSourceId(dataSourceId string) *GetDataSourceItemReqBuilder {
	builder.apiReq.PathParams.Set("data_source_id", fmt.Sprint(dataSourceId))
	return builder
}

// 数据记录的唯一标识
//
// 示例值：01010111
func (builder *GetDataSourceItemReqBuilder) ItemId(itemId string) *GetDataSourceItemReqBuilder {
	builder.apiReq.PathParams.Set("item_id", fmt.Sprint(itemId))
	return builder
}

func (builder *GetDataSourceItemReqBuilder) Build() *GetDataSourceItemReq {
	req := &GetDataSourceItemReq{}
	req.apiReq = &larkcore.ApiReq{}
	req.apiReq.PathParams = builder.apiReq.PathParams
	return req
}

type GetDataSourceItemReq struct {
	apiReq *larkcore.ApiReq
}

type GetDataSourceItemRespData struct {
	Item *Item `json:"item,omitempty"` // 数据项实例
}

type GetDataSourceItemResp struct {
	*larkcore.ApiResp `json:"-"`
	larkcore.CodeError
	Data *GetDataSourceItemRespData `json:"data"` // 业务数据
}

func (resp *GetDataSourceItemResp) Success() bool {
	return resp.Code == 0
}

type SearchDocWikiReqBodyBuilder struct {
	query     string // 搜索关键词
	queryFlag bool

	docFilter     *DocFilter // 文档过滤参数
	docFilterFlag bool

	wikiFilter     *WikiFilter // Wiki过滤参数
	wikiFilterFlag bool

	pageToken     string // 分页标记，第一次请求不填，表示从头开始遍历；分页查询结果还有更多项时会同时返回新的 page_token，下次遍历可采用该page_token获取查询结果
	pageTokenFlag bool

	pageSize     int // 分页大小
	pageSizeFlag bool
}

func NewSearchDocWikiReqBodyBuilder() *SearchDocWikiReqBodyBuilder {
	builder := &SearchDocWikiReqBodyBuilder{}
	return builder
}

// 搜索关键词
//
//示例值：飞书文档使用指南
func (builder *SearchDocWikiReqBodyBuilder) Query(query string) *SearchDocWikiReqBodyBuilder {
	builder.query = query
	builder.queryFlag = true
	return builder
}

// 文档过滤参数
//
//示例值：{"folder_tokens": ["fld_123456"]}
func (builder *SearchDocWikiReqBodyBuilder) DocFilter(docFilter *DocFilter) *SearchDocWikiReqBodyBuilder {
	builder.docFilter = docFilter
	builder.docFilterFlag = true
	return builder
}

// Wiki过滤参数
//
//示例值：{"creator_ids": ["ou_789012"], "space_ids": ["space_123456"]}
func (builder *SearchDocWikiReqBodyBuilder) WikiFilter(wikiFilter *WikiFilter) *SearchDocWikiReqBodyBuilder {
	builder.wikiFilter = wikiFilter
	builder.wikiFilterFlag = true
	return builder
}

// 分页标记，第一次请求不填，表示从头开始遍历；分页查询结果还有更多项时会同时返回新的 page_token，下次遍历可采用该page_token获取查询结果
//
//示例值：token_1234567890fedcba
func (builder *SearchDocWikiReqBodyBuilder) PageToken(pageToken string) *SearchDocWikiReqBodyBuilder {
	builder.pageToken = pageToken
	builder.pageTokenFlag = true
	return builder
}

// 分页大小
//
//示例值：15
func (builder *SearchDocWikiReqBodyBuilder) PageSize(pageSize int) *SearchDocWikiReqBodyBuilder {
	builder.pageSize = pageSize
	builder.pageSizeFlag = true
	return builder
}

func (builder *SearchDocWikiReqBodyBuilder) Build() *SearchDocWikiReqBody {
	req := &SearchDocWikiReqBody{}
	if builder.queryFlag {
		req.Query = &builder.query
	}
	if builder.docFilterFlag {
		req.DocFilter = builder.docFilter
	}
	if builder.wikiFilterFlag {
		req.WikiFilter = builder.wikiFilter
	}
	if builder.pageTokenFlag {
		req.PageToken = &builder.pageToken
	}
	if builder.pageSizeFlag {
		req.PageSize = &builder.pageSize
	}
	return req
}

type SearchDocWikiPathReqBodyBuilder struct {
	query          string
	queryFlag      bool
	docFilter      *DocFilter
	docFilterFlag  bool
	wikiFilter     *WikiFilter
	wikiFilterFlag bool
	pageToken      string
	pageTokenFlag  bool
	pageSize       int
	pageSizeFlag   bool
}

func NewSearchDocWikiPathReqBodyBuilder() *SearchDocWikiPathReqBodyBuilder {
	builder := &SearchDocWikiPathReqBodyBuilder{}
	return builder
}

// 搜索关键词
//
// 示例值：飞书文档使用指南
func (builder *SearchDocWikiPathReqBodyBuilder) Query(query string) *SearchDocWikiPathReqBodyBuilder {
	builder.query = query
	builder.queryFlag = true
	return builder
}

// 文档过滤参数
//
// 示例值：{"folder_tokens": ["fld_123456"]}
func (builder *SearchDocWikiPathReqBodyBuilder) DocFilter(docFilter *DocFilter) *SearchDocWikiPathReqBodyBuilder {
	builder.docFilter = docFilter
	builder.docFilterFlag = true
	return builder
}

// Wiki过滤参数
//
// 示例值：{"creator_ids": ["ou_789012"], "space_ids": ["space_123456"]}
func (builder *SearchDocWikiPathReqBodyBuilder) WikiFilter(wikiFilter *WikiFilter) *SearchDocWikiPathReqBodyBuilder {
	builder.wikiFilter = wikiFilter
	builder.wikiFilterFlag = true
	return builder
}

// 分页标记，第一次请求不填，表示从头开始遍历；分页查询结果还有更多项时会同时返回新的 page_token，下次遍历可采用该page_token获取查询结果
//
// 示例值：token_1234567890fedcba
func (builder *SearchDocWikiPathReqBodyBuilder) PageToken(pageToken string) *SearchDocWikiPathReqBodyBuilder {
	builder.pageToken = pageToken
	builder.pageTokenFlag = true
	return builder
}

// 分页大小
//
// 示例值：15
func (builder *SearchDocWikiPathReqBodyBuilder) PageSize(pageSize int) *SearchDocWikiPathReqBodyBuilder {
	builder.pageSize = pageSize
	builder.pageSizeFlag = true
	return builder
}

func (builder *SearchDocWikiPathReqBodyBuilder) Build() (*SearchDocWikiReqBody, error) {
	req := &SearchDocWikiReqBody{}
	if builder.queryFlag {
		req.Query = &builder.query
	}
	if builder.docFilterFlag {
		req.DocFilter = builder.docFilter
	}
	if builder.wikiFilterFlag {
		req.WikiFilter = builder.wikiFilter
	}
	if builder.pageTokenFlag {
		req.PageToken = &builder.pageToken
	}
	if builder.pageSizeFlag {
		req.PageSize = &builder.pageSize
	}
	return req, nil
}

type SearchDocWikiReqBuilder struct {
	apiReq *larkcore.ApiReq
	body   *SearchDocWikiReqBody
	limit  int // 最大返回多少记录，当使用迭代器访问时才有效
}

func NewSearchDocWikiReqBuilder() *SearchDocWikiReqBuilder {
	builder := &SearchDocWikiReqBuilder{}
	builder.apiReq = &larkcore.ApiReq{
		PathParams:  larkcore.PathParams{},
		QueryParams: larkcore.QueryParams{},
	}
	return builder
}

// 最大返回多少记录，当使用迭代器访问时才有效
func (builder *SearchDocWikiReqBuilder) Limit(limit int) *SearchDocWikiReqBuilder {
	builder.limit = limit
	return builder
}

// 搜索文档和Wiki
func (builder *SearchDocWikiReqBuilder) Body(body *SearchDocWikiReqBody) *SearchDocWikiReqBuilder {
	builder.body = body
	return builder
}

func (builder *SearchDocWikiReqBuilder) Build() *SearchDocWikiReq {
	req := &SearchDocWikiReq{}
	req.apiReq = &larkcore.ApiReq{}
	req.Limit = builder.limit
	req.apiReq.Body = builder.body
	return req
}

type SearchDocWikiReqBody struct {
	Query *string `json:"query,omitempty"` // 搜索关键词

	DocFilter *DocFilter `json:"doc_filter,omitempty"` // 文档过滤参数

	WikiFilter *WikiFilter `json:"wiki_filter,omitempty"` // Wiki过滤参数

	PageToken *string `json:"page_token,omitempty"` // 分页标记，第一次请求不填，表示从头开始遍历；分页查询结果还有更多项时会同时返回新的 page_token，下次遍历可采用该page_token获取查询结果

	PageSize *int `json:"page_size,omitempty"` // 分页大小
}

type SearchDocWikiReq struct {
	apiReq *larkcore.ApiReq
	Body   *SearchDocWikiReqBody `body:""`
	Limit  int                   // 最多返回多少记录，只有在使用迭代器访问时，才有效

}

type SearchDocWikiRespData struct {
	Total *int `json:"total,omitempty"` // 匹配结果总数（辅助分页参考）

	HasMore *bool `json:"has_more,omitempty"` // 是否有更多数据可供加载

	ResUnits []*DocResUnit `json:"res_units,omitempty"` // 搜索结果列表

	PageToken *string `json:"page_token,omitempty"` // 下一页分页标记，无更多结果时为空
}

type SearchDocWikiResp struct {
	*larkcore.ApiResp `json:"-"`
	larkcore.CodeError
	Data *SearchDocWikiRespData `json:"data"` // 业务数据
}

func (resp *SearchDocWikiResp) Success() bool {
	return resp.Code == 0
}

type CreateMessageReqBodyBuilder struct {
	query     string // 搜索关键词
	queryFlag bool

	fromIds     []string // 消息来自user_id列表
	fromIdsFlag bool

	chatIds     []string // 消息所在chat_id列表
	chatIdsFlag bool

	messageType     string // 消息类型(file/image/media)
	messageTypeFlag bool

	atChatterIds     []string // at用户user_id列表
	atChatterIdsFlag bool

	fromType     string // 消息来自类型(bot/user)
	fromTypeFlag bool

	chatType     string // 会话类型(group_chat/p2p_chat)
	chatTypeFlag bool

	startTime     string // 消息发送起始时间
	startTimeFlag bool

	endTime     string // 消息发送结束时间
	endTimeFlag bool
}

func NewCreateMessageReqBodyBuilder() *CreateMessageReqBodyBuilder {
	builder := &CreateMessageReqBodyBuilder{}
	return builder
}

// 搜索关键词
//
//示例值：测试消息
func (builder *CreateMessageReqBodyBuilder) Query(query string) *CreateMessageReqBodyBuilder {
	builder.query = query
	builder.queryFlag = true
	return builder
}

// 消息来自user_id列表
//
//示例值：
func (builder *CreateMessageReqBodyBuilder) FromIds(fromIds []string) *CreateMessageReqBodyBuilder {
	builder.fromIds = fromIds
	builder.fromIdsFlag = true
	return builder
}

// 消息所在chat_id列表
//
//示例值：
func (builder *CreateMessageReqBodyBuilder) ChatIds(chatIds []string) *CreateMessageReqBodyBuilder {
	builder.chatIds = chatIds
	builder.chatIdsFlag = true
	return builder
}

// 消息类型(file/image/media)
//
//示例值：
func (builder *CreateMessageReqBodyBuilder) MessageType(messageType string) *CreateMessageReqBodyBuilder {
	builder.messageType = messageType
	builder.messageTypeFlag = true
	return builder
}

// at用户user_id列表
//
//示例值：
func (builder *CreateMessageReqBodyBuilder) AtChatterIds(atChatterIds []string) *CreateMessageReqBodyBuilder {
	builder.atChatterIds = atChatterIds
	builder.atChatterIdsFlag = true
	return builder
}

// 消息来自类型(bot/user)
//
//示例值：
func (builder *CreateMessageReqBodyBuilder) FromType(fromType string) *CreateMessageReqBodyBuilder {
	builder.fromType = fromType
	builder.fromTypeFlag = true
	return builder
}

// 会话类型(group_chat/p2p_chat)
//
//示例值：
func (builder *CreateMessageReqBodyBuilder) ChatType(chatType string) *CreateMessageReqBodyBuilder {
	builder.chatType = chatType
	builder.chatTypeFlag = true
	return builder
}

// 消息发送起始时间
//
//示例值：1609296809
func (builder *CreateMessageReqBodyBuilder) StartTime(startTime string) *CreateMessageReqBodyBuilder {
	builder.startTime = startTime
	builder.startTimeFlag = true
	return builder
}

// 消息发送结束时间
//
//示例值：1609296809
func (builder *CreateMessageReqBodyBuilder) EndTime(endTime string) *CreateMessageReqBodyBuilder {
	builder.endTime = endTime
	builder.endTimeFlag = true
	return builder
}

func (builder *CreateMessageReqBodyBuilder) Build() *CreateMessageReqBody {
	req := &CreateMessageReqBody{}
	if builder.queryFlag {
		req.Query = &builder.query
	}
	if builder.fromIdsFlag {
		req.FromIds = builder.fromIds
	}
	if builder.chatIdsFlag {
		req.ChatIds = builder.chatIds
	}
	if builder.messageTypeFlag {
		req.MessageType = &builder.messageType
	}
	if builder.atChatterIdsFlag {
		req.AtChatterIds = builder.atChatterIds
	}
	if builder.fromTypeFlag {
		req.FromType = &builder.fromType
	}
	if builder.chatTypeFlag {
		req.ChatType = &builder.chatType
	}
	if builder.startTimeFlag {
		req.StartTime = &builder.startTime
	}
	if builder.endTimeFlag {
		req.EndTime = &builder.endTime
	}
	return req
}

type CreateMessagePathReqBodyBuilder struct {
	query            string
	queryFlag        bool
	fromIds          []string
	fromIdsFlag      bool
	chatIds          []string
	chatIdsFlag      bool
	messageType      string
	messageTypeFlag  bool
	atChatterIds     []string
	atChatterIdsFlag bool
	fromType         string
	fromTypeFlag     bool
	chatType         string
	chatTypeFlag     bool
	startTime        string
	startTimeFlag    bool
	endTime          string
	endTimeFlag      bool
}

func NewCreateMessagePathReqBodyBuilder() *CreateMessagePathReqBodyBuilder {
	builder := &CreateMessagePathReqBodyBuilder{}
	return builder
}

// 搜索关键词
//
// 示例值：测试消息
func (builder *CreateMessagePathReqBodyBuilder) Query(query string) *CreateMessagePathReqBodyBuilder {
	builder.query = query
	builder.queryFlag = true
	return builder
}

// 消息来自user_id列表
//
// 示例值：
func (builder *CreateMessagePathReqBodyBuilder) FromIds(fromIds []string) *CreateMessagePathReqBodyBuilder {
	builder.fromIds = fromIds
	builder.fromIdsFlag = true
	return builder
}

// 消息所在chat_id列表
//
// 示例值：
func (builder *CreateMessagePathReqBodyBuilder) ChatIds(chatIds []string) *CreateMessagePathReqBodyBuilder {
	builder.chatIds = chatIds
	builder.chatIdsFlag = true
	return builder
}

// 消息类型(file/image/media)
//
// 示例值：
func (builder *CreateMessagePathReqBodyBuilder) MessageType(messageType string) *CreateMessagePathReqBodyBuilder {
	builder.messageType = messageType
	builder.messageTypeFlag = true
	return builder
}

// at用户user_id列表
//
// 示例值：
func (builder *CreateMessagePathReqBodyBuilder) AtChatterIds(atChatterIds []string) *CreateMessagePathReqBodyBuilder {
	builder.atChatterIds = atChatterIds
	builder.atChatterIdsFlag = true
	return builder
}

// 消息来自类型(bot/user)
//
// 示例值：
func (builder *CreateMessagePathReqBodyBuilder) FromType(fromType string) *CreateMessagePathReqBodyBuilder {
	builder.fromType = fromType
	builder.fromTypeFlag = true
	return builder
}

// 会话类型(group_chat/p2p_chat)
//
// 示例值：
func (builder *CreateMessagePathReqBodyBuilder) ChatType(chatType string) *CreateMessagePathReqBodyBuilder {
	builder.chatType = chatType
	builder.chatTypeFlag = true
	return builder
}

// 消息发送起始时间
//
// 示例值：1609296809
func (builder *CreateMessagePathReqBodyBuilder) StartTime(startTime string) *CreateMessagePathReqBodyBuilder {
	builder.startTime = startTime
	builder.startTimeFlag = true
	return builder
}

// 消息发送结束时间
//
// 示例值：1609296809
func (builder *CreateMessagePathReqBodyBuilder) EndTime(endTime string) *CreateMessagePathReqBodyBuilder {
	builder.endTime = endTime
	builder.endTimeFlag = true
	return builder
}

func (builder *CreateMessagePathReqBodyBuilder) Build() (*CreateMessageReqBody, error) {
	req := &CreateMessageReqBody{}
	if builder.queryFlag {
		req.Query = &builder.query
	}
	if builder.fromIdsFlag {
		req.FromIds = builder.fromIds
	}
	if builder.chatIdsFlag {
		req.ChatIds = builder.chatIds
	}
	if builder.messageTypeFlag {
		req.MessageType = &builder.messageType
	}
	if builder.atChatterIdsFlag {
		req.AtChatterIds = builder.atChatterIds
	}
	if builder.fromTypeFlag {
		req.FromType = &builder.fromType
	}
	if builder.chatTypeFlag {
		req.ChatType = &builder.chatType
	}
	if builder.startTimeFlag {
		req.StartTime = &builder.startTime
	}
	if builder.endTimeFlag {
		req.EndTime = &builder.endTime
	}
	return req, nil
}

type CreateMessageReqBuilder struct {
	apiReq *larkcore.ApiReq
	body   *CreateMessageReqBody
}

func NewCreateMessageReqBuilder() *CreateMessageReqBuilder {
	builder := &CreateMessageReqBuilder{}
	builder.apiReq = &larkcore.ApiReq{
		PathParams:  larkcore.PathParams{},
		QueryParams: larkcore.QueryParams{},
	}
	return builder
}

// 此次调用中使用的用户ID的类型
//
// 示例值：
func (builder *CreateMessageReqBuilder) UserIdType(userIdType string) *CreateMessageReqBuilder {
	builder.apiReq.QueryParams.Set("user_id_type", fmt.Sprint(userIdType))
	return builder
}

// 分页大小
//
// 示例值：
func (builder *CreateMessageReqBuilder) PageSize(pageSize int) *CreateMessageReqBuilder {
	builder.apiReq.QueryParams.Set("page_size", fmt.Sprint(pageSize))
	return builder
}

// 分页token
//
// 示例值：
func (builder *CreateMessageReqBuilder) PageToken(pageToken string) *CreateMessageReqBuilder {
	builder.apiReq.QueryParams.Set("page_token", fmt.Sprint(pageToken))
	return builder
}

//
func (builder *CreateMessageReqBuilder) Body(body *CreateMessageReqBody) *CreateMessageReqBuilder {
	builder.body = body
	return builder
}

func (builder *CreateMessageReqBuilder) Build() *CreateMessageReq {
	req := &CreateMessageReq{}
	req.apiReq = &larkcore.ApiReq{}
	req.apiReq.QueryParams = builder.apiReq.QueryParams
	req.apiReq.Body = builder.body
	return req
}

type CreateMessageReqBody struct {
	Query *string `json:"query,omitempty"` // 搜索关键词

	FromIds []string `json:"from_ids,omitempty"` // 消息来自user_id列表

	ChatIds []string `json:"chat_ids,omitempty"` // 消息所在chat_id列表

	MessageType *string `json:"message_type,omitempty"` // 消息类型(file/image/media)

	AtChatterIds []string `json:"at_chatter_ids,omitempty"` // at用户user_id列表

	FromType *string `json:"from_type,omitempty"` // 消息来自类型(bot/user)

	ChatType *string `json:"chat_type,omitempty"` // 会话类型(group_chat/p2p_chat)

	StartTime *string `json:"start_time,omitempty"` // 消息发送起始时间

	EndTime *string `json:"end_time,omitempty"` // 消息发送结束时间
}

type CreateMessageReq struct {
	apiReq *larkcore.ApiReq
	Body   *CreateMessageReqBody `body:""`
}

type CreateMessageRespData struct {
	Items []string `json:"items,omitempty"` // 消息id列表

	PageToken *string `json:"page_token,omitempty"` // 翻页 token，传入返回下一页，首页不需要传入

	HasMore *bool `json:"has_more,omitempty"` // 是否还有下一页
}

type CreateMessageResp struct {
	*larkcore.ApiResp `json:"-"`
	larkcore.CodeError
	Data *CreateMessageRespData `json:"data"` // 业务数据
}

func (resp *CreateMessageResp) Success() bool {
	return resp.Code == 0
}

type CreateSchemaReqBuilder struct {
	apiReq *larkcore.ApiReq
	schema *Schema
}

func NewCreateSchemaReqBuilder() *CreateSchemaReqBuilder {
	builder := &CreateSchemaReqBuilder{}
	builder.apiReq = &larkcore.ApiReq{
		PathParams:  larkcore.PathParams{},
		QueryParams: larkcore.QueryParams{},
	}
	return builder
}

// 是否只用来校验合法性
//
// 示例值：true
func (builder *CreateSchemaReqBuilder) ValidateOnly(validateOnly bool) *CreateSchemaReqBuilder {
	builder.apiReq.QueryParams.Set("validate_only", fmt.Sprint(validateOnly))
	return builder
}

// 创建一个数据范式
func (builder *CreateSchemaReqBuilder) Schema(schema *Schema) *CreateSchemaReqBuilder {
	builder.schema = schema
	return builder
}

func (builder *CreateSchemaReqBuilder) Build() *CreateSchemaReq {
	req := &CreateSchemaReq{}
	req.apiReq = &larkcore.ApiReq{}
	req.apiReq.QueryParams = builder.apiReq.QueryParams
	req.apiReq.Body = builder.schema
	return req
}

type CreateSchemaReq struct {
	apiReq *larkcore.ApiReq
	Schema *Schema `body:""`
}

type CreateSchemaRespData struct {
	Schema *Schema `json:"schema,omitempty"` // 数据范式实例
}

type CreateSchemaResp struct {
	*larkcore.ApiResp `json:"-"`
	larkcore.CodeError
	Data *CreateSchemaRespData `json:"data"` // 业务数据
}

func (resp *CreateSchemaResp) Success() bool {
	return resp.Code == 0
}

type DeleteSchemaReqBuilder struct {
	apiReq *larkcore.ApiReq
}

func NewDeleteSchemaReqBuilder() *DeleteSchemaReqBuilder {
	builder := &DeleteSchemaReqBuilder{}
	builder.apiReq = &larkcore.ApiReq{
		PathParams:  larkcore.PathParams{},
		QueryParams: larkcore.QueryParams{},
	}
	return builder
}

// 用户自定义数据范式的唯一标识
//
// 示例值：custom_schema_id
func (builder *DeleteSchemaReqBuilder) SchemaId(schemaId string) *DeleteSchemaReqBuilder {
	builder.apiReq.PathParams.Set("schema_id", fmt.Sprint(schemaId))
	return builder
}

func (builder *DeleteSchemaReqBuilder) Build() *DeleteSchemaReq {
	req := &DeleteSchemaReq{}
	req.apiReq = &larkcore.ApiReq{}
	req.apiReq.PathParams = builder.apiReq.PathParams
	return req
}

type DeleteSchemaReq struct {
	apiReq *larkcore.ApiReq
}

type DeleteSchemaResp struct {
	*larkcore.ApiResp `json:"-"`
	larkcore.CodeError
}

func (resp *DeleteSchemaResp) Success() bool {
	return resp.Code == 0
}

type GetSchemaReqBuilder struct {
	apiReq *larkcore.ApiReq
}

func NewGetSchemaReqBuilder() *GetSchemaReqBuilder {
	builder := &GetSchemaReqBuilder{}
	builder.apiReq = &larkcore.ApiReq{
		PathParams:  larkcore.PathParams{},
		QueryParams: larkcore.QueryParams{},
	}
	return builder
}

// 用户自定义数据范式的唯一标识
//
// 示例值：custom_schema_id
func (builder *GetSchemaReqBuilder) SchemaId(schemaId string) *GetSchemaReqBuilder {
	builder.apiReq.PathParams.Set("schema_id", fmt.Sprint(schemaId))
	return builder
}

func (builder *GetSchemaReqBuilder) Build() *GetSchemaReq {
	req := &GetSchemaReq{}
	req.apiReq = &larkcore.ApiReq{}
	req.apiReq.PathParams = builder.apiReq.PathParams
	return req
}

type GetSchemaReq struct {
	apiReq *larkcore.ApiReq
}

type GetSchemaRespData struct {
	Schema *Schema `json:"schema,omitempty"` // 数据范式
}

type GetSchemaResp struct {
	*larkcore.ApiResp `json:"-"`
	larkcore.CodeError
	Data *GetSchemaRespData `json:"data"` // 业务数据
}

func (resp *GetSchemaResp) Success() bool {
	return resp.Code == 0
}

type PatchSchemaReqBodyBuilder struct {
	display     *SchemaDisplay // 数据展示相关配置
	displayFlag bool

	properties     []*PatchSchemaProperty // 数据范式的属性定义
	propertiesFlag bool
}

func NewPatchSchemaReqBodyBuilder() *PatchSchemaReqBodyBuilder {
	builder := &PatchSchemaReqBodyBuilder{}
	return builder
}

// 数据展示相关配置
//
//示例值：
func (builder *PatchSchemaReqBodyBuilder) Display(display *SchemaDisplay) *PatchSchemaReqBodyBuilder {
	builder.display = display
	builder.displayFlag = true
	return builder
}

// 数据范式的属性定义
//
//示例值：
func (builder *PatchSchemaReqBodyBuilder) Properties(properties []*PatchSchemaProperty) *PatchSchemaReqBodyBuilder {
	builder.properties = properties
	builder.propertiesFlag = true
	return builder
}

func (builder *PatchSchemaReqBodyBuilder) Build() *PatchSchemaReqBody {
	req := &PatchSchemaReqBody{}
	if builder.displayFlag {
		req.Display = builder.display
	}
	if builder.propertiesFlag {
		req.Properties = builder.properties
	}
	return req
}

type PatchSchemaPathReqBodyBuilder struct {
	display        *SchemaDisplay
	displayFlag    bool
	properties     []*PatchSchemaProperty
	propertiesFlag bool
}

func NewPatchSchemaPathReqBodyBuilder() *PatchSchemaPathReqBodyBuilder {
	builder := &PatchSchemaPathReqBodyBuilder{}
	return builder
}

// 数据展示相关配置
//
// 示例值：
func (builder *PatchSchemaPathReqBodyBuilder) Display(display *SchemaDisplay) *PatchSchemaPathReqBodyBuilder {
	builder.display = display
	builder.displayFlag = true
	return builder
}

// 数据范式的属性定义
//
// 示例值：
func (builder *PatchSchemaPathReqBodyBuilder) Properties(properties []*PatchSchemaProperty) *PatchSchemaPathReqBodyBuilder {
	builder.properties = properties
	builder.propertiesFlag = true
	return builder
}

func (builder *PatchSchemaPathReqBodyBuilder) Build() (*PatchSchemaReqBody, error) {
	req := &PatchSchemaReqBody{}
	if builder.displayFlag {
		req.Display = builder.display
	}
	if builder.propertiesFlag {
		req.Properties = builder.properties
	}
	return req, nil
}

type PatchSchemaReqBuilder struct {
	apiReq *larkcore.ApiReq
	body   *PatchSchemaReqBody
}

func NewPatchSchemaReqBuilder() *PatchSchemaReqBuilder {
	builder := &PatchSchemaReqBuilder{}
	builder.apiReq = &larkcore.ApiReq{
		PathParams:  larkcore.PathParams{},
		QueryParams: larkcore.QueryParams{},
	}
	return builder
}

// 用户自定义数据范式的唯一标识
//
// 示例值：custom_schema_id
func (builder *PatchSchemaReqBuilder) SchemaId(schemaId string) *PatchSchemaReqBuilder {
	builder.apiReq.PathParams.Set("schema_id", fmt.Sprint(schemaId))
	return builder
}

// 修改数据范式
func (builder *PatchSchemaReqBuilder) Body(body *PatchSchemaReqBody) *PatchSchemaReqBuilder {
	builder.body = body
	return builder
}

func (builder *PatchSchemaReqBuilder) Build() *PatchSchemaReq {
	req := &PatchSchemaReq{}
	req.apiReq = &larkcore.ApiReq{}
	req.apiReq.PathParams = builder.apiReq.PathParams
	req.apiReq.Body = builder.body
	return req
}

type PatchSchemaReqBody struct {
	Display *SchemaDisplay `json:"display,omitempty"` // 数据展示相关配置

	Properties []*PatchSchemaProperty `json:"properties,omitempty"` // 数据范式的属性定义
}

type PatchSchemaReq struct {
	apiReq *larkcore.ApiReq
	Body   *PatchSchemaReqBody `body:""`
}

type PatchSchemaRespData struct {
	Schema *Schema `json:"schema,omitempty"` // 数据范式实例
}

type PatchSchemaResp struct {
	*larkcore.ApiResp `json:"-"`
	larkcore.CodeError
	Data *PatchSchemaRespData `json:"data"` // 业务数据
}

func (resp *PatchSchemaResp) Success() bool {
	return resp.Code == 0
}

type ListDataSourceIterator struct {
	nextPageToken *string
	items         []*DataSource
	index         int
	limit         int
	ctx           context.Context
	req           *ListDataSourceReq
	listFunc      func(ctx context.Context, req *ListDataSourceReq, options ...larkcore.RequestOptionFunc) (*ListDataSourceResp, error)
	options       []larkcore.RequestOptionFunc
	curlNum       int
}

func (iterator *ListDataSourceIterator) Next() (bool, *DataSource, error) {
	// 达到最大量，则返回
	if iterator.limit > 0 && iterator.curlNum >= iterator.limit {
		return false, nil, nil
	}

	// 为0则拉取数据
	if iterator.index == 0 || iterator.index >= len(iterator.items) {
		if iterator.index != 0 && iterator.nextPageToken == nil {
			return false, nil, nil
		}
		if iterator.nextPageToken != nil {
			iterator.req.apiReq.QueryParams.Set("page_token", *iterator.nextPageToken)
		}
		resp, err := iterator.listFunc(iterator.ctx, iterator.req, iterator.options...)
		if err != nil {
			return false, nil, err
		}

		if resp.Code != 0 {
			return false, nil, errors.New(fmt.Sprintf("Code:%d,Msg:%s", resp.Code, resp.Msg))
		}

		if len(resp.Data.Items) == 0 {
			return false, nil, nil
		}

		iterator.nextPageToken = resp.Data.PageToken
		iterator.items = resp.Data.Items
		iterator.index = 0
	}

	block := iterator.items[iterator.index]
	iterator.index++
	iterator.curlNum++
	return true, block, nil
}

func (iterator *ListDataSourceIterator) NextPageToken() *string {
	return iterator.nextPageToken
}

type SearchDocWikiIterator struct {
	nextPageToken *string
	items         []*DocResUnit
	index         int
	limit         int
	ctx           context.Context
	req           *SearchDocWikiReq
	listFunc      func(ctx context.Context, req *SearchDocWikiReq, options ...larkcore.RequestOptionFunc) (*SearchDocWikiResp, error)
	options       []larkcore.RequestOptionFunc
	curlNum       int
}

func (iterator *SearchDocWikiIterator) Next() (bool, *DocResUnit, error) {
	// 达到最大量，则返回
	if iterator.limit > 0 && iterator.curlNum >= iterator.limit {
		return false, nil, nil
	}

	// 为0则拉取数据
	if iterator.index == 0 || iterator.index >= len(iterator.items) {
		if iterator.index != 0 && iterator.nextPageToken == nil {
			return false, nil, nil
		}
		if iterator.nextPageToken != nil {
			iterator.req.apiReq.QueryParams.Set("page_token", *iterator.nextPageToken)
		}
		resp, err := iterator.listFunc(iterator.ctx, iterator.req, iterator.options...)
		if err != nil {
			return false, nil, err
		}

		if resp.Code != 0 {
			return false, nil, errors.New(fmt.Sprintf("Code:%d,Msg:%s", resp.Code, resp.Msg))
		}

		if len(resp.Data.ResUnits) == 0 {
			return false, nil, nil
		}

		iterator.nextPageToken = resp.Data.PageToken
		iterator.items = resp.Data.ResUnits
		iterator.index = 0
	}

	block := iterator.items[iterator.index]
	iterator.index++
	iterator.curlNum++
	return true, block, nil
}

func (iterator *SearchDocWikiIterator) NextPageToken() *string {
	return iterator.nextPageToken
}
