// Code generated by lark_sdk_gen. DO NOT EDIT.
/**
 * Copyright 2022 chyroc
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package lark

import (
	"context"
)

// UpdateSheetFilter 更新子表筛选范围中的列筛选条件。
//
// 参数值可参考[筛选指南](https://open.feishu.cn/document/ukTMukTMukTM/uUDN04SN0QjL1QDN/sheets-v3/spreadsheet-sheet-filter/filter-user-guide)
//
// doc: https://open.feishu.cn/document/ukTMukTMukTM/uUDN04SN0QjL1QDN/sheets-v3/spreadsheet-sheet-filter/update
// new doc: https://open.feishu.cn/document/server-docs/docs/sheets-v3/spreadsheet-sheet-filter/update
func (r *DriveService) UpdateSheetFilter(ctx context.Context, request *UpdateSheetFilterReq, options ...MethodOptionFunc) (*UpdateSheetFilterResp, *Response, error) {
	if r.cli.mock.mockDriveUpdateSheetFilter != nil {
		r.cli.Log(ctx, LogLevelDebug, "[lark] Drive#UpdateSheetFilter mock enable")
		return r.cli.mock.mockDriveUpdateSheetFilter(ctx, request, options...)
	}

	req := &RawRequestReq{
		Scope:                 "Drive",
		API:                   "UpdateSheetFilter",
		Method:                "PUT",
		URL:                   r.cli.openBaseURL + "/open-apis/sheets/v3/spreadsheets/:spreadsheet_token/sheets/:sheet_id/filter",
		Body:                  request,
		MethodOption:          newMethodOption(options),
		NeedTenantAccessToken: true,
		NeedUserAccessToken:   true,
	}
	resp := new(updateSheetFilterResp)

	response, err := r.cli.RawRequest(ctx, req, resp)
	return resp.Data, response, err
}

// MockDriveUpdateSheetFilter mock DriveUpdateSheetFilter method
func (r *Mock) MockDriveUpdateSheetFilter(f func(ctx context.Context, request *UpdateSheetFilterReq, options ...MethodOptionFunc) (*UpdateSheetFilterResp, *Response, error)) {
	r.mockDriveUpdateSheetFilter = f
}

// UnMockDriveUpdateSheetFilter un-mock DriveUpdateSheetFilter method
func (r *Mock) UnMockDriveUpdateSheetFilter() {
	r.mockDriveUpdateSheetFilter = nil
}

// UpdateSheetFilterReq ...
type UpdateSheetFilterReq struct {
	SpreadSheetToken string                         `path:"spreadsheet_token" json:"-"` // 表格 token, 示例值: "shtcnmBA\*yGehy8"
	SheetID          string                         `path:"sheet_id" json:"-"`          // 子表 id, 示例值: "0b\**12"
	Col              string                         `json:"col,omitempty"`              // 更新筛选条件的列, 示例值: "E"
	Condition        *UpdateSheetFilterReqCondition `json:"condition,omitempty"`        // 筛选条件
}

// UpdateSheetFilterReqCondition ...
type UpdateSheetFilterReqCondition struct {
	FilterType  string   `json:"filter_type,omitempty"`  // 筛选类型, 示例值: "number"
	CompareType *string  `json:"compare_type,omitempty"` // 比较类型, 示例值: "less"
	Expected    []string `json:"expected,omitempty"`     // 筛选参数, 示例值: 6
}

// UpdateSheetFilterResp ...
type UpdateSheetFilterResp struct {
}

// updateSheetFilterResp ...
type updateSheetFilterResp struct {
	Code  int64                  `json:"code,omitempty"` // 错误码, 非 0 表示失败
	Msg   string                 `json:"msg,omitempty"`  // 错误描述
	Data  *UpdateSheetFilterResp `json:"data,omitempty"`
	Error *ErrorDetail           `json:"error,omitempty"`
}
