// 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"
)

// MergeSheetCell 该接口用于根据 spreadsheetToken 和维度信息合并单元格；单次操作不超过5000行, 100列。
//
// doc: https://open.feishu.cn/document/ukTMukTMukTM/ukDNzUjL5QzM14SO0MTN
// new doc: https://open.feishu.cn/document/server-docs/docs/sheets-v3/data-operation/merge-cells
func (r *DriveService) MergeSheetCell(ctx context.Context, request *MergeSheetCellReq, options ...MethodOptionFunc) (*MergeSheetCellResp, *Response, error) {
	if r.cli.mock.mockDriveMergeSheetCell != nil {
		r.cli.Log(ctx, LogLevelDebug, "[lark] Drive#MergeSheetCell mock enable")
		return r.cli.mock.mockDriveMergeSheetCell(ctx, request, options...)
	}

	req := &RawRequestReq{
		Scope:                 "Drive",
		API:                   "MergeSheetCell",
		Method:                "POST",
		URL:                   r.cli.openBaseURL + "/open-apis/sheets/v2/spreadsheets/:spreadsheetToken/merge_cells",
		Body:                  request,
		MethodOption:          newMethodOption(options),
		NeedTenantAccessToken: true,
		NeedUserAccessToken:   true,
	}
	resp := new(mergeSheetCellResp)

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

// MockDriveMergeSheetCell mock DriveMergeSheetCell method
func (r *Mock) MockDriveMergeSheetCell(f func(ctx context.Context, request *MergeSheetCellReq, options ...MethodOptionFunc) (*MergeSheetCellResp, *Response, error)) {
	r.mockDriveMergeSheetCell = f
}

// UnMockDriveMergeSheetCell un-mock DriveMergeSheetCell method
func (r *Mock) UnMockDriveMergeSheetCell() {
	r.mockDriveMergeSheetCell = nil
}

// MergeSheetCellReq ...
type MergeSheetCellReq struct {
	SpreadSheetToken string `path:"spreadsheetToken" json:"-"` // spreadsheet 的 token, 获取方式见[在线表格开发指南](https://open.feishu.cn/document/ukTMukTMukTM/uATMzUjLwEzM14CMxMTN/overview)
	Range            string `json:"range,omitempty"`           // 查询范围, 包含 sheetId 与单元格范围两部分, 目前支持四种索引方式, 详见 [在线表格开发指南](https://open.feishu.cn/document/ukTMukTMukTM/uATMzUjLwEzM14CMxMTN/overview)
	MergeType        string `json:"mergeType,omitempty"`       // 可选三个类型, "MERGE_ALL"  将所选区域直接合并、"MERGE_ROWS"  将所选区域按行合并、"MERGE_COLUMNS"  将所选区域按列合并响应
}

// MergeSheetCellResp ...
type MergeSheetCellResp struct {
	SpreadSheetToken string `json:"spreadsheetToken,omitempty"` // spreadsheet 的 token
}

// mergeSheetCellResp ...
type mergeSheetCellResp struct {
	Code int64               `json:"code,omitempty"`
	Msg  string              `json:"msg,omitempty"`
	Data *MergeSheetCellResp `json:"data,omitempty"`
}
