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

// BatchGetSheetValue 该接口用于根据 spreadsheetToken 和 ranges 读取表格多个范围的值, 返回数据限制为10M。
//
// doc: https://open.feishu.cn/document/ukTMukTMukTM/ukTMzUjL5EzM14SOxMTN
// new doc: https://open.feishu.cn/document/server-docs/docs/sheets-v3/data-operation/reading-multiple-ranges
func (r *DriveService) BatchGetSheetValue(ctx context.Context, request *BatchGetSheetValueReq, options ...MethodOptionFunc) (*BatchGetSheetValueResp, *Response, error) {
	if r.cli.mock.mockDriveBatchGetSheetValue != nil {
		r.cli.Log(ctx, LogLevelDebug, "[lark] Drive#BatchGetSheetValue mock enable")
		return r.cli.mock.mockDriveBatchGetSheetValue(ctx, request, options...)
	}

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

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

// MockDriveBatchGetSheetValue mock DriveBatchGetSheetValue method
func (r *Mock) MockDriveBatchGetSheetValue(f func(ctx context.Context, request *BatchGetSheetValueReq, options ...MethodOptionFunc) (*BatchGetSheetValueResp, *Response, error)) {
	r.mockDriveBatchGetSheetValue = f
}

// UnMockDriveBatchGetSheetValue un-mock DriveBatchGetSheetValue method
func (r *Mock) UnMockDriveBatchGetSheetValue() {
	r.mockDriveBatchGetSheetValue = nil
}

// BatchGetSheetValueReq ...
type BatchGetSheetValueReq struct {
	SpreadSheetToken     string   `path:"spreadsheetToken" json:"-"`      // spreadsheet 的 token, 获取方式见[在线表格开发指南](https://open.feishu.cn/document/ukTMukTMukTM/uATMzUjLwEzM14CMxMTN/overview)
	Ranges               []string `query:"ranges" json:"-"`               // 多个查询范围, 范围之间使用逗号分隔, 如range1, range2。⁣其中 range 包含 sheetId 与单元格范围两部分, 目前支持四种索引方式, 详见 [在线表格开发指南](https://open.feishu.cn/document/ukTMukTMukTM/uATMzUjLwEzM14CMxMTN/overview) 。若查询范围中使用形如<sheetId>!<开始单元格>:<结束列>的范围时, 仅支持获取100列数据。
	ValueRenderOption    *string  `query:"valueRenderOption" json:"-"`    // valueRenderOption=ToString 可返回纯文本的值(数值类型除外)；valueRenderOption=FormattedValue 计算并格式化单元格；valueRenderOption=Formula单元格中含有公式时返回公式本身；valueRenderOption=UnformattedValue计算但不对单元格进行格式化
	DateTimeRenderOption *string  `query:"dateTimeRenderOption" json:"-"` // dateTimeRenderOption=FormattedString 计算并将时间日期按照其格式进行格式化, 但不会对数字进行格式化, 返回格式化后的字符串。详见[电子表格常见问题](https://open.feishu.cn/document/ukTMukTMukTM/uATMzUjLwEzM14CMxMTN/guide/sheets-faq)
	UserIDType           *IDType  `query:"user_id_type" json:"-"`         // 返回的用户id类型, 可选open_id, union_id
}

// BatchGetSheetValueResp ...
type BatchGetSheetValueResp struct {
	Revision         int64                               `json:"revision,omitempty"`         // sheet 的版本号
	SpreadSheetToken string                              `json:"spreadsheetToken,omitempty"` // spreadsheet 的 token, 详见[在线表格开发指南](https://open.feishu.cn/document/ukTMukTMukTM/uATMzUjLwEzM14CMxMTN/overview)
	TotalCells       int64                               `json:"totalCells,omitempty"`       // 读取的单元格总数
	ValueRanges      []*BatchGetSheetValueRespValueRange `json:"valueRanges,omitempty"`      // 值与范围
}

// BatchGetSheetValueRespValueRange ...
type BatchGetSheetValueRespValueRange struct {
	MajorDimension string           `json:"majorDimension,omitempty"` // 插入维度
	Range          string           `json:"range,omitempty"`          // 返回数据的范围, 为空时表示查询范围没有数据
	Revision       int64            `json:"revision,omitempty"`       // sheet 的版本号
	Values         [][]SheetContent `json:"values,omitempty"`         // 查询得到的值
}

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